+static void
+hns3_handle_mbx_msg_out_intr(struct hns3_hw *hw)
+{
+ struct hns3_cmq_ring *crq = &hw->cmq.crq;
+ struct hns3_mbx_pf_to_vf_cmd *req;
+ struct hns3_cmd_desc *desc;
+ uint32_t tail, next_to_use;
+ uint8_t opcode;
+ uint16_t flag;
+
+ tail = hns3_read_dev(hw, HNS3_CMDQ_RX_TAIL_REG);
+ next_to_use = crq->next_to_use;
+ while (next_to_use != tail) {
+ desc = &crq->desc[next_to_use];
+ req = (struct hns3_mbx_pf_to_vf_cmd *)desc->data;
+ opcode = req->msg[0] & 0xff;
+
+ flag = rte_le_to_cpu_16(crq->desc[next_to_use].flag);
+ if (!hns3_get_bit(flag, HNS3_CMDQ_RX_OUTVLD_B))
+ goto scan_next;
+
+ if (crq->desc[next_to_use].opcode == 0)
+ goto scan_next;
+
+ if (opcode == HNS3_MBX_PF_VF_RESP) {
+ hns3_handle_mbx_response(hw, req);
+ /*
+ * Clear opcode to inform intr thread don't process
+ * again.
+ */
+ crq->desc[crq->next_to_use].opcode = 0;
+ }
+
+scan_next:
+ next_to_use = (next_to_use + 1) % hw->cmq.crq.desc_num;
+ }
+}
+