aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugenia Emantayev <eugenia@mellanox.com>2014-03-02 03:25:00 -0500
committerDavid S. Miller <davem@davemloft.net>2014-03-02 20:04:01 -0500
commit15bffdffccb3204eb1e993f60eee65c439a03136 (patch)
treeaba0262a2143cc1041e72d120214b99cb9181a5a
parent93591aaa62f89820f4ae0558f01eaf9a359738da (diff)
net/mlx4_en: Move queue stopped/waked counters to be per ring
Give accurate counters and avoids cache misses when several rings update the counters of stop/wake queue. Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com> Signed-off-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_port.c6
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_tx.c6
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4_en.h2
3 files changed, 11 insertions, 3 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_port.c b/drivers/net/ethernet/mellanox/mlx4/en_port.c
index dae1a1f4ae55..c2cfb05e7290 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_port.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_port.c
@@ -148,10 +148,16 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
148 stats->tx_packets = 0; 148 stats->tx_packets = 0;
149 stats->tx_bytes = 0; 149 stats->tx_bytes = 0;
150 priv->port_stats.tx_chksum_offload = 0; 150 priv->port_stats.tx_chksum_offload = 0;
151 priv->port_stats.queue_stopped = 0;
152 priv->port_stats.wake_queue = 0;
153
151 for (i = 0; i < priv->tx_ring_num; i++) { 154 for (i = 0; i < priv->tx_ring_num; i++) {
152 stats->tx_packets += priv->tx_ring[i]->packets; 155 stats->tx_packets += priv->tx_ring[i]->packets;
153 stats->tx_bytes += priv->tx_ring[i]->bytes; 156 stats->tx_bytes += priv->tx_ring[i]->bytes;
154 priv->port_stats.tx_chksum_offload += priv->tx_ring[i]->tx_csum; 157 priv->port_stats.tx_chksum_offload += priv->tx_ring[i]->tx_csum;
158 priv->port_stats.queue_stopped +=
159 priv->tx_ring[i]->queue_stopped;
160 priv->port_stats.wake_queue += priv->tx_ring[i]->wake_queue;
155 } 161 }
156 162
157 stats->rx_errors = be64_to_cpu(mlx4_en_stats->PCS) + 163 stats->rx_errors = be64_to_cpu(mlx4_en_stats->PCS) +
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 781ebca81d0e..56e8fbc128f8 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -445,7 +445,7 @@ static int mlx4_en_process_tx_cq(struct net_device *dev,
445 */ 445 */
446 if (netif_tx_queue_stopped(ring->tx_queue) && txbbs_skipped > 0) { 446 if (netif_tx_queue_stopped(ring->tx_queue) && txbbs_skipped > 0) {
447 netif_tx_wake_queue(ring->tx_queue); 447 netif_tx_wake_queue(ring->tx_queue);
448 priv->port_stats.wake_queue++; 448 ring->wake_queue++;
449 } 449 }
450 return done; 450 return done;
451} 451}
@@ -691,7 +691,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
691 ring->size - HEADROOM - MAX_DESC_TXBBS)) { 691 ring->size - HEADROOM - MAX_DESC_TXBBS)) {
692 /* every full Tx ring stops queue */ 692 /* every full Tx ring stops queue */
693 netif_tx_stop_queue(ring->tx_queue); 693 netif_tx_stop_queue(ring->tx_queue);
694 priv->port_stats.queue_stopped++; 694 ring->queue_stopped++;
695 695
696 /* If queue was emptied after the if, and before the 696 /* If queue was emptied after the if, and before the
697 * stop_queue - need to wake the queue, or else it will remain 697 * stop_queue - need to wake the queue, or else it will remain
@@ -704,7 +704,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
704 if (unlikely(((int)(ring->prod - ring->cons)) <= 704 if (unlikely(((int)(ring->prod - ring->cons)) <=
705 ring->size - HEADROOM - MAX_DESC_TXBBS)) { 705 ring->size - HEADROOM - MAX_DESC_TXBBS)) {
706 netif_tx_wake_queue(ring->tx_queue); 706 netif_tx_wake_queue(ring->tx_queue);
707 priv->port_stats.wake_queue++; 707 ring->wake_queue++;
708 } else { 708 } else {
709 return NETDEV_TX_BUSY; 709 return NETDEV_TX_BUSY;
710 } 710 }
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index 2610cc53fb4a..c59011d4e830 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -274,6 +274,8 @@ struct mlx4_en_tx_ring {
274 unsigned long bytes; 274 unsigned long bytes;
275 unsigned long packets; 275 unsigned long packets;
276 unsigned long tx_csum; 276 unsigned long tx_csum;
277 unsigned long queue_stopped;
278 unsigned long wake_queue;
277 struct mlx4_bf bf; 279 struct mlx4_bf bf;
278 bool bf_enabled; 280 bool bf_enabled;
279 struct netdev_queue *tx_queue; 281 struct netdev_queue *tx_queue;