Преглед на файлове

[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>
tags/v1.20.1
Jarrod Johnson преди 12 години
родител
ревизия
dc70229f70
променени са 1 файла, в които са добавени 13 реда и са изтрити 32 реда
  1. 13
    32
      src/drivers/net/efi/snpnet.c

+ 13
- 32
src/drivers/net/efi/snpnet.c Целия файл

@@ -57,28 +57,25 @@ static int snpnet_transmit ( struct net_device *netdev,
57 57
 	struct snpnet_device *snpnetdev = netdev->priv;
58 58
 	EFI_SIMPLE_NETWORK_PROTOCOL *snp = snpnetdev->snp;
59 59
 	EFI_STATUS efirc;
60
+	void *txbuf=NULL;
60 61
 	size_t len = iob_len ( iobuf );
61 62
 
62 63
 	efirc = snp->Transmit ( snp, 0, len, iobuf->data, NULL, NULL, NULL );
63
-	return EFIRC_TO_RC ( efirc );
64
-}
65
-
66
-/**
67
- * Find a I/O buffer on the list of outstanding Tx buffers and complete it.
68
- *
69
- * @v snpnetdev		SNP network device
70
- * @v txbuf		Buffer address
71
- */
72
-static void snpnet_complete ( struct net_device *netdev, void *txbuf ) {
73
-	struct io_buffer *tmp;
74
-	struct io_buffer *iobuf;
75
-
76
-	list_for_each_entry_safe ( iobuf, tmp, &netdev->tx_queue, list ) {
77
-		if ( iobuf->data == txbuf ) {
78
-			netdev_tx_complete ( netdev, iobuf );
64
+	if (efirc) {
65
+		return EFIRC_TO_RC ( efirc );
66
+	}
67
+	/* since GetStatus is so inconsistent, don't try more than one outstanding transmit at a time */
68
+	while ( txbuf == NULL ) {
69
+		efirc = snp->GetStatus ( snp, NULL, &txbuf );
70
+		if ( efirc ) {
71
+			DBGC ( snp, "SNP %p could not get status %s\n", snp,
72
+			       efi_strerror ( efirc ) );
79 73
 			break;
80 74
 		}
75
+
81 76
 	}
77
+	netdev_tx_complete ( netdev, iobuf );
78
+	return 0;
82 79
 }
83 80
 
84 81
 /**
@@ -92,22 +89,6 @@ static void snpnet_poll ( struct net_device *netdev ) {
92 89
 	EFI_STATUS efirc;
93 90
 	struct io_buffer *iobuf = NULL;
94 91
 	UINTN len;
95
-	void *txbuf;
96
-
97
-	/* Process Tx completions */
98
-	while ( 1 ) {
99
-		efirc = snp->GetStatus ( snp, NULL, &txbuf );
100
-		if ( efirc ) {
101
-			DBGC ( snp, "SNP %p could not get status %s\n", snp,
102
-			       efi_strerror ( efirc ) );
103
-			break;
104
-		}
105
-
106
-		if ( txbuf == NULL )
107
-			break;
108
-
109
-		snpnet_complete ( netdev, txbuf );
110
-	}
111 92
 
112 93
 	/* Process received packets */
113 94
 	while ( 1 ) {

Loading…
Отказ
Запис