Re: [PATCH v2] net/ixgbe: clean up rte_eth_dev_info_get
From: Lu, Wenzhuo <hidden>
Date: 2017-02-06 03:45:47
Hi Tiwei,
-----Original Message----- From: Bie, Tiwei Sent: Monday, February 6, 2017 11:08 AM To: Lu, Wenzhuo Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v2] net/ixgbe: clean up rte_eth_dev_info_get On Mon, Feb 06, 2017 at 10:59:42AM +0800, Lu, Wenzhuo wrote:quoted
Hi Tiwei,quoted
-----Original Message----- From: Bie, Tiwei Sent: Monday, February 6, 2017 10:51 AM To: Lu, Wenzhuo Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v2] net/ixgbe: clean up rte_eth_dev_info_get On Mon, Feb 06, 2017 at 10:41:28AM +0800, Lu, Wenzhuo wrote:quoted
Hi Tiwei,quoted
-----Original Message----- From: Bie, Tiwei Sent: Monday, February 6, 2017 10:31 AM To: Lu, Wenzhuo Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v2] net/ixgbe: clean up rte_eth_dev_info_get On Mon, Feb 06, 2017 at 10:09:32AM +0800, Wenzhuo Lu wrote: [...]quoted
static void ixgbe_dcb_init(struct ixgbe_hw *hw, struct ixgbe_dcb_config *dcb_config); -static int is_ixgbe_pmd(const char *driver_name); +static int is_device_supported(struct rte_eth_dev *dev, +struct eth_driver *drv);Should be: static bool is_device_supported(struct rte_eth_dev *dev, struct eth_driver *drv);O, forget to change it. Thanks.quoted
quoted
/* For Virtual Function support */ static int eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev); @@ -4380,16 +4380,14 @@ static intixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,quoted
ixgbe_add_rar(dev, addr, 0, 0); } -static int -is_ixgbe_pmd(const char *driver_name) +static bool +is_device_supported(struct rte_eth_dev *dev, struct +eth_driver +*drv) { - if (!strstr(driver_name, "ixgbe")) - return -ENOTSUP; + if (strcmp(dev->driver->pci_drv.driver.name, + drv->pci_drv.driver.name)) + return FALSE;It would be better to use `false' instead of `FALSE'.I see both 'false' and 'FALSE' are defined and used. Is there any reason that'false' is better?quoted
I think `true' and `false' are standard keywords defined and reserved by C. So I think it would be better to use them if the return type is`bool'.quoted
O, there's no 'bool' in C. You have to define it. The same for 'false' and 'true'.The `bool', `true' and `false' are all standard keywords defined and reserved by C, although the stdbool.h is not used in ixgbe. C adds this support by introducing a new header stdbool.h: #ifndef __bool_true_false_are_defined #define __bool_true_false_are_defined 1 #ifndef __cplusplus #define false 0 #define true 1 #define bool _Bool #if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER) typedef int _Bool; #endif
O, you're talking about C99. _Bool is a keyword added by it. 'bool', 'true', 'false' are not. That's why this header file have to define them.
#endif /* !__cplusplus */ #endif /* __bool_true_false_are_defined */ Best regards, Tiwei Bie