netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: greearb@candelatech.com
To: netdev@vger.kernel.org
Cc: Ben Greear <greearb@candelatech.com>
Subject: [RFC 1/5] net:  Support ethtool ops for rx of errored frames.
Date: Fri, 17 Jun 2011 17:09:39 -0700	[thread overview]
Message-ID: <1308355783-22407-2-git-send-email-greearb@candelatech.com> (raw)
In-Reply-To: <1308355783-22407-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb@candelatech.com>

This can be useful when sniffing dodgy networks.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 675ddc0... fb0fac9... M	include/linux/ethtool.h
:100644 100644 0e01860... 443a63c... M	net/core/ethtool.c
 include/linux/ethtool.h |    7 +++++++
 net/core/ethtool.c      |    8 ++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 675ddc0..fb0fac9 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -880,6 +880,9 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
  * @set_save_rxfcs:  Set flag to save (1), or discard (0), the Ethernet
  *	Frame Checksum for received packets.
  * @get_save_rxfcs:  Get current value for Save RX-FCS flag.
+ * @set_save_rxerr:  Set flag to save (1), or discard (0), received Ethernet
+ *	frames with errors (bad checksum, etc)
+ * @get_save_rxerr:  Get current value for Save RX-ERR flag.
  *
  * All operations are optional (i.e. the function pointer may be set
  * to %NULL) and callers must take this into account.  Callers must
@@ -960,6 +963,8 @@ struct ethtool_ops {
 	int	(*set_dump)(struct net_device *, struct ethtool_dump *);
 	int	(*set_save_rxfcs)(struct net_device *, u32);
 	u32	(*get_save_rxfcs)(struct net_device *);
+	int	(*set_save_rxerr)(struct net_device *, u32);
+	u32	(*get_save_rxerr)(struct net_device *);
 
 };
 #endif /* __KERNEL__ */
@@ -1036,6 +1041,8 @@ struct ethtool_ops {
 #define ETHTOOL_GET_DUMP_DATA	0x00000040 /* Get dump data */
 #define ETHTOOL_GET_SAVE_RXFCS	0x00000041 /* Get RX Save Frame Checksum */
 #define ETHTOOL_SET_SAVE_RXFCS	0x00000042 /* Set RX Save Frame Checksum */
+#define ETHTOOL_GET_SAVE_RXERR	0x00000043 /* Get RX Save Errored Frames */
+#define ETHTOOL_SET_SAVE_RXERR	0x00000044 /* Set RX Save Errored Frames */
 
 
 /* compatibility with older code */
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 0e01860..443a63c 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -2160,6 +2160,14 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
 		rc =  ethtool_get_value(dev, useraddr, ethcmd,
 					dev->ethtool_ops->get_save_rxfcs);
 		break;
+	case ETHTOOL_SET_SAVE_RXERR:
+		rc = ethtool_set_value(dev, useraddr,
+				       dev->ethtool_ops->set_save_rxerr);
+		break;
+	case ETHTOOL_GET_SAVE_RXERR:
+		rc =  ethtool_get_value(dev, useraddr, ethcmd,
+					dev->ethtool_ops->get_save_rxerr);
+		break;
 	default:
 		rc = -EOPNOTSUPP;
 	}
-- 
1.7.3.4


  reply	other threads:[~2011-06-18  0:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-18  0:09 [RFC 0/5] Ethernet low-level frame debugging support greearb
2011-06-18  0:09 ` greearb [this message]
2011-06-18  0:09 ` [RFC 2/5] net: Add pkt-type PACKET_INVALID greearb
2011-06-18  0:09 ` [RFC 3/5] e100: Support receiving errored frames greearb
2011-06-18  0:09 ` [RFC 4/5] net: Support sending frame with specified FCS greearb
2011-06-18  5:54   ` Eric Dumazet
2011-06-18 14:29     ` Ben Greear
2011-06-18 14:44       ` Eric Dumazet
2011-06-18  0:09 ` [RFC 5/5] e1000e: Support sending frame with custom FCS greearb

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=1308355783-22407-2-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).