From: Ben Hutchings <bhutchings@solarflare.com>
To: <netdev@vger.kernel.org>
Cc: <linux-net-drivers@solarflare.com>
Subject: [PATCH ethtool 1/2] Revert "Fix reporting of VLAN tag offload flags on Linux < 2.6.37"
Date: Tue, 24 Sep 2013 00:24:58 +0100 [thread overview]
Message-ID: <1379978698.2485.85.camel@bwh-desktop.uk.level5networks.com> (raw)
This reverts commit 1cddbe64cfc66b58988c85086d6df3a77c0c61a5.
It causes 'ethtool -K' to pass the VLAN tag offload flags to
ETHTOOL_SFLAGS when they are not supported and will be rejected.
---
ethtool.c | 41 -----------------------------------------
1 file changed, 41 deletions(-)
diff --git a/ethtool.c b/ethtool.c
index dcdc0a9..2dc07d3 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -35,8 +35,6 @@
#include <sys/utsname.h>
#include <limits.h>
#include <ctype.h>
-#include <assert.h>
-#include <sys/fcntl.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -1506,31 +1504,6 @@ static struct feature_defs *get_feature_defs(struct cmd_context *ctx)
return defs;
}
-static int get_netdev_attr(struct cmd_context *ctx, const char *name,
- char *buf, size_t buf_len)
-{
-#ifdef TEST_ETHTOOL
- errno = ENOENT;
- return -1;
-#else
- char path[40 + IFNAMSIZ];
- ssize_t len;
- int fd;
-
- len = snprintf(path, sizeof(path), "/sys/class/net/%s/%s",
- ctx->devname, name);
- assert(len < sizeof(path));
- fd = open(path, O_RDONLY);
- if (fd < 0)
- return fd;
- len = read(fd, buf, buf_len - 1);
- if (len >= 0)
- buf[len] = 0;
- close(fd);
- return len;
-#endif
-}
-
static int do_gdrv(struct cmd_context *ctx)
{
int err;
@@ -1972,20 +1945,6 @@ get_features(struct cmd_context *ctx, const struct feature_defs *defs)
perror("Cannot get device generic features");
else
allfail = 0;
- } else {
- /* We should have got VLAN tag offload flags through
- * ETHTOOL_GFLAGS. However, prior to Linux 2.6.37
- * they were not exposed in this way - and since VLAN
- * tag offload was defined and implemented by many
- * drivers, we shouldn't assume they are off.
- * Instead, since these feature flag values were
- * stable, read them from sysfs.
- */
- char buf[20];
- if (get_netdev_attr(ctx, "features", buf, sizeof(buf)) > 0)
- state->off_flags |=
- strtoul(buf, NULL, 0) &
- (ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN);
}
if (allfail) {
--
1.8.1.4
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
next reply other threads:[~2013-09-23 23:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-23 23:24 Ben Hutchings [this message]
2013-10-01 15:35 ` [PATCH ethtool 1/2] Revert "Fix reporting of VLAN tag offload flags on Linux < 2.6.37" Ben Hutchings
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=1379978698.2485.85.camel@bwh-desktop.uk.level5networks.com \
--to=bhutchings@solarflare.com \
--cc=linux-net-drivers@solarflare.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