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 <wenzhuo...@intel.com> > > > --- > > > 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. :-) Best regards, Tiwei Bie