Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1486098

Re: [PATCH net-next RESEND] xen-netfront: avoid packet loss when ethernet header crosses page boundary

From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [PATCH net-next RESEND] xen-netfront: avoid packet loss when ethernet header crosses page boundary
Date 2016-09-19 04:30 +0200
Message-ID <siWvg-80M-5@gated-at.bofh.it> (permalink)
References <shZ29-3Be-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Vitaly Kuznetsov <vkuznets@redhat.com>
Date: Fri, 16 Sep 2016 12:59:14 +0200

> @@ -595,6 +596,19 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
>  	offset = offset_in_page(skb->data);
>  	len = skb_headlen(skb);
>  
> +	/* The first req should be at least ETH_HLEN size or the packet will be
> +	 * dropped by netback.
> +	 */
> +	if (unlikely(PAGE_SIZE - offset < ETH_HLEN)) {
> +		nskb = skb_copy(skb, GFP_ATOMIC);
> +		if (!nskb)
> +			goto drop;
> +		dev_kfree_skb_any(skb);
> +		skb = nskb;
> +		page = virt_to_page(skb->data);
> +		offset = offset_in_page(skb->data);
> +	}
> +
>  	spin_lock_irqsave(&queue->tx_lock, flags);

I think you also have to recalculate 'len' in this case too, as
skb_headlen() will definitely be different for nskb.

In fact, I can't see how this code can work properly without that fix.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next RESEND] xen-netfront: avoid packet loss when ethernet header crosses page boundary Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-09-16 13:00 +0200
  Re: [PATCH net-next RESEND] xen-netfront: avoid packet loss when  ethernet header crosses page boundary David Miller <davem@davemloft.net> - 2016-09-19 04:30 +0200
    Re: [PATCH net-next RESEND] xen-netfront: avoid packet loss when  ethernet header crosses page boundary David Vrabel <david.vrabel@citrix.com> - 2016-09-19 12:30 +0200
      Re: [PATCH net-next RESEND] xen-netfront: avoid packet loss when ethernet header crosses page boundary Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-09-19 12:40 +0200
    Re: [PATCH net-next RESEND] xen-netfront: avoid packet loss when ethernet header crosses page boundary Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-09-19 12:30 +0200

csiph-web