DPDK rte_mbuf enable NIC Offload Compute checksum configuration method
Compute IP Checksum
Mb->l2_len = Len (out_eth)
Mb->l3_len = Len (out_ip)
mb->ol_flags |= Pkt_tx_ipv4 | Pkt_tx_ip_csum
Note:
Out_ip.checksum = 0
The NIC supports dev_tx_offload_ipv4_cksum features. Compute IP & UDP checksum
Mb->l2_len = Len (out_eth)
Mb->l3_len = Len (out_ip)
mb->ol_flags |= Pkt_tx_ipv4 | Pkt_tx_ip_csum | Pkt_tx_udp_cksum
Note:
Out_ip.checksum = 0
Out_udp.checksum = Rte_ipv4_phdr_cksum ()
The NIC supports Dev_tx_offload_ipv4_cksum and dev_tx_offload_udp_cksum features. compute the inner layer package IP checksum.
Mb->l2_len = Len (out_eth + out_ip + out_udp + Vxlan + in_eth)
Mb->l3_len = Len (in_ip)
mb->ol_flags |= _tx_ipv4 | Pkt_tx_ip_csum
Note:
In_ip.checksum = 0
The NIC supports Dev_tx_offload_ipv4_cksum ' features.
Note, it can only work if outer L4 checksum is 0. compute the inner layer package IP & TCP Checksum
Mb->l2_len = Len (out_eth + out_ip + out_udp + Vxlan + in_eth)
Mb->l3_len = Len (in_ip)
mb->ol_flags |= _tx_ipv4 | Pkt_tx_ip_csum | Pkt_tx_tcp_cksum
Note:
In_ip.checksum = 0
In_tcp.checksum = Rte_ipv4_phdr_cksum ()
The NIC supports Dev_tx_offload_ipv4_cksum and dev_tx_offload_tcp_cksum features.
Note, it can only work if outer L4 checksum is 0. compute the inner-layer encapsulation IP checksum and enable TSO.
Mb->l2_len = Len (out_eth + out_ip + out_udp + Vxlan + in_eth)
Mb->l3_len = Len (in_ip)
Mb->l4_len = Len (in _tcp)
mb->ol_flags |= Pkt_tx_ipv4 | Pkt_tx_ip_cksum | Pkt_tx_tcp_cksum |
pkt_tx_tcp_seg;
Note:
In_ip.checksum = 0
In_tcp.checksum = Rte_ipv4_phdr_cksum ()
The NIC supports Dev_tx_offload_tcp_tso features.
Note, it can only work if outer L4 checksum is 0. compute the inner IP & memory encapsulated IP & TCP checksum.
Mb->outer_l2_len = Len (out_eth)
Mb->outer_l3_len = Len (out_ip)
Mb->l2_len = Len (out_udp + Vxlan + in_eth)
Mb->l3_len = Len (in_ip)
Mb->ol_flags |= Pkt_tx_outer_ipv4 | Pkt_tx_outer_ip_cksum | \
Pkt_tx_ip_cksum | Pkt_tx_tcp_cksum;
Note:
Out_ip.checksum = 0
In_ip.checksum = 0
In_tcp.checksum = Rte_ipv4_phdr_cksum ()
The NIC supports Dev_tx_offload_ipv4_cksum, Dev_tx_offload_udp_cksum and dev_tx_offload_outer_ipv4_cksum features. All the above parameters can be used for reference in TESTPMD csumonly.c.