[v2,25/33] net/ice: handle virtchnl event message without interrupt

Message ID 20220413160932.2074781-26-kevinx.liu@intel.com (mailing list archive)
State Superseded, archived
Headers
Series support full function of DCF |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Kevin Liu April 13, 2022, 4:09 p.m. UTC
  From: Steve Yang <stevex.yang@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.yang@intel.com>
Signed-off-by: Kevin Liu <kevinx.liu@intel.com>
---
 drivers/net/ice/ice_dcf.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)
  

Patch

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: