diff options
author | Amir Vadai <amirv@mellanox.com> | 2014-07-08 04:28:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-07-08 23:00:49 -0400 |
commit | fbc6daf19745b372c0d909e5d74ab02e42b70e51 (patch) | |
tree | 261af07430baed5f056fde747f73e9f9879bf02c /drivers/net/ethernet/mellanox/mlx4/en_tx.c | |
parent | 0b0302449110ca5ca4350458ed57b971fcb78ec1 (diff) |
net/mlx4_en: Ignore budget on TX napi polling
It is recommended that TX work not count against the quota.
The cost of TX packet liberation is a minute percentage of what it costs to
process an RX frame. Furthermore, that SKB freeing makes memory available for
other paths in the stack.
Give the TX a larger budget and be more aggressive about cleaning up the Tx
descriptors this budget could be changed using ethtool:
$ ethtool -C eth1 tx-frames-irq <budget>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/en_tx.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_tx.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index ac3dead3792c..5045bab59633 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c | |||
@@ -351,9 +351,8 @@ int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring) | |||
351 | return cnt; | 351 | return cnt; |
352 | } | 352 | } |
353 | 353 | ||
354 | static int mlx4_en_process_tx_cq(struct net_device *dev, | 354 | static bool mlx4_en_process_tx_cq(struct net_device *dev, |
355 | struct mlx4_en_cq *cq, | 355 | struct mlx4_en_cq *cq) |
356 | int budget) | ||
357 | { | 356 | { |
358 | struct mlx4_en_priv *priv = netdev_priv(dev); | 357 | struct mlx4_en_priv *priv = netdev_priv(dev); |
359 | struct mlx4_cq *mcq = &cq->mcq; | 358 | struct mlx4_cq *mcq = &cq->mcq; |
@@ -372,9 +371,10 @@ static int mlx4_en_process_tx_cq(struct net_device *dev, | |||
372 | int factor = priv->cqe_factor; | 371 | int factor = priv->cqe_factor; |
373 | u64 timestamp = 0; | 372 | u64 timestamp = 0; |
374 | int done = 0; | 373 | int done = 0; |
374 | int budget = priv->tx_work_limit; | ||
375 | 375 | ||
376 | if (!priv->port_up) | 376 | if (!priv->port_up) |
377 | return 0; | 377 | return true; |
378 | 378 | ||
379 | index = cons_index & size_mask; | 379 | index = cons_index & size_mask; |
380 | cqe = &buf[(index << factor) + factor]; | 380 | cqe = &buf[(index << factor) + factor]; |
@@ -447,7 +447,7 @@ static int mlx4_en_process_tx_cq(struct net_device *dev, | |||
447 | netif_tx_wake_queue(ring->tx_queue); | 447 | netif_tx_wake_queue(ring->tx_queue); |
448 | ring->wake_queue++; | 448 | ring->wake_queue++; |
449 | } | 449 | } |
450 | return done; | 450 | return done < budget; |
451 | } | 451 | } |
452 | 452 | ||
453 | void mlx4_en_tx_irq(struct mlx4_cq *mcq) | 453 | void mlx4_en_tx_irq(struct mlx4_cq *mcq) |
@@ -467,18 +467,16 @@ int mlx4_en_poll_tx_cq(struct napi_struct *napi, int budget) | |||
467 | struct mlx4_en_cq *cq = container_of(napi, struct mlx4_en_cq, napi); | 467 | struct mlx4_en_cq *cq = container_of(napi, struct mlx4_en_cq, napi); |
468 | struct net_device *dev = cq->dev; | 468 | struct net_device *dev = cq->dev; |
469 | struct mlx4_en_priv *priv = netdev_priv(dev); | 469 | struct mlx4_en_priv *priv = netdev_priv(dev); |
470 | int done; | 470 | int clean_complete; |
471 | 471 | ||
472 | done = mlx4_en_process_tx_cq(dev, cq, budget); | 472 | clean_complete = mlx4_en_process_tx_cq(dev, cq); |
473 | if (!clean_complete) | ||
474 | return budget; | ||
473 | 475 | ||
474 | /* If we used up all the quota - we're probably not done yet... */ | 476 | napi_complete(napi); |
475 | if (done < budget) { | 477 | mlx4_en_arm_cq(priv, cq); |
476 | /* Done for now */ | 478 | |
477 | napi_complete(napi); | 479 | return 0; |
478 | mlx4_en_arm_cq(priv, cq); | ||
479 | return done; | ||
480 | } | ||
481 | return budget; | ||
482 | } | 480 | } |
483 | 481 | ||
484 | static struct mlx4_en_tx_desc *mlx4_en_bounce_to_desc(struct mlx4_en_priv *priv, | 482 | static struct mlx4_en_tx_desc *mlx4_en_bounce_to_desc(struct mlx4_en_priv *priv, |