[efi] Fix receive and transmit completion reporting

Fix the TxBuf value filled in by GetStatus() to report the transmit
buffer address as required by the (now clarified) specification.

Simplify "interrupt" handling in GetStatus() to report only that one
or more packets have been transmitted or received; there is no need to
report one GetStatus() "interrupt" per packet.

Simplify receive handling to dequeue received packets immediately from
the network device into an internal list (thereby avoiding the hacks
previously used to determine when to report new packet arrivals).

Originally-fixed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2015-07-22 18:31:45 +01:00
parent f903ddaac0
commit 88a5f56dc7
2 changed files with 79 additions and 80 deletions

View File

@@ -18,6 +18,9 @@
#include <ipxe/efi/Protocol/HiiDatabase.h>
#include <ipxe/efi/Protocol/LoadFile.h>
/** SNP transmit completion ring size */
#define EFI_SNP_NUM_TX 32
/** An SNP device */
struct efi_snp_device {
/** List of SNP devices */
@@ -34,20 +37,16 @@ struct efi_snp_device {
EFI_SIMPLE_NETWORK_MODE mode;
/** Started flag */
int started;
/** Outstanding TX packet count (via "interrupt status")
*
* Used in order to generate TX completions.
*/
unsigned int tx_count_interrupts;
/** Outstanding TX packet count (via "recycled tx buffers")
*
* Used in order to generate TX completions.
*/
unsigned int tx_count_txbufs;
/** Outstanding RX packet count (via "interrupt status") */
unsigned int rx_count_interrupts;
/** Outstanding RX packet count (via WaitForPacket event) */
unsigned int rx_count_events;
/** Pending interrupt status */
unsigned int interrupts;
/** Transmit completion ring */
VOID *tx[EFI_SNP_NUM_TX];
/** Transmit completion ring producer counter */
unsigned int tx_prod;
/** Transmit completion ring consumer counter */
unsigned int tx_cons;
/** Receive queue */
struct list_head rx;
/** The network interface identifier */
EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL nii;
/** Component name protocol */