* [dpdk-dev] [PATCH 0/4] rte_ethdev: cleanups @ 2015-04-09 21:29 Stephen Hemminger 2015-04-09 21:29 ` [dpdk-dev] [PATCH 1/4] rte_ethdev: remove extra inline Stephen Hemminger ` (4 more replies) 0 siblings, 5 replies; 10+ messages in thread From: Stephen Hemminger @ 2015-04-09 21:29 UTC (permalink / raw) To: dev A bunch of small (almost trivial) patches to fix style and other issues in the base Ethernet driver interface code. Stephen Hemminger (4): rte_ethdev: remove extra inline rte_ethdev: whitespace cleanup rte_ethdev: make tables const rte_ethdev: remove unnecessary paren on return lib/librte_ether/rte_ethdev.c | 545 +++++++++++++++++++++--------------------- lib/librte_ether/rte_ethdev.h | 57 ++--- 2 files changed, 305 insertions(+), 297 deletions(-) -- 2.1.4 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 1/4] rte_ethdev: remove extra inline 2015-04-09 21:29 [dpdk-dev] [PATCH 0/4] rte_ethdev: cleanups Stephen Hemminger @ 2015-04-09 21:29 ` Stephen Hemminger 2015-04-15 9:52 ` Bruce Richardson 2015-04-09 21:29 ` [dpdk-dev] [PATCH 2/4] rte_ethdev: whitespace cleanup Stephen Hemminger ` (3 subsequent siblings) 4 siblings, 1 reply; 10+ messages in thread From: Stephen Hemminger @ 2015-04-09 21:29 UTC (permalink / raw) To: dev There is no reason to inline functions that are not in the critical path. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/librte_ether/rte_ethdev.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index e20cca5..3120c3a 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -179,7 +179,7 @@ enum { DEV_ATTACHED }; -static inline void +static void rte_eth_dev_data_alloc(void) { const unsigned flags = 0; @@ -255,7 +255,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type) return eth_dev; } -static inline int +static int rte_eth_dev_create_unique_device_name(char *name, size_t size, struct rte_pci_device *pci_dev) { @@ -2415,7 +2415,7 @@ rte_eth_dev_priority_flow_ctrl_set(uint8_t port_id, struct rte_eth_pfc_conf *pfc return (-ENOTSUP); } -static inline int +static int rte_eth_check_reta_mask(struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) { @@ -2439,7 +2439,7 @@ rte_eth_check_reta_mask(struct rte_eth_rss_reta_entry64 *reta_conf, return -EINVAL; } -static inline int +static int rte_eth_check_reta_entry(struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size, uint8_t max_rxq) @@ -2648,7 +2648,7 @@ rte_eth_led_off(uint8_t port_id) * Returns index into MAC address array of addr. Use 00:00:00:00:00:00 to find * an empty spot. */ -static inline int +static int get_mac_addr_index(uint8_t port_id, struct ether_addr *addr) { struct rte_eth_dev_info dev_info; @@ -2789,7 +2789,7 @@ rte_eth_dev_set_vf_rxmode(uint8_t port_id, uint16_t vf, * Returns index into MAC address array of addr. Use 00:00:00:00:00:00 to find * an empty spot. */ -static inline int +static int get_hash_mac_addr_index(uint8_t port_id, struct ether_addr *addr) { struct rte_eth_dev_info dev_info; -- 2.1.4 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH 1/4] rte_ethdev: remove extra inline 2015-04-09 21:29 ` [dpdk-dev] [PATCH 1/4] rte_ethdev: remove extra inline Stephen Hemminger @ 2015-04-15 9:52 ` Bruce Richardson 0 siblings, 0 replies; 10+ messages in thread From: Bruce Richardson @ 2015-04-15 9:52 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev On Thu, Apr 09, 2015 at 02:29:39PM -0700, Stephen Hemminger wrote: > There is no reason to inline functions that are not in the critical > path. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Bruce Richardson <bruce.richardson@intel.com> > --- > lib/librte_ether/rte_ethdev.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index e20cca5..3120c3a 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -179,7 +179,7 @@ enum { > DEV_ATTACHED > }; > > -static inline void > +static void > rte_eth_dev_data_alloc(void) > { > const unsigned flags = 0; > @@ -255,7 +255,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type) > return eth_dev; > } > > -static inline int > +static int > rte_eth_dev_create_unique_device_name(char *name, size_t size, > struct rte_pci_device *pci_dev) > { > @@ -2415,7 +2415,7 @@ rte_eth_dev_priority_flow_ctrl_set(uint8_t port_id, struct rte_eth_pfc_conf *pfc > return (-ENOTSUP); > } > > -static inline int > +static int > rte_eth_check_reta_mask(struct rte_eth_rss_reta_entry64 *reta_conf, > uint16_t reta_size) > { > @@ -2439,7 +2439,7 @@ rte_eth_check_reta_mask(struct rte_eth_rss_reta_entry64 *reta_conf, > return -EINVAL; > } > > -static inline int > +static int > rte_eth_check_reta_entry(struct rte_eth_rss_reta_entry64 *reta_conf, > uint16_t reta_size, > uint8_t max_rxq) > @@ -2648,7 +2648,7 @@ rte_eth_led_off(uint8_t port_id) > * Returns index into MAC address array of addr. Use 00:00:00:00:00:00 to find > * an empty spot. > */ > -static inline int > +static int > get_mac_addr_index(uint8_t port_id, struct ether_addr *addr) > { > struct rte_eth_dev_info dev_info; > @@ -2789,7 +2789,7 @@ rte_eth_dev_set_vf_rxmode(uint8_t port_id, uint16_t vf, > * Returns index into MAC address array of addr. Use 00:00:00:00:00:00 to find > * an empty spot. > */ > -static inline int > +static int > get_hash_mac_addr_index(uint8_t port_id, struct ether_addr *addr) > { > struct rte_eth_dev_info dev_info; > -- > 2.1.4 > ^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 2/4] rte_ethdev: whitespace cleanup 2015-04-09 21:29 [dpdk-dev] [PATCH 0/4] rte_ethdev: cleanups Stephen Hemminger 2015-04-09 21:29 ` [dpdk-dev] [PATCH 1/4] rte_ethdev: remove extra inline Stephen Hemminger @ 2015-04-09 21:29 ` Stephen Hemminger 2015-04-15 9:53 ` Bruce Richardson 2015-04-09 21:29 ` [dpdk-dev] [PATCH 3/4] rte_ethdev: make tables const Stephen Hemminger ` (2 subsequent siblings) 4 siblings, 1 reply; 10+ messages in thread From: Stephen Hemminger @ 2015-04-09 21:29 UTC (permalink / raw) To: dev Fix space after keywords, and other missing whitespace. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/librte_ether/rte_ethdev.c | 191 ++++++++++++++++++++++-------------------- lib/librte_ether/rte_ethdev.h | 57 ++++++------- 2 files changed, 128 insertions(+), 120 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 3120c3a..56e22ea 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -83,13 +83,13 @@ PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \ return (retval); \ } \ -} while(0) +} while (0) #define PROC_PRIMARY_OR_RET() do { \ if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \ PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \ return; \ } \ -} while(0) +} while (0) /* Macros to check for invlaid function pointers in dev_ops structure */ #define FUNC_PTR_OR_ERR_RET(func, retval) do { \ @@ -97,13 +97,13 @@ PMD_DEBUG_TRACE("Function not supported\n"); \ return (retval); \ } \ -} while(0) +} while (0) #define FUNC_PTR_OR_RET(func) do { \ if ((func) == NULL) { \ PMD_DEBUG_TRACE("Function not supported\n"); \ return; \ } \ -} while(0) +} while (0) static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data"; struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS]; @@ -185,7 +185,7 @@ rte_eth_dev_data_alloc(void) const unsigned flags = 0; const struct rte_memzone *mz; - if (rte_eal_process_type() == RTE_PROC_PRIMARY){ + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { mz = rte_memzone_reserve(MZ_RTE_ETH_DEV_DATA, RTE_MAX_ETHPORTS * sizeof(*rte_eth_dev_data), rte_socket_id(), flags); @@ -257,7 +257,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type) static int rte_eth_dev_create_unique_device_name(char *name, size_t size, - struct rte_pci_device *pci_dev) + struct rte_pci_device *pci_dev) { int ret; @@ -265,8 +265,8 @@ rte_eth_dev_create_unique_device_name(char *name, size_t size, return -EINVAL; ret = snprintf(name, size, "%d:%d.%d", - pci_dev->addr.bus, pci_dev->addr.devid, - pci_dev->addr.function); + pci_dev->addr.bus, pci_dev->addr.devid, + pci_dev->addr.function); if (ret < 0) return ret; return 0; @@ -303,7 +303,7 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv, if (eth_dev == NULL) return -ENOMEM; - if (rte_eal_process_type() == RTE_PROC_PRIMARY){ + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { eth_dev->data->dev_private = rte_zmalloc("ethdev private structure", eth_drv->dev_private_size, RTE_CACHE_LINE_SIZE); @@ -699,9 +699,9 @@ rte_eth_dev_detach(uint8_t port_id, char *name) ret = rte_eth_dev_detach_pdev(port_id, &addr); if (ret == 0) snprintf(name, RTE_ETH_NAME_MAX_LEN, - "%04x:%02x:%02x.%d", - addr.domain, addr.bus, - addr.devid, addr.function); + "%04x:%02x:%02x.%d", + addr.domain, addr.bus, + addr.devid, addr.function); return ret; } else @@ -710,7 +710,7 @@ rte_eth_dev_detach(uint8_t port_id, char *name) #else /* RTE_LIBRTE_EAL_HOTPLUG */ int rte_eth_dev_attach(const char *devargs __rte_unused, - uint8_t *port_id __rte_unused) + uint8_t *port_id __rte_unused) { RTE_LOG(ERR, EAL, "Hotplug support isn't enabled\n"); return -1; @@ -719,7 +719,7 @@ rte_eth_dev_attach(const char *devargs __rte_unused, /* detach the device, then store the name of the device */ int rte_eth_dev_detach(uint8_t port_id __rte_unused, - char *name __rte_unused) + char *name __rte_unused) { RTE_LOG(ERR, EAL, "Hotplug support isn't enabled\n"); return -1; @@ -754,6 +754,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) return -(ENOMEM); if (nb_queues > old_nb_queues) { uint16_t new_qs = nb_queues - old_nb_queues; + memset(rxq + old_nb_queues, 0, sizeof(rxq[0]) * new_qs); } @@ -897,6 +898,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) return -ENOMEM; if (nb_queues > old_nb_queues) { uint16_t new_qs = nb_queues - old_nb_queues; + memset(txq + old_nb_queues, 0, sizeof(txq[0]) * new_qs); } @@ -912,6 +914,7 @@ static int rte_eth_dev_check_vf_rss_rxq_num(uint8_t port_id, uint16_t nb_rx_q) { struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + switch (nb_rx_q) { case 1: case 2: @@ -1025,8 +1028,8 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, return (-EINVAL); } conf = &(dev_conf->rx_adv_conf.vmdq_dcb_conf); - if (! (conf->nb_queue_pools == ETH_16_POOLS || - conf->nb_queue_pools == ETH_32_POOLS)) { + if (!(conf->nb_queue_pools == ETH_16_POOLS || + conf->nb_queue_pools == ETH_32_POOLS)) { PMD_DEBUG_TRACE("ethdev port_id=%d VMDQ+DCB selected, " "nb_queue_pools must be %d or %d\n", port_id, ETH_16_POOLS, ETH_32_POOLS); @@ -1043,8 +1046,8 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, return (-EINVAL); } conf = &(dev_conf->tx_adv_conf.vmdq_dcb_tx_conf); - if (! (conf->nb_queue_pools == ETH_16_POOLS || - conf->nb_queue_pools == ETH_32_POOLS)) { + if (!(conf->nb_queue_pools == ETH_16_POOLS || + conf->nb_queue_pools == ETH_32_POOLS)) { PMD_DEBUG_TRACE("ethdev port_id=%d VMDQ+DCB selected, " "nb_queue_pools != %d or nb_queue_pools " "!= %d\n", @@ -1064,8 +1067,8 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, return (-EINVAL); } conf = &(dev_conf->rx_adv_conf.dcb_rx_conf); - if (! (conf->nb_tcs == ETH_4_TCS || - conf->nb_tcs == ETH_8_TCS)) { + if (!(conf->nb_tcs == ETH_4_TCS || + conf->nb_tcs == ETH_8_TCS)) { PMD_DEBUG_TRACE("ethdev port_id=%d DCB selected, " "nb_tcs != %d or nb_tcs " "!= %d\n", @@ -1084,8 +1087,8 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, return (-EINVAL); } conf = &(dev_conf->tx_adv_conf.dcb_tx_conf); - if (! (conf->nb_tcs == ETH_4_TCS || - conf->nb_tcs == ETH_8_TCS)) { + if (!(conf->nb_tcs == ETH_4_TCS || + conf->nb_tcs == ETH_8_TCS)) { PMD_DEBUG_TRACE("ethdev port_id=%d DCB selected, " "nb_tcs != %d or nb_tcs " "!= %d\n", @@ -1195,8 +1198,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, (unsigned)dev_conf->rxmode.max_rx_pkt_len, (unsigned)dev_info.max_rx_pktlen); return (-EINVAL); - } - else if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN) { + } else if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN) { PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u" " < min valid value %u\n", port_id, @@ -1739,7 +1741,7 @@ rte_eth_stats_reset(uint8_t port_id) /* retrieve ethdev extended statistics */ int rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, - unsigned n) + unsigned n) { struct rte_eth_stats eth_stats; struct rte_eth_dev *dev; @@ -1776,7 +1778,7 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, stats_ptr = (char *)ð_stats + rte_stats_strings[i].offset; val = *(uint64_t *)stats_ptr; snprintf(xstats[count].name, sizeof(xstats[count].name), - "%s", rte_stats_strings[i].name); + "%s", rte_stats_strings[i].name); xstats[count++].value = val; } @@ -1788,8 +1790,8 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, stats_ptr += q * sizeof(uint64_t); val = *(uint64_t *)stats_ptr; snprintf(xstats[count].name, sizeof(xstats[count].name), - "rx_queue_%u_%s", q, - rte_rxq_stats_strings[i].name); + "rx_queue_%u_%s", q, + rte_rxq_stats_strings[i].name); xstats[count++].value = val; } } @@ -1802,8 +1804,8 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, stats_ptr += q * sizeof(uint64_t); val = *(uint64_t *)stats_ptr; snprintf(xstats[count].name, sizeof(xstats[count].name), - "tx_queue_%u_%s", q, - rte_txq_stats_strings[i].name); + "tx_queue_%u_%s", q, + rte_txq_stats_strings[i].name); xstats[count++].value = val; } } @@ -1954,7 +1956,7 @@ rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on) } dev = &rte_eth_devices[port_id]; - if (! (dev->data->dev_conf.rxmode.hw_vlan_filter)) { + if (!(dev->data->dev_conf.rxmode.hw_vlan_filter)) { PMD_DEBUG_TRACE("port %d: vlan-filtering disabled\n", port_id); return (-ENOSYS); } @@ -2026,27 +2028,27 @@ rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask) /*check which option changed by application*/ cur = !!(offload_mask & ETH_VLAN_STRIP_OFFLOAD); org = !!(dev->data->dev_conf.rxmode.hw_vlan_strip); - if (cur != org){ + if (cur != org) { dev->data->dev_conf.rxmode.hw_vlan_strip = (uint8_t)cur; mask |= ETH_VLAN_STRIP_MASK; } cur = !!(offload_mask & ETH_VLAN_FILTER_OFFLOAD); org = !!(dev->data->dev_conf.rxmode.hw_vlan_filter); - if (cur != org){ + if (cur != org) { dev->data->dev_conf.rxmode.hw_vlan_filter = (uint8_t)cur; mask |= ETH_VLAN_FILTER_MASK; } cur = !!(offload_mask & ETH_VLAN_EXTEND_OFFLOAD); org = !!(dev->data->dev_conf.rxmode.hw_vlan_extend); - if (cur != org){ + if (cur != org) { dev->data->dev_conf.rxmode.hw_vlan_extend = (uint8_t)cur; mask |= ETH_VLAN_EXTEND_MASK; } /*no change*/ - if(mask == 0) + if (mask == 0) return ret; FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_offload_set, -ENOTSUP); @@ -2069,13 +2071,13 @@ rte_eth_dev_get_vlan_offload(uint8_t port_id) dev = &rte_eth_devices[port_id]; if (dev->data->dev_conf.rxmode.hw_vlan_strip) - ret |= ETH_VLAN_STRIP_OFFLOAD ; + ret |= ETH_VLAN_STRIP_OFFLOAD; if (dev->data->dev_conf.rxmode.hw_vlan_filter) - ret |= ETH_VLAN_FILTER_OFFLOAD ; + ret |= ETH_VLAN_FILTER_OFFLOAD; if (dev->data->dev_conf.rxmode.hw_vlan_extend) - ret |= ETH_VLAN_EXTEND_OFFLOAD ; + ret |= ETH_VLAN_EXTEND_OFFLOAD; return ret; } @@ -2120,8 +2122,8 @@ rte_eth_dev_fdir_add_signature_filter(uint8_t port_id, if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP || fdir_filter->l4type == RTE_FDIR_L4TYPE_NONE) && (fdir_filter->port_src || fdir_filter->port_dst)) { - PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " \ - "None l4type, source & destinations ports " \ + PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " + "None l4type, source & destinations ports " "should be null!\n"); return (-EINVAL); } @@ -2154,8 +2156,8 @@ rte_eth_dev_fdir_update_signature_filter(uint8_t port_id, if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP || fdir_filter->l4type == RTE_FDIR_L4TYPE_NONE) && (fdir_filter->port_src || fdir_filter->port_dst)) { - PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " \ - "None l4type, source & destinations ports " \ + PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " + "None l4type, source & destinations ports " "should be null!\n"); return (-EINVAL); } @@ -2188,8 +2190,8 @@ rte_eth_dev_fdir_remove_signature_filter(uint8_t port_id, if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP || fdir_filter->l4type == RTE_FDIR_L4TYPE_NONE) && (fdir_filter->port_src || fdir_filter->port_dst)) { - PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " \ - "None l4type source & destinations ports " \ + PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " + "None l4type source & destinations ports " "should be null!\n"); return (-EINVAL); } @@ -2209,7 +2211,7 @@ rte_eth_dev_fdir_get_infos(uint8_t port_id, struct rte_eth_fdir *fdir) } dev = &rte_eth_devices[port_id]; - if (! (dev->data->dev_conf.fdir_conf.mode)) { + if (!(dev->data->dev_conf.fdir_conf.mode)) { PMD_DEBUG_TRACE("port %d: pkt-filter disabled\n", port_id); return (-ENOSYS); } @@ -2244,8 +2246,8 @@ rte_eth_dev_fdir_add_perfect_filter(uint8_t port_id, if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP || fdir_filter->l4type == RTE_FDIR_L4TYPE_NONE) && (fdir_filter->port_src || fdir_filter->port_dst)) { - PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " \ - "None l4type, source & destinations ports " \ + PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " + "None l4type, source & destinations ports " "should be null!\n"); return (-EINVAL); } @@ -2284,8 +2286,8 @@ rte_eth_dev_fdir_update_perfect_filter(uint8_t port_id, if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP || fdir_filter->l4type == RTE_FDIR_L4TYPE_NONE) && (fdir_filter->port_src || fdir_filter->port_dst)) { - PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " \ - "None l4type, source & destinations ports " \ + PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " + "None l4type, source & destinations ports " "should be null!\n"); return (-EINVAL); } @@ -2322,8 +2324,8 @@ rte_eth_dev_fdir_remove_perfect_filter(uint8_t port_id, if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP || fdir_filter->l4type == RTE_FDIR_L4TYPE_NONE) && (fdir_filter->port_src || fdir_filter->port_dst)) { - PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " \ - "None l4type, source & destinations ports " \ + PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " + "None l4type, source & destinations ports " "should be null!\n"); return (-EINVAL); } @@ -2348,7 +2350,7 @@ rte_eth_dev_fdir_set_masks(uint8_t port_id, struct rte_fdir_masks *fdir_mask) } dev = &rte_eth_devices[port_id]; - if (! (dev->data->dev_conf.fdir_conf.mode)) { + if (!(dev->data->dev_conf.fdir_conf.mode)) { PMD_DEBUG_TRACE("port %d: pkt-filter disabled\n", port_id); return (-ENOSYS); } @@ -2688,7 +2690,7 @@ rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr, return (-EINVAL); } if (pool >= ETH_64_POOLS) { - PMD_DEBUG_TRACE("pool id must be 0-%d\n",ETH_64_POOLS - 1); + PMD_DEBUG_TRACE("pool id must be 0-%d\n", ETH_64_POOLS - 1); return (-EINVAL); } @@ -2771,16 +2773,16 @@ rte_eth_dev_set_vf_rxmode(uint8_t port_id, uint16_t vf, rte_eth_dev_info_get(port_id, &dev_info); num_vfs = dev_info.max_vfs; - if (vf > num_vfs) - { + if (vf > num_vfs) { PMD_DEBUG_TRACE("set VF RX mode:invalid VF id %d\n", vf); return (-EINVAL); } - if (rx_mode == 0) - { + + if (rx_mode == 0) { PMD_DEBUG_TRACE("set VF RX mode:mode mask ca not be zero\n"); return (-EINVAL); } + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx_mode, -ENOTSUP); return (*dev->dev_ops->set_vf_rx_mode)(dev, vf, rx_mode, on); } @@ -2837,7 +2839,7 @@ rte_eth_dev_uc_hash_table_set(uint8_t port_id, struct ether_addr *addr, if (index < 0) { if (!on) { PMD_DEBUG_TRACE("port %d: the MAC address was not" - "set in UTA\n", port_id); + " set in UTA\n", port_id); return (-EINVAL); } @@ -2882,7 +2884,7 @@ rte_eth_dev_uc_all_hash_table_set(uint8_t port_id, uint8_t on) } int -rte_eth_dev_set_vf_rx(uint8_t port_id,uint16_t vf, uint8_t on) +rte_eth_dev_set_vf_rx(uint8_t port_id, uint16_t vf, uint8_t on) { uint16_t num_vfs; struct rte_eth_dev *dev; @@ -2897,18 +2899,17 @@ rte_eth_dev_set_vf_rx(uint8_t port_id,uint16_t vf, uint8_t on) rte_eth_dev_info_get(port_id, &dev_info); num_vfs = dev_info.max_vfs; - if (vf > num_vfs) - { + if (vf > num_vfs) { PMD_DEBUG_TRACE("port %d: invalid vf id\n", port_id); return (-EINVAL); } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx, -ENOTSUP); - return (*dev->dev_ops->set_vf_rx)(dev, vf,on); + return (*dev->dev_ops->set_vf_rx)(dev, vf, on); } int -rte_eth_dev_set_vf_tx(uint8_t port_id,uint16_t vf, uint8_t on) +rte_eth_dev_set_vf_tx(uint8_t port_id, uint16_t vf, uint8_t on) { uint16_t num_vfs; struct rte_eth_dev *dev; @@ -2923,19 +2924,18 @@ rte_eth_dev_set_vf_tx(uint8_t port_id,uint16_t vf, uint8_t on) rte_eth_dev_info_get(port_id, &dev_info); num_vfs = dev_info.max_vfs; - if (vf > num_vfs) - { + if (vf > num_vfs) { PMD_DEBUG_TRACE("set pool tx:invalid pool id=%d\n", vf); return (-EINVAL); } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_tx, -ENOTSUP); - return (*dev->dev_ops->set_vf_tx)(dev, vf,on); + return (*dev->dev_ops->set_vf_tx)(dev, vf, on); } int rte_eth_dev_set_vf_vlan_filter(uint8_t port_id, uint16_t vlan_id, - uint64_t vf_mask,uint8_t vlan_on) + uint64_t vf_mask, uint8_t vlan_on) { struct rte_eth_dev *dev; @@ -2946,21 +2946,20 @@ rte_eth_dev_set_vf_vlan_filter(uint8_t port_id, uint16_t vlan_id, } dev = &rte_eth_devices[port_id]; - if(vlan_id > ETHER_MAX_VLAN_ID) - { + if (vlan_id > ETHER_MAX_VLAN_ID) { PMD_DEBUG_TRACE("VF VLAN filter:invalid VLAN id=%d\n", vlan_id); return (-EINVAL); } - if (vf_mask == 0) - { + + if (vf_mask == 0) { PMD_DEBUG_TRACE("VF VLAN filter:pool_mask can not be 0\n"); return (-EINVAL); } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_filter, -ENOTSUP); return (*dev->dev_ops->set_vf_vlan_filter)(dev, vlan_id, - vf_mask,vlan_on); + vf_mask, vlan_on); } int rte_eth_set_queue_rate_limit(uint8_t port_id, uint16_t queue_idx, @@ -3052,20 +3051,19 @@ rte_eth_mirror_rule_set(uint8_t port_id, } if (mirror_conf->dst_pool >= ETH_64_POOLS) { - PMD_DEBUG_TRACE("Invalid dst pool, pool id must" - "be 0-%d\n",ETH_64_POOLS - 1); + PMD_DEBUG_TRACE("Invalid dst pool, pool id must " + "be 0-%d\n", ETH_64_POOLS - 1); return (-EINVAL); } if ((mirror_conf->rule_type_mask & ETH_VMDQ_POOL_MIRROR) && (mirror_conf->pool_mask == 0)) { - PMD_DEBUG_TRACE("Invalid mirror pool, pool mask can not" + PMD_DEBUG_TRACE("Invalid mirror pool, pool mask can not " "be 0.\n"); return (-EINVAL); } - if(rule_id >= ETH_VMDQ_NUM_MIRROR_RULE) - { + if (rule_id >= ETH_VMDQ_NUM_MIRROR_RULE) { PMD_DEBUG_TRACE("Invalid rule_id, rule_id must be 0-%d\n", ETH_VMDQ_NUM_MIRROR_RULE - 1); return (-EINVAL); @@ -3087,8 +3085,7 @@ rte_eth_mirror_rule_reset(uint8_t port_id, uint8_t rule_id) return (-ENODEV); } - if(rule_id >= ETH_VMDQ_NUM_MIRROR_RULE) - { + if (rule_id >= ETH_VMDQ_NUM_MIRROR_RULE) { PMD_DEBUG_TRACE("Invalid rule_id, rule_id must be 0-%d\n", ETH_VMDQ_NUM_MIRROR_RULE-1); return (-EINVAL); @@ -3171,8 +3168,8 @@ rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset) dev = &rte_eth_devices[port_id]; FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP); - return (*dev->dev_ops->rx_descriptor_done)( \ - dev->data->rx_queues[queue_id], offset); + return (*dev->dev_ops->rx_descriptor_done) + (dev->data->rx_queues[queue_id], offset); } #endif @@ -3204,8 +3201,9 @@ rte_eth_dev_callback_register(uint8_t port_id, } /* create a new callback. */ - if (user_cb == NULL && (user_cb = rte_zmalloc("INTR_USER_CALLBACK", - sizeof(struct rte_eth_dev_callback), 0)) != NULL) { + if (user_cb == NULL && + !(user_cb = rte_zmalloc("INTR_USER_CALLBACK", + sizeof(struct rte_eth_dev_callback), 0))) { user_cb->cb_fn = cb_fn; user_cb->cb_arg = cb_arg; user_cb->event = event; @@ -3293,7 +3291,8 @@ int rte_eth_dev_bypass_init(uint8_t port_id) return (-ENODEV); } - if ((dev= &rte_eth_devices[port_id]) == NULL) { + dev = &rte_eth_devices[port_id]; + if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); return (-ENODEV); } @@ -3313,7 +3312,8 @@ rte_eth_dev_bypass_state_show(uint8_t port_id, uint32_t *state) return (-ENODEV); } - if ((dev= &rte_eth_devices[port_id]) == NULL) { + dev = &rte_eth_devices[port_id]; + if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); return (-ENODEV); } @@ -3332,7 +3332,8 @@ rte_eth_dev_bypass_state_set(uint8_t port_id, uint32_t *new_state) return (-ENODEV); } - if ((dev= &rte_eth_devices[port_id]) == NULL) { + dev = &rte_eth_devices[port_id]; + if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); return (-ENODEV); } @@ -3352,7 +3353,8 @@ rte_eth_dev_bypass_event_show(uint8_t port_id, uint32_t event, uint32_t *state) return (-ENODEV); } - if ((dev= &rte_eth_devices[port_id]) == NULL) { + dev = &rte_eth_devices[port_id]; + if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); return (-ENODEV); } @@ -3372,7 +3374,8 @@ rte_eth_dev_bypass_event_store(uint8_t port_id, uint32_t event, uint32_t state) return (-ENODEV); } - if ((dev= &rte_eth_devices[port_id]) == NULL) { + dev = &rte_eth_devices[port_id]; + if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); return (-ENODEV); } @@ -3392,7 +3395,8 @@ rte_eth_dev_wd_timeout_store(uint8_t port_id, uint32_t timeout) return (-ENODEV); } - if ((dev= &rte_eth_devices[port_id]) == NULL) { + dev = &rte_eth_devices[port_id]; + if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); return (-ENODEV); } @@ -3412,7 +3416,8 @@ rte_eth_dev_bypass_ver_show(uint8_t port_id, uint32_t *ver) return (-ENODEV); } - if ((dev= &rte_eth_devices[port_id]) == NULL) { + dev = &rte_eth_devices[port_id]; + if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); return (-ENODEV); } @@ -3432,7 +3437,8 @@ rte_eth_dev_bypass_wd_timeout_show(uint8_t port_id, uint32_t *wd_timeout) return (-ENODEV); } - if ((dev= &rte_eth_devices[port_id]) == NULL) { + dev = &rte_eth_devices[port_id]; + if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); return (-ENODEV); } @@ -3452,7 +3458,8 @@ rte_eth_dev_bypass_wd_reset(uint8_t port_id) return (-ENODEV); } - if ((dev= &rte_eth_devices[port_id]) == NULL) { + dev = &rte_eth_devices[port_id]; + if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); return (-ENODEV); } diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index e8df027..47a60e5 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -229,7 +229,7 @@ struct rte_eth_link { uint16_t link_speed; /**< ETH_LINK_SPEED_[10, 100, 1000, 10000] */ uint16_t link_duplex; /**< ETH_LINK_[HALF_DUPLEX, FULL_DUPLEX] */ uint8_t link_status : 1; /**< 1 -> link up, 0 -> link down */ -}__attribute__((aligned(8))); /**< aligned for atomic64 read/write */ +} __attribute__((aligned(8))); /**< aligned for atomic64 read/write */ #define ETH_LINK_SPEED_AUTONEG 0 /**< Auto-negotiate link speed. */ #define ETH_LINK_SPEED_10 10 /**< 10 megabits/second. */ @@ -726,7 +726,7 @@ enum rte_l4type { */ enum rte_iptype { RTE_FDIR_IPTYPE_IPV4 = 0, /**< IPv4. */ - RTE_FDIR_IPTYPE_IPV6 , /**< IPv6. */ + RTE_FDIR_IPTYPE_IPV6, /**< IPv6. */ }; /** @@ -840,7 +840,7 @@ struct rte_eth_conf { struct rte_eth_rxmode rxmode; /**< Port RX configuration. */ struct rte_eth_txmode txmode; /**< Port TX configuration. */ uint32_t lpbk_mode; /**< Loopback operation mode. By default the value - is 0, meaning the loopback mode is disabled. + is 0, meaning the loopback mode is disabled. Read the datasheet of given ethernet controller for details. The possible values of this field are defined in implementation of each driver. */ @@ -1363,17 +1363,18 @@ struct eth_dev_ops { reta_update_t reta_update; /** Query redirection table. */ reta_query_t reta_query; - /* bypass control */ + #ifdef RTE_NIC_BYPASS - bypass_init_t bypass_init; - bypass_state_set_t bypass_state_set; - bypass_state_show_t bypass_state_show; - bypass_event_set_t bypass_event_set; - bypass_event_show_t bypass_event_show; - bypass_wd_timeout_set_t bypass_wd_timeout_set; - bypass_wd_timeout_show_t bypass_wd_timeout_show; - bypass_ver_show_t bypass_ver_show; - bypass_wd_reset_t bypass_wd_reset; + /* bypass control */ + bypass_init_t bypass_init; + bypass_state_set_t bypass_state_set; + bypass_state_show_t bypass_state_show; + bypass_event_set_t bypass_event_set; + bypass_event_show_t bypass_event_show; + bypass_wd_timeout_set_t bypass_wd_timeout_set; + bypass_wd_timeout_show_t bypass_wd_timeout_show; + bypass_ver_show_t bypass_ver_show; + bypass_wd_reset_t bypass_wd_reset; #endif /** Configure RSS hash protocols. */ @@ -1529,10 +1530,10 @@ struct rte_eth_dev_data { /**< Common rx buffer size handled by all queues */ uint64_t rx_mbuf_alloc_failed; /**< RX ring mbuf allocation failures. */ - struct ether_addr* mac_addrs;/**< Device Ethernet Link address. */ + struct ether_addr *mac_addrs;/**< Device Ethernet Link address. */ uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR]; /** bitmap array of associating Ethernet MAC addresses to pools */ - struct ether_addr* hash_mac_addrs; + struct ether_addr *hash_mac_addrs; /** Device Ethernet MAC addresses of hash filtering. */ uint8_t port_id; /**< Device [external] port identifier. */ uint8_t promiscuous : 1, /**< RX promiscuous mode ON(1) / OFF(0). */ @@ -2228,7 +2229,7 @@ extern int rte_eth_dev_set_mtu(uint8_t port_id, uint16_t mtu); * - (-ENOSYS) if VLAN filtering on *port_id* disabled. * - (-EINVAL) if *vlan_id* > 4095. */ -extern int rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id , int on); +extern int rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on); /** * Enable/Disable hardware VLAN Strip by a rx queue of an Ethernet device. @@ -2449,10 +2450,10 @@ extern uint32_t rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id); static inline uint32_t rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id) { - struct rte_eth_dev *dev; + struct rte_eth_dev *dev; - dev = &rte_eth_devices[port_id]; - return (*dev->dev_ops->rx_queue_count)(dev, queue_id); + dev = &rte_eth_devices[port_id]; + return (*dev->dev_ops->rx_queue_count)(dev, queue_id); } #endif @@ -2481,8 +2482,8 @@ rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset) struct rte_eth_dev *dev; dev = &rte_eth_devices[port_id]; - return (*dev->dev_ops->rx_descriptor_done)( \ - dev->data->rx_queues[queue_id], offset); + return (*dev->dev_ops->rx_descriptor_done) + (dev->data->rx_queues[queue_id], offset); } #endif @@ -2798,8 +2799,8 @@ enum rte_eth_event_type { RTE_ETH_EVENT_MAX /**< max value of this enum */ }; -typedef void (*rte_eth_dev_cb_fn)(uint8_t port_id, \ - enum rte_eth_event_type event, void *cb_arg); +typedef void (*rte_eth_dev_cb_fn)(uint8_t port_id, + enum rte_eth_event_type event, void *cb_arg); /**< user application callback to be registered for interrupts */ @@ -3031,8 +3032,8 @@ int rte_eth_dev_rss_reta_query(uint8_t port, * - (-ENODEV) if *port_id* invalid. * - (-EINVAL) if bad parameter. */ -int rte_eth_dev_uc_hash_table_set(uint8_t port,struct ether_addr *addr, - uint8_t on); +int rte_eth_dev_uc_hash_table_set(uint8_t port, struct ether_addr *addr, + uint8_t on); /** * Updates all unicast hash bitmaps for receiving packet with any Unicast @@ -3051,7 +3052,7 @@ int rte_eth_dev_uc_hash_table_set(uint8_t port,struct ether_addr *addr, * - (-ENODEV) if *port_id* invalid. * - (-EINVAL) if bad parameter. */ -int rte_eth_dev_uc_all_hash_table_set(uint8_t port,uint8_t on); +int rte_eth_dev_uc_all_hash_table_set(uint8_t port, uint8_t on); /** * Set RX L2 Filtering mode of a VF of an Ethernet device. @@ -3095,7 +3096,7 @@ int rte_eth_dev_set_vf_rxmode(uint8_t port, uint16_t vf, uint16_t rx_mode, * - (-EINVAL) if bad parameter. */ int -rte_eth_dev_set_vf_tx(uint8_t port,uint16_t vf, uint8_t on); +rte_eth_dev_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on); /** * Enable or disable a VF traffic receive of an Ethernet device. @@ -3114,7 +3115,7 @@ rte_eth_dev_set_vf_tx(uint8_t port,uint16_t vf, uint8_t on); * - (-EINVAL) if bad parameter. */ int -rte_eth_dev_set_vf_rx(uint8_t port,uint16_t vf, uint8_t on); +rte_eth_dev_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on); /** * Enable/Disable hardware VF VLAN filtering by an Ethernet device of -- 2.1.4 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH 2/4] rte_ethdev: whitespace cleanup 2015-04-09 21:29 ` [dpdk-dev] [PATCH 2/4] rte_ethdev: whitespace cleanup Stephen Hemminger @ 2015-04-15 9:53 ` Bruce Richardson 0 siblings, 0 replies; 10+ messages in thread From: Bruce Richardson @ 2015-04-15 9:53 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev On Thu, Apr 09, 2015 at 02:29:40PM -0700, Stephen Hemminger wrote: > Fix space after keywords, and other missing whitespace. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Partial NAK for now. Mostly this looks ok, but I disagree with the changes to the indentation of continued lines. Until we get agreement on what the standard way of doing this on DPDK is, making these changes is premature. [Plus I like the existing way of double-tab :-)]. /Bruce > --- > lib/librte_ether/rte_ethdev.c | 191 ++++++++++++++++++++++-------------------- > lib/librte_ether/rte_ethdev.h | 57 ++++++------- > 2 files changed, 128 insertions(+), 120 deletions(-) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index 3120c3a..56e22ea 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -83,13 +83,13 @@ > PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \ > return (retval); \ > } \ > -} while(0) > +} while (0) > #define PROC_PRIMARY_OR_RET() do { \ > if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \ > PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \ > return; \ > } \ > -} while(0) > +} while (0) > > /* Macros to check for invlaid function pointers in dev_ops structure */ > #define FUNC_PTR_OR_ERR_RET(func, retval) do { \ > @@ -97,13 +97,13 @@ > PMD_DEBUG_TRACE("Function not supported\n"); \ > return (retval); \ > } \ > -} while(0) > +} while (0) > #define FUNC_PTR_OR_RET(func) do { \ > if ((func) == NULL) { \ > PMD_DEBUG_TRACE("Function not supported\n"); \ > return; \ > } \ > -} while(0) > +} while (0) > > static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data"; > struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS]; > @@ -185,7 +185,7 @@ rte_eth_dev_data_alloc(void) > const unsigned flags = 0; > const struct rte_memzone *mz; > > - if (rte_eal_process_type() == RTE_PROC_PRIMARY){ > + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { > mz = rte_memzone_reserve(MZ_RTE_ETH_DEV_DATA, > RTE_MAX_ETHPORTS * sizeof(*rte_eth_dev_data), > rte_socket_id(), flags); > @@ -257,7 +257,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type) > > static int > rte_eth_dev_create_unique_device_name(char *name, size_t size, > - struct rte_pci_device *pci_dev) > + struct rte_pci_device *pci_dev) > { > int ret; > > @@ -265,8 +265,8 @@ rte_eth_dev_create_unique_device_name(char *name, size_t size, > return -EINVAL; > > ret = snprintf(name, size, "%d:%d.%d", > - pci_dev->addr.bus, pci_dev->addr.devid, > - pci_dev->addr.function); > + pci_dev->addr.bus, pci_dev->addr.devid, > + pci_dev->addr.function); > if (ret < 0) > return ret; > return 0; > @@ -303,7 +303,7 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv, > if (eth_dev == NULL) > return -ENOMEM; > > - if (rte_eal_process_type() == RTE_PROC_PRIMARY){ > + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { > eth_dev->data->dev_private = rte_zmalloc("ethdev private structure", > eth_drv->dev_private_size, > RTE_CACHE_LINE_SIZE); > @@ -699,9 +699,9 @@ rte_eth_dev_detach(uint8_t port_id, char *name) > ret = rte_eth_dev_detach_pdev(port_id, &addr); > if (ret == 0) > snprintf(name, RTE_ETH_NAME_MAX_LEN, > - "%04x:%02x:%02x.%d", > - addr.domain, addr.bus, > - addr.devid, addr.function); > + "%04x:%02x:%02x.%d", > + addr.domain, addr.bus, > + addr.devid, addr.function); > > return ret; > } else > @@ -710,7 +710,7 @@ rte_eth_dev_detach(uint8_t port_id, char *name) > #else /* RTE_LIBRTE_EAL_HOTPLUG */ > int > rte_eth_dev_attach(const char *devargs __rte_unused, > - uint8_t *port_id __rte_unused) > + uint8_t *port_id __rte_unused) > { > RTE_LOG(ERR, EAL, "Hotplug support isn't enabled\n"); > return -1; > @@ -719,7 +719,7 @@ rte_eth_dev_attach(const char *devargs __rte_unused, > /* detach the device, then store the name of the device */ > int > rte_eth_dev_detach(uint8_t port_id __rte_unused, > - char *name __rte_unused) > + char *name __rte_unused) > { > RTE_LOG(ERR, EAL, "Hotplug support isn't enabled\n"); > return -1; > @@ -754,6 +754,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) > return -(ENOMEM); > if (nb_queues > old_nb_queues) { > uint16_t new_qs = nb_queues - old_nb_queues; > + > memset(rxq + old_nb_queues, 0, > sizeof(rxq[0]) * new_qs); > } > @@ -897,6 +898,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) > return -ENOMEM; > if (nb_queues > old_nb_queues) { > uint16_t new_qs = nb_queues - old_nb_queues; > + > memset(txq + old_nb_queues, 0, > sizeof(txq[0]) * new_qs); > } > @@ -912,6 +914,7 @@ static int > rte_eth_dev_check_vf_rss_rxq_num(uint8_t port_id, uint16_t nb_rx_q) > { > struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + > switch (nb_rx_q) { > case 1: > case 2: > @@ -1025,8 +1028,8 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > return (-EINVAL); > } > conf = &(dev_conf->rx_adv_conf.vmdq_dcb_conf); > - if (! (conf->nb_queue_pools == ETH_16_POOLS || > - conf->nb_queue_pools == ETH_32_POOLS)) { > + if (!(conf->nb_queue_pools == ETH_16_POOLS || > + conf->nb_queue_pools == ETH_32_POOLS)) { > PMD_DEBUG_TRACE("ethdev port_id=%d VMDQ+DCB selected, " > "nb_queue_pools must be %d or %d\n", > port_id, ETH_16_POOLS, ETH_32_POOLS); > @@ -1043,8 +1046,8 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > return (-EINVAL); > } > conf = &(dev_conf->tx_adv_conf.vmdq_dcb_tx_conf); > - if (! (conf->nb_queue_pools == ETH_16_POOLS || > - conf->nb_queue_pools == ETH_32_POOLS)) { > + if (!(conf->nb_queue_pools == ETH_16_POOLS || > + conf->nb_queue_pools == ETH_32_POOLS)) { > PMD_DEBUG_TRACE("ethdev port_id=%d VMDQ+DCB selected, " > "nb_queue_pools != %d or nb_queue_pools " > "!= %d\n", > @@ -1064,8 +1067,8 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > return (-EINVAL); > } > conf = &(dev_conf->rx_adv_conf.dcb_rx_conf); > - if (! (conf->nb_tcs == ETH_4_TCS || > - conf->nb_tcs == ETH_8_TCS)) { > + if (!(conf->nb_tcs == ETH_4_TCS || > + conf->nb_tcs == ETH_8_TCS)) { > PMD_DEBUG_TRACE("ethdev port_id=%d DCB selected, " > "nb_tcs != %d or nb_tcs " > "!= %d\n", > @@ -1084,8 +1087,8 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > return (-EINVAL); > } > conf = &(dev_conf->tx_adv_conf.dcb_tx_conf); > - if (! (conf->nb_tcs == ETH_4_TCS || > - conf->nb_tcs == ETH_8_TCS)) { > + if (!(conf->nb_tcs == ETH_4_TCS || > + conf->nb_tcs == ETH_8_TCS)) { > PMD_DEBUG_TRACE("ethdev port_id=%d DCB selected, " > "nb_tcs != %d or nb_tcs " > "!= %d\n", > @@ -1195,8 +1198,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > (unsigned)dev_conf->rxmode.max_rx_pkt_len, > (unsigned)dev_info.max_rx_pktlen); > return (-EINVAL); > - } > - else if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN) { > + } else if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN) { > PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u" > " < min valid value %u\n", > port_id, > @@ -1739,7 +1741,7 @@ rte_eth_stats_reset(uint8_t port_id) > /* retrieve ethdev extended statistics */ > int > rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, > - unsigned n) > + unsigned n) > { > struct rte_eth_stats eth_stats; > struct rte_eth_dev *dev; > @@ -1776,7 +1778,7 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, > stats_ptr = (char *)ð_stats + rte_stats_strings[i].offset; > val = *(uint64_t *)stats_ptr; > snprintf(xstats[count].name, sizeof(xstats[count].name), > - "%s", rte_stats_strings[i].name); > + "%s", rte_stats_strings[i].name); > xstats[count++].value = val; > } > > @@ -1788,8 +1790,8 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, > stats_ptr += q * sizeof(uint64_t); > val = *(uint64_t *)stats_ptr; > snprintf(xstats[count].name, sizeof(xstats[count].name), > - "rx_queue_%u_%s", q, > - rte_rxq_stats_strings[i].name); > + "rx_queue_%u_%s", q, > + rte_rxq_stats_strings[i].name); > xstats[count++].value = val; > } > } > @@ -1802,8 +1804,8 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, > stats_ptr += q * sizeof(uint64_t); > val = *(uint64_t *)stats_ptr; > snprintf(xstats[count].name, sizeof(xstats[count].name), > - "tx_queue_%u_%s", q, > - rte_txq_stats_strings[i].name); > + "tx_queue_%u_%s", q, > + rte_txq_stats_strings[i].name); > xstats[count++].value = val; > } > } > @@ -1954,7 +1956,7 @@ rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on) > } > > dev = &rte_eth_devices[port_id]; > - if (! (dev->data->dev_conf.rxmode.hw_vlan_filter)) { > + if (!(dev->data->dev_conf.rxmode.hw_vlan_filter)) { > PMD_DEBUG_TRACE("port %d: vlan-filtering disabled\n", port_id); > return (-ENOSYS); > } > @@ -2026,27 +2028,27 @@ rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask) > /*check which option changed by application*/ > cur = !!(offload_mask & ETH_VLAN_STRIP_OFFLOAD); > org = !!(dev->data->dev_conf.rxmode.hw_vlan_strip); > - if (cur != org){ > + if (cur != org) { > dev->data->dev_conf.rxmode.hw_vlan_strip = (uint8_t)cur; > mask |= ETH_VLAN_STRIP_MASK; > } > > cur = !!(offload_mask & ETH_VLAN_FILTER_OFFLOAD); > org = !!(dev->data->dev_conf.rxmode.hw_vlan_filter); > - if (cur != org){ > + if (cur != org) { > dev->data->dev_conf.rxmode.hw_vlan_filter = (uint8_t)cur; > mask |= ETH_VLAN_FILTER_MASK; > } > > cur = !!(offload_mask & ETH_VLAN_EXTEND_OFFLOAD); > org = !!(dev->data->dev_conf.rxmode.hw_vlan_extend); > - if (cur != org){ > + if (cur != org) { > dev->data->dev_conf.rxmode.hw_vlan_extend = (uint8_t)cur; > mask |= ETH_VLAN_EXTEND_MASK; > } > > /*no change*/ > - if(mask == 0) > + if (mask == 0) > return ret; > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_offload_set, -ENOTSUP); > @@ -2069,13 +2071,13 @@ rte_eth_dev_get_vlan_offload(uint8_t port_id) > dev = &rte_eth_devices[port_id]; > > if (dev->data->dev_conf.rxmode.hw_vlan_strip) > - ret |= ETH_VLAN_STRIP_OFFLOAD ; > + ret |= ETH_VLAN_STRIP_OFFLOAD; > > if (dev->data->dev_conf.rxmode.hw_vlan_filter) > - ret |= ETH_VLAN_FILTER_OFFLOAD ; > + ret |= ETH_VLAN_FILTER_OFFLOAD; > > if (dev->data->dev_conf.rxmode.hw_vlan_extend) > - ret |= ETH_VLAN_EXTEND_OFFLOAD ; > + ret |= ETH_VLAN_EXTEND_OFFLOAD; > > return ret; > } > @@ -2120,8 +2122,8 @@ rte_eth_dev_fdir_add_signature_filter(uint8_t port_id, > if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP > || fdir_filter->l4type == RTE_FDIR_L4TYPE_NONE) > && (fdir_filter->port_src || fdir_filter->port_dst)) { > - PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " \ > - "None l4type, source & destinations ports " \ > + PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " > + "None l4type, source & destinations ports " > "should be null!\n"); > return (-EINVAL); > } > @@ -2154,8 +2156,8 @@ rte_eth_dev_fdir_update_signature_filter(uint8_t port_id, > if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP > || fdir_filter->l4type == RTE_FDIR_L4TYPE_NONE) > && (fdir_filter->port_src || fdir_filter->port_dst)) { > - PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " \ > - "None l4type, source & destinations ports " \ > + PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " > + "None l4type, source & destinations ports " > "should be null!\n"); > return (-EINVAL); > } > @@ -2188,8 +2190,8 @@ rte_eth_dev_fdir_remove_signature_filter(uint8_t port_id, > if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP > || fdir_filter->l4type == RTE_FDIR_L4TYPE_NONE) > && (fdir_filter->port_src || fdir_filter->port_dst)) { > - PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " \ > - "None l4type source & destinations ports " \ > + PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " > + "None l4type source & destinations ports " > "should be null!\n"); > return (-EINVAL); > } > @@ -2209,7 +2211,7 @@ rte_eth_dev_fdir_get_infos(uint8_t port_id, struct rte_eth_fdir *fdir) > } > > dev = &rte_eth_devices[port_id]; > - if (! (dev->data->dev_conf.fdir_conf.mode)) { > + if (!(dev->data->dev_conf.fdir_conf.mode)) { > PMD_DEBUG_TRACE("port %d: pkt-filter disabled\n", port_id); > return (-ENOSYS); > } > @@ -2244,8 +2246,8 @@ rte_eth_dev_fdir_add_perfect_filter(uint8_t port_id, > if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP > || fdir_filter->l4type == RTE_FDIR_L4TYPE_NONE) > && (fdir_filter->port_src || fdir_filter->port_dst)) { > - PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " \ > - "None l4type, source & destinations ports " \ > + PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " > + "None l4type, source & destinations ports " > "should be null!\n"); > return (-EINVAL); > } > @@ -2284,8 +2286,8 @@ rte_eth_dev_fdir_update_perfect_filter(uint8_t port_id, > if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP > || fdir_filter->l4type == RTE_FDIR_L4TYPE_NONE) > && (fdir_filter->port_src || fdir_filter->port_dst)) { > - PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " \ > - "None l4type, source & destinations ports " \ > + PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " > + "None l4type, source & destinations ports " > "should be null!\n"); > return (-EINVAL); > } > @@ -2322,8 +2324,8 @@ rte_eth_dev_fdir_remove_perfect_filter(uint8_t port_id, > if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP > || fdir_filter->l4type == RTE_FDIR_L4TYPE_NONE) > && (fdir_filter->port_src || fdir_filter->port_dst)) { > - PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " \ > - "None l4type, source & destinations ports " \ > + PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " > + "None l4type, source & destinations ports " > "should be null!\n"); > return (-EINVAL); > } > @@ -2348,7 +2350,7 @@ rte_eth_dev_fdir_set_masks(uint8_t port_id, struct rte_fdir_masks *fdir_mask) > } > > dev = &rte_eth_devices[port_id]; > - if (! (dev->data->dev_conf.fdir_conf.mode)) { > + if (!(dev->data->dev_conf.fdir_conf.mode)) { > PMD_DEBUG_TRACE("port %d: pkt-filter disabled\n", port_id); > return (-ENOSYS); > } > @@ -2688,7 +2690,7 @@ rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr, > return (-EINVAL); > } > if (pool >= ETH_64_POOLS) { > - PMD_DEBUG_TRACE("pool id must be 0-%d\n",ETH_64_POOLS - 1); > + PMD_DEBUG_TRACE("pool id must be 0-%d\n", ETH_64_POOLS - 1); > return (-EINVAL); > } > > @@ -2771,16 +2773,16 @@ rte_eth_dev_set_vf_rxmode(uint8_t port_id, uint16_t vf, > rte_eth_dev_info_get(port_id, &dev_info); > > num_vfs = dev_info.max_vfs; > - if (vf > num_vfs) > - { > + if (vf > num_vfs) { > PMD_DEBUG_TRACE("set VF RX mode:invalid VF id %d\n", vf); > return (-EINVAL); > } > - if (rx_mode == 0) > - { > + > + if (rx_mode == 0) { > PMD_DEBUG_TRACE("set VF RX mode:mode mask ca not be zero\n"); > return (-EINVAL); > } > + > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx_mode, -ENOTSUP); > return (*dev->dev_ops->set_vf_rx_mode)(dev, vf, rx_mode, on); > } > @@ -2837,7 +2839,7 @@ rte_eth_dev_uc_hash_table_set(uint8_t port_id, struct ether_addr *addr, > if (index < 0) { > if (!on) { > PMD_DEBUG_TRACE("port %d: the MAC address was not" > - "set in UTA\n", port_id); > + " set in UTA\n", port_id); > return (-EINVAL); > } > > @@ -2882,7 +2884,7 @@ rte_eth_dev_uc_all_hash_table_set(uint8_t port_id, uint8_t on) > } > > int > -rte_eth_dev_set_vf_rx(uint8_t port_id,uint16_t vf, uint8_t on) > +rte_eth_dev_set_vf_rx(uint8_t port_id, uint16_t vf, uint8_t on) > { > uint16_t num_vfs; > struct rte_eth_dev *dev; > @@ -2897,18 +2899,17 @@ rte_eth_dev_set_vf_rx(uint8_t port_id,uint16_t vf, uint8_t on) > rte_eth_dev_info_get(port_id, &dev_info); > > num_vfs = dev_info.max_vfs; > - if (vf > num_vfs) > - { > + if (vf > num_vfs) { > PMD_DEBUG_TRACE("port %d: invalid vf id\n", port_id); > return (-EINVAL); > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx, -ENOTSUP); > - return (*dev->dev_ops->set_vf_rx)(dev, vf,on); > + return (*dev->dev_ops->set_vf_rx)(dev, vf, on); > } > > int > -rte_eth_dev_set_vf_tx(uint8_t port_id,uint16_t vf, uint8_t on) > +rte_eth_dev_set_vf_tx(uint8_t port_id, uint16_t vf, uint8_t on) > { > uint16_t num_vfs; > struct rte_eth_dev *dev; > @@ -2923,19 +2924,18 @@ rte_eth_dev_set_vf_tx(uint8_t port_id,uint16_t vf, uint8_t on) > rte_eth_dev_info_get(port_id, &dev_info); > > num_vfs = dev_info.max_vfs; > - if (vf > num_vfs) > - { > + if (vf > num_vfs) { > PMD_DEBUG_TRACE("set pool tx:invalid pool id=%d\n", vf); > return (-EINVAL); > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_tx, -ENOTSUP); > - return (*dev->dev_ops->set_vf_tx)(dev, vf,on); > + return (*dev->dev_ops->set_vf_tx)(dev, vf, on); > } > > int > rte_eth_dev_set_vf_vlan_filter(uint8_t port_id, uint16_t vlan_id, > - uint64_t vf_mask,uint8_t vlan_on) > + uint64_t vf_mask, uint8_t vlan_on) > { > struct rte_eth_dev *dev; > > @@ -2946,21 +2946,20 @@ rte_eth_dev_set_vf_vlan_filter(uint8_t port_id, uint16_t vlan_id, > } > dev = &rte_eth_devices[port_id]; > > - if(vlan_id > ETHER_MAX_VLAN_ID) > - { > + if (vlan_id > ETHER_MAX_VLAN_ID) { > PMD_DEBUG_TRACE("VF VLAN filter:invalid VLAN id=%d\n", > vlan_id); > return (-EINVAL); > } > - if (vf_mask == 0) > - { > + > + if (vf_mask == 0) { > PMD_DEBUG_TRACE("VF VLAN filter:pool_mask can not be 0\n"); > return (-EINVAL); > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_filter, -ENOTSUP); > return (*dev->dev_ops->set_vf_vlan_filter)(dev, vlan_id, > - vf_mask,vlan_on); > + vf_mask, vlan_on); > } > > int rte_eth_set_queue_rate_limit(uint8_t port_id, uint16_t queue_idx, > @@ -3052,20 +3051,19 @@ rte_eth_mirror_rule_set(uint8_t port_id, > } > > if (mirror_conf->dst_pool >= ETH_64_POOLS) { > - PMD_DEBUG_TRACE("Invalid dst pool, pool id must" > - "be 0-%d\n",ETH_64_POOLS - 1); > + PMD_DEBUG_TRACE("Invalid dst pool, pool id must " > + "be 0-%d\n", ETH_64_POOLS - 1); > return (-EINVAL); > } > > if ((mirror_conf->rule_type_mask & ETH_VMDQ_POOL_MIRROR) && > (mirror_conf->pool_mask == 0)) { > - PMD_DEBUG_TRACE("Invalid mirror pool, pool mask can not" > + PMD_DEBUG_TRACE("Invalid mirror pool, pool mask can not " > "be 0.\n"); > return (-EINVAL); > } > > - if(rule_id >= ETH_VMDQ_NUM_MIRROR_RULE) > - { > + if (rule_id >= ETH_VMDQ_NUM_MIRROR_RULE) { > PMD_DEBUG_TRACE("Invalid rule_id, rule_id must be 0-%d\n", > ETH_VMDQ_NUM_MIRROR_RULE - 1); > return (-EINVAL); > @@ -3087,8 +3085,7 @@ rte_eth_mirror_rule_reset(uint8_t port_id, uint8_t rule_id) > return (-ENODEV); > } > > - if(rule_id >= ETH_VMDQ_NUM_MIRROR_RULE) > - { > + if (rule_id >= ETH_VMDQ_NUM_MIRROR_RULE) { > PMD_DEBUG_TRACE("Invalid rule_id, rule_id must be 0-%d\n", > ETH_VMDQ_NUM_MIRROR_RULE-1); > return (-EINVAL); > @@ -3171,8 +3168,8 @@ rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset) > > dev = &rte_eth_devices[port_id]; > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP); > - return (*dev->dev_ops->rx_descriptor_done)( \ > - dev->data->rx_queues[queue_id], offset); > + return (*dev->dev_ops->rx_descriptor_done) > + (dev->data->rx_queues[queue_id], offset); > } > #endif > > @@ -3204,8 +3201,9 @@ rte_eth_dev_callback_register(uint8_t port_id, > } > > /* create a new callback. */ > - if (user_cb == NULL && (user_cb = rte_zmalloc("INTR_USER_CALLBACK", > - sizeof(struct rte_eth_dev_callback), 0)) != NULL) { > + if (user_cb == NULL && > + !(user_cb = rte_zmalloc("INTR_USER_CALLBACK", > + sizeof(struct rte_eth_dev_callback), 0))) { > user_cb->cb_fn = cb_fn; > user_cb->cb_arg = cb_arg; > user_cb->event = event; > @@ -3293,7 +3291,8 @@ int rte_eth_dev_bypass_init(uint8_t port_id) > return (-ENODEV); > } > > - if ((dev= &rte_eth_devices[port_id]) == NULL) { > + dev = &rte_eth_devices[port_id]; > + if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > return (-ENODEV); > } > @@ -3313,7 +3312,8 @@ rte_eth_dev_bypass_state_show(uint8_t port_id, uint32_t *state) > return (-ENODEV); > } > > - if ((dev= &rte_eth_devices[port_id]) == NULL) { > + dev = &rte_eth_devices[port_id]; > + if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > return (-ENODEV); > } > @@ -3332,7 +3332,8 @@ rte_eth_dev_bypass_state_set(uint8_t port_id, uint32_t *new_state) > return (-ENODEV); > } > > - if ((dev= &rte_eth_devices[port_id]) == NULL) { > + dev = &rte_eth_devices[port_id]; > + if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > return (-ENODEV); > } > @@ -3352,7 +3353,8 @@ rte_eth_dev_bypass_event_show(uint8_t port_id, uint32_t event, uint32_t *state) > return (-ENODEV); > } > > - if ((dev= &rte_eth_devices[port_id]) == NULL) { > + dev = &rte_eth_devices[port_id]; > + if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > return (-ENODEV); > } > @@ -3372,7 +3374,8 @@ rte_eth_dev_bypass_event_store(uint8_t port_id, uint32_t event, uint32_t state) > return (-ENODEV); > } > > - if ((dev= &rte_eth_devices[port_id]) == NULL) { > + dev = &rte_eth_devices[port_id]; > + if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > return (-ENODEV); > } > @@ -3392,7 +3395,8 @@ rte_eth_dev_wd_timeout_store(uint8_t port_id, uint32_t timeout) > return (-ENODEV); > } > > - if ((dev= &rte_eth_devices[port_id]) == NULL) { > + dev = &rte_eth_devices[port_id]; > + if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > return (-ENODEV); > } > @@ -3412,7 +3416,8 @@ rte_eth_dev_bypass_ver_show(uint8_t port_id, uint32_t *ver) > return (-ENODEV); > } > > - if ((dev= &rte_eth_devices[port_id]) == NULL) { > + dev = &rte_eth_devices[port_id]; > + if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > return (-ENODEV); > } > @@ -3432,7 +3437,8 @@ rte_eth_dev_bypass_wd_timeout_show(uint8_t port_id, uint32_t *wd_timeout) > return (-ENODEV); > } > > - if ((dev= &rte_eth_devices[port_id]) == NULL) { > + dev = &rte_eth_devices[port_id]; > + if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > return (-ENODEV); > } > @@ -3452,7 +3458,8 @@ rte_eth_dev_bypass_wd_reset(uint8_t port_id) > return (-ENODEV); > } > > - if ((dev= &rte_eth_devices[port_id]) == NULL) { > + dev = &rte_eth_devices[port_id]; > + if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > return (-ENODEV); > } > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h > index e8df027..47a60e5 100644 > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h > @@ -229,7 +229,7 @@ struct rte_eth_link { > uint16_t link_speed; /**< ETH_LINK_SPEED_[10, 100, 1000, 10000] */ > uint16_t link_duplex; /**< ETH_LINK_[HALF_DUPLEX, FULL_DUPLEX] */ > uint8_t link_status : 1; /**< 1 -> link up, 0 -> link down */ > -}__attribute__((aligned(8))); /**< aligned for atomic64 read/write */ > +} __attribute__((aligned(8))); /**< aligned for atomic64 read/write */ > > #define ETH_LINK_SPEED_AUTONEG 0 /**< Auto-negotiate link speed. */ > #define ETH_LINK_SPEED_10 10 /**< 10 megabits/second. */ > @@ -726,7 +726,7 @@ enum rte_l4type { > */ > enum rte_iptype { > RTE_FDIR_IPTYPE_IPV4 = 0, /**< IPv4. */ > - RTE_FDIR_IPTYPE_IPV6 , /**< IPv6. */ > + RTE_FDIR_IPTYPE_IPV6, /**< IPv6. */ > }; > > /** > @@ -840,7 +840,7 @@ struct rte_eth_conf { > struct rte_eth_rxmode rxmode; /**< Port RX configuration. */ > struct rte_eth_txmode txmode; /**< Port TX configuration. */ > uint32_t lpbk_mode; /**< Loopback operation mode. By default the value > - is 0, meaning the loopback mode is disabled. > + is 0, meaning the loopback mode is disabled. > Read the datasheet of given ethernet controller > for details. The possible values of this field > are defined in implementation of each driver. */ > @@ -1363,17 +1363,18 @@ struct eth_dev_ops { > reta_update_t reta_update; > /** Query redirection table. */ > reta_query_t reta_query; > - /* bypass control */ > + > #ifdef RTE_NIC_BYPASS > - bypass_init_t bypass_init; > - bypass_state_set_t bypass_state_set; > - bypass_state_show_t bypass_state_show; > - bypass_event_set_t bypass_event_set; > - bypass_event_show_t bypass_event_show; > - bypass_wd_timeout_set_t bypass_wd_timeout_set; > - bypass_wd_timeout_show_t bypass_wd_timeout_show; > - bypass_ver_show_t bypass_ver_show; > - bypass_wd_reset_t bypass_wd_reset; > + /* bypass control */ > + bypass_init_t bypass_init; > + bypass_state_set_t bypass_state_set; > + bypass_state_show_t bypass_state_show; > + bypass_event_set_t bypass_event_set; > + bypass_event_show_t bypass_event_show; > + bypass_wd_timeout_set_t bypass_wd_timeout_set; > + bypass_wd_timeout_show_t bypass_wd_timeout_show; > + bypass_ver_show_t bypass_ver_show; > + bypass_wd_reset_t bypass_wd_reset; > #endif > > /** Configure RSS hash protocols. */ > @@ -1529,10 +1530,10 @@ struct rte_eth_dev_data { > /**< Common rx buffer size handled by all queues */ > > uint64_t rx_mbuf_alloc_failed; /**< RX ring mbuf allocation failures. */ > - struct ether_addr* mac_addrs;/**< Device Ethernet Link address. */ > + struct ether_addr *mac_addrs;/**< Device Ethernet Link address. */ > uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR]; > /** bitmap array of associating Ethernet MAC addresses to pools */ > - struct ether_addr* hash_mac_addrs; > + struct ether_addr *hash_mac_addrs; > /** Device Ethernet MAC addresses of hash filtering. */ > uint8_t port_id; /**< Device [external] port identifier. */ > uint8_t promiscuous : 1, /**< RX promiscuous mode ON(1) / OFF(0). */ > @@ -2228,7 +2229,7 @@ extern int rte_eth_dev_set_mtu(uint8_t port_id, uint16_t mtu); > * - (-ENOSYS) if VLAN filtering on *port_id* disabled. > * - (-EINVAL) if *vlan_id* > 4095. > */ > -extern int rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id , int on); > +extern int rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on); > > /** > * Enable/Disable hardware VLAN Strip by a rx queue of an Ethernet device. > @@ -2449,10 +2450,10 @@ extern uint32_t rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id); > static inline uint32_t > rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id) > { > - struct rte_eth_dev *dev; > + struct rte_eth_dev *dev; > > - dev = &rte_eth_devices[port_id]; > - return (*dev->dev_ops->rx_queue_count)(dev, queue_id); > + dev = &rte_eth_devices[port_id]; > + return (*dev->dev_ops->rx_queue_count)(dev, queue_id); > } > #endif > > @@ -2481,8 +2482,8 @@ rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset) > struct rte_eth_dev *dev; > > dev = &rte_eth_devices[port_id]; > - return (*dev->dev_ops->rx_descriptor_done)( \ > - dev->data->rx_queues[queue_id], offset); > + return (*dev->dev_ops->rx_descriptor_done) > + (dev->data->rx_queues[queue_id], offset); > } > #endif > > @@ -2798,8 +2799,8 @@ enum rte_eth_event_type { > RTE_ETH_EVENT_MAX /**< max value of this enum */ > }; > > -typedef void (*rte_eth_dev_cb_fn)(uint8_t port_id, \ > - enum rte_eth_event_type event, void *cb_arg); > +typedef void (*rte_eth_dev_cb_fn)(uint8_t port_id, > + enum rte_eth_event_type event, void *cb_arg); > /**< user application callback to be registered for interrupts */ > > > @@ -3031,8 +3032,8 @@ int rte_eth_dev_rss_reta_query(uint8_t port, > * - (-ENODEV) if *port_id* invalid. > * - (-EINVAL) if bad parameter. > */ > -int rte_eth_dev_uc_hash_table_set(uint8_t port,struct ether_addr *addr, > - uint8_t on); > +int rte_eth_dev_uc_hash_table_set(uint8_t port, struct ether_addr *addr, > + uint8_t on); > > /** > * Updates all unicast hash bitmaps for receiving packet with any Unicast > @@ -3051,7 +3052,7 @@ int rte_eth_dev_uc_hash_table_set(uint8_t port,struct ether_addr *addr, > * - (-ENODEV) if *port_id* invalid. > * - (-EINVAL) if bad parameter. > */ > -int rte_eth_dev_uc_all_hash_table_set(uint8_t port,uint8_t on); > +int rte_eth_dev_uc_all_hash_table_set(uint8_t port, uint8_t on); > > /** > * Set RX L2 Filtering mode of a VF of an Ethernet device. > @@ -3095,7 +3096,7 @@ int rte_eth_dev_set_vf_rxmode(uint8_t port, uint16_t vf, uint16_t rx_mode, > * - (-EINVAL) if bad parameter. > */ > int > -rte_eth_dev_set_vf_tx(uint8_t port,uint16_t vf, uint8_t on); > +rte_eth_dev_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on); > > /** > * Enable or disable a VF traffic receive of an Ethernet device. > @@ -3114,7 +3115,7 @@ rte_eth_dev_set_vf_tx(uint8_t port,uint16_t vf, uint8_t on); > * - (-EINVAL) if bad parameter. > */ > int > -rte_eth_dev_set_vf_rx(uint8_t port,uint16_t vf, uint8_t on); > +rte_eth_dev_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on); > > /** > * Enable/Disable hardware VF VLAN filtering by an Ethernet device of > -- > 2.1.4 > ^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 3/4] rte_ethdev: make tables const 2015-04-09 21:29 [dpdk-dev] [PATCH 0/4] rte_ethdev: cleanups Stephen Hemminger 2015-04-09 21:29 ` [dpdk-dev] [PATCH 1/4] rte_ethdev: remove extra inline Stephen Hemminger 2015-04-09 21:29 ` [dpdk-dev] [PATCH 2/4] rte_ethdev: whitespace cleanup Stephen Hemminger @ 2015-04-09 21:29 ` Stephen Hemminger 2015-04-15 9:54 ` Bruce Richardson 2015-04-09 21:29 ` [dpdk-dev] [PATCH 4/4] rte_ethdev: remove unnecessary paren on return Stephen Hemminger 2015-04-20 17:52 ` [dpdk-dev] [PATCH 0/4] rte_ethdev: cleanups Thomas Monjalon 4 siblings, 1 reply; 10+ messages in thread From: Stephen Hemminger @ 2015-04-09 21:29 UTC (permalink / raw) To: dev The statistics tables and null mac address should be immutable. Fix up get_addr routines to accept const args. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/librte_ether/rte_ethdev.c | 44 +++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 56e22ea..416e778 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -119,34 +119,34 @@ struct rte_eth_xstats_name_off { unsigned offset; }; -static struct rte_eth_xstats_name_off rte_stats_strings[] = { - {"rx_packets", offsetof(struct rte_eth_stats, ipackets)}, - {"tx_packets", offsetof(struct rte_eth_stats, opackets)}, - {"rx_bytes", offsetof(struct rte_eth_stats, ibytes)}, - {"tx_bytes", offsetof(struct rte_eth_stats, obytes)}, - {"tx_errors", offsetof(struct rte_eth_stats, oerrors)}, - {"rx_missed_errors", offsetof(struct rte_eth_stats, imissed)}, - {"rx_crc_errors", offsetof(struct rte_eth_stats, ibadcrc)}, - {"rx_bad_length_errors", offsetof(struct rte_eth_stats, ibadlen)}, - {"rx_errors", offsetof(struct rte_eth_stats, ierrors)}, - {"alloc_rx_buff_failed", offsetof(struct rte_eth_stats, rx_nombuf)}, - {"fdir_match", offsetof(struct rte_eth_stats, fdirmatch)}, - {"fdir_miss", offsetof(struct rte_eth_stats, fdirmiss)}, - {"tx_flow_control_xon", offsetof(struct rte_eth_stats, tx_pause_xon)}, - {"rx_flow_control_xon", offsetof(struct rte_eth_stats, rx_pause_xon)}, - {"tx_flow_control_xoff", offsetof(struct rte_eth_stats, tx_pause_xoff)}, - {"rx_flow_control_xoff", offsetof(struct rte_eth_stats, rx_pause_xoff)}, +static const struct rte_eth_xstats_name_off rte_stats_strings[] = { + {"rx_packets", offsetof(struct rte_eth_stats, ipackets)}, + {"tx_packets", offsetof(struct rte_eth_stats, opackets)}, + {"rx_bytes", offsetof(struct rte_eth_stats, ibytes)}, + {"tx_bytes", offsetof(struct rte_eth_stats, obytes)}, + {"tx_errors", offsetof(struct rte_eth_stats, oerrors)}, + {"rx_missed_errors", offsetof(struct rte_eth_stats, imissed)}, + {"rx_crc_errors", offsetof(struct rte_eth_stats, ibadcrc)}, + {"rx_bad_length_errors", offsetof(struct rte_eth_stats, ibadlen)}, + {"rx_errors", offsetof(struct rte_eth_stats, ierrors)}, + {"alloc_rx_buff_failed", offsetof(struct rte_eth_stats, rx_nombuf)}, + {"fdir_match", offsetof(struct rte_eth_stats, fdirmatch)}, + {"fdir_miss", offsetof(struct rte_eth_stats, fdirmiss)}, + {"tx_flow_control_xon", offsetof(struct rte_eth_stats, tx_pause_xon)}, + {"rx_flow_control_xon", offsetof(struct rte_eth_stats, rx_pause_xon)}, + {"tx_flow_control_xoff", offsetof(struct rte_eth_stats, tx_pause_xoff)}, + {"rx_flow_control_xoff", offsetof(struct rte_eth_stats, rx_pause_xoff)}, }; #define RTE_NB_STATS (sizeof(rte_stats_strings) / sizeof(rte_stats_strings[0])) -static struct rte_eth_xstats_name_off rte_rxq_stats_strings[] = { +static const struct rte_eth_xstats_name_off rte_rxq_stats_strings[] = { {"rx_packets", offsetof(struct rte_eth_stats, q_ipackets)}, {"rx_bytes", offsetof(struct rte_eth_stats, q_ibytes)}, }; #define RTE_NB_RXQ_STATS (sizeof(rte_rxq_stats_strings) / \ sizeof(rte_rxq_stats_strings[0])) -static struct rte_eth_xstats_name_off rte_txq_stats_strings[] = { +static const struct rte_eth_xstats_name_off rte_txq_stats_strings[] = { {"tx_packets", offsetof(struct rte_eth_stats, q_opackets)}, {"tx_bytes", offsetof(struct rte_eth_stats, q_obytes)}, {"tx_errors", offsetof(struct rte_eth_stats, q_errors)}, @@ -2651,7 +2651,7 @@ rte_eth_led_off(uint8_t port_id) * an empty spot. */ static int -get_mac_addr_index(uint8_t port_id, struct ether_addr *addr) +get_mac_addr_index(uint8_t port_id, const struct ether_addr *addr) { struct rte_eth_dev_info dev_info; struct rte_eth_dev *dev = &rte_eth_devices[port_id]; @@ -2666,7 +2666,7 @@ get_mac_addr_index(uint8_t port_id, struct ether_addr *addr) return -1; } -static struct ether_addr null_mac_addr = {{0, 0, 0, 0, 0, 0}}; +static const struct ether_addr null_mac_addr; int rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr, @@ -2792,7 +2792,7 @@ rte_eth_dev_set_vf_rxmode(uint8_t port_id, uint16_t vf, * an empty spot. */ static int -get_hash_mac_addr_index(uint8_t port_id, struct ether_addr *addr) +get_hash_mac_addr_index(uint8_t port_id, const struct ether_addr *addr) { struct rte_eth_dev_info dev_info; struct rte_eth_dev *dev = &rte_eth_devices[port_id]; -- 2.1.4 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH 3/4] rte_ethdev: make tables const 2015-04-09 21:29 ` [dpdk-dev] [PATCH 3/4] rte_ethdev: make tables const Stephen Hemminger @ 2015-04-15 9:54 ` Bruce Richardson 0 siblings, 0 replies; 10+ messages in thread From: Bruce Richardson @ 2015-04-15 9:54 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev On Thu, Apr 09, 2015 at 02:29:41PM -0700, Stephen Hemminger wrote: > The statistics tables and null mac address should be immutable. > Fix up get_addr routines to accept const args. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Bruce Richardson <bruce.richardson@intel.com> > --- > lib/librte_ether/rte_ethdev.c | 44 +++++++++++++++++++++---------------------- > 1 file changed, 22 insertions(+), 22 deletions(-) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index 56e22ea..416e778 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -119,34 +119,34 @@ struct rte_eth_xstats_name_off { > unsigned offset; > }; > > -static struct rte_eth_xstats_name_off rte_stats_strings[] = { > - {"rx_packets", offsetof(struct rte_eth_stats, ipackets)}, > - {"tx_packets", offsetof(struct rte_eth_stats, opackets)}, > - {"rx_bytes", offsetof(struct rte_eth_stats, ibytes)}, > - {"tx_bytes", offsetof(struct rte_eth_stats, obytes)}, > - {"tx_errors", offsetof(struct rte_eth_stats, oerrors)}, > - {"rx_missed_errors", offsetof(struct rte_eth_stats, imissed)}, > - {"rx_crc_errors", offsetof(struct rte_eth_stats, ibadcrc)}, > - {"rx_bad_length_errors", offsetof(struct rte_eth_stats, ibadlen)}, > - {"rx_errors", offsetof(struct rte_eth_stats, ierrors)}, > - {"alloc_rx_buff_failed", offsetof(struct rte_eth_stats, rx_nombuf)}, > - {"fdir_match", offsetof(struct rte_eth_stats, fdirmatch)}, > - {"fdir_miss", offsetof(struct rte_eth_stats, fdirmiss)}, > - {"tx_flow_control_xon", offsetof(struct rte_eth_stats, tx_pause_xon)}, > - {"rx_flow_control_xon", offsetof(struct rte_eth_stats, rx_pause_xon)}, > - {"tx_flow_control_xoff", offsetof(struct rte_eth_stats, tx_pause_xoff)}, > - {"rx_flow_control_xoff", offsetof(struct rte_eth_stats, rx_pause_xoff)}, > +static const struct rte_eth_xstats_name_off rte_stats_strings[] = { > + {"rx_packets", offsetof(struct rte_eth_stats, ipackets)}, > + {"tx_packets", offsetof(struct rte_eth_stats, opackets)}, > + {"rx_bytes", offsetof(struct rte_eth_stats, ibytes)}, > + {"tx_bytes", offsetof(struct rte_eth_stats, obytes)}, > + {"tx_errors", offsetof(struct rte_eth_stats, oerrors)}, > + {"rx_missed_errors", offsetof(struct rte_eth_stats, imissed)}, > + {"rx_crc_errors", offsetof(struct rte_eth_stats, ibadcrc)}, > + {"rx_bad_length_errors", offsetof(struct rte_eth_stats, ibadlen)}, > + {"rx_errors", offsetof(struct rte_eth_stats, ierrors)}, > + {"alloc_rx_buff_failed", offsetof(struct rte_eth_stats, rx_nombuf)}, > + {"fdir_match", offsetof(struct rte_eth_stats, fdirmatch)}, > + {"fdir_miss", offsetof(struct rte_eth_stats, fdirmiss)}, > + {"tx_flow_control_xon", offsetof(struct rte_eth_stats, tx_pause_xon)}, > + {"rx_flow_control_xon", offsetof(struct rte_eth_stats, rx_pause_xon)}, > + {"tx_flow_control_xoff", offsetof(struct rte_eth_stats, tx_pause_xoff)}, > + {"rx_flow_control_xoff", offsetof(struct rte_eth_stats, rx_pause_xoff)}, > }; > #define RTE_NB_STATS (sizeof(rte_stats_strings) / sizeof(rte_stats_strings[0])) > > -static struct rte_eth_xstats_name_off rte_rxq_stats_strings[] = { > +static const struct rte_eth_xstats_name_off rte_rxq_stats_strings[] = { > {"rx_packets", offsetof(struct rte_eth_stats, q_ipackets)}, > {"rx_bytes", offsetof(struct rte_eth_stats, q_ibytes)}, > }; > #define RTE_NB_RXQ_STATS (sizeof(rte_rxq_stats_strings) / \ > sizeof(rte_rxq_stats_strings[0])) > > -static struct rte_eth_xstats_name_off rte_txq_stats_strings[] = { > +static const struct rte_eth_xstats_name_off rte_txq_stats_strings[] = { > {"tx_packets", offsetof(struct rte_eth_stats, q_opackets)}, > {"tx_bytes", offsetof(struct rte_eth_stats, q_obytes)}, > {"tx_errors", offsetof(struct rte_eth_stats, q_errors)}, > @@ -2651,7 +2651,7 @@ rte_eth_led_off(uint8_t port_id) > * an empty spot. > */ > static int > -get_mac_addr_index(uint8_t port_id, struct ether_addr *addr) > +get_mac_addr_index(uint8_t port_id, const struct ether_addr *addr) > { > struct rte_eth_dev_info dev_info; > struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > @@ -2666,7 +2666,7 @@ get_mac_addr_index(uint8_t port_id, struct ether_addr *addr) > return -1; > } > > -static struct ether_addr null_mac_addr = {{0, 0, 0, 0, 0, 0}}; > +static const struct ether_addr null_mac_addr; > > int > rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr, > @@ -2792,7 +2792,7 @@ rte_eth_dev_set_vf_rxmode(uint8_t port_id, uint16_t vf, > * an empty spot. > */ > static int > -get_hash_mac_addr_index(uint8_t port_id, struct ether_addr *addr) > +get_hash_mac_addr_index(uint8_t port_id, const struct ether_addr *addr) > { > struct rte_eth_dev_info dev_info; > struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > -- > 2.1.4 > ^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 4/4] rte_ethdev: remove unnecessary paren on return 2015-04-09 21:29 [dpdk-dev] [PATCH 0/4] rte_ethdev: cleanups Stephen Hemminger ` (2 preceding siblings ...) 2015-04-09 21:29 ` [dpdk-dev] [PATCH 3/4] rte_ethdev: make tables const Stephen Hemminger @ 2015-04-09 21:29 ` Stephen Hemminger 2015-04-15 9:56 ` Bruce Richardson 2015-04-20 17:52 ` [dpdk-dev] [PATCH 0/4] rte_ethdev: cleanups Thomas Monjalon 4 siblings, 1 reply; 10+ messages in thread From: Stephen Hemminger @ 2015-04-09 21:29 UTC (permalink / raw) To: dev The Linux style is not to put extra useless paren's around the expression passed to return statement. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/librte_ether/rte_ethdev.c | 298 +++++++++++++++++++++--------------------- 1 file changed, 149 insertions(+), 149 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 416e778..b856100 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -81,7 +81,7 @@ #define PROC_PRIMARY_OR_ERR_RET(retval) do { \ if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \ PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \ - return (retval); \ + return (retval); \ } \ } while (0) #define PROC_PRIMARY_OR_RET() do { \ @@ -95,7 +95,7 @@ #define FUNC_PTR_OR_ERR_RET(func, retval) do { \ if ((func) == NULL) { \ PMD_DEBUG_TRACE("Function not supported\n"); \ - return (retval); \ + return (retval); \ } \ } while (0) #define FUNC_PTR_OR_RET(func) do { \ @@ -325,7 +325,7 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv, /* Invoke PMD device initialization function */ diag = (*eth_drv->eth_dev_init)(eth_dev); if (diag == 0) - return (0); + return 0; PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%u device_id=0x%x)" " failed\n", pci_drv->name, @@ -422,7 +422,7 @@ rte_eth_dev_socket_id(uint8_t port_id) uint8_t rte_eth_dev_count(void) { - return (nb_ports); + return nb_ports; } /* So far, DPDK hotplug function only supports linux */ @@ -763,7 +763,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) } dev->data->nb_rx_queues = nb_queues; - return (0); + return 0; } int @@ -907,7 +907,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) } dev->data->nb_tx_queues = nb_queues; - return (0); + return 0; } static int @@ -954,7 +954,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, port_id, dev_conf->rxmode.mq_mode, dev_conf->txmode.mq_mode); - return (-EINVAL); + return -EINVAL; } switch (dev_conf->rxmode.mq_mode) { @@ -965,7 +965,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, " SRIOV active, " "unsupported VMDQ mq_mode rx %u\n", port_id, dev_conf->rxmode.mq_mode); - return (-EINVAL); + return -EINVAL; case ETH_MQ_RX_RSS: PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8 " SRIOV active, " @@ -1001,7 +1001,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, " SRIOV active, " "unsupported VMDQ mq_mode tx %u\n", port_id, dev_conf->txmode.mq_mode); - return (-EINVAL); + return -EINVAL; default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */ /* if nothing mq mode configure, use default scheme */ dev->data->dev_conf.txmode.mq_mode = ETH_MQ_TX_VMDQ_ONLY; @@ -1014,7 +1014,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, PMD_DEBUG_TRACE("ethdev port_id=%d SRIOV active, " "queue number must less equal to %d\n", port_id, RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool); - return (-EINVAL); + return -EINVAL; } } else { /* For vmdb+dcb mode check our configuration before we go further */ @@ -1025,7 +1025,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, PMD_DEBUG_TRACE("ethdev port_id=%d VMDQ+DCB, nb_rx_q " "!= %d\n", port_id, ETH_VMDQ_DCB_NUM_QUEUES); - return (-EINVAL); + return -EINVAL; } conf = &(dev_conf->rx_adv_conf.vmdq_dcb_conf); if (!(conf->nb_queue_pools == ETH_16_POOLS || @@ -1033,7 +1033,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, PMD_DEBUG_TRACE("ethdev port_id=%d VMDQ+DCB selected, " "nb_queue_pools must be %d or %d\n", port_id, ETH_16_POOLS, ETH_32_POOLS); - return (-EINVAL); + return -EINVAL; } } if (dev_conf->txmode.mq_mode == ETH_MQ_TX_VMDQ_DCB) { @@ -1043,7 +1043,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, PMD_DEBUG_TRACE("ethdev port_id=%d VMDQ+DCB, nb_tx_q " "!= %d\n", port_id, ETH_VMDQ_DCB_NUM_QUEUES); - return (-EINVAL); + return -EINVAL; } conf = &(dev_conf->tx_adv_conf.vmdq_dcb_tx_conf); if (!(conf->nb_queue_pools == ETH_16_POOLS || @@ -1052,7 +1052,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, "nb_queue_pools != %d or nb_queue_pools " "!= %d\n", port_id, ETH_16_POOLS, ETH_32_POOLS); - return (-EINVAL); + return -EINVAL; } } @@ -1064,7 +1064,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, PMD_DEBUG_TRACE("ethdev port_id=%d DCB, nb_rx_q " "!= %d\n", port_id, ETH_DCB_NUM_QUEUES); - return (-EINVAL); + return -EINVAL; } conf = &(dev_conf->rx_adv_conf.dcb_rx_conf); if (!(conf->nb_tcs == ETH_4_TCS || @@ -1073,7 +1073,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, "nb_tcs != %d or nb_tcs " "!= %d\n", port_id, ETH_4_TCS, ETH_8_TCS); - return (-EINVAL); + return -EINVAL; } } @@ -1084,7 +1084,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, PMD_DEBUG_TRACE("ethdev port_id=%d DCB, nb_tx_q " "!= %d\n", port_id, ETH_DCB_NUM_QUEUES); - return (-EINVAL); + return -EINVAL; } conf = &(dev_conf->tx_adv_conf.dcb_tx_conf); if (!(conf->nb_tcs == ETH_4_TCS || @@ -1093,7 +1093,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, "nb_tcs != %d or nb_tcs " "!= %d\n", port_id, ETH_4_TCS, ETH_8_TCS); - return (-EINVAL); + return -EINVAL; } } } @@ -1114,21 +1114,21 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-EINVAL); + return -EINVAL; } if (nb_rx_q > RTE_MAX_QUEUES_PER_PORT) { PMD_DEBUG_TRACE( "Number of RX queues requested (%u) is greater than max supported(%d)\n", nb_rx_q, RTE_MAX_QUEUES_PER_PORT); - return (-EINVAL); + return -EINVAL; } if (nb_tx_q > RTE_MAX_QUEUES_PER_PORT) { PMD_DEBUG_TRACE( "Number of TX queues requested (%u) is greater than max supported(%d)\n", nb_tx_q, RTE_MAX_QUEUES_PER_PORT); - return (-EINVAL); + return -EINVAL; } dev = &rte_eth_devices[port_id]; @@ -1139,7 +1139,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, if (dev->data->dev_started) { PMD_DEBUG_TRACE( "port %d must be stopped to allow configuration\n", port_id); - return (-EBUSY); + return -EBUSY; } /* @@ -1151,21 +1151,21 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, if (nb_rx_q > dev_info.max_rx_queues) { PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_queues=%d > %d\n", port_id, nb_rx_q, dev_info.max_rx_queues); - return (-EINVAL); + return -EINVAL; } if (nb_rx_q == 0) { PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_q == 0\n", port_id); - return (-EINVAL); + return -EINVAL; } if (nb_tx_q > dev_info.max_tx_queues) { PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_queues=%d > %d\n", port_id, nb_tx_q, dev_info.max_tx_queues); - return (-EINVAL); + return -EINVAL; } if (nb_tx_q == 0) { PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_q == 0\n", port_id); - return (-EINVAL); + return -EINVAL; } /* Copy the dev_conf parameter into the dev structure */ @@ -1181,7 +1181,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, if (!(pci_drv->drv_flags & RTE_PCI_DRV_INTR_LSC)) { PMD_DEBUG_TRACE("driver %s does not support lsc\n", pci_drv->name); - return (-EINVAL); + return -EINVAL; } } @@ -1197,14 +1197,14 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, port_id, (unsigned)dev_conf->rxmode.max_rx_pkt_len, (unsigned)dev_info.max_rx_pktlen); - return (-EINVAL); + return -EINVAL; } else if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN) { PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u" " < min valid value %u\n", port_id, (unsigned)dev_conf->rxmode.max_rx_pkt_len, (unsigned)ETHER_MIN_LEN); - return (-EINVAL); + return -EINVAL; } } else { if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN || @@ -1313,7 +1313,7 @@ rte_eth_dev_start(uint8_t port_id) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-EINVAL); + return -EINVAL; } dev = &rte_eth_devices[port_id]; @@ -1324,7 +1324,7 @@ rte_eth_dev_start(uint8_t port_id) PMD_DEBUG_TRACE("Device with port_id=%" PRIu8 " already started\n", port_id); - return (0); + return 0; } diag = (*dev->dev_ops->dev_start)(dev); @@ -1450,13 +1450,13 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-EINVAL); + return -EINVAL; } dev = &rte_eth_devices[port_id]; if (rx_queue_id >= dev->data->nb_rx_queues) { PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id); - return (-EINVAL); + return -EINVAL; } if (dev->data->dev_started) { @@ -1478,7 +1478,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, PMD_DEBUG_TRACE("%s private_data_size %d < %d\n", mp->name, (int) mp->private_data_size, (int) sizeof(struct rte_pktmbuf_pool_private)); - return (-ENOSPC); + return -ENOSPC; } mbp_priv = rte_mempool_get_priv(mp); mbp_buf_size = mbp_priv->mbuf_data_room_size; @@ -1493,7 +1493,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, dev_info.min_rx_bufsize), (int)RTE_PKTMBUF_HEADROOM, (int)dev_info.min_rx_bufsize); - return (-EINVAL); + return -EINVAL; } if (rx_conf == NULL) @@ -1524,13 +1524,13 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-EINVAL); + return -EINVAL; } dev = &rte_eth_devices[port_id]; if (tx_queue_id >= dev->data->nb_tx_queues) { PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id); - return (-EINVAL); + return -EINVAL; } if (dev->data->dev_started) { @@ -1710,7 +1710,7 @@ rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -1916,7 +1916,7 @@ rte_eth_dev_get_mtu(uint8_t port_id, uint16_t *mtu) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -1932,7 +1932,7 @@ rte_eth_dev_set_mtu(uint8_t port_id, uint16_t mtu) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -1952,19 +1952,19 @@ rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; if (!(dev->data->dev_conf.rxmode.hw_vlan_filter)) { PMD_DEBUG_TRACE("port %d: vlan-filtering disabled\n", port_id); - return (-ENOSYS); + return -ENOSYS; } if (vlan_id > 4095) { PMD_DEBUG_TRACE("(port_id=%d) invalid vlan_id=%u > 4095\n", port_id, (unsigned) vlan_id); - return (-EINVAL); + return -EINVAL; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_filter_set, -ENOTSUP); @@ -1978,19 +1978,19 @@ rte_eth_dev_set_vlan_strip_on_queue(uint8_t port_id, uint16_t rx_queue_id, int o if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; if (rx_queue_id >= dev->data->nb_rx_queues) { PMD_DEBUG_TRACE("Invalid rx_queue_id=%d\n", port_id); - return (-EINVAL); + return -EINVAL; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP); (*dev->dev_ops->vlan_strip_queue_set)(dev, rx_queue_id, on); - return (0); + return 0; } int @@ -2000,14 +2000,14 @@ rte_eth_dev_set_vlan_ether_type(uint8_t port_id, uint16_t tpid) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_tpid_set, -ENOTSUP); (*dev->dev_ops->vlan_tpid_set)(dev, tpid); - return (0); + return 0; } int @@ -2020,7 +2020,7 @@ rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -2065,7 +2065,7 @@ rte_eth_dev_get_vlan_offload(uint8_t port_id) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -2089,7 +2089,7 @@ rte_eth_dev_set_vlan_pvid(uint8_t port_id, uint16_t pvid, int on) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -2108,7 +2108,7 @@ rte_eth_dev_fdir_add_signature_filter(uint8_t port_id, if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -2116,7 +2116,7 @@ rte_eth_dev_fdir_add_signature_filter(uint8_t port_id, if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_SIGNATURE) { PMD_DEBUG_TRACE("port %d: invalid FDIR mode=%u\n", port_id, dev->data->dev_conf.fdir_conf.mode); - return (-ENOSYS); + return -ENOSYS; } if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP @@ -2125,7 +2125,7 @@ rte_eth_dev_fdir_add_signature_filter(uint8_t port_id, PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " "None l4type, source & destinations ports " "should be null!\n"); - return (-EINVAL); + return -EINVAL; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fdir_add_signature_filter, -ENOTSUP); @@ -2142,7 +2142,7 @@ rte_eth_dev_fdir_update_signature_filter(uint8_t port_id, if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -2150,7 +2150,7 @@ rte_eth_dev_fdir_update_signature_filter(uint8_t port_id, if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_SIGNATURE) { PMD_DEBUG_TRACE("port %d: invalid FDIR mode=%u\n", port_id, dev->data->dev_conf.fdir_conf.mode); - return (-ENOSYS); + return -ENOSYS; } if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP @@ -2159,7 +2159,7 @@ rte_eth_dev_fdir_update_signature_filter(uint8_t port_id, PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " "None l4type, source & destinations ports " "should be null!\n"); - return (-EINVAL); + return -EINVAL; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fdir_update_signature_filter, -ENOTSUP); @@ -2176,7 +2176,7 @@ rte_eth_dev_fdir_remove_signature_filter(uint8_t port_id, if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -2184,7 +2184,7 @@ rte_eth_dev_fdir_remove_signature_filter(uint8_t port_id, if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_SIGNATURE) { PMD_DEBUG_TRACE("port %d: invalid FDIR mode=%u\n", port_id, dev->data->dev_conf.fdir_conf.mode); - return (-ENOSYS); + return -ENOSYS; } if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP @@ -2193,7 +2193,7 @@ rte_eth_dev_fdir_remove_signature_filter(uint8_t port_id, PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " "None l4type source & destinations ports " "should be null!\n"); - return (-EINVAL); + return -EINVAL; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fdir_remove_signature_filter, -ENOTSUP); @@ -2207,19 +2207,19 @@ rte_eth_dev_fdir_get_infos(uint8_t port_id, struct rte_eth_fdir *fdir) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; if (!(dev->data->dev_conf.fdir_conf.mode)) { PMD_DEBUG_TRACE("port %d: pkt-filter disabled\n", port_id); - return (-ENOSYS); + return -ENOSYS; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fdir_infos_get, -ENOTSUP); (*dev->dev_ops->fdir_infos_get)(dev, fdir); - return (0); + return 0; } int @@ -2232,7 +2232,7 @@ rte_eth_dev_fdir_add_perfect_filter(uint8_t port_id, if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -2240,7 +2240,7 @@ rte_eth_dev_fdir_add_perfect_filter(uint8_t port_id, if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_PERFECT) { PMD_DEBUG_TRACE("port %d: invalid FDIR mode=%u\n", port_id, dev->data->dev_conf.fdir_conf.mode); - return (-ENOSYS); + return -ENOSYS; } if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP @@ -2249,12 +2249,12 @@ rte_eth_dev_fdir_add_perfect_filter(uint8_t port_id, PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " "None l4type, source & destinations ports " "should be null!\n"); - return (-EINVAL); + return -EINVAL; } /* For now IPv6 is not supported with perfect filter */ if (fdir_filter->iptype == RTE_FDIR_IPTYPE_IPV6) - return (-ENOTSUP); + return -ENOTSUP; FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fdir_add_perfect_filter, -ENOTSUP); return (*dev->dev_ops->fdir_add_perfect_filter)(dev, fdir_filter, @@ -2272,7 +2272,7 @@ rte_eth_dev_fdir_update_perfect_filter(uint8_t port_id, if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -2280,7 +2280,7 @@ rte_eth_dev_fdir_update_perfect_filter(uint8_t port_id, if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_PERFECT) { PMD_DEBUG_TRACE("port %d: invalid FDIR mode=%u\n", port_id, dev->data->dev_conf.fdir_conf.mode); - return (-ENOSYS); + return -ENOSYS; } if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP @@ -2289,12 +2289,12 @@ rte_eth_dev_fdir_update_perfect_filter(uint8_t port_id, PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " "None l4type, source & destinations ports " "should be null!\n"); - return (-EINVAL); + return -EINVAL; } /* For now IPv6 is not supported with perfect filter */ if (fdir_filter->iptype == RTE_FDIR_IPTYPE_IPV6) - return (-ENOTSUP); + return -ENOTSUP; FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fdir_update_perfect_filter, -ENOTSUP); return (*dev->dev_ops->fdir_update_perfect_filter)(dev, fdir_filter, @@ -2310,7 +2310,7 @@ rte_eth_dev_fdir_remove_perfect_filter(uint8_t port_id, if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -2318,7 +2318,7 @@ rte_eth_dev_fdir_remove_perfect_filter(uint8_t port_id, if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_PERFECT) { PMD_DEBUG_TRACE("port %d: invalid FDIR mode=%u\n", port_id, dev->data->dev_conf.fdir_conf.mode); - return (-ENOSYS); + return -ENOSYS; } if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP @@ -2327,12 +2327,12 @@ rte_eth_dev_fdir_remove_perfect_filter(uint8_t port_id, PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " "None l4type, source & destinations ports " "should be null!\n"); - return (-EINVAL); + return -EINVAL; } /* For now IPv6 is not supported with perfect filter */ if (fdir_filter->iptype == RTE_FDIR_IPTYPE_IPV6) - return (-ENOTSUP); + return -ENOTSUP; FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fdir_remove_perfect_filter, -ENOTSUP); return (*dev->dev_ops->fdir_remove_perfect_filter)(dev, fdir_filter, @@ -2346,13 +2346,13 @@ rte_eth_dev_fdir_set_masks(uint8_t port_id, struct rte_fdir_masks *fdir_mask) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; if (!(dev->data->dev_conf.fdir_conf.mode)) { PMD_DEBUG_TRACE("port %d: pkt-filter disabled\n", port_id); - return (-ENOSYS); + return -ENOSYS; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fdir_set_masks, -ENOTSUP); @@ -2366,7 +2366,7 @@ rte_eth_dev_flow_ctrl_get(uint8_t port_id, struct rte_eth_fc_conf *fc_conf) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -2382,12 +2382,12 @@ rte_eth_dev_flow_ctrl_set(uint8_t port_id, struct rte_eth_fc_conf *fc_conf) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } if ((fc_conf->send_xon != 0) && (fc_conf->send_xon != 1)) { PMD_DEBUG_TRACE("Invalid send_xon, only 0/1 allowed\n"); - return (-EINVAL); + return -EINVAL; } dev = &rte_eth_devices[port_id]; @@ -2402,19 +2402,19 @@ rte_eth_dev_priority_flow_ctrl_set(uint8_t port_id, struct rte_eth_pfc_conf *pfc if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } if (pfc_conf->priority > (ETH_DCB_NUM_USER_PRIORITIES - 1)) { PMD_DEBUG_TRACE("Invalid priority, only 0-7 allowed\n"); - return (-EINVAL); + return -EINVAL; } dev = &rte_eth_devices[port_id]; /* High water, low water validation are device specific */ if (*dev->dev_ops->priority_flow_ctrl_set) return (*dev->dev_ops->priority_flow_ctrl_set)(dev, pfc_conf); - return (-ENOTSUP); + return -ENOTSUP; } static int @@ -2532,7 +2532,7 @@ rte_eth_dev_rss_hash_update(uint8_t port_id, struct rte_eth_rss_conf *rss_conf) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } rss_hash_protos = rss_conf->rss_hf; @@ -2540,7 +2540,7 @@ rte_eth_dev_rss_hash_update(uint8_t port_id, struct rte_eth_rss_conf *rss_conf) ((rss_hash_protos & ETH_RSS_PROTO_MASK) == 0)) { PMD_DEBUG_TRACE("Invalid rss_hash_protos=0x%x\n", rss_hash_protos); - return (-EINVAL); + return -EINVAL; } dev = &rte_eth_devices[port_id]; FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_update, -ENOTSUP); @@ -2555,7 +2555,7 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id, if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -2623,12 +2623,12 @@ rte_eth_led_on(uint8_t port_id) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_on, -ENOTSUP); - return ((*dev->dev_ops->dev_led_on)(dev)); + return (*dev->dev_ops->dev_led_on)(dev); } int @@ -2638,12 +2638,12 @@ rte_eth_led_off(uint8_t port_id) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_off, -ENOTSUP); - return ((*dev->dev_ops->dev_led_off)(dev)); + return (*dev->dev_ops->dev_led_off)(dev); } /* @@ -2678,7 +2678,7 @@ rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr, if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -2687,11 +2687,11 @@ rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr, if (is_zero_ether_addr(addr)) { PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n", port_id); - return (-EINVAL); + return -EINVAL; } if (pool >= ETH_64_POOLS) { PMD_DEBUG_TRACE("pool id must be 0-%d\n", ETH_64_POOLS - 1); - return (-EINVAL); + return -EINVAL; } index = get_mac_addr_index(port_id, addr); @@ -2700,7 +2700,7 @@ rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr, if (index < 0) { PMD_DEBUG_TRACE("port %d: MAC address array full\n", port_id); - return (-ENOSPC); + return -ENOSPC; } } else { pool_mask = dev->data->mac_pool_sel[index]; @@ -2730,7 +2730,7 @@ rte_eth_dev_mac_addr_remove(uint8_t port_id, struct ether_addr *addr) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -2739,7 +2739,7 @@ rte_eth_dev_mac_addr_remove(uint8_t port_id, struct ether_addr *addr) index = get_mac_addr_index(port_id, addr); if (index == 0) { PMD_DEBUG_TRACE("port %d: Cannot remove default MAC address\n", port_id); - return (-EADDRINUSE); + return -EADDRINUSE; } else if (index < 0) return 0; /* Do nothing if address wasn't found */ @@ -2766,7 +2766,7 @@ rte_eth_dev_set_vf_rxmode(uint8_t port_id, uint16_t vf, if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("set VF RX mode:Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -2775,12 +2775,12 @@ rte_eth_dev_set_vf_rxmode(uint8_t port_id, uint16_t vf, num_vfs = dev_info.max_vfs; if (vf > num_vfs) { PMD_DEBUG_TRACE("set VF RX mode:invalid VF id %d\n", vf); - return (-EINVAL); + return -EINVAL; } if (rx_mode == 0) { PMD_DEBUG_TRACE("set VF RX mode:mode mask ca not be zero\n"); - return (-EINVAL); + return -EINVAL; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx_mode, -ENOTSUP); @@ -2821,14 +2821,14 @@ rte_eth_dev_uc_hash_table_set(uint8_t port_id, struct ether_addr *addr, if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("unicast hash setting:Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; if (is_zero_ether_addr(addr)) { PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n", port_id); - return (-EINVAL); + return -EINVAL; } index = get_hash_mac_addr_index(port_id, addr); @@ -2840,14 +2840,14 @@ rte_eth_dev_uc_hash_table_set(uint8_t port_id, struct ether_addr *addr, if (!on) { PMD_DEBUG_TRACE("port %d: the MAC address was not" " set in UTA\n", port_id); - return (-EINVAL); + return -EINVAL; } index = get_hash_mac_addr_index(port_id, &null_mac_addr); if (index < 0) { PMD_DEBUG_TRACE("port %d: MAC address array full\n", port_id); - return (-ENOSPC); + return -ENOSPC; } } @@ -2874,7 +2874,7 @@ rte_eth_dev_uc_all_hash_table_set(uint8_t port_id, uint8_t on) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("unicast hash setting:Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -2892,7 +2892,7 @@ rte_eth_dev_set_vf_rx(uint8_t port_id, uint16_t vf, uint8_t on) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -2901,7 +2901,7 @@ rte_eth_dev_set_vf_rx(uint8_t port_id, uint16_t vf, uint8_t on) num_vfs = dev_info.max_vfs; if (vf > num_vfs) { PMD_DEBUG_TRACE("port %d: invalid vf id\n", port_id); - return (-EINVAL); + return -EINVAL; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx, -ENOTSUP); @@ -2917,7 +2917,7 @@ rte_eth_dev_set_vf_tx(uint8_t port_id, uint16_t vf, uint8_t on) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("set pool tx:Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -2926,7 +2926,7 @@ rte_eth_dev_set_vf_tx(uint8_t port_id, uint16_t vf, uint8_t on) num_vfs = dev_info.max_vfs; if (vf > num_vfs) { PMD_DEBUG_TRACE("set pool tx:invalid pool id=%d\n", vf); - return (-EINVAL); + return -EINVAL; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_tx, -ENOTSUP); @@ -2942,19 +2942,19 @@ rte_eth_dev_set_vf_vlan_filter(uint8_t port_id, uint16_t vlan_id, if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("VF VLAN filter:invalid port id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; if (vlan_id > ETHER_MAX_VLAN_ID) { PMD_DEBUG_TRACE("VF VLAN filter:invalid VLAN id=%d\n", vlan_id); - return (-EINVAL); + return -EINVAL; } if (vf_mask == 0) { PMD_DEBUG_TRACE("VF VLAN filter:pool_mask can not be 0\n"); - return (-EINVAL); + return -EINVAL; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_filter, -ENOTSUP); @@ -3042,31 +3042,31 @@ rte_eth_mirror_rule_set(uint8_t port_id, if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } if (mirror_conf->rule_type_mask == 0) { PMD_DEBUG_TRACE("mirror rule type can not be 0.\n"); - return (-EINVAL); + return -EINVAL; } if (mirror_conf->dst_pool >= ETH_64_POOLS) { PMD_DEBUG_TRACE("Invalid dst pool, pool id must " "be 0-%d\n", ETH_64_POOLS - 1); - return (-EINVAL); + return -EINVAL; } if ((mirror_conf->rule_type_mask & ETH_VMDQ_POOL_MIRROR) && (mirror_conf->pool_mask == 0)) { PMD_DEBUG_TRACE("Invalid mirror pool, pool mask can not " "be 0.\n"); - return (-EINVAL); + return -EINVAL; } if (rule_id >= ETH_VMDQ_NUM_MIRROR_RULE) { PMD_DEBUG_TRACE("Invalid rule_id, rule_id must be 0-%d\n", ETH_VMDQ_NUM_MIRROR_RULE - 1); - return (-EINVAL); + return -EINVAL; } dev = &rte_eth_devices[port_id]; @@ -3082,13 +3082,13 @@ rte_eth_mirror_rule_reset(uint8_t port_id, uint8_t rule_id) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } if (rule_id >= ETH_VMDQ_NUM_MIRROR_RULE) { PMD_DEBUG_TRACE("Invalid rule_id, rule_id must be 0-%d\n", ETH_VMDQ_NUM_MIRROR_RULE-1); - return (-EINVAL); + return -EINVAL; } dev = &rte_eth_devices[port_id]; @@ -3163,7 +3163,7 @@ rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; @@ -3182,11 +3182,11 @@ rte_eth_dev_callback_register(uint8_t port_id, struct rte_eth_dev_callback *user_cb; if (!cb_fn) - return (-EINVAL); + return -EINVAL; if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-EINVAL); + return -EINVAL; } dev = &rte_eth_devices[port_id]; @@ -3211,7 +3211,7 @@ rte_eth_dev_callback_register(uint8_t port_id, } rte_spinlock_unlock(&rte_eth_dev_cb_lock); - return ((user_cb == NULL) ? -ENOMEM : 0); + return (user_cb == NULL) ? -ENOMEM : 0; } int @@ -3224,11 +3224,11 @@ rte_eth_dev_callback_unregister(uint8_t port_id, struct rte_eth_dev_callback *cb, *next; if (!cb_fn) - return (-EINVAL); + return -EINVAL; if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-EINVAL); + return -EINVAL; } dev = &rte_eth_devices[port_id]; @@ -3257,7 +3257,7 @@ rte_eth_dev_callback_unregister(uint8_t port_id, } rte_spinlock_unlock(&rte_eth_dev_cb_lock); - return (ret); + return ret; } void @@ -3288,13 +3288,13 @@ int rte_eth_dev_bypass_init(uint8_t port_id) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); - return (-ENODEV); + return -ENODEV; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_init, -ENOTSUP); @@ -3309,13 +3309,13 @@ rte_eth_dev_bypass_state_show(uint8_t port_id, uint32_t *state) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); - return (-ENODEV); + return -ENODEV; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_show, -ENOTSUP); (*dev->dev_ops->bypass_state_show)(dev, state); @@ -3329,13 +3329,13 @@ rte_eth_dev_bypass_state_set(uint8_t port_id, uint32_t *new_state) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); - return (-ENODEV); + return -ENODEV; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_set, -ENOTSUP); @@ -3350,13 +3350,13 @@ rte_eth_dev_bypass_event_show(uint8_t port_id, uint32_t event, uint32_t *state) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); - return (-ENODEV); + return -ENODEV; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_show, -ENOTSUP); @@ -3371,13 +3371,13 @@ rte_eth_dev_bypass_event_store(uint8_t port_id, uint32_t event, uint32_t state) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); - return (-ENODEV); + return -ENODEV; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_event_set, -ENOTSUP); @@ -3392,13 +3392,13 @@ rte_eth_dev_wd_timeout_store(uint8_t port_id, uint32_t timeout) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); - return (-ENODEV); + return -ENODEV; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_timeout_set, -ENOTSUP); @@ -3413,13 +3413,13 @@ rte_eth_dev_bypass_ver_show(uint8_t port_id, uint32_t *ver) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); - return (-ENODEV); + return -ENODEV; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_ver_show, -ENOTSUP); @@ -3434,13 +3434,13 @@ rte_eth_dev_bypass_wd_timeout_show(uint8_t port_id, uint32_t *wd_timeout) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); - return (-ENODEV); + return -ENODEV; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_timeout_show, -ENOTSUP); @@ -3455,13 +3455,13 @@ rte_eth_dev_bypass_wd_reset(uint8_t port_id) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return (-ENODEV); + return -ENODEV; } dev = &rte_eth_devices[port_id]; if (!dev) { PMD_DEBUG_TRACE("Invalid port device\n"); - return (-ENODEV); + return -ENODEV; } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_reset, -ENOTSUP); @@ -3565,12 +3565,12 @@ rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id, struct rte_eth_rxtx_callback *user_cb) { #ifndef RTE_ETHDEV_RXTX_CALLBACKS - return (-ENOTSUP); + return -ENOTSUP; #endif /* Check input parameters. */ if (!rte_eth_dev_is_valid_port(port_id) || user_cb == NULL || queue_id >= rte_eth_devices[port_id].data->nb_rx_queues) { - return (-EINVAL); + return -EINVAL; } struct rte_eth_dev *dev = &rte_eth_devices[port_id]; @@ -3596,7 +3596,7 @@ rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id, } while (cb != NULL); /* Callback wasn't found. */ - return (-EINVAL); + return -EINVAL; } int @@ -3604,12 +3604,12 @@ rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id, struct rte_eth_rxtx_callback *user_cb) { #ifndef RTE_ETHDEV_RXTX_CALLBACKS - return (-ENOTSUP); + return -ENOTSUP; #endif /* Check input parameters. */ if (!rte_eth_dev_is_valid_port(port_id) || user_cb == NULL || queue_id >= rte_eth_devices[port_id].data->nb_tx_queues) { - return (-EINVAL); + return -EINVAL; } struct rte_eth_dev *dev = &rte_eth_devices[port_id]; @@ -3635,5 +3635,5 @@ rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id, } while (cb != NULL); /* Callback wasn't found. */ - return (-EINVAL); + return -EINVAL; } -- 2.1.4 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH 4/4] rte_ethdev: remove unnecessary paren on return 2015-04-09 21:29 ` [dpdk-dev] [PATCH 4/4] rte_ethdev: remove unnecessary paren on return Stephen Hemminger @ 2015-04-15 9:56 ` Bruce Richardson 0 siblings, 0 replies; 10+ messages in thread From: Bruce Richardson @ 2015-04-15 9:56 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev On Thu, Apr 09, 2015 at 02:29:42PM -0700, Stephen Hemminger wrote: > The Linux style is not to put extra useless paren's around > the expression passed to return statement. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Bruce Richardson <bruce.richardson@intel.com> > --- > lib/librte_ether/rte_ethdev.c | 298 +++++++++++++++++++++--------------------- > 1 file changed, 149 insertions(+), 149 deletions(-) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index 416e778..b856100 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -81,7 +81,7 @@ > #define PROC_PRIMARY_OR_ERR_RET(retval) do { \ > if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \ > PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \ > - return (retval); \ > + return (retval); \ > } \ > } while (0) > #define PROC_PRIMARY_OR_RET() do { \ > @@ -95,7 +95,7 @@ > #define FUNC_PTR_OR_ERR_RET(func, retval) do { \ > if ((func) == NULL) { \ > PMD_DEBUG_TRACE("Function not supported\n"); \ > - return (retval); \ > + return (retval); \ > } \ > } while (0) > #define FUNC_PTR_OR_RET(func) do { \ > @@ -325,7 +325,7 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv, > /* Invoke PMD device initialization function */ > diag = (*eth_drv->eth_dev_init)(eth_dev); > if (diag == 0) > - return (0); > + return 0; > > PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%u device_id=0x%x)" > " failed\n", pci_drv->name, > @@ -422,7 +422,7 @@ rte_eth_dev_socket_id(uint8_t port_id) > uint8_t > rte_eth_dev_count(void) > { > - return (nb_ports); > + return nb_ports; > } > > /* So far, DPDK hotplug function only supports linux */ > @@ -763,7 +763,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) > > } > dev->data->nb_rx_queues = nb_queues; > - return (0); > + return 0; > } > > int > @@ -907,7 +907,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) > > } > dev->data->nb_tx_queues = nb_queues; > - return (0); > + return 0; > } > > static int > @@ -954,7 +954,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > port_id, > dev_conf->rxmode.mq_mode, > dev_conf->txmode.mq_mode); > - return (-EINVAL); > + return -EINVAL; > } > > switch (dev_conf->rxmode.mq_mode) { > @@ -965,7 +965,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > " SRIOV active, " > "unsupported VMDQ mq_mode rx %u\n", > port_id, dev_conf->rxmode.mq_mode); > - return (-EINVAL); > + return -EINVAL; > case ETH_MQ_RX_RSS: > PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8 > " SRIOV active, " > @@ -1001,7 +1001,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > " SRIOV active, " > "unsupported VMDQ mq_mode tx %u\n", > port_id, dev_conf->txmode.mq_mode); > - return (-EINVAL); > + return -EINVAL; > default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */ > /* if nothing mq mode configure, use default scheme */ > dev->data->dev_conf.txmode.mq_mode = ETH_MQ_TX_VMDQ_ONLY; > @@ -1014,7 +1014,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > PMD_DEBUG_TRACE("ethdev port_id=%d SRIOV active, " > "queue number must less equal to %d\n", > port_id, RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool); > - return (-EINVAL); > + return -EINVAL; > } > } else { > /* For vmdb+dcb mode check our configuration before we go further */ > @@ -1025,7 +1025,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > PMD_DEBUG_TRACE("ethdev port_id=%d VMDQ+DCB, nb_rx_q " > "!= %d\n", > port_id, ETH_VMDQ_DCB_NUM_QUEUES); > - return (-EINVAL); > + return -EINVAL; > } > conf = &(dev_conf->rx_adv_conf.vmdq_dcb_conf); > if (!(conf->nb_queue_pools == ETH_16_POOLS || > @@ -1033,7 +1033,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > PMD_DEBUG_TRACE("ethdev port_id=%d VMDQ+DCB selected, " > "nb_queue_pools must be %d or %d\n", > port_id, ETH_16_POOLS, ETH_32_POOLS); > - return (-EINVAL); > + return -EINVAL; > } > } > if (dev_conf->txmode.mq_mode == ETH_MQ_TX_VMDQ_DCB) { > @@ -1043,7 +1043,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > PMD_DEBUG_TRACE("ethdev port_id=%d VMDQ+DCB, nb_tx_q " > "!= %d\n", > port_id, ETH_VMDQ_DCB_NUM_QUEUES); > - return (-EINVAL); > + return -EINVAL; > } > conf = &(dev_conf->tx_adv_conf.vmdq_dcb_tx_conf); > if (!(conf->nb_queue_pools == ETH_16_POOLS || > @@ -1052,7 +1052,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > "nb_queue_pools != %d or nb_queue_pools " > "!= %d\n", > port_id, ETH_16_POOLS, ETH_32_POOLS); > - return (-EINVAL); > + return -EINVAL; > } > } > > @@ -1064,7 +1064,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > PMD_DEBUG_TRACE("ethdev port_id=%d DCB, nb_rx_q " > "!= %d\n", > port_id, ETH_DCB_NUM_QUEUES); > - return (-EINVAL); > + return -EINVAL; > } > conf = &(dev_conf->rx_adv_conf.dcb_rx_conf); > if (!(conf->nb_tcs == ETH_4_TCS || > @@ -1073,7 +1073,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > "nb_tcs != %d or nb_tcs " > "!= %d\n", > port_id, ETH_4_TCS, ETH_8_TCS); > - return (-EINVAL); > + return -EINVAL; > } > } > > @@ -1084,7 +1084,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > PMD_DEBUG_TRACE("ethdev port_id=%d DCB, nb_tx_q " > "!= %d\n", > port_id, ETH_DCB_NUM_QUEUES); > - return (-EINVAL); > + return -EINVAL; > } > conf = &(dev_conf->tx_adv_conf.dcb_tx_conf); > if (!(conf->nb_tcs == ETH_4_TCS || > @@ -1093,7 +1093,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > "nb_tcs != %d or nb_tcs " > "!= %d\n", > port_id, ETH_4_TCS, ETH_8_TCS); > - return (-EINVAL); > + return -EINVAL; > } > } > } > @@ -1114,21 +1114,21 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-EINVAL); > + return -EINVAL; > } > > if (nb_rx_q > RTE_MAX_QUEUES_PER_PORT) { > PMD_DEBUG_TRACE( > "Number of RX queues requested (%u) is greater than max supported(%d)\n", > nb_rx_q, RTE_MAX_QUEUES_PER_PORT); > - return (-EINVAL); > + return -EINVAL; > } > > if (nb_tx_q > RTE_MAX_QUEUES_PER_PORT) { > PMD_DEBUG_TRACE( > "Number of TX queues requested (%u) is greater than max supported(%d)\n", > nb_tx_q, RTE_MAX_QUEUES_PER_PORT); > - return (-EINVAL); > + return -EINVAL; > } > > dev = &rte_eth_devices[port_id]; > @@ -1139,7 +1139,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > if (dev->data->dev_started) { > PMD_DEBUG_TRACE( > "port %d must be stopped to allow configuration\n", port_id); > - return (-EBUSY); > + return -EBUSY; > } > > /* > @@ -1151,21 +1151,21 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > if (nb_rx_q > dev_info.max_rx_queues) { > PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_queues=%d > %d\n", > port_id, nb_rx_q, dev_info.max_rx_queues); > - return (-EINVAL); > + return -EINVAL; > } > if (nb_rx_q == 0) { > PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_q == 0\n", port_id); > - return (-EINVAL); > + return -EINVAL; > } > > if (nb_tx_q > dev_info.max_tx_queues) { > PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_queues=%d > %d\n", > port_id, nb_tx_q, dev_info.max_tx_queues); > - return (-EINVAL); > + return -EINVAL; > } > if (nb_tx_q == 0) { > PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_q == 0\n", port_id); > - return (-EINVAL); > + return -EINVAL; > } > > /* Copy the dev_conf parameter into the dev structure */ > @@ -1181,7 +1181,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > if (!(pci_drv->drv_flags & RTE_PCI_DRV_INTR_LSC)) { > PMD_DEBUG_TRACE("driver %s does not support lsc\n", > pci_drv->name); > - return (-EINVAL); > + return -EINVAL; > } > } > > @@ -1197,14 +1197,14 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > port_id, > (unsigned)dev_conf->rxmode.max_rx_pkt_len, > (unsigned)dev_info.max_rx_pktlen); > - return (-EINVAL); > + return -EINVAL; > } else if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN) { > PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u" > " < min valid value %u\n", > port_id, > (unsigned)dev_conf->rxmode.max_rx_pkt_len, > (unsigned)ETHER_MIN_LEN); > - return (-EINVAL); > + return -EINVAL; > } > } else { > if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN || > @@ -1313,7 +1313,7 @@ rte_eth_dev_start(uint8_t port_id) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-EINVAL); > + return -EINVAL; > } > > dev = &rte_eth_devices[port_id]; > @@ -1324,7 +1324,7 @@ rte_eth_dev_start(uint8_t port_id) > PMD_DEBUG_TRACE("Device with port_id=%" PRIu8 > " already started\n", > port_id); > - return (0); > + return 0; > } > > diag = (*dev->dev_ops->dev_start)(dev); > @@ -1450,13 +1450,13 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-EINVAL); > + return -EINVAL; > } > > dev = &rte_eth_devices[port_id]; > if (rx_queue_id >= dev->data->nb_rx_queues) { > PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id); > - return (-EINVAL); > + return -EINVAL; > } > > if (dev->data->dev_started) { > @@ -1478,7 +1478,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, > PMD_DEBUG_TRACE("%s private_data_size %d < %d\n", > mp->name, (int) mp->private_data_size, > (int) sizeof(struct rte_pktmbuf_pool_private)); > - return (-ENOSPC); > + return -ENOSPC; > } > mbp_priv = rte_mempool_get_priv(mp); > mbp_buf_size = mbp_priv->mbuf_data_room_size; > @@ -1493,7 +1493,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, > dev_info.min_rx_bufsize), > (int)RTE_PKTMBUF_HEADROOM, > (int)dev_info.min_rx_bufsize); > - return (-EINVAL); > + return -EINVAL; > } > > if (rx_conf == NULL) > @@ -1524,13 +1524,13 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-EINVAL); > + return -EINVAL; > } > > dev = &rte_eth_devices[port_id]; > if (tx_queue_id >= dev->data->nb_tx_queues) { > PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id); > - return (-EINVAL); > + return -EINVAL; > } > > if (dev->data->dev_started) { > @@ -1710,7 +1710,7 @@ rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -1916,7 +1916,7 @@ rte_eth_dev_get_mtu(uint8_t port_id, uint16_t *mtu) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -1932,7 +1932,7 @@ rte_eth_dev_set_mtu(uint8_t port_id, uint16_t mtu) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -1952,19 +1952,19 @@ rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > if (!(dev->data->dev_conf.rxmode.hw_vlan_filter)) { > PMD_DEBUG_TRACE("port %d: vlan-filtering disabled\n", port_id); > - return (-ENOSYS); > + return -ENOSYS; > } > > if (vlan_id > 4095) { > PMD_DEBUG_TRACE("(port_id=%d) invalid vlan_id=%u > 4095\n", > port_id, (unsigned) vlan_id); > - return (-EINVAL); > + return -EINVAL; > } > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_filter_set, -ENOTSUP); > > @@ -1978,19 +1978,19 @@ rte_eth_dev_set_vlan_strip_on_queue(uint8_t port_id, uint16_t rx_queue_id, int o > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > if (rx_queue_id >= dev->data->nb_rx_queues) { > PMD_DEBUG_TRACE("Invalid rx_queue_id=%d\n", port_id); > - return (-EINVAL); > + return -EINVAL; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP); > (*dev->dev_ops->vlan_strip_queue_set)(dev, rx_queue_id, on); > > - return (0); > + return 0; > } > > int > @@ -2000,14 +2000,14 @@ rte_eth_dev_set_vlan_ether_type(uint8_t port_id, uint16_t tpid) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_tpid_set, -ENOTSUP); > (*dev->dev_ops->vlan_tpid_set)(dev, tpid); > > - return (0); > + return 0; > } > > int > @@ -2020,7 +2020,7 @@ rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -2065,7 +2065,7 @@ rte_eth_dev_get_vlan_offload(uint8_t port_id) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -2089,7 +2089,7 @@ rte_eth_dev_set_vlan_pvid(uint8_t port_id, uint16_t pvid, int on) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -2108,7 +2108,7 @@ rte_eth_dev_fdir_add_signature_filter(uint8_t port_id, > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -2116,7 +2116,7 @@ rte_eth_dev_fdir_add_signature_filter(uint8_t port_id, > if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_SIGNATURE) { > PMD_DEBUG_TRACE("port %d: invalid FDIR mode=%u\n", > port_id, dev->data->dev_conf.fdir_conf.mode); > - return (-ENOSYS); > + return -ENOSYS; > } > > if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP > @@ -2125,7 +2125,7 @@ rte_eth_dev_fdir_add_signature_filter(uint8_t port_id, > PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " > "None l4type, source & destinations ports " > "should be null!\n"); > - return (-EINVAL); > + return -EINVAL; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fdir_add_signature_filter, -ENOTSUP); > @@ -2142,7 +2142,7 @@ rte_eth_dev_fdir_update_signature_filter(uint8_t port_id, > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -2150,7 +2150,7 @@ rte_eth_dev_fdir_update_signature_filter(uint8_t port_id, > if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_SIGNATURE) { > PMD_DEBUG_TRACE("port %d: invalid FDIR mode=%u\n", > port_id, dev->data->dev_conf.fdir_conf.mode); > - return (-ENOSYS); > + return -ENOSYS; > } > > if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP > @@ -2159,7 +2159,7 @@ rte_eth_dev_fdir_update_signature_filter(uint8_t port_id, > PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " > "None l4type, source & destinations ports " > "should be null!\n"); > - return (-EINVAL); > + return -EINVAL; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fdir_update_signature_filter, -ENOTSUP); > @@ -2176,7 +2176,7 @@ rte_eth_dev_fdir_remove_signature_filter(uint8_t port_id, > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -2184,7 +2184,7 @@ rte_eth_dev_fdir_remove_signature_filter(uint8_t port_id, > if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_SIGNATURE) { > PMD_DEBUG_TRACE("port %d: invalid FDIR mode=%u\n", > port_id, dev->data->dev_conf.fdir_conf.mode); > - return (-ENOSYS); > + return -ENOSYS; > } > > if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP > @@ -2193,7 +2193,7 @@ rte_eth_dev_fdir_remove_signature_filter(uint8_t port_id, > PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " > "None l4type source & destinations ports " > "should be null!\n"); > - return (-EINVAL); > + return -EINVAL; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fdir_remove_signature_filter, -ENOTSUP); > @@ -2207,19 +2207,19 @@ rte_eth_dev_fdir_get_infos(uint8_t port_id, struct rte_eth_fdir *fdir) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > if (!(dev->data->dev_conf.fdir_conf.mode)) { > PMD_DEBUG_TRACE("port %d: pkt-filter disabled\n", port_id); > - return (-ENOSYS); > + return -ENOSYS; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fdir_infos_get, -ENOTSUP); > > (*dev->dev_ops->fdir_infos_get)(dev, fdir); > - return (0); > + return 0; > } > > int > @@ -2232,7 +2232,7 @@ rte_eth_dev_fdir_add_perfect_filter(uint8_t port_id, > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -2240,7 +2240,7 @@ rte_eth_dev_fdir_add_perfect_filter(uint8_t port_id, > if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_PERFECT) { > PMD_DEBUG_TRACE("port %d: invalid FDIR mode=%u\n", > port_id, dev->data->dev_conf.fdir_conf.mode); > - return (-ENOSYS); > + return -ENOSYS; > } > > if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP > @@ -2249,12 +2249,12 @@ rte_eth_dev_fdir_add_perfect_filter(uint8_t port_id, > PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " > "None l4type, source & destinations ports " > "should be null!\n"); > - return (-EINVAL); > + return -EINVAL; > } > > /* For now IPv6 is not supported with perfect filter */ > if (fdir_filter->iptype == RTE_FDIR_IPTYPE_IPV6) > - return (-ENOTSUP); > + return -ENOTSUP; > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fdir_add_perfect_filter, -ENOTSUP); > return (*dev->dev_ops->fdir_add_perfect_filter)(dev, fdir_filter, > @@ -2272,7 +2272,7 @@ rte_eth_dev_fdir_update_perfect_filter(uint8_t port_id, > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -2280,7 +2280,7 @@ rte_eth_dev_fdir_update_perfect_filter(uint8_t port_id, > if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_PERFECT) { > PMD_DEBUG_TRACE("port %d: invalid FDIR mode=%u\n", > port_id, dev->data->dev_conf.fdir_conf.mode); > - return (-ENOSYS); > + return -ENOSYS; > } > > if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP > @@ -2289,12 +2289,12 @@ rte_eth_dev_fdir_update_perfect_filter(uint8_t port_id, > PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " > "None l4type, source & destinations ports " > "should be null!\n"); > - return (-EINVAL); > + return -EINVAL; > } > > /* For now IPv6 is not supported with perfect filter */ > if (fdir_filter->iptype == RTE_FDIR_IPTYPE_IPV6) > - return (-ENOTSUP); > + return -ENOTSUP; > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fdir_update_perfect_filter, -ENOTSUP); > return (*dev->dev_ops->fdir_update_perfect_filter)(dev, fdir_filter, > @@ -2310,7 +2310,7 @@ rte_eth_dev_fdir_remove_perfect_filter(uint8_t port_id, > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -2318,7 +2318,7 @@ rte_eth_dev_fdir_remove_perfect_filter(uint8_t port_id, > if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_PERFECT) { > PMD_DEBUG_TRACE("port %d: invalid FDIR mode=%u\n", > port_id, dev->data->dev_conf.fdir_conf.mode); > - return (-ENOSYS); > + return -ENOSYS; > } > > if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP > @@ -2327,12 +2327,12 @@ rte_eth_dev_fdir_remove_perfect_filter(uint8_t port_id, > PMD_DEBUG_TRACE(" Port are meaningless for SCTP and " > "None l4type, source & destinations ports " > "should be null!\n"); > - return (-EINVAL); > + return -EINVAL; > } > > /* For now IPv6 is not supported with perfect filter */ > if (fdir_filter->iptype == RTE_FDIR_IPTYPE_IPV6) > - return (-ENOTSUP); > + return -ENOTSUP; > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fdir_remove_perfect_filter, -ENOTSUP); > return (*dev->dev_ops->fdir_remove_perfect_filter)(dev, fdir_filter, > @@ -2346,13 +2346,13 @@ rte_eth_dev_fdir_set_masks(uint8_t port_id, struct rte_fdir_masks *fdir_mask) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > if (!(dev->data->dev_conf.fdir_conf.mode)) { > PMD_DEBUG_TRACE("port %d: pkt-filter disabled\n", port_id); > - return (-ENOSYS); > + return -ENOSYS; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fdir_set_masks, -ENOTSUP); > @@ -2366,7 +2366,7 @@ rte_eth_dev_flow_ctrl_get(uint8_t port_id, struct rte_eth_fc_conf *fc_conf) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -2382,12 +2382,12 @@ rte_eth_dev_flow_ctrl_set(uint8_t port_id, struct rte_eth_fc_conf *fc_conf) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > if ((fc_conf->send_xon != 0) && (fc_conf->send_xon != 1)) { > PMD_DEBUG_TRACE("Invalid send_xon, only 0/1 allowed\n"); > - return (-EINVAL); > + return -EINVAL; > } > > dev = &rte_eth_devices[port_id]; > @@ -2402,19 +2402,19 @@ rte_eth_dev_priority_flow_ctrl_set(uint8_t port_id, struct rte_eth_pfc_conf *pfc > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > if (pfc_conf->priority > (ETH_DCB_NUM_USER_PRIORITIES - 1)) { > PMD_DEBUG_TRACE("Invalid priority, only 0-7 allowed\n"); > - return (-EINVAL); > + return -EINVAL; > } > > dev = &rte_eth_devices[port_id]; > /* High water, low water validation are device specific */ > if (*dev->dev_ops->priority_flow_ctrl_set) > return (*dev->dev_ops->priority_flow_ctrl_set)(dev, pfc_conf); > - return (-ENOTSUP); > + return -ENOTSUP; > } > > static int > @@ -2532,7 +2532,7 @@ rte_eth_dev_rss_hash_update(uint8_t port_id, struct rte_eth_rss_conf *rss_conf) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > rss_hash_protos = rss_conf->rss_hf; > @@ -2540,7 +2540,7 @@ rte_eth_dev_rss_hash_update(uint8_t port_id, struct rte_eth_rss_conf *rss_conf) > ((rss_hash_protos & ETH_RSS_PROTO_MASK) == 0)) { > PMD_DEBUG_TRACE("Invalid rss_hash_protos=0x%x\n", > rss_hash_protos); > - return (-EINVAL); > + return -EINVAL; > } > dev = &rte_eth_devices[port_id]; > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_update, -ENOTSUP); > @@ -2555,7 +2555,7 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id, > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -2623,12 +2623,12 @@ rte_eth_led_on(uint8_t port_id) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_on, -ENOTSUP); > - return ((*dev->dev_ops->dev_led_on)(dev)); > + return (*dev->dev_ops->dev_led_on)(dev); > } > > int > @@ -2638,12 +2638,12 @@ rte_eth_led_off(uint8_t port_id) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_off, -ENOTSUP); > - return ((*dev->dev_ops->dev_led_off)(dev)); > + return (*dev->dev_ops->dev_led_off)(dev); > } > > /* > @@ -2678,7 +2678,7 @@ rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr, > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -2687,11 +2687,11 @@ rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr, > if (is_zero_ether_addr(addr)) { > PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n", > port_id); > - return (-EINVAL); > + return -EINVAL; > } > if (pool >= ETH_64_POOLS) { > PMD_DEBUG_TRACE("pool id must be 0-%d\n", ETH_64_POOLS - 1); > - return (-EINVAL); > + return -EINVAL; > } > > index = get_mac_addr_index(port_id, addr); > @@ -2700,7 +2700,7 @@ rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr, > if (index < 0) { > PMD_DEBUG_TRACE("port %d: MAC address array full\n", > port_id); > - return (-ENOSPC); > + return -ENOSPC; > } > } else { > pool_mask = dev->data->mac_pool_sel[index]; > @@ -2730,7 +2730,7 @@ rte_eth_dev_mac_addr_remove(uint8_t port_id, struct ether_addr *addr) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -2739,7 +2739,7 @@ rte_eth_dev_mac_addr_remove(uint8_t port_id, struct ether_addr *addr) > index = get_mac_addr_index(port_id, addr); > if (index == 0) { > PMD_DEBUG_TRACE("port %d: Cannot remove default MAC address\n", port_id); > - return (-EADDRINUSE); > + return -EADDRINUSE; > } else if (index < 0) > return 0; /* Do nothing if address wasn't found */ > > @@ -2766,7 +2766,7 @@ rte_eth_dev_set_vf_rxmode(uint8_t port_id, uint16_t vf, > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("set VF RX mode:Invalid port_id=%d\n", > port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -2775,12 +2775,12 @@ rte_eth_dev_set_vf_rxmode(uint8_t port_id, uint16_t vf, > num_vfs = dev_info.max_vfs; > if (vf > num_vfs) { > PMD_DEBUG_TRACE("set VF RX mode:invalid VF id %d\n", vf); > - return (-EINVAL); > + return -EINVAL; > } > > if (rx_mode == 0) { > PMD_DEBUG_TRACE("set VF RX mode:mode mask ca not be zero\n"); > - return (-EINVAL); > + return -EINVAL; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx_mode, -ENOTSUP); > @@ -2821,14 +2821,14 @@ rte_eth_dev_uc_hash_table_set(uint8_t port_id, struct ether_addr *addr, > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("unicast hash setting:Invalid port_id=%d\n", > port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > if (is_zero_ether_addr(addr)) { > PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n", > port_id); > - return (-EINVAL); > + return -EINVAL; > } > > index = get_hash_mac_addr_index(port_id, addr); > @@ -2840,14 +2840,14 @@ rte_eth_dev_uc_hash_table_set(uint8_t port_id, struct ether_addr *addr, > if (!on) { > PMD_DEBUG_TRACE("port %d: the MAC address was not" > " set in UTA\n", port_id); > - return (-EINVAL); > + return -EINVAL; > } > > index = get_hash_mac_addr_index(port_id, &null_mac_addr); > if (index < 0) { > PMD_DEBUG_TRACE("port %d: MAC address array full\n", > port_id); > - return (-ENOSPC); > + return -ENOSPC; > } > } > > @@ -2874,7 +2874,7 @@ rte_eth_dev_uc_all_hash_table_set(uint8_t port_id, uint8_t on) > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("unicast hash setting:Invalid port_id=%d\n", > port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -2892,7 +2892,7 @@ rte_eth_dev_set_vf_rx(uint8_t port_id, uint16_t vf, uint8_t on) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -2901,7 +2901,7 @@ rte_eth_dev_set_vf_rx(uint8_t port_id, uint16_t vf, uint8_t on) > num_vfs = dev_info.max_vfs; > if (vf > num_vfs) { > PMD_DEBUG_TRACE("port %d: invalid vf id\n", port_id); > - return (-EINVAL); > + return -EINVAL; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx, -ENOTSUP); > @@ -2917,7 +2917,7 @@ rte_eth_dev_set_vf_tx(uint8_t port_id, uint16_t vf, uint8_t on) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("set pool tx:Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -2926,7 +2926,7 @@ rte_eth_dev_set_vf_tx(uint8_t port_id, uint16_t vf, uint8_t on) > num_vfs = dev_info.max_vfs; > if (vf > num_vfs) { > PMD_DEBUG_TRACE("set pool tx:invalid pool id=%d\n", vf); > - return (-EINVAL); > + return -EINVAL; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_tx, -ENOTSUP); > @@ -2942,19 +2942,19 @@ rte_eth_dev_set_vf_vlan_filter(uint8_t port_id, uint16_t vlan_id, > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("VF VLAN filter:invalid port id=%d\n", > port_id); > - return (-ENODEV); > + return -ENODEV; > } > dev = &rte_eth_devices[port_id]; > > if (vlan_id > ETHER_MAX_VLAN_ID) { > PMD_DEBUG_TRACE("VF VLAN filter:invalid VLAN id=%d\n", > vlan_id); > - return (-EINVAL); > + return -EINVAL; > } > > if (vf_mask == 0) { > PMD_DEBUG_TRACE("VF VLAN filter:pool_mask can not be 0\n"); > - return (-EINVAL); > + return -EINVAL; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_filter, -ENOTSUP); > @@ -3042,31 +3042,31 @@ rte_eth_mirror_rule_set(uint8_t port_id, > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > if (mirror_conf->rule_type_mask == 0) { > PMD_DEBUG_TRACE("mirror rule type can not be 0.\n"); > - return (-EINVAL); > + return -EINVAL; > } > > if (mirror_conf->dst_pool >= ETH_64_POOLS) { > PMD_DEBUG_TRACE("Invalid dst pool, pool id must " > "be 0-%d\n", ETH_64_POOLS - 1); > - return (-EINVAL); > + return -EINVAL; > } > > if ((mirror_conf->rule_type_mask & ETH_VMDQ_POOL_MIRROR) && > (mirror_conf->pool_mask == 0)) { > PMD_DEBUG_TRACE("Invalid mirror pool, pool mask can not " > "be 0.\n"); > - return (-EINVAL); > + return -EINVAL; > } > > if (rule_id >= ETH_VMDQ_NUM_MIRROR_RULE) { > PMD_DEBUG_TRACE("Invalid rule_id, rule_id must be 0-%d\n", > ETH_VMDQ_NUM_MIRROR_RULE - 1); > - return (-EINVAL); > + return -EINVAL; > } > > dev = &rte_eth_devices[port_id]; > @@ -3082,13 +3082,13 @@ rte_eth_mirror_rule_reset(uint8_t port_id, uint8_t rule_id) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > if (rule_id >= ETH_VMDQ_NUM_MIRROR_RULE) { > PMD_DEBUG_TRACE("Invalid rule_id, rule_id must be 0-%d\n", > ETH_VMDQ_NUM_MIRROR_RULE-1); > - return (-EINVAL); > + return -EINVAL; > } > > dev = &rte_eth_devices[port_id]; > @@ -3163,7 +3163,7 @@ rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > @@ -3182,11 +3182,11 @@ rte_eth_dev_callback_register(uint8_t port_id, > struct rte_eth_dev_callback *user_cb; > > if (!cb_fn) > - return (-EINVAL); > + return -EINVAL; > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-EINVAL); > + return -EINVAL; > } > > dev = &rte_eth_devices[port_id]; > @@ -3211,7 +3211,7 @@ rte_eth_dev_callback_register(uint8_t port_id, > } > > rte_spinlock_unlock(&rte_eth_dev_cb_lock); > - return ((user_cb == NULL) ? -ENOMEM : 0); > + return (user_cb == NULL) ? -ENOMEM : 0; > } > > int > @@ -3224,11 +3224,11 @@ rte_eth_dev_callback_unregister(uint8_t port_id, > struct rte_eth_dev_callback *cb, *next; > > if (!cb_fn) > - return (-EINVAL); > + return -EINVAL; > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-EINVAL); > + return -EINVAL; > } > > dev = &rte_eth_devices[port_id]; > @@ -3257,7 +3257,7 @@ rte_eth_dev_callback_unregister(uint8_t port_id, > } > > rte_spinlock_unlock(&rte_eth_dev_cb_lock); > - return (ret); > + return ret; > } > > void > @@ -3288,13 +3288,13 @@ int rte_eth_dev_bypass_init(uint8_t port_id) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > - return (-ENODEV); > + return -ENODEV; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_init, -ENOTSUP); > @@ -3309,13 +3309,13 @@ rte_eth_dev_bypass_state_show(uint8_t port_id, uint32_t *state) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > - return (-ENODEV); > + return -ENODEV; > } > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_show, -ENOTSUP); > (*dev->dev_ops->bypass_state_show)(dev, state); > @@ -3329,13 +3329,13 @@ rte_eth_dev_bypass_state_set(uint8_t port_id, uint32_t *new_state) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > - return (-ENODEV); > + return -ENODEV; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_set, -ENOTSUP); > @@ -3350,13 +3350,13 @@ rte_eth_dev_bypass_event_show(uint8_t port_id, uint32_t event, uint32_t *state) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > - return (-ENODEV); > + return -ENODEV; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_show, -ENOTSUP); > @@ -3371,13 +3371,13 @@ rte_eth_dev_bypass_event_store(uint8_t port_id, uint32_t event, uint32_t state) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > - return (-ENODEV); > + return -ENODEV; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_event_set, -ENOTSUP); > @@ -3392,13 +3392,13 @@ rte_eth_dev_wd_timeout_store(uint8_t port_id, uint32_t timeout) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > - return (-ENODEV); > + return -ENODEV; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_timeout_set, -ENOTSUP); > @@ -3413,13 +3413,13 @@ rte_eth_dev_bypass_ver_show(uint8_t port_id, uint32_t *ver) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > - return (-ENODEV); > + return -ENODEV; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_ver_show, -ENOTSUP); > @@ -3434,13 +3434,13 @@ rte_eth_dev_bypass_wd_timeout_show(uint8_t port_id, uint32_t *wd_timeout) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > - return (-ENODEV); > + return -ENODEV; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_timeout_show, -ENOTSUP); > @@ -3455,13 +3455,13 @@ rte_eth_dev_bypass_wd_reset(uint8_t port_id) > > if (!rte_eth_dev_is_valid_port(port_id)) { > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > - return (-ENODEV); > + return -ENODEV; > } > > dev = &rte_eth_devices[port_id]; > if (!dev) { > PMD_DEBUG_TRACE("Invalid port device\n"); > - return (-ENODEV); > + return -ENODEV; > } > > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_reset, -ENOTSUP); > @@ -3565,12 +3565,12 @@ rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id, > struct rte_eth_rxtx_callback *user_cb) > { > #ifndef RTE_ETHDEV_RXTX_CALLBACKS > - return (-ENOTSUP); > + return -ENOTSUP; > #endif > /* Check input parameters. */ > if (!rte_eth_dev_is_valid_port(port_id) || user_cb == NULL || > queue_id >= rte_eth_devices[port_id].data->nb_rx_queues) { > - return (-EINVAL); > + return -EINVAL; > } > > struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > @@ -3596,7 +3596,7 @@ rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id, > } while (cb != NULL); > > /* Callback wasn't found. */ > - return (-EINVAL); > + return -EINVAL; > } > > int > @@ -3604,12 +3604,12 @@ rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id, > struct rte_eth_rxtx_callback *user_cb) > { > #ifndef RTE_ETHDEV_RXTX_CALLBACKS > - return (-ENOTSUP); > + return -ENOTSUP; > #endif > /* Check input parameters. */ > if (!rte_eth_dev_is_valid_port(port_id) || user_cb == NULL || > queue_id >= rte_eth_devices[port_id].data->nb_tx_queues) { > - return (-EINVAL); > + return -EINVAL; > } > > struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > @@ -3635,5 +3635,5 @@ rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id, > } while (cb != NULL); > > /* Callback wasn't found. */ > - return (-EINVAL); > + return -EINVAL; > } > -- > 2.1.4 > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH 0/4] rte_ethdev: cleanups 2015-04-09 21:29 [dpdk-dev] [PATCH 0/4] rte_ethdev: cleanups Stephen Hemminger ` (3 preceding siblings ...) 2015-04-09 21:29 ` [dpdk-dev] [PATCH 4/4] rte_ethdev: remove unnecessary paren on return Stephen Hemminger @ 2015-04-20 17:52 ` Thomas Monjalon 4 siblings, 0 replies; 10+ messages in thread From: Thomas Monjalon @ 2015-04-20 17:52 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev 2015-04-09 14:29, Stephen Hemminger: > A bunch of small (almost trivial) patches to fix style and other > issues in the base Ethernet driver interface code. > > Stephen Hemminger (4): > rte_ethdev: remove extra inline > rte_ethdev: whitespace cleanup > rte_ethdev: make tables const > rte_ethdev: remove unnecessary paren on return Series applied except "whitespace cleanup" which was refused. Thanks ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-04-21 14:34 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-04-09 21:29 [dpdk-dev] [PATCH 0/4] rte_ethdev: cleanups Stephen Hemminger 2015-04-09 21:29 ` [dpdk-dev] [PATCH 1/4] rte_ethdev: remove extra inline Stephen Hemminger 2015-04-15 9:52 ` Bruce Richardson 2015-04-09 21:29 ` [dpdk-dev] [PATCH 2/4] rte_ethdev: whitespace cleanup Stephen Hemminger 2015-04-15 9:53 ` Bruce Richardson 2015-04-09 21:29 ` [dpdk-dev] [PATCH 3/4] rte_ethdev: make tables const Stephen Hemminger 2015-04-15 9:54 ` Bruce Richardson 2015-04-09 21:29 ` [dpdk-dev] [PATCH 4/4] rte_ethdev: remove unnecessary paren on return Stephen Hemminger 2015-04-15 9:56 ` Bruce Richardson 2015-04-20 17:52 ` [dpdk-dev] [PATCH 0/4] rte_ethdev: cleanups Thomas Monjalon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).