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 D3A3DA0C47; Tue, 12 Oct 2021 18:26:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 99A17410DB; Tue, 12 Oct 2021 18:26:28 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 4D97540E01 for ; Tue, 12 Oct 2021 18:26:26 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10135"; a="250602804" X-IronPort-AV: E=Sophos;i="5.85,368,1624345200"; d="scan'208";a="250602804" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2021 09:26:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,368,1624345200"; d="scan'208";a="591829395" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by orsmga004.jf.intel.com with ESMTP; 12 Oct 2021 09:26:02 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 12 Oct 2021 09:26:01 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Tue, 12 Oct 2021 09:26:01 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.171) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Tue, 12 Oct 2021 09:26:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=heu92awjQ3uSsfbbPM7NhLP8x+eDZ3wOB6Dm0VELNVsomCFkfX83UUEqBCmI6kJBTN3Vb0f5gd3GF0MDnVG8Wh/USBNw9vSziJ1Nn3t3cYJgJGcXX9sYSR9iZ9Dnz+GI4mVzyya1Uwa8TSwPcygVr/H4Qi4bgn+e2e+1dDZqwtjR4276tUu9fIRlvO5bKWtWk5TV7HJegv+jwugAtMBoHAlOKhA0Of4l2XPxljetFEZMQE8L3b/mjrt1gTErHU7eeCS4D6sAnzmWz6sNDqdBHdkIp21Ji6gAeoPaIASlg60710itFb4m4cKMWRShFw8RbE/AGL8CO8wQqUHqDC9kYQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lu9kfOm3mRdLhryL8MUkdLUOdkmfOUG/pVei5G2cTpQ=; b=HmjfkF5gmn8UiXLxXhuDWUb126wJvSvuwz5WObzjlo06Y78J2pTVSmfMTe6J/DArTVm5f+xCZM17MJoSed0PUrPYmQp92NEJ6LUKxagCPJMj+ScZg6gPox9u1t8/t2VgTPpVmRHFSa0ePYDQc5oiOBKTO+WD5oTnEePQRkTU/tdSuJNOdYaGJIiVded6PLknMvphLBzHlSPhFm6G0wrW5fB5VAK6IFCYotkwGciVfptfC6q9Q/uio1RvNtj2+GveleOfj2mYkVFPsWUkOZYotiVaDbIIZtiYad0q/U47LkqOR5mSGH7tyQYK8X/saeo80gAbegpM0wBMLq2doxwOIw== 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=lu9kfOm3mRdLhryL8MUkdLUOdkmfOUG/pVei5G2cTpQ=; b=aVghz5wWZfdw9WKM1zhVLFcQBcxKv5bLr/OippAUSinx49TUGfzCN6gLomfZlM3DvqeC08myYDm2kLg0OkdYkFEQUpfT81qgoMSA9V+Xq/xVI3AAtnrCbGJaUcoF8oIzTDnxd1bKJ0dFcgwglCV5iIYpBxuacRLeqpZSkdbWD1c= Received: from DM6PR11MB4491.namprd11.prod.outlook.com (2603:10b6:5:204::19) by DM6PR11MB4578.namprd11.prod.outlook.com (2603:10b6:5:2a7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.19; Tue, 12 Oct 2021 16:25:54 +0000 Received: from DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::740e:126e:c785:c8fd]) by DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::740e:126e:c785:c8fd%4]) with mapi id 15.20.4587.026; Tue, 12 Oct 2021 16:25:54 +0000 From: "Ananyev, Konstantin" To: "Nicolau, Radu" , "Iremonger, Bernard" , "Medvedkin, Vladimir" CC: "dev@dpdk.org" , "mdr@ashroe.eu" , "Richardson, Bruce" , "Zhang, Roy Fan" , "hemant.agrawal@nxp.com" , "gakhil@marvell.com" , "anoobj@marvell.com" , "Doherty, Declan" , "Sinha, Abhijit" , "Buckley, Daniel M" , "marchana@marvell.com" , "ktejasree@marvell.com" , "matan@nvidia.com" Thread-Topic: [PATCH v8 06/10] ipsec: add transmit segmentation offload support Thread-Index: AQHXvpT8g9Om7b1J7EOQg9S2rUCgL6vPP1zwgABJ0iA= Date: Tue, 12 Oct 2021 16:25:54 +0000 Message-ID: References: <20210713133542.3550525-1-radu.nicolau@intel.com> <20211011112945.2876-1-radu.nicolau@intel.com> <20211011112945.2876-7-radu.nicolau@intel.com> In-Reply-To: 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: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3598b6bd-9686-45a1-68f8-08d98d9cf6dc x-ms-traffictypediagnostic: DM6PR11MB4578: 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:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: L78te8+K0k1H3jC7YgjAg1HYZvoc0Vb4ztLeogY+eAx/rgKiUifik5XIRLO9aD3oqdRAU5ve0SdRU5OzsbhlaBuCtvjDhqj62CbVwU5bMIpQx1iShbjFglZ+XJuP8C1fotcMPgYNzWYfYe5PNU24vc2BW0f+GPK1tXfiVw06/kjiqs4SCvqA7DKEtSGuaO+ANUt+ATotavXANMWTBjhmYj2IXq6Ixy2HKt7yisXNiutY7ue9SH+3/NMwNnNz4oCmRSiunoiyI1oqRI9y7OC0PmYeg/mlWzCHdlcN0p/pjKd3bMyRhWYU+qNE2DXoPQzsW3eDWrB51hXOyZ7SPVc31bX9MVQ3i64PfcYLzGf1uCiCuktzJP6+ub6lZYep1/4MIv+6PlTAfyzaO0RHOhs2L/rZamm6WYFoH8+HDe4aiaEvtvrF77DskLvTR6Cedo6RlESlKiB/VcaN5t0eSfLR/ufVOQuKOS4ldHz/m8S5hTX1XpFEB8uYbxZf5+/Ns9dpF4CKqeKp/ViK26ych5ZF8biEbru0/jq2DQS81xBpWRSSJd87K7tBR5q3FAxc/lmx8p9LkVpbUrVpyqG63JkMZRvjCZe44fhgBcTvFNJ1bMkOMyod27aZN2kYd9377dYl+gQU8jM+eKssZx+I8StqPLKnGEIcFQNVQ+S79p8qKb2pXO6HcIAOfFAEiI6eN3mpoaDOkgFxX7J2KhShHRt2PA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4491.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(8676002)(83380400001)(8936002)(66476007)(66556008)(2906002)(66446008)(64756008)(76116006)(71200400001)(186003)(66946007)(26005)(54906003)(55236004)(110136005)(508600001)(5660300002)(7696005)(55016002)(9686003)(38100700002)(6506007)(38070700005)(6636002)(2940100002)(86362001)(316002)(33656002)(122000001)(52536014)(4326008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?SWIq5m1aoAqzi6niEGxh/g7AZYgUq1uBpoieTQ0qMAcj6GjimP2ydKi1GCMD?= =?us-ascii?Q?zRctU5to0VGEN8TdHvzJDvqLuctq2/ao3sUMApTa0aUC/DYXnRib3LfrU0gh?= =?us-ascii?Q?I18wlKBjNhUto477cIwQbs2j6Q5GhOpTl5Va5kNM593Ism56l1rIn5jf9fQ2?= =?us-ascii?Q?o6GIvnvUPBQ0s9NPkC8+yIpNktjy6N48qHhOp8TPYWA7+RKT/Y+7kivT5FP6?= =?us-ascii?Q?vE1mGV+8emmd5B3bifn7+yCJ4A+cYWX4xLhoAu/bCovbg7sksABegCAJft+L?= =?us-ascii?Q?4oM/+FNWE0uDttZPgi7/tR+nBA6tL2xVTy2X0yxpgLegWXpCo1hSY3Hwu5di?= =?us-ascii?Q?puMmvtl+vPCKGoJfET4T1sJbGSn/DW27PK7riDIsuP48Swdb1bmAry6ah35P?= =?us-ascii?Q?a18C5nuEUtliglehw50Pj9G02Dqq/yUeybeWRbSG0advMzkxcEgBD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wa?= 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: DM6PR11MB4491.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3598b6bd-9686-45a1-68f8-08d98d9cf6dc X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Oct 2021 16:25:54.4291 (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: yv7aDoExFjMY85YtCgWESs5479H9+T6nYSd4esD4clwiD3/7jHJK+RWl3IF9UFNFgZf/9tLoTiUu0GgUNF9e7a4UJBKoREehv+9VzhiRHaM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4578 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v8 06/10] ipsec: add transmit segmentation offload support 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" > > +/* check if packet will exceed MSS and segmentation is required */ > > +static inline int > > +esn_outb_nb_segments(struct rte_mbuf *m) { >=20 > DPDK codying style pls. >=20 > > + uint16_t segments =3D 1; > > + uint16_t pkt_l3len =3D m->pkt_len - m->l2_len; > > + > > + /* Only support segmentation for UDP/TCP flows */ > > + if (!(m->packet_type & (RTE_PTYPE_L4_UDP | RTE_PTYPE_L4_TCP))) >=20 > For ptypes it is not a bit flag, it should be something like: >=20 > pt =3D m->packet_type & RTE_PTYPE_L4_MASK; > if (pt =3D=3D RTE_PTYPE_L4_UDP || pt =3D=3D RTE_PTYPE_L4_TCP) {...} >=20 > BTW, ptype is usually used for RX path. > If you expect user to setup it up on TX path - it has to be documented in= formal API comments. Thinking a bit more about it: Do we really need to force user to set ptypes to use this feature? Might be something as simple as follows would work: 1. If user expects that he would need TSO for the ESP packet, he would simply set PKT_TX_TCP_SEG flag and usual offload fields required (l2_len, l3_len, l4_len, tso_segsz). 2. In ipsec lib we'll check for PKT_TX_TCP_SEG - and if it is set we'll do = extra processing (as your patch does - calc number of segments, fill ESP data in a bit diffe= rent way, fill outer_l2_len, outer_l3_len etc.) 3. If user overestimate things and there would be just one segment within p= acket with PKT_TX_TCP_SEG - I don't think it is a big deal, things will keep working c= orrectly and AFAIK there would be no slowdown. =20 That way it should probably simplify things for this feature and would help avoid setting extra ol_flags inside ipsec lib.=20 One side question - how PMD will report that this feature is supported? Would it be extra field in rte_security_ipsec_xform or something different?= =20 >=20 > > + return segments; > > + > > + if (m->tso_segsz > 0 && pkt_l3len > m->tso_segsz) { > > + segments =3D pkt_l3len / m->tso_segsz; > > + if (segments * m->tso_segsz < pkt_l3len) > > + segments++; >=20 > Why not simply: > segments =3D (pkt_l3len >=3D m->tso_segsz) ? 1 : (pkt_l3len + m->tso_seg= sz - 1) / m->tso_segsz; > ? >=20 > > + if (m->packet_type & RTE_PTYPE_L4_TCP) > > + m->ol_flags |=3D (PKT_TX_TCP_SEG | PKT_TX_TCP_CKSUM); > > + else > > + m->ol_flags |=3D (PKT_TX_UDP_SEG | PKT_TX_UDP_CKSUM); > > + } > > + > > + return segments; > > +} > > +