From: Steve Yang <stevex.y...@intel.com>

Currently, VF can only handle virtchnl event message by calling interrupt.
It is not available in two cases:
1. If the event message comes during VF initialization before interrupt
is enabled, this message will not be handled correctly.
2. Some virtchnl commands need to receive the event message and handle
it with interrupt disabled.
To solve this issue, we add the virtchnl event message handling in the
process of reading vitchnl messages in adminq from PF.

Signed-off-by: Steve Yang <stevex.y...@intel.com>
Signed-off-by: Kevin Liu <kevinx....@intel.com>
---
 drivers/net/ice/ice_dcf.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index 9c2f13cf72..1415f26ac3 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -63,11 +63,32 @@ ice_dcf_recv_cmd_rsp_no_irq(struct ice_dcf_hw *hw, enum 
virtchnl_ops op,
                        goto again;
 
                v_op = rte_le_to_cpu_32(event.desc.cookie_high);
-               if (v_op != op)
-                       goto again;
+
+               if (v_op == VIRTCHNL_OP_EVENT) {
+                       struct virtchnl_pf_event *vpe =
+                               (struct virtchnl_pf_event *)event.msg_buf;
+                       switch (vpe->event) {
+                       case VIRTCHNL_EVENT_RESET_IMPENDING:
+                               hw->resetting = true;
+                               if (rsp_msglen)
+                                       *rsp_msglen = 0;
+                               return IAVF_SUCCESS;
+                       default:
+                               goto again;
+                       }
+               } else {
+                       /* async reply msg on command issued by vf previously */
+                       if (v_op != op) {
+                               PMD_DRV_LOG(WARNING,
+                                       "command mismatch, expect %u, get %u",
+                                       op, v_op);
+                               goto again;
+                       }
+               }
 
                if (rsp_msglen != NULL)
                        *rsp_msglen = event.msg_len;
+
                return rte_le_to_cpu_32(event.desc.cookie_low);
 
 again:
-- 
2.33.1

Reply via email to