]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: hns3: fix PFC not setting problem for DCB module
authorYunsheng Lin <linyunsheng@huawei.com>
Tue, 22 Jan 2019 23:39:38 +0000 (07:39 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2019 08:21:17 +0000 (09:21 +0100)
[ Upstream commit d3ad430ac531e65f29c9737f86744c425c9173ef ]

The PFC enabling is based on user priority, currently it is
based on TC, which may cause PFC not setting correctly when pri
to TC mapping is not one to one relation.

This patch adds pfc_en in tm_info to fix it.

Fixes: cacde272dd00 ("net: hns3: Add hclge_dcb module for the support of DCB feature")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c

index 92f19384e25857ccef5d52f35329951250449057..a75d7c826fc2b8d229531cfafe005de98927f362 100644 (file)
@@ -245,6 +245,9 @@ static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc)
            hdev->flag & HCLGE_FLAG_MQPRIO_ENABLE)
                return -EINVAL;
 
+       if (pfc->pfc_en == hdev->tm_info.pfc_en)
+               return 0;
+
        prio_tc = hdev->tm_info.prio_tc;
        pfc_map = 0;
 
@@ -257,10 +260,8 @@ static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc)
                }
        }
 
-       if (pfc_map == hdev->tm_info.hw_pfc_map)
-               return 0;
-
        hdev->tm_info.hw_pfc_map = pfc_map;
+       hdev->tm_info.pfc_en = pfc->pfc_en;
 
        return hclge_pause_setup_hw(hdev);
 }
index 1528fb3fa6be6d4da6afcba7bdbbf5e1a7608171..260b1e77969080678cb4afcfeccef8c885d0856f 100644 (file)
@@ -249,6 +249,7 @@ struct hclge_tm_info {
        struct hclge_tc_info tc_info[HNAE3_MAX_TC];
        enum hclge_fc_mode fc_mode;
        u8 hw_pfc_map; /* Allow for packet drop or not on this TC */
+       u8 pfc_en;      /* PFC enabled or not for user priority */
 };
 
 struct hclge_comm_stats_str {
index 0d45d045706c7044eda8a17e7fe460285eee62fb..3180ae45288951cf7b6425458dd95249d4ecfb41 100644 (file)
@@ -1162,7 +1162,7 @@ static int hclge_pfc_setup_hw(struct hclge_dev *hdev)
                                HCLGE_RX_MAC_PAUSE_EN_MSK;
 
        return hclge_pfc_pause_en_cfg(hdev, enable_bitmap,
-                                     hdev->tm_info.hw_pfc_map);
+                                     hdev->tm_info.pfc_en);
 }
 
 /* Each Tc has a 1024 queue sets to backpress, it divides to