diff options
author | Kevin Hilman <khilman@linaro.org> | 2015-07-22 08:17:15 -0700 |
---|---|---|
committer | Kevin Hilman <khilman@linaro.org> | 2015-07-22 08:17:15 -0700 |
commit | 2447e09699cca5db52f86182f163f3a25d1089ab (patch) | |
tree | e16730dba489e5ea0f16737597525724daa5c770 /drivers/net/ethernet/mellanox/mlx4/en_tx.c | |
parent | 5a277b6839c4ef6c6ccacff49b64f302598264bf (diff) | |
parent | c8bde72f9af412de57f0ceae218d648640118b0b (diff) |
Merge branch 'linux-4.1.y' of git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable into linux-linaro-lsk-v4.1lsk-v4.1-15.07
* 'linux-4.1.y' of git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable: (126 commits)
Linux 4.1.3
Input: pixcir_i2c_ts - fix receive error
of/pci: Fix pci_address_to_pio() conversion of CPU address to I/O port
PCI: pciehp: Wait for hotplug command completion where necessary
PCI: Add pci_bus_addr_t
PCI: Propagate the "ignore hotplug" setting to parent
mtd: dc21285: use raw spinlock functions for nw_gpio_lock
mtd: fix: avoid race condition when accessing mtd->usecount
leds / PM: fix hibernation on arm when gpio-led used with CPU led trigger
video: mxsfb: Make sure axi clock is enabled when accessing registers
genirq: devres: Fix testing return value of request_any_context_irq()
IB/srp: Fix reconnection failure handling
IB/srp: Fix connection state tracking
IB/srp: Fix a connection setup race
IB/srp: Remove an extraneous scsi_host_put() from an error path
scsi_transport_srp: Fix a race condition
scsi_transport_srp: Introduce srp_wait_for_queuecommand()
spi: pl022: Specify 'num-cs' property as required in devicetree binding
spi: orion: Fix maximum baud rates for Armada 370/XP
spi: fix race freeing dummy_tx/rx before it is unmapped
...
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/en_tx.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_tx.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index 7bed3a88579f..c10d98f6ad96 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c @@ -66,6 +66,7 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, ring->size = size; ring->size_mask = size - 1; ring->stride = stride; + ring->full_size = ring->size - HEADROOM - MAX_DESC_TXBBS; tmp = size * sizeof(struct mlx4_en_tx_info); ring->tx_info = kmalloc_node(tmp, GFP_KERNEL | __GFP_NOWARN, node); @@ -180,6 +181,7 @@ void mlx4_en_destroy_tx_ring(struct mlx4_en_priv *priv, mlx4_bf_free(mdev->dev, &ring->bf); mlx4_qp_remove(mdev->dev, &ring->qp); mlx4_qp_free(mdev->dev, &ring->qp); + mlx4_qp_release_range(priv->mdev->dev, ring->qpn, 1); mlx4_en_unmap_buffer(&ring->wqres.buf); mlx4_free_hwq_res(mdev->dev, &ring->wqres, ring->buf_size); kfree(ring->bounce_buf); @@ -231,6 +233,11 @@ void mlx4_en_deactivate_tx_ring(struct mlx4_en_priv *priv, MLX4_QP_STATE_RST, NULL, 0, 0, &ring->qp); } +static inline bool mlx4_en_is_tx_ring_full(struct mlx4_en_tx_ring *ring) +{ + return ring->prod - ring->cons > ring->full_size; +} + static void mlx4_en_stamp_wqe(struct mlx4_en_priv *priv, struct mlx4_en_tx_ring *ring, int index, u8 owner) @@ -473,11 +480,10 @@ static bool mlx4_en_process_tx_cq(struct net_device *dev, netdev_tx_completed_queue(ring->tx_queue, packets, bytes); - /* - * Wakeup Tx queue if this stopped, and at least 1 packet - * was completed + /* Wakeup Tx queue if this stopped, and ring is not full. */ - if (netif_tx_queue_stopped(ring->tx_queue) && txbbs_skipped > 0) { + if (netif_tx_queue_stopped(ring->tx_queue) && + !mlx4_en_is_tx_ring_full(ring)) { netif_tx_wake_queue(ring->tx_queue); ring->wake_queue++; } @@ -921,8 +927,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) skb_tx_timestamp(skb); /* Check available TXBBs And 2K spare for prefetch */ - stop_queue = (int)(ring->prod - ring_cons) > - ring->size - HEADROOM - MAX_DESC_TXBBS; + stop_queue = mlx4_en_is_tx_ring_full(ring); if (unlikely(stop_queue)) { netif_tx_stop_queue(ring->tx_queue); ring->queue_stopped++; @@ -991,8 +996,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) smp_rmb(); ring_cons = ACCESS_ONCE(ring->cons); - if (unlikely(((int)(ring->prod - ring_cons)) <= - ring->size - HEADROOM - MAX_DESC_TXBBS)) { + if (unlikely(!mlx4_en_is_tx_ring_full(ring))) { netif_tx_wake_queue(ring->tx_queue); ring->wake_queue++; } |