Patchwork [1/2] net: allow multiple dev per napi with GRO

login
register
mail settings
Submitter stephen hemminger
Date April 1, 2009, 9:20 p.m.
Message ID <20090401142020.395f51bb@nehalam>
Download mbox | patch
Permalink /patch/25499/
State Accepted
Delegated to: David Miller
Headers show

Comments

stephen hemminger - April 1, 2009, 9:20 p.m.
GRO assumes that there is a one-to-one relationship between NAPI
structure and network device. Some devices like sky2 share multiple
devices on a single interrupt so only have one NAPI handler. Rather than
split GRO from NAPI, just have GRO assume if device changes that
it is a different flow.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - April 2, 2009, 8:08 a.m.
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 1 Apr 2009 14:20:20 -0700

> GRO assumes that there is a one-to-one relationship between NAPI
> structure and network device. Some devices like sky2 share multiple
> devices on a single interrupt so only have one NAPI handler. Rather than
> split GRO from NAPI, just have GRO assume if device changes that
> it is a different flow.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Looks good, applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Herbert Xu - April 2, 2009, 8:28 a.m.
On Thu, Apr 02, 2009 at 01:08:01AM -0700, David Miller wrote:
> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Wed, 1 Apr 2009 14:20:20 -0700
> 
> > GRO assumes that there is a one-to-one relationship between NAPI
> > structure and network device. Some devices like sky2 share multiple
> > devices on a single interrupt so only have one NAPI handler. Rather than
> > split GRO from NAPI, just have GRO assume if device changes that
> > it is a different flow.
> > 
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> Looks good, applied.

Yep, looks good to me too.  It's only the non-skb interface that
can't handle a shared napi as it uses napi->dev to construct the
skb.

I'm currently experimenting with a new interface to replace the
existing non-skb interface.  The idea is to get the driver to do
what we currently do in napi_fraginfo_skb through helpers.  This
should remove the usage of napi->dev.  It should also remove the
unnecessary double-copying of the frags array.

Cheers,

Patch

--- a/net/core/dev.c	2009-04-01 12:02:12.381316147 -0700
+++ b/net/core/dev.c	2009-04-01 12:07:29.718192280 -0700
@@ -2472,8 +2472,9 @@  static int __napi_gro_receive(struct nap
 		return GRO_NORMAL;
 
 	for (p = napi->gro_list; p; p = p->next) {
-		NAPI_GRO_CB(p)->same_flow = !compare_ether_header(
-			skb_mac_header(p), skb_gro_mac_header(skb));
+		NAPI_GRO_CB(p)->same_flow = (p->dev == skb->dev)
+			&& !compare_ether_header(skb_mac_header(p),
+						 skb_gro_mac_header(skb));
 		NAPI_GRO_CB(p)->flush = 0;
 	}