Skip to content

Commit c72cb30

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Fix VLAN acceleration handling in bnxt_fix_features().
The current logic in bnxt_fix_features() will inadvertently turn on both CTAG and STAG VLAN offload if the user tries to disable both. Fix it by checking that the user is trying to enable CTAG or STAG before enabling both. The logic is supposed to enable or disable both CTAG and STAG together. Fixes: 5a9f6b2 ("bnxt_en: Enable and disable RX CTAG and RX STAG VLAN acceleration together.") Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bbf211b commit c72cb30

File tree

1 file changed

+6
-3
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+6
-3
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9780,6 +9780,7 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev,
97809780
netdev_features_t features)
97819781
{
97829782
struct bnxt *bp = netdev_priv(dev);
9783+
netdev_features_t vlan_features;
97839784

97849785
if ((features & NETIF_F_NTUPLE) && !bnxt_rfs_capable(bp))
97859786
features &= ~NETIF_F_NTUPLE;
@@ -9796,12 +9797,14 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev,
97969797
/* Both CTAG and STAG VLAN accelaration on the RX side have to be
97979798
* turned on or off together.
97989799
*/
9799-
if ((features & (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX)) !=
9800-
(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX)) {
9800+
vlan_features = features & (NETIF_F_HW_VLAN_CTAG_RX |
9801+
NETIF_F_HW_VLAN_STAG_RX);
9802+
if (vlan_features != (NETIF_F_HW_VLAN_CTAG_RX |
9803+
NETIF_F_HW_VLAN_STAG_RX)) {
98019804
if (dev->features & NETIF_F_HW_VLAN_CTAG_RX)
98029805
features &= ~(NETIF_F_HW_VLAN_CTAG_RX |
98039806
NETIF_F_HW_VLAN_STAG_RX);
9804-
else
9807+
else if (vlan_features)
98059808
features |= NETIF_F_HW_VLAN_CTAG_RX |
98069809
NETIF_F_HW_VLAN_STAG_RX;
98079810
}

0 commit comments

Comments
 (0)