netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH net-next-2.6] gro: drivers should feed GRO only with TCP packets
@ 2010-09-01 17:04 Eric Dumazet
  2010-09-01 17:42 ` Stephen Hemminger
  2010-09-01 20:10 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Dumazet @ 2010-09-01 17:04 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Many network devices can tell if an incoming frame is a TCP one for a
small cost.

Instead of feeding GRO with all packets, we could filter packets on this
information ?

This should help machines handling a mixed UDP/TCP workload, keeping gro
overhead as small as possible.

patch against tg3 as an example...

Alternative would be to set a bit "is_tcp" on napi_struct to let this
choice being done in network stack, not by each driver. 

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 drivers/net/tg3.c |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index bc3af78..d530a0a 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -4748,13 +4748,25 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
 			}
 		}
 
+		/*
+		 * give to GRO stack only TCP frames, with good checksums.
+		 */
+		if ((desc->type_flags & RXD_FLAG_IS_TCP) &&
+		    skb->ip_summed == CHECKSUM_UNNECESSARY) {
 #if TG3_VLAN_TAG_USED
-		if (hw_vlan)
-			vlan_gro_receive(&tnapi->napi, tp->vlgrp, vtag, skb);
-		else
+			if (hw_vlan)
+				vlan_gro_receive(&tnapi->napi, tp->vlgrp, vtag, skb);
+			else
 #endif
-			napi_gro_receive(&tnapi->napi, skb);
-
+				napi_gro_receive(&tnapi->napi, skb);
+		} else {
+#if TG3_VLAN_TAG_USED
+			if (hw_vlan)
+				vlan_hwaccel_receive_skb(skb, tp->vlgrp, vtag);
+			else
+#endif
+				netif_receive_skb(skb);
+		}
 		received++;
 		budget--;
 



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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-01 17:04 [RFC PATCH net-next-2.6] gro: drivers should feed GRO only with TCP packets Eric Dumazet
2010-09-01 17:42 ` Stephen Hemminger
2010-09-01 17:48   ` David Miller
2010-09-01 17:55     ` Stephen Hemminger
2010-09-01 20:10 ` 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).