diff options
author | Michael Brown <mcb30@ipxe.org> | 2022-03-09 00:30:14 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2022-08-10 12:29:47 +0100 |
commit | 9f5b9e3abbeade8730811f22e385f120d36ab827 (patch) | |
tree | dd412990cf6eefafeca22664bc06c1e14b887453 /src/drivers/net/intelxlvf.c | |
parent | b4216fa5063e464a16361bba247d49e8620a2cf2 (diff) | |
download | ipxe-9f5b9e3abbeade8730811f22e385f120d36ab827.tar.gz |
[intelxl] Negotiate API version for virtual function via admin queue
Do not attempt to use the admin commands to get the firmware version
and report the driver version for the virtual function driver, since
these will be rejected by the E810 firmware as invalid commands when
issued by a virtual function. Instead, use the mailbox interface to
negotiate the API version with the physical function driver.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/net/intelxlvf.c')
-rw-r--r-- | src/drivers/net/intelxlvf.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/drivers/net/intelxlvf.c b/src/drivers/net/intelxlvf.c index 7dedf0f71..8febbb2b9 100644 --- a/src/drivers/net/intelxlvf.c +++ b/src/drivers/net/intelxlvf.c @@ -306,6 +306,47 @@ void intelxlvf_admin_event ( struct net_device *netdev, } /** + * Negotiate API version + * + * @v netdev Network device + * @ret rc Return status code + */ +static int intelxlvf_admin_version ( struct net_device *netdev ) { + struct intelxl_nic *intelxl = netdev->priv; + struct intelxl_admin_descriptor *cmd; + struct intelxl_admin_vf_version_buffer *ver; + union intelxl_admin_buffer *buf; + unsigned int api; + int rc; + + /* Populate descriptor */ + cmd = intelxl_admin_command_descriptor ( intelxl ); + cmd->vopcode = cpu_to_le32 ( INTELXL_ADMIN_VF_VERSION ); + cmd->flags = cpu_to_le16 ( INTELXL_ADMIN_FL_RD | INTELXL_ADMIN_FL_BUF ); + cmd->len = cpu_to_le16 ( sizeof ( buf->ver ) ); + buf = intelxl_admin_command_buffer ( intelxl ); + buf->ver.major = cpu_to_le32 ( INTELXL_ADMIN_VF_API_MAJOR ); + buf->ver.minor = cpu_to_le32 ( INTELXL_ADMIN_VF_API_MINOR ); + + /* Issue command */ + if ( ( rc = intelxlvf_admin_command ( netdev ) ) != 0 ) + return rc; + ver = &intelxl->vbuf.ver; + api = le32_to_cpu ( ver->major ); + DBGC ( intelxl, "INTELXL %p API v%d.%d\n", + intelxl, api, le32_to_cpu ( ver->minor ) ); + + /* Check for API compatibility */ + if ( api > INTELXL_ADMIN_VF_API_MAJOR ) { + DBGC ( intelxl, "INTELXL %p unsupported API v%d\n", + intelxl, api ); + return -ENOTSUP; + } + + return 0; +} + +/** * Get resources * * @v netdev Network device @@ -636,6 +677,10 @@ static int intelxlvf_probe ( struct pci_device *pci ) { if ( ( rc = intelxlvf_reset_admin ( intelxl ) ) != 0 ) goto err_reset_admin; + /* Negotiate API version */ + if ( ( rc = intelxlvf_admin_version ( netdev ) ) != 0 ) + goto err_version; + /* Get MAC address */ if ( ( rc = intelxlvf_admin_get_resources ( netdev ) ) != 0 ) goto err_get_resources; @@ -649,6 +694,7 @@ static int intelxlvf_probe ( struct pci_device *pci ) { unregister_netdev ( netdev ); err_register_netdev: err_get_resources: + err_version: err_reset_admin: intelxl_close_admin ( intelxl ); err_open_admin: |