From: Jesse Gross <jesse@nicira.com>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: David Miller <davem@davemloft.net>,
Jay Vosburgh <fubar@us.ibm.com>,
netdev@vger.kernel.org, linux-net-drivers@solarflare.com
Subject: Re: [PATCH net-2.6 3/3] bonding/vlan: Fix mangled NAs on slaves without VLAN tag insertion
Date: Mon, 13 Dec 2010 14:20:57 -0800 [thread overview]
Message-ID: <AANLkTimHQhOWxj-2ParX_-Tfyhf=OmkkWpq34chixX6=@mail.gmail.com> (raw)
In-Reply-To: <1292264424.9860.15.camel@bwh-desktop>
On Mon, Dec 13, 2010 at 10:20 AM, Ben Hutchings
<bhutchings@solarflare.com> wrote:
> bond_na_send() attempts to insert a VLAN tag in between building and
> sending packets of the respective formats. If the slave does not
> implement hardware VLAN tag insertion then vlan_put_tag() will mangle
> the network-layer header because the Ethernet header is not present at
> this point (unlike in bond_arp_send()).
>
> Fix this by adding the tag out-of-line and relying on
> dev_hard_start_xmit() to insert it inline if necessary.
>
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> ---
> drivers/net/bonding/bond_ipv6.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_ipv6.c b/drivers/net/bonding/bond_ipv6.c
> index 121b073..84fbd4e 100644
> --- a/drivers/net/bonding/bond_ipv6.c
> +++ b/drivers/net/bonding/bond_ipv6.c
> @@ -88,7 +88,12 @@ static void bond_na_send(struct net_device *slave_dev,
> }
>
> if (vlan_id) {
> - skb = vlan_put_tag(skb, vlan_id);
> + /* The Ethernet header is not present yet, so it is
> + * too early to insert a VLAN tag. Force use of an
> + * out-of-line tag here and let dev_hard_start_xmit()
> + * insert it if the slave hardware can't.
> + */
> + skb = __vlan_hwaccel_put_tag(skb, vlan_id);
> if (!skb) {
> pr_err("failed to insert VLAN tag\n");
> return;
You could drop the check for !skb, since __vlan_hwaccel_put_tag() can
never fail.
Actually, my plan is to remove all current users of vlan_put_tag() and
replace them with __vlan_hwaccel_put_tag (and then rename that to
vlan_put_tag()). There's really no reason why the upper layers should
have to care what the underlying device is capable of, now that
dev_hard_start_xmit() can handle it.
Reviewed-by: Jesse Gross <jesse@nicira.com>
prev parent reply other threads:[~2010-12-13 22:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-13 18:16 [PATCH net-next-2.6 0/3] bonding fixes Ben Hutchings
2010-12-13 18:18 ` Ben Hutchings
2010-12-16 20:42 ` David Miller
2010-12-13 18:19 ` [PATCH net-2.6 1/3] bonding/vlan: Remove redundant VLAN tag insertion logic Ben Hutchings
2010-12-13 19:58 ` Jay Vosburgh
2010-12-13 22:08 ` Jesse Gross
2010-12-13 18:19 ` [PATCH net-2.6 2/3] bonding: Change active slave quietly when bond is down Ben Hutchings
2010-12-13 20:41 ` Jay Vosburgh
2010-12-13 21:06 ` Ben Hutchings
2010-12-21 2:46 ` Flavio Leitner
2010-12-13 18:20 ` [PATCH net-2.6 3/3] bonding/vlan: Fix mangled NAs on slaves without VLAN tag insertion Ben Hutchings
2010-12-13 20:43 ` Jay Vosburgh
2010-12-13 22:20 ` Jesse Gross [this message]
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='AANLkTimHQhOWxj-2ParX_-Tfyhf=OmkkWpq34chixX6=@mail.gmail.com' \
--to=jesse@nicira.com \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=fubar@us.ibm.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;
as well as URLs for NNTP newsgroup(s).