net: add TCP fraglist GRO support
Subsystems (3)
RFC 1/1 net: add TCP fraglist GRO support
When forwarding TCP after GRO, software segmentation is very expensive, especially when the checksum needs to be recalculated.
One case where that's currently unavoidable is when routing packets over PPPoE. Performance improves significantly when using fraglist GRO implemented in the same way as for UDP.
Here's a measurement of running 2 TCP streams through a MediaTek MT7622 device (2-core Cortex-A53), which runs NAT with flow offload enabled from one ethernet port to PPPoE on another ethernet port + cake qdisc set to 1Gbps.
rx-gro-list off: 630 Mbit/s, CPU 35% idle rx-gro-list on: 770 Mbit/s, CPU 40% idle
--- include/net/gro.h | 1 + include/net/tcp.h | 3 +- net/core/gro.c | 27 ++++++++ net/ipv4/tcp_offload.c | 143 ++++++++++++++++++++++++++++++++++++++- net/ipv4/udp_offload.c | 27 -------- net/ipv6/tcpv6_offload.c | 58 +++++++++++++++- 6 files changed, 228 insertions(+), 31 deletions(-)
include/net/gro.h +1 -0
@@ -429,6 +429,7 @@ static inline __wsum ip6_gro_compute_pseudo(const struct sk_buff *skb, }int skb_gro_receive (struct sk_buff *p,struct sk_buff *skb); +int skb_gro_receive_list (struct sk_buff *p,struct sk_buff *skb);/* Pass the currently batched GRO_NORMAL SKBs up to the stack. */ static inline void gro_normal_list (struct napi_struct *napi)
include/net/tcp.h +2 -1
@@ -2194,7 +2194,8 @@ void tcp_v4_destroy_sock(struct sock *sk);struct sk_buff *tcp_gso_segment (struct sk_buff *skb,netdev_features_t features); -struct sk_buff *tcp_gro_receive (struct list_head *head,struct sk_buff *skb); +struct sk_buff *tcp_gro_receive (struct list_head *head,struct sk_buff *skb, +bool fraglist); INDIRECT_CALLABLE_DECLARE(int tcp4_gro_complete(struct sk_buff *skb, int thoff)); INDIRECT_CALLABLE_DECLARE(struct sk_buff *tcp4_gro_receive(struct list_head *head, struct sk_buff *skb)); INDIRECT_CALLABLE_DECLARE(int tcp6_gro_complete(struct sk_buff *skb, int thoff));
net/core/gro.c +27 -0
@@ -231,6 +231,33 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb)return 0 ; } +int skb_gro_receive_list (struct sk_buff *p,struct sk_buff *skb) +{ +if (unlikely (p->len + skb->len >=65536 )) +return -E2BIG ; + +if (NAPI_GRO_CB (p)->last == p) +skb_shinfo (p)->frag_list = skb; +else +NAPI_GRO_CB (p)->last->next = skb; + +skb_pull (skb,skb_gro_offset (skb)); + +NAPI_GRO_CB (p)->last = skb; +NAPI_GRO_CB (p)->count++; + p->data_len += skb->len; + +/* sk ownership - if any - completely transferred to the aggregated packet */ + skb->destructor =NULL ; + skb->sk =NULL ; + p->truesize += skb->truesize; + p->len += skb->len; + +NAPI_GRO_CB (skb)->same_flow =1 ; + +return 0 ; +} +static void napi_gro_complete (struct napi_struct *napi,struct sk_buff *skb) {
net/ipv4/tcp_offload.c +141 -2
197 lines not on this page · raw message
net/ipv4/udp_offload.c +0 -27
@@ -433,33 +433,6 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,return segs; } -static int skb_gro_receive_list (struct sk_buff *p,struct sk_buff *skb) -{ -if (unlikely (p->len + skb->len >=65536 )) -return -E2BIG ; - -if (NAPI_GRO_CB (p)->last == p) -skb_shinfo (p)->frag_list = skb; -else -NAPI_GRO_CB (p)->last->next = skb; - -skb_pull (skb,skb_gro_offset (skb)); - -NAPI_GRO_CB (p)->last = skb; -NAPI_GRO_CB (p)->count++; - p->data_len += skb->len; - -/* sk ownership - if any - completely transferred to the aggregated packet */ - skb->destructor =NULL ; - skb->sk =NULL ; - p->truesize += skb->truesize; - p->len += skb->len; - -NAPI_GRO_CB (skb)->same_flow =1 ; - -return 0 ; -} -#define UDP_GRO_CNT_MAX 64 static struct sk_buff *udp_gro_receive_segment(struct list_head *head,
net/ipv6/tcpv6_offload.c +57 -1
88 lines not on this page · raw message
Signature · 1 line
2.44.0
Quoted 7 lines · Felix Fietkau
When forwarding TCP after GRO, software segmentation is very expensive, especially when the checksum needs to be recalculated.
One case where that's currently unavoidable is when routing packets over PPPoE. Performance improves significantly when using fraglist GRO implemented in the same way as for UDP.
Quoted 7 lines
Here's a measurement of running 2 TCP streams through a MediaTek MT7622 device (2-core Cortex-A53), which runs NAT with flow offload enabled from one ethernet port to PPPoE on another ethernet port + cake qdisc set to 1Gbps.
rx-gro-list off: 630 Mbit/s, CPU 35% idle rx-gro-list on: 770 Mbit/s, CPU 40% idle
Hi Felix
changelog is a bit terse, and patch complex.
Could you elaborate why this issue
seems to be related to a specific driver ?
I think we should push hard to not use frag_list in drivers :/
And GRO itself could avoid building frag_list skbs in hosts where forwarding is enabled.
(Note that we also can increase MAX_SKB_FRAGS to 45 these days)
Quoted 23 lines · Eric Dumazet
Quoted 7 lines · Felix Fietkau
When forwarding TCP after GRO, software segmentation is very expensive, especially when the checksum needs to be recalculated.
One case where that's currently unavoidable is when routing packets over PPPoE. Performance improves significantly when using fraglist GRO implemented in the same way as for UDP.Quoted 7 lines
Here's a measurement of running 2 TCP streams through a MediaTek MT7622 device (2-core Cortex-A53), which runs NAT with flow offload enabled from one ethernet port to PPPoE on another ethernet port + cake qdisc set to 1Gbps.
rx-gro-list off: 630 Mbit/s, CPU 35% idle rx-gro-list on: 770 Mbit/s, CPU 40% idleHi Felix
changelog is a bit terse, and patch complex.
Could you elaborate why this issue
seems to be related to a specific driver ?
Quoted 6 lines
I think we should push hard to not use
frag_listin drivers :/And GRO itself could avoid building
frag_listskbs in hosts where forwarding is enabled.(Note that we also can increase
MAX_SKB_FRAGSto 45 these days)
The issue is not related to a specific driver at all. Here's how traffic flows: TCP packets are received on the SoC ethernet driver, the network stack performs regular GRO. The packet gets forwarded by flow offloading until it reaches the PPPoE device. PPPoE does not support GSO packets, so the packets need to be segmented again. This is *very* expensive, since data needs to be copied and checksummed.
So in my patch, I changed the code to build fraglist GRO instead of regular GRO packets, whenever there is no local socket to receive the packets. This makes segmenting very cheap, since the original skbs are preserved on the trip through the stack. The only cost is an extra socket lookup whenever NETIF_F_FRAGLIST_GRO is enabled.
PPPoE in this case is only an example. The same issue appears when forwarding to any netdev which does not support TSO, which in my case affects most wifi drivers as well.
- Felix
Quoted 30 lines · Felix Fietkau
Quoted 28 lines · Eric Dumazet
Quoted 7 lines · Felix Fietkau
When forwarding TCP after GRO, software segmentation is very expensive, especially when the checksum needs to be recalculated.
One case where that's currently unavoidable is when routing packets over PPPoE. Performance improves significantly when using fraglist GRO implemented in the same way as for UDP.Quoted 7 lines
Here's a measurement of running 2 TCP streams through a MediaTek MT7622 device (2-core Cortex-A53), which runs NAT with flow offload enabled from one ethernet port to PPPoE on another ethernet port + cake qdisc set to 1Gbps.
rx-gro-list off: 630 Mbit/s, CPU 35% idle rx-gro-list on: 770 Mbit/s, CPU 40% idleHi Felix
changelog is a bit terse, and patch complex.
Could you elaborate why this issue
seems to be related to a specific driver ?I think we should push hard to not use
frag_listin drivers :/And GRO itself could avoid building
frag_listskbs in hosts where forwarding is enabled.
Quoted 8 lines
Quoted 1 line
(Note that we also can increase
MAX_SKB_FRAGSto 45 these days)The issue is not related to a specific driver at all. Here's how traffic
flows: TCP packets are received on the SoC ethernet driver, the network stack performs regular GRO. The packet gets forwarded by flow offloading until it reaches the PPPoE device. PPPoE does not support GSO packets, so the packets need to be segmented again.
This is *very* expensive, since data needs to be copied and checksummed.
gso segmentation does not copy the payload, unless the device has no SG capability.
I guess something should be done about that, regardless of your GRO work, since most ethernet devices support SG these days.
Some drivers use header split for RX, so forwarding to PPPoE would require a linearization anyway, if SG is not properly handled.
Quoted 6 lines
So in my patch, I changed the code to build fraglist GRO instead of regular GRO packets, whenever there is no local socket to receive the packets. This makes segmenting very cheap, since the original skbs are preserved on the trip through the stack. The only cost is an extra socket lookup whenever
NETIF_F_FRAGLIST_GROis enabled.
A socket lookup in multi-net-namespace world is not going to work generically, but I get the idea now.
Quoted 40 lines · Eric Dumazet
Quoted 30 lines · Felix Fietkau
Quoted 28 lines · Eric Dumazet
Quoted 7 lines · Felix Fietkau
When forwarding TCP after GRO, software segmentation is very expensive, especially when the checksum needs to be recalculated.
One case where that's currently unavoidable is when routing packets over PPPoE. Performance improves significantly when using fraglist GRO implemented in the same way as for UDP.Quoted 7 lines
Here's a measurement of running 2 TCP streams through a MediaTek MT7622 device (2-core Cortex-A53), which runs NAT with flow offload enabled from one ethernet port to PPPoE on another ethernet port + cake qdisc set to 1Gbps.
rx-gro-list off: 630 Mbit/s, CPU 35% idle rx-gro-list on: 770 Mbit/s, CPU 40% idleHi Felix
changelog is a bit terse, and patch complex.
Could you elaborate why this issue
seems to be related to a specific driver ?I think we should push hard to not use
frag_listin drivers :/And GRO itself could avoid building
frag_listskbs in hosts where forwarding is enabled.Quoted 8 lines
Quoted 1 line
(Note that we also can increase
MAX_SKB_FRAGSto 45 these days)The issue is not related to a specific driver at all. Here's how traffic
flows: TCP packets are received on the SoC ethernet driver, the network stack performs regular GRO. The packet gets forwarded by flow offloading until it reaches the PPPoE device. PPPoE does not support GSO packets, so the packets need to be segmented again.
This is *very* expensive, since data needs to be copied and checksummed.
Quoted 8 lines
gso segmentation does not copy the payload, unless the device has no SG capability.
I guess something should be done about that, regardless of your GRO work, since most ethernet devices support SG these days.
Some drivers use header split for RX, so forwarding to PPPoE would require a linearization anyway, if SG is not properly handled.
In the world of consumer-grade WiFi devices, there are a lot of chipsets with limited or nonexistent SG support, and very limited checksum offload capabilities on Ethernet. The WiFi side of these devices is often even worse. I think fraglist GRO is a decent fallback for the inevitable corner cases.
Quoted 8 lines
Quoted 5 lines
So in my patch, I changed the code to build fraglist GRO instead of regular GRO packets, whenever there is no local socket to receive the packets. This makes segmenting very cheap, since the original skbs are preserved on the trip through the stack. The only cost is an extra socket lookup whenever
NETIF_F_FRAGLIST_GROis enabled.A socket lookup in multi-net-namespace world is not going to work generically, but I get the idea now.
Right, I can't think of a proper solution to this at the moment. Considering that NETIF_F_FRAGLIST_GRO is opt-in and only meant for rather specific configurations anyway, this should not be too much of a problem, right?
- Felix
Quoted 6 lines · Felix Fietkau
In the world of consumer-grade WiFi devices, there are a lot of chipsets with limited or nonexistent SG support, and very limited checksum offload capabilities on Ethernet. The WiFi side of these devices is often even worse. I think fraglist GRO is a decent fallback for the inevitable corner cases.
What about netfilter and NAT ? Are they okay with NETIF_F_FRAGLIST_GRO already ?
Many of these devices are probably using NAT.
Quoted 11 lines · Eric Dumazet
Quoted 6 lines · Felix Fietkau
In the world of consumer-grade WiFi devices, there are a lot of chipsets with limited or nonexistent SG support, and very limited checksum offload capabilities on Ethernet. The WiFi side of these devices is often even worse. I think fraglist GRO is a decent fallback for the inevitable corner cases.
What about netfilter and NAT ? Are they okay with
NETIF_F_FRAGLIST_GROalready ?Many of these devices are probably using NAT.
In my tests, nftables NAT works just fine, both with and without flowtable offloading. I didn't see anything in netfilter that would have a problem with this.
- Felix
Quoted 10 lines · Felix Fietkau
Quoted 8 lines · Eric Dumazet
Quoted 6 lines · Felix Fietkau
In the world of consumer-grade WiFi devices, there are a lot of chipsets with limited or nonexistent SG support, and very limited checksum offload capabilities on Ethernet. The WiFi side of these devices is often even worse. I think fraglist GRO is a decent fallback for the inevitable corner cases.
Quoted 7 lines
Quoted 3 lines
What about netfilter and NAT ? Are they okay with
NETIF_F_FRAGLIST_GROalready ?Many of these devices are probably using NAT.
In my tests, nftables NAT works just fine, both with and without flowtable offloading. I didn't see anything in netfilter that would have a problem with this.
This is great !
Paolo Abeni
maintainerQuoted 9 lines · Felix Fietkau
Quoted 8 lines · Eric Dumazet
Quoted 6 lines · Felix Fietkau
In the world of consumer-grade WiFi devices, there are a lot of chipsets with limited or nonexistent SG support, and very limited checksum offload capabilities on Ethernet. The WiFi side of these devices is often even worse. I think fraglist GRO is a decent fallback for the inevitable corner cases.
Quoted 7 lines
Quoted 3 lines
What about netfilter and NAT ? Are they okay with
NETIF_F_FRAGLIST_GROalready ?Many of these devices are probably using NAT.
In my tests, nftables NAT works just fine, both with and without flowtable offloading. I didn't see anything in netfilter that would have a problem with this.
I see you handle explicitly NAT changes in __tcpv4_gso_segment_csum(), like the current UDP code.
The TCP header has many other fields that could be updated affecting the TCP csum.
Handling every possible mutation looks cumbersome and will likely reduce the performance benefits.
What is your plan WRT other TCP header fields update?
Strictly WRT the patch, I guess it deserves to be split in series, moving UDP helpers in common code and possibly factoring out more helpers with separate patches.
e.g. in __tcpv4_gso_segment_csum() is quite similar __udpv4_gso_segment_csum() - even too much, as the tcp csum should be always be updated when the ports or addresses change ;)
Cheers,
Paolo
Quoted 19 lines · Paolo Abeni
Quoted 9 lines · Felix Fietkau
Quoted 8 lines · Eric Dumazet
Quoted 6 lines · Felix Fietkau
In the world of consumer-grade WiFi devices, there are a lot of chipsets with limited or nonexistent SG support, and very limited checksum offload capabilities on Ethernet. The WiFi side of these devices is often even worse. I think fraglist GRO is a decent fallback for the inevitable corner cases.
Quoted 5 lines
Quoted 3 lines
What about netfilter and NAT ? Are they okay with
NETIF_F_FRAGLIST_GROalready ?Many of these devices are probably using NAT.
In my tests, nftables NAT works just fine, both with and without flowtable offloading. I didn't see anything in netfilter that would have a problem with this.
I see you handle explicitly NAT changes in
__tcpv4_gso_segment_csum(), like the current UDP code.
Quoted 6 lines
The TCP header has many other fields that could be updated affecting the TCP csum.
Handling every possible mutation looks cumbersome and will likely reduce the performance benefits.What is your plan WRT other TCP header fields update?
I think that should be easy enough to handle. My patch already only combines packets where tcp_flag_word(th) is identical. So when segmenting, I could handle all flags changes with a single inet_proto_csum_replace4 call.
Quoted 3 lines
Strictly WRT the patch, I guess it deserves to be split in series, moving UDP helpers in common code and possibly factoring out more helpers with separate patches.
Will do.
Quoted 3 lines
e.g. in
__tcpv4_gso_segment_csum()is quite similar__udpv4_gso_segment_csum()- even too much, as the tcp csum should be always be updated when the ports or addresses change ;)
Will fix that.
Thanks,
- Felix
Quoted 34 lines · Felix Fietkau
Quoted 21 lines · Paolo Abeni
Quoted 9 lines · Felix Fietkau
Quoted 8 lines · Eric Dumazet
Quoted 6 lines · Felix Fietkau
In the world of consumer-grade WiFi devices, there are a lot of chipsets with limited or nonexistent SG support, and very limited checksum offload capabilities on Ethernet. The WiFi side of these devices is often even worse. I think fraglist GRO is a decent fallback for the inevitable corner cases.
Quoted 7 lines
Quoted 3 lines
What about netfilter and NAT ? Are they okay with
NETIF_F_FRAGLIST_GROalready ?Many of these devices are probably using NAT.
In my tests, nftables NAT works just fine, both with and without flowtable offloading. I didn't see anything in netfilter that would have a problem with this.
I see you handle explicitly NAT changes in
__tcpv4_gso_segment_csum(), like the current UDP code.Quoted 6 lines
The TCP header has many other fields that could be updated affecting the TCP csum.
Handling every possible mutation looks cumbersome and will likely reduce the performance benefits.What is your plan WRT other TCP header fields update?
I think that should be easy enough to handle. My patch already only combines packets where
tcp_flag_word(th)is identical. So when segmenting, I could handle all flags changes with a singleinet_proto_csum_replace4call.
Quoted 4 lines
Quoted 3 lines
Strictly WRT the patch, I guess it deserves to be split in series, moving UDP helpers in common code and possibly factoring out more helpers with separate patches.
Will do.
A significant chunk of the complexity is in the tcp[46]_check_fraglist_gro sk match. Is this heuristic worth the complexity?
It seems that the platforms that will enable NETIF_F_FRAGLIST will be mainly forwarding planes.
If keeping, this refinement can probably a separate follow-on patch in the series too:
- refactor existing udp code
- add segmentation support to handle such packets on tx
- add coalescing support that starts building such packets on rx
- refine coalescing choice
Quoted 9 lines
Quoted 3 lines
e.g. in
__tcpv4_gso_segment_csum()is quite similar__udpv4_gso_segment_csum()- even too much, as the tcp csum should be always be updated when the ports or addresses change ;)Will fix that.
Thanks,
- Felix
Quoted 33 lines · Willem de Bruijn
Quoted 32 lines · Felix Fietkau
Quoted 19 lines · Paolo Abeni
Quoted 9 lines · Felix Fietkau
Quoted 8 lines · Eric Dumazet
Quoted 6 lines · Felix Fietkau
In the world of consumer-grade WiFi devices, there are a lot of chipsets with limited or nonexistent SG support, and very limited checksum offload capabilities on Ethernet. The WiFi side of these devices is often even worse. I think fraglist GRO is a decent fallback for the inevitable corner cases.
Quoted 5 lines
Quoted 3 lines
What about netfilter and NAT ? Are they okay with
NETIF_F_FRAGLIST_GROalready ?Many of these devices are probably using NAT.
In my tests, nftables NAT works just fine, both with and without flowtable offloading. I didn't see anything in netfilter that would have a problem with this.
I see you handle explicitly NAT changes in
__tcpv4_gso_segment_csum(), like the current UDP code.Quoted 6 lines
The TCP header has many other fields that could be updated affecting the TCP csum.
Handling every possible mutation looks cumbersome and will likely reduce the performance benefits.What is your plan WRT other TCP header fields update?
I think that should be easy enough to handle. My patch already only combines packets where
tcp_flag_word(th)is identical. So when segmenting, I could handle all flags changes with a singleinet_proto_csum_replace4call.Quoted 3 lines
Strictly WRT the patch, I guess it deserves to be split in series, moving UDP helpers in common code and possibly factoring out more helpers with separate patches.
Quoted 8 lines
Quoted 1 line
Will do.
A significant chunk of the complexity is in the tcp[46]_check_fraglist_gro sk match. Is this heuristic worth the complexity?
It seems that the platforms that will enable
NETIF_F_FRAGLISTwill be mainly forwarding planes.
There are people using their devices as file servers and routers at the same time. The heuristic helps for those cases.
Quoted 7 lines
If keeping, this refinement can probably a separate follow-on patch in the series too:
- refactor existing udp code
- add segmentation support to handle such packets on tx
- add coalescing support that starts building such packets on rx
- refine coalescing choice
I don't really understand what you're suggesting. With my patch, the GRO code handles coalescing of packets. Segmentation on output is also supported. The next version of my patch will fix the cases that were too similar to the UDP code, so I guess refactoring to share code doesn't really make sense there. Am I missing something?
Thanks,
- Felix
Quoted 45 lines · Felix Fietkau
Quoted 44 lines · Willem de Bruijn
Quoted 34 lines · Felix Fietkau
Quoted 21 lines · Paolo Abeni
Quoted 9 lines · Felix Fietkau
Quoted 8 lines · Eric Dumazet
Quoted 6 lines · Felix Fietkau
In the world of consumer-grade WiFi devices, there are a lot of chipsets with limited or nonexistent SG support, and very limited checksum offload capabilities on Ethernet. The WiFi side of these devices is often even worse. I think fraglist GRO is a decent fallback for the inevitable corner cases.
Quoted 7 lines
Quoted 3 lines
What about netfilter and NAT ? Are they okay with
NETIF_F_FRAGLIST_GROalready ?Many of these devices are probably using NAT.
In my tests, nftables NAT works just fine, both with and without flowtable offloading. I didn't see anything in netfilter that would have a problem with this.
I see you handle explicitly NAT changes in
__tcpv4_gso_segment_csum(), like the current UDP code.Quoted 6 lines
The TCP header has many other fields that could be updated affecting the TCP csum.
Handling every possible mutation looks cumbersome and will likely reduce the performance benefits.What is your plan WRT other TCP header fields update?
I think that should be easy enough to handle. My patch already only combines packets where
tcp_flag_word(th)is identical. So when segmenting, I could handle all flags changes with a singleinet_proto_csum_replace4call.Quoted 4 lines
Quoted 3 lines
Strictly WRT the patch, I guess it deserves to be split in series, moving UDP helpers in common code and possibly factoring out more helpers with separate patches.
Will do.
A significant chunk of the complexity is in the tcp[46]_check_fraglist_gro sk match. Is this heuristic worth the complexity?
Quoted 5 lines
Quoted 2 lines
It seems that the platforms that will enable
NETIF_F_FRAGLISTwill be mainly forwarding planes.There are people using their devices as file servers and routers at the same time. The heuristic helps for those cases.
Ok.
Quoted 7 lines
Quoted 7 lines
If keeping, this refinement can probably a separate follow-on patch in the series too:
- refactor existing udp code
- add segmentation support to handle such packets on tx
- add coalescing support that starts building such packets on rx
- refine coalescing choice
Quoted 6 lines
I don't really understand what you're suggesting. With my patch, the GRO code handles coalescing of packets. Segmentation on output is also supported. The next version of my patch will fix the cases that were too similar to the UDP code, so I guess refactoring to share code doesn't really make sense there.
Am I missing something?
I mean if breaking up into a series. First have the refactoring patch which should be easy to review to be a noop. Then add the segmentation code, which needs to exist before packets may arrive that depend on it. Then add the code that produces such packets. To break up into manageable chunks.
Quoted 7 lines · Willem de Bruijn
Quoted 7 lines
Quoted 7 lines
If keeping, this refinement can probably a separate follow-on patch in the series too:
- refactor existing udp code
- add segmentation support to handle such packets on tx
- add coalescing support that starts building such packets on rx
- refine coalescing choice
Quoted 8 lines
Quoted 2 lines
I don't really understand what you're suggesting. With my patch, the GRO code handles coalescing of packets. Segmentation on output is also supported. The next version of my patch will fix the cases that were too similar to the UDP code, so I guess refactoring to share code doesn't really make sense there. Am I missing something?
I mean if breaking up into a series. First have the refactoring patch which should be easy to review to be a noop. Then add the segmentation code, which needs to exist before packets may arrive that depend on it. Then add the code that produces such packets. To break up into manageable chunks.
Right, that makes sense.
Thanks,
- Felix
Quoted 1 line · Eric Dumazet
I think we should push hard to not use
frag_listin drivers :/
why is that? I noticed significant gains for local delivery after adding frag_list support for H/W GRO. Fewer skbs going up the stack is essential for high throughput and reducing CPU load.
Quoted 3 lines
And GRO itself could avoid building
frag_listskbs in hosts where forwarding is enabled.
But if the egress device supports SG and the driver understands frag_list, walking the frag_list should be cheaper than multiple skbs traversing the forwarding path.
Quoted 2 lines
(Note that we also can increase
MAX_SKB_FRAGSto 45 these days)
Using 45 frags has other side effects and not something that can be done universally (hence why it is a config option).
45 frags is for Big TCP at 4kB and that is ~ 3 skbs at the default setting of 17 which means an skb chain 2 deep. 1 skb going up the stack vs 3 skbs - that is a big difference.
Was there a conference talk or a discussion around tests performed comparing use of frag_list with MAX_SKB_FRAGS at 17 vs expanding MAX_SKB_FRAGS to 45?
Quoted 7 lines · David Ahern
Quoted 1 line · Eric Dumazet
I think we should push hard to not use
frag_listin drivers :/why is that? I noticed significant gains for local delivery after adding
frag_listsupport for H/W GRO. Fewer skbs going up the stack is essential for high throughput and reducing CPU load.
Felix case is about forwarding, not local delivery (which is fine)
Quoted 8 lines
Quoted 4 lines
And GRO itself could avoid building
frag_listskbs in hosts where forwarding is enabled.But if the egress device supports SG and the driver understands
frag_list, walking thefrag_listshould be cheaper than multiple skbs traversing the forwarding path.
I do not count any relevant (modern) driver supporting NETIF_F_FRAGLIST
Quoted 10 lines
Quoted 3 lines
(Note that we also can increase
MAX_SKB_FRAGSto 45 these days)Using 45 frags has other side effects and not something that can be done universally (hence why it is a config option).
45 frags is for Big TCP at 4kB and that is ~ 3 skbs at the default setting of 17 which means an skb chain 2 deep. 1 skb going up the stack vs 3 skbs - that is a big difference.
45 frags can also be for non BIG TCP, allowing ~64KB GRO packets without frag_list.
45*1448 = 65160
Max number of frags per skb is orthogonal to (BIG) TCP.