Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ixgbevf: add BP_EXTENDED_STATS for CONFIG_NET_RX_BUSY_POLL

This patch adds the extended statistics similar to the ixgbe driver. These
statistics keep track of how often the busy polling yields, as well as how many
packets are cleaned or missed by the polling routine.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

authored by

Jacob Keller and committed by
Jeff Kirsher
3b5dca26 c777cdfa

+60
+32
drivers/net/ethernet/intel/ixgbevf/ethtool.c
··· 74 74 zero_base)}, 75 75 {"tx_csum_offload_ctxt", IXGBEVF_STAT(hw_csum_tx_good, zero_base, 76 76 zero_base)}, 77 + #ifdef BP_EXTENDED_STATS 78 + {"rx_bp_poll_yield", IXGBEVF_STAT(bp_rx_yields, zero_base, zero_base)}, 79 + {"rx_bp_cleaned", IXGBEVF_STAT(bp_rx_cleaned, zero_base, zero_base)}, 80 + {"rx_bp_misses", IXGBEVF_STAT(bp_rx_missed, zero_base, zero_base)}, 81 + {"tx_bp_napi_yield", IXGBEVF_STAT(bp_tx_yields, zero_base, zero_base)}, 82 + {"tx_bp_cleaned", IXGBEVF_STAT(bp_tx_cleaned, zero_base, zero_base)}, 83 + {"tx_bp_misses", IXGBEVF_STAT(bp_tx_missed, zero_base, zero_base)}, 84 + #endif 77 85 }; 78 86 79 87 #define IXGBE_QUEUE_STATS_LEN 0 ··· 399 391 { 400 392 struct ixgbevf_adapter *adapter = netdev_priv(netdev); 401 393 int i; 394 + #ifdef BP_EXTENDED_STATS 395 + u64 rx_yields = 0, rx_cleaned = 0, rx_missed = 0, 396 + tx_yields = 0, tx_cleaned = 0, tx_missed = 0; 397 + 398 + for (i = 0; i < adapter->num_rx_queues; i++) { 399 + rx_yields += adapter->rx_ring[i].bp_yields; 400 + rx_cleaned += adapter->rx_ring[i].bp_cleaned; 401 + rx_yields += adapter->rx_ring[i].bp_yields; 402 + } 403 + 404 + for (i = 0; i < adapter->num_tx_queues; i++) { 405 + tx_yields += adapter->tx_ring[i].bp_yields; 406 + tx_cleaned += adapter->tx_ring[i].bp_cleaned; 407 + tx_yields += adapter->tx_ring[i].bp_yields; 408 + } 409 + 410 + adapter->bp_rx_yields = rx_yields; 411 + adapter->bp_rx_cleaned = rx_cleaned; 412 + adapter->bp_rx_missed = rx_missed; 413 + 414 + adapter->bp_tx_yields = tx_yields; 415 + adapter->bp_tx_cleaned = tx_cleaned; 416 + adapter->bp_tx_missed = tx_missed; 417 + #endif 402 418 403 419 ixgbevf_update_stats(adapter); 404 420 for (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++) {
+22
drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
··· 40 40 41 41 #ifdef CONFIG_NET_RX_BUSY_POLL 42 42 #include <net/busy_poll.h> 43 + #define BP_EXTENDED_STATS 43 44 #endif 44 45 45 46 /* wrapper around a pointer to a socket buffer, ··· 81 80 struct u64_stats_sync syncp; 82 81 u64 hw_csum_rx_error; 83 82 u64 hw_csum_rx_good; 83 + #ifdef BP_EXTENDED_STATS 84 + u64 bp_yields; 85 + u64 bp_misses; 86 + u64 bp_cleaned; 87 + #endif 84 88 85 89 u16 head; 86 90 u16 tail; ··· 187 181 WARN_ON(q_vector->state & IXGBEVF_QV_STATE_NAPI); 188 182 q_vector->state |= IXGBEVF_QV_STATE_NAPI_YIELD; 189 183 rc = false; 184 + #ifdef BP_EXTENDED_STATS 185 + q_vector->tx.ring->bp_yields++; 186 + #endif 190 187 } else { 191 188 /* we don't care if someone yielded */ 192 189 q_vector->state = IXGBEVF_QV_STATE_NAPI; ··· 222 213 if ((q_vector->state & IXGBEVF_QV_LOCKED)) { 223 214 q_vector->state |= IXGBEVF_QV_STATE_POLL_YIELD; 224 215 rc = false; 216 + #ifdef BP_EXTENDED_STATS 217 + q_vector->rx.ring->bp_yields++; 218 + #endif 225 219 } else { 226 220 /* preserve yield marks */ 227 221 q_vector->state |= IXGBEVF_QV_STATE_POLL; ··· 369 357 u64 tx_busy; 370 358 unsigned int tx_ring_count; 371 359 unsigned int rx_ring_count; 360 + 361 + #ifdef BP_EXTENDED_STATS 362 + u64 bp_rx_yields; 363 + u64 bp_rx_cleaned; 364 + u64 bp_rx_missed; 365 + 366 + u64 bp_tx_yields; 367 + u64 bp_tx_cleaned; 368 + u64 bp_tx_missed; 369 + #endif 372 370 373 371 u32 link_speed; 374 372 bool link_up;
+6
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
··· 648 648 649 649 ixgbevf_for_each_ring(ring, q_vector->rx) { 650 650 found = ixgbevf_clean_rx_irq(q_vector, ring, 4); 651 + #ifdef BP_EXTENDED_STATS 652 + if (found) 653 + ring->bp_cleaned += found; 654 + else 655 + ring->bp_misses++; 656 + #endif 651 657 if (found) 652 658 break; 653 659 }