diff options
author | Patrick McHardy <kaber@trash.net> | 2008-07-16 23:15:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-16 23:15:45 -0400 |
commit | 746b9f0228a1c607b3db67c80da1c2a963321926 (patch) | |
tree | ea5e89d69279918691885c7c2abbc8a0894f4c9c | |
parent | 70efce27fc3d54271519244dc5e47da4ed711dd4 (diff) |
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: Patrick McHardy <kaber@trash.net>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Acked-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 14 | ||||
-rw-r--r-- | drivers/net/e1000e/netdev.c | 16 | ||||
-rw-r--r-- | drivers/net/igb/igb_main.c | 21 | ||||
-rw-r--r-- | drivers/net/ixgb/ixgb_main.c | 16 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 17 |
5 files changed, 57 insertions, 27 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 7aa458f7d8b8..80e3a65b4422 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -2477,10 +2477,15 @@ e1000_set_rx_mode(struct net_device *netdev) | |||
2477 | 2477 | ||
2478 | if (netdev->flags & IFF_PROMISC) { | 2478 | if (netdev->flags & IFF_PROMISC) { |
2479 | rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); | 2479 | rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); |
2480 | } else if (netdev->flags & IFF_ALLMULTI) { | 2480 | rctl &= ~E1000_RCTL_VFE; |
2481 | rctl |= E1000_RCTL_MPE; | ||
2482 | } else { | 2481 | } else { |
2483 | rctl &= ~E1000_RCTL_MPE; | 2482 | if (netdev->flags & IFF_ALLMULTI) { |
2483 | rctl |= E1000_RCTL_MPE; | ||
2484 | } else { | ||
2485 | rctl &= ~E1000_RCTL_MPE; | ||
2486 | } | ||
2487 | if (adapter->vlgrp && adapter->hw.mac_type != e1000_ich8lan) | ||
2488 | rctl |= E1000_RCTL_VFE; | ||
2484 | } | 2489 | } |
2485 | 2490 | ||
2486 | uc_ptr = NULL; | 2491 | uc_ptr = NULL; |
@@ -4962,7 +4967,8 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) | |||
4962 | if (adapter->hw.mac_type != e1000_ich8lan) { | 4967 | if (adapter->hw.mac_type != e1000_ich8lan) { |
4963 | /* enable VLAN receive filtering */ | 4968 | /* enable VLAN receive filtering */ |
4964 | rctl = E1000_READ_REG(&adapter->hw, RCTL); | 4969 | rctl = E1000_READ_REG(&adapter->hw, RCTL); |
4965 | rctl |= E1000_RCTL_VFE; | 4970 | if (!(netdev->flags & IFF_PROMISC)) |
4971 | rctl |= E1000_RCTL_VFE; | ||
4966 | rctl &= ~E1000_RCTL_CFIEN; | 4972 | rctl &= ~E1000_RCTL_CFIEN; |
4967 | E1000_WRITE_REG(&adapter->hw, RCTL, rctl); | 4973 | E1000_WRITE_REG(&adapter->hw, RCTL, rctl); |
4968 | e1000_update_mng_vlan(adapter); | 4974 | e1000_update_mng_vlan(adapter); |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 80592bdbe31e..3fe60268737a 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -1792,7 +1792,8 @@ static void e1000_vlan_rx_register(struct net_device *netdev, | |||
1792 | if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) { | 1792 | if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) { |
1793 | /* enable VLAN receive filtering */ | 1793 | /* enable VLAN receive filtering */ |
1794 | rctl = er32(RCTL); | 1794 | rctl = er32(RCTL); |
1795 | rctl |= E1000_RCTL_VFE; | 1795 | if (!(netdev->flags & IFF_PROMISC)) |
1796 | rctl |= E1000_RCTL_VFE; | ||
1796 | rctl &= ~E1000_RCTL_CFIEN; | 1797 | rctl &= ~E1000_RCTL_CFIEN; |
1797 | ew32(RCTL, rctl); | 1798 | ew32(RCTL, rctl); |
1798 | e1000_update_mng_vlan(adapter); | 1799 | e1000_update_mng_vlan(adapter); |
@@ -2230,11 +2231,16 @@ static void e1000_set_multi(struct net_device *netdev) | |||
2230 | 2231 | ||
2231 | if (netdev->flags & IFF_PROMISC) { | 2232 | if (netdev->flags & IFF_PROMISC) { |
2232 | rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); | 2233 | rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); |
2233 | } else if (netdev->flags & IFF_ALLMULTI) { | 2234 | rctl &= ~E1000_RCTL_VFE; |
2234 | rctl |= E1000_RCTL_MPE; | ||
2235 | rctl &= ~E1000_RCTL_UPE; | ||
2236 | } else { | 2235 | } else { |
2237 | rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE); | 2236 | if (netdev->flags & IFF_ALLMULTI) { |
2237 | rctl |= E1000_RCTL_MPE; | ||
2238 | rctl &= ~E1000_RCTL_UPE; | ||
2239 | } else { | ||
2240 | rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE); | ||
2241 | } | ||
2242 | if (adapter->vlgrp && adapter->flags & FLAG_HAS_HW_VLAN_FILTER) | ||
2243 | rctl |= E1000_RCTL_VFE; | ||
2238 | } | 2244 | } |
2239 | 2245 | ||
2240 | ew32(RCTL, rctl); | 2246 | ew32(RCTL, rctl); |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index aaed129f4ca0..1ab8e3ec9e56 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -2268,14 +2268,18 @@ static void igb_set_multi(struct net_device *netdev) | |||
2268 | 2268 | ||
2269 | rctl = rd32(E1000_RCTL); | 2269 | rctl = rd32(E1000_RCTL); |
2270 | 2270 | ||
2271 | if (netdev->flags & IFF_PROMISC) | 2271 | if (netdev->flags & IFF_PROMISC) { |
2272 | rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); | 2272 | rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); |
2273 | else if (netdev->flags & IFF_ALLMULTI) { | 2273 | rctl &= ~E1000_RCTL_VFE; |
2274 | rctl |= E1000_RCTL_MPE; | 2274 | } else { |
2275 | rctl &= ~E1000_RCTL_UPE; | 2275 | if (netdev->flags & IFF_ALLMULTI) { |
2276 | } else | 2276 | rctl |= E1000_RCTL_MPE; |
2277 | rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE); | 2277 | rctl &= ~E1000_RCTL_UPE; |
2278 | 2278 | } else | |
2279 | rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE); | ||
2280 | if (adapter->vlgrp) | ||
2281 | rctl |= E1000_RCTL_VFE; | ||
2282 | } | ||
2279 | wr32(E1000_RCTL, rctl); | 2283 | wr32(E1000_RCTL, rctl); |
2280 | 2284 | ||
2281 | if (!netdev->mc_count) { | 2285 | if (!netdev->mc_count) { |
@@ -4220,7 +4224,8 @@ static void igb_vlan_rx_register(struct net_device *netdev, | |||
4220 | 4224 | ||
4221 | /* enable VLAN receive filtering */ | 4225 | /* enable VLAN receive filtering */ |
4222 | rctl = rd32(E1000_RCTL); | 4226 | rctl = rd32(E1000_RCTL); |
4223 | rctl |= E1000_RCTL_VFE; | 4227 | if (!(netdev->flags & IFF_PROMISC)) |
4228 | rctl |= E1000_RCTL_VFE; | ||
4224 | rctl &= ~E1000_RCTL_CFIEN; | 4229 | rctl &= ~E1000_RCTL_CFIEN; |
4225 | wr32(E1000_RCTL, rctl); | 4230 | wr32(E1000_RCTL, rctl); |
4226 | igb_update_mng_vlan(adapter); | 4231 | igb_update_mng_vlan(adapter); |
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index e83feaf830bd..ec95cd4ea588 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -1053,11 +1053,16 @@ ixgb_set_multi(struct net_device *netdev) | |||
1053 | 1053 | ||
1054 | if (netdev->flags & IFF_PROMISC) { | 1054 | if (netdev->flags & IFF_PROMISC) { |
1055 | rctl |= (IXGB_RCTL_UPE | IXGB_RCTL_MPE); | 1055 | rctl |= (IXGB_RCTL_UPE | IXGB_RCTL_MPE); |
1056 | } else if (netdev->flags & IFF_ALLMULTI) { | 1056 | rctl &= ~IXGB_RCTL_VFE; |
1057 | rctl |= IXGB_RCTL_MPE; | ||
1058 | rctl &= ~IXGB_RCTL_UPE; | ||
1059 | } else { | 1057 | } else { |
1060 | rctl &= ~(IXGB_RCTL_UPE | IXGB_RCTL_MPE); | 1058 | if (netdev->flags & IFF_ALLMULTI) { |
1059 | rctl |= IXGB_RCTL_MPE; | ||
1060 | rctl &= ~IXGB_RCTL_UPE; | ||
1061 | } else { | ||
1062 | rctl &= ~(IXGB_RCTL_UPE | IXGB_RCTL_MPE); | ||
1063 | } | ||
1064 | if (adapter->vlgrp) | ||
1065 | rctl |= IXGB_RCTL_VFE; | ||
1061 | } | 1066 | } |
1062 | 1067 | ||
1063 | if (netdev->mc_count > IXGB_MAX_NUM_MULTICAST_ADDRESSES) { | 1068 | if (netdev->mc_count > IXGB_MAX_NUM_MULTICAST_ADDRESSES) { |
@@ -2104,7 +2109,8 @@ ixgb_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) | |||
2104 | /* enable VLAN receive filtering */ | 2109 | /* enable VLAN receive filtering */ |
2105 | 2110 | ||
2106 | rctl = IXGB_READ_REG(&adapter->hw, RCTL); | 2111 | rctl = IXGB_READ_REG(&adapter->hw, RCTL); |
2107 | rctl |= IXGB_RCTL_VFE; | 2112 | if (!(netdev->flags & IFF_PROMISC)) |
2113 | rctl |= IXGB_RCTL_VFE; | ||
2108 | rctl &= ~IXGB_RCTL_CFIEN; | 2114 | rctl &= ~IXGB_RCTL_CFIEN; |
2109 | IXGB_WRITE_REG(&adapter->hw, RCTL, rctl); | 2115 | IXGB_WRITE_REG(&adapter->hw, RCTL, rctl); |
2110 | } else { | 2116 | } else { |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 10a1c8c5cda1..afe3a1cdfdbd 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -1574,7 +1574,9 @@ static void ixgbe_vlan_rx_register(struct net_device *netdev, | |||
1574 | if (grp) { | 1574 | if (grp) { |
1575 | /* enable VLAN tag insert/strip */ | 1575 | /* enable VLAN tag insert/strip */ |
1576 | ctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_VLNCTRL); | 1576 | ctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_VLNCTRL); |
1577 | ctrl |= IXGBE_VLNCTRL_VME | IXGBE_VLNCTRL_VFE; | 1577 | ctrl |= IXGBE_VLNCTRL_VME; |
1578 | if (!(netdev->flags & IFF_PROMISC)) | ||
1579 | ctrl |= IXGBE_VLNCTRL_VFE; | ||
1578 | ctrl &= ~IXGBE_VLNCTRL_CFIEN; | 1580 | ctrl &= ~IXGBE_VLNCTRL_CFIEN; |
1579 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_VLNCTRL, ctrl); | 1581 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_VLNCTRL, ctrl); |
1580 | } | 1582 | } |
@@ -1645,11 +1647,16 @@ static void ixgbe_set_multi(struct net_device *netdev) | |||
1645 | 1647 | ||
1646 | if (netdev->flags & IFF_PROMISC) { | 1648 | if (netdev->flags & IFF_PROMISC) { |
1647 | fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); | 1649 | fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); |
1648 | } else if (netdev->flags & IFF_ALLMULTI) { | 1650 | fctrl &= ~IXGBE_VLNCTRL_VFE; |
1649 | fctrl |= IXGBE_FCTRL_MPE; | ||
1650 | fctrl &= ~IXGBE_FCTRL_UPE; | ||
1651 | } else { | 1651 | } else { |
1652 | fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); | 1652 | if (netdev->flags & IFF_ALLMULTI) { |
1653 | fctrl |= IXGBE_FCTRL_MPE; | ||
1654 | fctrl &= ~IXGBE_FCTRL_UPE; | ||
1655 | } else { | ||
1656 | fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); | ||
1657 | } | ||
1658 | if (adapter->vlgrp) | ||
1659 | fctrl |= IXGBE_VLNCTRL_VFE; | ||
1653 | } | 1660 | } |
1654 | 1661 | ||
1655 | IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl); | 1662 | IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl); |