Commit bb5790b7 authored by Huazhong Tan's avatar Huazhong Tan Committed by David S. Miller

net: hns3: refactor mailbox response scheme between PF and VF

Currently, PF responds to VF depending on what mailbox it is
handling, it is a bit inflexible. The correct way is, PF should
check the mbx_need_resp field to decide whether gives response
to VF.
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarYufeng Mo <moyufeng@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d3410018
...@@ -88,6 +88,12 @@ struct hclgevf_mbx_resp_status { ...@@ -88,6 +88,12 @@ struct hclgevf_mbx_resp_status {
u8 additional_info[HCLGE_MBX_MAX_RESP_DATA_SIZE]; u8 additional_info[HCLGE_MBX_MAX_RESP_DATA_SIZE];
}; };
struct hclge_respond_to_vf_msg {
int status;
u8 data[HCLGE_MBX_MAX_RESP_DATA_SIZE];
u16 len;
};
struct hclge_vf_to_pf_msg { struct hclge_vf_to_pf_msg {
u8 code; u8 code;
union { union {
...@@ -127,7 +133,7 @@ struct hclge_mbx_vf_to_pf_cmd { ...@@ -127,7 +133,7 @@ struct hclge_mbx_vf_to_pf_cmd {
struct hclge_vf_to_pf_msg msg; struct hclge_vf_to_pf_msg msg;
}; };
#define HCLGE_MBX_NEED_RESP_BIT BIT(0) #define HCLGE_MBX_NEED_RESP_B 0
struct hclge_mbx_pf_to_vf_cmd { struct hclge_mbx_pf_to_vf_cmd {
u8 dest_vfid; u8 dest_vfid;
......
...@@ -101,8 +101,9 @@ int hclgevf_send_mbx_msg(struct hclgevf_dev *hdev, ...@@ -101,8 +101,9 @@ int hclgevf_send_mbx_msg(struct hclgevf_dev *hdev,
} }
hclgevf_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_MBX_VF_TO_PF, false); hclgevf_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_MBX_VF_TO_PF, false);
req->mbx_need_resp |= need_resp ? HCLGE_MBX_NEED_RESP_BIT : if (need_resp)
~HCLGE_MBX_NEED_RESP_BIT; hnae3_set_bit(req->mbx_need_resp, HCLGE_MBX_NEED_RESP_B, 1);
memcpy(&req->msg, send_msg, sizeof(struct hclge_vf_to_pf_msg)); memcpy(&req->msg, send_msg, sizeof(struct hclge_vf_to_pf_msg));
/* synchronous send */ /* synchronous send */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment