1 /****************************************************************************
3 * Copyright (c) 2014 - 2018 Samsung Electronics Co., Ltd. All rights reserved
5 ****************************************************************************/
7 #include <linux/proc_fs.h>
8 #include <linux/version.h>
9 #include <linux/seq_file.h>
14 /* TCP send buffer sizes */
15 extern int sysctl_tcp_wmem
[3];
17 #ifndef __HIP4_SAMPLER_H__
18 #define __HIP4_SAMPLER_H__
20 #define HIP4_SAMPLER_SIGNAL_CTRLTX 0x20
21 #define HIP4_SAMPLER_SIGNAL_CTRLRX 0x21
22 #define HIP4_SAMPLER_THROUG 0x22
23 #define HIP4_SAMPLER_THROUG_K 0x23
24 #define HIP4_SAMPLER_THROUG_M 0x24
25 #define HIP4_SAMPLER_STOP_Q 0x25
26 #define HIP4_SAMPLER_START_Q 0x26
27 #define HIP4_SAMPLER_QREF 0x27
28 #define HIP4_SAMPLER_PEER 0x29
29 #define HIP4_SAMPLER_BOT_RX 0x2a
30 #define HIP4_SAMPLER_BOT_TX 0x2b
31 #define HIP4_SAMPLER_BOT_ADD 0x2c
32 #define HIP4_SAMPLER_BOT_REMOVE 0x2d
33 #define HIP4_SAMPLER_BOT_STOP_Q 0x2e
34 #define HIP4_SAMPLER_BOT_START_Q 0x2f
35 #define HIP4_SAMPLER_BOT_QMOD_RX 0x30
36 #define HIP4_SAMPLER_BOT_QMOD_TX 0x31
37 #define HIP4_SAMPLER_BOT_QMOD_STOP 0x32
38 #define HIP4_SAMPLER_BOT_QMOD_START 0x33
39 #define HIP4_SAMPLER_PKT_TX 0x40
40 #define HIP4_SAMPLER_PKT_TX_HIP4 0x41
41 #define HIP4_SAMPLER_PKT_TX_FB 0x42
42 #define HIP4_SAMPLER_SUSPEND 0x50
43 #define HIP4_SAMPLER_RESUME 0x51
45 #define HIP4_SAMPLER_TCP_SYN 0x60
46 #define HIP4_SAMPLER_TCP_FIN 0x61
47 #define HIP4_SAMPLER_TCP_DATA 0x62
48 #define HIP4_SAMPLER_TCP_ACK 0x63
49 #define HIP4_SAMPLER_TCP_RWND 0x64
50 #define HIP4_SAMPLER_TCP_CWND 0x65
51 #define HIP4_SAMPLER_TCP_SEND_BUF 0x66
52 #define HIP4_SAMPLER_TCP_DATA_IN 0x67
53 #define HIP4_SAMPLER_TCP_ACK_IN 0x68
55 #define HIP4_SAMPLER_MBULK 0xaa
56 #define HIP4_SAMPLER_QFULL 0xbb
57 #define HIP4_SAMPLER_MFULL 0xcc
58 #define HIP4_SAMPLER_INT 0xdd
59 #define HIP4_SAMPLER_INT_OUT 0xee
60 #define HIP4_SAMPLER_INT_BH 0xde
61 #define HIP4_SAMPLER_INT_OUT_BH 0xef
62 #define HIP4_SAMPLER_RESET 0xff
64 #define SCSC_HIP4_INTERFACES 1
66 #define SCSC_HIP4_STREAM_CH 1
67 #define SCSC_HIP4_OFFLINE_CH SCSC_HIP4_STREAM_CH
69 #if (SCSC_HIP4_OFFLINE_CH != SCSC_HIP4_STREAM_CH)
70 #error "SCSC_HIP4_STREAM_CH has to be equal to SCSC_HIP4_OFFLINE_CH"
73 #define SCSC_HIP4_DEBUG_INTERFACES ((SCSC_HIP4_INTERFACES) * (SCSC_HIP4_STREAM_CH + SCSC_HIP4_OFFLINE_CH))
77 void hip4_sampler_create(struct slsi_dev
*sdev
, struct scsc_mx
*mx
);
78 void hip4_sampler_destroy(struct slsi_dev
*sdev
, struct scsc_mx
*mx
);
80 /* Register hip4 instance with the logger */
81 /* return char device minor associated with the maxwell instance*/
82 int hip4_sampler_register_hip(struct scsc_mx
*mx
);
84 void hip4_sampler_update_record(u32 minor
, u8 param1
, u8 param2
, u8 param3
, u8 param4
, u32 param5
);
85 void hip4_sampler_tcp_decode(struct slsi_dev
*sdev
, struct net_device
*dev
, u8
*frame
, bool from_ba
);
87 extern bool hip4_sampler_sample_q
;
88 extern bool hip4_sampler_sample_qref
;
89 extern bool hip4_sampler_sample_int
;
90 extern bool hip4_sampler_sample_fapi
;
91 extern bool hip4_sampler_sample_through
;
92 extern bool hip4_sampler_sample_tcp
;
93 extern bool hip4_sampler_sample_start_stop_q
;
94 extern bool hip4_sampler_sample_mbulk
;
95 extern bool hip4_sampler_sample_qfull
;
96 extern bool hip4_sampler_sample_mfull
;
97 extern bool hip4_sampler_vif
;
98 extern bool hip4_sampler_bot
;
99 extern bool hip4_sampler_pkt_tx
;
100 extern bool hip4_sampler_suspend_resume
;
102 #ifdef CONFIG_SCSC_WLAN_HIP4_PROFILING
103 #define SCSC_HIP4_SAMPLER_Q(minor, q, idx_rw, value, rw) \
105 if (hip4_sampler_sample_q) { \
106 hip4_sampler_update_record(minor, q, idx_rw, value, rw, 0); \
109 #define SCSC_HIP4_SAMPLER_QREF(minor, ref, q) \
111 if (hip4_sampler_sample_qref) { \
112 hip4_sampler_update_record(minor, HIP4_SAMPLER_QREF, (ref & 0xff0000) >> 16, (ref & 0xff00) >> 8, (ref & 0xf0) | q, 0); \
115 #define SCSC_HIP4_SAMPLER_SIGNAL_CTRLTX(minor, bytes16_h, bytes16_l) \
117 if (hip4_sampler_sample_fapi) { \
118 hip4_sampler_update_record(minor, HIP4_SAMPLER_SIGNAL_CTRLTX, 0, bytes16_h, bytes16_l, 0); \
121 #define SCSC_HIP4_SAMPLER_SIGNAL_CTRLRX(minor, bytes16_h, bytes16_l) \
123 if (hip4_sampler_sample_fapi) { \
124 hip4_sampler_update_record(minor, HIP4_SAMPLER_SIGNAL_CTRLRX, 0, bytes16_h, bytes16_l, 0); \
128 #define SCSC_HIP4_SAMPLER_TCP_DECODE(sdev, dev, frame, from_ba) \
130 if (hip4_sampler_sample_tcp) { \
131 hip4_sampler_tcp_decode(sdev, dev, frame, from_ba); \
134 #define SCSC_HIP4_SAMPLER_THROUG(minor, rx_tx, bytes16_h, bytes16_l) \
136 if (hip4_sampler_sample_through) { \
137 hip4_sampler_update_record(minor, HIP4_SAMPLER_THROUG, rx_tx, bytes16_h, bytes16_l, 0); \
140 #define SCSC_HIP4_SAMPLER_THROUG_K(minor, rx_tx, bytes16_h, bytes16_l) \
142 if (hip4_sampler_sample_through) { \
143 hip4_sampler_update_record(minor, HIP4_SAMPLER_THROUG_K, rx_tx, bytes16_h, bytes16_l, 0); \
146 #define SCSC_HIP4_SAMPLER_THROUG_M(minor, rx_tx, bytes16_h, bytes16_l) \
148 if (hip4_sampler_sample_through) { \
149 hip4_sampler_update_record(minor, HIP4_SAMPLER_THROUG_M, rx_tx, bytes16_h, bytes16_l, 0); \
152 #define SCSC_HIP4_SAMPLER_STOP_Q(minor, vif_id) \
154 if (hip4_sampler_sample_start_stop_q) { \
155 hip4_sampler_update_record(minor, HIP4_SAMPLER_STOP_Q, 0, 0, vif_id, 0); \
158 #define SCSC_HIP4_SAMPLER_START_Q(minor, vif_id) \
160 if (hip4_sampler_sample_start_stop_q) { \
161 hip4_sampler_update_record(minor, HIP4_SAMPLER_START_Q, 0, 0, vif_id, 0); \
164 #define SCSC_HIP4_SAMPLER_MBULK(minor, bytes16_h, bytes16_l, clas) \
166 if (hip4_sampler_sample_mbulk) { \
167 hip4_sampler_update_record(minor, HIP4_SAMPLER_MBULK, clas, bytes16_h, bytes16_l, 0); \
170 #define SCSC_HIP4_SAMPLER_QFULL(minor, q) \
172 if (hip4_sampler_sample_qfull) { \
173 hip4_sampler_update_record(minor, HIP4_SAMPLER_QFULL, 0, 0, q, 0); \
176 #define SCSC_HIP4_SAMPLER_MFULL(minor) \
178 if (hip4_sampler_sample_mfull) { \
179 hip4_sampler_update_record(minor, HIP4_SAMPLER_MFULL, 0, 0, 0, 0); \
182 #define SCSC_HIP4_SAMPLER_INT(minor, id) \
184 if (hip4_sampler_sample_int) { \
185 hip4_sampler_update_record(minor, HIP4_SAMPLER_INT, 0, 0, id, 0); \
188 #define SCSC_HIP4_SAMPLER_INT_OUT(minor, id) \
190 if (hip4_sampler_sample_int) { \
191 hip4_sampler_update_record(minor, HIP4_SAMPLER_INT_OUT, 0, 0, id, 0); \
194 #define SCSC_HIP4_SAMPLER_INT_BH(minor, id) \
196 if (hip4_sampler_sample_int) { \
197 hip4_sampler_update_record(minor, HIP4_SAMPLER_INT_BH, 0, 0, id, 0); \
200 #define SCSC_HIP4_SAMPLER_INT_OUT_BH(minor, id) \
202 if (hip4_sampler_sample_int) { \
203 hip4_sampler_update_record(minor, HIP4_SAMPLER_INT_OUT_BH, 0, 0, id, 0); \
206 #define SCSC_HIP4_SAMPLER_RESET(minor) \
207 hip4_sampler_update_record(minor, HIP4_SAMPLER_RESET, 0, 0, 0, 0)
209 #define SCSC_HIP4_SAMPLER_VIF_PEER(minor, tx, vif, peer_index) \
211 if (hip4_sampler_vif) { \
212 hip4_sampler_update_record(minor, HIP4_SAMPLER_PEER, tx, vif, peer_index, 0); \
216 #define SCSC_HIP4_SAMPLER_BOT_RX(minor, scod, smod, vif_peer) \
218 if (hip4_sampler_bot) { \
219 hip4_sampler_update_record(minor, HIP4_SAMPLER_BOT_RX, scod, smod, vif_peer, 0); \
223 #define SCSC_HIP4_SAMPLER_BOT_TX(minor, scod, smod, vif_peer) \
225 if (hip4_sampler_bot) { \
226 hip4_sampler_update_record(minor, HIP4_SAMPLER_BOT_TX, scod, smod, vif_peer, 0); \
229 #define SCSC_HIP4_SAMPLER_BOT_ADD(minor, addr_1, addr_2, vif_peer) \
231 if (hip4_sampler_bot) { \
232 hip4_sampler_update_record(minor, HIP4_SAMPLER_BOT_ADD, addr_1, addr_2, vif_peer, 0); \
236 #define SCSC_HIP4_SAMPLER_BOT_REMOVE(minor, addr_1, addr_2, vif_peer) \
238 if (hip4_sampler_bot) { \
239 hip4_sampler_update_record(minor, HIP4_SAMPLER_BOT_REMOVE, addr_1, addr_2, vif_peer, 0); \
243 #define SCSC_HIP4_SAMPLER_BOT_START_Q(minor, vif_peer) \
245 if (hip4_sampler_bot) { \
246 hip4_sampler_update_record(minor, HIP4_SAMPLER_BOT_START_Q, 0, 0, vif_peer, 0); \
250 #define SCSC_HIP4_SAMPLER_BOT_STOP_Q(minor, vif_peer) \
252 if (hip4_sampler_bot) { \
253 hip4_sampler_update_record(minor, HIP4_SAMPLER_BOT_STOP_Q, 0, 0, vif_peer, 0); \
256 #define SCSC_HIP4_SAMPLER_BOT_QMOD_RX(minor, qcod, qmod, vif_peer) \
258 if (hip4_sampler_bot) { \
259 hip4_sampler_update_record(minor, HIP4_SAMPLER_BOT_QMOD_RX, qcod, qmod, vif_peer, 0); \
263 #define SCSC_HIP4_SAMPLER_BOT_QMOD_TX(minor, qcod, qmod, vif_peer) \
265 if (hip4_sampler_bot) { \
266 hip4_sampler_update_record(minor, HIP4_SAMPLER_BOT_QMOD_TX, qcod, qmod, vif_peer, 0); \
269 #define SCSC_HIP4_SAMPLER_BOT_QMOD_START(minor, vif_peer) \
271 if (hip4_sampler_sample_start_stop_q || hip4_sampler_bot) { \
272 hip4_sampler_update_record(minor, HIP4_SAMPLER_BOT_QMOD_START, 0, 0, vif_peer, 0); \
276 #define SCSC_HIP4_SAMPLER_BOT_QMOD_STOP(minor, vif_peer) \
278 if (hip4_sampler_sample_start_stop_q || hip4_sampler_bot) { \
279 hip4_sampler_update_record(minor, HIP4_SAMPLER_BOT_QMOD_STOP, 0, 0, vif_peer, 0); \
282 #define SCSC_HIP4_SAMPLER_PKT_TX(minor, host_tag) \
284 if (hip4_sampler_pkt_tx) { \
285 hip4_sampler_update_record(minor, HIP4_SAMPLER_PKT_TX, 0, (host_tag >> 8) & 0xff, host_tag & 0xff, 0); \
288 #define SCSC_HIP4_SAMPLER_PKT_TX_HIP4(minor, host_tag) \
290 if (hip4_sampler_pkt_tx) { \
291 hip4_sampler_update_record(minor, HIP4_SAMPLER_PKT_TX_HIP4, 0, (host_tag >> 8) & 0xff, host_tag & 0xff, 0); \
294 #define SCSC_HIP4_SAMPLER_PKT_TX_FB(minor, host_tag) \
296 if (hip4_sampler_pkt_tx) { \
297 hip4_sampler_update_record(minor, HIP4_SAMPLER_PKT_TX_FB, 0, (host_tag >> 8) & 0xff, host_tag & 0xff, 0); \
300 #define SCSC_HIP4_SAMPLER_SUSPEND(minor) \
302 if (hip4_sampler_suspend_resume) { \
303 hip4_sampler_update_record(minor, HIP4_SAMPLER_SUSPEND, 0, 0, 0, 0); \
306 #define SCSC_HIP4_SAMPLER_RESUME(minor) \
308 if (hip4_sampler_suspend_resume) { \
309 hip4_sampler_update_record(minor, HIP4_SAMPLER_RESUME, 0, 0, 0, 0); \
312 #define SCSC_HIP4_SAMPLER_TCP_SYN(minor, id, mss) \
314 if (hip4_sampler_sample_tcp) { \
315 hip4_sampler_update_record(minor, HIP4_SAMPLER_TCP_SYN, id, 0, 0, mss); \
318 #define SCSC_HIP4_SAMPLER_TCP_FIN(minor, id) \
320 if (hip4_sampler_sample_tcp) { \
321 hip4_sampler_update_record(minor, HIP4_SAMPLER_TCP_FIN, id, 0, 0, 0); \
324 #define SCSC_HIP4_SAMPLER_TCP_DATA(minor, id, seq_num) \
326 if (hip4_sampler_sample_tcp) { \
327 hip4_sampler_update_record(minor, HIP4_SAMPLER_TCP_DATA, id, 0, 0, seq_num); \
330 #define SCSC_HIP4_SAMPLER_TCP_ACK(minor, id, ack_num) \
332 if (hip4_sampler_sample_tcp) { \
333 hip4_sampler_update_record(minor, HIP4_SAMPLER_TCP_ACK, id, 0, 0, ack_num); \
336 #define SCSC_HIP4_SAMPLER_TCP_DATA_IN(minor, id, seq_num) \
338 if (hip4_sampler_sample_tcp) { \
339 hip4_sampler_update_record(minor, HIP4_SAMPLER_TCP_DATA_IN, id, 0, 0, seq_num); \
342 #define SCSC_HIP4_SAMPLER_TCP_ACK_IN(minor, id, ack_num) \
344 if (hip4_sampler_sample_tcp) { \
345 hip4_sampler_update_record(minor, HIP4_SAMPLER_TCP_ACK_IN, id, 0, 0, ack_num); \
348 #define SCSC_HIP4_SAMPLER_TCP_RWND(minor, id, rwnd) \
350 if (hip4_sampler_sample_tcp) { \
351 hip4_sampler_update_record(minor, HIP4_SAMPLER_TCP_RWND, id, 0, 0, rwnd); \
354 #define SCSC_HIP4_SAMPLER_TCP_CWND(minor, id, cwnd) \
356 if (hip4_sampler_sample_tcp) { \
357 hip4_sampler_update_record(minor, HIP4_SAMPLER_TCP_CWND, id, 0, 0, cwnd); \
360 #define SCSC_HIP4_SAMPLER_TCP_SEND_BUF(minor, id, send_buff_size) \
362 if (hip4_sampler_sample_tcp) { \
363 hip4_sampler_update_record(minor, HIP4_SAMPLER_TCP_SEND_BUF, id, 0, 0, send_buff_size); \
367 #define SCSC_HIP4_SAMPLER_Q(minor, q, idx_rw, value, rw)
368 #define SCSC_HIP4_SAMPLER_QREF(minor, ref, q)
369 #define SCSC_HIP4_SAMPLER_SIGNAL_CTRLTX(minor, bytes16_h, bytes16_l)
370 #define SCSC_HIP4_SAMPLER_SIGNAL_CTRLRX(minor, bytes16_h, bytes16_l)
371 #define SCSC_HIP4_SAMPLER_TPUT(minor, rx_tx, payload)
372 #define SCSC_HIP4_SAMPLER_THROUG(minor, bytes16_h, bytes16_l)
373 #define SCSC_HIP4_SAMPLER_THROUG_K(minor, bytes16_h, bytes16_l)
374 #define SCSC_HIP4_SAMPLER_THROUG_M(minor, bytes16_h, bytes16_l)
375 #define SCSC_HIP4_SAMPLER_MBULK(minor, bytes16_h, bytes16_l, clas)
376 #define SCSC_HIP4_SAMPLER_QFULL(minor, q)
377 #define SCSC_HIP4_SAMPLER_MFULL(minor)
378 #define SCSC_HIP4_SAMPLER_INT(minor, id)
379 #define SCSC_HIP4_SAMPLER_INT_BH(minor, id)
380 #define SCSC_HIP4_SAMPLER_INT_OUT(minor, id)
381 #define SCSC_HIP4_SAMPLER_INT_OUT_BH(minor, id)
382 #define SCSC_HIP4_SAMPLER_RESET(minor)
383 #define SCSC_HIP4_SAMPLER_VIF_PEER(minor, tx, vif, peer_index)
384 #define SCSC_HIP4_SAMPLER_BOT_RX(minor, scod, smod, vif_peer)
385 #define SCSC_HIP4_SAMPLER_BOT_TX(minor, scod, smod, vif_peer)
386 #define SCSC_HIP4_SAMPLER_BOT(minor, init, addr_1, addr_2, vif_peer)
387 #define SCSC_HIP4_SAMPLER_BOT_ADD(minor, addr_1, addr_2, vif_peer)
388 #define SCSC_HIP4_SAMPLER_BOT_REMOVE(minor, addr_1, addr_2, vif_peer)
389 #define SCSC_HIP4_SAMPLER_BOT_START_Q(minor, vif_peer)
390 #define SCSC_HIP4_SAMPLER_BOT_STOP_Q(minor, vif_peer)
391 #define SCSC_HIP4_SAMPLER_BOT_QMOD_RX(minor, qcod, qmod, vif_peer)
392 #define SCSC_HIP4_SAMPLER_BOT_QMOD_TX(minor, qcod, qmod, vif_peer)
393 #define SCSC_HIP4_SAMPLER_BOT_QMOD_START(minor, vif_peer)
394 #define SCSC_HIP4_SAMPLER_BOT_QMOD_STOP(minor, vif_peer)
395 #define SCSC_HIP4_SAMPLER_PKT_TX(minor, host_tag)
396 #define SCSC_HIP4_SAMPLER_PKT_TX_HIP4(minor, host_tag)
397 #define SCSC_HIP4_SAMPLER_PKT_TX_FB(minor, host_tag)
398 #define SCSC_HIP4_SAMPLER_SUSPEND(minor)
399 #define SCSC_HIP4_SAMPLER_RESUME(minor)
400 #define SCSC_HIP4_SAMPLER_TCP_SYN(minor, id, mss)
401 #define SCSC_HIP4_SAMPLER_TCP_FIN(minor, id)
402 #define SCSC_HIP4_SAMPLER_TCP_DATA(minor, id, seq_num)
403 #define SCSC_HIP4_SAMPLER_TCP_ACK(minor, id, ack_num)
404 #define SCSC_HIP4_SAMPLER_TCP_DATA_IN(minor, id, seq_num)
405 #define SCSC_HIP4_SAMPLER_TCP_ACK_IN(minor, id, ack_num)
406 #define SCSC_HIP4_SAMPLER_TCP_RWND(minor, id, rwnd)
407 #define SCSC_HIP4_SAMPLER_TCP_CWND(minor, id, cwnd)
408 #define SCSC_HIP4_SAMPLER_TCP_SEND_BUF(minor, id, send_buff_size)
409 #define SCSC_HIP4_SAMPLER_TCP_DECODE(sdev, dev, frame, from_ba)
410 #endif /* CONFIG_SCSC_WLAN_HIP4_PROFILING */
412 #endif /* __HIP4_SAMPLER_H__ */