net: hns3: Add support to enable TX/RX promisc mode for H/W rev(0x21)
authorPeng Li <lipeng321@huawei.com>
Fri, 25 May 2018 18:42:59 +0000 (19:42 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 29 May 2018 04:04:26 +0000 (00:04 -0400)
HCLGE_PROMISC_TX_EN_B and HCLGE_PROMISC_RX_EN_B are not supported
on pdev revision(0x20), new revision(0x21) supports them.

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

index 3fa08f780b062edf17ccdafa2f891c62c1a61fbd..e9be6aa88b65871dbbdbae1664bdc8b871adf68c 100644 (file)
@@ -484,6 +484,8 @@ struct hclge_promisc_param {
        u8 enable;
 };
 
+#define HCLGE_PROMISC_TX_EN_B  BIT(4)
+#define HCLGE_PROMISC_RX_EN_B  BIT(5)
 #define HCLGE_PROMISC_EN_B     1
 #define HCLGE_PROMISC_EN_ALL   0x7
 #define HCLGE_PROMISC_EN_UC    0x1
index c0b8d5a32bde9163b038c3d1cdf51d325b61c28d..8ad8f62dc50155e0963985b10e6918ded50fc86e 100644 (file)
@@ -3586,7 +3586,14 @@ int hclge_cmd_set_promisc_mode(struct hclge_dev *hdev,
 
        req = (struct hclge_promisc_cfg_cmd *)desc.data;
        req->vf_id = param->vf_id;
-       req->flag = (param->enable << HCLGE_PROMISC_EN_B);
+
+       /* HCLGE_PROMISC_TX_EN_B and HCLGE_PROMISC_RX_EN_B are not supported on
+        * pdev revision(0x20), new revision support them. The
+        * value of this two fields will not return error when driver
+        * send command to fireware in revision(0x20).
+        */
+       req->flag = (param->enable << HCLGE_PROMISC_EN_B) |
+               HCLGE_PROMISC_TX_EN_B | HCLGE_PROMISC_RX_EN_B;
 
        ret = hclge_cmd_send(&hdev->hw, &desc, 1);
        if (ret) {