浏览代码

[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>
tags/v1.20.1
Michael Brown 10 年前
父节点
当前提交
c6c7e78c42
共有 1 个文件被更改,包括 4 次插入8 次删除
  1. 4
    8
      src/drivers/net/efi/nii.c

+ 4
- 8
src/drivers/net/efi/nii.c 查看文件

785
 		return;
785
 		return;
786
 
786
 
787
 	/* Sanity check */
787
 	/* Sanity check */
788
-	if ( ! nii->txbuf ) {
789
-		DBGC ( nii, "NII %s reported spurious TX completion\n",
790
-		       nii->dev.name );
791
-		netdev_tx_err ( netdev, NULL, -EPIPE );
792
-		return;
793
-	}
788
+	assert ( nii->txbuf != NULL );
794
 
789
 
795
 	/* Complete transmission */
790
 	/* Complete transmission */
796
 	iobuf = nii->txbuf;
791
 	iobuf = nii->txbuf;
888
 	/* Get status */
883
 	/* Get status */
889
 	op = NII_OP ( PXE_OPCODE_GET_STATUS,
884
 	op = NII_OP ( PXE_OPCODE_GET_STATUS,
890
 		      ( PXE_OPFLAGS_GET_INTERRUPT_STATUS |
885
 		      ( PXE_OPFLAGS_GET_INTERRUPT_STATUS |
891
-			PXE_OPFLAGS_GET_TRANSMITTED_BUFFERS |
886
+			( nii->txbuf ? PXE_OPFLAGS_GET_TRANSMITTED_BUFFERS : 0)|
892
 			( nii->media ? PXE_OPFLAGS_GET_MEDIA_STATUS : 0 ) ) );
887
 			( nii->media ? PXE_OPFLAGS_GET_MEDIA_STATUS : 0 ) ) );
893
 	if ( ( stat = nii_issue_db ( nii, op, &db, sizeof ( db ) ) ) < 0 ) {
888
 	if ( ( stat = nii_issue_db ( nii, op, &db, sizeof ( db ) ) ) < 0 ) {
894
 		rc = -EIO_STAT ( stat );
889
 		rc = -EIO_STAT ( stat );
898
 	}
893
 	}
899
 
894
 
900
 	/* Process any TX completions */
895
 	/* Process any TX completions */
901
-	nii_poll_tx ( netdev, stat );
896
+	if ( nii->txbuf )
897
+		nii_poll_tx ( netdev, stat );
902
 
898
 
903
 	/* Process any RX completions */
899
 	/* Process any RX completions */
904
 	nii_poll_rx ( netdev );
900
 	nii_poll_rx ( netdev );

正在加载...
取消
保存