From: Olivier Matz Date: Wed, 26 Nov 2014 15:04:46 +0000 (+0100) Subject: mbuf: add help about Tx checksum flags X-Git-Tag: spdx-start~10065 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b029fd236da36435af19e0ff09386ed89d10fdf7;p=dpdk.git mbuf: add help about Tx checksum flags Describe how to use hardware checksum API. Signed-off-by: Olivier Matz Acked-by: Bruce Richardson --- diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index faa992465d..1739e37e94 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -100,12 +100,16 @@ extern "C" { /* add new TX flags here */ #define PKT_TX_VXLAN_CKSUM (1ULL << 50) /**< TX checksum of VXLAN computed by NIC */ #define PKT_TX_IEEE1588_TMST (1ULL << 51) /**< TX IEEE1588 packet to timestamp. */ -/* - * Bits 52+53 used for L4 packet type with checksum enabled. - * 00: Reserved - * 01: TCP checksum - * 10: SCTP checksum - * 11: UDP checksum + +/** + * Bits 52+53 used for L4 packet type with checksum enabled: 00: Reserved, + * 01: TCP checksum, 10: SCTP checksum, 11: UDP checksum. To use hardware + * L4 checksum offload, the user needs to: + * - fill l2_len and l3_len in mbuf + * - set the flags PKT_TX_TCP_CKSUM, PKT_TX_SCTP_CKSUM or PKT_TX_UDP_CKSUM + * - set the flag PKT_TX_IPV4 or PKT_TX_IPV6 + * - calculate the pseudo header checksum and set it in the L4 header (only + * for TCP or UDP). For SCTP, set the crc field to 0. */ #define PKT_TX_L4_NO_CKSUM (0ULL << 52) /**< Disable L4 cksum of TX pkt. */ #define PKT_TX_TCP_CKSUM (1ULL << 52) /**< TCP cksum of TX pkt. computed by NIC. */ @@ -115,8 +119,12 @@ extern "C" { #define PKT_TX_IP_CKSUM (1ULL << 54) /**< IP cksum of TX pkt. computed by NIC. */ #define PKT_TX_IPV4_CSUM PKT_TX_IP_CKSUM /**< Alias of PKT_TX_IP_CKSUM. */ -#define PKT_TX_IPV4 PKT_RX_IPV4_HDR /**< IPv4 with no IP checksum offload. */ -#define PKT_TX_IPV6 PKT_RX_IPV6_HDR /**< IPv6 packet */ + +/** Tell the NIC it's an IPv4 packet. Required for L4 checksum offload. */ +#define PKT_TX_IPV4 PKT_RX_IPV4_HDR + +/** Tell the NIC it's an IPv6 packet. Required for L4 checksum offload. */ +#define PKT_TX_IPV6 PKT_RX_IPV6_HDR #define PKT_TX_VLAN_PKT (1ULL << 55) /**< TX packet is a 802.1q VLAN packet. */