All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] [e1000 VLAN] Disable vlan hw accel when promiscuous mode
@ 2007-11-11  0:51 ` Joonwoo Park
  0 siblings, 0 replies; 53+ messages in thread
From: Joonwoo Park @ 2007-11-11  0:51 UTC (permalink / raw)
  To: 'David Miller', netdev
  Cc: 'Dave Johnson', linux-kernel, e1000-devel

IMHO even though netdevice is in the promiscuous mode, we should receive all of ingress packets.
This disable the vlan filtering feature when a vlan hw accel configured e1000 device goes into promiscuous mode.
This make packets visible to sniffers though it's not vlan id of itself.
Any check, comments will be appreciated.
Thanks.

Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
---
 drivers/net/e1000/e1000_main.c |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 72deff0..cdd5c84 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2424,7 +2424,7 @@ e1000_set_multi(struct net_device *netdev)
 	struct e1000_adapter *adapter = netdev_priv(netdev);
 	struct e1000_hw *hw = &adapter->hw;
 	struct dev_mc_list *mc_ptr;
-	uint32_t rctl;
+	uint32_t rctl, ctrl;
 	uint32_t hash_value;
 	int i, rar_entries = E1000_RAR_ENTRIES;
 	int mta_reg_count = (hw->mac_type == e1000_ich8lan) ?
@@ -2441,14 +2441,25 @@ e1000_set_multi(struct net_device *netdev)
 	/* Check for Promiscuous and All Multicast modes */
 
 	rctl = E1000_READ_REG(hw, RCTL);
+	ctrl = E1000_READ_REG(&adapter->hw, CTRL);
 
 	if (netdev->flags & IFF_PROMISC) {
 		rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
-	} else if (netdev->flags & IFF_ALLMULTI) {
-		rctl |= E1000_RCTL_MPE;
-		rctl &= ~E1000_RCTL_UPE;
+		if (adapter->hw.mac_type != e1000_ich8lan) {
+			if (ctrl & E1000_CTRL_VME)
+				rctl &= ~E1000_RCTL_VFE;
+		}
 	} else {
-		rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE);
+		if (adapter->hw.mac_type != e1000_ich8lan) {
+			if (ctrl & E1000_CTRL_VME)
+				rctl |= E1000_RCTL_VFE;
+		}
+		if (netdev->flags & IFF_ALLMULTI) {
+			rctl |= E1000_RCTL_MPE;
+			rctl &= ~E1000_RCTL_UPE;
+		} else {
+			rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE);
+		}
 	}
 
 	E1000_WRITE_REG(hw, RCTL, rctl);
@@ -4952,7 +4963,10 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
 		if (adapter->hw.mac_type != e1000_ich8lan) {
 			/* enable VLAN receive filtering */
 			rctl = E1000_READ_REG(&adapter->hw, RCTL);
-			rctl |= E1000_RCTL_VFE;
+			if (netdev->flags & IFF_PROMISC)
+				rctl &= ~E1000_RCTL_VFE;
+			else
+				rctl |= E1000_RCTL_VFE;
 			rctl &= ~E1000_RCTL_CFIEN;
 			E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
 			e1000_update_mng_vlan(adapter);
---


^ permalink raw reply	[flat|nested] 53+ messages in thread

end of thread, other threads:[~2007-11-14 23:32 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-11  0:51 [PATCH 2/2] [e1000 VLAN] Disable vlan hw accel when promiscuous mode Joonwoo Park
2007-11-11  0:51 ` Joonwoo Park
2007-11-12 17:12 ` Kok, Auke
2007-11-12 17:21   ` Patrick McHardy
2007-11-12 17:21     ` Patrick McHardy
2007-11-12 18:01     ` [E1000-devel] " Kok, Auke
2007-11-12 18:01       ` Kok, Auke
2007-11-12 22:33     ` David Miller
2007-11-12 22:33       ` David Miller
2007-11-12 22:43       ` Chris Friesen
2007-11-12 22:54         ` Kok, Auke
2007-11-12 22:54           ` Kok, Auke
2007-11-14 11:48           ` Benny Amorsen
2007-11-14 11:48             ` Benny Amorsen
2007-11-12 22:57         ` David Miller
2007-11-12 22:57           ` David Miller
2007-11-12 23:15           ` Willy Tarreau
2007-11-12 23:15             ` Willy Tarreau
2007-11-12 23:19             ` David Miller
2007-11-12 23:19               ` David Miller
2007-11-12 23:32               ` Willy Tarreau
2007-11-12 23:32                 ` Willy Tarreau
2007-11-12 23:38                 ` Kok, Auke
2007-11-12 23:38                   ` Kok, Auke
2007-11-12 23:40                 ` David Miller
2007-11-12 23:40                   ` David Miller
2007-11-13  1:21                   ` Joonwoo Park
2007-11-13  1:21                     ` Joonwoo Park
2007-11-13 10:21                     ` Patrick McHardy
2007-11-13 11:09                       ` Herbert Xu
2007-11-13 11:36                         ` David Miller
2007-11-13 11:36                           ` David Miller
2007-11-13 12:03                           ` Herbert Xu
2007-11-13 12:06                             ` David Miller
2007-11-13 12:16                               ` Herbert Xu
2007-11-13 12:18                                 ` Patrick McHardy
2007-11-13 16:41                                   ` Kok, Auke
2007-11-13 16:41                                     ` Kok, Auke
2007-11-13 17:26                                     ` Patrick McHardy
2007-11-13 17:26                                       ` Patrick McHardy
2007-11-13 17:30                                       ` Kok, Auke
2007-11-13 17:30                                         ` Kok, Auke
2007-11-14  9:42                                         ` Patrick McHardy
2007-11-14 23:30                                           ` Kok, Auke
2007-11-14 23:30                                             ` Kok, Auke
2007-11-13 19:59                                       ` Kok, Auke
2007-11-13 12:32                                 ` David Miller
2007-11-13 12:32                                   ` David Miller
2007-11-13  1:21             ` Joonwoo Park
2007-11-12 22:28   ` David Miller
2007-11-12 22:28     ` David Miller
2007-11-13 20:43 ` Stephen Hemminger
2007-11-13 20:43   ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.