[intel] Avoid completely filling the TX descriptor ring
It is unclear from the datasheets whether or not the TX ring can be completely filled (i.e. whether writing the tail value as equal to the current head value will cause the ring to be treated as completely full or completely empty). It is very plausible that this edge case could differ in behaviour between real hardware and the many implementations of an emulated Intel NIC found in various virtual machines. Err on the side of caution and always leave at least one ring entry empty. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -593,7 +593,7 @@ int intel_transmit ( struct net_device *netdev, struct io_buffer *iobuf ) {
|
||||
physaddr_t address;
|
||||
|
||||
/* Get next transmit descriptor */
|
||||
if ( ( intel->tx.prod - intel->tx.cons ) >= INTEL_NUM_TX_DESC ) {
|
||||
if ( ( intel->tx.prod - intel->tx.cons ) >= INTEL_TX_FILL ) {
|
||||
DBGC ( intel, "INTEL %p out of transmit descriptors\n", intel );
|
||||
return -ENOBUFS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user