From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Ben Greear <greearb@candelatech.com>,
netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 04/12] ixgbe: Support RX-ALL feature flag.
Date: Sat, 17 Mar 2012 01:50:52 -0700 [thread overview]
Message-ID: <1331974260-6383-5-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1331974260-6383-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Ben Greear <greearb@candelatech.com>
This allows the NIC to receive all frames available, including
those with bad FCS, ethernet control frames, and more.
Tested by sending frames with bad FCS.
Signed-off-by: Ben Greear <greearb@candelatech.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 986897b..cae763c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1482,8 +1482,8 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
struct sk_buff *skb;
unsigned int total_rx_bytes = 0, total_rx_packets = 0;
const int current_node = numa_node_id();
-#ifdef IXGBE_FCOE
struct ixgbe_adapter *adapter = q_vector->adapter;
+#ifdef IXGBE_FCOE
int ddp_bytes = 0;
#endif /* IXGBE_FCOE */
u16 i;
@@ -1612,7 +1612,8 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
/* ERR_MASK will only have valid bits if EOP set */
if (unlikely(ixgbe_test_staterr(rx_desc,
- IXGBE_RXDADV_ERR_FRAME_ERR_MASK))) {
+ IXGBE_RXDADV_ERR_FRAME_ERR_MASK) &&
+ !(adapter->netdev->features & NETIF_F_RXALL))) {
dev_kfree_skb_any(skb);
goto next_desc;
}
@@ -3342,6 +3343,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
/* set all bits that we expect to always be set */
+ fctrl &= ~IXGBE_FCTRL_SBP; /* disable store-bad-packets */
fctrl |= IXGBE_FCTRL_BAM;
fctrl |= IXGBE_FCTRL_DPF; /* discard pause frames when FC enabled */
fctrl |= IXGBE_FCTRL_PMCF;
@@ -3390,6 +3392,18 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
IXGBE_WRITE_REG(hw, IXGBE_VMOLR(adapter->num_vfs), vmolr);
}
+ /* This is useful for sniffing bad packets. */
+ if (adapter->netdev->features & NETIF_F_RXALL) {
+ /* UPE and MPE will be handled by normal PROMISC logic
+ * in e1000e_set_rx_mode */
+ fctrl |= (IXGBE_FCTRL_SBP | /* Receive bad packets */
+ IXGBE_FCTRL_BAM | /* RX All Bcast Pkts */
+ IXGBE_FCTRL_PMCF); /* RX All MAC Ctrl Pkts */
+
+ fctrl &= ~(IXGBE_FCTRL_DPF);
+ /* NOTE: VLAN filtering is disabled by setting PROMISC */
+ }
+
IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
if (netdev->features & NETIF_F_HW_VLAN_RX)
@@ -7459,6 +7473,7 @@ static int ixgbe_set_features(struct net_device *netdev,
netdev_features_t data)
{
struct ixgbe_adapter *adapter = netdev_priv(netdev);
+ netdev_features_t changed = netdev->features ^ data;
bool need_reset = false;
/* Make sure RSC matches LRO, reset if change */
@@ -7495,6 +7510,10 @@ static int ixgbe_set_features(struct net_device *netdev,
need_reset = true;
}
+ if (changed & NETIF_F_RXALL)
+ need_reset = true;
+
+ netdev->features = data;
if (need_reset)
ixgbe_do_reset(netdev);
@@ -7773,6 +7792,8 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
break;
}
+ netdev->hw_features |= NETIF_F_RXALL;
+
netdev->vlan_features |= NETIF_F_TSO;
netdev->vlan_features |= NETIF_F_TSO6;
netdev->vlan_features |= NETIF_F_IP_CSUM;
--
1.7.7.6
next prev parent reply other threads:[~2012-03-17 8:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-17 8:50 [net-next 00/12][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2012-03-17 8:50 ` [net-next 01/12] igb: Support sending custom Ethernet FCS Jeff Kirsher
2012-03-17 8:50 ` [net-next 02/12] igb: Support RX-ALL feature flag Jeff Kirsher
2012-03-17 8:50 ` [net-next 03/12] ixgbe: Support sending custom Ethernet FCS Jeff Kirsher
2012-03-17 8:50 ` Jeff Kirsher [this message]
2012-03-17 8:50 ` [net-next 05/12] ixgbe: Replace standard receive path with a page based receive Jeff Kirsher
2012-03-17 8:50 ` [net-next 06/12] ixgbe: cleanup logic in ixgbe_change_mtu Jeff Kirsher
2012-03-17 8:50 ` [net-next 07/12] ixgbe: Make certain that all frames fit minimum size requirements Jeff Kirsher
2012-03-17 8:50 ` [net-next 08/12] ixgbe: Modify setup of descriptor flags to avoid conditional jumps Jeff Kirsher
2012-03-17 8:50 ` [net-next 09/12] ixgbe: Use packets to track Tx completions instead of a seperate value Jeff Kirsher
2012-03-17 8:50 ` [net-next 10/12] ixgbe: Place skb on first buffer_info structure to avoid using stack space Jeff Kirsher
2012-03-17 8:50 ` [net-next 11/12] ixgbe: Write gso_segs and bytcount to the ring sooner Jeff Kirsher
2012-03-17 8:51 ` [net-next 12/12] ixgbe: always write DMA for single_mapped value with skb Jeff Kirsher
2012-03-17 9:06 ` [net-next 00/12][pull request] Intel Wired LAN Driver Updates David Miller
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=1331974260-6383-5-git-send-email-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=davem@davemloft.net \
--cc=gospo@redhat.com \
--cc=greearb@candelatech.com \
--cc=netdev@vger.kernel.org \
--cc=sassmann@redhat.com \
/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).