<div dir="auto"></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">---------- Forwarded message ---------<br>From: <strong class="gmail_sendername" dir="auto">Joe Damato</strong> <span dir="auto"><<a href="mailto:jdamato@fastly.com">jdamato@fastly.com</a>></span><br>Date: Fri, Oct 7, 2022, 2:43 PM<br>Subject: [next-queue v4 4/4] i40e: Add i40e_napi_poll tracepoint<br>To: <<a href="mailto:intel-wired-lan@lists.osuosl.org">intel-wired-lan@lists.osuosl.org</a>><br>Cc: <<a href="mailto:netdev@vger.kernel.org">netdev@vger.kernel.org</a>>, <<a href="mailto:kuba@kernel.org">kuba@kernel.org</a>>, <<a href="mailto:davem@davemloft.net">davem@davemloft.net</a>>, <<a href="mailto:anthony.l.nguyen@intel.com">anthony.l.nguyen@intel.com</a>>, <<a href="mailto:jesse.brandeburg@intel.com">jesse.brandeburg@intel.com</a>>, <<a href="mailto:maciej.fijalkowski@intel.com">maciej.fijalkowski@intel.com</a>>, <<a href="mailto:sridhar.samudrala@intel.com">sridhar.samudrala@intel.com</a>>, Joe Damato <<a href="mailto:jdamato@fastly.com">jdamato@fastly.com</a>><br></div><br><br>Add a tracepoint for i40e_napi_poll that allows users to get detailed<br>
information about the amount of work done. This information can help users<br>
better tune the correct NAPI parameters (like weight and budget), as well<br>
as debug NIC settings like rx-usecs and tx-usecs, etc.<br>
<br>
When perf is attached, this tracepoint only fires when not in XDP mode.<br>
<br>
An example of the output from this tracepoint:<br>
<br>
$ sudo perf trace -e i40e:i40e_napi_poll -a --call-graph=fp --libtraceevent_print<br>
<br>
[..snip..]<br>
<br>
388.258 :0/0 i40e:i40e_napi_poll(i40e_napi_poll on dev eth2 q i40e-eth2-TxRx-9 irq 346 irq_mask 00000000,00000000,00000000,00000000,00000000,00800000 curr_cpu 23 budget 64 bpr 64 rx_cleaned 28 tx_cleaned 0 rx_clean_complete 1 tx_clean_complete 1)<br>
i40e_napi_poll ([i40e])<br>
i40e_napi_poll ([i40e])<br>
__napi_poll ([kernel.kallsyms])<br>
net_rx_action ([kernel.kallsyms])<br>
__do_softirq ([kernel.kallsyms])<br>
common_interrupt ([kernel.kallsyms])<br>
asm_common_interrupt ([kernel.kallsyms])<br>
intel_idle_irq ([kernel.kallsyms])<br>
cpuidle_enter_state ([kernel.kallsyms])<br>
cpuidle_enter ([kernel.kallsyms])<br>
do_idle ([kernel.kallsyms])<br>
cpu_startup_entry ([kernel.kallsyms])<br>
[0x243fd8] ([kernel.kallsyms])<br>
secondary_startup_64_no_verify ([kernel.kallsyms])<br>
<br>
Signed-off-by: Joe Damato <<a href="mailto:jdamato@fastly.com" target="_blank" rel="noreferrer">jdamato@fastly.com</a>><br>
Acked-by: Jesse Brandeburg <<a href="mailto:jesse.brandeburg@intel.com" target="_blank" rel="noreferrer">jesse.brandeburg@intel.com</a>><br>
Acked-by: Sridhar Samudrala <<a href="mailto:sridhar.samudrala@intel.com" target="_blank" rel="noreferrer">sridhar.samudrala@intel.com</a>><br>
---<br>
drivers/net/ethernet/intel/i40e/i40e_trace.h | 49 ++++++++++++++++++++++++++++<br>
drivers/net/ethernet/intel/i40e/i40e_txrx.c | 4 +++<br>
2 files changed, 53 insertions(+)<br>
<br>
diff --git a/drivers/net/ethernet/intel/i40e/i40e_trace.h b/drivers/net/ethernet/intel/i40e/i40e_trace.h<br>
index b5b1229..79d587a 100644<br>
--- a/drivers/net/ethernet/intel/i40e/i40e_trace.h<br>
+++ b/drivers/net/ethernet/intel/i40e/i40e_trace.h<br>
@@ -55,6 +55,55 @@<br>
* being built from shared code.<br>
*/<br>
<br>
+#define NO_DEV "(i40e no_device)"<br>
+<br>
+TRACE_EVENT(i40e_napi_poll,<br>
+<br>
+ TP_PROTO(struct napi_struct *napi, struct i40e_q_vector *q, int budget,<br>
+ int budget_per_ring, unsigned int rx_cleaned, unsigned int tx_cleaned,<br>
+ bool rx_clean_complete, bool tx_clean_complete),<br>
+<br>
+ TP_ARGS(napi, q, budget, budget_per_ring, rx_cleaned, tx_cleaned,<br>
+ rx_clean_complete, tx_clean_complete),<br>
+<br>
+ TP_STRUCT__entry(<br>
+ __field(int, budget)<br>
+ __field(int, budget_per_ring)<br>
+ __field(unsigned int, rx_cleaned)<br>
+ __field(unsigned int, tx_cleaned)<br>
+ __field(int, rx_clean_complete)<br>
+ __field(int, tx_clean_complete)<br>
+ __field(int, irq_num)<br>
+ __field(int, curr_cpu)<br>
+ __string(qname, q->name)<br>
+ __string(dev_name, napi->dev ? napi->dev->name : NO_DEV)<br>
+ __bitmask(irq_affinity, nr_cpumask_bits)<br>
+ ),<br>
+<br>
+ TP_fast_assign(<br>
+ __entry->budget = budget;<br>
+ __entry->budget_per_ring = budget_per_ring;<br>
+ __entry->rx_cleaned = rx_cleaned;<br>
+ __entry->tx_cleaned = tx_cleaned;<br>
+ __entry->rx_clean_complete = rx_clean_complete;<br>
+ __entry->tx_clean_complete = tx_clean_complete;<br>
+ __entry->irq_num = q->irq_num;<br>
+ __entry->curr_cpu = get_cpu();<br>
+ __assign_str(qname, q->name);<br>
+ __assign_str(dev_name, napi->dev ? napi->dev->name : NO_DEV);<br>
+ __assign_bitmask(irq_affinity, cpumask_bits(&q->affinity_mask),<br>
+ nr_cpumask_bits);<br>
+ ),<br>
+<br>
+ TP_printk("i40e_napi_poll on dev %s q %s irq %d irq_mask %s curr_cpu %d "<br>
+ "budget %d bpr %d rx_cleaned %u tx_cleaned %u "<br>
+ "rx_clean_complete %d tx_clean_complete %d",<br>
+ __get_str(dev_name), __get_str(qname), __entry->irq_num,<br>
+ __get_bitmask(irq_affinity), __entry->curr_cpu, __entry->budget,<br>
+ __entry->budget_per_ring, __entry->rx_cleaned, __entry->tx_cleaned,<br>
+ __entry->rx_clean_complete, __entry->tx_clean_complete)<br>
+);<br>
+<br>
/* Events related to a vsi & ring */<br>
DECLARE_EVENT_CLASS(<br>
i40e_tx_template,<br>
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c<br>
index 5901e58..f2b1b94 100644<br>
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c<br>
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c<br>
@@ -2752,6 +2752,10 @@ int i40e_napi_poll(struct napi_struct *napi, int budget)<br>
clean_complete = rx_clean_complete = false;<br>
}<br>
<br>
+ if (!i40e_enabled_xdp_vsi(vsi))<br>
+ trace_i40e_napi_poll(napi, q_vector, budget, budget_per_ring, rx_cleaned,<br>
+ tx_cleaned, rx_clean_complete, tx_clean_complete);<br>
+<br>
/* If work not completed, return budget and polling will return */<br>
if (!clean_complete) {<br>
int cpu_id = smp_processor_id();<br>
-- <br>
2.7.4<br>
<br>
</div>