DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] testpmd: fix tso with csum engine
@ 2016-10-13 13:40 Olivier Matz
  2016-10-13 14:01 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Olivier Matz @ 2016-10-13 13:40 UTC (permalink / raw)
  To: dev, pablo.de.lara.guarch; +Cc: thomas.monjalon

The commit that disabled tso for small packets was broken during the
rebase. The problem is the IP checksum is not calculated in software if:
- TX IP checksum is disabled
- TSO is enabled
- the current packet is smaller than tso segment size

When checking if the PKT_TX_IP_CKSUM flag should be set (in case
of tso), use the local tso_segsz variable, which is set to 0 when the
packet is too small to require tso. Therefore the IP checksum will be
correctly calculated in software.

Moreover, we should not use tunnel segment size for non-tunnel tso, else
TSO will stay disabled for all packets.

Fixes: 97c21329d42b ("app/testpmd: do not use TSO for small packets")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 app/test-pmd/csumonly.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index f9e65b6..27d0f08 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -336,7 +336,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
 	if (!info->is_tunnel) {
 		max_pkt_len = info->l2_len + info->l3_len + info->l4_len +
 			info->tso_segsz;
-		if (info->tunnel_tso_segsz != 0 && info->pkt_len > max_pkt_len)
+		if (info->tso_segsz != 0 && info->pkt_len > max_pkt_len)
 			tso_segsz = info->tso_segsz;
 	} else {
 		max_pkt_len = info->outer_l2_len + info->outer_l3_len +
@@ -351,9 +351,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
 		ipv4_hdr->hdr_checksum = 0;
 
 		ol_flags |= PKT_TX_IPV4;
-		if (info->l4_proto == IPPROTO_TCP &&
-		    ((info->is_tunnel && info->tunnel_tso_segsz != 0) ||
-		     (!info->is_tunnel && info->tso_segsz != 0))) {
+		if (info->l4_proto == IPPROTO_TCP && tso_segsz) {
 			ol_flags |= PKT_TX_IP_CKSUM;
 		} else {
 			if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM)
-- 
2.8.1

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

* Re: [dpdk-dev] [PATCH] testpmd: fix tso with csum engine
  2016-10-13 13:40 [dpdk-dev] [PATCH] testpmd: fix tso with csum engine Olivier Matz
@ 2016-10-13 14:01 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2016-10-13 14:01 UTC (permalink / raw)
  To: Olivier Matz; +Cc: dev, pablo.de.lara.guarch

2016-10-13 15:40, Olivier Matz:
> The commit that disabled tso for small packets was broken during the
> rebase. The problem is the IP checksum is not calculated in software if:
> - TX IP checksum is disabled
> - TSO is enabled
> - the current packet is smaller than tso segment size
> 
> When checking if the PKT_TX_IP_CKSUM flag should be set (in case
> of tso), use the local tso_segsz variable, which is set to 0 when the
> packet is too small to require tso. Therefore the IP checksum will be
> correctly calculated in software.
> 
> Moreover, we should not use tunnel segment size for non-tunnel tso, else
> TSO will stay disabled for all packets.
> 
> Fixes: 97c21329d42b ("app/testpmd: do not use TSO for small packets")
> 
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>

Applied, thanks

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

end of thread, other threads:[~2016-10-13 14:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-13 13:40 [dpdk-dev] [PATCH] testpmd: fix tso with csum engine Olivier Matz
2016-10-13 14:01 ` Thomas Monjalon

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).