From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0076.outbound.protection.outlook.com [104.47.38.76]) by dpdk.org (Postfix) with ESMTP id 1D69537B4 for ; Fri, 6 Oct 2017 20:15:04 +0200 (CEST) Received: from BN3PR03CA0087.namprd03.prod.outlook.com (2a01:111:e400:7a4d::47) by SN2PR03MB2368.namprd03.prod.outlook.com (2603:10b6:804:e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Fri, 6 Oct 2017 18:15:02 +0000 Received: from BY2FFO11FD012.protection.gbl (2a01:111:f400:7c0c::172) by BN3PR03CA0087.outlook.office365.com (2a01:111:e400:7a4d::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10 via Frontend Transport; Fri, 6 Oct 2017 18:15:02 +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 BY2FFO11FD012.mail.protection.outlook.com (10.1.14.130) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.77.10 via Frontend Transport; Fri, 6 Oct 2017 18:15:01 +0000 Received: from netperf2.ap.freescale.net ([10.232.133.164]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id v96IERod027297; Fri, 6 Oct 2017 11:14:56 -0700 From: Akhil Goyal To: CC: , , , , , , , , , , , , Date: Fri, 6 Oct 2017 23:41:44 +0530 Message-ID: <20171006181151.4758-6-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171006181151.4758-1-akhil.goyal@nxp.com> References: <20171003131413.23846-1-akhil.goyal@nxp.com> <20171006181151.4758-1-akhil.goyal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131517873019057584; (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)(376002)(39380400002)(39860400002)(346002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(81166006)(8936002)(81156014)(16586007)(68736007)(77096006)(76176999)(50986999)(7416002)(47776003)(5660300001)(5003940100001)(189998001)(4326008)(53936002)(498600001)(50226002)(8676002)(104016004)(1076002)(575784001)(2351001)(105606002)(69596002)(106466001)(85426001)(15650500001)(36756003)(356003)(33646002)(86362001)(305945005)(8656003)(48376002)(54906003)(97736004)(316002)(50466002)(6666003)(2950100002)(2906002)(6916009); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR03MB2368; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD012; 1:IwGMO6BRMKJHSGsX6eGSIji76RwBRW/2/Fxa1S3fI6pdMtJQccN7Lj0AzNbyZ0YU8hpTC9SE3bBWSzVpb2Cy+UUdShAOAvd3lvLi5LCzjw7q1J/73U0TKfw6n158W0QV MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a594ff59-4ec7-422d-144f-08d50ce6295f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:SN2PR03MB2368; X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2368; 3:aXMg/ENX8wUNoV4fclN7mpzMVXi48InxWZgxg7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Cmwlx/OVL5d2Q3VaKOreFsuggbutDz2U0T9ejHf9OqAwsS8Gfcvp7DKL4UU3fKxjO5rvigpPtFUkLPUbJmxFdAa0oPdJrLnBCAhezjBy+buN2/dhr10MGyJesXq4s6OkfbriY6NG0Vtoo+78oYvIuTdulVqGFLZxJLqc06hnpbZ6dLSxAC4XBYWh6beLXNPM++h24K5hi+2VPgwzgM5dBRGGjOp/8AoAe72rVTm+33akx9RafLHxkWSr4Q== 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)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(3002001)(6055026)(6096035)(20161123565025)(20161123559100)(20161123563025)(20161123556025)(20161123561025)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN2PR03MB2368; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN2PR03MB2368; X-Forefront-PRVS: 0452022BE1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR03MB2368; 23:6XBvQd6yBjiXKXNZsPmfnPTPeZQ+8RVj9fClROMXC?= =?us-ascii?Q?oUPG/E64LYzPuptsU1cCBQ70OyudTEp4M7xXZD5vvL+A71L4r60R2p0P3a02?= =?us-ascii?Q?3jNMa2YW8PSkndlxI+/5vfwbjn2HPp19DnTzaO9p9zlTOXfbGAH8R6oMfiZE?= =?us-ascii?Q?6w+df5qz56z0VPgVZzfVgBUAn4kSNlGalC0oio+vpbJSbYqYZluvknN9XKQG?= =?us-ascii?Q?RMZ3/EL/3nL24HoacDa9FlzFOMgWerWYsvoc5m9qz8o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u3kxPFi68OtdShwuQqgRlIOa+TbDkR4PK4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2017 18:15:01.7809 (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: SN2PR03MB2368 Subject: [dpdk-dev] [PATCH v3 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: Fri, 06 Oct 2017 18:15:04 -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 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..95f2906 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 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