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 BFCDB7F58 for ; Mon, 10 Nov 2014 16:50:06 +0100 (CET) Received: by mail-wi0-f171.google.com with SMTP id r20so10933438wiv.10 for ; Mon, 10 Nov 2014 07:59:52 -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=qvIMZXojNxfkDsroejjkbaBHiMfR7gJn9nJd//Ty6wA=; b=JqKrNykfxa6OJ+zf1S2gZAGGwQCuwt1HwZw/IAcKvs/Rqr3k8g+mVCAJx+1n7rK7y9 P/oJianHbVJgLpOxbcWlScX9oXUQXiaFwm/dVPoYkJoXmKXyxbvIvLt9XW8/J7d6+VrQ Kwwg47GrvBY8nEIJjeIS6gvUsJiWsw1p8NlyWyP7Gb9vAj+szUTyDRl8UK+p78oKaAi/ nJmxkT0c9oXgPo6zKbFKKQOwPKEveZr0yRfvfIP+dT9ld/8RxeKZjokFqf3KkLvGbIFa IGvp2zxX9QgZxJMMFBC4Jnc1zHMDN45sCl/WcZ35JG6tQXqxtGQ1rKf5xByWdap8eZja 5z/w== X-Gm-Message-State: ALoCoQksasK20R3+KCsoAEgdTnZXR2AShhXxEgeY0McQvQAQflEuQauDtmlC0hJ2+kOHIWgUEXQy X-Received: by 10.195.12.136 with SMTP id eq8mr42606754wjd.77.1415635192609; Mon, 10 Nov 2014 07:59:52 -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 ll2sm10966561wjb.11.2014.11.10.07.59.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Nov 2014 07:59:52 -0800 (PST) From: Olivier Matz To: dev@dpdk.org Date: Mon, 10 Nov 2014 16:59:18 +0100 Message-Id: <1415635166-1364-5-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1415635166-1364-1-git-send-email-olivier.matz@6wind.com> References: <1415635166-1364-1-git-send-email-olivier.matz@6wind.com> Cc: jigsaw@gmail.com Subject: [dpdk-dev] [PATCH 04/12] 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: Mon, 10 Nov 2014 15:50:07 -0000 Describe how to use hardware checksum API. Signed-off-by: Olivier Matz --- lib/librte_mbuf/rte_mbuf.h | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index be15168..96e322b 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -95,19 +95,28 @@ extern "C" { #define PKT_RX_TUNNEL_IPV6_HDR (1ULL << 12) /**< RX tunnel packet with IPv6 header. */ #define PKT_TX_VLAN_PKT (1ULL << 55) /**< TX packet is a 802.1q VLAN packet. */ -#define PKT_TX_IP_CKSUM (1ULL << 54) /**< IP cksum of TX pkt. computed by NIC. */ + +/** + * Enable hardware computation of IP cksum. To use it: + * - fill l2_len and l3_len in mbuf + * - set the flags PKT_TX_IP_CKSUM + * - set the ip checksum to 0 in IP header + */ +#define PKT_TX_IP_CKSUM (1ULL << 54) #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 */ -/* - * 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 + * - 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. */ -- 2.1.0