]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[intelxl] Allow for admin commands that trigger a VF reset
authorMichael Brown <mcb30@ipxe.org>
Tue, 16 Aug 2022 16:59:37 +0000 (17:59 +0100)
committerMichael Brown <mcb30@ipxe.org>
Tue, 16 Aug 2022 18:29:01 +0000 (19:29 +0100)
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 <mcb30@ipxe.org>
src/drivers/net/intelxlvf.c

index 79245b46f0e3c4482982efa9879a0ad804f7baba..e30d8c6db8ce46852c99c3899eb9d20caa3b9c60 100644 (file)
@@ -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