Skip to content

Commit bf456ab

Browse files
Alexander DuyckJeff Kirsher
authored andcommitted
igb: Add workaround for VLAN tag stripping on 82576
There was a workaround partially implemented for the 82576 that is needed in order for VLAN tag stripping to function correctly. The original code had side effects that would make it so the workaround was active on all MACs. I have updated the code so that the workaround is enabled, but limited to the 82576, or activated if we exceed the available unicast addresses. The workaround has a side effect of mirroring all of the traffic outgoing from the VFs back to the PF. As such it is not recommended to use the 82576 in promiscuous mode as it will take a performance hit, though this is now consistent with the performance as seen on the out-of-tree igb driver. I also limited the scope of the UTA bits all being set to only when the VMOLR register is enabled. This should limit the effects of the UTA register so that we don't pick up any excess traffic unless promiscuous mode has been enabled on the PF, whereas before the PF would have ended up in something equivalent to unicast promiscuous mode with VLAN filtering otherwise. Signed-off-by: Alexander Duyck <aduyck@mirantis.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 268f9d3 commit bf456ab

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

drivers/net/ethernet/intel/igb/e1000_82575.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,8 @@ static s32 igb_init_mac_params_82575(struct e1000_hw *hw)
425425

426426
/* Set mta register count */
427427
mac->mta_reg_count = 128;
428+
/* Set uta register count */
429+
mac->uta_reg_count = (hw->mac.type == e1000_82575) ? 0 : 128;
428430
/* Set rar entry count */
429431
switch (mac->type) {
430432
case e1000_82576:

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ static struct rtnl_link_stats64 *igb_get_stats64(struct net_device *dev,
140140
struct rtnl_link_stats64 *stats);
141141
static int igb_change_mtu(struct net_device *, int);
142142
static int igb_set_mac(struct net_device *, void *);
143-
static void igb_set_uta(struct igb_adapter *adapter);
143+
static void igb_set_uta(struct igb_adapter *adapter, bool set);
144144
static irqreturn_t igb_intr(int irq, void *);
145145
static irqreturn_t igb_intr_msi(int irq, void *);
146146
static irqreturn_t igb_msix_other(int irq, void *);
@@ -3670,9 +3670,6 @@ static void igb_configure_rx(struct igb_adapter *adapter)
36703670
{
36713671
int i;
36723672

3673-
/* set UTA to appropriate mode */
3674-
igb_set_uta(adapter);
3675-
36763673
/* set the correct pool for the PF default MAC address in entry 0 */
36773674
igb_rar_set_qsel(adapter, adapter->hw.mac.addr, 0,
36783675
adapter->vfs_allocated_count);
@@ -4134,7 +4131,11 @@ static void igb_set_rx_mode(struct net_device *netdev)
41344131
/* Check for Promiscuous and All Multicast modes */
41354132
if (netdev->flags & IFF_PROMISC) {
41364133
rctl |= E1000_RCTL_UPE | E1000_RCTL_MPE;
4137-
vmolr |= E1000_VMOLR_ROPE | E1000_VMOLR_MPME;
4134+
vmolr |= E1000_VMOLR_MPME;
4135+
4136+
/* enable use of UTA filter to force packets to default pool */
4137+
if (hw->mac.type == e1000_82576)
4138+
vmolr |= E1000_VMOLR_ROPE;
41384139
} else {
41394140
if (netdev->flags & IFF_ALLMULTI) {
41404141
rctl |= E1000_RCTL_MPE;
@@ -4190,6 +4191,9 @@ static void igb_set_rx_mode(struct net_device *netdev)
41904191
if ((hw->mac.type < e1000_82576) || (hw->mac.type > e1000_i350))
41914192
return;
41924193

4194+
/* set UTA to appropriate mode */
4195+
igb_set_uta(adapter, !!(vmolr & E1000_VMOLR_ROPE));
4196+
41934197
vmolr |= rd32(E1000_VMOLR(vfn)) &
41944198
~(E1000_VMOLR_ROPE | E1000_VMOLR_MPME | E1000_VMOLR_ROMPE);
41954199

@@ -6323,28 +6327,26 @@ static void igb_msg_task(struct igb_adapter *adapter)
63236327
/**
63246328
* igb_set_uta - Set unicast filter table address
63256329
* @adapter: board private structure
6330+
* @set: boolean indicating if we are setting or clearing bits
63266331
*
63276332
* The unicast table address is a register array of 32-bit registers.
63286333
* The table is meant to be used in a way similar to how the MTA is used
63296334
* however due to certain limitations in the hardware it is necessary to
63306335
* set all the hash bits to 1 and use the VMOLR ROPE bit as a promiscuous
63316336
* enable bit to allow vlan tag stripping when promiscuous mode is enabled
63326337
**/
6333-
static void igb_set_uta(struct igb_adapter *adapter)
6338+
static void igb_set_uta(struct igb_adapter *adapter, bool set)
63346339
{
63356340
struct e1000_hw *hw = &adapter->hw;
6341+
u32 uta = set ? ~0 : 0;
63366342
int i;
63376343

6338-
/* The UTA table only exists on 82576 hardware and newer */
6339-
if (hw->mac.type < e1000_82576)
6340-
return;
6341-
63426344
/* we only need to do this if VMDq is enabled */
63436345
if (!adapter->vfs_allocated_count)
63446346
return;
63456347

6346-
for (i = 0; i < hw->mac.uta_reg_count; i++)
6347-
array_wr32(E1000_UTA, i, ~0);
6348+
for (i = hw->mac.uta_reg_count; i--;)
6349+
array_wr32(E1000_UTA, i, uta);
63486350
}
63496351

63506352
/**

0 commit comments

Comments
 (0)