mirror of
https://github.com/ipxe/ipxe
synced 2026-01-01 09:09:32 +03:00
[vmxnet3] Avoid completely filling the TX descriptor ring
Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
committed by
Michael Brown
parent
1852803e46
commit
3f8da985aa
@@ -92,19 +92,24 @@ static int vmxnet3_transmit ( struct net_device *netdev,
|
||||
struct io_buffer *iobuf ) {
|
||||
struct vmxnet3_nic *vmxnet = netdev_priv ( netdev );
|
||||
struct vmxnet3_tx_desc *tx_desc;
|
||||
unsigned int fill;
|
||||
unsigned int desc_idx;
|
||||
unsigned int generation;
|
||||
|
||||
/* Check that we have a free transmit descriptor */
|
||||
desc_idx = ( vmxnet->count.tx_prod % VMXNET3_NUM_TX_DESC );
|
||||
generation = ( ( vmxnet->count.tx_prod & VMXNET3_NUM_TX_DESC ) ?
|
||||
0 : cpu_to_le32 ( VMXNET3_TXF_GEN ) );
|
||||
if ( vmxnet->tx_iobuf[desc_idx] ) {
|
||||
fill = ( vmxnet->count.tx_prod - vmxnet->count.tx_cons );
|
||||
if ( fill >= VMXNET3_TX_FILL ) {
|
||||
DBGC ( vmxnet, "VMXNET3 %p out of transmit descriptors\n",
|
||||
vmxnet );
|
||||
return -ENOBUFS;
|
||||
}
|
||||
|
||||
/* Locate transmit descriptor */
|
||||
desc_idx = ( vmxnet->count.tx_prod % VMXNET3_NUM_TX_DESC );
|
||||
generation = ( ( vmxnet->count.tx_prod & VMXNET3_NUM_TX_DESC ) ?
|
||||
0 : cpu_to_le32 ( VMXNET3_TXF_GEN ) );
|
||||
assert ( vmxnet->tx_iobuf[desc_idx] == NULL );
|
||||
|
||||
/* Increment producer counter */
|
||||
vmxnet->count.tx_prod++;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user