Skip to content

Commit

Permalink
At least some versions of Emulex SNP driver differ from other vendors…
Browse files Browse the repository at this point in the history
… by never returning a NULL txbuf in GetStatus.

To tolerate this, modify the transmit poll behavior to loop until all iobufs iPXE wanted to transmit had their addresses returned.
If iPXE has no iobufs that it thinks should be transmitting, don't bother calling GetStatus anymore and proceed to receive loop.
  • Loading branch information
Jarrod Johnson committed Jan 14, 2012
1 parent e7a19f2 commit 9dd1a8f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/drivers/net/efi/snpnet.c
Expand Up @@ -43,6 +43,9 @@ struct snpnet_device {

/** State that the SNP should be in after close */
UINT32 close_state;

/** Count of packets awaiting confirmed transmit */
UINT32 txpending;
};

/**
Expand All @@ -58,6 +61,7 @@ static int snpnet_transmit ( struct net_device *netdev,
EFI_SIMPLE_NETWORK_PROTOCOL *snp = snpnetdev->snp;
EFI_STATUS efirc;
size_t len = iob_len ( iobuf );
snpnetdev->txpending++;

efirc = snp->Transmit ( snp, 0, len, iobuf->data, NULL, NULL, NULL );
return EFIRC_TO_RC ( efirc );
Expand All @@ -75,6 +79,8 @@ static void snpnet_complete ( struct net_device *netdev, void *txbuf ) {

list_for_each_entry_safe ( iobuf, tmp, &netdev->tx_queue, list ) {
if ( iobuf->data == txbuf ) {
struct snpnet_device *snpnetdev = netdev->priv;
snpnetdev->txpending--;
netdev_tx_complete ( netdev, iobuf );
break;
}
Expand All @@ -95,18 +101,16 @@ static void snpnet_poll ( struct net_device *netdev ) {
void *txbuf;

/* Process Tx completions */
while ( 1 ) {
while ( snpnetdev->txpending ) {
efirc = snp->GetStatus ( snp, NULL, &txbuf );
if ( efirc ) {
DBGC ( snp, "SNP %p could not get status %s\n", snp,
efi_strerror ( efirc ) );
break;
}

if ( txbuf == NULL )
break;

snpnet_complete ( netdev, txbuf );
if ( txbuf != NULL )
snpnet_complete ( netdev, txbuf );
}

/* Process received packets */
Expand Down

0 comments on commit 9dd1a8f

Please sign in to comment.