All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next-2.6] skge: add GRO support
@ 2010-08-31 22:32 Eric Dumazet
  2010-09-01  1:31 ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2010-08-31 22:32 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Stephen Hemminger

- use napi_gro_receive() instead of netif_receive_skb()
- use napi_complete() instead of __napi_complete()
- turn on NETIF_F_GRO by default
- Tested on a Marvell 88E8801 Gigabit NIC

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 drivers/net/skge.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 40e5c46..c2e29e3 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -3178,8 +3178,7 @@ static int skge_poll(struct napi_struct *napi, int to_do)
 
 		skb = skge_rx_get(dev, e, control, rd->status, rd->csum2);
 		if (likely(skb)) {
-			netif_receive_skb(skb);
-
+			napi_gro_receive(napi, skb);
 			++work_done;
 		}
 	}
@@ -3193,7 +3192,7 @@ static int skge_poll(struct napi_struct *napi, int to_do)
 		unsigned long flags;
 
 		spin_lock_irqsave(&hw->hw_lock, flags);
-		__napi_complete(napi);
+		napi_complete(napi);
 		hw->intr_mask |= napimask[skge->port];
 		skge_write32(hw, B0_IMSK, hw->intr_mask);
 		skge_read32(hw, B0_IMSK);
@@ -3849,6 +3848,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
 		dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
 		skge->rx_csum = 1;
 	}
+	dev->features |= NETIF_F_GRO;
 
 	/* read the mac address */
 	memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port*8, ETH_ALEN);



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next-2.6] skge: add GRO support
  2010-08-31 22:32 [PATCH net-next-2.6] skge: add GRO support Eric Dumazet
@ 2010-09-01  1:31 ` Stephen Hemminger
  2010-09-01  4:25   ` Eric Dumazet
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2010-09-01  1:31 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev

On Wed, 01 Sep 2010 00:32:36 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> @@ -3193,7 +3192,7 @@ static int skge_poll(struct napi_struct *napi, int to_do)
>  		unsigned long flags;
>  
>  		spin_lock_irqsave(&hw->hw_lock, flags);
> -		__napi_complete(napi);
> +		napi_complete(napi);

This adds a redundant irq_save/irq_restore in the packet
receive path.

In the case of skge, since the both ports share a single
IRQ mask register, the lock is there to make sure that updates
to the mask register doesn't race between NAPI finishing
on one port and IRQ on other port changing same IRQ mask register.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next-2.6] skge: add GRO support
  2010-09-01  1:31 ` Stephen Hemminger
@ 2010-09-01  4:25   ` Eric Dumazet
  2010-09-01 17:58     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2010-09-01  4:25 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev

Le mardi 31 août 2010 à 18:31 -0700, Stephen Hemminger a écrit :
> On Wed, 01 Sep 2010 00:32:36 +0200
> Eric Dumazet <eric.dumazet@gmail.com> wrote:
> 
> > @@ -3193,7 +3192,7 @@ static int skge_poll(struct napi_struct *napi, int to_do)
> >  		unsigned long flags;
> >  
> >  		spin_lock_irqsave(&hw->hw_lock, flags);
> > -		__napi_complete(napi);
> > +		napi_complete(napi);
> 
> This adds a redundant irq_save/irq_restore in the packet
> receive path.
> 
> In the case of skge, since the both ports share a single
> IRQ mask register, the lock is there to make sure that updates
> to the mask register doesn't race between NAPI finishing
> on one port and IRQ on other port changing same IRQ mask register.
> 
> 

We need to napi_gro_flush(), while IRQ are on, and napi_gro_flush() is
static to net/core/dev.c

Thanks !

[PATCH net-next-2.6 v2] skge: add GRO support

- napi_gro_flush() is exported from net/core/dev.c, to avoid
  an irq_save/irq_restore in the packet receive path.
- use napi_gro_receive() instead of netif_receive_skb()
- use napi_gro_flush() before calling __napi_complete()
- turn on NETIF_F_GRO by default
- Tested on a Marvell 88E8001 Gigabit NIC

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 drivers/net/skge.c        |    5 +++--
 include/linux/netdevice.h |    1 +
 net/core/dev.c            |    3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 40e5c46..a8a6358 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -3178,8 +3178,7 @@ static int skge_poll(struct napi_struct *napi, int to_do)
 
 		skb = skge_rx_get(dev, e, control, rd->status, rd->csum2);
 		if (likely(skb)) {
-			netif_receive_skb(skb);
-
+			napi_gro_receive(napi, skb);
 			++work_done;
 		}
 	}
@@ -3192,6 +3191,7 @@ static int skge_poll(struct napi_struct *napi, int to_do)
 	if (work_done < to_do) {
 		unsigned long flags;
 
+		napi_gro_flush(napi);
 		spin_lock_irqsave(&hw->hw_lock, flags);
 		__napi_complete(napi);
 		hw->intr_mask |= napimask[skge->port];
@@ -3849,6 +3849,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
 		dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
 		skge->rx_csum = 1;
 	}
+	dev->features |= NETIF_F_GRO;
 
 	/* read the mac address */
 	memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port*8, ETH_ALEN);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 0cf9448..fb31b5f 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1695,6 +1695,7 @@ extern gro_result_t	dev_gro_receive(struct napi_struct *napi,
 extern gro_result_t	napi_skb_finish(gro_result_t ret, struct sk_buff *skb);
 extern gro_result_t	napi_gro_receive(struct napi_struct *napi,
 					 struct sk_buff *skb);
+extern void		napi_gro_flush(struct napi_struct *napi);
 extern void		napi_reuse_skb(struct napi_struct *napi,
 				       struct sk_buff *skb);
 extern struct sk_buff *	napi_get_frags(struct napi_struct *napi);
diff --git a/net/core/dev.c b/net/core/dev.c
index 63bd20a..d8c43e7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3063,7 +3063,7 @@ out:
 	return netif_receive_skb(skb);
 }
 
-static void napi_gro_flush(struct napi_struct *napi)
+inline void napi_gro_flush(struct napi_struct *napi)
 {
 	struct sk_buff *skb, *next;
 
@@ -3076,6 +3076,7 @@ static void napi_gro_flush(struct napi_struct *napi)
 	napi->gro_count = 0;
 	napi->gro_list = NULL;
 }
+EXPORT_SYMBOL(napi_gro_flush);
 
 enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
 {



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next-2.6] skge: add GRO support
  2010-09-01  4:25   ` Eric Dumazet
@ 2010-09-01 17:58     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-09-01 17:58 UTC (permalink / raw)
  To: eric.dumazet; +Cc: shemminger, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 01 Sep 2010 06:25:32 +0200

> We need to napi_gro_flush(), while IRQ are on, and napi_gro_flush() is
> static to net/core/dev.c
> 
> Thanks !
> 
> [PATCH net-next-2.6 v2] skge: add GRO support
> 
> - napi_gro_flush() is exported from net/core/dev.c, to avoid
>   an irq_save/irq_restore in the packet receive path.
> - use napi_gro_receive() instead of netif_receive_skb()
> - use napi_gro_flush() before calling __napi_complete()
> - turn on NETIF_F_GRO by default
> - Tested on a Marvell 88E8001 Gigabit NIC
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-01 17:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-31 22:32 [PATCH net-next-2.6] skge: add GRO support Eric Dumazet
2010-09-01  1:31 ` Stephen Hemminger
2010-09-01  4:25   ` Eric Dumazet
2010-09-01 17:58     ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.