From patchwork Fri Sep 30 07:22:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117177 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D4CE2A034C; Fri, 30 Sep 2022 09:24:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC04B42905; Fri, 30 Sep 2022 09:24:06 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 8954E410F1; Fri, 30 Sep 2022 09:24:03 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Mf1nn62wBzlVxf; Fri, 30 Sep 2022 15:19:41 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:00 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 01/19] net/hns3: fix have no valid RSS rule Date: Fri, 30 Sep 2022 15:22:02 +0800 Message-ID: <20220930072220.20753-2-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li The 'hns3_restore_rss_filter' function is used to restore RSS rule. But this function calls the 'hns3_config_rss_filter' which sets the last to invalid in flow RSS list. This causes the flow RSS list has no valid rule. Fixes: ec674cb742e5 ("net/hns3: fix flushing RSS rule") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_flow.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index b84f26c26c..4952d807b8 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1539,7 +1539,6 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, const struct hns3_rss_conf *conf, bool add) { struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_rss_conf_ele *rss_filter_ptr; struct hns3_hw *hw = &hns->hw; struct hns3_rss_conf *rss_info; uint64_t flow_types; @@ -1618,13 +1617,6 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, goto rss_config_err; } - /* - * When create a new RSS rule, the old rule will be overlaid and set - * invalid. - */ - TAILQ_FOREACH(rss_filter_ptr, &hw->flow_rss_list, entries) - rss_filter_ptr->filter_info.valid = false; - rss_config_err: rte_spinlock_unlock(&hw->lock); @@ -1749,6 +1741,7 @@ hns3_flow_create_rss_rule(struct rte_eth_dev *dev, { struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct hns3_rss_conf_ele *rss_filter_ptr; + struct hns3_rss_conf_ele *filter_ptr; const struct hns3_rss_conf *rss_conf; int ret; @@ -1773,6 +1766,14 @@ hns3_flow_create_rss_rule(struct rte_eth_dev *dev, hns3_rss_conf_copy(&rss_filter_ptr->filter_info, &rss_conf->conf); rss_filter_ptr->filter_info.valid = true; + + /* + * When create a new RSS rule, the old rule will be overlaid and set + * invalid. + */ + TAILQ_FOREACH(filter_ptr, &hw->flow_rss_list, entries) + filter_ptr->filter_info.valid = false; + TAILQ_INSERT_TAIL(&hw->flow_rss_list, rss_filter_ptr, entries); flow->rule = rss_filter_ptr; flow->filter_type = RTE_ETH_FILTER_HASH; From patchwork Fri Sep 30 07:22:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117175 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2500EA034C; Fri, 30 Sep 2022 09:24:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C6CAC40FAE; Fri, 30 Sep 2022 09:24:04 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 3891140FAE; Fri, 30 Sep 2022 09:24:03 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Mf1np1mpTzlX54; Fri, 30 Sep 2022 15:19:42 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:00 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 02/19] net/hns3: fix RSS filter restore Date: Fri, 30 Sep 2022 15:22:03 +0800 Message-ID: <20220930072220.20753-3-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li Currently, driver sets RSS function to 'RTE_ETH_HASH_FUNCTION_MAX' when user flush all rules in order to judge whether driver needs to restore RSS rules. In fact, all rules are saved in flow RSS list. So there is no need to modify RSS function to this macro. And this list can be used to restore. The modification of RSS function may introduce new problem. So this patch fix it. Fixes: eb158fc756a5 ("net/hns3: fix config when creating RSS rule after flush") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_flow.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 4952d807b8..2fb83f756a 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1587,8 +1587,6 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, rss_info->conf.queue_num = 0; } - /* set RSS func invalid after flushed */ - rss_info->conf.func = RTE_ETH_HASH_FUNCTION_MAX; return 0; } @@ -1659,13 +1657,23 @@ int hns3_restore_rss_filter(struct rte_eth_dev *dev) { struct hns3_adapter *hns = dev->data->dev_private; + struct hns3_rss_conf_ele *filter; struct hns3_hw *hw = &hns->hw; + int ret = 0; - /* When user flush all rules, it doesn't need to restore RSS rule */ - if (hw->rss_info.conf.func == RTE_ETH_HASH_FUNCTION_MAX) - return 0; + TAILQ_FOREACH(filter, &hw->flow_rss_list, entries) { + if (!filter->filter_info.valid) + continue; - return hns3_config_rss_filter(dev, &hw->rss_info, true); + ret = hns3_config_rss_filter(dev, &filter->filter_info, true); + if (ret != 0) { + hns3_err(hw, "restore RSS filter failed, ret=%d", ret); + goto out; + } + } + +out: + return ret; } static int From patchwork Fri Sep 30 07:22:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117178 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C3C41A034C; Fri, 30 Sep 2022 09:24:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 48EF842B70; Fri, 30 Sep 2022 09:24:08 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id EA4D040E5A; Fri, 30 Sep 2022 09:24:03 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Mf1nq0K7Cz1P6vy; Fri, 30 Sep 2022 15:19:43 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:01 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 03/19] net/hns3: fix the lock protection of RSS flow rule Date: Fri, 30 Sep 2022 15:22:04 +0800 Message-ID: <20220930072220.20753-4-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li RSS flow rules are saved in RSS filter linked list. The linked list is modified by rte_flow API and is used to restore RSS rules during reset process. So this patch uses 'hw->flows_lock' to protect the configuration and recovery of RSS rule. Fixes: c37ca66f2b27 ("net/hns3: support RSS") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_flow.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 2fb83f756a..162a48e590 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1596,27 +1596,20 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, hns3_warn(hw, "Config queue numbers %u are beyond the scope of truncated", rss_flow_conf.queue_num); hns3_info(hw, "Max of contiguous %u PF queues are configured", num); - - rte_spinlock_lock(&hw->lock); if (num) { ret = hns3_update_indir_table(dev, &rss_flow_conf, num); if (ret) - goto rss_config_err; + return ret; } /* Set hash algorithm and flow types by the user's config */ ret = hns3_hw_rss_hash_set(hw, &rss_flow_conf); if (ret) - goto rss_config_err; + return ret; ret = hns3_rss_conf_copy(rss_info, &rss_flow_conf); - if (ret) { + if (ret) hns3_err(hw, "RSS config init fail(%d)", ret); - goto rss_config_err; - } - -rss_config_err: - rte_spinlock_unlock(&hw->lock); return ret; } @@ -1661,6 +1654,7 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) struct hns3_hw *hw = &hns->hw; int ret = 0; + pthread_mutex_lock(&hw->flows_lock); TAILQ_FOREACH(filter, &hw->flow_rss_list, entries) { if (!filter->filter_info.valid) continue; @@ -1673,6 +1667,8 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) } out: + pthread_mutex_unlock(&hw->flows_lock); + return ret; } From patchwork Fri Sep 30 07:22:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117179 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 33D29A034C; Fri, 30 Sep 2022 09:24:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 605B642B7B; Fri, 30 Sep 2022 09:24:09 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id AE6AC410FA; Fri, 30 Sep 2022 09:24:03 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Mf1r703chzHqVT; Fri, 30 Sep 2022 15:21:42 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:01 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 04/19] net/hns3: fix RSS flow rule restore failed Date: Fri, 30 Sep 2022 15:22:05 +0800 Message-ID: <20220930072220.20753-5-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li After reset process, types of RSS flow rule cannot be restored when load driver without RTE_ETH_MQ_RX_RSS_FLAG flag. This is because the restoration for RSS flow rule is done in the 'hns3_config_rss()'. But this function is also used to configure and restore RSS configuration from ethdev ops, and doesn't configure RSS types if 'rxmode.mq_mode' has not the flag. As a result, RSS types configured by rte flow API can't be restored in this case when encounter reset. Actually, all RSS rules are saved to a global link list. This patch uses the linked list to restore RSS flow rule. Fixes: 920be799dbc3 ("net/hns3: fix RSS indirection table configuration") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_ethdev.c | 11 ++--------- drivers/net/hns3/hns3_ethdev_vf.c | 11 ++--------- drivers/net/hns3/hns3_flow.c | 8 +++++++- drivers/net/hns3/hns3_flow.h | 1 + drivers/net/hns3/hns3_rss.h | 1 - 5 files changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 3d9f7c6ec7..b0f69589d9 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -5006,6 +5006,7 @@ static int hns3_do_start(struct hns3_adapter *hns, bool reset_queue) { struct hns3_hw *hw = &hns->hw; + struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; bool link_en; int ret; @@ -5042,7 +5043,7 @@ hns3_do_start(struct hns3_adapter *hns, bool reset_queue) if (ret) goto err_set_link_speed; - return 0; + return hns3_restore_filter(dev); err_set_link_speed: (void)hns3_cfg_mac_mode(hw, false); @@ -5059,12 +5060,6 @@ hns3_do_start(struct hns3_adapter *hns, bool reset_queue) return ret; } -static void -hns3_restore_filter(struct rte_eth_dev *dev) -{ - hns3_restore_rss_filter(dev); -} - static int hns3_dev_start(struct rte_eth_dev *dev) { @@ -5121,8 +5116,6 @@ hns3_dev_start(struct rte_eth_dev *dev) hns3_set_rxtx_function(dev); hns3_mp_req_start_rxtx(dev); - hns3_restore_filter(dev); - /* Enable interrupt of all rx queues before enabling queues */ hns3_dev_all_rx_queue_intr_enable(hw, true); diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index a72535eb7d..bc8f5ecec2 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -1727,6 +1727,7 @@ static int hns3vf_do_start(struct hns3_adapter *hns, bool reset_queue) { struct hns3_hw *hw = &hns->hw; + struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; uint16_t nb_rx_q = hw->data->nb_rx_queues; uint16_t nb_tx_q = hw->data->nb_tx_queues; int ret; @@ -1741,13 +1742,7 @@ hns3vf_do_start(struct hns3_adapter *hns, bool reset_queue) if (ret) hns3_err(hw, "failed to init queues, ret = %d.", ret); - return ret; -} - -static void -hns3vf_restore_filter(struct rte_eth_dev *dev) -{ - hns3_restore_rss_filter(dev); + return hns3_restore_filter(dev); } static int @@ -1799,8 +1794,6 @@ hns3vf_dev_start(struct rte_eth_dev *dev) hns3_set_rxtx_function(dev); hns3_mp_req_start_rxtx(dev); - hns3vf_restore_filter(dev); - /* Enable interrupt of all rx queues before enabling queues */ hns3_dev_all_rx_queue_intr_enable(hw, true); hns3_start_tqps(hw); diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 162a48e590..08fa6da7bb 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1646,7 +1646,7 @@ hns3_clear_rss_filter(struct rte_eth_dev *dev) return ret; } -int +static int hns3_restore_rss_filter(struct rte_eth_dev *dev) { struct hns3_adapter *hns = dev->data->dev_private; @@ -1672,6 +1672,12 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) return ret; } +int +hns3_restore_filter(struct rte_eth_dev *dev) +{ + return hns3_restore_rss_filter(dev); +} + static int hns3_flow_parse_rss(struct rte_eth_dev *dev, const struct hns3_rss_conf *conf, bool add) diff --git a/drivers/net/hns3/hns3_flow.h b/drivers/net/hns3/hns3_flow.h index 1ab3f9f5c6..0f5de129a3 100644 --- a/drivers/net/hns3/hns3_flow.h +++ b/drivers/net/hns3/hns3_flow.h @@ -49,5 +49,6 @@ int hns3_dev_flow_ops_get(struct rte_eth_dev *dev, const struct rte_flow_ops **ops); void hns3_flow_init(struct rte_eth_dev *dev); void hns3_flow_uninit(struct rte_eth_dev *dev); +int hns3_restore_filter(struct rte_eth_dev *dev); #endif /* _HNS3_FLOW_H_ */ diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h index 39af01ef13..1589c67c59 100644 --- a/drivers/net/hns3/hns3_rss.h +++ b/drivers/net/hns3/hns3_rss.h @@ -110,6 +110,5 @@ int hns3_config_rss(struct hns3_adapter *hns); void hns3_rss_uninit(struct hns3_adapter *hns); int hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, uint64_t rss_hf); int hns3_rss_set_algo_key(struct hns3_hw *hw, const uint8_t *key); -int hns3_restore_rss_filter(struct rte_eth_dev *dev); #endif /* _HNS3_RSS_H_ */ From patchwork Fri Sep 30 07:22:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117184 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0B31FA034C; Fri, 30 Sep 2022 09:24:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C99FE42BA4; Fri, 30 Sep 2022 09:24:15 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 7B31342825; Fri, 30 Sep 2022 09:24:10 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mf1nK4x3ZzHtpp; Fri, 30 Sep 2022 15:19:17 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:06 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 05/19] net/hns3: move flow direction rule recovery position Date: Fri, 30 Sep 2022 15:22:06 +0800 Message-ID: <20220930072220.20753-6-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li The 'hns3_restore_filter' is used to restore flow rules from rte_flow API during the reset process. This patch moves the recovery of flow direction rule to this function to improve code maintainability. Fixes: fcba820d9b9e ("net/hns3: support flow director") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_ethdev.c | 4 ---- drivers/net/hns3/hns3_fdir.c | 3 +++ drivers/net/hns3/hns3_flow.c | 7 +++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index b0f69589d9..15d622a900 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -5907,10 +5907,6 @@ hns3_restore_conf(struct hns3_adapter *hns) if (ret) goto err_promisc; - ret = hns3_restore_all_fdir_filter(hns); - if (ret) - goto err_promisc; - ret = hns3_restore_ptp(hns); if (ret) goto err_promisc; diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c index 30e5e66772..48a91fb517 100644 --- a/drivers/net/hns3/hns3_fdir.c +++ b/drivers/net/hns3/hns3_fdir.c @@ -1068,6 +1068,9 @@ int hns3_restore_all_fdir_filter(struct hns3_adapter *hns) bool err = false; int ret; + if (hns->is_vf) + return 0; + /* * This API is called in the reset recovery process, the parent function * must hold hw->lock. diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 08fa6da7bb..dd61ecd2aa 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1675,6 +1675,13 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) int hns3_restore_filter(struct rte_eth_dev *dev) { + struct hns3_adapter *hns = dev->data->dev_private; + int ret; + + ret = hns3_restore_all_fdir_filter(hns); + if (ret != 0) + return ret; + return hns3_restore_rss_filter(dev); } From patchwork Fri Sep 30 07:22:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117183 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DA1F4A034C; Fri, 30 Sep 2022 09:24:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9265142B95; Fri, 30 Sep 2022 09:24:14 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 20BF742B76; Fri, 30 Sep 2022 09:24:10 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Mf1nw3z6TzlVxf; Fri, 30 Sep 2022 15:19:48 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:06 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 06/19] net/hns3: fix hns3 restore filter function input Date: Fri, 30 Sep 2022 15:22:07 +0800 Message-ID: <20220930072220.20753-7-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li This 'hns3_restore_filter' is an internal interface of driver. Currently, it uses 'struct rte_eth_dev *dev' as input parameter, This is inconvenient for the function to call in driver because caller has to obtain its device address by global variable 'rte_eth_devices[]'. So this patch fix the input of this function. Fixes: 920be799dbc3 ("net/hns3: fix RSS indirection table configuration") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_ethdev.c | 3 +-- drivers/net/hns3/hns3_ethdev_vf.c | 3 +-- drivers/net/hns3/hns3_flow.c | 30 ++++++++++++------------------ drivers/net/hns3/hns3_flow.h | 2 +- 4 files changed, 15 insertions(+), 23 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 15d622a900..330a913cb8 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -5006,7 +5006,6 @@ static int hns3_do_start(struct hns3_adapter *hns, bool reset_queue) { struct hns3_hw *hw = &hns->hw; - struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; bool link_en; int ret; @@ -5043,7 +5042,7 @@ hns3_do_start(struct hns3_adapter *hns, bool reset_queue) if (ret) goto err_set_link_speed; - return hns3_restore_filter(dev); + return hns3_restore_filter(hns); err_set_link_speed: (void)hns3_cfg_mac_mode(hw, false); diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index bc8f5ecec2..446a0cdbc7 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -1727,7 +1727,6 @@ static int hns3vf_do_start(struct hns3_adapter *hns, bool reset_queue) { struct hns3_hw *hw = &hns->hw; - struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; uint16_t nb_rx_q = hw->data->nb_rx_queues; uint16_t nb_tx_q = hw->data->nb_tx_queues; int ret; @@ -1742,7 +1741,7 @@ hns3vf_do_start(struct hns3_adapter *hns, bool reset_queue) if (ret) hns3_err(hw, "failed to init queues, ret = %d.", ret); - return hns3_restore_filter(dev); + return hns3_restore_filter(hns); } static int diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index dd61ecd2aa..a2c1589c39 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1508,11 +1508,9 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config) } static int -hns3_update_indir_table(struct rte_eth_dev *dev, +hns3_update_indir_table(struct hns3_hw *hw, const struct rte_flow_action_rss *conf, uint16_t num) { - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_hw *hw = &hns->hw; uint16_t indir_tbl[HNS3_RSS_IND_TBL_SIZE_MAX]; uint16_t j; uint32_t i; @@ -1535,11 +1533,9 @@ hns3_update_indir_table(struct rte_eth_dev *dev, } static int -hns3_config_rss_filter(struct rte_eth_dev *dev, +hns3_config_rss_filter(struct hns3_hw *hw, const struct hns3_rss_conf *conf, bool add) { - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_hw *hw = &hns->hw; struct hns3_rss_conf *rss_info; uint64_t flow_types; uint16_t num; @@ -1591,13 +1587,13 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, } /* Set rx queues to use */ - num = RTE_MIN(dev->data->nb_rx_queues, rss_flow_conf.queue_num); + num = RTE_MIN(hw->data->nb_rx_queues, rss_flow_conf.queue_num); if (rss_flow_conf.queue_num > num) hns3_warn(hw, "Config queue numbers %u are beyond the scope of truncated", rss_flow_conf.queue_num); hns3_info(hw, "Max of contiguous %u PF queues are configured", num); if (num) { - ret = hns3_update_indir_table(dev, &rss_flow_conf, num); + ret = hns3_update_indir_table(hw, &rss_flow_conf, num); if (ret) return ret; } @@ -1627,7 +1623,7 @@ hns3_clear_rss_filter(struct rte_eth_dev *dev) rss_filter_ptr = TAILQ_FIRST(&hw->flow_rss_list); while (rss_filter_ptr) { TAILQ_REMOVE(&hw->flow_rss_list, rss_filter_ptr, entries); - ret = hns3_config_rss_filter(dev, &rss_filter_ptr->filter_info, + ret = hns3_config_rss_filter(hw, &rss_filter_ptr->filter_info, false); if (ret) rss_rule_fail_cnt++; @@ -1647,11 +1643,9 @@ hns3_clear_rss_filter(struct rte_eth_dev *dev) } static int -hns3_restore_rss_filter(struct rte_eth_dev *dev) +hns3_restore_rss_filter(struct hns3_hw *hw) { - struct hns3_adapter *hns = dev->data->dev_private; struct hns3_rss_conf_ele *filter; - struct hns3_hw *hw = &hns->hw; int ret = 0; pthread_mutex_lock(&hw->flows_lock); @@ -1659,7 +1653,7 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) if (!filter->filter_info.valid) continue; - ret = hns3_config_rss_filter(dev, &filter->filter_info, true); + ret = hns3_config_rss_filter(hw, &filter->filter_info, true); if (ret != 0) { hns3_err(hw, "restore RSS filter failed, ret=%d", ret); goto out; @@ -1673,16 +1667,16 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) } int -hns3_restore_filter(struct rte_eth_dev *dev) +hns3_restore_filter(struct hns3_adapter *hns) { - struct hns3_adapter *hns = dev->data->dev_private; + struct hns3_hw *hw = &hns->hw; int ret; ret = hns3_restore_all_fdir_filter(hns); if (ret != 0) return ret; - return hns3_restore_rss_filter(dev); + return hns3_restore_rss_filter(hw); } static int @@ -1699,7 +1693,7 @@ hns3_flow_parse_rss(struct rte_eth_dev *dev, return -EINVAL; } - return hns3_config_rss_filter(dev, conf, add); + return hns3_config_rss_filter(hw, conf, add); } static int @@ -1960,7 +1954,7 @@ hns3_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, break; case RTE_ETH_FILTER_HASH: rss_filter_ptr = (struct hns3_rss_conf_ele *)flow->rule; - ret = hns3_config_rss_filter(dev, &rss_filter_ptr->filter_info, + ret = hns3_config_rss_filter(hw, &rss_filter_ptr->filter_info, false); if (ret) return rte_flow_error_set(error, EIO, diff --git a/drivers/net/hns3/hns3_flow.h b/drivers/net/hns3/hns3_flow.h index 0f5de129a3..854fbb7ff0 100644 --- a/drivers/net/hns3/hns3_flow.h +++ b/drivers/net/hns3/hns3_flow.h @@ -49,6 +49,6 @@ int hns3_dev_flow_ops_get(struct rte_eth_dev *dev, const struct rte_flow_ops **ops); void hns3_flow_init(struct rte_eth_dev *dev); void hns3_flow_uninit(struct rte_eth_dev *dev); -int hns3_restore_filter(struct rte_eth_dev *dev); +int hns3_restore_filter(struct hns3_adapter *hns); #endif /* _HNS3_FLOW_H_ */ From patchwork Fri Sep 30 07:22:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117180 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7EE32A0540; Fri, 30 Sep 2022 09:24:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4BE214282B; Fri, 30 Sep 2022 09:24:11 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 6228642B7C; Fri, 30 Sep 2022 09:24:09 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Mf1rD6CzMzHqVQ; Fri, 30 Sep 2022 15:21:48 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:07 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 07/19] net/hns3: fix gcov compile warning Date: Fri, 30 Sep 2022 15:22:08 +0800 Message-ID: <20220930072220.20753-8-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org meson build -Db_coverage=true ninja -C build ../drivers/net/hns3/hns3_ethdev.c:2856:22: warning: ‘cfg.umv_space’ may be used uninitialized in this function [-Wmaybe-uninitialized] 2856 | pf->wanted_umv_size = cfg.umv_space; This patch fix compiling warnings using gcc10.3.1 version. Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_ethdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 330a913cb8..bbc086f21d 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -2808,6 +2808,7 @@ hns3_get_board_configuration(struct hns3_hw *hw) struct hns3_cfg cfg; int ret; + memset(&cfg, 0, sizeof(cfg)); ret = hns3_get_board_cfg(hw, &cfg); if (ret) { PMD_INIT_LOG(ERR, "get board config failed %d", ret); From patchwork Fri Sep 30 07:22:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117182 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F17BCA034C; Fri, 30 Sep 2022 09:24:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7B9B842B8A; Fri, 30 Sep 2022 09:24:13 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 4C9264282E; Fri, 30 Sep 2022 09:24:10 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Mf1qV0yDVzpVWB; Fri, 30 Sep 2022 15:21:10 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:07 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 08/19] net/hns3: fix incorrect packet type report for GENEVE Date: Fri, 30 Sep 2022 15:22:09 +0800 Message-ID: <20220930072220.20753-9-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li Currently, hns3 reports VXLAN tunnel packet type for GENEVE, which is misleading to user. In fact, hns3 hardware cannot distinguish between VXLAN and GENEVE packet. So this patch uses RTE_PTYPE_TUNNEL_GRENAT packet type to report. Fixes: 7d6df32cf742 ("net/hns3: fix missing outer L4 UDP flag for VXLAN") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index fc304e1efd..0a342ed9a2 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -1992,7 +1992,7 @@ hns3_dev_supported_ptypes_get(struct rte_eth_dev *dev) RTE_PTYPE_INNER_L4_TCP, RTE_PTYPE_INNER_L4_SCTP, RTE_PTYPE_INNER_L4_ICMP, - RTE_PTYPE_TUNNEL_VXLAN, + RTE_PTYPE_TUNNEL_GRENAT, RTE_PTYPE_TUNNEL_NVGRE, RTE_PTYPE_UNKNOWN }; @@ -2089,7 +2089,7 @@ hns3_init_tunnel_ptype_tbl(struct hns3_ptype_table *tbl) tbl->ol3table[5] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT; tbl->ol4table[0] = RTE_PTYPE_UNKNOWN; - tbl->ol4table[1] = RTE_PTYPE_L4_UDP | RTE_PTYPE_TUNNEL_VXLAN; + tbl->ol4table[1] = RTE_PTYPE_L4_UDP | RTE_PTYPE_TUNNEL_GRENAT; tbl->ol4table[2] = RTE_PTYPE_TUNNEL_NVGRE; } From patchwork Fri Sep 30 07:22:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117181 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B40B4A034C; Fri, 30 Sep 2022 09:24:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8353E42B87; Fri, 30 Sep 2022 09:24:12 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 13B0D4282B; Fri, 30 Sep 2022 09:24:10 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Mf1ny1bjjz1P6yr; Fri, 30 Sep 2022 15:19:50 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:08 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 09/19] net/hns3: fix magic numbers Date: Fri, 30 Sep 2022 15:22:10 +0800 Message-ID: <20220930072220.20753-10-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Jie Hai Removing magic numbers with macros. Signed-off-by: Jie Hai Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_ethdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index bbc086f21d..a1348f93a7 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -1713,6 +1713,7 @@ hns3_add_mc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) char mac_str[RTE_ETHER_ADDR_FMT_SIZE]; uint8_t vf_id; int ret; + int idx; /* Check if mac addr is valid */ if (!rte_is_multicast_ether_addr(mac_addr)) { @@ -1730,9 +1731,8 @@ hns3_add_mc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) HNS3_MC_MAC_VLAN_OPS_DESC_NUM); if (ret) { /* This mac addr do not exist, add new entry for it */ - memset(desc[0].data, 0, sizeof(desc[0].data)); - memset(desc[1].data, 0, sizeof(desc[0].data)); - memset(desc[2].data, 0, sizeof(desc[0].data)); + for (idx = 0; idx < HNS3_MC_MAC_VLAN_OPS_DESC_NUM; idx++) + memset(desc[idx].data, 0, sizeof(desc[idx].data)); } /* From patchwork Fri Sep 30 07:22:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117185 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 58599A034C; Fri, 30 Sep 2022 09:25:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5602C42BB1; Fri, 30 Sep 2022 09:24:18 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 3F0AE42B8F; Fri, 30 Sep 2022 09:24:15 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mf1nS3xvQzHtjY; Fri, 30 Sep 2022 15:19:24 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:13 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 10/19] net/hns3: fix header file self contained Date: Fri, 30 Sep 2022 15:22:11 +0800 Message-ID: <20220930072220.20753-11-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Chengwen Feng Header files should be self contained and should not be cyclically dependent. This patch fixed it. Signed-off-by: Chengwen Feng Signed-off-by: Min Hu Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_cmd.h | 3 +++ drivers/net/hns3/hns3_common.c | 2 +- drivers/net/hns3/hns3_dcb.h | 4 ++++ drivers/net/hns3/hns3_ethdev.c | 2 +- drivers/net/hns3/hns3_fdir.h | 5 +++++ drivers/net/hns3/hns3_flow.h | 3 +++ drivers/net/hns3/hns3_intr.c | 2 +- drivers/net/hns3/hns3_mbx.h | 4 ++++ drivers/net/hns3/hns3_mp.h | 2 ++ drivers/net/hns3/hns3_regs.h | 3 +++ drivers/net/hns3/hns3_rss.h | 2 ++ drivers/net/hns3/hns3_rxtx.c | 2 +- drivers/net/hns3/hns3_rxtx.h | 9 +++++++++ drivers/net/hns3/hns3_stats.h | 5 +++++ drivers/net/hns3/hns3_tm.h | 2 ++ 15 files changed, 46 insertions(+), 4 deletions(-) diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h index 82c999061d..bee96c1e46 100644 --- a/drivers/net/hns3/hns3_cmd.h +++ b/drivers/net/hns3/hns3_cmd.h @@ -7,6 +7,9 @@ #include +#include +#include + #define HNS3_CMDQ_TX_TIMEOUT 30000 #define HNS3_CMDQ_CLEAR_WAIT_TIME 200 #define HNS3_CMDQ_RX_INVLD_B 0 diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c index e732f68238..14291193cb 100644 --- a/drivers/net/hns3/hns3_common.c +++ b/drivers/net/hns3/hns3_common.c @@ -7,10 +7,10 @@ #include #include -#include "hns3_common.h" #include "hns3_logs.h" #include "hns3_regs.h" #include "hns3_rxtx.h" +#include "hns3_common.h" int hns3_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version, diff --git a/drivers/net/hns3/hns3_dcb.h b/drivers/net/hns3/hns3_dcb.h index e06ec177c8..9d9e7684c1 100644 --- a/drivers/net/hns3/hns3_dcb.h +++ b/drivers/net/hns3/hns3_dcb.h @@ -7,7 +7,11 @@ #include +#include +#include + #include "hns3_cmd.h" +#include "hns3_ethdev.h" #define HNS3_ETHER_MAX_RATE 100000 diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index a1348f93a7..60e933998a 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -6,7 +6,6 @@ #include #include -#include "hns3_ethdev.h" #include "hns3_common.h" #include "hns3_dump.h" #include "hns3_logs.h" @@ -16,6 +15,7 @@ #include "hns3_dcb.h" #include "hns3_mp.h" #include "hns3_flow.h" +#include "hns3_ethdev.h" #define HNS3_SERVICE_INTERVAL 1000000 /* us */ #define HNS3_SERVICE_QUICK_INTERVAL 10 diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h index d81f04a3f3..1a14f1eceb 100644 --- a/drivers/net/hns3/hns3_fdir.h +++ b/drivers/net/hns3/hns3_fdir.h @@ -5,6 +5,10 @@ #ifndef _HNS3_FDIR_H_ #define _HNS3_FDIR_H_ +#include + +#include + struct hns3_fd_key_cfg { uint8_t key_sel; uint8_t inner_sipv6_word_en; @@ -177,6 +181,7 @@ struct hns3_fdir_info { }; struct hns3_adapter; +struct hns3_hw; int hns3_init_fd_config(struct hns3_adapter *hns); int hns3_fdir_filter_init(struct hns3_adapter *hns); diff --git a/drivers/net/hns3/hns3_flow.h b/drivers/net/hns3/hns3_flow.h index 854fbb7ff0..ec94510152 100644 --- a/drivers/net/hns3/hns3_flow.h +++ b/drivers/net/hns3/hns3_flow.h @@ -6,6 +6,9 @@ #define _HNS3_FLOW_H_ #include +#include + +#include "hns3_rss.h" struct hns3_flow_counter { LIST_ENTRY(hns3_flow_counter) next; /* Pointer to the next counter. */ diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c index 4bdcd6070b..57679254ee 100644 --- a/drivers/net/hns3/hns3_intr.c +++ b/drivers/net/hns3/hns3_intr.c @@ -10,9 +10,9 @@ #include "hns3_common.h" #include "hns3_logs.h" -#include "hns3_intr.h" #include "hns3_regs.h" #include "hns3_rxtx.h" +#include "hns3_intr.h" #define SWITCH_CONTEXT_US 10 diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h index 0172a2e288..97f704426c 100644 --- a/drivers/net/hns3/hns3_mbx.h +++ b/drivers/net/hns3/hns3_mbx.h @@ -5,6 +5,10 @@ #ifndef _HNS3_MBX_H_ #define _HNS3_MBX_H_ +#include + +#include + enum HNS3_MBX_OPCODE { HNS3_MBX_RESET = 0x01, /* (VF -> PF) assert reset */ HNS3_MBX_ASSERTING_RESET, /* (PF -> VF) PF is asserting reset */ diff --git a/drivers/net/hns3/hns3_mp.h b/drivers/net/hns3/hns3_mp.h index a74221d086..230230bbfe 100644 --- a/drivers/net/hns3/hns3_mp.h +++ b/drivers/net/hns3/hns3_mp.h @@ -5,6 +5,8 @@ #ifndef _HNS3_MP_H_ #define _HNS3_MP_H_ +#include + /* Local data for primary or secondary process. */ struct hns3_process_local_data { bool init_done; /* Process action register completed flag. */ diff --git a/drivers/net/hns3/hns3_regs.h b/drivers/net/hns3/hns3_regs.h index 5812eb39db..2636429844 100644 --- a/drivers/net/hns3/hns3_regs.h +++ b/drivers/net/hns3/hns3_regs.h @@ -5,6 +5,9 @@ #ifndef _HNS3_REGS_H_ #define _HNS3_REGS_H_ +#include +#include + /* bar registers for cmdq */ #define HNS3_CMDQ_TX_ADDR_L_REG 0x27000 #define HNS3_CMDQ_TX_ADDR_H_REG 0x27004 diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h index 1589c67c59..6cae5f8634 100644 --- a/drivers/net/hns3/hns3_rss.h +++ b/drivers/net/hns3/hns3_rss.h @@ -4,6 +4,7 @@ #ifndef _HNS3_RSS_H_ #define _HNS3_RSS_H_ + #include #include @@ -91,6 +92,7 @@ static inline uint32_t roundup_pow_of_two(uint32_t x) extern const uint8_t hns3_hash_key[HNS3_RSS_KEY_SIZE]; struct hns3_adapter; +struct hns3_hw; int hns3_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index 0a342ed9a2..f1163ce8a9 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -17,10 +17,10 @@ #endif #include "hns3_common.h" -#include "hns3_rxtx.h" #include "hns3_regs.h" #include "hns3_logs.h" #include "hns3_mp.h" +#include "hns3_rxtx.h" #define HNS3_CFG_DESC_NUM(num) ((num) / 8 - 1) #define HNS3_RX_RING_PREFETCTH_MASK 3 diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h index 455f8b9419..f2d73043b7 100644 --- a/drivers/net/hns3/hns3_rxtx.h +++ b/drivers/net/hns3/hns3_rxtx.h @@ -6,7 +6,16 @@ #define _HNS3_RXTX_H_ #include + +#include #include +#include +#include +#include +#include +#include + +#include "hns3_ethdev.h" #define HNS3_MIN_RING_DESC 64 #define HNS3_MAX_RING_DESC 32768 diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h index 9d84072205..9a360f8870 100644 --- a/drivers/net/hns3/hns3_stats.h +++ b/drivers/net/hns3/hns3_stats.h @@ -5,6 +5,9 @@ #ifndef _HNS3_STATS_H_ #define _HNS3_STATS_H_ +#include +#include + /* TQP stats */ struct hns3_tqp_stats { uint64_t rcb_tx_ring_pktnum_rcd; /* Total num of transmitted packets */ @@ -145,6 +148,8 @@ struct hns3_reset_stats; #define HNS3_IMISSED_STATS_FIELD_OFFSET(f) \ (offsetof(struct hns3_rx_missed_stats, f)) +struct hns3_hw; + int hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats); int hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, diff --git a/drivers/net/hns3/hns3_tm.h b/drivers/net/hns3/hns3_tm.h index 83e9cc8ba9..47345eeed1 100644 --- a/drivers/net/hns3/hns3_tm.h +++ b/drivers/net/hns3/hns3_tm.h @@ -105,6 +105,8 @@ hns3_tm_calc_node_tc_no(struct hns3_tm_conf *conf, uint32_t node_id) return 0; } +struct hns3_hw; + void hns3_tm_conf_init(struct rte_eth_dev *dev); void hns3_tm_conf_uninit(struct rte_eth_dev *dev); int hns3_tm_ops_get(struct rte_eth_dev *dev __rte_unused, void *arg); From patchwork Fri Sep 30 07:22:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117186 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 253BDA034C; Fri, 30 Sep 2022 09:25:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3887742BB5; Fri, 30 Sep 2022 09:24:19 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 9084F42B99; Fri, 30 Sep 2022 09:24:15 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Mf1p359ypz1P70Z; Fri, 30 Sep 2022 15:19:55 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:13 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 11/19] net/hns3: remove unused structure definition Date: Fri, 30 Sep 2022 15:22:12 +0800 Message-ID: <20220930072220.20753-12-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Chengwen Feng This patch removes unused structure definition. Signed-off-by: Chengwen Feng Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_cmd.h | 19 ------------------- drivers/net/hns3/hns3_rss.h | 4 ---- 2 files changed, 23 deletions(-) diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h index bee96c1e46..902638ba99 100644 --- a/drivers/net/hns3/hns3_cmd.h +++ b/drivers/net/hns3/hns3_cmd.h @@ -59,11 +59,6 @@ enum hns3_cmd_return_status { HNS3_CMD_ROH_CHECK_FAIL = 12 }; -struct hns3_misc_vector { - uint8_t *addr; - int vector_irq; -}; - struct hns3_cmq { struct hns3_cmq_ring csq; struct hns3_cmq_ring crq; @@ -397,20 +392,6 @@ struct hns3_pkt_buf_alloc { struct hns3_shared_buf s_buf; }; -#define HNS3_RX_COM_WL_EN_B 15 -struct hns3_rx_com_wl_buf_cmd { - uint16_t high_wl; - uint16_t low_wl; - uint8_t rsv[20]; -}; - -#define HNS3_RX_PKT_EN_B 15 -struct hns3_rx_pkt_buf_cmd { - uint16_t high_pkt; - uint16_t low_pkt; - uint8_t rsv[20]; -}; - #define HNS3_PF_STATE_DONE_B 0 #define HNS3_PF_STATE_MAIN_B 1 #define HNS3_PF_STATE_BOND_B 2 diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h index 6cae5f8634..76b48fa994 100644 --- a/drivers/net/hns3/hns3_rss.h +++ b/drivers/net/hns3/hns3_rss.h @@ -34,10 +34,6 @@ #define HNS3_RSS_HASH_ALGO_SYMMETRIC_TOEP 2 #define HNS3_RSS_HASH_ALGO_MASK 0xf -struct hns3_rss_tuple_cfg { - uint64_t rss_tuple_fields; -}; - #define HNS3_RSS_QUEUES_BUFFER_NUM 64 /* Same as the Max rx/tx queue num */ struct hns3_rss_conf { /* RSS parameters :algorithm, flow_types, key, queue */ From patchwork Fri Sep 30 07:22:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117187 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DCCD0A034C; Fri, 30 Sep 2022 09:25:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 58D9542BB7; Fri, 30 Sep 2022 09:24:20 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 1D9BE42B92; Fri, 30 Sep 2022 09:24:16 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Mf1p41JKhz1P70d; Fri, 30 Sep 2022 15:19:56 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:14 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 12/19] net/hns3: do not use reserved identifier macro Date: Fri, 30 Sep 2022 15:22:13 +0800 Message-ID: <20220930072220.20753-13-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Chengwen Feng Currently, the hns3 driver uses _HNS3_XXX conditional compilation macros to prevent duplicate header files. But in the C11 standard, all identifiers starting with an underscore plus an uppercase letter are always reserved. So this patch fixes it. Signed-off-by: Chengwen Feng Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_cmd.h | 6 +++--- drivers/net/hns3/hns3_common.h | 6 +++--- drivers/net/hns3/hns3_dcb.h | 6 +++--- drivers/net/hns3/hns3_dump.h | 6 +++--- drivers/net/hns3/hns3_ethdev.h | 6 +++--- drivers/net/hns3/hns3_fdir.h | 6 +++--- drivers/net/hns3/hns3_flow.h | 6 +++--- drivers/net/hns3/hns3_intr.h | 6 +++--- drivers/net/hns3/hns3_logs.h | 6 +++--- drivers/net/hns3/hns3_mbx.h | 6 +++--- drivers/net/hns3/hns3_mp.h | 6 +++--- drivers/net/hns3/hns3_regs.h | 6 +++--- drivers/net/hns3/hns3_rss.h | 6 +++--- drivers/net/hns3/hns3_rxtx.h | 6 +++--- drivers/net/hns3/hns3_rxtx_vec.h | 6 +++--- drivers/net/hns3/hns3_rxtx_vec_neon.h | 6 +++--- drivers/net/hns3/hns3_stats.h | 6 +++--- drivers/net/hns3/hns3_tm.h | 6 +++--- 18 files changed, 54 insertions(+), 54 deletions(-) diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h index 902638ba99..8ac8b45819 100644 --- a/drivers/net/hns3/hns3_cmd.h +++ b/drivers/net/hns3/hns3_cmd.h @@ -2,8 +2,8 @@ * Copyright(c) 2018-2021 HiSilicon Limited. */ -#ifndef _HNS3_CMD_H_ -#define _HNS3_CMD_H_ +#ifndef HNS3_CMD_H +#define HNS3_CMD_H #include @@ -1038,4 +1038,4 @@ int hns3_cmd_init(struct hns3_hw *hw); void hns3_cmd_destroy_queue(struct hns3_hw *hw); void hns3_cmd_uninit(struct hns3_hw *hw); -#endif /* _HNS3_CMD_H_ */ +#endif /* HNS3_CMD_H */ diff --git a/drivers/net/hns3/hns3_common.h b/drivers/net/hns3/hns3_common.h index 2994e4a269..5aa001f0cc 100644 --- a/drivers/net/hns3/hns3_common.h +++ b/drivers/net/hns3/hns3_common.h @@ -2,8 +2,8 @@ * Copyright(C) 2021 HiSilicon Limited */ -#ifndef _HNS3_COMMON_H_ -#define _HNS3_COMMON_H_ +#ifndef HNS3_COMMON_H +#define HNS3_COMMON_H #include @@ -61,4 +61,4 @@ int hns3_restore_rx_interrupt(struct hns3_hw *hw); int hns3_get_pci_revision_id(struct hns3_hw *hw, uint8_t *revision_id); -#endif /* _HNS3_COMMON_H_ */ +#endif /* HNS3_COMMON_H */ diff --git a/drivers/net/hns3/hns3_dcb.h b/drivers/net/hns3/hns3_dcb.h index 9d9e7684c1..d5bb5edf4d 100644 --- a/drivers/net/hns3/hns3_dcb.h +++ b/drivers/net/hns3/hns3_dcb.h @@ -2,8 +2,8 @@ * Copyright(c) 2018-2021 HiSilicon Limited. */ -#ifndef _HNS3_DCB_H_ -#define _HNS3_DCB_H_ +#ifndef HNS3_DCB_H +#define HNS3_DCB_H #include @@ -215,4 +215,4 @@ int hns3_update_queue_map_configure(struct hns3_adapter *hns); int hns3_port_shaper_update(struct hns3_hw *hw, uint32_t speed); uint8_t hns3_txq_mapped_tc_get(struct hns3_hw *hw, uint16_t txq_no); -#endif /* _HNS3_DCB_H_ */ +#endif /* HNS3_DCB_H */ diff --git a/drivers/net/hns3/hns3_dump.h b/drivers/net/hns3/hns3_dump.h index b0fe37ee21..43e983a42f 100644 --- a/drivers/net/hns3/hns3_dump.h +++ b/drivers/net/hns3/hns3_dump.h @@ -2,12 +2,12 @@ * Copyright(C) 2022 HiSilicon Limited */ -#ifndef _HNS3_DUMP_H_ -#define _HNS3_DUMP_H_ +#ifndef HNS3_DUMP_H +#define HNS3_DUMP_H #include #include int hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file); -#endif /* _HNS3_DUMP_H_ */ +#endif /* HNS3_DUMP_H */ diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index bd5fc689f8..9fe9766736 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -2,8 +2,8 @@ * Copyright(c) 2018-2021 HiSilicon Limited. */ -#ifndef _HNS3_ETHDEV_H_ -#define _HNS3_ETHDEV_H_ +#ifndef HNS3_ETHDEV_H +#define HNS3_ETHDEV_H #include #include @@ -1074,4 +1074,4 @@ is_reset_pending(struct hns3_adapter *hns) return ret; } -#endif /* _HNS3_ETHDEV_H_ */ +#endif /* HNS3_ETHDEV_H */ diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h index 1a14f1eceb..ce70a534dc 100644 --- a/drivers/net/hns3/hns3_fdir.h +++ b/drivers/net/hns3/hns3_fdir.h @@ -2,8 +2,8 @@ * Copyright(c) 2018-2021 HiSilicon Limited. */ -#ifndef _HNS3_FDIR_H_ -#define _HNS3_FDIR_H_ +#ifndef HNS3_FDIR_H +#define HNS3_FDIR_H #include @@ -192,4 +192,4 @@ int hns3_clear_all_fdir_filter(struct hns3_adapter *hns); int hns3_fd_get_count(struct hns3_hw *hw, uint32_t id, uint64_t *value); int hns3_restore_all_fdir_filter(struct hns3_adapter *hns); -#endif /* _HNS3_FDIR_H_ */ +#endif /* HNS3_FDIR_H */ diff --git a/drivers/net/hns3/hns3_flow.h b/drivers/net/hns3/hns3_flow.h index ec94510152..e4b2fdf2e6 100644 --- a/drivers/net/hns3/hns3_flow.h +++ b/drivers/net/hns3/hns3_flow.h @@ -2,8 +2,8 @@ * Copyright(C) 2021 HiSilicon Limited */ -#ifndef _HNS3_FLOW_H_ -#define _HNS3_FLOW_H_ +#ifndef HNS3_FLOW_H +#define HNS3_FLOW_H #include #include @@ -54,4 +54,4 @@ void hns3_flow_init(struct rte_eth_dev *dev); void hns3_flow_uninit(struct rte_eth_dev *dev); int hns3_restore_filter(struct hns3_adapter *hns); -#endif /* _HNS3_FLOW_H_ */ +#endif /* HNS3_FLOW_H */ diff --git a/drivers/net/hns3/hns3_intr.h b/drivers/net/hns3/hns3_intr.h index 1490a5e387..aca1c0722c 100644 --- a/drivers/net/hns3/hns3_intr.h +++ b/drivers/net/hns3/hns3_intr.h @@ -2,8 +2,8 @@ * Copyright(c) 2018-2021 HiSilicon Limited. */ -#ifndef _HNS3_INTR_H_ -#define _HNS3_INTR_H_ +#ifndef HNS3_INTR_H +#define HNS3_INTR_H #include @@ -190,4 +190,4 @@ void hns3_reset_abort(struct hns3_adapter *hns); void hns3_start_report_lse(struct rte_eth_dev *dev); void hns3_stop_report_lse(struct rte_eth_dev *dev); -#endif /* _HNS3_INTR_H_ */ +#endif /* HNS3_INTR_H */ diff --git a/drivers/net/hns3/hns3_logs.h b/drivers/net/hns3/hns3_logs.h index 072a53bd69..c880f752ab 100644 --- a/drivers/net/hns3/hns3_logs.h +++ b/drivers/net/hns3/hns3_logs.h @@ -2,8 +2,8 @@ * Copyright(c) 2018-2021 HiSilicon Limited. */ -#ifndef _HNS3_LOGS_H_ -#define _HNS3_LOGS_H_ +#ifndef HNS3_LOGS_H +#define HNS3_LOGS_H extern int hns3_logtype_init; #define PMD_INIT_LOG(level, fmt, args...) \ @@ -31,4 +31,4 @@ extern int hns3_logtype_driver; #define hns3_dbg(hw, fmt, args...) \ PMD_DRV_LOG_RAW(hw, RTE_LOG_DEBUG, fmt "\n", ## args) -#endif /* _HNS3_LOGS_H_ */ +#endif /* HNS3_LOGS_H */ diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h index 97f704426c..c378783c6c 100644 --- a/drivers/net/hns3/hns3_mbx.h +++ b/drivers/net/hns3/hns3_mbx.h @@ -2,8 +2,8 @@ * Copyright(c) 2018-2021 HiSilicon Limited. */ -#ifndef _HNS3_MBX_H_ -#define _HNS3_MBX_H_ +#ifndef HNS3_MBX_H +#define HNS3_MBX_H #include @@ -172,4 +172,4 @@ void hns3_dev_handle_mbx_msg(struct hns3_hw *hw); int hns3_send_mbx_msg(struct hns3_hw *hw, uint16_t code, uint16_t subcode, const uint8_t *msg_data, uint8_t msg_len, bool need_resp, uint8_t *resp_data, uint16_t resp_len); -#endif /* _HNS3_MBX_H_ */ +#endif /* HNS3_MBX_H */ diff --git a/drivers/net/hns3/hns3_mp.h b/drivers/net/hns3/hns3_mp.h index 230230bbfe..5dc32a41d4 100644 --- a/drivers/net/hns3/hns3_mp.h +++ b/drivers/net/hns3/hns3_mp.h @@ -2,8 +2,8 @@ * Copyright(c) 2018-2021 HiSilicon Limited. */ -#ifndef _HNS3_MP_H_ -#define _HNS3_MP_H_ +#ifndef HNS3_MP_H +#define HNS3_MP_H #include @@ -21,4 +21,4 @@ void hns3_mp_req_stop_tx(struct rte_eth_dev *dev); int hns3_mp_init(struct rte_eth_dev *dev); void hns3_mp_uninit(struct rte_eth_dev *dev); -#endif /* _HNS3_MP_H_ */ +#endif /* HNS3_MP_H */ diff --git a/drivers/net/hns3/hns3_regs.h b/drivers/net/hns3/hns3_regs.h index 2636429844..459bbaf773 100644 --- a/drivers/net/hns3/hns3_regs.h +++ b/drivers/net/hns3/hns3_regs.h @@ -2,8 +2,8 @@ * Copyright(c) 2018-2021 HiSilicon Limited. */ -#ifndef _HNS3_REGS_H_ -#define _HNS3_REGS_H_ +#ifndef HNS3_REGS_H +#define HNS3_REGS_H #include #include @@ -153,4 +153,4 @@ #define HNS3_RL_USEC_TO_REG(rl_usec) ((rl_usec) >> 2) int hns3_get_regs(struct rte_eth_dev *eth_dev, struct rte_dev_reg_info *regs); -#endif /* _HNS3_REGS_H_ */ +#endif /* HNS3_REGS_H */ diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h index 76b48fa994..55aafedcba 100644 --- a/drivers/net/hns3/hns3_rss.h +++ b/drivers/net/hns3/hns3_rss.h @@ -2,8 +2,8 @@ * Copyright(c) 2018-2021 HiSilicon Limited. */ -#ifndef _HNS3_RSS_H_ -#define _HNS3_RSS_H_ +#ifndef HNS3_RSS_H +#define HNS3_RSS_H #include #include @@ -109,4 +109,4 @@ void hns3_rss_uninit(struct hns3_adapter *hns); int hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, uint64_t rss_hf); int hns3_rss_set_algo_key(struct hns3_hw *hw, const uint8_t *key); -#endif /* _HNS3_RSS_H_ */ +#endif /* HNS3_RSS_H */ diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h index f2d73043b7..ea1a805491 100644 --- a/drivers/net/hns3/hns3_rxtx.h +++ b/drivers/net/hns3/hns3_rxtx.h @@ -2,8 +2,8 @@ * Copyright(c) 2018-2021 HiSilicon Limited. */ -#ifndef _HNS3_RXTX_H_ -#define _HNS3_RXTX_H_ +#ifndef HNS3_RXTX_H +#define HNS3_RXTX_H #include @@ -777,4 +777,4 @@ void hns3_tx_push_init(struct rte_eth_dev *dev); void hns3_stop_tx_datapath(struct rte_eth_dev *dev); void hns3_start_tx_datapath(struct rte_eth_dev *dev); -#endif /* _HNS3_RXTX_H_ */ +#endif /* HNS3_RXTX_H */ diff --git a/drivers/net/hns3/hns3_rxtx_vec.h b/drivers/net/hns3/hns3_rxtx_vec.h index d13f18627d..2c8a91921e 100644 --- a/drivers/net/hns3/hns3_rxtx_vec.h +++ b/drivers/net/hns3/hns3_rxtx_vec.h @@ -2,8 +2,8 @@ * Copyright(c) 2020-2021 HiSilicon Limited. */ -#ifndef _HNS3_RXTX_VEC_H_ -#define _HNS3_RXTX_VEC_H_ +#ifndef HNS3_RXTX_VEC_H +#define HNS3_RXTX_VEC_H #include "hns3_rxtx.h" #include "hns3_ethdev.h" @@ -94,4 +94,4 @@ hns3_rx_reassemble_pkts(struct rte_mbuf **rx_pkts, return count; } -#endif /* _HNS3_RXTX_VEC_H_ */ +#endif /* HNS3_RXTX_VEC_H */ diff --git a/drivers/net/hns3/hns3_rxtx_vec_neon.h b/drivers/net/hns3/hns3_rxtx_vec_neon.h index 0edd4756f1..55d9bf817d 100644 --- a/drivers/net/hns3/hns3_rxtx_vec_neon.h +++ b/drivers/net/hns3/hns3_rxtx_vec_neon.h @@ -2,8 +2,8 @@ * Copyright(c) 2020-2021 HiSilicon Limited. */ -#ifndef _HNS3_RXTX_VEC_NEON_H_ -#define _HNS3_RXTX_VEC_NEON_H_ +#ifndef HNS3_RXTX_VEC_NEON_H +#define HNS3_RXTX_VEC_NEON_H #include @@ -299,4 +299,4 @@ hns3_recv_burst_vec(struct hns3_rx_queue *__restrict rxq, return nb_rx; } -#endif /* _HNS3_RXTX_VEC_NEON_H_ */ +#endif /* HNS3_RXTX_VEC_NEON_H */ diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h index 9a360f8870..74bc4173cc 100644 --- a/drivers/net/hns3/hns3_stats.h +++ b/drivers/net/hns3/hns3_stats.h @@ -2,8 +2,8 @@ * Copyright(c) 2018-2021 HiSilicon Limited. */ -#ifndef _HNS3_STATS_H_ -#define _HNS3_STATS_H_ +#ifndef HNS3_STATS_H +#define HNS3_STATS_H #include #include @@ -172,4 +172,4 @@ void hns3_stats_uninit(struct hns3_hw *hw); int hns3_query_mac_stats_reg_num(struct hns3_hw *hw); void hns3_update_hw_stats(struct hns3_hw *hw); -#endif /* _HNS3_STATS_H_ */ +#endif /* HNS3_STATS_H */ diff --git a/drivers/net/hns3/hns3_tm.h b/drivers/net/hns3/hns3_tm.h index 47345eeed1..0cac1a5bb2 100644 --- a/drivers/net/hns3/hns3_tm.h +++ b/drivers/net/hns3/hns3_tm.h @@ -2,8 +2,8 @@ * Copyright(c) 2020-2021 HiSilicon Limited. */ -#ifndef _HNS3_TM_H_ -#define _HNS3_TM_H_ +#ifndef HNS3_TM_H +#define HNS3_TM_H #include #include @@ -114,4 +114,4 @@ void hns3_tm_dev_start_proc(struct hns3_hw *hw); void hns3_tm_dev_stop_proc(struct hns3_hw *hw); int hns3_tm_conf_update(struct hns3_hw *hw); -#endif /* _HNS3_TM_H */ +#endif /* HNS3_TM_H */ From patchwork Fri Sep 30 07:22:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117188 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1A175A034C; Fri, 30 Sep 2022 09:25:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7E31D42BC0; Fri, 30 Sep 2022 09:24:21 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 85C3842B8E; Fri, 30 Sep 2022 09:24:16 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Mf1p41tCPzlXQw; Fri, 30 Sep 2022 15:19:56 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:14 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 13/19] net/hns3: fix fail to enable IPV4 or IPV6 packet RSS Date: Fri, 30 Sep 2022 15:22:14 +0800 Message-ID: <20220930072220.20753-14-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li Currently, hns3 driver use 'ipv4-other' and 'ipv6-other' as the flag of IP packets to judge if enable RSS tuple field. But user may use 'RTE_ETH_RSS_IPV4' or 'RTE_ETH_RSS_IPV6' as the flag. So this patch adds the processing of these macros. Fixes: 806f1d5ab0e3 ("net/hns3: set RSS hash type input configuration") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_rss.c | 14 ++++++++++++++ drivers/net/hns3/hns3_rss.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c index fc912ed2e8..e7e114727f 100644 --- a/drivers/net/hns3/hns3_rss.c +++ b/drivers/net/hns3/hns3_rss.c @@ -102,6 +102,10 @@ static const struct { BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_S) }, { RTE_ETH_RSS_NONFRAG_IPV4_SCTP | RTE_ETH_RSS_L4_DST_ONLY, BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_D) }, + { RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_L3_SRC_ONLY, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) }, + { RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_L3_DST_ONLY, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, { RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_L3_SRC_ONLY, BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) }, { RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_L3_DST_ONLY, @@ -134,6 +138,10 @@ static const struct { BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_S) }, { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L4_DST_ONLY, BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_D) }, + { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_SRC_ONLY, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) }, + { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_DST_ONLY, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, { RTE_ETH_RSS_NONFRAG_IPV6_OTHER | RTE_ETH_RSS_L3_SRC_ONLY, BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) }, { RTE_ETH_RSS_NONFRAG_IPV6_OTHER | RTE_ETH_RSS_L3_DST_ONLY, @@ -159,6 +167,9 @@ static const struct { BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_S) | BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_D) | BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_VER) }, + { RTE_ETH_RSS_IPV4, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, { RTE_ETH_RSS_NONFRAG_IPV4_OTHER, BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) | BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, @@ -177,6 +188,9 @@ static const struct { BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_D) | BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_S) | BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_VER) }, + { RTE_ETH_RSS_IPV6, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, { RTE_ETH_RSS_NONFRAG_IPV6_OTHER, BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) | BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) } diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h index 55aafedcba..8e8b056f4e 100644 --- a/drivers/net/hns3/hns3_rss.h +++ b/drivers/net/hns3/hns3_rss.h @@ -9,11 +9,13 @@ #include #define HNS3_ETH_RSS_SUPPORT ( \ + RTE_ETH_RSS_IPV4 | \ RTE_ETH_RSS_FRAG_IPV4 | \ RTE_ETH_RSS_NONFRAG_IPV4_TCP | \ RTE_ETH_RSS_NONFRAG_IPV4_UDP | \ RTE_ETH_RSS_NONFRAG_IPV4_SCTP | \ RTE_ETH_RSS_NONFRAG_IPV4_OTHER | \ + RTE_ETH_RSS_IPV6 | \ RTE_ETH_RSS_FRAG_IPV6 | \ RTE_ETH_RSS_NONFRAG_IPV6_TCP | \ RTE_ETH_RSS_NONFRAG_IPV6_UDP | \ From patchwork Fri Sep 30 07:22:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117189 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D0D57A034C; Fri, 30 Sep 2022 09:25:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 90DA442BC8; Fri, 30 Sep 2022 09:24:22 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 17A3B42B80; Fri, 30 Sep 2022 09:24:17 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mf1nV20lQzHtnW; Fri, 30 Sep 2022 15:19:26 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:15 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 14/19] net/hns3: fix some spelling errors Date: Fri, 30 Sep 2022 15:22:15 +0800 Message-ID: <20220930072220.20753-15-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li This patch fixes spelling errors about IPV6-SCTP macro. Fixes: 1bc633c34008 ("net/hns3: enable RSS for IPv6-SCTP dst/src port fields") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_rss.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c index e7e114727f..6d71ee94a9 100644 --- a/drivers/net/hns3/hns3_rss.c +++ b/drivers/net/hns3/hns3_rss.c @@ -57,8 +57,8 @@ enum hns3_tuple_field { HNS3_RSS_FIELD_IPV6_UDP_EN_IP_S, /* IPV6_SCTP ENABLE FIELD */ - HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_D = 48, - HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_S, + HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_D = 48, + HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_S, HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D, HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S, HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_VER, @@ -135,9 +135,9 @@ static const struct { { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L3_DST_ONLY, BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D) }, { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L4_SRC_ONLY, - BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_S) }, + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_S) }, { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L4_DST_ONLY, - BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_D) }, + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_D) }, { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_SRC_ONLY, BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) }, { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_DST_ONLY, @@ -185,8 +185,8 @@ static const struct { BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_UDP_D) }, { RTE_ETH_RSS_NONFRAG_IPV6_SCTP, BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S) | BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D) | - BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_D) | - BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_D) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_S) | BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_VER) }, { RTE_ETH_RSS_IPV6, BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) | From patchwork Fri Sep 30 07:22:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117191 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 99E56A0540; Fri, 30 Sep 2022 09:25:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9090642BC3; Fri, 30 Sep 2022 09:24:26 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 0F2ED42BAC; Fri, 30 Sep 2022 09:24:22 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Mf1qk2t1fzpVMf; Fri, 30 Sep 2022 15:21:22 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:20 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 15/19] net/hns3: fix inconsistent RSS behavior Date: Fri, 30 Sep 2022 15:22:16 +0800 Message-ID: <20220930072220.20753-16-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li When user only use 'ipv4' to set 'rss_hf', hns3 will enable all tuple fields for 'ipv4' flow. But if user use 'ipv4-tcp' , 'ipv4' and 'l4-src-only' to set 'rss_hf', driver does not enable all tuple fields for 'ipv4' flow. So this patch fixes this problem. Fixes: 806f1d5ab0e3 ("net/hns3: set RSS hash type input configuration") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_rss.c | 266 ++++++++++++++++++++++++------------ 1 file changed, 176 insertions(+), 90 deletions(-) diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c index 6d71ee94a9..ea745c791f 100644 --- a/drivers/net/hns3/hns3_rss.c +++ b/drivers/net/hns3/hns3_rss.c @@ -70,130 +70,209 @@ enum hns3_tuple_field { HNS3_RSS_FIELD_IPV6_FRAG_IP_S }; +enum hns3_rss_tuple_type { + HNS3_RSS_IP_TUPLE, + HNS3_RSS_IP_L4_TUPLE, +}; + static const struct { uint64_t rss_types; + uint16_t tuple_type; uint64_t rss_field; } hns3_set_tuple_table[] = { + /* IPV4-FRAG */ { RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_L3_SRC_ONLY, + HNS3_RSS_IP_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_S) }, { RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_L3_DST_ONLY, + HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_D) }, + { RTE_ETH_RSS_FRAG_IPV4, + HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_S) | BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_D) }, + + /* IPV4 */ + { RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_L3_SRC_ONLY, + HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) }, + { RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_L3_DST_ONLY, + HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, + { RTE_ETH_RSS_IPV4, + HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, + + /* IPV4-OTHER */ + { RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_L3_SRC_ONLY, + HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_L3_DST_ONLY, + HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV4_OTHER, + HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, + + /* IPV4-TCP */ { RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_L3_SRC_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_IP_S) }, { RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_L3_DST_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_IP_D) }, { RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_L4_SRC_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_TCP_S) }, { RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_L4_DST_ONLY, + HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_TCP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV4_TCP, + HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_IP_D) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_TCP_S) | BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_TCP_D) }, + + /* IPV4-UDP */ { RTE_ETH_RSS_NONFRAG_IPV4_UDP | RTE_ETH_RSS_L3_SRC_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_IP_S) }, { RTE_ETH_RSS_NONFRAG_IPV4_UDP | RTE_ETH_RSS_L3_DST_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_IP_D) }, { RTE_ETH_RSS_NONFRAG_IPV4_UDP | RTE_ETH_RSS_L4_SRC_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_UDP_S) }, { RTE_ETH_RSS_NONFRAG_IPV4_UDP | RTE_ETH_RSS_L4_DST_ONLY, + HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_UDP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV4_UDP, + HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_IP_D) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_UDP_S) | BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_UDP_D) }, + + /* IPV4-SCTP */ { RTE_ETH_RSS_NONFRAG_IPV4_SCTP | RTE_ETH_RSS_L3_SRC_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_IP_S) }, { RTE_ETH_RSS_NONFRAG_IPV4_SCTP | RTE_ETH_RSS_L3_DST_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_IP_D) }, { RTE_ETH_RSS_NONFRAG_IPV4_SCTP | RTE_ETH_RSS_L4_SRC_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_S) }, { RTE_ETH_RSS_NONFRAG_IPV4_SCTP | RTE_ETH_RSS_L4_DST_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_D) }, - { RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_L3_SRC_ONLY, - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) }, - { RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_L3_DST_ONLY, - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, - { RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_L3_SRC_ONLY, - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) }, - { RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_L3_DST_ONLY, - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV4_SCTP, + HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_IP_D) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_D) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_VER) }, + + /* IPV6-FRAG */ { RTE_ETH_RSS_FRAG_IPV6 | RTE_ETH_RSS_L3_SRC_ONLY, + HNS3_RSS_IP_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_S) }, { RTE_ETH_RSS_FRAG_IPV6 | RTE_ETH_RSS_L3_DST_ONLY, + HNS3_RSS_IP_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_D) }, + { RTE_ETH_RSS_FRAG_IPV6, + HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_D) }, + + /* IPV6 */ + { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_SRC_ONLY, + HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) }, + { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_DST_ONLY, + HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, + { RTE_ETH_RSS_IPV6, + HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, + + /* IPV6-OTHER */ + { RTE_ETH_RSS_NONFRAG_IPV6_OTHER | RTE_ETH_RSS_L3_SRC_ONLY, + HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV6_OTHER | RTE_ETH_RSS_L3_DST_ONLY, + HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV6_OTHER, + HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, + + /* IPV6-TCP */ { RTE_ETH_RSS_NONFRAG_IPV6_TCP | RTE_ETH_RSS_L3_SRC_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_IP_S) }, { RTE_ETH_RSS_NONFRAG_IPV6_TCP | RTE_ETH_RSS_L3_DST_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_IP_D) }, { RTE_ETH_RSS_NONFRAG_IPV6_TCP | RTE_ETH_RSS_L4_SRC_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_TCP_S) }, { RTE_ETH_RSS_NONFRAG_IPV6_TCP | RTE_ETH_RSS_L4_DST_ONLY, + HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_TCP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV6_TCP, + HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_IP_D) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_TCP_S) | BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_TCP_D) }, + + /* IPV6-UDP */ { RTE_ETH_RSS_NONFRAG_IPV6_UDP | RTE_ETH_RSS_L3_SRC_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_IP_S) }, { RTE_ETH_RSS_NONFRAG_IPV6_UDP | RTE_ETH_RSS_L3_DST_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_IP_D) }, { RTE_ETH_RSS_NONFRAG_IPV6_UDP | RTE_ETH_RSS_L4_SRC_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_UDP_S) }, { RTE_ETH_RSS_NONFRAG_IPV6_UDP | RTE_ETH_RSS_L4_DST_ONLY, + HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_UDP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV6_UDP, + HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_IP_D) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_UDP_S) | BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_UDP_D) }, + + /* IPV6-SCTP */ { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L3_SRC_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S) }, { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L3_DST_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D) }, { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L4_SRC_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_S) }, { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L4_DST_ONLY, + HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_D) }, - { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_SRC_ONLY, - BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) }, - { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_DST_ONLY, - BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, - { RTE_ETH_RSS_NONFRAG_IPV6_OTHER | RTE_ETH_RSS_L3_SRC_ONLY, - BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) }, - { RTE_ETH_RSS_NONFRAG_IPV6_OTHER | RTE_ETH_RSS_L3_DST_ONLY, - BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, -}; - -static const struct { - uint64_t rss_types; - uint64_t rss_field; -} hns3_set_rss_types[] = { - { RTE_ETH_RSS_FRAG_IPV4, BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_D) | - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_S) }, - { RTE_ETH_RSS_NONFRAG_IPV4_TCP, BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_IP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_IP_D) | - BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_TCP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_TCP_D) }, - { RTE_ETH_RSS_NONFRAG_IPV4_UDP, BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_IP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_IP_D) | - BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_UDP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_UDP_D) }, - { RTE_ETH_RSS_NONFRAG_IPV4_SCTP, BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_IP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_IP_D) | - BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_D) | - BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_VER) }, - { RTE_ETH_RSS_IPV4, - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, - { RTE_ETH_RSS_NONFRAG_IPV4_OTHER, - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, - { RTE_ETH_RSS_FRAG_IPV6, BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_D) }, - { RTE_ETH_RSS_NONFRAG_IPV6_TCP, BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_IP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_IP_D) | - BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_TCP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_TCP_D) }, - { RTE_ETH_RSS_NONFRAG_IPV6_UDP, BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_IP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_IP_D) | - BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_UDP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_UDP_D) }, - { RTE_ETH_RSS_NONFRAG_IPV6_SCTP, BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S) | + { RTE_ETH_RSS_NONFRAG_IPV6_SCTP, + HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S) | BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D) | BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_D) | BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_S) | BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_VER) }, - { RTE_ETH_RSS_IPV6, - BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, - { RTE_ETH_RSS_NONFRAG_IPV6_OTHER, - BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) } }; /* @@ -321,46 +400,53 @@ hns3_rss_reset_indir_table(struct hns3_hw *hw) return ret; } +static uint64_t +hns3_rss_calc_tuple_filed(uint64_t rss_hf) +{ + uint64_t l3_only_mask = RTE_ETH_RSS_L3_SRC_ONLY | + RTE_ETH_RSS_L3_DST_ONLY; + uint64_t l4_only_mask = RTE_ETH_RSS_L4_SRC_ONLY | + RTE_ETH_RSS_L4_DST_ONLY; + uint64_t l3_l4_only_mask = l3_only_mask | l4_only_mask; + bool has_l3_l4_only = !!(rss_hf & l3_l4_only_mask); + bool has_l3_only = !!(rss_hf & l3_only_mask); + uint64_t tuple = 0; + uint32_t i; + + for (i = 0; i < RTE_DIM(hns3_set_tuple_table); i++) { + if ((rss_hf & hns3_set_tuple_table[i].rss_types) != + hns3_set_tuple_table[i].rss_types) + continue; + + if (hns3_set_tuple_table[i].tuple_type == HNS3_RSS_IP_TUPLE) { + if (hns3_set_tuple_table[i].rss_types & l3_only_mask || + !has_l3_only) + tuple |= hns3_set_tuple_table[i].rss_field; + continue; + } + + /* For IP types with L4, we need check both L3 and L4 */ + if (hns3_set_tuple_table[i].rss_types & l3_l4_only_mask || + !has_l3_l4_only) + tuple |= hns3_set_tuple_table[i].rss_field; + } + + return tuple; +} + int hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, uint64_t rss_hf) { struct hns3_rss_input_tuple_cmd *req; struct hns3_cmd_desc desc; - uint32_t fields_count = 0; /* count times for setting tuple fields */ - uint32_t i; + uint64_t tuple_field; int ret; hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_INPUT_TUPLE, false); - req = (struct hns3_rss_input_tuple_cmd *)desc.data; - for (i = 0; i < RTE_DIM(hns3_set_tuple_table); i++) { - if ((rss_hf & hns3_set_tuple_table[i].rss_types) == - hns3_set_tuple_table[i].rss_types) { - req->tuple_field |= - rte_cpu_to_le_64(hns3_set_tuple_table[i].rss_field); - fields_count++; - } - } - - /* - * When user does not specify the following types or a combination of - * the following types, it enables all fields for the supported RSS - * types. the following types as: - * - RTE_ETH_RSS_L3_SRC_ONLY - * - RTE_ETH_RSS_L3_DST_ONLY - * - RTE_ETH_RSS_L4_SRC_ONLY - * - RTE_ETH_RSS_L4_DST_ONLY - */ - if (fields_count == 0) { - for (i = 0; i < RTE_DIM(hns3_set_rss_types); i++) { - if ((rss_hf & hns3_set_rss_types[i].rss_types) == - hns3_set_rss_types[i].rss_types) - req->tuple_field |= rte_cpu_to_le_64( - hns3_set_rss_types[i].rss_field); - } - } - + tuple_field = hns3_rss_calc_tuple_filed(rss_hf); + req->tuple_field = rte_cpu_to_le_64(tuple_field); ret = hns3_cmd_send(hw, &desc, 1); if (ret) { hns3_err(hw, "Update RSS flow types tuples failed %d", ret); From patchwork Fri Sep 30 07:22:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117190 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E64CDA034C; Fri, 30 Sep 2022 09:25:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F5CB42B84; Fri, 30 Sep 2022 09:24:25 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 920F042BC9; Fri, 30 Sep 2022 09:24:22 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mf1pN2lt6zVhk0; Fri, 30 Sep 2022 15:20:12 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:20 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 16/19] net/hns3: add check for L3 and L4 type Date: Fri, 30 Sep 2022 15:22:17 +0800 Message-ID: <20220930072220.20753-17-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li When user set 'L3_SRC/DST_ONLY' or 'L4_SRC/DST_ONLY' to 'rss_hf' and do not specify the packet type, these types will be set to hardware. So this patch adds a check for them. Fixes: 806f1d5ab0e3 ("net/hns3: set RSS hash type input configuration") Cc: stable@dpdk.org Signed-off-by: Huisong Li --- drivers/net/hns3/hns3_rss.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c index ea745c791f..ca5a129234 100644 --- a/drivers/net/hns3/hns3_rss.c +++ b/drivers/net/hns3/hns3_rss.c @@ -400,8 +400,34 @@ hns3_rss_reset_indir_table(struct hns3_hw *hw) return ret; } +static void +hns3_rss_check_l3l4_types(struct hns3_hw *hw, uint64_t rss_hf) +{ + uint64_t ip_mask = RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_FRAG_IPV4 | + RTE_ETH_RSS_NONFRAG_IPV4_OTHER | + RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_FRAG_IPV6 | + RTE_ETH_RSS_NONFRAG_IPV6_OTHER; + uint64_t l4_mask = RTE_ETH_RSS_NONFRAG_IPV4_TCP | + RTE_ETH_RSS_NONFRAG_IPV4_UDP | + RTE_ETH_RSS_NONFRAG_IPV4_SCTP | + RTE_ETH_RSS_NONFRAG_IPV6_TCP | + RTE_ETH_RSS_NONFRAG_IPV6_UDP | + RTE_ETH_RSS_NONFRAG_IPV6_SCTP; + uint64_t l3_src_dst_mask = RTE_ETH_RSS_L3_SRC_ONLY | + RTE_ETH_RSS_L3_DST_ONLY; + uint64_t l4_src_dst_mask = RTE_ETH_RSS_L4_SRC_ONLY | + RTE_ETH_RSS_L4_DST_ONLY; + + if (rss_hf & l3_src_dst_mask && + !(rss_hf & ip_mask || rss_hf & l4_mask)) + hns3_warn(hw, "packet type isn't specified, L3_SRC/DST_ONLY is ignored."); + + if (rss_hf & l4_src_dst_mask && !(rss_hf & l4_mask)) + hns3_warn(hw, "packet type isn't specified, L4_SRC/DST_ONLY is ignored."); +} + static uint64_t -hns3_rss_calc_tuple_filed(uint64_t rss_hf) +hns3_rss_calc_tuple_filed(struct hns3_hw *hw, uint64_t rss_hf) { uint64_t l3_only_mask = RTE_ETH_RSS_L3_SRC_ONLY | RTE_ETH_RSS_L3_DST_ONLY; @@ -430,6 +456,7 @@ hns3_rss_calc_tuple_filed(uint64_t rss_hf) !has_l3_l4_only) tuple |= hns3_set_tuple_table[i].rss_field; } + hns3_rss_check_l3l4_types(hw, rss_hf); return tuple; } @@ -445,7 +472,7 @@ hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, uint64_t rss_hf) hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_INPUT_TUPLE, false); req = (struct hns3_rss_input_tuple_cmd *)desc.data; - tuple_field = hns3_rss_calc_tuple_filed(rss_hf); + tuple_field = hns3_rss_calc_tuple_filed(hw, rss_hf); req->tuple_field = rte_cpu_to_le_64(tuple_field); ret = hns3_cmd_send(hw, &desc, 1); if (ret) { From patchwork Fri Sep 30 07:22:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117192 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 23E42A034C; Fri, 30 Sep 2022 09:25:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D03FE42BD7; Fri, 30 Sep 2022 09:24:27 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id AF19642B84; Fri, 30 Sep 2022 09:24:22 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mf1pN458kzVhkP; Fri, 30 Sep 2022 15:20:12 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:20 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 17/19] net/hns3: revert fix mailbox communication with HW Date: Fri, 30 Sep 2022 15:22:18 +0800 Message-ID: <20220930072220.20753-18-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Chengwen Feng VF's command receive queue was mainly used to receive mailbox messages from PF. There are two type mailbox messages: request response message and message pushed by PF. There are two types of threads that can handle these messages: 1) the interrupt thread of the main process: it could handle both types of messages. 2) other threads: it could only handle request response messages. The collaboration mechanism between the two type threads is that other threads set the opcode of processed messages to zero so that the interrupt thread of the main process does not process these messages again. Because other threads can only process part of the messages, after the processing is complete, the next-to-use pointer of the command receive queue should not be updated. Otherwise, some messages (e.g. messages pushed by PF) maybe discarded. Unfortunately, the patch to be reverted updates next-to-use pointer of the command receive queue in other threads context, and this will lead to discard some mailbox message. So this commit reverts commit 599ef84add7e ("net/hns3: fix mailbox communication with HW") Fixes: 599ef84add7e ("net/hns3: fix mailbox communication with HW") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_mbx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c index 02028dcd9c..910a16c999 100644 --- a/drivers/net/hns3/hns3_mbx.c +++ b/drivers/net/hns3/hns3_mbx.c @@ -436,8 +436,10 @@ hns3_handle_mbx_msg_out_intr(struct hns3_hw *hw) next_to_use = (next_to_use + 1) % hw->cmq.crq.desc_num; } - crq->next_to_use = next_to_use; - hns3_write_dev(hw, HNS3_CMDQ_RX_HEAD_REG, crq->next_to_use); + /* + * Note: the crq->next_to_use field should not updated, otherwise, + * mailbox messages may be discarded. + */ } void From patchwork Fri Sep 30 07:22:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117193 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A6E88A034C; Fri, 30 Sep 2022 09:25:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DA82742BDC; Fri, 30 Sep 2022 09:24:28 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 2E1E542BCB; Fri, 30 Sep 2022 09:24:23 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Mf1ql4JgRzpSxj; Fri, 30 Sep 2022 15:21:23 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:21 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 18/19] net/hns3: fix VF mark wrong message processed Date: Fri, 30 Sep 2022 15:22:19 +0800 Message-ID: <20220930072220.20753-19-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Chengwen Feng VF's command receive queue was mainly used to receive mailbox messages from PF. There are two type mailbox messages: request response message and message pushed by PF. There are two types of threads that can handle these messages: 1) the interrupt thread of the main process: it could handle both types of messages. 2) other threads: it could only handle request response messages. The collaboration mechanism between the two type threads is that other threads set the opcode of processed messages to zero so that the interrupt thread of the main process does not process these messages again. Unfortunately, the other threads mark the message pointed to by the crq->next-to-use variable which is fixed in the loop, not the message pointed to by the next-to-use variable. This patch fixes it. Fixes: dbbbad23e380 ("net/hns3: fix VF handling LSC event in secondary process") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_mbx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c index 910a16c999..8e0a58aa02 100644 --- a/drivers/net/hns3/hns3_mbx.c +++ b/drivers/net/hns3/hns3_mbx.c @@ -429,7 +429,7 @@ hns3_handle_mbx_msg_out_intr(struct hns3_hw *hw) * Clear opcode to inform intr thread don't process * again. */ - crq->desc[crq->next_to_use].opcode = 0; + crq->desc[next_to_use].opcode = 0; } scan_next: From patchwork Fri Sep 30 07:22:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 117194 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5EA90A034C; Fri, 30 Sep 2022 09:25:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B334C42BE0; Fri, 30 Sep 2022 09:24:29 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id A48414282D; Fri, 30 Sep 2022 09:24:23 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Mf1pC5HcZz1P6yq; Fri, 30 Sep 2022 15:20:03 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 15:24:21 +0800 From: Dongdong Liu To: , , , CC: , , , , , Subject: [PATCH 19/19] net/hns3: fix the obtaination of minimum Tx frame length Date: Fri, 30 Sep 2022 15:22:20 +0800 Message-ID: <20220930072220.20753-20-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220930072220.20753-1-liudongdong3@huawei.com> References: <20220930072220.20753-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Jie Hai When packet length in Tx is less than length hardware supported, the minimum frame length in hns3 is used to do padding to avoid hardware error. Currently, this length is fixed by macro, which is very unfavorable for subsequent hardware evolution. So fix it as firmware report. Fixes: 395b5e08ef8d ("net/hns3: add Tx short frame padding compatibility") Cc: stable@dpdk.org Signed-off-by: Jie Hai Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_cmd.h | 6 ++++++ drivers/net/hns3/hns3_ethdev.c | 4 +++- drivers/net/hns3/hns3_ethdev.h | 3 +-- drivers/net/hns3/hns3_ethdev_vf.c | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h index 8ac8b45819..994dfc48cc 100644 --- a/drivers/net/hns3/hns3_cmd.h +++ b/drivers/net/hns3/hns3_cmd.h @@ -967,6 +967,12 @@ struct hns3_dev_specs_0_cmd { uint32_t max_tm_rate; }; +struct hns3_dev_specs_1_cmd { + uint8_t rsv0[12]; + uint8_t min_tx_pkt_len; + uint8_t rsv1[11]; +}; + struct hns3_query_rpu_cmd { uint32_t tc_queue_num; uint32_t rsv1[2]; diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 60e933998a..813fcedc6a 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -2661,14 +2661,17 @@ static void hns3_parse_dev_specifications(struct hns3_hw *hw, struct hns3_cmd_desc *desc) { struct hns3_dev_specs_0_cmd *req0; + struct hns3_dev_specs_1_cmd *req1; req0 = (struct hns3_dev_specs_0_cmd *)desc[0].data; + req1 = (struct hns3_dev_specs_1_cmd *)desc[1].data; hw->max_non_tso_bd_num = req0->max_non_tso_bd_num; hw->rss_ind_tbl_size = rte_le_to_cpu_16(req0->rss_ind_tbl_size); hw->rss_key_size = rte_le_to_cpu_16(req0->rss_key_size); hw->max_tm_rate = rte_le_to_cpu_32(req0->max_tm_rate); hw->intr.int_ql_max = rte_le_to_cpu_16(req0->intr_ql_max); + hw->min_tx_pkt_len = req1->min_tx_pkt_len; } static int @@ -2763,7 +2766,6 @@ hns3_get_capability(struct hns3_hw *hw) hw->tso_mode = HNS3_TSO_HW_CAL_PSEUDO_H_CSUM; hw->vlan_mode = HNS3_HW_SHIFT_AND_DISCARD_MODE; hw->drop_stats_mode = HNS3_PKTS_DROP_STATS_MODE2; - hw->min_tx_pkt_len = HNS3_HIP09_MIN_TX_PKT_LEN; pf->tqp_config_mode = HNS3_FLEX_MAX_TQP_NUM_MODE; hw->rss_info.ipv6_sctp_offload_supported = true; hw->udp_cksum_mode = HNS3_SPECIAL_PORT_HW_CKSUM_MODE; diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index 9fe9766736..2457754b3d 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -75,7 +75,6 @@ #define HNS3_DEFAULT_MTU 1500UL #define HNS3_DEFAULT_FRAME_LEN (HNS3_DEFAULT_MTU + HNS3_ETH_OVERHEAD) #define HNS3_HIP08_MIN_TX_PKT_LEN 33 -#define HNS3_HIP09_MIN_TX_PKT_LEN 9 #define HNS3_BITS_PER_BYTE 8 @@ -550,7 +549,7 @@ struct hns3_hw { * The minimum length of the packet supported by hardware in the Tx * direction. */ - uint32_t min_tx_pkt_len; + uint8_t min_tx_pkt_len; struct hns3_queue_intr intr; /* diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 446a0cdbc7..c1bbcf42b1 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -701,13 +701,16 @@ static void hns3vf_parse_dev_specifications(struct hns3_hw *hw, struct hns3_cmd_desc *desc) { struct hns3_dev_specs_0_cmd *req0; + struct hns3_dev_specs_1_cmd *req1; req0 = (struct hns3_dev_specs_0_cmd *)desc[0].data; + req1 = (struct hns3_dev_specs_1_cmd *)desc[1].data; hw->max_non_tso_bd_num = req0->max_non_tso_bd_num; hw->rss_ind_tbl_size = rte_le_to_cpu_16(req0->rss_ind_tbl_size); hw->rss_key_size = rte_le_to_cpu_16(req0->rss_key_size); hw->intr.int_ql_max = rte_le_to_cpu_16(req0->intr_ql_max); + hw->min_tx_pkt_len = req1->min_tx_pkt_len; } static int @@ -846,7 +849,6 @@ hns3vf_get_capability(struct hns3_hw *hw) hw->intr.gl_unit = HNS3_INTR_COALESCE_GL_UINT_1US; hw->tso_mode = HNS3_TSO_HW_CAL_PSEUDO_H_CSUM; hw->drop_stats_mode = HNS3_PKTS_DROP_STATS_MODE2; - hw->min_tx_pkt_len = HNS3_HIP09_MIN_TX_PKT_LEN; hw->rss_info.ipv6_sctp_offload_supported = true; hw->promisc_mode = HNS3_LIMIT_PROMISC_MODE;