From: Ben Hutchings <bhutchings@solarflare.com>
To: netdev@vger.kernel.org
Cc: linux-net-drivers@solarflare.com
Subject: [PATCH][RFC] TSO for VLAN devices without VLAN tag insertion
Date: Tue, 10 Jun 2008 20:59:44 +0100 [thread overview]
Message-ID: <20080610195943.GO11300@solarflare.com> (raw)
The SFC4000 controller can set IP header, TCP and UDP checksums in IPv4
packets, with or without VLAN encapsulation. However it does not do VLAN
tag insertion.
When I try to make TSO work for VLAN devices via the new vlan_features,
dev_queue_xmit() finds skb->ip_summed == CHECKSUM_PARTIAL &&
skb->protocol == htons(ETH_P_8021Q) and calls skb_checksum_help(), which
sets skb->ip_summed = CHECKSUM_NONE.
This causes netif_needs_gso() to return true when called by
dev_hard_start_xmit(), and GSO then does its worst.
Below is a patch which worked for me, but I'm not sure whether it's the
best way to fix the problem (so I'm not submitting or signing it off yet).
Ben.
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -119,6 +119,7 @@
#include <linux/err.h>
#include <linux/ctype.h>
#include <linux/if_arp.h>
+#include <linux/if_vlan.h>
#include "net-sysfs.h"
@@ -1638,14 +1639,24 @@ int dev_queue_xmit(struct sk_buff *skb)
* checksumming for this protocol, complete checksumming here.
*/
if (skb->ip_summed == CHECKSUM_PARTIAL) {
+ unsigned long features = dev->features;
+ __be16 protocol = skb->protocol;
+
+ if (protocol == htons(ETH_P_8021Q)) {
+ struct vlan_ethhdr *veh =
+ (struct vlan_ethhdr *)skb->data;
+ features &= dev->vlan_features;
+ protocol = veh->h_vlan_encapsulated_proto;
+ }
+
skb_set_transport_header(skb, skb->csum_start -
skb_headroom(skb));
- if (!(dev->features & NETIF_F_GEN_CSUM) &&
- !((dev->features & NETIF_F_IP_CSUM) &&
- skb->protocol == htons(ETH_P_IP)) &&
- !((dev->features & NETIF_F_IPV6_CSUM) &&
- skb->protocol == htons(ETH_P_IPV6)))
+ if (!(features & NETIF_F_GEN_CSUM) &&
+ !((features & NETIF_F_IP_CSUM) &&
+ protocol == htons(ETH_P_IP)) &&
+ !((features & NETIF_F_IPV6_CSUM) &&
+ protocol == htons(ETH_P_IPV6)))
if (skb_checksum_help(skb))
goto out_kfree_skb;
}
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
next reply other threads:[~2008-06-10 19:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-10 19:59 Ben Hutchings [this message]
2008-06-12 12:02 ` [PATCH][RFC] TSO for VLAN devices without VLAN tag insertion Patrick McHardy
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=20080610195943.GO11300@solarflare.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.