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 9982DA0C48; Tue, 20 Jul 2021 14:17:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D79840689; Tue, 20 Jul 2021 14:17:20 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id AC8C840140 for ; Tue, 20 Jul 2021 14:17:18 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10050"; a="296785958" X-IronPort-AV: E=Sophos;i="5.84,254,1620716400"; d="scan'208";a="296785958" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2021 05:17:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,254,1620716400"; d="scan'208";a="415223246" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga003.jf.intel.com with ESMTP; 20 Jul 2021 05:17:16 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Tue, 20 Jul 2021 05:17:16 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) 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.2242.10; Tue, 20 Jul 2021 05:17:15 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) 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.2242.10 via Frontend Transport; Tue, 20 Jul 2021 05:17:14 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.49) 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.2242.10; Tue, 20 Jul 2021 05:17:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lovXLVk0JnbBuvfXE48qysPRa1Wp28DPWy4Lz1KNh/pBcFDctcW7K9dWauiWspWumwfpZ+JGQc/cIk/87rTUYKiL3Z7CmR1YRtSl5XXvwHLxpeEAvzxkM0BH6gesgW+MhUxvisMZ1INW5rmf0ZNUZOJykmEcJ+JHFD78OCb5ZAykl+axTnMvqJAAZLFNvIQIGQxiTXAbVBd4XuGzTpQiKSWnueJ1t9GQQro384X2zrjXIissHx0DAqfvikv1HxfJNpe9Y22hCxkWm5paC8WnRA3XER7ITpV1hlbEaKLr+Iq2S9n7OSP3CMWYPxus7aBeJIi9FbnLlNCLIeLJup+Pzw== 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-SenderADCheck; bh=SfFMPY2MSGOY+kbMnNULgefj6NgqY54u0/8CvSscdaw=; b=gy2OG03BAC9NQ2a1IB6Zpj2zSwg/kzpMw3/kRoxj6AKWEkV7nHvVH37eXDUuMKkWRnkdYtukLyjHkX/AaR6JyebeXKxq8YnOWy3pnEip9tQbI/4UL8S+PV3Na9dA/G/4VjUe9+VTlcnxbYDjFeKPUZ1CA4Kh1629IeUlmroAr0LY+OQyqR7ObFvFnlF383+dc9EH4YsjGcVf8YorkQTyn3vvTMGMEn9DlzBtXh7A3xaKIPvqYvaiQftww7Hwbjcwtb1zOmJUNzpoEhviY25Nlry6pT605g+KusMbfTLpHETXfZOS6FfH0WkMXDWodTjgV+pb7LrtTIHJ8Dxx6QQfyQ== 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=SfFMPY2MSGOY+kbMnNULgefj6NgqY54u0/8CvSscdaw=; b=Z4DKg9VESFnLsBPKX3wG+NkvGu6758kSqJaWEdUkO47xaaZThmkzGfO7sZU0qeQZ7ywxNC/swDN9qqB9RXCgLSlM+9rg6oWnGUgqDphPqtr9uaqxKsBzr07una/cG650EABOc3ftTpQEUEu7IyZBVSu0+iLOaGD0gsIiGxNLFZo= Authentication-Results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by PH0PR11MB4886.namprd11.prod.outlook.com (2603:10b6:510:33::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.24; Tue, 20 Jul 2021 12:17:06 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bde5:66de:e755:c5bb]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bde5:66de:e755:c5bb%4]) with mapi id 15.20.4331.034; Tue, 20 Jul 2021 12:17:06 +0000 To: Thomas Monjalon CC: Paulis Gributs , , , Shahaf Shuler , , Andrew Rybchenko , , , References: <20210715132015.1587544-1-paulis.gributs@intel.com> <23ee1261-e6db-69d2-8a9e-423dc38a925a@intel.com> <4976849.lnOlTO5uOn@thomas> From: Ferruh Yigit X-User: ferruhy Message-ID: <3e11041c-470d-5004-83c5-1c3b5f1b226a@intel.com> Date: Tue, 20 Jul 2021 13:16:58 +0100 In-Reply-To: <4976849.lnOlTO5uOn@thomas> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-ClientProxiedBy: MR2P264CA0061.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:31::25) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.0.206] (37.228.236.146) by MR2P264CA0061.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:31::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 12:17:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 20a6bc53-f6b2-45d6-6418-08d94b784a39 X-MS-TrafficTypeDiagnostic: PH0PR11MB4886: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ocZwc4zuiNFAB0iZjm/H/1uWQtIBQIYpev219kAf0HMZP3LS0bLyXWa8SEnC+PUPYz6Mp5B2X1TCF5k3VIMshsxuiPb/Q2LFOr+TGBBL9V/UCNcUtjtOlvSJYVTTCgKdWuXFANKG9alXldHQ92I06TxEaoN5VU3A5n+NLTJkpzczcWhd6nM84ze/+NvJ6ZQzESeMF/R3ujXKME3U+pV+k3yN88ycLdX5scVtIzUSCJjBTcXNdMZBt6MwdUpz6NeYdr9LTiSh5m53ae6zVjG2xYo9/VeZ4JfDWpuuha6UXh3cQUo03A6pR/8/Nk+FcHgXd25AmxDedFY3fsc6k5g0CEXt1RGoN+wiuJ4f8fli5d4bvhab6cuSN7SJvXgf97rQPAEM/cRcZhUbVNYjuG0GJdiDwqPM0fSCmY9v3nvexuWWWVrHwbTnFgxi1W84JgSsnloajhQU9FT/PsJALTYmg2CB8q6vZ30ObDRaRVVC7DInlOTBz8Uk6b02DjyJ9JQdnn4PtrPvWqSP+k6YLjmKr1CnywfrBz3COWTMutKgeAAzQMESZkQbMMOrHt34LsnG7tFPPOIR1iA0JZIb5fyiFYs02Yhs8n5YSiT8vBn0VZ2fTyd57nXrpc5efCCX0Emu12yANNxeyjFKDjRYBxFKbiO7EGP3iPzBm3E2XDzBGH8UQDCTsiHvHEZvock0z2b9kNQBlBzjZ6KKMjYd5Ovqsw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5000.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(376002)(346002)(396003)(366004)(39860400002)(186003)(31696002)(316002)(16576012)(6916009)(2616005)(44832011)(54906003)(956004)(53546011)(6486002)(478600001)(83380400001)(36756003)(2906002)(31686004)(4326008)(5660300002)(8936002)(8676002)(6666004)(38100700002)(66556008)(66946007)(66476007)(86362001)(26005)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RDU0Q3crMTV4WU9FTkxma2ZoYTZzOHZKbXBtYWhjRmZZV0l5WVRBbnpMVmcw?= =?utf-8?B?RmdmOHkxdXEvZjdtWFRYK2liejduWlFyOEM1Y0tXZE9yYXFmUVZBTHFDRjVE?= =?utf-8?B?aFNERUpaSkQyQWM2VVNYNG5xTkFaZkJ5dVU4T3k5Nkx4Qm55UnViK1drSWZO?= =?utf-8?B?V25oM3l4RnNpZEwrMWk0RmlIR0xZa294d3ArcHE1bkViZk9KSXU0NnNLKzdj?= =?utf-8?B?THd5cUpjRlpHREtTSzI0SUVIK3lWNFlJZ1NvclNOSGZXWXVWNWJZV1RuN04v?= =?utf-8?B?MHR0dXFsNlhKN05SWTNt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aNFk5Vlhva0lIUnY3d1JlTHpFZjNhdVdsbkJDeXA0elFQ?= =?utf-8?B?djBEUWZoMi9HY2t4TTlicEJBSytoM21ibTdnd1lwSnp2L3pVczk0VkJ6SDdo?= =?utf-8?B?NC9LTFdjNDVJSWw1Y0VKMHo1UXlJTkpIbXFnZVFoQjFTK2xTMW5vMUswN2xL?= =?utf-8?B?dExzZWRyS2NlbmVBbThwZ0dha2VENnBsQUZUZXI3RzB6dTdKaDlQWFlEb2xn?= =?utf-8?B?cFJvRWw1eUlwWjhEYjV4NW1SZUtoaEJpTHY0bzExUmQxOUFaZHltVkZaTkxK?= =?utf-8?B?OUtiM2JFc3VQVTJQbEpsNkMwTTk3c3R0ZnJsV3h4STJXamw0RE5CMEpWL0Nh?= =?utf-8?B?L2NXY05SK2VUdnY3T1VvNThKMFZKbTUwbEF5YmZYbVJYU21BZ09XWjR3Wk5J?= =?utf-8?B?OEJjSXUzbndNS0RuR2tJMnMrbVp4dE9zQWN2bkw4OUx1OGRkTGpnUDg1SWly?= =?utf-8?B?a1Q0dklZQm80aVVRNENFbkt6dDFYMG9vcVU0WVlqRnEwWEFBK2pHTjFDQjNl?= =?utf-8?Q?f3C+iZwMgjpBJplbGLtdgZ7dzaVZjQggqJ6Iqim?= X-MS-Exchange-CrossTenant-Network-Message-Id: 20a6bc53-f6b2-45d6-6418-08d94b784a39 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2021 12:17:06.4174 (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: 2OQxmIIInqfE9Y3g6QxlZSon6Z7Y9HnsHYcgil0wTx4QcMS2i8L/Bol+YBBwfp2Yra4ZDOojMh4brAWHtz3ykQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4886 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH] app/testpmd: remove most uses of rte_eth_devices 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" On 7/20/2021 11:35 AM, Thomas Monjalon wrote: > 19/07/2021 18:42, Ferruh Yigit: >> On 7/15/2021 2:20 PM, Paulis Gributs wrote: >>> This patch removes most uses of the global variable rte_eth_devices >>> from testpmd. This was done to avoid using the object directly which >>> applications should not do. >>> >>> Most uses have been replaced with standard function calls, however >>> the use of it in the show_macs function could not be replaced as no >>> function call exists to get all mac addresses of a given port. >>> >>> Signed-off-by: Paulis Gributs > [...] >>> @@ -857,16 +857,23 @@ dma_unmap_cb(struct rte_mempool *mp __rte_unused, void *opaque __rte_unused, >>> int ret; >>> >>> RTE_ETH_FOREACH_DEV(pid) { >>> - struct rte_eth_dev *dev = >>> - &rte_eth_devices[pid]; >>> + struct rte_eth_dev_info dev_info; >>> >>> - ret = rte_dev_dma_unmap(dev->device, memhdr->addr, 0, >>> - memhdr->len); >>> + ret = eth_dev_info_get_print_err(pid, &dev_info); >>> + if (ret != 0) { >>> + TESTPMD_LOG(DEBUG, >>> + "unable to get device info for port %d on addr 0x%p," >>> + "mempool unmapping will not be performed\n", >>> + pid, memhdr->addr); >>> + continue; >>> + } >>> + >>> + ret = rte_dev_dma_unmap(dev_info.device, memhdr->addr, 0, memhdr->len); >>> if (ret) { >>> TESTPMD_LOG(DEBUG, >>> "unable to DMA unmap addr 0x%p " >>> "for device %s\n", >>> - memhdr->addr, dev->data->name); >>> + memhdr->addr, dev_info.device->name); >>> } >>> } >>> ret = rte_extmem_unregister(memhdr->addr, memhdr->len); >>> @@ -892,16 +899,22 @@ dma_map_cb(struct rte_mempool *mp __rte_unused, void *opaque __rte_unused, >>> return; >>> } >>> RTE_ETH_FOREACH_DEV(pid) { >>> - struct rte_eth_dev *dev = >>> - &rte_eth_devices[pid]; >>> + struct rte_eth_dev_info dev_info; >>> >>> - ret = rte_dev_dma_map(dev->device, memhdr->addr, 0, >>> - memhdr->len); >>> + ret = eth_dev_info_get_print_err(pid, &dev_info); >>> + if (ret != 0) { >>> + TESTPMD_LOG(DEBUG, >>> + "unable to get device info for port %d on addr 0x%p," >>> + "mempool mapping will not be performed\n", >>> + pid, memhdr->addr); >>> + continue; >>> + } >>> + ret = rte_dev_dma_map(dev_info.device, memhdr->addr, 0, memhdr->len); >>> if (ret) { >>> TESTPMD_LOG(DEBUG, >>> "unable to DMA map addr 0x%p " >>> "for device %s\n", >>> - memhdr->addr, dev->data->name); >>> + memhdr->addr, dev_info.device->name); >>> } >>> } >>> } >> >> Hi Shahaf, >> >> These callbacks are used to map/unmap anon memory and added on commit [1]. >> >> Can you please elaborate why it is required? And does xmem covers this >> functionality already? > > The external memory must be registered for DMA. > It completes the feature of external memory, > so yes it is required. > External memory has its own parameter (--mp-alloc=xmem) and its own code path. This is for anonymous memory. As far as I understand xmem already supports mapping. Above mapping support is for anonymous memory and it is added before xmem support, to have similar functionality. But Anatoly & Shahaf know better. >> The concern I have is, it uses some DPDK details, like rte_device to implement >> functionality in a test applications (testpmd). If this is a required >> functionality for end user, it is very hard for them to implement this, and >> perhaps we should have some APIs/wrappers to help the users in that case. >> Or if it is not required, we can perhaps drop from testpmd. > > I agree the API is bad. > It should be an API in every driver classes. > >> But first I am trying to understand what functionality it brings, if it is >> something required by end user or not. > > We should deprecate the API and introduce a new one. > Is it urgent to drop the API? Something you would like to do in 21.11? > It is not urgent at all, just trying to clarify and cleanup if needed. If the xmem covers what this code is trying to to with anon mem, we can drop this from testpmd.