From: greearb@candelatech.com
To: netdev@vger.kernel.org
Cc: Ben Greear <greearb@candelatech.com>
Subject: [PATCH 1/2] net: Support getting/setting RX-FCS in drivers.
Date: Fri, 17 Jun 2011 12:40:14 -0700 [thread overview]
Message-ID: <1308339615-5866-2-git-send-email-greearb@candelatech.com> (raw)
In-Reply-To: <1308339615-5866-1-git-send-email-greearb@candelatech.com>
From: Ben Greear <greearb@candelatech.com>
This will allow us to enable/disable having the Ethernet
frame checksum appended to the skb. Enabling this is
useful when sniffing packets.
In particular, this can be used to test logic that allows
a NIC to receive all frames, even ones with bad checksums.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 439b173... 675ddc0... M include/linux/ethtool.h
:100644 100644 fd14116... 0e01860... M net/core/ethtool.c
include/linux/ethtool.h | 8 ++++++++
net/core/ethtool.c | 8 ++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 439b173..675ddc0 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -877,6 +877,9 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
* and flag of the device.
* @get_dump_data: Get dump data.
* @set_dump: Set dump specific flags to the device.
+ * @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.
*
* All operations are optional (i.e. the function pointer may be set
* to %NULL) and callers must take this into account. Callers must
@@ -955,6 +958,8 @@ struct ethtool_ops {
int (*get_dump_data)(struct net_device *,
struct ethtool_dump *, void *);
int (*set_dump)(struct net_device *, struct ethtool_dump *);
+ int (*set_save_rxfcs)(struct net_device *, u32);
+ u32 (*get_save_rxfcs)(struct net_device *);
};
#endif /* __KERNEL__ */
@@ -1029,6 +1034,9 @@ struct ethtool_ops {
#define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */
#define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */
#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 */
+
/* compatibility with older code */
#define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index fd14116..0e01860 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -2152,6 +2152,14 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
case ETHTOOL_GET_DUMP_DATA:
rc = ethtool_get_dump_data(dev, useraddr);
break;
+ case ETHTOOL_SET_SAVE_RXFCS:
+ rc = ethtool_set_value(dev, useraddr,
+ dev->ethtool_ops->set_save_rxfcs);
+ break;
+ case ETHTOOL_GET_SAVE_RXFCS:
+ rc = ethtool_get_value(dev, useraddr, ethcmd,
+ dev->ethtool_ops->get_save_rxfcs);
+ break;
default:
rc = -EOPNOTSUPP;
}
--
1.7.3.4
next prev parent reply other threads:[~2011-06-17 19:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-17 19:40 [PATCH 0/2] Allow NICs to pass Frame Checksum up the stack greearb
2011-06-17 19:40 ` greearb [this message]
2011-06-17 19:40 ` [PATCH 2/2] e100: Support receiving Ethernet FCS greearb
2011-06-18 1:47 ` Jeff Kirsher
2011-06-17 20:00 ` [PATCH 0/2] Allow NICs to pass Frame Checksum up the stack Michał Mirosław
2011-06-17 20:48 ` Ben Greear
2011-06-17 20:57 ` Ben Hutchings
2011-06-17 20:58 ` Ben Greear
2011-06-19 23:21 ` David Miller
2011-06-19 23:51 ` Ben Greear
2011-06-19 23:54 ` David Miller
2011-06-19 23:58 ` Ben Greear
2011-06-19 23:20 ` 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=1308339615-5866-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).