misc cleanup patches
Subsystems (2)
cover misc cleanup patches
These are all low risk, low reward changes found by reviewing while doing other work. Ok to defer them to 2.2 if necessary.
Stephen Hemminger (11):
eth: move queue check for rx_queue_count
eth: do simple return
kni: remove useless semicolon
eth: remove unnecessary return value
kni: eliminate unnecessary return variables
pipeline: remove useless cast
lpm: remove useless casts
hash: remove useless casts
kni: remove useless cast
i40e: remove useless cast
bond: remove useless cast
drivers/net/bonding/rte_eth_bond_pmd.c | 12 +++++------ drivers/net/e1000/em_rxtx.c | 5 ----- drivers/net/e1000/igb_rxtx.c | 5 ----- drivers/net/i40e/i40e_ethdev.c | 3 +-- drivers/net/i40e/i40e_rxtx.c | 5 ----- drivers/net/ixgbe/ixgbe_rxtx.c | 5 ----- .../linuxapp/kni/ethtool/igb/e1000_82575.c | 16 +++++--------- lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 9 ++++---- .../linuxapp/kni/ethtool/ixgbe/ixgbe_common.c | 4 ++-- lib/librte_ether/rte_ethdev.c | 25 +++++++++++++--------- lib/librte_hash/rte_cuckoo_hash.c | 4 ++-- lib/librte_hash/rte_fbk_hash.c | 3 +-- lib/librte_kni/rte_kni.c | 7 ++---- lib/librte_lpm/rte_lpm.c | 4 ++-- lib/librte_lpm/rte_lpm6.c | 8 +++---- lib/librte_pipeline/rte_pipeline.c | 4 ++-- 16 files changed, 46 insertions(+), 73 deletions(-)
Signature · 1 line
2.1.4
PATCH 1/11 eth: move queue check for rx_queue_count
All implemenations of rx_queue_count need to check for queue_id being valid, therefore move the test to common code. Also, add missing queue validation for rx_descriptor_done
--- drivers/net/e1000/em_rxtx.c | 5 ----- drivers/net/e1000/igb_rxtx.c | 5 ----- drivers/net/i40e/i40e_rxtx.c | 5 ----- drivers/net/ixgbe/ixgbe_rxtx.c | 5 ----- lib/librte_ether/rte_ethdev.c | 11 +++++++++++ 5 files changed, 11 insertions(+), 20 deletions(-)
drivers/net/e1000/em_rxtx.c +0 -5
@@ -1454,11 +1454,6 @@ eth_em_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)struct em_rx_queue *rxq;uint32_t desc =0 ; -if (rx_queue_id >= dev->data->nb_rx_queues) { -PMD_RX_LOG (DEBUG ,"Invalid RX queue_id=%d" , rx_queue_id); -return 0 ; - } - rxq = dev->data->rx_queues[rx_queue_id]; rxdp = &(rxq->rx_ring[rxq->rx_tail]);
drivers/net/e1000/igb_rxtx.c +0 -5
@@ -1543,11 +1543,6 @@ eth_igb_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)struct igb_rx_queue *rxq;uint32_t desc =0 ; -if (rx_queue_id >= dev->data->nb_rx_queues) { -PMD_RX_LOG (ERR ,"Invalid RX queue id=%d" , rx_queue_id); -return 0 ; - } - rxq = dev->data->rx_queues[rx_queue_id]; rxdp = &(rxq->rx_ring[rxq->rx_tail]);
drivers/net/i40e/i40e_rxtx.c +0 -5
@@ -2547,11 +2547,6 @@ i40e_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)struct i40e_rx_queue *rxq;uint16_t desc =0 ; -if (unlikely (rx_queue_id >= dev->data->nb_rx_queues)) { -PMD_DRV_LOG (ERR ,"Invalid RX queue id %u" , rx_queue_id); -return 0 ; - } - rxq = dev->data->rx_queues[rx_queue_id]; rxdp = &(rxq->rx_ring[rxq->rx_tail]); while ((desc < rxq->nb_rx_desc) &&
drivers/net/ixgbe/ixgbe_rxtx.c +0 -5
@@ -2598,11 +2598,6 @@ ixgbe_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)struct ixgbe_rx_queue *rxq;uint32_t desc =0 ; -if (rx_queue_id >= dev->data->nb_rx_queues) { -PMD_RX_LOG (ERR ,"Invalid RX queue id=%d" , rx_queue_id); -return 0 ; - } - rxq = dev->data->rx_queues[rx_queue_id]; rxdp = &(rxq->rx_ring[rxq->rx_tail]);
lib/librte_ether/rte_ethdev.c +11 -0
@@ -122,6 +122,7 @@ } \ }while (0 ) + static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS ];static struct rte_eth_dev_data *rte_eth_dev_data;
@@ -2910,6 +2911,11 @@ rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)VALID_PORTID_OR_ERR_RET (port_id,0 ); +if (queue_id >= dev->data->nb_rx_queues) { +PMD_RX_LOG (ERR ,"Invalid RX queue id=%d" , queue_id); +return 0 ; + } + dev = &rte_eth_devices[port_id];FUNC_PTR_OR_ERR_RET (*dev->dev_ops->rx_queue_count,0 );return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
@@ -2922,6 +2928,11 @@ rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); +if (queue_id >= dev->data->nb_rx_queues) { +PMD_RX_LOG (ERR ,"Invalid RX queue id=%d" , queue_id); +return 0 ; + } + 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],
Signature · 1 line
2.1.4
PATCH 2/11 eth: do simple return
In reply to Stephen HemmingerFound by coccinelle simple_return.cocci
This function can just use direct return.
--- lib/librte_ether/rte_ethdev.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
lib/librte_ether/rte_ethdev.c +1 -6
@@ -269,17 +269,12 @@ static int rte_eth_dev_create_unique_device_name(char *name, size_t size, struct rte_pci_device *pci_dev) { -int ret; -if ((name ==NULL ) || (pci_dev ==NULL ))return -EINVAL ; - ret =snprintf (name, size,"%d:%d.%d" , +return snprintf (name, size,"%d:%d.%d" , pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function); -if (ret <0 ) -return ret; -return 0 ; }int
Signature · 1 line
2.1.4
PATCH 3/11 kni: remove useless semicolon
In reply to Stephen HemmingerFound by coccinelle semicolon.cocci script
--- lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_common.c +2 -2
@@ -1534,7 +1534,7 @@ static s32 ixgbe_ready_eeprom(struct ixgbe_hw *hw)udelay (5 );ixgbe_standby_eeprom (hw); - }; + }/* * On some parts, SPI write time could vary from 0-20mSec on 3.3V
@@ -1616,7 +1616,7 @@ static void ixgbe_shift_out_eeprom_bits(struct ixgbe_hw *hw, u16 data,* EEPROM */ mask = mask >>1 ; - }; + }/* We leave the "DI" bit set to "0" when we leave this routine. */ eec &= ~IXGBE_EEC_DI ;
Signature · 1 line
2.1.4
PATCH 4/11 eth: remove unnecessary return value
In reply to Stephen HemmingerEliminate unnecessary variable for return value
Found with returnvar.cocci
--- lib/librte_ether/rte_ethdev.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
lib/librte_ether/rte_ethdev.c +3 -4
@@ -1892,7 +1892,6 @@ int rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask) {struct rte_eth_dev *dev; -int ret =0 ;int mask =0 ;int cur, org =0 ;
@@ -1921,14 +1920,14 @@ rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask) mask |=ETH_VLAN_EXTEND_MASK ; } -/*no change*/ +/* no change */ if (mask ==0 ) -return ret; +return 0 ;FUNC_PTR_OR_ERR_RET (*dev->dev_ops->vlan_offload_set, -ENOTSUP ); (*dev->dev_ops->vlan_offload_set)(dev, mask); -return ret; +return 0 ; }int
Signature · 1 line
2.1.4
PATCH 5/11 kni: eliminate unnecessary return variables
In reply to Stephen HemmingerIf function just sets a variable (and never changes it) and then returns that value, just move the constant to return. Found with returnvar.cocci
--- lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_82575.c | 16 +++++----------- lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 9 ++++----- 2 files changed, 9 insertions(+), 16 deletions(-)
lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_82575.c +5 -11
@@ -876,7 +876,6 @@ out:static s32 e1000_set_d0_lplu_state_82580 (struct e1000_hw *hw,bool active) {struct e1000_phy_info *phy = &hw->phy; -s32 ret_val =E1000_SUCCESS ;u32 data;DEBUGFUNC ("e1000_set_d0_lplu_state_82580" );
@@ -904,7 +903,7 @@ static s32 e1000_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active) }E1000_WRITE_REG (hw,E1000_82580_PHY_POWER_MGMT , data); -return ret_val; +return E1000_SUCCESS ; }/**
@@ -924,7 +923,6 @@ static s32 e1000_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active)s32 e1000_set_d3_lplu_state_82580 (struct e1000_hw *hw,bool active) {struct e1000_phy_info *phy = &hw->phy; -s32 ret_val =E1000_SUCCESS ;u32 data;DEBUGFUNC ("e1000_set_d3_lplu_state_82580" );
@@ -952,7 +950,7 @@ s32 e1000_set_d3_lplu_state_82580(struct e1000_hw *hw, bool active) }E1000_WRITE_REG (hw,E1000_82580_PHY_POWER_MGMT , data); -return ret_val; +return E1000_SUCCESS ; }/**
@@ -1112,7 +1110,6 @@ static void e1000_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask)static s32 e1000_get_cfg_done_82575 (struct e1000_hw *hw) {s32 timeout =PHY_CFG_TIMEOUT ; -s32 ret_val =E1000_SUCCESS ;u32 mask =E1000_NVM_CFG_DONE_PORT_0 ;DEBUGFUNC ("e1000_get_cfg_done_82575" );
@@ -1137,7 +1134,7 @@ static s32 e1000_get_cfg_done_82575(struct e1000_hw *hw) (hw->phy.type == e1000_phy_igp_3))e1000_phy_init_script_igp3 (hw); -return ret_val; +return E1000_SUCCESS ; }/**
@@ -2786,7 +2783,6 @@ s32 e1000_read_emi_reg(struct e1000_hw *hw, u16 addr, u16 *data)**/ s32 e1000_set_eee_i350 (struct e1000_hw *hw) { -s32 ret_val =E1000_SUCCESS ;u32 ipcnfg, eeer;DEBUGFUNC ("e1000_set_eee_i350" );
@@ -2818,8 +2814,7 @@ s32 e1000_set_eee_i350(struct e1000_hw *hw)E1000_READ_REG (hw,E1000_IPCNFG );E1000_READ_REG (hw,E1000_EEER ); out: - -return ret_val; +return E1000_SUCCESS ; }/**
@@ -2986,7 +2981,6 @@ void e1000_write_vfta_i350(struct e1000_hw *hw, u32 offset, u32 value)**/ s32 e1000_set_i2c_bb (struct e1000_hw *hw) { -s32 ret_val =E1000_SUCCESS ;u32 ctrl_ext, i2cparams;DEBUGFUNC ("e1000_set_i2c_bb" );
@@ -3003,7 +2997,7 @@ s32 e1000_set_i2c_bb(struct e1000_hw *hw)E1000_WRITE_REG (hw,E1000_I2CPARAMS , i2cparams);E1000_WRITE_FLUSH (hw); -return ret_val; +return E1000_SUCCESS ; }/**
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c +4 -5
@@ -1859,7 +1859,6 @@ static s32 igb_enable_mas(struct igb_adapter *adapter) {struct e1000_hw *hw = &adapter->hw;u32 connsw; -s32 ret_val =E1000_SUCCESS ; connsw =E1000_READ_REG (hw,E1000_CONNSW );if (hw->phy.media_type == e1000_media_type_copper) {
@@ -1871,7 +1870,7 @@ static s32 igb_enable_mas(struct igb_adapter *adapter)E1000_WRITE_FLUSH (hw); }else if (connsw &E1000_CONNSW_SERDESD ) {/* already SerDes, no need to enable anything */ -return ret_val; +return E1000_SUCCESS ; }else { dev_info(pci_dev_to_dev(adapter->pdev), "%s:MAS: Unable to configure feature, disabling..\n",
@@ -1879,7 +1878,7 @@ static s32 igb_enable_mas(struct igb_adapter *adapter) adapter->flags &= ~IGB_FLAG_MAS_ENABLE ; } } -return ret_val; +return E1000_SUCCESS ; }void igb_reset (struct igb_adapter *adapter)
@@ -2424,14 +2423,14 @@ int igb_init_vmdq_netdevs(struct igb_adapter *adapter)int igb_remove_vmdq_netdevs (struct igb_adapter *adapter) { -int pool, err =0 ; +int pool;for (pool =1 ; pool < adapter->vmdq_pools; pool++) {unregister_netdev (adapter->vmdq_netdev[pool-1 ]);free_netdev (adapter->vmdq_netdev[pool-1 ]); adapter->vmdq_netdev[pool-1 ] =NULL ; } -return err; +return 0 ; }#endif /* CONFIG_IGB_VMDQ_NETDEV */
Signature · 1 line
2.1.4
PATCH 6/11 pipeline: remove useless cast
In reply to Stephen HemmingerFound by modified version of acll_cast.cocci
lib/librte_pipeline/rte_pipeline.c:358:18-49: WARNING: casting value returned by memory allocation function to (struct rte_pipeline_table_entry *) is useless.
--- lib/librte_pipeline/rte_pipeline.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_pipeline/rte_pipeline.c +2 -2
@@ -355,8 +355,8 @@ rte_pipeline_table_create(struct rte_pipeline *p,/* Allocate space for the default table entry */ entry_size =sizeof (struct rte_pipeline_table_entry ) + params->action_data_size; - default_entry = (struct rte_pipeline_table_entry *)rte_zmalloc_socket ( -"PIPELINE" , entry_size,RTE_CACHE_LINE_SIZE , p->socket_id); + default_entry =rte_zmalloc_socket ("PIPELINE" , entry_size, +RTE_CACHE_LINE_SIZE , p->socket_id);if (default_entry ==NULL ) {RTE_LOG (ERR ,PIPELINE ,"%s: Failed to allocate default entry\n" , __func__);
Signature · 1 line
2.1.4
PATCH 7/11 lpm: remove useless casts
In reply to Stephen HemmingerFound by modified coccinelle script.
lib/librte_lpm/rte_lpm6.c:196:8-23: WARNING: casting value returned by memory allocation function to (struct rte_lpm6 *) is useless. lib/librte_lpm/rte_lpm6.c:205:19-39: WARNING: casting value returned by memory allocation function to (struct rte_lpm6_rule *) is useless. lib/librte_lpm/rte_lpm.c:195:8-22: WARNING: casting value returned by memory allocation function to (struct rte_lpm *) is useless.
--- lib/librte_lpm/rte_lpm.c | 4 ++-- lib/librte_lpm/rte_lpm6.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
lib/librte_lpm/rte_lpm.c +2 -2
@@ -192,8 +192,8 @@ rte_lpm_create(const char *name, int socket_id, int max_rules, }/* Allocate memory to store the LPM data structures. */ - lpm = (struct rte_lpm *)rte_zmalloc_socket (mem_name, mem_size, -RTE_CACHE_LINE_SIZE , socket_id); + lpm =rte_zmalloc_socket (mem_name, mem_size, +RTE_CACHE_LINE_SIZE , socket_id);if (lpm ==NULL ) {RTE_LOG (ERR ,LPM ,"LPM memory allocation failed\n" );rte_free (te);
lib/librte_lpm/rte_lpm6.c +4 -4
@@ -193,8 +193,8 @@ rte_lpm6_create(const char *name, int socket_id, }/* Allocate memory to store the LPM data structures. */ - lpm = (struct rte_lpm6 *)rte_zmalloc_socket (mem_name, (size_t )mem_size, -RTE_CACHE_LINE_SIZE , socket_id); + lpm =rte_zmalloc_socket (mem_name, (size_t )mem_size, +RTE_CACHE_LINE_SIZE , socket_id);if (lpm ==NULL ) {RTE_LOG (ERR ,LPM ,"LPM memory allocation failed\n" );
@@ -202,8 +202,8 @@ rte_lpm6_create(const char *name, int socket_id, goto exit; } - lpm->rules_tbl = (struct rte_lpm6_rule *)rte_zmalloc_socket (NULL , - (size_t )rules_size,RTE_CACHE_LINE_SIZE , socket_id); + lpm->rules_tbl =rte_zmalloc_socket (NULL , (size_t )rules_size, +RTE_CACHE_LINE_SIZE , socket_id);if (lpm->rules_tbl ==NULL ) {RTE_LOG (ERR ,LPM ,"LPM memory allocation failed\n" );
Signature · 1 line
2.1.4
PATCH 8/11 hash: remove useless casts
In reply to Stephen HemmingerFound by coccinelle.
lib/librte_hash/rte_fbk_hash.c:153:7-32: WARNING: casting value returned by memory allocation function to (struct rte_fbk_hash_table *) is useless. lib/librte_hash/rte_cuckoo_hash.c:218:6-21: WARNING: casting value returned by memory allocation function to (struct rte_hash *) is useless.
--- lib/librte_hash/rte_cuckoo_hash.c | 4 ++-- lib/librte_hash/rte_fbk_hash.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-)
lib/librte_hash/rte_cuckoo_hash.c +2 -2
@@ -215,8 +215,8 @@ rte_hash_create(const struct rte_hash_parameters *params) goto err; } - h = (struct rte_hash *)rte_zmalloc_socket (hash_name,sizeof (struct rte_hash ), -RTE_CACHE_LINE_SIZE , params->socket_id); + h =rte_zmalloc_socket (hash_name,sizeof (struct rte_hash ), +RTE_CACHE_LINE_SIZE , params->socket_id);if (h ==NULL ) {RTE_LOG (ERR ,HASH ,"memory allocation failed\n" );
lib/librte_hash/rte_fbk_hash.c +1 -2
@@ -150,8 +150,7 @@ rte_fbk_hash_create(const struct rte_fbk_hash_params *params) }/* Allocate memory for table. */ - ht = (struct rte_fbk_hash_table *)rte_zmalloc_socket (hash_name, mem_size, -0 , params->socket_id); + ht =rte_zmalloc_socket (hash_name, mem_size,0 , params->socket_id);if (ht ==NULL ) {RTE_LOG (ERR ,HASH ,"Failed to allocate fbk hash table\n" );rte_free (te);
Signature · 1 line
2.1.4
PATCH 9/11 kni: remove useless cast
In reply to Stephen Hemmingerlib/librte_kni/rte_kni.c:224:27-54: WARNING: casting value returned by memory allocation function to (struct rte_kni_memzone_slot *) is useless.
--- lib/librte_kni/rte_kni.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
lib/librte_kni/rte_kni.c +2 -5
@@ -221,11 +221,8 @@ rte_kni_init(unsigned int max_kni_ifaces) }/* Allocate slot objects */ - kni_memzone_pool.slots = (struct rte_kni_memzone_slot *) -rte_malloc (NULL , -sizeof (struct rte_kni_memzone_slot ) * - max_kni_ifaces, -0 ); + kni_memzone_pool.slots =rte_calloc (NULL , max_kni_ifaces, +sizeof (struct rte_kni_memzone_slot ),0 );KNI_MEM_CHECK (kni_memzone_pool.slots ==NULL );/* Initialize general pool variables */
Signature · 1 line
2.1.4
PATCH 10/11 i40e: remove useless cast
In reply to Stephen Hemmingerdrivers/net/i40e/i40e_ethdev.c:2360:18-56: WARNING: casting value returned by memory allocation function to (struct i40e_aqc_get_switch_config_resp *) is useless.
--- drivers/net/i40e/i40e_ethdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev.c +1 -2
@@ -2357,8 +2357,7 @@ i40e_pf_get_switch_config(struct i40e_pf *pf)uint16_t start_seid =0 , num_reported;int ret; - switch_config = (struct i40e_aqc_get_switch_config_resp *)\ -rte_zmalloc ("i40e" ,I40E_AQ_LARGE_BUF ,0 ); + switch_config =rte_zmalloc ("i40e" ,I40E_AQ_LARGE_BUF ,0 );if (!switch_config) {PMD_DRV_LOG (ERR ,"Failed to allocated memory" );return -ENOMEM ;
Signature · 1 line
2.1.4
PATCH 11/11 bond: remove useless cast
In reply to Stephen HemmingerFound by coccinelle script.
drivers/net/bonding/rte_eth_bond_pmd.c:1587:34-54: WARNING: casting value returned by memory allocation function to (struct bond_rx_queue *) is useless. drivers/net/bonding/rte_eth_bond_pmd.c:1611:35-55: WARNING: casting value returned by memory allocation function to (struct bond_tx_queue *) is useless.
--- drivers/net/bonding/rte_eth_bond_pmd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +6 -6
@@ -1584,9 +1584,9 @@ bond_ethdev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id __rte_unused, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mb_pool) { - struct bond_rx_queue *bd_rx_q = (struct bond_rx_queue *) -rte_zmalloc_socket (NULL ,sizeof (struct bond_rx_queue ), -0 , dev->pci_dev->numa_node); + struct bond_rx_queue *bd_rx_q + =rte_zmalloc_socket (NULL ,sizeof (struct bond_rx_queue ), +0 , dev->pci_dev->numa_node);if (bd_rx_q ==NULL )return -1 ;
@@ -1608,9 +1608,9 @@ bond_ethdev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id __rte_unused, const struct rte_eth_txconf *tx_conf) { - struct bond_tx_queue *bd_tx_q = (struct bond_tx_queue *) -rte_zmalloc_socket (NULL ,sizeof (struct bond_tx_queue ), -0 , dev->pci_dev->numa_node); + struct bond_tx_queue *bd_tx_q + =rte_zmalloc_socket (NULL ,sizeof (struct bond_tx_queue ), +0 , dev->pci_dev->numa_node);if (bd_tx_q ==NULL )return -1 ;
Signature · 1 line
2.1.4
Re: [PATCH 01/11] eth: move queue check for rx_queue_count
In reply to Stephen Hemminger2015-07-24 10:06, Stephen Hemminger:
lib/librte_ether/rte_ethdev.c line 125
Quoted 7 lines
lib/librte_ether/rte_ethdev.c +1
-0@@ -122,6 +122,7 @@ } \ }while (0 ) +
checkpatch would warn about this whitespace change
lib/librte_ether/rte_ethdev.c rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id) · line 2917
Quoted 11 lines
lib/librte_ether/rte_ethdev.c +4
-0static const char *MZ_RTE_ETH_DEV_DATA ="rte_eth_dev_data" ;struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS ];static struct rte_eth_dev_data *rte_eth_dev_data;@@ -2910,6 +2911,11 @@ rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)VALID_PORTID_OR_ERR_RET (port_id,0 ); +if (queue_id >= dev->data->nb_rx_queues) { +PMD_RX_LOG (ERR ,"Invalid RX queue id=%d" , queue_id); +return 0 ; + }
PMD_RX_LOG is not defined in ethdev.
Re: [PATCH 10/11] i40e: remove useless cast
In reply to Stephen HemmingerQuoted 8 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Stephen Hemminger
Sent: Friday, July 24, 2015 10:06 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH 10/11] i40e: remove useless cast
Quoted 5 lines
drivers/net/i40e/i40e_ethdev.c:2360:18-56: WARNING: casting value returned by memory allocation function to (struct
i40e_aqc_get_switch_config_resp*) is useless.Signed-off-by Stephen Hemminger <[email protected]>
Re: [PATCH 01/11] eth: move queue check for rx_queue_count
In reply to Stephen HemmingerQuoted 8 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Stephen Hemminger
Sent: Friday, July 24, 2015 10:06 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH 01/11] eth: move queue check forrx_queue_count
Quoted 5 lines
All implemenations of
rx_queue_countneed to check forqueue_idbeing valid, therefore move the test to common code.
Also, add missing queue validation forrx_descriptor_doneSigned-off-by Stephen Hemminger <[email protected]>