diff options
author | Eric Joyner <erj@FreeBSD.org> | 2018-09-11 18:33:43 +0000 |
---|---|---|
committer | Eric Joyner <erj@FreeBSD.org> | 2018-09-11 18:33:43 +0000 |
commit | de35521a3bbfa50aa7c6dc6852a78099254da094 (patch) | |
tree | bad0afb70db62fd23be3963a0414e67c59f25213 /sys/dev | |
parent | 26dfa867d2471e33f8efdd66bafb17d6da2848a9 (diff) | |
download | src-de35521a3bbfa50aa7c6dc6852a78099254da094.tar.gz src-de35521a3bbfa50aa7c6dc6852a78099254da094.zip |
ix(4), ixv(4): VLAN tag stripping fixes for Amazon EC2 Enhanced Networking
From Piotr:
ix(4), ixv(4): Add VLAN tag strip check when receiving packets
ixv(4): Fix support for VLAN_HWTAGGING and VLAN_HWFILTER flags
This change will prevent driver from passing VLAN tags when
interface configuration is not expecting them. VF driver will
check for VLAN_HWTAGGING and VLAN_HWFILTER flags and act adequately.
This patch resolves problem occuring on EC2 platforms.
Submitted by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reported by: cperciva@
Reviewed by: cperciva@, Intel Networking
Approved by: re
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D17061
Notes
Notes:
svn path=/head/; revision=338593
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ixgbe/if_ixv.c | 30 | ||||
-rw-r--r-- | sys/dev/ixgbe/ix_txrx.c | 3 |
2 files changed, 22 insertions, 11 deletions
diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index e1fb720511fb..a6a3465b60d7 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -1470,6 +1470,7 @@ ixv_initialize_receive_units(if_ctx_t ctx) static void ixv_setup_vlan_support(if_ctx_t ctx) { + struct ifnet *ifp = iflib_get_ifp(ctx); struct adapter *adapter = iflib_get_softc(ctx); struct ixgbe_hw *hw = &adapter->hw; u32 ctrl, vid, vfta, retry; @@ -1483,19 +1484,28 @@ ixv_setup_vlan_support(if_ctx_t ctx) if (adapter->num_vlans == 0) return; - /* Enable the queues */ - for (int i = 0; i < adapter->num_rx_queues; i++) { - ctrl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(i)); - ctrl |= IXGBE_RXDCTL_VME; - IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), ctrl); - /* - * Let Rx path know that it needs to store VLAN tag - * as part of extra mbuf info. - */ - adapter->rx_queues[i].rxr.vtag_strip = TRUE; + if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { + /* Enable the queues */ + for (int i = 0; i < adapter->num_rx_queues; i++) { + ctrl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(i)); + ctrl |= IXGBE_RXDCTL_VME; + IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), ctrl); + /* + * Let Rx path know that it needs to store VLAN tag + * as part of extra mbuf info. + */ + adapter->rx_queues[i].rxr.vtag_strip = TRUE; + } } /* + * If filtering VLAN tags is disabled, + * there is no need to fill VLAN Filter Table Array (VFTA). + */ + if ((ifp->if_capenable & IFCAP_VLAN_HWFILTER) == 0) + return; + + /* * A soft reset zero's out the VFTA, so * we need to repopulate it now. */ diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c index 3fef6c5889d1..91c92c56a6df 100644 --- a/sys/dev/ixgbe/ix_txrx.c +++ b/sys/dev/ixgbe/ix_txrx.c @@ -430,7 +430,8 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) rxd->wb.upper.status_error = 0; eop = ((staterr & IXGBE_RXD_STAT_EOP) != 0); - if (staterr & IXGBE_RXD_STAT_VP) { + + if ( (rxr->vtag_strip) && (staterr & IXGBE_RXD_STAT_VP) ) { vtag = le16toh(rxd->wb.upper.vlan); } else { vtag = 0; |