From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 3C1F61B2F7 for ; Sun, 15 Oct 2017 14:49:09 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id u138so28690696wmu.5 for ; Sun, 15 Oct 2017 05:49:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dev-mellanox-co-il.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=FI1TTJhsjBsYmTXZzRCzPxGH/Twa5vIZS96zcjh3Qzc=; b=Lm4uj0fM6pI7qxAVU29F5cO5RGAlOk3AnRDtTArP3X1+sF1BwU9YOiI9/6WYKfKfxv 94/IJ3QkdPe18hYb9ErCiuXcNND1gQLk1tvHCVPgZD0B5dY763q6a0woYHfHT1pMx5Ef 4tT3ka8cTb8VW3LB9UW0O3x4DIqGWbK3KOfwBXfcqP32a1luamU3j4E9fXwpAzMadFgs owWSlREZLbagrpRSMbqNeiLOsI3ujGtB3QQEopIdkchgX8pmEN3A1cGiKhAKYZ6bXAXj AxQ3ST5BW/It6wS1oxiiMZKoubD2Z4gJWWQa26f8JmB3b2WUeTXgWbBuM40iBnx7Wutu RKhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=FI1TTJhsjBsYmTXZzRCzPxGH/Twa5vIZS96zcjh3Qzc=; b=cHvB3u9N59OTLfEVXEg2kWUz3ob8PqPARUDp/lwNPMFDCqYxoj7g1bxnHnBgLCIIiH KynMGcR06uM3AEPFYyKg/s8dgp/wQXVbwg2r3UHhD/whs+hr2tecJXFiGG9vNucQm+bX HBJotPm6QzmPv6liRflpeKjcFzETgM3Im1y6rAnrCqqQdX/evnW8NlP/b66I3dLJgMjD gnBxs9NBv8708JFyk6lOUIQbPFnuCDV71DfwRKv/Wcg9OfxHfMyIMKi7meNOPDYkAO/l uQisQS7BED+euWZQVK/Q7zvwRntwFWZDIIOnoxW5O6wkPTeL/6TdkdpZhPF6zBsi5uH2 s9DA== X-Gm-Message-State: AMCzsaUYM7gQ1lOlctGzjclO2afS6rzPX7udHzZwd2DsUx5Gjtz+rVN8 hmmr8IzjQ9cs5FLL3ikaRE1zxQ== X-Google-Smtp-Source: AOwi7QD5o1YWsTV4dHhZ2T/cj4LHGUNBJMWNwlKrjMh5bxtaXYUCoHO1ho6O+I0VcXH3lqjAiu7eTw== X-Received: by 10.80.143.163 with SMTP id y32mr9084273edy.162.1508071748950; Sun, 15 Oct 2017 05:49:08 -0700 (PDT) Received: from [10.0.38.219] ([193.47.165.251]) by smtp.gmail.com with ESMTPSA id t43sm3821007edh.22.2017.10.15.05.49.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Oct 2017 05:49:08 -0700 (PDT) To: Akhil Goyal , dev@dpdk.org Cc: declan.doherty@intel.com, pablo.de.lara.guarch@intel.com, hemant.agrawal@nxp.com, radu.nicolau@intel.com, borisp@mellanox.com, aviadye@mellanox.com, thomas@monjalon.net, sandeep.malik@nxp.com, jerin.jacob@caviumnetworks.com, john.mcnamara@intel.com, konstantin.ananyev@intel.com, shahafs@mellanox.com, olivier.matz@6wind.com References: <20171006181151.4758-1-akhil.goyal@nxp.com> <20171014221734.15511-1-akhil.goyal@nxp.com> <20171014221734.15511-6-akhil.goyal@nxp.com> From: Aviad Yehezkel Message-ID: <1187a22e-3cc2-e5ba-afb2-5856548cc6f6@dev.mellanox.co.il> Date: Sun, 15 Oct 2017 15:49:06 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171014221734.15511-6-akhil.goyal@nxp.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [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: Sun, 15 Oct 2017 12:49:09 -0000 On 10/15/2017 1:17 AM, Akhil Goyal wrote: > 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 Tested-by: Aviad Yehezkel