diff mbox series

app/testpmd: fix set L4 len for UDP packets

Message ID 1541950288-10800-1-git-send-email-rasland@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show
Series app/testpmd: fix set L4 len for UDP packets | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS

Commit Message

Raslan Darawsheh Nov. 11, 2018, 3:31 p.m. UTC
testpmd only sets the L4 len in case of TCP packets.
some PMD's like tap rely on mbuf meta data to calculate csum

this will set the L4 len for UDP packets same as TCP

Fixes: 160c3dc9 ("app/testpmd: introduce IP parsing functions in csum fwd engine")
Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
CC: stable@dpdk.org
---
 app/test-pmd/csumonly.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Ferruh Yigit Nov. 12, 2018, 2:31 p.m. UTC | #1
On 11/11/2018 3:31 PM, Raslan Darawsheh wrote:
> testpmd only sets the L4 len in case of TCP packets.
> some PMD's like tap rely on mbuf meta data to calculate csum
> 
> this will set the L4 len for UDP packets same as TCP
> 
> Fixes: 160c3dc9 ("app/testpmd: introduce IP parsing functions in csum fwd engine")
> CC: stable@dpdk.org
>
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> Signed-off-by: Ophir Munk <ophirmu@mellanox.com>


Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/master, thanks.
diff mbox series

Patch

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index dce4b9b..ffeee20 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -111,7 +111,9 @@  parse_ipv4(struct ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info)
 	if (info->l4_proto == IPPROTO_TCP) {
 		tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + info->l3_len);
 		info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2;
-	} else
+	} else if (info->l4_proto == IPPROTO_UDP)
+		info->l4_len = sizeof(struct udp_hdr);
+	else
 		info->l4_len = 0;
 }
 
@@ -128,7 +130,9 @@  parse_ipv6(struct ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info)
 	if (info->l4_proto == IPPROTO_TCP) {
 		tcp_hdr = (struct tcp_hdr *)((char *)ipv6_hdr + info->l3_len);
 		info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2;
-	} else
+	} else if (info->l4_proto == IPPROTO_UDP)
+		info->l4_len = sizeof(struct udp_hdr);
+	else
 		info->l4_len = 0;
 }