Re: [PATCH] net: Fix vlan_gro_frags vs netpoll and bonding paths

Herbert Xu
2010-08-28T00:13:43Z

On Fri, Aug 27, 2010 at 10:50:42PM +0200, Jarek Poplawski wrote:
> After positive netpoll_rx_on() check in vlan_gro_receive() there is
> skipped part of the "common" GRO_NORMAL path, especially "pull:" in
> dev_gro_receive(), where at least eth header should be copied for
> entirely paged skbs. So, eth_type_trans() can read zeroed header only.

Right, thanks for catching this.

> diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
> index 01ddb04..58289fe 100644
> --- a/net/8021q/vlan_core.c
> +++ b/net/8021q/vlan_core.c
> @@ -139,13 +139,19 @@ gro_result_t vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
> if (!skb)
> return GRO_DROP;
>
> - if (netpoll_rx_on(skb)) {
> - skb->protocol = eth_type_trans(skb, skb->dev);
> + /*
> + * Complete the eth header here, mainly for skb_bond_should_drop(),
> + * and for netpoll_rx_on() btw.
> + */
> + skb_gro_pull_in(skb);
> + skb->protocol = eth_type_trans(skb, skb->dev);
> + skb_gro_pull(skb, -ETH_HLEN);

But this code should go into the netpoll (i.e., slow-path) case
only so as not to impede performance.

Also, we need to fix this for the non-VLAN case as well.

Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt