From: Joonwoo Park <joonwpark81@gmail.com>
To: auke-jan.h.kok@intel.com
Cc: kaber@trash.net, jeff@garzik.org, netdev@vger.kernel.org
Subject: [PATCH 4/5] [E1000]: [VLAN] Turn off the HW vlan filter if promisc
Date: Fri, 11 Apr 2008 22:58:51 +0900 [thread overview]
Message-ID: <20080411135851.GD8137@tp64> (raw)
If the netdev goes into mode promiscuous, receive all of the packets on
the wire without HW filtering, those packets will be processed as type
PACKET_OTHERHOST.
Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
---
drivers/net/e1000/e1000_main.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 0991648..61965c2 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2495,7 +2495,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) ?
@@ -2512,13 +2512,19 @@ 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;
+ rctl &= ~E1000_RCTL_VFE;
} else {
- rctl &= ~E1000_RCTL_MPE;
+ if (ctrl & E1000_CTRL_VME &&
+ adapter->hw.mac_type != e1000_ich8lan)
+ rctl |= E1000_RCTL_VFE;
+ if (netdev->flags & IFF_ALLMULTI)
+ rctl |= E1000_RCTL_MPE;
+ else
+ rctl &= ~E1000_RCTL_MPE;
}
uc_ptr = NULL;
@@ -5013,7 +5019,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);
--
1.5.4.3
next reply other threads:[~2008-04-11 13:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-11 13:58 Joonwoo Park [this message]
2008-04-17 21:25 ` [PATCH 4/5] [E1000]: [VLAN] Turn off the HW vlan filter if promisc Kok, Auke
2008-04-18 1:54 ` Joonwoo Park
2008-04-18 2:08 ` Joonwoo Park
2008-04-18 17:48 ` Kok, Auke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080411135851.GD8137@tp64 \
--to=joonwpark81@gmail.com \
--cc=auke-jan.h.kok@intel.com \
--cc=jeff@garzik.org \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).