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 A8611A050D; Thu, 14 Apr 2022 17:20:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5200640694; Thu, 14 Apr 2022 17:20:48 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id D60E240687 for ; Thu, 14 Apr 2022 17:20:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649949647; x=1681485647; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=0SXr0kaNVW5r06fMm2EopcaZhYQc5LpKhPRBLreE8Pg=; b=E86Ey/yw9tB1xPmmjSNHwpPS9LcW3cIa9zxkf5gSJOpsV08CsV5RZSpb 3p7E4iPz/5doldJEi7Ox2teRv60WvScthQVYRitLurSVgn9i/xuGa8W9V PmW5NoTe8hd4U+k7jgG0ww1qadXhVt1pjDr8hDIFMLuQjKBHqzJltqTKa iEeg+H1dInF/DC6LDKKlfvTjk7eGRmvOLqxuo03YsO8npQ2Ixv64TOIRb uCQTUr+jmkspDqgRFt2BolPBMz2JM0elokha6nCSiKSmScaoCngHm20ZG BXYes7LrX0WV3XO52Lv/bOvp5Sx4UkCkec5do2dAcXCmQJFh/n78PghYm g==; X-IronPort-AV: E=McAfee;i="6400,9594,10317"; a="263130940" X-IronPort-AV: E=Sophos;i="5.90,260,1643702400"; d="scan'208";a="263130940" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2022 08:20:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,260,1643702400"; d="scan'208";a="612370329" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga008.fm.intel.com with ESMTP; 14 Apr 2022 08:20:45 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX603.amr.corp.intel.com (10.22.229.16) 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 08:20:45 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) 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.2308.27; Thu, 14 Apr 2022 08:20:45 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx608.amr.corp.intel.com (10.22.229.21) 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 08:20:45 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.101) by edgegateway.intel.com (134.134.137.103) 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 08:20:44 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=euxyhBcndku3TE81rsK5A1BeJU53zOWVShWOC4vjCzShAfcWejhaW6lUlpW28AsF3afL4oyxAd3gSHzdVL1zndMzHVrH/PHX5lJLAAPsRKSyWCQfuLdUJCNxb+4aVEGZ/ZTqC0nFsCzHZEmoK7MINhXpA+p7JYvBkLGIZ1yaObhPUoA21FwR3Nu05lM0bTwDOoiogTk3/WexUasySS+kOWGS6E9Otj3VGJ7yf/NVPby7WL6mSUM1jXZcV87jvSaBx1Kyi22jjtrbDcc9yLhyEE631B0nLWAK+g53ky1SgUDNGAkYodcM9sR2OdsIxytXavlDmCS5+/m68c36cnEHCA== 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=PARAGoIIcOkFqKRDECZWyIS7g66O4F5ThfUj6vRaDAk=; b=PGLq1q/BSG3SeUDziWxFgBRiUhPPJwE1qMJgo0rkXnETyJQ2IJhrsNNbXKV94HYuNTM6omaLrdNggbZYmJQ2cicMHP6O7Cl/xuLuulufPmFPl5+u2J2xGkCEe7KRdsHqKu8h8LnxF/bwBF8B7AvNeY3Fm0vurchNjLXCYxgzymcATO5ftoljgG2+ruWgjayNytptKWu0unW8DkqTNJaB9g+pduVRGBaM1A4ZvGEf2j6jrBOF5rbmwSWwimkP9saV68BJMzrcv2UNa+GOWGNCH0M4YBkUN0/olPX6kzMZLU2fZatyKY9W2raLNcHwyTYy4o4lhQmV6SG9UO0MvB/LXw== 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 DM6PR11MB4348.namprd11.prod.outlook.com (2603:10b6:5:1db::18) by MN2PR11MB3629.namprd11.prod.outlook.com (2603:10b6:208:f0::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Thu, 14 Apr 2022 15:20:42 +0000 Received: from DM6PR11MB4348.namprd11.prod.outlook.com ([fe80::2d8b:621a:5b05:7edd]) by DM6PR11MB4348.namprd11.prod.outlook.com ([fe80::2d8b:621a:5b05:7edd%3]) with mapi id 15.20.5144.029; Thu, 14 Apr 2022 15:20:42 +0000 From: "Jayatheerthan, Jay" 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 Thread-Topic: [PATCH v3] kni: optimize alloc queue release Thread-Index: AQHYT0bUgxrIaC2MOUeKra8NcJMRMazvE3WQ Date: Thu, 14 Apr 2022 15:20:42 +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: <20220413145717.3661947-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: de965e44-7d8d-4383-a4e6-08da1e2a5725 x-ms-traffictypediagnostic: MN2PR11MB3629: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: cs5zV52v2cdk4Ii4mTWNd3NWkShfc0di1teVmwEkuT3cfl8dRS2NkTY3Jx1LOw6y+QBGElYAX+BuK+EGCh1ajbXWPHJfoZuMrLi83AD3a4d4xIudU+2MZWySztV4X74LlhSgek4ITCLqfwZJBLLNnAHrMvR/ueSCz4ub1/rcp+HRWGLRkDWbPrnicSbeWyizX6tVbgOufH6v0oT9AjUVvwyZsyNjoXOJZJBpKs39wwUqrX29gVrtKlUBKytebA6O8HwNteEQc+C9MgB7OmZzh2zqQSSqhGRH6Ywv9Eu3ikcV39+06r6lJGEbDAus4N8WNpSRfRACk1K2x0bv5Ag5exeYqexnZUW+51Q1fUg+xc3Z6YtrhTxWyNkQHXLDGnF4EKG0nFw976DO9pauLpd/LRFMZukd1VBUmX289MaWSsIxkyiVMlsa93ALx5KPRNSlAg59hCadX4isUj+CPLRgBRpclWiOM9/rH98NwPkL3St2IQUsevgMfR8vWjwXYjdw4B1O9QJ8wyEsu2Bl4hHV/ibRS/IlH9QwnYInpC4TYmqk2Vnivj4OUPE88c0OicPVcNPLx1pPp4+YIFGPdq15a38V/AJTp9zkSeRo5Ft33yjkXbp4duv84hAhYPho4hxLBziS59ArMKk9nLlix1KYo46WlZZqnLmmqmGFhZf/N2KH2Lwqde+x49r8oXHWmwYo0PXdbeuzhoZivLc7PlPXiQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4348.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(82960400001)(186003)(122000001)(83380400001)(38070700005)(26005)(33656002)(5660300002)(38100700002)(52536014)(2906002)(8936002)(66476007)(66556008)(55016003)(64756008)(66446008)(66946007)(6636002)(110136005)(508600001)(8676002)(4326008)(76116006)(7696005)(6506007)(316002)(9686003)(53546011)(86362001)(71200400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?YT9BKFfhd4hQypJ6C0x/bWSLg4Ja1UJEs+qCVomd/EfjHLBSjPKfsom5Nzxx?= =?us-ascii?Q?QOJxDD4+DELiADN9sjeH+gvDqx8ib2MB9I1PFB8t+fB2bHJlBXdM+oDgAnqz?= =?us-ascii?Q?jp2zZlZsYrJQk2pM0ReIxG/DZiK+oviH8l3FoOrK1RN5q4na2f9/UA7OxMAc?= =?us-ascii?Q?O9nBzdGe5S3LlCllSZz6fooUktw+eBiQlaRq5ki4NVakHTSDn/rYLFvO+7+G?= =?us-ascii?Q?Xec2bziidS3+iMCbPwakWauxtoTmGsDkmr/TQwat85eQ2WvKXnj8uYmSM/nF?= =?us-ascii?Q?Au7HbguCD/+UGmMfZXGFdMWVXSY06SSzFOTrKpOZmbkJACfVQeqaSulF2F1r?= =?us-ascii?Q?B4f2yHmK/3yS/S1j0z4+2eIs+3ROQ2xp7N74UD9COqP0+BjodstWB7sjPalY?= =?us-ascii?Q?pC7HL5NESZXpadknIkorF+PEwORkDrvO0LXUKNyWZg0JrHFlizImb2lgMC90?= =?us-ascii?Q?FG2fc+w547w4SeHr38ixWFXXv17h4h+xA99jM0IPXrQIQ4/SjBYwPZy+VHOr?= =?us-ascii?Q?wOrP7B4USMA/RvzottavhpBMsvYONdmLtsZQoUzB4/JMVvGirzdEGAw6GUa+?= =?us-ascii?Q?0Tpk6a0chj1YLpZXVieXdlCdic+RQHkj2J9li9c+i2rNx592r6N+XIcJgKDD?= =?us-ascii?Q?OPNCsK4Fa3hM1F5MQyjodXgbNce57DtKecXk41MiPO5a9DE2/0umbisn6gRp?= =?us-ascii?Q?rF4gazDQIeTWKAwlaLrHdhsywvTqr3I3nmcyxnjskp63aLy1ICBF0lfIrO+a?= =?us-ascii?Q?DG6R5pSMte8Sft+Gw8s7e5P75Myf19Y+KQih0js1WUdDovYBssR/ZgQzyD8E?= =?us-ascii?Q?ZDwjLrEyynjaMl7BSClVUJqtt7JaFZomSkvfdjAcosg0KP0GUlBluhMjnAMT?= =?us-ascii?Q?xnSGmyY4TjU5nDTlsMuOHNvvC0NRkOsuM4cb7/AB1tPwoUtecFEBIWGEB6X1?= =?us-ascii?Q?5wLdGpM4KFkySxNgkc6fKvfhkJGsdlz4Q0CeDvl3S4a8oPt5qwXRdffIkOGZ?= =?us-ascii?Q?b39dI/6KpMhdIpgkpjyZz9XsnbUqyHdWRthJbPUDmvts8fmRbBHrXQ1H3qWa?= =?us-ascii?Q?f+AqBK+G07Uxzx+v0+y6SZO+KWVdxuDdGoycqlK6AmVgF6TZxOVw+BmBY5pW?= =?us-ascii?Q?oeIVZQItjjXZkPpaQJO779crFKPeZbe5cfiFeQ4d/FAi3Dg9+dklb+CHNPKo?= =?us-ascii?Q?tap4PuTKWkTe/eW3wPwg166OcC3y3o124m5qVUofhvVQyT225ydjAcwitdy1?= =?us-ascii?Q?XvlI64eS2aPqn7iKArw5G9NyHn++TLrbCcR5K0+MMuAtqn+CgHZxDLzakzks?= =?us-ascii?Q?LIAExjEfeH1G+v5DCY6YOPJ9pzobG/vUVXRa0TVGpUC0YZT4AQAHN9rvxj1p?= =?us-ascii?Q?tqm/Mx7GYzZLhXSGPOyWb9KahfHb7LER5oitDYjaslsoTXGOJdJNoUQgfihC?= =?us-ascii?Q?YzjhXgpKGR5nFmIi89oDzR0qIig7H4lRj6ShBU7xkL446AhgIWy7X3CO9NRw?= =?us-ascii?Q?j+1PDJFdKxULtNULtgA2OvqT5QchFaSGf6ga4fywtoBixCjvQi8ZNIA0XKvI?= =?us-ascii?Q?lqbuYD2wjRz+exjjwRY/pTNBIxj4vSpp0xUVwHSLb3bKGbX3nrYBqK4ISJTW?= =?us-ascii?Q?Hv+RzEnxVXyyM2+jGecahx3hJ5i28L8gWeURE/1lYWzBvaU99iuVX7xtd7LH?= =?us-ascii?Q?s6tjtMzmzlwwTPaGjIHckS3Ft3//ADVntUCN0zuWgFj5hsGWAmdFybw1gEpK?= =?us-ascii?Q?c9UJ/EIeYotOkCHNeZ5prcHH7JiC3zA=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: DM6PR11MB4348.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: de965e44-7d8d-4383-a4e6-08da1e2a5725 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Apr 2022 15:20:42.5109 (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: Nf+8lZTf0zkaNUx+WL53/UWf8n8TSCPf9mciebIHcJTef9kVVQ/pWQTdajdazAqagE4cMMhyhqntZPFPUN35WdrQNqHRic/E/zo6XOpqZn0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3629 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 > -----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 >=20 > the kni alloc queue is filled with physical addresses of mbufs nitpick: "The" instead of "the". > 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 nitpick: current and existing are redundant. Can keep one. > 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. >=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 speeds up the freeing process. >=20 > Signed-off-by: Naga Harish K S V > --- > v2: > * fix checkpatch errors >=20 > v3: > * fix commit message as per review comments > --- > 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..f443e5b2fc 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