Skip to contentSkip to conversation

app/test: fix IPv6 header initialization

PATCH Applied Lance Richardson 2 participants 6 messages Mar 26, 2021 – Jul 5, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/test: fix IPv6 header initialization

Fix two issues found when writing PMD unit tests for HW ptype and L4 checksum offload:

- The version field in the IPv6 header was being set to zero, which prevented hardware from recognizing it as IPv6. The IP version field is now set to six.
- The payload_len field was being initialized using host byte order, which (among other things) resulted in incorrect L4 checksum computation. The payload_len field is now set using network (big-endian) byte order.

Fixes 92073ef961ee ("bond: unit tests")
---
 app/test/packet_burst_generator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test/packet_burst_generator.c +2 -2
index f203f9d09e..8b390853a2 100644
@@ -141,8 +141,8 @@ uint16_t
 initialize_ipv6_header(struct rte_ipv6_hdr *ip_hdr, uint8_t *src_addr,
 		uint8_t *dst_addr, uint16_t pkt_data_len)
 {
-	ip_hdr->vtc_flow = 0;
-	ip_hdr->payload_len = pkt_data_len;
+	ip_hdr->vtc_flow = rte_cpu_to_be_32(0x60000000); /* Set version to 6. */
+	ip_hdr->payload_len = rte_cpu_to_be_16(pkt_data_len);
 	ip_hdr->proto = IPPROTO_UDP;
 	ip_hdr->hop_limits = IP_DEFTTL;
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Lance Richardson

Fix two issues found when writing PMD unit tests for HW ptype and L4 checksum offload:

Would those unit tests be interesting to other pmd driver writers?

Quoted 10 lines

- The version field in the IPv6 header was being set to zero, which prevented hardware from recognizing it as IPv6. The IP version field is now set to six.
- The payload_len field was being initialized using host byte order, which (among other things) resulted in incorrect L4 checksum computation. The payload_len field is now set using network (big-endian) byte order.

Fixes 92073ef961ee ("bond: unit tests")

Odd that this never got caught before, I guess nobody ran the bonding test with ipv6.

Adding new maintainers for the bonding code since this helper is only used in the bonding ut.
Should we take this in 21.05 or wait 21.08?

Quoted 3 lines
Signature · 1 line
David Marchand
#2 lore raw
Quoted 9 lines · David Marchand
Quoted 3 lines · Lance Richardson

Fix two issues found when writing PMD unit tests for HW ptype and L4 checksum offload:

Would those unit tests be interesting to other pmd driver writers?

I think so, although some adjustments would be needed to account for differences in hardware capabilities. The tests I've written so far are still very much a work in progress, but I hope to have something ready for RFC in the near future.

#3 lore raw
Quoted 10 lines · Lance Richardson
Quoted 7 lines · David Marchand
Quoted 3 lines · Lance Richardson

Fix two issues found when writing PMD unit tests for HW ptype and L4 checksum offload:

Quoted 6 lines
Quoted 2 lines

Would those unit tests be interesting to other pmd driver writers?

I think so, although some adjustments would be needed to account for differences in hardware capabilities. The tests I've written so far are still very much a work in progress, but I hope to have something ready for RFC in the near future.

What is the current status of this patch?

Thanks,
Lance

#4 lore raw
Quoted 13 lines · Lance Richardson
Quoted 10 lines · Lance Richardson
Quoted 7 lines · David Marchand
Quoted 3 lines · Lance Richardson

Fix two issues found when writing PMD unit tests for HW ptype and L4 checksum offload:

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Would those unit tests be interesting to other pmd driver writers?

I think so, although some adjustments would be needed to account for differences in hardware capabilities. The tests I've written so far are still very much a work in progress, but I hope to have something ready for RFC in the near future.

What is the current status of this patch?

I wanted feedback from bonding guys, but I'll get it in v21.08 now. Thanks for the heads up.

Signature · 1 line
David Marchand
Reviewed-by on v1 1/1 Applied
#5 lore raw
In reply to Lance Richardson
Quoted 12 lines · Lance Richardson

Fix two issues found when writing PMD unit tests for HW ptype and L4 checksum offload:

- The version field in the IPv6 header was being set to zero, which prevented hardware from recognizing it as IPv6. The IP version field is now set to six.
- The payload_len field was being initialized using host byte order, which (among other things) resulted in incorrect L4 checksum computation. The payload_len field is now set using network (big-endian) byte order.

Quoted 4 lines
Fixes 92073ef961ee ("bond: unit tests")

Applied, thanks.

Signature · 1 line
David Marchand