Skip to contentSkip to conversation

net: Fix vlan_gro_frags vs netpoll and bonding paths

PATCH In review Jarek Poplawski 5 participants 40 messages Aug 27, 2010 – Sep 3, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: Fix vlan_gro_frags vs netpoll and bonding paths

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.

Alas moving the netpoll_rx_on() check isn't enough here because a bit later, in vlan_gro_common(), skb_bond_should_drop() is called, which depends on skb->protocol and skb->pkt_type data, and can also change eth_hdr h_dest address (which is overwritten later, btw).

To fix both problems this patch completes copying and verifying of eth header from the fragment in vlan_gro_receive(). For that purpose the "pull:" part of dev_gro_receive() was separated into an inline as skb_gro_pull_in(), and there was added a "lighter" version of napi_frags_finish(). No gro path except vlan_gro_frags() should be affected by these changes.

---

 include/linux/netdevice.h |   33 ++++++++++++++++++++++++++++++
 net/8021q/vlan_core.c     |   16 ++++++++++----
 net/core/dev.c            |   48 +++++++++++++++++++++++++-------------------
 3 files changed, 71 insertions(+), 26 deletions(-)
include/linux/netdevice.h +33 -0
index 46c36ff..ad59f76 100644
@@ -1339,6 +1339,36 @@ static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len)
 	NAPI_GRO_CB(skb)->data_offset += len;
 }
 
+/*
+ * Complete pulling of the header(s) from the fragment
+ */
+static inline void skb_gro_pull_in(struct sk_buff *skb)
+{
+	int grow;
+
+	if (skb_headlen(skb) >= skb_gro_offset(skb))
+		return;
+
+	grow = skb_gro_offset(skb) - skb_headlen(skb);
+
+	BUG_ON(skb->end - skb->tail < grow);
+
+	memcpy(skb_tail_pointer(skb), NAPI_GRO_CB(skb)->frag0, grow);
+
+	skb->tail += grow;
+	skb->data_len -= grow;
+
+	skb_shinfo(skb)->frags[0].page_offset += grow;
+	skb_shinfo(skb)->frags[0].size -= grow;
+
+	if (unlikely(!skb_shinfo(skb)->frags[0].size)) {
+		put_page(skb_shinfo(skb)->frags[0].page);
+		memmove(skb_shinfo(skb)->frags,
+			skb_shinfo(skb)->frags + 1,
+			--skb_shinfo(skb)->nr_frags * sizeof(skb_frag_t));
+	}
+}
+
 static inline void *skb_gro_header_fast(struct sk_buff *skb,
 					unsigned int offset)
 {
@@ -1701,6 +1731,9 @@ extern struct sk_buff *	napi_get_frags(struct napi_struct *napi);
 extern gro_result_t	napi_frags_finish(struct napi_struct *napi,
 					  struct sk_buff *skb,
 					  gro_result_t ret);
+extern gro_result_t	__napi_frags_finish(struct napi_struct *napi,
+					    struct sk_buff *skb,
+					    gro_result_t ret);
 extern struct sk_buff *	napi_frags_skb(struct napi_struct *napi);
 extern gro_result_t	napi_gro_frags(struct napi_struct *napi);
 
net/8021q/vlan_core.c +11 -5
index 01ddb04..58289fe 100644
@@ -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);
+
+	if (netpoll_rx_on(skb))
 		return vlan_hwaccel_receive_skb(skb, grp, vlan_tci)
 			? GRO_DROP : GRO_NORMAL;
-	}
 
-	return napi_frags_finish(napi, skb,
-				 vlan_gro_common(napi, grp, vlan_tci, skb));
+	return __napi_frags_finish(napi, skb,
+				   vlan_gro_common(napi, grp, vlan_tci, skb));
 }
 EXPORT_SYMBOL(vlan_gro_frags);
net/core/dev.c +27 -21

60 lines not on this page · raw message

#1 lore raw
Quoted 4 lines · Jarek Poplawski

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.

Quoted 7 lines
net/8021q/vlan_core.c +0 -0
index 01ddb04..58289fe 100644
@@ -139,13 +139,19 @@ gro_result_t vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
 	if (!skb)
 		return GRO_DROP;

net/8021q/vlan_core.c gro_result_t vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp, · line 148

Quoted 10 lines
net/8021q/vlan_core.c +7 -2
 
-	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,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#2 lore raw
Quoted 16 lines · Herbert Xu
Quoted 4 lines · Jarek Poplawski

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.

Quoted 8 lines
net/8021q/vlan_core.c +0 -0
index 01ddb04..58289fe 100644
@@ -139,13 +139,19 @@ gro_result_t vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
 	if (!skb)
 		return GRO_DROP;
 
Quoted 12 lines

net/8021q/vlan_core.c gro_result_t vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp, · line 148

Quoted 9 lines
net/8021q/vlan_core.c +7 -2
-	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.

I'm not sure I can understand. What about skb_bond_should_drop() mentioned in the comments? IMHO we have to impede performance a bit (and treat it similarly to non-fragmented path) just to fix it, and consider optimization of this bonding call later.

Quoted 2 lines

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

But the only other non-VLAN case I know was fixed already...

Cheers,
Jarek P.

#3 lore raw

[RFC] gro: Is it ok to share a single napi from several devs ?

In commit f2bde7328633269ee935d9ed96535ade15cc348f
Author: Stephen Hemminger <[email protected]>

net: allow multiple dev per napi with GRO

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.

It was assumed a napi could be shared by several devs, but I dont really understand, since we have an unique ->dev pointer inside "napi_struct", this one is set once, and never change.

This pointer is currently used from napi_get_frags() [but that could be avoided], and from netpoll_poll_lock().

The netpoll_poll_lock() case is problematic.

static inline void *netpoll_poll_lock(struct napi_struct *napi)

{
        struct net_device *dev = napi->_dev;

        if (dev && dev->npinfo) {
                spin_lock(&napi->poll_lock);

Maybe we should remove 'dev' field from napi_struct and replace it by a npinfo pointer ?

#4 lore raw

Re: [RFC] gro: Is it ok to share a single napi from several devs ?

Quoted 22 lines · Eric Dumazet

In commit f2bde7328633269ee935d9ed96535ade15cc348f
Author: Stephen Hemminger <[email protected]>

net: allow multiple dev per napi with GRO

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.

It was assumed a napi could be shared by several devs, but I dont really understand, since we have an unique ->dev pointer inside "napi_struct", this one is set once, and never change.

This pointer is currently used from napi_get_frags() [but that could be avoided], and from netpoll_poll_lock().

The netpoll_poll_lock() case is problematic.

static inline void *netpoll_poll_lock(struct napi_struct *napi)

Quoted 8 lines
{
        struct net_device *dev = napi->_dev;

        if (dev && dev->npinfo) {
                spin_lock(&napi->poll_lock);

Maybe we should remove 'dev' field from napi_struct and replace it by a npinfo pointer ?

Sky2 seems to work like a single netdev (with an internal sub-netdev), so I can't see your concern: what is the main aim of this replacement?

Jarek P.

#5 lore raw

Re: [RFC] gro: Is it ok to share a single napi from several devs ?

Quoted 26 lines · Jarek Poplawski
Quoted 25 lines · Eric Dumazet

In commit f2bde7328633269ee935d9ed96535ade15cc348f
Author: Stephen Hemminger <[email protected]>

net: allow multiple dev per napi with GRO

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.

It was assumed a napi could be shared by several devs, but I dont really understand, since we have an unique ->dev pointer inside "napi_struct", this one is set once, and never change.

This pointer is currently used from napi_get_frags() [but that could be avoided], and from netpoll_poll_lock().

The netpoll_poll_lock() case is problematic.

static inline void *netpoll_poll_lock(struct napi_struct *napi)

{
        struct net_device *dev = napi->_dev;
Quoted 8 lines
Quoted 5 lines
        if (dev && dev->npinfo) {
                spin_lock(&napi->poll_lock);

Maybe we should remove 'dev' field from napi_struct and replace it by a npinfo pointer ?

Sky2 seems to work like a single netdev (with an internal sub-netdev), so I can't see your concern: what is the main aim of this replacement?

I am trying to understand why this commit was needed then.

It adds an extra test in the main loop, testing skb->dev against p->dev, it must me for something...

I am trying to say that the one to one relationship between NAPI structure and a device is not only a GRO thing, but also a netpoll one.

So either we completely remove this one to one relationship, either Stephen commit was not needed.

Some clarification is needed.

#6 lore raw

Re: [RFC] gro: Is it ok to share a single napi from several devs ?

Quoted 36 lines · Eric Dumazet
Quoted 26 lines · Jarek Poplawski
Quoted 25 lines · Eric Dumazet

In commit f2bde7328633269ee935d9ed96535ade15cc348f
Author: Stephen Hemminger <[email protected]>

net: allow multiple dev per napi with GRO

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.

It was assumed a napi could be shared by several devs, but I dont really understand, since we have an unique ->dev pointer inside "napi_struct", this one is set once, and never change.

This pointer is currently used from napi_get_frags() [but that could be avoided], and from netpoll_poll_lock().

The netpoll_poll_lock() case is problematic.

static inline void *netpoll_poll_lock(struct napi_struct *napi)

{
        struct net_device *dev = napi->_dev;
Quoted 8 lines
Quoted 5 lines
        if (dev && dev->npinfo) {
                spin_lock(&napi->poll_lock);

Maybe we should remove 'dev' field from napi_struct and replace it by a npinfo pointer ?

Sky2 seems to work like a single netdev (with an internal sub-netdev), so I can't see your concern: what is the main aim of this replacement?

Quoted 7 lines

I am trying to understand why this commit was needed then.

It adds an extra test in the main loop, testing skb->dev against p->dev, it must me for something...

I am trying to say that the one to one relationship between NAPI structure and a device is not only a GRO thing, but also a netpoll one.

I guess it's not about the full one to one relationship, but kind of overloading (pseudo vlan?). How much it's needed is another question, but at least the order of these tests seems doubtful.

Jarek P.

#7 lore raw

Re: [RFC] gro: Is it ok to share a single napi from several devs ?

In reply to Eric Dumazet
Quoted 41 lines · On Sat, 28 Aug 2010 16:48:29 +0200 Eric Dumazet <[email protected]> wrote:
Quoted 26 lines · Jarek Poplawski
Quoted 25 lines · Eric Dumazet

In commit f2bde7328633269ee935d9ed96535ade15cc348f
Author: Stephen Hemminger <[email protected]>

net: allow multiple dev per napi with GRO

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.

It was assumed a napi could be shared by several devs, but I dont really understand, since we have an unique ->dev pointer inside "napi_struct", this one is set once, and never change.

This pointer is currently used from napi_get_frags() [but that could be avoided], and from netpoll_poll_lock().

The netpoll_poll_lock() case is problematic.

static inline void *netpoll_poll_lock(struct napi_struct *napi)

{
        struct net_device *dev = napi->_dev;
Quoted 8 lines
Quoted 5 lines
        if (dev && dev->npinfo) {
                spin_lock(&napi->poll_lock);

Maybe we should remove 'dev' field from napi_struct and replace it by a npinfo pointer ?

Sky2 seems to work like a single netdev (with an internal sub-netdev), so I can't see your concern: what is the main aim of this replacement?

I am trying to understand why this commit was needed then.

It adds an extra test in the main loop, testing skb->dev against p->dev, it must me for something...

Quoted 9 lines

I am trying to say that the one to one relationship between NAPI structure and a device is not only a GRO thing, but also a netpoll one.

So either we completely remove this one to one relationship, either Stephen commit was not needed.

Some clarification is needed.

The Marvell Yukon2 hardware supports two interfaces sharing a common interrupt. Therfore the sky2 driver has up to two net devices and a single NAPI per board. It is possible in a single invocation of the poll loop to process frames for both ports. GRO works by combining received packets from identical flows over one NAPI interval. It is possible on sky2 that one packet could be processed for the first port, and the next packet processed was for second port and the two packets were related so that GRO would combine them. The check for the same dev is required to prevent this. Yes it is an unlikely corner case, but the purpose of GRO is to do aggregation but preserve the flow characteristics of the incoming traffic.

maintainer
#8 lore raw

Re: [RFC] gro: Is it ok to share a single napi from several devs ?

From: Stephen Hemminger <[email protected]>
Date: Sat, 28 Aug 2010 10:14:24 -0700

Quoted 10 lines

The Marvell Yukon2 hardware supports two interfaces sharing a common interrupt. Therfore the sky2 driver has up to two net devices and a single NAPI per board. It is possible in a single invocation of the poll loop to process frames for both ports. GRO works by combining received packets from identical flows over one NAPI interval. It is possible on sky2 that one packet could be processed for the first port, and the next packet processed was for second port and the two packets were related so that GRO would combine them. The check for the same dev is required to prevent this. Yes it is an unlikely corner case, but the purpose of GRO is to do aggregation but preserve the flow characteristics of the incoming traffic.

If that is true then GRO is going to refuse to merge every single frame that arrives on the second port of a SKY2 device. :-)

This is because for the two ports, you allocate and register one NAPI instance which uses only the first port's netdev pointer.

Therefore, when GRO compares napi->dev to skb->dev it will always not match for packets coming from the second port since the netdev pointer in skb->dev will be different.

Since netpoll does similar things, this means both NAPI and netpoll cannot function properly with SKY2's second port. It will only work right on the first port.

#9 lore raw

Re: [RFC] gro: Is it ok to share a single napi from several devs ?

Quoted 3 lines · On Sat, 28 Aug 2010 14:41:30 -0700 (PDT) David Miller <[email protected]>…

Since netpoll does similar things, this means both NAPI and netpoll cannot function properly with SKY2's second port. It will only work right on the first port.

I knew netpoll was broken on second port.

maintainer
#10 lore raw

Re: [RFC] gro: Is it ok to share a single napi from several devs ?

From: Stephen Hemminger <[email protected]>
Date: Sat, 28 Aug 2010 15:31:24 -0700

Quoted 8 lines
Quoted 3 lines · On Sat, 28 Aug 2010 14:41:30 -0700 (PDT) David Miller <[email protected]>…

Since netpoll does similar things, this means both NAPI and netpoll cannot function properly with SKY2's second port. It will only work right on the first port.

I knew netpoll was broken on second port.

Well, now we know that GRO is too :-)

If we wish to keep the one-to-one mapping of NAPI contexts to interrupt sources, what we can do is provide some kind of "dev list".

The other option is to register two NAPI contexts and schedule them both on an interrupt.

But in both cases, detecting the end of polling, and thus when to turn the interrupts back on, is non-trivial.

I really don't like either solution, therefore, so I'll try to brain storm on this a bit more.

#11 lore raw

Re: [RFC] gro: Is it ok to share a single napi from several devs ?

In reply to David Miller
Quoted 14 lines · David Miller

From: Stephen Hemminger <[email protected]>
Date: Sat, 28 Aug 2010 10:14:24 -0700

Quoted 10 lines

The Marvell Yukon2 hardware supports two interfaces sharing a common interrupt. Therfore the sky2 driver has up to two net devices and a single NAPI per board. It is possible in a single invocation of the poll loop to process frames for both ports. GRO works by combining received packets from identical flows over one NAPI interval. It is possible on sky2 that one packet could be processed for the first port, and the next packet processed was for second port and the two packets were related so that GRO would combine them. The check for the same dev is required to prevent this. Yes it is an unlikely corner case, but the purpose of GRO is to do aggregation but preserve the flow characteristics of the incoming traffic.

Quoted 7 lines

If that is true then GRO is going to refuse to merge every single frame that arrives on the second port of a SKY2 device. :-)

This is because for the two ports, you allocate and register one NAPI instance which uses only the first port's netdev pointer.

Therefore, when GRO compares napi->dev to skb->dev it will always not

Actually, when GRO compares napi->dev to skb->dev?

Jarek P.

Quoted 8 lines

match for packets coming from the second port since the netdev pointer in skb->dev will be different.

Since netpoll does similar things, this means both NAPI and netpoll cannot function properly with SKY2's second port. It will only work right on the first port.

maintainer
#12 lore raw

Re: [RFC] gro: Is it ok to share a single napi from several devs ?

From: Jarek Poplawski <[email protected]>
Date: Sun, 29 Aug 2010 11:59:51 +0200

Quoted 1 line

Actually, when GRO compares napi->dev to skb->dev?

Hmmm, I thought the code made a skb->dev comparison with the existing SKBs in the list when checking for same-flow matches.

It doesn't, probably based upon the assumption that a NAPI instance maps to a unique device, the very topic we're discussing right now :-/

#13 lore raw

Re: [RFC] gro: Is it ok to share a single napi from several devs ?

Quoted 13 lines · David Miller

From: Jarek Poplawski <[email protected]>
Date: Sun, 29 Aug 2010 11:59:51 +0200

Quoted 1 line

Actually, when GRO compares napi->dev to skb->dev?

Hmmm, I thought the code made a skb->dev comparison with the existing SKBs in the list when checking for same-flow matches.

It doesn't, probably based upon the assumption that a NAPI instance maps to a unique device, the very topic we're discussing right now :-/

It does the check, Stephen added it in the commit I mentioned to start this thread.

With net-next-2.6 this now reads :

#14 lore raw

Re: [RFC] gro: Is it ok to share a single napi from several devs ?

Quoted 15 lines · Eric Dumazet

Le dimanche 29 aoĂťt 2010 Ă 10:06 -0700, David Miller a ĂŠcrit :

Quoted 13 lines

From: Jarek Poplawski <[email protected]>
Date: Sun, 29 Aug 2010 11:59:51 +0200

Quoted 1 line

Actually, when GRO compares napi->dev to skb->dev?

Hmmm, I thought the code made a skb->dev comparison with the existing SKBs in the list when checking for same-flow matches.

It doesn't, probably based upon the assumption that a NAPI instance maps to a unique device, the very topic we're discussing right now :-/

Quoted 5 lines

It does the check, Stephen added it in the commit I mentioned to start this thread.

With net-next-2.6 this now reads :

Since Stephen didn't seem to miss this too much it seems quite obvious to me this check should be removed.

Jarek P.

#15 lore raw

Re: [RFC] gro: Is it ok to share a single napi from several devs ?

Quoted 16 lines · On Mon, 30 Aug 2010 06:42:31 +0000 Jarek Poplawski <[email protected]> wrote:
Quoted 15 lines · Eric Dumazet

Le dimanche 29 aoĂťt 2010 Ă 10:06 -0700, David Miller a ĂŠcrit :

Quoted 13 lines

From: Jarek Poplawski <[email protected]>
Date: Sun, 29 Aug 2010 11:59:51 +0200

Quoted 1 line

Actually, when GRO compares napi->dev to skb->dev?

Hmmm, I thought the code made a skb->dev comparison with the existing SKBs in the list when checking for same-flow matches.

It doesn't, probably based upon the assumption that a NAPI instance maps to a unique device, the very topic we're discussing right now :-/

Quoted 8 lines
Quoted 5 lines

It does the check, Stephen added it in the commit I mentioned to start this thread.

With net-next-2.6 this now reads :

Since Stephen didn't seem to miss this too much it seems quite obvious to me this check should be removed.

No. I just don't use that system much, breaking code for sake of one comparison is ridiculous. If you need to do some performance wanking, go figure out why just loading netfilter drops forwarding performance by 20%.

maintainer
#16 lore raw

Re: [RFC] gro: Is it ok to share a single napi from several devs ?

From: Stephen Hemminger <[email protected]>
Date: Mon, 30 Aug 2010 08:57:21 -0700

Quoted 22 lines
Quoted 19 lines · On Mon, 30 Aug 2010 06:42:31 +0000 Jarek Poplawski <[email protected]> wrote:
Quoted 18 lines · Eric Dumazet

Le dimanche 29 aoĂťt 2010 Ă 10:06 -0700, David Miller a ĂŠcrit :

Quoted 13 lines

From: Jarek Poplawski <[email protected]>
Date: Sun, 29 Aug 2010 11:59:51 +0200

Quoted 1 line

Actually, when GRO compares napi->dev to skb->dev?

Hmmm, I thought the code made a skb->dev comparison with the existing SKBs in the list when checking for same-flow matches.

It doesn't, probably based upon the assumption that a NAPI instance maps to a unique device, the very topic we're discussing right now :-/

It does the check, Stephen added it in the commit I mentioned to start this thread.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

With net-next-2.6 this now reads :

Since Stephen didn't seem to miss this too much it seems quite obvious to me this check should be removed.

No. I just don't use that system much, breaking code for sake of one comparison is ridiculous.

It's not working to begin with.

I agree with Jarek that the check should be removed. And GRO is one of those places that, precisely, even one memory reference removal can improve performance dramatically.

Herbert spent a lot of time doing micro-optimizations to make GRO better and better, and the smallest things can turn out to make a huge difference there.

#17 lore raw

PATCH 1/1 sky2: don't do GRO on second port

There's something very important I forgot to tell you. What?

Don't cross the GRO streams.
Why?

It would be bad.
I'm fuzzy on the whole good/bad thing. What do you mean, "bad"?

Try to imagine all the Internet as you know it stopping instantaneously
and every bit in every packet swapping at the speed of light.
Total packet reordering.
Right. That's bad. Okay. All right. Important safety tip. Thanks, Hubert

The simplest way to stop this is just avoid doing GRO on the second port. Very few Marvell boards support two ports per ring, and GRO is just an optimization.

drivers/net/sky2.c +11 -8
@@ -2520,24 +2520,27 @@ static inline void sky2_tx_done(struct n
 	}
 }
 
-static inline void sky2_skb_rx(const struct sky2_port *sky2,
+static inline void sky2_skb_rx(struct napi_struct *napi,
+			       const struct sky2_port *sky2,
 			       u32 status, struct sk_buff *skb)
 {
 #ifdef SKY2_VLAN_TAG_USED
-	u16 vlan_tag = be16_to_cpu(sky2->rx_tag);
 	if (sky2->vlgrp && (status & GMR_FS_VLAN)) {
-		if (skb->ip_summed == CHECKSUM_NONE)
+		u16 vlan_tag = be16_to_cpu(sky2->rx_tag);
+
+		if (skb->ip_summed == CHECKSUM_NONE ||
+		    sky2->netdev != napi->dev)
 			vlan_hwaccel_receive_skb(skb, sky2->vlgrp, vlan_tag);
 		else
-			vlan_gro_receive(&sky2->hw->napi, sky2->vlgrp,
-					 vlan_tag, skb);
+			vlan_gro_receive(napi, sky2->vlgrp, vlan_tag, skb);
 		return;
 	}
 #endif
-	if (skb->ip_summed == CHECKSUM_NONE)
+	if (skb->ip_summed == CHECKSUM_NONE ||
+	    sky2->netdev != napi->dev)
 		netif_receive_skb(skb);
 	else
-		napi_gro_receive(&sky2->hw->napi, skb);
+		napi_gro_receive(napi, skb);
 }
 
 static inline void sky2_rx_done(struct sky2_hw *hw, unsigned port,
@@ -2638,7 +2641,7 @@ static int sky2_status_intr(struct sky2_
 
 			skb->protocol = eth_type_trans(skb, dev);
 
-			sky2_skb_rx(sky2, status, skb);
+			sky2_skb_rx(&hw->napi, sky2, status, skb);
 
 			/* Stop after net poll weight */
 			if (++work_done >= to_do)
#18 lore raw

Re: [PATCH] sky2: don't do GRO on second port

Quoted 7 lines · Stephen Hemminger

There's something very important I forgot to tell you. What?

Don't cross the GRO streams.
Why?

Quoted 7 lines

It would be bad.
I'm fuzzy on the whole good/bad thing. What do you mean, "bad"?

Try to imagine all the Internet as you know it stopping instantaneously
and every bit in every packet swapping at the speed of light.
Total packet reordering.
Right. That's bad. Okay. All right. Important safety tip. Thanks, Hubert

Looks really bad to me, so... let's forget it! ;-) (At least until next next.)

Jarek P.

Quoted 54 lines

The simplest way to stop this is just avoid doing GRO on the second port. Very few Marvell boards support two ports per ring, and GRO is just an optimization.

drivers/net/sky2.c +11 -8
@@ -2520,24 +2520,27 @@ static inline void sky2_tx_done(struct n
 	}
 }
 
-static inline void sky2_skb_rx(const struct sky2_port *sky2,
+static inline void sky2_skb_rx(struct napi_struct *napi,
+			       const struct sky2_port *sky2,
 			       u32 status, struct sk_buff *skb)
 {
 #ifdef SKY2_VLAN_TAG_USED
-	u16 vlan_tag = be16_to_cpu(sky2->rx_tag);
 	if (sky2->vlgrp && (status & GMR_FS_VLAN)) {
-		if (skb->ip_summed == CHECKSUM_NONE)
+		u16 vlan_tag = be16_to_cpu(sky2->rx_tag);
+
+		if (skb->ip_summed == CHECKSUM_NONE ||
+		    sky2->netdev != napi->dev)
 			vlan_hwaccel_receive_skb(skb, sky2->vlgrp, vlan_tag);
 		else
-			vlan_gro_receive(&sky2->hw->napi, sky2->vlgrp,
-					 vlan_tag, skb);
+			vlan_gro_receive(napi, sky2->vlgrp, vlan_tag, skb);
 		return;
 	}
 #endif
-	if (skb->ip_summed == CHECKSUM_NONE)
+	if (skb->ip_summed == CHECKSUM_NONE ||
+	    sky2->netdev != napi->dev)
 		netif_receive_skb(skb);
 	else
-		napi_gro_receive(&sky2->hw->napi, skb);
+		napi_gro_receive(napi, skb);
 }
 
 static inline void sky2_rx_done(struct sky2_hw *hw, unsigned port,
@@ -2638,7 +2641,7 @@ static int sky2_status_intr(struct sky2_
 
 			skb->protocol = eth_type_trans(skb, dev);
 
-			sky2_skb_rx(sky2, status, skb);
+			sky2_skb_rx(&hw->napi, sky2, status, skb);
 
 			/* Stop after net poll weight */
 			if (++work_done >= to_do)
maintainer
#19 lore raw

Re: [PATCH] sky2: don't do GRO on second port

From: Jarek Poplawski <[email protected]>
Date: Mon, 30 Aug 2010 21:09:00 +0200

Quoted 11 lines · Stephen Hemminger
Quoted 10 lines

There's something very important I forgot to tell you. What?

Don't cross the GRO streams.
Why?

It would be bad.
I'm fuzzy on the whole good/bad thing. What do you mean, "bad"?

Quoted 7 lines
Quoted 4 lines

Try to imagine all the Internet as you know it stopping instantaneously
and every bit in every packet swapping at the speed of light.
Total packet reordering.
Right. That's bad. Okay. All right. Important safety tip. Thanks, Hubert

Looks really bad to me, so... let's forget it! ;-) (At least until next next.)

I'm applying this patch.

Note that for us, devices act as domains, or a key for networking traffic, whether we like it or not. Yes, even for the same IP addresses on the same host.

The reason is that we can do ingress packet editing and the realm of those rules are per-ingress-qdisc, which are per-device.

The only scenerio you can guarentee that all packets for a given flow key will be treated the same is the one where the input device is the same as well.

When there is a single napi --> device mapping, it works, but without that invariant it doesn't.

#20 lore raw

Re: [PATCH] sky2: don't do GRO on second port

Quoted 21 lines · On Wed, 01 Sep 2010 14:51:51 -0700 (PDT) David Miller <[email protected]>…

From: Jarek Poplawski <[email protected]>
Date: Mon, 30 Aug 2010 21:09:00 +0200

Quoted 18 lines · Stephen Hemminger
Quoted 7 lines

There's something very important I forgot to tell you. What?

Don't cross the GRO streams.
Why?

Quoted 7 lines

It would be bad.
I'm fuzzy on the whole good/bad thing. What do you mean, "bad"?

Try to imagine all the Internet as you know it stopping instantaneously
and every bit in every packet swapping at the speed of light.
Total packet reordering.
Right. That's bad. Okay. All right. Important safety tip. Thanks, Hubert

Looks really bad to me, so... let's forget it! ;-) (At least until next next.)

The patch wasn't that bad, but the movie quote probably confused you.

Alternatively, the driver could keep track of "current GRO device" and manually complete the GRO if the next packet changes the current device. But it didn't seem worth the effort.

#21 lore raw

Re: [PATCH] sky2: don't do GRO on second port

Quoted 22 lines · Stephen Hemminger
Quoted 19 lines · On Wed, 01 Sep 2010 14:51:51 -0700 (PDT) David Miller <[email protected]>…

From: Jarek Poplawski <[email protected]>
Date: Mon, 30 Aug 2010 21:09:00 +0200

Quoted 16 lines · Stephen Hemminger
Quoted 14 lines

There's something very important I forgot to tell you. What?

Don't cross the GRO streams.
Why?

It would be bad.
I'm fuzzy on the whole good/bad thing. What do you mean, "bad"?

Try to imagine all the Internet as you know it stopping instantaneously
and every bit in every packet swapping at the speed of light.
Total packet reordering.
Right. That's bad. Okay. All right. Important safety tip. Thanks, Hubert

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

Looks really bad to me, so... let's forget it! ;-) (At least until next next.)

The patch wasn't that bad, but the movie quote probably confused you.

Yes, I was equally confused by both of them. Good to know it's only fiction... ;-)

Jarek P.

#22 lore raw

Re: [PATCH] sky2: don't do GRO on second port

Quoted 23 lines · Jarek Poplawski
Quoted 22 lines · Stephen Hemminger
Quoted 19 lines · On Wed, 01 Sep 2010 14:51:51 -0700 (PDT) David Miller <[email protected]>…

From: Jarek Poplawski <[email protected]>
Date: Mon, 30 Aug 2010 21:09:00 +0200

Quoted 16 lines · Stephen Hemminger
Quoted 14 lines

There's something very important I forgot to tell you. What?

Don't cross the GRO streams.
Why?

It would be bad.
I'm fuzzy on the whole good/bad thing. What do you mean, "bad"?

Try to imagine all the Internet as you know it stopping instantaneously
and every bit in every packet swapping at the speed of light.
Total packet reordering.
Right. That's bad. Okay. All right. Important safety tip. Thanks, Hubert

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

Looks really bad to me, so... let's forget it! ;-) (At least until next next.)

The patch wasn't that bad, but the movie quote probably confused you.

Yes, I was equally confused by both of them. Good to know it's only fiction... ;-)

Stephen, after Eric's explanation, I really think this patch was a bad idea, and I apologize my false opinion started this.

I hope David, will revert this patch, please.

Sorry,
Jarek P.

maintainer
#23 lore raw

Re: [PATCH] sky2: don't do GRO on second port

From: Jarek Poplawski <[email protected]>
Date: Thu, 2 Sep 2010 12:53:26 +0000

Quoted 4 lines

Stephen, after Eric's explanation, I really think this patch was a bad idea, and I apologize my false opinion started this.

I hope David, will revert this patch, please.

Ok, now that I've reread everything over I agree, I'll revert the sky2 change, thanks.

#24 lore raw

Re: [PATCH] sky2: don't do GRO on second port

Quoted 10 lines · David Miller

From: Jarek Poplawski <[email protected]>
Date: Thu, 2 Sep 2010 12:53:26 +0000

Quoted 4 lines

Stephen, after Eric's explanation, I really think this patch was a bad idea, and I apologize my false opinion started this.

I hope David, will revert this patch, please.

Ok, now that I've reread everything over I agree, I'll revert the sky2 change, thanks.

Thanks!
Jarek P.

#25 lore raw

Re: [PATCH] sky2: don't do GRO on second port

In reply to David Miller
Quoted 6 lines · David Miller

The only scenerio you can guarentee that all packets for a given flow key will be treated the same is the one where the input device is the same as well.

When there is a single napi --> device mapping, it works, but without that invariant it doesn't.

Do you mean a single napi can't be used eg. for vlan_gro and napi_gro? (napi_gro handles flows for skb->dev different from napi->dev or I miss something?)

Jarek P.

#26 lore raw

Re: [PATCH] sky2: don't do GRO on second port

Quoted 5 lines · Jarek Poplawski
Quoted 4 lines · David Miller

The only scenerio you can guarentee that all packets for a given flow key will be treated the same is the one where the input device is the same as well.

Quoted 7 lines
Quoted 2 lines

When there is a single napi --> device mapping, it works, but without that invariant it doesn't.

Do you mean a single napi can't be used eg. for vlan_gro and napi_gro? (napi_gro handles flows for skb->dev different from napi->dev or I miss something?)

Same napi can be used both for vlan tagged trafic and "non tagged trafic".

vlan_gro_common() does the right thing, when initializing skb->dev to the vlan device, before doing the GRO loop.

So if we receive two packets on same ethernet device, two different vlans, vlan_gro_common() automatically say they are not part of the same flow, even if upper layers would say "it's ok for these two packets to merge". Of course, we wont ask upper layers what they think :)

So we must keep the test against skb->dev, because of vlans,

diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev;

(both in vlan_gro_common() and __napi_gro_receive())

#27 lore raw

Re: [PATCH] sky2: don't do GRO on second port

Quoted 25 lines · Eric Dumazet
Quoted 5 lines · Jarek Poplawski
Quoted 4 lines · David Miller

The only scenerio you can guarentee that all packets for a given flow key will be treated the same is the one where the input device is the same as well.

Quoted 7 lines
Quoted 2 lines

When there is a single napi --> device mapping, it works, but without that invariant it doesn't.

Do you mean a single napi can't be used eg. for vlan_gro and napi_gro? (napi_gro handles flows for skb->dev different from napi->dev or I miss something?)

Same napi can be used both for vlan tagged trafic and "non tagged trafic".

vlan_gro_common() does the right thing, when initializing skb->dev to the vlan device, before doing the GRO loop.

So if we receive two packets on same ethernet device, two different vlans, vlan_gro_common() automatically say they are not part of the same flow, even if upper layers would say "it's ok for these two packets to merge". Of course, we wont ask upper layers what they think :)

Quoted 6 lines

So we must keep the test against skb->dev, because of vlans,

diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev;

(both in vlan_gro_common() and __napi_gro_receive())

Exactly, but there is no "a single napi --> device mapping". And sky2 uses the same model. So, there is only a question of cost of this test, and a question of probability of gro errors on collisions without such a test in normal use. (And if gro can never do such errors for other reasons?)

Jarek P.

#28 lore raw

Re: [PATCH] sky2: don't do GRO on second port

Quoted 6 lines · Jarek Poplawski

Exactly, but there is no "a single napi --> device mapping". And sky2 uses the same model. So, there is only a question of cost of this test, and a question of probability of gro errors on collisions without such a test in normal use. (And if gro can never do such errors for other reasons?)

Two vlans might carry packets in different domains, with a clash of IP space and TCP flows. Even with a probability of 0.000000001%, we cannot ever merge two packets of different domains. Really !

napi->dev is not used in GRO path, as mentioned earlier, but in napi_get_frags(), while not needed.

To make this very clear, I suggest following patch :

[PATCH net-next-2.6] gro: remove use of napi->dev

Only use of napi->dev in GRO stack is the one found in napi_get_frags()

We can remove it and use a plain dev_alloc_skb() call.

---
 net/core/dev.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/core/dev.c +4 -2
index d8c43e7..607057a 100644
@@ -3248,9 +3248,11 @@ struct sk_buff *napi_get_frags(struct napi_struct *napi)
 	struct sk_buff *skb = napi->skb;
 
 	if (!skb) {
-		skb = netdev_alloc_skb_ip_align(napi->dev, GRO_MAX_HEAD);
-		if (skb)
+		skb = dev_alloc_skb(GRO_MAX_HEAD + NET_IP_ALIGN);
+		if (skb) {
+			skb_reserve(skb, NET_IP_ALIGN);
 			napi->skb = skb;
+		}
 	}
 	return skb;
 }
#29 lore raw

Re: [PATCH] sky2: don't do GRO on second port

Quoted 9 lines · Eric Dumazet
Quoted 6 lines · Jarek Poplawski

Exactly, but there is no "a single napi --> device mapping". And sky2 uses the same model. So, there is only a question of cost of this test, and a question of probability of gro errors on collisions without such a test in normal use. (And if gro can never do such errors for other reasons?)

Quoted 3 lines

Two vlans might carry packets in different domains, with a clash of IP space and TCP flows. Even with a probability of 0.000000001%, we cannot ever merge two packets of different domains. Really !

Hmm... But there is only a question of sky2 and this test in __napi_gro_receive().

Quoted 5 lines

napi->dev is not used in GRO path, as mentioned earlier, but in napi_get_frags(), while not needed.

To make this very clear, I suggest following patch :

But where this skb gets its skb->dev now?

Jarek P.

Quoted 32 lines

[PATCH net-next-2.6] gro: remove use of napi->dev

Only use of napi->dev in GRO stack is the one found in napi_get_frags()

We can remove it and use a plain dev_alloc_skb() call.

---
 net/core/dev.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/core/dev.c +4 -2
index d8c43e7..607057a 100644
@@ -3248,9 +3248,11 @@ struct sk_buff *napi_get_frags(struct napi_struct *napi)
 	struct sk_buff *skb = napi->skb;
 
 	if (!skb) {
-		skb = netdev_alloc_skb_ip_align(napi->dev, GRO_MAX_HEAD);
-		if (skb)
+		skb = dev_alloc_skb(GRO_MAX_HEAD + NET_IP_ALIGN);
+		if (skb) {
+			skb_reserve(skb, NET_IP_ALIGN);
 			napi->skb = skb;
+		}
 	}
 	return skb;
 }
#30 lore raw

Re: [PATCH] sky2: don't do GRO on second port

Quoted 9 lines · Jarek Poplawski
Quoted 3 lines · Eric Dumazet

Two vlans might carry packets in different domains, with a clash of IP space and TCP flows. Even with a probability of 0.000000001%, we cannot ever merge two packets of different domains. Really !

Hmm... But there is only a question of sky2 and this test in __napi_gro_receive().

Any driver can receive in one napi run :

1) A TCP tagged frame for vlan 345, delivered to vlan_gro_receive(), queued in napi->gro_list.

2) An untagged frame, delived via napi_gro_receive()

    Can meet previous frame in napi->gro_list. Should not merge.

So napi_gro_receive() must perform the same skb->dev check, sky2 or not.

Quoted 7 lines
Quoted 5 lines

napi->dev is not used in GRO path, as mentioned earlier, but in napi_get_frags(), while not needed.

To make this very clear, I suggest following patch :

But where this skb gets its skb->dev now?

Oh you are right, I thought drivers were setting this later, but its not the case.

#31 lore raw

Re: [PATCH] sky2: don't do GRO on second port

Quoted 13 lines · Eric Dumazet
Quoted 9 lines · Jarek Poplawski
Quoted 3 lines · Eric Dumazet

Two vlans might carry packets in different domains, with a clash of IP space and TCP flows. Even with a probability of 0.000000001%, we cannot ever merge two packets of different domains. Really !

Hmm... But there is only a question of sky2 and this test in __napi_gro_receive().

Any driver can receive in one napi run :

Quoted 7 lines

1) A TCP tagged frame for vlan 345, delivered to vlan_gro_receive(), queued in napi->gro_list.

2) An untagged frame, delived via napi_gro_receive()

    Can meet previous frame in napi->gro_list. Should not merge.

So napi_gro_receive() must perform the same skb->dev check, sky2 or not.

But of course!!! I was mislead by Stephen's changelog so much. So now I really can't understand this current: "sky2: don't do GRO on second port"...

Thanks,
Jarek P.

maintainer
#32 lore raw

Re: [PATCH] sky2: don't do GRO on second port

In reply to Eric Dumazet

From: Eric Dumazet <[email protected]>
Date: Thu, 02 Sep 2010 12:41:45 +0200

Quoted 7 lines

[PATCH net-next-2.6] gro: remove use of napi->dev

Only use of napi->dev in GRO stack is the one found in napi_get_frags()

We can remove it and use a plain dev_alloc_skb() call.

If you change this to use skb->dev I can apply this.

Thanks.

#33 lore raw

Re: [PATCH] sky2: don't do GRO on second port

In reply to Eric Dumazet
Quoted 8 lines · Eric Dumazet

[PATCH net-next-2.6] gro: remove use of napi->dev

Only use of napi->dev in GRO stack is the one found in napi_get_frags()

We can remove it and use a plain dev_alloc_skb() call.

Why do you think napi->dev is not needed?

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#34 lore raw

Re: [PATCH] sky2: don't do GRO on second port

Quoted 11 lines · Herbert Xu
Quoted 8 lines · Eric Dumazet

[PATCH net-next-2.6] gro: remove use of napi->dev

Only use of napi->dev in GRO stack is the one found in napi_get_frags()

We can remove it and use a plain dev_alloc_skb() call.

Why do you think napi->dev is not needed?

Origin was that sky2 could use one napi and two devices on it. No bug, only a conceptual problem using a napi->dev.

Then, there is a small second point :

netdev_alloc_skb_ip_align() is using 'device' NUMA node to allocate memory.

In this context, this makes litle sense because this skb is not going to be used by the device. Its a pure software one, for the sake of GRO handling.

It would be more efficient to allocate an skb on NUMA node of the CPU handling the softirq.

Thanks

#35 lore raw

Re: [PATCH] sky2: don't do GRO on second port

In reply to Jarek Poplawski
Quoted 10 lines · Jarek Poplawski
Quoted 6 lines · David Miller

The only scenerio you can guarentee that all packets for a given flow key will be treated the same is the one where the input device is the same as well.

When there is a single napi --> device mapping, it works, but without that invariant it doesn't.

Do you mean a single napi can't be used eg. for vlan_gro and napi_gro? (napi_gro handles flows for skb->dev different from napi->dev or I

Of course I meant:
(vlan_gro handles flows for skb->dev different from napi->dev or I

Quoted 1 line

miss something?)

Sorry,
Jarek P.

#36 lore raw

Re: [RFC] gro: Is it ok to share a single napi from several devs ?

In reply to David Miller
Quoted 28 lines · David Miller

From: Stephen Hemminger <[email protected]>
Date: Mon, 30 Aug 2010 08:57:21 -0700

Quoted 25 lines
Quoted 22 lines · On Mon, 30 Aug 2010 06:42:31 +0000 Jarek Poplawski <[email protected]> wrote:
Quoted 20 lines · Eric Dumazet

Le dimanche 29 aoĂťt 2010 Ă 10:06 -0700, David Miller a ĂŠcrit :

Quoted 13 lines

From: Jarek Poplawski <[email protected]>
Date: Sun, 29 Aug 2010 11:59:51 +0200

Quoted 1 line

Actually, when GRO compares napi->dev to skb->dev?

Hmmm, I thought the code made a skb->dev comparison with the existing SKBs in the list when checking for same-flow matches.

It doesn't, probably based upon the assumption that a NAPI instance maps to a unique device, the very topic we're discussing right now :-/

It does the check, Stephen added it in the commit I mentioned to start this thread.

With net-next-2.6 this now reads :

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Since Stephen didn't seem to miss this too much it seems quite obvious to me this check should be removed.

No. I just don't use that system much, breaking code for sake of one comparison is ridiculous.

It's not working to begin with.

IMHO it should work yet. On the other hand, after removing this test GRO should still work OK for these NICs in most cases, so it should be treated as an optimization only. And it seems very unusual to keep such optimizations at this level for such rare cases.

Quoted 3 lines

I agree with Jarek that the check should be removed. And GRO is one of those places that, precisely, even one memory reference removal can improve performance dramatically.

Hmm... I proposed removal when Stephen didn't defend it. Since he seems to change his line, I'd prefer to be convinced I'm wrong, preferably with some use/test case; most preferably from some desperated user...

Quoted 3 lines

Herbert spent a lot of time doing micro-optimizations to make GRO better and better, and the smallest things can turn out to make a huge difference there.

Anyway, after the last Eric's optimization, it's almost invisible...

Jarek P.

#37 lore raw

[RFC] netpoll: Is it ok to share a single napi from several devs ?

So everybody jumped on GRO, while my concern was more the napi->dev thing.

I pointed to gro because the commit was about gro, but gro was fine IMHO.

Are we sure netpoll is ok ?

If a napi is shared by several net_device, should'nt we change netpoll_poll_lock() ?

static inline void *netpoll_poll_lock(struct napi_struct *napi)

{
        struct net_device *dev = napi->dev;

        if (dev && dev->npinfo) {
                spin_lock(&napi->poll_lock);
                napi->poll_owner = smp_processor_id();
                return napi;
        }
        return NULL;
}

---->

static inline void *netpoll_poll_lock(struct napi_struct *napi)

{
        if (atomic_read(&napi->poll_count)) {
                spin_lock(&napi->poll_lock);
                napi->poll_owner = smp_processor_id();
                return napi;
        }
        return NULL;
}
#38 lore raw

Re: [RFC] netpoll: Is it ok to share a single napi from several devs ?

Quoted 7 lines · On Mon, 30 Aug 2010 21:59:16 +0200 Eric Dumazet <[email protected]> wrote:

So everybody jumped on GRO, while my concern was more the napi->dev thing.

I pointed to gro because the commit was about gro, but gro was fine IMHO.

Are we sure netpoll is ok ?

Netpoll is dependent on napi->netdev but does not cause problems. The sky2 driver doesn't expose netpoll on second port. The second port has different net_device_ops without netpoll.

#39 lore raw

Re: [RFC] netpoll: Is it ok to share a single napi from several devs ?

Quoted 6 lines · Stephen Hemminger
Quoted 3 lines · On Mon, 30 Aug 2010 21:59:16 +0200 Eric Dumazet <[email protected]> wrote:

So everybody jumped on GRO, while my concern was more the napi->dev thing.

Quoted 10 lines
Quoted 4 lines

I pointed to gro because the commit was about gro, but gro was fine IMHO.

Are we sure netpoll is ok ?

Netpoll is dependent on napi->netdev but does not cause problems. The sky2 driver doesn't expose netpoll on second port. The second port has different net_device_ops without netpoll.

Ah, great, thanks for clarification.