i40e: Add tx_stopped stat
authorJoe Damato <jdamato@fastly.com>
Thu, 24 Mar 2022 19:46:58 +0000 (12:46 -0700)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 12 Apr 2022 18:07:05 +0000 (11:07 -0700)
Track TX queue stop events and export the new stat with ethtool.

Signed-off-by: Joe Damato <jdamato@fastly.com>
Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/i40e/i40e.h
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 55c6bce5da61e98ebe6312ba8b86718ae40e55bf..18558a01935319a6d814a650d0e652f9a33697d2 100644 (file)
@@ -852,6 +852,7 @@ struct i40e_vsi {
        u64 tx_busy;
        u64 tx_linearize;
        u64 tx_force_wb;
+       u64 tx_stopped;
        u64 rx_buf_failed;
        u64 rx_page_failed;
        u64 rx_page_reuse;
index be7c6f34d45c660b3fb21069bb0aced1c4d4c6b6..c9dcd6d92c832ca74fb06389f93bc30a86e17415 100644 (file)
@@ -309,10 +309,11 @@ static void i40e_dbg_dump_vsi_seid(struct i40e_pf *pf, int seid)
                         tx_ring->stats.bytes,
                         tx_ring->tx_stats.restart_queue);
                dev_info(&pf->pdev->dev,
-                        "    tx_rings[%i]: tx_stats: tx_busy = %lld, tx_done_old = %lld\n",
+                        "    tx_rings[%i]: tx_stats: tx_busy = %lld, tx_done_old = %lld, tx_stopped = %lld\n",
                         i,
                         tx_ring->tx_stats.tx_busy,
-                        tx_ring->tx_stats.tx_done_old);
+                        tx_ring->tx_stats.tx_done_old,
+                        tx_ring->tx_stats.tx_stopped);
                dev_info(&pf->pdev->dev,
                         "    tx_rings[%i]: size = %i\n",
                         i, tx_ring->size);
index e48499624d22c6a4565c74295c0cda2e955835af..162bae158160d87c4f9ed74e935701971421e51b 100644 (file)
@@ -293,6 +293,7 @@ static const struct i40e_stats i40e_gstrings_misc_stats[] = {
        I40E_VSI_STAT("tx_linearize", tx_linearize),
        I40E_VSI_STAT("tx_force_wb", tx_force_wb),
        I40E_VSI_STAT("tx_busy", tx_busy),
+       I40E_VSI_STAT("tx_stopped", tx_stopped),
        I40E_VSI_STAT("rx_alloc_fail", rx_buf_failed),
        I40E_VSI_STAT("rx_pg_alloc_fail", rx_page_failed),
        I40E_VSI_STAT("rx_cache_reuse", rx_page_reuse),
index b7f11fd8297bd1edd2cf5bb838d68178395e9aeb..fea40efbd1ca87ff1d13082caf9b63a09d0bdd9d 100644 (file)
@@ -785,6 +785,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
        unsigned int start;
        u64 tx_linearize;
        u64 tx_force_wb;
+       u64 tx_stopped;
        u64 rx_p, rx_b;
        u64 tx_p, tx_b;
        u16 q;
@@ -804,6 +805,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
        rx_b = rx_p = 0;
        tx_b = tx_p = 0;
        tx_restart = tx_busy = tx_linearize = tx_force_wb = 0;
+       tx_stopped = 0;
        rx_page = 0;
        rx_buf = 0;
        rx_reuse = 0;
@@ -828,6 +830,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
                tx_busy += p->tx_stats.tx_busy;
                tx_linearize += p->tx_stats.tx_linearize;
                tx_force_wb += p->tx_stats.tx_force_wb;
+               tx_stopped += p->tx_stats.tx_stopped;
 
                /* locate Rx ring */
                p = READ_ONCE(vsi->rx_rings[q]);
@@ -872,6 +875,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
        vsi->tx_busy = tx_busy;
        vsi->tx_linearize = tx_linearize;
        vsi->tx_force_wb = tx_force_wb;
+       vsi->tx_stopped = tx_stopped;
        vsi->rx_page_failed = rx_page;
        vsi->rx_buf_failed = rx_buf;
        vsi->rx_page_reuse = rx_reuse;
index 8b844ad08a86ff0662258451faf07f189be69c38..7bc1174edf6b9c1803eabd05a5d2bf0c6bb65317 100644 (file)
@@ -3396,6 +3396,8 @@ int __i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)
        /* Memory barrier before checking head and tail */
        smp_mb();
 
+       ++tx_ring->tx_stats.tx_stopped;
+
        /* Check again in a case another CPU has just made room available. */
        if (likely(I40E_DESC_UNUSED(tx_ring) < size))
                return -EBUSY;
index c471c2da313ce250a29cf823a46972f85f3f405d..41f86e9535a00b80f8323e47756ba3fffb4af894 100644 (file)
@@ -290,6 +290,7 @@ struct i40e_tx_queue_stats {
        u64 tx_done_old;
        u64 tx_linearize;
        u64 tx_force_wb;
+       u64 tx_stopped;
        int prev_pkt_ctr;
 };