From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 822E3A046B for ; Mon, 24 Jun 2019 20:54:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CA5831BA9A; Mon, 24 Jun 2019 20:54:27 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id B26311BA96 for ; Mon, 24 Jun 2019 20:54:26 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jun 2019 11:54:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,413,1557212400"; d="scan'208";a="312799120" Received: from irsmsx152.ger.corp.intel.com ([163.33.192.66]) by orsmga004.jf.intel.com with ESMTP; 24 Jun 2019 11:54:23 -0700 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.143]) by IRSMSX152.ger.corp.intel.com ([169.254.6.79]) with mapi id 14.03.0439.000; Mon, 24 Jun 2019 19:54:22 +0100 From: "Ananyev, Konstantin" To: "Smoczynski, MarcinX" , "Kovacevic, Marko" , "orika@mellanox.com" , "Richardson, Bruce" , "De Lara Guarch, Pablo" , "Nicolau, Radu" , "akhil.goyal@nxp.com" , "Kantecki, Tomasz" , "Iremonger, Bernard" , "olivier.matz@6wind.com" CC: "dev@dpdk.org" Thread-Topic: [PATCH v2 1/4] net: new ipv6 header extension parsing function Thread-Index: AQHVKpK8urJoKlpj/k2oXvrSeVIFeaarJxPQ Date: Mon, 24 Jun 2019 18:54:21 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725801689E428B@IRSMSX104.ger.corp.intel.com> References: <20190508104717.13448-1-marcinx.smoczynski@intel.com> <20190624134000.2456-1-marcinx.smoczynski@intel.com> <20190624134000.2456-2-marcinx.smoczynski@intel.com> In-Reply-To: <20190624134000.2456-2-marcinx.smoczynski@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOGYzODViNTItM2JkMC00ZDVmLTgwODAtN2NhMjlhZTk2MjA4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiYXdzK1BFOExKbFM0SzVSQWpTUFl3ZkR1c0RJM1BGVG95SzdyQ1ZvakxEKzRvcVhCWkhyTEl1Zld4TXh2S2hJUiJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 1/4] net: new ipv6 header extension parsing function 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Smoczynski, MarcinX > Sent: Monday, June 24, 2019 2:40 PM > To: Kovacevic, Marko ; orika@mellanox.com; Ric= hardson, Bruce ; De Lara > Guarch, Pablo ; Nicolau, Radu ; akhil.goyal@nxp.com; Kantecki, Tomasz > ; Ananyev, Konstantin ; Iremonger, Bernard > ; olivier.matz@6wind.com > Cc: dev@dpdk.org; Smoczynski, MarcinX > Subject: [PATCH v2 1/4] net: new ipv6 header extension parsing function >=20 > Introduce new function for IPv6 header extension parsing able to > determine extension length and next protocol number. >=20 > This function is helpful when implementing IPv6 header traversing. >=20 > Signed-off-by: Marcin Smoczynski > --- > lib/librte_net/rte_ip.h | 49 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 49 insertions(+) >=20 > diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h > index ae3b7e730..c2c67b85d 100644 > --- a/lib/librte_net/rte_ip.h > +++ b/lib/librte_net/rte_ip.h > @@ -428,6 +428,55 @@ rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv= 6_hdr, const void *l4_hdr) > return (uint16_t)cksum; > } >=20 > +/* IPv6 fragmentation header size */ > +#define RTE_IPV6_FRAG_HDR_SIZE 8 > + > +/** > + * Parse next IPv6 header extension > + * > + * This function checks if proto number is an IPv6 extensions and parses= its > + * data if so, providing information on next header and extension length= . > + * > + * @param p > + * Pointer to an extension raw data. > + * @param proto > + * Protocol number extracted from the "next header" field from > + * the IPv6 header or the previous extension. > + * @param ext_len > + * Extension data length. > + * @return > + * next protocol number if proto is an IPv6 extension, -EINVAL otherwi= se > + */ > +static inline int __rte_experimental > +rte_ipv6_get_next_ext(uint8_t *p, int proto, size_t *ext_len) > +{ > + int next_proto; > + > + switch (proto) { > + case IPPROTO_AH: > + next_proto =3D *p++; > + *ext_len =3D (*p + 2) * sizeof(uint32_t); > + break; > + > + case IPPROTO_HOPOPTS: > + case IPPROTO_ROUTING: > + case IPPROTO_DSTOPTS: > + next_proto =3D *p++; > + *ext_len =3D (*p + 1) * sizeof(uint64_t); > + break; > + > + case IPPROTO_FRAGMENT: > + next_proto =3D *p; > + *ext_len =3D RTE_IPV6_FRAG_HDR_SIZE; > + break; > + > + default: > + return -EINVAL; > + } > + > + return next_proto; > +} > + > #ifdef __cplusplus > } > #endif > -- Acked-by: Konstantin Ananyev Tested-by: Konstantin Ananyev > 2.17.1