diff options
author | Michael Brown <mcb30@ipxe.org> | 2022-08-08 14:48:25 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2022-08-11 14:53:57 +0100 |
commit | c220b93f3145b10cf9b2a10a52bac4ee1252992f (patch) | |
tree | 047eec14f34296a4e0c67037ede92ca50da6c4a8 /src/drivers/net | |
parent | 67f8878e102accdff5f82130c0c0dd85ebc698d0 (diff) | |
download | ipxe-c220b93f3145b10cf9b2a10a52bac4ee1252992f.tar.gz |
[intelxl] Reuse admin command descriptor and buffer for VF responses
Remove the large static admin data buffer structure embedded within
struct intelxl_nic, and instead copy the response received via the
"send to VF" admin queue event to the (already consumed and completed)
admin command descriptor and data buffer.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/net')
-rw-r--r-- | src/drivers/net/intelxl.h | 4 | ||||
-rw-r--r-- | src/drivers/net/intelxlvf.c | 28 |
2 files changed, 15 insertions, 17 deletions
diff --git a/src/drivers/net/intelxl.h b/src/drivers/net/intelxl.h index cd0d2ee81..771932c0b 100644 --- a/src/drivers/net/intelxl.h +++ b/src/drivers/net/intelxl.h @@ -1092,10 +1092,6 @@ struct intelxl_nic { /** Current VF opcode */ unsigned int vopcode; - /** Current VF return value */ - int vret; - /** Current VF event data buffer */ - union intelxl_admin_buffer vbuf; /** Transmit descriptor ring */ struct intelxl_ring tx; diff --git a/src/drivers/net/intelxlvf.c b/src/drivers/net/intelxlvf.c index 6f52f1393..8774b110a 100644 --- a/src/drivers/net/intelxlvf.c +++ b/src/drivers/net/intelxlvf.c @@ -201,7 +201,7 @@ static int intelxlvf_admin_command ( struct net_device *netdev ) { } /* Check for errors */ - if ( intelxl->vret != 0 ) + if ( cmd->vret != 0 ) return -EIO; return 0; @@ -271,7 +271,9 @@ static void intelxlvf_admin_event ( struct net_device *netdev, struct intelxl_admin_descriptor *evt, union intelxl_admin_buffer *buf ) { struct intelxl_nic *intelxl = netdev->priv; + struct intelxl_admin *admin = &intelxl->command; unsigned int vopcode; + unsigned int index; /* Ignore unrecognised events */ if ( evt->opcode != cpu_to_le16 ( INTELXL_ADMIN_SEND_TO_VF ) ) { @@ -283,12 +285,14 @@ static void intelxlvf_admin_event ( struct net_device *netdev, /* Record command response if applicable */ vopcode = le32_to_cpu ( evt->vopcode ); if ( vopcode == intelxl->vopcode ) { - memcpy ( &intelxl->vbuf, buf, sizeof ( intelxl->vbuf ) ); + index = ( ( admin->index - 1 ) % INTELXL_ADMIN_NUM_DESC ); + memcpy ( &admin->desc[index], evt, sizeof ( *evt ) ); + memcpy ( &admin->buf[index], buf, sizeof ( *buf ) ); intelxl->vopcode = 0; - intelxl->vret = le32_to_cpu ( evt->vret ); - if ( intelxl->vret != 0 ) { + if ( evt->vret != 0 ) { DBGC ( intelxl, "INTELXL %p admin VF command %#x " - "error %d\n", intelxl, vopcode, intelxl->vret ); + "error %d\n", intelxl, vopcode, + le32_to_cpu ( evt->vret ) ); DBGC_HDA ( intelxl, virt_to_phys ( evt ), evt, sizeof ( *evt ) ); DBGC_HDA ( intelxl, virt_to_phys ( buf ), buf, @@ -322,7 +326,6 @@ static void intelxlvf_admin_event ( struct net_device *netdev, 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; @@ -339,10 +342,9 @@ static int intelxlvf_admin_version ( struct net_device *netdev ) { /* Issue command */ if ( ( rc = intelxlvf_admin_command ( netdev ) ) != 0 ) return rc; - ver = &intelxl->vbuf.ver; - api = le32_to_cpu ( ver->major ); + api = le32_to_cpu ( buf->ver.major ); DBGC ( intelxl, "INTELXL %p API v%d.%d\n", - intelxl, api, le32_to_cpu ( ver->minor ) ); + intelxl, api, le32_to_cpu ( buf->ver.minor ) ); /* Check for API compatibility */ if ( api > INTELXL_ADMIN_VF_API_MAJOR ) { @@ -363,21 +365,21 @@ static int intelxlvf_admin_version ( struct net_device *netdev ) { static int intelxlvf_admin_get_resources ( struct net_device *netdev ) { struct intelxl_nic *intelxl = netdev->priv; struct intelxl_admin_descriptor *cmd; - struct intelxl_admin_vf_get_resources_buffer *res; + union intelxl_admin_buffer *buf; int rc; /* Populate descriptor */ cmd = intelxl_admin_command_descriptor ( intelxl ); cmd->vopcode = cpu_to_le32 ( INTELXL_ADMIN_VF_GET_RESOURCES ); + buf = intelxl_admin_command_buffer ( intelxl ); /* Issue command */ if ( ( rc = intelxlvf_admin_command ( netdev ) ) != 0 ) return rc; /* Parse response */ - res = &intelxl->vbuf.res; - intelxl->vsi = le16_to_cpu ( res->vsi ); - memcpy ( netdev->hw_addr, res->mac, ETH_ALEN ); + intelxl->vsi = le16_to_cpu ( buf->res.vsi ); + memcpy ( netdev->hw_addr, buf->res.mac, ETH_ALEN ); DBGC ( intelxl, "INTELXL %p VSI %#04x\n", intelxl, intelxl->vsi ); return 0; |