* Re: virtio-net header alignment [not found] ` <1243268223.32745.25.camel@blaa> @ 2009-06-10 5:12 ` Herbert Xu 2009-06-11 12:39 ` David Miller 2009-06-11 18:01 ` Sridhar Samudrala 0 siblings, 2 replies; 6+ messages in thread From: Herbert Xu @ 2009-06-10 5:12 UTC (permalink / raw) To: Mark McLoughlin Cc: Rusty Russell, Danielius Kudinskas, aliguori, Paul T Knowles, netdev On Mon, May 25, 2009 at 05:17:03PM +0100, Mark McLoughlin wrote: > > Perhaps; would padding struct virtio_net_hdr_mrg_rxbuf have avoided it? > > Cc-ing Herbert, he initially wrote the guest side of this. Does this fix it? virtio_net: Fix IP alignment on mergeable RX path We need to enforce the IP alignment on the mergeable RX path just like the other RX path. Not doing so results in misaligned IP headers. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 4d1d479..52fba8e 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -283,10 +283,11 @@ static void try_fill_recv_maxbufs(struct virtnet_info *vi) for (;;) { struct virtio_net_hdr *hdr; - skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN); + skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN + NET_IP_ALIGN); if (unlikely(!skb)) break; + skb_reserve(skb, NET_IP_ALIGN); skb_put(skb, MAX_PACKET_LEN); hdr = skb_vnet_hdr(skb); Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: virtio-net header alignment 2009-06-10 5:12 ` virtio-net header alignment Herbert Xu @ 2009-06-11 12:39 ` David Miller 2009-06-11 18:01 ` Sridhar Samudrala 1 sibling, 0 replies; 6+ messages in thread From: David Miller @ 2009-06-11 12:39 UTC (permalink / raw) To: herbert; +Cc: markmc, rusty, kudinskas, aliguori, pablo, netdev From: Herbert Xu <herbert@gondor.apana.org.au> Date: Wed, 10 Jun 2009 15:12:27 +1000 > On Mon, May 25, 2009 at 05:17:03PM +0100, Mark McLoughlin wrote: >> >> Perhaps; would padding struct virtio_net_hdr_mrg_rxbuf have avoided it? >> >> Cc-ing Herbert, he initially wrote the guest side of this. > > Does this fix it? > > virtio_net: Fix IP alignment on mergeable RX path > > We need to enforce the IP alignment on the mergeable RX path just > like the other RX path. Not doing so results in misaligned IP > headers. > > Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> I'll apply this as soon as I see some test reports. Has anyone had a chance to try this out yet? ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: virtio-net header alignment 2009-06-10 5:12 ` virtio-net header alignment Herbert Xu 2009-06-11 12:39 ` David Miller @ 2009-06-11 18:01 ` Sridhar Samudrala 2009-06-11 20:50 ` Herbert Xu 1 sibling, 1 reply; 6+ messages in thread From: Sridhar Samudrala @ 2009-06-11 18:01 UTC (permalink / raw) To: Herbert Xu Cc: Mark McLoughlin, Rusty Russell, Danielius Kudinskas, aliguori, Paul T Knowles, netdev On Wed, 2009-06-10 at 15:12 +1000, Herbert Xu wrote: > On Mon, May 25, 2009 at 05:17:03PM +0100, Mark McLoughlin wrote: > > > > Perhaps; would padding struct virtio_net_hdr_mrg_rxbuf have avoided it? > > > > Cc-ing Herbert, he initially wrote the guest side of this. > > Does this fix it? > > virtio_net: Fix IP alignment on mergeable RX path > > We need to enforce the IP alignment on the mergeable RX path just > like the other RX path. Not doing so results in misaligned IP > headers. I think this fixes the old RX path rather than the mergeable RX path. try_fill_recv_maxbufs() is called from try_fill_recv() if (!vi->mergeable_rx_bufs) { try_fill_recv_maxbufs(vi); return; } -Sridhar > > Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index 4d1d479..52fba8e 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -283,10 +283,11 @@ static void try_fill_recv_maxbufs(struct virtnet_info *vi) > for (;;) { > struct virtio_net_hdr *hdr; > > - skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN); > + skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN + NET_IP_ALIGN); > if (unlikely(!skb)) > break; > > + skb_reserve(skb, NET_IP_ALIGN); > skb_put(skb, MAX_PACKET_LEN); > > hdr = skb_vnet_hdr(skb); > > Cheers, ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: virtio-net header alignment 2009-06-11 18:01 ` Sridhar Samudrala @ 2009-06-11 20:50 ` Herbert Xu 2009-06-11 22:59 ` [PATCH] virtio_net: Fix IP alignment on non-mergeable RX path Rusty Russell 0 siblings, 1 reply; 6+ messages in thread From: Herbert Xu @ 2009-06-11 20:50 UTC (permalink / raw) To: Sridhar Samudrala Cc: Mark McLoughlin, Rusty Russell, Danielius Kudinskas, aliguori, Paul T Knowles, netdev On Thu, Jun 11, 2009 at 11:01:06AM -0700, Sridhar Samudrala wrote: > > I think this fixes the old RX path rather than the mergeable RX path. > try_fill_recv_maxbufs() is called from try_fill_recv() > > if (!vi->mergeable_rx_bufs) { > try_fill_recv_maxbufs(vi); > return; > } Yes you're right. We should do s/mergeable/non-mergeable/ in the changelog :) Thanks, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] virtio_net: Fix IP alignment on non-mergeable RX path 2009-06-11 20:50 ` Herbert Xu @ 2009-06-11 22:59 ` Rusty Russell 2009-06-12 3:55 ` David Miller 0 siblings, 1 reply; 6+ messages in thread From: Rusty Russell @ 2009-06-11 22:59 UTC (permalink / raw) To: Herbert Xu Cc: Sridhar Samudrala, Mark McLoughlin, Danielius Kudinskas, aliguori, Paul T Knowles, netdev From: Herbert Xu <herbert@gondor.apana.org.au> We need to enforce the IP alignment on the non-mergeable RX path just like the other RX path. Not doing so results in misaligned IP headers. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 4d1d479..52fba8e 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -283,10 +283,11 @@ static void try_fill_recv_maxbufs(struct virtnet_info *vi) for (;;) { struct virtio_net_hdr *hdr; - skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN); + skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN + NET_IP_ALIGN); if (unlikely(!skb)) break; + skb_reserve(skb, NET_IP_ALIGN); skb_put(skb, MAX_PACKET_LEN); hdr = skb_vnet_hdr(skb); ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] virtio_net: Fix IP alignment on non-mergeable RX path 2009-06-11 22:59 ` [PATCH] virtio_net: Fix IP alignment on non-mergeable RX path Rusty Russell @ 2009-06-12 3:55 ` David Miller 0 siblings, 0 replies; 6+ messages in thread From: David Miller @ 2009-06-12 3:55 UTC (permalink / raw) To: rusty; +Cc: herbert, sri, markmc, kudinskas, aliguori, pablo, netdev From: Rusty Russell <rusty@rustcorp.com.au> Date: Fri, 12 Jun 2009 08:29:22 +0930 > From: Herbert Xu <herbert@gondor.apana.org.au> > > We need to enforce the IP alignment on the non-mergeable RX path just > like the other RX path. Not doing so results in misaligned IP > headers. > > Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> > Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Applied, thanks everyone. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-06-12 3:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <OF1B881599.F1B4A2EF-ON802575BB.0036EA40-802575BC.0041BFB5@au1.ibm.com>
[not found] ` <200905251601.29327.rusty@rustcorp.com.au>
[not found] ` <1243268223.32745.25.camel@blaa>
2009-06-10 5:12 ` virtio-net header alignment Herbert Xu
2009-06-11 12:39 ` David Miller
2009-06-11 18:01 ` Sridhar Samudrala
2009-06-11 20:50 ` Herbert Xu
2009-06-11 22:59 ` [PATCH] virtio_net: Fix IP alignment on non-mergeable RX path Rusty Russell
2009-06-12 3:55 ` David Miller
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).