From: John Fastabend <john.r.fastabend@intel.com>
To: netdev@vger.kernel.org
Cc: jesse@nicira.com
Subject: [RFC][net-next-2.6 PATCH 3/4] ethtool: set hard_header_len using ETH_FLAG_{TX|RX}VLAN
Date: Thu, 21 Oct 2010 15:10:15 -0700 [thread overview]
Message-ID: <20101021221015.22906.3516.stgit@jf-dev1-dcblab> (raw)
In-Reply-To: <20101021221004.22906.58438.stgit@jf-dev1-dcblab>
Toggling the vlan tx|rx hw offloads needs to set the hard_header_len
as well otherwise we end up using LL_RESERVED_SPACE incorrectly.
This results in pskb_expand_head() being used unnecessarily.
This add a check in ethtool_op_set_flags to catch the ETH_FLAG_TXVLAN
flag and set the header length.
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---
net/core/ethtool.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 956a9f4..4f7fe26 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -21,6 +21,7 @@
#include <linux/uaccess.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
+#include <linux/if_vlan.h>
/*
* Some useful ethtool_ops methods that're device independent.
@@ -151,6 +152,14 @@ int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported)
if (data & ~supported)
return -EINVAL;
+ /* is ETH_FLAGS_TXVLAN being toggled */
+ if ((dev->features & ETH_FLAG_TXVLAN) ^ (data & ETH_FLAG_TXVLAN)) {
+ if (data & ETH_FLAG_TXVLAN)
+ dev->hard_header_len -= VLAN_HLEN;
+ else
+ dev->hard_header_len += VLAN_HLEN;
+ }
+
dev->features = ((dev->features & ~flags_dup_features) |
(data & flags_dup_features));
return 0;
next prev parent reply other threads:[~2010-10-21 22:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-21 22:10 [RFC][net-next-2.6 PATCH 1/4] net: consolidate 8021q tagging John Fastabend
2010-10-21 22:10 ` [RFC][net-next-2.6 PATCH 2/4] net: 8021Q consolidate header_ops routines John Fastabend
2010-10-25 22:44 ` Jesse Gross
2010-11-04 0:47 ` Jesse Gross
2010-11-04 13:43 ` John Fastabend
2010-11-04 18:26 ` Jesse Gross
2010-10-21 22:10 ` John Fastabend [this message]
2010-10-22 13:00 ` [RFC][net-next-2.6 PATCH 3/4] ethtool: set hard_header_len using ETH_FLAG_{TX|RX}VLAN Ben Hutchings
2010-10-25 22:45 ` Jesse Gross
2010-10-26 21:58 ` John Fastabend
2010-10-21 22:10 ` [RFC][net-next-2.6 PATCH 4/4] net: remove check for headroom in vlan_dev_create John Fastabend
2010-10-25 22:45 ` Jesse Gross
2010-10-26 22:05 ` John Fastabend
2010-10-27 2:07 ` Jesse Gross
2010-10-25 22:44 ` [RFC][net-next-2.6 PATCH 1/4] net: consolidate 8021q tagging Jesse Gross
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=20101021221015.22906.3516.stgit@jf-dev1-dcblab \
--to=john.r.fastabend@intel.com \
--cc=jesse@nicira.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).