FreeBSD Bugzilla – Attachment 229767 Details for
Bug 260068
e1000 & igb in netmap mode removes VLAN headers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to fix the issue
vlan.patch (text/plain), 7.58 KB, created by
Vincenzo Maffione
on 2021-11-28 18:11:46 UTC
(
hide
)
Description:
Patch to fix the issue
Filename:
MIME Type:
Creator:
Vincenzo Maffione
Created:
2021-11-28 18:11:46 UTC
Size:
7.58 KB
patch
obsolete
>diff --git a/sys/dev/e1000/em_txrx.c b/sys/dev/e1000/em_txrx.c >index 6ac66a901..4ea8fd7f9 100644 >--- a/sys/dev/e1000/em_txrx.c >+++ b/sys/dev/e1000/em_txrx.c >@@ -665,6 +665,7 @@ em_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) > if_softc_ctx_t scctx = sc->shared; > struct em_rx_queue *que = &sc->rx_queues[ri->iri_qsidx]; > struct rx_ring *rxr = &que->rxr; >+ struct ifnet *ifp = iflib_get_ifp(sc->ctx); > union e1000_rx_desc_extended *rxd; > > u16 len; >@@ -706,7 +707,8 @@ em_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) > i++; > } while (!eop); > >- em_receive_checksum(staterr, staterr >> 24, ri); >+ if (if_getcapenable(ifp) & IFCAP_RXCSUM) >+ em_receive_checksum(staterr, staterr >> 24, ri); > > if (staterr & E1000_RXD_STAT_VP) { > vtag = le16toh(rxd->wb.upper.vlan); >diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c >index b3775b351..3e828fd6b 100644 >--- a/sys/dev/e1000/if_em.c >+++ b/sys/dev/e1000/if_em.c >@@ -297,12 +297,12 @@ static void em_if_debug(if_ctx_t); > static void em_update_stats_counters(struct e1000_softc *); > static void em_add_hw_stats(struct e1000_softc *); > static int em_if_set_promisc(if_ctx_t, int); >-static bool em_if_vlan_filter_capable(struct e1000_softc *); >-static bool em_if_vlan_filter_used(struct e1000_softc *); >+static bool em_if_vlan_filter_capable(if_ctx_t); >+static bool em_if_vlan_filter_used(if_ctx_t); > static void em_if_vlan_filter_enable(struct e1000_softc *); > static void em_if_vlan_filter_disable(struct e1000_softc *); > static void em_if_vlan_filter_write(struct e1000_softc *); >-static void em_setup_vlan_hw_support(struct e1000_softc *); >+static void em_setup_vlan_hw_support(if_ctx_t ctx); > static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); > static void em_print_nvm_info(struct e1000_softc *); > static void em_fw_version_locked(if_ctx_t); >@@ -915,16 +915,18 @@ em_if_attach_pre(if_ctx_t ctx) > scctx->isc_rxd_size[0] = sizeof(struct e1000_rx_desc); > scctx->isc_tx_csum_flags = CSUM_TCP | CSUM_UDP; > scctx->isc_txrx = &lem_txrx; >- scctx->isc_capabilities = scctx->isc_capenable = LEM_CAPS; >+ scctx->isc_capabilities = LEM_CAPS; > if (hw->mac.type < e1000_82543) >- scctx->isc_capenable &= ~(IFCAP_HWCSUM|IFCAP_VLAN_HWCSUM); >+ scctx->isc_capabilities &= ~(IFCAP_HWCSUM|IFCAP_VLAN_HWCSUM); > /* 82541ER doesn't do HW tagging */ > if (hw->device_id == E1000_DEV_ID_82541ER || hw->device_id == E1000_DEV_ID_82541ER_LOM) >- scctx->isc_capenable &= ~IFCAP_VLAN_HWTAGGING; >+ scctx->isc_capabilities &= ~IFCAP_VLAN_HWTAGGING; > /* INTx only */ > scctx->isc_msix_bar = 0; >+ scctx->isc_capenable = scctx->isc_capabilities; > } > >+ > /* Setup PCI resources */ > if (em_allocate_pci_resources(ctx)) { > device_printf(dev, "Allocation of PCI resources failed\n"); >@@ -1356,7 +1358,7 @@ em_if_init(if_ctx_t ctx) > em_initialize_receive_unit(ctx); > > /* Set up VLAN support and filter */ >- em_setup_vlan_hw_support(sc); >+ em_setup_vlan_hw_support(ctx); > > /* Don't lose promiscuous settings */ > em_if_set_promisc(ctx, if_getflags(ifp)); >@@ -1683,7 +1685,7 @@ em_if_set_promisc(if_ctx_t ctx, int flags) > reg_rctl &= ~E1000_RCTL_UPE; > E1000_WRITE_REG(&sc->hw, E1000_RCTL, reg_rctl); > } >- if (em_if_vlan_filter_used(sc)) >+ if (em_if_vlan_filter_used(ctx)) > em_if_vlan_filter_enable(sc); > } > return (0); >@@ -3242,12 +3244,12 @@ em_initialize_receive_unit(if_ctx_t ctx) > > /* Set up L3 and L4 csum Rx descriptor offloads */ > rxcsum = E1000_READ_REG(hw, E1000_RXCSUM); >- if (scctx->isc_capenable & IFCAP_RXCSUM) { >+ if (if_getcapenable(ifp) & IFCAP_RXCSUM) { > rxcsum |= E1000_RXCSUM_TUOFL | E1000_RXCSUM_IPOFL; > if (hw->mac.type > e1000_82575) > rxcsum |= E1000_RXCSUM_CRCOFL; > else if (hw->mac.type < em_mac_min && >- scctx->isc_capenable & IFCAP_HWCSUM_IPV6) >+ if_getcapenable(ifp) & IFCAP_HWCSUM_IPV6) > rxcsum |= E1000_RXCSUM_IPV6OFL; > } else { > rxcsum &= ~(E1000_RXCSUM_IPOFL | E1000_RXCSUM_TUOFL); >@@ -3441,11 +3443,11 @@ em_if_vlan_unregister(if_ctx_t ctx, u16 vtag) > } > > static bool >-em_if_vlan_filter_capable(struct e1000_softc *sc) >+em_if_vlan_filter_capable(if_ctx_t ctx) > { >- if_softc_ctx_t scctx = sc->shared; >+ if_t ifp = iflib_get_ifp(ctx); > >- if ((scctx->isc_capenable & IFCAP_VLAN_HWFILTER) && >+ if ((if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) && > !em_disable_crc_stripping) > return (true); > >@@ -3453,9 +3455,11 @@ em_if_vlan_filter_capable(struct e1000_softc *sc) > } > > static bool >-em_if_vlan_filter_used(struct e1000_softc *sc) >+em_if_vlan_filter_used(if_ctx_t ctx) > { >- if (!em_if_vlan_filter_capable(sc)) >+ struct e1000_softc *sc = iflib_get_softc(ctx); >+ >+ if (!em_if_vlan_filter_capable(ctx)) > return (false); > > for (int i = 0; i < EM_VFTA_SIZE; i++) >@@ -3515,10 +3519,11 @@ em_if_vlan_filter_write(struct e1000_softc *sc) > } > > static void >-em_setup_vlan_hw_support(struct e1000_softc *sc) >+em_setup_vlan_hw_support(if_ctx_t ctx) > { >- if_softc_ctx_t scctx = sc->shared; >+ struct e1000_softc *sc = iflib_get_softc(ctx); > struct e1000_hw *hw = &sc->hw; >+ struct ifnet *ifp = iflib_get_ifp(ctx); > u32 reg; > > /* XXXKB: Return early if we are a VF until VF decap and filter management >@@ -3527,7 +3532,7 @@ em_setup_vlan_hw_support(struct e1000_softc *sc) > if (sc->vf_ifp) > return; > >- if (scctx->isc_capenable & IFCAP_VLAN_HWTAGGING && >+ if (if_getcapenable(ifp) & IFCAP_VLAN_HWTAGGING && > !em_disable_crc_stripping) { > reg = E1000_READ_REG(hw, E1000_CTRL); > reg |= E1000_CTRL_VME; >@@ -3539,7 +3544,7 @@ em_setup_vlan_hw_support(struct e1000_softc *sc) > } > > /* If we aren't doing HW filtering, we're done */ >- if (!em_if_vlan_filter_capable(sc)) { >+ if (!em_if_vlan_filter_capable(ctx)) { > em_if_vlan_filter_disable(sc); > return; > } >diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h >index 33ba22a88..ed5a88013 100644 >--- a/sys/dev/e1000/if_em.h >+++ b/sys/dev/e1000/if_em.h >@@ -439,7 +439,6 @@ struct em_rx_queue { > > /* Our softc structure */ > struct e1000_softc { >- struct ifnet *ifp; > struct e1000_hw hw; > > if_softc_ctx_t shared; >diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c >index 548ceee8a..7620371af 100644 >--- a/sys/dev/e1000/igb_txrx.c >+++ b/sys/dev/e1000/igb_txrx.c >@@ -434,6 +434,7 @@ igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) > if_softc_ctx_t scctx = sc->shared; > struct em_rx_queue *que = &sc->rx_queues[ri->iri_qsidx]; > struct rx_ring *rxr = &que->rxr; >+ struct ifnet *ifp = iflib_get_ifp(sc->ctx); > union e1000_adv_rx_desc *rxd; > > uint16_t pkt_info, len, vtag; >@@ -460,12 +461,14 @@ igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) > rxd->wb.upper.status_error = 0; > eop = ((staterr & E1000_RXD_STAT_EOP) == E1000_RXD_STAT_EOP); > >- if (((sc->hw.mac.type == e1000_i350) || >- (sc->hw.mac.type == e1000_i354)) && >- (staterr & E1000_RXDEXT_STATERR_LB)) >- vtag = be16toh(rxd->wb.upper.vlan); >- else >- vtag = le16toh(rxd->wb.upper.vlan); >+ if ((staterr & E1000_RXD_STAT_VP) != 0) { >+ if (((sc->hw.mac.type == e1000_i350) || >+ (sc->hw.mac.type == e1000_i354)) && >+ (staterr & E1000_RXDEXT_STATERR_LB)) >+ vtag = be16toh(rxd->wb.upper.vlan); >+ else >+ vtag = le16toh(rxd->wb.upper.vlan); >+ } > > /* Make sure bad packets are discarded */ > if (eop && ((staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) != 0)) { >@@ -492,14 +495,12 @@ igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) > > rxr->rx_packets++; > >- if ((scctx->isc_capenable & IFCAP_RXCSUM) != 0) >+ if ((if_getcapenable(ifp) & IFCAP_RXCSUM) != 0) > igb_rx_checksum(staterr, ri, ptype); > >- if ((scctx->isc_capenable & IFCAP_VLAN_HWTAGGING) != 0 && >- (staterr & E1000_RXD_STAT_VP) != 0) { >- ri->iri_vtag = vtag; >+ ri->iri_vtag = vtag; >+ if (vtag) > ri->iri_flags |= M_VLANTAG; >- } > > ri->iri_flowid = > le32toh(rxd->wb.lower.hi_dword.rss);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 260068
: 229767