From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 2EA602B96 for ; Fri, 3 Feb 2017 12:52:40 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 03 Feb 2017 03:52:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,328,1477983600"; d="scan'208";a="816633093" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.252.22.184]) ([10.252.22.184]) by FMSMGA003.fm.intel.com with ESMTP; 03 Feb 2017 03:52:38 -0800 To: "Lu, Wenzhuo" , "Bie, Tiwei" References: <1485311962-62335-1-git-send-email-wenzhuo.lu@intel.com> <20170125031647.GA6019@debian> <6A0DE07E22DDAD4C9103DF62FEBC09093B55DCF6@shsmsx102.ccr.corp.intel.com> <20170125052443.GA19560@debian> <20cab07d-ed9d-fbec-d00f-c386cb9f87e8@intel.com> <6A0DE07E22DDAD4C9103DF62FEBC09093B5608A4@shsmsx102.ccr.corp.intel.com> Cc: "dev@dpdk.org" From: Ferruh Yigit Message-ID: Date: Fri, 3 Feb 2017 11:52:38 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <6A0DE07E22DDAD4C9103DF62FEBC09093B5608A4@shsmsx102.ccr.corp.intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: clean up rte_eth_dev_info_get X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2017 11:52:41 -0000 On 2/3/2017 6:50 AM, Lu, Wenzhuo wrote: > Hi Ferruh, > >> -----Original Message----- >> From: Yigit, Ferruh >> Sent: Monday, January 30, 2017 8:16 PM >> To: Bie, Tiwei; Lu, Wenzhuo >> Cc: dev@dpdk.org >> Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: clean up rte_eth_dev_info_get >> >> On 1/25/2017 5:24 AM, Tiwei Bie wrote: >>> On Wed, Jan 25, 2017 at 01:13:32PM +0800, Lu, Wenzhuo wrote: >>>> Hi Tiwei, >>>> >>>>> -----Original Message----- >>>>> From: Bie, Tiwei >>>>> Sent: Wednesday, January 25, 2017 11:17 AM >>>>> To: Lu, Wenzhuo >>>>> Cc: dev@dpdk.org >>>>> Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: clean up >>>>> rte_eth_dev_info_get >>>>> >>>>> On Wed, Jan 25, 2017 at 10:39:22AM +0800, Wenzhuo Lu wrote: >>>>>> It'not appropriate to call rte_eth_dev_info_get in PMD, as >>>>>> rte_eth_dev_info_get need to get info from PMD. >>>>>> Remove rte_eth_dev_info_get from PMD code and get the info directly. >>>>>> >>>>>> Signed-off-by: Wenzhuo Lu >>>>>> --- >>>>>> drivers/net/ixgbe/ixgbe_ethdev.c | 144 >>>>>> ++++++++++++++++++--------------------- >>>>>> 1 file changed, 68 insertions(+), 76 deletions(-) >>>>>> >>>>>> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c >>>>>> b/drivers/net/ixgbe/ixgbe_ethdev.c >>>>>> index 64ce55a..f14a68b 100644 >>>>>> --- a/drivers/net/ixgbe/ixgbe_ethdev.c >>>>>> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c >>>>>> @@ -4401,17 +4401,17 @@ static int >>>>> ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, >>>>>> int rar_entry; >>>>>> uint8_t *new_mac = (uint8_t *)(mac_addr); >>>>>> struct rte_eth_dev *dev; >>>>>> - struct rte_eth_dev_info dev_info; >>>>>> + struct rte_pci_device *pci_dev; >>>>>> >>>>>> RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); >>>>>> >>>>>> dev = &rte_eth_devices[port]; >>>>>> - rte_eth_dev_info_get(port, &dev_info); >>>>>> + pci_dev = IXGBE_DEV_TO_PCI(dev); >>>>>> >>>>>> - if (is_ixgbe_pmd(dev_info.driver_name) != 0) >>>>>> + if (is_ixgbe_pmd(dev->data->drv_name)) >>>>>> return -ENOTSUP; >>>>>> >>>>> >>>>> The return value of is_ixgbe_pmd() is not boolean (actually I think >>>>> it should be based on its name). If we omit the comparison with 0, >>>>> the code looks weird. It looks like it'll return -ENOTSUP if the port's driver >> is ixgbe PMD. >>>> >>>> Yes, it’s weird. But what makes it weird is not the missing comparison but >> the function name. >>>> Better changing it to ixgbe_pmd_check. How about it? >>>> >>> >>> Yeah, I also prefer to change the helper function itself. But I'm not >>> good at the naming. I'd like to hear others' opinion. :-) >> >> Agree that it looks wrong without 0 comparison. >> >> Helper function is checking if the given port is an ixgbe port or not, >> unfortunately you need to this for PMD specific APIs. >> So What about is_device_supported(), >> >> I agree it is better if it returns bool, and I also think it is better if it gets the >> rte_eth_dev as input parameter, validating port based on name is API internal >> knowledge. >> >> Also instead of name comparison against fixed string, it can be eth_dev- >>> driver->pci_drv.name against driver->name. This makes function more > Thanks for your suggestion. But I don’t get your point here. > For a specific device, should not the eth_dev->driver->pci_drv.name and the driver->name be the same? Yes they are same. But there is a intention to unlink "eth_drv->pci_drv", to better support non pci devices, so instead of a PMD directly accessing name through this link, I believe it is better to use rte_drier->name, which is more generic. > > >> generic, and perhaps this helper function can be moved into ethdev layer, >> later. For this function needs to get both eth_dev and rte_driver as argument. >> >> >>> >>> Best regards, >>> Tiwei Bie >>> >