Commit 746b9f02 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

netdrv intel: disable VLAN filtering in promiscous mode

As discussed in this thread:

http://www.mail-archive.com/netdev@vger.kernel.org/msg53976.html

promiscous mode means to disable *all* filters. Currently only unicast
and multicast filtering is disabled. This patch changes all Intel
drivers to also disable VLAN filtering.
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 70efce27
...@@ -2477,11 +2477,16 @@ e1000_set_rx_mode(struct net_device *netdev) ...@@ -2477,11 +2477,16 @@ e1000_set_rx_mode(struct net_device *netdev)
if (netdev->flags & IFF_PROMISC) { if (netdev->flags & IFF_PROMISC) {
rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
} else if (netdev->flags & IFF_ALLMULTI) { rctl &= ~E1000_RCTL_VFE;
} else {
if (netdev->flags & IFF_ALLMULTI) {
rctl |= E1000_RCTL_MPE; rctl |= E1000_RCTL_MPE;
} else { } else {
rctl &= ~E1000_RCTL_MPE; rctl &= ~E1000_RCTL_MPE;
} }
if (adapter->vlgrp && adapter->hw.mac_type != e1000_ich8lan)
rctl |= E1000_RCTL_VFE;
}
uc_ptr = NULL; uc_ptr = NULL;
if (netdev->uc_count > rar_entries - 1) { if (netdev->uc_count > rar_entries - 1) {
...@@ -4962,6 +4967,7 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) ...@@ -4962,6 +4967,7 @@ 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_VFE;
rctl &= ~E1000_RCTL_CFIEN; rctl &= ~E1000_RCTL_CFIEN;
E1000_WRITE_REG(&adapter->hw, RCTL, rctl); E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
......
...@@ -1792,6 +1792,7 @@ static void e1000_vlan_rx_register(struct net_device *netdev, ...@@ -1792,6 +1792,7 @@ 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_VFE;
rctl &= ~E1000_RCTL_CFIEN; rctl &= ~E1000_RCTL_CFIEN;
ew32(RCTL, rctl); ew32(RCTL, rctl);
...@@ -2230,12 +2231,17 @@ static void e1000_set_multi(struct net_device *netdev) ...@@ -2230,12 +2231,17 @@ static void e1000_set_multi(struct net_device *netdev)
if (netdev->flags & IFF_PROMISC) { if (netdev->flags & IFF_PROMISC) {
rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
} else if (netdev->flags & IFF_ALLMULTI) { rctl &= ~E1000_RCTL_VFE;
} else {
if (netdev->flags & IFF_ALLMULTI) {
rctl |= E1000_RCTL_MPE; rctl |= E1000_RCTL_MPE;
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 && adapter->flags & FLAG_HAS_HW_VLAN_FILTER)
rctl |= E1000_RCTL_VFE;
}
ew32(RCTL, rctl); ew32(RCTL, rctl);
......
...@@ -2268,14 +2268,18 @@ static void igb_set_multi(struct net_device *netdev) ...@@ -2268,14 +2268,18 @@ static void igb_set_multi(struct net_device *netdev)
rctl = rd32(E1000_RCTL); rctl = rd32(E1000_RCTL);
if (netdev->flags & IFF_PROMISC) if (netdev->flags & IFF_PROMISC) {
rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
else if (netdev->flags & IFF_ALLMULTI) { rctl &= ~E1000_RCTL_VFE;
} else {
if (netdev->flags & IFF_ALLMULTI) {
rctl |= E1000_RCTL_MPE; rctl |= E1000_RCTL_MPE;
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;
}
wr32(E1000_RCTL, rctl); wr32(E1000_RCTL, rctl);
if (!netdev->mc_count) { if (!netdev->mc_count) {
...@@ -4220,6 +4224,7 @@ static void igb_vlan_rx_register(struct net_device *netdev, ...@@ -4220,6 +4224,7 @@ 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_VFE;
rctl &= ~E1000_RCTL_CFIEN; rctl &= ~E1000_RCTL_CFIEN;
wr32(E1000_RCTL, rctl); wr32(E1000_RCTL, rctl);
......
...@@ -1053,12 +1053,17 @@ ixgb_set_multi(struct net_device *netdev) ...@@ -1053,12 +1053,17 @@ ixgb_set_multi(struct net_device *netdev)
if (netdev->flags & IFF_PROMISC) { if (netdev->flags & IFF_PROMISC) {
rctl |= (IXGB_RCTL_UPE | IXGB_RCTL_MPE); rctl |= (IXGB_RCTL_UPE | IXGB_RCTL_MPE);
} else if (netdev->flags & IFF_ALLMULTI) { rctl &= ~IXGB_RCTL_VFE;
} else {
if (netdev->flags & IFF_ALLMULTI) {
rctl |= IXGB_RCTL_MPE; rctl |= IXGB_RCTL_MPE;
rctl &= ~IXGB_RCTL_UPE; rctl &= ~IXGB_RCTL_UPE;
} else { } else {
rctl &= ~(IXGB_RCTL_UPE | IXGB_RCTL_MPE); rctl &= ~(IXGB_RCTL_UPE | IXGB_RCTL_MPE);
} }
if (adapter->vlgrp)
rctl |= IXGB_RCTL_VFE;
}
if (netdev->mc_count > IXGB_MAX_NUM_MULTICAST_ADDRESSES) { if (netdev->mc_count > IXGB_MAX_NUM_MULTICAST_ADDRESSES) {
rctl |= IXGB_RCTL_MPE; rctl |= IXGB_RCTL_MPE;
...@@ -2104,6 +2109,7 @@ ixgb_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) ...@@ -2104,6 +2109,7 @@ 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_VFE;
rctl &= ~IXGB_RCTL_CFIEN; rctl &= ~IXGB_RCTL_CFIEN;
IXGB_WRITE_REG(&adapter->hw, RCTL, rctl); IXGB_WRITE_REG(&adapter->hw, RCTL, rctl);
......
...@@ -1574,7 +1574,9 @@ static void ixgbe_vlan_rx_register(struct net_device *netdev, ...@@ -1574,7 +1574,9 @@ static void ixgbe_vlan_rx_register(struct net_device *netdev,
if (grp) { if (grp) {
/* 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 | IXGBE_VLNCTRL_VFE; 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);
} }
...@@ -1645,12 +1647,17 @@ static void ixgbe_set_multi(struct net_device *netdev) ...@@ -1645,12 +1647,17 @@ static void ixgbe_set_multi(struct net_device *netdev)
if (netdev->flags & IFF_PROMISC) { if (netdev->flags & IFF_PROMISC) {
fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
} else if (netdev->flags & IFF_ALLMULTI) { fctrl &= ~IXGBE_VLNCTRL_VFE;
} else {
if (netdev->flags & IFF_ALLMULTI) {
fctrl |= IXGBE_FCTRL_MPE; fctrl |= IXGBE_FCTRL_MPE;
fctrl &= ~IXGBE_FCTRL_UPE; fctrl &= ~IXGBE_FCTRL_UPE;
} else { } else {
fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
} }
if (adapter->vlgrp)
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