From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0055.outbound.protection.outlook.com [104.47.38.55]) by dpdk.org (Postfix) with ESMTP id 583901B573 for ; Tue, 9 Oct 2018 16:18:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UPF/p2HvDR9N0ry0zLaRdTKyHDlVt4qK5zXS7nr6RYk=; b=YIjDku/g31uq5UMhxlLcZG+pzrE+1r+cTsnD09Da5ygwKD45Cg1PCpHLcRsem9KhfNtjyw0DvRqfyknyrnecbTEBjdYMSFwexsaFPp0CJ3F0R92HMU+eJMPdcoS/EFuLjv0IPAktpN2Wxd+XHwtOBuZXVINkCnj77AwlQ8p1J0I= Received: from BYAPR07MB4997.namprd07.prod.outlook.com (52.135.238.214) by BYAPR07MB5607.namprd07.prod.outlook.com (20.177.231.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.27; Tue, 9 Oct 2018 14:18:10 +0000 Received: from BYAPR07MB4997.namprd07.prod.outlook.com ([fe80::c5c:4d86:b353:175a]) by BYAPR07MB4997.namprd07.prod.outlook.com ([fe80::c5c:4d86:b353:175a%4]) with mapi id 15.20.1207.024; Tue, 9 Oct 2018 14:18:10 +0000 From: Jerin Jacob To: Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Olivier Matz CC: "dev@dpdk.org" , "Jacob, Jerin" Thread-Topic: [dpdk-dev] [PATCH v5 2/4] ethdev: add Tx offload outer UDP checksum definition Thread-Index: AQHUX9rnXSGUg7y+4UGlS8fadNEeqA== Date: Tue, 9 Oct 2018 14:18:09 +0000 Message-ID: <20181009141741.5162-2-jerin.jacob@caviumnetworks.com> References: <20181008160953.32510-1-jerin.jacob@caviumnetworks.com> <20181009141741.5162-1-jerin.jacob@caviumnetworks.com> In-Reply-To: <20181009141741.5162-1-jerin.jacob@caviumnetworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [111.93.218.67] x-clientproxiedby: DM5PR21CA0032.namprd21.prod.outlook.com (2603:10b6:3:ed::18) To BYAPR07MB4997.namprd07.prod.outlook.com (2603:10b6:a03:5b::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BYAPR07MB5607; 6:O+U80fFfa62A367EPeW1nv8R3sS2t9xT41xYTsgQB5Ib9YgGjQ6MsNLELbZjwlfDXyxixxVZztG+MboS50sktiNAlf5rywmZ8BToDpPQFQcQK+Pb5ES0nhOx76IxDggrkdkMEt6e8mmR7aAV/063y4cgR8q6AyEomQ0cXA7J2goVujuIkShNAqbeQvF7cY1EVaimhIUuqn4fVDuWPsglVXZj0qsrqQ7lhYZl+rOqgoSYz8MSQ7R1vid90Ma2amA7iXOCLh+F2FQ81zGYLwGCNMC6DsFl0MywiwE8+IVrptGqH5u5JVUkfR0bU+2sU2Yi70IDC3ZzoFsJ5/EXXvy8ANT6zqeHLmngwZChfjzWy/b6eLjABL6fwBU2NMJXit3x4rSSb3Y6KKw9Gd3BOSR30DkvztSWkclI1GAK+qstd1LE7J7XpZceJo51ZCrp5JPyqIhT3bVpMNoQaapFe3WnlA==; 5:eHA684jb3+nmJnCafnI/T3nOZ2BppZL3WD0MCtNi/b8Cedi/LhF68OuLAZETK3idJItxOw3jR2FD8V3NC0QTncRSvTagBypJWuk+nenLSkMtxogfuVwuas7NiSpCyALBvCQIyI55fSX99uduPqbPfwCiJapOHk5iX82PQrJu2BY=; 7:sfFejhuhT5BKFbR7Zj7V8QR8itZIQiHi7ZuzMWK6tn/Aom7MUH9Rd8n45yPb3RZ+FvHmr9wcm2qFp/4CtKwP3vFNLvcwF6vy//5pwC6rP79pP2Hcd4x6zv1+iCSfM6pXjqINpfTcwRLNib+u9DszbqxlDXFhfhl/W8kMBUC95cRNLWryyrAux5CYe7YbXUjx4pZipIjl256FY9WmO2yWUucOHpli1asCKh1PTJ3+qMUHOlXAnuFOIjQQZiRpiK9F x-ms-office365-filtering-correlation-id: 62bcfadd-35a8-401f-ace6-08d62df209ef x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB5607; x-ms-traffictypediagnostic: BYAPR07MB5607: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231355)(944501410)(4982022)(52105095)(3002001)(10201501046)(93006095)(149066)(150057)(6041310)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(201708071742011)(7699051); SRVR:BYAPR07MB5607; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB5607; x-forefront-prvs: 08200063E9 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(346002)(136003)(366004)(396003)(39850400004)(189003)(199004)(4326008)(26005)(1076002)(66066001)(966005)(186003)(14454004)(2906002)(575784001)(316002)(478600001)(102836004)(25786009)(105586002)(6116002)(3846002)(68736007)(107886003)(1857600001)(106356001)(6512007)(81156014)(81166006)(76176011)(11346002)(71200400001)(71190400001)(99286004)(6486002)(7416002)(110136005)(5660300001)(54906003)(42882007)(6306002)(476003)(97736004)(5250100002)(53936002)(8676002)(36756003)(6436002)(14444005)(5024004)(305945005)(486006)(52116002)(256004)(72206003)(446003)(7736002)(2616005)(2900100001)(6506007)(386003)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB5607; H:BYAPR07MB4997.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: NpU7VFsJZ0Vxe+VbNFo9MtXxUfdrAAK4/Pmo7ukcOsgI3S6sxCLxucPVImIljFKOzEgbsbCw8O44uOodtT551XMJIk9nFxmFcrawQbbXP+zzyuvZx1QlSesBNZ0sO1B3f0Btw6tp7RH2gNjP0i80VXyHtT9/xUH5S1Ms374ijNM26eMu5vyM3oIna2mhGxkWuoyHhIyJwNlqXo8WFm9+U02CaNCdG2jganitmwc8jwqOs2JaszOZFhB1O40hEWSGTJDNBcHlx3dOPVYn2h8kNDVQ/29WzEd8IqGewB6IEKPXSdIoVisgiscnpVjVlPgjthify3HNveIzVaCwGQx6eQJU5eDpdARSsge0QTTcFkU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-Network-Message-Id: 62bcfadd-35a8-401f-ace6-08d62df209ef X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Oct 2018 14:18:09.8573 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB5607 Subject: [dpdk-dev] [PATCH v5 2/4] ethdev: add Tx offload outer UDP checksum definition 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: , X-List-Received-Date: Tue, 09 Oct 2018 14:18:12 -0000 Introduced DEV_TX_OFFLOAD_OUTER_UDP_CKSUM offload flags and PKT_TX_OUTER_UDP_CKSUM mbuf ol_flags to enable Tx outer UDP checksum offload. To use hardware Tx outer UDP checksum offload, the user needs to, - enable following in mbuf: a) fill outer_l2_len and outer_l3_len in mbuf b) set the PKT_TX_OUTER_UDP_CKSUM flag c) set the flag PKT_TX_OUTER_IPV4 or PKT_TX_OUTER_IPV6 - configure DEV_TX_OFFLOAD_OUTER_UDP_CKSUM offload flags in slow path Signed-off-by: Jerin Jacob Reviewed-by: Andrew Rybchenko --- v4: - Added Reviewed-by: Andrew Rybchenko - Added more description for PKT_TX_OUTER_UDP_CKSUM flag(Andrew Rybchenko) v3: - Git comment corrections (Andrew Rybchenko) s/PKT_TX_OUTER_TCP_CKSUM/PKT_TX_OUTER_UDP_CKSUM/g s/mbuff/mbuf/g v2: - Removed DEV_TX_OFFLOAD_OUTER_TCP_CKSUM and DEV_TX_OFFLOAD_OUTER_SCTP_CKSU= M as there is no realworld use case for it. See: http://patches.dpdk.org/patch/44692/ This patch series is depended on http://patches.dpdk.org/patch/45840/ --- app/test-pmd/config.c | 10 ++++++++++ doc/guides/nics/features.rst | 5 +++++ lib/librte_ethdev/rte_ethdev.c | 1 + lib/librte_ethdev/rte_ethdev.h | 2 ++ lib/librte_mbuf/rte_mbuf.c | 1 + lib/librte_mbuf/rte_mbuf.h | 14 +++++++++++++- 6 files changed, 32 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index d53c527e5..5d9745ae5 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -773,6 +773,16 @@ port_offload_cap_display(portid_t port_id) else printf("off\n"); } + + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM) { + printf("TX Outer UDP checksum: "); + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_OUTER_UDP_CKSUM) + printf("on\n"); + else + printf("off\n"); + } + } =20 int diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst index 998f67c8e..bc5fff2c1 100644 --- a/doc/guides/nics/features.rst +++ b/doc/guides/nics/features.rst @@ -642,7 +642,12 @@ Supports inner packet L4 checksum. * **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:DEV_RX_OFFLOAD_= OUTER_UDP_CKSUM``. * **[provides] mbuf**: ``mbuf.ol_flags:PKT_RX_OUTER_L4_CKSUM_UNKNOWN`` | ``PKT_RX_OUTER_L4_CKSUM_BAD`` | ``PKT_RX_OUTER_L4_CKSUM_GOOD`` | ``PKT_R= X_OUTER_L4_CKSUM_INVALID``. +* **[uses] rte_eth_txconf,rte_eth_txmode**: ``offloads:DEV_TX_OFFLOAD_= OUTER_UDP_CKSUM``. +* **[uses] mbuf**: ``mbuf.ol_flags:PKT_TX_OUTER_IPV4`` | ``PKT_TX_OUTE= R_IPV6``. + ``mbuf.ol_flags:PKT_TX_OUTER_UDP_CKSUM``. +* **[uses] mbuf**: ``mbuf.outer_l2_len``, ``mbuf.outer_l3_len``. * **[provides] rte_eth_dev_info**: ``rx_offload_capa,rx_queue_offload_capa= :DEV_RX_OFFLOAD_OUTER_UDP_CKSUM``, + ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_OUTER_UDP_CKSUM``= . =20 =20 .. _nic_features_packet_type_parsing: diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.= c index a630c4fda..bb48b5a0f 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -159,6 +159,7 @@ static const struct { RTE_TX_OFFLOAD_BIT2STR(SECURITY), RTE_TX_OFFLOAD_BIT2STR(UDP_TNL_TSO), RTE_TX_OFFLOAD_BIT2STR(IP_TNL_TSO), + RTE_TX_OFFLOAD_BIT2STR(OUTER_UDP_CKSUM), }; =20 #undef RTE_TX_OFFLOAD_BIT2STR diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.= h index 821d371c3..79d0bb1ed 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -944,6 +944,8 @@ struct rte_eth_conf { * for tunnel TSO. */ #define DEV_TX_OFFLOAD_IP_TNL_TSO 0x00080000 +/** Device supports outer UDP checksum */ +#define DEV_TX_OFFLOAD_OUTER_UDP_CKSUM 0x00100000 =20 #define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP 0x00000001 /**< Device supports Rx queue setup after device started*/ diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index c1740ce0c..c59c5bb0d 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -447,6 +447,7 @@ rte_get_tx_ol_flag_list(uint64_t mask, char *buf, size_= t buflen) "PKT_TX_TUNNEL_NONE" }, { PKT_TX_MACSEC, PKT_TX_MACSEC, NULL }, { PKT_TX_SEC_OFFLOAD, PKT_TX_SEC_OFFLOAD, NULL }, + { PKT_TX_OUTER_UDP_CKSUM, PKT_TX_OUTER_UDP_CKSUM, NULL }, }; const char *name; unsigned int i; diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index a453ec008..ba5d02f3e 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -200,6 +200,17 @@ extern "C" { =20 /* add new TX flags here */ =20 +/** + * Outer UDP checksum offload flag. This flag is used for enabling + * outer UDP checksum in PMD. To use outer UDP checksum, the user needs to + * 1) Enable the following in mbuff, + * a) Fill outer_l2_len and outer_l3_len in mbuf. + * b) Set the PKT_TX_OUTER_UDP_CKSUM flag. + * c) Set the PKT_TX_OUTER_IPV4 or PKT_TX_OUTER_IPV6 flag. + * 2) Configure DEV_TX_OFFLOAD_OUTER_UDP_CKSUM offload flag. + */ +#define PKT_TX_OUTER_UDP_CKSUM (1ULL << 41) + /** * UDP Fragmentation Offload flag. This flag is used for enabling UDP * fragmentation in SW or in HW. When use UFO, mbuf->tso_segsz is used @@ -367,7 +378,8 @@ extern "C" { PKT_TX_TUNNEL_MASK | \ PKT_TX_MACSEC | \ PKT_TX_SEC_OFFLOAD | \ - PKT_TX_UDP_SEG) + PKT_TX_UDP_SEG | \ + PKT_TX_OUTER_UDP_CKSUM) =20 /** * Mbuf having an external buffer attached. shinfo in mbuf must be filled. --=20 2.19.1