Skip to content

Commit

Permalink
app/test: fix IPv6 header initialization
Browse files Browse the repository at this point in the history
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: 92073ef ("bond: unit tests")
Cc: stable@dpdk.org

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
  • Loading branch information
Lance Richardson authored and david-marchand committed Jul 5, 2021
1 parent fc5bffb commit a906371
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/test/packet_burst_generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,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;

Expand Down

0 comments on commit a906371

Please sign in to comment.