[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTimHQhOWxj-2ParX_-Tfyhf=OmkkWpq34chixX6=@mail.gmail.com>
Date: Mon, 13 Dec 2010 14:20:57 -0800
From: Jesse Gross <jesse@...ira.com>
To: Ben Hutchings <bhutchings@...arflare.com>
Cc: David Miller <davem@...emloft.net>,
Jay Vosburgh <fubar@...ibm.com>, netdev@...r.kernel.org,
linux-net-drivers@...arflare.com
Subject: Re: [PATCH net-2.6 3/3] bonding/vlan: Fix mangled NAs on slaves
without VLAN tag insertion
On Mon, Dec 13, 2010 at 10:20 AM, Ben Hutchings
<bhutchings@...arflare.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@...arflare.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@...ira.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists