net:wireless:Support eswin usb wifi ECR6600U
[platform/kernel/linux-starfive.git] / drivers / net / wireless / eswin / ecrnx_events.h
1 /**
2  ******************************************************************************
3  *
4  * @file ecrnx_events.h
5  *
6  * @brief Trace events definition
7  *
8  * Copyright (C) ESWIN 2015-2020
9  *
10  ******************************************************************************
11  */
12 #undef TRACE_SYSTEM
13 #define TRACE_SYSTEM ecrnx
14
15 #if !defined(_ECRNX_EVENTS_H) || defined(TRACE_HEADER_MULTI_READ)
16 #define _ECRNX_EVENTS_H
17
18 #include <linux/tracepoint.h>
19 #ifndef CONFIG_ECRNX_FHOST
20 #include "ecrnx_tx.h"
21 #endif
22 #include "ecrnx_compat.h"
23
24 /*****************************************************************************
25  * TRACE function for MGMT TX (FULLMAC)
26  ****************************************************************************/
27 #ifdef CONFIG_ECRNX_FULLMAC
28 #include "linux/ieee80211.h"
29 #if defined(CONFIG_TRACEPOINTS) && defined(CREATE_TRACE_POINTS)
30 #include <linux/trace_seq.h>
31
32 /* P2P Public Action Frames Definitions (see WiFi P2P Technical Specification, section 4.2.8) */
33 /* IEEE 802.11 Public Action Usage Category - Define P2P public action frames */
34 #define MGMT_ACTION_PUBLIC_CAT              (0x04)
35 /* Offset of OUI Subtype field in P2P Action Frame format */
36 #define MGMT_ACTION_OUI_SUBTYPE_OFFSET      (6)
37 /* P2P Public Action Frame Types */
38 enum p2p_action_type {
39     P2P_ACTION_GO_NEG_REQ   = 0,    /* GO Negociation Request */
40     P2P_ACTION_GO_NEG_RSP,          /* GO Negociation Response */
41     P2P_ACTION_GO_NEG_CFM,          /* GO Negociation Confirmation */
42     P2P_ACTION_INVIT_REQ,           /* P2P Invitation Request */
43     P2P_ACTION_INVIT_RSP,           /* P2P Invitation Response */
44     P2P_ACTION_DEV_DISC_REQ,        /* Device Discoverability Request */
45     P2P_ACTION_DEV_DISC_RSP,        /* Device Discoverability Response */
46     P2P_ACTION_PROV_DISC_REQ,       /* Provision Discovery Request */
47     P2P_ACTION_PROV_DISC_RSP,       /* Provision Discovery Response */
48 };
49
50 const char *ftrace_print_mgmt_info(struct trace_seq *p, u16 frame_control, u8 cat, u8 type, u8 p2p) {
51     const char *ret = trace_seq_buffer_ptr(p);
52
53     switch (frame_control & IEEE80211_FCTL_STYPE) {
54         case (IEEE80211_STYPE_ASSOC_REQ): trace_seq_printf(p, "Association Request"); break;
55         case (IEEE80211_STYPE_ASSOC_RESP): trace_seq_printf(p, "Association Response"); break;
56         case (IEEE80211_STYPE_REASSOC_REQ): trace_seq_printf(p, "Reassociation Request"); break;
57         case (IEEE80211_STYPE_REASSOC_RESP): trace_seq_printf(p, "Reassociation Response"); break;
58         case (IEEE80211_STYPE_PROBE_REQ): trace_seq_printf(p, "Probe Request"); break;
59         case (IEEE80211_STYPE_PROBE_RESP): trace_seq_printf(p, "Probe Response"); break;
60         case (IEEE80211_STYPE_BEACON): trace_seq_printf(p, "Beacon"); break;
61         case (IEEE80211_STYPE_ATIM): trace_seq_printf(p, "ATIM"); break;
62         case (IEEE80211_STYPE_DISASSOC): trace_seq_printf(p, "Disassociation"); break;
63         case (IEEE80211_STYPE_AUTH): trace_seq_printf(p, "Authentication"); break;
64         case (IEEE80211_STYPE_DEAUTH): trace_seq_printf(p, "Deauthentication"); break;
65         case (IEEE80211_STYPE_ACTION):
66             trace_seq_printf(p, "Action");
67             if (cat == MGMT_ACTION_PUBLIC_CAT && type == 0x9)
68                 switch (p2p) {
69                     case (P2P_ACTION_GO_NEG_REQ): trace_seq_printf(p, ": GO Negociation Request"); break;
70                     case (P2P_ACTION_GO_NEG_RSP): trace_seq_printf(p, ": GO Negociation Response"); break;
71                     case (P2P_ACTION_GO_NEG_CFM): trace_seq_printf(p, ": GO Negociation Confirmation"); break;
72                     case (P2P_ACTION_INVIT_REQ): trace_seq_printf(p, ": P2P Invitation Request"); break;
73                     case (P2P_ACTION_INVIT_RSP): trace_seq_printf(p, ": P2P Invitation Response"); break;
74                     case (P2P_ACTION_DEV_DISC_REQ): trace_seq_printf(p, ": Device Discoverability Request"); break;
75                     case (P2P_ACTION_DEV_DISC_RSP): trace_seq_printf(p, ": Device Discoverability Response"); break;
76                     case (P2P_ACTION_PROV_DISC_REQ): trace_seq_printf(p, ": Provision Discovery Request"); break;
77                     case (P2P_ACTION_PROV_DISC_RSP): trace_seq_printf(p, ": Provision Discovery Response"); break;
78                     default: trace_seq_printf(p, "Unknown p2p %d", p2p); break;
79                 }
80             else {
81                 switch (cat) {
82                     case 0: trace_seq_printf(p, ":Spectrum %d", type); break;
83                     case 1: trace_seq_printf(p, ":QOS %d", type); break;
84                     case 2: trace_seq_printf(p, ":DLS %d", type); break;
85                     case 3: trace_seq_printf(p, ":BA %d", type); break;
86                     case 4: trace_seq_printf(p, ":Public %d", type); break;
87                     case 5: trace_seq_printf(p, ":Radio Measure %d", type); break;
88                     case 6: trace_seq_printf(p, ":Fast BSS %d", type); break;
89                     case 7: trace_seq_printf(p, ":HT Action %d", type); break;
90                     case 8: trace_seq_printf(p, ":SA Query %d", type); break;
91                     case 9: trace_seq_printf(p, ":Protected Public %d", type); break;
92                     case 10: trace_seq_printf(p, ":WNM %d", type); break;
93                     case 11: trace_seq_printf(p, ":Unprotected WNM %d", type); break;
94                     case 12: trace_seq_printf(p, ":TDLS %d", type); break;
95                     case 13: trace_seq_printf(p, ":Mesh %d", type); break;
96                     case 14: trace_seq_printf(p, ":MultiHop %d", type); break;
97                     case 15: trace_seq_printf(p, ":Self Protected %d", type); break;
98                     case 126: trace_seq_printf(p, ":Vendor protected"); break;
99                     case 127: trace_seq_printf(p, ":Vendor"); break;
100                     default: trace_seq_printf(p, ":Unknown category %d", cat); break;
101                 }
102             }
103             break;
104         default: trace_seq_printf(p, "Unknown subtype %d", frame_control & IEEE80211_FCTL_STYPE); break;
105     }
106
107     trace_seq_putc(p, 0);
108
109     return ret;
110 }
111 #endif /* defined(CONFIG_TRACEPOINTS) && defined(CREATE_TRACE_POINTS) */
112
113 #undef __print_mgmt_info
114 #define __print_mgmt_info(frame_control, cat, type, p2p) ftrace_print_mgmt_info(p, frame_control, cat, type, p2p)
115
116 TRACE_EVENT(
117     roc,
118     TP_PROTO(u8 vif_idx, u16 freq, unsigned int duration),
119     TP_ARGS(vif_idx, freq, duration),
120     TP_STRUCT__entry(
121         __field(u8, vif_idx)
122         __field(u16, freq)
123         __field(unsigned int, duration)
124                      ),
125     TP_fast_assign(
126         __entry->vif_idx = vif_idx;
127         __entry->freq = freq;
128         __entry->duration = duration;
129                    ),
130     TP_printk("f=%d vif=%d dur=%d",
131             __entry->freq, __entry->vif_idx, __entry->duration)
132 );
133
134 TRACE_EVENT(
135     cancel_roc,
136     TP_PROTO(u8 vif_idx),
137     TP_ARGS(vif_idx),
138     TP_STRUCT__entry(
139         __field(u8, vif_idx)
140                      ),
141     TP_fast_assign(
142         __entry->vif_idx = vif_idx;
143                    ),
144     TP_printk("vif=%d", __entry->vif_idx)
145 );
146
147 TRACE_EVENT(
148     roc_exp,
149     TP_PROTO(u8 vif_idx),
150     TP_ARGS(vif_idx),
151     TP_STRUCT__entry(
152         __field(u8, vif_idx)
153                      ),
154     TP_fast_assign(
155         __entry->vif_idx = vif_idx;
156                    ),
157     TP_printk("vif=%d", __entry->vif_idx)
158 );
159
160 TRACE_EVENT(
161     switch_roc,
162     TP_PROTO(u8 vif_idx),
163     TP_ARGS(vif_idx),
164     TP_STRUCT__entry(
165         __field(u8, vif_idx)
166                      ),
167     TP_fast_assign(
168         __entry->vif_idx = vif_idx;
169                    ),
170     TP_printk("vif=%d", __entry->vif_idx)
171 );
172
173 DECLARE_EVENT_CLASS(
174     mgmt_template,
175     TP_PROTO(u16 freq, u8 vif_idx, u8 sta_idx, struct ieee80211_mgmt *mgmt),
176     TP_ARGS(freq, vif_idx, sta_idx, mgmt),
177     TP_STRUCT__entry(
178         __field(u16, freq)
179         __field(u8, vif_idx)
180         __field(u8, sta_idx)
181         __field(u16, frame_control)
182         __field(u8, action_cat)
183         __field(u8, action_type)
184         __field(u8, action_p2p)
185                      ),
186     TP_fast_assign(
187         __entry->freq = freq;
188         __entry->vif_idx = vif_idx;
189         __entry->sta_idx = sta_idx;
190         __entry->frame_control = mgmt->frame_control;
191         __entry->action_cat = mgmt->u.action.category;
192         __entry->action_type = mgmt->u.action.u.wme_action.action_code;
193         __entry->action_p2p = *((u8 *)&mgmt->u.action.category
194                                  + MGMT_ACTION_OUI_SUBTYPE_OFFSET);
195                    ),
196     TP_printk("f=%d vif=%d sta=%d -> %s",
197             __entry->freq, __entry->vif_idx, __entry->sta_idx,
198               __print_mgmt_info(__entry->frame_control, __entry->action_cat,
199                                 __entry->action_type, __entry->action_p2p))
200 );
201
202 DEFINE_EVENT(mgmt_template, mgmt_tx,
203              TP_PROTO(u16 freq, u8 vif_idx, u8 sta_idx, struct ieee80211_mgmt *mgmt),
204              TP_ARGS(freq, vif_idx, sta_idx, mgmt));
205
206 DEFINE_EVENT(mgmt_template, mgmt_rx,
207              TP_PROTO(u16 freq, u8 vif_idx, u8 sta_idx, struct ieee80211_mgmt *mgmt),
208              TP_ARGS(freq, vif_idx, sta_idx, mgmt));
209
210 TRACE_EVENT(
211     mgmt_cfm,
212     TP_PROTO(u8 vif_idx, u8 sta_idx, bool acked),
213     TP_ARGS(vif_idx, sta_idx, acked),
214     TP_STRUCT__entry(
215         __field(u8, vif_idx)
216         __field(u8, sta_idx)
217         __field(bool, acked)
218                      ),
219     TP_fast_assign(
220         __entry->vif_idx = vif_idx;
221         __entry->sta_idx = sta_idx;
222         __entry->acked = acked;
223                    ),
224     TP_printk("vif=%d sta=%d ack=%d",
225             __entry->vif_idx, __entry->sta_idx, __entry->acked)
226 );
227 #endif /* CONFIG_ECRNX_FULLMAC */
228
229 /*****************************************************************************
230  * TRACE function for TXQ
231  ****************************************************************************/
232 #ifndef CONFIG_ECRNX_FHOST
233 #if defined(CONFIG_TRACEPOINTS) && defined(CREATE_TRACE_POINTS)
234
235 #include <linux/trace_seq.h>
236 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
237 #include <linux/trace_events.h>
238 #else
239 #include <linux/ftrace_event.h>
240 #endif
241
242 const char *
243 ftrace_print_txq(struct trace_seq *p, int txq_idx) {
244     const char *ret = trace_seq_buffer_ptr(p);
245
246     if (txq_idx == TXQ_INACTIVE) {
247         trace_seq_printf(p, "[INACTIVE]");
248     } else if (txq_idx < NX_FIRST_VIF_TXQ_IDX) {
249         trace_seq_printf(p, "[STA %d/%d]",
250                          txq_idx / NX_NB_TXQ_PER_STA,
251                          txq_idx % NX_NB_TXQ_PER_STA);
252 #ifdef CONFIG_ECRNX_FULLMAC
253     } else if (txq_idx < NX_FIRST_UNK_TXQ_IDX) {
254         trace_seq_printf(p, "[BC/MC %d]",
255                          txq_idx - NX_FIRST_BCMC_TXQ_IDX);
256     } else if (txq_idx < NX_OFF_CHAN_TXQ_IDX) {
257         trace_seq_printf(p, "[UNKNOWN %d]",
258                          txq_idx - NX_FIRST_UNK_TXQ_IDX);
259     } else if (txq_idx == NX_OFF_CHAN_TXQ_IDX) {
260         trace_seq_printf(p, "[OFFCHAN]");
261 #else
262     } else if (txq_idx < NX_NB_TXQ) {
263         txq_idx -= NX_FIRST_VIF_TXQ_IDX;
264         trace_seq_printf(p, "[VIF %d/%d]",
265                          txq_idx / NX_NB_TXQ_PER_VIF,
266                          txq_idx % NX_NB_TXQ_PER_VIF);
267 #endif
268     } else {
269         trace_seq_printf(p, "[ERROR %d]", txq_idx);
270     }
271
272     trace_seq_putc(p, 0);
273
274     return ret;
275 }
276
277 const char *
278 ftrace_print_sta(struct trace_seq *p, int sta_idx) {
279     const char *ret = trace_seq_buffer_ptr(p);
280
281     if (sta_idx < NX_REMOTE_STA_MAX) {
282         trace_seq_printf(p, "[STA %d]", sta_idx);
283     } else {
284         trace_seq_printf(p, "[BC/MC %d]", sta_idx - NX_REMOTE_STA_MAX);
285     }
286
287     trace_seq_putc(p, 0);
288
289     return ret;
290 }
291
292 const char *
293 ftrace_print_hwq(struct trace_seq *p, int hwq_idx) {
294
295     static const struct trace_print_flags symbols[] =
296         {{ECRNX_HWQ_BK, "BK"},
297          {ECRNX_HWQ_BE, "BE"},
298          {ECRNX_HWQ_VI, "VI"},
299          {ECRNX_HWQ_VO, "VO"},
300 #ifdef CONFIG_ECRNX_FULLMAC
301          {ECRNX_HWQ_BCMC, "BCMC"},
302 #else
303          {ECRNX_HWQ_BCN, "BCN"},
304 #endif
305          { -1, NULL }};
306     return trace_print_symbols_seq(p, hwq_idx, symbols);
307 }
308
309 const char *
310 ftrace_print_hwq_cred(struct trace_seq *p, u8 *cred) {
311     const char *ret = trace_seq_buffer_ptr(p);
312
313 #if CONFIG_USER_MAX == 1
314     trace_seq_printf(p, "%d", cred[0]);
315 #else
316     int i;
317
318     for (i = 0; i < CONFIG_USER_MAX - 1; i++)
319         trace_seq_printf(p, "%d-", cred[i]);
320     trace_seq_printf(p, "%d", cred[i]);
321 #endif
322
323     trace_seq_putc(p, 0);
324     return ret;
325 }
326
327 const char *
328 ftrace_print_mu_info(struct trace_seq *p, u8 mu_info) {
329     const char *ret = trace_seq_buffer_ptr(p);
330
331     if (mu_info)
332         trace_seq_printf(p, "MU: %d-%d", (mu_info & 0x3f), (mu_info >> 6));
333
334     trace_seq_putc(p, 0);
335     return ret;
336 }
337
338 const char *
339 ftrace_print_mu_group(struct trace_seq *p, int nb_user, u8 *users) {
340     const char *ret = trace_seq_buffer_ptr(p);
341     int i;
342
343     if (users[0] != 0xff)
344         trace_seq_printf(p, "(%d", users[0]);
345     else
346         trace_seq_printf(p, "(-");
347     for (i = 1; i < CONFIG_USER_MAX ; i++) {
348         if (users[i] != 0xff)
349             trace_seq_printf(p, ",%d", users[i]);
350         else
351             trace_seq_printf(p, ",-");
352     }
353
354     trace_seq_printf(p, ")");
355     trace_seq_putc(p, 0);
356     return ret;
357 }
358
359 const char *
360 ftrace_print_amsdu(struct trace_seq *p, u16 nb_pkt) {
361     const char *ret = trace_seq_buffer_ptr(p);
362
363     if (nb_pkt > 1)
364         trace_seq_printf(p, "(AMSDU %d)", nb_pkt);
365
366     trace_seq_putc(p, 0);
367     return ret;
368 }
369 #endif /* defined(CONFIG_TRACEPOINTS) && defined(CREATE_TRACE_POINTS) */
370
371 #undef __print_txq
372 #define __print_txq(txq_idx) ftrace_print_txq(p, txq_idx)
373
374 #undef __print_sta
375 #define __print_sta(sta_idx) ftrace_print_sta(p, sta_idx)
376
377 #undef __print_hwq
378 #define __print_hwq(hwq) ftrace_print_hwq(p, hwq)
379
380 #undef __print_hwq_cred
381 #define __print_hwq_cred(cred) ftrace_print_hwq_cred(p, cred)
382
383 #undef __print_mu_info
384 #define __print_mu_info(mu_info) ftrace_print_mu_info(p, mu_info)
385
386 #undef __print_mu_group
387 #define __print_mu_group(nb, users) ftrace_print_mu_group(p, nb, users)
388
389 #undef __print_amsdu
390 #define __print_amsdu(nb_pkt) ftrace_print_amsdu(p, nb_pkt)
391
392 #ifdef CONFIG_ECRNX_FULLMAC
393
394 TRACE_EVENT(
395     txq_select,
396     TP_PROTO(int txq_idx, u16 pkt_ready_up, struct sk_buff *skb),
397     TP_ARGS(txq_idx, pkt_ready_up, skb),
398     TP_STRUCT__entry(
399         __field(u16, txq_idx)
400         __field(u16, pkt_ready)
401         __field(struct sk_buff *, skb)
402                      ),
403     TP_fast_assign(
404         __entry->txq_idx = txq_idx;
405         __entry->pkt_ready = pkt_ready_up;
406         __entry->skb = skb;
407                    ),
408     TP_printk("%s pkt_ready_up=%d skb=%p", __print_txq(__entry->txq_idx),
409               __entry->pkt_ready, __entry->skb)
410 );
411
412 #endif /* CONFIG_ECRNX_FULLMAC */
413
414 DECLARE_EVENT_CLASS(
415     hwq_template,
416     TP_PROTO(u8 hwq_idx),
417     TP_ARGS(hwq_idx),
418     TP_STRUCT__entry(
419         __field(u8, hwq_idx)
420                      ),
421     TP_fast_assign(
422         __entry->hwq_idx = hwq_idx;
423                    ),
424     TP_printk("%s", __print_hwq(__entry->hwq_idx))
425 );
426
427 DEFINE_EVENT(hwq_template, hwq_flowctrl_stop,
428              TP_PROTO(u8 hwq_idx),
429              TP_ARGS(hwq_idx));
430
431 DEFINE_EVENT(hwq_template, hwq_flowctrl_start,
432              TP_PROTO(u8 hwq_idx),
433              TP_ARGS(hwq_idx));
434
435
436 DECLARE_EVENT_CLASS(
437     txq_template,
438     TP_PROTO(struct ecrnx_txq *txq),
439     TP_ARGS(txq),
440     TP_STRUCT__entry(
441         __field(u16, txq_idx)
442                      ),
443     TP_fast_assign(
444         __entry->txq_idx = txq->idx;
445                    ),
446     TP_printk("%s", __print_txq(__entry->txq_idx))
447 );
448
449 DEFINE_EVENT(txq_template, txq_add_to_hw,
450              TP_PROTO(struct ecrnx_txq *txq),
451              TP_ARGS(txq));
452
453 DEFINE_EVENT(txq_template, txq_del_from_hw,
454              TP_PROTO(struct ecrnx_txq *txq),
455              TP_ARGS(txq));
456
457 #ifdef CONFIG_ECRNX_FULLMAC
458
459 DEFINE_EVENT(txq_template, txq_flowctrl_stop,
460              TP_PROTO(struct ecrnx_txq *txq),
461              TP_ARGS(txq));
462
463 DEFINE_EVENT(txq_template, txq_flowctrl_restart,
464              TP_PROTO(struct ecrnx_txq *txq),
465              TP_ARGS(txq));
466
467 #endif  /* CONFIG_ECRNX_FULLMAC */
468
469 TRACE_EVENT(
470     process_txq,
471     TP_PROTO(struct ecrnx_txq *txq),
472     TP_ARGS(txq),
473     TP_STRUCT__entry(
474         __field(u16, txq_idx)
475         __field(u16, len)
476         __field(u16, len_retry)
477         __field(s8, credit)
478         #ifdef CONFIG_ECRNX_FULLMAC
479         __field(u16, limit)
480         #endif /* CONFIG_ECRNX_FULLMAC*/
481                      ),
482     TP_fast_assign(
483         __entry->txq_idx = txq->idx;
484         __entry->len = skb_queue_len(&txq->sk_list);
485         #ifdef CONFIG_MAC80211_TXQ
486         __entry->len += txq->nb_ready_mac80211;
487         #endif
488         __entry->len_retry = txq->nb_retry;
489         __entry->credit = txq->credits;
490         #ifdef CONFIG_ECRNX_FULLMAC
491         __entry->limit = txq->push_limit;
492         #endif /* CONFIG_ECRNX_FULLMAC*/
493                    ),
494
495     #ifdef CONFIG_ECRNX_FULLMAC
496     TP_printk("%s txq_credits=%d, len=%d, retry_len=%d, push_limit=%d",
497               __print_txq(__entry->txq_idx), __entry->credit,
498               __entry->len, __entry->len_retry, __entry->limit)
499     #else
500     TP_printk("%s txq_credits=%d, len=%d, retry_len=%d",
501               __print_txq(__entry->txq_idx), __entry->credit,
502               __entry->len, __entry->len_retry)
503     #endif /* CONFIG_ECRNX_FULLMAC*/
504 );
505
506 DECLARE_EVENT_CLASS(
507     txq_reason_template,
508     TP_PROTO(struct ecrnx_txq *txq, u16 reason),
509     TP_ARGS(txq, reason),
510     TP_STRUCT__entry(
511         __field(u16, txq_idx)
512         __field(u16, reason)
513         __field(u16, status)
514                      ),
515     TP_fast_assign(
516         __entry->txq_idx = txq->idx;
517         __entry->reason = reason;
518         __entry->status = txq->status;
519                    ),
520     TP_printk("%s reason=%s status=%s",
521               __print_txq(__entry->txq_idx),
522               __print_symbolic(__entry->reason,
523                                {ECRNX_TXQ_STOP_FULL, "FULL"},
524                                {ECRNX_TXQ_STOP_CSA, "CSA"},
525                                {ECRNX_TXQ_STOP_STA_PS, "PS"},
526                                {ECRNX_TXQ_STOP_VIF_PS, "VPS"},
527                                {ECRNX_TXQ_STOP_CHAN, "CHAN"},
528                                {ECRNX_TXQ_STOP_MU_POS, "MU"}),
529               __print_flags(__entry->status, "|",
530                             {ECRNX_TXQ_IN_HWQ_LIST, "IN LIST"},
531                             {ECRNX_TXQ_STOP_FULL, "FULL"},
532                             {ECRNX_TXQ_STOP_CSA, "CSA"},
533                             {ECRNX_TXQ_STOP_STA_PS, "PS"},
534                             {ECRNX_TXQ_STOP_VIF_PS, "VPS"},
535                             {ECRNX_TXQ_STOP_CHAN, "CHAN"},
536                             {ECRNX_TXQ_STOP_MU_POS, "MU"},
537                             {ECRNX_TXQ_NDEV_FLOW_CTRL, "FLW_CTRL"}))
538 );
539
540 DEFINE_EVENT(txq_reason_template, txq_start,
541              TP_PROTO(struct ecrnx_txq *txq, u16 reason),
542              TP_ARGS(txq, reason));
543
544 DEFINE_EVENT(txq_reason_template, txq_stop,
545              TP_PROTO(struct ecrnx_txq *txq, u16 reason),
546              TP_ARGS(txq, reason));
547
548
549 TRACE_EVENT(
550     push_desc,
551     TP_PROTO(struct sk_buff *skb, struct ecrnx_sw_txhdr *sw_txhdr, int push_flags),
552
553     TP_ARGS(skb, sw_txhdr, push_flags),
554
555     TP_STRUCT__entry(
556         __field(struct sk_buff *, skb)
557         __field(unsigned int, len)
558         __field(u16, tx_queue)
559         __field(u8, hw_queue)
560         __field(u8, push_flag)
561         __field(u32, flag)
562         __field(s8, txq_cred)
563         __field(u8, hwq_cred)
564         __field(u8, txq_length)
565 #ifdef CONFIG_ECRNX_SOFTMAC
566         __field(u16, sn)
567 #endif
568         __field(u16, pkt_cnt)
569         __field(u8, mu_info)
570                      ),
571     TP_fast_assign(
572         __entry->skb = skb;
573         __entry->tx_queue = sw_txhdr->txq->idx;
574         __entry->push_flag = push_flags;
575         __entry->hw_queue = sw_txhdr->txq->hwq->id;
576         __entry->txq_cred = sw_txhdr->txq->credits;
577         __entry->hwq_cred = sw_txhdr->txq->hwq->credits[ECRNX_TXQ_POS_ID(sw_txhdr->txq)];
578 #ifdef CONFIG_ECRNX_SPLIT_TX_BUF
579         __entry->pkt_cnt =  sw_txhdr->desc.host.packet_cnt;
580 #endif
581         __entry->txq_length = skb_queue_len(&sw_txhdr->txq->sk_list);
582 #ifdef CONFIG_ECRNX_FULLMAC
583         __entry->flag = sw_txhdr->desc.host.flags;
584 #ifdef CONFIG_ECRNX_SPLIT_TX_BUF
585 #ifdef CONFIG_ECRNX_AMSDUS_TX
586         if (sw_txhdr->amsdu.len)
587             __entry->len = sw_txhdr->amsdu.len;
588         else
589 #endif /* CONFIG_ECRNX_AMSDUS_TX */
590             __entry->len = sw_txhdr->desc.host.packet_len[0];
591 #else
592         __entry->len = sw_txhdr->desc.host.packet_len;
593 #endif /* CONFIG_ECRNX_SPLIT_TX_BUF */
594
595 #else /* !CONFIG_ECRNX_FULLMAC */
596         __entry->flag = sw_txhdr->desc.umac.flags;
597         __entry->len = sw_txhdr->frame_len;
598         __entry->sn = sw_txhdr->sn;
599 #endif /* CONFIG_ECRNX_FULLMAC */
600 #ifdef CONFIG_ECRNX_MUMIMO_TX
601         __entry->mu_info = sw_txhdr->desc.host.mumimo_info;
602 #else
603         __entry->mu_info = 0;
604 #endif
605                    ),
606
607 #ifdef CONFIG_ECRNX_FULLMAC
608     TP_printk("%s skb=%p (len=%d) hw_queue=%s txq_length=%d cred_txq=%d cred_hwq=%d %s flag=%s %s%s%s",
609               __print_txq(__entry->tx_queue), __entry->skb, __entry->len,
610               __print_hwq(__entry->hw_queue), __entry->txq_length,
611               __entry->txq_cred, __entry->hwq_cred,
612               __print_mu_info(__entry->mu_info),
613               __print_flags(__entry->flag, "|",
614                             {TXU_CNTRL_RETRY, "RETRY"},
615                             {TXU_CNTRL_MORE_DATA, "MOREDATA"},
616                             {TXU_CNTRL_MGMT, "MGMT"},
617                             {TXU_CNTRL_MGMT_NO_CCK, "NO_CCK"},
618                             {TXU_CNTRL_MGMT_ROBUST, "ROBUST"},
619                             {TXU_CNTRL_AMSDU, "AMSDU"},
620                             {TXU_CNTRL_USE_4ADDR, "4ADDR"},
621                             {TXU_CNTRL_EOSP, "EOSP"},
622                             {TXU_CNTRL_MESH_FWD, "MESH_FWD"},
623                             {TXU_CNTRL_TDLS, "TDLS"}),
624               (__entry->push_flag & ECRNX_PUSH_IMMEDIATE) ? "(IMMEDIATE)" : "",
625               (!(__entry->flag & TXU_CNTRL_RETRY) &&
626                (__entry->push_flag & ECRNX_PUSH_RETRY)) ? "(SW_RETRY)" : "",
627               __print_amsdu(__entry->pkt_cnt))
628 #else
629     TP_printk("%s skb=%p (len=%d) hw_queue=%s txq_length=%d cred_txq=%d cred_hwq=%d %s flag=%x (%s) sn=%d %s",
630               __print_txq(__entry->tx_queue), __entry->skb, __entry->len,
631               __print_hwq(__entry->hw_queue), __entry->txq_length, __entry->txq_cred,
632               __entry->hwq_cred,
633               __print_mu_info(__entry->mu_info),
634               __entry->flag,
635               __print_flags(__entry->push_flag, "|",
636                             {ECRNX_PUSH_RETRY, "RETRY"},
637                             {ECRNX_PUSH_IMMEDIATE, "IMMEDIATE"}),
638               __entry->sn, __print_amsdu(__entry->pkt_cnt))
639 #endif /* CONFIG_ECRNX_FULLMAC */
640 );
641
642
643 TRACE_EVENT(
644     txq_queue_skb,
645     TP_PROTO(struct sk_buff *skb, struct ecrnx_txq *txq, bool retry),
646     TP_ARGS(skb, txq, retry),
647     TP_STRUCT__entry(
648         __field(struct sk_buff *, skb)
649         __field(u16, txq_idx)
650         __field(s8, credit)
651         __field(u16, q_len)
652         __field(u16, q_len_retry)
653         __field(bool, retry)
654                      ),
655     TP_fast_assign(
656         __entry->skb = skb;
657         __entry->txq_idx = txq->idx;
658         __entry->credit = txq->credits;
659         __entry->q_len = skb_queue_len(&txq->sk_list);
660         __entry->q_len_retry = txq->nb_retry;
661         __entry->retry = retry;
662                    ),
663
664     TP_printk("%s skb=%p retry=%d txq_credits=%d queue_len=%d (retry = %d)",
665               __print_txq(__entry->txq_idx), __entry->skb, __entry->retry,
666               __entry->credit, __entry->q_len, __entry->q_len_retry)
667 );
668 TRACE_EVENT(
669     txq_drop_skb,
670     TP_PROTO(struct sk_buff *skb, struct ecrnx_txq *txq, unsigned long queued_time),
671     TP_ARGS(skb, txq, queued_time),
672     TP_STRUCT__entry(
673         __field(struct sk_buff *, skb)
674         __field(u16, txq_idx)
675         __field(unsigned long, queued_time)
676         __field(u16, q_len)
677         __field(u16, q_len_retry)
678                      ),
679     TP_fast_assign(
680         __entry->skb = skb;
681         __entry->txq_idx = txq->idx;
682         __entry->q_len = skb_queue_len(&txq->sk_list);
683         __entry->q_len_retry = txq->nb_retry;
684         __entry->queued_time = queued_time;
685                    ),
686     TP_printk("%s skb=%p time_queued=%dms queue_len=%d (retry = %d)",
687               __print_txq(__entry->txq_idx), __entry->skb,
688               jiffies_to_msecs(__entry->queued_time), __entry->q_len, __entry->q_len_retry)
689 );
690
691 #ifdef CONFIG_MAC80211_TXQ
692 TRACE_EVENT(
693     txq_wake,
694     TP_PROTO(struct ecrnx_txq *txq),
695     TP_ARGS(txq),
696     TP_STRUCT__entry(
697         __field(u16, txq_idx)
698         __field(u16, q_len)
699                      ),
700     TP_fast_assign(
701         __entry->txq_idx = txq->idx;
702         __entry->q_len = txq->nb_ready_mac80211;
703                    ),
704
705     TP_printk("%s mac80211_queue_len=%d", __print_txq(__entry->txq_idx), __entry->q_len)
706 );
707
708 TRACE_EVENT(
709     txq_drop,
710     TP_PROTO(struct ecrnx_txq *txq, unsigned long nb_drop),
711     TP_ARGS(txq, nb_drop),
712     TP_STRUCT__entry(
713         __field(u16, txq_idx)
714         __field(u16, nb_drop)
715                      ),
716     TP_fast_assign(
717         __entry->txq_idx = txq->idx;
718         __entry->nb_drop = nb_drop;
719                    ),
720
721     TP_printk("%s %u pkt have been dropped by codel in mac80211 txq",
722               __print_txq(__entry->txq_idx), __entry->nb_drop)
723 );
724
725 #endif
726
727
728 DECLARE_EVENT_CLASS(
729     idx_template,
730     TP_PROTO(u16 idx),
731     TP_ARGS(idx),
732     TP_STRUCT__entry(
733         __field(u16, idx)
734                      ),
735     TP_fast_assign(
736         __entry->idx = idx;
737                    ),
738     TP_printk("idx=%d", __entry->idx)
739 );
740
741
742 DEFINE_EVENT(idx_template, txq_vif_start,
743              TP_PROTO(u16 idx),
744              TP_ARGS(idx));
745
746 DEFINE_EVENT(idx_template, txq_vif_stop,
747              TP_PROTO(u16 idx),
748              TP_ARGS(idx));
749
750 TRACE_EVENT(
751     process_hw_queue,
752     TP_PROTO(struct ecrnx_hwq *hwq),
753     TP_ARGS(hwq),
754     TP_STRUCT__entry(
755         __field(u16, hwq)
756         __array(u8, credits, CONFIG_USER_MAX)
757                      ),
758     TP_fast_assign(
759         int i;
760         __entry->hwq = hwq->id;
761         for (i=0; i < CONFIG_USER_MAX; i ++)
762             __entry->credits[i] = hwq->credits[i];
763                    ),
764     TP_printk("hw_queue=%s hw_credits=%s",
765               __print_hwq(__entry->hwq), __print_hwq_cred(__entry->credits))
766 );
767
768 DECLARE_EVENT_CLASS(
769     sta_idx_template,
770     TP_PROTO(u16 idx),
771     TP_ARGS(idx),
772     TP_STRUCT__entry(
773         __field(u16, idx)
774                      ),
775     TP_fast_assign(
776         __entry->idx = idx;
777                    ),
778     TP_printk("%s", __print_sta(__entry->idx))
779 );
780
781 DEFINE_EVENT(sta_idx_template, txq_sta_start,
782              TP_PROTO(u16 idx),
783              TP_ARGS(idx));
784
785 DEFINE_EVENT(sta_idx_template, txq_sta_stop,
786              TP_PROTO(u16 idx),
787              TP_ARGS(idx));
788
789 #ifdef CONFIG_ECRNX_FULLMAC
790
791 DEFINE_EVENT(sta_idx_template, ps_disable,
792              TP_PROTO(u16 idx),
793              TP_ARGS(idx));
794
795 #endif  /* CONFIG_ECRNX_FULLMAC */
796
797 TRACE_EVENT(
798     skb_confirm,
799     TP_PROTO(struct sk_buff *skb, struct ecrnx_txq *txq, struct ecrnx_hwq *hwq,
800 #ifdef CONFIG_ECRNX_FULLMAC
801              struct tx_cfm_tag *cfm
802 #else
803              u8 cfm
804 #endif
805              ),
806
807     TP_ARGS(skb, txq, hwq, cfm),
808
809     TP_STRUCT__entry(
810         __field(struct sk_buff *, skb)
811         __field(u16, txq_idx)
812         __field(u8, hw_queue)
813         __array(u8, hw_credit, CONFIG_USER_MAX)
814         __field(s8, sw_credit)
815         __field(s8, sw_credit_up)
816 #ifdef CONFIG_ECRNX_FULLMAC
817         __field(u8, ampdu_size)
818 #ifdef CONFIG_ECRNX_SPLIT_TX_BUF
819         __field(u16, amsdu)
820 #endif /* CONFIG_ECRNX_SPLIT_TX_BUF */
821         __field(u16, sn)
822 #endif /* CONFIG_ECRNX_FULLMAC*/
823                      ),
824
825     TP_fast_assign(
826         int i;
827         __entry->skb = skb;
828         __entry->txq_idx = txq->idx;
829         __entry->hw_queue = hwq->id;
830         for (i = 0 ; i < CONFIG_USER_MAX ; i++)
831             __entry->hw_credit[i] = hwq->credits[i];
832         __entry->sw_credit = txq->credits;
833 #if defined CONFIG_ECRNX_FULLMAC
834         __entry->sw_credit_up = cfm->credits;
835         __entry->ampdu_size = cfm->ampdu_size;
836 #ifdef CONFIG_ECRNX_SPLIT_TX_BUF
837         __entry->amsdu = cfm->amsdu_size;
838         __entry->sn = cfm->sn;
839 #endif
840 #else
841         __entry->sw_credit_up = cfm
842 #endif /* CONFIG_ECRNX_FULLMAC */
843                    ),
844
845     TP_printk("%s skb=%p hw_queue=%s, hw_credits=%s, txq_credits=%d (+%d)"
846 #ifdef CONFIG_ECRNX_FULLMAC
847               " sn=%u ampdu=%d"
848 #ifdef CONFIG_ECRNX_SPLIT_TX_BUF
849               " amsdu=%u"
850 #endif
851 #endif
852               , __print_txq(__entry->txq_idx), __entry->skb,
853               __print_hwq(__entry->hw_queue),
854               __print_hwq_cred(__entry->hw_credit),
855                __entry->sw_credit, __entry->sw_credit_up
856 #ifdef CONFIG_ECRNX_FULLMAC
857               , __entry->sn, __entry->ampdu_size
858 #ifdef CONFIG_ECRNX_SPLIT_TX_BUF
859               , __entry->amsdu
860 #endif
861 #endif
862               )
863 );
864
865 TRACE_EVENT(
866     credit_update,
867     TP_PROTO(struct ecrnx_txq *txq, s8_l cred_up),
868
869     TP_ARGS(txq, cred_up),
870
871     TP_STRUCT__entry(
872         __field(struct sk_buff *, skb)
873         __field(u16, txq_idx)
874         __field(s8, sw_credit)
875         __field(s8, sw_credit_up)
876                      ),
877
878     TP_fast_assign(
879         __entry->txq_idx = txq->idx;
880         __entry->sw_credit = txq->credits;
881         __entry->sw_credit_up = cred_up;
882                    ),
883
884     TP_printk("%s txq_credits=%d (%+d)", __print_txq(__entry->txq_idx),
885               __entry->sw_credit, __entry->sw_credit_up)
886 )
887
888 #ifdef CONFIG_ECRNX_FULLMAC
889
890 DECLARE_EVENT_CLASS(
891     ps_template,
892     TP_PROTO(struct ecrnx_sta *sta),
893     TP_ARGS(sta),
894     TP_STRUCT__entry(
895         __field(u16, idx)
896         __field(u16, ready_ps)
897         __field(u16, sp_ps)
898         __field(u16, ready_uapsd)
899         __field(u16, sp_uapsd)
900                      ),
901     TP_fast_assign(
902         __entry->idx  = sta->sta_idx;
903         __entry->ready_ps = sta->ps.pkt_ready[LEGACY_PS_ID];
904         __entry->sp_ps = sta->ps.sp_cnt[LEGACY_PS_ID];
905         __entry->ready_uapsd = sta->ps.pkt_ready[UAPSD_ID];
906         __entry->sp_uapsd = sta->ps.sp_cnt[UAPSD_ID];
907                    ),
908
909     TP_printk("%s [PS] ready=%d sp=%d [UAPSD] ready=%d sp=%d",
910               __print_sta(__entry->idx), __entry->ready_ps, __entry->sp_ps,
911               __entry->ready_uapsd, __entry->sp_uapsd)
912 );
913
914 DEFINE_EVENT(ps_template, ps_queue,
915              TP_PROTO(struct ecrnx_sta *sta),
916              TP_ARGS(sta));
917
918 DEFINE_EVENT(ps_template, ps_drop,
919              TP_PROTO(struct ecrnx_sta *sta),
920              TP_ARGS(sta));
921 DEFINE_EVENT(ps_template, ps_push,
922              TP_PROTO(struct ecrnx_sta *sta),
923              TP_ARGS(sta));
924
925 DEFINE_EVENT(ps_template, ps_enable,
926              TP_PROTO(struct ecrnx_sta *sta),
927              TP_ARGS(sta));
928
929 TRACE_EVENT(
930     ps_traffic_update,
931     TP_PROTO(u16 sta_idx, u8 traffic, bool uapsd),
932
933     TP_ARGS(sta_idx, traffic, uapsd),
934
935     TP_STRUCT__entry(
936         __field(u16, sta_idx)
937         __field(u8, traffic)
938         __field(bool, uapsd)
939                      ),
940
941     TP_fast_assign(
942         __entry->sta_idx = sta_idx;
943         __entry->traffic = traffic;
944         __entry->uapsd = uapsd;
945                    ),
946
947     TP_printk("%s %s%s traffic available ", __print_sta(__entry->sta_idx),
948               __entry->traffic ? "" : "no more ",
949               __entry->uapsd ? "U-APSD" : "legacy PS")
950 );
951
952 TRACE_EVENT(
953     ps_traffic_req,
954     TP_PROTO(struct ecrnx_sta *sta, u16 pkt_req, u8 ps_id),
955     TP_ARGS(sta, pkt_req, ps_id),
956     TP_STRUCT__entry(
957         __field(u16, idx)
958         __field(u16, pkt_req)
959         __field(u8, ps_id)
960         __field(u16, ready)
961         __field(u16, sp)
962                      ),
963     TP_fast_assign(
964         __entry->idx  = sta->sta_idx;
965         __entry->pkt_req  = pkt_req;
966         __entry->ps_id  = ps_id;
967         __entry->ready = sta->ps.pkt_ready[ps_id];
968         __entry->sp = sta->ps.sp_cnt[ps_id];
969                    ),
970
971     TP_printk("%s %s traffic request %d pkt (ready=%d, sp=%d)",
972               __print_sta(__entry->idx),
973               __entry->ps_id == UAPSD_ID ? "U-APSD" : "legacy PS" ,
974               __entry->pkt_req, __entry->ready, __entry->sp)
975 );
976
977
978 #ifdef CONFIG_ECRNX_AMSDUS_TX
979 TRACE_EVENT(
980     amsdu_subframe,
981     TP_PROTO(struct ecrnx_sw_txhdr *sw_txhdr),
982     TP_ARGS(sw_txhdr),
983     TP_STRUCT__entry(
984         __field(struct sk_buff *, skb)
985         __field(u16, txq_idx)
986         __field(u8, nb)
987         __field(u32, len)
988                      ),
989     TP_fast_assign(
990         __entry->skb = sw_txhdr->skb;
991         __entry->nb = sw_txhdr->amsdu.nb;
992         __entry->len = sw_txhdr->amsdu.len;
993         __entry->txq_idx = sw_txhdr->txq->idx;
994                    ),
995
996     TP_printk("%s skb=%p %s nb_subframe=%d, len=%u",
997               __print_txq(__entry->txq_idx), __entry->skb,
998               (__entry->nb == 2) ? "Start new AMSDU" : "Add subframe",
999               __entry->nb, __entry->len)
1000 );
1001 TRACE_EVENT(
1002     amsdu_dismantle,
1003     TP_PROTO(struct ecrnx_sw_txhdr *sw_txhdr),
1004     TP_ARGS(sw_txhdr),
1005     TP_STRUCT__entry(
1006         __field(struct sk_buff *, skb)
1007         __field(u16, txq_idx)
1008         __field(u8, nb)
1009         __field(u32, len)
1010                      ),
1011     TP_fast_assign(
1012         __entry->skb = sw_txhdr->skb;
1013         __entry->nb = sw_txhdr->amsdu.nb;
1014         __entry->len = sw_txhdr->amsdu.len;
1015         __entry->txq_idx = sw_txhdr->txq->idx;
1016                    ),
1017     TP_printk("%s skb=%p nb_subframe=%d, len=%u",
1018               __print_txq(__entry->txq_idx), __entry->skb,
1019               __entry->nb, __entry->len)
1020 );
1021 TRACE_EVENT(
1022     amsdu_len_update,
1023     TP_PROTO(struct ecrnx_sta *sta, int amsdu_len),
1024     TP_ARGS(sta, amsdu_len),
1025     TP_STRUCT__entry(
1026         __field(u8, sta_idx)
1027         __field(u16, amsdu_len)
1028                      ),
1029     TP_fast_assign(
1030         __entry->sta_idx = sta->sta_idx;
1031         __entry->amsdu_len = amsdu_len;
1032                    ),
1033     TP_printk("[Sta %d] A-MSDU len = %d", __entry->sta_idx, __entry->amsdu_len)
1034 );
1035 #endif
1036
1037 #endif /* CONFIG_ECRNX_FULLMAC */
1038
1039 #ifdef CONFIG_ECRNX_MUMIMO_TX
1040 TRACE_EVENT(
1041     mu_group_update,
1042     TP_PROTO(struct ecrnx_mu_group *group),
1043     TP_ARGS(group),
1044     TP_STRUCT__entry(
1045         __field(u8, nb_user)
1046         __field(u8, group_id)
1047         __array(u8, users, CONFIG_USER_MAX)
1048                      ),
1049     TP_fast_assign(
1050         int i;
1051         __entry->nb_user = group->user_cnt;
1052         for (i = 0; i < CONFIG_USER_MAX ; i++) {
1053             if (group->users[i]) {
1054                 __entry->users[i] = group->users[i]->sta_idx;
1055             } else {
1056                 __entry->users[i] = 0xff;
1057             }
1058         }
1059
1060         __entry->group_id = group->group_id;
1061                    ),
1062
1063     TP_printk("Group-id = %d, Users = %s",
1064               __entry->group_id,
1065               __print_mu_group(__entry->nb_user, __entry->users))
1066 );
1067
1068 TRACE_EVENT(
1069     mu_group_delete,
1070     TP_PROTO(int group_id),
1071     TP_ARGS(group_id),
1072     TP_STRUCT__entry(
1073         __field(u8, group_id)
1074                      ),
1075     TP_fast_assign(
1076         __entry->group_id = group_id;
1077                    ),
1078
1079     TP_printk("Group-id = %d", __entry->group_id)
1080 );
1081
1082 TRACE_EVENT(
1083     mu_group_selection,
1084     TP_PROTO(struct ecrnx_sta *sta, int group_id),
1085     TP_ARGS(sta, group_id),
1086     TP_STRUCT__entry(
1087         __field(u8, sta_idx)
1088         __field(u8, group_id)
1089                      ),
1090     TP_fast_assign(
1091         __entry->sta_idx = sta->sta_idx;
1092         __entry->group_id = group_id;
1093                    ),
1094
1095     TP_printk("[Sta %d] Group-id = %d", __entry->sta_idx, __entry->group_id)
1096 );
1097
1098 TRACE_EVENT(
1099     txq_select_mu_group,
1100     TP_PROTO(struct ecrnx_txq *txq, int group_id, int pos),
1101
1102     TP_ARGS(txq, group_id, pos),
1103
1104     TP_STRUCT__entry(
1105         __field(u16, txq_idx)
1106         __field(u8, group_id)
1107         __field(u8, pos)
1108                      ),
1109     TP_fast_assign(
1110         __entry->txq_idx = txq->idx;
1111         __entry->group_id = group_id;
1112         __entry->pos = pos;
1113                    ),
1114
1115     TP_printk("%s: group=%d pos=%d", __print_txq(__entry->txq_idx),
1116               __entry->group_id, __entry->pos)
1117 );
1118
1119 #endif /* CONFIG_ECRNX_MUMIMO_TX */
1120 #endif /* ! CONFIG_ECRNX_FHOST */
1121
1122 /*****************************************************************************
1123  * TRACE functions for MESH
1124  ****************************************************************************/
1125 #ifdef CONFIG_ECRNX_FULLMAC
1126 DECLARE_EVENT_CLASS(
1127     mesh_path_template,
1128     TP_PROTO(struct ecrnx_mesh_path *mesh_path),
1129     TP_ARGS(mesh_path),
1130     TP_STRUCT__entry(
1131         __field(u8, idx)
1132         __field(u8, next_hop_sta)
1133         __array(u8, tgt_mac, ETH_ALEN)
1134                      ),
1135
1136     TP_fast_assign(
1137         __entry->idx = mesh_path->path_idx;
1138         memcpy(__entry->tgt_mac, &mesh_path->tgt_mac_addr, ETH_ALEN);
1139         if (mesh_path->nhop_sta)
1140             __entry->next_hop_sta = mesh_path->nhop_sta->sta_idx;
1141         else
1142             __entry->next_hop_sta = 0xff;
1143                    ),
1144
1145     TP_printk("Mpath(%d): target=%pM next_hop=STA-%d",
1146               __entry->idx, __entry->tgt_mac, __entry->next_hop_sta)
1147 );
1148
1149 DEFINE_EVENT(mesh_path_template, mesh_create_path,
1150              TP_PROTO(struct ecrnx_mesh_path *mesh_path),
1151              TP_ARGS(mesh_path));
1152
1153 DEFINE_EVENT(mesh_path_template, mesh_delete_path,
1154              TP_PROTO(struct ecrnx_mesh_path *mesh_path),
1155              TP_ARGS(mesh_path));
1156
1157 DEFINE_EVENT(mesh_path_template, mesh_update_path,
1158              TP_PROTO(struct ecrnx_mesh_path *mesh_path),
1159              TP_ARGS(mesh_path));
1160
1161 #endif /* CONFIG_ECRNX_FULLMAC */
1162
1163 /*****************************************************************************
1164  * TRACE functions for RADAR
1165  ****************************************************************************/
1166 #ifdef CONFIG_ECRNX_RADAR
1167 TRACE_EVENT(
1168     radar_pulse,
1169     TP_PROTO(u8 chain, struct radar_pulse *pulse),
1170     TP_ARGS(chain, pulse),
1171     TP_STRUCT__entry(
1172         __field(u8, chain)
1173         __field(s16, freq)
1174         __field(u16, pri)
1175         __field(u8, len)
1176         __field(u8, fom)
1177                      ),
1178     TP_fast_assign(
1179         __entry->freq = pulse->freq * 2;
1180         __entry->len = pulse->len * 2;
1181         __entry->fom = pulse->fom * 6;
1182         __entry->pri = pulse->rep;
1183         __entry->chain = chain;
1184                    ),
1185
1186     TP_printk("%s: PRI=%.5d LEN=%.3d FOM=%.2d%% freq=%dMHz ",
1187               __print_symbolic(__entry->chain,
1188                                {ECRNX_RADAR_RIU, "RIU"},
1189                                {ECRNX_RADAR_FCU, "FCU"}),
1190               __entry->pri, __entry->len, __entry->fom, __entry->freq)
1191             );
1192
1193 TRACE_EVENT(
1194     radar_detected,
1195     TP_PROTO(u8 chain, u8 region, s16 freq, u8 type, u16 pri),
1196     TP_ARGS(chain, region, freq, type, pri),
1197     TP_STRUCT__entry(
1198         __field(u8, chain)
1199         __field(u8, region)
1200         __field(s16, freq)
1201         __field(u8, type)
1202         __field(u16, pri)
1203                      ),
1204     TP_fast_assign(
1205         __entry->chain = chain;
1206         __entry->region = region;
1207         __entry->freq = freq;
1208         __entry->type = type;
1209         __entry->pri = pri;
1210                    ),
1211     TP_printk("%s: region=%s type=%d freq=%dMHz (pri=%dus)",
1212               __print_symbolic(__entry->chain,
1213                                {ECRNX_RADAR_RIU, "RIU"},
1214                                {ECRNX_RADAR_FCU, "FCU"}),
1215               __print_symbolic(__entry->region,
1216                                {NL80211_DFS_UNSET, "UNSET"},
1217                                {NL80211_DFS_FCC, "FCC"},
1218                                {NL80211_DFS_ETSI, "ETSI"},
1219                                {NL80211_DFS_JP, "JP"}),
1220               __entry->type, __entry->freq, __entry->pri)
1221 );
1222
1223 TRACE_EVENT(
1224     radar_set_region,
1225     TP_PROTO(u8 region),
1226     TP_ARGS(region),
1227     TP_STRUCT__entry(
1228         __field(u8, region)
1229                      ),
1230     TP_fast_assign(
1231         __entry->region = region;
1232                    ),
1233     TP_printk("region=%s",
1234               __print_symbolic(__entry->region,
1235                                {NL80211_DFS_UNSET, "UNSET"},
1236                                {NL80211_DFS_FCC, "FCC"},
1237                                {NL80211_DFS_ETSI, "ETSI"},
1238                                {NL80211_DFS_JP, "JP"}))
1239 );
1240
1241 TRACE_EVENT(
1242     radar_enable_detection,
1243     TP_PROTO(u8 region, u8 enable, u8 chain),
1244     TP_ARGS(region, enable, chain),
1245     TP_STRUCT__entry(
1246         __field(u8, region)
1247         __field(u8, chain)
1248         __field(u8, enable)
1249                      ),
1250     TP_fast_assign(
1251         __entry->chain = chain;
1252         __entry->enable = enable;
1253         __entry->region = region;
1254                    ),
1255     TP_printk("%s: %s radar detection %s",
1256                __print_symbolic(__entry->chain,
1257                                {ECRNX_RADAR_RIU, "RIU"},
1258                                {ECRNX_RADAR_FCU, "FCU"}),
1259               __print_symbolic(__entry->enable,
1260                                {ECRNX_RADAR_DETECT_DISABLE, "Disable"},
1261                                {ECRNX_RADAR_DETECT_ENABLE, "Enable (no report)"},
1262                                {ECRNX_RADAR_DETECT_REPORT, "Enable"}),
1263               __entry->enable == ECRNX_RADAR_DETECT_DISABLE ? "" :
1264               __print_symbolic(__entry->region,
1265                                {NL80211_DFS_UNSET, "UNSET"},
1266                                {NL80211_DFS_FCC, "FCC"},
1267                                {NL80211_DFS_ETSI, "ETSI"},
1268                                {NL80211_DFS_JP, "JP"}))
1269 );
1270 #endif /* CONFIG_ECRNX_RADAR */
1271
1272 /*****************************************************************************
1273  * TRACE functions for IPC message
1274  ****************************************************************************/
1275 #include "ecrnx_strs.h"
1276
1277 DECLARE_EVENT_CLASS(
1278     ipc_msg_template,
1279     TP_PROTO(u16 id),
1280     TP_ARGS(id),
1281     TP_STRUCT__entry(
1282         __field(u16, id)
1283                      ),
1284     TP_fast_assign(
1285         __entry->id  = id;
1286                    ),
1287
1288     TP_printk("%s (%d - %d)", ECRNX_ID2STR(__entry->id),
1289               MSG_T(__entry->id), MSG_I(__entry->id))
1290 );
1291
1292 DEFINE_EVENT(ipc_msg_template, msg_send,
1293              TP_PROTO(u16 id),
1294              TP_ARGS(id));
1295
1296 DEFINE_EVENT(ipc_msg_template, msg_recv,
1297              TP_PROTO(u16 id),
1298              TP_ARGS(id));
1299
1300
1301
1302 #endif /* !defined(_ECRNX_EVENTS_H) || defined(TRACE_HEADER_MULTI_READ) */
1303
1304 #undef TRACE_INCLUDE_PATH
1305 #undef TRACE_INCLUDE_FILE
1306 #define TRACE_INCLUDE_PATH .
1307 #define TRACE_INCLUDE_FILE ecrnx_events
1308 #include <trace/define_trace.h>