From: John Fastabend <john.r.fastabend@intel.com>
To: jesse@nicira.com
Cc: john.r.fastabend@intel.com, netdev@vger.kernel.org,
bhutchings@solarflare.com
Subject: [RFC][net-next-2.6 PATCH v2] 8021q: set hard_header_len when VLAN offload features are toggled
Date: Tue, 26 Oct 2010 14:59:33 -0700 [thread overview]
Message-ID: <20101026215933.2339.45454.stgit@jf-dev1-dcblab> (raw)
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 vlan_transfer_features to catch the ETH_FLAG_TXVLAN
flag and set the header length. This requires drivers to add the
ETH_FLAG_TXVLAN to vlan_features.
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---
net/8021q/vlan.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 05b867e..825011b 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -334,6 +334,16 @@ static void vlan_transfer_features(struct net_device *dev,
vlandev->features &= ~dev->vlan_features;
vlandev->features |= dev->features & dev->vlan_features;
vlandev->gso_max_size = dev->gso_max_size;
+
+ /* is ETH_FLAGS_TXVLAN being toggled */
+ if ((vlandev->features & ETH_FLAG_TXVLAN) ^
+ (old_features & ETH_FLAG_TXVLAN)) {
+ if (vlandev->features & ETH_FLAG_TXVLAN)
+ vlandev->hard_header_len -= VLAN_HLEN;
+ else
+ vlandev->hard_header_len += VLAN_HLEN;
+ }
+
#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
vlandev->fcoe_ddp_xid = dev->fcoe_ddp_xid;
#endif
next reply other threads:[~2010-10-26 22:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-26 21:59 John Fastabend [this message]
2010-10-27 2:05 ` [RFC][net-next-2.6 PATCH v2] 8021q: set hard_header_len when VLAN offload features are toggled Jesse Gross
2010-10-27 21:40 ` John Fastabend
2010-10-27 23:04 ` 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=20101026215933.2339.45454.stgit@jf-dev1-dcblab \
--to=john.r.fastabend@intel.com \
--cc=bhutchings@solarflare.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).