|
Takashi Iwai |
8f2514 |
From 8d4ad0ab2874f218e000718f2134ce0180438e61 Mon Sep 17 00:00:00 2001
|
|
Takashi Iwai |
8f2514 |
From: Jian Shen <shenjian15@huawei.com>
|
|
Takashi Iwai |
8f2514 |
Date: Wed, 29 Sep 2021 17:35:50 +0800
|
|
Takashi Iwai |
8f2514 |
Subject: [PATCH] net: hns3: remove tc enable checking
|
|
Takashi Iwai |
8f2514 |
Git-commit: a8e76fefe3de9b8e609cf192af75e7878d21fa3a
|
|
Takashi Iwai |
8f2514 |
Patch-mainline: v5.15-rc4
|
|
Takashi Iwai |
8f2514 |
References: stable-5.14.10
|
|
Takashi Iwai |
8f2514 |
|
|
Takashi Iwai |
8f2514 |
[ Upstream commit a8e76fefe3de9b8e609cf192af75e7878d21fa3a ]
|
|
Takashi Iwai |
8f2514 |
|
|
Takashi Iwai |
8f2514 |
Currently, in function hns3_nic_set_real_num_queue(), the
|
|
Takashi Iwai |
8f2514 |
driver doesn't report the queue count and offset for disabled
|
|
Takashi Iwai |
8f2514 |
tc. If user enables multiple TCs, but only maps user
|
|
Takashi Iwai |
8f2514 |
priorities to partial of them, it may cause the queue range
|
|
Takashi Iwai |
8f2514 |
of the unmapped TC being displayed abnormally.
|
|
Takashi Iwai |
8f2514 |
|
|
Takashi Iwai |
8f2514 |
Fix it by removing the tc enable checking, ensure the queue
|
|
Takashi Iwai |
8f2514 |
count is not zero.
|
|
Takashi Iwai |
8f2514 |
|
|
Takashi Iwai |
8f2514 |
With this change, the tc_en is useless now, so remove it.
|
|
Takashi Iwai |
8f2514 |
|
|
Takashi Iwai |
8f2514 |
Fixes: a75a8efa00c5 ("net: hns3: Fix tc setup when netdev is first up")
|
|
Takashi Iwai |
8f2514 |
Signed-off-by: Jian Shen <shenjian15@huawei.com>
|
|
Takashi Iwai |
8f2514 |
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
|
|
Takashi Iwai |
8f2514 |
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
Takashi Iwai |
8f2514 |
Signed-off-by: Sasha Levin <sashal@kernel.org>
|
|
Takashi Iwai |
8f2514 |
Acked-by: Takashi Iwai <tiwai@suse.de>
|
|
Takashi Iwai |
8f2514 |
|
|
Takashi Iwai |
8f2514 |
---
|
|
Takashi Iwai |
8f2514 |
drivers/net/ethernet/hisilicon/hns3/hnae3.h | 1 -
|
|
Takashi Iwai |
8f2514 |
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 11 ++---------
|
|
Takashi Iwai |
8f2514 |
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 5 -----
|
|
Takashi Iwai |
8f2514 |
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 2 --
|
|
Takashi Iwai |
8f2514 |
4 files changed, 2 insertions(+), 17 deletions(-)
|
|
Takashi Iwai |
8f2514 |
|
|
Takashi Iwai |
8f2514 |
diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
|
|
Takashi Iwai |
8f2514 |
index e0b7c3c44e7b..32987bd134a1 100644
|
|
Takashi Iwai |
8f2514 |
--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
|
|
Takashi Iwai |
8f2514 |
+++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
|
|
Takashi Iwai |
8f2514 |
@@ -750,7 +750,6 @@ struct hnae3_tc_info {
|
|
Takashi Iwai |
8f2514 |
u8 prio_tc[HNAE3_MAX_USER_PRIO]; /* TC indexed by prio */
|
|
Takashi Iwai |
8f2514 |
u16 tqp_count[HNAE3_MAX_TC];
|
|
Takashi Iwai |
8f2514 |
u16 tqp_offset[HNAE3_MAX_TC];
|
|
Takashi Iwai |
8f2514 |
- unsigned long tc_en; /* bitmap of TC enabled */
|
|
Takashi Iwai |
8f2514 |
u8 num_tc; /* Total number of enabled TCs */
|
|
Takashi Iwai |
8f2514 |
bool mqprio_active;
|
|
Takashi Iwai |
8f2514 |
};
|
|
Takashi Iwai |
8f2514 |
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
|
|
Takashi Iwai |
8f2514 |
index b24ad9bc8e1b..114692c4f797 100644
|
|
Takashi Iwai |
8f2514 |
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
|
|
Takashi Iwai |
8f2514 |
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
|
|
Takashi Iwai |
8f2514 |
@@ -620,13 +620,9 @@ static int hns3_nic_set_real_num_queue(struct net_device *netdev)
|
|
Takashi Iwai |
8f2514 |
return ret;
|
|
Takashi Iwai |
8f2514 |
}
|
|
Takashi Iwai |
8f2514 |
|
|
Takashi Iwai |
8f2514 |
- for (i = 0; i < HNAE3_MAX_TC; i++) {
|
|
Takashi Iwai |
8f2514 |
- if (!test_bit(i, &tc_info->tc_en))
|
|
Takashi Iwai |
8f2514 |
- continue;
|
|
Takashi Iwai |
8f2514 |
-
|
|
Takashi Iwai |
8f2514 |
+ for (i = 0; i < tc_info->num_tc; i++)
|
|
Takashi Iwai |
8f2514 |
netdev_set_tc_queue(netdev, i, tc_info->tqp_count[i],
|
|
Takashi Iwai |
8f2514 |
tc_info->tqp_offset[i]);
|
|
Takashi Iwai |
8f2514 |
- }
|
|
Takashi Iwai |
8f2514 |
}
|
|
Takashi Iwai |
8f2514 |
|
|
Takashi Iwai |
8f2514 |
ret = netif_set_real_num_tx_queues(netdev, queue_size);
|
|
Takashi Iwai |
8f2514 |
@@ -4830,12 +4826,9 @@ static void hns3_init_tx_ring_tc(struct hns3_nic_priv *priv)
|
|
Takashi Iwai |
8f2514 |
struct hnae3_tc_info *tc_info = &kinfo->tc_info;
|
|
Takashi Iwai |
8f2514 |
int i;
|
|
Takashi Iwai |
8f2514 |
|
|
Takashi Iwai |
8f2514 |
- for (i = 0; i < HNAE3_MAX_TC; i++) {
|
|
Takashi Iwai |
8f2514 |
+ for (i = 0; i < tc_info->num_tc; i++) {
|
|
Takashi Iwai |
8f2514 |
int j;
|
|
Takashi Iwai |
8f2514 |
|
|
Takashi Iwai |
8f2514 |
- if (!test_bit(i, &tc_info->tc_en))
|
|
Takashi Iwai |
8f2514 |
- continue;
|
|
Takashi Iwai |
8f2514 |
-
|
|
Takashi Iwai |
8f2514 |
for (j = 0; j < tc_info->tqp_count[i]; j++) {
|
|
Takashi Iwai |
8f2514 |
struct hnae3_queue *q;
|
|
Takashi Iwai |
8f2514 |
|
|
Takashi Iwai |
8f2514 |
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
|
|
Takashi Iwai |
8f2514 |
index 39f56f245d84..5fadfdbc4858 100644
|
|
Takashi Iwai |
8f2514 |
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
|
|
Takashi Iwai |
8f2514 |
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
|
|
Takashi Iwai |
8f2514 |
@@ -420,8 +420,6 @@ static int hclge_mqprio_qopt_check(struct hclge_dev *hdev,
|
|
Takashi Iwai |
8f2514 |
static void hclge_sync_mqprio_qopt(struct hnae3_tc_info *tc_info,
|
|
Takashi Iwai |
8f2514 |
struct tc_mqprio_qopt_offload *mqprio_qopt)
|
|
Takashi Iwai |
8f2514 |
{
|
|
Takashi Iwai |
8f2514 |
- int i;
|
|
Takashi Iwai |
8f2514 |
-
|
|
Takashi Iwai |
8f2514 |
memset(tc_info, 0, sizeof(*tc_info));
|
|
Takashi Iwai |
8f2514 |
tc_info->num_tc = mqprio_qopt->qopt.num_tc;
|
|
Takashi Iwai |
8f2514 |
memcpy(tc_info->prio_tc, mqprio_qopt->qopt.prio_tc_map,
|
|
Takashi Iwai |
8f2514 |
@@ -430,9 +428,6 @@ static void hclge_sync_mqprio_qopt(struct hnae3_tc_info *tc_info,
|
|
Takashi Iwai |
8f2514 |
sizeof_field(struct hnae3_tc_info, tqp_count));
|
|
Takashi Iwai |
8f2514 |
memcpy(tc_info->tqp_offset, mqprio_qopt->qopt.offset,
|
|
Takashi Iwai |
8f2514 |
sizeof_field(struct hnae3_tc_info, tqp_offset));
|
|
Takashi Iwai |
8f2514 |
-
|
|
Takashi Iwai |
8f2514 |
- for (i = 0; i < HNAE3_MAX_USER_PRIO; i++)
|
|
Takashi Iwai |
8f2514 |
- set_bit(tc_info->prio_tc[i], &tc_info->tc_en);
|
|
Takashi Iwai |
8f2514 |
}
|
|
Takashi Iwai |
8f2514 |
|
|
Takashi Iwai |
8f2514 |
static int hclge_config_tc(struct hclge_dev *hdev,
|
|
Takashi Iwai |
8f2514 |
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
|
|
Takashi Iwai |
8f2514 |
index 44618cc4cca1..6f5035a788c0 100644
|
|
Takashi Iwai |
8f2514 |
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
|
|
Takashi Iwai |
8f2514 |
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
|
|
Takashi Iwai |
8f2514 |
@@ -687,12 +687,10 @@ static void hclge_tm_vport_tc_info_update(struct hclge_vport *vport)
|
|
Takashi Iwai |
8f2514 |
|
|
Takashi Iwai |
8f2514 |
for (i = 0; i < HNAE3_MAX_TC; i++) {
|
|
Takashi Iwai |
8f2514 |
if (hdev->hw_tc_map & BIT(i) && i < kinfo->tc_info.num_tc) {
|
|
Takashi Iwai |
8f2514 |
- set_bit(i, &kinfo->tc_info.tc_en);
|
|
Takashi Iwai |
8f2514 |
kinfo->tc_info.tqp_offset[i] = i * kinfo->rss_size;
|
|
Takashi Iwai |
8f2514 |
kinfo->tc_info.tqp_count[i] = kinfo->rss_size;
|
|
Takashi Iwai |
8f2514 |
} else {
|
|
Takashi Iwai |
8f2514 |
/* Set to default queue if TC is disable */
|
|
Takashi Iwai |
8f2514 |
- clear_bit(i, &kinfo->tc_info.tc_en);
|
|
Takashi Iwai |
8f2514 |
kinfo->tc_info.tqp_offset[i] = 0;
|
|
Takashi Iwai |
8f2514 |
kinfo->tc_info.tqp_count[i] = 1;
|
|
Takashi Iwai |
8f2514 |
}
|
|
Takashi Iwai |
8f2514 |
--
|
|
Takashi Iwai |
8f2514 |
2.26.2
|
|
Takashi Iwai |
8f2514 |
|