vmxnet3: adjust ring sizes when interface is down

If ethtool is used to update ring sizes on a vmxnet3 interface that isn't
running, the change isn't stored, meaning the ring update is effectively is
ignored and lost without any indication to the user.

Other network drivers store the ring size update so that ring allocation uses
the new sizes next time the interface is brought up.  This patch modifies
vmxnet3 to behave this way as well

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Shreyas Bhatewara <sbhatewara@vmware.com>
CC: "VMware, Inc." <pv-drivers@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Neil Horman 2014-06-13 10:03:21 -04:00 committed by David S. Miller
parent 7171511eae
commit f00e2b0ac3
3 changed files with 18 additions and 6 deletions

View File

@ -2589,8 +2589,8 @@ vmxnet3_open(struct net_device *netdev)
for (i = 0; i < adapter->num_tx_queues; i++) for (i = 0; i < adapter->num_tx_queues; i++)
spin_lock_init(&adapter->tx_queue[i].tx_lock); spin_lock_init(&adapter->tx_queue[i].tx_lock);
err = vmxnet3_create_queues(adapter, VMXNET3_DEF_TX_RING_SIZE, err = vmxnet3_create_queues(adapter, adapter->tx_ring_size,
VMXNET3_DEF_RX_RING_SIZE, adapter->rx_ring_size,
VMXNET3_DEF_RX_RING_SIZE); VMXNET3_DEF_RX_RING_SIZE);
if (err) if (err)
goto queue_err; goto queue_err;
@ -2968,6 +2968,9 @@ vmxnet3_probe_device(struct pci_dev *pdev,
adapter->netdev = netdev; adapter->netdev = netdev;
adapter->pdev = pdev; adapter->pdev = pdev;
adapter->tx_ring_size = VMXNET3_DEF_TX_RING_SIZE;
adapter->rx_ring_size = VMXNET3_DEF_RX_RING_SIZE;
spin_lock_init(&adapter->cmd_lock); spin_lock_init(&adapter->cmd_lock);
adapter->adapter_pa = dma_map_single(&adapter->pdev->dev, adapter, adapter->adapter_pa = dma_map_single(&adapter->pdev->dev, adapter,
sizeof(struct vmxnet3_adapter), sizeof(struct vmxnet3_adapter),

View File

@ -449,8 +449,8 @@ vmxnet3_get_ringparam(struct net_device *netdev,
param->rx_mini_max_pending = 0; param->rx_mini_max_pending = 0;
param->rx_jumbo_max_pending = 0; param->rx_jumbo_max_pending = 0;
param->rx_pending = adapter->rx_queue[0].rx_ring[0].size; param->rx_pending = adapter->rx_ring_size;
param->tx_pending = adapter->tx_queue[0].tx_ring.size; param->tx_pending = adapter->tx_ring_size;
param->rx_mini_pending = 0; param->rx_mini_pending = 0;
param->rx_jumbo_pending = 0; param->rx_jumbo_pending = 0;
} }
@ -529,9 +529,11 @@ vmxnet3_set_ringparam(struct net_device *netdev,
* size */ * size */
netdev_err(netdev, "failed to apply new sizes, " netdev_err(netdev, "failed to apply new sizes, "
"try the default ones\n"); "try the default ones\n");
new_rx_ring_size = VMXNET3_DEF_RX_RING_SIZE;
new_tx_ring_size = VMXNET3_DEF_TX_RING_SIZE;
err = vmxnet3_create_queues(adapter, err = vmxnet3_create_queues(adapter,
VMXNET3_DEF_TX_RING_SIZE, new_tx_ring_size,
VMXNET3_DEF_RX_RING_SIZE, new_rx_ring_size,
VMXNET3_DEF_RX_RING_SIZE); VMXNET3_DEF_RX_RING_SIZE);
if (err) { if (err) {
netdev_err(netdev, "failed to create queues " netdev_err(netdev, "failed to create queues "
@ -545,6 +547,8 @@ vmxnet3_set_ringparam(struct net_device *netdev,
netdev_err(netdev, "failed to re-activate, error %d." netdev_err(netdev, "failed to re-activate, error %d."
" Closing it\n", err); " Closing it\n", err);
} }
adapter->tx_ring_size = new_tx_ring_size;
adapter->rx_ring_size = new_rx_ring_size;
out: out:
clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state); clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state);

View File

@ -349,6 +349,11 @@ struct vmxnet3_adapter {
u32 link_speed; /* in mbps */ u32 link_speed; /* in mbps */
u64 tx_timeout_count; u64 tx_timeout_count;
/* Ring sizes */
u32 tx_ring_size;
u32 rx_ring_size;
struct work_struct work; struct work_struct work;
unsigned long state; /* VMXNET3_STATE_BIT_xxx */ unsigned long state; /* VMXNET3_STATE_BIT_xxx */