From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 51ED7A052F; Wed, 29 Jan 2020 16:38:25 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 253A61BFEE; Wed, 29 Jan 2020 16:38:25 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id DDA8D1BFEA for ; Wed, 29 Jan 2020 16:38:22 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jan 2020 07:34:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,378,1574150400"; d="scan'208";a="229643438" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga003.jf.intel.com with ESMTP; 29 Jan 2020 07:34:54 -0800 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 29 Jan 2020 07:34:53 -0800 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 29 Jan 2020 07:34:53 -0800 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (104.47.44.53) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 29 Jan 2020 07:34:53 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Eo+8ctwFJFdyzi1v4OAhF9XNkMw5X07qYKUtqsaDymqzoXuXDvGFNA9zYQ0dlLfcfV4/wbLB/eicqpbi2LDisjX69Se/IPNWh+tUJGKXyNxRaEg92t98KxSxU5VWsC5eNF0hdFgBgMG3Ha90vcT1Ol3fMszTeYv7mDC5TMJee/kvvzngHi+Sb8XvSpG3l/gaeFdTTTCtQNgH+Le/8iBGh6gfK7yRw2PSmOn/JRAxoPnUYbC0ojK1axhXEMZ8G+kXC+VYXhEq3OCKhDeijxlN3XIGS0Fh9MyFLKaI/9o2XnOmJUkId9CGstXgukHMxineMSeTTh6g1iZp9d11wSwjRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lskeGPewnEqZA5wbfWRc3epk0OkZSOPAyzpOO/1Oig8=; b=ILqUtiU6xjspK2AXSLXF3gnCGRFxIZh68gNyagtAQqDGAj++NuMuEYkIvD+Ea9vjbI+Cb1Mnd2OubgjEk3tVWULZ0WjguP5QlQqQuyXF3Oj0ihrrvWX7eQZg02Mh0Ikv/gUj1TOf5CwVP5fahRWPPdHjNg0Q2eJDK86H5JUYszBQBWPcvcVDJWHxv1nc7E8P3Proki9jYqOoJTfml3le9/g/4unbEQ3P7HBmhTFnmEL+WFCRnaMiX3cEyvw9vZd2UwZTWFwMFkn0A2Ai1DeJ0iDJo26pWUEZlVoN2yGoMl+BKjraFxgZv7infGyizhmKR7xN3sfdDjcEuiQ0AsGMgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lskeGPewnEqZA5wbfWRc3epk0OkZSOPAyzpOO/1Oig8=; b=MgXdNrvRcF0t2R1Rj41s18wPy3ksSVUObW4r9fCYRyWjzmbUmEry7dCUT1QVht3tlPy/fwmZndgt/P/qMPjOoxLfQGnYHd2wG9laEii/vp1fzm4KuLNukzR+IP0ZzqoVO8iHsHgghiLJCkLrF88IyCKxPrG677yvSu4wc+vmZww= Received: from SN6PR11MB2558.namprd11.prod.outlook.com (52.135.94.19) by SN6PR11MB3421.namprd11.prod.outlook.com (52.135.124.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.23; Wed, 29 Jan 2020 15:34:50 +0000 Received: from SN6PR11MB2558.namprd11.prod.outlook.com ([fe80::4d86:362a:13c3:8386]) by SN6PR11MB2558.namprd11.prod.outlook.com ([fe80::4d86:362a:13c3:8386%7]) with mapi id 15.20.2665.027; Wed, 29 Jan 2020 15:34:50 +0000 From: "Ananyev, Konstantin" To: Anoob Joseph , Akhil Goyal , "Nicolau, Radu" , Thomas Monjalon CC: Lukasz Bartosik , Jerin Jacob , Narayana Prasad , Ankur Dwivedi , Archana Muniganti , Tejasree Kondoj , Vamsi Attunuru , "dev@dpdk.org" Thread-Topic: [PATCH v2 11/12] examples/ipsec-secgw: add app mode worker Thread-Index: AQHVz5glEEdWEmriukuwybNfgKyTmagByTBg Date: Wed, 29 Jan 2020 15:34:50 +0000 Message-ID: References: <1575808249-31135-1-git-send-email-anoobj@marvell.com> <1579527918-360-1-git-send-email-anoobj@marvell.com> <1579527918-360-12-git-send-email-anoobj@marvell.com> In-Reply-To: <1579527918-360-12-git-send-email-anoobj@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNmY5MmUzZDItOTI5Zi00NTY0LTkzY2EtN2I3NjQ0MmEzYzhlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiS2JQY0FnYW1KYzhWWWVTZFBcL2NzNlg5bWlkTEphSFUrZHBoem9BUTA3bDk3K3RDa3E4dG9nOGQ1QzA3TEFGeWEifQ== dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 x-ctpclassification: CTP_NT authentication-results: spf=none (sender IP is ) smtp.mailfrom=konstantin.ananyev@intel.com; x-originating-ip: [192.198.151.187] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3770a536-a140-4d11-28c5-08d7a4d0c7b9 x-ms-traffictypediagnostic: SN6PR11MB3421: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:525; x-forefront-prvs: 02973C87BC x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(136003)(39860400002)(376002)(346002)(396003)(199004)(189003)(76116006)(7416002)(316002)(9686003)(33656002)(478600001)(6506007)(110136005)(66946007)(86362001)(66476007)(66446008)(64756008)(66556008)(186003)(52536014)(7696005)(2906002)(55016002)(8676002)(4326008)(5660300002)(54906003)(81156014)(71200400001)(8936002)(81166006)(26005); DIR:OUT; SFP:1102; SCL:1; SRVR:SN6PR11MB3421; H:SN6PR11MB2558.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: GSHFnMxn0Qb0LEWMathZSLgM1uYyKykN4DxU7CR6i+cKxPxHYzqcDfmjku4w2iSLNC/uOOPm0H62Rt4CVTIVVtq93bro9t5wrV4Qz/bTsjYZHw8HwQYePjYLPdJDkXCZVmBNYt92e6po9iuJJ5osWmLsuDeJq74wRokf16VpQ2ehaNbMF31pdX3OQs+K8cTqsJoZnlhLHnfWXsONaKBJVdmWsDDcE4Tq9PZMhgVTp423/KRt/tYU64SPn6odtfAjVlzxRbK5uS8jmIL9CZNqcf2tSHaNvT+zwdWVEkkchbZyQAKurpLH1bgj2OkeWIIJgZnWrhcpBLk5ME+RT+Zj3G5vCB3cl36nTcknVnB+9622awi7UsfPnhjKG5GZ/5iftR32SoK9zVVbxxTqT3x/j9lHzLWbrTeEA4Kcr+TPZagAITUFp7ZZEVQdJcOhEWvM x-ms-exchange-antispam-messagedata: qwOlN3KAtulIl1IbvcKqrK81PJc+pCfq2oKNztE1zqXhezZvZiPqrfjNXmNF/bf2UKl+AA7MVAJI43VJjwjloc0MLcetLkPBtUJ5DW9lH3QzU5sH/V+M+QtItheGdVPFS5qJf/98HWon4lJo1YlLRQ== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 3770a536-a140-4d11-28c5-08d7a4d0c7b9 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jan 2020 15:34:50.5808 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: vhM4tiPS0mtTqpRDqsI62A4ZHGELe3fwSngcyGX2VeEcFjsQ8OJwJDRRc39IhRWLfFg5LiZJpIzx3wZghEj5et+mJ4L3eHIlZOWsS79KaMo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3421 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2 11/12] examples/ipsec-secgw: add app mode worker 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" > Add application inbound/outbound worker thread and > IPsec application processing code for event mode. >=20 > Exampple ipsec-secgw command in app mode: > ipsec-secgw -w 0002:02:00.0,ipsec_in_max_spi=3D128 > -w 0002:03:00.0,ipsec_in_max_spi=3D128 -w 0002:0e:00.0 -w 0002:10:00.1 > --log-level=3D8 -c 0x1 -- -P -p 0x3 -u 0x1 --config "(1,0,0),(0,0,0)" > -f aes-gcm.cfg --transfer-mode event --schedule-type parallel >=20 > Signed-off-by: Anoob Joseph > Signed-off-by: Ankur Dwivedi > Signed-off-by: Lukasz Bartosik > --- > examples/ipsec-secgw/ipsec-secgw.c | 45 +--- > examples/ipsec-secgw/ipsec-secgw.h | 69 ++++++ > examples/ipsec-secgw/ipsec.h | 22 -- > examples/ipsec-secgw/ipsec_worker.c | 418 ++++++++++++++++++++++++++++++= +++++- > examples/ipsec-secgw/ipsec_worker.h | 39 ++++ > 5 files changed, 533 insertions(+), 60 deletions(-) > create mode 100644 examples/ipsec-secgw/ipsec_worker.h >=20 > diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ip= sec-secgw.c > index 86215fb..7d844bb 100644 > --- a/examples/ipsec-secgw/ipsec-secgw.c > +++ b/examples/ipsec-secgw/ipsec-secgw.c > @@ -50,12 +50,11 @@ >=20 > #include "event_helper.h" > #include "ipsec.h" > +#include "ipsec_worker.h" > #include "parser.h" >=20 > volatile bool force_quit; >=20 > -#define RTE_LOGTYPE_IPSEC RTE_LOGTYPE_USER1 > - > #define MAX_JUMBO_PKT_LEN 9600 >=20 > #define MEMPOOL_CACHE_SIZE 256 > @@ -85,29 +84,6 @@ volatile bool force_quit; > static uint16_t nb_rxd =3D IPSEC_SECGW_RX_DESC_DEFAULT; > static uint16_t nb_txd =3D IPSEC_SECGW_TX_DESC_DEFAULT; >=20 > -#if RTE_BYTE_ORDER !=3D RTE_LITTLE_ENDIAN > -#define __BYTES_TO_UINT64(a, b, c, d, e, f, g, h) \ > - (((uint64_t)((a) & 0xff) << 56) | \ > - ((uint64_t)((b) & 0xff) << 48) | \ > - ((uint64_t)((c) & 0xff) << 40) | \ > - ((uint64_t)((d) & 0xff) << 32) | \ > - ((uint64_t)((e) & 0xff) << 24) | \ > - ((uint64_t)((f) & 0xff) << 16) | \ > - ((uint64_t)((g) & 0xff) << 8) | \ > - ((uint64_t)(h) & 0xff)) > -#else > -#define __BYTES_TO_UINT64(a, b, c, d, e, f, g, h) \ > - (((uint64_t)((h) & 0xff) << 56) | \ > - ((uint64_t)((g) & 0xff) << 48) | \ > - ((uint64_t)((f) & 0xff) << 40) | \ > - ((uint64_t)((e) & 0xff) << 32) | \ > - ((uint64_t)((d) & 0xff) << 24) | \ > - ((uint64_t)((c) & 0xff) << 16) | \ > - ((uint64_t)((b) & 0xff) << 8) | \ > - ((uint64_t)(a) & 0xff)) > -#endif > -#define ETHADDR(a, b, c, d, e, f) (__BYTES_TO_UINT64(a, b, c, d, e, f, 0= , 0)) > - > #define ETHADDR_TO_UINT64(addr) __BYTES_TO_UINT64( \ > (addr)->addr_bytes[0], (addr)->addr_bytes[1], \ > (addr)->addr_bytes[2], (addr)->addr_bytes[3], \ > @@ -119,18 +95,6 @@ static uint16_t nb_txd =3D IPSEC_SECGW_TX_DESC_DEFAUL= T; >=20 > #define MTU_TO_FRAMELEN(x) ((x) + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN) >=20 > -/* port/source ethernet addr and destination ethernet addr */ > -struct ethaddr_info { > - uint64_t src, dst; > -}; > - > -struct ethaddr_info ethaddr_tbl[RTE_MAX_ETHPORTS] =3D { > - { 0, ETHADDR(0x00, 0x16, 0x3e, 0x7e, 0x94, 0x9a) }, > - { 0, ETHADDR(0x00, 0x16, 0x3e, 0x22, 0xa1, 0xd9) }, > - { 0, ETHADDR(0x00, 0x16, 0x3e, 0x08, 0x69, 0x26) }, > - { 0, ETHADDR(0x00, 0x16, 0x3e, 0x49, 0x9e, 0xdd) } > -}; > - > struct flow_info flow_info_tbl[RTE_MAX_ETHPORTS]; >=20 > #define CMD_LINE_OPT_CONFIG "config" > @@ -183,6 +147,13 @@ static const struct option lgopts[] =3D { > {NULL, 0, 0, 0} > }; >=20 > +struct ethaddr_info ethaddr_tbl[RTE_MAX_ETHPORTS] =3D { > + { 0, ETHADDR(0x00, 0x16, 0x3e, 0x7e, 0x94, 0x9a) }, > + { 0, ETHADDR(0x00, 0x16, 0x3e, 0x22, 0xa1, 0xd9) }, > + { 0, ETHADDR(0x00, 0x16, 0x3e, 0x08, 0x69, 0x26) }, > + { 0, ETHADDR(0x00, 0x16, 0x3e, 0x49, 0x9e, 0xdd) } > +}; > + > /* mask of enabled ports */ > static uint32_t enabled_port_mask; > static uint64_t enabled_cryptodev_mask =3D UINT64_MAX; > diff --git a/examples/ipsec-secgw/ipsec-secgw.h b/examples/ipsec-secgw/ip= sec-secgw.h > index 5b19e29..926ce5d 100644 > --- a/examples/ipsec-secgw/ipsec-secgw.h > +++ b/examples/ipsec-secgw/ipsec-secgw.h > @@ -4,10 +4,79 @@ > #ifndef _IPSEC_SECGW_H_ > #define _IPSEC_SECGW_H_ >=20 > +#include > + > +#define NB_SOCKETS 4 > + > +#define MAX_PKT_BURST 32 > + > +#define RTE_LOGTYPE_IPSEC RTE_LOGTYPE_USER1 > + > #define NB_SOCKETS 4 Duplicate, NB_SOCKETS already defined, see above. >=20 > #define UNPROTECTED_PORT(portid) (unprotected_port_mask & (1 << portid)) As you are moving it anyway probably a good time to put portid param in (), or even make it a static inline function. >=20 > +#if RTE_BYTE_ORDER !=3D RTE_LITTLE_ENDIAN > +#define __BYTES_TO_UINT64(a, b, c, d, e, f, g, h) \ > + (((uint64_t)((a) & 0xff) << 56) | \ > + ((uint64_t)((b) & 0xff) << 48) | \ > + ((uint64_t)((c) & 0xff) << 40) | \ > + ((uint64_t)((d) & 0xff) << 32) | \ > + ((uint64_t)((e) & 0xff) << 24) | \ > + ((uint64_t)((f) & 0xff) << 16) | \ > + ((uint64_t)((g) & 0xff) << 8) | \ > + ((uint64_t)(h) & 0xff)) > +#else > +#define __BYTES_TO_UINT64(a, b, c, d, e, f, g, h) \ > + (((uint64_t)((h) & 0xff) << 56) | \ > + ((uint64_t)((g) & 0xff) << 48) | \ > + ((uint64_t)((f) & 0xff) << 40) | \ > + ((uint64_t)((e) & 0xff) << 32) | \ > + ((uint64_t)((d) & 0xff) << 24) | \ > + ((uint64_t)((c) & 0xff) << 16) | \ > + ((uint64_t)((b) & 0xff) << 8) | \ > + ((uint64_t)(a) & 0xff)) > +#endif > + > +#define ETHADDR(a, b, c, d, e, f) (__BYTES_TO_UINT64(a, b, c, d, e, f, 0= , 0)) > + > +struct traffic_type { > + const uint8_t *data[MAX_PKT_BURST * 2]; > + struct rte_mbuf *pkts[MAX_PKT_BURST * 2]; > + void *saptr[MAX_PKT_BURST * 2]; > + uint32_t res[MAX_PKT_BURST * 2]; > + uint32_t num; > +}; > + > +struct ipsec_traffic { > + struct traffic_type ipsec; > + struct traffic_type ip4; > + struct traffic_type ip6; > +}; > + > +/* Fields optimized for devices without burst */ > +struct traffic_type_nb { > + const uint8_t *data; > + struct rte_mbuf *pkt; > + uint32_t res; > + uint32_t num; > +}; > + > +struct ipsec_traffic_nb { > + struct traffic_type_nb ipsec; > + struct traffic_type_nb ip4; > + struct traffic_type_nb ip6; > +}; > + > +/* port/source ethernet addr and destination ethernet addr */ > +struct ethaddr_info { > + uint64_t src, dst; > +}; > + > +struct ethaddr_info ethaddr_tbl[RTE_MAX_ETHPORTS]; > + > +/* TODO: All var definitions need to be part of a .c file */ Seems like that TODO wasn't done :) Probably a good thing to add extern for all global vars declarations here, and keep actual definitions in ipsec-secgw.c. Same story for: +struct socket_ctx socket_ctx[NB_SOCKETS]; in ipsec.h > + > /* Port mask to identify the unprotected ports */ > uint32_t unprotected_port_mask; >=20