I try to compute checksum for IP and TCP via DPDK checksum offload. The code does the following:
ipv4_hdr->hdr_checksum = 0;
mb->l2_len = eth_hdr_len;
mb->l3_len = ipv4_hdr_len;
mb->ol_flags = PKT_TX_IPV4 | PKT_TX_IP_CKSUM | PKT_TX_TCP_CKSUM;
tcp_hdr->cksum = rte_ipv4_phdr_cksum(ipv4_hdr, mb->ol_flags);
rte_eth_conf has been set:
port_conf.txmode.offloads = DEV_TX_OFFLOAD_IPV4_CKSUM | DEV_TX_OFFLOAD_TCP_CKSUM;
the IP checksum is right, TCP checksum has fixed offset from the correct checksum (under my environment, it is 4)
Any ideas?