net: hns3: Fix for mac pause not disable in pfc mode
authorYunsheng Lin <linyunsheng@huawei.com>
Fri, 6 Jul 2018 10:27:56 +0000 (11:27 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 7 Jul 2018 02:13:06 +0000 (11:13 +0900)
When pfc pause mode is enable, the mac pause mode need to be
disabled, otherwise the pfc pause packet will not be sent when
congestion happens.

This patch fixes by disabling the mac pause when pfc pause is
enabled.

Fixes: 848440544b41 ("net: hns3: Add support of TX Scheduler & Shaper to HNS3 driver")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c

index 82bc30fdff9872db1a5380fc0a9ed19e0bc0af17..e2acf3bd6ba3197e2b4bbdf14c46df5ce3b74ccc 100644 (file)
@@ -1223,6 +1223,10 @@ static int hclge_mac_pause_setup_hw(struct hclge_dev *hdev)
                tx_en = true;
                rx_en = true;
                break;
+       case HCLGE_FC_PFC:
+               tx_en = false;
+               rx_en = false;
+               break;
        default:
                tx_en = true;
                rx_en = true;
@@ -1240,8 +1244,9 @@ int hclge_pause_setup_hw(struct hclge_dev *hdev)
        if (ret)
                return ret;
 
-       if (hdev->tm_info.fc_mode != HCLGE_FC_PFC)
-               return hclge_mac_pause_setup_hw(hdev);
+       ret = hclge_mac_pause_setup_hw(hdev);
+       if (ret)
+               return ret;
 
        /* Only DCB-supported dev supports qset back pressure and pfc cmd */
        if (!hnae3_dev_dcb_supported(hdev))