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 35841A050A; Wed, 13 Apr 2022 12:23:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C5E6440694; Wed, 13 Apr 2022 12:23:35 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id B00C44068B for ; Wed, 13 Apr 2022 12:23: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=1649845414; x=1681381414; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=jFTLfcm5DQlKUu5ZbHqSv/cQ/EiGEPnJTa7tzWDg9ag=; b=VhiqtpCkapwGz+NWnXi1Ak67SSqZF02hMlQUj3VFaK1ZQDOISAT2e8dy xd+VPXuNiG+TdW/0KAIEQlslpXZ1tlkuYuguwTGd+OIqsdHvFI7y7g6Ms dQZQez/qEXfSmCgCx7xk0XCh3+HbHc+CMOLiQB4GTZWxrhR5Ddk5uCSsD C/JYhmBqorSmC5VgLLXWsSftIDCuTlCsrzshWHIy+UL/rJozoQl1Ec3qj BF/fKAYniqU1zIvvHaKRtkNgV5y5NTyoozlbVNnkVj71BO/fJlieVRtzA bVC0p4Mur8643l8vV0RSbeyZCwBNJTjAIvG/JszmN3nZO/W5jtxOIA9tx Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10315"; a="325535930" X-IronPort-AV: E=Sophos;i="5.90,256,1643702400"; d="scan'208";a="325535930" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2022 03:23:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,256,1643702400"; d="scan'208";a="645116259" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by FMSMGA003.fm.intel.com with ESMTP; 13 Apr 2022 03:23:33 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 13 Apr 2022 03:23:33 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 13 Apr 2022 03:23:32 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Wed, 13 Apr 2022 03:23:32 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.40) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Wed, 13 Apr 2022 03:23:32 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O3uxn3xavheRGzX7oeO6CZAOZpsd9u+v2RR2ToBVopZyCHCZVM5lQ1tu+B/QfuwGJ3HtQN99H+FQTY+G1xgRrBS0G0YwcqD9ayOcZWU+BtuwBa9ZNBfnZdulOMVcUNPPRAsXuFTl28DCR4dT7JNHbVjR+BArfEA6LBDot5UA/7pCcJQbNe7Qbi82c5bw/Tqa4sj/MA6xly+yZV9jvpaM+rOCn55s6pjRqrQodCj+iU27OwdMbP5HIASh15/Wee6XYb4bx9zRbUyACg1Hv1Zviomnd57x42o+BjsR5N+SiD4Agee7PlldqfURAbipA2zlTJfxvkPJH+4c/9qj7cal1A== 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=chEMaB44w6i4EoOCb/djiS63rKD+YQSDAl/R5Ebd8yQ=; b=Td0/9FWJwNKFw4FrADg9xkifMUdWz4RJpkrm5JU4NvOxFhjyPThCnnayVV/WVnwd2Fa3qcbxMQxr9qRy0+JpTTcthSPwx9qTdwLgtVuwskXanVRrsGiThpfwqJIeXnGO6cH5KM86wnVIXrWYNOeNvfdkiafMhlWApKF1wrShbvpDAkXRNBVx3/m0dUmhQuG9ShR1NHOOWvx7RhnxpNNZdSdIm0dOC+VbW2+SsDUjB+YKzYv2y+zD2TXPms+yIoz7M2BFlxtoSsLKqSpbs1m45HTLE/3h4QGkGUK/Co/ahnC9fmrisNI6/epgeDPoeEsU8xCyxyGIeiDQktRrS5Q2TQ== 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 MW4PR11MB5911.namprd11.prod.outlook.com (2603:10b6:303:16b::16) by BYAPR11MB3384.namprd11.prod.outlook.com (2603:10b6:a03:75::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Wed, 13 Apr 2022 10:23:30 +0000 Received: from MW4PR11MB5911.namprd11.prod.outlook.com ([fe80::387e:27a2:aa94:294]) by MW4PR11MB5911.namprd11.prod.outlook.com ([fe80::387e:27a2:aa94:294%2]) with mapi id 15.20.5164.018; Wed, 13 Apr 2022 10:23:30 +0000 From: "Kundapura, Ganapati" To: "Naga Harish K, S V" , "Yigit, Ferruh" CC: "Jayatheerthan, Jay" , "dev@dpdk.org" Subject: RE: [PATCH v2] kni: optimize alloc queue release Thread-Topic: [PATCH v2] kni: optimize alloc queue release Thread-Index: AQHYTvo9HNSNabeSEEWqjRQpc4IXaaztoosQ Date: Wed, 13 Apr 2022 10:23:30 +0000 Message-ID: References: <20220413054048.3052817-1-s.v.naga.harish.k@intel.com> <20220413054856.3054752-1-s.v.naga.harish.k@intel.com> In-Reply-To: <20220413054856.3054752-1-s.v.naga.harish.k@intel.com> 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: 89ecf24d-91ef-49af-c9df-08da1d37a830 x-ms-traffictypediagnostic: BYAPR11MB3384: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: Rtl8wFD4tGRDnsutczIwFi8ldvyYNuZZN/Lxa/M5e6xPPY2BwXIsKVpWjy0yYAX88mIp0fye6crXmbdBrdz8ClG4AxoqIOnx5UV9BiuLBaS5i4++JU+wSnTem7HbpW8dLBhbV2p7GEcqi99mDwh8oxKcqx1/MTKDXcRHWrLim8YoCdQNZoWv590/rUe6mtZO+5zhYHG6r1Ao5PT7DIsofR75f0t8h6thSAyAILD0AL89NzZrCS5FfWBuXojYQW7OKr9e0i8Jue6sBh/Zuz9vF9gUzwOqgFUj5MsMsOaXwLv+BDf6fr+Ig2Er4cwcWaYnQ+xqk9aVuc4GuuzXXcz2JLIQN2+K8URSwWT3VeHwtcCiyzyWGkkslV3WQWJ9UD6arK+ncqU6pUyQD5Levw3keKIdld6cOyBq9RodReERRa7Jgv+VZQ+CkIWnyq88/pIAJVBmv1YWN9P6gB1bMsxpKYLGQKIF/85RepAsB1M85Oprto/oEwFB5BuIWrWWgsdkJC8NnySPXcj/Fmecw9l/2YxTPJRvUs3oRs+LLrMHAPrqbxZvjx14zvxxWMPa8kCpVf/JTrc5jiQNyIM/J94+aVlQjd3dBqNy5HDeErY0VqPxz//642T7/8oAsrKE2E75jX/Ktwp/8ZrSormDSanK30PZFGW4qC5S+D7MsCK3eZyneYxYy1GH3ipl310tDsPGWgZWJKkuUo7Eoqo3/5YCrQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR11MB5911.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(66476007)(55236004)(7696005)(186003)(6506007)(26005)(9686003)(53546011)(54906003)(66556008)(82960400001)(122000001)(33656002)(508600001)(83380400001)(55016003)(6636002)(76116006)(66946007)(2906002)(110136005)(64756008)(66446008)(71200400001)(86362001)(52536014)(4326008)(8676002)(316002)(38100700002)(38070700005)(8936002)(5660300002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?OVLf73FrOUByDqXAlGrqUbk8FuS1GTv/jHEWeyKYmOYCskW4+lLbYT+p7+9+?= =?us-ascii?Q?01Mmgru79MlCfu1mgMQBavGSAlg1Yc25zGSiUfWF/NMe9/C92Ue3Ybkl0oTQ?= =?us-ascii?Q?uNtfdxM68tKKC4Kw1lf5ggmg9vrDk03Qr6Imgv2o1i1rATElR0iPFKAQfQv7?= =?us-ascii?Q?craZaBa6MMSCdLYbQz2Ul9mF8owZICoHtRdATM61lTpoqV+3foyH2dRVUpWW?= =?us-ascii?Q?mSSlmS4IyzGD2+UbM48RbiTlQDPIoGkS2lSBUVVJ8CGSr6WPYRF0bUwz0lOE?= =?us-ascii?Q?0/j6//33L+A+1qSaNfBKFKNf0XG3LrWu404gRAKl03UTQBmt2JhwmwOZbReR?= =?us-ascii?Q?d/hiifylrW0Rfak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Fn0I?= =?us-ascii?Q?itaS++yHjYObSmiTbUji9HXf+p9Odgv00iSXEmCjb3a6gsy0mXvESntJ1jMO?= =?us-ascii?Q?Kc4oEj/tryzlWc97l30mZfjdJDBh7nSvWHfs4RfzLn+YnnJyIUkKoIhCbdsZ?= =?us-ascii?Q?Kq5H0YKkAAH3cYOlWBDsrjM4ksCEc/WhW3ttKyveAXxo7plZkRH9z5fY8Iby?= =?us-ascii?Q?k4lorYVaCEr80m+nebJ65BxvjUS7CtOIlTs4cLlSgiBk3XH9xB9NQ21VR2Fm?= =?us-ascii?Q?S4jRYX+XwagiW4pBvC/kcgkK0m0cajpg7zJs3PwzqgAm+ehpfaAuodVVfPD6?= =?us-ascii?Q?vfOfMuW0rp/UOSQ6+s8AbYAq8L8hI07gnYmMduyQn+WavAQRKffL+jkhh3MC?= =?us-ascii?Q?x1m+R60YIrYMAGC+kLy24NEghp9QbzjcmRP5zLmTG/0PRD6N1hpuo+S0xGZJ?= =?us-ascii?Q?0tZ65E0fBVnsSk8VE/eqWrxu5xuXEGKaO4NniAoK8sXMaOsIRZmoH9SIiipa?= =?us-ascii?Q?HDd7iLyqcF41uoE6S9Vqn/QZBQ3TLm8=3D?= 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: MW4PR11MB5911.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89ecf24d-91ef-49af-c9df-08da1d37a830 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Apr 2022 10:23:30.7585 (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: /n9taDwQkVWY39KoNB8c0s+QP5eCLJCgyAw1seEePVrgv5CjUHUPhc8beh+L4p44vS1hfcC3pAI35gsoIX1MKaPvpGH8/uvrjAM7LBoBGB0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3384 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 Harish > -----Original Message----- > From: Naga Harish K S V > Sent: 13 April 2022 11:19 > To: Yigit, Ferruh > Cc: Jayatheerthan, Jay ; dev@dpdk.org > Subject: [PATCH v2] kni: optimize alloc queue release >=20 > the kni alloc queue is filled with physical addresses of mbufs for kernel > consumption. Any unused mbufs in the alloc queue are freed during > shutdown sequence in rte_kni_release. >=20 > In the current existing implementation, for freeing one entry of alloc qu= eue > all the objects of the mempool are traversed. This process is repeated fo= r all > the objects of the alloc queue which consumes lot of cpu cycles. >=20 > 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 sppeds up the freeing process. Nitpick: speeds >=20 > Signed-off-by: Naga Harish K S V > --- > v2: > * fix checkpatch errors > --- > lib/kni/rte_kni.c | 23 ++++++++--------------- > 1 file changed, 8 insertions(+), 15 deletions(-) >=20 > diff --git a/lib/kni/rte_kni.c b/lib/kni/rte_kni.c index 7971c56bb4..f443= e5b2fc > 100644 > --- a/lib/kni/rte_kni.c > +++ b/lib/kni/rte_kni.c > @@ -375,26 +375,19 @@ va2pa_all(struct rte_mbuf *mbuf) } >=20 > 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; >=20 > 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); > } >=20 > @@ -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"); >=20 > - 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); >=20 > -- > 2.23.0