xref: /freebsd/sys/compat/linuxkpi/common/src/linux_80211.h (revision a3cefe7f2b4df0f70ff92d4570ce18e517af43ec)
1 /*-
2  * Copyright (c) 2020-2026 The FreeBSD Foundation
3  * Copyright (c) 2020-2021 Bjoern A. Zeeb
4  *
5  * This software was developed by Björn Zeeb under sponsorship from
6  * the FreeBSD Foundation.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  */
29 
30 /*
31  * Public functions are called linuxkpi_*().
32  * Internal (static) functions are called lkpi_*().
33  *
34  * The internal structures holding metadata over public structures are also
35  * called lkpi_xxx (usually with a member at the end called xxx).
36  * Note: we do not replicate the structure names but the general variable names
37  * for these (e.g., struct hw -> struct lkpi_hw, struct sta -> struct lkpi_sta).
38  * There are macros to access one from the other.
39  * We call the internal versions lxxx (e.g., hw -> lhw, sta -> lsta).
40  */
41 
42 #ifndef _LKPI_SRC_LINUX_80211_H
43 #define _LKPI_SRC_LINUX_80211_H
44 
45 #include "opt_wlan.h"
46 
47 #if defined(IEEE80211_DEBUG) && !defined(LINUXKPI_DEBUG_80211)
48 #define	LINUXKPI_DEBUG_80211
49 #endif
50 
51 /* #define	LINUXKPI_DEBUG_80211 */
52 
53 #ifndef	D80211_TODO
54 #define	D80211_TODO		0x00000001
55 #endif
56 #ifndef D80211_IMPROVE
57 #define	D80211_IMPROVE		0x00000002
58 #endif
59 #define	D80211_IMPROVE_TXQ	0x00000004
60 #define	D80211_CHANDEF		0x00000008
61 #define	D80211_TRACE		0x00000010
62 #define	D80211_TRACEOK		0x00000020
63 #define	D80211_SCAN		0x00000040
64 #define	D80211_SCAN_BEACON	0x00000080
65 #define	D80211_TRACE_TX		0x00000100
66 #define	D80211_TRACE_TX_DUMP	0x00000200
67 #define	D80211_TRACE_RX		0x00001000
68 #define	D80211_TRACE_RX_DUMP	0x00002000
69 #define	D80211_TRACE_RX_BEACONS	0x00004000
70 #define	D80211_TRACEX		(D80211_TRACE_TX|D80211_TRACE_RX)
71 #define	D80211_TRACEX_DUMP	(D80211_TRACE_TX_DUMP|D80211_TRACE_RX_DUMP)
72 #define	D80211_TRACE_STA	0x00010000
73 #define	D80211_TRACE_HW_CRYPTO	0x00020000
74 #define	D80211_TRACE_MO		0x00100000
75 #define	D80211_TRACE_MODE	0x0f000000
76 #define	D80211_TRACE_MODE_HT	0x01000000
77 #define	D80211_TRACE_MODE_VHT	0x02000000
78 #define	D80211_TRACE_MODE_HE	0x04000000
79 #define	D80211_TRACE_MODE_EHT	0x08000000
80 
81 #ifdef	LINUXKPI_DEBUG_80211
82 #define	TRACE_SCAN(ic, fmt, ...)					\
83     if (linuxkpi_debug_80211 & D80211_SCAN)				\
84 	printf("%s:%d: %s SCAN " fmt "\n",				\
85 	    __func__, __LINE__, ic->ic_name, ##__VA_ARGS__)
86 #define	TRACE_SCAN_BEACON(ic, fmt, ...)					\
87     if (linuxkpi_debug_80211 & D80211_SCAN_BEACON)			\
88 	printf("%s:%d: %s SCAN " fmt "\n",				\
89 	    __func__, __LINE__, ic->ic_name, ##__VA_ARGS__)
90 #else
91 #define	TRACE_SCAN(...)		do {} while (0)
92 #define	TRACE_SCAN_BEACON(...)	do {} while (0)
93 #endif
94 
95 #define	IMPROVE_TXQ(...)						\
96     if (linuxkpi_debug_80211 & D80211_IMPROVE_TXQ)			\
97 	printf("%s:%d: XXX LKPI80211 IMPROVE_TXQ\n", __func__, __LINE__)
98 
99 #define	IMPROVE_HT(fmt, ...)						\
100     if (linuxkpi_debug_80211 & D80211_TRACE_MODE_HT)			\
101 	printf("%s:%d: XXX LKPI80211 IMPROVE_HT " fmt "\n",		\
102 	    __func__, __LINE__, ##__VA_ARGS__);
103 
104 #define	MTAG_ABI_LKPI80211	1707696513	/* LinuxKPI 802.11 KBI */
105 
106 #ifdef LKPI_80211_USE_MTAG
107 /*
108  * Deferred RX path.
109  * We need to pass *ni along (and possibly more in the future so
110  * we use a struct right from the start.
111  */
112 #define	LKPI80211_TAG_RXNI	0		/* deferred RX path */
113 struct lkpi_80211_tag_rxni {
114 	struct ieee80211_node	*ni;		/* MUST hold a reference to it. */
115 };
116 #endif
117 
118 struct lkpi_radiotap_tx_hdr {
119 	struct ieee80211_radiotap_header wt_ihdr;
120 	uint8_t		wt_flags;
121 	uint8_t		wt_rate;
122 	uint16_t	wt_chan_freq;
123 	uint16_t	wt_chan_flags;
124 } __packed;
125 #define	LKPI_RTAP_TX_FLAGS_PRESENT					\
126 	((1 << IEEE80211_RADIOTAP_FLAGS) |				\
127 	 (1 << IEEE80211_RADIOTAP_RATE) |				\
128 	 (1 << IEEE80211_RADIOTAP_CHANNEL))
129 
130 struct lkpi_radiotap_rx_hdr {
131 	struct ieee80211_radiotap_header wr_ihdr;
132 	uint64_t	wr_tsft;
133 	uint8_t		wr_flags;
134 	uint8_t		wr_rate;
135 	uint16_t	wr_chan_freq;
136 	uint16_t	wr_chan_flags;
137 	int8_t		wr_dbm_antsignal;
138 	int8_t		wr_dbm_antnoise;
139 } __packed __aligned(8);
140 #define	LKPI_RTAP_RX_FLAGS_PRESENT					\
141 	((1 << IEEE80211_RADIOTAP_TSFT) |				\
142 	 (1 << IEEE80211_RADIOTAP_FLAGS) |				\
143 	 (1 << IEEE80211_RADIOTAP_RATE) |				\
144 	 (1 << IEEE80211_RADIOTAP_CHANNEL) |				\
145 	 (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |			\
146 	 (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE))
147 
148 struct lkpi_hw;
149 
150 struct lkpi_txq {
151 	TAILQ_ENTRY(lkpi_txq)	txq_entry;
152 
153 	struct mtx		ltxq_mtx;
154 	bool			seen_dequeue;
155 	bool			stopped;
156 	uint32_t		txq_generation;
157 	struct sk_buff_head	skbq;
158 	uint64_t		frms_enqueued;
159 	uint64_t		frms_dequeued;
160 	uint64_t		frms_tx;
161 
162 	/* Must be last! */
163 	struct ieee80211_txq	txq __aligned(CACHE_LINE_SIZE);
164 };
165 #define	TXQ_TO_LTXQ(_txq)	container_of(_txq, struct lkpi_txq, txq)
166 
167 
168 struct lkpi_sta {
169 	struct list_head	lsta_list;
170 	struct ieee80211_node	*ni;
171 	struct ieee80211_hw	*hw;		/* back pointer f. locking. */
172 
173 	/* Deferred TX path. */
174 	/* Eventually we might want to migrate this into net80211 entirely. */
175 	/* XXX-BZ can we use sta->txq[] instead directly? */
176 	struct task		txq_task;
177 	struct mbufq		txq;
178 	struct mtx		txq_mtx;
179 
180 	struct ieee80211_key_conf *kc[IEEE80211_WEP_NKID];
181 	enum ieee80211_sta_state state;
182 	bool			txq_ready;			/* Can we run the taskq? */
183 	bool			added_to_drv;			/* Driver knows; i.e. we called ...(). */
184 	bool			in_mgd;				/* XXX-BZ should this be per-vif? */
185 
186 	struct station_info	sinfo;				/* statistics */
187 	uint64_t		frms_tx;			/* (*tx) */
188 
189 	/* Must be last! */
190 	struct ieee80211_sta	sta __aligned(CACHE_LINE_SIZE);
191 };
192 #define	STA_TO_LSTA(_sta)	container_of(_sta, struct lkpi_sta, sta)
193 #define	LSTA_TO_STA(_lsta)	(&(_lsta)->sta)
194 
195 /* Either protected by wiphy lock or rcu for the list. */
196 struct lkpi_vif {
197         TAILQ_ENTRY(lkpi_vif)	lvif_entry;
198 	struct ieee80211vap	iv_vap;
199 	eventhandler_tag	lvif_ifllevent;
200 
201 	struct sysctl_ctx_list	sysctl_ctx;
202 
203 	struct mtx		mtx;
204 	struct wireless_dev	wdev;
205 
206 	/* Other local stuff. */
207 	int			(*iv_newstate)(struct ieee80211vap *,
208 				    enum ieee80211_state, int);
209 	struct ieee80211_node *	(*iv_update_bss)(struct ieee80211vap *,
210 				    struct ieee80211_node *);
211 	void			(*iv_recv_mgmt)(struct ieee80211_node *,
212 				    struct mbuf *, int,
213 				    const struct ieee80211_rx_stats *,
214 				    int, int);
215 	struct task		sw_scan_task;
216 
217 	struct list_head	lsta_list;
218 
219 	struct lkpi_sta		*lvif_bss;
220 
221 	struct ieee80211_node	*key_update_iv_bss;
222 	int			ic_unlocked;			/* Count of ic unlocks pending (*mo_set_key) */
223 	int			nt_unlocked;			/* Count of nt unlocks pending (*mo_set_key) */
224 	int			beacons;			/* # of beacons since assoc */
225 	bool			lvif_bss_synched;
226 	bool			added_to_drv;			/* Driver knows; i.e. we called add_interface(). */
227 
228 	bool			hw_queue_stopped[IEEE80211_NUM_ACS];
229 
230 	/* Must be last! */
231 	struct ieee80211_vif	vif __aligned(CACHE_LINE_SIZE);
232 };
233 #define	VAP_TO_LVIF(_vap)	container_of(_vap, struct lkpi_vif, iv_vap)
234 #define	LVIF_TO_VAP(_lvif)	(&(_lvif)->iv_vap)
235 #define	VIF_TO_LVIF(_vif)	container_of(_vif, struct lkpi_vif, vif)
236 #define	LVIF_TO_VIF(_lvif)	(&(_lvif)->vif)
237 
238 
239 struct lkpi_hw {	/* name it mac80211_sc? */
240 	const struct ieee80211_ops	*ops;
241 	struct ieee80211_scan_request	*hw_req;
242 	struct workqueue_struct		*workq;
243 
244 	/* FreeBSD specific compat. */
245 	/* Linux device is in hw.wiphy->dev after SET_IEEE80211_DEV(). */
246 	struct ieee80211com		*ic;
247 	struct lkpi_radiotap_tx_hdr	rtap_tx;
248 	struct lkpi_radiotap_rx_hdr	rtap_rx;
249 
250 	TAILQ_HEAD(, lkpi_vif)		lvif_head;
251 	struct sx			lvif_sx;
252 
253 	struct list_head		lchanctx_list;
254 	struct list_head		lchanctx_list_reserved;
255 	struct netdev_hw_addr_list	mc_list;
256 	unsigned int			mc_flags;
257 	struct sx			mc_sx;
258 
259 	struct cfg80211_chan_def	dflt_chandef;
260 	struct cfg80211_chan_def	scan_chandef;
261 
262 	struct mtx			txq_mtx;
263 	uint32_t			txq_generation[IEEE80211_NUM_ACS];
264 	spinlock_t			txq_scheduled_lock[IEEE80211_NUM_ACS];
265 	TAILQ_HEAD(, lkpi_txq)		txq_scheduled[IEEE80211_NUM_ACS];
266 	spinlock_t			txq_lock;
267 
268 	/* Deferred RX path. */
269 	struct task		rxq_task;
270 	struct mbufq		rxq;
271 	struct mtx		rxq_mtx;
272 
273 	/* Scan functions we overload to handle depending on scan mode. */
274 	void                    (*ic_scan_curchan)(struct ieee80211_scan_state *,
275 				    unsigned long);
276 	void                    (*ic_scan_mindwell)(struct ieee80211_scan_state *);
277 
278 	/* Node functions we overload to sync state. */
279 	struct ieee80211_node *	(*ic_node_alloc)(struct ieee80211vap *,
280 				    const uint8_t [IEEE80211_ADDR_LEN]);
281 	int			(*ic_node_init)(struct ieee80211_node *);
282 	void			(*ic_node_cleanup)(struct ieee80211_node *);
283 	void			(*ic_node_free)(struct ieee80211_node *);
284 
285 	/* HT and later functions. */
286 	int			(*ic_recv_action)(struct ieee80211_node *,
287 				    const struct ieee80211_frame *,
288 				    const uint8_t *, const uint8_t *);
289 	int			(*ic_send_action)(struct ieee80211_node *,
290 				    int, int, void *);
291 	int			(*ic_ampdu_enable)(struct ieee80211_node *,
292 				    struct ieee80211_tx_ampdu *);
293 	int			(*ic_addba_request)(struct ieee80211_node *,
294 				    struct ieee80211_tx_ampdu *, int, int, int);
295 	int			(*ic_addba_response)(struct ieee80211_node *,
296 				    struct ieee80211_tx_ampdu *, int, int, int);
297 	void			(*ic_addba_stop)(struct ieee80211_node *,
298 				    struct ieee80211_tx_ampdu *);
299 	void			(*ic_addba_response_timeout)(struct ieee80211_node *,
300 				    struct ieee80211_tx_ampdu *);
301 	void			(*ic_bar_response)(struct ieee80211_node *,
302 				    struct ieee80211_tx_ampdu *, int);
303 	int			(*ic_ampdu_rx_start)(struct ieee80211_node *,
304 				    struct ieee80211_rx_ampdu *, int, int, int);
305 	void			(*ic_ampdu_rx_stop)(struct ieee80211_node *,
306 				    struct ieee80211_rx_ampdu *);
307 
308 #define	LKPI_MAC80211_DRV_STARTED	0x00000001
309 	uint32_t			sc_flags;
310 #define	LKPI_LHW_SCAN_RUNNING		0x00000001
311 #define	LKPI_LHW_SCAN_HW		0x00000002
312 	uint32_t			scan_flags;
313 	struct mtx			scan_mtx;
314 
315 	int				supbands;	/* Number of supported bands. */
316 	int				max_rates;	/* Maximum number of bitrates supported in any channel. */
317 	int				scan_ie_len;	/* Length of common per-band scan IEs. */
318 
319 	bool				mc_all_multi;
320 	bool				update_wme;
321 	bool				rxq_stopped;
322 	bool				emulate_chanctx;
323 
324 	/* Must be last! */
325 	struct ieee80211_hw		hw __aligned(CACHE_LINE_SIZE);
326 };
327 #define	LHW_TO_HW(_lhw)		(&(_lhw)->hw)
328 #define	HW_TO_LHW(_hw)		container_of(_hw, struct lkpi_hw, hw)
329 
330 #define	LKPI_LHW_SCAN_BITS				\
331     "\010\1RUNING\2HW"
332 
333 struct lkpi_chanctx {
334 	struct list_head		entry;
335 
336 	bool				added_to_drv;	/* Managed by MO */
337 	struct lkpi_vif			*lvif;		/* Backpointer. */
338 
339 	struct ieee80211_chanctx_conf	chanctx_conf __aligned(CACHE_LINE_SIZE);
340 };
341 #define	LCHANCTX_TO_CHANCTX_CONF(_lchanctx)		\
342     (&(_lchanctx)->chanctx_conf)
343 #define	CHANCTX_CONF_TO_LCHANCTX(_conf)			\
344     container_of(_conf, struct lkpi_chanctx, chanctx_conf)
345 
346 struct lkpi_wiphy {
347 	const struct cfg80211_ops	*ops;
348 
349 	struct work_struct		wwk;
350 	struct list_head		wwk_list;
351 	struct mtx			wwk_mtx;
352 
353 	/* Must be last! */
354 	struct wiphy			wiphy __aligned(CACHE_LINE_SIZE);
355 };
356 #define	WIPHY_TO_LWIPHY(_wiphy)	container_of(_wiphy, struct lkpi_wiphy, wiphy)
357 #define	LWIPHY_TO_WIPHY(_lwiphy)	(&(_lwiphy)->wiphy)
358 
359 #define	LKPI_80211_LWIPHY_WORK_LOCK_INIT(_lwiphy)	\
360     mtx_init(&(_lwiphy)->wwk_mtx, "lwiphy-work", NULL, MTX_DEF);
361 #define	LKPI_80211_LWIPHY_WORK_LOCK_DESTROY(_lwiphy)	\
362     mtx_destroy(&(_lwiphy)->wwk_mtx)
363 #define	LKPI_80211_LWIPHY_WORK_LOCK(_lwiphy)		\
364     mtx_lock(&(_lwiphy)->wwk_mtx)
365 #define	LKPI_80211_LWIPHY_WORK_UNLOCK(_lwiphy)		\
366     mtx_unlock(&(_lwiphy)->wwk_mtx)
367 #define	LKPI_80211_LWIPHY_WORK_LOCK_ASSERT(_lwiphy)	\
368     mtx_assert(&(_lwiphy)->wwk_mtx, MA_OWNED)
369 #define	LKPI_80211_LWIPHY_WORK_UNLOCK_ASSERT(_lwiphy)	\
370     mtx_assert(&(_lwiphy)->wwk_mtx, MA_NOTOWNED)
371 
372 #define	LKPI_80211_LHW_SCAN_LOCK_INIT(_lhw)		\
373     mtx_init(&(_lhw)->scan_mtx, "lhw-scan", NULL, MTX_DEF | MTX_RECURSE);
374 #define	LKPI_80211_LHW_SCAN_LOCK_DESTROY(_lhw)		\
375     mtx_destroy(&(_lhw)->scan_mtx);
376 #define	LKPI_80211_LHW_SCAN_LOCK(_lhw)			\
377     mtx_lock(&(_lhw)->scan_mtx)
378 #define	LKPI_80211_LHW_SCAN_UNLOCK(_lhw)		\
379     mtx_unlock(&(_lhw)->scan_mtx)
380 #define	LKPI_80211_LHW_SCAN_LOCK_ASSERT(_lhw)		\
381     mtx_assert(&(_lhw)->scan_mtx, MA_OWNED)
382 #define	LKPI_80211_LHW_SCAN_UNLOCK_ASSERT(_lhw)		\
383     mtx_assert(&(_lhw)->scan_mtx, MA_NOTOWNED)
384 
385 #define	LKPI_80211_LHW_TXQ_LOCK_INIT(_lhw)		\
386     mtx_init(&(_lhw)->txq_mtx, "lhw-txq", NULL, MTX_DEF | MTX_RECURSE);
387 #define	LKPI_80211_LHW_TXQ_LOCK_DESTROY(_lhw)		\
388     mtx_destroy(&(_lhw)->txq_mtx);
389 #define	LKPI_80211_LHW_TXQ_LOCK(_lhw)			\
390     mtx_lock(&(_lhw)->txq_mtx)
391 #define	LKPI_80211_LHW_TXQ_UNLOCK(_lhw)			\
392     mtx_unlock(&(_lhw)->txq_mtx)
393 #define	LKPI_80211_LHW_TXQ_LOCK_ASSERT(_lhw)		\
394     mtx_assert(&(_lhw)->txq_mtx, MA_OWNED)
395 #define	LKPI_80211_LHW_TXQ_UNLOCK_ASSERT(_lhw)		\
396     mtx_assert(&(_lhw)->txq_mtx, MA_NOTOWNED)
397 
398 #define	LKPI_80211_LHW_RXQ_LOCK_INIT(_lhw)		\
399     mtx_init(&(_lhw)->rxq_mtx, "lhw-rxq", NULL, MTX_DEF | MTX_RECURSE);
400 #define	LKPI_80211_LHW_RXQ_LOCK_DESTROY(_lhw)		\
401     mtx_destroy(&(_lhw)->rxq_mtx);
402 #define	LKPI_80211_LHW_RXQ_LOCK(_lhw)			\
403     mtx_lock(&(_lhw)->rxq_mtx)
404 #define	LKPI_80211_LHW_RXQ_UNLOCK(_lhw)			\
405     mtx_unlock(&(_lhw)->rxq_mtx)
406 #define	LKPI_80211_LHW_RXQ_LOCK_ASSERT(_lhw)		\
407     mtx_assert(&(_lhw)->rxq_mtx, MA_OWNED)
408 #define	LKPI_80211_LHW_RXQ_UNLOCK_ASSERT(_lhw)		\
409     mtx_assert(&(_lhw)->rxq_mtx, MA_NOTOWNED)
410 
411 #define	LKPI_80211_LHW_LVIF_LOCK(_lhw)	sx_xlock(&(_lhw)->lvif_sx)
412 #define	LKPI_80211_LHW_LVIF_UNLOCK(_lhw) sx_xunlock(&(_lhw)->lvif_sx)
413 
414 #define	LKPI_80211_LHW_MC_LOCK_INIT(_lhw)		\
415     sx_init_flags(&lhw->mc_sx, "lhw-mc", 0);
416 #define	LKPI_80211_LHW_MC_LOCK_DESTROY(_lhw)		\
417     sx_destroy(&lhw->mc_sx);
418 #define	LKPI_80211_LHW_MC_LOCK(_lhw)	sx_xlock(&(_lhw)->mc_sx)
419 #define	LKPI_80211_LHW_MC_UNLOCK(_lhw)	sx_xunlock(&(_lhw)->mc_sx)
420 
421 #define	LKPI_80211_LVIF_LOCK(_lvif)	mtx_lock(&(_lvif)->mtx)
422 #define	LKPI_80211_LVIF_UNLOCK(_lvif)	mtx_unlock(&(_lvif)->mtx)
423 
424 #define	LKPI_80211_LSTA_TXQ_LOCK_INIT(_lsta)		\
425     mtx_init(&(_lsta)->txq_mtx, "lsta-txq", NULL, MTX_DEF);
426 #define	LKPI_80211_LSTA_TXQ_LOCK_DESTROY(_lsta)		\
427     mtx_destroy(&(_lsta)->txq_mtx);
428 #define	LKPI_80211_LSTA_TXQ_LOCK(_lsta)			\
429     mtx_lock(&(_lsta)->txq_mtx)
430 #define	LKPI_80211_LSTA_TXQ_UNLOCK(_lsta)		\
431     mtx_unlock(&(_lsta)->txq_mtx)
432 #define	LKPI_80211_LSTA_TXQ_LOCK_ASSERT(_lsta)		\
433     mtx_assert(&(_lsta)->txq_mtx, MA_OWNED)
434 #define	LKPI_80211_LSTA_TXQ_UNLOCK_ASSERT(_lsta)	\
435     mtx_assert(&(_lsta)->txq_mtx, MA_NOTOWNED)
436 
437 #define	LKPI_80211_LTXQ_LOCK_INIT(_ltxq)		\
438     mtx_init(&(_ltxq)->ltxq_mtx, "ltxq", NULL, MTX_DEF);
439 #define	LKPI_80211_LTXQ_LOCK_DESTROY(_ltxq)		\
440     mtx_destroy(&(_ltxq)->ltxq_mtx);
441 #define	LKPI_80211_LTXQ_LOCK(_ltxq)			\
442     mtx_lock(&(_ltxq)->ltxq_mtx)
443 #define	LKPI_80211_LTXQ_UNLOCK(_ltxq)			\
444     mtx_unlock(&(_ltxq)->ltxq_mtx)
445 #define	LKPI_80211_LTXQ_LOCK_ASSERT(_ltxq)		\
446     mtx_assert(&(_ltxq)->ltxq_mtx, MA_OWNED)
447 #define	LKPI_80211_LTXQ_UNLOCK_ASSERT(_ltxq)		\
448     mtx_assert(&(_ltxq)->ltxq_mtx, MA_NOTOWNED)
449 
450 int lkpi_80211_mo_start(struct ieee80211_hw *);
451 void lkpi_80211_mo_stop(struct ieee80211_hw *, bool);
452 int lkpi_80211_mo_get_antenna(struct ieee80211_hw *, u32 *, u32 *);
453 int lkpi_80211_mo_set_frag_threshold(struct ieee80211_hw *, uint32_t);
454 int lkpi_80211_mo_set_rts_threshold(struct ieee80211_hw *, uint32_t);
455 int lkpi_80211_mo_add_interface(struct ieee80211_hw *, struct ieee80211_vif *);
456 void lkpi_80211_mo_remove_interface(struct ieee80211_hw *, struct ieee80211_vif *);
457 int lkpi_80211_mo_hw_scan(struct ieee80211_hw *, struct ieee80211_vif *,
458     struct ieee80211_scan_request *);
459 void lkpi_80211_mo_cancel_hw_scan(struct ieee80211_hw *, struct ieee80211_vif *);
460 void lkpi_80211_mo_sw_scan_complete(struct ieee80211_hw *, struct ieee80211_vif *);
461 void lkpi_80211_mo_sw_scan_start(struct ieee80211_hw *, struct ieee80211_vif *,
462     const u8 *);
463 u64 lkpi_80211_mo_prepare_multicast(struct ieee80211_hw *,
464     struct netdev_hw_addr_list *);
465 void lkpi_80211_mo_configure_filter(struct ieee80211_hw *, unsigned int,
466     unsigned int *, u64);
467 int lkpi_80211_mo_sta_state(struct ieee80211_hw *, struct ieee80211_vif *,
468     struct lkpi_sta *, enum ieee80211_sta_state);
469 int lkpi_80211_mo_config(struct ieee80211_hw *, uint32_t);
470 int lkpi_80211_mo_assign_vif_chanctx(struct ieee80211_hw *, struct ieee80211_vif *,
471     struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *);
472 void lkpi_80211_mo_unassign_vif_chanctx(struct ieee80211_hw *, struct ieee80211_vif *,
473     struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *);
474 int lkpi_80211_mo_add_chanctx(struct ieee80211_hw *, struct ieee80211_chanctx_conf *);
475 void lkpi_80211_mo_change_chanctx(struct ieee80211_hw *,
476     struct ieee80211_chanctx_conf *, uint32_t);
477 void lkpi_80211_mo_remove_chanctx(struct ieee80211_hw *,
478     struct ieee80211_chanctx_conf *);
479 void lkpi_80211_mo_vif_cfg_changed(struct ieee80211_hw *, struct ieee80211_vif *,
480     uint64_t, bool);
481 void lkpi_80211_mo_link_info_changed(struct ieee80211_hw *, struct ieee80211_vif *,
482     struct ieee80211_bss_conf *, uint64_t, uint8_t, bool);
483 void lkpi_80211_mo_bss_info_changed(struct ieee80211_hw *, struct ieee80211_vif *,
484     struct ieee80211_bss_conf *, uint64_t);
485 int lkpi_80211_mo_conf_tx(struct ieee80211_hw *, struct ieee80211_vif *,
486     uint32_t, uint16_t, const struct ieee80211_tx_queue_params *);
487 void lkpi_80211_mo_flush(struct ieee80211_hw *, struct ieee80211_vif *,
488     uint32_t, bool);
489 void lkpi_80211_mo_mgd_prepare_tx(struct ieee80211_hw *, struct ieee80211_vif *,
490     struct ieee80211_prep_tx_info *);
491 void lkpi_80211_mo_mgd_complete_tx(struct ieee80211_hw *, struct ieee80211_vif *,
492     struct ieee80211_prep_tx_info *);
493 void lkpi_80211_mo_tx(struct ieee80211_hw *, struct ieee80211_tx_control *,
494     struct sk_buff *);
495 void lkpi_80211_mo_wake_tx_queue(struct ieee80211_hw *, struct ieee80211_txq *,
496     bool);
497 void lkpi_80211_mo_sync_rx_queues(struct ieee80211_hw *);
498 void lkpi_80211_mo_sta_pre_rcu_remove(struct ieee80211_hw *,
499     struct ieee80211_vif *, struct ieee80211_sta *);
500 int lkpi_80211_mo_set_key(struct ieee80211_hw *, enum set_key_cmd,
501     struct ieee80211_vif *, struct ieee80211_sta *,
502     struct ieee80211_key_conf *);
503 int lkpi_80211_mo_ampdu_action(struct ieee80211_hw *, struct ieee80211_vif *,
504     struct ieee80211_ampdu_params *);
505 int lkpi_80211_mo_sta_statistics(struct ieee80211_hw *, struct ieee80211_vif *,
506     struct ieee80211_sta *, struct station_info *);
507 
508 #endif	/* _LKPI_SRC_LINUX_80211_H */
509