net: hns3: use a reserved byte to identify need_resp flag
authorHuazhong Tan <tanhuazhong@huawei.com>
Thu, 25 Apr 2019 12:42:50 +0000 (20:42 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 26 Apr 2019 16:13:28 +0000 (12:13 -0400)
This patch uses a reserved byte in the hclge_mbx_vf_to_pf_cmd
to save the need_resp flag, so when PF received the mailbox,
it can use it to decise whether send a response to VF.

For hclge_set_vf_uc_mac_addr(), it should use mbx_need_resp flag
to decide whether send response to VF.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c

index 8b6191f61211b830379b56a89d435aed1965b60a..83e19c6b974edb08e7c3237d886ad58a196ce04e 100644 (file)
@@ -84,12 +84,15 @@ struct hclgevf_mbx_resp_status {
 struct hclge_mbx_vf_to_pf_cmd {
        u8 rsv;
        u8 mbx_src_vfid; /* Auto filled by IMP */
-       u8 rsv1[2];
+       u8 mbx_need_resp;
+       u8 rsv1[1];
        u8 msg_len;
        u8 rsv2[3];
        u8 msg[HCLGE_MBX_MAX_MSG_SIZE];
 };
 
+#define HCLGE_MBX_NEED_RESP_BIT                BIT(0)
+
 struct hclge_mbx_pf_to_vf_cmd {
        u8 dest_vfid;
        u8 rsv[3];
index 24386bd894f713b4541bddb7062d7a0a93e1ff16..fe48c5634a871870101663f595ac7361ae240423 100644 (file)
@@ -212,8 +212,7 @@ static int hclge_set_vf_promisc_mode(struct hclge_vport *vport,
 }
 
 static int hclge_set_vf_uc_mac_addr(struct hclge_vport *vport,
-                                   struct hclge_mbx_vf_to_pf_cmd *mbx_req,
-                                   bool gen_resp)
+                                   struct hclge_mbx_vf_to_pf_cmd *mbx_req)
 {
        const u8 *mac_addr = (const u8 *)(&mbx_req->msg[2]);
        struct hclge_dev *hdev = vport->back;
@@ -249,7 +248,7 @@ static int hclge_set_vf_uc_mac_addr(struct hclge_vport *vport,
                return -EIO;
        }
 
-       if (gen_resp)
+       if (mbx_req->mbx_need_resp & HCLGE_MBX_NEED_RESP_BIT)
                hclge_gen_resp_to_vf(vport, mbx_req, status, NULL, 0);
 
        return 0;
@@ -597,7 +596,7 @@ void hclge_mbx_handler(struct hclge_dev *hdev)
                                        ret);
                        break;
                case HCLGE_MBX_SET_UNICAST:
-                       ret = hclge_set_vf_uc_mac_addr(vport, req, true);
+                       ret = hclge_set_vf_uc_mac_addr(vport, req);
                        if (ret)
                                dev_err(&hdev->pdev->dev,
                                        "PF fail(%d) to set VF UC MAC Addr\n",
index 3c22639a652759a3eb87f7a2add4f1feb3bfdc49..30f2e9352cf3373cb8bd409aa2a7e1e730bf7472 100644 (file)
@@ -98,6 +98,8 @@ int hclgevf_send_mbx_msg(struct hclgevf_dev *hdev, u16 code, u16 subcode,
        }
 
        hclgevf_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_MBX_VF_TO_PF, false);
+       req->mbx_need_resp |= need_resp ? HCLGE_MBX_NEED_RESP_BIT :
+                                         ~HCLGE_MBX_NEED_RESP_BIT;
        req->msg[0] = code;
        req->msg[1] = subcode;
        memcpy(&req->msg[2], msg_data, msg_len);