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 ECDABA00C3; Tue, 18 Jan 2022 13:12:51 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 807D54270E; Tue, 18 Jan 2022 13:12:51 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id B0F444068E for ; Tue, 18 Jan 2022 13:12:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642507968; x=1674043968; h=message-id:date:to:cc:references:from:subject: in-reply-to:content-transfer-encoding:mime-version; bh=Cz9unTDst6l2y3NXEEvN8zwuWtVYqeigi3h7IHNPIP4=; b=YOGANmBfFajxhapVq9sF4ICK5O1uwvGSEOniJBm1atpa9yatgCQFVGHA x8OovhaB17tL/ABEinEAFQ4wVZk10o1oddnb7/sWhxWyUwD22lyF0LM5W 9jKv5YwJzdDoyqMFyQ6iNnFsAyyLUlh51gCDpibgJ5qSg2QYPqmHbIV/3 9nkvClkG+TGLF3CBhF39Foq8ApPeTwMfGsULCk8E0EPDHYYEFkrHKnz8x W6JHb9B932Su7T8Gy1+JETdXChbXa+LNn4GSBlRZhJwpTieGtMjJ4hL2X p2Vla/86MuLyaHbsn6AR0s9Ajaav5ZSitRK3t7wUCl4UplF1yn7wG07tl A==; X-IronPort-AV: E=McAfee;i="6200,9189,10230"; a="244997512" X-IronPort-AV: E=Sophos;i="5.88,297,1635231600"; d="scan'208";a="244997512" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2022 04:12:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,297,1635231600"; d="scan'208";a="517747235" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga007.jf.intel.com with ESMTP; 18 Jan 2022 04:12:47 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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.2308.20; Tue, 18 Jan 2022 04:12:46 -0800 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Tue, 18 Jan 2022 04:12:46 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Tue, 18 Jan 2022 04:12:46 -0800 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.177) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Tue, 18 Jan 2022 04:12:46 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n6UP7EjUpXCP/34Y8hS1JZs7SA54lOlGNXCxl1loCljJ2B4R4RNpm84SKW1HU4tBGYxgtLEU+M/Q1tjN/hbmhfVsAhtqmv12VoKDwV4SgywyJhDf1uBRHAfjRW6ZTk1IakoiNdBjoFWvQVC6h5cMmCRCi+Mx9CQi3bvqVcpjCNgDmSUnf+yWzLAvTzgqQ7JZfVCAQbufMSK8gon/2G0xqed36tsiCkfgh+uJkQr16ditIOsBzF2ioB/PyAC/P4sgQf0pyuo6JrNmrIHyWyAKw8tK5rA7pQgjRmeMazcap6g5edO6VNHStJDvsonfR5PvVEygwG+P1GvcD69sXxIJrw== 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=PmHmdPXMf561pnhnMkqZCLGnUUUr+V0JXIgka2tBYTE=; b=lmEg9Lqto7jOYLvmn8X3H+ths2k2aChgw4wzUtDIH3zVGYC7x3N6XVz0oy0Pw/GF9K0/JcwosGWhFaGUxMOoCstq7W0eSTqM+WYxQrz7PbiCNDXy7gpTZucmvRKNy/FkaEky329OnfV65F0RMuR+TJUB3kZINr2L3INO5cepVgpjhBhXh6BfYGrcW86tU+xcTh+aU0TZXnmq7B719HQ/M7wqvK0Qm95TsYs3pof7WQfqBqrErpWlsCbsrw4/6A5TSPSdhFqP2KqpShEWNuIRbR8exEHbIedzZSv4RnfRp14htMVwFlgySH08biaqo/j8Aa4qnSOItc0zzpkki44zXw== 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 Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by MN2PR11MB4238.namprd11.prod.outlook.com (2603:10b6:208:188::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Tue, 18 Jan 2022 12:12:44 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::5046:8550:928d:850e]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::5046:8550:928d:850e%7]) with mapi id 15.20.4888.014; Tue, 18 Jan 2022 12:12:43 +0000 Message-ID: <923832f2-c8a0-84e9-360c-e79549a480a6@intel.com> Date: Tue, 18 Jan 2022 12:12:34 +0000 Content-Language: en-US To: kumaraparameshwaran rathinavel CC: Thomas Monjalon , "Wiles, Keith" , , Kumara Parameshwaran , Andrew Rybchenko , David Marchand References: <20211126041515.96259-1-kumaraparamesh92@gmail.com> <3166646.G96rZvMJ2N@thomas> <6aed79d2-be6c-7f30-a562-7acd69ebae57@intel.com> From: Ferruh Yigit Subject: Re: [PATCH] net/tap: Bug fix to populate fds in secondary process X-User: ferruhy In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO2P265CA0196.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9e::16) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e0c48f7e-fd9a-430e-1298-08d9da7bd498 X-MS-TrafficTypeDiagnostic: MN2PR11MB4238:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N3d+EurAxd5wf2A0o/cIGdzZz1ulJlxweDNbSxBZZO4uutCJTxXiuoHUAPk0O1Hz8FykL4Q9W0rvuxmufnzKkVIB+ot37jjpWgR7U5ImMxPdMjvzNQx6cHPgiiOBtRc3Dj6Kcs8+Si13Edy8ViNJ6Mmzeb8VDQS3JpX9sb+cq3iVz+S09kxd8HvrhDykPkyifE1hFCqCaZSOqqh6/eBTAPsJjgUXxJHHz/EZGGz/Ag99nz0RY4+nbO/lOQfS7VmmOyScZ91kU8tpfSZDHRM+FabtzXz2bGKgCoyQbIPhMcEJtSDtVy5eu71Dt9Qhh7aURGciXZG05hAJu3bP510295ozhaJs87nuVW8hAgMfDSWqpxXA0RQpMt6e1u7+0pkH+FfAaUjNOHehAqBGW9ePwa644FsAHzSt+qL3zd+twRAW/FGn74sG5mN3aQwzoECc4Jn0uGpIdj93EET/y2ZZmWWWDBt7T+gAT5Z73J3VSMc4u4Ipku2lI66thPM9GLvN0Kci4BflWe3q2VEYmGgotgkQE18lxKIH37BDNlKDmzAymDpahOxYvSXTQYZStSGLGDfiELA0fb431+TXjGQ4FMk4cX2+VzcN/fjvqDEvfaOSkJIoj3gXUxYeTzuvW3OdVL2Ge/grFlFhqgTEZ6xUj2HhaOH0M0uOicJUzyD9KzpYU3H/HdF68FSuC+zmF/VQNuNKN+uQt9TfKziFWBl11w== 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:(366004)(31686004)(83380400001)(186003)(36756003)(6916009)(5660300002)(8676002)(82960400001)(26005)(53546011)(6506007)(44832011)(31696002)(4326008)(66476007)(6486002)(508600001)(86362001)(2616005)(6512007)(38100700002)(66556008)(8936002)(66946007)(2906002)(6666004)(316002)(54906003)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QmJFaVhSSFVtVG1OVC9pUm5yNWVHcFpWYmo5WWNkdFphTzhUcXQ1WklpWmJ4?= =?utf-8?B?YnEycERVcnZIUXF4RWxPQU9ZM2RyT1VTMXJJa0N2djR6Tm13c3ZVQkVZejUv?= =?utf-8?B?OUJNQW43NVZ2OVpNRmRRUUlPbE1sK0NXTGJrVU1Sa05jamErUllqcVMwZjh6?= =?utf-8?B?SlhxT3J6VENnaXRFUGVtY2N6QUIyai9PaEhtU1pmbXNtV0ZwaTFOMWRGVGRG?= =?utf-8?B?ay9janVjdlpSTmpoWE91ZDNnQkI1c0lJM2luTk5kMHJ5aE1tVmczNDhDMXox?= =?utf-8?B?QmRycmhXa25lb3pJTXhrc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VkZEVnYybE8wWTRC?= =?utf-8?B?YUNDL3NyU1V6b0cyWTVxRTVzWEZabFp1cFIrTDlJbTF1d3pDY0J2YnFIN2gw?= =?utf-8?Q?QdEKNmb8+rq5vt3DQm2Ub1s=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: e0c48f7e-fd9a-430e-1298-08d9da7bd498 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2022 12:12:43.3922 (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: R5vFdCdZnN3QVSXOQu0Z6zq64OWKVuxBzCbpIc9/nzYsGMaYZpYMoy6SIy9KLuo/DihVHio7kwbRPmJedpcaEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4238 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 On 1/18/2022 11:21 AM, kumaraparameshwaran rathinavel wrote: Comment moved down. Please don't top post, it makes very hard to follow the discussion and bad for archives to visit discussion later. > > On Tue, Jan 18, 2022 at 3:17 PM Ferruh Yigit > wrote: > > On 1/17/2022 6:33 PM, Thomas Monjalon wrote: > > 17/01/2022 19:28, Ferruh Yigit: > >>> +   ret = rte_eth_dev_get_port_by_name(request_param->port_name, &port_id); > >>> +   if (ret) { > >>> +           TAP_LOG(ERR, "Failed to get port id for %s", > >>> +                   request_param->port_name); > >>> +           return -1; > >>> +   } > >>> +   dev = &rte_eth_devices[port_id]; > >> > >> Since this is not really related with your patch, I want to have a separate thread for it. > >> > >> It is not good to access the 'rte_eth_devices' global variable directly from a driver, that > >> is error prone. > >> > >> Btw, what 'peer' supposed to contain? > >> > >> It can be solved by adding an internal API, only for drivers to get eth_dev from the name, > >> like: 'rte_eth_dev_get_by_name()'. > >> This way a few other usage can be converted to this API. > >> > >> @Thomas and @Andrew what do you think about the new API proposal? > > > > It looks similar to rte_eth_dev_get_port_by_name() which returns a port_id. > > Exactly, but get eth_dev directly for drivers. For drivers no need to work with port_id > handler, they can use eth_dev directly. > > Another solution can be an getter function for drivers, which gets port_id and returns > the eth_dev. > > > It is a bit strange for an ethdev driver to not have access to its own ethdev struct. > > Isn't there something broken in the logic? > > > > This is callback function between primary and secondary applications sync. So port name > will be same for both, but eth_dev will be different and port_id may be different. > Driver finds its own eth_dev from the shared port name. > > Just wanted to bring it to your attention, > > In Mellanox driver there is a requirement to exchange fds between primary and secondary and similar usage is seen, the primary sends the port_id and the secondary refers to the rte_eth_devices in the driver, > The functions are > - mlx5_mp_secondary_handle in secondary > - mlx5_mp_req_start_rxtx in primary which is invoked from mlx5_dev_start. > > In my implementation I have used the name and invoked get_port_by_name, I can also pass the port_id from the primary to make it uniform. So with similar usage in Mellanox is there a problem there as well on referring to the rte_eth_devices from the PMD ? > It would be same, still will be accessing to the 'rte_eth_devices'. That is why a new API for drivers may help.