+static void
+hns3_handle_mbx_response(struct hns3_hw *hw, struct hns3_mbx_pf_to_vf_cmd *req)
+{
+ struct hns3_mbx_resp_status *resp = &hw->mbx_resp;
+ uint32_t msg_data;
+
+ if (req->match_id != 0) {
+ /*
+ * If match_id is not zero, it means PF support copy request's
+ * match_id to its response. So VF could use the match_id
+ * to match the request.
+ */
+ if (resp->matching_scheme !=
+ HNS3_MBX_RESP_MATCHING_SCHEME_OF_MATCH_ID) {
+ resp->matching_scheme =
+ HNS3_MBX_RESP_MATCHING_SCHEME_OF_MATCH_ID;
+ hns3_info(hw, "detect mailbox support match id!");
+ }
+ if (req->match_id == resp->match_id) {
+ resp->resp_status = hns3_resp_to_errno(req->msg[3]);
+ memcpy(resp->additional_info, &req->msg[4],
+ HNS3_MBX_MAX_RESP_DATA_SIZE);
+ rte_io_wmb();
+ resp->received_match_resp = true;
+ }
+ return;
+ }
+
+ /*
+ * If the below instructions can be executed, it means PF does not
+ * support copy request's match_id to its response. So VF follows the
+ * original scheme to process.
+ */
+ resp->resp_status = hns3_resp_to_errno(req->msg[3]);
+ memcpy(resp->additional_info, &req->msg[4],
+ HNS3_MBX_MAX_RESP_DATA_SIZE);
+ msg_data = (uint32_t)req->msg[1] << 16 | req->msg[2];
+ hns3_update_resp_position(hw, msg_data);
+}
+