Skip to content

Commit 0c5a616

Browse files
Alexander DuyckJeff Kirsher
authored andcommitted
ixgbe: Add support for toggling VLAN filtering flag via ethtool
This change makes it so that we can use the ethtool rx-vlan-filter flag to toggle Rx VLAN filtering on and off. This is basically just an extension of the existing VLAN promisc work in that it just adds support for the additional ethtool flag. Signed-off-by: Alexander Duyck <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 4ae7834 commit 0c5a616

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4447,6 +4447,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
44474447
struct ixgbe_adapter *adapter = netdev_priv(netdev);
44484448
struct ixgbe_hw *hw = &adapter->hw;
44494449
u32 fctrl, vmolr = IXGBE_VMOLR_BAM | IXGBE_VMOLR_AUPE;
4450+
netdev_features_t features = netdev->features;
44504451
int count;
44514452

44524453
/* Check for Promiscuous and All Multicast modes */
@@ -4464,14 +4465,13 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
44644465
hw->addr_ctrl.user_set_promisc = true;
44654466
fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
44664467
vmolr |= IXGBE_VMOLR_MPE;
4467-
ixgbe_vlan_promisc_enable(adapter);
4468+
features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
44684469
} else {
44694470
if (netdev->flags & IFF_ALLMULTI) {
44704471
fctrl |= IXGBE_FCTRL_MPE;
44714472
vmolr |= IXGBE_VMOLR_MPE;
44724473
}
44734474
hw->addr_ctrl.user_set_promisc = false;
4474-
ixgbe_vlan_promisc_disable(adapter);
44754475
}
44764476

44774477
/*
@@ -4504,7 +4504,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
45044504
}
45054505

45064506
/* This is useful for sniffing bad packets. */
4507-
if (adapter->netdev->features & NETIF_F_RXALL) {
4507+
if (features & NETIF_F_RXALL) {
45084508
/* UPE and MPE will be handled by normal PROMISC logic
45094509
* in e1000e_set_rx_mode */
45104510
fctrl |= (IXGBE_FCTRL_SBP | /* Receive bad packets */
@@ -4517,10 +4517,15 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
45174517

45184518
IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
45194519

4520-
if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
4520+
if (features & NETIF_F_HW_VLAN_CTAG_RX)
45214521
ixgbe_vlan_strip_enable(adapter);
45224522
else
45234523
ixgbe_vlan_strip_disable(adapter);
4524+
4525+
if (features & NETIF_F_HW_VLAN_CTAG_FILTER)
4526+
ixgbe_vlan_promisc_disable(adapter);
4527+
else
4528+
ixgbe_vlan_promisc_enable(adapter);
45244529
}
45254530

45264531
static void ixgbe_napi_enable_all(struct ixgbe_adapter *adapter)
@@ -8495,11 +8500,6 @@ static int ixgbe_set_features(struct net_device *netdev,
84958500
adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
84968501
}
84978502

8498-
if (features & NETIF_F_HW_VLAN_CTAG_RX)
8499-
ixgbe_vlan_strip_enable(adapter);
8500-
else
8501-
ixgbe_vlan_strip_disable(adapter);
8502-
85038503
if (changed & NETIF_F_RXALL)
85048504
need_reset = true;
85058505

@@ -8516,6 +8516,9 @@ static int ixgbe_set_features(struct net_device *netdev,
85168516

85178517
if (need_reset)
85188518
ixgbe_do_reset(netdev);
8519+
else if (changed & (NETIF_F_HW_VLAN_CTAG_RX |
8520+
NETIF_F_HW_VLAN_CTAG_FILTER))
8521+
ixgbe_set_rx_mode(netdev);
85198522

85208523
return 0;
85218524
}
@@ -9190,7 +9193,8 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
91909193
NETIF_F_RXCSUM |
91919194
NETIF_F_HW_CSUM |
91929195
NETIF_F_HW_VLAN_CTAG_TX |
9193-
NETIF_F_HW_VLAN_CTAG_RX;
9196+
NETIF_F_HW_VLAN_CTAG_RX |
9197+
NETIF_F_HW_VLAN_CTAG_FILTER;
91949198

91959199
if (hw->mac.type >= ixgbe_mac_82599EB)
91969200
netdev->features |= NETIF_F_SCTP_CRC;
@@ -9204,9 +9208,6 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
92049208
netdev->hw_features |= NETIF_F_NTUPLE |
92059209
NETIF_F_HW_TC;
92069210

9207-
/* set this bit last since it cannot be part of hw_features */
9208-
netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
9209-
92109211
netdev->vlan_features |= NETIF_F_SG |
92119212
NETIF_F_TSO |
92129213
NETIF_F_TSO6 |

0 commit comments

Comments
 (0)