cxgb3: Replace LRO with GRO
Subsystems (3)
Divy Le Ray
Acked-byHi Herbert,
Your patch looks fine. Early testing provides the same perfs seen with LRO.
I resubmit the original patch with 2 changes:
- cxgb3_set_flags() removal did not apply.
commit 47fd23fe8efeea3af4593a8424419df48724eb25 had updated the routine.
- replace the NETIF_F_LRO features flag with NETIF_F_GRO
cxgb3: Replace LRO with GRO
This patch makes cxgb3 invoke the GRO hooks instead of LRO. As GRO has a compatible external interface to LRO this is a very straightforward replacement.
I've kept the ioctl controls for per-queue LRO switches. However, we should not encourage anyone to use these.
Because of that, I've also kept the skb construction code in cxgb3. Hopefully we can phase out those per-queue switches and then kill this too.
---
drivers/net/Kconfig | 1 drivers/net/cxgb3/adapter.h | 13 +--- drivers/net/cxgb3/cxgb3_main.c | 42 +------------- drivers/net/cxgb3/sge.c | 118 +++++----------------------------------- 4 files changed, 22 insertions(+), 152 deletions(-)
drivers/net/Kconfig +0 -1
@@ -2408,7 +2408,6 @@ config CHELSIO_T3 tristate "Chelsio Communications T3 10Gb Ethernet support" depends on CHELSIO_T3_DEPENDS select FW_LOADER - select INET_LRO help This driver supports Chelsio T3-based gigabit and 10Gb Ethernet adapters.
drivers/net/cxgb3/adapter.h +2 -11
@@ -42,7 +42,6 @@#include <linux/cache.h> #include <linux/mutex.h> #include <linux/bitops.h> -#include <linux/inet_lro.h> #include "t3cdev.h" #include <asm/io.h>
@@ -178,15 +177,11 @@ enum { /* per port SGE statistics */ SGE_PSTAT_TX_CSUM, /* # of TX checksum offloads */SGE_PSTAT_VLANEX ,/* # of VLAN tag extractions */ SGE_PSTAT_VLANINS ,/* # of VLAN tag insertions */ -SGE_PSTAT_LRO_AGGR ,/* # of page chunks added to LRO sessions */ -SGE_PSTAT_LRO_FLUSHED ,/* # of flushed LRO sessions */ -SGE_PSTAT_LRO_NO_DESC ,/* # of overflown LRO sessions */ SGE_PSTAT_MAX /* must be last */ }; -#define T3_MAX_LRO_SES 8 -#define T3_MAX_LRO_MAX_PKTS 64 +struct napi_gro_fraginfo ;struct sge_qset {/* an SGE queue set */ struct adapter *adap;
@@ -194,12 +189,8 @@ struct sge_qset { /* an SGE queue set */struct sge_rspq rspq;struct sge_fl fl[SGE_RXQ_PER_SET ];struct sge_txq txq[SGE_TXQ_PER_SET ]; -struct net_lro_mgr lro_mgr; -struct net_lro_desc lro_desc[T3_MAX_LRO_SES ]; -struct skb_frag_struct *lro_frag_tbl; -int lro_nfrags; +struct napi_gro_fraginfo lro_frag_tbl;int lro_enabled; -int lro_frag_len;void *lro_va;struct net_device *netdev;struct netdev_queue *tx_q;/* associated netdev TX queue */
drivers/net/cxgb3/cxgb3_main.c +4 -38
75 lines not on this page · raw message
drivers/net/cxgb3/sge.c +16 -102
191 lines not on this page · raw message
Quoted 8 lines · Divy Le Ray
Your patch looks fine. Early testing provides the same perfs seen with LRO.
I resubmit the original patch with 2 changes:
-cxgb3_set_flags()removal did not apply.
commit47fd23fe8efeea3af4593a8424419df48724eb25had updated the routine.
- replace theNETIF_F_LROfeatures flag withNETIF_F_GRO
Thanks for the update Divy! It looks good to me.
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 10 lines · Herbert Xu
Quoted 7 lines · Divy Le Ray
Your patch looks fine. Early testing provides the same perfs seen with LRO.
I resubmit the original patch with 2 changes:
-cxgb3_set_flags()removal did not apply.
commit47fd23fe8efeea3af4593a8424419df48724eb25had updated the routine.
- replace theNETIF_F_LROfeatures flag withNETIF_F_GROThanks for the update Divy! It looks good to me.
Hi Herbert,
The perfs are not actually as good as with LRO. With a slow server, 1 netperf stream gets on average:
without the patch, lro off: 3.8Gbs
without the patch, lro on: 6.1Gbs
with the patch, GRO on: 4.8Gbs.
I'll look into it.
Cheers,
Divy
Quoted 2 lines · Divy Le Ray
The perfs are not actually as good as with LRO.
Thanks for testing Divy!
Quoted 1 line
With a slow server, 1 netperf stream gets on average:
I presume the server is receiving?
Quoted 3 lines
without the patch, lro off: 3.8Gbs
without the patch, lro on: 6.1Gbs
with the patch, GRO on: 4.8Gbs.
What about the case of GRO off with the patch? Just checking to make sure that nothing else has changed.
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 2 lines
I presume the server is receiving?
Yes, it is receiving. The adapter is set up with one queue, its irq pinned to cpu1, irq balance disabled. CPU1 is pegged in all tests.
Quoted 7 lines
Quoted 4 lines
without the patch, lro off: 3.8Gbs
without the patch, lro on: 6.1Gbs
with the patch, GRO on: 4.8Gbs.What about the case of GRO off with the patch? Just checking to make sure that nothing else has changed.
I'm getting about 3.4Gbs with the patch and GRO off.
I did some profiling with GRO on and LRO on. Here are typical outputs:
GRO on:
CPU 1 :
26.445100 copy_user_generic_unrolled vmlinux
10.050300 skb_copy_datagram_iovec vmlinux
5.076900 memcpy vmlinux
4.636400 process_responses cxgb3.ko
4.625100 __pskb_pull_tail vmlinux
4.463300 eth_type_trans vmlinux
4.420600 inet_gro_receive vmlinux
4.310500 refill_fl cxgb3.ko
3.312700 skb_copy_bits vmlinux
3.155300 put_page vmlinux
2.818200 kfree vmlinux
2.537300 tcp_gro_receive vmlinux
2.422700 dev_gro_receive vmlinux
2.229400 kmem_cache_alloc_node vmlinux
1.526000 skb_gro_receive vmlinux
1.319200 free_hot_cold_page vmlinux
1.224800 get_page_from_freelist vmlinux
1.112500 __alloc_skb vmlinux
0.910200 kmem_cache_free vmlinux
0.872000 napi_fraginfo_skb vmlinuxLRO on:
CPU 1 :
48.511600 copy_user_generic_unrolled vmlinux
5.859600 put_page vmlinux
4.405500 process_responses cxgb3.ko
4.006400 refill_fl cxgb3.ko
2.547200 irq_entries_start vmlinux
2.315900 free_hot_cold_page vmlinux
2.224400 skb_copy_datagram_iovec vmlinux
1.985400 tcp_recvmsg vmlinux
1.311700 csum_partial vmlinux
1.276200 _raw_spin_lock vmlinux
1.088000 get_page_from_freelist vmlinux
1.016900 get_pageblock_flags_group vmlinux
0.920300 memcpy_toiovec vmlinux
0.859200 kfree vmlinux
0.688900 dst_release vmlinux
0.630400 t3_sge_intr_msix_napi cxgb3.ko
0.559300 tcp_rcv_established vmlinux
0.472800 kmem_cache_alloc_node vmlinux
0.404200 __inet_lookup_established vmlinux
0.399100 memset vmlinuxI have not looked at the code yet. It's getting late :)
Cheers,
Divy
Quoted 9 lines · Divy Le Ray
Quoted 7 lines
Quoted 4 lines
without the patch, lro off: 3.8Gbs
without the patch, lro on: 6.1Gbs
with the patch, GRO on: 4.8Gbs.What about the case of GRO off with the patch? Just checking to make sure that nothing else has changed.
I'm getting about 3.4Gbs with the patch and GRO off.
I wonder where the 3.8 => 3.4 slow-down is coming from.
Quoted 12 lines
I did some profiling with GRO on and LRO on. Here are typical outputs:
GRO on:
CPU 1 :26.445100 copy_user_generic_unrolled vmlinux 10.050300 skb_copy_datagram_iovec vmlinux 5.076900 memcpy vmlinux 4.636400 process_responses cxgb3.ko 4.625100 __pskb_pull_tail vmlinux 4.463300 eth_type_trans vmlinux 4.420600 inet_gro_receive vmlinux 4.310500 refill_fl cxgb3.ko 3.312700 skb_copy_bits vmlinux
Thanks, this is very helpful. The first obvious deficiency is that napi_fraginfo_skb is causing multiple pskb_may_pull calls on every fragment which is bad.
I'll get a patch out for you test.
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.txtHi Divy:
Quoted 2 lines · Divy Le Ray
1.112500
__alloc_skbvmlinux
Can you confirm that you were testing 1500 byte packets? If so that would tell us why this function got up there. As it stands GRO will not stop aggregating even when the frags array is full, until the skb size hits 64K.
That means half the packet will be in frag_list which is very inefficient.
If this is indeed the problem, then for now I'll simply make it stop aggregating after the array is full, just like LRO.
While in future we can extend it such that even when it starts using frag_list, it'll still continue to fill in the frags array.
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.txtQuoted 6 lines · Herbert Xu
Hi Divy:
Quoted 1 line · Divy Le Ray
1.112500
__alloc_skbvmlinuxCan you confirm that you were testing 1500 byte packets?
Yes.
Cheers,
Divy
Quoted 2 lines · Divy Le Ray
Yes.
Great. Please give this patch a whirl.
commit a9156545da4f6ed729b1871a92e3ead04f37a034
Author: Herbert Xu <[email protected]> Date: Sat Jan 17 21:49:42 2009 +1100
gro: Do not merge paged packets into frag_list
Bigger is not always better :)
It was easy to continue to merged packets into frag_list after the page array is full. However, this turns out to be worse than LRO because frag_list is a much less efficient form of storage than the page array. So we're better off stopping the merge and starting a new entry with an empty page array.
In future we can optimise this further by doing frag_list merging but making sure that we continue to fill in the page array.
commit 2e54c6210c41f7fb2c503a4b51a8288e05a1c9d5
Author: Herbert Xu <[email protected]> Date: Sat Jan 17 21:45:11 2009 +1100
gro: Avoid copying headers of unmerged packets
Unfortunately simplicity isn't always the best. The fraginfo interface turned out to be suboptimal. The problem was quite obvious. For every packet, we have to copy the headers from the frags structure into skb->head, even though for 99% of the packets this part is immediately thrown away after the merge.
LRO didn't have this problem because it directly read the headers from the frags structure.
This patch attempts to address this by creating an interface that allows GRO to access the headers in the first frag without having to copy it. Because all drivers that use frags place the headers in the first frag this optimisation should be enough.
commit db14bd4bff3d85d779a83fbdc554f4147ee9b841
Author: Herbert Xu <[email protected]> Date: Sun Jan 18 00:00:13 2009 +1100
gro: Fix merging of paged packets
The previous fix to paged packets broke the merging because it reset the skb->len before we added it to the merged packet. This wasn't detected because it simply resulted in the truncation of the packet while the missing bit is subsequently retransmitted.
The fix is to store skb->len before we clobber it.
commit 6ba4147cb5854d334965d89acb821e6f624534eb
Author: Herbert Xu <[email protected]> Date: Sat Jan 17 21:05:58 2009 +1100
gro: Move common completion code into helpers
Currently VLAN still has a bit of common code handling the aftermath of GRO that's shared with the common path. This patch moves them into shared helpers to reduce code duplication.
commit 86c3c2fc1f99394990b3ef1c2881b6036e4f5141
Author: Herbert Xu <[email protected]> Date: Sat Jan 17 15:06:40 2009 +1100
gro: Fix error handling on extremely short frags
When a frag is shorter than an Ethernet header, we'd return a zeroed packet instead of aborting. This patch fixes that.
commit 099f08d2279eff7f74226bc8f691b358b1eac7b7
Author: Herbert Xu <[email protected]> Date: Sat Jan 17 20:12:07 2009 +1100
gro: Fix handling of complete checksums in IPv6
We need to perform skb_postpull_rcsum after pulling the IPv6 header in order to maintain the correctness of the complete checksum.
This patch also adds a missing iph reload after pulling.
include/linux/netdevice.h +29 -0
@@ -983,6 +983,9 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,void netif_napi_del (struct napi_struct *napi);struct napi_gro_cb { +/* This indicates where we are processing relative to skb->data. */ +int data_offset; +/* This is non-zero if the packet may be of the same flow. */ int same_flow;
@@ -1084,6 +1087,29 @@ extern int dev_restart(struct net_device *dev);#ifdef CONFIG_NETPOLL_TRAP extern int netpoll_trap (void );#endif +extern void *skb_gro_header (struct sk_buff *skb,unsigned int hlen); +extern int skb_gro_receive (struct sk_buff **head, +struct sk_buff *skb); + +static inline unsigned int skb_gro_offset (const struct sk_buff *skb) +{ +return NAPI_GRO_CB (skb)->data_offset; +} + +static inline unsigned int skb_gro_len (const struct sk_buff *skb) +{ +return skb->len -NAPI_GRO_CB (skb)->data_offset; +} + +static inline void skb_gro_pull (struct sk_buff *skb,unsigned int len) +{ +NAPI_GRO_CB (skb)->data_offset += len; +} + +static inline void skb_gro_reset_offset (struct sk_buff *skb) +{ +NAPI_GRO_CB (skb)->data_offset =0 ; +} static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
@@ -1372,12 +1398,15 @@ extern int netif_receive_skb(struct sk_buff *skb);extern void napi_gro_flush (struct napi_struct *napi);extern int dev_gro_receive (struct napi_struct *napi,struct sk_buff *skb); +extern int napi_skb_finish (int ret,struct sk_buff *skb);extern int napi_gro_receive (struct napi_struct *napi,struct sk_buff *skb);extern void napi_reuse_skb (struct napi_struct *napi,struct sk_buff *skb);extern struct sk_buff *napi_fraginfo_skb (struct napi_struct *napi,struct napi_gro_fraginfo *info); +extern int napi_frags_finish (struct napi_struct *napi, +struct sk_buff *skb,int ret);extern int napi_gro_frags (struct napi_struct *napi,struct napi_gro_fraginfo *info);extern void netif_nit_deliver (struct sk_buff *skb);
include/linux/skbuff.h +0 -2
@@ -1687,8 +1687,6 @@ extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen);extern struct sk_buff *skb_segment (struct sk_buff *skb,int features); -extern int skb_gro_receive (struct sk_buff **head, -struct sk_buff *skb);static inline void *skb_header_pointer (const struct sk_buff *skb,int offset,int len,void *buffer)
net/8021q/vlan_core.c +5 -34
@@ -98,22 +98,9 @@ drop:int vlan_gro_receive (struct napi_struct *napi,struct vlan_group *grp,unsigned int vlan_tci,struct sk_buff *skb) { -int err =NET_RX_SUCCESS ; +skb_gro_reset_offset (skb); -switch (vlan_gro_common (napi, grp, vlan_tci, skb)) { -case -1 : -return netif_receive_skb (skb); - -case 2 : - err =NET_RX_DROP ; -/* fall through */ - -case 1 : -kfree_skb (skb); -break ; - } - -return err; +return napi_skb_finish (vlan_gro_common (napi, grp, vlan_tci, skb), skb); }EXPORT_SYMBOL (vlan_gro_receive);
@@ -121,27 +108,11 @@ int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp, unsigned int vlan_tci, struct napi_gro_fraginfo *info) { struct sk_buff *skb = napi_fraginfo_skb(napi, info); -int err =NET_RX_DROP ;if (!skb) - goto out; - - err =NET_RX_SUCCESS ; - -switch (vlan_gro_common (napi, grp, vlan_tci, skb)) { -case -1 : -return netif_receive_skb (skb); - -case 2 : - err =NET_RX_DROP ; -/* fall through */ - -case 1 : -napi_reuse_skb (napi, skb); -break ; - } +return NET_RX_DROP ; -out: -return err; +return napi_frags_finish (napi, skb, +vlan_gro_common (napi, grp, vlan_tci, skb)); }EXPORT_SYMBOL (vlan_gro_frags);
net/core/dev.c +110 -33
254 lines not on this page · raw message
net/core/skbuff.c +20 -10
@@ -2587,16 +2587,23 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)struct sk_buff *p = *head;struct sk_buff *nskb;unsigned int headroom; -unsigned int hlen = p->data -skb_mac_header (p); +unsigned int len =skb_gro_len (skb); -if (hlen + p->len + skb->len >=65536 ) +if (p->len + len >=65536 )return -E2BIG ;if (skb_shinfo (p)->frag_list) goto merge; -else if (!skb_headlen (p) && !skb_headlen (skb) && -skb_shinfo (p)->nr_frags +skb_shinfo (skb)->nr_frags < -MAX_SKB_FRAGS ) { +else if (skb_headlen (skb) <=skb_gro_offset (skb)) { +if (skb_shinfo (p)->nr_frags +skb_shinfo (skb)->nr_frags > +MAX_SKB_FRAGS ) +return -E2BIG ; + +skb_shinfo (skb)->frags[0 ].page_offset += +skb_gro_offset (skb) -skb_headlen (skb); +skb_shinfo (skb)->frags[0 ].size -= +skb_gro_offset (skb) -skb_headlen (skb); +memcpy (skb_shinfo (p)->frags +skb_shinfo (p)->nr_frags,skb_shinfo (skb)->frags,skb_shinfo (skb)->nr_frags *sizeof (skb_frag_t));
@@ -2621,12 +2628,15 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) nskb->mac_len = p->mac_len;skb_reserve (nskb, headroom); +__skb_put (nskb,skb_headlen (p)); -skb_set_mac_header (nskb, -hlen); +skb_set_mac_header (nskb,skb_mac_header (p) - p->data);skb_set_network_header (nskb,skb_network_offset (p));skb_set_transport_header (nskb,skb_transport_offset (p)); -memcpy (skb_mac_header (nskb),skb_mac_header (p), hlen); +__skb_pull (p,skb_gro_offset (p)); +memcpy (skb_mac_header (nskb),skb_mac_header (p), + p->data -skb_mac_header (p)); *NAPI_GRO_CB (nskb) = *NAPI_GRO_CB (p);skb_shinfo (nskb)->frag_list = p;
@@ -2651,9 +2661,9 @@ merge: done:NAPI_GRO_CB (p)->count++; - p->data_len += skb->len; - p->truesize += skb->len; - p->len += skb->len; + p->data_len += len; + p->truesize += len; + p->len += len;NAPI_GRO_CB (skb)->same_flow =1 ;return 0 ;
net/ipv4/af_inet.c +5 -5
@@ -1253,10 +1253,10 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head,int proto;int id; -if (unlikely (!pskb_may_pull (skb,sizeof (*iph)))) + iph =skb_gro_header (skb,sizeof (*iph)); +if (unlikely (!iph)) goto out; - iph =ip_hdr (skb); proto = iph->protocol & (MAX_INET_PROTOS -1 );rcu_read_lock ();
@@ -1270,7 +1270,7 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head,if (unlikely (ip_fast_csum ((u8 *)iph, iph->ihl))) goto out_unlock; - flush =ntohs (iph->tot_len) != skb->len || + flush =ntohs (iph->tot_len) !=skb_gro_len (skb) || iph->frag_off !=htons (IP_DF ); id =ntohs (iph->id);
@@ -1298,8 +1298,8 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head, }NAPI_GRO_CB (skb)->flush |= flush; -__skb_pull (skb,sizeof (*iph)); -skb_reset_transport_header (skb); +skb_gro_pull (skb,sizeof (*iph)); +skb_set_transport_header (skb,skb_gro_offset (skb)); pp = ops->gro_receive (head, skb);
net/ipv4/tcp.c +8 -8
@@ -2473,19 +2473,19 @@ struct sk_buff **tcp_gro_receive(struct sk_buff **head, struct sk_buff *skb)unsigned int mss =1 ;int flush =1 ; -if (!pskb_may_pull (skb,sizeof (*th))) + th =skb_gro_header (skb,sizeof (*th)); +if (unlikely (!th)) goto out; - th =tcp_hdr (skb); thlen = th->doff *4 ;if (thlen <sizeof (*th)) goto out; -if (!pskb_may_pull (skb, thlen)) + th =skb_gro_header (skb, thlen); +if (unlikely (!th)) goto out; - th =tcp_hdr (skb); -__skb_pull (skb, thlen); +skb_gro_pull (skb, thlen); flags =tcp_flag_word (th);
@@ -2513,10 +2513,10 @@ found: flush |= th->ack_seq != th2->ack_seq || th->window != th2->window; flush |=memcmp (th +1 , th2 +1 , thlen -sizeof (*th)); - total = p->len; + total =skb_gro_len (p); mss =skb_shinfo (p)->gso_size; - flush |= skb->len > mss || skb->len <=0 ; + flush |=skb_gro_len (skb) > mss || !skb_gro_len (skb); flush |=ntohl (th2->seq) + total !=ntohl (th->seq);if (flush ||skb_gro_receive (head, skb)) {
@@ -2529,7 +2529,7 @@ found:tcp_flag_word (th2) |= flags & (TCP_FLAG_FIN |TCP_FLAG_PSH ); out_check_final: - flush = skb->len < mss; + flush =skb_gro_len (skb) < mss; flush |= flags & (TCP_FLAG_URG |TCP_FLAG_PSH |TCP_FLAG_RST |TCP_FLAG_SYN |TCP_FLAG_FIN );
net/ipv4/tcp_ipv4.c +1 -1
@@ -2355,7 +2355,7 @@ struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff *skb)switch (skb->ip_summed) {case CHECKSUM_COMPLETE : -if (!tcp_v4_check (skb->len, iph->saddr, iph->daddr, +if (!tcp_v4_check (skb_gro_len (skb), iph->saddr, iph->daddr, skb->csum)) { skb->ip_summed =CHECKSUM_UNNECESSARY ;break ;
net/ipv6/af_inet6.c +26 -9
@@ -797,24 +797,36 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,unsigned int nlen;int flush =1 ;int proto; +__wsum csum; -if (unlikely (!pskb_may_pull (skb,sizeof (*iph)))) + iph =skb_gro_header (skb,sizeof (*iph)); +if (unlikely (!iph)) goto out; - iph =ipv6_hdr (skb); -__skb_pull (skb,sizeof (*iph)); +skb_gro_pull (skb,sizeof (*iph)); +skb_set_transport_header (skb,skb_gro_offset (skb)); - flush +=ntohs (iph->payload_len) != skb->len; + flush +=ntohs (iph->payload_len) !=skb_gro_len (skb);rcu_read_lock (); - proto =ipv6_gso_pull_exthdrs (skb, iph->nexthdr); -IPV6_GRO_CB (skb)->proto = proto; + proto = iph->nexthdr; ops =rcu_dereference (inet6_protos[proto]); -if (!ops || !ops->gro_receive) - goto out_unlock; +if (!ops || !ops->gro_receive) { +__pskb_pull (skb,skb_gro_offset (skb)); + proto =ipv6_gso_pull_exthdrs (skb, proto); +skb_gro_pull (skb, -skb_transport_offset (skb)); +skb_reset_transport_header (skb); +__skb_push (skb,skb_gro_offset (skb)); + +if (!ops || !ops->gro_receive) + goto out_unlock; + + iph =ipv6_hdr (skb); + } + +IPV6_GRO_CB (skb)->proto = proto; flush--; -skb_reset_transport_header (skb); nlen =skb_network_header_len (skb);for (p = *head; p; p = p->next) {
@@ -839,8 +851,13 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,NAPI_GRO_CB (skb)->flush |= flush; + csum = skb->csum; +skb_postpull_rcsum (skb, iph,skb_network_header_len (skb)); + pp = ops->gro_receive (head, skb); + skb->csum = csum; + out_unlock:rcu_read_unlock ();
net/ipv6/tcp_ipv6.c +1 -1
@@ -948,7 +948,7 @@ struct sk_buff **tcp6_gro_receive(struct sk_buff **head, struct sk_buff *skb)switch (skb->ip_summed) {case CHECKSUM_COMPLETE : -if (!tcp_v6_check (skb->len, &iph->saddr, &iph->daddr, +if (!tcp_v6_check (skb_gro_len (skb), &iph->saddr, &iph->daddr, skb->csum)) { skb->ip_summed =CHECKSUM_UNNECESSARY ;break ;
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.txtQuoted 5 lines · Herbert Xu
Quoted 1 line · Divy Le Ray
Yes.
Great. Please give this patch a whirl.
Hi Herbert,
Thanks for the patch. It does improve the performance. I'm now getting about 5.3Gbs.
Here is a oprofile output:
33.929900 copy_user_generic_unrolled vmlinux
7.150300 process_responses cxgb3.ko
6.261100 refill_fl cxgb3.ko
6.181700 memcpy vmlinux
6.168100 inet_gro_receive vmlinux
4.593700 put_page vmlinux
4.085600 dev_gro_receive vmlinux
3.833800 tcp_gro_receive vmlinux
1.817100 free_hot_cold_page vmlinux
1.715000 skb_copy_datagram_iovec vmlinux
1.705900 skb_gro_header vmlinux
1.676400 get_page_from_freelist vmlinux
1.256700 tcp_recvmsg vmlinux
0.893800 get_pageblock_flags_group vmlinux
0.850700 irq_entries_start vmlinux
0.803000 _raw_spin_lock vmlinux
0.782600 skb_gro_receive vmlinux
0.739500 memcpy_toiovec vmlinux
0.725900 napi_fraginfo_skb vmlinux
0.601200 kfree vmlinuxCheers,
Divy
Quoted 3 lines · Divy Le Ray
Thanks for the patch. It does improve the performance. I'm now getting about 5.3Gbs.
Thanks for testing Divy!
Quoted 5 lines
Here is a oprofile output:
33.929900 copy_user_generic_unrolled vmlinux 7.150300 process_responses cxgb3.ko 6.261100 refill_fl cxgb3.ko 6.181700 memcpy vmlinux
I wonder why this is still up there.
Maybe this patch will help?
net/core/dev.c +2 -1
@@ -2554,7 +2554,8 @@ struct sk_buff *napi_fraginfo_skb(struct napi_struct *napi,BUG_ON (info->nr_frags >MAX_SKB_FRAGS );skb_shinfo (skb)->nr_frags = info->nr_frags; -memcpy (skb_shinfo (skb)->frags, info->frags,sizeof (info->frags)); +memcpy (skb_shinfo (skb)->frags, info->frags, + info->nr_frags *sizeof (*info->frags)); skb->data_len = info->len; skb->len += info->len;
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.txtDavid Miller
maintainerFrom: Divy Le Ray <[email protected]>
Date: Thu, 15 Jan 2009 13:14:03 -0800
Quoted 9 lines
cxgb3: Replace LRO with GRO
This patch makes cxgb3 invoke the GRO hooks instead of LRO. As GRO has a compatible external interface to LRO this is a very straightforward replacement.
I've kept the ioctl controls for per-queue LRO switches. However, we should not encourage anyone to use these.
Quoted 6 lines
Because of that, I've also kept the skb construction code in cxgb3. Hopefully we can phase out those per-queue switches and then kill this too.
Signed-off-by Herbert Xu <[email protected]>Acked-by Divy Le Ray <[email protected]>
I've added this to my net-next-2.6 tree.
I'm confident that you will work out the performance issues with Herbert, else we'll simply revert this.
David Miller
maintainerFrom: David Miller <[email protected]>
Date: Mon, 19 Jan 2009 17:03:08 -0800 (PST)
Quoted 16 lines
From: Divy Le Ray <[email protected]>
Date: Thu, 15 Jan 2009 13:14:03 -0800Quoted 13 lines
cxgb3: Replace LRO with GRO
This patch makes cxgb3 invoke the GRO hooks instead of LRO. As GRO has a compatible external interface to LRO this is a very straightforward replacement.
I've kept the ioctl controls for per-queue LRO switches. However, we should not encourage anyone to use these.
Because of that, I've also kept the skb construction code in cxgb3. Hopefully we can phase out those per-queue switches and then kill this too.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Herbert Xu <[email protected]>Acked-by Divy Le Ray <[email protected]>I've added this to my net-next-2.6 tree.
I'm confident that you will work out the performance issues with Herbert, else we'll simply revert this.
I had to add a fix due to some build bustage resulting from this change.
drivers/scsi/cxgb3i/cxgb3i_ddp.h was depending upon the implicit inclusion of linux/vmalloc.h coming from the inet_lro.h include which is removed by this change.
In file included from drivers/scsi/cxgb3i/cxgb3i_ddp.c:24:drivers/scsi/cxgb3i/cxgb3i_ddp.h: In function 'cxgb3i_alloc_big_mem':drivers/scsi/cxgb3i/cxgb3i_ddp.h:148: error: implicit declaration of function 'vmalloc' drivers/scsi/cxgb3i/cxgb3i_ddp.h:148: warning: assignment makes pointer from integer without a cast drivers/scsi/cxgb3i/cxgb3i_ddp.h: In function 'cxgb3i_free_big_mem':drivers/scsi/cxgb3i/cxgb3i_ddp.h:157: error: implicit declaration of function 'vfree'
I'll fix this up.
Quoted 11 lines · David Miller
drivers/scsi/cxgb3i/cxgb3i_ddp.hwas depending upon the implicit inclusion oflinux/vmalloc.hcoming from theinet_lro.hinclude which is removed by this change.In file included from
drivers/scsi/cxgb3i/cxgb3i_ddp.c:24:drivers/scsi/cxgb3i/cxgb3i_ddp.h: In function 'cxgb3i_alloc_big_mem':drivers/scsi/cxgb3i/cxgb3i_ddp.h:148: error: implicit declaration of function 'vmalloc'drivers/scsi/cxgb3i/cxgb3i_ddp.h:148: warning: assignment makes pointer from integer without a castdrivers/scsi/cxgb3i/cxgb3i_ddp.h: In function 'cxgb3i_free_big_mem':drivers/scsi/cxgb3i/cxgb3i_ddp.h:157: error: implicit declaration of function 'vfree'
Thanks Dave!
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 · David Miller
I had to add a fix due to some build bustage resulting from this change.
drivers/scsi/cxgb3i/cxgb3i_ddp.hwas depending upon the implicit inclusion oflinux/vmalloc.hcoming from theinet_lro.hinclude which is removed by this change.
Quoted 8 lines
In file included from
drivers/scsi/cxgb3i/cxgb3i_ddp.c:24:drivers/scsi/cxgb3i/cxgb3i_ddp.h: In function 'cxgb3i_alloc_big_mem':drivers/scsi/cxgb3i/cxgb3i_ddp.h:148: error: implicit declaration of function 'vmalloc'drivers/scsi/cxgb3i/cxgb3i_ddp.h:148: warning: assignment makes pointer from integer without a castdrivers/scsi/cxgb3i/cxgb3i_ddp.h: In function 'cxgb3i_free_big_mem':drivers/scsi/cxgb3i/cxgb3i_ddp.h:157: error: implicit declaration of function 'vfree'I'll fix this up.
Oops. Sorry about that. Thanks for fixing it.
Cheers,
Divy