From 04879352c4f5fbb4f1aeaf9b644c2b8408847894 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 16 Aug 2022 17:59:37 +0100 Subject: [intelxl] Allow for admin commands that trigger a VF reset The RESET_VF admin queue command does not complete via the usual mechanism, but instead requires us to poll registers to wait for the reset to take effect and then reopen the admin queue. Allow for the existence of other admin queue commands that also trigger a VF reset, by separating out the logic that waits for the reset to complete. Signed-off-by: Michael Brown --- src/drivers/net/intelxlvf.c | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/src/drivers/net/intelxlvf.c b/src/drivers/net/intelxlvf.c index 79245b4..e30d8c6 100644 --- a/src/drivers/net/intelxlvf.c +++ b/src/drivers/net/intelxlvf.c @@ -103,24 +103,14 @@ static int intelxlvf_reset_wait_active ( struct intelxl_nic *intelxl ) { } /** - * Reset hardware via admin queue + * Wait for reset to complete * * @v intelxl Intel device * @ret rc Return status code */ -static int intelxlvf_reset_admin ( struct intelxl_nic *intelxl ) { - struct intelxlvf_admin_descriptor *cmd; +static int intelxlvf_reset_wait ( struct intelxl_nic *intelxl ) { int rc; - /* Populate descriptor */ - cmd = intelxlvf_admin_command_descriptor ( intelxl ); - cmd->opcode = cpu_to_le16 ( INTELXLVF_ADMIN_SEND_TO_PF ); - cmd->vopcode = cpu_to_le32 ( INTELXLVF_ADMIN_RESET ); - - /* Issue command */ - if ( ( rc = intelxl_admin_command ( intelxl ) ) != 0 ) - goto err_command; - /* Wait for minimum reset time */ mdelay ( INTELXLVF_RESET_DELAY_MS ); @@ -135,10 +125,35 @@ static int intelxlvf_reset_admin ( struct intelxl_nic *intelxl ) { err_active: err_teardown: intelxl_reopen_admin ( intelxl ); - err_command: return rc; } +/** + * Reset hardware via admin queue + * + * @v intelxl Intel device + * @ret rc Return status code + */ +static int intelxlvf_reset_admin ( struct intelxl_nic *intelxl ) { + struct intelxlvf_admin_descriptor *cmd; + int rc; + + /* Populate descriptor */ + cmd = intelxlvf_admin_command_descriptor ( intelxl ); + cmd->opcode = cpu_to_le16 ( INTELXLVF_ADMIN_SEND_TO_PF ); + cmd->vopcode = cpu_to_le32 ( INTELXLVF_ADMIN_RESET ); + + /* Issue command */ + if ( ( rc = intelxl_admin_command ( intelxl ) ) != 0 ) + return rc; + + /* Wait for reset to complete */ + if ( ( rc = intelxlvf_reset_wait ( intelxl ) ) != 0 ) + return rc; + + return 0; +} + /****************************************************************************** * * Admin queue -- cgit v1.1