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 950ACA04B3; Mon, 23 Dec 2019 17:49:48 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 505C42BA3; Mon, 23 Dec 2019 17:49:47 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id D94F21252 for ; Mon, 23 Dec 2019 17:49:45 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Dec 2019 08:49:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,348,1571727600"; d="scan'208";a="391631718" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga005.jf.intel.com with ESMTP; 23 Dec 2019 08:49:44 -0800 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 23 Dec 2019 08:49:43 -0800 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 23 Dec 2019 08:49:43 -0800 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 23 Dec 2019 08:49:43 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.100) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 23 Dec 2019 08:49:42 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zh+1GP7uX15Ib5cXft1FH4ppYJz9GrEUf+v9R/3zS9fJcuWKqs/1JBDKMtihYiAKG/EImDX/bmnmSKd73LQG8kIiC0rM+dnsGnrjX6UHVWVzdPXsKZO6nz+pFw7GjOSza3UMwaqwsYXxCE26AUGmhjTxzkDlJchQzB2TtzW4THMr0KWoFCCfNKgHuvnS27gQa7L9M2mLN12BP7cyGAec1BCkiOyM/YCI6Mf9ltpvgIFT4kIHSzkarqIIkmAFDWxlzPPRSR5ysYSxNPAPHM6AgUH1FRyPsjW1ILaahu6rdWhY07VaDFaIz/xEKR97UaRmMe1B7LhM0zeNYW0PbBvcJA== 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=3ULRLU0ptM9Cy1lVoXrhrEOLPDSr+C5uucZUJM20QuQ=; b=ZOHfZkDq+/gCOlDbPN54QkvQpEbwq6b8NRU5Q8Fn2xIOQBwPjL2TRwsF3COjxl8O+o+mCfKhRMefR/hkpvXrih8c1w49oaZTAAiHYX4BqPNmqKnv5bot97TkzzSdWA+R15RCd9jBUGJgqONWddjmxzqsEle8RZBIjA9SGRFR4Tsr01YglSJOQ6IeZih4PlUrL6csMNdG2HsY3VK9d20bgkpffJlKcPR1aA6ywm2fY35IdrHoCV8eBQFjcs0MYouKdXIyZnU2dnqUOK8mEI4tT4t6uYFosfmssjxITzZyx9LZzRSpsKz42FE+eiKQVDr8lUsKj0yAlcpcimbYOxuZAw== 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=3ULRLU0ptM9Cy1lVoXrhrEOLPDSr+C5uucZUJM20QuQ=; b=dyc1PI2asT9WLrdEVjF0KNcYwqaKpMNZpL80XAp+7owXtYAxOxxSEH03/hjtO08mIZm65PTn3KtChU0VBtc3wPrcl39SOuo1Hp3KKbDOkBKsfQnn3VVR5m1T9W5+dgfw0BfdgI2JZZtwXurl3ON0sNPVs6jMETX45Bmn4VGY32g= Received: from SN6PR11MB2558.namprd11.prod.outlook.com (52.135.94.19) by SN6PR11MB2784.namprd11.prod.outlook.com (52.135.89.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2559.15; Mon, 23 Dec 2019 16:49:38 +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.2559.017; Mon, 23 Dec 2019 16:49:38 +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 11/14] examples/ipsec-secgw: add app processing code Thread-Index: AQHVrcOadPqTP1DsRkKLTgq8QBAlEKfH922w Date: Mon, 23 Dec 2019 16:49:38 +0000 Message-ID: References: <1575808249-31135-1-git-send-email-anoobj@marvell.com> <1575808249-31135-12-git-send-email-anoobj@marvell.com> In-Reply-To: <1575808249-31135-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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNWY5OWU0MWQtZmRhMC00ZTAxLWJjNTMtZGRiNmExMzc5YWU2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiSHd2bUdDeTdNaFhYb3NCSXg1SURFSTdhdHhCQTRlY3NhRHFhWTc0cjJBZnRtZno2aGZDMEdsQW5zMjlsMGM1ZyJ9 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.184] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e7e0df2e-7da6-4779-3f51-08d787c81964 x-ms-traffictypediagnostic: SN6PR11MB2784: 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:1468; x-forefront-prvs: 0260457E99 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(39860400002)(376002)(346002)(396003)(366004)(199004)(189003)(66946007)(7696005)(71200400001)(8676002)(81166006)(64756008)(66476007)(478600001)(66446008)(81156014)(66556008)(76116006)(54906003)(5660300002)(4326008)(6506007)(55016002)(110136005)(33656002)(9686003)(186003)(2906002)(316002)(8936002)(86362001)(52536014)(26005)(7416002); DIR:OUT; SFP:1102; SCL:1; SRVR:SN6PR11MB2784; 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: kZLatkCJ1rarJdJNOOqrY7+1AnbmZRv6kKfd+PYr19D/c/BvLsY88pRCgakwaHnvKMS2zhS8CA8R/FmkJYuRZG1ZOcZWVm6Ue3vHEfeBhEHc9O0Lz7C/0aahMy5T6FgYlb3Y3uZHK9919w0F0oEdN7j1QRYwnql40jZoDi2/Mytfez7Zve9aTTMQT/YIZL9Hj0tjX5c8lp3NM0du48+fLRxem1vjhlGyTByA63CInYgNfroP1McbthBlmVEXfBxSncdNiW8Eil4+DbJ965vwK4u++UUqWEOlnOeYinGU+u0RQSoo7Q3eqXoPJSSznNSqC3+TrEtauesIwIfcWzeXibOuXphgWrjQSXknPd3x5OQpWRMI/4eV4XSYKoqspAKWEfsh/UO1ZnpCwUcHwGji3TEd8ULA80YBbGFmstnCfu3S5M6+9iEkDYhH4m8BoaQi Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: e7e0df2e-7da6-4779-3f51-08d787c81964 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Dec 2019 16:49:38.3814 (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: GLWywi9nDVDD7nFhO93bl9AJvodXPpB4RlX7wslxND/nOGAEFKykW5u0jc3ec7NoaTDR2PrwtqKZ8p6IMVs9wfe6I56gm0cxZrUUWYP8ZI0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB2784 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH 11/14] examples/ipsec-secgw: add app processing code 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" >=20 > Add IPsec application processing code for event mode. >=20 > Signed-off-by: Anoob Joseph > Signed-off-by: Lukasz Bartosik > --- > examples/ipsec-secgw/ipsec-secgw.c | 124 ++++++------------ > examples/ipsec-secgw/ipsec-secgw.h | 81 ++++++++++++ > examples/ipsec-secgw/ipsec.h | 37 +++--- > examples/ipsec-secgw/ipsec_worker.c | 242 ++++++++++++++++++++++++++++++= ++++-- > examples/ipsec-secgw/ipsec_worker.h | 39 ++++++ > examples/ipsec-secgw/sa.c | 11 -- > 6 files changed, 409 insertions(+), 125 deletions(-) > create mode 100644 examples/ipsec-secgw/ipsec-secgw.h > 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 c5d95b9..2e7d4d8 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 > @@ -70,8 +69,6 @@ volatile bool force_quit; >=20 > #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ >=20 > -#define NB_SOCKETS 4 > - > /* Configure how many packets ahead to prefetch, when reading packets */ > #define PREFETCH_OFFSET 3 >=20 > @@ -79,8 +76,6 @@ volatile bool force_quit; >=20 > #define MAX_LCORE_PARAMS 1024 >=20 > -#define UNPROTECTED_PORT(port) (unprotected_port_mask & (1 << portid)) > - > /* > * Configurable number of RX/TX ring descriptors > */ > @@ -89,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], \ > @@ -123,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" > @@ -192,10 +152,16 @@ 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; > -static uint32_t unprotected_port_mask; > static int32_t promiscuous_on =3D 1; > static int32_t numa_on =3D 1; /**< NUMA is enabled by default. */ > static uint32_t nb_lcores; > @@ -283,8 +249,6 @@ static struct rte_eth_conf port_conf =3D { > }, > }; >=20 > -static struct socket_ctx socket_ctx[NB_SOCKETS]; > - > /* > * Determine is multi-segment support required: > * - either frame buffer size is smaller then mtu > @@ -2828,47 +2792,10 @@ main(int32_t argc, char **argv) >=20 > sa_check_offloads(portid, &req_rx_offloads, &req_tx_offloads); > port_init(portid, req_rx_offloads, req_tx_offloads); > - /* Create default ipsec flow for the ethernet device */ > - ret =3D create_default_ipsec_flow(portid, req_rx_offloads); > - if (ret) > - printf("Cannot create default flow, err=3D%d, port=3D%d\n", > - ret, portid); > } >=20 > cryptodevs_init(); >=20 > - /* start ports */ > - RTE_ETH_FOREACH_DEV(portid) { > - if ((enabled_port_mask & (1 << portid)) =3D=3D 0) > - continue; > - > - /* > - * Start device > - * note: device must be started before a flow rule > - * can be installed. > - */ > - ret =3D rte_eth_dev_start(portid); > - if (ret < 0) > - rte_exit(EXIT_FAILURE, "rte_eth_dev_start: " > - "err=3D%d, port=3D%d\n", ret, portid); > - /* > - * If enabled, put device in promiscuous mode. > - * This allows IO forwarding mode to forward packets > - * to itself through 2 cross-connected ports of the > - * target machine. > - */ > - if (promiscuous_on) { > - ret =3D rte_eth_promiscuous_enable(portid); > - if (ret !=3D 0) > - rte_exit(EXIT_FAILURE, > - "rte_eth_promiscuous_enable: err=3D%s, port=3D%d\n", > - rte_strerror(-ret), portid); > - } > - > - rte_eth_dev_callback_register(portid, > - RTE_ETH_EVENT_IPSEC, inline_ipsec_event_callback, NULL); > - } > - > /* fragment reassemble is enabled */ > if (frag_tbl_sz !=3D 0) { > ret =3D reassemble_init(); > @@ -2889,8 +2816,6 @@ main(int32_t argc, char **argv) > } > } >=20 > - check_all_ports_link_status(enabled_port_mask); > - > /* > * Set the enabled port mask in helper config for use by helper > * sub-system. This will be used while intializing devices using > @@ -2903,6 +2828,39 @@ main(int32_t argc, char **argv) > if (ret < 0) > rte_exit(EXIT_FAILURE, "eh_devs_init failed, err=3D%d\n", ret); >=20 > + /* Create default ipsec flow for each port and start each port */ > + RTE_ETH_FOREACH_DEV(portid) { > + if ((enabled_port_mask & (1 << portid)) =3D=3D 0) > + continue; > + > + ret =3D create_default_ipsec_flow(portid, req_rx_offloads); That doesn't look right. For more than one eth port in the system, req_rx_offloads will be overwritt= en by that moment. > + if (ret) > + printf("create_default_ipsec_flow failed, err=3D%d, " > + "port=3D%d\n", ret, portid); > + /* > + * Start device > + * note: device must be started before a flow rule > + * can be installed. > + */ > + ret =3D rte_eth_dev_start(portid); Moving that piece of code (dev_start) after sa_init() breaks ixgbe inline-c= rypto support. As I understand, because configured ipsec flows don't persist dev_start(). At least for ixgbe PMD. Any reason why to move that code at all? > + if (ret < 0) > + rte_exit(EXIT_FAILURE, "rte_eth_dev_start: " > + "err=3D%d, port=3D%d\n", ret, portid); > + /* > + * If enabled, put device in promiscuous mode. > + * This allows IO forwarding mode to forward packets > + * to itself through 2 cross-connected ports of the > + * target machine. > + */ > + if (promiscuous_on) > + rte_eth_promiscuous_enable(portid); > + > + rte_eth_dev_callback_register(portid, > + RTE_ETH_EVENT_IPSEC, inline_ipsec_event_callback, NULL); > + } > + > + check_all_ports_link_status(enabled_port_mask); > + > /* launch per-lcore init on every lcore */ > rte_eal_mp_remote_launch(ipsec_launch_one_lcore, eh_conf, CALL_MASTER); >=20