mirror of
https://github.com/ipxe/ipxe
synced 2025-12-19 19:49:45 +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 io_buffer *iobuf ) {
|
||||||
struct vmxnet3_nic *vmxnet = netdev_priv ( netdev );
|
struct vmxnet3_nic *vmxnet = netdev_priv ( netdev );
|
||||||
struct vmxnet3_tx_desc *tx_desc;
|
struct vmxnet3_tx_desc *tx_desc;
|
||||||
|
unsigned int fill;
|
||||||
unsigned int desc_idx;
|
unsigned int desc_idx;
|
||||||
unsigned int generation;
|
unsigned int generation;
|
||||||
|
|
||||||
/* Check that we have a free transmit descriptor */
|
/* Check that we have a free transmit descriptor */
|
||||||
desc_idx = ( vmxnet->count.tx_prod % VMXNET3_NUM_TX_DESC );
|
fill = ( vmxnet->count.tx_prod - vmxnet->count.tx_cons );
|
||||||
generation = ( ( vmxnet->count.tx_prod & VMXNET3_NUM_TX_DESC ) ?
|
if ( fill >= VMXNET3_TX_FILL ) {
|
||||||
0 : cpu_to_le32 ( VMXNET3_TXF_GEN ) );
|
|
||||||
if ( vmxnet->tx_iobuf[desc_idx] ) {
|
|
||||||
DBGC ( vmxnet, "VMXNET3 %p out of transmit descriptors\n",
|
DBGC ( vmxnet, "VMXNET3 %p out of transmit descriptors\n",
|
||||||
vmxnet );
|
vmxnet );
|
||||||
return -ENOBUFS;
|
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 */
|
/* Increment producer counter */
|
||||||
vmxnet->count.tx_prod++;
|
vmxnet->count.tx_prod++;
|
||||||
|
|
||||||
|
|||||||
@@ -493,6 +493,9 @@ struct vmxnet3_nic {
|
|||||||
/** MTU size */
|
/** MTU size */
|
||||||
#define VMXNET3_MTU ( ETH_FRAME_LEN + 4 /* VLAN */ + 4 /* FCS */ )
|
#define VMXNET3_MTU ( ETH_FRAME_LEN + 4 /* VLAN */ + 4 /* FCS */ )
|
||||||
|
|
||||||
|
/** Transmit ring maximum fill level */
|
||||||
|
#define VMXNET3_TX_FILL ( VMXNET3_NUM_TX_DESC - 1 )
|
||||||
|
|
||||||
/** Receive ring maximum fill level */
|
/** Receive ring maximum fill level */
|
||||||
#define VMXNET3_RX_FILL 8
|
#define VMXNET3_RX_FILL 8
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user