From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 985BDA04A2 for ; Sat, 9 May 2020 05:41:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2D8421D992; Sat, 9 May 2020 05:41:05 +0200 (CEST) Received: from huawei.com (szxga07-in.huawei.com [45.249.212.35]) by dpdk.org (Postfix) with ESMTP id 97A2F1D985; Sat, 9 May 2020 05:41:02 +0200 (CEST) Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id BAE3FF71105B8AA54D65; Sat, 9 May 2020 11:40:45 +0800 (CST) Received: from tester.localdomain (10.175.119.39) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Sat, 9 May 2020 11:40:35 +0800 From: Xiaoyun wang To: CC: , , , , , , , , , , Xiaoyun wang , Date: Sat, 9 May 2020 12:04:13 +0800 Message-ID: <034a9a94e90cfffdeee2b7c37d000977860705ba.1588991713.git.cloud.wangxiaoyun@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Originating-IP: [10.175.119.39] X-CFilter-Loop: Reflected Subject: [dpdk-stable] [PATCH v5 1/4] net/hinic: increase Tx/Rx queues non-null judgment X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Message-ID: <20200509040413.PoaV8FgQ3Yp4d6E5PeaXTEUMEiR0hCHVQfh_gql22mk@z> Increase tx_queues and rx_queues non-null judgment before free tx or rx resources, and modify some formate for logs. Fixes: 54faba2295bd ("net/hinic: adds Tx queue xstats members") Cc: stable@dpdk.org Signed-off-by: Xiaoyun wang --- 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 | 13 ++++++------- drivers/net/hinic/hinic_pmd_rx.c | 3 ++- drivers/net/hinic/hinic_pmd_tx.c | 5 ++++- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/net/hinic/base/hinic_pmd_cmdq.h b/drivers/net/hinic/base/hinic_pmd_cmdq.h index 4ce0a4c..0d5e380 100644 --- a/drivers/net/hinic/base/hinic_pmd_cmdq.h +++ b/drivers/net/hinic/base/hinic_pmd_cmdq.h @@ -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 diff --git a/drivers/net/hinic/base/hinic_pmd_hwif.c b/drivers/net/hinic/base/hinic_pmd_hwif.c index 63fba0d..1839df0 100644 --- a/drivers/net/hinic/base/hinic_pmd_hwif.c +++ b/drivers/net/hinic/base/hinic_pmd_hwif.c @@ -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 set attr5"); return; } diff --git a/drivers/net/hinic/base/hinic_pmd_nicio.c b/drivers/net/hinic/base/hinic_pmd_nicio.c index 60c4e14..7f7e11d 100644 --- a/drivers/net/hinic/base/hinic_pmd_nicio.c +++ b/drivers/net/hinic/base/hinic_pmd_nicio.c @@ -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; diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index cfbca64..5fcff81 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@ -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 wqepage */ 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", @@ -2070,7 +2070,7 @@ static int hinic_rss_indirtbl_update(struct rte_eth_dev *dev, indirtbl[i] = reta_conf[idx].reta[shift]; } - for (i = 0 ; i < reta_size; i++) { + 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); @@ -2300,8 +2300,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++; } @@ -2312,13 +2311,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 * diff --git a/drivers/net/hinic/hinic_pmd_rx.c b/drivers/net/hinic/hinic_pmd_rx.c index 4ca74f0..a49769a 100644 --- a/drivers/net/hinic/hinic_pmd_rx.c +++ b/drivers/net/hinic/hinic_pmd_rx.c @@ -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; diff --git a/drivers/net/hinic/hinic_pmd_tx.c b/drivers/net/hinic/hinic_pmd_tx.c index 258f2c1..bd39f93 100644 --- a/drivers/net/hinic/hinic_pmd_tx.c +++ b/drivers/net/hinic/hinic_pmd_tx.c @@ -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; } @@ -1217,7 +1219,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; -- 1.8.3.1