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 C8FE0A04B3; Mon, 23 Dec 2019 18:28:20 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0ACE21C01; Mon, 23 Dec 2019 18:28:20 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 99D171252 for ; Mon, 23 Dec 2019 18:28:18 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Dec 2019 09:28:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,348,1571727600"; d="scan'208";a="207333448" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga007.jf.intel.com with ESMTP; 23 Dec 2019 09:28:17 -0800 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 23 Dec 2019 09:28:16 -0800 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 23 Dec 2019 09:28:16 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.171) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 23 Dec 2019 09:28:16 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ocdzd6JN3bkTVyD+jALUztusUesjahCGHK0jvrudbHg9gI9G71zjXu9Syl3RMnKjyFs8SGDatC0kyeF5qEqz86WV8IxeFxkCH9uxLD0SIC+CZW6j6UOFtISi5EfXSWmAdMY8RrQVv01Vtj3UT5lNB89l5Z5yedwnmtDP3NqgWHvTiIWqKAITv8S5RPPe71N6SXjbys/IxtGNlJ6OLZA4Js+43DWjkk3DTiOABKDVwEmX8yqlgfRJ3nUOHWI2eccmeX9f6VsWtj9p58DL+Py8SSwOnL76AtQ/2mr7YyabNCxjj4hELRKxa+xeXUkMrQ+BuugOvP8MCdbBXT70F6sJ/A== 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=QUmgl+Ys0KAM23gK+PJrVUjW6CqGQ+ELuXuGtBJuc5c=; b=LtB4wYbnu+C8xEUY4nLYvSX2D13vx9qAEl2els9eJ3AKdJN1o9eMcJ1XTWPGWMnjdXDtCcAwG4oxzZlwIgL0ThV/fkycMGNzaH8M92jEokslOIGPrFwyDrqQD2IACnNbKccesrREuZIYHHEp6hJGG4doFJUefkUwvieMrNgUceln9ZD5z5cSkr31fsEwL5+s/RwQMxZ9HrKOHIjJ0C9l19KcU1Va+FxSGfXSQGpVcEcuPFJskKAxOSyApL01Vp8fxJnsiXawAHiDCLdILfgNNZlT/zgEZ7Ocsk5KL25I+lGiBz+/QH5Sy02iXvkFGMX53f/4IThrhDUn65g+mlnpbg== 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=QUmgl+Ys0KAM23gK+PJrVUjW6CqGQ+ELuXuGtBJuc5c=; b=sHJIaH6h09msVMBa+zgbirU47pQo161FUnPQiiGYo5Uos84bX9As/CrjCZYk8N5xMpL+DwxEbJASOGjbanKHOBCDV+xUz2hg9g/CCiIY4ya5jsvwxcsMAoMju7ZK8YyQ9ZE0/XCXy0HvKiyKiMVikjamfwl80AGzVUuF9+CxqVs= Received: from SN6PR11MB2558.namprd11.prod.outlook.com (52.135.94.19) by SN6PR11MB3454.namprd11.prod.outlook.com (52.135.110.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2559.14; Mon, 23 Dec 2019 17:28:14 +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 17:28:14 +0000 From: "Ananyev, Konstantin" To: Anoob Joseph , Akhil Goyal , "Nicolau, Radu" , Thomas Monjalon CC: Ankur Dwivedi , Jerin Jacob , Narayana Prasad , Archana Muniganti , Tejasree Kondoj , "Vamsi Attunuru" , Lukasz Bartosik , "dev@dpdk.org" Thread-Topic: [PATCH 12/14] examples/ipsec-secgw: add driver outbound worker Thread-Index: AQHVrcObmnDTU18PTEqxffjPihYmT6fIDP4A Date: Mon, 23 Dec 2019 17:28:14 +0000 Message-ID: References: <1575808249-31135-1-git-send-email-anoobj@marvell.com> <1575808249-31135-13-git-send-email-anoobj@marvell.com> In-Reply-To: <1575808249-31135-13-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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMWZkODEyNTQtMzA1ZC00ZmQ3LWEyZjItNTQ3YjllODI1MjcyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoib1wvYjNqUCtcL1Rmek9ReTNJNGM3d1F4SG1FbWhrMkZQNkdsR0JVWkNsTWJOSTVMVmxsVExpRTRqeE1xK2JpUVF3In0= 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: 7c4f4942-d39a-47e7-9756-08d787cd7dc8 x-ms-traffictypediagnostic: SN6PR11MB3454: 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:4303; x-forefront-prvs: 0260457E99 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(366004)(396003)(39860400002)(136003)(376002)(199004)(189003)(186003)(478600001)(9686003)(52536014)(6506007)(76116006)(66446008)(66556008)(64756008)(71200400001)(66476007)(7696005)(26005)(7416002)(55016002)(5660300002)(316002)(8936002)(86362001)(33656002)(2906002)(81156014)(110136005)(81166006)(54906003)(8676002)(4326008)(66946007); DIR:OUT; SFP:1102; SCL:1; SRVR:SN6PR11MB3454; 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: Fx0TMZusFnXetHqvvSPovfdsOOZFUYzxQSfmzlINxfuiAMm/XiGNiwjFuLTy32aOJLBQYITxQu/nbjVJX7cZYXYlGqgOfqRTo28DIYYaEcw4VsehRDdOCMsj0U6LDKBCUh0LKQ290ZAk784sSfbfOYRBUHUYb7xsAncXFpV4n5DAlfwLET55QrHCTAQvTXnDlccoZ3RC7ijTZr13TxH+iF6pTseEqY2q2kjH87e1jmgeg2SNY7syHhXhx8ocx5U9OeQh7HCTF/CdWex8pF4zx8GaL5Eexyx008dqmP3NVQXKYlho6GWDLmiMbl3FbUo3SSEPF914mlyMjU/fKXoQo2Ela1k2GkP+6W1+vIqCS+m5vNV7twKSJvlAuXyn07zr3WO5lzObkFAt4YXhgwaPhIhDV3SrxxdlfhDmq3UmZmMZ81deD/DFdeNyrNIjC+9J Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 7c4f4942-d39a-47e7-9756-08d787cd7dc8 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Dec 2019 17:28:14.3448 (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: /rWLUWONI+OyG4X7LO7EEf5MZ8v1IINorMrILIGoMyqvugcrv4AN0uhsWDKIWp+S68Ev/nJmosPqg5Jd5DQgmyg1Uz8ZcpXs0AIJn0BkxM8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3454 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH 12/14] examples/ipsec-secgw: add driver outbound 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" > This patch adds the driver outbound worker thread for ipsec-secgw. > In this mode the security session is a fixed one and sa update > is not done. >=20 > Signed-off-by: Ankur Dwivedi > Signed-off-by: Anoob Joseph > Signed-off-by: Lukasz Bartosik > --- > examples/ipsec-secgw/ipsec-secgw.c | 12 +++++ > examples/ipsec-secgw/ipsec.c | 9 ++++ > examples/ipsec-secgw/ipsec_worker.c | 90 +++++++++++++++++++++++++++++++= +++++- > 3 files changed, 110 insertions(+), 1 deletion(-) >=20 > diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ip= sec-secgw.c > index 2e7d4d8..76719f2 100644 > --- a/examples/ipsec-secgw/ipsec-secgw.c > +++ b/examples/ipsec-secgw/ipsec-secgw.c > @@ -2011,6 +2011,18 @@ cryptodevs_init(void) > i++; > } >=20 > + /* > + * Set the queue pair to at least the number of ethernet > + * devices for inline outbound. > + */ > + qp =3D RTE_MAX(rte_eth_dev_count_avail(), qp); Not sure, what for? Why we can't process packets from several eth devs on the same crypto-dev q= ueue? > + > + /* > + * The requested number of queues should never exceed > + * the max available > + */ > + qp =3D RTE_MIN(qp, max_nb_qps); > + > if (qp =3D=3D 0) > continue; >=20 > diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c > index e529f68..9ff8a63 100644 > --- a/examples/ipsec-secgw/ipsec.c > +++ b/examples/ipsec-secgw/ipsec.c > @@ -141,6 +141,10 @@ create_lookaside_session(struct ipsec_ctx *ipsec_ctx= , struct ipsec_sa *sa, > return 0; > } >=20 > +uint16_t sa_no; > +#define MAX_FIXED_SESSIONS 10 > +struct rte_security_session *sec_session_fixed[MAX_FIXED_SESSIONS]; > + > int > create_inline_session(struct socket_ctx *skt_ctx, struct ipsec_sa *sa, > struct rte_ipsec_session *ips) > @@ -401,6 +405,11 @@ create_inline_session(struct socket_ctx *skt_ctx, st= ruct ipsec_sa *sa, >=20 > ips->security.ol_flags =3D sec_cap->ol_flags; > ips->security.ctx =3D sec_ctx; > + if (sa_no < MAX_FIXED_SESSIONS) { > + sec_session_fixed[sa_no] =3D > + ipsec_get_primary_session(sa)->security.ses; > + sa_no++; > + } > } Totally lost what is the purpose of these changes... Why first 10 inline-proto are special and need to be saved inside global ar= ray (sec_session_fixed)? Why later, in ipsec_worker.c this array is referenced by eth port_id? What would happen if number of inline-proto sessions is less than number of= eth ports? =20 > set_cdev_id: > diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/i= psec_worker.c > index 2af9475..e202277 100644 > --- a/examples/ipsec-secgw/ipsec_worker.c > +++ b/examples/ipsec-secgw/ipsec_worker.c > @@ -263,7 +263,7 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struc= t route_table *rt, > */ >=20 > /* Workers registered */ > -#define IPSEC_EVENTMODE_WORKERS 2 > +#define IPSEC_EVENTMODE_WORKERS 3 >=20 > /* > * Event mode worker > @@ -423,6 +423,84 @@ ipsec_wrkr_non_burst_int_port_app_mode_inb(struct eh= _event_link_info *links, > return; > } >=20 > +/* > + * Event mode worker > + * Operating parameters : non-burst - Tx internal port - driver mode - o= utbound > + */ > +extern struct rte_security_session *sec_session_fixed[]; > +static void > +ipsec_wrkr_non_burst_int_port_drvr_mode_outb(struct eh_event_link_info *= links, > + uint8_t nb_links) > +{ > + unsigned int nb_rx =3D 0; > + struct rte_mbuf *pkt; > + unsigned int port_id; > + struct rte_event ev; > + uint32_t lcore_id; > + > + /* Check if we have links registered for this lcore */ > + if (nb_links =3D=3D 0) { > + /* No links registered - exit */ > + goto exit; > + } > + > + /* Get core ID */ > + lcore_id =3D rte_lcore_id(); > + > + RTE_LOG(INFO, IPSEC, > + "Launching event mode worker (non-burst - Tx internal port - " > + "driver mode - outbound) on lcore %d\n", lcore_id); > + > + /* We have valid links */ > + > + /* Check if it's single link */ > + if (nb_links !=3D 1) { > + RTE_LOG(INFO, IPSEC, > + "Multiple links not supported. Using first link\n"); > + } > + > + RTE_LOG(INFO, IPSEC, " -- lcoreid=3D%u event_port_id=3D%u\n", lcore_id, > + links[0].event_port_id); > + while (!force_quit) { > + /* Read packet from event queues */ > + nb_rx =3D rte_event_dequeue_burst(links[0].eventdev_id, > + links[0].event_port_id, > + &ev, /* events */ > + 1, /* nb_events */ > + 0 /* timeout_ticks */); > + > + if (nb_rx =3D=3D 0) > + continue; > + > + port_id =3D ev.queue_id; > + pkt =3D ev.mbuf; > + > + rte_prefetch0(rte_pktmbuf_mtod(pkt, void *)); > + > + /* Process packet */ > + ipsec_event_pre_forward(pkt, port_id); > + > + pkt->udata64 =3D (uint64_t) sec_session_fixed[port_id]; > + > + /* Mark the packet for Tx security offload */ > + pkt->ol_flags |=3D PKT_TX_SEC_OFFLOAD; > + > + /* > + * Since tx internal port is available, events can be > + * directly enqueued to the adapter and it would be > + * internally submitted to the eth device. > + */ > + rte_event_eth_tx_adapter_enqueue(links[0].eventdev_id, > + links[0].event_port_id, > + &ev, /* events */ > + 1, /* nb_events */ > + 0 /* flags */); > + } > + > +exit: > + return; > +} > + > static uint8_t > ipsec_eventmode_populate_wrkr_params(struct eh_app_worker_params *wrkrs) > { > @@ -449,6 +527,16 @@ ipsec_eventmode_populate_wrkr_params(struct eh_app_w= orker_params *wrkrs) > wrkr->cap.ipsec_dir =3D EH_IPSEC_DIR_TYPE_INBOUND; > wrkr->worker_thread =3D ipsec_wrkr_non_burst_int_port_app_mode_inb; >=20 > + wrkr++; > + nb_wrkr_param++; > + > + /* Non-burst - Tx internal port - driver mode - outbound */ > + wrkr->cap.burst =3D EH_RX_TYPE_NON_BURST; > + wrkr->cap.tx_internal_port =3D EH_TX_TYPE_INTERNAL_PORT; > + wrkr->cap.ipsec_mode =3D EH_IPSEC_MODE_TYPE_DRIVER; > + wrkr->cap.ipsec_dir =3D EH_IPSEC_DIR_TYPE_OUTBOUND; > + wrkr->worker_thread =3D ipsec_wrkr_non_burst_int_port_drvr_mode_outb; > + > nb_wrkr_param++; > return nb_wrkr_param; > } > -- > 2.7.4