From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 57839A0C41; Wed, 15 Sep 2021 16:34:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4193B4068F; Wed, 15 Sep 2021 16:34:29 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 498634014F for ; Wed, 15 Sep 2021 16:34:27 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10107"; a="283336234" X-IronPort-AV: E=Sophos;i="5.85,295,1624345200"; d="scan'208";a="283336234" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2021 07:34:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,295,1624345200"; d="scan'208";a="651222020" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga005.jf.intel.com with ESMTP; 15 Sep 2021 07:34:12 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 15 Sep 2021 07:34:11 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Wed, 15 Sep 2021 07:34:11 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.169) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Wed, 15 Sep 2021 07:34:11 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I5xSPwjLkZa8qdaH7MpTkUSDm4fqC0ZVDbmUXHLf/XRzS9dgpiuVhrxKD1RgT1GwdMHcOWrzWt9OrgYoGvQplxXlMiMYbZKw/IpUqPRrjq3PZH4uskn6unhRdyXAqkAukCJmaMoA1BTE9MjKLPU3OqeLyKkQj25PwVnmjxu2SJOfnWo4B9PEEU+lmJTA2yjnzUL4ghoFGDrHNe/k5Qd8YIUahDcFgKWL0AohrkFvIgL0RidXEaVHBfP//E6Ce3/jKciQYrCiY4WBXOqsQrFLEWOiEuQN9K6ChWkzexsmU6b+qxQPhygJcpDD0XzHYWj6qpaU7DA7BWxrbbnAiUuHnQ== 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; bh=FQ6JF8dFGxKeahSOxRrN3wTX97XHvTYK6Mg3TbnCmUA=; b=Kd3zo2ZxWOQ2auzV9iT/om3fa7PsabKh5+0h9sDdgq8tGL2nSyyHTD0JbAvxMKMirGbOUz6N5b3sL0TGlROiYkIcv1e1ntG+7a18eUSiCWydgj//dRB8qJZdMGZf/gkeUyRDsuqCdJUdCkrCftUTk+WJPYytshnlZv8AaDCi8RM4sSgoD8mTi/Ka0H8nd0OdHMsTpcr77Zppc23T2xZ64fSIg3Qd9im0d0BFcKbWKq959+WxBEe/VAa2L1ICyPZXekLBPr7zmxR0rKs6Ggnd3uoyWxpEmEg+bAZrwE86wmnyFc5j0TyC7fxaDRorPy5D+Ug0DP2+ZfVukHbZ0KmHYQ== 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=FQ6JF8dFGxKeahSOxRrN3wTX97XHvTYK6Mg3TbnCmUA=; b=ygFXnMgpT2OKjfiYfrrvrxiJDiucrvYP2MYQUW0XJwRbfWJn8nB+Xvp3V4qv4hsrJhYU+AOEv0c1x7HDRhh8pTBzwx1BUrVSg5Z/xqJCBFl/gpPvrmw1uuKDO+7K87i6yHHpJkhSaIIQOfpvVxcsNmNiKMc1pJ4/LWMtFXDz+4s= Received: from BY5PR11MB4482.namprd11.prod.outlook.com (2603:10b6:a03:1ca::33) by BY5PR11MB3960.namprd11.prod.outlook.com (2603:10b6:a03:185::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Wed, 15 Sep 2021 14:34:10 +0000 Received: from BY5PR11MB4482.namprd11.prod.outlook.com ([fe80::a850:4ae9:9444:7334]) by BY5PR11MB4482.namprd11.prod.outlook.com ([fe80::a850:4ae9:9444:7334%5]) with mapi id 15.20.4500.019; Wed, 15 Sep 2021 14:34:10 +0000 From: "Ananyev, Konstantin" To: Nithin Dabilpuram , "jerinj@marvell.com" , "gakhil@marvell.com" , "Zhang, Roy Fan" , "hemant.agrawal@nxp.com" , "matan@nvidia.com" CC: "dev@dpdk.org" , "Yigit, Ferruh" , "Nicolau, Radu" , "olivier.matz@6wind.com" , "g.singh@nxp.com" , "Doherty, Declan" , "jiawenwu@trustnetic.com" Thread-Topic: [PATCH v5 3/3] examples/ipsec-secgw: update event mode inline path Thread-Index: AQHXqXvhl1wWkhDQgEyt56nVg1PcnaulKmwQ Date: Wed, 15 Sep 2021 14:34:09 +0000 Message-ID: References: <20210624102848.3878788-1-gakhil@marvell.com> <20210914151434.29922-1-ndabilpuram@marvell.com> <20210914151434.29922-4-ndabilpuram@marvell.com> In-Reply-To: <20210914151434.29922-4-ndabilpuram@marvell.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 authentication-results: marvell.com; dkim=none (message not signed) header.d=none;marvell.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8640193b-60c1-4ca3-bc87-08d97855e18a x-ms-traffictypediagnostic: BY5PR11MB3960: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4502; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: laB1kM9e5ETokY9ra4/atAyt3gihAxYf4RN/LQpdUAe+be8jJJWoxCc3sLl7hIM0gTkFxtRQ2Va2sW/uoyCaYDQEYnFQs2RcLA5OBspFZsVfB8XUorS88njWypXK/xDNyyMw7P4IOkm1e04VtIwT6PV1wpjueMLyXG9vbBoqfqcOOXWewar3Z3uHg0AAjWDLULWNlT1QcV6voabuJb0zEy3JoPsiRy7/7D4ieLd+OlgzuslEqVdnfNdyWdsykqh2giW0y8hh168aCqXeVI3cN3iW+9KpHyNqBfdXxdP954AKqjblU83M/qhtqP9gdh8kJUpb+KGKV4S0GcQbXnaR2AhnkwZW1fnoL+zvs0OoEy/nr2dIfOuJ+sWANhrw7+yP7+2NZEmb/hbsybysjmyTNIvIrkiLRRsljizTxc9h++ascyC9KBmvM8s1YQmOOo6GF9lIoZf9glgSoELWdVztiVTTp9qCCIKyx44Je8aAXjy/flsuaaQjMBb6yphySjNbLzK8YIlOsnP/t7DQd8XD6r00LGCtFBS25gQJG7VclznRF440D2f4z09K+J4QYrYWWYeAAp16e87SbCOJ/sRQCJh5W4PKZJOuS2fbIax4LnfqlvV7TW3MBujuVDVqoWHr9TS6BQHpWm3rdr/9ZVIA05hGl5qnSZA42vJtfJ5cWbbHcuz10w6uaM096aAlKZATz73+MidpqAGpPD+oHn4FmQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR11MB4482.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(136003)(39860400002)(396003)(346002)(366004)(316002)(5660300002)(15650500001)(7696005)(8936002)(66946007)(54906003)(71200400001)(38100700002)(186003)(64756008)(66446008)(66556008)(33656002)(66476007)(26005)(86362001)(122000001)(110136005)(2906002)(76116006)(55236004)(8676002)(83380400001)(38070700005)(52536014)(9686003)(4326008)(55016002)(478600001)(6506007); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?p0f9IHALOKG345+0/yZ5lAC37XAbyC6AOuNSdBy8V5RqkjhFhj4iq3D72Mt1?= =?us-ascii?Q?kcsX1wxstTP51qw6Mxh7ntk3dUG+q+6dyhnq6NTCeJqJg0baPrfmghfKUwIG?= =?us-ascii?Q?FNlM4jHyWpC66ZekJ/5lgeeFhGBmCDl/EUYSMWpSoS+hLBtHxDU0MjL/Df9h?= =?us-ascii?Q?CmmxhnIKBxsjIxZjVK8DGh+x4yMvtRw2JWw2dpQV1kKlzce5irWvVnSxrCa5?= =?us-ascii?Q?dBHVaZ0MIlei8wt1yU9gRnygcAsD1xl+69wy8l8+WzXHWGvsIbkSGsh1CbfV?= =?us-ascii?Q?YbU3g+hpkE7RQJXfVu9Aqu/yGIqdgJOUC/3isOjlbq5U0YYx6t0FHY8eApgf?= =?us-ascii?Q?tFm5sOjmVe8KsWLZhHlvFdZkrQUERDwYEQmH0AejTRnXXhQWU2pHgVTeJ1mK?= =?us-ascii?Q?QYNixXYfxuQT8F1q2gyHhkU0ge/6OqY4U5oFVtsVHC+m0BeVfk5dtal+s062?= =?us-ascii?Q?sLPno/tKZUuBR0gMUTYmvsfE9DgnPFZT6T3uP/IVVtQZ2GoO3O9p3mEESwym?= =?us-ascii?Q?yI/XMP+1dNO1oBhI/nTeqdG3ouYxS/iboSlpKuedzE9D/GJM9lIfQZJ7ygla?= =?us-ascii?Q?Cn5dRnNwW1t6Msmhe8l6jzEWCTWHnTTxyNeTzpRj60ryVtLuYLZCZzD8AZyv?= =?us-ascii?Q?s7Ros5l1u9VenBefA9zGtgFr0C2AwRWWZheDTNJRSXEAOKvojw8h2Hpr/bxd?= =?us-ascii?Q?lCZrn1gN35mVIOc65bKFNM9oz16KV8Vt3V5NSSqpTHMowLuNVD8ClEZZQc8F?= =?us-ascii?Q?l69MWaTsnHpH6bzlFX6a6DfkJARnCHFTMH6/kcQ1Nb3ONRxRUscNguxH1JP+?= =?us-ascii?Q?QeF0rNpAeBLPPsyqKn8UHq64KLR1+p2VvItvkVgL38SyZ1VXTGPqP7ox+BFC?= =?us-ascii?Q?k7NRCwCS0P93cfYoWU0/3VO3CUvtFIkq1c/ZLMqaqiCsx6gGDG38n4OUlhT3?= =?us-ascii?Q?2sKerd3P23zRAgypAnK6lzIdhqoXlU8oU+RvC/2KPdmxvaZQPRh9dwlpY7Ga?= =?us-ascii?Q?QmRTQjgE4hnBZaIxSGrI18vzSEZUhsXHfVBasOptLrpefFc59LSHxFdU8XkY?= =?us-ascii?Q?XQ8Wf2t9qVweyCI5fBnuERyJAtIOsCeNz93i1vof/tPTqDmNBw7EDUoiWPJm?= =?us-ascii?Q?x/4v98tyTbWNewvh78J09oggmWnV8YF2j/MX+WCNv2BcO6m3hd/YpqrSsR8V?= =?us-ascii?Q?gJ67Clnuio0ewlZ2S0n3Cpo9pGqHGxBZihaykDrIUrmUMjzYXgPHLMFi5No7?= =?us-ascii?Q?o9j9l57hDc+JAt8/d0LmN+w+QQEOOHEvx8SdOOnYNW9h8S7hhwNKUaeTckzD?= =?us-ascii?Q?8eNtYlx1L/griOwIiXnSwTLc?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR11MB4482.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8640193b-60c1-4ca3-bc87-08d97855e18a X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Sep 2021 14:34:09.9955 (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: K3p2Belx1hvqSHf+MJvwz0xryKvSBdYkwPed+N6xaIk1rgVcOioebZ9G2DzP4i4XdgWMStEZ5LYYxyz5rvrGUOFUc/rcZOuTErPJPxV+L2c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR11MB3960 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v5 3/3] examples/ipsec-secgw: update event mode inline path X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" > Update mbuf.l2_len with L2 header size for outbound > inline processing. >=20 > This patch also fixes a bug in arg parsing. >=20 > Signed-off-by: Nithin Dabilpuram > Acked-by: Akhil Goyal > --- > examples/ipsec-secgw/ipsec-secgw.c | 2 ++ > examples/ipsec-secgw/ipsec_worker.c | 41 ++++++++++++++++++++++++-------= ------ > 2 files changed, 29 insertions(+), 14 deletions(-) >=20 > diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ip= sec-secgw.c > index f252d34..7ad94cb 100644 > --- a/examples/ipsec-secgw/ipsec-secgw.c > +++ b/examples/ipsec-secgw/ipsec-secgw.c > @@ -1495,6 +1495,8 @@ parse_portmask(const char *portmask) > char *end =3D NULL; > unsigned long pm; >=20 > + errno =3D 0; > + > /* parse hexadecimal string */ > pm =3D strtoul(portmask, &end, 16); > if ((portmask[0] =3D=3D '\0') || (end =3D=3D NULL) || (*end !=3D '\0')) > diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/i= psec_worker.c > index 647e22d..c545497 100644 > --- a/examples/ipsec-secgw/ipsec_worker.c > +++ b/examples/ipsec-secgw/ipsec_worker.c > @@ -12,6 +12,11 @@ > #include "ipsec-secgw.h" > #include "ipsec_worker.h" >=20 > +struct port_drv_mode_data { > + struct rte_security_session *sess; > + struct rte_security_ctx *ctx; > +}; > + > static inline enum pkt_type > process_ipsec_get_pkt_type(struct rte_mbuf *pkt, uint8_t **nlp) > { > @@ -60,7 +65,8 @@ ipsec_event_pre_forward(struct rte_mbuf *m, unsigned in= t port_id) >=20 > static inline void > prepare_out_sessions_tbl(struct sa_ctx *sa_out, > - struct rte_security_session **sess_tbl, uint16_t size) > + struct port_drv_mode_data *data, > + uint16_t size) > { > struct rte_ipsec_session *pri_sess; > struct ipsec_sa *sa; > @@ -95,9 +101,10 @@ prepare_out_sessions_tbl(struct sa_ctx *sa_out, > } >=20 > /* Use only first inline session found for a given port */ > - if (sess_tbl[sa->portid]) > + if (data[sa->portid].sess) > continue; > - sess_tbl[sa->portid] =3D pri_sess->security.ses; > + data[sa->portid].sess =3D pri_sess->security.ses; > + data[sa->portid].ctx =3D pri_sess->security.ctx; > } > } >=20 > @@ -356,9 +363,8 @@ process_ipsec_ev_outbound(struct ipsec_ctx *ctx, stru= ct route_table *rt, > goto drop_pkt_and_exit; > } >=20 > - if (sess->security.ol_flags & RTE_SECURITY_TX_OLOAD_NEED_MDATA) > - *(struct rte_security_session **)rte_security_dynfield(pkt) =3D > - sess->security.ses; > + rte_security_set_pkt_metadata(sess->security.ctx, > + sess->security.ses, pkt, NULL); >=20 > /* Mark the packet for Tx security offload */ > pkt->ol_flags |=3D PKT_TX_SEC_OFFLOAD; > @@ -367,6 +373,9 @@ process_ipsec_ev_outbound(struct ipsec_ctx *ctx, stru= ct route_table *rt, > port_id =3D sa->portid; >=20 > send_pkt: > + /* Provide L2 len for Outbound processing */ > + pkt->l2_len =3D RTE_ETHER_HDR_LEN; > + > /* Update mac addresses */ > update_mac_addrs(pkt, port_id); >=20 > @@ -398,7 +407,7 @@ static void > ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_event_link_info *links, > uint8_t nb_links) > { > - struct rte_security_session *sess_tbl[RTE_MAX_ETHPORTS] =3D { NULL }; > + struct port_drv_mode_data data[RTE_MAX_ETHPORTS]; > unsigned int nb_rx =3D 0; > struct rte_mbuf *pkt; > struct rte_event ev; > @@ -412,6 +421,8 @@ ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_even= t_link_info *links, > return; > } >=20 > + memset(&data, 0, sizeof(struct port_drv_mode_data)); > + > /* Get core ID */ > lcore_id =3D rte_lcore_id(); >=20 > @@ -422,8 +433,8 @@ ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_even= t_link_info *links, > * Prepare security sessions table. In outbound driver mode > * we always use first session configured for a given port > */ > - prepare_out_sessions_tbl(socket_ctx[socket_id].sa_out, sess_tbl, > - RTE_MAX_ETHPORTS); > + prepare_out_sessions_tbl(socket_ctx[socket_id].sa_out, data, > + RTE_MAX_ETHPORTS); >=20 > RTE_LOG(INFO, IPSEC, > "Launching event mode worker (non-burst - Tx internal port - " > @@ -460,19 +471,21 @@ ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_ev= ent_link_info *links, >=20 > if (!is_unprotected_port(port_id)) { >=20 > - if (unlikely(!sess_tbl[port_id])) { > + if (unlikely(!data[port_id].sess)) { > rte_pktmbuf_free(pkt); > continue; > } >=20 > /* Save security session */ > - if (rte_security_dynfield_is_registered()) > - *(struct rte_security_session **) > - rte_security_dynfield(pkt) =3D > - sess_tbl[port_id]; > + rte_security_set_pkt_metadata(data[port_id].ctx, > + data[port_id].sess, pkt, > + NULL); >=20 > /* Mark the packet for Tx security offload */ > pkt->ol_flags |=3D PKT_TX_SEC_OFFLOAD; > + > + /* Provide L2 len for Outbound processing */ > + pkt->l2_len =3D RTE_ETHER_HDR_LEN; > } >=20 > /* > -- Acked-by: Konstantin Ananyev > 2.8.4