xref: /wlan-driver/qca-wifi-host-cmn/utils/pktlog/include/pktlog_ac_i.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2012-2020 The Linux Foundation. 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 #ifndef _PKTLOG_AC_I_
20 #define _PKTLOG_AC_I_
21 
22 #ifndef REMOVE_PKT_LOG
23 
24 #include <ol_txrx_internal.h>
25 #include <pktlog_ac.h>
26 
27 
28 #define PKTLOG_TAG                      "ATH_PKTLOG"
29 #define PKTLOG_DEFAULT_BUFSIZE          (10 * 1024 * 1024) /* 10MB */
30 #define PKTLOG_DEFAULT_SACK_THR         3
31 #define PKTLOG_DEFAULT_TAIL_LENGTH      100
32 #define PKTLOG_DEFAULT_THRUPUT_THRESH   (64 * 1024)
33 #define PKTLOG_DEFAULT_PER_THRESH       30
34 #define PKTLOG_DEFAULT_PHYERR_THRESH    300
35 #define PKTLOG_DEFAULT_TRIGGER_INTERVAL 500
36 
37 /* Max Pktlog buffer size received from fw/hw */
38 #define MAX_PKTLOG_RECV_BUF_SIZE        2048
39 
40 struct ath_pktlog_arg {
41 	struct ath_pktlog_info *pl_info;
42 	uint32_t flags;
43 	uint16_t missed_cnt;
44 #ifdef HELIUMPLUS
45 	uint8_t log_type;
46 	uint8_t macId;
47 #else
48 	uint16_t log_type;
49 #endif
50 	size_t log_size;
51 	uint16_t timestamp;
52 #ifdef PKTLOG_HAS_SPECIFIC_DATA
53 	uint32_t type_specific_data;
54 #endif
55 	char *buf;
56 };
57 
58 void pktlog_getbuf_intsafe(struct ath_pktlog_arg *plarg);
59 char *pktlog_getbuf(struct pktlog_dev_t *pl_dev,
60 		    struct ath_pktlog_info *pl_info,
61 		    size_t log_size, struct ath_pktlog_hdr *pl_hdr);
62 
63 #ifdef PKTLOG_HAS_SPECIFIC_DATA
64 /**
65  * pktlog_hdr_set_specific_data() - set type specific data
66  * @log_hdr: pktlog header
67  * @type_specific_data: type specific data
68  *
69  * Return: None
70  */
71 void
72 pktlog_hdr_set_specific_data(struct ath_pktlog_hdr *log_hdr,
73 			     uint32_t type_specific_data);
74 
75 /**
76  * pktlog_hdr_get_specific_data() - get type specific data
77  * @log_hdr: pktlog header
78  * @type_specific_data: type specific data
79  *
80  * Return: pktlog subtype
81  */
82 uint32_t
83 pktlog_hdr_get_specific_data(struct ath_pktlog_hdr *log_hdr);
84 
85 /**
86  * pktlog_arg_set_specific_data() - set type specific data
87  * @log_hdr: pktlog arg
88  * @type_specific_data: type specific data
89  *
90  * Return: None
91  */
92 void
93 pktlog_arg_set_specific_data(struct ath_pktlog_arg *plarg,
94 			     uint32_t type_specific_data);
95 
96 /**
97  * pktlog_arg_get_specific_data() - set type specific data
98  * @log_hdr: pktlog arg
99  * @type_specific_data: type specific data
100  *
101  * Return: pktlog subtype
102  */
103 uint32_t
104 pktlog_arg_get_specific_data(struct ath_pktlog_arg *plarg);
105 #else
106 static inline void
pktlog_hdr_set_specific_data(struct ath_pktlog_hdr * log_hdr,uint32_t type_specific_data)107 pktlog_hdr_set_specific_data(struct ath_pktlog_hdr *log_hdr,
108 			     uint32_t type_specific_data)
109 {
110 }
111 
112 static inline uint32_t
pktlog_hdr_get_specific_data(struct ath_pktlog_hdr * log_hdr)113 pktlog_hdr_get_specific_data(struct ath_pktlog_hdr *log_hdr)
114 {
115 	return 0;
116 }
117 
118 static inline void
pktlog_arg_set_specific_data(struct ath_pktlog_arg * plarg,uint32_t type_specific_data)119 pktlog_arg_set_specific_data(struct ath_pktlog_arg *plarg,
120 			     uint32_t type_specific_data)
121 {
122 }
123 
124 static inline uint32_t
pktlog_arg_get_specific_data(struct ath_pktlog_arg * plarg)125 pktlog_arg_get_specific_data(struct ath_pktlog_arg *plarg)
126 {
127 	return 0;
128 }
129 #endif /* PKTLOG_HAS_SPECIFIC_DATA */
130 #endif /* REMOVE_PKT_LOG */
131 #endif
132