Skip to contentSkip to conversation

Disable vlan hw accel when promiscuous mode

PATCH Joonwoo Park 2 participants 3 messages Nov 14, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

2007/11/14, Kok, Auke <[email protected]>:

Quoted 18 lines
Quoted 6 lines · Patrick McHardy
Quoted 5 lines · Auke
Quoted 2 lines · Patrick McHardy

I already posted a patch for this, not sure what happened to it. Auke, any news on merging the secondary unicast address support?

Quoted 7 lines
Quoted 2 lines

I dropped the ball on that one. Care to resend it and send me one for e1000e as well?

Patch for e1000 attached.

Does e1000e also work with PCI cards if I add the proper IDs? Otherwise I could only send an untested patch.

Johnwoo,

Quoted 9 lines

your patch unfortunately does not apply after patrick's unicast patch,

also, ich8lan support is removed from e1000 in the e1000 version in jgarzik/netdev-2.6 #upstream as planned (moved over to e1000e!).

Can you resend your patch so that it applies to jgarzik/netdev-2.6 #upstream with Patrick's patch applied? That would help a lot. And possibly do the e1000e patch as well :)

This is a patch for the jgarzik/netdev-2.6 #upstream with Patrick's one was applied. But the ich8lan stuff was not removed at this patch.
I'll work e1000e too :-)

Thanks.
Joonwoo

[E1000]: Disable vlan hw accel when promiscuous mode

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.

---
 drivers/net/e1000/e1000_main.c |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)
drivers/net/e1000/e1000_main.c +18 -5
index 5fd5f51..edf2ced 100644
@@ -2425,7 +2425,7 @@ e1000_set_rx_mode(struct net_device *netdev)
 	struct e1000_hw *hw = &adapter->hw;
 	struct dev_addr_list *uc_ptr;
 	struct dev_addr_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) ?
@@ -2442,13 +2442,23 @@ e1000_set_rx_mode(struct net_device *netdev)
 	/* Check for Promiscuous and All Multicast modes */
 
 	rctl = E1000_READ_REG(hw, RCTL);
+	ctrl = E1000_READ_REG(hw, CTRL);
 
 	if (netdev->flags & IFF_PROMISC) {
 		rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
-	} else if (netdev->flags & IFF_ALLMULTI) {
-		rctl |= E1000_RCTL_MPE;
+		if (adapter->hw.mac_type != e1000_ich8lan) {
+			if (ctrl & E1000_CTRL_VME)
+				rctl &= ~E1000_RCTL_VFE;
+		}
 	} else {
-		rctl &= ~E1000_RCTL_MPE;
+		if (adapter->hw.mac_type != e1000_ich8lan) {
+			if (ctrl & E1000_CTRL_VME)
+				rctl |= E1000_RCTL_VFE;
+		} else if (netdev->flags & IFF_ALLMULTI) {
+			rctl |= E1000_RCTL_MPE;
+		} else {
+			rctl &= ~E1000_RCTL_MPE;
+		}
 	}
 
 	uc_ptr = NULL;
@@ -4967,7 +4977,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);

---

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

#1 lore raw
Quoted 21 lines · Joonwoo Park

2007/11/14, Kok, Auke <[email protected]>:

Quoted 20 lines
Quoted 11 lines · Patrick McHardy
Quoted 6 lines · Auke
Quoted 2 lines · Patrick McHardy

I already posted a patch for this, not sure what happened to it. Auke, any news on merging the secondary unicast address support?

I dropped the ball on that one. Care to resend it and send me one for e1000e as well?

Patch for e1000 attached.

Does e1000e also work with PCI cards if I add the proper IDs? Otherwise I could only send an untested patch.

Johnwoo,

your patch unfortunately does not apply after patrick's unicast patch,

also, ich8lan support is removed from e1000 in the e1000 version in jgarzik/netdev-2.6 #upstream as planned (moved over to e1000e!).

Quoted 7 lines
Quoted 4 lines

Can you resend your patch so that it applies to jgarzik/netdev-2.6 #upstream with Patrick's patch applied? That would help a lot. And possibly do the e1000e patch as well :)

This is a patch for the jgarzik/netdev-2.6 #upstream with Patrick's one was applied. But the ich8lan stuff was not removed at this patch.

no, my TODO list is insane at the moment :)

thanks for the patch. I'll apply and rip the ich8 workarounds out myself later when appropriate.

Quoted 1 line

I'll work e1000e too :-)

awesome, looking forward to that.

Auke

Quoted 71 lines

Thanks.
Joonwoo

[E1000]: Disable vlan hw accel when promiscuous mode

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.

---
 drivers/net/e1000/e1000_main.c |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)
drivers/net/e1000/e1000_main.c +18 -7
index 5fd5f51..edf2ced 100644
@@ -2425,7 +2425,7 @@ e1000_set_rx_mode(struct net_device *netdev)
 	struct e1000_hw *hw = &adapter->hw;
 	struct dev_addr_list *uc_ptr;
 	struct dev_addr_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) ?
@@ -2442,13 +2442,23 @@ e1000_set_rx_mode(struct net_device *netdev)
 	/* Check for Promiscuous and All Multicast modes */
 
 	rctl = E1000_READ_REG(hw, RCTL);
+	ctrl = E1000_READ_REG(hw, CTRL);
 
 	if (netdev->flags & IFF_PROMISC) {
 		rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
-	} else if (netdev->flags & IFF_ALLMULTI) {
-		rctl |= E1000_RCTL_MPE;
+		if (adapter->hw.mac_type != e1000_ich8lan) {
+			if (ctrl & E1000_CTRL_VME)
+				rctl &= ~E1000_RCTL_VFE;
+		}
 	} else {
-		rctl &= ~E1000_RCTL_MPE;
+		if (adapter->hw.mac_type != e1000_ich8lan) {
+			if (ctrl & E1000_CTRL_VME)
+				rctl |= E1000_RCTL_VFE;
+		} else if (netdev->flags & IFF_ALLMULTI) {
+			rctl |= E1000_RCTL_MPE;
+		} else {
+			rctl &= ~E1000_RCTL_MPE;
+		}
 	}
 
 	uc_ptr = NULL;
@@ -4967,7 +4977,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);
---
 
-
Quoted 3 lines

To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

#2 lore raw
Quoted 4 lines
Quoted 1 line

I'll work e1000e too :-)

awesome, looking forward to that.

BTW, It seems to need Patrick's unicast patch for e1000e first. I'll looking forward to that too.

Thanks
Joonwoo

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/