Browse Source

[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 years ago
parent
commit
dc70229f70
1 changed files with 13 additions and 32 deletions
  1. 13
    32
      src/drivers/net/efi/snpnet.c

+ 13
- 32
src/drivers/net/efi/snpnet.c View File

57
 	struct snpnet_device *snpnetdev = netdev->priv;
57
 	struct snpnet_device *snpnetdev = netdev->priv;
58
 	EFI_SIMPLE_NETWORK_PROTOCOL *snp = snpnetdev->snp;
58
 	EFI_SIMPLE_NETWORK_PROTOCOL *snp = snpnetdev->snp;
59
 	EFI_STATUS efirc;
59
 	EFI_STATUS efirc;
60
+	void *txbuf=NULL;
60
 	size_t len = iob_len ( iobuf );
61
 	size_t len = iob_len ( iobuf );
61
 
62
 
62
 	efirc = snp->Transmit ( snp, 0, len, iobuf->data, NULL, NULL, NULL );
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
 			break;
73
 			break;
80
 		}
74
 		}
75
+
81
 	}
76
 	}
77
+	netdev_tx_complete ( netdev, iobuf );
78
+	return 0;
82
 }
79
 }
83
 
80
 
84
 /**
81
 /**
92
 	EFI_STATUS efirc;
89
 	EFI_STATUS efirc;
93
 	struct io_buffer *iobuf = NULL;
90
 	struct io_buffer *iobuf = NULL;
94
 	UINTN len;
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
 	/* Process received packets */
93
 	/* Process received packets */
113
 	while ( 1 ) {
94
 	while ( 1 ) {

Loading…
Cancel
Save