From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0069.outbound.protection.outlook.com [104.47.32.69]) by dpdk.org (Postfix) with ESMTP id 1B7C81B3A8 for ; Tue, 3 Oct 2017 15:17:14 +0200 (CEST) Received: from MWHPR03CA0022.namprd03.prod.outlook.com (10.175.133.160) by CO2PR03MB2359.namprd03.prod.outlook.com (10.166.93.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Tue, 3 Oct 2017 13:17:13 +0000 Received: from BN1AFFO11FD025.protection.gbl (2a01:111:f400:7c10::159) by MWHPR03CA0022.outlook.office365.com (2603:10b6:300:117::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11 via Frontend Transport; Tue, 3 Oct 2017 13:17:13 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; NXP1.onmicrosoft.com; dkim=none (message not signed) header.d=none;NXP1.onmicrosoft.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD025.mail.protection.outlook.com (10.58.52.85) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.77.10 via Frontend Transport; Tue, 3 Oct 2017 13:17:13 +0000 Received: from netperf2.ap.freescale.net ([10.232.133.164]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id v93DGfTG030592; Tue, 3 Oct 2017 06:17:08 -0700 From: Akhil Goyal To: CC: , , , , , , , , , , Date: Tue, 3 Oct 2017 18:44:06 +0530 Message-ID: <20171003131413.23846-6-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171003131413.23846-1-akhil.goyal@nxp.com> References: <20170914082651.26232-1-akhil.goyal@nxp.com> <20171003131413.23846-1-akhil.goyal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131515102334568134; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(7966004)(346002)(39380400002)(376002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(189998001)(7416002)(6916009)(316002)(2950100002)(48376002)(68736007)(1076002)(5003940100001)(53936002)(50466002)(76176999)(50986999)(16586007)(106466001)(5660300001)(33646002)(4326008)(2351001)(105606002)(77096006)(8656003)(97736004)(85426001)(104016004)(36756003)(69596002)(15650500001)(498600001)(86362001)(575784001)(2906002)(8676002)(8936002)(356003)(47776003)(54906003)(50226002)(81166006)(81156014)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2359; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD025; 1:HXbGDfyBQpCioB35s/gvCWzA1+xTg75/E+/2XlXCanMI26wCAmDAG3mUeBGAl1yU+FEbu/YIyQlUa7xgarQdSnYXVESqTKRc30qiL+xCs1gsQkAA4PAui8WBGDZUrn4C MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6ee839ab-2317-43bb-e565-08d50a610fb4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:CO2PR03MB2359; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2359; 3:vP1YRn88zHZ22/ME4JXiUStYaqbKqW5fCMSTwUgv4RymD0TwbWV0UG5d0ThnJME7OxwFLrh8U/5JkAJlSht2utBdVbscr8eo0McA+37P70z4hKQsMEM55l/2oR8H7VRMX4uFIMQ5Kpe26Ulc+e48d+hhbG+ObNFsEy+JxF80EbHiYdgRDpmkYeEfLn5g5SF6OsJskQ9Pu0cJlGkSlJZvZrdpsey/P8FopWN+vmWU4vQ8sjq1wxAJ3Y/Mog/s/6oYg2/kA+52zy/uj2PRJtfNSsqhMpdYDaHV4vqzH7Q3MRPEU8f70HeHKxNGUkVuqYi8SAzL6SAgjpHoo5Xz35Hqdw==; 25:SOcamw0b7vhmN7nZhcfBdMgQ+clNRiVf36RiiM5iYr2dcU/1u5qUnxffIqfnL2Tzn+/6TR+cadCsIj9Ru2CcnOyUnMw9ph+Rni98I6saoMC74dSop3wJcaMVqtCzmekhAfPyZRkR0fReE1JjhCl8h1Am+OA1Amt2B26mvJ7RZbTyq1SuNDK+g9bceAvrZCN7kgcDoIdAnUwDyxK5LYRbmFtkohW3XQOjKQ493LJT5tDzMOSiZMUhx+je96pC4EdScqBtpMhRlYXDlbBZOGK/jlDAmc+bTdnH3bnUi31Uqa56IB02ndR4bFSvV54P/pyfDCZDnvopdNX/wCTUgL4dYw==; 31:ywj5yi6v4YBWQhtSMFnOhZmzhdqXHZbBH3qbfHrS1DLddal3PdmbpTi2EXAWrDMuo8ZFhNJP1zgbh0vNkjGyQEOEt0Dljv04TkJuO1IyqCQsbEzN0MbxtoO+9E4LQdF/RMjALrfguJiW1jqi+oQPhqfARj6TUhiEpCDYXjZ/W76Xhs7P+oGWYCxzaDhQPM1OOn7yOHlxJaK3Tk0PQnZWVVMrah4qK+tCRDLlA+JxH48= X-MS-TrafficTypeDiagnostic: CO2PR03MB2359: X-Exchange-Antispam-Report-Test: UriScan:(192374486261705)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6096035)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123556025)(20161123565025)(20161123561025)(20161123559100)(20161123563025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CO2PR03MB2359; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CO2PR03MB2359; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2359; 4:nONPMXkASOr71+7qjS3LpJw5YKLYSFhhqt4d/I7RcUcqKG6taaBLrdSW47lH6RcLzmrLfUn9pZrX+4fHFjUp70CRe1kH6MQNFRsbx0gPNG6MsarR4WptROdSXa9zw7RRJaxyMWcI2xZdtZUcJrrX4oQxr1qoK05FckQy0Ih/QaWwbFziP8bDfEP++YJzPzV+zFjG6cRdV0Dc3Lf2HiEE0fXcIX2CirgK+cWyPgfGyWXQTwH0joF2fZl+94Vvi7ThaPGzJotUM8FhVyrsRiXNODQ5g003fefkFyYBzr8R1gaOvp86fSiRaRQqpaCgA9HT4b6774zGwa31mSNigXH0nA== X-Forefront-PRVS: 044968D9E1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2359; 23:nStMKeEvere8Nm/vc5s2HxvPGRbhyyULkn2+4lnZz?= =?us-ascii?Q?ysETNUOow7TioiVqV5zJGO3NqFB6CpkDXXc8x+PmoyZGZnG4eum89HnH6tlI?= =?us-ascii?Q?AlRx9pXgS1Bch2E5e7o/QH+PnNze5U1CI3bRnzoc3OIPU0TG/sj0VmKYk6N+?= =?us-ascii?Q?kEIB9mo26WfS1L9z7ELt8sB6V9oAZ/KJRHfgjdgA1E3me+hlTcPvt1PRYo37?= =?us-ascii?Q?pUHZiThsdn85c29IPqCCCneK+8Wk9GjpCiaoeocp4yHLiFqIam7EjpBIBHT8?= =?us-ascii?Q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:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2017 13:17:13.2072 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR03MB2359 Subject: [dpdk-dev] [PATCH v2 05/12] lib/librte_mbuf: add security crypto flags and mbuf fields 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, 03 Oct 2017 13:17:15 -0000 From: Boris Pismenny add security crypto flags and update mbuf fields to support IPsec crypto offload for transmitted packets, and to indicate crypto result for received packets. Signed-off-by: Aviad Yehezkel Signed-off-by: Boris Pismenny Signed-off-by: Radu Nicolau --- lib/librte_mbuf/rte_mbuf.c | 6 ++++++ lib/librte_mbuf/rte_mbuf.h | 33 ++++++++++++++++++++++++++++++--- lib/librte_mbuf/rte_mbuf_ptype.c | 1 + lib/librte_mbuf/rte_mbuf_ptype.h | 11 +++++++++++ 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index 26a62b8..2978259 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -323,6 +323,8 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask) case PKT_RX_QINQ_STRIPPED: return "PKT_RX_QINQ_STRIPPED"; case PKT_RX_LRO: return "PKT_RX_LRO"; 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"; default: return NULL; } } @@ -358,6 +360,8 @@ rte_get_rx_ol_flag_list(uint64_t mask, char *buf, size_t buflen) { PKT_RX_QINQ_STRIPPED, PKT_RX_QINQ_STRIPPED, NULL }, { PKT_RX_LRO, PKT_RX_LRO, NULL }, { PKT_RX_TIMESTAMP, PKT_RX_TIMESTAMP, NULL }, + { PKT_RX_SEC_OFFLOAD, PKT_RX_SEC_OFFLOAD, NULL }, + { PKT_RX_SEC_OFFLOAD_FAILED, PKT_RX_SEC_OFFLOAD_FAILED, NULL }, }; const char *name; unsigned int i; @@ -410,6 +414,7 @@ const char *rte_get_tx_ol_flag_name(uint64_t mask) case PKT_TX_TUNNEL_GENEVE: return "PKT_TX_TUNNEL_GENEVE"; case PKT_TX_TUNNEL_MPLSINUDP: return "PKT_TX_TUNNEL_MPLSINUDP"; case PKT_TX_MACSEC: return "PKT_TX_MACSEC"; + case PKT_TX_SEC_OFFLOAD: return "PKT_TX_SEC_OFFLOAD"; default: return NULL; } } @@ -443,6 +448,7 @@ rte_get_tx_ol_flag_list(uint64_t mask, char *buf, size_t buflen) { PKT_TX_TUNNEL_MPLSINUDP, PKT_TX_TUNNEL_MASK, "PKT_TX_TUNNEL_NONE" }, { PKT_TX_MACSEC, PKT_TX_MACSEC, NULL }, + { PKT_TX_SEC_OFFLOAD, PKT_TX_SEC_OFFLOAD, NULL }, }; const char *name; unsigned int i; diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index eaed7ee..7a8285e 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -189,11 +189,26 @@ extern "C" { */ #define PKT_RX_TIMESTAMP (1ULL << 17) +/** + * Indicate that security offload processing was applied on the RX packet. + */ +#define PKT_RX_SEC_OFFLOAD (1ULL << 18) + +/** + * Indicate that security offload processing failed on the RX packet. + */ +#define PKT_RX_SEC_OFFLOAD_FAILED (1ULL << 19) + /* add new RX flags here */ /* add new TX flags here */ /** + * Request security offload processing on the TX packet. + */ +#define PKT_TX_SEC_OFFLOAD (1ULL << 43) + +/** * Offload the MACsec. This flag must be set by the application to enable * this offload feature for a packet to be transmitted. */ @@ -316,7 +331,8 @@ extern "C" { PKT_TX_QINQ_PKT | \ PKT_TX_VLAN_PKT | \ PKT_TX_TUNNEL_MASK | \ - PKT_TX_MACSEC) + PKT_TX_MACSEC | \ + PKT_TX_SEC_OFFLOAD) #define __RESERVED (1ULL << 61) /**< reserved for future mbuf use */ @@ -456,8 +472,19 @@ struct rte_mbuf { uint32_t l3_type:4; /**< (Outer) L3 type. */ uint32_t l4_type:4; /**< (Outer) L4 type. */ uint32_t tun_type:4; /**< Tunnel type. */ - uint32_t inner_l2_type:4; /**< Inner L2 type. */ - uint32_t inner_l3_type:4; /**< Inner L3 type. */ + RTE_STD_C11 + union { + uint8_t inner_esp_next_proto; + /**< ESP next protocol type, valid if RTE_PTYPE_TUNNEL_ESP + tunnel type is set on both Tx and Rx */ + __extension__ + struct { + uint8_t inner_l2_type:4; + /**< Inner L2 type. */ + uint8_t inner_l3_type:4; + /**< Inner L3 type. */ + }; + }; uint32_t inner_l4_type:4; /**< Inner L4 type. */ }; }; diff --git a/lib/librte_mbuf/rte_mbuf_ptype.c b/lib/librte_mbuf/rte_mbuf_ptype.c index e5c4fae..01b51fe 100644 --- a/lib/librte_mbuf/rte_mbuf_ptype.c +++ b/lib/librte_mbuf/rte_mbuf_ptype.c @@ -89,6 +89,7 @@ const char *rte_get_ptype_tunnel_name(uint32_t ptype) case RTE_PTYPE_TUNNEL_NVGRE: return "TUNNEL_NVGRE"; case RTE_PTYPE_TUNNEL_GENEVE: return "TUNNEL_GENEVE"; case RTE_PTYPE_TUNNEL_GRENAT: return "TUNNEL_GRENAT"; + case RTE_PTYPE_TUNNEL_ESP: return "TUNNEL_ESP"; default: return "TUNNEL_UNKNOWN"; } } diff --git a/lib/librte_mbuf/rte_mbuf_ptype.h b/lib/librte_mbuf/rte_mbuf_ptype.h index acd70bb..aefc0fe 100644 --- a/lib/librte_mbuf/rte_mbuf_ptype.h +++ b/lib/librte_mbuf/rte_mbuf_ptype.h @@ -383,6 +383,17 @@ extern "C" { */ #define RTE_PTYPE_TUNNEL_GRENAT 0x00006000 /** + * ESP (IP Encapsulating Security Payload) tunneling packet type. + * + * Packet format: + * <'ether type'=0x0800 + * | 'version'=4, 'protocol'=51> + * or, + * <'ether type'=0x86DD + * | 'version'=6, 'next header'=51> + */ +#define RTE_PTYPE_TUNNEL_ESP 0x00007000 +/** * Mask of tunneling packet types. */ #define RTE_PTYPE_TUNNEL_MASK 0x0000f000 -- 2.9.3