]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[intelxl] Fix retrieval of switch configuration via admin queue
authorMichael Brown <mcb30@ipxe.org>
Mon, 14 Mar 2022 16:28:24 +0000 (16:28 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 8 Aug 2022 14:59:55 +0000 (15:59 +0100)
Commit 8f3e648 ("[intelxl] Use one admin queue buffer per admin queue
descriptor") changed the API for intelxl_admin_command() such that the
caller now constructs the command directly within the next available
descriptor ring entry, rather than relying on intelxl_admin_command()
to copy the descriptor to and from the descriptor ring.

This introduced a regression in intelxl_admin_switch(), since the
second and subsequent iterations of the loop will not have constructed
a valid command in the new descriptor ring entry before calling
intelxl_admin_command().

Fix by constructing the command within the loop.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/net/intelxl.c

index ac9e37c5aaf015261d6ad7b5af9e4f4d8f0594d3..111ac98edc0703a5141527c3fb2a8bbca5ca37d5 100644 (file)
@@ -593,18 +593,20 @@ static int intelxl_admin_switch ( struct intelxl_nic *intelxl ) {
        struct intelxl_admin_descriptor *cmd;
        struct intelxl_admin_switch_params *sw;
        union intelxl_admin_buffer *buf;
+       uint16_t next = 0;
        int rc;
 
-       /* Populate descriptor */
-       cmd = intelxl_admin_command_descriptor ( intelxl );
-       cmd->opcode = cpu_to_le16 ( INTELXL_ADMIN_SWITCH );
-       cmd->flags = cpu_to_le16 ( INTELXL_ADMIN_FL_BUF );
-       cmd->len = cpu_to_le16 ( sizeof ( buf->sw ) );
-       sw = &cmd->params.sw;
-       buf = intelxl_admin_command_buffer ( intelxl );
-
        /* Get each configuration in turn */
        do {
+               /* Populate descriptor */
+               cmd = intelxl_admin_command_descriptor ( intelxl );
+               cmd->opcode = cpu_to_le16 ( INTELXL_ADMIN_SWITCH );
+               cmd->flags = cpu_to_le16 ( INTELXL_ADMIN_FL_BUF );
+               cmd->len = cpu_to_le16 ( sizeof ( buf->sw ) );
+               sw = &cmd->params.sw;
+               sw->next = next;
+               buf = intelxl_admin_command_buffer ( intelxl );
+
                /* Issue command */
                if ( ( rc = intelxl_admin_command ( intelxl ) ) != 0 )
                        return rc;
@@ -624,7 +626,7 @@ static int intelxl_admin_switch ( struct intelxl_nic *intelxl ) {
                               buf->sw.cfg.connection );
                }
 
-       } while ( sw->next );
+       } while ( ( next = sw->next ) );
 
        /* Check that we found a VSI */
        if ( ! intelxl->vsi ) {