fixes for queue resource free and code style
cover fixes for queue resource free and code style
This patch adds tx_queues and rx_queues non-null judgment before free tx or rx resources, because some app may set tx_queues or rx_queues to be null before call free resource interfaces, which may cause a segfault, adds pkt_len member update for dst_mbuf when copy a mbuf to a new dst_mbuf, code style format rectification, and adjusts the legality judgment order of RSS RETA table.
--
v1:
- the queues resource free problem fixes
- the pkt len updates of mbuf fixes
- code style modification
- optimize RSS RETA table updates
Xiaoyun wang (4):
net/hinic: the queues resource free problem fixes net/hinic: the pkt len updates of mbuf fixes net/hinic: code style modification net/hinic: optimize RSS RETA table updates
drivers/net/hinic/base/hinic_pmd_cmdq.h | 2 +- drivers/net/hinic/base/hinic_pmd_hwif.c | 2 +- drivers/net/hinic/base/hinic_pmd_nicio.c | 1 - drivers/net/hinic/hinic_pmd_ethdev.c | 44 +++++++++++++++----------------- drivers/net/hinic/hinic_pmd_ethdev.h | 12 +++++---- drivers/net/hinic/hinic_pmd_rx.c | 3 ++- drivers/net/hinic/hinic_pmd_tx.c | 5 +++- 7 files changed, 36 insertions(+), 33 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/4 net/hinic: the queues resource free problem fixes
Adds tx_queues and rx_queues non-null judgment before free tx or rx resources, because some app may set tx_queues or rx_queues to be null before call free resource interfaces, which may cause a segfault.
--- drivers/net/hinic/hinic_pmd_rx.c | 3 ++- drivers/net/hinic/hinic_pmd_tx.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/hinic/hinic_pmd_rx.c +2 -1
@@ -413,7 +413,8 @@ void hinic_free_all_rx_resources(struct rte_eth_dev *eth_dev)HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV (eth_dev);for (q_id =0 ; q_id < nic_dev->num_rq; q_id++) { - eth_dev->data->rx_queues[q_id] =NULL ; +if (eth_dev->data->rx_queues !=NULL ) + eth_dev->data->rx_queues[q_id] =NULL ;if (nic_dev->rxqs[q_id] ==NULL )continue ;
drivers/net/hinic/hinic_pmd_tx.c +2 -1
@@ -1217,7 +1217,8 @@ void hinic_free_all_tx_resources(struct rte_eth_dev *eth_dev)HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV (eth_dev);for (q_id =0 ; q_id < nic_dev->num_sq; q_id++) { - eth_dev->data->tx_queues[q_id] =NULL ; +if (eth_dev->data->tx_queues !=NULL ) + eth_dev->data->tx_queues[q_id] =NULL ;if (nic_dev->txqs[q_id] ==NULL )continue ;
Signature · 1 line
1.8.3.1
PATCH 2/4 net/hinic: the pkt len updates of mbuf fixes
In reply to Xiaoyun wangWhen copy a mbuf to a new dst_mbuf, the pkt_len member of dst_mbuf needs to be updated.
--- drivers/net/hinic/hinic_pmd_tx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/hinic/hinic_pmd_tx.c +2 -0
@@ -313,6 +313,8 @@ static inline struct rte_mbuf *hinic_copy_tx_mbuf(struct hinic_nic_dev *nic_dev, mbuf = mbuf->next; } + dst_mbuf->pkt_len = dst_mbuf->data_len; +return dst_mbuf; }
Signature · 1 line
1.8.3.1
PATCH 3/4 net/hinic: code style modification
In reply to Xiaoyun wangThe patch modifies the comments of structures or functions, and adds space for comments, removes extra empty lines and adjusts the print level for VF branches in one sdk interface.
--- drivers/net/hinic/base/hinic_pmd_cmdq.h | 2 +- drivers/net/hinic/base/hinic_pmd_hwif.c | 2 +- drivers/net/hinic/base/hinic_pmd_nicio.c | 1 - drivers/net/hinic/hinic_pmd_ethdev.c | 28 +++++++++++++--------------- drivers/net/hinic/hinic_pmd_ethdev.h | 12 +++++++----- 5 files changed, 22 insertions(+), 23 deletions(-)
drivers/net/hinic/base/hinic_pmd_cmdq.h +1 -1
@@ -9,7 +9,7 @@#define HINIC_SCMD_DATA_LEN 16 -/* hiovs pmd use 64, kernel l2nic use 4096 */ +/* pmd driver uses 64, kernel l2nic use 4096 */ #define HINIC_CMDQ_DEPTH 64#define HINIC_CMDQ_BUF_SIZE 2048U
drivers/net/hinic/base/hinic_pmd_hwif.c +1 -1
@@ -99,7 +99,7 @@ void hinic_set_pf_status(struct hinic_hwif *hwif, enum hinic_pf_status status)u32 addr =HINIC_CSR_FUNC_ATTR5_ADDR ;if (hwif->attr.func_type ==TYPE_VF ) { -PMD_DRV_LOG (ERR ,"VF doesn't support set attr5" ); +PMD_DRV_LOG (INFO ,"VF doesn't support to set attr5" );return ; }
drivers/net/hinic/base/hinic_pmd_nicio.c +0 -1
@@ -369,7 +369,6 @@ static int init_rq_ctxts(struct hinic_nic_io *nic_io)HINIC_MOD_L2NIC ,HINIC_UCODE_CMD_MDY_QUEUE_CONTEXT , cmd_buf, &out_param, 0); -if ((err) || out_param !=0 ) {PMD_DRV_LOG (ERR ,"Failed to set RQ ctxts" ); err = -EFAULT ;
drivers/net/hinic/hinic_pmd_ethdev.c +13 -15
@@ -354,7 +354,7 @@ static int hinic_dev_configure(struct rte_eth_dev *dev)return err; } -/*clear fdir filter flag in function table*/ +/* clear fdir filter flag in function table */ hinic_free_fdir_filter (nic_dev);return HINIC_OK ;
@@ -440,7 +440,7 @@ static int hinic_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, } nic_dev->rxqs[queue_idx] = rxq; -/* alloc rx sq hw wqepage*/ +/* alloc rx sq hw wqe page */ rc =hinic_create_rq (hwdev, queue_idx, rq_depth, socket_id);if (rc) { PMD_DRV_LOG(ERR, "Create rxq[%d] failed, dev_name: %s, rq_depth: %d",
@@ -2035,12 +2035,12 @@ static int hinic_rss_conf_get(struct rte_eth_dev *dev, }/** -* DPDK callback to update the RETA indirection table. +* DPDK callback to update the RSS redirection table. * * @param dev * Pointer to Ethernet device structure. * @param reta_conf -* Pointer to RETA configuration structure array. +* Pointer to RSS reta configuration data. * @param reta_size * Size of the RETA table. *
@@ -2102,14 +2102,13 @@ static int hinic_rss_indirtbl_update(struct rte_eth_dev *dev,return HINIC_ERROR ; } -/** -* DPDK callback to get the RETA indirection table. +* DPDK callback to get the RSS indirection table. * * @param dev * Pointer to Ethernet device structure. * @param reta_conf -* Pointer to RETA configuration structure array. +* Pointer to RSS reta configuration data. * @param reta_size * Size of the RETA table. *
@@ -2309,8 +2308,7 @@ static int hinic_dev_xstats_get_names(struct rte_eth_dev *dev,for (i =0 ; i <HINIC_VPORT_XSTATS_NUM ; i++) {snprintf (xstats_names[count].name,sizeof (xstats_names[count].name), -"%s" , - hinic_vport_stats_strings[i].name); +"%s" , hinic_vport_stats_strings[i].name); count++; }
@@ -2321,13 +2319,13 @@ static int hinic_dev_xstats_get_names(struct rte_eth_dev *dev,for (i =0 ; i <HINIC_PHYPORT_XSTATS_NUM ; i++) {snprintf (xstats_names[count].name,sizeof (xstats_names[count].name), -"%s" , - hinic_phyport_stats_strings[i].name); +"%s" , hinic_phyport_stats_strings[i].name); count++; }return count; } +/** * DPDK callback to set mac address *
@@ -2492,19 +2490,19 @@ static int hinic_set_mc_addr_list(struct rte_eth_dev *dev, }/** -* DPDK callback to manage filter operations +* DPDK callback to manage filter control operations * * @param dev * Pointer to Ethernet device structure. * @param filter_type -* Filter type. +* Filter type, which just supports generic type. * @param filter_op -* Operation to perform. +* Filter operation to perform. * @param arg * Pointer to operation-specific structure. * * @return -* 0 on success, negative errno value on failure. +* 0 on success, negative error value otherwise. */ static int hinic_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type,
drivers/net/hinic/hinic_pmd_ethdev.h +7 -5
@@ -53,11 +53,13 @@ struct hinic_5tuple_filter_info {* used when more than one filter matches. */ uint8_t priority; - uint8_t dst_ip_mask:1, /* if mask is 1b, do not compare dst ip. */ - src_ip_mask:1, /* if mask is 1b, do not compare src ip. */ - dst_port_mask:1, /* if mask is 1b, do not compare dst port. */ - src_port_mask:1, /* if mask is 1b, do not compare src port. */ - proto_mask:1; /* if mask is 1b, do not compare protocol. */ + +/* if mask is 1b, do not compare the response bit domain */ + uint8_t dst_ip_mask:1, + src_ip_mask:1, + dst_port_mask:1, + src_port_mask:1, + proto_mask:1; };/* 5tuple filter structure */
Signature · 1 line
1.8.3.1
PATCH 4/4 net/hinic: optimize RSS RETA table updates
In reply to Xiaoyun wangBefore updating RSS indirection table, firstly determine whether rq num in RETA table is legal, if it is invalid(such as exceeding the maximum rxq num), driver will not update hw indirection table and return fail.
--- drivers/net/hinic/hinic_pmd_ethdev.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/hinic/hinic_pmd_ethdev.c +8 -8
@@ -2075,16 +2075,16 @@ static int hinic_rss_indirtbl_update(struct rte_eth_dev *dev,for (i =0 ; i < reta_size; i++) { idx = i /RTE_RETA_GROUP_SIZE ; shift = i %RTE_RETA_GROUP_SIZE ; -if (reta_conf[idx].mask & (1ULL << shift)) - indirtbl[i] = reta_conf[idx].reta[shift]; - } -for (i =0 ; i < reta_size; i++) { -if (indirtbl[i] >= nic_dev->num_rq) { -PMD_DRV_LOG (ERR ,"Invalid reta entry, index: %d, num_rq: %d" , - i, nic_dev->num_rq); - goto disable_rss; +if (reta_conf[idx].reta[shift] >= nic_dev->num_rq) { +PMD_DRV_LOG (ERR ,"Invalid reta entry, indirtbl[%d]: %d " +"exceeds the maximum rxq num: %d" , i, + reta_conf[idx].reta[shift], nic_dev->num_rq); +return -EINVAL ; } + +if (reta_conf[idx].mask & (1ULL << shift)) + indirtbl[i] = reta_conf[idx].reta[shift]; } err =hinic_rss_set_indir_tbl (nic_dev->hwdev, tmpl_idx, indirtbl);
Signature · 1 line
1.8.3.1
Quoted 14 lines · Xiaoyun wang
This patch adds
tx_queuesandrx_queuesnon-null judgment before free tx or rx resources, because some app may settx_queuesorrx_queuesto be null before call free resource interfaces, which may cause a segfault, addspkt_lenmember update fordst_mbufwhen copy a mbuf to a newdst_mbuf, code style format rectification, and adjusts the legality judgment order of RSS RETA table.--
v1:
- the queues resource free problem fixes
- the pkt len updates of mbuf fixes
- code style modification
- optimize RSS RETA table updates
Quoted 5 lines
Xiaoyun wang (4):
net/hinic: the queues resource free problem fixes net/hinic: the pkt len updates of mbuf fixes net/hinic: code style modification net/hinic: optimize RSS RETA table updates
Series applied to dpdk-next-net/master, thanks.