Commit 78ed11a5 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

netdrv intel: always enable VLAN filtering except in promiscous mode

Currently VLAN filtering is enabled when the first VLAN is added.
Obviously before that there's no point in receiving any VLAN packets.
Now that we disable VLAN filtering in promiscous mode, we can keep
the VLAN filters enabled the remaining time.
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Acked-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Acked-by: default avatarPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 746b9f02
...@@ -2484,7 +2484,7 @@ e1000_set_rx_mode(struct net_device *netdev) ...@@ -2484,7 +2484,7 @@ e1000_set_rx_mode(struct net_device *netdev)
} else { } else {
rctl &= ~E1000_RCTL_MPE; rctl &= ~E1000_RCTL_MPE;
} }
if (adapter->vlgrp && adapter->hw.mac_type != e1000_ich8lan) if (adapter->hw.mac_type != e1000_ich8lan)
rctl |= E1000_RCTL_VFE; rctl |= E1000_RCTL_VFE;
} }
...@@ -4967,8 +4967,6 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) ...@@ -4967,8 +4967,6 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
if (adapter->hw.mac_type != e1000_ich8lan) { if (adapter->hw.mac_type != e1000_ich8lan) {
/* enable VLAN receive filtering */ /* enable VLAN receive filtering */
rctl = E1000_READ_REG(&adapter->hw, RCTL); rctl = E1000_READ_REG(&adapter->hw, RCTL);
if (!(netdev->flags & IFF_PROMISC))
rctl |= E1000_RCTL_VFE;
rctl &= ~E1000_RCTL_CFIEN; rctl &= ~E1000_RCTL_CFIEN;
E1000_WRITE_REG(&adapter->hw, RCTL, rctl); E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
e1000_update_mng_vlan(adapter); e1000_update_mng_vlan(adapter);
...@@ -4980,10 +4978,6 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) ...@@ -4980,10 +4978,6 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
if (adapter->hw.mac_type != e1000_ich8lan) { if (adapter->hw.mac_type != e1000_ich8lan) {
/* disable VLAN filtering */
rctl = E1000_READ_REG(&adapter->hw, RCTL);
rctl &= ~E1000_RCTL_VFE;
E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
if (adapter->mng_vlan_id != if (adapter->mng_vlan_id !=
(u16)E1000_MNG_VLAN_NONE) { (u16)E1000_MNG_VLAN_NONE) {
e1000_vlan_rx_kill_vid(netdev, e1000_vlan_rx_kill_vid(netdev,
......
...@@ -1792,8 +1792,6 @@ static void e1000_vlan_rx_register(struct net_device *netdev, ...@@ -1792,8 +1792,6 @@ static void e1000_vlan_rx_register(struct net_device *netdev,
if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) { if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) {
/* enable VLAN receive filtering */ /* enable VLAN receive filtering */
rctl = er32(RCTL); rctl = er32(RCTL);
if (!(netdev->flags & IFF_PROMISC))
rctl |= E1000_RCTL_VFE;
rctl &= ~E1000_RCTL_CFIEN; rctl &= ~E1000_RCTL_CFIEN;
ew32(RCTL, rctl); ew32(RCTL, rctl);
e1000_update_mng_vlan(adapter); e1000_update_mng_vlan(adapter);
...@@ -1805,10 +1803,6 @@ static void e1000_vlan_rx_register(struct net_device *netdev, ...@@ -1805,10 +1803,6 @@ static void e1000_vlan_rx_register(struct net_device *netdev,
ew32(CTRL, ctrl); ew32(CTRL, ctrl);
if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) { if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) {
/* disable VLAN filtering */
rctl = er32(RCTL);
rctl &= ~E1000_RCTL_VFE;
ew32(RCTL, rctl);
if (adapter->mng_vlan_id != if (adapter->mng_vlan_id !=
(u16)E1000_MNG_VLAN_NONE) { (u16)E1000_MNG_VLAN_NONE) {
e1000_vlan_rx_kill_vid(netdev, e1000_vlan_rx_kill_vid(netdev,
...@@ -2239,7 +2233,7 @@ static void e1000_set_multi(struct net_device *netdev) ...@@ -2239,7 +2233,7 @@ static void e1000_set_multi(struct net_device *netdev)
} else { } else {
rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE); rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE);
} }
if (adapter->vlgrp && adapter->flags & FLAG_HAS_HW_VLAN_FILTER) if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER)
rctl |= E1000_RCTL_VFE; rctl |= E1000_RCTL_VFE;
} }
......
...@@ -2277,8 +2277,7 @@ static void igb_set_multi(struct net_device *netdev) ...@@ -2277,8 +2277,7 @@ static void igb_set_multi(struct net_device *netdev)
rctl &= ~E1000_RCTL_UPE; rctl &= ~E1000_RCTL_UPE;
} else } else
rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE); rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE);
if (adapter->vlgrp) rctl |= E1000_RCTL_VFE;
rctl |= E1000_RCTL_VFE;
} }
wr32(E1000_RCTL, rctl); wr32(E1000_RCTL, rctl);
...@@ -4224,8 +4223,6 @@ static void igb_vlan_rx_register(struct net_device *netdev, ...@@ -4224,8 +4223,6 @@ static void igb_vlan_rx_register(struct net_device *netdev,
/* enable VLAN receive filtering */ /* enable VLAN receive filtering */
rctl = rd32(E1000_RCTL); rctl = rd32(E1000_RCTL);
if (!(netdev->flags & IFF_PROMISC))
rctl |= E1000_RCTL_VFE;
rctl &= ~E1000_RCTL_CFIEN; rctl &= ~E1000_RCTL_CFIEN;
wr32(E1000_RCTL, rctl); wr32(E1000_RCTL, rctl);
igb_update_mng_vlan(adapter); igb_update_mng_vlan(adapter);
...@@ -4237,10 +4234,6 @@ static void igb_vlan_rx_register(struct net_device *netdev, ...@@ -4237,10 +4234,6 @@ static void igb_vlan_rx_register(struct net_device *netdev,
ctrl &= ~E1000_CTRL_VME; ctrl &= ~E1000_CTRL_VME;
wr32(E1000_CTRL, ctrl); wr32(E1000_CTRL, ctrl);
/* disable VLAN filtering */
rctl = rd32(E1000_RCTL);
rctl &= ~E1000_RCTL_VFE;
wr32(E1000_RCTL, rctl);
if (adapter->mng_vlan_id != (u16)IGB_MNG_VLAN_NONE) { if (adapter->mng_vlan_id != (u16)IGB_MNG_VLAN_NONE) {
igb_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); igb_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
adapter->mng_vlan_id = IGB_MNG_VLAN_NONE; adapter->mng_vlan_id = IGB_MNG_VLAN_NONE;
......
...@@ -1061,8 +1061,7 @@ ixgb_set_multi(struct net_device *netdev) ...@@ -1061,8 +1061,7 @@ ixgb_set_multi(struct net_device *netdev)
} else { } else {
rctl &= ~(IXGB_RCTL_UPE | IXGB_RCTL_MPE); rctl &= ~(IXGB_RCTL_UPE | IXGB_RCTL_MPE);
} }
if (adapter->vlgrp) rctl |= IXGB_RCTL_VFE;
rctl |= IXGB_RCTL_VFE;
} }
if (netdev->mc_count > IXGB_MAX_NUM_MULTICAST_ADDRESSES) { if (netdev->mc_count > IXGB_MAX_NUM_MULTICAST_ADDRESSES) {
...@@ -2109,8 +2108,6 @@ ixgb_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) ...@@ -2109,8 +2108,6 @@ ixgb_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
/* enable VLAN receive filtering */ /* enable VLAN receive filtering */
rctl = IXGB_READ_REG(&adapter->hw, RCTL); rctl = IXGB_READ_REG(&adapter->hw, RCTL);
if (!(netdev->flags & IFF_PROMISC))
rctl |= IXGB_RCTL_VFE;
rctl &= ~IXGB_RCTL_CFIEN; rctl &= ~IXGB_RCTL_CFIEN;
IXGB_WRITE_REG(&adapter->hw, RCTL, rctl); IXGB_WRITE_REG(&adapter->hw, RCTL, rctl);
} else { } else {
...@@ -2119,12 +2116,6 @@ ixgb_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) ...@@ -2119,12 +2116,6 @@ ixgb_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
ctrl = IXGB_READ_REG(&adapter->hw, CTRL0); ctrl = IXGB_READ_REG(&adapter->hw, CTRL0);
ctrl &= ~IXGB_CTRL0_VME; ctrl &= ~IXGB_CTRL0_VME;
IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl); IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl);
/* disable VLAN filtering */
rctl = IXGB_READ_REG(&adapter->hw, RCTL);
rctl &= ~IXGB_RCTL_VFE;
IXGB_WRITE_REG(&adapter->hw, RCTL, rctl);
} }
/* don't enable interrupts unless we are UP */ /* don't enable interrupts unless we are UP */
......
...@@ -1575,8 +1575,6 @@ static void ixgbe_vlan_rx_register(struct net_device *netdev, ...@@ -1575,8 +1575,6 @@ static void ixgbe_vlan_rx_register(struct net_device *netdev,
/* enable VLAN tag insert/strip */ /* enable VLAN tag insert/strip */
ctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_VLNCTRL); ctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_VLNCTRL);
ctrl |= IXGBE_VLNCTRL_VME; ctrl |= IXGBE_VLNCTRL_VME;
if (!(netdev->flags & IFF_PROMISC))
ctrl |= IXGBE_VLNCTRL_VFE;
ctrl &= ~IXGBE_VLNCTRL_CFIEN; ctrl &= ~IXGBE_VLNCTRL_CFIEN;
IXGBE_WRITE_REG(&adapter->hw, IXGBE_VLNCTRL, ctrl); IXGBE_WRITE_REG(&adapter->hw, IXGBE_VLNCTRL, ctrl);
} }
...@@ -1655,8 +1653,7 @@ static void ixgbe_set_multi(struct net_device *netdev) ...@@ -1655,8 +1653,7 @@ static void ixgbe_set_multi(struct net_device *netdev)
} else { } else {
fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
} }
if (adapter->vlgrp) fctrl |= IXGBE_VLNCTRL_VFE;
fctrl |= IXGBE_VLNCTRL_VFE;
} }
IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl); IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment