net: hns3: fix delete tc fail issue
authorJijie Shao <shaojijie@huawei.com>
Thu, 7 Mar 2024 01:01:12 +0000 (09:01 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Mar 2024 12:01:32 +0000 (12:01 +0000)
When the tc is removed during reset, hns3 driver will return a errcode.
But kernel ignores this errcode, As a result,
the driver status is inconsistent with the kernel status.

This patch retains the deletion status when the deletion fails
and continues to delete after the reset to ensure that
the status of the driver is consistent with that of kernel.

Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hnae3.h
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h

index a72caaf..f19f1e1 100644 (file)
@@ -820,6 +820,7 @@ struct hnae3_tc_info {
        u8 max_tc; /* Total number of TCs */
        u8 num_tc; /* Total number of enabled TCs */
        bool mqprio_active;
+       bool mqprio_destroy;
        bool dcb_ets_active;
 };
 
index b98301e..eabbacb 100644 (file)
@@ -619,6 +619,8 @@ static int hclge_setup_tc(struct hnae3_handle *h,
                return ret;
        }
 
+       kinfo->tc_info.mqprio_destroy = !tc;
+
        ret = hclge_notify_down_uinit(hdev);
        if (ret)
                return ret;
index 16860ee..349e4a1 100644 (file)
@@ -12105,6 +12105,8 @@ static int hclge_reset_ae_dev(struct hnae3_ae_dev *ae_dev)
                return ret;
        }
 
+       hclge_reset_tc_config(hdev);
+
        ret = hclge_tm_init_hw(hdev, true);
        if (ret) {
                dev_err(&pdev->dev, "tm init hw fail, ret =%d\n", ret);
index c58c312..00c3f25 100644 (file)
@@ -2143,3 +2143,19 @@ int hclge_tm_flush_cfg(struct hclge_dev *hdev, bool enable)
 
        return ret;
 }
+
+void hclge_reset_tc_config(struct hclge_dev *hdev)
+{
+       struct hclge_vport *vport = &hdev->vport[0];
+       struct hnae3_knic_private_info *kinfo;
+
+       kinfo = &vport->nic.kinfo;
+
+       if (!kinfo->tc_info.mqprio_destroy)
+               return;
+
+       /* clear tc info, including mqprio_destroy and mqprio_active */
+       memset(&kinfo->tc_info, 0, sizeof(kinfo->tc_info));
+       hclge_tm_schd_info_update(hdev, 0);
+       hclge_comm_rss_indir_init_cfg(hdev->ae_dev, &hdev->rss_cfg);
+}
index 53eec6d..0985916 100644 (file)
@@ -277,4 +277,5 @@ int hclge_tm_get_port_shaper(struct hclge_dev *hdev,
 int hclge_up_to_tc_map(struct hclge_dev *hdev);
 int hclge_dscp_to_tc_map(struct hclge_dev *hdev);
 int hclge_tm_flush_cfg(struct hclge_dev *hdev, bool enable);
+void hclge_reset_tc_config(struct hclge_dev *hdev);
 #endif