When reusing a command description read from HW, driver should set
IN_VLD bit, WR bit and NO_INTR bit. If IN_VLD bit and NO_INTR bit
are not set, the command fails and driver prints error message:

[  135.261284] hns3 0000:7d:00.0: cmdq execute failed for 
get_mac_vlan_cmd_status,status=2.
[  135.270983] hns3 0000:7d:00.0: add mac addr failed for cmd_send, ret =-5.

This patch fixes the bug.
Fixes: 46a3df9 (net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer 
Support)

Signed-off-by: Lipeng <lipeng...@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c 
b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index d11a9a5..0b95fbe 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -3600,11 +3600,11 @@ static int hclge_add_mac_vlan_tbl(struct hclge_vport 
*vport,
                                                           resp_code,
                                                           HCLGE_MAC_VLAN_ADD);
        } else {
-               mc_desc[0].flag &= cpu_to_le16(~HCLGE_CMD_FLAG_WR);
+               hclge_cmd_reuse_desc(&mc_desc[0], false);
                mc_desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
-               mc_desc[1].flag &= cpu_to_le16(~HCLGE_CMD_FLAG_WR);
+               hclge_cmd_reuse_desc(&mc_desc[1], false);
                mc_desc[1].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
-               mc_desc[2].flag &= cpu_to_le16(~HCLGE_CMD_FLAG_WR);
+               hclge_cmd_reuse_desc(&mc_desc[2], false);
                mc_desc[2].flag &= cpu_to_le16(~HCLGE_CMD_FLAG_NEXT);
                memcpy(mc_desc[0].data, req,
                       sizeof(struct hclge_mac_vlan_tbl_entry_cmd));
-- 
1.9.1

Reply via email to