mirror of https://github.com/ipxe/ipxe.git
[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>pull/697/head^2
parent
67f8878e10
commit
c220b93f31
|
@ -1092,10 +1092,6 @@ struct intelxl_nic {
|
||||||
|
|
||||||
/** Current VF opcode */
|
/** Current VF opcode */
|
||||||
unsigned int vopcode;
|
unsigned int vopcode;
|
||||||
/** Current VF return value */
|
|
||||||
int vret;
|
|
||||||
/** Current VF event data buffer */
|
|
||||||
union intelxl_admin_buffer vbuf;
|
|
||||||
|
|
||||||
/** Transmit descriptor ring */
|
/** Transmit descriptor ring */
|
||||||
struct intelxl_ring tx;
|
struct intelxl_ring tx;
|
||||||
|
|
|
@ -201,7 +201,7 @@ static int intelxlvf_admin_command ( struct net_device *netdev ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for errors */
|
/* Check for errors */
|
||||||
if ( intelxl->vret != 0 )
|
if ( cmd->vret != 0 )
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -271,7 +271,9 @@ static void intelxlvf_admin_event ( struct net_device *netdev,
|
||||||
struct intelxl_admin_descriptor *evt,
|
struct intelxl_admin_descriptor *evt,
|
||||||
union intelxl_admin_buffer *buf ) {
|
union intelxl_admin_buffer *buf ) {
|
||||||
struct intelxl_nic *intelxl = netdev->priv;
|
struct intelxl_nic *intelxl = netdev->priv;
|
||||||
|
struct intelxl_admin *admin = &intelxl->command;
|
||||||
unsigned int vopcode;
|
unsigned int vopcode;
|
||||||
|
unsigned int index;
|
||||||
|
|
||||||
/* Ignore unrecognised events */
|
/* Ignore unrecognised events */
|
||||||
if ( evt->opcode != cpu_to_le16 ( INTELXL_ADMIN_SEND_TO_VF ) ) {
|
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 */
|
/* Record command response if applicable */
|
||||||
vopcode = le32_to_cpu ( evt->vopcode );
|
vopcode = le32_to_cpu ( evt->vopcode );
|
||||||
if ( vopcode == intelxl->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->vopcode = 0;
|
||||||
intelxl->vret = le32_to_cpu ( evt->vret );
|
if ( evt->vret != 0 ) {
|
||||||
if ( intelxl->vret != 0 ) {
|
|
||||||
DBGC ( intelxl, "INTELXL %p admin VF command %#x "
|
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,
|
DBGC_HDA ( intelxl, virt_to_phys ( evt ), evt,
|
||||||
sizeof ( *evt ) );
|
sizeof ( *evt ) );
|
||||||
DBGC_HDA ( intelxl, virt_to_phys ( buf ), buf,
|
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 ) {
|
static int intelxlvf_admin_version ( struct net_device *netdev ) {
|
||||||
struct intelxl_nic *intelxl = netdev->priv;
|
struct intelxl_nic *intelxl = netdev->priv;
|
||||||
struct intelxl_admin_descriptor *cmd;
|
struct intelxl_admin_descriptor *cmd;
|
||||||
struct intelxl_admin_vf_version_buffer *ver;
|
|
||||||
union intelxl_admin_buffer *buf;
|
union intelxl_admin_buffer *buf;
|
||||||
unsigned int api;
|
unsigned int api;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -339,10 +342,9 @@ static int intelxlvf_admin_version ( struct net_device *netdev ) {
|
||||||
/* Issue command */
|
/* Issue command */
|
||||||
if ( ( rc = intelxlvf_admin_command ( netdev ) ) != 0 )
|
if ( ( rc = intelxlvf_admin_command ( netdev ) ) != 0 )
|
||||||
return rc;
|
return rc;
|
||||||
ver = &intelxl->vbuf.ver;
|
api = le32_to_cpu ( buf->ver.major );
|
||||||
api = le32_to_cpu ( ver->major );
|
|
||||||
DBGC ( intelxl, "INTELXL %p API v%d.%d\n",
|
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 */
|
/* Check for API compatibility */
|
||||||
if ( api > INTELXL_ADMIN_VF_API_MAJOR ) {
|
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 ) {
|
static int intelxlvf_admin_get_resources ( struct net_device *netdev ) {
|
||||||
struct intelxl_nic *intelxl = netdev->priv;
|
struct intelxl_nic *intelxl = netdev->priv;
|
||||||
struct intelxl_admin_descriptor *cmd;
|
struct intelxl_admin_descriptor *cmd;
|
||||||
struct intelxl_admin_vf_get_resources_buffer *res;
|
union intelxl_admin_buffer *buf;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Populate descriptor */
|
/* Populate descriptor */
|
||||||
cmd = intelxl_admin_command_descriptor ( intelxl );
|
cmd = intelxl_admin_command_descriptor ( intelxl );
|
||||||
cmd->vopcode = cpu_to_le32 ( INTELXL_ADMIN_VF_GET_RESOURCES );
|
cmd->vopcode = cpu_to_le32 ( INTELXL_ADMIN_VF_GET_RESOURCES );
|
||||||
|
buf = intelxl_admin_command_buffer ( intelxl );
|
||||||
|
|
||||||
/* Issue command */
|
/* Issue command */
|
||||||
if ( ( rc = intelxlvf_admin_command ( netdev ) ) != 0 )
|
if ( ( rc = intelxlvf_admin_command ( netdev ) ) != 0 )
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
/* Parse response */
|
/* Parse response */
|
||||||
res = &intelxl->vbuf.res;
|
intelxl->vsi = le16_to_cpu ( buf->res.vsi );
|
||||||
intelxl->vsi = le16_to_cpu ( res->vsi );
|
memcpy ( netdev->hw_addr, buf->res.mac, ETH_ALEN );
|
||||||
memcpy ( netdev->hw_addr, res->mac, ETH_ALEN );
|
|
||||||
DBGC ( intelxl, "INTELXL %p VSI %#04x\n", intelxl, intelxl->vsi );
|
DBGC ( intelxl, "INTELXL %p VSI %#04x\n", intelxl, intelxl->vsi );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue