net/mlx5e: Add TX inner packet counters
authorMatthew Finlay <matt@mellanox.com>
Mon, 22 Feb 2016 16:17:34 +0000 (18:17 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 24 Feb 2016 18:50:22 +0000 (13:50 -0500)
Add TSO and TX checksum counters for tunneled, inner packets

Signed-off-by: Matthew Finlay <matt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/en.h
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c

index a700c5713226096c016d598b88aaa044117ccb41..1dca3dcf90f5358a757631198a4cd2c7d786432c 100644 (file)
@@ -103,12 +103,15 @@ static const char vport_strings[][ETH_GSTRING_LEN] = {
        /* SW counters */
        "tso_packets",
        "tso_bytes",
+       "tso_inner_packets",
+       "tso_inner_bytes",
        "lro_packets",
        "lro_bytes",
        "rx_csum_good",
        "rx_csum_none",
        "rx_csum_sw",
        "tx_csum_offload",
+       "tx_csum_inner",
        "tx_queue_stopped",
        "tx_queue_wake",
        "tx_queue_dropped",
@@ -141,18 +144,21 @@ struct mlx5e_vport_stats {
        /* SW counters */
        u64 tso_packets;
        u64 tso_bytes;
+       u64 tso_inner_packets;
+       u64 tso_inner_bytes;
        u64 lro_packets;
        u64 lro_bytes;
        u64 rx_csum_good;
        u64 rx_csum_none;
        u64 rx_csum_sw;
        u64 tx_csum_offload;
+       u64 tx_csum_inner;
        u64 tx_queue_stopped;
        u64 tx_queue_wake;
        u64 tx_queue_dropped;
        u64 rx_wqe_err;
 
-#define NUM_VPORT_COUNTERS     32
+#define NUM_VPORT_COUNTERS     35
 };
 
 static const char pport_strings[][ETH_GSTRING_LEN] = {
@@ -252,7 +258,10 @@ static const char sq_stats_strings[][ETH_GSTRING_LEN] = {
        "packets",
        "tso_packets",
        "tso_bytes",
+       "tso_inner_packets",
+       "tso_inner_bytes",
        "csum_offload_none",
+       "csum_offload_inner",
        "stopped",
        "wake",
        "dropped",
@@ -263,12 +272,15 @@ struct mlx5e_sq_stats {
        u64 packets;
        u64 tso_packets;
        u64 tso_bytes;
+       u64 tso_inner_packets;
+       u64 tso_inner_bytes;
        u64 csum_offload_none;
+       u64 csum_offload_inner;
        u64 stopped;
        u64 wake;
        u64 dropped;
        u64 nop;
-#define NUM_SQ_STATS 8
+#define NUM_SQ_STATS 11
 };
 
 struct mlx5e_stats {
index 6f7eb3b21e2b31f4644ff6771076ec60acc4c546..0d45f35aee7208fc1a855cff842070c984e24f75 100644 (file)
@@ -145,9 +145,12 @@ void mlx5e_update_stats(struct mlx5e_priv *priv)
        /* Collect firts the SW counters and then HW for consistency */
        s->tso_packets          = 0;
        s->tso_bytes            = 0;
+       s->tso_inner_packets    = 0;
+       s->tso_inner_bytes      = 0;
        s->tx_queue_stopped     = 0;
        s->tx_queue_wake        = 0;
        s->tx_queue_dropped     = 0;
+       s->tx_csum_inner        = 0;
        tx_offload_none         = 0;
        s->lro_packets          = 0;
        s->lro_bytes            = 0;
@@ -168,9 +171,12 @@ void mlx5e_update_stats(struct mlx5e_priv *priv)
 
                        s->tso_packets          += sq_stats->tso_packets;
                        s->tso_bytes            += sq_stats->tso_bytes;
+                       s->tso_inner_packets    += sq_stats->tso_inner_packets;
+                       s->tso_inner_bytes      += sq_stats->tso_inner_bytes;
                        s->tx_queue_stopped     += sq_stats->stopped;
                        s->tx_queue_wake        += sq_stats->wake;
                        s->tx_queue_dropped     += sq_stats->dropped;
+                       s->tx_csum_inner        += sq_stats->csum_offload_inner;
                        tx_offload_none         += sq_stats->csum_offload_none;
                }
        }
@@ -245,7 +251,7 @@ void mlx5e_update_stats(struct mlx5e_priv *priv)
                s->tx_broadcast_bytes;
 
        /* Update calculated offload counters */
-       s->tx_csum_offload = s->tx_packets - tx_offload_none;
+       s->tx_csum_offload = s->tx_packets - tx_offload_none - s->tx_csum_inner;
        s->rx_csum_good    = s->rx_packets - s->rx_csum_none -
                               s->rx_csum_sw;
 
index 6ce2884388ccfdc7a2e1d88544c7138caccff2d2..a05c070cbc2f756d2b271ee73de9d21b1a9f4b4a 100644 (file)
@@ -187,11 +187,13 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
 
        if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
                eseg->cs_flags = MLX5_ETH_WQE_L3_CSUM;
-               if (skb->encapsulation)
+               if (skb->encapsulation) {
                        eseg->cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM |
                                          MLX5_ETH_WQE_L4_INNER_CSUM;
-               else
+                       sq->stats.csum_offload_inner++;
+               } else {
                        eseg->cs_flags |= MLX5_ETH_WQE_L4_CSUM;
+               }
        } else
                sq->stats.csum_offload_none++;
 
@@ -201,21 +203,21 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
        }
 
        if (skb_is_gso(skb)) {
-               u32 payload_len;
-
                eseg->mss    = cpu_to_be16(skb_shinfo(skb)->gso_size);
                opcode       = MLX5_OPCODE_LSO;
 
-               if (skb->encapsulation)
+               if (skb->encapsulation) {
                        ihs = skb_inner_transport_offset(skb) + inner_tcp_hdrlen(skb);
-               else
+                       sq->stats.tso_inner_packets++;
+                       sq->stats.tso_inner_bytes += skb->len - ihs;
+               } else {
                        ihs = skb_transport_offset(skb) + tcp_hdrlen(skb);
+                       sq->stats.tso_packets++;
+                       sq->stats.tso_bytes += skb->len - ihs;
+               }
 
-               payload_len   = skb->len - ihs;
                wi->num_bytes = skb->len +
                                (skb_shinfo(skb)->gso_segs - 1) * ihs;
-               sq->stats.tso_packets++;
-               sq->stats.tso_bytes += payload_len;
        } else {
                bf = sq->bf_budget &&
                     !skb->xmit_more &&
This page took 0.028407 seconds and 5 git commands to generate.