[PATCH] net/iavf: fix add and delete MAC address

peng1x.zhang at intel.com peng1x.zhang at intel.com
Wed Aug 10 20:54:56 CEST 2022


From: Peng Zhang <peng1x.zhang at intel.com>

Response execution of command to add or delete MAC address is not correct 
under scenario of bonding device, and it would also induce to wrongly deal 
with subsequent commands' response. 

This patch is to fix the issue by adding the handling of response.

Fixes: 22b123a36d07 ("net/avf: initialize PMD") 

Signed-off-by: Peng Zhang <peng1x.zhang at intel.com>
---
 drivers/net/iavf/iavf_vchnl.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index f6da2cf4bd..edd445db05 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -189,6 +189,25 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args)
 		}
 		_clear_cmd(vf);
 		break;
+	case VIRTCHNL_OP_ADD_ETH_ADDR:
+	case VIRTCHNL_OP_DEL_ETH_ADDR:
+		do {
+			result = iavf_read_msg_from_pf(adapter, args->out_size,
+						   args->out_buffer);
+			if (result == IAVF_MSG_CMD ||
+					    vf->pend_cmd == VIRTCHNL_OP_UNKNOWN)
+				break;
+			iavf_msec_delay(ASQ_DELAY_MS);
+		} while (i++ < MAX_TRY_TIMES);
+		if (i >= MAX_TRY_TIMES ||
+		vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
+			err = -1;
+			PMD_DRV_LOG(ERR, "No response or return failure (%d)"
+			" for cmd %d", vf->cmd_retval, args->ops);
+		}
+		_clear_cmd(vf);
+		break;
+
 	case VIRTCHNL_OP_REQUEST_QUEUES:
 		/*
 		 * ignore async reply, only wait for system message,
-- 
2.25.1



More information about the stable mailing list