From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0048.outbound.protection.outlook.com [104.47.38.48]) by dpdk.org (Postfix) with ESMTP id 155A31B53C for ; Tue, 9 Oct 2018 16:18:07 +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=uA1AT4sPSCyiAHKjVHhpnvVoj0rBJnyhGQdsZLuS5AQ=; b=j6pLFrKpH01EHglMR20jAGx7EYuTmQEZpr8wLWoE+77MAqAm5BXrdEnJVn3FypD61f9NV2SJHMwk55l4OyJPzgxkSGOk5QZUk2s16vZKsCsgqI3BJFimpmIrHowjwjwqbGtJx/tY0YlxVvMaDk5RJYTsI+DWqrCMGuYSjnBsg1A= 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:05 +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:04 +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 1/4] ethdev: add Rx offload outer UDP checksum definition Thread-Index: AQHUX9rkUUtXrgvWGEGf1D4VlOsA8Q== Date: Tue, 9 Oct 2018 14:18:04 +0000 Message-ID: <20181009141741.5162-1-jerin.jacob@caviumnetworks.com> References: <20181008160953.32510-1-jerin.jacob@caviumnetworks.com> In-Reply-To: <20181008160953.32510-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:iGMudGWCJn5CS2W9sKf9lkS2l8JLVXD8LjUQGdWlQvB2jQOX4EjVJib4u7PG572tQM/xkU4PQYSDS86xpObbPuMf6VMRHYC6HH2gC0Em83Q2MhE0DTsK1dibH9gZyzFVWhxnWVCF52srlRD+U314KTfhlbKhVFqi8SJZD8bXBvIDXS/al85to3MYxn7okhE4yrS7dv8pt4Aq/jiX8QXnECgG5CzjYN3OkiUKoT3whiQsoENb973HyMIQgd7CdRhnXRgHx3A5mvyPGfrzABy7/J5M9D44Iy4tIQpoFV6uQt9m0f+SPOHsQAxChwzCyV31sO2tA+gSOim0FM2GduW2Qe/eLfaARtenTCwNagaYJZoJnHsKf0FxbbElr4aQ04kE/QRr/O3MARHsI1gxy7mV9h4SSP350XjF6lvTve8Xe9waUOnqX9LCdDbIWRjBoCv05OP3NYUaUI+g2Y63g206gQ==; 5:nMvjgsELjvI8amWDIWiRkPAJVdcDEAZBc+45FY+lIBgx6NT4rfU7kCjh+hol273LE91ote66bFBKcHX3ZE7GxNsWhdRZb9fC27kXv+iPhQhDv2iyGN2VABSyqUrT0IypKkEHkB9oiNGg5En2/wWBisneqBCMZXcQTCiLZn4s5ZM=; 7:tml0DCzEokhPfw55NLSTeCXbRyo5mVzCAALsh3fsH0fakzoJiQyg/F+X9mtpQr8HYfU7GBhwrPW9dMLcfPoS2xgHipc+pqtidlOq/OOlLGa4bxBhSdlFkU7XeiLjZyMPKBAqVX7ndXU8IegNGiYRM0dziquvCZdoZi6aKx26bc3LBVPZp3DN45CmKsYPDrI2oHwjZfkHTZPxibgwoy8v0dA/LDJNUDRXBi4y3SmI35zs6KLRbjEEGFu3PJvbsh6l x-ms-office365-filtering-correlation-id: 41e9c9be-63b2-4ac7-948d-08d62df206ce 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)(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: yvS/m/iavS/7oWbEvLIZsUZGdc3+jnue3X5QFvHA7wreG9d5FPXv1mXsqGDXj494bAb/+NZD6nwdBvfp5lSfumDUrgT9XmxVTDC6gaNrowUAh5R2CWrfnHcX30bsNsErQWRsAcchdUz1/v3NXfG2yxbq9KVMvVuGbxuQ5EK9eMjkeXgSKr7+P6U+0NjgbPszJw9arreMMN/bBjSsdgdfLUIYDgrwR54yndZFxvPa8x0bcDUU0kPqWYHmcDDZqYDNFw0g5WSvKhvRYZ/AhQSlVdjQd7ff8MvFh/ln4y1VaTg13NAN/T0rH8p5S75f9rfVQW55S93zxMrEdyMsY5MA6E5eJc85Z+P1OQgF8odOmws= 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: 41e9c9be-63b2-4ac7-948d-08d62df206ce X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Oct 2018 14:18:04.7947 (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 1/4] ethdev: add Rx 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:07 -0000 Introduced DEV_RX_OFFLOAD_OUTER_UDP_CKSUM Rx offload flag and PKT_RX_OUTER_L4_CKSUM_* mbuf ol_flags to detect outer UDP checksum status. - To use hardware Rx outer UDP checksum offload, the user needs to configure DEV_RX_OFFLOAD_OUTER_UDP_CKSUM offload flags in slowpath. - Driver updates checksum status in mbuf ol_flag as PKT_RX_OUTER_L4_CKSUM_* flags. Signed-off-by: Jerin Jacob Reviewed-by: Andrew Rybchenko --- This patch series is depended on http://patches.dpdk.org/patch/45840/ v5: - Added Reviewed-by: Andrew Rybchenko v4: - Replaced PKT_RX_EL4_CKSUM_BAD with PKT_RX_OUTER_L4_CKSUM_* flags v3: - Mention in git commit log that PKT_RX_EL4_CKSUM_BAD based one bit scheme selected based on exiting outer L3 PKT_RX_EIP_CKSUM_BAD one bit flag scheme= . - Removed extra empty line in features.rst (Andrew Rybchenko) v2: - Removed DEV_RX_OFFLOAD_OUTER_TCP_CKSUM and DEV_RX_OFFLOAD_OUTER_SCTP_CKSU= M as there is no realworld use case for it. See: http://patches.dpdk.org/patch/44692/ --- app/test-pmd/config.c | 9 +++++++++ doc/guides/nics/features.rst | 5 +++++ lib/librte_ethdev/rte_ethdev.c | 1 + lib/librte_ethdev/rte_ethdev.h | 1 + lib/librte_mbuf/rte_mbuf.c | 12 ++++++++++++ lib/librte_mbuf/rte_mbuf.h | 19 +++++++++++++++++++ 6 files changed, 47 insertions(+) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 1adc9b94b..d53c527e5 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -594,6 +594,15 @@ port_offload_cap_display(portid_t port_id) printf("off\n"); } =20 + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_UDP_CKSUM) { + printf("RX Outer UDP checksum: "); + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_OUTER_UDP_CKSUM) + printf("on\n"); + else + printf("off\n"); + } + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_LRO) { printf("Large receive offload: "); if (ports[port_id].dev_conf.rxmode.offloads & diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst index d42489b6d..998f67c8e 100644 --- a/doc/guides/nics/features.rst +++ b/doc/guides/nics/features.rst @@ -639,6 +639,11 @@ Inner L4 checksum =20 Supports inner packet L4 checksum. =20 +* **[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``. +* **[provides] rte_eth_dev_info**: ``rx_offload_capa,rx_queue_offload_capa= :DEV_RX_OFFLOAD_OUTER_UDP_CKSUM``, + =20 .. _nic_features_packet_type_parsing: =20 diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.= c index e9a82fe7f..a630c4fda 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -127,6 +127,7 @@ static const struct { RTE_RX_OFFLOAD_BIT2STR(SECURITY), RTE_RX_OFFLOAD_BIT2STR(KEEP_CRC), RTE_RX_OFFLOAD_BIT2STR(SCTP_CKSUM), + RTE_RX_OFFLOAD_BIT2STR(OUTER_UDP_CKSUM), }; =20 #undef RTE_RX_OFFLOAD_BIT2STR diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.= h index d02db14ad..821d371c3 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -889,6 +889,7 @@ struct rte_eth_conf { #define DEV_RX_OFFLOAD_SECURITY 0x00008000 #define DEV_RX_OFFLOAD_KEEP_CRC 0x00010000 #define DEV_RX_OFFLOAD_SCTP_CKSUM 0x00020000 +#define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM 0x00040000 =20 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \ DEV_RX_OFFLOAD_UDP_CKSUM | \ diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index e714c5a59..c1740ce0c 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -301,6 +301,11 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask) case PKT_RX_TIMESTAMP: return "PKT_RX_TIMESTAMP"; case PKT_RX_SEC_OFFLOAD: return "PKT_RX_SEC_OFFLOAD"; case PKT_RX_SEC_OFFLOAD_FAILED: return "PKT_RX_SEC_OFFLOAD_FAILED"; + case PKT_RX_OUTER_L4_CKSUM_BAD: return "PKT_RX_OUTER_L4_CKSUM_BAD"; + case PKT_RX_OUTER_L4_CKSUM_GOOD: return "PKT_RX_OUTER_L4_CKSUM_GOOD"; + case PKT_RX_OUTER_L4_CKSUM_INVALID: + return "PKT_RX_OUTER_L4_CKSUM_INVALID"; + default: return NULL; } } @@ -339,6 +344,13 @@ rte_get_rx_ol_flag_list(uint64_t mask, char *buf, size= _t buflen) { PKT_RX_SEC_OFFLOAD, PKT_RX_SEC_OFFLOAD, NULL }, { PKT_RX_SEC_OFFLOAD_FAILED, PKT_RX_SEC_OFFLOAD_FAILED, NULL }, { PKT_RX_QINQ, PKT_RX_QINQ, NULL }, + { PKT_RX_OUTER_L4_CKSUM_BAD, PKT_RX_OUTER_L4_CKSUM_MASK, NULL }, + { PKT_RX_OUTER_L4_CKSUM_GOOD, PKT_RX_OUTER_L4_CKSUM_MASK, + NULL }, + { PKT_RX_OUTER_L4_CKSUM_INVALID, PKT_RX_OUTER_L4_CKSUM_MASK, + NULL }, + { PKT_RX_OUTER_L4_CKSUM_UNKNOWN, PKT_RX_OUTER_L4_CKSUM_MASK, + "PKT_RX_OUTER_L4_CKSUM_UNKNOWN" }, }; const char *name; unsigned int i; diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index eb11779e7..a453ec008 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -177,6 +177,25 @@ extern "C" { */ #define PKT_RX_QINQ (1ULL << 20) =20 +/** + * Mask of bits used to determine the status of outer RX L4 checksum. + * - PKT_RX_OUTER_L4_CKSUM_UNKNOWN: no info about the outer RX L4 checksum + * - PKT_RX_OUTER_L4_CKSUM_BAD: the outer L4 checksum in the packet is wro= ng + * - PKT_RX_OUTER_L4_CKSUM_GOOD: the outer L4 checksum in the packet is va= lid + * - PKT_RX_OUTER_L4_CKSUM_INVALID: invalid outer L4 checksum state. + * + * The detection of PKT_RX_OUTER_L4_CKSUM_GOOD shall be based on the given + * HW capability, At minimum, the PMD should support + * PKT_RX_OUTER_L4_CKSUM_UNKNOWN and PKT_RX_OUTER_L4_CKSUM_BAD states + * if the DEV_RX_OFFLOAD_OUTER_UDP_CKSUM offload is available. + */ +#define PKT_RX_OUTER_L4_CKSUM_MASK ((1ULL << 21) | (1ULL << 22)) + +#define PKT_RX_OUTER_L4_CKSUM_UNKNOWN 0 +#define PKT_RX_OUTER_L4_CKSUM_BAD (1ULL << 21) +#define PKT_RX_OUTER_L4_CKSUM_GOOD (1ULL << 22) +#define PKT_RX_OUTER_L4_CKSUM_INVALID ((1ULL << 21) | (1ULL << 22)) + /* add new RX flags here */ =20 /* add new TX flags here */ --=20 2.19.1