+ hns3_update_linkstatus_and_event(hw, true);
+}
+
+static void
+hns3_update_port_base_vlan_info(struct hns3_hw *hw,
+ struct hns3_mbx_pf_to_vf_cmd *req)
+{
+#define PVID_STATE_OFFSET 1
+ uint16_t new_pvid_state = req->msg[PVID_STATE_OFFSET] ?
+ HNS3_PORT_BASE_VLAN_ENABLE : HNS3_PORT_BASE_VLAN_DISABLE;
+ /*
+ * Currently, hardware doesn't support more than two layers VLAN offload
+ * based on hns3 network engine, which would cause packets loss or wrong
+ * packets for these types of packets. If the hns3 PF kernel ethdev
+ * driver sets the PVID for VF device after initialization of the
+ * related VF device, the PF driver will notify VF driver to update the
+ * PVID configuration state. The VF driver will update the PVID
+ * configuration state immediately to ensure that the VLAN process in Tx
+ * and Rx is correct. But in the window period of this state transition,
+ * packets loss or packets with wrong VLAN may occur.
+ */
+ if (hw->port_base_vlan_cfg.state != new_pvid_state) {
+ hw->port_base_vlan_cfg.state = new_pvid_state;
+ hns3_update_all_queues_pvid_proc_en(hw);
+ }
+}
+
+static void
+hns3_handle_promisc_info(struct hns3_hw *hw, uint16_t promisc_en)
+{
+ if (!promisc_en) {
+ /*
+ * When promisc/allmulti mode is closed by the hns3 PF kernel
+ * ethdev driver for untrusted, modify VF's related status.
+ */
+ hns3_warn(hw, "Promisc mode will be closed by host for being "
+ "untrusted.");
+ hw->data->promiscuous = 0;
+ hw->data->all_multicast = 0;
+ }
+}
+
+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;
+ }