1  /*
2   * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
3   *
4   * Permission to use, copy, modify, and/or distribute this software for
5   * any purpose with or without fee is hereby granted, provided that the
6   * above copyright notice and this permission notice appear in all
7   * copies.
8   *
9   * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10   * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11   * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12   * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13   * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14   * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15   * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16   * PERFORMANCE OF THIS SOFTWARE.
17   */
18  
19  /**
20   * DOC: i_qdf_tracepoint.h
21   * This file provides internal interface for triggering tracepoints
22   */
23  #if  !defined(_I_QDF_TRACEPOINT_H)
24  #define _I_QDF_TRACEPOINT_H
25  
26  #include <qdf_tracepoint_defs.h>
27  
28  /**
29   * __qdf_trace_dp_rx_tcp_pkt_enabled() - Get the dp_rx_tcp_pkt tracepoint
30   *  enabled or disabled state
31   *
32   * Return: True if the tracepoint is enabled else false
33   */
34  static inline
__qdf_trace_dp_rx_tcp_pkt_enabled(void)35  bool __qdf_trace_dp_rx_tcp_pkt_enabled(void)
36  {
37  	return trace_dp_rx_tcp_pkt_enabled();
38  }
39  
40  /**
41   * __qdf_trace_dp_rx_tcp_pkt() - Trace tcp packet in rx direction
42   * @skb: pointer to network buffer
43   * @tcp_seq_num: TCP sequence number
44   * @tcp_ack_num: TCP acknowlegment number
45   * @srcport: TCP source port
46   * @dstport: TCP destination port
47   * @latency: latency
48   *
49   * Return: None
50   */
51  static inline
__qdf_trace_dp_rx_tcp_pkt(struct sk_buff * skb,uint32_t tcp_seq_num,uint32_t tcp_ack_num,uint16_t srcport,uint16_t dstport,uint64_t latency)52  void __qdf_trace_dp_rx_tcp_pkt(struct sk_buff *skb, uint32_t tcp_seq_num,
53  			       uint32_t tcp_ack_num, uint16_t srcport,
54  			       uint16_t dstport, uint64_t latency)
55  {
56  	trace_dp_rx_tcp_pkt(skb, tcp_seq_num, tcp_ack_num, srcport, dstport,
57  			    latency);
58  }
59  
60  /**
61   * __qdf_trace_dp_tx_comp_tcp_pkt_enabled() - Get the dp_tx_comp_tcp_pkt
62   *  tracepoint enabled or disabled state
63   *
64   * Return: True if the tracepoint is enabled else false
65   */
66  static inline
__qdf_trace_dp_tx_comp_tcp_pkt_enabled(void)67  bool __qdf_trace_dp_tx_comp_tcp_pkt_enabled(void)
68  {
69  	return trace_dp_tx_comp_tcp_pkt_enabled();
70  }
71  
72  /**
73   * __qdf_trace_dp_tx_comp_tcp_pkt() - Trace tcp packet in tx completion
74   * @skb: pointer to network buffer
75   * @tcp_seq_num: TCP sequence number
76   * @tcp_ack_num: TCP acknowlegment number
77   * @srcport: TCP source port
78   * @dstport: TCP destination port
79   * @latency: latency
80   *
81   * Return: None
82   */
83  static inline
__qdf_trace_dp_tx_comp_tcp_pkt(struct sk_buff * skb,uint32_t tcp_seq_num,uint32_t tcp_ack_num,uint16_t srcport,uint16_t dstport,uint64_t latency)84  void __qdf_trace_dp_tx_comp_tcp_pkt(struct sk_buff *skb, uint32_t tcp_seq_num,
85  				    uint32_t tcp_ack_num, uint16_t srcport,
86  				    uint16_t dstport, uint64_t latency)
87  {
88  	trace_dp_tx_comp_tcp_pkt(skb, tcp_seq_num, tcp_ack_num, srcport,
89  				 dstport, latency);
90  }
91  
92  /**
93   * __qdf_trace_dp_rx_udp_pkt_enabled() - Get the dp_rx_udp_pkt tracepoint
94   *  enabled or disabled state
95   *
96   * Return: True if the tracepoint is enabled else false
97   */
98  static inline
__qdf_trace_dp_rx_udp_pkt_enabled(void)99  bool __qdf_trace_dp_rx_udp_pkt_enabled(void)
100  {
101  	return trace_dp_rx_udp_pkt_enabled();
102  }
103  
104  /**
105   * __qdf_trace_dp_rx_udp_pkt() - Trace udp packet in rx direction
106   * @skb: pointer to network buffer
107   * @ip_id: ip identification field
108   * @srcport: UDP source port
109   * @dstport: UDP destination port
110   * @latency: latency
111   *
112   * Return: None
113   */
114  static inline
__qdf_trace_dp_rx_udp_pkt(struct sk_buff * skb,uint16_t ip_id,uint16_t srcport,uint16_t dstport,uint64_t latency)115  void __qdf_trace_dp_rx_udp_pkt(struct sk_buff *skb, uint16_t ip_id,
116  			       uint16_t srcport, uint16_t dstport,
117  			       uint64_t latency)
118  {
119  	trace_dp_rx_udp_pkt(skb, ip_id, srcport, dstport, latency);
120  }
121  
122  /**
123   * __qdf_trace_dp_tx_comp_udp_pkt_enabled() - Get the dp_tx_comp_udp_pkt
124   *  tracepoint enabled or disabled state
125   *
126   * Return: True if the tracepoint is enabled else false
127   */
128  static inline
__qdf_trace_dp_tx_comp_udp_pkt_enabled(void)129  bool __qdf_trace_dp_tx_comp_udp_pkt_enabled(void)
130  {
131  	return trace_dp_tx_comp_udp_pkt_enabled();
132  }
133  
134  /**
135   * __qdf_trace_dp_tx_comp_udp_pkt() - Trace udp packet in tx completion
136   * @skb: pointer to network buffer
137   * @ip_id: ip identification field
138   * @srcport: UDP source port
139   * @dstport: UDP destination port
140   * @latency: latency
141   *
142   * Return: None
143   */
144  static inline
__qdf_trace_dp_tx_comp_udp_pkt(struct sk_buff * skb,uint16_t ip_id,uint16_t srcport,uint16_t dstport,uint64_t latency)145  void __qdf_trace_dp_tx_comp_udp_pkt(struct sk_buff *skb, uint16_t ip_id,
146  				    uint16_t srcport, uint16_t dstport,
147  				    uint64_t latency)
148  {
149  	trace_dp_tx_comp_udp_pkt(skb, ip_id, srcport, dstport, latency);
150  }
151  
152  /**
153   * __qdf_trace_dp_rx_generic_ip_pkt_enabled() - Get the dp_rx_generic_ip_pkt
154   *					tracepoint enabled or disabled state
155   *
156   * Return: True if the tracepoint is enabled else false
157   */
158  static inline
__qdf_trace_dp_rx_generic_ip_pkt_enabled(void)159  bool __qdf_trace_dp_rx_generic_ip_pkt_enabled(void)
160  {
161  	return trace_dp_rx_generic_ip_pkt_enabled();
162  }
163  
164  /**
165   * __qdf_trace_dp_rx_generic_ip_pkt() - Trace generic ip packet in rx direction
166   * @skb: pointer to network buffer
167   * @ip_proto: ip protocol type
168   * @ip_id: ip identification field
169   * @trans_hdr_4_bytes: transport header first 4 bytes
170   * @latency: latency
171   *
172   * Return: None
173   */
174  static inline
__qdf_trace_dp_rx_generic_ip_pkt(struct sk_buff * skb,uint8_t ip_proto,uint16_t ip_id,uint32_t trans_hdr_4_bytes,uint64_t latency)175  void __qdf_trace_dp_rx_generic_ip_pkt(struct sk_buff *skb, uint8_t ip_proto,
176  				      uint16_t ip_id, uint32_t trans_hdr_4_bytes,
177  				      uint64_t latency)
178  {
179  	trace_dp_rx_generic_ip_pkt(skb, ip_proto, ip_id,
180  				   trans_hdr_4_bytes,
181  				   latency);
182  }
183  
184  /**
185   * __qdf_trace_dp_tx_comp_generic_ip_pkt_enabled() - Get the dp_tx_comp_generic_ip_pkt
186   *						tracepoint enabled or disabled state
187   *
188   * Return: True if the tracepoint is enabled else false
189   */
190  static inline
__qdf_trace_dp_tx_comp_generic_ip_pkt_enabled(void)191  bool __qdf_trace_dp_tx_comp_generic_ip_pkt_enabled(void)
192  {
193  	return trace_dp_tx_comp_generic_ip_pkt_enabled();
194  }
195  
196  /**
197   * __qdf_trace_dp_tx_comp_generic_ip_pkt() - Trace generic ip packet in
198   *					     tx direction
199   * @skb: pointer to network buffer
200   * @ip_proto: IP protocol field
201   * @ip_id: ip identification field
202   * @trans_hdr_4_bytes: transport header first 4 bytes
203   * @latency: latency
204   *
205   * Return: None
206   */
207  static inline
__qdf_trace_dp_tx_comp_generic_ip_pkt(struct sk_buff * skb,uint8_t ip_proto,uint16_t ip_id,uint32_t trans_hdr_4_bytes,uint64_t latency)208  void __qdf_trace_dp_tx_comp_generic_ip_pkt(struct sk_buff *skb,
209  					   uint8_t ip_proto,
210  					   uint16_t ip_id,
211  					   uint32_t trans_hdr_4_bytes,
212  					   uint64_t latency)
213  {
214  	trace_dp_tx_comp_generic_ip_pkt(skb, ip_proto, ip_id,
215  					trans_hdr_4_bytes,
216  					latency);
217  }
218  
219  /**
220   * __qdf_trace_dp_rx_pkt_enabled() - Get the dp_rx_pkt tracepoint
221   *  enabled or disabled state
222   *
223   * Return: True if the tracepoint is enabled else false
224   */
225  static inline
__qdf_trace_dp_rx_pkt_enabled(void)226  bool __qdf_trace_dp_rx_pkt_enabled(void)
227  {
228  	return trace_dp_rx_pkt_enabled();
229  }
230  
231  /**
232   * __qdf_trace_dp_rx_pkt() - Trace non-tcp/udp packet in rx direction
233   * @skb: pointer to network buffer
234   * @ether_type: type in ethernet header
235   * @latency: latency
236   *
237   * Return: None
238   */
239  static inline
__qdf_trace_dp_rx_pkt(struct sk_buff * skb,uint16_t ether_type,uint64_t latency)240  void __qdf_trace_dp_rx_pkt(struct sk_buff *skb, uint16_t ether_type,
241  			   uint64_t latency)
242  {
243  	trace_dp_rx_pkt(skb, ether_type, latency);
244  }
245  
246  /**
247   * __qdf_trace_dp_tx_comp_pkt_enabled() - Get the dp_tx_comp_pkt tracepoint
248   *  enabled or disabled state
249   *
250   * Return: True if the tracepoint is enabled else false
251   */
252  static inline
__qdf_trace_dp_tx_comp_pkt_enabled(void)253  bool __qdf_trace_dp_tx_comp_pkt_enabled(void)
254  {
255  	return trace_dp_tx_comp_pkt_enabled();
256  }
257  
258  /**
259   * __qdf_trace_dp_tx_comp_pkt() - Trace non-tcp/udp packet in rx direction
260   * @skb: pointer to network buffer
261   * @ether_type: type in ethernet header
262   * @latency: latency
263   *
264   * Return: None
265   */
266  static inline
__qdf_trace_dp_tx_comp_pkt(struct sk_buff * skb,uint16_t ether_type,uint64_t latency)267  void __qdf_trace_dp_tx_comp_pkt(struct sk_buff *skb, uint16_t ether_type,
268  				uint64_t latency)
269  {
270  	trace_dp_tx_comp_pkt(skb, ether_type, latency);
271  }
272  
273  /**
274   * __qdf_trace_dp_del_reg_write_enabled() - Get the dp_del_reg_write tracepoint
275   *  enabled or disabled state
276   *
277   * Return: True if the tracepoint is enabled else false
278   */
279  static inline
__qdf_trace_dp_del_reg_write_enabled(void)280  bool __qdf_trace_dp_del_reg_write_enabled(void)
281  {
282  	return trace_dp_del_reg_write_enabled();
283  }
284  
285  /**
286   * __qdf_trace_dp_del_reg_write() - Trace delayed register writes
287   * @srng_id: srng id
288   * @enq_val: enqueue value
289   * @deq_val: dequeue value
290   * @enq_time: enqueue time
291   * @deq_time: dequeue time
292   *
293   * Return: None
294   */
295  static inline
__qdf_trace_dp_del_reg_write(uint8_t srng_id,uint32_t enq_val,uint32_t deq_val,uint64_t enq_time,uint64_t deq_time)296  void __qdf_trace_dp_del_reg_write(uint8_t srng_id, uint32_t enq_val,
297  				  uint32_t deq_val, uint64_t enq_time,
298  				  uint64_t deq_time)
299  {
300  	trace_dp_del_reg_write(srng_id, enq_val, deq_val, enq_time,
301  			       deq_time);
302  }
303  
304  /**
305   * __qdf_trace_dp_ce_tasklet_sched_latency_enabled() - Get the
306   *  dp_ce_tasklet_sched_lat tracepoint enabled or disabled state
307   *
308   * Return: True if the tracepoint is enabled else false
309   */
310  static inline
__qdf_trace_dp_ce_tasklet_sched_latency_enabled(void)311  bool __qdf_trace_dp_ce_tasklet_sched_latency_enabled(void)
312  {
313  	return trace_dp_ce_tasklet_sched_latency_enabled();
314  }
315  
316  /**
317   * __qdf_trace_dp_ce_tasklet_sched_latency() - Trace ce tasklet scheduling
318   *  latency
319   * @ce_id: ce id
320   * @sched_latency: ce tasklet sched latency
321   *
322   * Return: None
323   */
324  static inline void
__qdf_trace_dp_ce_tasklet_sched_latency(uint8_t ce_id,uint64_t sched_latency)325  __qdf_trace_dp_ce_tasklet_sched_latency(uint8_t ce_id, uint64_t sched_latency)
326  {
327  	trace_dp_ce_tasklet_sched_latency(ce_id, sched_latency);
328  }
329  #endif /* _I_QDF_TRACEPOINT_H */
330