From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) by dpdk.org (Postfix) with ESMTP id A2A36590F for ; Wed, 26 Nov 2014 15:54:18 +0100 (CET) Received: by mail-wi0-f171.google.com with SMTP id bs8so12780138wib.16 for ; Wed, 26 Nov 2014 07:05:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FLa1whSiT+CxFWS9y7aSRnmhsEI+FM5XZ3ppDKqS+Cs=; b=S3MISTBs16tOw1hgD4BD4Fxt6AGd1yEY7goVo6s/1jBOYGcbuH20GQ7ClLQgmV2Oa8 MWODJvcu3Cd/6+uIk0YDDcylk8PXk4Yc6r93D0Nmw+sVKxgwD/SQ7tej7mYxOmI/tUK9 s9OiFGaZnsTNxPHYxKnOfI12nbxNxvhcQQ91oFB5zYAY6bCOMISY3L8uZgZckRwXaHOc VSIDD19q503PdHx4kyjQ46CeLkzuYXDen4nGzzVcAsBvX0901YYlUy53L32p841wm7A1 malcDOPnvW98Y8GEmSa8Xcu0m93A998dAoGN0eHRiCcXchalW9SQovrLd4AVQ833hn9M 5gOg== X-Gm-Message-State: ALoCoQmsMwIiaLEOZtMVrM08Te/6RmEOkPzrwCjXUfZ3mEp7gI3SQDn4yjfhnXRCNuDwVAp9FOpQ X-Received: by 10.180.208.112 with SMTP id md16mr41262877wic.37.1417014315754; Wed, 26 Nov 2014 07:05:15 -0800 (PST) Received: from glumotte.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by mx.google.com with ESMTPSA id bm1sm6682819wjb.45.2014.11.26.07.05.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Nov 2014 07:05:15 -0800 (PST) From: Olivier Matz To: dev@dpdk.org Date: Wed, 26 Nov 2014 16:04:46 +0100 Message-Id: <1417014295-29064-5-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1417014295-29064-1-git-send-email-olivier.matz@6wind.com> References: <1416524335-22753-1-git-send-email-olivier.matz@6wind.com> <1417014295-29064-1-git-send-email-olivier.matz@6wind.com> Cc: jigsaw@gmail.com Subject: [dpdk-dev] [PATCH v4 04/13] mbuf: add help about TX checksum flags X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2014 14:54:18 -0000 Describe how to use hardware checksum API. Signed-off-by: Olivier Matz Acked-by: Bruce Richardson --- lib/librte_mbuf/rte_mbuf.h | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index faa9924..6d9ef21 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -100,23 +100,31 @@ 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_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. */ #define PKT_TX_SCTP_CKSUM (2ULL << 52) /**< SCTP cksum of TX pkt. computed by NIC. */ #define PKT_TX_UDP_CKSUM (3ULL << 52) /**< UDP cksum of TX pkt. computed by NIC. */ #define PKT_TX_L4_MASK (3ULL << 52) /**< Mask for L4 cksum offload request. */ -#define PKT_TX_IP_CKSUM (1ULL << 54) /**< IP cksum of TX pkt. computed by NIC. */ +#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. */ -- 2.1.0