net: Fix GRO for multiple page fragments
Subsystems (2)
PATCH 1/1 net: Fix GRO for multiple page fragments
This loop over fragments in napi_fraginfo_skb() was "interesting".
---
This is not tested, as only cxgb3 will currently pass in multiple fragments at the same time. skb_shinfo(skb)->nr_frags would already be 0 but it makes no sense to rely on that. I hope I'm not missing some subtlety...
Ben.
net/core/dev.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
net/core/dev.c +2 -2
@@ -2539,9 +2539,9 @@ struct sk_buff *napi_fraginfo_skb(struct napi_struct *napi, }BUG_ON (info->nr_frags >MAX_SKB_FRAGS ); - frag = &info->frags[info->nr_frags -1 ]; + frag = info->frags; -for (i =skb_shinfo (skb)->nr_frags; i < info->nr_frags; i++) { +for (i =0 ; i < info->nr_frags; i++) {skb_fill_page_desc (skb, i, frag->page, frag->page_offset, frag->size); frag++;
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
David Miller
maintainerFrom: Ben Hutchings <[email protected]>
Date: Thu, 16 Apr 2009 19:04:20 +0100
Quoted 8 lines
This loop over fragments in
napi_fraginfo_skb()was "interesting".Signed-off-by Ben Hutchings <[email protected]>---
This is not tested, as only cxgb3 will currently pass in multiple fragments at the same time. skb_shinfo(skb)->nr_frags would already be 0 but it makes no sense to rely on that. I hope I'm not missing some subtlety...
I think the code still isn't right after your changes.
The intent seems to be to append frags from 'info' into the SKB, so that it works even if the SKB already has some frags.
And being that cxgb3 is pretty well tested with GRO I'm suspicious even moreso :-)
Herbert?
Quoted 22 lines
net/core/dev.c +2
-2@@ -2539,9 +2539,9 @@ struct sk_buff *napi_fraginfo_skb(struct napi_struct *napi, }BUG_ON (info->nr_frags >MAX_SKB_FRAGS ); - frag = &info->frags[info->nr_frags -1 ]; + frag = info->frags; -for (i =skb_shinfo (skb)->nr_frags; i < info->nr_frags; i++) { +for (i =0 ; i < info->nr_frags; i++) {skb_fill_page_desc (skb, i, frag->page, frag->page_offset, frag->size); frag++;Signature · 4 lines
-- Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Quoted 10 lines · David Miller
I think the code still isn't right after your changes.
The intent seems to be to append frags from 'info' into the SKB, so that it works even if the SKB already has some frags.
And being that cxgb3 is pretty well tested with GRO I'm suspicious even moreso :-)
Herbert?
Ah, I'd replied via private email to Ben. This whole loop no longer exists in net-next. As for 2.6.30, the existing loop should be correct.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtQuoted 7 lines · Herbert Xu
Quoted 6 lines · David Miller
I think the code still isn't right after your changes.
The intent seems to be to append frags from 'info' into the SKB, so that it works even if the SKB already has some frags.
Quoted 8 lines
Quoted 4 lines
And being that cxgb3 is pretty well tested with GRO I'm suspicious even moreso :-)
Herbert?
Ah, I'd replied via private email to Ben. This whole loop no longer exists in net-next. As for 2.6.30, the existing loop should be correct.
The loop is iterating forward, not backward, so why initialise frag to point to the last fragment?
Ben.
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Quoted 3 lines · Ben Hutchings
The loop is iterating forward, not backward, so why initialise frag to point to the last fragment?
Ah yes, that's completely bogus. I suppose it only works because the current users only supply one frag under normal circumstanses.
Yes we should integrate your patch for 2.6.30. For net-next the loop no longer exists so it should be fine.
Thanks,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtDavid Miller
maintainerFrom: Herbert Xu <[email protected]>
Date: Fri, 17 Apr 2009 22:48:12 +0800
Quoted 10 lines · Ben Hutchings
Quoted 3 lines
The loop is iterating forward, not backward, so why initialise frag to point to the last fragment?
Ah yes, that's completely bogus. I suppose it only works because the current users only supply one frag under normal circumstanses.
Yes we should integrate your patch for 2.6.30. For net-next the loop no longer exists so it should be fine.
I've applied Ben's patch.
Quoted 12 lines · David Miller
From: Ben Hutchings <[email protected]>
Date: Thu, 16 Apr 2009 19:04:20 +0100Quoted 8 lines
This loop over fragments in
napi_fraginfo_skb()was "interesting".Signed-off-by Ben Hutchings <[email protected]>---
This is not tested, as only cxgb3 will currently pass in multiple fragments at the same time. skb_shinfo(skb)->nr_frags would already be 0 but it makes no sense to rely on that. I hope I'm not missing some subtlety...
Quoted 4 lines
I think the code still isn't right after your changes.
The intent seems to be to append frags from 'info' into the SKB, so that it works even if the SKB already has some frags.
[...]
This function is setting up a 'new' skb from the fragments it's given. To avoid allocation overhead it recycles skbs via napi->skb if they are merged (or otherwise discarded). There should be no data attached to the recycled skb.
Ben.
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.