From patchwork Sun Apr 8 12:32:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xueming Li X-Patchwork-Id: 37519 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CD6261B685; Sun, 8 Apr 2018 14:33:17 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id EF9681B67C for ; Sun, 8 Apr 2018 14:33:12 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from xuemingl@mellanox.com) with ESMTPS (AES256-SHA encrypted); 8 Apr 2018 15:34:15 +0300 Received: from dev-r630-06.mtbc.labs.mlnx (dev-r630-06.mtbc.labs.mlnx [10.12.205.180]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w38CX7lf024995; Sun, 8 Apr 2018 15:33:08 +0300 Received: from dev-r630-06.mtbc.labs.mlnx (localhost [127.0.0.1]) by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7) with ESMTP id w38CX74P110753; Sun, 8 Apr 2018 20:33:07 +0800 Received: (from xuemingl@localhost) by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7/Submit) id w38CX7K9110752; Sun, 8 Apr 2018 20:33:07 +0800 From: Xueming Li To: Wenzhuo Lu , Jingjing Wu , Thomas Monjalon , Yongseok Koh , Olivier MATZ , Shahaf Shuler Cc: Xueming Li , Ferruh Yigit , dev@dpdk.org Date: Sun, 8 Apr 2018 20:32:37 +0800 Message-Id: <20180408123240.110698-2-xuemingl@mellanox.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20180408123240.110698-1-xuemingl@mellanox.com> References: <20180408123240.110698-1-xuemingl@mellanox.com> In-Reply-To: <20180109141110.146250-2-xuemingl@mellanox.com> References: <20180109141110.146250-2-xuemingl@mellanox.com> Subject: [dpdk-dev] [PATCH v4 1/4] ethdev: introduce generic IP/UDP tunnel checksum and TSO X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch introduce new TX offload flags for device that supports IP or UDP tunneled packet L3/L4 checksum and TSO offload. The support from the device is for inner and outer checksums on IPV4/TCP/UDP and TSO for *any packet with the following format*: / [optional IPv4/IPv6] / [optional TCP/UDP] / / [optional inner IPv4/IPv6] / [optional TCP/UDP] For example the following packets can use this feature: 1. eth / ipv4 / udp / VXLAN / ip / tcp 2. eth / ipv4 / GRE / MPLS / ipv4 / udp Please note that tunnel headers that contain payload length, sequence id or checksum will not be updated. Signed-off-by: Xueming Li --- lib/librte_ether/rte_ethdev.h | 4 ++++ lib/librte_mbuf/rte_mbuf.c | 6 ++++++ lib/librte_mbuf/rte_mbuf.h | 2 ++ 3 files changed, 12 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 5c8af16f5..a3ae43cdc 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -980,6 +980,10 @@ struct rte_eth_conf { * the same mempool and has refcnt = 1. */ #define DEV_TX_OFFLOAD_SECURITY 0x00020000 +/**< Device supports UDP tunneled packet TSO */ +#define DEV_TX_OFFLOAD_UDP_TNL_TSO 0x00040000 +/**< Device supports IP based tunnel packet TSO */ +#define DEV_TX_OFFLOAD_IP_TNL_TSO 0x00080000 /* * If new Tx offload capabilities are defined, they also must be diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index 091d388d3..41e1bc953 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -405,6 +405,8 @@ const char *rte_get_tx_ol_flag_name(uint64_t mask) case PKT_TX_TUNNEL_IPIP: return "PKT_TX_TUNNEL_IPIP"; case PKT_TX_TUNNEL_GENEVE: return "PKT_TX_TUNNEL_GENEVE"; case PKT_TX_TUNNEL_MPLSINUDP: return "PKT_TX_TUNNEL_MPLSINUDP"; + case PKT_TX_TUNNEL_IP: return "PKT_TX_TUNNEL_IP"; + case PKT_TX_TUNNEL_UDP: return "PKT_TX_TUNNEL_UDP"; case PKT_TX_MACSEC: return "PKT_TX_MACSEC"; case PKT_TX_SEC_OFFLOAD: return "PKT_TX_SEC_OFFLOAD"; default: return NULL; @@ -439,6 +441,10 @@ rte_get_tx_ol_flag_list(uint64_t mask, char *buf, size_t buflen) "PKT_TX_TUNNEL_NONE" }, { PKT_TX_TUNNEL_MPLSINUDP, PKT_TX_TUNNEL_MASK, "PKT_TX_TUNNEL_NONE" }, + { PKT_TX_TUNNEL_IP, PKT_TX_TUNNEL_MASK, + "PKT_TX_TUNNEL_NONE" }, + { PKT_TX_TUNNEL_UDP, PKT_TX_TUNNEL_MASK, + "PKT_TX_TUNNEL_NONE" }, { PKT_TX_MACSEC, PKT_TX_MACSEC, NULL }, { PKT_TX_SEC_OFFLOAD, PKT_TX_SEC_OFFLOAD, NULL }, }; diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 62740254d..6a8031c7a 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -210,6 +210,8 @@ extern "C" { #define PKT_TX_TUNNEL_GENEVE (0x4ULL << 45) /**< TX packet with MPLS-in-UDP RFC 7510 header. */ #define PKT_TX_TUNNEL_MPLSINUDP (0x5ULL << 45) +#define PKT_TX_TUNNEL_IP (0xDULL << 45) /**< Tx IP tunneled packet. */ +#define PKT_TX_TUNNEL_UDP (0xEULL << 45) /**< Tx UDP tunneled packet. */ /* add new TX TUNNEL type here */ #define PKT_TX_TUNNEL_MASK (0xFULL << 45)