net: hns3: enable DCB when TC num is one and pfc_en is non-zero
authorYunsheng Lin <linyunsheng@huawei.com>
Fri, 28 Jun 2019 11:50:08 +0000 (19:50 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 28 Jun 2019 16:39:49 +0000 (09:39 -0700)
Currently when TC num is one, the DCB will be disabled no matter if
pfc_en is non-zero or not.

This patch enables the DCB if pfc_en is non-zero, even when TC num
is one.

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>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h

index 1161361a973b56a174a7be93724fa4f2d8a31350..bac4ce13f6ae44dd54a2d28efbcd374fcc2dfecb 100644 (file)
@@ -325,6 +325,8 @@ static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc)
        hdev->tm_info.hw_pfc_map = pfc_map;
        hdev->tm_info.pfc_en = pfc->pfc_en;
 
+       hclge_tm_pfc_info_update(hdev);
+
        return hclge_pause_setup_hw(hdev, false);
 }
 
index 9edae5f15ffbc2eef82e58884a519dc4feadb54a..cb2fb5a62ea581bf31850a1a34d1063c90c7e2f3 100644 (file)
@@ -597,8 +597,10 @@ static void hclge_tm_tc_info_init(struct hclge_dev *hdev)
                hdev->tm_info.prio_tc[i] =
                        (i >= hdev->tm_info.num_tc) ? 0 : i;
 
-       /* DCB is enabled if we have more than 1 TC */
-       if (hdev->tm_info.num_tc > 1)
+       /* DCB is enabled if we have more than 1 TC or pfc_en is
+        * non-zero.
+        */
+       if (hdev->tm_info.num_tc > 1 || hdev->tm_info.pfc_en)
                hdev->flag |= HCLGE_FLAG_DCB_ENABLE;
        else
                hdev->flag &= ~HCLGE_FLAG_DCB_ENABLE;
@@ -1388,6 +1390,19 @@ void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc)
        hclge_tm_schd_info_init(hdev);
 }
 
+void hclge_tm_pfc_info_update(struct hclge_dev *hdev)
+{
+       /* DCB is enabled if we have more than 1 TC or pfc_en is
+        * non-zero.
+        */
+       if (hdev->tm_info.num_tc > 1 || hdev->tm_info.pfc_en)
+               hdev->flag |= HCLGE_FLAG_DCB_ENABLE;
+       else
+               hdev->flag &= ~HCLGE_FLAG_DCB_ENABLE;
+
+       hclge_pfc_info_init(hdev);
+}
+
 int hclge_tm_init_hw(struct hclge_dev *hdev, bool init)
 {
        int ret;
index f60e540c7a6246a6caf867c3f3b6fe07424bbf40..5150daaac3454601d2cf7375d508e270b284b1ca 100644 (file)
@@ -147,6 +147,7 @@ int hclge_pause_setup_hw(struct hclge_dev *hdev, bool init);
 int hclge_tm_schd_setup_hw(struct hclge_dev *hdev);
 void hclge_tm_prio_tc_info_update(struct hclge_dev *hdev, u8 *prio_tc);
 void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc);
+void hclge_tm_pfc_info_update(struct hclge_dev *hdev);
 int hclge_tm_dwrr_cfg(struct hclge_dev *hdev);
 int hclge_tm_init_hw(struct hclge_dev *hdev, bool init);
 int hclge_mac_pause_en_cfg(struct hclge_dev *hdev, bool tx, bool rx);