From faf26bf8b882a6d56cc76686e2f0f3b236541f9d Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 17 Mar 2022 13:01:50 +0000 Subject: [PATCH] [intelxl] Allow expected admin queue command errors to be silenced The "clear PXE mode" admin queue command will return an EEXIST error if the device is already in non-PXE mode, but there is no other admin queue command that can be used to determine whether the device has already been switched into non-PXE mode. Provide a mechanism to allow expected errors from a command to be silenced, to allow the "clear PXE mode" command to be cleanly used without needing to first check the GLLAN_RCTL_0 register value. Signed-off-by: Michael Brown --- src/drivers/net/intelxl.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/drivers/net/intelxl.c b/src/drivers/net/intelxl.c index 51e888a60..c73285a61 100644 --- a/src/drivers/net/intelxl.c +++ b/src/drivers/net/intelxl.c @@ -348,6 +348,7 @@ int intelxl_admin_command ( struct intelxl_nic *intelxl ) { union intelxl_admin_buffer *buf; uint64_t address; uint32_t cookie; + uint16_t silence; unsigned int index; unsigned int tail; unsigned int i; @@ -364,11 +365,14 @@ int intelxl_admin_command ( struct intelxl_nic *intelxl ) { DBGC2 ( intelxl, "/%#08x", le32_to_cpu ( cmd->cookie ) ); DBGC2 ( intelxl, ":\n" ); + /* Allow expected errors to be silenced */ + silence = cmd->ret; + cmd->ret = 0; + /* Sanity checks */ assert ( ! ( cmd->flags & cpu_to_le16 ( INTELXL_ADMIN_FL_DD ) ) ); assert ( ! ( cmd->flags & cpu_to_le16 ( INTELXL_ADMIN_FL_CMP ) ) ); assert ( ! ( cmd->flags & cpu_to_le16 ( INTELXL_ADMIN_FL_ERR ) ) ); - assert ( cmd->ret == 0 ); /* Populate data buffer address if applicable */ if ( cmd->flags & cpu_to_le16 ( INTELXL_ADMIN_FL_BUF ) ) { @@ -419,8 +423,8 @@ int intelxl_admin_command ( struct intelxl_nic *intelxl ) { goto err; } - /* Check for errors */ - if ( cmd->ret != 0 ) { + /* Check for unexpected errors */ + if ( ( cmd->ret != 0 ) && ( cmd->ret != silence ) ) { DBGC ( intelxl, "INTELXL %p admin command %#x error " "%d\n", intelxl, index, le16_to_cpu ( cmd->ret ) );