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

sfc: implement per-queue TSO (hw_gso) stats

Use our existing TSO stats, which count enqueued TSO TXes.
Users may expect them to count completions, as tx-packets and
tx-bytes do; however, these are the counters we have, and the
qstats documentation doesn't actually specify.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Edward Cree and committed by
David S. Miller
db3067c8 07e5fa5b

+22
+16
drivers/net/ethernet/sfc/efx.c
··· 654 654 channel = efx_get_tx_channel(efx, idx); 655 655 stats->packets = 0; 656 656 stats->bytes = 0; 657 + stats->hw_gso_packets = 0; 658 + stats->hw_gso_wire_packets = 0; 657 659 efx_for_each_channel_tx_queue(tx_queue, channel) { 658 660 stats->packets += tx_queue->complete_packets - 659 661 tx_queue->old_complete_packets; 660 662 stats->bytes += tx_queue->complete_bytes - 661 663 tx_queue->old_complete_bytes; 664 + /* Note that, unlike stats->packets and stats->bytes, 665 + * these count TXes enqueued, rather than completed, 666 + * which may not be what users expect. 667 + */ 668 + stats->hw_gso_packets += tx_queue->tso_bursts - 669 + tx_queue->old_tso_bursts; 670 + stats->hw_gso_wire_packets += tx_queue->tso_packets - 671 + tx_queue->old_tso_packets; 662 672 } 663 673 } 664 674 ··· 686 676 rx->hw_drop_overruns = 0; 687 677 tx->packets = 0; 688 678 tx->bytes = 0; 679 + tx->hw_gso_packets = 0; 680 + tx->hw_gso_wire_packets = 0; 689 681 690 682 /* Count all packets on non-core queues, and packets before last 691 683 * datapath start on core queues. ··· 709 697 net_dev->real_num_tx_queues) { 710 698 tx->packets += tx_queue->complete_packets; 711 699 tx->bytes += tx_queue->complete_bytes; 700 + tx->hw_gso_packets += tx_queue->tso_bursts; 701 + tx->hw_gso_wire_packets += tx_queue->tso_packets; 712 702 } else { 713 703 tx->packets += tx_queue->old_complete_packets; 714 704 tx->bytes += tx_queue->old_complete_bytes; 705 + tx->hw_gso_packets += tx_queue->old_tso_bursts; 706 + tx->hw_gso_wire_packets += tx_queue->old_tso_packets; 715 707 } 716 708 /* Include XDP TX in device-wide stats */ 717 709 tx->packets += tx_queue->complete_xdp_packets;
+4
drivers/net/ethernet/sfc/net_driver.h
··· 197 197 * efx_init_tx_queue() 198 198 * @old_complete_bytes: Value of @complete_bytes as of last 199 199 * efx_init_tx_queue() 200 + * @old_tso_bursts: Value of @tso_bursts as of last efx_init_tx_queue() 201 + * @old_tso_packets: Value of @tso_packets as of last efx_init_tx_queue() 200 202 * @read_count: Current read pointer. 201 203 * This is the number of buffers that have been removed from both rings. 202 204 * @old_write_count: The value of @write_count when last checked. ··· 278 276 bool xdp_tx; 279 277 unsigned long old_complete_packets; 280 278 unsigned long old_complete_bytes; 279 + unsigned int old_tso_bursts; 280 + unsigned int old_tso_packets; 281 281 282 282 /* Members used mainly on the completion path */ 283 283 unsigned int read_count ____cacheline_aligned_in_smp;
+2
drivers/net/ethernet/sfc/tx_common.c
··· 88 88 89 89 tx_queue->old_complete_packets = tx_queue->complete_packets; 90 90 tx_queue->old_complete_bytes = tx_queue->complete_bytes; 91 + tx_queue->old_tso_bursts = tx_queue->tso_bursts; 92 + tx_queue->old_tso_packets = tx_queue->tso_packets; 91 93 92 94 tx_queue->xdp_tx = efx_channel_is_xdp_tx(tx_queue->channel); 93 95 tx_queue->tso_version = 0;