1*5113495bSYour Name /*
2*5113495bSYour Name * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved.
3*5113495bSYour Name * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name *
5*5113495bSYour Name * Permission to use, copy, modify, and/or distribute this software for
6*5113495bSYour Name * any purpose with or without fee is hereby granted, provided that the
7*5113495bSYour Name * above copyright notice and this permission notice appear in all
8*5113495bSYour Name * copies.
9*5113495bSYour Name *
10*5113495bSYour Name * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11*5113495bSYour Name * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12*5113495bSYour Name * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13*5113495bSYour Name * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14*5113495bSYour Name * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15*5113495bSYour Name * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16*5113495bSYour Name * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*5113495bSYour Name * PERFORMANCE OF THIS SOFTWARE.
18*5113495bSYour Name */
19*5113495bSYour Name
20*5113495bSYour Name #ifndef _OL_TXRX_INTERNAL__H_
21*5113495bSYour Name #define _OL_TXRX_INTERNAL__H_
22*5113495bSYour Name
23*5113495bSYour Name #include <qdf_util.h> /* qdf_assert */
24*5113495bSYour Name #include <qdf_nbuf.h> /* qdf_nbuf_t */
25*5113495bSYour Name #include <qdf_mem.h> /* qdf_mem_set */
26*5113495bSYour Name #include <cds_ieee80211_common.h> /* ieee80211_frame */
27*5113495bSYour Name #include <ol_htt_rx_api.h> /* htt_rx_msdu_desc_completes_mpdu, etc. */
28*5113495bSYour Name
29*5113495bSYour Name #include <ol_txrx_types.h>
30*5113495bSYour Name
31*5113495bSYour Name #include <ol_txrx_dbg.h>
32*5113495bSYour Name #include <enet.h> /* ETHERNET_HDR_LEN, etc. */
33*5113495bSYour Name #include <ipv4.h> /* IPV4_HDR_LEN, etc. */
34*5113495bSYour Name #include <ip_prot.h> /* IP_PROTOCOL_TCP, etc. */
35*5113495bSYour Name
36*5113495bSYour Name #ifdef ATH_11AC_TXCOMPACT
37*5113495bSYour Name #define OL_TX_DESC_NO_REFS(tx_desc) 1
38*5113495bSYour Name #define OL_TX_DESC_REF_INIT(tx_desc) /* no-op */
39*5113495bSYour Name #define OL_TX_DESC_REF_INC(tx_desc) /* no-op */
40*5113495bSYour Name #else
41*5113495bSYour Name #define OL_TX_DESC_NO_REFS(tx_desc) \
42*5113495bSYour Name qdf_atomic_dec_and_test(&tx_desc->ref_cnt)
43*5113495bSYour Name #define OL_TX_DESC_REF_INIT(tx_desc) qdf_atomic_init(&tx_desc->ref_cnt)
44*5113495bSYour Name #define OL_TX_DESC_REF_INC(tx_desc) qdf_atomic_inc(&tx_desc->ref_cnt)
45*5113495bSYour Name #endif
46*5113495bSYour Name
47*5113495bSYour Name #ifndef TXRX_ASSERT_LEVEL
48*5113495bSYour Name #define TXRX_ASSERT_LEVEL 3
49*5113495bSYour Name #endif
50*5113495bSYour Name
51*5113495bSYour Name #ifdef __KLOCWORK__
52*5113495bSYour Name #define TXRX_ASSERT1(x) do { if (!(x)) abort(); } while (0)
53*5113495bSYour Name #define TXRX_ASSERT2(x) do { if (!(x)) abort(); } while (0)
54*5113495bSYour Name #else /* #ifdef __KLOCWORK__ */
55*5113495bSYour Name
56*5113495bSYour Name #if TXRX_ASSERT_LEVEL > 0
57*5113495bSYour Name #define TXRX_ASSERT1(condition) qdf_assert((condition))
58*5113495bSYour Name #else
59*5113495bSYour Name #define TXRX_ASSERT1(condition)
60*5113495bSYour Name #endif
61*5113495bSYour Name
62*5113495bSYour Name #if TXRX_ASSERT_LEVEL > 1
63*5113495bSYour Name #define TXRX_ASSERT2(condition) qdf_assert((condition))
64*5113495bSYour Name #else
65*5113495bSYour Name #define TXRX_ASSERT2(condition)
66*5113495bSYour Name #endif
67*5113495bSYour Name #endif /* #ifdef __KLOCWORK__ */
68*5113495bSYour Name
69*5113495bSYour Name #ifdef TXRX_PRINT_ENABLE
70*5113495bSYour Name
71*5113495bSYour Name #include "qdf_types.h" /* qdf_vprint */
72*5113495bSYour Name
73*5113495bSYour Name #define ol_txrx_alert(params...) \
74*5113495bSYour Name QDF_TRACE_FATAL(QDF_MODULE_ID_TXRX, params)
75*5113495bSYour Name #define ol_txrx_err(params...) \
76*5113495bSYour Name QDF_TRACE_ERROR(QDF_MODULE_ID_TXRX, params)
77*5113495bSYour Name #define ol_txrx_warn(params...) \
78*5113495bSYour Name QDF_TRACE_WARN(QDF_MODULE_ID_TXRX, params)
79*5113495bSYour Name #define ol_txrx_info(params...) \
80*5113495bSYour Name QDF_TRACE_INFO(QDF_MODULE_ID_TXRX, params)
81*5113495bSYour Name #define ol_txrx_info_high(params...) \
82*5113495bSYour Name QDF_TRACE_INFO(QDF_MODULE_ID_TXRX, params)
83*5113495bSYour Name #define ol_txrx_dbg(params...) \
84*5113495bSYour Name QDF_TRACE_DEBUG(QDF_MODULE_ID_TXRX, params)
85*5113495bSYour Name
86*5113495bSYour Name #define txrx_nofl_alert(params...) \
87*5113495bSYour Name QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_TXRX, params)
88*5113495bSYour Name #define txrx_nofl_err(params...) \
89*5113495bSYour Name QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_TXRX, params)
90*5113495bSYour Name #define txrx_nofl_warn(params...) \
91*5113495bSYour Name QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_TXRX, params)
92*5113495bSYour Name #define txrx_nofl_info(params...) \
93*5113495bSYour Name QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_TXRX, params)
94*5113495bSYour Name #define txrx_nofl_dbg(params...) \
95*5113495bSYour Name QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_TXRX, params)
96*5113495bSYour Name
97*5113495bSYour Name #define ol_txrx_err_rl(params...) \
98*5113495bSYour Name QDF_TRACE_ERROR_RL(QDF_MODULE_ID_TXRX, params)
99*5113495bSYour Name
100*5113495bSYour Name /*
101*5113495bSYour Name * define PN check failure message print rate
102*5113495bSYour Name * as 1 second
103*5113495bSYour Name */
104*5113495bSYour Name #define TXRX_PN_CHECK_FAILURE_PRINT_PERIOD_MS 1000
105*5113495bSYour Name
106*5113495bSYour Name #else
107*5113495bSYour Name
108*5113495bSYour Name #define ol_txrx_alert(format, args...)
109*5113495bSYour Name #define ol_txrx_err(format, args...)
110*5113495bSYour Name #define ol_txrx_warn(format, args...)
111*5113495bSYour Name #define ol_txrx_info(format, args...)
112*5113495bSYour Name #define ol_txrx_info_high(format, args...)
113*5113495bSYour Name #define ol_txrx_dbg(format, args...)
114*5113495bSYour Name
115*5113495bSYour Name #define txrx_nofl_alert(params...)
116*5113495bSYour Name #define txrx_nofl_err(params...)
117*5113495bSYour Name #define txrx_nofl_warn(params...)
118*5113495bSYour Name #define txrx_nofl_info(params...)
119*5113495bSYour Name #define txrx_nofl_dbg(params...)
120*5113495bSYour Name
121*5113495bSYour Name #define ol_txrx_err_rl(params...)
122*5113495bSYour Name
123*5113495bSYour Name #endif /* TXRX_PRINT_ENABLE */
124*5113495bSYour Name
125*5113495bSYour Name /*--- tx credit debug printouts ---*/
126*5113495bSYour Name
127*5113495bSYour Name #ifndef DEBUG_CREDIT
128*5113495bSYour Name #define DEBUG_CREDIT 0
129*5113495bSYour Name #endif
130*5113495bSYour Name
131*5113495bSYour Name #if DEBUG_CREDIT
132*5113495bSYour Name #define TX_CREDIT_DEBUG_PRINT(fmt, ...) qdf_print(fmt, ## __VA_ARGS__)
133*5113495bSYour Name #else
134*5113495bSYour Name #define TX_CREDIT_DEBUG_PRINT(fmt, ...)
135*5113495bSYour Name #endif
136*5113495bSYour Name
137*5113495bSYour Name /*--- tx scheduler debug printouts ---*/
138*5113495bSYour Name
139*5113495bSYour Name #ifdef HOST_TX_SCHED_DEBUG
140*5113495bSYour Name #define TX_SCHED_DEBUG_PRINT(fmt, ...) qdf_print(fmt, ## __VA_ARGS__)
141*5113495bSYour Name #else
142*5113495bSYour Name #define TX_SCHED_DEBUG_PRINT(fmt, ...)
143*5113495bSYour Name #endif
144*5113495bSYour Name #define TX_SCHED_DEBUG_PRINT_ALWAYS(fmt, ...) qdf_print(fmt, ## __VA_ARGS__)
145*5113495bSYour Name
146*5113495bSYour Name #define OL_TXRX_LIST_APPEND(head, tail, elem) \
147*5113495bSYour Name do { \
148*5113495bSYour Name if (!(head)) { \
149*5113495bSYour Name (head) = (elem); \
150*5113495bSYour Name } else { \
151*5113495bSYour Name qdf_nbuf_set_next((tail), (elem)); \
152*5113495bSYour Name } \
153*5113495bSYour Name (tail) = (elem); \
154*5113495bSYour Name } while (0)
155*5113495bSYour Name
156*5113495bSYour Name static inline void
ol_rx_mpdu_list_next(struct ol_txrx_pdev_t * pdev,void * mpdu_list,qdf_nbuf_t * mpdu_tail,qdf_nbuf_t * next_mpdu)157*5113495bSYour Name ol_rx_mpdu_list_next(struct ol_txrx_pdev_t *pdev,
158*5113495bSYour Name void *mpdu_list,
159*5113495bSYour Name qdf_nbuf_t *mpdu_tail, qdf_nbuf_t *next_mpdu)
160*5113495bSYour Name {
161*5113495bSYour Name htt_pdev_handle htt_pdev = pdev->htt_pdev;
162*5113495bSYour Name qdf_nbuf_t msdu;
163*5113495bSYour Name
164*5113495bSYour Name /*
165*5113495bSYour Name * For now, we use a simply flat list of MSDUs.
166*5113495bSYour Name * So, traverse the list until we reach the last MSDU within the MPDU.
167*5113495bSYour Name */
168*5113495bSYour Name TXRX_ASSERT2(mpdu_list);
169*5113495bSYour Name msdu = mpdu_list;
170*5113495bSYour Name while (!htt_rx_msdu_desc_completes_mpdu
171*5113495bSYour Name (htt_pdev, htt_rx_msdu_desc_retrieve(htt_pdev, msdu))) {
172*5113495bSYour Name if (!qdf_nbuf_next(msdu)) {
173*5113495bSYour Name qdf_err("last-msdu bit not set!");
174*5113495bSYour Name break;
175*5113495bSYour Name } else {
176*5113495bSYour Name msdu = qdf_nbuf_next(msdu);
177*5113495bSYour Name }
178*5113495bSYour Name TXRX_ASSERT2(msdu);
179*5113495bSYour Name }
180*5113495bSYour Name /* msdu now points to the last MSDU within the first MPDU */
181*5113495bSYour Name *mpdu_tail = msdu;
182*5113495bSYour Name *next_mpdu = qdf_nbuf_next(msdu);
183*5113495bSYour Name }
184*5113495bSYour Name
185*5113495bSYour Name /*--- txrx stats macros ---*/
186*5113495bSYour Name
187*5113495bSYour Name /* unconditional defs */
188*5113495bSYour Name #define TXRX_STATS_INCR(pdev, field) TXRX_STATS_ADD(pdev, field, 1)
189*5113495bSYour Name
190*5113495bSYour Name /* default conditional defs (may be undefed below) */
191*5113495bSYour Name
192*5113495bSYour Name #define TXRX_STATS_INIT(_pdev) \
193*5113495bSYour Name qdf_mem_zero(&((_pdev)->stats), sizeof((_pdev)->stats))
194*5113495bSYour Name #define TXRX_STATS_ADD(_pdev, _field, _delta) { \
195*5113495bSYour Name _pdev->stats._field += _delta; }
196*5113495bSYour Name #define TXRX_STATS_MSDU_INCR(pdev, field, netbuf) \
197*5113495bSYour Name do { \
198*5113495bSYour Name TXRX_STATS_INCR((pdev), pub.field.pkts); \
199*5113495bSYour Name TXRX_STATS_ADD((pdev), pub.field.bytes, qdf_nbuf_len(netbuf)); \
200*5113495bSYour Name } while (0)
201*5113495bSYour Name
202*5113495bSYour Name /* conditional defs based on verbosity level */
203*5113495bSYour Name
204*5113495bSYour Name
205*5113495bSYour Name #define TXRX_STATS_MSDU_LIST_INCR(pdev, field, netbuf_list) \
206*5113495bSYour Name do { \
207*5113495bSYour Name qdf_nbuf_t tmp_list = netbuf_list; \
208*5113495bSYour Name while (tmp_list) { \
209*5113495bSYour Name TXRX_STATS_MSDU_INCR(pdev, field, tmp_list); \
210*5113495bSYour Name tmp_list = qdf_nbuf_next(tmp_list); \
211*5113495bSYour Name } \
212*5113495bSYour Name } while (0)
213*5113495bSYour Name
214*5113495bSYour Name #define TXRX_STATS_MSDU_INCR_TX_STATUS(status, pdev, netbuf) do { \
215*5113495bSYour Name if (status == htt_tx_status_ok) \
216*5113495bSYour Name TXRX_STATS_MSDU_INCR(pdev, tx.delivered, netbuf); \
217*5113495bSYour Name else if (status == htt_tx_status_discard) \
218*5113495bSYour Name TXRX_STATS_MSDU_INCR(pdev, tx.dropped.target_discard, \
219*5113495bSYour Name netbuf); \
220*5113495bSYour Name else if (status == htt_tx_status_no_ack) \
221*5113495bSYour Name TXRX_STATS_MSDU_INCR(pdev, tx.dropped.no_ack, netbuf); \
222*5113495bSYour Name else if (status == htt_tx_status_drop) \
223*5113495bSYour Name TXRX_STATS_MSDU_INCR(pdev, tx.dropped.target_drop, \
224*5113495bSYour Name netbuf); \
225*5113495bSYour Name else if (status == htt_tx_status_download_fail) \
226*5113495bSYour Name TXRX_STATS_MSDU_INCR(pdev, tx.dropped.download_fail, \
227*5113495bSYour Name netbuf); \
228*5113495bSYour Name else \
229*5113495bSYour Name /* NO-OP */; \
230*5113495bSYour Name } while (0)
231*5113495bSYour Name
232*5113495bSYour Name #define TXRX_STATS_UPDATE_TX_COMP_HISTOGRAM(_pdev, _p_cntrs) \
233*5113495bSYour Name do { \
234*5113495bSYour Name if (_p_cntrs == 1) { \
235*5113495bSYour Name TXRX_STATS_ADD(_pdev, pub.tx.comp_histogram.pkts_1, 1);\
236*5113495bSYour Name } else if (_p_cntrs > 2 && _p_cntrs <= 10) { \
237*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
238*5113495bSYour Name pub.tx.comp_histogram.pkts_2_10, 1); \
239*5113495bSYour Name } else if (_p_cntrs > 10 && _p_cntrs <= 20) { \
240*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
241*5113495bSYour Name pub.tx.comp_histogram.pkts_11_20, 1); \
242*5113495bSYour Name } else if (_p_cntrs > 20 && _p_cntrs <= 30) { \
243*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
244*5113495bSYour Name pub.tx.comp_histogram.pkts_21_30, 1); \
245*5113495bSYour Name } else if (_p_cntrs > 30 && _p_cntrs <= 40) { \
246*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
247*5113495bSYour Name pub.tx.comp_histogram.pkts_31_40, 1); \
248*5113495bSYour Name } else if (_p_cntrs > 40 && _p_cntrs <= 50) { \
249*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
250*5113495bSYour Name pub.tx.comp_histogram.pkts_41_50, 1); \
251*5113495bSYour Name } else if (_p_cntrs > 50 && _p_cntrs <= 60) { \
252*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
253*5113495bSYour Name pub.tx.comp_histogram.pkts_51_60, 1); \
254*5113495bSYour Name } else { \
255*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
256*5113495bSYour Name pub.tx.comp_histogram.pkts_61_plus, 1); \
257*5113495bSYour Name } \
258*5113495bSYour Name } while (0)
259*5113495bSYour Name
260*5113495bSYour Name #define TXRX_STATS_UPDATE_TX_STATS(_pdev, _status, _p_cntrs, _b_cntrs) \
261*5113495bSYour Name do { \
262*5113495bSYour Name switch (status) { \
263*5113495bSYour Name case htt_tx_status_ok: \
264*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
265*5113495bSYour Name pub.tx.delivered.pkts, _p_cntrs); \
266*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
267*5113495bSYour Name pub.tx.delivered.bytes, _b_cntrs); \
268*5113495bSYour Name break; \
269*5113495bSYour Name case htt_tx_status_discard: \
270*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
271*5113495bSYour Name pub.tx.dropped.target_discard.pkts, _p_cntrs);\
272*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
273*5113495bSYour Name pub.tx.dropped.target_discard.bytes, _b_cntrs);\
274*5113495bSYour Name break; \
275*5113495bSYour Name case htt_tx_status_no_ack: \
276*5113495bSYour Name TXRX_STATS_ADD(_pdev, pub.tx.dropped.no_ack.pkts, \
277*5113495bSYour Name _p_cntrs); \
278*5113495bSYour Name TXRX_STATS_ADD(_pdev, pub.tx.dropped.no_ack.bytes, \
279*5113495bSYour Name _b_cntrs); \
280*5113495bSYour Name break; \
281*5113495bSYour Name case htt_tx_status_drop: \
282*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
283*5113495bSYour Name pub.tx.dropped.target_drop.pkts, _p_cntrs);\
284*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
285*5113495bSYour Name pub.tx.dropped.target_drop.bytes, _b_cntrs);\
286*5113495bSYour Name break; \
287*5113495bSYour Name case htt_tx_status_download_fail: \
288*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
289*5113495bSYour Name pub.tx.dropped.download_fail.pkts, _p_cntrs); \
290*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
291*5113495bSYour Name pub.tx.dropped.download_fail.bytes, _b_cntrs);\
292*5113495bSYour Name break; \
293*5113495bSYour Name default: \
294*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
295*5113495bSYour Name pub.tx.dropped.others.pkts, _p_cntrs); \
296*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
297*5113495bSYour Name pub.tx.dropped.others.bytes, _b_cntrs); \
298*5113495bSYour Name break; \
299*5113495bSYour Name } \
300*5113495bSYour Name TXRX_STATS_UPDATE_TX_COMP_HISTOGRAM(_pdev, _p_cntrs); \
301*5113495bSYour Name } while (0)
302*5113495bSYour Name
303*5113495bSYour Name
304*5113495bSYour Name /*--- txrx sequence number trace macros ---*/
305*5113495bSYour Name
306*5113495bSYour Name #define TXRX_SEQ_NUM_ERR(_status) (0xffff - _status)
307*5113495bSYour Name
308*5113495bSYour Name #if defined(ENABLE_RX_REORDER_TRACE)
309*5113495bSYour Name
310*5113495bSYour Name A_STATUS ol_rx_reorder_trace_attach(ol_txrx_pdev_handle pdev);
311*5113495bSYour Name void ol_rx_reorder_trace_detach(ol_txrx_pdev_handle pdev);
312*5113495bSYour Name void ol_rx_reorder_trace_add(ol_txrx_pdev_handle pdev,
313*5113495bSYour Name uint8_t tid,
314*5113495bSYour Name uint16_t reorder_idx,
315*5113495bSYour Name uint16_t seq_num, int num_mpdus);
316*5113495bSYour Name
317*5113495bSYour Name #define OL_RX_REORDER_TRACE_ATTACH ol_rx_reorder_trace_attach
318*5113495bSYour Name #define OL_RX_REORDER_TRACE_DETACH ol_rx_reorder_trace_detach
319*5113495bSYour Name #define OL_RX_REORDER_TRACE_ADD ol_rx_reorder_trace_add
320*5113495bSYour Name
321*5113495bSYour Name #else
322*5113495bSYour Name
323*5113495bSYour Name #define OL_RX_REORDER_TRACE_ATTACH(_pdev) A_OK
324*5113495bSYour Name #define OL_RX_REORDER_TRACE_DETACH(_pdev)
325*5113495bSYour Name #define OL_RX_REORDER_TRACE_ADD(pdev, tid, reorder_idx, seq_num, num_mpdus)
326*5113495bSYour Name
327*5113495bSYour Name #endif /* ENABLE_RX_REORDER_TRACE */
328*5113495bSYour Name
329*5113495bSYour Name /*--- txrx packet number trace macros ---*/
330*5113495bSYour Name
331*5113495bSYour Name #if defined(ENABLE_RX_PN_TRACE)
332*5113495bSYour Name
333*5113495bSYour Name A_STATUS ol_rx_pn_trace_attach(ol_txrx_pdev_handle pdev);
334*5113495bSYour Name void ol_rx_pn_trace_detach(ol_txrx_pdev_handle pdev);
335*5113495bSYour Name void ol_rx_pn_trace_add(struct ol_txrx_pdev_t *pdev,
336*5113495bSYour Name struct ol_txrx_peer_t *peer,
337*5113495bSYour Name uint16_t tid, void *rx_desc);
338*5113495bSYour Name
339*5113495bSYour Name #define OL_RX_PN_TRACE_ATTACH ol_rx_pn_trace_attach
340*5113495bSYour Name #define OL_RX_PN_TRACE_DETACH ol_rx_pn_trace_detach
341*5113495bSYour Name #define OL_RX_PN_TRACE_ADD ol_rx_pn_trace_add
342*5113495bSYour Name
343*5113495bSYour Name #else
344*5113495bSYour Name
345*5113495bSYour Name #define OL_RX_PN_TRACE_ATTACH(_pdev) A_OK
346*5113495bSYour Name #define OL_RX_PN_TRACE_DETACH(_pdev)
347*5113495bSYour Name #define OL_RX_PN_TRACE_ADD(pdev, peer, tid, rx_desc)
348*5113495bSYour Name
349*5113495bSYour Name #endif /* ENABLE_RX_PN_TRACE */
350*5113495bSYour Name
ol_txrx_ieee80211_hdrsize(const void * data)351*5113495bSYour Name static inline int ol_txrx_ieee80211_hdrsize(const void *data)
352*5113495bSYour Name {
353*5113495bSYour Name const struct ieee80211_frame *wh = (const struct ieee80211_frame *)data;
354*5113495bSYour Name int size = sizeof(struct ieee80211_frame);
355*5113495bSYour Name
356*5113495bSYour Name /* NB: we don't handle control frames */
357*5113495bSYour Name TXRX_ASSERT1((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) !=
358*5113495bSYour Name IEEE80211_FC0_TYPE_CTL);
359*5113495bSYour Name if ((wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) ==
360*5113495bSYour Name IEEE80211_FC1_DIR_DSTODS)
361*5113495bSYour Name size += QDF_MAC_ADDR_SIZE;
362*5113495bSYour Name if (IEEE80211_QOS_HAS_SEQ(wh)) {
363*5113495bSYour Name size += sizeof(uint16_t);
364*5113495bSYour Name /* Qos frame with Order bit set indicates an HTC frame */
365*5113495bSYour Name if (wh->i_fc[1] & IEEE80211_FC1_ORDER)
366*5113495bSYour Name size += sizeof(struct ieee80211_htc);
367*5113495bSYour Name }
368*5113495bSYour Name return size;
369*5113495bSYour Name }
370*5113495bSYour Name
371*5113495bSYour Name /*--- frame display utility ---*/
372*5113495bSYour Name
373*5113495bSYour Name enum ol_txrx_frm_dump_options {
374*5113495bSYour Name ol_txrx_frm_dump_contents = 0x1,
375*5113495bSYour Name ol_txrx_frm_dump_tcp_seq = 0x2,
376*5113495bSYour Name };
377*5113495bSYour Name
378*5113495bSYour Name #ifdef TXRX_DEBUG_DATA
379*5113495bSYour Name static inline void
ol_txrx_frms_dump(const char * name,struct ol_txrx_pdev_t * pdev,qdf_nbuf_t frm,enum ol_txrx_frm_dump_options display_options,int max_len)380*5113495bSYour Name ol_txrx_frms_dump(const char *name,
381*5113495bSYour Name struct ol_txrx_pdev_t *pdev,
382*5113495bSYour Name qdf_nbuf_t frm,
383*5113495bSYour Name enum ol_txrx_frm_dump_options display_options, int max_len)
384*5113495bSYour Name {
385*5113495bSYour Name #define TXRX_FRM_DUMP_MAX_LEN 128
386*5113495bSYour Name uint8_t local_buf[TXRX_FRM_DUMP_MAX_LEN] = { 0 };
387*5113495bSYour Name uint8_t *p;
388*5113495bSYour Name
389*5113495bSYour Name if (name) {
390*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO, "%s\n",
391*5113495bSYour Name name);
392*5113495bSYour Name }
393*5113495bSYour Name while (frm) {
394*5113495bSYour Name p = qdf_nbuf_data(frm);
395*5113495bSYour Name if (display_options & ol_txrx_frm_dump_tcp_seq) {
396*5113495bSYour Name int tcp_offset;
397*5113495bSYour Name int l2_hdr_size;
398*5113495bSYour Name uint16_t ethtype;
399*5113495bSYour Name uint8_t ip_prot;
400*5113495bSYour Name
401*5113495bSYour Name if (pdev->frame_format == wlan_frm_fmt_802_3) {
402*5113495bSYour Name struct ethernet_hdr_t *enet_hdr =
403*5113495bSYour Name (struct ethernet_hdr_t *)p;
404*5113495bSYour Name l2_hdr_size = ETHERNET_HDR_LEN;
405*5113495bSYour Name
406*5113495bSYour Name /*
407*5113495bSYour Name * LLC/SNAP present?
408*5113495bSYour Name */
409*5113495bSYour Name ethtype = (enet_hdr->ethertype[0] << 8) |
410*5113495bSYour Name enet_hdr->ethertype[1];
411*5113495bSYour Name if (!IS_ETHERTYPE(ethertype)) {
412*5113495bSYour Name /* 802.3 format */
413*5113495bSYour Name struct llc_snap_hdr_t *llc_hdr;
414*5113495bSYour Name
415*5113495bSYour Name llc_hdr = (struct llc_snap_hdr_t *)
416*5113495bSYour Name (p + l2_hdr_size);
417*5113495bSYour Name l2_hdr_size += LLC_SNAP_HDR_LEN;
418*5113495bSYour Name ethtype = (llc_hdr->ethertype[0] << 8) |
419*5113495bSYour Name llc_hdr->ethertype[1];
420*5113495bSYour Name }
421*5113495bSYour Name } else {
422*5113495bSYour Name struct llc_snap_hdr_t *llc_hdr;
423*5113495bSYour Name
424*5113495bSYour Name /* (generic?) 802.11 */
425*5113495bSYour Name l2_hdr_size = sizeof(struct ieee80211_frame);
426*5113495bSYour Name llc_hdr = (struct llc_snap_hdr_t *)
427*5113495bSYour Name (p + l2_hdr_size);
428*5113495bSYour Name l2_hdr_size += LLC_SNAP_HDR_LEN;
429*5113495bSYour Name ethtype = (llc_hdr->ethertype[0] << 8) |
430*5113495bSYour Name llc_hdr->ethertype[1];
431*5113495bSYour Name }
432*5113495bSYour Name if (ethtype == ETHERTYPE_IPV4) {
433*5113495bSYour Name struct ipv4_hdr_t *ipv4_hdr;
434*5113495bSYour Name
435*5113495bSYour Name ipv4_hdr =
436*5113495bSYour Name (struct ipv4_hdr_t *)(p + l2_hdr_size);
437*5113495bSYour Name ip_prot = ipv4_hdr->protocol;
438*5113495bSYour Name tcp_offset = l2_hdr_size + IPV4_HDR_LEN;
439*5113495bSYour Name } else if (ethtype == ETHERTYPE_IPV6) {
440*5113495bSYour Name struct ipv6_hdr_t *ipv6_hdr;
441*5113495bSYour Name
442*5113495bSYour Name ipv6_hdr =
443*5113495bSYour Name (struct ipv6_hdr_t *)(p + l2_hdr_size);
444*5113495bSYour Name ip_prot = ipv6_hdr->next_hdr;
445*5113495bSYour Name tcp_offset = l2_hdr_size + IPV6_HDR_LEN;
446*5113495bSYour Name } else {
447*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_TXRX,
448*5113495bSYour Name QDF_TRACE_LEVEL_INFO,
449*5113495bSYour Name "frame %pK non-IP ethertype (%x)\n",
450*5113495bSYour Name frm, ethtype);
451*5113495bSYour Name goto NOT_IP_TCP;
452*5113495bSYour Name }
453*5113495bSYour Name if (ip_prot == IP_PROTOCOL_TCP) {
454*5113495bSYour Name #if NEVERDEFINED
455*5113495bSYour Name struct tcp_hdr_t *tcp_hdr;
456*5113495bSYour Name uint32_t tcp_seq_num;
457*5113495bSYour Name
458*5113495bSYour Name tcp_hdr = (struct tcp_hdr_t *)(p + tcp_offset);
459*5113495bSYour Name tcp_seq_num =
460*5113495bSYour Name (tcp_hdr->seq_num[0] << 24) |
461*5113495bSYour Name (tcp_hdr->seq_num[1] << 16) |
462*5113495bSYour Name (tcp_hdr->seq_num[1] << 8) |
463*5113495bSYour Name (tcp_hdr->seq_num[1] << 0);
464*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_TXRX,
465*5113495bSYour Name QDF_TRACE_LEVEL_INFO,
466*5113495bSYour Name "frame %pK: TCP seq num = %d\n", frm,
467*5113495bSYour Name tcp_seq_num);
468*5113495bSYour Name #else
469*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_TXRX,
470*5113495bSYour Name QDF_TRACE_LEVEL_INFO,
471*5113495bSYour Name "frame %pK: TCP seq num = %d\n", frm,
472*5113495bSYour Name ((*(p + tcp_offset + 4)) << 24) |
473*5113495bSYour Name ((*(p + tcp_offset + 5)) << 16) |
474*5113495bSYour Name ((*(p + tcp_offset + 6)) << 8) |
475*5113495bSYour Name (*(p + tcp_offset + 7)));
476*5113495bSYour Name #endif
477*5113495bSYour Name } else {
478*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_TXRX,
479*5113495bSYour Name QDF_TRACE_LEVEL_INFO,
480*5113495bSYour Name "frame %pK non-TCP IP protocol (%x)\n",
481*5113495bSYour Name frm, ip_prot);
482*5113495bSYour Name }
483*5113495bSYour Name }
484*5113495bSYour Name NOT_IP_TCP:
485*5113495bSYour Name if (display_options & ol_txrx_frm_dump_contents) {
486*5113495bSYour Name int i, frag_num, len_lim;
487*5113495bSYour Name
488*5113495bSYour Name len_lim = max_len;
489*5113495bSYour Name if (len_lim > qdf_nbuf_len(frm))
490*5113495bSYour Name len_lim = qdf_nbuf_len(frm);
491*5113495bSYour Name if (len_lim > TXRX_FRM_DUMP_MAX_LEN)
492*5113495bSYour Name len_lim = TXRX_FRM_DUMP_MAX_LEN;
493*5113495bSYour Name
494*5113495bSYour Name /*
495*5113495bSYour Name * Gather frame contents from netbuf fragments
496*5113495bSYour Name * into a contiguous buffer.
497*5113495bSYour Name */
498*5113495bSYour Name frag_num = 0;
499*5113495bSYour Name i = 0;
500*5113495bSYour Name while (i < len_lim) {
501*5113495bSYour Name int frag_bytes;
502*5113495bSYour Name
503*5113495bSYour Name frag_bytes =
504*5113495bSYour Name qdf_nbuf_get_frag_len(frm, frag_num);
505*5113495bSYour Name if (frag_bytes > len_lim - i)
506*5113495bSYour Name frag_bytes = len_lim - i;
507*5113495bSYour Name if (frag_bytes > 0) {
508*5113495bSYour Name p = qdf_nbuf_get_frag_vaddr(frm,
509*5113495bSYour Name frag_num);
510*5113495bSYour Name qdf_mem_copy(&local_buf[i], p,
511*5113495bSYour Name frag_bytes);
512*5113495bSYour Name }
513*5113495bSYour Name frag_num++;
514*5113495bSYour Name i += frag_bytes;
515*5113495bSYour Name }
516*5113495bSYour Name
517*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO,
518*5113495bSYour Name "frame %pK data (%pK), hex dump of bytes 0-%d of %d:\n",
519*5113495bSYour Name frm, p, len_lim - 1, (int)qdf_nbuf_len(frm));
520*5113495bSYour Name p = local_buf;
521*5113495bSYour Name while (len_lim > 16) {
522*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_TXRX,
523*5113495bSYour Name QDF_TRACE_LEVEL_INFO,
524*5113495bSYour Name " " /* indent */
525*5113495bSYour Name "%02x %02x %02x %02x %02x %02x %02x %02x "
526*5113495bSYour Name "%02x %02x %02x %02x %02x %02x %02x %02x\n",
527*5113495bSYour Name *(p + 0), *(p + 1), *(p + 2),
528*5113495bSYour Name *(p + 3), *(p + 4), *(p + 5),
529*5113495bSYour Name *(p + 6), *(p + 7), *(p + 8),
530*5113495bSYour Name *(p + 9), *(p + 10), *(p + 11),
531*5113495bSYour Name *(p + 12), *(p + 13), *(p + 14),
532*5113495bSYour Name *(p + 15));
533*5113495bSYour Name p += 16;
534*5113495bSYour Name len_lim -= 16;
535*5113495bSYour Name }
536*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO,
537*5113495bSYour Name " " /* indent */);
538*5113495bSYour Name while (len_lim > 0) {
539*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_TXRX,
540*5113495bSYour Name QDF_TRACE_LEVEL_INFO, "%02x ", *p);
541*5113495bSYour Name p++;
542*5113495bSYour Name len_lim--;
543*5113495bSYour Name }
544*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO,
545*5113495bSYour Name "\n");
546*5113495bSYour Name }
547*5113495bSYour Name frm = qdf_nbuf_next(frm);
548*5113495bSYour Name }
549*5113495bSYour Name }
550*5113495bSYour Name #else
551*5113495bSYour Name #define ol_txrx_frms_dump(name, pdev, frms, display_options, max_len)
552*5113495bSYour Name #endif /* TXRX_DEBUG_DATA */
553*5113495bSYour Name
554*5113495bSYour Name #ifdef SUPPORT_HOST_STATISTICS
555*5113495bSYour Name
556*5113495bSYour Name #define OL_RX_ERR_STATISTICS(pdev, vdev, err_type, sec_type, is_mcast) \
557*5113495bSYour Name ol_rx_err_statistics(pdev->ctrl_pdev, vdev->vdev_id, err_type, \
558*5113495bSYour Name sec_type, is_mcast)
559*5113495bSYour Name
560*5113495bSYour Name #define OL_RX_ERR_STATISTICS_1(pdev, vdev, peer, rx_desc, err_type) \
561*5113495bSYour Name do { \
562*5113495bSYour Name int is_mcast; \
563*5113495bSYour Name enum htt_sec_type sec_type; \
564*5113495bSYour Name is_mcast = htt_rx_msdu_is_wlan_mcast( \
565*5113495bSYour Name pdev->htt_pdev, rx_desc); \
566*5113495bSYour Name sec_type = peer->security[is_mcast \
567*5113495bSYour Name ? txrx_sec_mcast \
568*5113495bSYour Name : txrx_sec_ucast].sec_type; \
569*5113495bSYour Name OL_RX_ERR_STATISTICS(pdev, vdev, err_type, \
570*5113495bSYour Name pdev->sec_types[sec_type], \
571*5113495bSYour Name is_mcast); \
572*5113495bSYour Name } while (false)
573*5113495bSYour Name
574*5113495bSYour Name #ifdef CONFIG_HL_SUPPORT
575*5113495bSYour Name
576*5113495bSYour Name /**
577*5113495bSYour Name * ol_rx_err_inv_get_wifi_header() - retrieve wifi header
578*5113495bSYour Name * @pdev: handle to the physical device
579*5113495bSYour Name * @rx_msdu: msdu of which header needs to be retrieved
580*5113495bSYour Name *
581*5113495bSYour Name * Return: wifi header
582*5113495bSYour Name */
583*5113495bSYour Name static inline
ol_rx_err_inv_get_wifi_header(struct ol_pdev_t * pdev,qdf_nbuf_t rx_msdu)584*5113495bSYour Name struct ieee80211_frame *ol_rx_err_inv_get_wifi_header(
585*5113495bSYour Name struct ol_pdev_t *pdev, qdf_nbuf_t rx_msdu)
586*5113495bSYour Name {
587*5113495bSYour Name return NULL;
588*5113495bSYour Name }
589*5113495bSYour Name #else
590*5113495bSYour Name
591*5113495bSYour Name static inline
ol_rx_err_inv_get_wifi_header(struct ol_pdev_t * pdev,qdf_nbuf_t rx_msdu)592*5113495bSYour Name struct ieee80211_frame *ol_rx_err_inv_get_wifi_header(
593*5113495bSYour Name struct ol_pdev_t *pdev, qdf_nbuf_t rx_msdu)
594*5113495bSYour Name {
595*5113495bSYour Name struct ieee80211_frame *wh = NULL;
596*5113495bSYour Name
597*5113495bSYour Name if (ol_cfg_frame_type(pdev) == wlan_frm_fmt_native_wifi)
598*5113495bSYour Name /* For windows, it is always native wifi header .*/
599*5113495bSYour Name wh = (struct ieee80211_frame *)qdf_nbuf_data(rx_msdu);
600*5113495bSYour Name
601*5113495bSYour Name return wh;
602*5113495bSYour Name }
603*5113495bSYour Name #endif
604*5113495bSYour Name
605*5113495bSYour Name #define OL_RX_ERR_INV_PEER_STATISTICS(pdev, rx_msdu) \
606*5113495bSYour Name do { \
607*5113495bSYour Name struct ieee80211_frame *wh = NULL; \
608*5113495bSYour Name /*FIX THIS : */ \
609*5113495bSYour Name /* Here htt_rx_mpdu_wifi_hdr_retrieve should be used. */ \
610*5113495bSYour Name /*But at present it seems it does not work.*/ \
611*5113495bSYour Name /*wh = (struct ieee80211_frame *) */ \
612*5113495bSYour Name /*htt_rx_mpdu_wifi_hdr_retrieve(pdev->htt_pdev, rx_desc);*/ \
613*5113495bSYour Name /* this only apply to LL device.*/ \
614*5113495bSYour Name wh = ol_rx_err_inv_get_wifi_header(pdev->ctrl_pdev, rx_msdu); \
615*5113495bSYour Name ol_rx_err_inv_peer_statistics(pdev->ctrl_pdev, \
616*5113495bSYour Name wh, OL_RX_ERR_UNKNOWN_PEER); \
617*5113495bSYour Name } while (false)
618*5113495bSYour Name
619*5113495bSYour Name #define OL_RX_ERR_STATISTICS_2(pdev, vdev, peer, rx_desc, rx_msdu, rx_status) \
620*5113495bSYour Name do { \
621*5113495bSYour Name enum ol_rx_err_type err_type = OL_RX_ERR_NONE; \
622*5113495bSYour Name if (rx_status == htt_rx_status_decrypt_err) \
623*5113495bSYour Name err_type = OL_RX_ERR_DECRYPT; \
624*5113495bSYour Name else if (rx_status == htt_rx_status_tkip_mic_err) \
625*5113495bSYour Name err_type = OL_RX_ERR_TKIP_MIC; \
626*5113495bSYour Name else if (rx_status == htt_rx_status_mpdu_length_err) \
627*5113495bSYour Name err_type = OL_RX_ERR_MPDU_LENGTH; \
628*5113495bSYour Name else if (rx_status == htt_rx_status_mpdu_encrypt_required_err) \
629*5113495bSYour Name err_type = OL_RX_ERR_ENCRYPT_REQUIRED; \
630*5113495bSYour Name else if (rx_status == htt_rx_status_err_dup) \
631*5113495bSYour Name err_type = OL_RX_ERR_DUP; \
632*5113495bSYour Name else if (rx_status == htt_rx_status_err_fcs) \
633*5113495bSYour Name err_type = OL_RX_ERR_FCS; \
634*5113495bSYour Name else \
635*5113495bSYour Name err_type = OL_RX_ERR_UNKNOWN; \
636*5113495bSYour Name \
637*5113495bSYour Name if (vdev && peer) { \
638*5113495bSYour Name OL_RX_ERR_STATISTICS_1(pdev, vdev, peer, \
639*5113495bSYour Name rx_mpdu_desc, err_type); \
640*5113495bSYour Name } else { \
641*5113495bSYour Name OL_RX_ERR_INV_PEER_STATISTICS(pdev, rx_msdu); \
642*5113495bSYour Name } \
643*5113495bSYour Name } while (false)
644*5113495bSYour Name #else
645*5113495bSYour Name #define OL_RX_ERR_STATISTICS(pdev, vdev, err_type, sec_type, is_mcast)
646*5113495bSYour Name #define OL_RX_ERR_STATISTICS_1(pdev, vdev, peer, rx_desc, err_type)
647*5113495bSYour Name #define OL_RX_ERR_STATISTICS_2(pdev, vdev, peer, rx_desc, rx_msdu, rx_status)
648*5113495bSYour Name #endif /* SUPPORT_HOST_STATISTICS */
649*5113495bSYour Name
650*5113495bSYour Name #ifdef QCA_ENABLE_OL_TXRX_PEER_STATS
651*5113495bSYour Name #define OL_TXRX_PEER_STATS_UPDATE_BASE(peer, tx_or_rx, type, msdu) \
652*5113495bSYour Name do { \
653*5113495bSYour Name qdf_spin_lock_bh(&peer->vdev->pdev->peer_stat_mutex); \
654*5113495bSYour Name peer->stats.tx_or_rx.frms.type += 1; \
655*5113495bSYour Name peer->stats.tx_or_rx.bytes.type += qdf_nbuf_len(msdu); \
656*5113495bSYour Name qdf_spin_unlock_bh(&peer->vdev->pdev->peer_stat_mutex); \
657*5113495bSYour Name } while (0)
658*5113495bSYour Name #define OL_TXRX_PEER_STATS_UPDATE(peer, tx_or_rx, msdu) \
659*5113495bSYour Name do { \
660*5113495bSYour Name struct ol_txrx_vdev_t *vdev = peer->vdev; \
661*5113495bSYour Name struct ol_txrx_pdev_t *pdev = vdev->pdev; \
662*5113495bSYour Name uint8_t *dest_addr; \
663*5113495bSYour Name if (pdev->frame_format == wlan_frm_fmt_802_3) { \
664*5113495bSYour Name dest_addr = qdf_nbuf_data(msdu); \
665*5113495bSYour Name } else { /* 802.11 format */ \
666*5113495bSYour Name struct ieee80211_frame *frm; \
667*5113495bSYour Name frm = (struct ieee80211_frame *) qdf_nbuf_data(msdu); \
668*5113495bSYour Name if (vdev->opmode == wlan_op_mode_ap) { \
669*5113495bSYour Name dest_addr = (uint8_t *) &(frm->i_addr1[0]); \
670*5113495bSYour Name } else { \
671*5113495bSYour Name dest_addr = (uint8_t *) &(frm->i_addr3[0]); \
672*5113495bSYour Name } \
673*5113495bSYour Name } \
674*5113495bSYour Name if (qdf_unlikely(QDF_IS_ADDR_BROADCAST(dest_addr))) { \
675*5113495bSYour Name OL_TXRX_PEER_STATS_UPDATE_BASE(peer, tx_or_rx, \
676*5113495bSYour Name bcast, msdu); \
677*5113495bSYour Name } else if (qdf_unlikely(IEEE80211_IS_MULTICAST(dest_addr))) { \
678*5113495bSYour Name OL_TXRX_PEER_STATS_UPDATE_BASE(peer, tx_or_rx, \
679*5113495bSYour Name mcast, msdu); \
680*5113495bSYour Name } else { \
681*5113495bSYour Name OL_TXRX_PEER_STATS_UPDATE_BASE(peer, tx_or_rx, \
682*5113495bSYour Name ucast, msdu); \
683*5113495bSYour Name } \
684*5113495bSYour Name } while (0)
685*5113495bSYour Name #define OL_TX_PEER_STATS_UPDATE(peer, msdu) \
686*5113495bSYour Name OL_TXRX_PEER_STATS_UPDATE(peer, tx, msdu)
687*5113495bSYour Name #define OL_RX_PEER_STATS_UPDATE(peer, msdu) \
688*5113495bSYour Name OL_TXRX_PEER_STATS_UPDATE(peer, rx, msdu)
689*5113495bSYour Name #define OL_TXRX_PEER_STATS_MUTEX_INIT(pdev) \
690*5113495bSYour Name qdf_spinlock_create(&pdev->peer_stat_mutex)
691*5113495bSYour Name #define OL_TXRX_PEER_STATS_MUTEX_DESTROY(pdev) \
692*5113495bSYour Name qdf_spinlock_destroy(&pdev->peer_stat_mutex)
693*5113495bSYour Name #else
694*5113495bSYour Name #define OL_TX_PEER_STATS_UPDATE(peer, msdu) /* no-op */
695*5113495bSYour Name #define OL_RX_PEER_STATS_UPDATE(peer, msdu) /* no-op */
696*5113495bSYour Name #define OL_TXRX_PEER_STATS_MUTEX_INIT(peer) /* no-op */
697*5113495bSYour Name #define OL_TXRX_PEER_STATS_MUTEX_DESTROY(peer) /* no-op */
698*5113495bSYour Name #endif
699*5113495bSYour Name
700*5113495bSYour Name #ifndef DEBUG_HTT_CREDIT
701*5113495bSYour Name #define DEBUG_HTT_CREDIT 0
702*5113495bSYour Name #endif
703*5113495bSYour Name
704*5113495bSYour Name #if defined(FEATURE_TSO_DEBUG)
705*5113495bSYour Name #define TXRX_STATS_TSO_HISTOGRAM(_pdev, _p_cntrs) \
706*5113495bSYour Name do { \
707*5113495bSYour Name if (_p_cntrs == 1) { \
708*5113495bSYour Name TXRX_STATS_ADD(_pdev, pub.tx.tso.tso_hist.pkts_1, 1); \
709*5113495bSYour Name } else if (_p_cntrs >= 2 && _p_cntrs <= 5) { \
710*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
711*5113495bSYour Name pub.tx.tso.tso_hist.pkts_2_5, 1); \
712*5113495bSYour Name } else if (_p_cntrs > 5 && _p_cntrs <= 10) { \
713*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
714*5113495bSYour Name pub.tx.tso.tso_hist.pkts_6_10, 1); \
715*5113495bSYour Name } else if (_p_cntrs > 10 && _p_cntrs <= 15) { \
716*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
717*5113495bSYour Name pub.tx.tso.tso_hist.pkts_11_15, 1); \
718*5113495bSYour Name } else if (_p_cntrs > 15 && _p_cntrs <= 20) { \
719*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
720*5113495bSYour Name pub.tx.tso.tso_hist.pkts_16_20, 1); \
721*5113495bSYour Name } else if (_p_cntrs > 20) { \
722*5113495bSYour Name TXRX_STATS_ADD(_pdev, \
723*5113495bSYour Name pub.tx.tso.tso_hist.pkts_20_plus, 1); \
724*5113495bSYour Name } \
725*5113495bSYour Name } while (0)
726*5113495bSYour Name
727*5113495bSYour Name #define TXRX_STATS_TSO_RESET_MSDU(pdev, idx) \
728*5113495bSYour Name do { \
729*5113495bSYour Name pdev->stats.pub.tx.tso.tso_info.tso_msdu_info[idx].num_seg \
730*5113495bSYour Name = 0; \
731*5113495bSYour Name pdev->stats.pub.tx.tso.tso_info.tso_msdu_info[idx].tso_seg_idx \
732*5113495bSYour Name = 0; \
733*5113495bSYour Name } while (0)
734*5113495bSYour Name
735*5113495bSYour Name #define TXRX_STATS_TSO_MSDU_IDX(pdev) \
736*5113495bSYour Name pdev->stats.pub.tx.tso.tso_info.tso_msdu_idx
737*5113495bSYour Name
738*5113495bSYour Name #define TXRX_STATS_TSO_MSDU(pdev, idx) \
739*5113495bSYour Name pdev->stats.pub.tx.tso.tso_info.tso_msdu_info[idx]
740*5113495bSYour Name
741*5113495bSYour Name #define TXRX_STATS_TSO_MSDU_NUM_SEG(pdev, idx) \
742*5113495bSYour Name pdev->stats.pub.tx.tso.tso_info.tso_msdu_info[idx].num_seg
743*5113495bSYour Name
744*5113495bSYour Name #define TXRX_STATS_TSO_MSDU_GSO_SIZE(pdev, idx) \
745*5113495bSYour Name pdev->stats.pub.tx.tso.tso_info.tso_msdu_info[idx].gso_size
746*5113495bSYour Name
747*5113495bSYour Name #define TXRX_STATS_TSO_MSDU_TOTAL_LEN(pdev, idx) \
748*5113495bSYour Name pdev->stats.pub.tx.tso.tso_info.tso_msdu_info[idx].total_len
749*5113495bSYour Name
750*5113495bSYour Name #define TXRX_STATS_TSO_MSDU_NR_FRAGS(pdev, idx) \
751*5113495bSYour Name pdev->stats.pub.tx.tso.tso_info.tso_msdu_info[idx].nr_frags
752*5113495bSYour Name
753*5113495bSYour Name #define TXRX_STATS_TSO_CURR_MSDU(pdev, idx) \
754*5113495bSYour Name TXRX_STATS_TSO_MSDU(pdev, idx)
755*5113495bSYour Name
756*5113495bSYour Name #define TXRX_STATS_TSO_SEG_IDX(pdev, idx) \
757*5113495bSYour Name TXRX_STATS_TSO_CURR_MSDU(pdev, idx).tso_seg_idx
758*5113495bSYour Name
759*5113495bSYour Name #define TXRX_STATS_TSO_INC_SEG(pdev, idx) \
760*5113495bSYour Name do { \
761*5113495bSYour Name TXRX_STATS_TSO_CURR_MSDU(pdev, idx).num_seg++; \
762*5113495bSYour Name TXRX_STATS_TSO_CURR_MSDU(pdev, idx).num_seg &= \
763*5113495bSYour Name NUM_MAX_TSO_SEGS_MASK; \
764*5113495bSYour Name } while (0)
765*5113495bSYour Name
766*5113495bSYour Name #define TXRX_STATS_TSO_RST_SEG(pdev, idx) \
767*5113495bSYour Name TXRX_STATS_TSO_CURR_MSDU(pdev, idx).num_seg = 0
768*5113495bSYour Name
769*5113495bSYour Name #define TXRX_STATS_TSO_RST_SEG_IDX(pdev, idx) \
770*5113495bSYour Name TXRX_STATS_TSO_CURR_MSDU(pdev, idx).tso_seg_idx = 0
771*5113495bSYour Name
772*5113495bSYour Name #define TXRX_STATS_TSO_SEG(pdev, msdu_idx, seg_idx) \
773*5113495bSYour Name TXRX_STATS_TSO_MSDU(pdev, msdu_idx).tso_segs[seg_idx]
774*5113495bSYour Name
775*5113495bSYour Name #define TXRX_STATS_TSO_CURR_SEG(pdev, idx) \
776*5113495bSYour Name TXRX_STATS_TSO_SEG(pdev, idx, \
777*5113495bSYour Name TXRX_STATS_TSO_SEG_IDX(pdev, idx)) \
778*5113495bSYour Name
779*5113495bSYour Name #define TXRX_STATS_TSO_INC_SEG_IDX(pdev, idx) \
780*5113495bSYour Name do { \
781*5113495bSYour Name TXRX_STATS_TSO_SEG_IDX(pdev, idx)++; \
782*5113495bSYour Name TXRX_STATS_TSO_SEG_IDX(pdev, idx) &= NUM_MAX_TSO_SEGS_MASK; \
783*5113495bSYour Name } while (0)
784*5113495bSYour Name
785*5113495bSYour Name #define TXRX_STATS_TSO_SEG_UPDATE(pdev, idx, tso_seg) \
786*5113495bSYour Name (TXRX_STATS_TSO_CURR_SEG(pdev, idx) = tso_seg)
787*5113495bSYour Name
788*5113495bSYour Name #define TXRX_STATS_TSO_GSO_SIZE_UPDATE(pdev, idx, size) \
789*5113495bSYour Name (TXRX_STATS_TSO_CURR_MSDU(pdev, idx).gso_size = size)
790*5113495bSYour Name
791*5113495bSYour Name #define TXRX_STATS_TSO_TOTAL_LEN_UPDATE(pdev, idx, len) \
792*5113495bSYour Name (TXRX_STATS_TSO_CURR_MSDU(pdev, idx).total_len = len)
793*5113495bSYour Name
794*5113495bSYour Name #define TXRX_STATS_TSO_NUM_FRAGS_UPDATE(pdev, idx, frags) \
795*5113495bSYour Name (TXRX_STATS_TSO_CURR_MSDU(pdev, idx).nr_frags = frags)
796*5113495bSYour Name
797*5113495bSYour Name #else
798*5113495bSYour Name #define TXRX_STATS_TSO_HISTOGRAM(_pdev, _p_cntrs) /* no-op */
799*5113495bSYour Name #define TXRX_STATS_TSO_RESET_MSDU(pdev, idx) /* no-op */
800*5113495bSYour Name #define TXRX_STATS_TSO_MSDU_IDX(pdev) /* no-op */
801*5113495bSYour Name #define TXRX_STATS_TSO_MSDU(pdev, idx) /* no-op */
802*5113495bSYour Name #define TXRX_STATS_TSO_MSDU_NUM_SEG(pdev, idx) /* no-op */
803*5113495bSYour Name #define TXRX_STATS_TSO_CURR_MSDU(pdev, idx) /* no-op */
804*5113495bSYour Name #define TXRX_STATS_TSO_INC_MSDU_IDX(pdev) /* no-op */
805*5113495bSYour Name #define TXRX_STATS_TSO_SEG_IDX(pdev, idx) /* no-op */
806*5113495bSYour Name #define TXRX_STATS_TSO_SEG(pdev, msdu_idx, seg_idx) /* no-op */
807*5113495bSYour Name #define TXRX_STATS_TSO_CURR_SEG(pdev, idx) /* no-op */
808*5113495bSYour Name #define TXRX_STATS_TSO_INC_SEG_IDX(pdev, idx) /* no-op */
809*5113495bSYour Name #define TXRX_STATS_TSO_SEG_UPDATE(pdev, idx, tso_seg) /* no-op */
810*5113495bSYour Name #define TXRX_STATS_TSO_INC_SEG(pdev, idx) /* no-op */
811*5113495bSYour Name #define TXRX_STATS_TSO_RST_SEG(pdev, idx) /* no-op */
812*5113495bSYour Name #define TXRX_STATS_TSO_RST_SEG_IDX(pdev, idx) /* no-op */
813*5113495bSYour Name #define TXRX_STATS_TSO_GSO_SIZE_UPDATE(pdev, idx, size) /* no-op */
814*5113495bSYour Name #define TXRX_STATS_TSO_TOTAL_LEN_UPDATE(pdev, idx, len) /* no-op */
815*5113495bSYour Name #define TXRX_STATS_TSO_NUM_FRAGS_UPDATE(pdev, idx, frags) /* no-op */
816*5113495bSYour Name #define TXRX_STATS_TSO_MSDU_GSO_SIZE(pdev, idx) /* no-op */
817*5113495bSYour Name #define TXRX_STATS_TSO_MSDU_TOTAL_LEN(pdev, idx) /* no-op */
818*5113495bSYour Name #define TXRX_STATS_TSO_MSDU_NR_FRAGS(pdev, idx) /* no-op */
819*5113495bSYour Name
820*5113495bSYour Name #endif /* FEATURE_TSO_DEBUG */
821*5113495bSYour Name
822*5113495bSYour Name #ifdef FEATURE_HL_GROUP_CREDIT_FLOW_CONTROL
823*5113495bSYour Name
824*5113495bSYour Name void
825*5113495bSYour Name ol_txrx_update_group_credit(
826*5113495bSYour Name struct ol_tx_queue_group_t *group,
827*5113495bSYour Name int32_t credit,
828*5113495bSYour Name u_int8_t absolute);
829*5113495bSYour Name #endif
830*5113495bSYour Name
831*5113495bSYour Name #endif /* _OL_TXRX_INTERNAL__H_ */
832