From 749597dc1d21dce46fb94bfbe34cdb20ec1d9ab3 Mon Sep 17 00:00:00 2001 From: Eric Joyner Date: Tue, 24 Sep 2019 17:06:32 +0000 Subject: [PATCH] ix, ixv: Read msix_bar from device configuration Instead of predicting the MSI-X bar index based on the device's MAC type, read it from the device's PCI configuration instead. PR: 239704 Submitted by: Piotr Pietruszewski Reviewed by: erj@ MFC after: 3 days Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D21547 --- sys/dev/ixgbe/if_ix.c | 5 +++-- sys/dev/ixgbe/if_ixv.c | 2 +- sys/dev/ixgbe/ixgbe.h | 2 -- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 9c61c9a2407..de76ca7f443 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -1012,12 +1012,13 @@ ixgbe_if_attach_pre(if_ctx_t ctx) CSUM_IP6_TCP | CSUM_IP6_UDP | CSUM_IP6_TSO; if (adapter->hw.mac.type == ixgbe_mac_82598EB) { scctx->isc_tx_nsegments = IXGBE_82598_SCATTER; - scctx->isc_msix_bar = PCIR_BAR(MSIX_82598_BAR); } else { scctx->isc_tx_csum_flags |= CSUM_SCTP |CSUM_IP6_SCTP; scctx->isc_tx_nsegments = IXGBE_82599_SCATTER; - scctx->isc_msix_bar = PCIR_BAR(MSIX_82599_BAR); } + + scctx->isc_msix_bar = pci_msix_table_bar(dev); + scctx->isc_tx_tso_segments_max = scctx->isc_tx_nsegments; scctx->isc_tx_tso_size_max = IXGBE_TSO_SIZE; scctx->isc_tx_tso_segsize_max = PAGE_SIZE; diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index cfc824dd7f8..5e98e8a445b 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -494,7 +494,7 @@ ixv_if_attach_pre(if_ctx_t ctx) scctx->isc_tx_csum_flags = CSUM_IP | CSUM_TCP | CSUM_UDP | CSUM_TSO | CSUM_IP6_TCP | CSUM_IP6_UDP | CSUM_IP6_TSO; scctx->isc_tx_nsegments = IXGBE_82599_SCATTER; - scctx->isc_msix_bar = PCIR_BAR(MSIX_82598_BAR); + scctx->isc_msix_bar = pci_msix_table_bar(dev); scctx->isc_tx_tso_segments_max = scctx->isc_tx_nsegments; scctx->isc_tx_tso_size_max = IXGBE_TSO_SIZE; scctx->isc_tx_tso_segsize_max = PAGE_SIZE; diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h index 4261d1e36b8..1502c7fb866 100644 --- a/sys/dev/ixgbe/ixgbe.h +++ b/sys/dev/ixgbe/ixgbe.h @@ -189,8 +189,6 @@ #define MAX_NUM_MULTICAST_ADDRESSES 128 #define IXGBE_82598_SCATTER 100 #define IXGBE_82599_SCATTER 32 -#define MSIX_82598_BAR 3 -#define MSIX_82599_BAR 4 #define IXGBE_TSO_SIZE 262140 #define IXGBE_RX_HDR 128 #define IXGBE_VFTA_SIZE 128