From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0079.outbound.protection.outlook.com [104.47.32.79]) by dpdk.org (Postfix) with ESMTP id B60D21B392 for ; Sun, 15 Oct 2017 00:20:53 +0200 (CEST) Received: from CY4PR03CA0088.namprd03.prod.outlook.com (10.171.242.157) by BN3PR03MB2356.namprd03.prod.outlook.com (10.166.74.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Sat, 14 Oct 2017 22:20:52 +0000 Received: from BN1AFFO11FD034.protection.gbl (2a01:111:f400:7c10::109) by CY4PR03CA0088.outlook.office365.com (2603:10b6:910:4d::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.77.21 via Frontend Transport; Sat, 14 Oct 2017 22:20:51 +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 BN1AFFO11FD034.mail.protection.outlook.com (10.58.52.158) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.77.10 via Frontend Transport; Sat, 14 Oct 2017 22:20:51 +0000 Received: from netperf2.ap.freescale.net ([10.232.133.164]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id v9EMKCMO018714; Sat, 14 Oct 2017 15:20:45 -0700 From: Akhil Goyal To: CC: , , , , , , , , , , , , Date: Sun, 15 Oct 2017 03:47:27 +0530 Message-ID: <20171014221734.15511-6-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171014221734.15511-1-akhil.goyal@nxp.com> References: <20171006181151.4758-1-akhil.goyal@nxp.com> <20171014221734.15511-1-akhil.goyal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131524932513410327; (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)(376002)(39860400002)(346002)(39380400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(5660300001)(54906003)(2351001)(69596002)(76176999)(316002)(50986999)(16586007)(77096006)(48376002)(1076002)(7416002)(189998001)(6666003)(105606002)(8656003)(2950100002)(6916009)(50226002)(68736007)(36756003)(47776003)(5003940100001)(50466002)(106466001)(97736004)(498600001)(4326008)(33646002)(53936002)(15650500001)(85426001)(8936002)(305945005)(8676002)(81156014)(81166006)(2906002)(356003)(86362001)(104016004); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2356; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD034; 1:AWHp9bLtWC/QxqW6pbH8Me5q7Nrcs2oSDAWh0mz6UM3hn48WaAEqLhGHGJKCr67fDTLZU0JKn9lQtPKvaSjzBKc4mZLP5PSZ1k7mWDTtP/5G9l+soXGMvf+eXg9RVr8Y MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6c7a55bc-c45e-42f4-ea55-08d51351d403 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:BN3PR03MB2356; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2356; 3:Q80LrcAbGbzx8HuNFWe68v3kwMD+p6wYVuLZ1nazVtOG8Y1hTZECSxxe6tf/Bb712Ud4L/NBn9NUEBiivWRPR+kl/q5aRi0m5k/a5V8OJR8JPmAXReNzEtFp9s476mmPj86KJSO7XgDx1KUF/DRSRBXateRChMMLCco5ISyfOoptYsmcvRkXTsVD+w2lANzvrsUnnBR3gBL+eIf6CXwNxrjyC707QH5igyg8XpCedd5Cv7P3r9G1vpieWgaFz0ruFwLHY7PA+apVjdqxckvApNzs80Lz141HxwIFlyVXmNW4431spM2qo3s5Ui8YR/F3agnG6weonTiAWbnzQ5QVYF056gQtL8uqxMCgO4CJDU8=; 25:8deXHauJf3NhikuqeNGhhoZIwoqn7dNClQ/lj+S90V4sd6/yPmX5ALd1K/k4Ud+mbqzLE0epI83MGQROBJu4yEhFeYb2FBSX3WSUqrG4lKoJSZxD3nX0QZ3LhqdJJyEO5aK8i87PvW0tkTYlOUhdypFL2vJCVl99491+zOZBJ+OoyxjfEpyPQ4BeesyjqunSgeaRdYMXpU1Dgf//tMKS0Ny1yotqRGqO92X2SPAYK9AzxNmJi+6LOnOTfeF79ORZoWgqH5zvqyEBW7snpD4CUzkbFsRz6xcphTa78okl8piEmkc3xhHdO6rNwmCVqvZqriArxG205q+YWgQ9XTKbUA== X-MS-TrafficTypeDiagnostic: BN3PR03MB2356: X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2356; 31:32p5f2MGuz0IO4awfJLygJfB5gF7ZvSKx14uA0jS+CMJkb3Ow9fiiBk9Em5XN1jBj/LfuYc0lDswT6yCpr4Uxpp+/ly1r2ZizPLznF8pjQ78WP3tjAgWInCklFnW80U8msOIfYoY6ZFixLKKHFv5i8+N4WFbsUmpxWKdxWWtynNch7e+sofjXsK4bkbMn5bpV22/syFauZZ/e122w6u3OnxIPPkirMw/L8QWAYCF//I=; 4:gs8djRII5Xpbic6yRIz4hEkQS5voO19fFJubwrgzK68juDmH5xNe5ibOr2tqkJ2xZd/TsvnoJte7h1teh6iBAIhNxEn0ZbZsWSZQSLLn+8g9CFt1wlWXalPQqsGyP7zIdgQVj/84LsgF5V1LMem8d00/XjxFIyaSQdpTQqFuHxA0JbCrJbGN29H6KqxzFiW/6PtmI0480pUdAinMiScGL4w45whmti/X9i5+shllaKHn20UtsQr6F8ULKWJbstSzhaatm2aYw/6fxlv61TndTdUQlyXPE7TMfr58feMguWDVm6OVrC8tAdBl3NqJLBsNMxbjEfIRqH2/I2u2P986Bw== 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)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6055026)(6096035)(20161123565025)(20161123563025)(20161123561025)(20161123556025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123559100)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN3PR03MB2356; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN3PR03MB2356; X-Forefront-PRVS: 046060344D X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR03MB2356; 23:VGIZuItS49sfQcmeFPT/g+WqfOOfo0VrPjXuV/hHD?= =?us-ascii?Q?hm6E89rP2lxtcEXXOLE3vrXJrdWQEToLcDDZR7af/myB4keirarmg+4X2nUR?= =?us-ascii?Q?cB6MdjY3Int2qx8ZtCAuxqUkvG5EzJnE/EODf0wXq4RrHCRB+VNTHF7Tfq12?= =?us-ascii?Q?SymhEP4Edia9NtjIeLCi0N3Bwd6PSlHBwBPfs/XKjAW+QMbzefPgEYeBrM+3?= =?us-ascii?Q?Iu6fL2eaXMHy9T1e97OC9bjaD+PrEHt60DRfPTv6ZGopyPyOEvNBLL3iPYYk?= =?us-ascii?Q?1veQlNx5twkpftUolx3l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AvamK?= =?us-ascii?Q?T3H7UH9Y7KUDpaOsl2MC1TOGL+4rlop5ZK22g2olLl+Ak/5YOLzcv82H6CrZ?= =?us-ascii?Q?GKrkPl+1eli1I40ojM=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2356; 6:Sv4sFMhMqyPoM5sDJ9IMUm3eC+5G7+KqRGu6t81UTTSG+jpdlsHdfFbpPAun/GQiVdBebQlLs0lyOMDwSDujAGg7QeL2mDJ+N2MxpSNhBQXEw03BAd/wlTyBUd9RkSayGOMkn6Hm4pxflkeWbbL0u8ombhS5ptNXf7gj1izckIN7st34YmwHDfz7uKPLcf1DmaX8OcRRnrctCoIfnL5tQgxk1N7fsH3wU/ODw+981dwt1g5mE2axF8CkMJXMLOioQAGHXTg3I38LrEa0UZ+uoKhG1n4oMALzriGY7wTsZlOqyRPrXYXkIQiLzAf8+GwVW11TF3IMrcXZdNvbeXkAIw==; 5:8lvsEG02aHGafTirkSvBJ5wR5v56iQ1keQYXPz2Wz+Gw3BlIOacbLDCRhk96zhSCVDwr83FBO+Xk+QNVvOr1bCrHa5xaEqONgjDjcpsMU6mj3IoYLryFTC+drBBJQ9klR/zVAO3+oany5ymFYZp3Fg==; 24:51z6SFErDLLNsJD0dD80hy9qLY/p0viok2eYfTH125pVFpxmwZUC2e1ykgF6d7hdQcrDq+s6caDPhIQwKpK72cWuw8okjWeXbAcxMCgpF6E=; 7:ZVC6AVGEx6XZVoYxcauaOY+Is/l6s8MBLB/3++JANVuklpIodC9D9cfun0fqqPqqiyXB0PwEIbl+yMZFux/0qUjnw4vXyd0TRRSH8/aUbRtt1Tf8wwtwZR/Cfe3RuwmJHe+cYlUJi7nAkQj8cL4QCxsWoX+o68lZFLaqTS7bZUNhmHNHL9iCi4eQ7HWbJ0Q0j6D86sbgV0K4W0IpfH/4u6vYeyOlIQv/yHqX974Gf3Q= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2017 22:20:51.0758 (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: BN3PR03MB2356 Subject: [dpdk-dev] [PATCH v4 05/12] 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: Sat, 14 Oct 2017 22:20:54 -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 | 35 ++++++++++++++++++++++++++++++++--- lib/librte_mbuf/rte_mbuf_ptype.c | 1 + lib/librte_mbuf/rte_mbuf_ptype.h | 11 +++++++++++ 4 files changed, 50 insertions(+), 3 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index 0e18709..6659261 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -324,6 +324,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; } } @@ -359,6 +361,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; @@ -411,6 +415,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; } } @@ -444,6 +449,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 cc38040..5d478da 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,21 @@ 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 a450814..a623226 100644 --- a/lib/librte_mbuf/rte_mbuf_ptype.c +++ b/lib/librte_mbuf/rte_mbuf_ptype.c @@ -91,6 +91,7 @@ const char *rte_get_ptype_tunnel_name(uint32_t ptype) case RTE_PTYPE_TUNNEL_GRENAT: return "TUNNEL_GRENAT"; case RTE_PTYPE_TUNNEL_GTPC: return "TUNNEL_GTPC"; case RTE_PTYPE_TUNNEL_GTPU: return "TUNNEL_GTPU"; + 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 978c4a2..5c62435 100644 --- a/lib/librte_mbuf/rte_mbuf_ptype.h +++ b/lib/librte_mbuf/rte_mbuf_ptype.h @@ -415,6 +415,17 @@ extern "C" { */ #define RTE_PTYPE_TUNNEL_GTPU 0x00008000 /** + * 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 0x00009000 +/** * Mask of tunneling packet types. */ #define RTE_PTYPE_TUNNEL_MASK 0x0000f000 -- 2.9.3