mirror of
https://github.com/ipxe/ipxe
synced 2025-12-17 18:11:49 +03:00
[snpnet] Give up entirely on the transmit queue
Practically speaking, it seems the convention is to only have one packet pending and not rely upon any mechanism to associate returned txbuf with txqueue. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
committed by
Michael Brown
parent
4108321bf5
commit
dc70229f70
@@ -57,28 +57,25 @@ static int snpnet_transmit ( struct net_device *netdev,
|
|||||||
struct snpnet_device *snpnetdev = netdev->priv;
|
struct snpnet_device *snpnetdev = netdev->priv;
|
||||||
EFI_SIMPLE_NETWORK_PROTOCOL *snp = snpnetdev->snp;
|
EFI_SIMPLE_NETWORK_PROTOCOL *snp = snpnetdev->snp;
|
||||||
EFI_STATUS efirc;
|
EFI_STATUS efirc;
|
||||||
|
void *txbuf=NULL;
|
||||||
size_t len = iob_len ( iobuf );
|
size_t len = iob_len ( iobuf );
|
||||||
|
|
||||||
efirc = snp->Transmit ( snp, 0, len, iobuf->data, NULL, NULL, NULL );
|
efirc = snp->Transmit ( snp, 0, len, iobuf->data, NULL, NULL, NULL );
|
||||||
return EFIRC_TO_RC ( efirc );
|
if (efirc) {
|
||||||
}
|
return EFIRC_TO_RC ( efirc );
|
||||||
|
}
|
||||||
/**
|
/* since GetStatus is so inconsistent, don't try more than one outstanding transmit at a time */
|
||||||
* Find a I/O buffer on the list of outstanding Tx buffers and complete it.
|
while ( txbuf == NULL ) {
|
||||||
*
|
efirc = snp->GetStatus ( snp, NULL, &txbuf );
|
||||||
* @v snpnetdev SNP network device
|
if ( efirc ) {
|
||||||
* @v txbuf Buffer address
|
DBGC ( snp, "SNP %p could not get status %s\n", snp,
|
||||||
*/
|
efi_strerror ( efirc ) );
|
||||||
static void snpnet_complete ( struct net_device *netdev, void *txbuf ) {
|
|
||||||
struct io_buffer *tmp;
|
|
||||||
struct io_buffer *iobuf;
|
|
||||||
|
|
||||||
list_for_each_entry_safe ( iobuf, tmp, &netdev->tx_queue, list ) {
|
|
||||||
if ( iobuf->data == txbuf ) {
|
|
||||||
netdev_tx_complete ( netdev, iobuf );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
netdev_tx_complete ( netdev, iobuf );
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,22 +89,6 @@ static void snpnet_poll ( struct net_device *netdev ) {
|
|||||||
EFI_STATUS efirc;
|
EFI_STATUS efirc;
|
||||||
struct io_buffer *iobuf = NULL;
|
struct io_buffer *iobuf = NULL;
|
||||||
UINTN len;
|
UINTN len;
|
||||||
void *txbuf;
|
|
||||||
|
|
||||||
/* Process Tx completions */
|
|
||||||
while ( 1 ) {
|
|
||||||
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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Process received packets */
|
/* Process received packets */
|
||||||
while ( 1 ) {
|
while ( 1 ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user