mlx4: add a new xmit_more counter
authorEric Dumazet <edumazet@google.com>
Thu, 2 Oct 2014 15:24:21 +0000 (08:24 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 5 Oct 2014 00:04:14 +0000 (20:04 -0400)
ethtool -S reports a new counter, tracking number of time doorbell
was not triggered, because skb->xmit_more was set.

$ ethtool -S eth0 | egrep "tx_packet|xmit_more"
     tx_packets: 2413288400
     xmit_more: 666121277

I merged the tso_packet false sharing avoidance in this patch as well.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
drivers/net/ethernet/mellanox/mlx4/en_port.c
drivers/net/ethernet/mellanox/mlx4/en_tx.c
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h

index 35ff2925110a3f690098e62ab73a3321965be17f..42c9f8b09a6e25e619367c1bb216c8afefc6d6b0 100644 (file)
@@ -112,6 +112,7 @@ static const char main_strings[][ETH_GSTRING_LEN] = {
 
        /* port statistics */
        "tso_packets",
+       "xmit_more",
        "queue_stopped", "wake_queue", "tx_timeout", "rx_alloc_failed",
        "rx_csum_good", "rx_csum_none", "tx_chksum_offload",
 
index c2cfb05e72905cc6961ddc773547e1d09ae26bbf..0a0261d128b9b200369b2fd34d602681ea25c363 100644 (file)
@@ -150,14 +150,19 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
        priv->port_stats.tx_chksum_offload = 0;
        priv->port_stats.queue_stopped = 0;
        priv->port_stats.wake_queue = 0;
+       priv->port_stats.tso_packets = 0;
+       priv->port_stats.xmit_more = 0;
 
        for (i = 0; i < priv->tx_ring_num; i++) {
-               stats->tx_packets += priv->tx_ring[i]->packets;
-               stats->tx_bytes += priv->tx_ring[i]->bytes;
-               priv->port_stats.tx_chksum_offload += priv->tx_ring[i]->tx_csum;
-               priv->port_stats.queue_stopped +=
-                       priv->tx_ring[i]->queue_stopped;
-               priv->port_stats.wake_queue += priv->tx_ring[i]->wake_queue;
+               const struct mlx4_en_tx_ring *ring = priv->tx_ring[i];
+
+               stats->tx_packets += ring->packets;
+               stats->tx_bytes += ring->bytes;
+               priv->port_stats.tx_chksum_offload += ring->tx_csum;
+               priv->port_stats.queue_stopped     += ring->queue_stopped;
+               priv->port_stats.wake_queue        += ring->wake_queue;
+               priv->port_stats.tso_packets       += ring->tso_packets;
+               priv->port_stats.xmit_more         += ring->xmit_more;
        }
 
        stats->rx_errors = be64_to_cpu(mlx4_en_stats->PCS) +
index adedc47e947dca504d1fb94fc88ba76681456cc0..0c501253fdabb0d16fe412c667582e5b227938d4 100644 (file)
@@ -840,7 +840,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
                 * note that we already verified that it is linear */
                memcpy(tx_desc->lso.header, skb->data, lso_header_size);
 
-               priv->port_stats.tso_packets++;
+               ring->tso_packets++;
                i = ((skb->len - lso_header_size) / skb_shinfo(skb)->gso_size) +
                        !!((skb->len - lso_header_size) % skb_shinfo(skb)->gso_size);
                tx_info->nr_bytes = skb->len + (i - 1) * lso_header_size;
@@ -910,6 +910,8 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
                        wmb();
                        iowrite32be(ring->doorbell_qpn,
                                    ring->bf.uar->map + MLX4_SEND_DOORBELL);
+               } else {
+                       ring->xmit_more++;
                }
        }
 
index 6a4fc2394cf2df9487e507e55bef7279b7b5c1eb..84c9d5dbfa4f36e502e0f777dd5a287c3368761b 100644 (file)
@@ -279,6 +279,8 @@ struct mlx4_en_tx_ring {
        unsigned long tx_csum;
        unsigned long queue_stopped;
        unsigned long wake_queue;
+       unsigned long tso_packets;
+       unsigned long xmit_more;
        struct mlx4_bf bf;
        bool bf_enabled;
        bool bf_alloced;
@@ -426,6 +428,7 @@ struct mlx4_en_pkt_stats {
 
 struct mlx4_en_port_stats {
        unsigned long tso_packets;
+       unsigned long xmit_more;
        unsigned long queue_stopped;
        unsigned long wake_queue;
        unsigned long tx_timeout;
@@ -433,7 +436,7 @@ struct mlx4_en_port_stats {
        unsigned long rx_chksum_good;
        unsigned long rx_chksum_none;
        unsigned long tx_chksum_offload;
-#define NUM_PORT_STATS         8
+#define NUM_PORT_STATS         9
 };
 
 struct mlx4_en_perf_stats {