From: greearb@candelatech.com
To: netdev@vger.kernel.org
Cc: Ben Greear <greearb@candelatech.com>
Subject: [PATCH v2 09/10] e100: Support RXALL feature flag.
Date: Wed, 8 Feb 2012 11:54:44 -0800 [thread overview]
Message-ID: <1328730885-10941-10-git-send-email-greearb@candelatech.com> (raw)
In-Reply-To: <1328730885-10941-1-git-send-email-greearb@candelatech.com>
From: Ben Greear <greearb@candelatech.com>
This allows the NIC to receive packets with bad FCS
and other errors. Good for sniffing packets on flakey
networks.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 c793939... a296ec4... M drivers/net/ethernet/intel/e100.c
drivers/net/ethernet/intel/e100.c | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index c793939..a296ec4 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -462,7 +462,7 @@ struct config {
/*5*/ u8 X(tx_dma_max_count:7, dma_max_count_enable:1);
/*6*/ u8 X(X(X(X(X(X(X(late_scb_update:1, direct_rx_dma:1),
tno_intr:1), cna_intr:1), standard_tcb:1), standard_stat_counter:1),
- rx_discard_overruns:1), rx_save_bad_frames:1);
+ rx_save_overruns : 1), rx_save_bad_frames : 1);
/*7*/ u8 X(X(X(X(X(rx_discard_short_frames:1, tx_underrun_retry:2),
pad7:2), rx_extended_rfd:1), tx_two_frames_in_fifo:1),
tx_dynamic_tbd:1);
@@ -1165,6 +1165,12 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
}
}
+ if (netdev->features & NETIF_F_RXALL) {
+ config->rx_save_overruns = 0x1; /* 1=save, 0=discard */
+ config->rx_save_bad_frames = 0x1; /* 1=save, 0=discard */
+ config->rx_discard_short_frames = 0x0; /* 1=discard, 0=save */
+ }
+
netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
"[00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]);
@@ -1999,6 +2005,16 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
skb_put(skb, actual_size);
skb->protocol = eth_type_trans(skb, nic->netdev);
+ /* If we are receiving all frames, then don't bother
+ * checking for errors.
+ */
+ if (unlikely(dev->features & NETIF_F_RXALL)) {
+ if (actual_size > nic->netdev->mtu + VLAN_ETH_HLEN)
+ /* Received oversized frame */
+ dev->stats.rx_over_errors++;
+ goto process_skb;
+ }
+
if (unlikely(!(rfd_status & cb_ok))) {
/* Don't indicate if hardware indicates errors */
dev_kfree_skb_any(skb);
@@ -2007,6 +2023,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
nic->rx_over_length_errors++;
dev_kfree_skb_any(skb);
} else {
+process_skb:
dev->stats.rx_packets++;
dev->stats.rx_bytes += actual_size;
netif_receive_skb(skb);
@@ -2757,7 +2774,7 @@ static int e100_set_features(struct net_device *netdev,
struct nic *nic = netdev_priv(netdev);
netdev_features_t changed = features ^ netdev->features;
- if (!(changed & (NETIF_F_RXFCS)))
+ if (!(changed & (NETIF_F_RXFCS | NETIF_F_RXALL)))
return 0;
netdev->features = features;
@@ -2793,6 +2810,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
netdev->hw_features |= NETIF_F_RXFCS;
netdev->priv_flags |= IFF_SUPP_NOFCS;
+ netdev->hw_features |= NETIF_F_RXALL;
netdev->netdev_ops = &e100_netdev_ops;
SET_ETHTOOL_OPS(netdev, &e100_ethtool_ops);
--
1.7.3.4
next prev parent reply other threads:[~2012-02-08 19:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-08 19:54 [PATCH v2 00/10] Low-level Ethernet debugging features greearb
2012-02-08 19:54 ` [PATCH v2 01/10] net: Support RXFCS feature flag greearb
2012-02-08 19:54 ` [PATCH v2 02/10] e100: " greearb
2012-02-10 22:56 ` Michał Mirosław
2012-02-11 0:17 ` Ben Greear
2012-02-08 19:54 ` [PATCH v2 03/10] e1000e: " greearb
2012-02-10 22:46 ` Michał Mirosław
2012-02-10 22:57 ` Ben Greear
2012-02-10 23:09 ` Michał Mirosław
2012-02-11 0:06 ` Ben Greear
2012-02-08 19:54 ` [PATCH v2 04/10] net: Add framework to allow sending packets with customized CRC greearb
2012-02-08 19:54 ` [PATCH v2 05/10] e100: Support sending custom Ethernet CRC greearb
2012-02-08 19:54 ` [PATCH v2 06/10] e1000e: " greearb
2012-02-08 19:54 ` [PATCH v2 07/10] net: Support RX-ALL feature flag greearb
2012-02-08 19:54 ` [PATCH v2 08/10] e1000e: Support RXALL " greearb
2012-02-08 19:54 ` greearb [this message]
2012-02-08 19:54 ` [PATCH v2 10/10] e1000: Support sending custom Ethernet CRC greearb
2012-02-10 4:31 ` [PATCH v2 00/10] Low-level Ethernet debugging features Jeff Kirsher
2012-02-10 5:42 ` Ben Greear
2012-02-10 5:52 ` Jeff Kirsher
2012-02-10 13:25 ` Eric Dumazet
2012-02-10 13:45 ` David Laight
2012-02-10 13:51 ` Eric Dumazet
2012-02-10 14:09 ` Eric Dumazet
2012-02-10 17:18 ` Ben Greear
2012-02-10 20:43 ` 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=1328730885-10941-10-git-send-email-greearb@candelatech.com \
--to=greearb@candelatech.com \
--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).