* Process the pseudo-header checksum of an IPv6 header. * * Depending on the ol_flags, the pseudo-header checksum expected by the * drivers is not the same. For instance, when TSO is enabled, the IPv6 * payload length must not be included in the packet. * * When ol_flags is 0, it computes the standard pseudo-header checksum. * * @param ipv6_hdr * The pointer to the contiguous IPv6 heade
| 583 | * The non-complemented checksum to set in the L4 header. |
| 584 | */ |
| 585 | static inline uint16_t |
| 586 | rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags) |
| 587 | { |
| 588 | uint32_t sum; |
| 589 | struct { |
| 590 | rte_be32_t len; /* L4 length. */ |
| 591 | rte_be32_t proto; /* L4 protocol - top 3 bytes must be zero */ |
| 592 | } psd_hdr; |
| 593 | |
| 594 | psd_hdr.proto = (uint32_t)(ipv6_hdr->proto << 24); |
| 595 | if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG)) { |
| 596 | psd_hdr.len = 0; |
| 597 | } else { |
| 598 | psd_hdr.len = ipv6_hdr->payload_len; |
| 599 | } |
| 600 | |
| 601 | sum = __rte_raw_cksum(ipv6_hdr->src_addr, |
| 602 | sizeof(ipv6_hdr->src_addr) + sizeof(ipv6_hdr->dst_addr), |
| 603 | 0); |
| 604 | sum = __rte_raw_cksum(&psd_hdr, sizeof(psd_hdr), sum); |
| 605 | return __rte_raw_cksum_reduce(sum); |
| 606 | } |
| 607 | |
| 608 | /** |
| 609 | * @internal Calculate the non-complemented IPv6 L4 checksum |
no test coverage detected