i40e: Split bytes and packets from Rx/Tx stats
authorAlexander Duyck <alexander.h.duyck@intel.com>
Sat, 28 Sep 2013 06:00:43 +0000 (06:00 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 10 Oct 2013 05:21:39 +0000 (22:21 -0700)
This makes it so that the Tx and Rx byte and packet counts are
separated from the rest of the statistics.  This allows for better
isolation of these stats when we move them into the 64 bit statistics.

Simplify things by re-ordering how the stats display in ethtool.
Instead of displaying all of the Tx queues as a block, followed by all
the Rx queues, the new order is Tx[0], Rx[0], Tx[1], Rx[1], ..., Tx[n],
Rx[n].  This reduces the loops and cleans up the display for testing
purposes since it is very easy to verify if flow director is doing the
right thing as the Tx and Rx queue pair are shown in pairs.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_debugfs.c
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/i40e/i40e_txrx.c
drivers/net/ethernet/intel/i40e/i40e_txrx.h

index 0b01c61f70c22094174629b876e1ab7fa5db64de..2b6655bf1f3d1b5deeb9bc14b1065311683b1bc7 100644 (file)
@@ -512,8 +512,8 @@ static void i40e_dbg_dump_vsi_seid(struct i40e_pf *pf, int seid)
                                 vsi->rx_rings[i].ring_active);
                        dev_info(&pf->pdev->dev,
                                 "    rx_rings[%i]: rx_stats: packets = %lld, bytes = %lld, non_eop_descs = %lld\n",
-                                i, vsi->rx_rings[i].rx_stats.packets,
-                                vsi->rx_rings[i].rx_stats.bytes,
+                                i, vsi->rx_rings[i].stats.packets,
+                                vsi->rx_rings[i].stats.bytes,
                                 vsi->rx_rings[i].rx_stats.non_eop_descs);
                        dev_info(&pf->pdev->dev,
                                 "    rx_rings[%i]: rx_stats: alloc_rx_page_failed = %lld, alloc_rx_buff_failed = %lld\n",
@@ -556,8 +556,8 @@ static void i40e_dbg_dump_vsi_seid(struct i40e_pf *pf, int seid)
                                 vsi->tx_rings[i].ring_active);
                        dev_info(&pf->pdev->dev,
                                 "    tx_rings[%i]: tx_stats: packets = %lld, bytes = %lld, restart_queue = %lld\n",
-                                i, vsi->tx_rings[i].tx_stats.packets,
-                                vsi->tx_rings[i].tx_stats.bytes,
+                                i, vsi->tx_rings[i].stats.packets,
+                                vsi->tx_rings[i].stats.bytes,
                                 vsi->tx_rings[i].tx_stats.restart_queue);
                        dev_info(&pf->pdev->dev,
                                 "    tx_rings[%i]: tx_stats: tx_busy = %lld, tx_done_old = %lld\n",
index 9a76b8cec76c0b9ef700c8fb6c68c75fd4e09e05..8754c6fa6324711496a3c7e1b08f90ec988a33dd 100644 (file)
@@ -587,13 +587,11 @@ static void i40e_get_ethtool_stats(struct net_device *netdev,
                data[i++] = (i40e_gstrings_net_stats[j].sizeof_stat ==
                        sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
        }
-       for (j = 0; j < vsi->num_queue_pairs; j++) {
-               data[i++] = vsi->tx_rings[j].tx_stats.packets;
-               data[i++] = vsi->tx_rings[j].tx_stats.bytes;
-       }
-       for (j = 0; j < vsi->num_queue_pairs; j++) {
-               data[i++] = vsi->rx_rings[j].rx_stats.packets;
-               data[i++] = vsi->rx_rings[j].rx_stats.bytes;
+       for (j = 0; j < vsi->num_queue_pairs; j++, i += 4) {
+               data[i] = vsi->tx_rings[j].stats.packets;
+               data[i + 1] = vsi->tx_rings[j].stats.bytes;
+               data[i + 2] = vsi->rx_rings[j].stats.packets;
+               data[i + 3] = vsi->rx_rings[j].stats.bytes;
        }
        if (vsi == pf->vsi[pf->lan_vsi]) {
                for (j = 0; j < I40E_GLOBAL_STATS_LEN; j++) {
@@ -641,8 +639,6 @@ static void i40e_get_strings(struct net_device *netdev, u32 stringset,
                        p += ETH_GSTRING_LEN;
                        snprintf(p, ETH_GSTRING_LEN, "tx-%u.tx_bytes", i);
                        p += ETH_GSTRING_LEN;
-               }
-               for (i = 0; i < vsi->num_queue_pairs; i++) {
                        snprintf(p, ETH_GSTRING_LEN, "rx-%u.rx_packets", i);
                        p += ETH_GSTRING_LEN;
                        snprintf(p, ETH_GSTRING_LEN, "rx-%u.rx_bytes", i);
index 657babe82c9c60c10209c0b09846ece0919f319a..d1b5bae15ea8d528007d4d5379495c062d4ebc6e 100644 (file)
@@ -376,8 +376,12 @@ void i40e_vsi_reset_stats(struct i40e_vsi *vsi)
        memset(&vsi->eth_stats_offsets, 0, sizeof(vsi->eth_stats_offsets));
        if (vsi->rx_rings)
                for (i = 0; i < vsi->num_queue_pairs; i++) {
+                       memset(&vsi->rx_rings[i].stats, 0 ,
+                              sizeof(vsi->rx_rings[i].stats));
                        memset(&vsi->rx_rings[i].rx_stats, 0 ,
                               sizeof(vsi->rx_rings[i].rx_stats));
+                       memset(&vsi->tx_rings[i].stats, 0 ,
+                              sizeof(vsi->tx_rings[i].stats));
                        memset(&vsi->tx_rings[i].tx_stats, 0,
                               sizeof(vsi->tx_rings[i].tx_stats));
                }
@@ -708,14 +712,14 @@ void i40e_update_stats(struct i40e_vsi *vsi)
                struct i40e_ring *p;
 
                p = &vsi->rx_rings[q];
-               rx_b += p->rx_stats.bytes;
-               rx_p += p->rx_stats.packets;
+               rx_b += p->stats.bytes;
+               rx_p += p->stats.packets;
                rx_buf += p->rx_stats.alloc_rx_buff_failed;
                rx_page += p->rx_stats.alloc_rx_page_failed;
 
                p = &vsi->tx_rings[q];
-               tx_b += p->tx_stats.bytes;
-               tx_p += p->tx_stats.packets;
+               tx_b += p->stats.bytes;
+               tx_p += p->stats.packets;
                tx_restart += p->tx_stats.restart_queue;
                tx_busy += p->tx_stats.tx_busy;
        }
index ad2818f26821e53365080ae6de356a90a3ad64cf..3e73bc093737bc164b16eff99f0a064c3af6d18c 100644 (file)
@@ -305,14 +305,14 @@ static bool i40e_check_tx_hang(struct i40e_ring *tx_ring)
         * run the check_tx_hang logic with a transmit completion
         * pending but without time to complete it yet.
         */
-       if ((tx_ring->tx_stats.tx_done_old == tx_ring->tx_stats.packets) &&
+       if ((tx_ring->tx_stats.tx_done_old == tx_ring->stats.packets) &&
            tx_pending) {
                /* make sure it is true for two checks in a row */
                ret = test_and_set_bit(__I40E_HANG_CHECK_ARMED,
                                       &tx_ring->state);
        } else {
                /* update completed stats and disarm the hang check */
-               tx_ring->tx_stats.tx_done_old = tx_ring->tx_stats.packets;
+               tx_ring->tx_stats.tx_done_old = tx_ring->stats.packets;
                clear_bit(__I40E_HANG_CHECK_ARMED, &tx_ring->state);
        }
 
@@ -411,8 +411,8 @@ static bool i40e_clean_tx_irq(struct i40e_ring *tx_ring, int budget)
 
        i += tx_ring->count;
        tx_ring->next_to_clean = i;
-       tx_ring->tx_stats.bytes += total_bytes;
-       tx_ring->tx_stats.packets += total_packets;
+       tx_ring->stats.bytes += total_bytes;
+       tx_ring->stats.packets += total_packets;
        tx_ring->q_vector->tx.total_bytes += total_bytes;
        tx_ring->q_vector->tx.total_packets += total_packets;
 
@@ -1075,8 +1075,8 @@ next_desc:
        }
 
        rx_ring->next_to_clean = i;
-       rx_ring->rx_stats.packets += total_rx_packets;
-       rx_ring->rx_stats.bytes += total_rx_bytes;
+       rx_ring->stats.packets += total_rx_packets;
+       rx_ring->stats.bytes += total_rx_bytes;
        rx_ring->q_vector->rx.total_packets += total_rx_packets;
        rx_ring->q_vector->rx.total_bytes += total_rx_bytes;
 
index e5142476a7f0f72f9f922faab9e298738c002eb1..7f3f7e3e4238b8a3d2a2833c0031f5f3b7588599 100644 (file)
@@ -126,17 +126,18 @@ struct i40e_rx_buffer {
        unsigned int page_offset;
 };
 
-struct i40e_tx_queue_stats {
+struct i40e_queue_stats {
        u64 packets;
        u64 bytes;
+};
+
+struct i40e_tx_queue_stats {
        u64 restart_queue;
        u64 tx_busy;
        u64 tx_done_old;
 };
 
 struct i40e_rx_queue_stats {
-       u64 packets;
-       u64 bytes;
        u64 non_eop_descs;
        u64 alloc_rx_page_failed;
        u64 alloc_rx_buff_failed;
@@ -215,6 +216,7 @@ struct i40e_ring {
        bool ring_active;               /* is ring online or not */
 
        /* stats structs */
+       struct i40e_queue_stats stats;
        union {
                struct i40e_tx_queue_stats tx_stats;
                struct i40e_rx_queue_stats rx_stats;
This page took 0.046666 seconds and 5 git commands to generate.