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 D8141A0509; Thu, 14 Apr 2022 19:39:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 71C7140687; Thu, 14 Apr 2022 19:39:36 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id F29F84067C for ; Thu, 14 Apr 2022 19:39:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649957975; x=1681493975; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=yEEP8n7VPptg+VgqgHw+1om9d9BTBHw3yDNKga4UwSE=; b=Z2fGP5sf36hCUQ6g6Wgf2Rs0zU2XJWm5S2Vzm0jyh4fOVjJPkrWZ9Zky 7zqGO1+oSHSNqdMmX1ZhXKywYNPwcTf5ouRUUtr/WJO00tH8z+0ZP5R7n wmpQsXx07anAtwIOAyyW9Pk4JQ7wvWZbLc/UTkzp70wpMLR70lMxswgn/ arDLhvuJeTYmIvv/JvVkOrZ4L/m2DHyKcmirDC/BThFN5a4Nc8TJUSkKl UNhSkQ04T34mIyZsriy4jA4sazzocqqK6j/opbBkx2AuYg87aSyNfCYnx GC5iKX5tm2u9wJtId8OudjCQhJF0oaSZHViSEbRJiMbP75N4uEK2g9Quk A==; X-IronPort-AV: E=McAfee;i="6400,9594,10317"; a="262435259" X-IronPort-AV: E=Sophos;i="5.90,260,1643702400"; d="scan'208";a="262435259" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2022 10:39:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,260,1643702400"; d="scan'208";a="552783426" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga007.jf.intel.com with ESMTP; 14 Apr 2022 10:39:33 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 14 Apr 2022 10:39:33 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 14 Apr 2022 10:39:32 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Thu, 14 Apr 2022 10:39:32 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.108) 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.2308.27; Thu, 14 Apr 2022 10:38:42 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EGNSsBzTYgCmNqm8sfObB2wBmMJFq4sSwf0C79segnJidXy9zkYb97PU2rNBqAC5kPTaMylP3l7K6XHvxAL+Lv1hiqgl3WZJR0uNxLA7RTlUls4gXX4x4YkOtY3W426sXpW2Ro/Z8EeXv8Ydeo3381IujjOO0YFpyyScF7bQZiyhpe2JnxJoPfOZuTe6eQnuAicloCfxt1ewws6Nb9W3Y2fMOP6IkB4KHQfnhJMEjtlOkAoIiiphnKG9DhSRbxDqWxkPbgtquaiAK6mRHMdZx+XSlGyzxH5AEFbstYRLmsjZ63cWpMyEqBScsqvl75HH9Sm9Vii5XXVZ6W5vDksMhg== 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=0dO2+ggAM5Wp56iC0PLEH7gDRYbdkcm8K7rd9ypsw54=; b=gTZHw5cUlgem576YIP1s0tHNeiydHb77588G8x9G/pgc312iBqyevbfKZCXM6FgZzx3QX6u8FI2T+XtmFsv2mvUMgJz3Hb3uLSHqwI+wxcan/g4Ia9r1BJFgNRKo9O3b6n592v4lYafm3s/4mQtvjl8y3DhHNqLl9epyVa/B+7IwIIM/hRb9OK7Z3oHnZiii3+X/dy5zvN7Pbv9QdSeMVbU0+Z5istBaEiYw6Z+GhjmVGpUeU9BtpbBMFpIWic7tWaxsRcZwwGwdHWsNQXrSg9WhEMAy1DUJU8dEsPMi6ofP2coDcXrKVaoNcgOur/KfcVVUE8PzQoVIxRsQMCTtsw== 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 Received: from DM6PR11MB3868.namprd11.prod.outlook.com (2603:10b6:5:19f::13) by MW5PR11MB5811.namprd11.prod.outlook.com (2603:10b6:303:198::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18; Thu, 14 Apr 2022 17:38:41 +0000 Received: from DM6PR11MB3868.namprd11.prod.outlook.com ([fe80::49f8:b100:2186:de00]) by DM6PR11MB3868.namprd11.prod.outlook.com ([fe80::49f8:b100:2186:de00%6]) with mapi id 15.20.5144.030; Thu, 14 Apr 2022 17:38:41 +0000 From: "Naga Harish K, S V" To: "Jayatheerthan, Jay" , "ferruh.yigit@xilinx.com" , "Yigit, Ferruh" CC: "dev@dpdk.org" Subject: RE: [PATCH v3] kni: optimize alloc queue release Thread-Topic: [PATCH v3] kni: optimize alloc queue release Thread-Index: AQHYT0bUgxrIaC2MOUeKra8NcJMRMazvE3WQgACamrA= Date: Thu, 14 Apr 2022 17:38:40 +0000 Message-ID: References: <20220413054856.3054752-1-s.v.naga.harish.k@intel.com> <20220413145717.3661947-1-s.v.naga.harish.k@intel.com> In-Reply-To: Accept-Language: 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.401.20 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6c161050-f8fa-445c-5c8c-08da1e3d9d7d x-ms-traffictypediagnostic: MW5PR11MB5811:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: +c+ssI5Rf6iAXcyz8pSryhOrONZ+Wqo0dAcakSDWB5QH7ECNDydGIRzCLXWcijILgmD6iNtnUDAX104JtCqA+BuL5saktx3oz0DbBAEzzc8OrxhOUUpPanh3p5XN1ib5biNRdJ6OEPL6Pp86jiwPILsFZYzrDto9phluAQn5TFBnGHoWTi2ouhQMkOXs2mgv/xUmYUAXEX7fo+wy4/+EXMw8iX7VfRQaRFlg79mH/bUe+wGY2dK/yPkJ5gxLV64QKuNL4JA1rTQABfHoli0x85Vn2ibA23KYN6GHCW/8YwkxjcbVUpuPXPzV78m87Bbas74f8QfNwllOk9JbhzI1DBavFBIbEuCCBqg4GA4N2Tnp0MsyTIaNxFcHMT3ADnyHiq0wflVgR+OKn3Ksz+QRRjarbira5iWGQf41CBREo9Q1V6hp5oDir/BcsxEiSCzZNwFg6V9dGOyj5ZX8ZAfgEy1FOrjq4SGDNnVHquMSJ2qvSfRnNJ0XIFxe1C+ujOhPUd1B/72Vi5EnBb5FD7ziqKDCa8Spj6Dg9s5HLldUtSCQ2xHQZeYOzm0Z+zZt/K/Ap9ZiWW3J+rShPuKC4m3Bsw65CGUq8ghv1tPsZEEDvEFW1XD+A2C9oP9bsc0a5t4kxyG+sDD0WUrIyO88gvbiEanRpuiPNykYGZgzm3AjG0XRnbUwaT80bpDAJbAzuimMEqalpfyRgTMzPjj7JRmoRw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB3868.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(66556008)(66446008)(8676002)(4326008)(9686003)(186003)(66476007)(64756008)(33656002)(508600001)(38070700005)(6506007)(6636002)(7696005)(83380400001)(71200400001)(110136005)(86362001)(316002)(53546011)(55016003)(76116006)(66946007)(38100700002)(5660300002)(82960400001)(122000001)(2906002)(52536014)(8936002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 2 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?s6gxDvkMigdpdiZ7Y/z7r7+/kgtJ0Lqe16Zi3UoEMt1/usDjQHE1wrMIi8i3?= =?us-ascii?Q?Yg4lZAkHI21GU+8orB4oBR2nP/HWIFu73DZLyZYK1XWKja5dH7drz0PPp5sZ?= =?us-ascii?Q?y90IIrlg7zfKNceZfZNHfTeps64zm7/pR4MMQh6nfXBd0EOOiie9pI18sPbZ?= =?us-ascii?Q?EznOw6F5KzNe8TNRJIIb1c3+ZxGqgWH181d7kNyJ/pwey8NBBquwOOY+ZYod?= =?us-ascii?Q?lz6X4PRig2NwFt4TBVV5/3nRLxRJ2VwJy/I+9FXjQu75QC70Hc8gA/q5wn+i?= =?us-ascii?Q?Pa3f4Wd8eh+kpcXwp4rsO3uVuHlQpJc53Ees5DtnYaeuxOrfmGMO/jL5bKWR?= =?us-ascii?Q?hDlOg1B32Z1FtOHSeIFXxsWxkFfp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2Lh1EPScB+Sv7dJPKrEnjARoEGvYgtaXdCWAS27lcG4fAnpOHf2h/p0dT398?= =?us-ascii?Q?ZWQ1TxEZtCnvodOuGeI7/jnhg6fZ15zcU+sMDXX9F75QuAtL33GqZSNm2cM6?= =?us-ascii?Q?krNGFv15kgN/7wLTCn8USuMD+LhH4gqB77Eq0ibg/24oUycKh/lkdufpCs7m?= =?us-ascii?Q?SosrpJNt5R5nCHs/1yAIyK3e/XoH+UE8pC5grKkGwFoO7JYv9MA1m8qecOTk?= =?us-ascii?Q?9dm+Yyrl99Ifa87L9ESwa3Vl5wRiDXDyblfUGxI86dvT0xKMC5McwCT9tDDe?= =?us-ascii?Q?nhE9JRykSd05vpUAu2oyoMpCagVmW1vg3ASukaDkZ+DziblqlJ8RHomkdYzo?= =?us-ascii?Q?za19KZ9fQd563TZxFd75qopwivjlAAPfsxauZzV2ikKl3WlV1MZVYyUTDuZC?= =?us-ascii?Q?0/8PQ4Azvp4M2I/RCvuxmzCPz+9AstccObBYzJvFTveT0uvKDYpHbIfYYVQJ?= =?us-ascii?Q?UwKUGtP6BtAwAeWF97MIbKXh9JFjsto+rA/1Trz52uskTMqG5iKpHJGNoVn4?= x-ms-exchange-antispam-messagedata-1: NFzoKBugwBjF3OjXiTpYVPE9QqYy6mpamk8= 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: DM6PR11MB3868.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6c161050-f8fa-445c-5c8c-08da1e3d9d7d X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Apr 2022 17:38:40.9329 (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: OQIM5QmNubCPwyoBq04PWSZ8sF0Ao7ypL/92QB3tTDHZerKEdhiFZKyg7BefWKbdCFtEpxy3BDqn9XEPMG/gZRycbUBNVExhXBgYC0s96+o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR11MB5811 X-OriginatorOrg: intel.com 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 Hi Jay, > -----Original Message----- > From: Jayatheerthan, Jay > Sent: Thursday, April 14, 2022 8:51 PM > To: Naga Harish K, S V ; > ferruh.yigit@xilinx.com; Yigit, Ferruh > Cc: dev@dpdk.org > Subject: RE: [PATCH v3] kni: optimize alloc queue release >=20 > > -----Original Message----- > > From: Naga Harish K, S V > > Sent: Wednesday, April 13, 2022 8:27 PM > > To: ferruh.yigit@xilinx.com; Yigit, Ferruh > > Cc: Jayatheerthan, Jay ; dev@dpdk.org > > Subject: [PATCH v3] kni: optimize alloc queue release > > > > the kni alloc queue is filled with physical addresses of mbufs >=20 > nitpick: "The" instead of "the". Updated in v4 patch. >=20 > > for kernel consumption. Any unused mbufs in the alloc queue are freed > > during shutdown sequence in rte_kni_release. > > > > In the current existing implementation, for freeing one entry of >=20 > nitpick: current and existing are redundant. Can keep one. Updated in v4 patch. >=20 > > alloc queue all the objects of the mempool are traversed. This process > > is repeated for all the objects of the alloc queue which consumes lot > > of cpu cycles. > > > > Instead of using mempool object iteration method,use > > ``rte_mem_iova2virt()`` api to get the virtual address for the > > physical addresses of alloc_q objects. > > This speeds up the freeing process. > > > > Signed-off-by: Naga Harish K S V > > --- > > v2: > > * fix checkpatch errors > > > > v3: > > * fix commit message as per review comments > > --- > > lib/kni/rte_kni.c | 23 ++++++++--------------- > > 1 file changed, 8 insertions(+), 15 deletions(-) > > > > diff --git a/lib/kni/rte_kni.c b/lib/kni/rte_kni.c index > > 7971c56bb4..f443e5b2fc 100644 > > --- a/lib/kni/rte_kni.c > > +++ b/lib/kni/rte_kni.c > > @@ -375,26 +375,19 @@ va2pa_all(struct rte_mbuf *mbuf) } > > > > static void > > -obj_free(struct rte_mempool *mp __rte_unused, void *opaque, void > *obj, > > - unsigned obj_idx __rte_unused) > > -{ > > - struct rte_mbuf *m =3D obj; > > - void *mbuf_phys =3D opaque; > > - > > - if (va2pa(m) =3D=3D mbuf_phys) > > - rte_pktmbuf_free(m); > > -} > > - > > -static void > > -kni_free_fifo_phy(struct rte_mempool *mp, struct rte_kni_fifo *fifo) > > +kni_free_fifo_phy(struct rte_kni_fifo *fifo) > > { > > void *mbuf_phys; > > int ret; > > + struct rte_mbuf *m; > > > > do { > > ret =3D kni_fifo_get(fifo, &mbuf_phys, 1); > > - if (ret) > > - rte_mempool_obj_iter(mp, obj_free, mbuf_phys); > > + if (ret) { > > + m =3D (struct rte_mbuf *) > > + rte_mem_iova2virt((rte_iova_t)mbuf_phys); > > + rte_pktmbuf_free(m); > > + } > > } while (ret); > > } > > > > @@ -440,7 +433,7 @@ rte_kni_release(struct rte_kni *kni) > > if (kni_fifo_count(kni->rx_q)) > > RTE_LOG(ERR, KNI, "Fail to free all Rx-q items\n"); > > > > - kni_free_fifo_phy(kni->pktmbuf_pool, kni->alloc_q); > > + kni_free_fifo_phy(kni->alloc_q); > > kni_free_fifo(kni->tx_q); > > kni_free_fifo(kni->free_q); > > > > -- > > 2.23.0