MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rte_ipv6_phdr_cksum

Function rte_ipv6_phdr_cksum

dpdk/lib/net/rte_ip.h:585–606  ·  view source on GitHub ↗

* 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

Source from the content-addressed store, hash-verified

583 * The non-complemented checksum to set in the L4 header.
584 */
585static inline uint16_t
586rte_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

Callers 6

__rte_ipv6_udptcp_cksumFunction · 0.85
mana_tx_burstFunction · 0.85
mlx5_lro_update_hdrFunction · 0.85
virtio_tx_offloadFunction · 0.85

Calls 2

__rte_raw_cksumFunction · 0.85
__rte_raw_cksum_reduceFunction · 0.85

Tested by

no test coverage detected