@@ -12,6 +12,31 @@
TRACE_EVENT(napi_poll,
+ TP_PROTO(struct napi_struct *napi, int weight, int work),
+
+ TP_ARGS(napi, weight, work),
+
+ TP_STRUCT__entry(
+ __field( struct napi_struct *, napi)
+ __string( dev_name, napi->dev ? napi->dev->name : NO_DEV)
+ __field( int, weight)
+ __field( int, work)
+ ),
+
+ TP_fast_assign(
+ __entry->napi = napi;
+ __assign_str(dev_name, napi->dev ? napi->dev->name : NO_DEV);
+ __entry->weight = weight;
+ __entry->work = work;
+ ),
+
+ TP_printk("napi poll on napi struct %p for device %s"
+ " weight %d work %d",
+ __entry->napi, __get_str(dev_name), __entry->weight,
+ __entry->work)
+);
+
+DECLARE_EVENT_CLASS(napi_state,
TP_PROTO(struct napi_struct *napi),
TP_ARGS(napi),
@@ -26,8 +51,18 @@ TRACE_EVENT(napi_poll,
__assign_str(dev_name, napi->dev ? napi->dev->name : NO_DEV);
),
- TP_printk("napi poll on napi struct %p for device %s",
- __entry->napi, __get_str(dev_name))
+ TP_printk("napi struct %p for device %s",
+ __entry->napi, __get_str(dev_name))
+);
+
+DEFINE_EVENT(napi_state, napi_schedule,
+ TP_PROTO(struct napi_struct *napi),
+ TP_ARGS(napi)
+);
+
+DEFINE_EVENT(napi_state, napi_complete,
+ TP_PROTO(struct napi_struct *napi),
+ TP_ARGS(napi)
);
#undef NO_DEV
@@ -4023,6 +4023,7 @@ void __napi_schedule(struct napi_struct *n)
local_irq_save(flags);
____napi_schedule(&__get_cpu_var(softnet_data), n);
local_irq_restore(flags);
+ trace_napi_schedule(n);
}
EXPORT_SYMBOL(__napi_schedule);
@@ -4034,6 +4035,7 @@ void __napi_complete(struct napi_struct *n)
list_del(&n->poll_list);
smp_mb__before_clear_bit();
clear_bit(NAPI_STATE_SCHED, &n->state);
+ trace_napi_complete(n);
}
EXPORT_SYMBOL(__napi_complete);
@@ -4134,7 +4136,7 @@ static void net_rx_action(struct softirq_action *h)
work = 0;
if (test_bit(NAPI_STATE_SCHED, &n->state)) {
work = n->poll(n, weight);
- trace_napi_poll(n);
+ trace_napi_poll(n, weight, work);
}
WARN_ON_ONCE(work > weight);
@@ -160,7 +160,7 @@ static int poll_one_napi(struct netpoll_info *npinfo,
set_bit(NAPI_STATE_NPSVC, &napi->state);
work = napi->poll(napi, budget);
- trace_napi_poll(napi);
+ trace_napi_poll(napi, budget, work);
clear_bit(NAPI_STATE_NPSVC, &napi->state);
atomic_dec(&trapped);