aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2013-09-28 02:00:43 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2013-10-10 01:21:39 -0400
commita114d0a6aca7f96f46be93539665dbb28bdf1a73 (patch)
tree5b623ad16cb38e80f2503626e902c402a0b0b329
parent7070ce0a6419a118842298bc967061ad6cea40db (diff)
i40e: Split bytes and packets from Rx/Tx stats
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>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_debugfs.c8
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_ethtool.c14
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c12
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.c12
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.h8
5 files changed, 28 insertions, 26 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
index 0b01c61f70c2..2b6655bf1f3d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
@@ -512,8 +512,8 @@ static void i40e_dbg_dump_vsi_seid(struct i40e_pf *pf, int seid)
512 vsi->rx_rings[i].ring_active); 512 vsi->rx_rings[i].ring_active);
513 dev_info(&pf->pdev->dev, 513 dev_info(&pf->pdev->dev,
514 " rx_rings[%i]: rx_stats: packets = %lld, bytes = %lld, non_eop_descs = %lld\n", 514 " rx_rings[%i]: rx_stats: packets = %lld, bytes = %lld, non_eop_descs = %lld\n",
515 i, vsi->rx_rings[i].rx_stats.packets, 515 i, vsi->rx_rings[i].stats.packets,
516 vsi->rx_rings[i].rx_stats.bytes, 516 vsi->rx_rings[i].stats.bytes,
517 vsi->rx_rings[i].rx_stats.non_eop_descs); 517 vsi->rx_rings[i].rx_stats.non_eop_descs);
518 dev_info(&pf->pdev->dev, 518 dev_info(&pf->pdev->dev,
519 " rx_rings[%i]: rx_stats: alloc_rx_page_failed = %lld, alloc_rx_buff_failed = %lld\n", 519 " 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)
556 vsi->tx_rings[i].ring_active); 556 vsi->tx_rings[i].ring_active);
557 dev_info(&pf->pdev->dev, 557 dev_info(&pf->pdev->dev,
558 " tx_rings[%i]: tx_stats: packets = %lld, bytes = %lld, restart_queue = %lld\n", 558 " tx_rings[%i]: tx_stats: packets = %lld, bytes = %lld, restart_queue = %lld\n",
559 i, vsi->tx_rings[i].tx_stats.packets, 559 i, vsi->tx_rings[i].stats.packets,
560 vsi->tx_rings[i].tx_stats.bytes, 560 vsi->tx_rings[i].stats.bytes,
561 vsi->tx_rings[i].tx_stats.restart_queue); 561 vsi->tx_rings[i].tx_stats.restart_queue);
562 dev_info(&pf->pdev->dev, 562 dev_info(&pf->pdev->dev,
563 " tx_rings[%i]: tx_stats: tx_busy = %lld, tx_done_old = %lld\n", 563 " tx_rings[%i]: tx_stats: tx_busy = %lld, tx_done_old = %lld\n",
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index 9a76b8cec76c..8754c6fa6324 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -587,13 +587,11 @@ static void i40e_get_ethtool_stats(struct net_device *netdev,
587 data[i++] = (i40e_gstrings_net_stats[j].sizeof_stat == 587 data[i++] = (i40e_gstrings_net_stats[j].sizeof_stat ==
588 sizeof(u64)) ? *(u64 *)p : *(u32 *)p; 588 sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
589 } 589 }
590 for (j = 0; j < vsi->num_queue_pairs; j++) { 590 for (j = 0; j < vsi->num_queue_pairs; j++, i += 4) {
591 data[i++] = vsi->tx_rings[j].tx_stats.packets; 591 data[i] = vsi->tx_rings[j].stats.packets;
592 data[i++] = vsi->tx_rings[j].tx_stats.bytes; 592 data[i + 1] = vsi->tx_rings[j].stats.bytes;
593 } 593 data[i + 2] = vsi->rx_rings[j].stats.packets;
594 for (j = 0; j < vsi->num_queue_pairs; j++) { 594 data[i + 3] = vsi->rx_rings[j].stats.bytes;
595 data[i++] = vsi->rx_rings[j].rx_stats.packets;
596 data[i++] = vsi->rx_rings[j].rx_stats.bytes;
597 } 595 }
598 if (vsi == pf->vsi[pf->lan_vsi]) { 596 if (vsi == pf->vsi[pf->lan_vsi]) {
599 for (j = 0; j < I40E_GLOBAL_STATS_LEN; j++) { 597 for (j = 0; j < I40E_GLOBAL_STATS_LEN; j++) {
@@ -641,8 +639,6 @@ static void i40e_get_strings(struct net_device *netdev, u32 stringset,
641 p += ETH_GSTRING_LEN; 639 p += ETH_GSTRING_LEN;
642 snprintf(p, ETH_GSTRING_LEN, "tx-%u.tx_bytes", i); 640 snprintf(p, ETH_GSTRING_LEN, "tx-%u.tx_bytes", i);
643 p += ETH_GSTRING_LEN; 641 p += ETH_GSTRING_LEN;
644 }
645 for (i = 0; i < vsi->num_queue_pairs; i++) {
646 snprintf(p, ETH_GSTRING_LEN, "rx-%u.rx_packets", i); 642 snprintf(p, ETH_GSTRING_LEN, "rx-%u.rx_packets", i);
647 p += ETH_GSTRING_LEN; 643 p += ETH_GSTRING_LEN;
648 snprintf(p, ETH_GSTRING_LEN, "rx-%u.rx_bytes", i); 644 snprintf(p, ETH_GSTRING_LEN, "rx-%u.rx_bytes", i);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 657babe82c9c..d1b5bae15ea8 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -376,8 +376,12 @@ void i40e_vsi_reset_stats(struct i40e_vsi *vsi)
376 memset(&vsi->eth_stats_offsets, 0, sizeof(vsi->eth_stats_offsets)); 376 memset(&vsi->eth_stats_offsets, 0, sizeof(vsi->eth_stats_offsets));
377 if (vsi->rx_rings) 377 if (vsi->rx_rings)
378 for (i = 0; i < vsi->num_queue_pairs; i++) { 378 for (i = 0; i < vsi->num_queue_pairs; i++) {
379 memset(&vsi->rx_rings[i].stats, 0 ,
380 sizeof(vsi->rx_rings[i].stats));
379 memset(&vsi->rx_rings[i].rx_stats, 0 , 381 memset(&vsi->rx_rings[i].rx_stats, 0 ,
380 sizeof(vsi->rx_rings[i].rx_stats)); 382 sizeof(vsi->rx_rings[i].rx_stats));
383 memset(&vsi->tx_rings[i].stats, 0 ,
384 sizeof(vsi->tx_rings[i].stats));
381 memset(&vsi->tx_rings[i].tx_stats, 0, 385 memset(&vsi->tx_rings[i].tx_stats, 0,
382 sizeof(vsi->tx_rings[i].tx_stats)); 386 sizeof(vsi->tx_rings[i].tx_stats));
383 } 387 }
@@ -708,14 +712,14 @@ void i40e_update_stats(struct i40e_vsi *vsi)
708 struct i40e_ring *p; 712 struct i40e_ring *p;
709 713
710 p = &vsi->rx_rings[q]; 714 p = &vsi->rx_rings[q];
711 rx_b += p->rx_stats.bytes; 715 rx_b += p->stats.bytes;
712 rx_p += p->rx_stats.packets; 716 rx_p += p->stats.packets;
713 rx_buf += p->rx_stats.alloc_rx_buff_failed; 717 rx_buf += p->rx_stats.alloc_rx_buff_failed;
714 rx_page += p->rx_stats.alloc_rx_page_failed; 718 rx_page += p->rx_stats.alloc_rx_page_failed;
715 719
716 p = &vsi->tx_rings[q]; 720 p = &vsi->tx_rings[q];
717 tx_b += p->tx_stats.bytes; 721 tx_b += p->stats.bytes;
718 tx_p += p->tx_stats.packets; 722 tx_p += p->stats.packets;
719 tx_restart += p->tx_stats.restart_queue; 723 tx_restart += p->tx_stats.restart_queue;
720 tx_busy += p->tx_stats.tx_busy; 724 tx_busy += p->tx_stats.tx_busy;
721 } 725 }
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index ad2818f26821..3e73bc093737 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -305,14 +305,14 @@ static bool i40e_check_tx_hang(struct i40e_ring *tx_ring)
305 * run the check_tx_hang logic with a transmit completion 305 * run the check_tx_hang logic with a transmit completion
306 * pending but without time to complete it yet. 306 * pending but without time to complete it yet.
307 */ 307 */
308 if ((tx_ring->tx_stats.tx_done_old == tx_ring->tx_stats.packets) && 308 if ((tx_ring->tx_stats.tx_done_old == tx_ring->stats.packets) &&
309 tx_pending) { 309 tx_pending) {
310 /* make sure it is true for two checks in a row */ 310 /* make sure it is true for two checks in a row */
311 ret = test_and_set_bit(__I40E_HANG_CHECK_ARMED, 311 ret = test_and_set_bit(__I40E_HANG_CHECK_ARMED,
312 &tx_ring->state); 312 &tx_ring->state);
313 } else { 313 } else {
314 /* update completed stats and disarm the hang check */ 314 /* update completed stats and disarm the hang check */
315 tx_ring->tx_stats.tx_done_old = tx_ring->tx_stats.packets; 315 tx_ring->tx_stats.tx_done_old = tx_ring->stats.packets;
316 clear_bit(__I40E_HANG_CHECK_ARMED, &tx_ring->state); 316 clear_bit(__I40E_HANG_CHECK_ARMED, &tx_ring->state);
317 } 317 }
318 318
@@ -411,8 +411,8 @@ static bool i40e_clean_tx_irq(struct i40e_ring *tx_ring, int budget)
411 411
412 i += tx_ring->count; 412 i += tx_ring->count;
413 tx_ring->next_to_clean = i; 413 tx_ring->next_to_clean = i;
414 tx_ring->tx_stats.bytes += total_bytes; 414 tx_ring->stats.bytes += total_bytes;
415 tx_ring->tx_stats.packets += total_packets; 415 tx_ring->stats.packets += total_packets;
416 tx_ring->q_vector->tx.total_bytes += total_bytes; 416 tx_ring->q_vector->tx.total_bytes += total_bytes;
417 tx_ring->q_vector->tx.total_packets += total_packets; 417 tx_ring->q_vector->tx.total_packets += total_packets;
418 418
@@ -1075,8 +1075,8 @@ next_desc:
1075 } 1075 }
1076 1076
1077 rx_ring->next_to_clean = i; 1077 rx_ring->next_to_clean = i;
1078 rx_ring->rx_stats.packets += total_rx_packets; 1078 rx_ring->stats.packets += total_rx_packets;
1079 rx_ring->rx_stats.bytes += total_rx_bytes; 1079 rx_ring->stats.bytes += total_rx_bytes;
1080 rx_ring->q_vector->rx.total_packets += total_rx_packets; 1080 rx_ring->q_vector->rx.total_packets += total_rx_packets;
1081 rx_ring->q_vector->rx.total_bytes += total_rx_bytes; 1081 rx_ring->q_vector->rx.total_bytes += total_rx_bytes;
1082 1082
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h
index e5142476a7f0..7f3f7e3e4238 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h
@@ -126,17 +126,18 @@ struct i40e_rx_buffer {
126 unsigned int page_offset; 126 unsigned int page_offset;
127}; 127};
128 128
129struct i40e_tx_queue_stats { 129struct i40e_queue_stats {
130 u64 packets; 130 u64 packets;
131 u64 bytes; 131 u64 bytes;
132};
133
134struct i40e_tx_queue_stats {
132 u64 restart_queue; 135 u64 restart_queue;
133 u64 tx_busy; 136 u64 tx_busy;
134 u64 tx_done_old; 137 u64 tx_done_old;
135}; 138};
136 139
137struct i40e_rx_queue_stats { 140struct i40e_rx_queue_stats {
138 u64 packets;
139 u64 bytes;
140 u64 non_eop_descs; 141 u64 non_eop_descs;
141 u64 alloc_rx_page_failed; 142 u64 alloc_rx_page_failed;
142 u64 alloc_rx_buff_failed; 143 u64 alloc_rx_buff_failed;
@@ -215,6 +216,7 @@ struct i40e_ring {
215 bool ring_active; /* is ring online or not */ 216 bool ring_active; /* is ring online or not */
216 217
217 /* stats structs */ 218 /* stats structs */
219 struct i40e_queue_stats stats;
218 union { 220 union {
219 struct i40e_tx_queue_stats tx_stats; 221 struct i40e_tx_queue_stats tx_stats;
220 struct i40e_rx_queue_stats rx_stats; 222 struct i40e_rx_queue_stats rx_stats;