summaryrefslogtreecommitdiffstats
path: root/src/drivers/net/efi/nii.c
diff options
context:
space:
mode:
authorMichael Brown2015-04-14 18:02:00 +0200
committerMichael Brown2015-04-14 18:02:00 +0200
commitc6c7e78c42fff7b057ce32467ac6aa84bef94026 (patch)
treeca4ccbd8332a075c41b70dfeee8b61e0cf97b089 /src/drivers/net/efi/nii.c
parent[efi] Poll media status only if advertised as supported (diff)
downloadipxe-c6c7e78c42fff7b057ce32467ac6aa84bef94026.tar.gz
ipxe-c6c7e78c42fff7b057ce32467ac6aa84bef94026.tar.xz
ipxe-c6c7e78c42fff7b057ce32467ac6aa84bef94026.zip
[efi] Poll for TX completions only when there is an outstanding TX buffer
At least one NII implementation (in a Microsoft Surface tablet) seems to fail to report the absence (sic) of TX completions properly. Work around this by checking for TX completions only when we expect to see one. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/net/efi/nii.c')
-rw-r--r--src/drivers/net/efi/nii.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/drivers/net/efi/nii.c b/src/drivers/net/efi/nii.c
index 3910dc9f..f2c6647e 100644
--- a/src/drivers/net/efi/nii.c
+++ b/src/drivers/net/efi/nii.c
@@ -785,12 +785,7 @@ static void nii_poll_tx ( struct net_device *netdev, unsigned int stat ) {
return;
/* Sanity check */
- if ( ! nii->txbuf ) {
- DBGC ( nii, "NII %s reported spurious TX completion\n",
- nii->dev.name );
- netdev_tx_err ( netdev, NULL, -EPIPE );
- return;
- }
+ assert ( nii->txbuf != NULL );
/* Complete transmission */
iobuf = nii->txbuf;
@@ -888,7 +883,7 @@ static void nii_poll ( struct net_device *netdev ) {
/* Get status */
op = NII_OP ( PXE_OPCODE_GET_STATUS,
( PXE_OPFLAGS_GET_INTERRUPT_STATUS |
- PXE_OPFLAGS_GET_TRANSMITTED_BUFFERS |
+ ( nii->txbuf ? PXE_OPFLAGS_GET_TRANSMITTED_BUFFERS : 0)|
( nii->media ? PXE_OPFLAGS_GET_MEDIA_STATUS : 0 ) ) );
if ( ( stat = nii_issue_db ( nii, op, &db, sizeof ( db ) ) ) < 0 ) {
rc = -EIO_STAT ( stat );
@@ -898,7 +893,8 @@ static void nii_poll ( struct net_device *netdev ) {
}
/* Process any TX completions */
- nii_poll_tx ( netdev, stat );
+ if ( nii->txbuf )
+ nii_poll_tx ( netdev, stat );
/* Process any RX completions */
nii_poll_rx ( netdev );