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 0B938A0508; Thu, 14 Apr 2022 12:01:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EDA9740041; Thu, 14 Apr 2022 12:01:15 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id B0D4E4003F for ; Thu, 14 Apr 2022 12:01:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649930473; x=1681466473; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=wsc7DUnkIZsnH5qS9Q410ZfQ3uAU7txrqF6wBDnktrA=; b=DxalDHcZAzcLSsd+vf7z3VmFF+JakMp21moOI6vQsgqQFMHZXuEKSpcF KGgssnszRow6EIBU+QzY9lQ9OjXbGzTJOuzBYSSLuqZ+QdLaDJIdrJ8oI IUbr7Rh/4CvzNakA76AYzL8DPXBeVFMiz2FiEnUxpEBQO68gfnqhGyFBz aS7FaZ3QTfLcy02TkO3YouymB7cZdeZY70Mtv5yruKAzPVQmXzlTxd8F8 vDO/5IMCGDrFHFjoBhwywuqm37SCZ+go9WrQ2wIg0lD76DEb9B0woZSWA lW8uN7OSclYuN23o86QcrRO+Ja1482ofCkam8iehCNaKV3+Ewth37B/D1 g==; X-IronPort-AV: E=McAfee;i="6400,9594,10316"; a="349330927" X-IronPort-AV: E=Sophos;i="5.90,259,1643702400"; d="scan'208";a="349330927" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2022 03:01:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,259,1643702400"; d="scan'208";a="725304010" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by orsmga005.jf.intel.com with ESMTP; 14 Apr 2022 03:01:12 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX605.amr.corp.intel.com (10.22.229.18) 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 03:01:12 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx601.amr.corp.intel.com (10.22.229.14) 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 03:01:12 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.107) 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.2308.27; Thu, 14 Apr 2022 03:01:12 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jjkUNK/EbHclPjmjohMu9XNVhgSY9fHE2XWtWJZko4GPqWCEc2NP0V3tZ2u7LsRtgN0XyexHTuvpJQl9dXtlVZs0k0cBpWlw+I6dLcx4FiC6gp9GWuRnYgqucvNtjpbEDl+wBMNe05zR0ajuylZNRUwJp+3FoOh3hnsfL9avMrSbCW4zfxeVbr3UTwSj7Bb/VtAl/jrU0YB7iUQbklhXitnapmHbAxpNP36cumpzOcenC7KeZUCvGavb7FC+T48lo8Wz8qp63ZuIUtyd27RM9dnsoTvKFzE54RizZMnuPYWN7OE6lSISf0kbI3Epuao/UfYSPPPA68FP3DT1cnE1CA== 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=8vfZup5Os4ta5I1vUGvmEMAP9uj0/bZT2BZVyrZj2L8=; b=NugwuxVsIRkKvE9aQi3OmNeguC8u5CfxkGvSNBUxXXQzN48L7lYSZ2B7Vm22bTJdZoSMEGJftJmJRAjKZ1LxYPefVWovGQzkhOR9VqiwrI1thyvZwRmEPdvYiWFWoMF5aVJl7p/Qkv6MJxpPOkcD5xUk90bm3oHQgEF8X1+ltuRYgpwyVkm8armABzFG+hyK1yzKo3J5k9/wQF/4frzDPHzXyKs5vlgSss7l5QglF+tMOCmkPAutSNzq2JvtnAO1u95oHtL2MxQfRl9nhwlfwmC05vHdwJ/U1fP+3hGNh11MjbfuxWlGmf0i541b3L/gfPhLkrTneajygUkuQHE5yQ== 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 BN6PR11MB1586.namprd11.prod.outlook.com (2603:10b6:405:f::17) 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 10:01:10 +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 10:01:10 +0000 From: "Naga Harish K, S V" To: "Kundapura, Ganapati" , "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: AQHYTvo9HNSNabeSEEWqjRQpc4IXaaztoosQgAGMRxA= Date: Thu, 14 Apr 2022 10:01:10 +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: 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: 3a2093de-8c37-4326-c287-08da1dfdb3af x-ms-traffictypediagnostic: BN6PR11MB1586: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: o7IYYSXFjWvDAyF5agzi4jUFSrNCU1rx9e3n/aVzdCxZgX6r5A+VkoqiF9Es3qZwzmuwf89t5HAc1jZEJehC7/7qtyO2SAPueFnenDshPeiaFvu/5c4WRw5WobozE5MkjCA8T271/fDiu0KYVu/U+ZLfZbarvGv+bJl+5d+RMVWeCQ0aE1barfL9072QdIvspBAkzCmu/sZWVSggOWziQOfeppNodikwH1uY6LnwPw6VVHQN5FDAqRUd6QZPQpzIQUA2oyifuO3Qwp8oXeepxt1v5VbO3foebsDgmABUbeiG6cShQii0BO72XCuFoqcSUrhFSSdzFT+wkpKjRp6i14UgKDMtQl+OGb9mHAkfsbSrY2JsLCjYVZTVYc9/ByXo+XTZBiv9jUO0VHdO/t8MFIQUTcYQJIAhdD7azNXnE8I5JonFg+EbHbFQJ8Flgp2zWOVSwHA8pXM1n7Keg59OnsIKVTu6kd5VK2axcslFmaT2r7N9JRsiBiY2ObYgZ/1CHhW4pHriOOzEdfZo3DpQ3QtVnjfA+cIEoQ7ctQLxmIFw9pMHwZhRWfDcaMSa5NeSGiEeGlHHg6Llg8kBhr70WQRfaG5dx9GtDOZdJYgZStWIFzBkH2IKabqzUDfJq/5VWnuWr5ps5s52hmM1BLMp0+kezoeDJOM2KLWpTdLBUGX9euBmYAQPtrQO6eLIiho+XpiNwveluClsPRXdW/+cbg== 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)(2906002)(53546011)(7696005)(52536014)(9686003)(6636002)(110136005)(54906003)(64756008)(8676002)(6506007)(66446008)(66556008)(66476007)(66946007)(76116006)(316002)(33656002)(4326008)(38100700002)(71200400001)(508600001)(38070700005)(55016003)(5660300002)(8936002)(83380400001)(86362001)(186003)(82960400001)(122000001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 2 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Qs/aYvOwhuq0S0rlaes0nvYMEUDUK7mLRF7PtWhy0CSJHhv1LstriqqPT1UA?= =?us-ascii?Q?4IvxFZW18V/1BtknfBDMd//HX44uv3TeDcKPENS15r8LNqK2tA50tVAi+w8Z?= =?us-ascii?Q?YUtt59ekaggnXJkC0rWVlXfa1K+uTmYe7quRTtEOcivAayPb3lRECVt9CxrI?= =?us-ascii?Q?lwL5LsPYbFv7tmgMlCKBISBAgp+spZzRTaxDlvCo4VFJegMYk7XWqkq5OiYa?= =?us-ascii?Q?BkqysqGqfp3UuHs9MWTU6mfzCKEehtmbjM0Z/2tKIkv1GWz6OlzbUrOIqSFn?= =?us-ascii?Q?3k1JOjDp2FyRuVXLvbcKSIBULqKKcWHtqL8vc+o0Pdw+67i8tZYBBkOhEwKh?= =?us-ascii?Q?svw/3AN9ZUr2QuDAKtoIKxqPSHNGq/w/8Ab8uJTrwAv80CPx7jSc9rjyUQv/?= =?us-ascii?Q?mY5cp/cAdY7LHdAn9Lc0vyBZqeIq6chluAB1f4ufxIrqNEc0h8C59nHVBusL?= =?us-ascii?Q?Ati9zqTEyAcIk9MH0+viryRjFE08EgiAPaCVWL4CjA6gPrZ2eD4FvXSZ8cMt?= =?us-ascii?Q?gGqL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=?us-ascii?Q?HfIA7lY2BeNlRGzIBvJ+A5A/NkFxLcqE6AtNySUJtiC5vGLgXEqeV/PpZ3H3?= =?us-ascii?Q?pFozSdE+nMa9l98UAstvohATo0s8jxH2erXkf/leK8LYcPwAd23K+g8PGQaj?= =?us-ascii?Q?aw8AarJF5tj460wgBb+yhXv0LRVnjzuYzKYfPK6CteagVvKG8r/el2MEyZdl?= =?us-ascii?Q?gv1J+9yKpIO9LyVK6AYuU4BDIpHGmFdk0+nN82C0yXFpZ91bFv7Qvsmc8nCk?= =?us-ascii?Q?YIk6vohV3DO0zhhyzor04zVfRjABUHsMZqexpcS+auWxKkHeMGvar6mCf+E7?= =?us-ascii?Q?KoLZYPkXSSmAStbMwzYtyzvu0Ar6hgufLBUKlIUE0VmhdsP+7+X8eeLJqZ2P?= x-ms-exchange-antispam-messagedata-1: rNQY4AHwWykl1n6QCUCT28Irr3tKXazZE1g= 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: 3a2093de-8c37-4326-c287-08da1dfdb3af X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Apr 2022 10:01:10.3980 (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: G56AB28nPYGlWPX9K5Wh9leayZy8nwqv8y7c40eoggvbMnowwsAJETafneCurcdqQNZoSMuoa1vLNajfbKkC4vRFNMWmeGwIoeS+Y0CDjR4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1586 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 Ganapati, > -----Original Message----- > From: Kundapura, Ganapati > Sent: Wednesday, April 13, 2022 3:54 PM > To: Naga Harish K, S V ; Yigit, Ferruh > > Cc: Jayatheerthan, Jay ; dev@dpdk.org > Subject: RE: [PATCH v2] kni: optimize alloc queue release >=20 > Hi Harish >=20 > > -----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 > > > > 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. > > > > In the current existing implementation, for freeing one entry of 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 c= pu > 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 sppeds up the freeing process. > Nitpick: speeds The commit message is updated v3 patch. > > > > 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(-) > > > > 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