1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun #ifndef __NET_CFG80211_H
3*4882a593Smuzhiyun #define __NET_CFG80211_H
4*4882a593Smuzhiyun /*
5*4882a593Smuzhiyun * 802.11 device and configuration interface
6*4882a593Smuzhiyun *
7*4882a593Smuzhiyun * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
8*4882a593Smuzhiyun * Copyright 2013-2014 Intel Mobile Communications GmbH
9*4882a593Smuzhiyun * Copyright 2015-2017 Intel Deutschland GmbH
10*4882a593Smuzhiyun * Copyright (C) 2018-2020 Intel Corporation
11*4882a593Smuzhiyun */
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun #include <linux/netdevice.h>
14*4882a593Smuzhiyun #include <linux/debugfs.h>
15*4882a593Smuzhiyun #include <linux/list.h>
16*4882a593Smuzhiyun #include <linux/bug.h>
17*4882a593Smuzhiyun #include <linux/netlink.h>
18*4882a593Smuzhiyun #include <linux/skbuff.h>
19*4882a593Smuzhiyun #include <linux/nl80211.h>
20*4882a593Smuzhiyun #include <linux/if_ether.h>
21*4882a593Smuzhiyun #include <linux/ieee80211.h>
22*4882a593Smuzhiyun #include <linux/net.h>
23*4882a593Smuzhiyun #include <linux/android_kabi.h>
24*4882a593Smuzhiyun #include <net/regulatory.h>
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun /**
27*4882a593Smuzhiyun * DOC: Introduction
28*4882a593Smuzhiyun *
29*4882a593Smuzhiyun * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
30*4882a593Smuzhiyun * userspace and drivers, and offers some utility functionality associated
31*4882a593Smuzhiyun * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
32*4882a593Smuzhiyun * by all modern wireless drivers in Linux, so that they offer a consistent
33*4882a593Smuzhiyun * API through nl80211. For backward compatibility, cfg80211 also offers
34*4882a593Smuzhiyun * wireless extensions to userspace, but hides them from drivers completely.
35*4882a593Smuzhiyun *
36*4882a593Smuzhiyun * Additionally, cfg80211 contains code to help enforce regulatory spectrum
37*4882a593Smuzhiyun * use restrictions.
38*4882a593Smuzhiyun */
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun /**
42*4882a593Smuzhiyun * DOC: Device registration
43*4882a593Smuzhiyun *
44*4882a593Smuzhiyun * In order for a driver to use cfg80211, it must register the hardware device
45*4882a593Smuzhiyun * with cfg80211. This happens through a number of hardware capability structs
46*4882a593Smuzhiyun * described below.
47*4882a593Smuzhiyun *
48*4882a593Smuzhiyun * The fundamental structure for each device is the 'wiphy', of which each
49*4882a593Smuzhiyun * instance describes a physical wireless device connected to the system. Each
50*4882a593Smuzhiyun * such wiphy can have zero, one, or many virtual interfaces associated with
51*4882a593Smuzhiyun * it, which need to be identified as such by pointing the network interface's
52*4882a593Smuzhiyun * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
53*4882a593Smuzhiyun * the wireless part of the interface, normally this struct is embedded in the
54*4882a593Smuzhiyun * network interface's private data area. Drivers can optionally allow creating
55*4882a593Smuzhiyun * or destroying virtual interfaces on the fly, but without at least one or the
56*4882a593Smuzhiyun * ability to create some the wireless device isn't useful.
57*4882a593Smuzhiyun *
58*4882a593Smuzhiyun * Each wiphy structure contains device capability information, and also has
59*4882a593Smuzhiyun * a pointer to the various operations the driver offers. The definitions and
60*4882a593Smuzhiyun * structures here describe these capabilities in detail.
61*4882a593Smuzhiyun */
62*4882a593Smuzhiyun
63*4882a593Smuzhiyun struct wiphy;
64*4882a593Smuzhiyun
65*4882a593Smuzhiyun /*
66*4882a593Smuzhiyun * wireless hardware capability structures
67*4882a593Smuzhiyun */
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun /**
70*4882a593Smuzhiyun * enum ieee80211_channel_flags - channel flags
71*4882a593Smuzhiyun *
72*4882a593Smuzhiyun * Channel flags set by the regulatory control code.
73*4882a593Smuzhiyun *
74*4882a593Smuzhiyun * @IEEE80211_CHAN_DISABLED: This channel is disabled.
75*4882a593Smuzhiyun * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
76*4882a593Smuzhiyun * sending probe requests or beaconing.
77*4882a593Smuzhiyun * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
78*4882a593Smuzhiyun * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
79*4882a593Smuzhiyun * is not permitted.
80*4882a593Smuzhiyun * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
81*4882a593Smuzhiyun * is not permitted.
82*4882a593Smuzhiyun * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
83*4882a593Smuzhiyun * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
84*4882a593Smuzhiyun * this flag indicates that an 80 MHz channel cannot use this
85*4882a593Smuzhiyun * channel as the control or any of the secondary channels.
86*4882a593Smuzhiyun * This may be due to the driver or due to regulatory bandwidth
87*4882a593Smuzhiyun * restrictions.
88*4882a593Smuzhiyun * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
89*4882a593Smuzhiyun * this flag indicates that an 160 MHz channel cannot use this
90*4882a593Smuzhiyun * channel as the control or any of the secondary channels.
91*4882a593Smuzhiyun * This may be due to the driver or due to regulatory bandwidth
92*4882a593Smuzhiyun * restrictions.
93*4882a593Smuzhiyun * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
94*4882a593Smuzhiyun * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
95*4882a593Smuzhiyun * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
96*4882a593Smuzhiyun * on this channel.
97*4882a593Smuzhiyun * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
98*4882a593Smuzhiyun * on this channel.
99*4882a593Smuzhiyun * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel.
100*4882a593Smuzhiyun * @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted
101*4882a593Smuzhiyun * on this channel.
102*4882a593Smuzhiyun * @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted
103*4882a593Smuzhiyun * on this channel.
104*4882a593Smuzhiyun * @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted
105*4882a593Smuzhiyun * on this channel.
106*4882a593Smuzhiyun * @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted
107*4882a593Smuzhiyun * on this channel.
108*4882a593Smuzhiyun * @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted
109*4882a593Smuzhiyun * on this channel.
110*4882a593Smuzhiyun *
111*4882a593Smuzhiyun */
112*4882a593Smuzhiyun enum ieee80211_channel_flags {
113*4882a593Smuzhiyun IEEE80211_CHAN_DISABLED = 1<<0,
114*4882a593Smuzhiyun IEEE80211_CHAN_NO_IR = 1<<1,
115*4882a593Smuzhiyun /* hole at 1<<2 */
116*4882a593Smuzhiyun IEEE80211_CHAN_RADAR = 1<<3,
117*4882a593Smuzhiyun IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
118*4882a593Smuzhiyun IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
119*4882a593Smuzhiyun IEEE80211_CHAN_NO_OFDM = 1<<6,
120*4882a593Smuzhiyun IEEE80211_CHAN_NO_80MHZ = 1<<7,
121*4882a593Smuzhiyun IEEE80211_CHAN_NO_160MHZ = 1<<8,
122*4882a593Smuzhiyun IEEE80211_CHAN_INDOOR_ONLY = 1<<9,
123*4882a593Smuzhiyun IEEE80211_CHAN_IR_CONCURRENT = 1<<10,
124*4882a593Smuzhiyun IEEE80211_CHAN_NO_20MHZ = 1<<11,
125*4882a593Smuzhiyun IEEE80211_CHAN_NO_10MHZ = 1<<12,
126*4882a593Smuzhiyun IEEE80211_CHAN_NO_HE = 1<<13,
127*4882a593Smuzhiyun IEEE80211_CHAN_1MHZ = 1<<14,
128*4882a593Smuzhiyun IEEE80211_CHAN_2MHZ = 1<<15,
129*4882a593Smuzhiyun IEEE80211_CHAN_4MHZ = 1<<16,
130*4882a593Smuzhiyun IEEE80211_CHAN_8MHZ = 1<<17,
131*4882a593Smuzhiyun IEEE80211_CHAN_16MHZ = 1<<18,
132*4882a593Smuzhiyun };
133*4882a593Smuzhiyun
134*4882a593Smuzhiyun #define IEEE80211_CHAN_NO_HT40 \
135*4882a593Smuzhiyun (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
136*4882a593Smuzhiyun
137*4882a593Smuzhiyun #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000
138*4882a593Smuzhiyun #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000)
139*4882a593Smuzhiyun
140*4882a593Smuzhiyun /**
141*4882a593Smuzhiyun * struct ieee80211_channel - channel definition
142*4882a593Smuzhiyun *
143*4882a593Smuzhiyun * This structure describes a single channel for use
144*4882a593Smuzhiyun * with cfg80211.
145*4882a593Smuzhiyun *
146*4882a593Smuzhiyun * @center_freq: center frequency in MHz
147*4882a593Smuzhiyun * @freq_offset: offset from @center_freq, in KHz
148*4882a593Smuzhiyun * @hw_value: hardware-specific value for the channel
149*4882a593Smuzhiyun * @flags: channel flags from &enum ieee80211_channel_flags.
150*4882a593Smuzhiyun * @orig_flags: channel flags at registration time, used by regulatory
151*4882a593Smuzhiyun * code to support devices with additional restrictions
152*4882a593Smuzhiyun * @band: band this channel belongs to.
153*4882a593Smuzhiyun * @max_antenna_gain: maximum antenna gain in dBi
154*4882a593Smuzhiyun * @max_power: maximum transmission power (in dBm)
155*4882a593Smuzhiyun * @max_reg_power: maximum regulatory transmission power (in dBm)
156*4882a593Smuzhiyun * @beacon_found: helper to regulatory code to indicate when a beacon
157*4882a593Smuzhiyun * has been found on this channel. Use regulatory_hint_found_beacon()
158*4882a593Smuzhiyun * to enable this, this is useful only on 5 GHz band.
159*4882a593Smuzhiyun * @orig_mag: internal use
160*4882a593Smuzhiyun * @orig_mpwr: internal use
161*4882a593Smuzhiyun * @dfs_state: current state of this channel. Only relevant if radar is required
162*4882a593Smuzhiyun * on this channel.
163*4882a593Smuzhiyun * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
164*4882a593Smuzhiyun * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
165*4882a593Smuzhiyun */
166*4882a593Smuzhiyun struct ieee80211_channel {
167*4882a593Smuzhiyun enum nl80211_band band;
168*4882a593Smuzhiyun u32 center_freq;
169*4882a593Smuzhiyun u16 freq_offset;
170*4882a593Smuzhiyun u16 hw_value;
171*4882a593Smuzhiyun u32 flags;
172*4882a593Smuzhiyun int max_antenna_gain;
173*4882a593Smuzhiyun int max_power;
174*4882a593Smuzhiyun int max_reg_power;
175*4882a593Smuzhiyun bool beacon_found;
176*4882a593Smuzhiyun u32 orig_flags;
177*4882a593Smuzhiyun int orig_mag, orig_mpwr;
178*4882a593Smuzhiyun enum nl80211_dfs_state dfs_state;
179*4882a593Smuzhiyun unsigned long dfs_state_entered;
180*4882a593Smuzhiyun unsigned int dfs_cac_ms;
181*4882a593Smuzhiyun };
182*4882a593Smuzhiyun
183*4882a593Smuzhiyun /**
184*4882a593Smuzhiyun * enum ieee80211_rate_flags - rate flags
185*4882a593Smuzhiyun *
186*4882a593Smuzhiyun * Hardware/specification flags for rates. These are structured
187*4882a593Smuzhiyun * in a way that allows using the same bitrate structure for
188*4882a593Smuzhiyun * different bands/PHY modes.
189*4882a593Smuzhiyun *
190*4882a593Smuzhiyun * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
191*4882a593Smuzhiyun * preamble on this bitrate; only relevant in 2.4GHz band and
192*4882a593Smuzhiyun * with CCK rates.
193*4882a593Smuzhiyun * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
194*4882a593Smuzhiyun * when used with 802.11a (on the 5 GHz band); filled by the
195*4882a593Smuzhiyun * core code when registering the wiphy.
196*4882a593Smuzhiyun * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
197*4882a593Smuzhiyun * when used with 802.11b (on the 2.4 GHz band); filled by the
198*4882a593Smuzhiyun * core code when registering the wiphy.
199*4882a593Smuzhiyun * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
200*4882a593Smuzhiyun * when used with 802.11g (on the 2.4 GHz band); filled by the
201*4882a593Smuzhiyun * core code when registering the wiphy.
202*4882a593Smuzhiyun * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
203*4882a593Smuzhiyun * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
204*4882a593Smuzhiyun * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
205*4882a593Smuzhiyun */
206*4882a593Smuzhiyun enum ieee80211_rate_flags {
207*4882a593Smuzhiyun IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
208*4882a593Smuzhiyun IEEE80211_RATE_MANDATORY_A = 1<<1,
209*4882a593Smuzhiyun IEEE80211_RATE_MANDATORY_B = 1<<2,
210*4882a593Smuzhiyun IEEE80211_RATE_MANDATORY_G = 1<<3,
211*4882a593Smuzhiyun IEEE80211_RATE_ERP_G = 1<<4,
212*4882a593Smuzhiyun IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5,
213*4882a593Smuzhiyun IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6,
214*4882a593Smuzhiyun };
215*4882a593Smuzhiyun
216*4882a593Smuzhiyun /**
217*4882a593Smuzhiyun * enum ieee80211_bss_type - BSS type filter
218*4882a593Smuzhiyun *
219*4882a593Smuzhiyun * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
220*4882a593Smuzhiyun * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
221*4882a593Smuzhiyun * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
222*4882a593Smuzhiyun * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
223*4882a593Smuzhiyun * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
224*4882a593Smuzhiyun */
225*4882a593Smuzhiyun enum ieee80211_bss_type {
226*4882a593Smuzhiyun IEEE80211_BSS_TYPE_ESS,
227*4882a593Smuzhiyun IEEE80211_BSS_TYPE_PBSS,
228*4882a593Smuzhiyun IEEE80211_BSS_TYPE_IBSS,
229*4882a593Smuzhiyun IEEE80211_BSS_TYPE_MBSS,
230*4882a593Smuzhiyun IEEE80211_BSS_TYPE_ANY
231*4882a593Smuzhiyun };
232*4882a593Smuzhiyun
233*4882a593Smuzhiyun /**
234*4882a593Smuzhiyun * enum ieee80211_privacy - BSS privacy filter
235*4882a593Smuzhiyun *
236*4882a593Smuzhiyun * @IEEE80211_PRIVACY_ON: privacy bit set
237*4882a593Smuzhiyun * @IEEE80211_PRIVACY_OFF: privacy bit clear
238*4882a593Smuzhiyun * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
239*4882a593Smuzhiyun */
240*4882a593Smuzhiyun enum ieee80211_privacy {
241*4882a593Smuzhiyun IEEE80211_PRIVACY_ON,
242*4882a593Smuzhiyun IEEE80211_PRIVACY_OFF,
243*4882a593Smuzhiyun IEEE80211_PRIVACY_ANY
244*4882a593Smuzhiyun };
245*4882a593Smuzhiyun
246*4882a593Smuzhiyun #define IEEE80211_PRIVACY(x) \
247*4882a593Smuzhiyun ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
248*4882a593Smuzhiyun
249*4882a593Smuzhiyun /**
250*4882a593Smuzhiyun * struct ieee80211_rate - bitrate definition
251*4882a593Smuzhiyun *
252*4882a593Smuzhiyun * This structure describes a bitrate that an 802.11 PHY can
253*4882a593Smuzhiyun * operate with. The two values @hw_value and @hw_value_short
254*4882a593Smuzhiyun * are only for driver use when pointers to this structure are
255*4882a593Smuzhiyun * passed around.
256*4882a593Smuzhiyun *
257*4882a593Smuzhiyun * @flags: rate-specific flags
258*4882a593Smuzhiyun * @bitrate: bitrate in units of 100 Kbps
259*4882a593Smuzhiyun * @hw_value: driver/hardware value for this rate
260*4882a593Smuzhiyun * @hw_value_short: driver/hardware value for this rate when
261*4882a593Smuzhiyun * short preamble is used
262*4882a593Smuzhiyun */
263*4882a593Smuzhiyun struct ieee80211_rate {
264*4882a593Smuzhiyun u32 flags;
265*4882a593Smuzhiyun u16 bitrate;
266*4882a593Smuzhiyun u16 hw_value, hw_value_short;
267*4882a593Smuzhiyun };
268*4882a593Smuzhiyun
269*4882a593Smuzhiyun /**
270*4882a593Smuzhiyun * struct ieee80211_he_obss_pd - AP settings for spatial reuse
271*4882a593Smuzhiyun *
272*4882a593Smuzhiyun * @enable: is the feature enabled.
273*4882a593Smuzhiyun * @sr_ctrl: The SR Control field of SRP element.
274*4882a593Smuzhiyun * @non_srg_max_offset: non-SRG maximum tx power offset
275*4882a593Smuzhiyun * @min_offset: minimal tx power offset an associated station shall use
276*4882a593Smuzhiyun * @max_offset: maximum tx power offset an associated station shall use
277*4882a593Smuzhiyun * @bss_color_bitmap: bitmap that indicates the BSS color values used by
278*4882a593Smuzhiyun * members of the SRG
279*4882a593Smuzhiyun * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values
280*4882a593Smuzhiyun * used by members of the SRG
281*4882a593Smuzhiyun */
282*4882a593Smuzhiyun struct ieee80211_he_obss_pd {
283*4882a593Smuzhiyun bool enable;
284*4882a593Smuzhiyun u8 sr_ctrl;
285*4882a593Smuzhiyun u8 non_srg_max_offset;
286*4882a593Smuzhiyun u8 min_offset;
287*4882a593Smuzhiyun u8 max_offset;
288*4882a593Smuzhiyun u8 bss_color_bitmap[8];
289*4882a593Smuzhiyun u8 partial_bssid_bitmap[8];
290*4882a593Smuzhiyun };
291*4882a593Smuzhiyun
292*4882a593Smuzhiyun /**
293*4882a593Smuzhiyun * struct cfg80211_he_bss_color - AP settings for BSS coloring
294*4882a593Smuzhiyun *
295*4882a593Smuzhiyun * @color: the current color.
296*4882a593Smuzhiyun * @enabled: HE BSS color is used
297*4882a593Smuzhiyun * @partial: define the AID equation.
298*4882a593Smuzhiyun */
299*4882a593Smuzhiyun struct cfg80211_he_bss_color {
300*4882a593Smuzhiyun u8 color;
301*4882a593Smuzhiyun bool enabled;
302*4882a593Smuzhiyun bool partial;
303*4882a593Smuzhiyun };
304*4882a593Smuzhiyun
305*4882a593Smuzhiyun /**
306*4882a593Smuzhiyun * struct ieee80211_he_bss_color - AP settings for BSS coloring
307*4882a593Smuzhiyun *
308*4882a593Smuzhiyun * @color: the current color.
309*4882a593Smuzhiyun * @disabled: is the feature disabled.
310*4882a593Smuzhiyun * @partial: define the AID equation.
311*4882a593Smuzhiyun */
312*4882a593Smuzhiyun struct ieee80211_he_bss_color {
313*4882a593Smuzhiyun u8 color;
314*4882a593Smuzhiyun bool disabled;
315*4882a593Smuzhiyun bool partial;
316*4882a593Smuzhiyun };
317*4882a593Smuzhiyun
318*4882a593Smuzhiyun /**
319*4882a593Smuzhiyun * struct ieee80211_sta_ht_cap - STA's HT capabilities
320*4882a593Smuzhiyun *
321*4882a593Smuzhiyun * This structure describes most essential parameters needed
322*4882a593Smuzhiyun * to describe 802.11n HT capabilities for an STA.
323*4882a593Smuzhiyun *
324*4882a593Smuzhiyun * @ht_supported: is HT supported by the STA
325*4882a593Smuzhiyun * @cap: HT capabilities map as described in 802.11n spec
326*4882a593Smuzhiyun * @ampdu_factor: Maximum A-MPDU length factor
327*4882a593Smuzhiyun * @ampdu_density: Minimum A-MPDU spacing
328*4882a593Smuzhiyun * @mcs: Supported MCS rates
329*4882a593Smuzhiyun */
330*4882a593Smuzhiyun struct ieee80211_sta_ht_cap {
331*4882a593Smuzhiyun u16 cap; /* use IEEE80211_HT_CAP_ */
332*4882a593Smuzhiyun bool ht_supported;
333*4882a593Smuzhiyun u8 ampdu_factor;
334*4882a593Smuzhiyun u8 ampdu_density;
335*4882a593Smuzhiyun struct ieee80211_mcs_info mcs;
336*4882a593Smuzhiyun };
337*4882a593Smuzhiyun
338*4882a593Smuzhiyun /**
339*4882a593Smuzhiyun * struct ieee80211_sta_vht_cap - STA's VHT capabilities
340*4882a593Smuzhiyun *
341*4882a593Smuzhiyun * This structure describes most essential parameters needed
342*4882a593Smuzhiyun * to describe 802.11ac VHT capabilities for an STA.
343*4882a593Smuzhiyun *
344*4882a593Smuzhiyun * @vht_supported: is VHT supported by the STA
345*4882a593Smuzhiyun * @cap: VHT capabilities map as described in 802.11ac spec
346*4882a593Smuzhiyun * @vht_mcs: Supported VHT MCS rates
347*4882a593Smuzhiyun */
348*4882a593Smuzhiyun struct ieee80211_sta_vht_cap {
349*4882a593Smuzhiyun bool vht_supported;
350*4882a593Smuzhiyun u32 cap; /* use IEEE80211_VHT_CAP_ */
351*4882a593Smuzhiyun struct ieee80211_vht_mcs_info vht_mcs;
352*4882a593Smuzhiyun };
353*4882a593Smuzhiyun
354*4882a593Smuzhiyun #define IEEE80211_HE_PPE_THRES_MAX_LEN 25
355*4882a593Smuzhiyun
356*4882a593Smuzhiyun /**
357*4882a593Smuzhiyun * struct ieee80211_sta_he_cap - STA's HE capabilities
358*4882a593Smuzhiyun *
359*4882a593Smuzhiyun * This structure describes most essential parameters needed
360*4882a593Smuzhiyun * to describe 802.11ax HE capabilities for a STA.
361*4882a593Smuzhiyun *
362*4882a593Smuzhiyun * @has_he: true iff HE data is valid.
363*4882a593Smuzhiyun * @he_cap_elem: Fixed portion of the HE capabilities element.
364*4882a593Smuzhiyun * @he_mcs_nss_supp: The supported NSS/MCS combinations.
365*4882a593Smuzhiyun * @ppe_thres: Holds the PPE Thresholds data.
366*4882a593Smuzhiyun */
367*4882a593Smuzhiyun struct ieee80211_sta_he_cap {
368*4882a593Smuzhiyun bool has_he;
369*4882a593Smuzhiyun struct ieee80211_he_cap_elem he_cap_elem;
370*4882a593Smuzhiyun struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
371*4882a593Smuzhiyun u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
372*4882a593Smuzhiyun };
373*4882a593Smuzhiyun
374*4882a593Smuzhiyun /**
375*4882a593Smuzhiyun * struct ieee80211_sband_iftype_data
376*4882a593Smuzhiyun *
377*4882a593Smuzhiyun * This structure encapsulates sband data that is relevant for the
378*4882a593Smuzhiyun * interface types defined in @types_mask. Each type in the
379*4882a593Smuzhiyun * @types_mask must be unique across all instances of iftype_data.
380*4882a593Smuzhiyun *
381*4882a593Smuzhiyun * @types_mask: interface types mask
382*4882a593Smuzhiyun * @he_cap: holds the HE capabilities
383*4882a593Smuzhiyun * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
384*4882a593Smuzhiyun * 6 GHz band channel (and 0 may be valid value).
385*4882a593Smuzhiyun */
386*4882a593Smuzhiyun struct ieee80211_sband_iftype_data {
387*4882a593Smuzhiyun u16 types_mask;
388*4882a593Smuzhiyun struct ieee80211_sta_he_cap he_cap;
389*4882a593Smuzhiyun struct ieee80211_he_6ghz_capa he_6ghz_capa;
390*4882a593Smuzhiyun };
391*4882a593Smuzhiyun
392*4882a593Smuzhiyun /**
393*4882a593Smuzhiyun * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
394*4882a593Smuzhiyun *
395*4882a593Smuzhiyun * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
396*4882a593Smuzhiyun * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
397*4882a593Smuzhiyun * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
398*4882a593Smuzhiyun * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
399*4882a593Smuzhiyun * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
400*4882a593Smuzhiyun * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
401*4882a593Smuzhiyun * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
402*4882a593Smuzhiyun * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
403*4882a593Smuzhiyun * 2.16GHz+2.16GHz
404*4882a593Smuzhiyun * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
405*4882a593Smuzhiyun * 4.32GHz + 4.32GHz
406*4882a593Smuzhiyun * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
407*4882a593Smuzhiyun * 4.32GHz + 4.32GHz
408*4882a593Smuzhiyun * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
409*4882a593Smuzhiyun * and 4.32GHz + 4.32GHz
410*4882a593Smuzhiyun * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
411*4882a593Smuzhiyun * 2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
412*4882a593Smuzhiyun */
413*4882a593Smuzhiyun enum ieee80211_edmg_bw_config {
414*4882a593Smuzhiyun IEEE80211_EDMG_BW_CONFIG_4 = 4,
415*4882a593Smuzhiyun IEEE80211_EDMG_BW_CONFIG_5 = 5,
416*4882a593Smuzhiyun IEEE80211_EDMG_BW_CONFIG_6 = 6,
417*4882a593Smuzhiyun IEEE80211_EDMG_BW_CONFIG_7 = 7,
418*4882a593Smuzhiyun IEEE80211_EDMG_BW_CONFIG_8 = 8,
419*4882a593Smuzhiyun IEEE80211_EDMG_BW_CONFIG_9 = 9,
420*4882a593Smuzhiyun IEEE80211_EDMG_BW_CONFIG_10 = 10,
421*4882a593Smuzhiyun IEEE80211_EDMG_BW_CONFIG_11 = 11,
422*4882a593Smuzhiyun IEEE80211_EDMG_BW_CONFIG_12 = 12,
423*4882a593Smuzhiyun IEEE80211_EDMG_BW_CONFIG_13 = 13,
424*4882a593Smuzhiyun IEEE80211_EDMG_BW_CONFIG_14 = 14,
425*4882a593Smuzhiyun IEEE80211_EDMG_BW_CONFIG_15 = 15,
426*4882a593Smuzhiyun };
427*4882a593Smuzhiyun
428*4882a593Smuzhiyun /**
429*4882a593Smuzhiyun * struct ieee80211_edmg - EDMG configuration
430*4882a593Smuzhiyun *
431*4882a593Smuzhiyun * This structure describes most essential parameters needed
432*4882a593Smuzhiyun * to describe 802.11ay EDMG configuration
433*4882a593Smuzhiyun *
434*4882a593Smuzhiyun * @channels: bitmap that indicates the 2.16 GHz channel(s)
435*4882a593Smuzhiyun * that are allowed to be used for transmissions.
436*4882a593Smuzhiyun * Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
437*4882a593Smuzhiyun * Set to 0 indicate EDMG not supported.
438*4882a593Smuzhiyun * @bw_config: Channel BW Configuration subfield encodes
439*4882a593Smuzhiyun * the allowed channel bandwidth configurations
440*4882a593Smuzhiyun */
441*4882a593Smuzhiyun struct ieee80211_edmg {
442*4882a593Smuzhiyun u8 channels;
443*4882a593Smuzhiyun enum ieee80211_edmg_bw_config bw_config;
444*4882a593Smuzhiyun };
445*4882a593Smuzhiyun
446*4882a593Smuzhiyun /**
447*4882a593Smuzhiyun * struct ieee80211_sta_s1g_cap - STA's S1G capabilities
448*4882a593Smuzhiyun *
449*4882a593Smuzhiyun * This structure describes most essential parameters needed
450*4882a593Smuzhiyun * to describe 802.11ah S1G capabilities for a STA.
451*4882a593Smuzhiyun *
452*4882a593Smuzhiyun * @s1g_supported: is STA an S1G STA
453*4882a593Smuzhiyun * @cap: S1G capabilities information
454*4882a593Smuzhiyun * @nss_mcs: Supported NSS MCS set
455*4882a593Smuzhiyun */
456*4882a593Smuzhiyun struct ieee80211_sta_s1g_cap {
457*4882a593Smuzhiyun bool s1g;
458*4882a593Smuzhiyun u8 cap[10]; /* use S1G_CAPAB_ */
459*4882a593Smuzhiyun u8 nss_mcs[5];
460*4882a593Smuzhiyun };
461*4882a593Smuzhiyun
462*4882a593Smuzhiyun /**
463*4882a593Smuzhiyun * struct ieee80211_supported_band - frequency band definition
464*4882a593Smuzhiyun *
465*4882a593Smuzhiyun * This structure describes a frequency band a wiphy
466*4882a593Smuzhiyun * is able to operate in.
467*4882a593Smuzhiyun *
468*4882a593Smuzhiyun * @channels: Array of channels the hardware can operate with
469*4882a593Smuzhiyun * in this band.
470*4882a593Smuzhiyun * @band: the band this structure represents
471*4882a593Smuzhiyun * @n_channels: Number of channels in @channels
472*4882a593Smuzhiyun * @bitrates: Array of bitrates the hardware can operate with
473*4882a593Smuzhiyun * in this band. Must be sorted to give a valid "supported
474*4882a593Smuzhiyun * rates" IE, i.e. CCK rates first, then OFDM.
475*4882a593Smuzhiyun * @n_bitrates: Number of bitrates in @bitrates
476*4882a593Smuzhiyun * @ht_cap: HT capabilities in this band
477*4882a593Smuzhiyun * @vht_cap: VHT capabilities in this band
478*4882a593Smuzhiyun * @s1g_cap: S1G capabilities in this band
479*4882a593Smuzhiyun * @edmg_cap: EDMG capabilities in this band
480*4882a593Smuzhiyun * @s1g_cap: S1G capabilities in this band (S1B band only, of course)
481*4882a593Smuzhiyun * @n_iftype_data: number of iftype data entries
482*4882a593Smuzhiyun * @iftype_data: interface type data entries. Note that the bits in
483*4882a593Smuzhiyun * @types_mask inside this structure cannot overlap (i.e. only
484*4882a593Smuzhiyun * one occurrence of each type is allowed across all instances of
485*4882a593Smuzhiyun * iftype_data).
486*4882a593Smuzhiyun */
487*4882a593Smuzhiyun struct ieee80211_supported_band {
488*4882a593Smuzhiyun struct ieee80211_channel *channels;
489*4882a593Smuzhiyun struct ieee80211_rate *bitrates;
490*4882a593Smuzhiyun enum nl80211_band band;
491*4882a593Smuzhiyun int n_channels;
492*4882a593Smuzhiyun int n_bitrates;
493*4882a593Smuzhiyun struct ieee80211_sta_ht_cap ht_cap;
494*4882a593Smuzhiyun struct ieee80211_sta_vht_cap vht_cap;
495*4882a593Smuzhiyun struct ieee80211_sta_s1g_cap s1g_cap;
496*4882a593Smuzhiyun struct ieee80211_edmg edmg_cap;
497*4882a593Smuzhiyun u16 n_iftype_data;
498*4882a593Smuzhiyun const struct ieee80211_sband_iftype_data *iftype_data;
499*4882a593Smuzhiyun };
500*4882a593Smuzhiyun
501*4882a593Smuzhiyun /**
502*4882a593Smuzhiyun * ieee80211_get_sband_iftype_data - return sband data for a given iftype
503*4882a593Smuzhiyun * @sband: the sband to search for the STA on
504*4882a593Smuzhiyun * @iftype: enum nl80211_iftype
505*4882a593Smuzhiyun *
506*4882a593Smuzhiyun * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
507*4882a593Smuzhiyun */
508*4882a593Smuzhiyun static inline const struct ieee80211_sband_iftype_data *
ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band * sband,u8 iftype)509*4882a593Smuzhiyun ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
510*4882a593Smuzhiyun u8 iftype)
511*4882a593Smuzhiyun {
512*4882a593Smuzhiyun int i;
513*4882a593Smuzhiyun
514*4882a593Smuzhiyun if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
515*4882a593Smuzhiyun return NULL;
516*4882a593Smuzhiyun
517*4882a593Smuzhiyun for (i = 0; i < sband->n_iftype_data; i++) {
518*4882a593Smuzhiyun const struct ieee80211_sband_iftype_data *data =
519*4882a593Smuzhiyun &sband->iftype_data[i];
520*4882a593Smuzhiyun
521*4882a593Smuzhiyun if (data->types_mask & BIT(iftype))
522*4882a593Smuzhiyun return data;
523*4882a593Smuzhiyun }
524*4882a593Smuzhiyun
525*4882a593Smuzhiyun return NULL;
526*4882a593Smuzhiyun }
527*4882a593Smuzhiyun
528*4882a593Smuzhiyun /**
529*4882a593Smuzhiyun * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
530*4882a593Smuzhiyun * @sband: the sband to search for the iftype on
531*4882a593Smuzhiyun * @iftype: enum nl80211_iftype
532*4882a593Smuzhiyun *
533*4882a593Smuzhiyun * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
534*4882a593Smuzhiyun */
535*4882a593Smuzhiyun static inline const struct ieee80211_sta_he_cap *
ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band * sband,u8 iftype)536*4882a593Smuzhiyun ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
537*4882a593Smuzhiyun u8 iftype)
538*4882a593Smuzhiyun {
539*4882a593Smuzhiyun const struct ieee80211_sband_iftype_data *data =
540*4882a593Smuzhiyun ieee80211_get_sband_iftype_data(sband, iftype);
541*4882a593Smuzhiyun
542*4882a593Smuzhiyun if (data && data->he_cap.has_he)
543*4882a593Smuzhiyun return &data->he_cap;
544*4882a593Smuzhiyun
545*4882a593Smuzhiyun return NULL;
546*4882a593Smuzhiyun }
547*4882a593Smuzhiyun
548*4882a593Smuzhiyun /**
549*4882a593Smuzhiyun * ieee80211_get_he_sta_cap - return HE capabilities for an sband's STA
550*4882a593Smuzhiyun * @sband: the sband to search for the STA on
551*4882a593Smuzhiyun *
552*4882a593Smuzhiyun * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
553*4882a593Smuzhiyun */
554*4882a593Smuzhiyun static inline const struct ieee80211_sta_he_cap *
ieee80211_get_he_sta_cap(const struct ieee80211_supported_band * sband)555*4882a593Smuzhiyun ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband)
556*4882a593Smuzhiyun {
557*4882a593Smuzhiyun return ieee80211_get_he_iftype_cap(sband, NL80211_IFTYPE_STATION);
558*4882a593Smuzhiyun }
559*4882a593Smuzhiyun
560*4882a593Smuzhiyun /**
561*4882a593Smuzhiyun * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities
562*4882a593Smuzhiyun * @sband: the sband to search for the STA on
563*4882a593Smuzhiyun * @iftype: the iftype to search for
564*4882a593Smuzhiyun *
565*4882a593Smuzhiyun * Return: the 6GHz capabilities
566*4882a593Smuzhiyun */
567*4882a593Smuzhiyun static inline __le16
ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band * sband,enum nl80211_iftype iftype)568*4882a593Smuzhiyun ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
569*4882a593Smuzhiyun enum nl80211_iftype iftype)
570*4882a593Smuzhiyun {
571*4882a593Smuzhiyun const struct ieee80211_sband_iftype_data *data =
572*4882a593Smuzhiyun ieee80211_get_sband_iftype_data(sband, iftype);
573*4882a593Smuzhiyun
574*4882a593Smuzhiyun if (WARN_ON(!data || !data->he_cap.has_he))
575*4882a593Smuzhiyun return 0;
576*4882a593Smuzhiyun
577*4882a593Smuzhiyun return data->he_6ghz_capa.capa;
578*4882a593Smuzhiyun }
579*4882a593Smuzhiyun
580*4882a593Smuzhiyun /**
581*4882a593Smuzhiyun * wiphy_read_of_freq_limits - read frequency limits from device tree
582*4882a593Smuzhiyun *
583*4882a593Smuzhiyun * @wiphy: the wireless device to get extra limits for
584*4882a593Smuzhiyun *
585*4882a593Smuzhiyun * Some devices may have extra limitations specified in DT. This may be useful
586*4882a593Smuzhiyun * for chipsets that normally support more bands but are limited due to board
587*4882a593Smuzhiyun * design (e.g. by antennas or external power amplifier).
588*4882a593Smuzhiyun *
589*4882a593Smuzhiyun * This function reads info from DT and uses it to *modify* channels (disable
590*4882a593Smuzhiyun * unavailable ones). It's usually a *bad* idea to use it in drivers with
591*4882a593Smuzhiyun * shared channel data as DT limitations are device specific. You should make
592*4882a593Smuzhiyun * sure to call it only if channels in wiphy are copied and can be modified
593*4882a593Smuzhiyun * without affecting other devices.
594*4882a593Smuzhiyun *
595*4882a593Smuzhiyun * As this function access device node it has to be called after set_wiphy_dev.
596*4882a593Smuzhiyun * It also modifies channels so they have to be set first.
597*4882a593Smuzhiyun * If using this helper, call it before wiphy_register().
598*4882a593Smuzhiyun */
599*4882a593Smuzhiyun #ifdef CONFIG_OF
600*4882a593Smuzhiyun void wiphy_read_of_freq_limits(struct wiphy *wiphy);
601*4882a593Smuzhiyun #else /* CONFIG_OF */
wiphy_read_of_freq_limits(struct wiphy * wiphy)602*4882a593Smuzhiyun static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
603*4882a593Smuzhiyun {
604*4882a593Smuzhiyun }
605*4882a593Smuzhiyun #endif /* !CONFIG_OF */
606*4882a593Smuzhiyun
607*4882a593Smuzhiyun
608*4882a593Smuzhiyun /*
609*4882a593Smuzhiyun * Wireless hardware/device configuration structures and methods
610*4882a593Smuzhiyun */
611*4882a593Smuzhiyun
612*4882a593Smuzhiyun /**
613*4882a593Smuzhiyun * DOC: Actions and configuration
614*4882a593Smuzhiyun *
615*4882a593Smuzhiyun * Each wireless device and each virtual interface offer a set of configuration
616*4882a593Smuzhiyun * operations and other actions that are invoked by userspace. Each of these
617*4882a593Smuzhiyun * actions is described in the operations structure, and the parameters these
618*4882a593Smuzhiyun * operations use are described separately.
619*4882a593Smuzhiyun *
620*4882a593Smuzhiyun * Additionally, some operations are asynchronous and expect to get status
621*4882a593Smuzhiyun * information via some functions that drivers need to call.
622*4882a593Smuzhiyun *
623*4882a593Smuzhiyun * Scanning and BSS list handling with its associated functionality is described
624*4882a593Smuzhiyun * in a separate chapter.
625*4882a593Smuzhiyun */
626*4882a593Smuzhiyun
627*4882a593Smuzhiyun #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
628*4882a593Smuzhiyun WLAN_USER_POSITION_LEN)
629*4882a593Smuzhiyun
630*4882a593Smuzhiyun /**
631*4882a593Smuzhiyun * struct vif_params - describes virtual interface parameters
632*4882a593Smuzhiyun * @flags: monitor interface flags, unchanged if 0, otherwise
633*4882a593Smuzhiyun * %MONITOR_FLAG_CHANGED will be set
634*4882a593Smuzhiyun * @use_4addr: use 4-address frames
635*4882a593Smuzhiyun * @macaddr: address to use for this virtual interface.
636*4882a593Smuzhiyun * If this parameter is set to zero address the driver may
637*4882a593Smuzhiyun * determine the address as needed.
638*4882a593Smuzhiyun * This feature is only fully supported by drivers that enable the
639*4882a593Smuzhiyun * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating
640*4882a593Smuzhiyun ** only p2p devices with specified MAC.
641*4882a593Smuzhiyun * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
642*4882a593Smuzhiyun * belonging to that MU-MIMO groupID; %NULL if not changed
643*4882a593Smuzhiyun * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
644*4882a593Smuzhiyun * MU-MIMO packets going to the specified station; %NULL if not changed
645*4882a593Smuzhiyun */
646*4882a593Smuzhiyun struct vif_params {
647*4882a593Smuzhiyun u32 flags;
648*4882a593Smuzhiyun int use_4addr;
649*4882a593Smuzhiyun u8 macaddr[ETH_ALEN];
650*4882a593Smuzhiyun const u8 *vht_mumimo_groups;
651*4882a593Smuzhiyun const u8 *vht_mumimo_follow_addr;
652*4882a593Smuzhiyun };
653*4882a593Smuzhiyun
654*4882a593Smuzhiyun /**
655*4882a593Smuzhiyun * struct key_params - key information
656*4882a593Smuzhiyun *
657*4882a593Smuzhiyun * Information about a key
658*4882a593Smuzhiyun *
659*4882a593Smuzhiyun * @key: key material
660*4882a593Smuzhiyun * @key_len: length of key material
661*4882a593Smuzhiyun * @cipher: cipher suite selector
662*4882a593Smuzhiyun * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
663*4882a593Smuzhiyun * with the get_key() callback, must be in little endian,
664*4882a593Smuzhiyun * length given by @seq_len.
665*4882a593Smuzhiyun * @seq_len: length of @seq.
666*4882a593Smuzhiyun * @vlan_id: vlan_id for VLAN group key (if nonzero)
667*4882a593Smuzhiyun * @mode: key install mode (RX_TX, NO_TX or SET_TX)
668*4882a593Smuzhiyun */
669*4882a593Smuzhiyun struct key_params {
670*4882a593Smuzhiyun const u8 *key;
671*4882a593Smuzhiyun const u8 *seq;
672*4882a593Smuzhiyun int key_len;
673*4882a593Smuzhiyun int seq_len;
674*4882a593Smuzhiyun u16 vlan_id;
675*4882a593Smuzhiyun u32 cipher;
676*4882a593Smuzhiyun enum nl80211_key_mode mode;
677*4882a593Smuzhiyun };
678*4882a593Smuzhiyun
679*4882a593Smuzhiyun /**
680*4882a593Smuzhiyun * struct cfg80211_chan_def - channel definition
681*4882a593Smuzhiyun * @chan: the (control) channel
682*4882a593Smuzhiyun * @width: channel width
683*4882a593Smuzhiyun * @center_freq1: center frequency of first segment
684*4882a593Smuzhiyun * @center_freq2: center frequency of second segment
685*4882a593Smuzhiyun * (only with 80+80 MHz)
686*4882a593Smuzhiyun * @edmg: define the EDMG channels configuration.
687*4882a593Smuzhiyun * If edmg is requested (i.e. the .channels member is non-zero),
688*4882a593Smuzhiyun * chan will define the primary channel and all other
689*4882a593Smuzhiyun * parameters are ignored.
690*4882a593Smuzhiyun * @freq1_offset: offset from @center_freq1, in KHz
691*4882a593Smuzhiyun */
692*4882a593Smuzhiyun struct cfg80211_chan_def {
693*4882a593Smuzhiyun struct ieee80211_channel *chan;
694*4882a593Smuzhiyun enum nl80211_chan_width width;
695*4882a593Smuzhiyun u32 center_freq1;
696*4882a593Smuzhiyun u32 center_freq2;
697*4882a593Smuzhiyun struct ieee80211_edmg edmg;
698*4882a593Smuzhiyun u16 freq1_offset;
699*4882a593Smuzhiyun };
700*4882a593Smuzhiyun
701*4882a593Smuzhiyun /*
702*4882a593Smuzhiyun * cfg80211_bitrate_mask - masks for bitrate control
703*4882a593Smuzhiyun */
704*4882a593Smuzhiyun struct cfg80211_bitrate_mask {
705*4882a593Smuzhiyun struct {
706*4882a593Smuzhiyun u32 legacy;
707*4882a593Smuzhiyun u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
708*4882a593Smuzhiyun u16 vht_mcs[NL80211_VHT_NSS_MAX];
709*4882a593Smuzhiyun u16 he_mcs[NL80211_HE_NSS_MAX];
710*4882a593Smuzhiyun enum nl80211_txrate_gi gi;
711*4882a593Smuzhiyun enum nl80211_he_gi he_gi;
712*4882a593Smuzhiyun enum nl80211_he_ltf he_ltf;
713*4882a593Smuzhiyun } control[NUM_NL80211_BANDS];
714*4882a593Smuzhiyun };
715*4882a593Smuzhiyun
716*4882a593Smuzhiyun
717*4882a593Smuzhiyun /**
718*4882a593Smuzhiyun * struct cfg80211_tid_cfg - TID specific configuration
719*4882a593Smuzhiyun * @config_override: Flag to notify driver to reset TID configuration
720*4882a593Smuzhiyun * of the peer.
721*4882a593Smuzhiyun * @tids: bitmap of TIDs to modify
722*4882a593Smuzhiyun * @mask: bitmap of attributes indicating which parameter changed,
723*4882a593Smuzhiyun * similar to &nl80211_tid_config_supp.
724*4882a593Smuzhiyun * @noack: noack configuration value for the TID
725*4882a593Smuzhiyun * @retry_long: retry count value
726*4882a593Smuzhiyun * @retry_short: retry count value
727*4882a593Smuzhiyun * @ampdu: Enable/Disable MPDU aggregation
728*4882a593Smuzhiyun * @rtscts: Enable/Disable RTS/CTS
729*4882a593Smuzhiyun * @amsdu: Enable/Disable MSDU aggregation
730*4882a593Smuzhiyun * @txrate_type: Tx bitrate mask type
731*4882a593Smuzhiyun * @txrate_mask: Tx bitrate to be applied for the TID
732*4882a593Smuzhiyun */
733*4882a593Smuzhiyun struct cfg80211_tid_cfg {
734*4882a593Smuzhiyun bool config_override;
735*4882a593Smuzhiyun u8 tids;
736*4882a593Smuzhiyun u64 mask;
737*4882a593Smuzhiyun enum nl80211_tid_config noack;
738*4882a593Smuzhiyun u8 retry_long, retry_short;
739*4882a593Smuzhiyun enum nl80211_tid_config ampdu;
740*4882a593Smuzhiyun enum nl80211_tid_config rtscts;
741*4882a593Smuzhiyun enum nl80211_tid_config amsdu;
742*4882a593Smuzhiyun enum nl80211_tx_rate_setting txrate_type;
743*4882a593Smuzhiyun struct cfg80211_bitrate_mask txrate_mask;
744*4882a593Smuzhiyun };
745*4882a593Smuzhiyun
746*4882a593Smuzhiyun /**
747*4882a593Smuzhiyun * struct cfg80211_tid_config - TID configuration
748*4882a593Smuzhiyun * @peer: Station's MAC address
749*4882a593Smuzhiyun * @n_tid_conf: Number of TID specific configurations to be applied
750*4882a593Smuzhiyun * @tid_conf: Configuration change info
751*4882a593Smuzhiyun */
752*4882a593Smuzhiyun struct cfg80211_tid_config {
753*4882a593Smuzhiyun const u8 *peer;
754*4882a593Smuzhiyun u32 n_tid_conf;
755*4882a593Smuzhiyun struct cfg80211_tid_cfg tid_conf[];
756*4882a593Smuzhiyun };
757*4882a593Smuzhiyun
758*4882a593Smuzhiyun /**
759*4882a593Smuzhiyun * cfg80211_get_chandef_type - return old channel type from chandef
760*4882a593Smuzhiyun * @chandef: the channel definition
761*4882a593Smuzhiyun *
762*4882a593Smuzhiyun * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
763*4882a593Smuzhiyun * chandef, which must have a bandwidth allowing this conversion.
764*4882a593Smuzhiyun */
765*4882a593Smuzhiyun static inline enum nl80211_channel_type
cfg80211_get_chandef_type(const struct cfg80211_chan_def * chandef)766*4882a593Smuzhiyun cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
767*4882a593Smuzhiyun {
768*4882a593Smuzhiyun switch (chandef->width) {
769*4882a593Smuzhiyun case NL80211_CHAN_WIDTH_20_NOHT:
770*4882a593Smuzhiyun return NL80211_CHAN_NO_HT;
771*4882a593Smuzhiyun case NL80211_CHAN_WIDTH_20:
772*4882a593Smuzhiyun return NL80211_CHAN_HT20;
773*4882a593Smuzhiyun case NL80211_CHAN_WIDTH_40:
774*4882a593Smuzhiyun if (chandef->center_freq1 > chandef->chan->center_freq)
775*4882a593Smuzhiyun return NL80211_CHAN_HT40PLUS;
776*4882a593Smuzhiyun return NL80211_CHAN_HT40MINUS;
777*4882a593Smuzhiyun default:
778*4882a593Smuzhiyun WARN_ON(1);
779*4882a593Smuzhiyun return NL80211_CHAN_NO_HT;
780*4882a593Smuzhiyun }
781*4882a593Smuzhiyun }
782*4882a593Smuzhiyun
783*4882a593Smuzhiyun /**
784*4882a593Smuzhiyun * cfg80211_chandef_create - create channel definition using channel type
785*4882a593Smuzhiyun * @chandef: the channel definition struct to fill
786*4882a593Smuzhiyun * @channel: the control channel
787*4882a593Smuzhiyun * @chantype: the channel type
788*4882a593Smuzhiyun *
789*4882a593Smuzhiyun * Given a channel type, create a channel definition.
790*4882a593Smuzhiyun */
791*4882a593Smuzhiyun void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
792*4882a593Smuzhiyun struct ieee80211_channel *channel,
793*4882a593Smuzhiyun enum nl80211_channel_type chantype);
794*4882a593Smuzhiyun
795*4882a593Smuzhiyun /**
796*4882a593Smuzhiyun * cfg80211_chandef_identical - check if two channel definitions are identical
797*4882a593Smuzhiyun * @chandef1: first channel definition
798*4882a593Smuzhiyun * @chandef2: second channel definition
799*4882a593Smuzhiyun *
800*4882a593Smuzhiyun * Return: %true if the channels defined by the channel definitions are
801*4882a593Smuzhiyun * identical, %false otherwise.
802*4882a593Smuzhiyun */
803*4882a593Smuzhiyun static inline bool
cfg80211_chandef_identical(const struct cfg80211_chan_def * chandef1,const struct cfg80211_chan_def * chandef2)804*4882a593Smuzhiyun cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
805*4882a593Smuzhiyun const struct cfg80211_chan_def *chandef2)
806*4882a593Smuzhiyun {
807*4882a593Smuzhiyun return (chandef1->chan == chandef2->chan &&
808*4882a593Smuzhiyun chandef1->width == chandef2->width &&
809*4882a593Smuzhiyun chandef1->center_freq1 == chandef2->center_freq1 &&
810*4882a593Smuzhiyun chandef1->freq1_offset == chandef2->freq1_offset &&
811*4882a593Smuzhiyun chandef1->center_freq2 == chandef2->center_freq2);
812*4882a593Smuzhiyun }
813*4882a593Smuzhiyun
814*4882a593Smuzhiyun /**
815*4882a593Smuzhiyun * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
816*4882a593Smuzhiyun *
817*4882a593Smuzhiyun * @chandef: the channel definition
818*4882a593Smuzhiyun *
819*4882a593Smuzhiyun * Return: %true if EDMG defined, %false otherwise.
820*4882a593Smuzhiyun */
821*4882a593Smuzhiyun static inline bool
cfg80211_chandef_is_edmg(const struct cfg80211_chan_def * chandef)822*4882a593Smuzhiyun cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
823*4882a593Smuzhiyun {
824*4882a593Smuzhiyun return chandef->edmg.channels || chandef->edmg.bw_config;
825*4882a593Smuzhiyun }
826*4882a593Smuzhiyun
827*4882a593Smuzhiyun /**
828*4882a593Smuzhiyun * cfg80211_chandef_compatible - check if two channel definitions are compatible
829*4882a593Smuzhiyun * @chandef1: first channel definition
830*4882a593Smuzhiyun * @chandef2: second channel definition
831*4882a593Smuzhiyun *
832*4882a593Smuzhiyun * Return: %NULL if the given channel definitions are incompatible,
833*4882a593Smuzhiyun * chandef1 or chandef2 otherwise.
834*4882a593Smuzhiyun */
835*4882a593Smuzhiyun const struct cfg80211_chan_def *
836*4882a593Smuzhiyun cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
837*4882a593Smuzhiyun const struct cfg80211_chan_def *chandef2);
838*4882a593Smuzhiyun
839*4882a593Smuzhiyun /**
840*4882a593Smuzhiyun * cfg80211_chandef_valid - check if a channel definition is valid
841*4882a593Smuzhiyun * @chandef: the channel definition to check
842*4882a593Smuzhiyun * Return: %true if the channel definition is valid. %false otherwise.
843*4882a593Smuzhiyun */
844*4882a593Smuzhiyun bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
845*4882a593Smuzhiyun
846*4882a593Smuzhiyun /**
847*4882a593Smuzhiyun * cfg80211_chandef_usable - check if secondary channels can be used
848*4882a593Smuzhiyun * @wiphy: the wiphy to validate against
849*4882a593Smuzhiyun * @chandef: the channel definition to check
850*4882a593Smuzhiyun * @prohibited_flags: the regulatory channel flags that must not be set
851*4882a593Smuzhiyun * Return: %true if secondary channels are usable. %false otherwise.
852*4882a593Smuzhiyun */
853*4882a593Smuzhiyun bool cfg80211_chandef_usable(struct wiphy *wiphy,
854*4882a593Smuzhiyun const struct cfg80211_chan_def *chandef,
855*4882a593Smuzhiyun u32 prohibited_flags);
856*4882a593Smuzhiyun
857*4882a593Smuzhiyun /**
858*4882a593Smuzhiyun * cfg80211_chandef_dfs_required - checks if radar detection is required
859*4882a593Smuzhiyun * @wiphy: the wiphy to validate against
860*4882a593Smuzhiyun * @chandef: the channel definition to check
861*4882a593Smuzhiyun * @iftype: the interface type as specified in &enum nl80211_iftype
862*4882a593Smuzhiyun * Returns:
863*4882a593Smuzhiyun * 1 if radar detection is required, 0 if it is not, < 0 on error
864*4882a593Smuzhiyun */
865*4882a593Smuzhiyun int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
866*4882a593Smuzhiyun const struct cfg80211_chan_def *chandef,
867*4882a593Smuzhiyun enum nl80211_iftype iftype);
868*4882a593Smuzhiyun
869*4882a593Smuzhiyun /**
870*4882a593Smuzhiyun * ieee80211_chandef_rate_flags - returns rate flags for a channel
871*4882a593Smuzhiyun *
872*4882a593Smuzhiyun * In some channel types, not all rates may be used - for example CCK
873*4882a593Smuzhiyun * rates may not be used in 5/10 MHz channels.
874*4882a593Smuzhiyun *
875*4882a593Smuzhiyun * @chandef: channel definition for the channel
876*4882a593Smuzhiyun *
877*4882a593Smuzhiyun * Returns: rate flags which apply for this channel
878*4882a593Smuzhiyun */
879*4882a593Smuzhiyun static inline enum ieee80211_rate_flags
ieee80211_chandef_rate_flags(struct cfg80211_chan_def * chandef)880*4882a593Smuzhiyun ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
881*4882a593Smuzhiyun {
882*4882a593Smuzhiyun switch (chandef->width) {
883*4882a593Smuzhiyun case NL80211_CHAN_WIDTH_5:
884*4882a593Smuzhiyun return IEEE80211_RATE_SUPPORTS_5MHZ;
885*4882a593Smuzhiyun case NL80211_CHAN_WIDTH_10:
886*4882a593Smuzhiyun return IEEE80211_RATE_SUPPORTS_10MHZ;
887*4882a593Smuzhiyun default:
888*4882a593Smuzhiyun break;
889*4882a593Smuzhiyun }
890*4882a593Smuzhiyun return 0;
891*4882a593Smuzhiyun }
892*4882a593Smuzhiyun
893*4882a593Smuzhiyun /**
894*4882a593Smuzhiyun * ieee80211_chandef_max_power - maximum transmission power for the chandef
895*4882a593Smuzhiyun *
896*4882a593Smuzhiyun * In some regulations, the transmit power may depend on the configured channel
897*4882a593Smuzhiyun * bandwidth which may be defined as dBm/MHz. This function returns the actual
898*4882a593Smuzhiyun * max_power for non-standard (20 MHz) channels.
899*4882a593Smuzhiyun *
900*4882a593Smuzhiyun * @chandef: channel definition for the channel
901*4882a593Smuzhiyun *
902*4882a593Smuzhiyun * Returns: maximum allowed transmission power in dBm for the chandef
903*4882a593Smuzhiyun */
904*4882a593Smuzhiyun static inline int
ieee80211_chandef_max_power(struct cfg80211_chan_def * chandef)905*4882a593Smuzhiyun ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
906*4882a593Smuzhiyun {
907*4882a593Smuzhiyun switch (chandef->width) {
908*4882a593Smuzhiyun case NL80211_CHAN_WIDTH_5:
909*4882a593Smuzhiyun return min(chandef->chan->max_reg_power - 6,
910*4882a593Smuzhiyun chandef->chan->max_power);
911*4882a593Smuzhiyun case NL80211_CHAN_WIDTH_10:
912*4882a593Smuzhiyun return min(chandef->chan->max_reg_power - 3,
913*4882a593Smuzhiyun chandef->chan->max_power);
914*4882a593Smuzhiyun default:
915*4882a593Smuzhiyun break;
916*4882a593Smuzhiyun }
917*4882a593Smuzhiyun return chandef->chan->max_power;
918*4882a593Smuzhiyun }
919*4882a593Smuzhiyun
920*4882a593Smuzhiyun /**
921*4882a593Smuzhiyun * enum survey_info_flags - survey information flags
922*4882a593Smuzhiyun *
923*4882a593Smuzhiyun * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
924*4882a593Smuzhiyun * @SURVEY_INFO_IN_USE: channel is currently being used
925*4882a593Smuzhiyun * @SURVEY_INFO_TIME: active time (in ms) was filled in
926*4882a593Smuzhiyun * @SURVEY_INFO_TIME_BUSY: busy time was filled in
927*4882a593Smuzhiyun * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
928*4882a593Smuzhiyun * @SURVEY_INFO_TIME_RX: receive time was filled in
929*4882a593Smuzhiyun * @SURVEY_INFO_TIME_TX: transmit time was filled in
930*4882a593Smuzhiyun * @SURVEY_INFO_TIME_SCAN: scan time was filled in
931*4882a593Smuzhiyun * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
932*4882a593Smuzhiyun *
933*4882a593Smuzhiyun * Used by the driver to indicate which info in &struct survey_info
934*4882a593Smuzhiyun * it has filled in during the get_survey().
935*4882a593Smuzhiyun */
936*4882a593Smuzhiyun enum survey_info_flags {
937*4882a593Smuzhiyun SURVEY_INFO_NOISE_DBM = BIT(0),
938*4882a593Smuzhiyun SURVEY_INFO_IN_USE = BIT(1),
939*4882a593Smuzhiyun SURVEY_INFO_TIME = BIT(2),
940*4882a593Smuzhiyun SURVEY_INFO_TIME_BUSY = BIT(3),
941*4882a593Smuzhiyun SURVEY_INFO_TIME_EXT_BUSY = BIT(4),
942*4882a593Smuzhiyun SURVEY_INFO_TIME_RX = BIT(5),
943*4882a593Smuzhiyun SURVEY_INFO_TIME_TX = BIT(6),
944*4882a593Smuzhiyun SURVEY_INFO_TIME_SCAN = BIT(7),
945*4882a593Smuzhiyun SURVEY_INFO_TIME_BSS_RX = BIT(8),
946*4882a593Smuzhiyun };
947*4882a593Smuzhiyun
948*4882a593Smuzhiyun /**
949*4882a593Smuzhiyun * struct survey_info - channel survey response
950*4882a593Smuzhiyun *
951*4882a593Smuzhiyun * @channel: the channel this survey record reports, may be %NULL for a single
952*4882a593Smuzhiyun * record to report global statistics
953*4882a593Smuzhiyun * @filled: bitflag of flags from &enum survey_info_flags
954*4882a593Smuzhiyun * @noise: channel noise in dBm. This and all following fields are
955*4882a593Smuzhiyun * optional
956*4882a593Smuzhiyun * @time: amount of time in ms the radio was turn on (on the channel)
957*4882a593Smuzhiyun * @time_busy: amount of time the primary channel was sensed busy
958*4882a593Smuzhiyun * @time_ext_busy: amount of time the extension channel was sensed busy
959*4882a593Smuzhiyun * @time_rx: amount of time the radio spent receiving data
960*4882a593Smuzhiyun * @time_tx: amount of time the radio spent transmitting data
961*4882a593Smuzhiyun * @time_scan: amount of time the radio spent for scanning
962*4882a593Smuzhiyun * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
963*4882a593Smuzhiyun *
964*4882a593Smuzhiyun * Used by dump_survey() to report back per-channel survey information.
965*4882a593Smuzhiyun *
966*4882a593Smuzhiyun * This structure can later be expanded with things like
967*4882a593Smuzhiyun * channel duty cycle etc.
968*4882a593Smuzhiyun */
969*4882a593Smuzhiyun struct survey_info {
970*4882a593Smuzhiyun struct ieee80211_channel *channel;
971*4882a593Smuzhiyun u64 time;
972*4882a593Smuzhiyun u64 time_busy;
973*4882a593Smuzhiyun u64 time_ext_busy;
974*4882a593Smuzhiyun u64 time_rx;
975*4882a593Smuzhiyun u64 time_tx;
976*4882a593Smuzhiyun u64 time_scan;
977*4882a593Smuzhiyun u64 time_bss_rx;
978*4882a593Smuzhiyun u32 filled;
979*4882a593Smuzhiyun s8 noise;
980*4882a593Smuzhiyun };
981*4882a593Smuzhiyun
982*4882a593Smuzhiyun #define CFG80211_MAX_WEP_KEYS 4
983*4882a593Smuzhiyun
984*4882a593Smuzhiyun /**
985*4882a593Smuzhiyun * struct cfg80211_crypto_settings - Crypto settings
986*4882a593Smuzhiyun * @wpa_versions: indicates which, if any, WPA versions are enabled
987*4882a593Smuzhiyun * (from enum nl80211_wpa_versions)
988*4882a593Smuzhiyun * @cipher_group: group key cipher suite (or 0 if unset)
989*4882a593Smuzhiyun * @n_ciphers_pairwise: number of AP supported unicast ciphers
990*4882a593Smuzhiyun * @ciphers_pairwise: unicast key cipher suites
991*4882a593Smuzhiyun * @n_akm_suites: number of AKM suites
992*4882a593Smuzhiyun * @akm_suites: AKM suites
993*4882a593Smuzhiyun * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
994*4882a593Smuzhiyun * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
995*4882a593Smuzhiyun * required to assume that the port is unauthorized until authorized by
996*4882a593Smuzhiyun * user space. Otherwise, port is marked authorized by default.
997*4882a593Smuzhiyun * @control_port_ethertype: the control port protocol that should be
998*4882a593Smuzhiyun * allowed through even on unauthorized ports
999*4882a593Smuzhiyun * @control_port_no_encrypt: TRUE to prevent encryption of control port
1000*4882a593Smuzhiyun * protocol frames.
1001*4882a593Smuzhiyun * @control_port_over_nl80211: TRUE if userspace expects to exchange control
1002*4882a593Smuzhiyun * port frames over NL80211 instead of the network interface.
1003*4882a593Smuzhiyun * @control_port_no_preauth: disables pre-auth rx over the nl80211 control
1004*4882a593Smuzhiyun * port for mac80211
1005*4882a593Smuzhiyun * @wep_keys: static WEP keys, if not NULL points to an array of
1006*4882a593Smuzhiyun * CFG80211_MAX_WEP_KEYS WEP keys
1007*4882a593Smuzhiyun * @wep_tx_key: key index (0..3) of the default TX static WEP key
1008*4882a593Smuzhiyun * @psk: PSK (for devices supporting 4-way-handshake offload)
1009*4882a593Smuzhiyun * @sae_pwd: password for SAE authentication (for devices supporting SAE
1010*4882a593Smuzhiyun * offload)
1011*4882a593Smuzhiyun * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
1012*4882a593Smuzhiyun * @sae_pwe: The mechanisms allowed for SAE PWE derivation:
1013*4882a593Smuzhiyun *
1014*4882a593Smuzhiyun * NL80211_SAE_PWE_UNSPECIFIED
1015*4882a593Smuzhiyun * Not-specified, used to indicate userspace did not specify any
1016*4882a593Smuzhiyun * preference. The driver should follow its internal policy in
1017*4882a593Smuzhiyun * such a scenario.
1018*4882a593Smuzhiyun *
1019*4882a593Smuzhiyun * NL80211_SAE_PWE_HUNT_AND_PECK
1020*4882a593Smuzhiyun * Allow hunting-and-pecking loop only
1021*4882a593Smuzhiyun *
1022*4882a593Smuzhiyun * NL80211_SAE_PWE_HASH_TO_ELEMENT
1023*4882a593Smuzhiyun * Allow hash-to-element only
1024*4882a593Smuzhiyun *
1025*4882a593Smuzhiyun * NL80211_SAE_PWE_BOTH
1026*4882a593Smuzhiyun * Allow either hunting-and-pecking loop or hash-to-element
1027*4882a593Smuzhiyun */
1028*4882a593Smuzhiyun struct cfg80211_crypto_settings {
1029*4882a593Smuzhiyun u32 wpa_versions;
1030*4882a593Smuzhiyun u32 cipher_group;
1031*4882a593Smuzhiyun int n_ciphers_pairwise;
1032*4882a593Smuzhiyun u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
1033*4882a593Smuzhiyun int n_akm_suites;
1034*4882a593Smuzhiyun u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
1035*4882a593Smuzhiyun bool control_port;
1036*4882a593Smuzhiyun __be16 control_port_ethertype;
1037*4882a593Smuzhiyun bool control_port_no_encrypt;
1038*4882a593Smuzhiyun bool control_port_over_nl80211;
1039*4882a593Smuzhiyun bool control_port_no_preauth;
1040*4882a593Smuzhiyun struct key_params *wep_keys;
1041*4882a593Smuzhiyun int wep_tx_key;
1042*4882a593Smuzhiyun const u8 *psk;
1043*4882a593Smuzhiyun const u8 *sae_pwd;
1044*4882a593Smuzhiyun u8 sae_pwd_len;
1045*4882a593Smuzhiyun enum nl80211_sae_pwe_mechanism sae_pwe;
1046*4882a593Smuzhiyun
1047*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
1048*4882a593Smuzhiyun };
1049*4882a593Smuzhiyun
1050*4882a593Smuzhiyun /**
1051*4882a593Smuzhiyun * struct cfg80211_beacon_data - beacon data
1052*4882a593Smuzhiyun * @head: head portion of beacon (before TIM IE)
1053*4882a593Smuzhiyun * or %NULL if not changed
1054*4882a593Smuzhiyun * @tail: tail portion of beacon (after TIM IE)
1055*4882a593Smuzhiyun * or %NULL if not changed
1056*4882a593Smuzhiyun * @head_len: length of @head
1057*4882a593Smuzhiyun * @tail_len: length of @tail
1058*4882a593Smuzhiyun * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
1059*4882a593Smuzhiyun * @beacon_ies_len: length of beacon_ies in octets
1060*4882a593Smuzhiyun * @proberesp_ies: extra information element(s) to add into Probe Response
1061*4882a593Smuzhiyun * frames or %NULL
1062*4882a593Smuzhiyun * @proberesp_ies_len: length of proberesp_ies in octets
1063*4882a593Smuzhiyun * @assocresp_ies: extra information element(s) to add into (Re)Association
1064*4882a593Smuzhiyun * Response frames or %NULL
1065*4882a593Smuzhiyun * @assocresp_ies_len: length of assocresp_ies in octets
1066*4882a593Smuzhiyun * @probe_resp_len: length of probe response template (@probe_resp)
1067*4882a593Smuzhiyun * @probe_resp: probe response template (AP mode only)
1068*4882a593Smuzhiyun * @ftm_responder: enable FTM responder functionality; -1 for no change
1069*4882a593Smuzhiyun * (which also implies no change in LCI/civic location data)
1070*4882a593Smuzhiyun * @lci: Measurement Report element content, starting with Measurement Token
1071*4882a593Smuzhiyun * (measurement type 8)
1072*4882a593Smuzhiyun * @civicloc: Measurement Report element content, starting with Measurement
1073*4882a593Smuzhiyun * Token (measurement type 11)
1074*4882a593Smuzhiyun * @lci_len: LCI data length
1075*4882a593Smuzhiyun * @civicloc_len: Civic location data length
1076*4882a593Smuzhiyun */
1077*4882a593Smuzhiyun struct cfg80211_beacon_data {
1078*4882a593Smuzhiyun const u8 *head, *tail;
1079*4882a593Smuzhiyun const u8 *beacon_ies;
1080*4882a593Smuzhiyun const u8 *proberesp_ies;
1081*4882a593Smuzhiyun const u8 *assocresp_ies;
1082*4882a593Smuzhiyun const u8 *probe_resp;
1083*4882a593Smuzhiyun const u8 *lci;
1084*4882a593Smuzhiyun const u8 *civicloc;
1085*4882a593Smuzhiyun s8 ftm_responder;
1086*4882a593Smuzhiyun
1087*4882a593Smuzhiyun size_t head_len, tail_len;
1088*4882a593Smuzhiyun size_t beacon_ies_len;
1089*4882a593Smuzhiyun size_t proberesp_ies_len;
1090*4882a593Smuzhiyun size_t assocresp_ies_len;
1091*4882a593Smuzhiyun size_t probe_resp_len;
1092*4882a593Smuzhiyun size_t lci_len;
1093*4882a593Smuzhiyun size_t civicloc_len;
1094*4882a593Smuzhiyun
1095*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
1096*4882a593Smuzhiyun };
1097*4882a593Smuzhiyun
1098*4882a593Smuzhiyun struct mac_address {
1099*4882a593Smuzhiyun u8 addr[ETH_ALEN];
1100*4882a593Smuzhiyun };
1101*4882a593Smuzhiyun
1102*4882a593Smuzhiyun /**
1103*4882a593Smuzhiyun * struct cfg80211_acl_data - Access control list data
1104*4882a593Smuzhiyun *
1105*4882a593Smuzhiyun * @acl_policy: ACL policy to be applied on the station's
1106*4882a593Smuzhiyun * entry specified by mac_addr
1107*4882a593Smuzhiyun * @n_acl_entries: Number of MAC address entries passed
1108*4882a593Smuzhiyun * @mac_addrs: List of MAC addresses of stations to be used for ACL
1109*4882a593Smuzhiyun */
1110*4882a593Smuzhiyun struct cfg80211_acl_data {
1111*4882a593Smuzhiyun enum nl80211_acl_policy acl_policy;
1112*4882a593Smuzhiyun int n_acl_entries;
1113*4882a593Smuzhiyun
1114*4882a593Smuzhiyun /* Keep it last */
1115*4882a593Smuzhiyun struct mac_address mac_addrs[];
1116*4882a593Smuzhiyun };
1117*4882a593Smuzhiyun
1118*4882a593Smuzhiyun /**
1119*4882a593Smuzhiyun * struct cfg80211_fils_discovery - FILS discovery parameters from
1120*4882a593Smuzhiyun * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
1121*4882a593Smuzhiyun *
1122*4882a593Smuzhiyun * @min_interval: Minimum packet interval in TUs (0 - 10000)
1123*4882a593Smuzhiyun * @max_interval: Maximum packet interval in TUs (0 - 10000)
1124*4882a593Smuzhiyun * @tmpl_len: Template length
1125*4882a593Smuzhiyun * @tmpl: Template data for FILS discovery frame including the action
1126*4882a593Smuzhiyun * frame headers.
1127*4882a593Smuzhiyun */
1128*4882a593Smuzhiyun struct cfg80211_fils_discovery {
1129*4882a593Smuzhiyun u32 min_interval;
1130*4882a593Smuzhiyun u32 max_interval;
1131*4882a593Smuzhiyun size_t tmpl_len;
1132*4882a593Smuzhiyun const u8 *tmpl;
1133*4882a593Smuzhiyun };
1134*4882a593Smuzhiyun
1135*4882a593Smuzhiyun /**
1136*4882a593Smuzhiyun * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe
1137*4882a593Smuzhiyun * response parameters in 6GHz.
1138*4882a593Smuzhiyun *
1139*4882a593Smuzhiyun * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned
1140*4882a593Smuzhiyun * in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive
1141*4882a593Smuzhiyun * scanning
1142*4882a593Smuzhiyun * @tmpl_len: Template length
1143*4882a593Smuzhiyun * @tmpl: Template data for probe response
1144*4882a593Smuzhiyun */
1145*4882a593Smuzhiyun struct cfg80211_unsol_bcast_probe_resp {
1146*4882a593Smuzhiyun u32 interval;
1147*4882a593Smuzhiyun size_t tmpl_len;
1148*4882a593Smuzhiyun const u8 *tmpl;
1149*4882a593Smuzhiyun };
1150*4882a593Smuzhiyun
1151*4882a593Smuzhiyun /**
1152*4882a593Smuzhiyun * enum cfg80211_ap_settings_flags - AP settings flags
1153*4882a593Smuzhiyun *
1154*4882a593Smuzhiyun * Used by cfg80211_ap_settings
1155*4882a593Smuzhiyun *
1156*4882a593Smuzhiyun * @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication
1157*4882a593Smuzhiyun */
1158*4882a593Smuzhiyun enum cfg80211_ap_settings_flags {
1159*4882a593Smuzhiyun AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0),
1160*4882a593Smuzhiyun };
1161*4882a593Smuzhiyun
1162*4882a593Smuzhiyun /**
1163*4882a593Smuzhiyun * struct cfg80211_ap_settings - AP configuration
1164*4882a593Smuzhiyun *
1165*4882a593Smuzhiyun * Used to configure an AP interface.
1166*4882a593Smuzhiyun *
1167*4882a593Smuzhiyun * @chandef: defines the channel to use
1168*4882a593Smuzhiyun * @beacon: beacon data
1169*4882a593Smuzhiyun * @beacon_interval: beacon interval
1170*4882a593Smuzhiyun * @dtim_period: DTIM period
1171*4882a593Smuzhiyun * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
1172*4882a593Smuzhiyun * user space)
1173*4882a593Smuzhiyun * @ssid_len: length of @ssid
1174*4882a593Smuzhiyun * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
1175*4882a593Smuzhiyun * @crypto: crypto settings
1176*4882a593Smuzhiyun * @privacy: the BSS uses privacy
1177*4882a593Smuzhiyun * @auth_type: Authentication type (algorithm)
1178*4882a593Smuzhiyun * @smps_mode: SMPS mode
1179*4882a593Smuzhiyun * @inactivity_timeout: time in seconds to determine station's inactivity.
1180*4882a593Smuzhiyun * @p2p_ctwindow: P2P CT Window
1181*4882a593Smuzhiyun * @p2p_opp_ps: P2P opportunistic PS
1182*4882a593Smuzhiyun * @acl: ACL configuration used by the drivers which has support for
1183*4882a593Smuzhiyun * MAC address based access control
1184*4882a593Smuzhiyun * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
1185*4882a593Smuzhiyun * networks.
1186*4882a593Smuzhiyun * @beacon_rate: bitrate to be used for beacons
1187*4882a593Smuzhiyun * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
1188*4882a593Smuzhiyun * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
1189*4882a593Smuzhiyun * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
1190*4882a593Smuzhiyun * @ht_required: stations must support HT
1191*4882a593Smuzhiyun * @vht_required: stations must support VHT
1192*4882a593Smuzhiyun * @twt_responder: Enable Target Wait Time
1193*4882a593Smuzhiyun * @he_required: stations must support HE
1194*4882a593Smuzhiyun * @flags: flags, as defined in enum cfg80211_ap_settings_flags
1195*4882a593Smuzhiyun * @he_obss_pd: OBSS Packet Detection settings
1196*4882a593Smuzhiyun * @he_bss_color: BSS Color settings
1197*4882a593Smuzhiyun * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
1198*4882a593Smuzhiyun * @fils_discovery: FILS discovery transmission parameters
1199*4882a593Smuzhiyun * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
1200*4882a593Smuzhiyun */
1201*4882a593Smuzhiyun struct cfg80211_ap_settings {
1202*4882a593Smuzhiyun struct cfg80211_chan_def chandef;
1203*4882a593Smuzhiyun
1204*4882a593Smuzhiyun struct cfg80211_beacon_data beacon;
1205*4882a593Smuzhiyun
1206*4882a593Smuzhiyun int beacon_interval, dtim_period;
1207*4882a593Smuzhiyun const u8 *ssid;
1208*4882a593Smuzhiyun size_t ssid_len;
1209*4882a593Smuzhiyun enum nl80211_hidden_ssid hidden_ssid;
1210*4882a593Smuzhiyun struct cfg80211_crypto_settings crypto;
1211*4882a593Smuzhiyun bool privacy;
1212*4882a593Smuzhiyun enum nl80211_auth_type auth_type;
1213*4882a593Smuzhiyun enum nl80211_smps_mode smps_mode;
1214*4882a593Smuzhiyun int inactivity_timeout;
1215*4882a593Smuzhiyun u8 p2p_ctwindow;
1216*4882a593Smuzhiyun bool p2p_opp_ps;
1217*4882a593Smuzhiyun const struct cfg80211_acl_data *acl;
1218*4882a593Smuzhiyun bool pbss;
1219*4882a593Smuzhiyun struct cfg80211_bitrate_mask beacon_rate;
1220*4882a593Smuzhiyun
1221*4882a593Smuzhiyun const struct ieee80211_ht_cap *ht_cap;
1222*4882a593Smuzhiyun const struct ieee80211_vht_cap *vht_cap;
1223*4882a593Smuzhiyun const struct ieee80211_he_cap_elem *he_cap;
1224*4882a593Smuzhiyun const struct ieee80211_he_operation *he_oper;
1225*4882a593Smuzhiyun bool ht_required, vht_required, he_required;
1226*4882a593Smuzhiyun bool twt_responder;
1227*4882a593Smuzhiyun u32 flags;
1228*4882a593Smuzhiyun struct ieee80211_he_obss_pd he_obss_pd;
1229*4882a593Smuzhiyun struct cfg80211_he_bss_color he_bss_color;
1230*4882a593Smuzhiyun struct cfg80211_fils_discovery fils_discovery;
1231*4882a593Smuzhiyun struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
1232*4882a593Smuzhiyun
1233*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
1234*4882a593Smuzhiyun };
1235*4882a593Smuzhiyun
1236*4882a593Smuzhiyun /**
1237*4882a593Smuzhiyun * struct cfg80211_csa_settings - channel switch settings
1238*4882a593Smuzhiyun *
1239*4882a593Smuzhiyun * Used for channel switch
1240*4882a593Smuzhiyun *
1241*4882a593Smuzhiyun * @chandef: defines the channel to use after the switch
1242*4882a593Smuzhiyun * @beacon_csa: beacon data while performing the switch
1243*4882a593Smuzhiyun * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
1244*4882a593Smuzhiyun * @counter_offsets_presp: offsets of the counters within the probe response
1245*4882a593Smuzhiyun * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
1246*4882a593Smuzhiyun * @n_counter_offsets_presp: number of csa counters in the probe response
1247*4882a593Smuzhiyun * @beacon_after: beacon data to be used on the new channel
1248*4882a593Smuzhiyun * @radar_required: whether radar detection is required on the new channel
1249*4882a593Smuzhiyun * @block_tx: whether transmissions should be blocked while changing
1250*4882a593Smuzhiyun * @count: number of beacons until switch
1251*4882a593Smuzhiyun */
1252*4882a593Smuzhiyun struct cfg80211_csa_settings {
1253*4882a593Smuzhiyun struct cfg80211_chan_def chandef;
1254*4882a593Smuzhiyun struct cfg80211_beacon_data beacon_csa;
1255*4882a593Smuzhiyun const u16 *counter_offsets_beacon;
1256*4882a593Smuzhiyun const u16 *counter_offsets_presp;
1257*4882a593Smuzhiyun unsigned int n_counter_offsets_beacon;
1258*4882a593Smuzhiyun unsigned int n_counter_offsets_presp;
1259*4882a593Smuzhiyun struct cfg80211_beacon_data beacon_after;
1260*4882a593Smuzhiyun bool radar_required;
1261*4882a593Smuzhiyun bool block_tx;
1262*4882a593Smuzhiyun u8 count;
1263*4882a593Smuzhiyun
1264*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
1265*4882a593Smuzhiyun };
1266*4882a593Smuzhiyun
1267*4882a593Smuzhiyun #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10
1268*4882a593Smuzhiyun
1269*4882a593Smuzhiyun /**
1270*4882a593Smuzhiyun * struct iface_combination_params - input parameters for interface combinations
1271*4882a593Smuzhiyun *
1272*4882a593Smuzhiyun * Used to pass interface combination parameters
1273*4882a593Smuzhiyun *
1274*4882a593Smuzhiyun * @num_different_channels: the number of different channels we want
1275*4882a593Smuzhiyun * to use for verification
1276*4882a593Smuzhiyun * @radar_detect: a bitmap where each bit corresponds to a channel
1277*4882a593Smuzhiyun * width where radar detection is needed, as in the definition of
1278*4882a593Smuzhiyun * &struct ieee80211_iface_combination.@radar_detect_widths
1279*4882a593Smuzhiyun * @iftype_num: array with the number of interfaces of each interface
1280*4882a593Smuzhiyun * type. The index is the interface type as specified in &enum
1281*4882a593Smuzhiyun * nl80211_iftype.
1282*4882a593Smuzhiyun * @new_beacon_int: set this to the beacon interval of a new interface
1283*4882a593Smuzhiyun * that's not operating yet, if such is to be checked as part of
1284*4882a593Smuzhiyun * the verification
1285*4882a593Smuzhiyun */
1286*4882a593Smuzhiyun struct iface_combination_params {
1287*4882a593Smuzhiyun int num_different_channels;
1288*4882a593Smuzhiyun u8 radar_detect;
1289*4882a593Smuzhiyun int iftype_num[NUM_NL80211_IFTYPES];
1290*4882a593Smuzhiyun u32 new_beacon_int;
1291*4882a593Smuzhiyun };
1292*4882a593Smuzhiyun
1293*4882a593Smuzhiyun /**
1294*4882a593Smuzhiyun * enum station_parameters_apply_mask - station parameter values to apply
1295*4882a593Smuzhiyun * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
1296*4882a593Smuzhiyun * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
1297*4882a593Smuzhiyun * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
1298*4882a593Smuzhiyun *
1299*4882a593Smuzhiyun * Not all station parameters have in-band "no change" signalling,
1300*4882a593Smuzhiyun * for those that don't these flags will are used.
1301*4882a593Smuzhiyun */
1302*4882a593Smuzhiyun enum station_parameters_apply_mask {
1303*4882a593Smuzhiyun STATION_PARAM_APPLY_UAPSD = BIT(0),
1304*4882a593Smuzhiyun STATION_PARAM_APPLY_CAPABILITY = BIT(1),
1305*4882a593Smuzhiyun STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
1306*4882a593Smuzhiyun STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
1307*4882a593Smuzhiyun };
1308*4882a593Smuzhiyun
1309*4882a593Smuzhiyun /**
1310*4882a593Smuzhiyun * struct sta_txpwr - station txpower configuration
1311*4882a593Smuzhiyun *
1312*4882a593Smuzhiyun * Used to configure txpower for station.
1313*4882a593Smuzhiyun *
1314*4882a593Smuzhiyun * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1315*4882a593Smuzhiyun * is not provided, the default per-interface tx power setting will be
1316*4882a593Smuzhiyun * overriding. Driver should be picking up the lowest tx power, either tx
1317*4882a593Smuzhiyun * power per-interface or per-station.
1318*4882a593Smuzhiyun * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1319*4882a593Smuzhiyun * will be less than or equal to specified from userspace, whereas if TPC
1320*4882a593Smuzhiyun * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1321*4882a593Smuzhiyun * NL80211_TX_POWER_FIXED is not a valid configuration option for
1322*4882a593Smuzhiyun * per peer TPC.
1323*4882a593Smuzhiyun */
1324*4882a593Smuzhiyun struct sta_txpwr {
1325*4882a593Smuzhiyun s16 power;
1326*4882a593Smuzhiyun enum nl80211_tx_power_setting type;
1327*4882a593Smuzhiyun };
1328*4882a593Smuzhiyun
1329*4882a593Smuzhiyun /**
1330*4882a593Smuzhiyun * struct station_parameters - station parameters
1331*4882a593Smuzhiyun *
1332*4882a593Smuzhiyun * Used to change and create a new station.
1333*4882a593Smuzhiyun *
1334*4882a593Smuzhiyun * @vlan: vlan interface station should belong to
1335*4882a593Smuzhiyun * @supported_rates: supported rates in IEEE 802.11 format
1336*4882a593Smuzhiyun * (or NULL for no change)
1337*4882a593Smuzhiyun * @supported_rates_len: number of supported rates
1338*4882a593Smuzhiyun * @sta_flags_mask: station flags that changed
1339*4882a593Smuzhiyun * (bitmask of BIT(%NL80211_STA_FLAG_...))
1340*4882a593Smuzhiyun * @sta_flags_set: station flags values
1341*4882a593Smuzhiyun * (bitmask of BIT(%NL80211_STA_FLAG_...))
1342*4882a593Smuzhiyun * @listen_interval: listen interval or -1 for no change
1343*4882a593Smuzhiyun * @aid: AID or zero for no change
1344*4882a593Smuzhiyun * @vlan_id: VLAN ID for station (if nonzero)
1345*4882a593Smuzhiyun * @peer_aid: mesh peer AID or zero for no change
1346*4882a593Smuzhiyun * @plink_action: plink action to take
1347*4882a593Smuzhiyun * @plink_state: set the peer link state for a station
1348*4882a593Smuzhiyun * @ht_capa: HT capabilities of station
1349*4882a593Smuzhiyun * @vht_capa: VHT capabilities of station
1350*4882a593Smuzhiyun * @uapsd_queues: bitmap of queues configured for uapsd. same format
1351*4882a593Smuzhiyun * as the AC bitmap in the QoS info field
1352*4882a593Smuzhiyun * @max_sp: max Service Period. same format as the MAX_SP in the
1353*4882a593Smuzhiyun * QoS info field (but already shifted down)
1354*4882a593Smuzhiyun * @sta_modify_mask: bitmap indicating which parameters changed
1355*4882a593Smuzhiyun * (for those that don't have a natural "no change" value),
1356*4882a593Smuzhiyun * see &enum station_parameters_apply_mask
1357*4882a593Smuzhiyun * @local_pm: local link-specific mesh power save mode (no change when set
1358*4882a593Smuzhiyun * to unknown)
1359*4882a593Smuzhiyun * @capability: station capability
1360*4882a593Smuzhiyun * @ext_capab: extended capabilities of the station
1361*4882a593Smuzhiyun * @ext_capab_len: number of extended capabilities
1362*4882a593Smuzhiyun * @supported_channels: supported channels in IEEE 802.11 format
1363*4882a593Smuzhiyun * @supported_channels_len: number of supported channels
1364*4882a593Smuzhiyun * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1365*4882a593Smuzhiyun * @supported_oper_classes_len: number of supported operating classes
1366*4882a593Smuzhiyun * @opmode_notif: operating mode field from Operating Mode Notification
1367*4882a593Smuzhiyun * @opmode_notif_used: information if operating mode field is used
1368*4882a593Smuzhiyun * @support_p2p_ps: information if station supports P2P PS mechanism
1369*4882a593Smuzhiyun * @he_capa: HE capabilities of station
1370*4882a593Smuzhiyun * @he_capa_len: the length of the HE capabilities
1371*4882a593Smuzhiyun * @airtime_weight: airtime scheduler weight for this station
1372*4882a593Smuzhiyun * @txpwr: transmit power for an associated station
1373*4882a593Smuzhiyun * @he_6ghz_capa: HE 6 GHz Band capabilities of station
1374*4882a593Smuzhiyun */
1375*4882a593Smuzhiyun struct station_parameters {
1376*4882a593Smuzhiyun const u8 *supported_rates;
1377*4882a593Smuzhiyun struct net_device *vlan;
1378*4882a593Smuzhiyun u32 sta_flags_mask, sta_flags_set;
1379*4882a593Smuzhiyun u32 sta_modify_mask;
1380*4882a593Smuzhiyun int listen_interval;
1381*4882a593Smuzhiyun u16 aid;
1382*4882a593Smuzhiyun u16 vlan_id;
1383*4882a593Smuzhiyun u16 peer_aid;
1384*4882a593Smuzhiyun u8 supported_rates_len;
1385*4882a593Smuzhiyun u8 plink_action;
1386*4882a593Smuzhiyun u8 plink_state;
1387*4882a593Smuzhiyun const struct ieee80211_ht_cap *ht_capa;
1388*4882a593Smuzhiyun const struct ieee80211_vht_cap *vht_capa;
1389*4882a593Smuzhiyun u8 uapsd_queues;
1390*4882a593Smuzhiyun u8 max_sp;
1391*4882a593Smuzhiyun enum nl80211_mesh_power_mode local_pm;
1392*4882a593Smuzhiyun u16 capability;
1393*4882a593Smuzhiyun const u8 *ext_capab;
1394*4882a593Smuzhiyun u8 ext_capab_len;
1395*4882a593Smuzhiyun const u8 *supported_channels;
1396*4882a593Smuzhiyun u8 supported_channels_len;
1397*4882a593Smuzhiyun const u8 *supported_oper_classes;
1398*4882a593Smuzhiyun u8 supported_oper_classes_len;
1399*4882a593Smuzhiyun u8 opmode_notif;
1400*4882a593Smuzhiyun bool opmode_notif_used;
1401*4882a593Smuzhiyun int support_p2p_ps;
1402*4882a593Smuzhiyun const struct ieee80211_he_cap_elem *he_capa;
1403*4882a593Smuzhiyun u8 he_capa_len;
1404*4882a593Smuzhiyun u16 airtime_weight;
1405*4882a593Smuzhiyun struct sta_txpwr txpwr;
1406*4882a593Smuzhiyun const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
1407*4882a593Smuzhiyun
1408*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
1409*4882a593Smuzhiyun };
1410*4882a593Smuzhiyun
1411*4882a593Smuzhiyun /**
1412*4882a593Smuzhiyun * struct station_del_parameters - station deletion parameters
1413*4882a593Smuzhiyun *
1414*4882a593Smuzhiyun * Used to delete a station entry (or all stations).
1415*4882a593Smuzhiyun *
1416*4882a593Smuzhiyun * @mac: MAC address of the station to remove or NULL to remove all stations
1417*4882a593Smuzhiyun * @subtype: Management frame subtype to use for indicating removal
1418*4882a593Smuzhiyun * (10 = Disassociation, 12 = Deauthentication)
1419*4882a593Smuzhiyun * @reason_code: Reason code for the Disassociation/Deauthentication frame
1420*4882a593Smuzhiyun */
1421*4882a593Smuzhiyun struct station_del_parameters {
1422*4882a593Smuzhiyun const u8 *mac;
1423*4882a593Smuzhiyun u8 subtype;
1424*4882a593Smuzhiyun u16 reason_code;
1425*4882a593Smuzhiyun };
1426*4882a593Smuzhiyun
1427*4882a593Smuzhiyun /**
1428*4882a593Smuzhiyun * enum cfg80211_station_type - the type of station being modified
1429*4882a593Smuzhiyun * @CFG80211_STA_AP_CLIENT: client of an AP interface
1430*4882a593Smuzhiyun * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
1431*4882a593Smuzhiyun * unassociated (update properties for this type of client is permitted)
1432*4882a593Smuzhiyun * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
1433*4882a593Smuzhiyun * the AP MLME in the device
1434*4882a593Smuzhiyun * @CFG80211_STA_AP_STA: AP station on managed interface
1435*4882a593Smuzhiyun * @CFG80211_STA_IBSS: IBSS station
1436*4882a593Smuzhiyun * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
1437*4882a593Smuzhiyun * while TDLS setup is in progress, it moves out of this state when
1438*4882a593Smuzhiyun * being marked authorized; use this only if TDLS with external setup is
1439*4882a593Smuzhiyun * supported/used)
1440*4882a593Smuzhiyun * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
1441*4882a593Smuzhiyun * entry that is operating, has been marked authorized by userspace)
1442*4882a593Smuzhiyun * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1443*4882a593Smuzhiyun * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
1444*4882a593Smuzhiyun */
1445*4882a593Smuzhiyun enum cfg80211_station_type {
1446*4882a593Smuzhiyun CFG80211_STA_AP_CLIENT,
1447*4882a593Smuzhiyun CFG80211_STA_AP_CLIENT_UNASSOC,
1448*4882a593Smuzhiyun CFG80211_STA_AP_MLME_CLIENT,
1449*4882a593Smuzhiyun CFG80211_STA_AP_STA,
1450*4882a593Smuzhiyun CFG80211_STA_IBSS,
1451*4882a593Smuzhiyun CFG80211_STA_TDLS_PEER_SETUP,
1452*4882a593Smuzhiyun CFG80211_STA_TDLS_PEER_ACTIVE,
1453*4882a593Smuzhiyun CFG80211_STA_MESH_PEER_KERNEL,
1454*4882a593Smuzhiyun CFG80211_STA_MESH_PEER_USER,
1455*4882a593Smuzhiyun };
1456*4882a593Smuzhiyun
1457*4882a593Smuzhiyun /**
1458*4882a593Smuzhiyun * cfg80211_check_station_change - validate parameter changes
1459*4882a593Smuzhiyun * @wiphy: the wiphy this operates on
1460*4882a593Smuzhiyun * @params: the new parameters for a station
1461*4882a593Smuzhiyun * @statype: the type of station being modified
1462*4882a593Smuzhiyun *
1463*4882a593Smuzhiyun * Utility function for the @change_station driver method. Call this function
1464*4882a593Smuzhiyun * with the appropriate station type looking up the station (and checking that
1465*4882a593Smuzhiyun * it exists). It will verify whether the station change is acceptable, and if
1466*4882a593Smuzhiyun * not will return an error code. Note that it may modify the parameters for
1467*4882a593Smuzhiyun * backward compatibility reasons, so don't use them before calling this.
1468*4882a593Smuzhiyun */
1469*4882a593Smuzhiyun int cfg80211_check_station_change(struct wiphy *wiphy,
1470*4882a593Smuzhiyun struct station_parameters *params,
1471*4882a593Smuzhiyun enum cfg80211_station_type statype);
1472*4882a593Smuzhiyun
1473*4882a593Smuzhiyun /**
1474*4882a593Smuzhiyun * enum rate_info_flags - bitrate info flags
1475*4882a593Smuzhiyun *
1476*4882a593Smuzhiyun * Used by the driver to indicate the specific rate transmission
1477*4882a593Smuzhiyun * type for 802.11n transmissions.
1478*4882a593Smuzhiyun *
1479*4882a593Smuzhiyun * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1480*4882a593Smuzhiyun * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1481*4882a593Smuzhiyun * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
1482*4882a593Smuzhiyun * @RATE_INFO_FLAGS_DMG: 60GHz MCS
1483*4882a593Smuzhiyun * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
1484*4882a593Smuzhiyun * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
1485*4882a593Smuzhiyun */
1486*4882a593Smuzhiyun enum rate_info_flags {
1487*4882a593Smuzhiyun RATE_INFO_FLAGS_MCS = BIT(0),
1488*4882a593Smuzhiyun RATE_INFO_FLAGS_VHT_MCS = BIT(1),
1489*4882a593Smuzhiyun RATE_INFO_FLAGS_SHORT_GI = BIT(2),
1490*4882a593Smuzhiyun RATE_INFO_FLAGS_DMG = BIT(3),
1491*4882a593Smuzhiyun RATE_INFO_FLAGS_HE_MCS = BIT(4),
1492*4882a593Smuzhiyun RATE_INFO_FLAGS_EDMG = BIT(5),
1493*4882a593Smuzhiyun };
1494*4882a593Smuzhiyun
1495*4882a593Smuzhiyun /**
1496*4882a593Smuzhiyun * enum rate_info_bw - rate bandwidth information
1497*4882a593Smuzhiyun *
1498*4882a593Smuzhiyun * Used by the driver to indicate the rate bandwidth.
1499*4882a593Smuzhiyun *
1500*4882a593Smuzhiyun * @RATE_INFO_BW_5: 5 MHz bandwidth
1501*4882a593Smuzhiyun * @RATE_INFO_BW_10: 10 MHz bandwidth
1502*4882a593Smuzhiyun * @RATE_INFO_BW_20: 20 MHz bandwidth
1503*4882a593Smuzhiyun * @RATE_INFO_BW_40: 40 MHz bandwidth
1504*4882a593Smuzhiyun * @RATE_INFO_BW_80: 80 MHz bandwidth
1505*4882a593Smuzhiyun * @RATE_INFO_BW_160: 160 MHz bandwidth
1506*4882a593Smuzhiyun * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1507*4882a593Smuzhiyun */
1508*4882a593Smuzhiyun enum rate_info_bw {
1509*4882a593Smuzhiyun RATE_INFO_BW_20 = 0,
1510*4882a593Smuzhiyun RATE_INFO_BW_5,
1511*4882a593Smuzhiyun RATE_INFO_BW_10,
1512*4882a593Smuzhiyun RATE_INFO_BW_40,
1513*4882a593Smuzhiyun RATE_INFO_BW_80,
1514*4882a593Smuzhiyun RATE_INFO_BW_160,
1515*4882a593Smuzhiyun RATE_INFO_BW_HE_RU,
1516*4882a593Smuzhiyun };
1517*4882a593Smuzhiyun
1518*4882a593Smuzhiyun /**
1519*4882a593Smuzhiyun * struct rate_info - bitrate information
1520*4882a593Smuzhiyun *
1521*4882a593Smuzhiyun * Information about a receiving or transmitting bitrate
1522*4882a593Smuzhiyun *
1523*4882a593Smuzhiyun * @flags: bitflag of flags from &enum rate_info_flags
1524*4882a593Smuzhiyun * @mcs: mcs index if struct describes an HT/VHT/HE rate
1525*4882a593Smuzhiyun * @legacy: bitrate in 100kbit/s for 802.11abg
1526*4882a593Smuzhiyun * @nss: number of streams (VHT & HE only)
1527*4882a593Smuzhiyun * @bw: bandwidth (from &enum rate_info_bw)
1528*4882a593Smuzhiyun * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1529*4882a593Smuzhiyun * @he_dcm: HE DCM value
1530*4882a593Smuzhiyun * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1531*4882a593Smuzhiyun * only valid if bw is %RATE_INFO_BW_HE_RU)
1532*4882a593Smuzhiyun * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
1533*4882a593Smuzhiyun */
1534*4882a593Smuzhiyun struct rate_info {
1535*4882a593Smuzhiyun u8 flags;
1536*4882a593Smuzhiyun u8 mcs;
1537*4882a593Smuzhiyun u16 legacy;
1538*4882a593Smuzhiyun u8 nss;
1539*4882a593Smuzhiyun u8 bw;
1540*4882a593Smuzhiyun u8 he_gi;
1541*4882a593Smuzhiyun u8 he_dcm;
1542*4882a593Smuzhiyun u8 he_ru_alloc;
1543*4882a593Smuzhiyun u8 n_bonded_ch;
1544*4882a593Smuzhiyun };
1545*4882a593Smuzhiyun
1546*4882a593Smuzhiyun /**
1547*4882a593Smuzhiyun * enum bss_param_flags - bitrate info flags
1548*4882a593Smuzhiyun *
1549*4882a593Smuzhiyun * Used by the driver to indicate the specific rate transmission
1550*4882a593Smuzhiyun * type for 802.11n transmissions.
1551*4882a593Smuzhiyun *
1552*4882a593Smuzhiyun * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1553*4882a593Smuzhiyun * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1554*4882a593Smuzhiyun * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1555*4882a593Smuzhiyun */
1556*4882a593Smuzhiyun enum bss_param_flags {
1557*4882a593Smuzhiyun BSS_PARAM_FLAGS_CTS_PROT = 1<<0,
1558*4882a593Smuzhiyun BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1,
1559*4882a593Smuzhiyun BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2,
1560*4882a593Smuzhiyun };
1561*4882a593Smuzhiyun
1562*4882a593Smuzhiyun /**
1563*4882a593Smuzhiyun * struct sta_bss_parameters - BSS parameters for the attached station
1564*4882a593Smuzhiyun *
1565*4882a593Smuzhiyun * Information about the currently associated BSS
1566*4882a593Smuzhiyun *
1567*4882a593Smuzhiyun * @flags: bitflag of flags from &enum bss_param_flags
1568*4882a593Smuzhiyun * @dtim_period: DTIM period for the BSS
1569*4882a593Smuzhiyun * @beacon_interval: beacon interval
1570*4882a593Smuzhiyun */
1571*4882a593Smuzhiyun struct sta_bss_parameters {
1572*4882a593Smuzhiyun u8 flags;
1573*4882a593Smuzhiyun u8 dtim_period;
1574*4882a593Smuzhiyun u16 beacon_interval;
1575*4882a593Smuzhiyun };
1576*4882a593Smuzhiyun
1577*4882a593Smuzhiyun /**
1578*4882a593Smuzhiyun * struct cfg80211_txq_stats - TXQ statistics for this TID
1579*4882a593Smuzhiyun * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
1580*4882a593Smuzhiyun * indicate the relevant values in this struct are filled
1581*4882a593Smuzhiyun * @backlog_bytes: total number of bytes currently backlogged
1582*4882a593Smuzhiyun * @backlog_packets: total number of packets currently backlogged
1583*4882a593Smuzhiyun * @flows: number of new flows seen
1584*4882a593Smuzhiyun * @drops: total number of packets dropped
1585*4882a593Smuzhiyun * @ecn_marks: total number of packets marked with ECN CE
1586*4882a593Smuzhiyun * @overlimit: number of drops due to queue space overflow
1587*4882a593Smuzhiyun * @overmemory: number of drops due to memory limit overflow
1588*4882a593Smuzhiyun * @collisions: number of hash collisions
1589*4882a593Smuzhiyun * @tx_bytes: total number of bytes dequeued
1590*4882a593Smuzhiyun * @tx_packets: total number of packets dequeued
1591*4882a593Smuzhiyun * @max_flows: maximum number of flows supported
1592*4882a593Smuzhiyun */
1593*4882a593Smuzhiyun struct cfg80211_txq_stats {
1594*4882a593Smuzhiyun u32 filled;
1595*4882a593Smuzhiyun u32 backlog_bytes;
1596*4882a593Smuzhiyun u32 backlog_packets;
1597*4882a593Smuzhiyun u32 flows;
1598*4882a593Smuzhiyun u32 drops;
1599*4882a593Smuzhiyun u32 ecn_marks;
1600*4882a593Smuzhiyun u32 overlimit;
1601*4882a593Smuzhiyun u32 overmemory;
1602*4882a593Smuzhiyun u32 collisions;
1603*4882a593Smuzhiyun u32 tx_bytes;
1604*4882a593Smuzhiyun u32 tx_packets;
1605*4882a593Smuzhiyun u32 max_flows;
1606*4882a593Smuzhiyun };
1607*4882a593Smuzhiyun
1608*4882a593Smuzhiyun /**
1609*4882a593Smuzhiyun * struct cfg80211_tid_stats - per-TID statistics
1610*4882a593Smuzhiyun * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
1611*4882a593Smuzhiyun * indicate the relevant values in this struct are filled
1612*4882a593Smuzhiyun * @rx_msdu: number of received MSDUs
1613*4882a593Smuzhiyun * @tx_msdu: number of (attempted) transmitted MSDUs
1614*4882a593Smuzhiyun * @tx_msdu_retries: number of retries (not counting the first) for
1615*4882a593Smuzhiyun * transmitted MSDUs
1616*4882a593Smuzhiyun * @tx_msdu_failed: number of failed transmitted MSDUs
1617*4882a593Smuzhiyun * @txq_stats: TXQ statistics
1618*4882a593Smuzhiyun */
1619*4882a593Smuzhiyun struct cfg80211_tid_stats {
1620*4882a593Smuzhiyun u32 filled;
1621*4882a593Smuzhiyun u64 rx_msdu;
1622*4882a593Smuzhiyun u64 tx_msdu;
1623*4882a593Smuzhiyun u64 tx_msdu_retries;
1624*4882a593Smuzhiyun u64 tx_msdu_failed;
1625*4882a593Smuzhiyun struct cfg80211_txq_stats txq_stats;
1626*4882a593Smuzhiyun };
1627*4882a593Smuzhiyun
1628*4882a593Smuzhiyun #define IEEE80211_MAX_CHAINS 4
1629*4882a593Smuzhiyun
1630*4882a593Smuzhiyun /**
1631*4882a593Smuzhiyun * struct station_info - station information
1632*4882a593Smuzhiyun *
1633*4882a593Smuzhiyun * Station information filled by driver for get_station() and dump_station.
1634*4882a593Smuzhiyun *
1635*4882a593Smuzhiyun * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1636*4882a593Smuzhiyun * indicate the relevant values in this struct for them
1637*4882a593Smuzhiyun * @connected_time: time(in secs) since a station is last connected
1638*4882a593Smuzhiyun * @inactive_time: time since last station activity (tx/rx) in milliseconds
1639*4882a593Smuzhiyun * @assoc_at: bootime (ns) of the last association
1640*4882a593Smuzhiyun * @rx_bytes: bytes (size of MPDUs) received from this station
1641*4882a593Smuzhiyun * @tx_bytes: bytes (size of MPDUs) transmitted to this station
1642*4882a593Smuzhiyun * @llid: mesh local link id
1643*4882a593Smuzhiyun * @plid: mesh peer link id
1644*4882a593Smuzhiyun * @plink_state: mesh peer link state
1645*4882a593Smuzhiyun * @signal: The signal strength, type depends on the wiphy's signal_type.
1646*4882a593Smuzhiyun * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1647*4882a593Smuzhiyun * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
1648*4882a593Smuzhiyun * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1649*4882a593Smuzhiyun * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1650*4882a593Smuzhiyun * @chain_signal: per-chain signal strength of last received packet in dBm
1651*4882a593Smuzhiyun * @chain_signal_avg: per-chain signal strength average in dBm
1652*4882a593Smuzhiyun * @txrate: current unicast bitrate from this station
1653*4882a593Smuzhiyun * @rxrate: current unicast bitrate to this station
1654*4882a593Smuzhiyun * @rx_packets: packets (MSDUs & MMPDUs) received from this station
1655*4882a593Smuzhiyun * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
1656*4882a593Smuzhiyun * @tx_retries: cumulative retry counts (MPDUs)
1657*4882a593Smuzhiyun * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
1658*4882a593Smuzhiyun * @rx_dropped_misc: Dropped for un-specified reason.
1659*4882a593Smuzhiyun * @bss_param: current BSS parameters
1660*4882a593Smuzhiyun * @generation: generation number for nl80211 dumps.
1661*4882a593Smuzhiyun * This number should increase every time the list of stations
1662*4882a593Smuzhiyun * changes, i.e. when a station is added or removed, so that
1663*4882a593Smuzhiyun * userspace can tell whether it got a consistent snapshot.
1664*4882a593Smuzhiyun * @assoc_req_ies: IEs from (Re)Association Request.
1665*4882a593Smuzhiyun * This is used only when in AP mode with drivers that do not use
1666*4882a593Smuzhiyun * user space MLME/SME implementation. The information is provided for
1667*4882a593Smuzhiyun * the cfg80211_new_sta() calls to notify user space of the IEs.
1668*4882a593Smuzhiyun * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1669*4882a593Smuzhiyun * @sta_flags: station flags mask & values
1670*4882a593Smuzhiyun * @beacon_loss_count: Number of times beacon loss event has triggered.
1671*4882a593Smuzhiyun * @t_offset: Time offset of the station relative to this host.
1672*4882a593Smuzhiyun * @local_pm: local mesh STA power save mode
1673*4882a593Smuzhiyun * @peer_pm: peer mesh STA power save mode
1674*4882a593Smuzhiyun * @nonpeer_pm: non-peer mesh STA power save mode
1675*4882a593Smuzhiyun * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1676*4882a593Smuzhiyun * towards this station.
1677*4882a593Smuzhiyun * @rx_beacon: number of beacons received from this peer
1678*4882a593Smuzhiyun * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1679*4882a593Smuzhiyun * from this peer
1680*4882a593Smuzhiyun * @connected_to_gate: true if mesh STA has a path to mesh gate
1681*4882a593Smuzhiyun * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
1682*4882a593Smuzhiyun * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
1683*4882a593Smuzhiyun * @airtime_weight: current airtime scheduling weight
1684*4882a593Smuzhiyun * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
1685*4882a593Smuzhiyun * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
1686*4882a593Smuzhiyun * Note that this doesn't use the @filled bit, but is used if non-NULL.
1687*4882a593Smuzhiyun * @ack_signal: signal strength (in dBm) of the last ACK frame.
1688*4882a593Smuzhiyun * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
1689*4882a593Smuzhiyun * been sent.
1690*4882a593Smuzhiyun * @rx_mpdu_count: number of MPDUs received from this station
1691*4882a593Smuzhiyun * @fcs_err_count: number of packets (MPDUs) received from this station with
1692*4882a593Smuzhiyun * an FCS error. This counter should be incremented only when TA of the
1693*4882a593Smuzhiyun * received packet with an FCS error matches the peer MAC address.
1694*4882a593Smuzhiyun * @airtime_link_metric: mesh airtime link metric.
1695*4882a593Smuzhiyun * @connected_to_as: true if mesh STA has a path to authentication server
1696*4882a593Smuzhiyun */
1697*4882a593Smuzhiyun struct station_info {
1698*4882a593Smuzhiyun u64 filled;
1699*4882a593Smuzhiyun u32 connected_time;
1700*4882a593Smuzhiyun u32 inactive_time;
1701*4882a593Smuzhiyun u64 assoc_at;
1702*4882a593Smuzhiyun u64 rx_bytes;
1703*4882a593Smuzhiyun u64 tx_bytes;
1704*4882a593Smuzhiyun u16 llid;
1705*4882a593Smuzhiyun u16 plid;
1706*4882a593Smuzhiyun u8 plink_state;
1707*4882a593Smuzhiyun s8 signal;
1708*4882a593Smuzhiyun s8 signal_avg;
1709*4882a593Smuzhiyun
1710*4882a593Smuzhiyun u8 chains;
1711*4882a593Smuzhiyun s8 chain_signal[IEEE80211_MAX_CHAINS];
1712*4882a593Smuzhiyun s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1713*4882a593Smuzhiyun
1714*4882a593Smuzhiyun struct rate_info txrate;
1715*4882a593Smuzhiyun struct rate_info rxrate;
1716*4882a593Smuzhiyun u32 rx_packets;
1717*4882a593Smuzhiyun u32 tx_packets;
1718*4882a593Smuzhiyun u32 tx_retries;
1719*4882a593Smuzhiyun u32 tx_failed;
1720*4882a593Smuzhiyun u32 rx_dropped_misc;
1721*4882a593Smuzhiyun struct sta_bss_parameters bss_param;
1722*4882a593Smuzhiyun struct nl80211_sta_flag_update sta_flags;
1723*4882a593Smuzhiyun
1724*4882a593Smuzhiyun int generation;
1725*4882a593Smuzhiyun
1726*4882a593Smuzhiyun const u8 *assoc_req_ies;
1727*4882a593Smuzhiyun size_t assoc_req_ies_len;
1728*4882a593Smuzhiyun
1729*4882a593Smuzhiyun u32 beacon_loss_count;
1730*4882a593Smuzhiyun s64 t_offset;
1731*4882a593Smuzhiyun enum nl80211_mesh_power_mode local_pm;
1732*4882a593Smuzhiyun enum nl80211_mesh_power_mode peer_pm;
1733*4882a593Smuzhiyun enum nl80211_mesh_power_mode nonpeer_pm;
1734*4882a593Smuzhiyun
1735*4882a593Smuzhiyun u32 expected_throughput;
1736*4882a593Smuzhiyun
1737*4882a593Smuzhiyun u64 tx_duration;
1738*4882a593Smuzhiyun u64 rx_duration;
1739*4882a593Smuzhiyun u64 rx_beacon;
1740*4882a593Smuzhiyun u8 rx_beacon_signal_avg;
1741*4882a593Smuzhiyun u8 connected_to_gate;
1742*4882a593Smuzhiyun
1743*4882a593Smuzhiyun struct cfg80211_tid_stats *pertid;
1744*4882a593Smuzhiyun s8 ack_signal;
1745*4882a593Smuzhiyun s8 avg_ack_signal;
1746*4882a593Smuzhiyun
1747*4882a593Smuzhiyun u16 airtime_weight;
1748*4882a593Smuzhiyun
1749*4882a593Smuzhiyun u32 rx_mpdu_count;
1750*4882a593Smuzhiyun u32 fcs_err_count;
1751*4882a593Smuzhiyun
1752*4882a593Smuzhiyun u32 airtime_link_metric;
1753*4882a593Smuzhiyun
1754*4882a593Smuzhiyun u8 connected_to_as;
1755*4882a593Smuzhiyun
1756*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
1757*4882a593Smuzhiyun };
1758*4882a593Smuzhiyun
1759*4882a593Smuzhiyun #if IS_ENABLED(CONFIG_CFG80211)
1760*4882a593Smuzhiyun /**
1761*4882a593Smuzhiyun * cfg80211_get_station - retrieve information about a given station
1762*4882a593Smuzhiyun * @dev: the device where the station is supposed to be connected to
1763*4882a593Smuzhiyun * @mac_addr: the mac address of the station of interest
1764*4882a593Smuzhiyun * @sinfo: pointer to the structure to fill with the information
1765*4882a593Smuzhiyun *
1766*4882a593Smuzhiyun * Returns 0 on success and sinfo is filled with the available information
1767*4882a593Smuzhiyun * otherwise returns a negative error code and the content of sinfo has to be
1768*4882a593Smuzhiyun * considered undefined.
1769*4882a593Smuzhiyun */
1770*4882a593Smuzhiyun int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
1771*4882a593Smuzhiyun struct station_info *sinfo);
1772*4882a593Smuzhiyun #else
cfg80211_get_station(struct net_device * dev,const u8 * mac_addr,struct station_info * sinfo)1773*4882a593Smuzhiyun static inline int cfg80211_get_station(struct net_device *dev,
1774*4882a593Smuzhiyun const u8 *mac_addr,
1775*4882a593Smuzhiyun struct station_info *sinfo)
1776*4882a593Smuzhiyun {
1777*4882a593Smuzhiyun return -ENOENT;
1778*4882a593Smuzhiyun }
1779*4882a593Smuzhiyun #endif
1780*4882a593Smuzhiyun
1781*4882a593Smuzhiyun /**
1782*4882a593Smuzhiyun * enum monitor_flags - monitor flags
1783*4882a593Smuzhiyun *
1784*4882a593Smuzhiyun * Monitor interface configuration flags. Note that these must be the bits
1785*4882a593Smuzhiyun * according to the nl80211 flags.
1786*4882a593Smuzhiyun *
1787*4882a593Smuzhiyun * @MONITOR_FLAG_CHANGED: set if the flags were changed
1788*4882a593Smuzhiyun * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
1789*4882a593Smuzhiyun * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
1790*4882a593Smuzhiyun * @MONITOR_FLAG_CONTROL: pass control frames
1791*4882a593Smuzhiyun * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
1792*4882a593Smuzhiyun * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1793*4882a593Smuzhiyun * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
1794*4882a593Smuzhiyun */
1795*4882a593Smuzhiyun enum monitor_flags {
1796*4882a593Smuzhiyun MONITOR_FLAG_CHANGED = 1<<__NL80211_MNTR_FLAG_INVALID,
1797*4882a593Smuzhiyun MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
1798*4882a593Smuzhiyun MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
1799*4882a593Smuzhiyun MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
1800*4882a593Smuzhiyun MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
1801*4882a593Smuzhiyun MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1802*4882a593Smuzhiyun MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE,
1803*4882a593Smuzhiyun };
1804*4882a593Smuzhiyun
1805*4882a593Smuzhiyun /**
1806*4882a593Smuzhiyun * enum mpath_info_flags - mesh path information flags
1807*4882a593Smuzhiyun *
1808*4882a593Smuzhiyun * Used by the driver to indicate which info in &struct mpath_info it has filled
1809*4882a593Smuzhiyun * in during get_station() or dump_station().
1810*4882a593Smuzhiyun *
1811*4882a593Smuzhiyun * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1812*4882a593Smuzhiyun * @MPATH_INFO_SN: @sn filled
1813*4882a593Smuzhiyun * @MPATH_INFO_METRIC: @metric filled
1814*4882a593Smuzhiyun * @MPATH_INFO_EXPTIME: @exptime filled
1815*4882a593Smuzhiyun * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1816*4882a593Smuzhiyun * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1817*4882a593Smuzhiyun * @MPATH_INFO_FLAGS: @flags filled
1818*4882a593Smuzhiyun * @MPATH_INFO_HOP_COUNT: @hop_count filled
1819*4882a593Smuzhiyun * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
1820*4882a593Smuzhiyun */
1821*4882a593Smuzhiyun enum mpath_info_flags {
1822*4882a593Smuzhiyun MPATH_INFO_FRAME_QLEN = BIT(0),
1823*4882a593Smuzhiyun MPATH_INFO_SN = BIT(1),
1824*4882a593Smuzhiyun MPATH_INFO_METRIC = BIT(2),
1825*4882a593Smuzhiyun MPATH_INFO_EXPTIME = BIT(3),
1826*4882a593Smuzhiyun MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
1827*4882a593Smuzhiyun MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
1828*4882a593Smuzhiyun MPATH_INFO_FLAGS = BIT(6),
1829*4882a593Smuzhiyun MPATH_INFO_HOP_COUNT = BIT(7),
1830*4882a593Smuzhiyun MPATH_INFO_PATH_CHANGE = BIT(8),
1831*4882a593Smuzhiyun };
1832*4882a593Smuzhiyun
1833*4882a593Smuzhiyun /**
1834*4882a593Smuzhiyun * struct mpath_info - mesh path information
1835*4882a593Smuzhiyun *
1836*4882a593Smuzhiyun * Mesh path information filled by driver for get_mpath() and dump_mpath().
1837*4882a593Smuzhiyun *
1838*4882a593Smuzhiyun * @filled: bitfield of flags from &enum mpath_info_flags
1839*4882a593Smuzhiyun * @frame_qlen: number of queued frames for this destination
1840*4882a593Smuzhiyun * @sn: target sequence number
1841*4882a593Smuzhiyun * @metric: metric (cost) of this mesh path
1842*4882a593Smuzhiyun * @exptime: expiration time for the mesh path from now, in msecs
1843*4882a593Smuzhiyun * @flags: mesh path flags
1844*4882a593Smuzhiyun * @discovery_timeout: total mesh path discovery timeout, in msecs
1845*4882a593Smuzhiyun * @discovery_retries: mesh path discovery retries
1846*4882a593Smuzhiyun * @generation: generation number for nl80211 dumps.
1847*4882a593Smuzhiyun * This number should increase every time the list of mesh paths
1848*4882a593Smuzhiyun * changes, i.e. when a station is added or removed, so that
1849*4882a593Smuzhiyun * userspace can tell whether it got a consistent snapshot.
1850*4882a593Smuzhiyun * @hop_count: hops to destination
1851*4882a593Smuzhiyun * @path_change_count: total number of path changes to destination
1852*4882a593Smuzhiyun */
1853*4882a593Smuzhiyun struct mpath_info {
1854*4882a593Smuzhiyun u32 filled;
1855*4882a593Smuzhiyun u32 frame_qlen;
1856*4882a593Smuzhiyun u32 sn;
1857*4882a593Smuzhiyun u32 metric;
1858*4882a593Smuzhiyun u32 exptime;
1859*4882a593Smuzhiyun u32 discovery_timeout;
1860*4882a593Smuzhiyun u8 discovery_retries;
1861*4882a593Smuzhiyun u8 flags;
1862*4882a593Smuzhiyun u8 hop_count;
1863*4882a593Smuzhiyun u32 path_change_count;
1864*4882a593Smuzhiyun
1865*4882a593Smuzhiyun int generation;
1866*4882a593Smuzhiyun };
1867*4882a593Smuzhiyun
1868*4882a593Smuzhiyun /**
1869*4882a593Smuzhiyun * struct bss_parameters - BSS parameters
1870*4882a593Smuzhiyun *
1871*4882a593Smuzhiyun * Used to change BSS parameters (mainly for AP mode).
1872*4882a593Smuzhiyun *
1873*4882a593Smuzhiyun * @use_cts_prot: Whether to use CTS protection
1874*4882a593Smuzhiyun * (0 = no, 1 = yes, -1 = do not change)
1875*4882a593Smuzhiyun * @use_short_preamble: Whether the use of short preambles is allowed
1876*4882a593Smuzhiyun * (0 = no, 1 = yes, -1 = do not change)
1877*4882a593Smuzhiyun * @use_short_slot_time: Whether the use of short slot time is allowed
1878*4882a593Smuzhiyun * (0 = no, 1 = yes, -1 = do not change)
1879*4882a593Smuzhiyun * @basic_rates: basic rates in IEEE 802.11 format
1880*4882a593Smuzhiyun * (or NULL for no change)
1881*4882a593Smuzhiyun * @basic_rates_len: number of basic rates
1882*4882a593Smuzhiyun * @ap_isolate: do not forward packets between connected stations
1883*4882a593Smuzhiyun * (0 = no, 1 = yes, -1 = do not change)
1884*4882a593Smuzhiyun * @ht_opmode: HT Operation mode
1885*4882a593Smuzhiyun * (u16 = opmode, -1 = do not change)
1886*4882a593Smuzhiyun * @p2p_ctwindow: P2P CT Window (-1 = no change)
1887*4882a593Smuzhiyun * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
1888*4882a593Smuzhiyun */
1889*4882a593Smuzhiyun struct bss_parameters {
1890*4882a593Smuzhiyun int use_cts_prot;
1891*4882a593Smuzhiyun int use_short_preamble;
1892*4882a593Smuzhiyun int use_short_slot_time;
1893*4882a593Smuzhiyun const u8 *basic_rates;
1894*4882a593Smuzhiyun u8 basic_rates_len;
1895*4882a593Smuzhiyun int ap_isolate;
1896*4882a593Smuzhiyun int ht_opmode;
1897*4882a593Smuzhiyun s8 p2p_ctwindow, p2p_opp_ps;
1898*4882a593Smuzhiyun };
1899*4882a593Smuzhiyun
1900*4882a593Smuzhiyun /**
1901*4882a593Smuzhiyun * struct mesh_config - 802.11s mesh configuration
1902*4882a593Smuzhiyun *
1903*4882a593Smuzhiyun * These parameters can be changed while the mesh is active.
1904*4882a593Smuzhiyun *
1905*4882a593Smuzhiyun * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
1906*4882a593Smuzhiyun * by the Mesh Peering Open message
1907*4882a593Smuzhiyun * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
1908*4882a593Smuzhiyun * used by the Mesh Peering Open message
1909*4882a593Smuzhiyun * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
1910*4882a593Smuzhiyun * the mesh peering management to close a mesh peering
1911*4882a593Smuzhiyun * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
1912*4882a593Smuzhiyun * mesh interface
1913*4882a593Smuzhiyun * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
1914*4882a593Smuzhiyun * be sent to establish a new peer link instance in a mesh
1915*4882a593Smuzhiyun * @dot11MeshTTL: the value of TTL field set at a source mesh STA
1916*4882a593Smuzhiyun * @element_ttl: the value of TTL field set at a mesh STA for path selection
1917*4882a593Smuzhiyun * elements
1918*4882a593Smuzhiyun * @auto_open_plinks: whether we should automatically open peer links when we
1919*4882a593Smuzhiyun * detect compatible mesh peers
1920*4882a593Smuzhiyun * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
1921*4882a593Smuzhiyun * synchronize to for 11s default synchronization method
1922*4882a593Smuzhiyun * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
1923*4882a593Smuzhiyun * that an originator mesh STA can send to a particular path target
1924*4882a593Smuzhiyun * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
1925*4882a593Smuzhiyun * @min_discovery_timeout: the minimum length of time to wait until giving up on
1926*4882a593Smuzhiyun * a path discovery in milliseconds
1927*4882a593Smuzhiyun * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
1928*4882a593Smuzhiyun * receiving a PREQ shall consider the forwarding information from the
1929*4882a593Smuzhiyun * root to be valid. (TU = time unit)
1930*4882a593Smuzhiyun * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
1931*4882a593Smuzhiyun * which a mesh STA can send only one action frame containing a PREQ
1932*4882a593Smuzhiyun * element
1933*4882a593Smuzhiyun * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
1934*4882a593Smuzhiyun * which a mesh STA can send only one Action frame containing a PERR
1935*4882a593Smuzhiyun * element
1936*4882a593Smuzhiyun * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
1937*4882a593Smuzhiyun * it takes for an HWMP information element to propagate across the mesh
1938*4882a593Smuzhiyun * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
1939*4882a593Smuzhiyun * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
1940*4882a593Smuzhiyun * announcements are transmitted
1941*4882a593Smuzhiyun * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
1942*4882a593Smuzhiyun * station has access to a broader network beyond the MBSS. (This is
1943*4882a593Smuzhiyun * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
1944*4882a593Smuzhiyun * only means that the station will announce others it's a mesh gate, but
1945*4882a593Smuzhiyun * not necessarily using the gate announcement protocol. Still keeping the
1946*4882a593Smuzhiyun * same nomenclature to be in sync with the spec)
1947*4882a593Smuzhiyun * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
1948*4882a593Smuzhiyun * entity (default is TRUE - forwarding entity)
1949*4882a593Smuzhiyun * @rssi_threshold: the threshold for average signal strength of candidate
1950*4882a593Smuzhiyun * station to establish a peer link
1951*4882a593Smuzhiyun * @ht_opmode: mesh HT protection mode
1952*4882a593Smuzhiyun *
1953*4882a593Smuzhiyun * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1954*4882a593Smuzhiyun * receiving a proactive PREQ shall consider the forwarding information to
1955*4882a593Smuzhiyun * the root mesh STA to be valid.
1956*4882a593Smuzhiyun *
1957*4882a593Smuzhiyun * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1958*4882a593Smuzhiyun * PREQs are transmitted.
1959*4882a593Smuzhiyun * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1960*4882a593Smuzhiyun * during which a mesh STA can send only one Action frame containing
1961*4882a593Smuzhiyun * a PREQ element for root path confirmation.
1962*4882a593Smuzhiyun * @power_mode: The default mesh power save mode which will be the initial
1963*4882a593Smuzhiyun * setting for new peer links.
1964*4882a593Smuzhiyun * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
1965*4882a593Smuzhiyun * after transmitting its beacon.
1966*4882a593Smuzhiyun * @plink_timeout: If no tx activity is seen from a STA we've established
1967*4882a593Smuzhiyun * peering with for longer than this time (in seconds), then remove it
1968*4882a593Smuzhiyun * from the STA's list of peers. Default is 30 minutes.
1969*4882a593Smuzhiyun * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
1970*4882a593Smuzhiyun * connected to a mesh gate in mesh formation info. If false, the
1971*4882a593Smuzhiyun * value in mesh formation is determined by the presence of root paths
1972*4882a593Smuzhiyun * in the mesh path table
1973*4882a593Smuzhiyun * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP
1974*4882a593Smuzhiyun * for HWMP) if the destination is a direct neighbor. Note that this might
1975*4882a593Smuzhiyun * not be the optimal decision as a multi-hop route might be better. So
1976*4882a593Smuzhiyun * if using this setting you will likely also want to disable
1977*4882a593Smuzhiyun * dot11MeshForwarding and use another mesh routing protocol on top.
1978*4882a593Smuzhiyun */
1979*4882a593Smuzhiyun struct mesh_config {
1980*4882a593Smuzhiyun u16 dot11MeshRetryTimeout;
1981*4882a593Smuzhiyun u16 dot11MeshConfirmTimeout;
1982*4882a593Smuzhiyun u16 dot11MeshHoldingTimeout;
1983*4882a593Smuzhiyun u16 dot11MeshMaxPeerLinks;
1984*4882a593Smuzhiyun u8 dot11MeshMaxRetries;
1985*4882a593Smuzhiyun u8 dot11MeshTTL;
1986*4882a593Smuzhiyun u8 element_ttl;
1987*4882a593Smuzhiyun bool auto_open_plinks;
1988*4882a593Smuzhiyun u32 dot11MeshNbrOffsetMaxNeighbor;
1989*4882a593Smuzhiyun u8 dot11MeshHWMPmaxPREQretries;
1990*4882a593Smuzhiyun u32 path_refresh_time;
1991*4882a593Smuzhiyun u16 min_discovery_timeout;
1992*4882a593Smuzhiyun u32 dot11MeshHWMPactivePathTimeout;
1993*4882a593Smuzhiyun u16 dot11MeshHWMPpreqMinInterval;
1994*4882a593Smuzhiyun u16 dot11MeshHWMPperrMinInterval;
1995*4882a593Smuzhiyun u16 dot11MeshHWMPnetDiameterTraversalTime;
1996*4882a593Smuzhiyun u8 dot11MeshHWMPRootMode;
1997*4882a593Smuzhiyun bool dot11MeshConnectedToMeshGate;
1998*4882a593Smuzhiyun bool dot11MeshConnectedToAuthServer;
1999*4882a593Smuzhiyun u16 dot11MeshHWMPRannInterval;
2000*4882a593Smuzhiyun bool dot11MeshGateAnnouncementProtocol;
2001*4882a593Smuzhiyun bool dot11MeshForwarding;
2002*4882a593Smuzhiyun s32 rssi_threshold;
2003*4882a593Smuzhiyun u16 ht_opmode;
2004*4882a593Smuzhiyun u32 dot11MeshHWMPactivePathToRootTimeout;
2005*4882a593Smuzhiyun u16 dot11MeshHWMProotInterval;
2006*4882a593Smuzhiyun u16 dot11MeshHWMPconfirmationInterval;
2007*4882a593Smuzhiyun enum nl80211_mesh_power_mode power_mode;
2008*4882a593Smuzhiyun u16 dot11MeshAwakeWindowDuration;
2009*4882a593Smuzhiyun u32 plink_timeout;
2010*4882a593Smuzhiyun bool dot11MeshNolearn;
2011*4882a593Smuzhiyun
2012*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
2013*4882a593Smuzhiyun };
2014*4882a593Smuzhiyun
2015*4882a593Smuzhiyun /**
2016*4882a593Smuzhiyun * struct mesh_setup - 802.11s mesh setup configuration
2017*4882a593Smuzhiyun * @chandef: defines the channel to use
2018*4882a593Smuzhiyun * @mesh_id: the mesh ID
2019*4882a593Smuzhiyun * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
2020*4882a593Smuzhiyun * @sync_method: which synchronization method to use
2021*4882a593Smuzhiyun * @path_sel_proto: which path selection protocol to use
2022*4882a593Smuzhiyun * @path_metric: which metric to use
2023*4882a593Smuzhiyun * @auth_id: which authentication method this mesh is using
2024*4882a593Smuzhiyun * @ie: vendor information elements (optional)
2025*4882a593Smuzhiyun * @ie_len: length of vendor information elements
2026*4882a593Smuzhiyun * @is_authenticated: this mesh requires authentication
2027*4882a593Smuzhiyun * @is_secure: this mesh uses security
2028*4882a593Smuzhiyun * @user_mpm: userspace handles all MPM functions
2029*4882a593Smuzhiyun * @dtim_period: DTIM period to use
2030*4882a593Smuzhiyun * @beacon_interval: beacon interval to use
2031*4882a593Smuzhiyun * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
2032*4882a593Smuzhiyun * @basic_rates: basic rates to use when creating the mesh
2033*4882a593Smuzhiyun * @beacon_rate: bitrate to be used for beacons
2034*4882a593Smuzhiyun * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2035*4882a593Smuzhiyun * changes the channel when a radar is detected. This is required
2036*4882a593Smuzhiyun * to operate on DFS channels.
2037*4882a593Smuzhiyun * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2038*4882a593Smuzhiyun * port frames over NL80211 instead of the network interface.
2039*4882a593Smuzhiyun *
2040*4882a593Smuzhiyun * These parameters are fixed when the mesh is created.
2041*4882a593Smuzhiyun */
2042*4882a593Smuzhiyun struct mesh_setup {
2043*4882a593Smuzhiyun struct cfg80211_chan_def chandef;
2044*4882a593Smuzhiyun const u8 *mesh_id;
2045*4882a593Smuzhiyun u8 mesh_id_len;
2046*4882a593Smuzhiyun u8 sync_method;
2047*4882a593Smuzhiyun u8 path_sel_proto;
2048*4882a593Smuzhiyun u8 path_metric;
2049*4882a593Smuzhiyun u8 auth_id;
2050*4882a593Smuzhiyun const u8 *ie;
2051*4882a593Smuzhiyun u8 ie_len;
2052*4882a593Smuzhiyun bool is_authenticated;
2053*4882a593Smuzhiyun bool is_secure;
2054*4882a593Smuzhiyun bool user_mpm;
2055*4882a593Smuzhiyun u8 dtim_period;
2056*4882a593Smuzhiyun u16 beacon_interval;
2057*4882a593Smuzhiyun int mcast_rate[NUM_NL80211_BANDS];
2058*4882a593Smuzhiyun u32 basic_rates;
2059*4882a593Smuzhiyun struct cfg80211_bitrate_mask beacon_rate;
2060*4882a593Smuzhiyun bool userspace_handles_dfs;
2061*4882a593Smuzhiyun bool control_port_over_nl80211;
2062*4882a593Smuzhiyun
2063*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
2064*4882a593Smuzhiyun };
2065*4882a593Smuzhiyun
2066*4882a593Smuzhiyun /**
2067*4882a593Smuzhiyun * struct ocb_setup - 802.11p OCB mode setup configuration
2068*4882a593Smuzhiyun * @chandef: defines the channel to use
2069*4882a593Smuzhiyun *
2070*4882a593Smuzhiyun * These parameters are fixed when connecting to the network
2071*4882a593Smuzhiyun */
2072*4882a593Smuzhiyun struct ocb_setup {
2073*4882a593Smuzhiyun struct cfg80211_chan_def chandef;
2074*4882a593Smuzhiyun };
2075*4882a593Smuzhiyun
2076*4882a593Smuzhiyun /**
2077*4882a593Smuzhiyun * struct ieee80211_txq_params - TX queue parameters
2078*4882a593Smuzhiyun * @ac: AC identifier
2079*4882a593Smuzhiyun * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
2080*4882a593Smuzhiyun * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
2081*4882a593Smuzhiyun * 1..32767]
2082*4882a593Smuzhiyun * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
2083*4882a593Smuzhiyun * 1..32767]
2084*4882a593Smuzhiyun * @aifs: Arbitration interframe space [0..255]
2085*4882a593Smuzhiyun */
2086*4882a593Smuzhiyun struct ieee80211_txq_params {
2087*4882a593Smuzhiyun enum nl80211_ac ac;
2088*4882a593Smuzhiyun u16 txop;
2089*4882a593Smuzhiyun u16 cwmin;
2090*4882a593Smuzhiyun u16 cwmax;
2091*4882a593Smuzhiyun u8 aifs;
2092*4882a593Smuzhiyun };
2093*4882a593Smuzhiyun
2094*4882a593Smuzhiyun /**
2095*4882a593Smuzhiyun * DOC: Scanning and BSS list handling
2096*4882a593Smuzhiyun *
2097*4882a593Smuzhiyun * The scanning process itself is fairly simple, but cfg80211 offers quite
2098*4882a593Smuzhiyun * a bit of helper functionality. To start a scan, the scan operation will
2099*4882a593Smuzhiyun * be invoked with a scan definition. This scan definition contains the
2100*4882a593Smuzhiyun * channels to scan, and the SSIDs to send probe requests for (including the
2101*4882a593Smuzhiyun * wildcard, if desired). A passive scan is indicated by having no SSIDs to
2102*4882a593Smuzhiyun * probe. Additionally, a scan request may contain extra information elements
2103*4882a593Smuzhiyun * that should be added to the probe request. The IEs are guaranteed to be
2104*4882a593Smuzhiyun * well-formed, and will not exceed the maximum length the driver advertised
2105*4882a593Smuzhiyun * in the wiphy structure.
2106*4882a593Smuzhiyun *
2107*4882a593Smuzhiyun * When scanning finds a BSS, cfg80211 needs to be notified of that, because
2108*4882a593Smuzhiyun * it is responsible for maintaining the BSS list; the driver should not
2109*4882a593Smuzhiyun * maintain a list itself. For this notification, various functions exist.
2110*4882a593Smuzhiyun *
2111*4882a593Smuzhiyun * Since drivers do not maintain a BSS list, there are also a number of
2112*4882a593Smuzhiyun * functions to search for a BSS and obtain information about it from the
2113*4882a593Smuzhiyun * BSS structure cfg80211 maintains. The BSS list is also made available
2114*4882a593Smuzhiyun * to userspace.
2115*4882a593Smuzhiyun */
2116*4882a593Smuzhiyun
2117*4882a593Smuzhiyun /**
2118*4882a593Smuzhiyun * struct cfg80211_ssid - SSID description
2119*4882a593Smuzhiyun * @ssid: the SSID
2120*4882a593Smuzhiyun * @ssid_len: length of the ssid
2121*4882a593Smuzhiyun */
2122*4882a593Smuzhiyun struct cfg80211_ssid {
2123*4882a593Smuzhiyun u8 ssid[IEEE80211_MAX_SSID_LEN];
2124*4882a593Smuzhiyun u8 ssid_len;
2125*4882a593Smuzhiyun };
2126*4882a593Smuzhiyun
2127*4882a593Smuzhiyun /**
2128*4882a593Smuzhiyun * struct cfg80211_scan_info - information about completed scan
2129*4882a593Smuzhiyun * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
2130*4882a593Smuzhiyun * wireless device that requested the scan is connected to. If this
2131*4882a593Smuzhiyun * information is not available, this field is left zero.
2132*4882a593Smuzhiyun * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
2133*4882a593Smuzhiyun * @aborted: set to true if the scan was aborted for any reason,
2134*4882a593Smuzhiyun * userspace will be notified of that
2135*4882a593Smuzhiyun */
2136*4882a593Smuzhiyun struct cfg80211_scan_info {
2137*4882a593Smuzhiyun u64 scan_start_tsf;
2138*4882a593Smuzhiyun u8 tsf_bssid[ETH_ALEN] __aligned(2);
2139*4882a593Smuzhiyun bool aborted;
2140*4882a593Smuzhiyun };
2141*4882a593Smuzhiyun
2142*4882a593Smuzhiyun /**
2143*4882a593Smuzhiyun * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only
2144*4882a593Smuzhiyun *
2145*4882a593Smuzhiyun * @short_bssid: short ssid to scan for
2146*4882a593Smuzhiyun * @bssid: bssid to scan for
2147*4882a593Smuzhiyun * @channel_idx: idx of the channel in the channel array in the scan request
2148*4882a593Smuzhiyun * which the above info relvant to
2149*4882a593Smuzhiyun * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU
2150*4882a593Smuzhiyun * @short_ssid_valid: short_ssid is valid and can be used
2151*4882a593Smuzhiyun * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait
2152*4882a593Smuzhiyun * 20 TUs before starting to send probe requests.
2153*4882a593Smuzhiyun */
2154*4882a593Smuzhiyun struct cfg80211_scan_6ghz_params {
2155*4882a593Smuzhiyun u32 short_ssid;
2156*4882a593Smuzhiyun u32 channel_idx;
2157*4882a593Smuzhiyun u8 bssid[ETH_ALEN];
2158*4882a593Smuzhiyun bool unsolicited_probe;
2159*4882a593Smuzhiyun bool short_ssid_valid;
2160*4882a593Smuzhiyun bool psc_no_listen;
2161*4882a593Smuzhiyun };
2162*4882a593Smuzhiyun
2163*4882a593Smuzhiyun /**
2164*4882a593Smuzhiyun * struct cfg80211_scan_request - scan request description
2165*4882a593Smuzhiyun *
2166*4882a593Smuzhiyun * @ssids: SSIDs to scan for (active scan only)
2167*4882a593Smuzhiyun * @n_ssids: number of SSIDs
2168*4882a593Smuzhiyun * @channels: channels to scan on.
2169*4882a593Smuzhiyun * @n_channels: total number of channels to scan
2170*4882a593Smuzhiyun * @scan_width: channel width for scanning
2171*4882a593Smuzhiyun * @ie: optional information element(s) to add into Probe Request or %NULL
2172*4882a593Smuzhiyun * @ie_len: length of ie in octets
2173*4882a593Smuzhiyun * @duration: how long to listen on each channel, in TUs. If
2174*4882a593Smuzhiyun * %duration_mandatory is not set, this is the maximum dwell time and
2175*4882a593Smuzhiyun * the actual dwell time may be shorter.
2176*4882a593Smuzhiyun * @duration_mandatory: if set, the scan duration must be as specified by the
2177*4882a593Smuzhiyun * %duration field.
2178*4882a593Smuzhiyun * @flags: bit field of flags controlling operation
2179*4882a593Smuzhiyun * @rates: bitmap of rates to advertise for each band
2180*4882a593Smuzhiyun * @wiphy: the wiphy this was for
2181*4882a593Smuzhiyun * @scan_start: time (in jiffies) when the scan started
2182*4882a593Smuzhiyun * @wdev: the wireless device to scan for
2183*4882a593Smuzhiyun * @info: (internal) information about completed scan
2184*4882a593Smuzhiyun * @notified: (internal) scan request was notified as done or aborted
2185*4882a593Smuzhiyun * @no_cck: used to send probe requests at non CCK rate in 2GHz band
2186*4882a593Smuzhiyun * @mac_addr: MAC address used with randomisation
2187*4882a593Smuzhiyun * @mac_addr_mask: MAC address mask used with randomisation, bits that
2188*4882a593Smuzhiyun * are 0 in the mask should be randomised, bits that are 1 should
2189*4882a593Smuzhiyun * be taken from the @mac_addr
2190*4882a593Smuzhiyun * @scan_6ghz: relevant for split scan request only,
2191*4882a593Smuzhiyun * true if this is the second scan request
2192*4882a593Smuzhiyun * @n_6ghz_params: number of 6 GHz params
2193*4882a593Smuzhiyun * @scan_6ghz_params: 6 GHz params
2194*4882a593Smuzhiyun * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
2195*4882a593Smuzhiyun */
2196*4882a593Smuzhiyun struct cfg80211_scan_request {
2197*4882a593Smuzhiyun struct cfg80211_ssid *ssids;
2198*4882a593Smuzhiyun int n_ssids;
2199*4882a593Smuzhiyun u32 n_channels;
2200*4882a593Smuzhiyun enum nl80211_bss_scan_width scan_width;
2201*4882a593Smuzhiyun const u8 *ie;
2202*4882a593Smuzhiyun size_t ie_len;
2203*4882a593Smuzhiyun u16 duration;
2204*4882a593Smuzhiyun bool duration_mandatory;
2205*4882a593Smuzhiyun u32 flags;
2206*4882a593Smuzhiyun
2207*4882a593Smuzhiyun u32 rates[NUM_NL80211_BANDS];
2208*4882a593Smuzhiyun
2209*4882a593Smuzhiyun struct wireless_dev *wdev;
2210*4882a593Smuzhiyun
2211*4882a593Smuzhiyun u8 mac_addr[ETH_ALEN] __aligned(2);
2212*4882a593Smuzhiyun u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2213*4882a593Smuzhiyun u8 bssid[ETH_ALEN] __aligned(2);
2214*4882a593Smuzhiyun
2215*4882a593Smuzhiyun /* internal */
2216*4882a593Smuzhiyun struct wiphy *wiphy;
2217*4882a593Smuzhiyun unsigned long scan_start;
2218*4882a593Smuzhiyun struct cfg80211_scan_info info;
2219*4882a593Smuzhiyun bool notified;
2220*4882a593Smuzhiyun bool no_cck;
2221*4882a593Smuzhiyun bool scan_6ghz;
2222*4882a593Smuzhiyun u32 n_6ghz_params;
2223*4882a593Smuzhiyun struct cfg80211_scan_6ghz_params *scan_6ghz_params;
2224*4882a593Smuzhiyun
2225*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
2226*4882a593Smuzhiyun
2227*4882a593Smuzhiyun /* keep last */
2228*4882a593Smuzhiyun struct ieee80211_channel *channels[];
2229*4882a593Smuzhiyun };
2230*4882a593Smuzhiyun
get_random_mask_addr(u8 * buf,const u8 * addr,const u8 * mask)2231*4882a593Smuzhiyun static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
2232*4882a593Smuzhiyun {
2233*4882a593Smuzhiyun int i;
2234*4882a593Smuzhiyun
2235*4882a593Smuzhiyun get_random_bytes(buf, ETH_ALEN);
2236*4882a593Smuzhiyun for (i = 0; i < ETH_ALEN; i++) {
2237*4882a593Smuzhiyun buf[i] &= ~mask[i];
2238*4882a593Smuzhiyun buf[i] |= addr[i] & mask[i];
2239*4882a593Smuzhiyun }
2240*4882a593Smuzhiyun }
2241*4882a593Smuzhiyun
2242*4882a593Smuzhiyun /**
2243*4882a593Smuzhiyun * struct cfg80211_match_set - sets of attributes to match
2244*4882a593Smuzhiyun *
2245*4882a593Smuzhiyun * @ssid: SSID to be matched; may be zero-length in case of BSSID match
2246*4882a593Smuzhiyun * or no match (RSSI only)
2247*4882a593Smuzhiyun * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
2248*4882a593Smuzhiyun * or no match (RSSI only)
2249*4882a593Smuzhiyun * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
2250*4882a593Smuzhiyun * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
2251*4882a593Smuzhiyun * for filtering out scan results received. Drivers advertize this support
2252*4882a593Smuzhiyun * of band specific rssi based filtering through the feature capability
2253*4882a593Smuzhiyun * %NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
2254*4882a593Smuzhiyun * specific rssi thresholds take precedence over rssi_thold, if specified.
2255*4882a593Smuzhiyun * If not specified for any band, it will be assigned with rssi_thold of
2256*4882a593Smuzhiyun * corresponding matchset.
2257*4882a593Smuzhiyun */
2258*4882a593Smuzhiyun struct cfg80211_match_set {
2259*4882a593Smuzhiyun struct cfg80211_ssid ssid;
2260*4882a593Smuzhiyun u8 bssid[ETH_ALEN];
2261*4882a593Smuzhiyun s32 rssi_thold;
2262*4882a593Smuzhiyun s32 per_band_rssi_thold[NUM_NL80211_BANDS];
2263*4882a593Smuzhiyun };
2264*4882a593Smuzhiyun
2265*4882a593Smuzhiyun /**
2266*4882a593Smuzhiyun * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
2267*4882a593Smuzhiyun *
2268*4882a593Smuzhiyun * @interval: interval between scheduled scan iterations. In seconds.
2269*4882a593Smuzhiyun * @iterations: number of scan iterations in this scan plan. Zero means
2270*4882a593Smuzhiyun * infinite loop.
2271*4882a593Smuzhiyun * The last scan plan will always have this parameter set to zero,
2272*4882a593Smuzhiyun * all other scan plans will have a finite number of iterations.
2273*4882a593Smuzhiyun */
2274*4882a593Smuzhiyun struct cfg80211_sched_scan_plan {
2275*4882a593Smuzhiyun u32 interval;
2276*4882a593Smuzhiyun u32 iterations;
2277*4882a593Smuzhiyun };
2278*4882a593Smuzhiyun
2279*4882a593Smuzhiyun /**
2280*4882a593Smuzhiyun * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
2281*4882a593Smuzhiyun *
2282*4882a593Smuzhiyun * @band: band of BSS which should match for RSSI level adjustment.
2283*4882a593Smuzhiyun * @delta: value of RSSI level adjustment.
2284*4882a593Smuzhiyun */
2285*4882a593Smuzhiyun struct cfg80211_bss_select_adjust {
2286*4882a593Smuzhiyun enum nl80211_band band;
2287*4882a593Smuzhiyun s8 delta;
2288*4882a593Smuzhiyun };
2289*4882a593Smuzhiyun
2290*4882a593Smuzhiyun /**
2291*4882a593Smuzhiyun * struct cfg80211_sched_scan_request - scheduled scan request description
2292*4882a593Smuzhiyun *
2293*4882a593Smuzhiyun * @reqid: identifies this request.
2294*4882a593Smuzhiyun * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
2295*4882a593Smuzhiyun * @n_ssids: number of SSIDs
2296*4882a593Smuzhiyun * @n_channels: total number of channels to scan
2297*4882a593Smuzhiyun * @scan_width: channel width for scanning
2298*4882a593Smuzhiyun * @ie: optional information element(s) to add into Probe Request or %NULL
2299*4882a593Smuzhiyun * @ie_len: length of ie in octets
2300*4882a593Smuzhiyun * @flags: bit field of flags controlling operation
2301*4882a593Smuzhiyun * @match_sets: sets of parameters to be matched for a scan result
2302*4882a593Smuzhiyun * entry to be considered valid and to be passed to the host
2303*4882a593Smuzhiyun * (others are filtered out).
2304*4882a593Smuzhiyun * If ommited, all results are passed.
2305*4882a593Smuzhiyun * @n_match_sets: number of match sets
2306*4882a593Smuzhiyun * @report_results: indicates that results were reported for this request
2307*4882a593Smuzhiyun * @wiphy: the wiphy this was for
2308*4882a593Smuzhiyun * @dev: the interface
2309*4882a593Smuzhiyun * @scan_start: start time of the scheduled scan
2310*4882a593Smuzhiyun * @channels: channels to scan
2311*4882a593Smuzhiyun * @min_rssi_thold: for drivers only supporting a single threshold, this
2312*4882a593Smuzhiyun * contains the minimum over all matchsets
2313*4882a593Smuzhiyun * @mac_addr: MAC address used with randomisation
2314*4882a593Smuzhiyun * @mac_addr_mask: MAC address mask used with randomisation, bits that
2315*4882a593Smuzhiyun * are 0 in the mask should be randomised, bits that are 1 should
2316*4882a593Smuzhiyun * be taken from the @mac_addr
2317*4882a593Smuzhiyun * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
2318*4882a593Smuzhiyun * index must be executed first.
2319*4882a593Smuzhiyun * @n_scan_plans: number of scan plans, at least 1.
2320*4882a593Smuzhiyun * @rcu_head: RCU callback used to free the struct
2321*4882a593Smuzhiyun * @owner_nlportid: netlink portid of owner (if this should is a request
2322*4882a593Smuzhiyun * owned by a particular socket)
2323*4882a593Smuzhiyun * @nl_owner_dead: netlink owner socket was closed - this request be freed
2324*4882a593Smuzhiyun * @list: for keeping list of requests.
2325*4882a593Smuzhiyun * @delay: delay in seconds to use before starting the first scan
2326*4882a593Smuzhiyun * cycle. The driver may ignore this parameter and start
2327*4882a593Smuzhiyun * immediately (or at any other time), if this feature is not
2328*4882a593Smuzhiyun * supported.
2329*4882a593Smuzhiyun * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
2330*4882a593Smuzhiyun * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
2331*4882a593Smuzhiyun * reporting in connected state to cases where a matching BSS is determined
2332*4882a593Smuzhiyun * to have better or slightly worse RSSI than the current connected BSS.
2333*4882a593Smuzhiyun * The relative RSSI threshold values are ignored in disconnected state.
2334*4882a593Smuzhiyun * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
2335*4882a593Smuzhiyun * to the specified band while deciding whether a better BSS is reported
2336*4882a593Smuzhiyun * using @relative_rssi. If delta is a negative number, the BSSs that
2337*4882a593Smuzhiyun * belong to the specified band will be penalized by delta dB in relative
2338*4882a593Smuzhiyun * comparisions.
2339*4882a593Smuzhiyun */
2340*4882a593Smuzhiyun struct cfg80211_sched_scan_request {
2341*4882a593Smuzhiyun u64 reqid;
2342*4882a593Smuzhiyun struct cfg80211_ssid *ssids;
2343*4882a593Smuzhiyun int n_ssids;
2344*4882a593Smuzhiyun u32 n_channels;
2345*4882a593Smuzhiyun enum nl80211_bss_scan_width scan_width;
2346*4882a593Smuzhiyun const u8 *ie;
2347*4882a593Smuzhiyun size_t ie_len;
2348*4882a593Smuzhiyun u32 flags;
2349*4882a593Smuzhiyun struct cfg80211_match_set *match_sets;
2350*4882a593Smuzhiyun int n_match_sets;
2351*4882a593Smuzhiyun s32 min_rssi_thold;
2352*4882a593Smuzhiyun u32 delay;
2353*4882a593Smuzhiyun struct cfg80211_sched_scan_plan *scan_plans;
2354*4882a593Smuzhiyun int n_scan_plans;
2355*4882a593Smuzhiyun
2356*4882a593Smuzhiyun u8 mac_addr[ETH_ALEN] __aligned(2);
2357*4882a593Smuzhiyun u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2358*4882a593Smuzhiyun
2359*4882a593Smuzhiyun bool relative_rssi_set;
2360*4882a593Smuzhiyun s8 relative_rssi;
2361*4882a593Smuzhiyun struct cfg80211_bss_select_adjust rssi_adjust;
2362*4882a593Smuzhiyun
2363*4882a593Smuzhiyun /* internal */
2364*4882a593Smuzhiyun struct wiphy *wiphy;
2365*4882a593Smuzhiyun struct net_device *dev;
2366*4882a593Smuzhiyun unsigned long scan_start;
2367*4882a593Smuzhiyun bool report_results;
2368*4882a593Smuzhiyun struct rcu_head rcu_head;
2369*4882a593Smuzhiyun u32 owner_nlportid;
2370*4882a593Smuzhiyun bool nl_owner_dead;
2371*4882a593Smuzhiyun struct list_head list;
2372*4882a593Smuzhiyun
2373*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
2374*4882a593Smuzhiyun
2375*4882a593Smuzhiyun /* keep last */
2376*4882a593Smuzhiyun struct ieee80211_channel *channels[];
2377*4882a593Smuzhiyun };
2378*4882a593Smuzhiyun
2379*4882a593Smuzhiyun /**
2380*4882a593Smuzhiyun * enum cfg80211_signal_type - signal type
2381*4882a593Smuzhiyun *
2382*4882a593Smuzhiyun * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
2383*4882a593Smuzhiyun * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
2384*4882a593Smuzhiyun * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
2385*4882a593Smuzhiyun */
2386*4882a593Smuzhiyun enum cfg80211_signal_type {
2387*4882a593Smuzhiyun CFG80211_SIGNAL_TYPE_NONE,
2388*4882a593Smuzhiyun CFG80211_SIGNAL_TYPE_MBM,
2389*4882a593Smuzhiyun CFG80211_SIGNAL_TYPE_UNSPEC,
2390*4882a593Smuzhiyun };
2391*4882a593Smuzhiyun
2392*4882a593Smuzhiyun /**
2393*4882a593Smuzhiyun * struct cfg80211_inform_bss - BSS inform data
2394*4882a593Smuzhiyun * @chan: channel the frame was received on
2395*4882a593Smuzhiyun * @scan_width: scan width that was used
2396*4882a593Smuzhiyun * @signal: signal strength value, according to the wiphy's
2397*4882a593Smuzhiyun * signal type
2398*4882a593Smuzhiyun * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
2399*4882a593Smuzhiyun * received; should match the time when the frame was actually
2400*4882a593Smuzhiyun * received by the device (not just by the host, in case it was
2401*4882a593Smuzhiyun * buffered on the device) and be accurate to about 10ms.
2402*4882a593Smuzhiyun * If the frame isn't buffered, just passing the return value of
2403*4882a593Smuzhiyun * ktime_get_boottime_ns() is likely appropriate.
2404*4882a593Smuzhiyun * @parent_tsf: the time at the start of reception of the first octet of the
2405*4882a593Smuzhiyun * timestamp field of the frame. The time is the TSF of the BSS specified
2406*4882a593Smuzhiyun * by %parent_bssid.
2407*4882a593Smuzhiyun * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
2408*4882a593Smuzhiyun * the BSS that requested the scan in which the beacon/probe was received.
2409*4882a593Smuzhiyun * @chains: bitmask for filled values in @chain_signal.
2410*4882a593Smuzhiyun * @chain_signal: per-chain signal strength of last received BSS in dBm.
2411*4882a593Smuzhiyun */
2412*4882a593Smuzhiyun struct cfg80211_inform_bss {
2413*4882a593Smuzhiyun struct ieee80211_channel *chan;
2414*4882a593Smuzhiyun enum nl80211_bss_scan_width scan_width;
2415*4882a593Smuzhiyun s32 signal;
2416*4882a593Smuzhiyun u64 boottime_ns;
2417*4882a593Smuzhiyun u64 parent_tsf;
2418*4882a593Smuzhiyun u8 parent_bssid[ETH_ALEN] __aligned(2);
2419*4882a593Smuzhiyun u8 chains;
2420*4882a593Smuzhiyun s8 chain_signal[IEEE80211_MAX_CHAINS];
2421*4882a593Smuzhiyun };
2422*4882a593Smuzhiyun
2423*4882a593Smuzhiyun /**
2424*4882a593Smuzhiyun * struct cfg80211_bss_ies - BSS entry IE data
2425*4882a593Smuzhiyun * @tsf: TSF contained in the frame that carried these IEs
2426*4882a593Smuzhiyun * @rcu_head: internal use, for freeing
2427*4882a593Smuzhiyun * @len: length of the IEs
2428*4882a593Smuzhiyun * @from_beacon: these IEs are known to come from a beacon
2429*4882a593Smuzhiyun * @data: IE data
2430*4882a593Smuzhiyun */
2431*4882a593Smuzhiyun struct cfg80211_bss_ies {
2432*4882a593Smuzhiyun u64 tsf;
2433*4882a593Smuzhiyun struct rcu_head rcu_head;
2434*4882a593Smuzhiyun int len;
2435*4882a593Smuzhiyun bool from_beacon;
2436*4882a593Smuzhiyun u8 data[];
2437*4882a593Smuzhiyun };
2438*4882a593Smuzhiyun
2439*4882a593Smuzhiyun /**
2440*4882a593Smuzhiyun * struct cfg80211_bss - BSS description
2441*4882a593Smuzhiyun *
2442*4882a593Smuzhiyun * This structure describes a BSS (which may also be a mesh network)
2443*4882a593Smuzhiyun * for use in scan results and similar.
2444*4882a593Smuzhiyun *
2445*4882a593Smuzhiyun * @channel: channel this BSS is on
2446*4882a593Smuzhiyun * @scan_width: width of the control channel
2447*4882a593Smuzhiyun * @bssid: BSSID of the BSS
2448*4882a593Smuzhiyun * @beacon_interval: the beacon interval as from the frame
2449*4882a593Smuzhiyun * @capability: the capability field in host byte order
2450*4882a593Smuzhiyun * @ies: the information elements (Note that there is no guarantee that these
2451*4882a593Smuzhiyun * are well-formed!); this is a pointer to either the beacon_ies or
2452*4882a593Smuzhiyun * proberesp_ies depending on whether Probe Response frame has been
2453*4882a593Smuzhiyun * received. It is always non-%NULL.
2454*4882a593Smuzhiyun * @beacon_ies: the information elements from the last Beacon frame
2455*4882a593Smuzhiyun * (implementation note: if @hidden_beacon_bss is set this struct doesn't
2456*4882a593Smuzhiyun * own the beacon_ies, but they're just pointers to the ones from the
2457*4882a593Smuzhiyun * @hidden_beacon_bss struct)
2458*4882a593Smuzhiyun * @proberesp_ies: the information elements from the last Probe Response frame
2459*4882a593Smuzhiyun * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2460*4882a593Smuzhiyun * a BSS that hides the SSID in its beacon, this points to the BSS struct
2461*4882a593Smuzhiyun * that holds the beacon data. @beacon_ies is still valid, of course, and
2462*4882a593Smuzhiyun * points to the same data as hidden_beacon_bss->beacon_ies in that case.
2463*4882a593Smuzhiyun * @transmitted_bss: pointer to the transmitted BSS, if this is a
2464*4882a593Smuzhiyun * non-transmitted one (multi-BSSID support)
2465*4882a593Smuzhiyun * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2466*4882a593Smuzhiyun * (multi-BSSID support)
2467*4882a593Smuzhiyun * @signal: signal strength value (type depends on the wiphy's signal_type)
2468*4882a593Smuzhiyun * @chains: bitmask for filled values in @chain_signal.
2469*4882a593Smuzhiyun * @chain_signal: per-chain signal strength of last received BSS in dBm.
2470*4882a593Smuzhiyun * @bssid_index: index in the multiple BSS set
2471*4882a593Smuzhiyun * @max_bssid_indicator: max number of members in the BSS set
2472*4882a593Smuzhiyun * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
2473*4882a593Smuzhiyun */
2474*4882a593Smuzhiyun struct cfg80211_bss {
2475*4882a593Smuzhiyun struct ieee80211_channel *channel;
2476*4882a593Smuzhiyun enum nl80211_bss_scan_width scan_width;
2477*4882a593Smuzhiyun
2478*4882a593Smuzhiyun const struct cfg80211_bss_ies __rcu *ies;
2479*4882a593Smuzhiyun const struct cfg80211_bss_ies __rcu *beacon_ies;
2480*4882a593Smuzhiyun const struct cfg80211_bss_ies __rcu *proberesp_ies;
2481*4882a593Smuzhiyun
2482*4882a593Smuzhiyun struct cfg80211_bss *hidden_beacon_bss;
2483*4882a593Smuzhiyun struct cfg80211_bss *transmitted_bss;
2484*4882a593Smuzhiyun struct list_head nontrans_list;
2485*4882a593Smuzhiyun
2486*4882a593Smuzhiyun s32 signal;
2487*4882a593Smuzhiyun
2488*4882a593Smuzhiyun u16 beacon_interval;
2489*4882a593Smuzhiyun u16 capability;
2490*4882a593Smuzhiyun
2491*4882a593Smuzhiyun u8 bssid[ETH_ALEN];
2492*4882a593Smuzhiyun u8 chains;
2493*4882a593Smuzhiyun s8 chain_signal[IEEE80211_MAX_CHAINS];
2494*4882a593Smuzhiyun
2495*4882a593Smuzhiyun u8 bssid_index;
2496*4882a593Smuzhiyun u8 max_bssid_indicator;
2497*4882a593Smuzhiyun
2498*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
2499*4882a593Smuzhiyun
2500*4882a593Smuzhiyun u8 priv[] __aligned(sizeof(void *));
2501*4882a593Smuzhiyun };
2502*4882a593Smuzhiyun
2503*4882a593Smuzhiyun /**
2504*4882a593Smuzhiyun * ieee80211_bss_get_elem - find element with given ID
2505*4882a593Smuzhiyun * @bss: the bss to search
2506*4882a593Smuzhiyun * @id: the element ID
2507*4882a593Smuzhiyun *
2508*4882a593Smuzhiyun * Note that the return value is an RCU-protected pointer, so
2509*4882a593Smuzhiyun * rcu_read_lock() must be held when calling this function.
2510*4882a593Smuzhiyun * Return: %NULL if not found.
2511*4882a593Smuzhiyun */
2512*4882a593Smuzhiyun const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
2513*4882a593Smuzhiyun
2514*4882a593Smuzhiyun /**
2515*4882a593Smuzhiyun * ieee80211_bss_get_ie - find IE with given ID
2516*4882a593Smuzhiyun * @bss: the bss to search
2517*4882a593Smuzhiyun * @id: the element ID
2518*4882a593Smuzhiyun *
2519*4882a593Smuzhiyun * Note that the return value is an RCU-protected pointer, so
2520*4882a593Smuzhiyun * rcu_read_lock() must be held when calling this function.
2521*4882a593Smuzhiyun * Return: %NULL if not found.
2522*4882a593Smuzhiyun */
ieee80211_bss_get_ie(struct cfg80211_bss * bss,u8 id)2523*4882a593Smuzhiyun static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
2524*4882a593Smuzhiyun {
2525*4882a593Smuzhiyun return (void *)ieee80211_bss_get_elem(bss, id);
2526*4882a593Smuzhiyun }
2527*4882a593Smuzhiyun
2528*4882a593Smuzhiyun
2529*4882a593Smuzhiyun /**
2530*4882a593Smuzhiyun * struct cfg80211_auth_request - Authentication request data
2531*4882a593Smuzhiyun *
2532*4882a593Smuzhiyun * This structure provides information needed to complete IEEE 802.11
2533*4882a593Smuzhiyun * authentication.
2534*4882a593Smuzhiyun *
2535*4882a593Smuzhiyun * @bss: The BSS to authenticate with, the callee must obtain a reference
2536*4882a593Smuzhiyun * to it if it needs to keep it.
2537*4882a593Smuzhiyun * @auth_type: Authentication type (algorithm)
2538*4882a593Smuzhiyun * @ie: Extra IEs to add to Authentication frame or %NULL
2539*4882a593Smuzhiyun * @ie_len: Length of ie buffer in octets
2540*4882a593Smuzhiyun * @key_len: length of WEP key for shared key authentication
2541*4882a593Smuzhiyun * @key_idx: index of WEP key for shared key authentication
2542*4882a593Smuzhiyun * @key: WEP key for shared key authentication
2543*4882a593Smuzhiyun * @auth_data: Fields and elements in Authentication frames. This contains
2544*4882a593Smuzhiyun * the authentication frame body (non-IE and IE data), excluding the
2545*4882a593Smuzhiyun * Authentication algorithm number, i.e., starting at the Authentication
2546*4882a593Smuzhiyun * transaction sequence number field.
2547*4882a593Smuzhiyun * @auth_data_len: Length of auth_data buffer in octets
2548*4882a593Smuzhiyun */
2549*4882a593Smuzhiyun struct cfg80211_auth_request {
2550*4882a593Smuzhiyun struct cfg80211_bss *bss;
2551*4882a593Smuzhiyun const u8 *ie;
2552*4882a593Smuzhiyun size_t ie_len;
2553*4882a593Smuzhiyun enum nl80211_auth_type auth_type;
2554*4882a593Smuzhiyun const u8 *key;
2555*4882a593Smuzhiyun u8 key_len, key_idx;
2556*4882a593Smuzhiyun const u8 *auth_data;
2557*4882a593Smuzhiyun size_t auth_data_len;
2558*4882a593Smuzhiyun };
2559*4882a593Smuzhiyun
2560*4882a593Smuzhiyun /**
2561*4882a593Smuzhiyun * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
2562*4882a593Smuzhiyun *
2563*4882a593Smuzhiyun * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
2564*4882a593Smuzhiyun * @ASSOC_REQ_DISABLE_VHT: Disable VHT
2565*4882a593Smuzhiyun * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
2566*4882a593Smuzhiyun * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
2567*4882a593Smuzhiyun * authentication capability. Drivers can offload authentication to
2568*4882a593Smuzhiyun * userspace if this flag is set. Only applicable for cfg80211_connect()
2569*4882a593Smuzhiyun * request (connect callback).
2570*4882a593Smuzhiyun */
2571*4882a593Smuzhiyun enum cfg80211_assoc_req_flags {
2572*4882a593Smuzhiyun ASSOC_REQ_DISABLE_HT = BIT(0),
2573*4882a593Smuzhiyun ASSOC_REQ_DISABLE_VHT = BIT(1),
2574*4882a593Smuzhiyun ASSOC_REQ_USE_RRM = BIT(2),
2575*4882a593Smuzhiyun CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3),
2576*4882a593Smuzhiyun };
2577*4882a593Smuzhiyun
2578*4882a593Smuzhiyun /**
2579*4882a593Smuzhiyun * struct cfg80211_assoc_request - (Re)Association request data
2580*4882a593Smuzhiyun *
2581*4882a593Smuzhiyun * This structure provides information needed to complete IEEE 802.11
2582*4882a593Smuzhiyun * (re)association.
2583*4882a593Smuzhiyun * @bss: The BSS to associate with. If the call is successful the driver is
2584*4882a593Smuzhiyun * given a reference that it must give back to cfg80211_send_rx_assoc()
2585*4882a593Smuzhiyun * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2586*4882a593Smuzhiyun * association requests while already associating must be rejected.
2587*4882a593Smuzhiyun * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2588*4882a593Smuzhiyun * @ie_len: Length of ie buffer in octets
2589*4882a593Smuzhiyun * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
2590*4882a593Smuzhiyun * @crypto: crypto settings
2591*4882a593Smuzhiyun * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
2592*4882a593Smuzhiyun * to indicate a request to reassociate within the ESS instead of a request
2593*4882a593Smuzhiyun * do the initial association with the ESS. When included, this is set to
2594*4882a593Smuzhiyun * the BSSID of the current association, i.e., to the value that is
2595*4882a593Smuzhiyun * included in the Current AP address field of the Reassociation Request
2596*4882a593Smuzhiyun * frame.
2597*4882a593Smuzhiyun * @flags: See &enum cfg80211_assoc_req_flags
2598*4882a593Smuzhiyun * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2599*4882a593Smuzhiyun * will be used in ht_capa. Un-supported values will be ignored.
2600*4882a593Smuzhiyun * @ht_capa_mask: The bits of ht_capa which are to be used.
2601*4882a593Smuzhiyun * @vht_capa: VHT capability override
2602*4882a593Smuzhiyun * @vht_capa_mask: VHT capability mask indicating which fields to use
2603*4882a593Smuzhiyun * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2604*4882a593Smuzhiyun * %NULL if FILS is not used.
2605*4882a593Smuzhiyun * @fils_kek_len: Length of fils_kek in octets
2606*4882a593Smuzhiyun * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2607*4882a593Smuzhiyun * Request/Response frame or %NULL if FILS is not used. This field starts
2608*4882a593Smuzhiyun * with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
2609*4882a593Smuzhiyun * @s1g_capa: S1G capability override
2610*4882a593Smuzhiyun * @s1g_capa_mask: S1G capability override mask
2611*4882a593Smuzhiyun */
2612*4882a593Smuzhiyun struct cfg80211_assoc_request {
2613*4882a593Smuzhiyun struct cfg80211_bss *bss;
2614*4882a593Smuzhiyun const u8 *ie, *prev_bssid;
2615*4882a593Smuzhiyun size_t ie_len;
2616*4882a593Smuzhiyun struct cfg80211_crypto_settings crypto;
2617*4882a593Smuzhiyun bool use_mfp;
2618*4882a593Smuzhiyun u32 flags;
2619*4882a593Smuzhiyun struct ieee80211_ht_cap ht_capa;
2620*4882a593Smuzhiyun struct ieee80211_ht_cap ht_capa_mask;
2621*4882a593Smuzhiyun struct ieee80211_vht_cap vht_capa, vht_capa_mask;
2622*4882a593Smuzhiyun const u8 *fils_kek;
2623*4882a593Smuzhiyun size_t fils_kek_len;
2624*4882a593Smuzhiyun const u8 *fils_nonces;
2625*4882a593Smuzhiyun struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;
2626*4882a593Smuzhiyun
2627*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
2628*4882a593Smuzhiyun };
2629*4882a593Smuzhiyun
2630*4882a593Smuzhiyun /**
2631*4882a593Smuzhiyun * struct cfg80211_deauth_request - Deauthentication request data
2632*4882a593Smuzhiyun *
2633*4882a593Smuzhiyun * This structure provides information needed to complete IEEE 802.11
2634*4882a593Smuzhiyun * deauthentication.
2635*4882a593Smuzhiyun *
2636*4882a593Smuzhiyun * @bssid: the BSSID of the BSS to deauthenticate from
2637*4882a593Smuzhiyun * @ie: Extra IEs to add to Deauthentication frame or %NULL
2638*4882a593Smuzhiyun * @ie_len: Length of ie buffer in octets
2639*4882a593Smuzhiyun * @reason_code: The reason code for the deauthentication
2640*4882a593Smuzhiyun * @local_state_change: if set, change local state only and
2641*4882a593Smuzhiyun * do not set a deauth frame
2642*4882a593Smuzhiyun */
2643*4882a593Smuzhiyun struct cfg80211_deauth_request {
2644*4882a593Smuzhiyun const u8 *bssid;
2645*4882a593Smuzhiyun const u8 *ie;
2646*4882a593Smuzhiyun size_t ie_len;
2647*4882a593Smuzhiyun u16 reason_code;
2648*4882a593Smuzhiyun bool local_state_change;
2649*4882a593Smuzhiyun };
2650*4882a593Smuzhiyun
2651*4882a593Smuzhiyun /**
2652*4882a593Smuzhiyun * struct cfg80211_disassoc_request - Disassociation request data
2653*4882a593Smuzhiyun *
2654*4882a593Smuzhiyun * This structure provides information needed to complete IEEE 802.11
2655*4882a593Smuzhiyun * disassociation.
2656*4882a593Smuzhiyun *
2657*4882a593Smuzhiyun * @bss: the BSS to disassociate from
2658*4882a593Smuzhiyun * @ie: Extra IEs to add to Disassociation frame or %NULL
2659*4882a593Smuzhiyun * @ie_len: Length of ie buffer in octets
2660*4882a593Smuzhiyun * @reason_code: The reason code for the disassociation
2661*4882a593Smuzhiyun * @local_state_change: This is a request for a local state only, i.e., no
2662*4882a593Smuzhiyun * Disassociation frame is to be transmitted.
2663*4882a593Smuzhiyun */
2664*4882a593Smuzhiyun struct cfg80211_disassoc_request {
2665*4882a593Smuzhiyun struct cfg80211_bss *bss;
2666*4882a593Smuzhiyun const u8 *ie;
2667*4882a593Smuzhiyun size_t ie_len;
2668*4882a593Smuzhiyun u16 reason_code;
2669*4882a593Smuzhiyun bool local_state_change;
2670*4882a593Smuzhiyun };
2671*4882a593Smuzhiyun
2672*4882a593Smuzhiyun /**
2673*4882a593Smuzhiyun * struct cfg80211_ibss_params - IBSS parameters
2674*4882a593Smuzhiyun *
2675*4882a593Smuzhiyun * This structure defines the IBSS parameters for the join_ibss()
2676*4882a593Smuzhiyun * method.
2677*4882a593Smuzhiyun *
2678*4882a593Smuzhiyun * @ssid: The SSID, will always be non-null.
2679*4882a593Smuzhiyun * @ssid_len: The length of the SSID, will always be non-zero.
2680*4882a593Smuzhiyun * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
2681*4882a593Smuzhiyun * search for IBSSs with a different BSSID.
2682*4882a593Smuzhiyun * @chandef: defines the channel to use if no other IBSS to join can be found
2683*4882a593Smuzhiyun * @channel_fixed: The channel should be fixed -- do not search for
2684*4882a593Smuzhiyun * IBSSs to join on other channels.
2685*4882a593Smuzhiyun * @ie: information element(s) to include in the beacon
2686*4882a593Smuzhiyun * @ie_len: length of that
2687*4882a593Smuzhiyun * @beacon_interval: beacon interval to use
2688*4882a593Smuzhiyun * @privacy: this is a protected network, keys will be configured
2689*4882a593Smuzhiyun * after joining
2690*4882a593Smuzhiyun * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2691*4882a593Smuzhiyun * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2692*4882a593Smuzhiyun * required to assume that the port is unauthorized until authorized by
2693*4882a593Smuzhiyun * user space. Otherwise, port is marked authorized by default.
2694*4882a593Smuzhiyun * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2695*4882a593Smuzhiyun * port frames over NL80211 instead of the network interface.
2696*4882a593Smuzhiyun * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2697*4882a593Smuzhiyun * changes the channel when a radar is detected. This is required
2698*4882a593Smuzhiyun * to operate on DFS channels.
2699*4882a593Smuzhiyun * @basic_rates: bitmap of basic rates to use when creating the IBSS
2700*4882a593Smuzhiyun * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
2701*4882a593Smuzhiyun * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2702*4882a593Smuzhiyun * will be used in ht_capa. Un-supported values will be ignored.
2703*4882a593Smuzhiyun * @ht_capa_mask: The bits of ht_capa which are to be used.
2704*4882a593Smuzhiyun * @wep_keys: static WEP keys, if not NULL points to an array of
2705*4882a593Smuzhiyun * CFG80211_MAX_WEP_KEYS WEP keys
2706*4882a593Smuzhiyun * @wep_tx_key: key index (0..3) of the default TX static WEP key
2707*4882a593Smuzhiyun */
2708*4882a593Smuzhiyun struct cfg80211_ibss_params {
2709*4882a593Smuzhiyun const u8 *ssid;
2710*4882a593Smuzhiyun const u8 *bssid;
2711*4882a593Smuzhiyun struct cfg80211_chan_def chandef;
2712*4882a593Smuzhiyun const u8 *ie;
2713*4882a593Smuzhiyun u8 ssid_len, ie_len;
2714*4882a593Smuzhiyun u16 beacon_interval;
2715*4882a593Smuzhiyun u32 basic_rates;
2716*4882a593Smuzhiyun bool channel_fixed;
2717*4882a593Smuzhiyun bool privacy;
2718*4882a593Smuzhiyun bool control_port;
2719*4882a593Smuzhiyun bool control_port_over_nl80211;
2720*4882a593Smuzhiyun bool userspace_handles_dfs;
2721*4882a593Smuzhiyun int mcast_rate[NUM_NL80211_BANDS];
2722*4882a593Smuzhiyun struct ieee80211_ht_cap ht_capa;
2723*4882a593Smuzhiyun struct ieee80211_ht_cap ht_capa_mask;
2724*4882a593Smuzhiyun struct key_params *wep_keys;
2725*4882a593Smuzhiyun int wep_tx_key;
2726*4882a593Smuzhiyun
2727*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
2728*4882a593Smuzhiyun };
2729*4882a593Smuzhiyun
2730*4882a593Smuzhiyun /**
2731*4882a593Smuzhiyun * struct cfg80211_bss_selection - connection parameters for BSS selection.
2732*4882a593Smuzhiyun *
2733*4882a593Smuzhiyun * @behaviour: requested BSS selection behaviour.
2734*4882a593Smuzhiyun * @param: parameters for requestion behaviour.
2735*4882a593Smuzhiyun * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
2736*4882a593Smuzhiyun * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
2737*4882a593Smuzhiyun */
2738*4882a593Smuzhiyun struct cfg80211_bss_selection {
2739*4882a593Smuzhiyun enum nl80211_bss_select_attr behaviour;
2740*4882a593Smuzhiyun union {
2741*4882a593Smuzhiyun enum nl80211_band band_pref;
2742*4882a593Smuzhiyun struct cfg80211_bss_select_adjust adjust;
2743*4882a593Smuzhiyun } param;
2744*4882a593Smuzhiyun };
2745*4882a593Smuzhiyun
2746*4882a593Smuzhiyun /**
2747*4882a593Smuzhiyun * struct cfg80211_connect_params - Connection parameters
2748*4882a593Smuzhiyun *
2749*4882a593Smuzhiyun * This structure provides information needed to complete IEEE 802.11
2750*4882a593Smuzhiyun * authentication and association.
2751*4882a593Smuzhiyun *
2752*4882a593Smuzhiyun * @channel: The channel to use or %NULL if not specified (auto-select based
2753*4882a593Smuzhiyun * on scan results)
2754*4882a593Smuzhiyun * @channel_hint: The channel of the recommended BSS for initial connection or
2755*4882a593Smuzhiyun * %NULL if not specified
2756*4882a593Smuzhiyun * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2757*4882a593Smuzhiyun * results)
2758*4882a593Smuzhiyun * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
2759*4882a593Smuzhiyun * %NULL if not specified. Unlike the @bssid parameter, the driver is
2760*4882a593Smuzhiyun * allowed to ignore this @bssid_hint if it has knowledge of a better BSS
2761*4882a593Smuzhiyun * to use.
2762*4882a593Smuzhiyun * @ssid: SSID
2763*4882a593Smuzhiyun * @ssid_len: Length of ssid in octets
2764*4882a593Smuzhiyun * @auth_type: Authentication type (algorithm)
2765*4882a593Smuzhiyun * @ie: IEs for association request
2766*4882a593Smuzhiyun * @ie_len: Length of assoc_ie in octets
2767*4882a593Smuzhiyun * @privacy: indicates whether privacy-enabled APs should be used
2768*4882a593Smuzhiyun * @mfp: indicate whether management frame protection is used
2769*4882a593Smuzhiyun * @crypto: crypto settings
2770*4882a593Smuzhiyun * @key_len: length of WEP key for shared key authentication
2771*4882a593Smuzhiyun * @key_idx: index of WEP key for shared key authentication
2772*4882a593Smuzhiyun * @key: WEP key for shared key authentication
2773*4882a593Smuzhiyun * @flags: See &enum cfg80211_assoc_req_flags
2774*4882a593Smuzhiyun * @bg_scan_period: Background scan period in seconds
2775*4882a593Smuzhiyun * or -1 to indicate that default value is to be used.
2776*4882a593Smuzhiyun * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2777*4882a593Smuzhiyun * will be used in ht_capa. Un-supported values will be ignored.
2778*4882a593Smuzhiyun * @ht_capa_mask: The bits of ht_capa which are to be used.
2779*4882a593Smuzhiyun * @vht_capa: VHT Capability overrides
2780*4882a593Smuzhiyun * @vht_capa_mask: The bits of vht_capa which are to be used.
2781*4882a593Smuzhiyun * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
2782*4882a593Smuzhiyun * networks.
2783*4882a593Smuzhiyun * @bss_select: criteria to be used for BSS selection.
2784*4882a593Smuzhiyun * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
2785*4882a593Smuzhiyun * to indicate a request to reassociate within the ESS instead of a request
2786*4882a593Smuzhiyun * do the initial association with the ESS. When included, this is set to
2787*4882a593Smuzhiyun * the BSSID of the current association, i.e., to the value that is
2788*4882a593Smuzhiyun * included in the Current AP address field of the Reassociation Request
2789*4882a593Smuzhiyun * frame.
2790*4882a593Smuzhiyun * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2791*4882a593Smuzhiyun * NAI or %NULL if not specified. This is used to construct FILS wrapped
2792*4882a593Smuzhiyun * data IE.
2793*4882a593Smuzhiyun * @fils_erp_username_len: Length of @fils_erp_username in octets.
2794*4882a593Smuzhiyun * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2795*4882a593Smuzhiyun * %NULL if not specified. This specifies the domain name of ER server and
2796*4882a593Smuzhiyun * is used to construct FILS wrapped data IE.
2797*4882a593Smuzhiyun * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
2798*4882a593Smuzhiyun * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
2799*4882a593Smuzhiyun * messages. This is also used to construct FILS wrapped data IE.
2800*4882a593Smuzhiyun * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
2801*4882a593Smuzhiyun * keys in FILS or %NULL if not specified.
2802*4882a593Smuzhiyun * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
2803*4882a593Smuzhiyun * @want_1x: indicates user-space supports and wants to use 802.1X driver
2804*4882a593Smuzhiyun * offload of 4-way handshake.
2805*4882a593Smuzhiyun * @edmg: define the EDMG channels.
2806*4882a593Smuzhiyun * This may specify multiple channels and bonding options for the driver
2807*4882a593Smuzhiyun * to choose from, based on BSS configuration.
2808*4882a593Smuzhiyun */
2809*4882a593Smuzhiyun struct cfg80211_connect_params {
2810*4882a593Smuzhiyun struct ieee80211_channel *channel;
2811*4882a593Smuzhiyun struct ieee80211_channel *channel_hint;
2812*4882a593Smuzhiyun const u8 *bssid;
2813*4882a593Smuzhiyun const u8 *bssid_hint;
2814*4882a593Smuzhiyun const u8 *ssid;
2815*4882a593Smuzhiyun size_t ssid_len;
2816*4882a593Smuzhiyun enum nl80211_auth_type auth_type;
2817*4882a593Smuzhiyun const u8 *ie;
2818*4882a593Smuzhiyun size_t ie_len;
2819*4882a593Smuzhiyun bool privacy;
2820*4882a593Smuzhiyun enum nl80211_mfp mfp;
2821*4882a593Smuzhiyun struct cfg80211_crypto_settings crypto;
2822*4882a593Smuzhiyun const u8 *key;
2823*4882a593Smuzhiyun u8 key_len, key_idx;
2824*4882a593Smuzhiyun u32 flags;
2825*4882a593Smuzhiyun int bg_scan_period;
2826*4882a593Smuzhiyun struct ieee80211_ht_cap ht_capa;
2827*4882a593Smuzhiyun struct ieee80211_ht_cap ht_capa_mask;
2828*4882a593Smuzhiyun struct ieee80211_vht_cap vht_capa;
2829*4882a593Smuzhiyun struct ieee80211_vht_cap vht_capa_mask;
2830*4882a593Smuzhiyun bool pbss;
2831*4882a593Smuzhiyun struct cfg80211_bss_selection bss_select;
2832*4882a593Smuzhiyun const u8 *prev_bssid;
2833*4882a593Smuzhiyun const u8 *fils_erp_username;
2834*4882a593Smuzhiyun size_t fils_erp_username_len;
2835*4882a593Smuzhiyun const u8 *fils_erp_realm;
2836*4882a593Smuzhiyun size_t fils_erp_realm_len;
2837*4882a593Smuzhiyun u16 fils_erp_next_seq_num;
2838*4882a593Smuzhiyun const u8 *fils_erp_rrk;
2839*4882a593Smuzhiyun size_t fils_erp_rrk_len;
2840*4882a593Smuzhiyun bool want_1x;
2841*4882a593Smuzhiyun struct ieee80211_edmg edmg;
2842*4882a593Smuzhiyun
2843*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
2844*4882a593Smuzhiyun };
2845*4882a593Smuzhiyun
2846*4882a593Smuzhiyun /**
2847*4882a593Smuzhiyun * enum cfg80211_connect_params_changed - Connection parameters being updated
2848*4882a593Smuzhiyun *
2849*4882a593Smuzhiyun * This enum provides information of all connect parameters that
2850*4882a593Smuzhiyun * have to be updated as part of update_connect_params() call.
2851*4882a593Smuzhiyun *
2852*4882a593Smuzhiyun * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
2853*4882a593Smuzhiyun * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
2854*4882a593Smuzhiyun * username, erp sequence number and rrk) are updated
2855*4882a593Smuzhiyun * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
2856*4882a593Smuzhiyun */
2857*4882a593Smuzhiyun enum cfg80211_connect_params_changed {
2858*4882a593Smuzhiyun UPDATE_ASSOC_IES = BIT(0),
2859*4882a593Smuzhiyun UPDATE_FILS_ERP_INFO = BIT(1),
2860*4882a593Smuzhiyun UPDATE_AUTH_TYPE = BIT(2),
2861*4882a593Smuzhiyun };
2862*4882a593Smuzhiyun
2863*4882a593Smuzhiyun /**
2864*4882a593Smuzhiyun * enum wiphy_params_flags - set_wiphy_params bitfield values
2865*4882a593Smuzhiyun * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
2866*4882a593Smuzhiyun * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
2867*4882a593Smuzhiyun * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
2868*4882a593Smuzhiyun * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
2869*4882a593Smuzhiyun * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
2870*4882a593Smuzhiyun * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
2871*4882a593Smuzhiyun * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
2872*4882a593Smuzhiyun * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
2873*4882a593Smuzhiyun * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
2874*4882a593Smuzhiyun */
2875*4882a593Smuzhiyun enum wiphy_params_flags {
2876*4882a593Smuzhiyun WIPHY_PARAM_RETRY_SHORT = 1 << 0,
2877*4882a593Smuzhiyun WIPHY_PARAM_RETRY_LONG = 1 << 1,
2878*4882a593Smuzhiyun WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
2879*4882a593Smuzhiyun WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
2880*4882a593Smuzhiyun WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
2881*4882a593Smuzhiyun WIPHY_PARAM_DYN_ACK = 1 << 5,
2882*4882a593Smuzhiyun WIPHY_PARAM_TXQ_LIMIT = 1 << 6,
2883*4882a593Smuzhiyun WIPHY_PARAM_TXQ_MEMORY_LIMIT = 1 << 7,
2884*4882a593Smuzhiyun WIPHY_PARAM_TXQ_QUANTUM = 1 << 8,
2885*4882a593Smuzhiyun };
2886*4882a593Smuzhiyun
2887*4882a593Smuzhiyun #define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256
2888*4882a593Smuzhiyun
2889*4882a593Smuzhiyun /* The per TXQ device queue limit in airtime */
2890*4882a593Smuzhiyun #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000
2891*4882a593Smuzhiyun #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000
2892*4882a593Smuzhiyun
2893*4882a593Smuzhiyun /* The per interface airtime threshold to switch to lower queue limit */
2894*4882a593Smuzhiyun #define IEEE80211_AQL_THRESHOLD 24000
2895*4882a593Smuzhiyun
2896*4882a593Smuzhiyun /**
2897*4882a593Smuzhiyun * struct cfg80211_pmksa - PMK Security Association
2898*4882a593Smuzhiyun *
2899*4882a593Smuzhiyun * This structure is passed to the set/del_pmksa() method for PMKSA
2900*4882a593Smuzhiyun * caching.
2901*4882a593Smuzhiyun *
2902*4882a593Smuzhiyun * @bssid: The AP's BSSID (may be %NULL).
2903*4882a593Smuzhiyun * @pmkid: The identifier to refer a PMKSA.
2904*4882a593Smuzhiyun * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
2905*4882a593Smuzhiyun * derivation by a FILS STA. Otherwise, %NULL.
2906*4882a593Smuzhiyun * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
2907*4882a593Smuzhiyun * the hash algorithm used to generate this.
2908*4882a593Smuzhiyun * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
2909*4882a593Smuzhiyun * cache identifier (may be %NULL).
2910*4882a593Smuzhiyun * @ssid_len: Length of the @ssid in octets.
2911*4882a593Smuzhiyun * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
2912*4882a593Smuzhiyun * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
2913*4882a593Smuzhiyun * %NULL).
2914*4882a593Smuzhiyun * @pmk_lifetime: Maximum lifetime for PMKSA in seconds
2915*4882a593Smuzhiyun * (dot11RSNAConfigPMKLifetime) or 0 if not specified.
2916*4882a593Smuzhiyun * The configured PMKSA must not be used for PMKSA caching after
2917*4882a593Smuzhiyun * expiration and any keys derived from this PMK become invalid on
2918*4882a593Smuzhiyun * expiration, i.e., the current association must be dropped if the PMK
2919*4882a593Smuzhiyun * used for it expires.
2920*4882a593Smuzhiyun * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
2921*4882a593Smuzhiyun * PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
2922*4882a593Smuzhiyun * Drivers are expected to trigger a full authentication instead of using
2923*4882a593Smuzhiyun * this PMKSA for caching when reassociating to a new BSS after this
2924*4882a593Smuzhiyun * threshold to generate a new PMK before the current one expires.
2925*4882a593Smuzhiyun */
2926*4882a593Smuzhiyun struct cfg80211_pmksa {
2927*4882a593Smuzhiyun const u8 *bssid;
2928*4882a593Smuzhiyun const u8 *pmkid;
2929*4882a593Smuzhiyun const u8 *pmk;
2930*4882a593Smuzhiyun size_t pmk_len;
2931*4882a593Smuzhiyun const u8 *ssid;
2932*4882a593Smuzhiyun size_t ssid_len;
2933*4882a593Smuzhiyun const u8 *cache_id;
2934*4882a593Smuzhiyun u32 pmk_lifetime;
2935*4882a593Smuzhiyun u8 pmk_reauth_threshold;
2936*4882a593Smuzhiyun };
2937*4882a593Smuzhiyun
2938*4882a593Smuzhiyun /**
2939*4882a593Smuzhiyun * struct cfg80211_pkt_pattern - packet pattern
2940*4882a593Smuzhiyun * @mask: bitmask where to match pattern and where to ignore bytes,
2941*4882a593Smuzhiyun * one bit per byte, in same format as nl80211
2942*4882a593Smuzhiyun * @pattern: bytes to match where bitmask is 1
2943*4882a593Smuzhiyun * @pattern_len: length of pattern (in bytes)
2944*4882a593Smuzhiyun * @pkt_offset: packet offset (in bytes)
2945*4882a593Smuzhiyun *
2946*4882a593Smuzhiyun * Internal note: @mask and @pattern are allocated in one chunk of
2947*4882a593Smuzhiyun * memory, free @mask only!
2948*4882a593Smuzhiyun */
2949*4882a593Smuzhiyun struct cfg80211_pkt_pattern {
2950*4882a593Smuzhiyun const u8 *mask, *pattern;
2951*4882a593Smuzhiyun int pattern_len;
2952*4882a593Smuzhiyun int pkt_offset;
2953*4882a593Smuzhiyun };
2954*4882a593Smuzhiyun
2955*4882a593Smuzhiyun /**
2956*4882a593Smuzhiyun * struct cfg80211_wowlan_tcp - TCP connection parameters
2957*4882a593Smuzhiyun *
2958*4882a593Smuzhiyun * @sock: (internal) socket for source port allocation
2959*4882a593Smuzhiyun * @src: source IP address
2960*4882a593Smuzhiyun * @dst: destination IP address
2961*4882a593Smuzhiyun * @dst_mac: destination MAC address
2962*4882a593Smuzhiyun * @src_port: source port
2963*4882a593Smuzhiyun * @dst_port: destination port
2964*4882a593Smuzhiyun * @payload_len: data payload length
2965*4882a593Smuzhiyun * @payload: data payload buffer
2966*4882a593Smuzhiyun * @payload_seq: payload sequence stamping configuration
2967*4882a593Smuzhiyun * @data_interval: interval at which to send data packets
2968*4882a593Smuzhiyun * @wake_len: wakeup payload match length
2969*4882a593Smuzhiyun * @wake_data: wakeup payload match data
2970*4882a593Smuzhiyun * @wake_mask: wakeup payload match mask
2971*4882a593Smuzhiyun * @tokens_size: length of the tokens buffer
2972*4882a593Smuzhiyun * @payload_tok: payload token usage configuration
2973*4882a593Smuzhiyun */
2974*4882a593Smuzhiyun struct cfg80211_wowlan_tcp {
2975*4882a593Smuzhiyun struct socket *sock;
2976*4882a593Smuzhiyun __be32 src, dst;
2977*4882a593Smuzhiyun u16 src_port, dst_port;
2978*4882a593Smuzhiyun u8 dst_mac[ETH_ALEN];
2979*4882a593Smuzhiyun int payload_len;
2980*4882a593Smuzhiyun const u8 *payload;
2981*4882a593Smuzhiyun struct nl80211_wowlan_tcp_data_seq payload_seq;
2982*4882a593Smuzhiyun u32 data_interval;
2983*4882a593Smuzhiyun u32 wake_len;
2984*4882a593Smuzhiyun const u8 *wake_data, *wake_mask;
2985*4882a593Smuzhiyun u32 tokens_size;
2986*4882a593Smuzhiyun /* must be last, variable member */
2987*4882a593Smuzhiyun struct nl80211_wowlan_tcp_data_token payload_tok;
2988*4882a593Smuzhiyun };
2989*4882a593Smuzhiyun
2990*4882a593Smuzhiyun /**
2991*4882a593Smuzhiyun * struct cfg80211_wowlan - Wake on Wireless-LAN support info
2992*4882a593Smuzhiyun *
2993*4882a593Smuzhiyun * This structure defines the enabled WoWLAN triggers for the device.
2994*4882a593Smuzhiyun * @any: wake up on any activity -- special trigger if device continues
2995*4882a593Smuzhiyun * operating as normal during suspend
2996*4882a593Smuzhiyun * @disconnect: wake up if getting disconnected
2997*4882a593Smuzhiyun * @magic_pkt: wake up on receiving magic packet
2998*4882a593Smuzhiyun * @patterns: wake up on receiving packet matching a pattern
2999*4882a593Smuzhiyun * @n_patterns: number of patterns
3000*4882a593Smuzhiyun * @gtk_rekey_failure: wake up on GTK rekey failure
3001*4882a593Smuzhiyun * @eap_identity_req: wake up on EAP identity request packet
3002*4882a593Smuzhiyun * @four_way_handshake: wake up on 4-way handshake
3003*4882a593Smuzhiyun * @rfkill_release: wake up when rfkill is released
3004*4882a593Smuzhiyun * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
3005*4882a593Smuzhiyun * NULL if not configured.
3006*4882a593Smuzhiyun * @nd_config: configuration for the scan to be used for net detect wake.
3007*4882a593Smuzhiyun */
3008*4882a593Smuzhiyun struct cfg80211_wowlan {
3009*4882a593Smuzhiyun bool any, disconnect, magic_pkt, gtk_rekey_failure,
3010*4882a593Smuzhiyun eap_identity_req, four_way_handshake,
3011*4882a593Smuzhiyun rfkill_release;
3012*4882a593Smuzhiyun struct cfg80211_pkt_pattern *patterns;
3013*4882a593Smuzhiyun struct cfg80211_wowlan_tcp *tcp;
3014*4882a593Smuzhiyun int n_patterns;
3015*4882a593Smuzhiyun struct cfg80211_sched_scan_request *nd_config;
3016*4882a593Smuzhiyun };
3017*4882a593Smuzhiyun
3018*4882a593Smuzhiyun /**
3019*4882a593Smuzhiyun * struct cfg80211_coalesce_rules - Coalesce rule parameters
3020*4882a593Smuzhiyun *
3021*4882a593Smuzhiyun * This structure defines coalesce rule for the device.
3022*4882a593Smuzhiyun * @delay: maximum coalescing delay in msecs.
3023*4882a593Smuzhiyun * @condition: condition for packet coalescence.
3024*4882a593Smuzhiyun * see &enum nl80211_coalesce_condition.
3025*4882a593Smuzhiyun * @patterns: array of packet patterns
3026*4882a593Smuzhiyun * @n_patterns: number of patterns
3027*4882a593Smuzhiyun */
3028*4882a593Smuzhiyun struct cfg80211_coalesce_rules {
3029*4882a593Smuzhiyun int delay;
3030*4882a593Smuzhiyun enum nl80211_coalesce_condition condition;
3031*4882a593Smuzhiyun struct cfg80211_pkt_pattern *patterns;
3032*4882a593Smuzhiyun int n_patterns;
3033*4882a593Smuzhiyun };
3034*4882a593Smuzhiyun
3035*4882a593Smuzhiyun /**
3036*4882a593Smuzhiyun * struct cfg80211_coalesce - Packet coalescing settings
3037*4882a593Smuzhiyun *
3038*4882a593Smuzhiyun * This structure defines coalescing settings.
3039*4882a593Smuzhiyun * @rules: array of coalesce rules
3040*4882a593Smuzhiyun * @n_rules: number of rules
3041*4882a593Smuzhiyun */
3042*4882a593Smuzhiyun struct cfg80211_coalesce {
3043*4882a593Smuzhiyun struct cfg80211_coalesce_rules *rules;
3044*4882a593Smuzhiyun int n_rules;
3045*4882a593Smuzhiyun };
3046*4882a593Smuzhiyun
3047*4882a593Smuzhiyun /**
3048*4882a593Smuzhiyun * struct cfg80211_wowlan_nd_match - information about the match
3049*4882a593Smuzhiyun *
3050*4882a593Smuzhiyun * @ssid: SSID of the match that triggered the wake up
3051*4882a593Smuzhiyun * @n_channels: Number of channels where the match occurred. This
3052*4882a593Smuzhiyun * value may be zero if the driver can't report the channels.
3053*4882a593Smuzhiyun * @channels: center frequencies of the channels where a match
3054*4882a593Smuzhiyun * occurred (in MHz)
3055*4882a593Smuzhiyun */
3056*4882a593Smuzhiyun struct cfg80211_wowlan_nd_match {
3057*4882a593Smuzhiyun struct cfg80211_ssid ssid;
3058*4882a593Smuzhiyun int n_channels;
3059*4882a593Smuzhiyun u32 channels[];
3060*4882a593Smuzhiyun };
3061*4882a593Smuzhiyun
3062*4882a593Smuzhiyun /**
3063*4882a593Smuzhiyun * struct cfg80211_wowlan_nd_info - net detect wake up information
3064*4882a593Smuzhiyun *
3065*4882a593Smuzhiyun * @n_matches: Number of match information instances provided in
3066*4882a593Smuzhiyun * @matches. This value may be zero if the driver can't provide
3067*4882a593Smuzhiyun * match information.
3068*4882a593Smuzhiyun * @matches: Array of pointers to matches containing information about
3069*4882a593Smuzhiyun * the matches that triggered the wake up.
3070*4882a593Smuzhiyun */
3071*4882a593Smuzhiyun struct cfg80211_wowlan_nd_info {
3072*4882a593Smuzhiyun int n_matches;
3073*4882a593Smuzhiyun struct cfg80211_wowlan_nd_match *matches[];
3074*4882a593Smuzhiyun };
3075*4882a593Smuzhiyun
3076*4882a593Smuzhiyun /**
3077*4882a593Smuzhiyun * struct cfg80211_wowlan_wakeup - wakeup report
3078*4882a593Smuzhiyun * @disconnect: woke up by getting disconnected
3079*4882a593Smuzhiyun * @magic_pkt: woke up by receiving magic packet
3080*4882a593Smuzhiyun * @gtk_rekey_failure: woke up by GTK rekey failure
3081*4882a593Smuzhiyun * @eap_identity_req: woke up by EAP identity request packet
3082*4882a593Smuzhiyun * @four_way_handshake: woke up by 4-way handshake
3083*4882a593Smuzhiyun * @rfkill_release: woke up by rfkill being released
3084*4882a593Smuzhiyun * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
3085*4882a593Smuzhiyun * @packet_present_len: copied wakeup packet data
3086*4882a593Smuzhiyun * @packet_len: original wakeup packet length
3087*4882a593Smuzhiyun * @packet: The packet causing the wakeup, if any.
3088*4882a593Smuzhiyun * @packet_80211: For pattern match, magic packet and other data
3089*4882a593Smuzhiyun * frame triggers an 802.3 frame should be reported, for
3090*4882a593Smuzhiyun * disconnect due to deauth 802.11 frame. This indicates which
3091*4882a593Smuzhiyun * it is.
3092*4882a593Smuzhiyun * @tcp_match: TCP wakeup packet received
3093*4882a593Smuzhiyun * @tcp_connlost: TCP connection lost or failed to establish
3094*4882a593Smuzhiyun * @tcp_nomoretokens: TCP data ran out of tokens
3095*4882a593Smuzhiyun * @net_detect: if not %NULL, woke up because of net detect
3096*4882a593Smuzhiyun */
3097*4882a593Smuzhiyun struct cfg80211_wowlan_wakeup {
3098*4882a593Smuzhiyun bool disconnect, magic_pkt, gtk_rekey_failure,
3099*4882a593Smuzhiyun eap_identity_req, four_way_handshake,
3100*4882a593Smuzhiyun rfkill_release, packet_80211,
3101*4882a593Smuzhiyun tcp_match, tcp_connlost, tcp_nomoretokens;
3102*4882a593Smuzhiyun s32 pattern_idx;
3103*4882a593Smuzhiyun u32 packet_present_len, packet_len;
3104*4882a593Smuzhiyun const void *packet;
3105*4882a593Smuzhiyun struct cfg80211_wowlan_nd_info *net_detect;
3106*4882a593Smuzhiyun };
3107*4882a593Smuzhiyun
3108*4882a593Smuzhiyun /**
3109*4882a593Smuzhiyun * struct cfg80211_gtk_rekey_data - rekey data
3110*4882a593Smuzhiyun * @kek: key encryption key (@kek_len bytes)
3111*4882a593Smuzhiyun * @kck: key confirmation key (@kck_len bytes)
3112*4882a593Smuzhiyun * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
3113*4882a593Smuzhiyun * @kek_len: length of kek
3114*4882a593Smuzhiyun * @kck_len length of kck
3115*4882a593Smuzhiyun * @akm: akm (oui, id)
3116*4882a593Smuzhiyun */
3117*4882a593Smuzhiyun struct cfg80211_gtk_rekey_data {
3118*4882a593Smuzhiyun const u8 *kek, *kck, *replay_ctr;
3119*4882a593Smuzhiyun u32 akm;
3120*4882a593Smuzhiyun u8 kek_len, kck_len;
3121*4882a593Smuzhiyun };
3122*4882a593Smuzhiyun
3123*4882a593Smuzhiyun /**
3124*4882a593Smuzhiyun * struct cfg80211_update_ft_ies_params - FT IE Information
3125*4882a593Smuzhiyun *
3126*4882a593Smuzhiyun * This structure provides information needed to update the fast transition IE
3127*4882a593Smuzhiyun *
3128*4882a593Smuzhiyun * @md: The Mobility Domain ID, 2 Octet value
3129*4882a593Smuzhiyun * @ie: Fast Transition IEs
3130*4882a593Smuzhiyun * @ie_len: Length of ft_ie in octets
3131*4882a593Smuzhiyun */
3132*4882a593Smuzhiyun struct cfg80211_update_ft_ies_params {
3133*4882a593Smuzhiyun u16 md;
3134*4882a593Smuzhiyun const u8 *ie;
3135*4882a593Smuzhiyun size_t ie_len;
3136*4882a593Smuzhiyun };
3137*4882a593Smuzhiyun
3138*4882a593Smuzhiyun /**
3139*4882a593Smuzhiyun * struct cfg80211_mgmt_tx_params - mgmt tx parameters
3140*4882a593Smuzhiyun *
3141*4882a593Smuzhiyun * This structure provides information needed to transmit a mgmt frame
3142*4882a593Smuzhiyun *
3143*4882a593Smuzhiyun * @chan: channel to use
3144*4882a593Smuzhiyun * @offchan: indicates wether off channel operation is required
3145*4882a593Smuzhiyun * @wait: duration for ROC
3146*4882a593Smuzhiyun * @buf: buffer to transmit
3147*4882a593Smuzhiyun * @len: buffer length
3148*4882a593Smuzhiyun * @no_cck: don't use cck rates for this frame
3149*4882a593Smuzhiyun * @dont_wait_for_ack: tells the low level not to wait for an ack
3150*4882a593Smuzhiyun * @n_csa_offsets: length of csa_offsets array
3151*4882a593Smuzhiyun * @csa_offsets: array of all the csa offsets in the frame
3152*4882a593Smuzhiyun */
3153*4882a593Smuzhiyun struct cfg80211_mgmt_tx_params {
3154*4882a593Smuzhiyun struct ieee80211_channel *chan;
3155*4882a593Smuzhiyun bool offchan;
3156*4882a593Smuzhiyun unsigned int wait;
3157*4882a593Smuzhiyun const u8 *buf;
3158*4882a593Smuzhiyun size_t len;
3159*4882a593Smuzhiyun bool no_cck;
3160*4882a593Smuzhiyun bool dont_wait_for_ack;
3161*4882a593Smuzhiyun int n_csa_offsets;
3162*4882a593Smuzhiyun const u16 *csa_offsets;
3163*4882a593Smuzhiyun };
3164*4882a593Smuzhiyun
3165*4882a593Smuzhiyun /**
3166*4882a593Smuzhiyun * struct cfg80211_dscp_exception - DSCP exception
3167*4882a593Smuzhiyun *
3168*4882a593Smuzhiyun * @dscp: DSCP value that does not adhere to the user priority range definition
3169*4882a593Smuzhiyun * @up: user priority value to which the corresponding DSCP value belongs
3170*4882a593Smuzhiyun */
3171*4882a593Smuzhiyun struct cfg80211_dscp_exception {
3172*4882a593Smuzhiyun u8 dscp;
3173*4882a593Smuzhiyun u8 up;
3174*4882a593Smuzhiyun };
3175*4882a593Smuzhiyun
3176*4882a593Smuzhiyun /**
3177*4882a593Smuzhiyun * struct cfg80211_dscp_range - DSCP range definition for user priority
3178*4882a593Smuzhiyun *
3179*4882a593Smuzhiyun * @low: lowest DSCP value of this user priority range, inclusive
3180*4882a593Smuzhiyun * @high: highest DSCP value of this user priority range, inclusive
3181*4882a593Smuzhiyun */
3182*4882a593Smuzhiyun struct cfg80211_dscp_range {
3183*4882a593Smuzhiyun u8 low;
3184*4882a593Smuzhiyun u8 high;
3185*4882a593Smuzhiyun };
3186*4882a593Smuzhiyun
3187*4882a593Smuzhiyun /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
3188*4882a593Smuzhiyun #define IEEE80211_QOS_MAP_MAX_EX 21
3189*4882a593Smuzhiyun #define IEEE80211_QOS_MAP_LEN_MIN 16
3190*4882a593Smuzhiyun #define IEEE80211_QOS_MAP_LEN_MAX \
3191*4882a593Smuzhiyun (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
3192*4882a593Smuzhiyun
3193*4882a593Smuzhiyun /**
3194*4882a593Smuzhiyun * struct cfg80211_qos_map - QoS Map Information
3195*4882a593Smuzhiyun *
3196*4882a593Smuzhiyun * This struct defines the Interworking QoS map setting for DSCP values
3197*4882a593Smuzhiyun *
3198*4882a593Smuzhiyun * @num_des: number of DSCP exceptions (0..21)
3199*4882a593Smuzhiyun * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
3200*4882a593Smuzhiyun * the user priority DSCP range definition
3201*4882a593Smuzhiyun * @up: DSCP range definition for a particular user priority
3202*4882a593Smuzhiyun */
3203*4882a593Smuzhiyun struct cfg80211_qos_map {
3204*4882a593Smuzhiyun u8 num_des;
3205*4882a593Smuzhiyun struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
3206*4882a593Smuzhiyun struct cfg80211_dscp_range up[8];
3207*4882a593Smuzhiyun };
3208*4882a593Smuzhiyun
3209*4882a593Smuzhiyun /**
3210*4882a593Smuzhiyun * struct cfg80211_nan_conf - NAN configuration
3211*4882a593Smuzhiyun *
3212*4882a593Smuzhiyun * This struct defines NAN configuration parameters
3213*4882a593Smuzhiyun *
3214*4882a593Smuzhiyun * @master_pref: master preference (1 - 255)
3215*4882a593Smuzhiyun * @bands: operating bands, a bitmap of &enum nl80211_band values.
3216*4882a593Smuzhiyun * For instance, for NL80211_BAND_2GHZ, bit 0 would be set
3217*4882a593Smuzhiyun * (i.e. BIT(NL80211_BAND_2GHZ)).
3218*4882a593Smuzhiyun */
3219*4882a593Smuzhiyun struct cfg80211_nan_conf {
3220*4882a593Smuzhiyun u8 master_pref;
3221*4882a593Smuzhiyun u8 bands;
3222*4882a593Smuzhiyun };
3223*4882a593Smuzhiyun
3224*4882a593Smuzhiyun /**
3225*4882a593Smuzhiyun * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
3226*4882a593Smuzhiyun * configuration
3227*4882a593Smuzhiyun *
3228*4882a593Smuzhiyun * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
3229*4882a593Smuzhiyun * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
3230*4882a593Smuzhiyun */
3231*4882a593Smuzhiyun enum cfg80211_nan_conf_changes {
3232*4882a593Smuzhiyun CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
3233*4882a593Smuzhiyun CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
3234*4882a593Smuzhiyun };
3235*4882a593Smuzhiyun
3236*4882a593Smuzhiyun /**
3237*4882a593Smuzhiyun * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
3238*4882a593Smuzhiyun *
3239*4882a593Smuzhiyun * @filter: the content of the filter
3240*4882a593Smuzhiyun * @len: the length of the filter
3241*4882a593Smuzhiyun */
3242*4882a593Smuzhiyun struct cfg80211_nan_func_filter {
3243*4882a593Smuzhiyun const u8 *filter;
3244*4882a593Smuzhiyun u8 len;
3245*4882a593Smuzhiyun };
3246*4882a593Smuzhiyun
3247*4882a593Smuzhiyun /**
3248*4882a593Smuzhiyun * struct cfg80211_nan_func - a NAN function
3249*4882a593Smuzhiyun *
3250*4882a593Smuzhiyun * @type: &enum nl80211_nan_function_type
3251*4882a593Smuzhiyun * @service_id: the service ID of the function
3252*4882a593Smuzhiyun * @publish_type: &nl80211_nan_publish_type
3253*4882a593Smuzhiyun * @close_range: if true, the range should be limited. Threshold is
3254*4882a593Smuzhiyun * implementation specific.
3255*4882a593Smuzhiyun * @publish_bcast: if true, the solicited publish should be broadcasted
3256*4882a593Smuzhiyun * @subscribe_active: if true, the subscribe is active
3257*4882a593Smuzhiyun * @followup_id: the instance ID for follow up
3258*4882a593Smuzhiyun * @followup_reqid: the requestor instance ID for follow up
3259*4882a593Smuzhiyun * @followup_dest: MAC address of the recipient of the follow up
3260*4882a593Smuzhiyun * @ttl: time to live counter in DW.
3261*4882a593Smuzhiyun * @serv_spec_info: Service Specific Info
3262*4882a593Smuzhiyun * @serv_spec_info_len: Service Specific Info length
3263*4882a593Smuzhiyun * @srf_include: if true, SRF is inclusive
3264*4882a593Smuzhiyun * @srf_bf: Bloom Filter
3265*4882a593Smuzhiyun * @srf_bf_len: Bloom Filter length
3266*4882a593Smuzhiyun * @srf_bf_idx: Bloom Filter index
3267*4882a593Smuzhiyun * @srf_macs: SRF MAC addresses
3268*4882a593Smuzhiyun * @srf_num_macs: number of MAC addresses in SRF
3269*4882a593Smuzhiyun * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
3270*4882a593Smuzhiyun * @tx_filters: filters that should be transmitted in the SDF.
3271*4882a593Smuzhiyun * @num_rx_filters: length of &rx_filters.
3272*4882a593Smuzhiyun * @num_tx_filters: length of &tx_filters.
3273*4882a593Smuzhiyun * @instance_id: driver allocated id of the function.
3274*4882a593Smuzhiyun * @cookie: unique NAN function identifier.
3275*4882a593Smuzhiyun */
3276*4882a593Smuzhiyun struct cfg80211_nan_func {
3277*4882a593Smuzhiyun enum nl80211_nan_function_type type;
3278*4882a593Smuzhiyun u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
3279*4882a593Smuzhiyun u8 publish_type;
3280*4882a593Smuzhiyun bool close_range;
3281*4882a593Smuzhiyun bool publish_bcast;
3282*4882a593Smuzhiyun bool subscribe_active;
3283*4882a593Smuzhiyun u8 followup_id;
3284*4882a593Smuzhiyun u8 followup_reqid;
3285*4882a593Smuzhiyun struct mac_address followup_dest;
3286*4882a593Smuzhiyun u32 ttl;
3287*4882a593Smuzhiyun const u8 *serv_spec_info;
3288*4882a593Smuzhiyun u8 serv_spec_info_len;
3289*4882a593Smuzhiyun bool srf_include;
3290*4882a593Smuzhiyun const u8 *srf_bf;
3291*4882a593Smuzhiyun u8 srf_bf_len;
3292*4882a593Smuzhiyun u8 srf_bf_idx;
3293*4882a593Smuzhiyun struct mac_address *srf_macs;
3294*4882a593Smuzhiyun int srf_num_macs;
3295*4882a593Smuzhiyun struct cfg80211_nan_func_filter *rx_filters;
3296*4882a593Smuzhiyun struct cfg80211_nan_func_filter *tx_filters;
3297*4882a593Smuzhiyun u8 num_tx_filters;
3298*4882a593Smuzhiyun u8 num_rx_filters;
3299*4882a593Smuzhiyun u8 instance_id;
3300*4882a593Smuzhiyun u64 cookie;
3301*4882a593Smuzhiyun
3302*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
3303*4882a593Smuzhiyun };
3304*4882a593Smuzhiyun
3305*4882a593Smuzhiyun /**
3306*4882a593Smuzhiyun * struct cfg80211_pmk_conf - PMK configuration
3307*4882a593Smuzhiyun *
3308*4882a593Smuzhiyun * @aa: authenticator address
3309*4882a593Smuzhiyun * @pmk_len: PMK length in bytes.
3310*4882a593Smuzhiyun * @pmk: the PMK material
3311*4882a593Smuzhiyun * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
3312*4882a593Smuzhiyun * is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
3313*4882a593Smuzhiyun * holds PMK-R0.
3314*4882a593Smuzhiyun */
3315*4882a593Smuzhiyun struct cfg80211_pmk_conf {
3316*4882a593Smuzhiyun const u8 *aa;
3317*4882a593Smuzhiyun u8 pmk_len;
3318*4882a593Smuzhiyun const u8 *pmk;
3319*4882a593Smuzhiyun const u8 *pmk_r0_name;
3320*4882a593Smuzhiyun };
3321*4882a593Smuzhiyun
3322*4882a593Smuzhiyun /**
3323*4882a593Smuzhiyun * struct cfg80211_external_auth_params - Trigger External authentication.
3324*4882a593Smuzhiyun *
3325*4882a593Smuzhiyun * Commonly used across the external auth request and event interfaces.
3326*4882a593Smuzhiyun *
3327*4882a593Smuzhiyun * @action: action type / trigger for external authentication. Only significant
3328*4882a593Smuzhiyun * for the authentication request event interface (driver to user space).
3329*4882a593Smuzhiyun * @bssid: BSSID of the peer with which the authentication has
3330*4882a593Smuzhiyun * to happen. Used by both the authentication request event and
3331*4882a593Smuzhiyun * authentication response command interface.
3332*4882a593Smuzhiyun * @ssid: SSID of the AP. Used by both the authentication request event and
3333*4882a593Smuzhiyun * authentication response command interface.
3334*4882a593Smuzhiyun * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
3335*4882a593Smuzhiyun * authentication request event interface.
3336*4882a593Smuzhiyun * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
3337*4882a593Smuzhiyun * use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
3338*4882a593Smuzhiyun * the real status code for failures. Used only for the authentication
3339*4882a593Smuzhiyun * response command interface (user space to driver).
3340*4882a593Smuzhiyun * @pmkid: The identifier to refer a PMKSA.
3341*4882a593Smuzhiyun */
3342*4882a593Smuzhiyun struct cfg80211_external_auth_params {
3343*4882a593Smuzhiyun enum nl80211_external_auth_action action;
3344*4882a593Smuzhiyun u8 bssid[ETH_ALEN] __aligned(2);
3345*4882a593Smuzhiyun struct cfg80211_ssid ssid;
3346*4882a593Smuzhiyun unsigned int key_mgmt_suite;
3347*4882a593Smuzhiyun u16 status;
3348*4882a593Smuzhiyun const u8 *pmkid;
3349*4882a593Smuzhiyun };
3350*4882a593Smuzhiyun
3351*4882a593Smuzhiyun /**
3352*4882a593Smuzhiyun * struct cfg80211_ftm_responder_stats - FTM responder statistics
3353*4882a593Smuzhiyun *
3354*4882a593Smuzhiyun * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
3355*4882a593Smuzhiyun * indicate the relevant values in this struct for them
3356*4882a593Smuzhiyun * @success_num: number of FTM sessions in which all frames were successfully
3357*4882a593Smuzhiyun * answered
3358*4882a593Smuzhiyun * @partial_num: number of FTM sessions in which part of frames were
3359*4882a593Smuzhiyun * successfully answered
3360*4882a593Smuzhiyun * @failed_num: number of failed FTM sessions
3361*4882a593Smuzhiyun * @asap_num: number of ASAP FTM sessions
3362*4882a593Smuzhiyun * @non_asap_num: number of non-ASAP FTM sessions
3363*4882a593Smuzhiyun * @total_duration_ms: total sessions durations - gives an indication
3364*4882a593Smuzhiyun * of how much time the responder was busy
3365*4882a593Smuzhiyun * @unknown_triggers_num: number of unknown FTM triggers - triggers from
3366*4882a593Smuzhiyun * initiators that didn't finish successfully the negotiation phase with
3367*4882a593Smuzhiyun * the responder
3368*4882a593Smuzhiyun * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
3369*4882a593Smuzhiyun * for a new scheduling although it already has scheduled FTM slot
3370*4882a593Smuzhiyun * @out_of_window_triggers_num: total FTM triggers out of scheduled window
3371*4882a593Smuzhiyun */
3372*4882a593Smuzhiyun struct cfg80211_ftm_responder_stats {
3373*4882a593Smuzhiyun u32 filled;
3374*4882a593Smuzhiyun u32 success_num;
3375*4882a593Smuzhiyun u32 partial_num;
3376*4882a593Smuzhiyun u32 failed_num;
3377*4882a593Smuzhiyun u32 asap_num;
3378*4882a593Smuzhiyun u32 non_asap_num;
3379*4882a593Smuzhiyun u64 total_duration_ms;
3380*4882a593Smuzhiyun u32 unknown_triggers_num;
3381*4882a593Smuzhiyun u32 reschedule_requests_num;
3382*4882a593Smuzhiyun u32 out_of_window_triggers_num;
3383*4882a593Smuzhiyun };
3384*4882a593Smuzhiyun
3385*4882a593Smuzhiyun /**
3386*4882a593Smuzhiyun * struct cfg80211_pmsr_ftm_result - FTM result
3387*4882a593Smuzhiyun * @failure_reason: if this measurement failed (PMSR status is
3388*4882a593Smuzhiyun * %NL80211_PMSR_STATUS_FAILURE), this gives a more precise
3389*4882a593Smuzhiyun * reason than just "failure"
3390*4882a593Smuzhiyun * @burst_index: if reporting partial results, this is the index
3391*4882a593Smuzhiyun * in [0 .. num_bursts-1] of the burst that's being reported
3392*4882a593Smuzhiyun * @num_ftmr_attempts: number of FTM request frames transmitted
3393*4882a593Smuzhiyun * @num_ftmr_successes: number of FTM request frames acked
3394*4882a593Smuzhiyun * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
3395*4882a593Smuzhiyun * fill this to indicate in how many seconds a retry is deemed possible
3396*4882a593Smuzhiyun * by the responder
3397*4882a593Smuzhiyun * @num_bursts_exp: actual number of bursts exponent negotiated
3398*4882a593Smuzhiyun * @burst_duration: actual burst duration negotiated
3399*4882a593Smuzhiyun * @ftms_per_burst: actual FTMs per burst negotiated
3400*4882a593Smuzhiyun * @lci_len: length of LCI information (if present)
3401*4882a593Smuzhiyun * @civicloc_len: length of civic location information (if present)
3402*4882a593Smuzhiyun * @lci: LCI data (may be %NULL)
3403*4882a593Smuzhiyun * @civicloc: civic location data (may be %NULL)
3404*4882a593Smuzhiyun * @rssi_avg: average RSSI over FTM action frames reported
3405*4882a593Smuzhiyun * @rssi_spread: spread of the RSSI over FTM action frames reported
3406*4882a593Smuzhiyun * @tx_rate: bitrate for transmitted FTM action frame response
3407*4882a593Smuzhiyun * @rx_rate: bitrate of received FTM action frame
3408*4882a593Smuzhiyun * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
3409*4882a593Smuzhiyun * @rtt_variance: variance of RTTs measured (note that standard deviation is
3410*4882a593Smuzhiyun * the square root of the variance)
3411*4882a593Smuzhiyun * @rtt_spread: spread of the RTTs measured
3412*4882a593Smuzhiyun * @dist_avg: average of distances (mm) measured
3413*4882a593Smuzhiyun * (must have either this or @rtt_avg)
3414*4882a593Smuzhiyun * @dist_variance: variance of distances measured (see also @rtt_variance)
3415*4882a593Smuzhiyun * @dist_spread: spread of distances measured (see also @rtt_spread)
3416*4882a593Smuzhiyun * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
3417*4882a593Smuzhiyun * @num_ftmr_successes_valid: @num_ftmr_successes is valid
3418*4882a593Smuzhiyun * @rssi_avg_valid: @rssi_avg is valid
3419*4882a593Smuzhiyun * @rssi_spread_valid: @rssi_spread is valid
3420*4882a593Smuzhiyun * @tx_rate_valid: @tx_rate is valid
3421*4882a593Smuzhiyun * @rx_rate_valid: @rx_rate is valid
3422*4882a593Smuzhiyun * @rtt_avg_valid: @rtt_avg is valid
3423*4882a593Smuzhiyun * @rtt_variance_valid: @rtt_variance is valid
3424*4882a593Smuzhiyun * @rtt_spread_valid: @rtt_spread is valid
3425*4882a593Smuzhiyun * @dist_avg_valid: @dist_avg is valid
3426*4882a593Smuzhiyun * @dist_variance_valid: @dist_variance is valid
3427*4882a593Smuzhiyun * @dist_spread_valid: @dist_spread is valid
3428*4882a593Smuzhiyun */
3429*4882a593Smuzhiyun struct cfg80211_pmsr_ftm_result {
3430*4882a593Smuzhiyun const u8 *lci;
3431*4882a593Smuzhiyun const u8 *civicloc;
3432*4882a593Smuzhiyun unsigned int lci_len;
3433*4882a593Smuzhiyun unsigned int civicloc_len;
3434*4882a593Smuzhiyun enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
3435*4882a593Smuzhiyun u32 num_ftmr_attempts, num_ftmr_successes;
3436*4882a593Smuzhiyun s16 burst_index;
3437*4882a593Smuzhiyun u8 busy_retry_time;
3438*4882a593Smuzhiyun u8 num_bursts_exp;
3439*4882a593Smuzhiyun u8 burst_duration;
3440*4882a593Smuzhiyun u8 ftms_per_burst;
3441*4882a593Smuzhiyun s32 rssi_avg;
3442*4882a593Smuzhiyun s32 rssi_spread;
3443*4882a593Smuzhiyun struct rate_info tx_rate, rx_rate;
3444*4882a593Smuzhiyun s64 rtt_avg;
3445*4882a593Smuzhiyun s64 rtt_variance;
3446*4882a593Smuzhiyun s64 rtt_spread;
3447*4882a593Smuzhiyun s64 dist_avg;
3448*4882a593Smuzhiyun s64 dist_variance;
3449*4882a593Smuzhiyun s64 dist_spread;
3450*4882a593Smuzhiyun
3451*4882a593Smuzhiyun u16 num_ftmr_attempts_valid:1,
3452*4882a593Smuzhiyun num_ftmr_successes_valid:1,
3453*4882a593Smuzhiyun rssi_avg_valid:1,
3454*4882a593Smuzhiyun rssi_spread_valid:1,
3455*4882a593Smuzhiyun tx_rate_valid:1,
3456*4882a593Smuzhiyun rx_rate_valid:1,
3457*4882a593Smuzhiyun rtt_avg_valid:1,
3458*4882a593Smuzhiyun rtt_variance_valid:1,
3459*4882a593Smuzhiyun rtt_spread_valid:1,
3460*4882a593Smuzhiyun dist_avg_valid:1,
3461*4882a593Smuzhiyun dist_variance_valid:1,
3462*4882a593Smuzhiyun dist_spread_valid:1;
3463*4882a593Smuzhiyun
3464*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
3465*4882a593Smuzhiyun };
3466*4882a593Smuzhiyun
3467*4882a593Smuzhiyun /**
3468*4882a593Smuzhiyun * struct cfg80211_pmsr_result - peer measurement result
3469*4882a593Smuzhiyun * @addr: address of the peer
3470*4882a593Smuzhiyun * @host_time: host time (use ktime_get_boottime() adjust to the time when the
3471*4882a593Smuzhiyun * measurement was made)
3472*4882a593Smuzhiyun * @ap_tsf: AP's TSF at measurement time
3473*4882a593Smuzhiyun * @status: status of the measurement
3474*4882a593Smuzhiyun * @final: if reporting partial results, mark this as the last one; if not
3475*4882a593Smuzhiyun * reporting partial results always set this flag
3476*4882a593Smuzhiyun * @ap_tsf_valid: indicates the @ap_tsf value is valid
3477*4882a593Smuzhiyun * @type: type of the measurement reported, note that we only support reporting
3478*4882a593Smuzhiyun * one type at a time, but you can report multiple results separately and
3479*4882a593Smuzhiyun * they're all aggregated for userspace.
3480*4882a593Smuzhiyun */
3481*4882a593Smuzhiyun struct cfg80211_pmsr_result {
3482*4882a593Smuzhiyun u64 host_time, ap_tsf;
3483*4882a593Smuzhiyun enum nl80211_peer_measurement_status status;
3484*4882a593Smuzhiyun
3485*4882a593Smuzhiyun u8 addr[ETH_ALEN];
3486*4882a593Smuzhiyun
3487*4882a593Smuzhiyun u8 final:1,
3488*4882a593Smuzhiyun ap_tsf_valid:1;
3489*4882a593Smuzhiyun
3490*4882a593Smuzhiyun enum nl80211_peer_measurement_type type;
3491*4882a593Smuzhiyun
3492*4882a593Smuzhiyun union {
3493*4882a593Smuzhiyun struct cfg80211_pmsr_ftm_result ftm;
3494*4882a593Smuzhiyun };
3495*4882a593Smuzhiyun };
3496*4882a593Smuzhiyun
3497*4882a593Smuzhiyun /**
3498*4882a593Smuzhiyun * struct cfg80211_pmsr_ftm_request_peer - FTM request data
3499*4882a593Smuzhiyun * @requested: indicates FTM is requested
3500*4882a593Smuzhiyun * @preamble: frame preamble to use
3501*4882a593Smuzhiyun * @burst_period: burst period to use
3502*4882a593Smuzhiyun * @asap: indicates to use ASAP mode
3503*4882a593Smuzhiyun * @num_bursts_exp: number of bursts exponent
3504*4882a593Smuzhiyun * @burst_duration: burst duration
3505*4882a593Smuzhiyun * @ftms_per_burst: number of FTMs per burst
3506*4882a593Smuzhiyun * @ftmr_retries: number of retries for FTM request
3507*4882a593Smuzhiyun * @request_lci: request LCI information
3508*4882a593Smuzhiyun * @request_civicloc: request civic location information
3509*4882a593Smuzhiyun * @trigger_based: use trigger based ranging for the measurement
3510*4882a593Smuzhiyun * If neither @trigger_based nor @non_trigger_based is set,
3511*4882a593Smuzhiyun * EDCA based ranging will be used.
3512*4882a593Smuzhiyun * @non_trigger_based: use non trigger based ranging for the measurement
3513*4882a593Smuzhiyun * If neither @trigger_based nor @non_trigger_based is set,
3514*4882a593Smuzhiyun * EDCA based ranging will be used.
3515*4882a593Smuzhiyun *
3516*4882a593Smuzhiyun * See also nl80211 for the respective attribute documentation.
3517*4882a593Smuzhiyun */
3518*4882a593Smuzhiyun struct cfg80211_pmsr_ftm_request_peer {
3519*4882a593Smuzhiyun enum nl80211_preamble preamble;
3520*4882a593Smuzhiyun u16 burst_period;
3521*4882a593Smuzhiyun u8 requested:1,
3522*4882a593Smuzhiyun asap:1,
3523*4882a593Smuzhiyun request_lci:1,
3524*4882a593Smuzhiyun request_civicloc:1,
3525*4882a593Smuzhiyun trigger_based:1,
3526*4882a593Smuzhiyun non_trigger_based:1;
3527*4882a593Smuzhiyun u8 num_bursts_exp;
3528*4882a593Smuzhiyun u8 burst_duration;
3529*4882a593Smuzhiyun u8 ftms_per_burst;
3530*4882a593Smuzhiyun u8 ftmr_retries;
3531*4882a593Smuzhiyun };
3532*4882a593Smuzhiyun
3533*4882a593Smuzhiyun /**
3534*4882a593Smuzhiyun * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
3535*4882a593Smuzhiyun * @addr: MAC address
3536*4882a593Smuzhiyun * @chandef: channel to use
3537*4882a593Smuzhiyun * @report_ap_tsf: report the associated AP's TSF
3538*4882a593Smuzhiyun * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
3539*4882a593Smuzhiyun */
3540*4882a593Smuzhiyun struct cfg80211_pmsr_request_peer {
3541*4882a593Smuzhiyun u8 addr[ETH_ALEN];
3542*4882a593Smuzhiyun struct cfg80211_chan_def chandef;
3543*4882a593Smuzhiyun u8 report_ap_tsf:1;
3544*4882a593Smuzhiyun struct cfg80211_pmsr_ftm_request_peer ftm;
3545*4882a593Smuzhiyun };
3546*4882a593Smuzhiyun
3547*4882a593Smuzhiyun /**
3548*4882a593Smuzhiyun * struct cfg80211_pmsr_request - peer measurement request
3549*4882a593Smuzhiyun * @cookie: cookie, set by cfg80211
3550*4882a593Smuzhiyun * @nl_portid: netlink portid - used by cfg80211
3551*4882a593Smuzhiyun * @drv_data: driver data for this request, if required for aborting,
3552*4882a593Smuzhiyun * not otherwise freed or anything by cfg80211
3553*4882a593Smuzhiyun * @mac_addr: MAC address used for (randomised) request
3554*4882a593Smuzhiyun * @mac_addr_mask: MAC address mask used for randomisation, bits that
3555*4882a593Smuzhiyun * are 0 in the mask should be randomised, bits that are 1 should
3556*4882a593Smuzhiyun * be taken from the @mac_addr
3557*4882a593Smuzhiyun * @list: used by cfg80211 to hold on to the request
3558*4882a593Smuzhiyun * @timeout: timeout (in milliseconds) for the whole operation, if
3559*4882a593Smuzhiyun * zero it means there's no timeout
3560*4882a593Smuzhiyun * @n_peers: number of peers to do measurements with
3561*4882a593Smuzhiyun * @peers: per-peer measurement request data
3562*4882a593Smuzhiyun */
3563*4882a593Smuzhiyun struct cfg80211_pmsr_request {
3564*4882a593Smuzhiyun u64 cookie;
3565*4882a593Smuzhiyun void *drv_data;
3566*4882a593Smuzhiyun u32 n_peers;
3567*4882a593Smuzhiyun u32 nl_portid;
3568*4882a593Smuzhiyun
3569*4882a593Smuzhiyun u32 timeout;
3570*4882a593Smuzhiyun
3571*4882a593Smuzhiyun u8 mac_addr[ETH_ALEN] __aligned(2);
3572*4882a593Smuzhiyun u8 mac_addr_mask[ETH_ALEN] __aligned(2);
3573*4882a593Smuzhiyun
3574*4882a593Smuzhiyun struct list_head list;
3575*4882a593Smuzhiyun
3576*4882a593Smuzhiyun struct cfg80211_pmsr_request_peer peers[];
3577*4882a593Smuzhiyun };
3578*4882a593Smuzhiyun
3579*4882a593Smuzhiyun /**
3580*4882a593Smuzhiyun * struct cfg80211_update_owe_info - OWE Information
3581*4882a593Smuzhiyun *
3582*4882a593Smuzhiyun * This structure provides information needed for the drivers to offload OWE
3583*4882a593Smuzhiyun * (Opportunistic Wireless Encryption) processing to the user space.
3584*4882a593Smuzhiyun *
3585*4882a593Smuzhiyun * Commonly used across update_owe_info request and event interfaces.
3586*4882a593Smuzhiyun *
3587*4882a593Smuzhiyun * @peer: MAC address of the peer device for which the OWE processing
3588*4882a593Smuzhiyun * has to be done.
3589*4882a593Smuzhiyun * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
3590*4882a593Smuzhiyun * processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
3591*4882a593Smuzhiyun * cannot give you the real status code for failures. Used only for
3592*4882a593Smuzhiyun * OWE update request command interface (user space to driver).
3593*4882a593Smuzhiyun * @ie: IEs obtained from the peer or constructed by the user space. These are
3594*4882a593Smuzhiyun * the IEs of the remote peer in the event from the host driver and
3595*4882a593Smuzhiyun * the constructed IEs by the user space in the request interface.
3596*4882a593Smuzhiyun * @ie_len: Length of IEs in octets.
3597*4882a593Smuzhiyun */
3598*4882a593Smuzhiyun struct cfg80211_update_owe_info {
3599*4882a593Smuzhiyun u8 peer[ETH_ALEN] __aligned(2);
3600*4882a593Smuzhiyun u16 status;
3601*4882a593Smuzhiyun const u8 *ie;
3602*4882a593Smuzhiyun size_t ie_len;
3603*4882a593Smuzhiyun };
3604*4882a593Smuzhiyun
3605*4882a593Smuzhiyun /**
3606*4882a593Smuzhiyun * struct mgmt_frame_regs - management frame registrations data
3607*4882a593Smuzhiyun * @global_stypes: bitmap of management frame subtypes registered
3608*4882a593Smuzhiyun * for the entire device
3609*4882a593Smuzhiyun * @interface_stypes: bitmap of management frame subtypes registered
3610*4882a593Smuzhiyun * for the given interface
3611*4882a593Smuzhiyun * @global_mcast_rx: mcast RX is needed globally for these subtypes
3612*4882a593Smuzhiyun * @interface_mcast_stypes: mcast RX is needed on this interface
3613*4882a593Smuzhiyun * for these subtypes
3614*4882a593Smuzhiyun */
3615*4882a593Smuzhiyun struct mgmt_frame_regs {
3616*4882a593Smuzhiyun u32 global_stypes, interface_stypes;
3617*4882a593Smuzhiyun u32 global_mcast_stypes, interface_mcast_stypes;
3618*4882a593Smuzhiyun };
3619*4882a593Smuzhiyun
3620*4882a593Smuzhiyun /**
3621*4882a593Smuzhiyun * struct cfg80211_ops - backend description for wireless configuration
3622*4882a593Smuzhiyun *
3623*4882a593Smuzhiyun * This struct is registered by fullmac card drivers and/or wireless stacks
3624*4882a593Smuzhiyun * in order to handle configuration requests on their interfaces.
3625*4882a593Smuzhiyun *
3626*4882a593Smuzhiyun * All callbacks except where otherwise noted should return 0
3627*4882a593Smuzhiyun * on success or a negative error code.
3628*4882a593Smuzhiyun *
3629*4882a593Smuzhiyun * All operations are currently invoked under rtnl for consistency with the
3630*4882a593Smuzhiyun * wireless extensions but this is subject to reevaluation as soon as this
3631*4882a593Smuzhiyun * code is used more widely and we have a first user without wext.
3632*4882a593Smuzhiyun *
3633*4882a593Smuzhiyun * @suspend: wiphy device needs to be suspended. The variable @wow will
3634*4882a593Smuzhiyun * be %NULL or contain the enabled Wake-on-Wireless triggers that are
3635*4882a593Smuzhiyun * configured for the device.
3636*4882a593Smuzhiyun * @resume: wiphy device needs to be resumed
3637*4882a593Smuzhiyun * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
3638*4882a593Smuzhiyun * to call device_set_wakeup_enable() to enable/disable wakeup from
3639*4882a593Smuzhiyun * the device.
3640*4882a593Smuzhiyun *
3641*4882a593Smuzhiyun * @add_virtual_intf: create a new virtual interface with the given name,
3642*4882a593Smuzhiyun * must set the struct wireless_dev's iftype. Beware: You must create
3643*4882a593Smuzhiyun * the new netdev in the wiphy's network namespace! Returns the struct
3644*4882a593Smuzhiyun * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
3645*4882a593Smuzhiyun * also set the address member in the wdev.
3646*4882a593Smuzhiyun *
3647*4882a593Smuzhiyun * @del_virtual_intf: remove the virtual interface
3648*4882a593Smuzhiyun *
3649*4882a593Smuzhiyun * @change_virtual_intf: change type/configuration of virtual interface,
3650*4882a593Smuzhiyun * keep the struct wireless_dev's iftype updated.
3651*4882a593Smuzhiyun *
3652*4882a593Smuzhiyun * @add_key: add a key with the given parameters. @mac_addr will be %NULL
3653*4882a593Smuzhiyun * when adding a group key.
3654*4882a593Smuzhiyun *
3655*4882a593Smuzhiyun * @get_key: get information about the key with the given parameters.
3656*4882a593Smuzhiyun * @mac_addr will be %NULL when requesting information for a group
3657*4882a593Smuzhiyun * key. All pointers given to the @callback function need not be valid
3658*4882a593Smuzhiyun * after it returns. This function should return an error if it is
3659*4882a593Smuzhiyun * not possible to retrieve the key, -ENOENT if it doesn't exist.
3660*4882a593Smuzhiyun *
3661*4882a593Smuzhiyun * @del_key: remove a key given the @mac_addr (%NULL for a group key)
3662*4882a593Smuzhiyun * and @key_index, return -ENOENT if the key doesn't exist.
3663*4882a593Smuzhiyun *
3664*4882a593Smuzhiyun * @set_default_key: set the default key on an interface
3665*4882a593Smuzhiyun *
3666*4882a593Smuzhiyun * @set_default_mgmt_key: set the default management frame key on an interface
3667*4882a593Smuzhiyun *
3668*4882a593Smuzhiyun * @set_default_beacon_key: set the default Beacon frame key on an interface
3669*4882a593Smuzhiyun *
3670*4882a593Smuzhiyun * @set_rekey_data: give the data necessary for GTK rekeying to the driver
3671*4882a593Smuzhiyun *
3672*4882a593Smuzhiyun * @start_ap: Start acting in AP mode defined by the parameters.
3673*4882a593Smuzhiyun * @change_beacon: Change the beacon parameters for an access point mode
3674*4882a593Smuzhiyun * interface. This should reject the call when AP mode wasn't started.
3675*4882a593Smuzhiyun * @stop_ap: Stop being an AP, including stopping beaconing.
3676*4882a593Smuzhiyun *
3677*4882a593Smuzhiyun * @add_station: Add a new station.
3678*4882a593Smuzhiyun * @del_station: Remove a station
3679*4882a593Smuzhiyun * @change_station: Modify a given station. Note that flags changes are not much
3680*4882a593Smuzhiyun * validated in cfg80211, in particular the auth/assoc/authorized flags
3681*4882a593Smuzhiyun * might come to the driver in invalid combinations -- make sure to check
3682*4882a593Smuzhiyun * them, also against the existing state! Drivers must call
3683*4882a593Smuzhiyun * cfg80211_check_station_change() to validate the information.
3684*4882a593Smuzhiyun * @get_station: get station information for the station identified by @mac
3685*4882a593Smuzhiyun * @dump_station: dump station callback -- resume dump at index @idx
3686*4882a593Smuzhiyun *
3687*4882a593Smuzhiyun * @add_mpath: add a fixed mesh path
3688*4882a593Smuzhiyun * @del_mpath: delete a given mesh path
3689*4882a593Smuzhiyun * @change_mpath: change a given mesh path
3690*4882a593Smuzhiyun * @get_mpath: get a mesh path for the given parameters
3691*4882a593Smuzhiyun * @dump_mpath: dump mesh path callback -- resume dump at index @idx
3692*4882a593Smuzhiyun * @get_mpp: get a mesh proxy path for the given parameters
3693*4882a593Smuzhiyun * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
3694*4882a593Smuzhiyun * @join_mesh: join the mesh network with the specified parameters
3695*4882a593Smuzhiyun * (invoked with the wireless_dev mutex held)
3696*4882a593Smuzhiyun * @leave_mesh: leave the current mesh network
3697*4882a593Smuzhiyun * (invoked with the wireless_dev mutex held)
3698*4882a593Smuzhiyun *
3699*4882a593Smuzhiyun * @get_mesh_config: Get the current mesh configuration
3700*4882a593Smuzhiyun *
3701*4882a593Smuzhiyun * @update_mesh_config: Update mesh parameters on a running mesh.
3702*4882a593Smuzhiyun * The mask is a bitfield which tells us which parameters to
3703*4882a593Smuzhiyun * set, and which to leave alone.
3704*4882a593Smuzhiyun *
3705*4882a593Smuzhiyun * @change_bss: Modify parameters for a given BSS.
3706*4882a593Smuzhiyun *
3707*4882a593Smuzhiyun * @set_txq_params: Set TX queue parameters
3708*4882a593Smuzhiyun *
3709*4882a593Smuzhiyun * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
3710*4882a593Smuzhiyun * as it doesn't implement join_mesh and needs to set the channel to
3711*4882a593Smuzhiyun * join the mesh instead.
3712*4882a593Smuzhiyun *
3713*4882a593Smuzhiyun * @set_monitor_channel: Set the monitor mode channel for the device. If other
3714*4882a593Smuzhiyun * interfaces are active this callback should reject the configuration.
3715*4882a593Smuzhiyun * If no interfaces are active or the device is down, the channel should
3716*4882a593Smuzhiyun * be stored for when a monitor interface becomes active.
3717*4882a593Smuzhiyun *
3718*4882a593Smuzhiyun * @scan: Request to do a scan. If returning zero, the scan request is given
3719*4882a593Smuzhiyun * the driver, and will be valid until passed to cfg80211_scan_done().
3720*4882a593Smuzhiyun * For scan results, call cfg80211_inform_bss(); you can call this outside
3721*4882a593Smuzhiyun * the scan/scan_done bracket too.
3722*4882a593Smuzhiyun * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
3723*4882a593Smuzhiyun * indicate the status of the scan through cfg80211_scan_done().
3724*4882a593Smuzhiyun *
3725*4882a593Smuzhiyun * @auth: Request to authenticate with the specified peer
3726*4882a593Smuzhiyun * (invoked with the wireless_dev mutex held)
3727*4882a593Smuzhiyun * @assoc: Request to (re)associate with the specified peer
3728*4882a593Smuzhiyun * (invoked with the wireless_dev mutex held)
3729*4882a593Smuzhiyun * @deauth: Request to deauthenticate from the specified peer
3730*4882a593Smuzhiyun * (invoked with the wireless_dev mutex held)
3731*4882a593Smuzhiyun * @disassoc: Request to disassociate from the specified peer
3732*4882a593Smuzhiyun * (invoked with the wireless_dev mutex held)
3733*4882a593Smuzhiyun *
3734*4882a593Smuzhiyun * @connect: Connect to the ESS with the specified parameters. When connected,
3735*4882a593Smuzhiyun * call cfg80211_connect_result()/cfg80211_connect_bss() with status code
3736*4882a593Smuzhiyun * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
3737*4882a593Smuzhiyun * cfg80211_connect_result()/cfg80211_connect_bss() with the status code
3738*4882a593Smuzhiyun * from the AP or cfg80211_connect_timeout() if no frame with status code
3739*4882a593Smuzhiyun * was received.
3740*4882a593Smuzhiyun * The driver is allowed to roam to other BSSes within the ESS when the
3741*4882a593Smuzhiyun * other BSS matches the connect parameters. When such roaming is initiated
3742*4882a593Smuzhiyun * by the driver, the driver is expected to verify that the target matches
3743*4882a593Smuzhiyun * the configured security parameters and to use Reassociation Request
3744*4882a593Smuzhiyun * frame instead of Association Request frame.
3745*4882a593Smuzhiyun * The connect function can also be used to request the driver to perform a
3746*4882a593Smuzhiyun * specific roam when connected to an ESS. In that case, the prev_bssid
3747*4882a593Smuzhiyun * parameter is set to the BSSID of the currently associated BSS as an
3748*4882a593Smuzhiyun * indication of requesting reassociation.
3749*4882a593Smuzhiyun * In both the driver-initiated and new connect() call initiated roaming
3750*4882a593Smuzhiyun * cases, the result of roaming is indicated with a call to
3751*4882a593Smuzhiyun * cfg80211_roamed(). (invoked with the wireless_dev mutex held)
3752*4882a593Smuzhiyun * @update_connect_params: Update the connect parameters while connected to a
3753*4882a593Smuzhiyun * BSS. The updated parameters can be used by driver/firmware for
3754*4882a593Smuzhiyun * subsequent BSS selection (roaming) decisions and to form the
3755*4882a593Smuzhiyun * Authentication/(Re)Association Request frames. This call does not
3756*4882a593Smuzhiyun * request an immediate disassociation or reassociation with the current
3757*4882a593Smuzhiyun * BSS, i.e., this impacts only subsequent (re)associations. The bits in
3758*4882a593Smuzhiyun * changed are defined in &enum cfg80211_connect_params_changed.
3759*4882a593Smuzhiyun * (invoked with the wireless_dev mutex held)
3760*4882a593Smuzhiyun * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
3761*4882a593Smuzhiyun * connection is in progress. Once done, call cfg80211_disconnected() in
3762*4882a593Smuzhiyun * case connection was already established (invoked with the
3763*4882a593Smuzhiyun * wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
3764*4882a593Smuzhiyun *
3765*4882a593Smuzhiyun * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
3766*4882a593Smuzhiyun * cfg80211_ibss_joined(), also call that function when changing BSSID due
3767*4882a593Smuzhiyun * to a merge.
3768*4882a593Smuzhiyun * (invoked with the wireless_dev mutex held)
3769*4882a593Smuzhiyun * @leave_ibss: Leave the IBSS.
3770*4882a593Smuzhiyun * (invoked with the wireless_dev mutex held)
3771*4882a593Smuzhiyun *
3772*4882a593Smuzhiyun * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
3773*4882a593Smuzhiyun * MESH mode)
3774*4882a593Smuzhiyun *
3775*4882a593Smuzhiyun * @set_wiphy_params: Notify that wiphy parameters have changed;
3776*4882a593Smuzhiyun * @changed bitfield (see &enum wiphy_params_flags) describes which values
3777*4882a593Smuzhiyun * have changed. The actual parameter values are available in
3778*4882a593Smuzhiyun * struct wiphy. If returning an error, no value should be changed.
3779*4882a593Smuzhiyun *
3780*4882a593Smuzhiyun * @set_tx_power: set the transmit power according to the parameters,
3781*4882a593Smuzhiyun * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
3782*4882a593Smuzhiyun * wdev may be %NULL if power was set for the wiphy, and will
3783*4882a593Smuzhiyun * always be %NULL unless the driver supports per-vif TX power
3784*4882a593Smuzhiyun * (as advertised by the nl80211 feature flag.)
3785*4882a593Smuzhiyun * @get_tx_power: store the current TX power into the dbm variable;
3786*4882a593Smuzhiyun * return 0 if successful
3787*4882a593Smuzhiyun *
3788*4882a593Smuzhiyun * @set_wds_peer: set the WDS peer for a WDS interface
3789*4882a593Smuzhiyun *
3790*4882a593Smuzhiyun * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
3791*4882a593Smuzhiyun * functions to adjust rfkill hw state
3792*4882a593Smuzhiyun *
3793*4882a593Smuzhiyun * @dump_survey: get site survey information.
3794*4882a593Smuzhiyun *
3795*4882a593Smuzhiyun * @remain_on_channel: Request the driver to remain awake on the specified
3796*4882a593Smuzhiyun * channel for the specified duration to complete an off-channel
3797*4882a593Smuzhiyun * operation (e.g., public action frame exchange). When the driver is
3798*4882a593Smuzhiyun * ready on the requested channel, it must indicate this with an event
3799*4882a593Smuzhiyun * notification by calling cfg80211_ready_on_channel().
3800*4882a593Smuzhiyun * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
3801*4882a593Smuzhiyun * This allows the operation to be terminated prior to timeout based on
3802*4882a593Smuzhiyun * the duration value.
3803*4882a593Smuzhiyun * @mgmt_tx: Transmit a management frame.
3804*4882a593Smuzhiyun * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
3805*4882a593Smuzhiyun * frame on another channel
3806*4882a593Smuzhiyun *
3807*4882a593Smuzhiyun * @testmode_cmd: run a test mode command; @wdev may be %NULL
3808*4882a593Smuzhiyun * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
3809*4882a593Smuzhiyun * used by the function, but 0 and 1 must not be touched. Additionally,
3810*4882a593Smuzhiyun * return error codes other than -ENOBUFS and -ENOENT will terminate the
3811*4882a593Smuzhiyun * dump and return to userspace with an error, so be careful. If any data
3812*4882a593Smuzhiyun * was passed in from userspace then the data/len arguments will be present
3813*4882a593Smuzhiyun * and point to the data contained in %NL80211_ATTR_TESTDATA.
3814*4882a593Smuzhiyun *
3815*4882a593Smuzhiyun * @set_bitrate_mask: set the bitrate mask configuration
3816*4882a593Smuzhiyun *
3817*4882a593Smuzhiyun * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
3818*4882a593Smuzhiyun * devices running firmwares capable of generating the (re) association
3819*4882a593Smuzhiyun * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
3820*4882a593Smuzhiyun * @del_pmksa: Delete a cached PMKID.
3821*4882a593Smuzhiyun * @flush_pmksa: Flush all cached PMKIDs.
3822*4882a593Smuzhiyun * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
3823*4882a593Smuzhiyun * allows the driver to adjust the dynamic ps timeout value.
3824*4882a593Smuzhiyun * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
3825*4882a593Smuzhiyun * After configuration, the driver should (soon) send an event indicating
3826*4882a593Smuzhiyun * the current level is above/below the configured threshold; this may
3827*4882a593Smuzhiyun * need some care when the configuration is changed (without first being
3828*4882a593Smuzhiyun * disabled.)
3829*4882a593Smuzhiyun * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
3830*4882a593Smuzhiyun * connection quality monitor. An event is to be sent only when the
3831*4882a593Smuzhiyun * signal level is found to be outside the two values. The driver should
3832*4882a593Smuzhiyun * set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
3833*4882a593Smuzhiyun * If it is provided then there's no point providing @set_cqm_rssi_config.
3834*4882a593Smuzhiyun * @set_cqm_txe_config: Configure connection quality monitor TX error
3835*4882a593Smuzhiyun * thresholds.
3836*4882a593Smuzhiyun * @sched_scan_start: Tell the driver to start a scheduled scan.
3837*4882a593Smuzhiyun * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
3838*4882a593Smuzhiyun * given request id. This call must stop the scheduled scan and be ready
3839*4882a593Smuzhiyun * for starting a new one before it returns, i.e. @sched_scan_start may be
3840*4882a593Smuzhiyun * called immediately after that again and should not fail in that case.
3841*4882a593Smuzhiyun * The driver should not call cfg80211_sched_scan_stopped() for a requested
3842*4882a593Smuzhiyun * stop (when this method returns 0).
3843*4882a593Smuzhiyun *
3844*4882a593Smuzhiyun * @update_mgmt_frame_registrations: Notify the driver that management frame
3845*4882a593Smuzhiyun * registrations were updated. The callback is allowed to sleep.
3846*4882a593Smuzhiyun *
3847*4882a593Smuzhiyun * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
3848*4882a593Smuzhiyun * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
3849*4882a593Smuzhiyun * reject TX/RX mask combinations they cannot support by returning -EINVAL
3850*4882a593Smuzhiyun * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
3851*4882a593Smuzhiyun *
3852*4882a593Smuzhiyun * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
3853*4882a593Smuzhiyun *
3854*4882a593Smuzhiyun * @tdls_mgmt: Transmit a TDLS management frame.
3855*4882a593Smuzhiyun * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
3856*4882a593Smuzhiyun *
3857*4882a593Smuzhiyun * @probe_client: probe an associated client, must return a cookie that it
3858*4882a593Smuzhiyun * later passes to cfg80211_probe_status().
3859*4882a593Smuzhiyun *
3860*4882a593Smuzhiyun * @set_noack_map: Set the NoAck Map for the TIDs.
3861*4882a593Smuzhiyun *
3862*4882a593Smuzhiyun * @get_channel: Get the current operating channel for the virtual interface.
3863*4882a593Smuzhiyun * For monitor interfaces, it should return %NULL unless there's a single
3864*4882a593Smuzhiyun * current monitoring channel.
3865*4882a593Smuzhiyun *
3866*4882a593Smuzhiyun * @start_p2p_device: Start the given P2P device.
3867*4882a593Smuzhiyun * @stop_p2p_device: Stop the given P2P device.
3868*4882a593Smuzhiyun *
3869*4882a593Smuzhiyun * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
3870*4882a593Smuzhiyun * Parameters include ACL policy, an array of MAC address of stations
3871*4882a593Smuzhiyun * and the number of MAC addresses. If there is already a list in driver
3872*4882a593Smuzhiyun * this new list replaces the existing one. Driver has to clear its ACL
3873*4882a593Smuzhiyun * when number of MAC addresses entries is passed as 0. Drivers which
3874*4882a593Smuzhiyun * advertise the support for MAC based ACL have to implement this callback.
3875*4882a593Smuzhiyun *
3876*4882a593Smuzhiyun * @start_radar_detection: Start radar detection in the driver.
3877*4882a593Smuzhiyun *
3878*4882a593Smuzhiyun * @end_cac: End running CAC, probably because a related CAC
3879*4882a593Smuzhiyun * was finished on another phy.
3880*4882a593Smuzhiyun *
3881*4882a593Smuzhiyun * @update_ft_ies: Provide updated Fast BSS Transition information to the
3882*4882a593Smuzhiyun * driver. If the SME is in the driver/firmware, this information can be
3883*4882a593Smuzhiyun * used in building Authentication and Reassociation Request frames.
3884*4882a593Smuzhiyun *
3885*4882a593Smuzhiyun * @crit_proto_start: Indicates a critical protocol needs more link reliability
3886*4882a593Smuzhiyun * for a given duration (milliseconds). The protocol is provided so the
3887*4882a593Smuzhiyun * driver can take the most appropriate actions.
3888*4882a593Smuzhiyun * @crit_proto_stop: Indicates critical protocol no longer needs increased link
3889*4882a593Smuzhiyun * reliability. This operation can not fail.
3890*4882a593Smuzhiyun * @set_coalesce: Set coalesce parameters.
3891*4882a593Smuzhiyun *
3892*4882a593Smuzhiyun * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
3893*4882a593Smuzhiyun * responsible for veryfing if the switch is possible. Since this is
3894*4882a593Smuzhiyun * inherently tricky driver may decide to disconnect an interface later
3895*4882a593Smuzhiyun * with cfg80211_stop_iface(). This doesn't mean driver can accept
3896*4882a593Smuzhiyun * everything. It should do it's best to verify requests and reject them
3897*4882a593Smuzhiyun * as soon as possible.
3898*4882a593Smuzhiyun *
3899*4882a593Smuzhiyun * @set_qos_map: Set QoS mapping information to the driver
3900*4882a593Smuzhiyun *
3901*4882a593Smuzhiyun * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
3902*4882a593Smuzhiyun * given interface This is used e.g. for dynamic HT 20/40 MHz channel width
3903*4882a593Smuzhiyun * changes during the lifetime of the BSS.
3904*4882a593Smuzhiyun *
3905*4882a593Smuzhiyun * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
3906*4882a593Smuzhiyun * with the given parameters; action frame exchange has been handled by
3907*4882a593Smuzhiyun * userspace so this just has to modify the TX path to take the TS into
3908*4882a593Smuzhiyun * account.
3909*4882a593Smuzhiyun * If the admitted time is 0 just validate the parameters to make sure
3910*4882a593Smuzhiyun * the session can be created at all; it is valid to just always return
3911*4882a593Smuzhiyun * success for that but that may result in inefficient behaviour (handshake
3912*4882a593Smuzhiyun * with the peer followed by immediate teardown when the addition is later
3913*4882a593Smuzhiyun * rejected)
3914*4882a593Smuzhiyun * @del_tx_ts: remove an existing TX TS
3915*4882a593Smuzhiyun *
3916*4882a593Smuzhiyun * @join_ocb: join the OCB network with the specified parameters
3917*4882a593Smuzhiyun * (invoked with the wireless_dev mutex held)
3918*4882a593Smuzhiyun * @leave_ocb: leave the current OCB network
3919*4882a593Smuzhiyun * (invoked with the wireless_dev mutex held)
3920*4882a593Smuzhiyun *
3921*4882a593Smuzhiyun * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
3922*4882a593Smuzhiyun * is responsible for continually initiating channel-switching operations
3923*4882a593Smuzhiyun * and returning to the base channel for communication with the AP.
3924*4882a593Smuzhiyun * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
3925*4882a593Smuzhiyun * peers must be on the base channel when the call completes.
3926*4882a593Smuzhiyun * @start_nan: Start the NAN interface.
3927*4882a593Smuzhiyun * @stop_nan: Stop the NAN interface.
3928*4882a593Smuzhiyun * @add_nan_func: Add a NAN function. Returns negative value on failure.
3929*4882a593Smuzhiyun * On success @nan_func ownership is transferred to the driver and
3930*4882a593Smuzhiyun * it may access it outside of the scope of this function. The driver
3931*4882a593Smuzhiyun * should free the @nan_func when no longer needed by calling
3932*4882a593Smuzhiyun * cfg80211_free_nan_func().
3933*4882a593Smuzhiyun * On success the driver should assign an instance_id in the
3934*4882a593Smuzhiyun * provided @nan_func.
3935*4882a593Smuzhiyun * @del_nan_func: Delete a NAN function.
3936*4882a593Smuzhiyun * @nan_change_conf: changes NAN configuration. The changed parameters must
3937*4882a593Smuzhiyun * be specified in @changes (using &enum cfg80211_nan_conf_changes);
3938*4882a593Smuzhiyun * All other parameters must be ignored.
3939*4882a593Smuzhiyun *
3940*4882a593Smuzhiyun * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
3941*4882a593Smuzhiyun *
3942*4882a593Smuzhiyun * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
3943*4882a593Smuzhiyun * function should return phy stats, and interface stats otherwise.
3944*4882a593Smuzhiyun *
3945*4882a593Smuzhiyun * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
3946*4882a593Smuzhiyun * If not deleted through @del_pmk the PMK remains valid until disconnect
3947*4882a593Smuzhiyun * upon which the driver should clear it.
3948*4882a593Smuzhiyun * (invoked with the wireless_dev mutex held)
3949*4882a593Smuzhiyun * @del_pmk: delete the previously configured PMK for the given authenticator.
3950*4882a593Smuzhiyun * (invoked with the wireless_dev mutex held)
3951*4882a593Smuzhiyun *
3952*4882a593Smuzhiyun * @external_auth: indicates result of offloaded authentication processing from
3953*4882a593Smuzhiyun * user space
3954*4882a593Smuzhiyun *
3955*4882a593Smuzhiyun * @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter
3956*4882a593Smuzhiyun * tells the driver that the frame should not be encrypted.
3957*4882a593Smuzhiyun *
3958*4882a593Smuzhiyun * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
3959*4882a593Smuzhiyun * Statistics should be cumulative, currently no way to reset is provided.
3960*4882a593Smuzhiyun * @start_pmsr: start peer measurement (e.g. FTM)
3961*4882a593Smuzhiyun * @abort_pmsr: abort peer measurement
3962*4882a593Smuzhiyun *
3963*4882a593Smuzhiyun * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
3964*4882a593Smuzhiyun * but offloading OWE processing to the user space will get the updated
3965*4882a593Smuzhiyun * DH IE through this interface.
3966*4882a593Smuzhiyun *
3967*4882a593Smuzhiyun * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
3968*4882a593Smuzhiyun * and overrule HWMP path selection algorithm.
3969*4882a593Smuzhiyun * @set_tid_config: TID specific configuration, this can be peer or BSS specific
3970*4882a593Smuzhiyun * This callback may sleep.
3971*4882a593Smuzhiyun * @reset_tid_config: Reset TID specific configuration for the peer, for the
3972*4882a593Smuzhiyun * given TIDs. This callback may sleep.
3973*4882a593Smuzhiyun */
3974*4882a593Smuzhiyun struct cfg80211_ops {
3975*4882a593Smuzhiyun int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
3976*4882a593Smuzhiyun int (*resume)(struct wiphy *wiphy);
3977*4882a593Smuzhiyun void (*set_wakeup)(struct wiphy *wiphy, bool enabled);
3978*4882a593Smuzhiyun
3979*4882a593Smuzhiyun struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
3980*4882a593Smuzhiyun const char *name,
3981*4882a593Smuzhiyun unsigned char name_assign_type,
3982*4882a593Smuzhiyun enum nl80211_iftype type,
3983*4882a593Smuzhiyun struct vif_params *params);
3984*4882a593Smuzhiyun int (*del_virtual_intf)(struct wiphy *wiphy,
3985*4882a593Smuzhiyun struct wireless_dev *wdev);
3986*4882a593Smuzhiyun int (*change_virtual_intf)(struct wiphy *wiphy,
3987*4882a593Smuzhiyun struct net_device *dev,
3988*4882a593Smuzhiyun enum nl80211_iftype type,
3989*4882a593Smuzhiyun struct vif_params *params);
3990*4882a593Smuzhiyun
3991*4882a593Smuzhiyun int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
3992*4882a593Smuzhiyun u8 key_index, bool pairwise, const u8 *mac_addr,
3993*4882a593Smuzhiyun struct key_params *params);
3994*4882a593Smuzhiyun int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
3995*4882a593Smuzhiyun u8 key_index, bool pairwise, const u8 *mac_addr,
3996*4882a593Smuzhiyun void *cookie,
3997*4882a593Smuzhiyun void (*callback)(void *cookie, struct key_params*));
3998*4882a593Smuzhiyun int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
3999*4882a593Smuzhiyun u8 key_index, bool pairwise, const u8 *mac_addr);
4000*4882a593Smuzhiyun int (*set_default_key)(struct wiphy *wiphy,
4001*4882a593Smuzhiyun struct net_device *netdev,
4002*4882a593Smuzhiyun u8 key_index, bool unicast, bool multicast);
4003*4882a593Smuzhiyun int (*set_default_mgmt_key)(struct wiphy *wiphy,
4004*4882a593Smuzhiyun struct net_device *netdev,
4005*4882a593Smuzhiyun u8 key_index);
4006*4882a593Smuzhiyun int (*set_default_beacon_key)(struct wiphy *wiphy,
4007*4882a593Smuzhiyun struct net_device *netdev,
4008*4882a593Smuzhiyun u8 key_index);
4009*4882a593Smuzhiyun
4010*4882a593Smuzhiyun int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
4011*4882a593Smuzhiyun struct cfg80211_ap_settings *settings);
4012*4882a593Smuzhiyun int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
4013*4882a593Smuzhiyun struct cfg80211_beacon_data *info);
4014*4882a593Smuzhiyun int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
4015*4882a593Smuzhiyun
4016*4882a593Smuzhiyun
4017*4882a593Smuzhiyun int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
4018*4882a593Smuzhiyun const u8 *mac,
4019*4882a593Smuzhiyun struct station_parameters *params);
4020*4882a593Smuzhiyun int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
4021*4882a593Smuzhiyun struct station_del_parameters *params);
4022*4882a593Smuzhiyun int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
4023*4882a593Smuzhiyun const u8 *mac,
4024*4882a593Smuzhiyun struct station_parameters *params);
4025*4882a593Smuzhiyun int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
4026*4882a593Smuzhiyun const u8 *mac, struct station_info *sinfo);
4027*4882a593Smuzhiyun int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
4028*4882a593Smuzhiyun int idx, u8 *mac, struct station_info *sinfo);
4029*4882a593Smuzhiyun
4030*4882a593Smuzhiyun int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
4031*4882a593Smuzhiyun const u8 *dst, const u8 *next_hop);
4032*4882a593Smuzhiyun int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
4033*4882a593Smuzhiyun const u8 *dst);
4034*4882a593Smuzhiyun int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
4035*4882a593Smuzhiyun const u8 *dst, const u8 *next_hop);
4036*4882a593Smuzhiyun int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
4037*4882a593Smuzhiyun u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
4038*4882a593Smuzhiyun int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
4039*4882a593Smuzhiyun int idx, u8 *dst, u8 *next_hop,
4040*4882a593Smuzhiyun struct mpath_info *pinfo);
4041*4882a593Smuzhiyun int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
4042*4882a593Smuzhiyun u8 *dst, u8 *mpp, struct mpath_info *pinfo);
4043*4882a593Smuzhiyun int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
4044*4882a593Smuzhiyun int idx, u8 *dst, u8 *mpp,
4045*4882a593Smuzhiyun struct mpath_info *pinfo);
4046*4882a593Smuzhiyun int (*get_mesh_config)(struct wiphy *wiphy,
4047*4882a593Smuzhiyun struct net_device *dev,
4048*4882a593Smuzhiyun struct mesh_config *conf);
4049*4882a593Smuzhiyun int (*update_mesh_config)(struct wiphy *wiphy,
4050*4882a593Smuzhiyun struct net_device *dev, u32 mask,
4051*4882a593Smuzhiyun const struct mesh_config *nconf);
4052*4882a593Smuzhiyun int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
4053*4882a593Smuzhiyun const struct mesh_config *conf,
4054*4882a593Smuzhiyun const struct mesh_setup *setup);
4055*4882a593Smuzhiyun int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
4056*4882a593Smuzhiyun
4057*4882a593Smuzhiyun int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
4058*4882a593Smuzhiyun struct ocb_setup *setup);
4059*4882a593Smuzhiyun int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
4060*4882a593Smuzhiyun
4061*4882a593Smuzhiyun int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
4062*4882a593Smuzhiyun struct bss_parameters *params);
4063*4882a593Smuzhiyun
4064*4882a593Smuzhiyun int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
4065*4882a593Smuzhiyun struct ieee80211_txq_params *params);
4066*4882a593Smuzhiyun
4067*4882a593Smuzhiyun int (*libertas_set_mesh_channel)(struct wiphy *wiphy,
4068*4882a593Smuzhiyun struct net_device *dev,
4069*4882a593Smuzhiyun struct ieee80211_channel *chan);
4070*4882a593Smuzhiyun
4071*4882a593Smuzhiyun int (*set_monitor_channel)(struct wiphy *wiphy,
4072*4882a593Smuzhiyun struct cfg80211_chan_def *chandef);
4073*4882a593Smuzhiyun
4074*4882a593Smuzhiyun int (*scan)(struct wiphy *wiphy,
4075*4882a593Smuzhiyun struct cfg80211_scan_request *request);
4076*4882a593Smuzhiyun void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4077*4882a593Smuzhiyun
4078*4882a593Smuzhiyun int (*auth)(struct wiphy *wiphy, struct net_device *dev,
4079*4882a593Smuzhiyun struct cfg80211_auth_request *req);
4080*4882a593Smuzhiyun int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
4081*4882a593Smuzhiyun struct cfg80211_assoc_request *req);
4082*4882a593Smuzhiyun int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
4083*4882a593Smuzhiyun struct cfg80211_deauth_request *req);
4084*4882a593Smuzhiyun int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
4085*4882a593Smuzhiyun struct cfg80211_disassoc_request *req);
4086*4882a593Smuzhiyun
4087*4882a593Smuzhiyun int (*connect)(struct wiphy *wiphy, struct net_device *dev,
4088*4882a593Smuzhiyun struct cfg80211_connect_params *sme);
4089*4882a593Smuzhiyun int (*update_connect_params)(struct wiphy *wiphy,
4090*4882a593Smuzhiyun struct net_device *dev,
4091*4882a593Smuzhiyun struct cfg80211_connect_params *sme,
4092*4882a593Smuzhiyun u32 changed);
4093*4882a593Smuzhiyun int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
4094*4882a593Smuzhiyun u16 reason_code);
4095*4882a593Smuzhiyun
4096*4882a593Smuzhiyun int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
4097*4882a593Smuzhiyun struct cfg80211_ibss_params *params);
4098*4882a593Smuzhiyun int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
4099*4882a593Smuzhiyun
4100*4882a593Smuzhiyun int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
4101*4882a593Smuzhiyun int rate[NUM_NL80211_BANDS]);
4102*4882a593Smuzhiyun
4103*4882a593Smuzhiyun int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
4104*4882a593Smuzhiyun
4105*4882a593Smuzhiyun int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4106*4882a593Smuzhiyun enum nl80211_tx_power_setting type, int mbm);
4107*4882a593Smuzhiyun int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4108*4882a593Smuzhiyun int *dbm);
4109*4882a593Smuzhiyun
4110*4882a593Smuzhiyun int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
4111*4882a593Smuzhiyun const u8 *addr);
4112*4882a593Smuzhiyun
4113*4882a593Smuzhiyun void (*rfkill_poll)(struct wiphy *wiphy);
4114*4882a593Smuzhiyun
4115*4882a593Smuzhiyun #ifdef CONFIG_NL80211_TESTMODE
4116*4882a593Smuzhiyun int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
4117*4882a593Smuzhiyun void *data, int len);
4118*4882a593Smuzhiyun int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
4119*4882a593Smuzhiyun struct netlink_callback *cb,
4120*4882a593Smuzhiyun void *data, int len);
4121*4882a593Smuzhiyun #endif
4122*4882a593Smuzhiyun
4123*4882a593Smuzhiyun int (*set_bitrate_mask)(struct wiphy *wiphy,
4124*4882a593Smuzhiyun struct net_device *dev,
4125*4882a593Smuzhiyun const u8 *peer,
4126*4882a593Smuzhiyun const struct cfg80211_bitrate_mask *mask);
4127*4882a593Smuzhiyun
4128*4882a593Smuzhiyun int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
4129*4882a593Smuzhiyun int idx, struct survey_info *info);
4130*4882a593Smuzhiyun
4131*4882a593Smuzhiyun int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
4132*4882a593Smuzhiyun struct cfg80211_pmksa *pmksa);
4133*4882a593Smuzhiyun int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
4134*4882a593Smuzhiyun struct cfg80211_pmksa *pmksa);
4135*4882a593Smuzhiyun int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
4136*4882a593Smuzhiyun
4137*4882a593Smuzhiyun int (*remain_on_channel)(struct wiphy *wiphy,
4138*4882a593Smuzhiyun struct wireless_dev *wdev,
4139*4882a593Smuzhiyun struct ieee80211_channel *chan,
4140*4882a593Smuzhiyun unsigned int duration,
4141*4882a593Smuzhiyun u64 *cookie);
4142*4882a593Smuzhiyun int (*cancel_remain_on_channel)(struct wiphy *wiphy,
4143*4882a593Smuzhiyun struct wireless_dev *wdev,
4144*4882a593Smuzhiyun u64 cookie);
4145*4882a593Smuzhiyun
4146*4882a593Smuzhiyun int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
4147*4882a593Smuzhiyun struct cfg80211_mgmt_tx_params *params,
4148*4882a593Smuzhiyun u64 *cookie);
4149*4882a593Smuzhiyun int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
4150*4882a593Smuzhiyun struct wireless_dev *wdev,
4151*4882a593Smuzhiyun u64 cookie);
4152*4882a593Smuzhiyun
4153*4882a593Smuzhiyun int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4154*4882a593Smuzhiyun bool enabled, int timeout);
4155*4882a593Smuzhiyun
4156*4882a593Smuzhiyun int (*set_cqm_rssi_config)(struct wiphy *wiphy,
4157*4882a593Smuzhiyun struct net_device *dev,
4158*4882a593Smuzhiyun s32 rssi_thold, u32 rssi_hyst);
4159*4882a593Smuzhiyun
4160*4882a593Smuzhiyun int (*set_cqm_rssi_range_config)(struct wiphy *wiphy,
4161*4882a593Smuzhiyun struct net_device *dev,
4162*4882a593Smuzhiyun s32 rssi_low, s32 rssi_high);
4163*4882a593Smuzhiyun
4164*4882a593Smuzhiyun int (*set_cqm_txe_config)(struct wiphy *wiphy,
4165*4882a593Smuzhiyun struct net_device *dev,
4166*4882a593Smuzhiyun u32 rate, u32 pkts, u32 intvl);
4167*4882a593Smuzhiyun
4168*4882a593Smuzhiyun void (*update_mgmt_frame_registrations)(struct wiphy *wiphy,
4169*4882a593Smuzhiyun struct wireless_dev *wdev,
4170*4882a593Smuzhiyun struct mgmt_frame_regs *upd);
4171*4882a593Smuzhiyun
4172*4882a593Smuzhiyun int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
4173*4882a593Smuzhiyun int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
4174*4882a593Smuzhiyun
4175*4882a593Smuzhiyun int (*sched_scan_start)(struct wiphy *wiphy,
4176*4882a593Smuzhiyun struct net_device *dev,
4177*4882a593Smuzhiyun struct cfg80211_sched_scan_request *request);
4178*4882a593Smuzhiyun int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
4179*4882a593Smuzhiyun u64 reqid);
4180*4882a593Smuzhiyun
4181*4882a593Smuzhiyun int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
4182*4882a593Smuzhiyun struct cfg80211_gtk_rekey_data *data);
4183*4882a593Smuzhiyun
4184*4882a593Smuzhiyun int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4185*4882a593Smuzhiyun const u8 *peer, u8 action_code, u8 dialog_token,
4186*4882a593Smuzhiyun u16 status_code, u32 peer_capability,
4187*4882a593Smuzhiyun bool initiator, const u8 *buf, size_t len);
4188*4882a593Smuzhiyun int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
4189*4882a593Smuzhiyun const u8 *peer, enum nl80211_tdls_operation oper);
4190*4882a593Smuzhiyun
4191*4882a593Smuzhiyun int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,
4192*4882a593Smuzhiyun const u8 *peer, u64 *cookie);
4193*4882a593Smuzhiyun
4194*4882a593Smuzhiyun int (*set_noack_map)(struct wiphy *wiphy,
4195*4882a593Smuzhiyun struct net_device *dev,
4196*4882a593Smuzhiyun u16 noack_map);
4197*4882a593Smuzhiyun
4198*4882a593Smuzhiyun int (*get_channel)(struct wiphy *wiphy,
4199*4882a593Smuzhiyun struct wireless_dev *wdev,
4200*4882a593Smuzhiyun struct cfg80211_chan_def *chandef);
4201*4882a593Smuzhiyun
4202*4882a593Smuzhiyun int (*start_p2p_device)(struct wiphy *wiphy,
4203*4882a593Smuzhiyun struct wireless_dev *wdev);
4204*4882a593Smuzhiyun void (*stop_p2p_device)(struct wiphy *wiphy,
4205*4882a593Smuzhiyun struct wireless_dev *wdev);
4206*4882a593Smuzhiyun
4207*4882a593Smuzhiyun int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
4208*4882a593Smuzhiyun const struct cfg80211_acl_data *params);
4209*4882a593Smuzhiyun
4210*4882a593Smuzhiyun int (*start_radar_detection)(struct wiphy *wiphy,
4211*4882a593Smuzhiyun struct net_device *dev,
4212*4882a593Smuzhiyun struct cfg80211_chan_def *chandef,
4213*4882a593Smuzhiyun u32 cac_time_ms);
4214*4882a593Smuzhiyun void (*end_cac)(struct wiphy *wiphy,
4215*4882a593Smuzhiyun struct net_device *dev);
4216*4882a593Smuzhiyun int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
4217*4882a593Smuzhiyun struct cfg80211_update_ft_ies_params *ftie);
4218*4882a593Smuzhiyun int (*crit_proto_start)(struct wiphy *wiphy,
4219*4882a593Smuzhiyun struct wireless_dev *wdev,
4220*4882a593Smuzhiyun enum nl80211_crit_proto_id protocol,
4221*4882a593Smuzhiyun u16 duration);
4222*4882a593Smuzhiyun void (*crit_proto_stop)(struct wiphy *wiphy,
4223*4882a593Smuzhiyun struct wireless_dev *wdev);
4224*4882a593Smuzhiyun int (*set_coalesce)(struct wiphy *wiphy,
4225*4882a593Smuzhiyun struct cfg80211_coalesce *coalesce);
4226*4882a593Smuzhiyun
4227*4882a593Smuzhiyun int (*channel_switch)(struct wiphy *wiphy,
4228*4882a593Smuzhiyun struct net_device *dev,
4229*4882a593Smuzhiyun struct cfg80211_csa_settings *params);
4230*4882a593Smuzhiyun
4231*4882a593Smuzhiyun int (*set_qos_map)(struct wiphy *wiphy,
4232*4882a593Smuzhiyun struct net_device *dev,
4233*4882a593Smuzhiyun struct cfg80211_qos_map *qos_map);
4234*4882a593Smuzhiyun
4235*4882a593Smuzhiyun int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
4236*4882a593Smuzhiyun struct cfg80211_chan_def *chandef);
4237*4882a593Smuzhiyun
4238*4882a593Smuzhiyun int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4239*4882a593Smuzhiyun u8 tsid, const u8 *peer, u8 user_prio,
4240*4882a593Smuzhiyun u16 admitted_time);
4241*4882a593Smuzhiyun int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4242*4882a593Smuzhiyun u8 tsid, const u8 *peer);
4243*4882a593Smuzhiyun
4244*4882a593Smuzhiyun int (*tdls_channel_switch)(struct wiphy *wiphy,
4245*4882a593Smuzhiyun struct net_device *dev,
4246*4882a593Smuzhiyun const u8 *addr, u8 oper_class,
4247*4882a593Smuzhiyun struct cfg80211_chan_def *chandef);
4248*4882a593Smuzhiyun void (*tdls_cancel_channel_switch)(struct wiphy *wiphy,
4249*4882a593Smuzhiyun struct net_device *dev,
4250*4882a593Smuzhiyun const u8 *addr);
4251*4882a593Smuzhiyun int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
4252*4882a593Smuzhiyun struct cfg80211_nan_conf *conf);
4253*4882a593Smuzhiyun void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4254*4882a593Smuzhiyun int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4255*4882a593Smuzhiyun struct cfg80211_nan_func *nan_func);
4256*4882a593Smuzhiyun void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4257*4882a593Smuzhiyun u64 cookie);
4258*4882a593Smuzhiyun int (*nan_change_conf)(struct wiphy *wiphy,
4259*4882a593Smuzhiyun struct wireless_dev *wdev,
4260*4882a593Smuzhiyun struct cfg80211_nan_conf *conf,
4261*4882a593Smuzhiyun u32 changes);
4262*4882a593Smuzhiyun
4263*4882a593Smuzhiyun int (*set_multicast_to_unicast)(struct wiphy *wiphy,
4264*4882a593Smuzhiyun struct net_device *dev,
4265*4882a593Smuzhiyun const bool enabled);
4266*4882a593Smuzhiyun
4267*4882a593Smuzhiyun int (*get_txq_stats)(struct wiphy *wiphy,
4268*4882a593Smuzhiyun struct wireless_dev *wdev,
4269*4882a593Smuzhiyun struct cfg80211_txq_stats *txqstats);
4270*4882a593Smuzhiyun
4271*4882a593Smuzhiyun int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
4272*4882a593Smuzhiyun const struct cfg80211_pmk_conf *conf);
4273*4882a593Smuzhiyun int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
4274*4882a593Smuzhiyun const u8 *aa);
4275*4882a593Smuzhiyun int (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
4276*4882a593Smuzhiyun struct cfg80211_external_auth_params *params);
4277*4882a593Smuzhiyun
4278*4882a593Smuzhiyun int (*tx_control_port)(struct wiphy *wiphy,
4279*4882a593Smuzhiyun struct net_device *dev,
4280*4882a593Smuzhiyun const u8 *buf, size_t len,
4281*4882a593Smuzhiyun const u8 *dest, const __be16 proto,
4282*4882a593Smuzhiyun const bool noencrypt,
4283*4882a593Smuzhiyun u64 *cookie);
4284*4882a593Smuzhiyun
4285*4882a593Smuzhiyun int (*get_ftm_responder_stats)(struct wiphy *wiphy,
4286*4882a593Smuzhiyun struct net_device *dev,
4287*4882a593Smuzhiyun struct cfg80211_ftm_responder_stats *ftm_stats);
4288*4882a593Smuzhiyun
4289*4882a593Smuzhiyun int (*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
4290*4882a593Smuzhiyun struct cfg80211_pmsr_request *request);
4291*4882a593Smuzhiyun void (*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
4292*4882a593Smuzhiyun struct cfg80211_pmsr_request *request);
4293*4882a593Smuzhiyun int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
4294*4882a593Smuzhiyun struct cfg80211_update_owe_info *owe_info);
4295*4882a593Smuzhiyun int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
4296*4882a593Smuzhiyun const u8 *buf, size_t len);
4297*4882a593Smuzhiyun int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
4298*4882a593Smuzhiyun struct cfg80211_tid_config *tid_conf);
4299*4882a593Smuzhiyun int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
4300*4882a593Smuzhiyun const u8 *peer, u8 tids);
4301*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
4302*4882a593Smuzhiyun ANDROID_KABI_RESERVE(2);
4303*4882a593Smuzhiyun ANDROID_KABI_RESERVE(3);
4304*4882a593Smuzhiyun ANDROID_KABI_RESERVE(4);
4305*4882a593Smuzhiyun };
4306*4882a593Smuzhiyun
4307*4882a593Smuzhiyun /*
4308*4882a593Smuzhiyun * wireless hardware and networking interfaces structures
4309*4882a593Smuzhiyun * and registration/helper functions
4310*4882a593Smuzhiyun */
4311*4882a593Smuzhiyun
4312*4882a593Smuzhiyun /**
4313*4882a593Smuzhiyun * enum wiphy_flags - wiphy capability flags
4314*4882a593Smuzhiyun *
4315*4882a593Smuzhiyun * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split
4316*4882a593Smuzhiyun * into two, first for legacy bands and second for UHB.
4317*4882a593Smuzhiyun * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
4318*4882a593Smuzhiyun * wiphy at all
4319*4882a593Smuzhiyun * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
4320*4882a593Smuzhiyun * by default -- this flag will be set depending on the kernel's default
4321*4882a593Smuzhiyun * on wiphy_new(), but can be changed by the driver if it has a good
4322*4882a593Smuzhiyun * reason to override the default
4323*4882a593Smuzhiyun * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
4324*4882a593Smuzhiyun * on a VLAN interface). This flag also serves an extra purpose of
4325*4882a593Smuzhiyun * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
4326*4882a593Smuzhiyun * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
4327*4882a593Smuzhiyun * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
4328*4882a593Smuzhiyun * control port protocol ethertype. The device also honours the
4329*4882a593Smuzhiyun * control_port_no_encrypt flag.
4330*4882a593Smuzhiyun * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
4331*4882a593Smuzhiyun * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
4332*4882a593Smuzhiyun * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
4333*4882a593Smuzhiyun * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
4334*4882a593Smuzhiyun * firmware.
4335*4882a593Smuzhiyun * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
4336*4882a593Smuzhiyun * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
4337*4882a593Smuzhiyun * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
4338*4882a593Smuzhiyun * link setup/discovery operations internally. Setup, discovery and
4339*4882a593Smuzhiyun * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
4340*4882a593Smuzhiyun * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
4341*4882a593Smuzhiyun * used for asking the driver/firmware to perform a TDLS operation.
4342*4882a593Smuzhiyun * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
4343*4882a593Smuzhiyun * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
4344*4882a593Smuzhiyun * when there are virtual interfaces in AP mode by calling
4345*4882a593Smuzhiyun * cfg80211_report_obss_beacon().
4346*4882a593Smuzhiyun * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
4347*4882a593Smuzhiyun * responds to probe-requests in hardware.
4348*4882a593Smuzhiyun * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
4349*4882a593Smuzhiyun * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
4350*4882a593Smuzhiyun * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
4351*4882a593Smuzhiyun * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
4352*4882a593Smuzhiyun * beaconing mode (AP, IBSS, Mesh, ...).
4353*4882a593Smuzhiyun * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
4354*4882a593Smuzhiyun * before connection.
4355*4882a593Smuzhiyun * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys
4356*4882a593Smuzhiyun */
4357*4882a593Smuzhiyun enum wiphy_flags {
4358*4882a593Smuzhiyun WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0),
4359*4882a593Smuzhiyun /* use hole at 1 */
4360*4882a593Smuzhiyun WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(2),
4361*4882a593Smuzhiyun WIPHY_FLAG_NETNS_OK = BIT(3),
4362*4882a593Smuzhiyun WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4),
4363*4882a593Smuzhiyun WIPHY_FLAG_4ADDR_AP = BIT(5),
4364*4882a593Smuzhiyun WIPHY_FLAG_4ADDR_STATION = BIT(6),
4365*4882a593Smuzhiyun WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7),
4366*4882a593Smuzhiyun WIPHY_FLAG_IBSS_RSN = BIT(8),
4367*4882a593Smuzhiyun WIPHY_FLAG_MESH_AUTH = BIT(10),
4368*4882a593Smuzhiyun /* use hole at 11 */
4369*4882a593Smuzhiyun /* use hole at 12 */
4370*4882a593Smuzhiyun WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13),
4371*4882a593Smuzhiyun WIPHY_FLAG_AP_UAPSD = BIT(14),
4372*4882a593Smuzhiyun WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),
4373*4882a593Smuzhiyun WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16),
4374*4882a593Smuzhiyun WIPHY_FLAG_HAVE_AP_SME = BIT(17),
4375*4882a593Smuzhiyun WIPHY_FLAG_REPORTS_OBSS = BIT(18),
4376*4882a593Smuzhiyun WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),
4377*4882a593Smuzhiyun WIPHY_FLAG_OFFCHAN_TX = BIT(20),
4378*4882a593Smuzhiyun WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),
4379*4882a593Smuzhiyun WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),
4380*4882a593Smuzhiyun WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),
4381*4882a593Smuzhiyun WIPHY_FLAG_HAS_STATIC_WEP = BIT(24),
4382*4882a593Smuzhiyun };
4383*4882a593Smuzhiyun
4384*4882a593Smuzhiyun /**
4385*4882a593Smuzhiyun * struct ieee80211_iface_limit - limit on certain interface types
4386*4882a593Smuzhiyun * @max: maximum number of interfaces of these types
4387*4882a593Smuzhiyun * @types: interface types (bits)
4388*4882a593Smuzhiyun */
4389*4882a593Smuzhiyun struct ieee80211_iface_limit {
4390*4882a593Smuzhiyun u16 max;
4391*4882a593Smuzhiyun u16 types;
4392*4882a593Smuzhiyun };
4393*4882a593Smuzhiyun
4394*4882a593Smuzhiyun /**
4395*4882a593Smuzhiyun * struct ieee80211_iface_combination - possible interface combination
4396*4882a593Smuzhiyun *
4397*4882a593Smuzhiyun * With this structure the driver can describe which interface
4398*4882a593Smuzhiyun * combinations it supports concurrently.
4399*4882a593Smuzhiyun *
4400*4882a593Smuzhiyun * Examples:
4401*4882a593Smuzhiyun *
4402*4882a593Smuzhiyun * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
4403*4882a593Smuzhiyun *
4404*4882a593Smuzhiyun * .. code-block:: c
4405*4882a593Smuzhiyun *
4406*4882a593Smuzhiyun * struct ieee80211_iface_limit limits1[] = {
4407*4882a593Smuzhiyun * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
4408*4882a593Smuzhiyun * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
4409*4882a593Smuzhiyun * };
4410*4882a593Smuzhiyun * struct ieee80211_iface_combination combination1 = {
4411*4882a593Smuzhiyun * .limits = limits1,
4412*4882a593Smuzhiyun * .n_limits = ARRAY_SIZE(limits1),
4413*4882a593Smuzhiyun * .max_interfaces = 2,
4414*4882a593Smuzhiyun * .beacon_int_infra_match = true,
4415*4882a593Smuzhiyun * };
4416*4882a593Smuzhiyun *
4417*4882a593Smuzhiyun *
4418*4882a593Smuzhiyun * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
4419*4882a593Smuzhiyun *
4420*4882a593Smuzhiyun * .. code-block:: c
4421*4882a593Smuzhiyun *
4422*4882a593Smuzhiyun * struct ieee80211_iface_limit limits2[] = {
4423*4882a593Smuzhiyun * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
4424*4882a593Smuzhiyun * BIT(NL80211_IFTYPE_P2P_GO), },
4425*4882a593Smuzhiyun * };
4426*4882a593Smuzhiyun * struct ieee80211_iface_combination combination2 = {
4427*4882a593Smuzhiyun * .limits = limits2,
4428*4882a593Smuzhiyun * .n_limits = ARRAY_SIZE(limits2),
4429*4882a593Smuzhiyun * .max_interfaces = 8,
4430*4882a593Smuzhiyun * .num_different_channels = 1,
4431*4882a593Smuzhiyun * };
4432*4882a593Smuzhiyun *
4433*4882a593Smuzhiyun *
4434*4882a593Smuzhiyun * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
4435*4882a593Smuzhiyun *
4436*4882a593Smuzhiyun * This allows for an infrastructure connection and three P2P connections.
4437*4882a593Smuzhiyun *
4438*4882a593Smuzhiyun * .. code-block:: c
4439*4882a593Smuzhiyun *
4440*4882a593Smuzhiyun * struct ieee80211_iface_limit limits3[] = {
4441*4882a593Smuzhiyun * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
4442*4882a593Smuzhiyun * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
4443*4882a593Smuzhiyun * BIT(NL80211_IFTYPE_P2P_CLIENT), },
4444*4882a593Smuzhiyun * };
4445*4882a593Smuzhiyun * struct ieee80211_iface_combination combination3 = {
4446*4882a593Smuzhiyun * .limits = limits3,
4447*4882a593Smuzhiyun * .n_limits = ARRAY_SIZE(limits3),
4448*4882a593Smuzhiyun * .max_interfaces = 4,
4449*4882a593Smuzhiyun * .num_different_channels = 2,
4450*4882a593Smuzhiyun * };
4451*4882a593Smuzhiyun *
4452*4882a593Smuzhiyun */
4453*4882a593Smuzhiyun struct ieee80211_iface_combination {
4454*4882a593Smuzhiyun /**
4455*4882a593Smuzhiyun * @limits:
4456*4882a593Smuzhiyun * limits for the given interface types
4457*4882a593Smuzhiyun */
4458*4882a593Smuzhiyun const struct ieee80211_iface_limit *limits;
4459*4882a593Smuzhiyun
4460*4882a593Smuzhiyun /**
4461*4882a593Smuzhiyun * @num_different_channels:
4462*4882a593Smuzhiyun * can use up to this many different channels
4463*4882a593Smuzhiyun */
4464*4882a593Smuzhiyun u32 num_different_channels;
4465*4882a593Smuzhiyun
4466*4882a593Smuzhiyun /**
4467*4882a593Smuzhiyun * @max_interfaces:
4468*4882a593Smuzhiyun * maximum number of interfaces in total allowed in this group
4469*4882a593Smuzhiyun */
4470*4882a593Smuzhiyun u16 max_interfaces;
4471*4882a593Smuzhiyun
4472*4882a593Smuzhiyun /**
4473*4882a593Smuzhiyun * @n_limits:
4474*4882a593Smuzhiyun * number of limitations
4475*4882a593Smuzhiyun */
4476*4882a593Smuzhiyun u8 n_limits;
4477*4882a593Smuzhiyun
4478*4882a593Smuzhiyun /**
4479*4882a593Smuzhiyun * @beacon_int_infra_match:
4480*4882a593Smuzhiyun * In this combination, the beacon intervals between infrastructure
4481*4882a593Smuzhiyun * and AP types must match. This is required only in special cases.
4482*4882a593Smuzhiyun */
4483*4882a593Smuzhiyun bool beacon_int_infra_match;
4484*4882a593Smuzhiyun
4485*4882a593Smuzhiyun /**
4486*4882a593Smuzhiyun * @radar_detect_widths:
4487*4882a593Smuzhiyun * bitmap of channel widths supported for radar detection
4488*4882a593Smuzhiyun */
4489*4882a593Smuzhiyun u8 radar_detect_widths;
4490*4882a593Smuzhiyun
4491*4882a593Smuzhiyun /**
4492*4882a593Smuzhiyun * @radar_detect_regions:
4493*4882a593Smuzhiyun * bitmap of regions supported for radar detection
4494*4882a593Smuzhiyun */
4495*4882a593Smuzhiyun u8 radar_detect_regions;
4496*4882a593Smuzhiyun
4497*4882a593Smuzhiyun /**
4498*4882a593Smuzhiyun * @beacon_int_min_gcd:
4499*4882a593Smuzhiyun * This interface combination supports different beacon intervals.
4500*4882a593Smuzhiyun *
4501*4882a593Smuzhiyun * = 0
4502*4882a593Smuzhiyun * all beacon intervals for different interface must be same.
4503*4882a593Smuzhiyun * > 0
4504*4882a593Smuzhiyun * any beacon interval for the interface part of this combination AND
4505*4882a593Smuzhiyun * GCD of all beacon intervals from beaconing interfaces of this
4506*4882a593Smuzhiyun * combination must be greater or equal to this value.
4507*4882a593Smuzhiyun */
4508*4882a593Smuzhiyun u32 beacon_int_min_gcd;
4509*4882a593Smuzhiyun };
4510*4882a593Smuzhiyun
4511*4882a593Smuzhiyun struct ieee80211_txrx_stypes {
4512*4882a593Smuzhiyun u16 tx, rx;
4513*4882a593Smuzhiyun };
4514*4882a593Smuzhiyun
4515*4882a593Smuzhiyun /**
4516*4882a593Smuzhiyun * enum wiphy_wowlan_support_flags - WoWLAN support flags
4517*4882a593Smuzhiyun * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
4518*4882a593Smuzhiyun * trigger that keeps the device operating as-is and
4519*4882a593Smuzhiyun * wakes up the host on any activity, for example a
4520*4882a593Smuzhiyun * received packet that passed filtering; note that the
4521*4882a593Smuzhiyun * packet should be preserved in that case
4522*4882a593Smuzhiyun * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
4523*4882a593Smuzhiyun * (see nl80211.h)
4524*4882a593Smuzhiyun * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
4525*4882a593Smuzhiyun * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
4526*4882a593Smuzhiyun * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
4527*4882a593Smuzhiyun * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
4528*4882a593Smuzhiyun * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
4529*4882a593Smuzhiyun * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
4530*4882a593Smuzhiyun * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
4531*4882a593Smuzhiyun */
4532*4882a593Smuzhiyun enum wiphy_wowlan_support_flags {
4533*4882a593Smuzhiyun WIPHY_WOWLAN_ANY = BIT(0),
4534*4882a593Smuzhiyun WIPHY_WOWLAN_MAGIC_PKT = BIT(1),
4535*4882a593Smuzhiyun WIPHY_WOWLAN_DISCONNECT = BIT(2),
4536*4882a593Smuzhiyun WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3),
4537*4882a593Smuzhiyun WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4),
4538*4882a593Smuzhiyun WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5),
4539*4882a593Smuzhiyun WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6),
4540*4882a593Smuzhiyun WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7),
4541*4882a593Smuzhiyun WIPHY_WOWLAN_NET_DETECT = BIT(8),
4542*4882a593Smuzhiyun };
4543*4882a593Smuzhiyun
4544*4882a593Smuzhiyun struct wiphy_wowlan_tcp_support {
4545*4882a593Smuzhiyun const struct nl80211_wowlan_tcp_data_token_feature *tok;
4546*4882a593Smuzhiyun u32 data_payload_max;
4547*4882a593Smuzhiyun u32 data_interval_max;
4548*4882a593Smuzhiyun u32 wake_payload_max;
4549*4882a593Smuzhiyun bool seq;
4550*4882a593Smuzhiyun };
4551*4882a593Smuzhiyun
4552*4882a593Smuzhiyun /**
4553*4882a593Smuzhiyun * struct wiphy_wowlan_support - WoWLAN support data
4554*4882a593Smuzhiyun * @flags: see &enum wiphy_wowlan_support_flags
4555*4882a593Smuzhiyun * @n_patterns: number of supported wakeup patterns
4556*4882a593Smuzhiyun * (see nl80211.h for the pattern definition)
4557*4882a593Smuzhiyun * @pattern_max_len: maximum length of each pattern
4558*4882a593Smuzhiyun * @pattern_min_len: minimum length of each pattern
4559*4882a593Smuzhiyun * @max_pkt_offset: maximum Rx packet offset
4560*4882a593Smuzhiyun * @max_nd_match_sets: maximum number of matchsets for net-detect,
4561*4882a593Smuzhiyun * similar, but not necessarily identical, to max_match_sets for
4562*4882a593Smuzhiyun * scheduled scans.
4563*4882a593Smuzhiyun * See &struct cfg80211_sched_scan_request.@match_sets for more
4564*4882a593Smuzhiyun * details.
4565*4882a593Smuzhiyun * @tcp: TCP wakeup support information
4566*4882a593Smuzhiyun */
4567*4882a593Smuzhiyun struct wiphy_wowlan_support {
4568*4882a593Smuzhiyun u32 flags;
4569*4882a593Smuzhiyun int n_patterns;
4570*4882a593Smuzhiyun int pattern_max_len;
4571*4882a593Smuzhiyun int pattern_min_len;
4572*4882a593Smuzhiyun int max_pkt_offset;
4573*4882a593Smuzhiyun int max_nd_match_sets;
4574*4882a593Smuzhiyun const struct wiphy_wowlan_tcp_support *tcp;
4575*4882a593Smuzhiyun };
4576*4882a593Smuzhiyun
4577*4882a593Smuzhiyun /**
4578*4882a593Smuzhiyun * struct wiphy_coalesce_support - coalesce support data
4579*4882a593Smuzhiyun * @n_rules: maximum number of coalesce rules
4580*4882a593Smuzhiyun * @max_delay: maximum supported coalescing delay in msecs
4581*4882a593Smuzhiyun * @n_patterns: number of supported patterns in a rule
4582*4882a593Smuzhiyun * (see nl80211.h for the pattern definition)
4583*4882a593Smuzhiyun * @pattern_max_len: maximum length of each pattern
4584*4882a593Smuzhiyun * @pattern_min_len: minimum length of each pattern
4585*4882a593Smuzhiyun * @max_pkt_offset: maximum Rx packet offset
4586*4882a593Smuzhiyun */
4587*4882a593Smuzhiyun struct wiphy_coalesce_support {
4588*4882a593Smuzhiyun int n_rules;
4589*4882a593Smuzhiyun int max_delay;
4590*4882a593Smuzhiyun int n_patterns;
4591*4882a593Smuzhiyun int pattern_max_len;
4592*4882a593Smuzhiyun int pattern_min_len;
4593*4882a593Smuzhiyun int max_pkt_offset;
4594*4882a593Smuzhiyun };
4595*4882a593Smuzhiyun
4596*4882a593Smuzhiyun /**
4597*4882a593Smuzhiyun * enum wiphy_vendor_command_flags - validation flags for vendor commands
4598*4882a593Smuzhiyun * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
4599*4882a593Smuzhiyun * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
4600*4882a593Smuzhiyun * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
4601*4882a593Smuzhiyun * (must be combined with %_WDEV or %_NETDEV)
4602*4882a593Smuzhiyun */
4603*4882a593Smuzhiyun enum wiphy_vendor_command_flags {
4604*4882a593Smuzhiyun WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
4605*4882a593Smuzhiyun WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
4606*4882a593Smuzhiyun WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
4607*4882a593Smuzhiyun };
4608*4882a593Smuzhiyun
4609*4882a593Smuzhiyun /**
4610*4882a593Smuzhiyun * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
4611*4882a593Smuzhiyun *
4612*4882a593Smuzhiyun * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
4613*4882a593Smuzhiyun * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
4614*4882a593Smuzhiyun * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
4615*4882a593Smuzhiyun *
4616*4882a593Smuzhiyun */
4617*4882a593Smuzhiyun enum wiphy_opmode_flag {
4618*4882a593Smuzhiyun STA_OPMODE_MAX_BW_CHANGED = BIT(0),
4619*4882a593Smuzhiyun STA_OPMODE_SMPS_MODE_CHANGED = BIT(1),
4620*4882a593Smuzhiyun STA_OPMODE_N_SS_CHANGED = BIT(2),
4621*4882a593Smuzhiyun };
4622*4882a593Smuzhiyun
4623*4882a593Smuzhiyun /**
4624*4882a593Smuzhiyun * struct sta_opmode_info - Station's ht/vht operation mode information
4625*4882a593Smuzhiyun * @changed: contains value from &enum wiphy_opmode_flag
4626*4882a593Smuzhiyun * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
4627*4882a593Smuzhiyun * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
4628*4882a593Smuzhiyun * @rx_nss: new rx_nss value of a station
4629*4882a593Smuzhiyun */
4630*4882a593Smuzhiyun
4631*4882a593Smuzhiyun struct sta_opmode_info {
4632*4882a593Smuzhiyun u32 changed;
4633*4882a593Smuzhiyun enum nl80211_smps_mode smps_mode;
4634*4882a593Smuzhiyun enum nl80211_chan_width bw;
4635*4882a593Smuzhiyun u8 rx_nss;
4636*4882a593Smuzhiyun };
4637*4882a593Smuzhiyun
4638*4882a593Smuzhiyun #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
4639*4882a593Smuzhiyun
4640*4882a593Smuzhiyun /**
4641*4882a593Smuzhiyun * struct wiphy_vendor_command - vendor command definition
4642*4882a593Smuzhiyun * @info: vendor command identifying information, as used in nl80211
4643*4882a593Smuzhiyun * @flags: flags, see &enum wiphy_vendor_command_flags
4644*4882a593Smuzhiyun * @doit: callback for the operation, note that wdev is %NULL if the
4645*4882a593Smuzhiyun * flags didn't ask for a wdev and non-%NULL otherwise; the data
4646*4882a593Smuzhiyun * pointer may be %NULL if userspace provided no data at all
4647*4882a593Smuzhiyun * @dumpit: dump callback, for transferring bigger/multiple items. The
4648*4882a593Smuzhiyun * @storage points to cb->args[5], ie. is preserved over the multiple
4649*4882a593Smuzhiyun * dumpit calls.
4650*4882a593Smuzhiyun * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
4651*4882a593Smuzhiyun * Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
4652*4882a593Smuzhiyun * attribute is just raw data (e.g. a firmware command).
4653*4882a593Smuzhiyun * @maxattr: highest attribute number in policy
4654*4882a593Smuzhiyun * It's recommended to not have the same sub command with both @doit and
4655*4882a593Smuzhiyun * @dumpit, so that userspace can assume certain ones are get and others
4656*4882a593Smuzhiyun * are used with dump requests.
4657*4882a593Smuzhiyun */
4658*4882a593Smuzhiyun struct wiphy_vendor_command {
4659*4882a593Smuzhiyun struct nl80211_vendor_cmd_info info;
4660*4882a593Smuzhiyun u32 flags;
4661*4882a593Smuzhiyun int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4662*4882a593Smuzhiyun const void *data, int data_len);
4663*4882a593Smuzhiyun int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4664*4882a593Smuzhiyun struct sk_buff *skb, const void *data, int data_len,
4665*4882a593Smuzhiyun unsigned long *storage);
4666*4882a593Smuzhiyun const struct nla_policy *policy;
4667*4882a593Smuzhiyun unsigned int maxattr;
4668*4882a593Smuzhiyun
4669*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
4670*4882a593Smuzhiyun };
4671*4882a593Smuzhiyun
4672*4882a593Smuzhiyun /**
4673*4882a593Smuzhiyun * struct wiphy_iftype_ext_capab - extended capabilities per interface type
4674*4882a593Smuzhiyun * @iftype: interface type
4675*4882a593Smuzhiyun * @extended_capabilities: extended capabilities supported by the driver,
4676*4882a593Smuzhiyun * additional capabilities might be supported by userspace; these are the
4677*4882a593Smuzhiyun * 802.11 extended capabilities ("Extended Capabilities element") and are
4678*4882a593Smuzhiyun * in the same format as in the information element. See IEEE Std
4679*4882a593Smuzhiyun * 802.11-2012 8.4.2.29 for the defined fields.
4680*4882a593Smuzhiyun * @extended_capabilities_mask: mask of the valid values
4681*4882a593Smuzhiyun * @extended_capabilities_len: length of the extended capabilities
4682*4882a593Smuzhiyun */
4683*4882a593Smuzhiyun struct wiphy_iftype_ext_capab {
4684*4882a593Smuzhiyun enum nl80211_iftype iftype;
4685*4882a593Smuzhiyun const u8 *extended_capabilities;
4686*4882a593Smuzhiyun const u8 *extended_capabilities_mask;
4687*4882a593Smuzhiyun u8 extended_capabilities_len;
4688*4882a593Smuzhiyun };
4689*4882a593Smuzhiyun
4690*4882a593Smuzhiyun /**
4691*4882a593Smuzhiyun * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
4692*4882a593Smuzhiyun * @max_peers: maximum number of peers in a single measurement
4693*4882a593Smuzhiyun * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
4694*4882a593Smuzhiyun * @randomize_mac_addr: can randomize MAC address for measurement
4695*4882a593Smuzhiyun * @ftm.supported: FTM measurement is supported
4696*4882a593Smuzhiyun * @ftm.asap: ASAP-mode is supported
4697*4882a593Smuzhiyun * @ftm.non_asap: non-ASAP-mode is supported
4698*4882a593Smuzhiyun * @ftm.request_lci: can request LCI data
4699*4882a593Smuzhiyun * @ftm.request_civicloc: can request civic location data
4700*4882a593Smuzhiyun * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
4701*4882a593Smuzhiyun * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
4702*4882a593Smuzhiyun * @ftm.max_bursts_exponent: maximum burst exponent supported
4703*4882a593Smuzhiyun * (set to -1 if not limited; note that setting this will necessarily
4704*4882a593Smuzhiyun * forbid using the value 15 to let the responder pick)
4705*4882a593Smuzhiyun * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
4706*4882a593Smuzhiyun * not limited)
4707*4882a593Smuzhiyun * @ftm.trigger_based: trigger based ranging measurement is supported
4708*4882a593Smuzhiyun * @ftm.non_trigger_based: non trigger based ranging measurement is supported
4709*4882a593Smuzhiyun */
4710*4882a593Smuzhiyun struct cfg80211_pmsr_capabilities {
4711*4882a593Smuzhiyun unsigned int max_peers;
4712*4882a593Smuzhiyun u8 report_ap_tsf:1,
4713*4882a593Smuzhiyun randomize_mac_addr:1;
4714*4882a593Smuzhiyun
4715*4882a593Smuzhiyun struct {
4716*4882a593Smuzhiyun u32 preambles;
4717*4882a593Smuzhiyun u32 bandwidths;
4718*4882a593Smuzhiyun s8 max_bursts_exponent;
4719*4882a593Smuzhiyun u8 max_ftms_per_burst;
4720*4882a593Smuzhiyun u8 supported:1,
4721*4882a593Smuzhiyun asap:1,
4722*4882a593Smuzhiyun non_asap:1,
4723*4882a593Smuzhiyun request_lci:1,
4724*4882a593Smuzhiyun request_civicloc:1,
4725*4882a593Smuzhiyun trigger_based:1,
4726*4882a593Smuzhiyun non_trigger_based:1;
4727*4882a593Smuzhiyun } ftm;
4728*4882a593Smuzhiyun };
4729*4882a593Smuzhiyun
4730*4882a593Smuzhiyun /**
4731*4882a593Smuzhiyun * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
4732*4882a593Smuzhiyun * suites for interface types defined in @iftypes_mask. Each type in the
4733*4882a593Smuzhiyun * @iftypes_mask must be unique across all instances of iftype_akm_suites.
4734*4882a593Smuzhiyun *
4735*4882a593Smuzhiyun * @iftypes_mask: bitmask of interfaces types
4736*4882a593Smuzhiyun * @akm_suites: points to an array of supported akm suites
4737*4882a593Smuzhiyun * @n_akm_suites: number of supported AKM suites
4738*4882a593Smuzhiyun */
4739*4882a593Smuzhiyun struct wiphy_iftype_akm_suites {
4740*4882a593Smuzhiyun u16 iftypes_mask;
4741*4882a593Smuzhiyun const u32 *akm_suites;
4742*4882a593Smuzhiyun int n_akm_suites;
4743*4882a593Smuzhiyun };
4744*4882a593Smuzhiyun
4745*4882a593Smuzhiyun /**
4746*4882a593Smuzhiyun * struct wiphy - wireless hardware description
4747*4882a593Smuzhiyun * @reg_notifier: the driver's regulatory notification callback,
4748*4882a593Smuzhiyun * note that if your driver uses wiphy_apply_custom_regulatory()
4749*4882a593Smuzhiyun * the reg_notifier's request can be passed as NULL
4750*4882a593Smuzhiyun * @regd: the driver's regulatory domain, if one was requested via
4751*4882a593Smuzhiyun * the regulatory_hint() API. This can be used by the driver
4752*4882a593Smuzhiyun * on the reg_notifier() if it chooses to ignore future
4753*4882a593Smuzhiyun * regulatory domain changes caused by other drivers.
4754*4882a593Smuzhiyun * @signal_type: signal type reported in &struct cfg80211_bss.
4755*4882a593Smuzhiyun * @cipher_suites: supported cipher suites
4756*4882a593Smuzhiyun * @n_cipher_suites: number of supported cipher suites
4757*4882a593Smuzhiyun * @akm_suites: supported AKM suites. These are the default AKMs supported if
4758*4882a593Smuzhiyun * the supported AKMs not advertized for a specific interface type in
4759*4882a593Smuzhiyun * iftype_akm_suites.
4760*4882a593Smuzhiyun * @n_akm_suites: number of supported AKM suites
4761*4882a593Smuzhiyun * @iftype_akm_suites: array of supported akm suites info per interface type.
4762*4882a593Smuzhiyun * Note that the bits in @iftypes_mask inside this structure cannot
4763*4882a593Smuzhiyun * overlap (i.e. only one occurrence of each type is allowed across all
4764*4882a593Smuzhiyun * instances of iftype_akm_suites).
4765*4882a593Smuzhiyun * @num_iftype_akm_suites: number of interface types for which supported akm
4766*4882a593Smuzhiyun * suites are specified separately.
4767*4882a593Smuzhiyun * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
4768*4882a593Smuzhiyun * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
4769*4882a593Smuzhiyun * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
4770*4882a593Smuzhiyun * -1 = fragmentation disabled, only odd values >= 256 used
4771*4882a593Smuzhiyun * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
4772*4882a593Smuzhiyun * @_net: the network namespace this wiphy currently lives in
4773*4882a593Smuzhiyun * @perm_addr: permanent MAC address of this device
4774*4882a593Smuzhiyun * @addr_mask: If the device supports multiple MAC addresses by masking,
4775*4882a593Smuzhiyun * set this to a mask with variable bits set to 1, e.g. if the last
4776*4882a593Smuzhiyun * four bits are variable then set it to 00-00-00-00-00-0f. The actual
4777*4882a593Smuzhiyun * variable bits shall be determined by the interfaces added, with
4778*4882a593Smuzhiyun * interfaces not matching the mask being rejected to be brought up.
4779*4882a593Smuzhiyun * @n_addresses: number of addresses in @addresses.
4780*4882a593Smuzhiyun * @addresses: If the device has more than one address, set this pointer
4781*4882a593Smuzhiyun * to a list of addresses (6 bytes each). The first one will be used
4782*4882a593Smuzhiyun * by default for perm_addr. In this case, the mask should be set to
4783*4882a593Smuzhiyun * all-zeroes. In this case it is assumed that the device can handle
4784*4882a593Smuzhiyun * the same number of arbitrary MAC addresses.
4785*4882a593Smuzhiyun * @registered: protects ->resume and ->suspend sysfs callbacks against
4786*4882a593Smuzhiyun * unregister hardware
4787*4882a593Smuzhiyun * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
4788*4882a593Smuzhiyun * It will be renamed automatically on wiphy renames
4789*4882a593Smuzhiyun * @dev: (virtual) struct device for this wiphy. The item in
4790*4882a593Smuzhiyun * /sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
4791*4882a593Smuzhiyun * (see below).
4792*4882a593Smuzhiyun * @wext: wireless extension handlers
4793*4882a593Smuzhiyun * @priv: driver private data (sized according to wiphy_new() parameter)
4794*4882a593Smuzhiyun * @interface_modes: bitmask of interfaces types valid for this wiphy,
4795*4882a593Smuzhiyun * must be set by driver
4796*4882a593Smuzhiyun * @iface_combinations: Valid interface combinations array, should not
4797*4882a593Smuzhiyun * list single interface types.
4798*4882a593Smuzhiyun * @n_iface_combinations: number of entries in @iface_combinations array.
4799*4882a593Smuzhiyun * @software_iftypes: bitmask of software interface types, these are not
4800*4882a593Smuzhiyun * subject to any restrictions since they are purely managed in SW.
4801*4882a593Smuzhiyun * @flags: wiphy flags, see &enum wiphy_flags
4802*4882a593Smuzhiyun * @regulatory_flags: wiphy regulatory flags, see
4803*4882a593Smuzhiyun * &enum ieee80211_regulatory_flags
4804*4882a593Smuzhiyun * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
4805*4882a593Smuzhiyun * @ext_features: extended features advertised to nl80211, see
4806*4882a593Smuzhiyun * &enum nl80211_ext_feature_index.
4807*4882a593Smuzhiyun * @bss_priv_size: each BSS struct has private data allocated with it,
4808*4882a593Smuzhiyun * this variable determines its size
4809*4882a593Smuzhiyun * @max_scan_ssids: maximum number of SSIDs the device can scan for in
4810*4882a593Smuzhiyun * any given scan
4811*4882a593Smuzhiyun * @max_sched_scan_reqs: maximum number of scheduled scan requests that
4812*4882a593Smuzhiyun * the device can run concurrently.
4813*4882a593Smuzhiyun * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
4814*4882a593Smuzhiyun * for in any given scheduled scan
4815*4882a593Smuzhiyun * @max_match_sets: maximum number of match sets the device can handle
4816*4882a593Smuzhiyun * when performing a scheduled scan, 0 if filtering is not
4817*4882a593Smuzhiyun * supported.
4818*4882a593Smuzhiyun * @max_scan_ie_len: maximum length of user-controlled IEs device can
4819*4882a593Smuzhiyun * add to probe request frames transmitted during a scan, must not
4820*4882a593Smuzhiyun * include fixed IEs like supported rates
4821*4882a593Smuzhiyun * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
4822*4882a593Smuzhiyun * scans
4823*4882a593Smuzhiyun * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
4824*4882a593Smuzhiyun * of iterations) for scheduled scan supported by the device.
4825*4882a593Smuzhiyun * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
4826*4882a593Smuzhiyun * single scan plan supported by the device.
4827*4882a593Smuzhiyun * @max_sched_scan_plan_iterations: maximum number of iterations for a single
4828*4882a593Smuzhiyun * scan plan supported by the device.
4829*4882a593Smuzhiyun * @coverage_class: current coverage class
4830*4882a593Smuzhiyun * @fw_version: firmware version for ethtool reporting
4831*4882a593Smuzhiyun * @hw_version: hardware version for ethtool reporting
4832*4882a593Smuzhiyun * @max_num_pmkids: maximum number of PMKIDs supported by device
4833*4882a593Smuzhiyun * @privid: a pointer that drivers can use to identify if an arbitrary
4834*4882a593Smuzhiyun * wiphy is theirs, e.g. in global notifiers
4835*4882a593Smuzhiyun * @bands: information about bands/channels supported by this device
4836*4882a593Smuzhiyun *
4837*4882a593Smuzhiyun * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
4838*4882a593Smuzhiyun * transmitted through nl80211, points to an array indexed by interface
4839*4882a593Smuzhiyun * type
4840*4882a593Smuzhiyun *
4841*4882a593Smuzhiyun * @available_antennas_tx: bitmap of antennas which are available to be
4842*4882a593Smuzhiyun * configured as TX antennas. Antenna configuration commands will be
4843*4882a593Smuzhiyun * rejected unless this or @available_antennas_rx is set.
4844*4882a593Smuzhiyun *
4845*4882a593Smuzhiyun * @available_antennas_rx: bitmap of antennas which are available to be
4846*4882a593Smuzhiyun * configured as RX antennas. Antenna configuration commands will be
4847*4882a593Smuzhiyun * rejected unless this or @available_antennas_tx is set.
4848*4882a593Smuzhiyun *
4849*4882a593Smuzhiyun * @probe_resp_offload:
4850*4882a593Smuzhiyun * Bitmap of supported protocols for probe response offloading.
4851*4882a593Smuzhiyun * See &enum nl80211_probe_resp_offload_support_attr. Only valid
4852*4882a593Smuzhiyun * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
4853*4882a593Smuzhiyun *
4854*4882a593Smuzhiyun * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
4855*4882a593Smuzhiyun * may request, if implemented.
4856*4882a593Smuzhiyun *
4857*4882a593Smuzhiyun * @wowlan: WoWLAN support information
4858*4882a593Smuzhiyun * @wowlan_config: current WoWLAN configuration; this should usually not be
4859*4882a593Smuzhiyun * used since access to it is necessarily racy, use the parameter passed
4860*4882a593Smuzhiyun * to the suspend() operation instead.
4861*4882a593Smuzhiyun *
4862*4882a593Smuzhiyun * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
4863*4882a593Smuzhiyun * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
4864*4882a593Smuzhiyun * If null, then none can be over-ridden.
4865*4882a593Smuzhiyun * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden.
4866*4882a593Smuzhiyun * If null, then none can be over-ridden.
4867*4882a593Smuzhiyun *
4868*4882a593Smuzhiyun * @wdev_list: the list of associated (virtual) interfaces; this list must
4869*4882a593Smuzhiyun * not be modified by the driver, but can be read with RTNL/RCU protection.
4870*4882a593Smuzhiyun *
4871*4882a593Smuzhiyun * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
4872*4882a593Smuzhiyun * supports for ACL.
4873*4882a593Smuzhiyun *
4874*4882a593Smuzhiyun * @extended_capabilities: extended capabilities supported by the driver,
4875*4882a593Smuzhiyun * additional capabilities might be supported by userspace; these are
4876*4882a593Smuzhiyun * the 802.11 extended capabilities ("Extended Capabilities element")
4877*4882a593Smuzhiyun * and are in the same format as in the information element. See
4878*4882a593Smuzhiyun * 802.11-2012 8.4.2.29 for the defined fields. These are the default
4879*4882a593Smuzhiyun * extended capabilities to be used if the capabilities are not specified
4880*4882a593Smuzhiyun * for a specific interface type in iftype_ext_capab.
4881*4882a593Smuzhiyun * @extended_capabilities_mask: mask of the valid values
4882*4882a593Smuzhiyun * @extended_capabilities_len: length of the extended capabilities
4883*4882a593Smuzhiyun * @iftype_ext_capab: array of extended capabilities per interface type
4884*4882a593Smuzhiyun * @num_iftype_ext_capab: number of interface types for which extended
4885*4882a593Smuzhiyun * capabilities are specified separately.
4886*4882a593Smuzhiyun * @coalesce: packet coalescing support information
4887*4882a593Smuzhiyun *
4888*4882a593Smuzhiyun * @vendor_commands: array of vendor commands supported by the hardware
4889*4882a593Smuzhiyun * @n_vendor_commands: number of vendor commands
4890*4882a593Smuzhiyun * @vendor_events: array of vendor events supported by the hardware
4891*4882a593Smuzhiyun * @n_vendor_events: number of vendor events
4892*4882a593Smuzhiyun *
4893*4882a593Smuzhiyun * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
4894*4882a593Smuzhiyun * (including P2P GO) or 0 to indicate no such limit is advertised. The
4895*4882a593Smuzhiyun * driver is allowed to advertise a theoretical limit that it can reach in
4896*4882a593Smuzhiyun * some cases, but may not always reach.
4897*4882a593Smuzhiyun *
4898*4882a593Smuzhiyun * @max_num_csa_counters: Number of supported csa_counters in beacons
4899*4882a593Smuzhiyun * and probe responses. This value should be set if the driver
4900*4882a593Smuzhiyun * wishes to limit the number of csa counters. Default (0) means
4901*4882a593Smuzhiyun * infinite.
4902*4882a593Smuzhiyun * @bss_select_support: bitmask indicating the BSS selection criteria supported
4903*4882a593Smuzhiyun * by the driver in the .connect() callback. The bit position maps to the
4904*4882a593Smuzhiyun * attribute indices defined in &enum nl80211_bss_select_attr.
4905*4882a593Smuzhiyun *
4906*4882a593Smuzhiyun * @nan_supported_bands: bands supported by the device in NAN mode, a
4907*4882a593Smuzhiyun * bitmap of &enum nl80211_band values. For instance, for
4908*4882a593Smuzhiyun * NL80211_BAND_2GHZ, bit 0 would be set
4909*4882a593Smuzhiyun * (i.e. BIT(NL80211_BAND_2GHZ)).
4910*4882a593Smuzhiyun *
4911*4882a593Smuzhiyun * @txq_limit: configuration of internal TX queue frame limit
4912*4882a593Smuzhiyun * @txq_memory_limit: configuration internal TX queue memory limit
4913*4882a593Smuzhiyun * @txq_quantum: configuration of internal TX queue scheduler quantum
4914*4882a593Smuzhiyun *
4915*4882a593Smuzhiyun * @tx_queue_len: allow setting transmit queue len for drivers not using
4916*4882a593Smuzhiyun * wake_tx_queue
4917*4882a593Smuzhiyun *
4918*4882a593Smuzhiyun * @support_mbssid: can HW support association with nontransmitted AP
4919*4882a593Smuzhiyun * @support_only_he_mbssid: don't parse MBSSID elements if it is not
4920*4882a593Smuzhiyun * HE AP, in order to avoid compatibility issues.
4921*4882a593Smuzhiyun * @support_mbssid must be set for this to have any effect.
4922*4882a593Smuzhiyun *
4923*4882a593Smuzhiyun * @pmsr_capa: peer measurement capabilities
4924*4882a593Smuzhiyun *
4925*4882a593Smuzhiyun * @tid_config_support: describes the per-TID config support that the
4926*4882a593Smuzhiyun * device has
4927*4882a593Smuzhiyun * @tid_config_support.vif: bitmap of attributes (configurations)
4928*4882a593Smuzhiyun * supported by the driver for each vif
4929*4882a593Smuzhiyun * @tid_config_support.peer: bitmap of attributes (configurations)
4930*4882a593Smuzhiyun * supported by the driver for each peer
4931*4882a593Smuzhiyun * @tid_config_support.max_retry: maximum supported retry count for
4932*4882a593Smuzhiyun * long/short retry configuration
4933*4882a593Smuzhiyun *
4934*4882a593Smuzhiyun * @max_data_retry_count: maximum supported per TID retry count for
4935*4882a593Smuzhiyun * configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
4936*4882a593Smuzhiyun * %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes
4937*4882a593Smuzhiyun */
4938*4882a593Smuzhiyun struct wiphy {
4939*4882a593Smuzhiyun /* assign these fields before you register the wiphy */
4940*4882a593Smuzhiyun
4941*4882a593Smuzhiyun u8 perm_addr[ETH_ALEN];
4942*4882a593Smuzhiyun u8 addr_mask[ETH_ALEN];
4943*4882a593Smuzhiyun
4944*4882a593Smuzhiyun struct mac_address *addresses;
4945*4882a593Smuzhiyun
4946*4882a593Smuzhiyun const struct ieee80211_txrx_stypes *mgmt_stypes;
4947*4882a593Smuzhiyun
4948*4882a593Smuzhiyun const struct ieee80211_iface_combination *iface_combinations;
4949*4882a593Smuzhiyun int n_iface_combinations;
4950*4882a593Smuzhiyun u16 software_iftypes;
4951*4882a593Smuzhiyun
4952*4882a593Smuzhiyun u16 n_addresses;
4953*4882a593Smuzhiyun
4954*4882a593Smuzhiyun /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
4955*4882a593Smuzhiyun u16 interface_modes;
4956*4882a593Smuzhiyun
4957*4882a593Smuzhiyun u16 max_acl_mac_addrs;
4958*4882a593Smuzhiyun
4959*4882a593Smuzhiyun u32 flags, regulatory_flags, features;
4960*4882a593Smuzhiyun u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
4961*4882a593Smuzhiyun
4962*4882a593Smuzhiyun u32 ap_sme_capa;
4963*4882a593Smuzhiyun
4964*4882a593Smuzhiyun enum cfg80211_signal_type signal_type;
4965*4882a593Smuzhiyun
4966*4882a593Smuzhiyun int bss_priv_size;
4967*4882a593Smuzhiyun u8 max_scan_ssids;
4968*4882a593Smuzhiyun u8 max_sched_scan_reqs;
4969*4882a593Smuzhiyun u8 max_sched_scan_ssids;
4970*4882a593Smuzhiyun u8 max_match_sets;
4971*4882a593Smuzhiyun u16 max_scan_ie_len;
4972*4882a593Smuzhiyun u16 max_sched_scan_ie_len;
4973*4882a593Smuzhiyun u32 max_sched_scan_plans;
4974*4882a593Smuzhiyun u32 max_sched_scan_plan_interval;
4975*4882a593Smuzhiyun u32 max_sched_scan_plan_iterations;
4976*4882a593Smuzhiyun
4977*4882a593Smuzhiyun int n_cipher_suites;
4978*4882a593Smuzhiyun const u32 *cipher_suites;
4979*4882a593Smuzhiyun
4980*4882a593Smuzhiyun int n_akm_suites;
4981*4882a593Smuzhiyun const u32 *akm_suites;
4982*4882a593Smuzhiyun
4983*4882a593Smuzhiyun const struct wiphy_iftype_akm_suites *iftype_akm_suites;
4984*4882a593Smuzhiyun unsigned int num_iftype_akm_suites;
4985*4882a593Smuzhiyun
4986*4882a593Smuzhiyun u8 retry_short;
4987*4882a593Smuzhiyun u8 retry_long;
4988*4882a593Smuzhiyun u32 frag_threshold;
4989*4882a593Smuzhiyun u32 rts_threshold;
4990*4882a593Smuzhiyun u8 coverage_class;
4991*4882a593Smuzhiyun
4992*4882a593Smuzhiyun char fw_version[ETHTOOL_FWVERS_LEN];
4993*4882a593Smuzhiyun u32 hw_version;
4994*4882a593Smuzhiyun
4995*4882a593Smuzhiyun #ifdef CONFIG_PM
4996*4882a593Smuzhiyun const struct wiphy_wowlan_support *wowlan;
4997*4882a593Smuzhiyun struct cfg80211_wowlan *wowlan_config;
4998*4882a593Smuzhiyun #endif
4999*4882a593Smuzhiyun
5000*4882a593Smuzhiyun u16 max_remain_on_channel_duration;
5001*4882a593Smuzhiyun
5002*4882a593Smuzhiyun u8 max_num_pmkids;
5003*4882a593Smuzhiyun
5004*4882a593Smuzhiyun u32 available_antennas_tx;
5005*4882a593Smuzhiyun u32 available_antennas_rx;
5006*4882a593Smuzhiyun
5007*4882a593Smuzhiyun u32 probe_resp_offload;
5008*4882a593Smuzhiyun
5009*4882a593Smuzhiyun const u8 *extended_capabilities, *extended_capabilities_mask;
5010*4882a593Smuzhiyun u8 extended_capabilities_len;
5011*4882a593Smuzhiyun
5012*4882a593Smuzhiyun const struct wiphy_iftype_ext_capab *iftype_ext_capab;
5013*4882a593Smuzhiyun unsigned int num_iftype_ext_capab;
5014*4882a593Smuzhiyun
5015*4882a593Smuzhiyun const void *privid;
5016*4882a593Smuzhiyun
5017*4882a593Smuzhiyun struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
5018*4882a593Smuzhiyun
5019*4882a593Smuzhiyun void (*reg_notifier)(struct wiphy *wiphy,
5020*4882a593Smuzhiyun struct regulatory_request *request);
5021*4882a593Smuzhiyun
5022*4882a593Smuzhiyun /* fields below are read-only, assigned by cfg80211 */
5023*4882a593Smuzhiyun
5024*4882a593Smuzhiyun const struct ieee80211_regdomain __rcu *regd;
5025*4882a593Smuzhiyun
5026*4882a593Smuzhiyun struct device dev;
5027*4882a593Smuzhiyun
5028*4882a593Smuzhiyun bool registered;
5029*4882a593Smuzhiyun
5030*4882a593Smuzhiyun struct dentry *debugfsdir;
5031*4882a593Smuzhiyun
5032*4882a593Smuzhiyun const struct ieee80211_ht_cap *ht_capa_mod_mask;
5033*4882a593Smuzhiyun const struct ieee80211_vht_cap *vht_capa_mod_mask;
5034*4882a593Smuzhiyun
5035*4882a593Smuzhiyun struct list_head wdev_list;
5036*4882a593Smuzhiyun
5037*4882a593Smuzhiyun possible_net_t _net;
5038*4882a593Smuzhiyun
5039*4882a593Smuzhiyun #ifdef CONFIG_CFG80211_WEXT
5040*4882a593Smuzhiyun const struct iw_handler_def *wext;
5041*4882a593Smuzhiyun #endif
5042*4882a593Smuzhiyun
5043*4882a593Smuzhiyun const struct wiphy_coalesce_support *coalesce;
5044*4882a593Smuzhiyun
5045*4882a593Smuzhiyun const struct wiphy_vendor_command *vendor_commands;
5046*4882a593Smuzhiyun const struct nl80211_vendor_cmd_info *vendor_events;
5047*4882a593Smuzhiyun int n_vendor_commands, n_vendor_events;
5048*4882a593Smuzhiyun
5049*4882a593Smuzhiyun u16 max_ap_assoc_sta;
5050*4882a593Smuzhiyun
5051*4882a593Smuzhiyun u8 max_num_csa_counters;
5052*4882a593Smuzhiyun
5053*4882a593Smuzhiyun u32 bss_select_support;
5054*4882a593Smuzhiyun
5055*4882a593Smuzhiyun u8 nan_supported_bands;
5056*4882a593Smuzhiyun
5057*4882a593Smuzhiyun u32 txq_limit;
5058*4882a593Smuzhiyun u32 txq_memory_limit;
5059*4882a593Smuzhiyun u32 txq_quantum;
5060*4882a593Smuzhiyun
5061*4882a593Smuzhiyun unsigned long tx_queue_len;
5062*4882a593Smuzhiyun
5063*4882a593Smuzhiyun u8 support_mbssid:1,
5064*4882a593Smuzhiyun support_only_he_mbssid:1;
5065*4882a593Smuzhiyun
5066*4882a593Smuzhiyun const struct cfg80211_pmsr_capabilities *pmsr_capa;
5067*4882a593Smuzhiyun
5068*4882a593Smuzhiyun struct {
5069*4882a593Smuzhiyun u64 peer, vif;
5070*4882a593Smuzhiyun u8 max_retry;
5071*4882a593Smuzhiyun } tid_config_support;
5072*4882a593Smuzhiyun
5073*4882a593Smuzhiyun u8 max_data_retry_count;
5074*4882a593Smuzhiyun
5075*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
5076*4882a593Smuzhiyun
5077*4882a593Smuzhiyun char priv[] __aligned(NETDEV_ALIGN);
5078*4882a593Smuzhiyun };
5079*4882a593Smuzhiyun
wiphy_net(struct wiphy * wiphy)5080*4882a593Smuzhiyun static inline struct net *wiphy_net(struct wiphy *wiphy)
5081*4882a593Smuzhiyun {
5082*4882a593Smuzhiyun return read_pnet(&wiphy->_net);
5083*4882a593Smuzhiyun }
5084*4882a593Smuzhiyun
wiphy_net_set(struct wiphy * wiphy,struct net * net)5085*4882a593Smuzhiyun static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
5086*4882a593Smuzhiyun {
5087*4882a593Smuzhiyun write_pnet(&wiphy->_net, net);
5088*4882a593Smuzhiyun }
5089*4882a593Smuzhiyun
5090*4882a593Smuzhiyun /**
5091*4882a593Smuzhiyun * wiphy_priv - return priv from wiphy
5092*4882a593Smuzhiyun *
5093*4882a593Smuzhiyun * @wiphy: the wiphy whose priv pointer to return
5094*4882a593Smuzhiyun * Return: The priv of @wiphy.
5095*4882a593Smuzhiyun */
wiphy_priv(struct wiphy * wiphy)5096*4882a593Smuzhiyun static inline void *wiphy_priv(struct wiphy *wiphy)
5097*4882a593Smuzhiyun {
5098*4882a593Smuzhiyun BUG_ON(!wiphy);
5099*4882a593Smuzhiyun return &wiphy->priv;
5100*4882a593Smuzhiyun }
5101*4882a593Smuzhiyun
5102*4882a593Smuzhiyun /**
5103*4882a593Smuzhiyun * priv_to_wiphy - return the wiphy containing the priv
5104*4882a593Smuzhiyun *
5105*4882a593Smuzhiyun * @priv: a pointer previously returned by wiphy_priv
5106*4882a593Smuzhiyun * Return: The wiphy of @priv.
5107*4882a593Smuzhiyun */
priv_to_wiphy(void * priv)5108*4882a593Smuzhiyun static inline struct wiphy *priv_to_wiphy(void *priv)
5109*4882a593Smuzhiyun {
5110*4882a593Smuzhiyun BUG_ON(!priv);
5111*4882a593Smuzhiyun return container_of(priv, struct wiphy, priv);
5112*4882a593Smuzhiyun }
5113*4882a593Smuzhiyun
5114*4882a593Smuzhiyun /**
5115*4882a593Smuzhiyun * set_wiphy_dev - set device pointer for wiphy
5116*4882a593Smuzhiyun *
5117*4882a593Smuzhiyun * @wiphy: The wiphy whose device to bind
5118*4882a593Smuzhiyun * @dev: The device to parent it to
5119*4882a593Smuzhiyun */
set_wiphy_dev(struct wiphy * wiphy,struct device * dev)5120*4882a593Smuzhiyun static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
5121*4882a593Smuzhiyun {
5122*4882a593Smuzhiyun wiphy->dev.parent = dev;
5123*4882a593Smuzhiyun }
5124*4882a593Smuzhiyun
5125*4882a593Smuzhiyun /**
5126*4882a593Smuzhiyun * wiphy_dev - get wiphy dev pointer
5127*4882a593Smuzhiyun *
5128*4882a593Smuzhiyun * @wiphy: The wiphy whose device struct to look up
5129*4882a593Smuzhiyun * Return: The dev of @wiphy.
5130*4882a593Smuzhiyun */
wiphy_dev(struct wiphy * wiphy)5131*4882a593Smuzhiyun static inline struct device *wiphy_dev(struct wiphy *wiphy)
5132*4882a593Smuzhiyun {
5133*4882a593Smuzhiyun return wiphy->dev.parent;
5134*4882a593Smuzhiyun }
5135*4882a593Smuzhiyun
5136*4882a593Smuzhiyun /**
5137*4882a593Smuzhiyun * wiphy_name - get wiphy name
5138*4882a593Smuzhiyun *
5139*4882a593Smuzhiyun * @wiphy: The wiphy whose name to return
5140*4882a593Smuzhiyun * Return: The name of @wiphy.
5141*4882a593Smuzhiyun */
wiphy_name(const struct wiphy * wiphy)5142*4882a593Smuzhiyun static inline const char *wiphy_name(const struct wiphy *wiphy)
5143*4882a593Smuzhiyun {
5144*4882a593Smuzhiyun return dev_name(&wiphy->dev);
5145*4882a593Smuzhiyun }
5146*4882a593Smuzhiyun
5147*4882a593Smuzhiyun /**
5148*4882a593Smuzhiyun * wiphy_new_nm - create a new wiphy for use with cfg80211
5149*4882a593Smuzhiyun *
5150*4882a593Smuzhiyun * @ops: The configuration operations for this device
5151*4882a593Smuzhiyun * @sizeof_priv: The size of the private area to allocate
5152*4882a593Smuzhiyun * @requested_name: Request a particular name.
5153*4882a593Smuzhiyun * NULL is valid value, and means use the default phy%d naming.
5154*4882a593Smuzhiyun *
5155*4882a593Smuzhiyun * Create a new wiphy and associate the given operations with it.
5156*4882a593Smuzhiyun * @sizeof_priv bytes are allocated for private use.
5157*4882a593Smuzhiyun *
5158*4882a593Smuzhiyun * Return: A pointer to the new wiphy. This pointer must be
5159*4882a593Smuzhiyun * assigned to each netdev's ieee80211_ptr for proper operation.
5160*4882a593Smuzhiyun */
5161*4882a593Smuzhiyun struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
5162*4882a593Smuzhiyun const char *requested_name);
5163*4882a593Smuzhiyun
5164*4882a593Smuzhiyun /**
5165*4882a593Smuzhiyun * wiphy_new - create a new wiphy for use with cfg80211
5166*4882a593Smuzhiyun *
5167*4882a593Smuzhiyun * @ops: The configuration operations for this device
5168*4882a593Smuzhiyun * @sizeof_priv: The size of the private area to allocate
5169*4882a593Smuzhiyun *
5170*4882a593Smuzhiyun * Create a new wiphy and associate the given operations with it.
5171*4882a593Smuzhiyun * @sizeof_priv bytes are allocated for private use.
5172*4882a593Smuzhiyun *
5173*4882a593Smuzhiyun * Return: A pointer to the new wiphy. This pointer must be
5174*4882a593Smuzhiyun * assigned to each netdev's ieee80211_ptr for proper operation.
5175*4882a593Smuzhiyun */
wiphy_new(const struct cfg80211_ops * ops,int sizeof_priv)5176*4882a593Smuzhiyun static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
5177*4882a593Smuzhiyun int sizeof_priv)
5178*4882a593Smuzhiyun {
5179*4882a593Smuzhiyun return wiphy_new_nm(ops, sizeof_priv, NULL);
5180*4882a593Smuzhiyun }
5181*4882a593Smuzhiyun
5182*4882a593Smuzhiyun /**
5183*4882a593Smuzhiyun * wiphy_register - register a wiphy with cfg80211
5184*4882a593Smuzhiyun *
5185*4882a593Smuzhiyun * @wiphy: The wiphy to register.
5186*4882a593Smuzhiyun *
5187*4882a593Smuzhiyun * Return: A non-negative wiphy index or a negative error code.
5188*4882a593Smuzhiyun */
5189*4882a593Smuzhiyun int wiphy_register(struct wiphy *wiphy);
5190*4882a593Smuzhiyun
5191*4882a593Smuzhiyun /**
5192*4882a593Smuzhiyun * wiphy_unregister - deregister a wiphy from cfg80211
5193*4882a593Smuzhiyun *
5194*4882a593Smuzhiyun * @wiphy: The wiphy to unregister.
5195*4882a593Smuzhiyun *
5196*4882a593Smuzhiyun * After this call, no more requests can be made with this priv
5197*4882a593Smuzhiyun * pointer, but the call may sleep to wait for an outstanding
5198*4882a593Smuzhiyun * request that is being handled.
5199*4882a593Smuzhiyun */
5200*4882a593Smuzhiyun void wiphy_unregister(struct wiphy *wiphy);
5201*4882a593Smuzhiyun
5202*4882a593Smuzhiyun /**
5203*4882a593Smuzhiyun * wiphy_free - free wiphy
5204*4882a593Smuzhiyun *
5205*4882a593Smuzhiyun * @wiphy: The wiphy to free
5206*4882a593Smuzhiyun */
5207*4882a593Smuzhiyun void wiphy_free(struct wiphy *wiphy);
5208*4882a593Smuzhiyun
5209*4882a593Smuzhiyun /* internal structs */
5210*4882a593Smuzhiyun struct cfg80211_conn;
5211*4882a593Smuzhiyun struct cfg80211_internal_bss;
5212*4882a593Smuzhiyun struct cfg80211_cached_keys;
5213*4882a593Smuzhiyun struct cfg80211_cqm_config;
5214*4882a593Smuzhiyun
5215*4882a593Smuzhiyun /**
5216*4882a593Smuzhiyun * struct wireless_dev - wireless device state
5217*4882a593Smuzhiyun *
5218*4882a593Smuzhiyun * For netdevs, this structure must be allocated by the driver
5219*4882a593Smuzhiyun * that uses the ieee80211_ptr field in struct net_device (this
5220*4882a593Smuzhiyun * is intentional so it can be allocated along with the netdev.)
5221*4882a593Smuzhiyun * It need not be registered then as netdev registration will
5222*4882a593Smuzhiyun * be intercepted by cfg80211 to see the new wireless device.
5223*4882a593Smuzhiyun *
5224*4882a593Smuzhiyun * For non-netdev uses, it must also be allocated by the driver
5225*4882a593Smuzhiyun * in response to the cfg80211 callbacks that require it, as
5226*4882a593Smuzhiyun * there's no netdev registration in that case it may not be
5227*4882a593Smuzhiyun * allocated outside of callback operations that return it.
5228*4882a593Smuzhiyun *
5229*4882a593Smuzhiyun * @wiphy: pointer to hardware description
5230*4882a593Smuzhiyun * @iftype: interface type
5231*4882a593Smuzhiyun * @list: (private) Used to collect the interfaces
5232*4882a593Smuzhiyun * @netdev: (private) Used to reference back to the netdev, may be %NULL
5233*4882a593Smuzhiyun * @identifier: (private) Identifier used in nl80211 to identify this
5234*4882a593Smuzhiyun * wireless device if it has no netdev
5235*4882a593Smuzhiyun * @current_bss: (private) Used by the internal configuration code
5236*4882a593Smuzhiyun * @chandef: (private) Used by the internal configuration code to track
5237*4882a593Smuzhiyun * the user-set channel definition.
5238*4882a593Smuzhiyun * @preset_chandef: (private) Used by the internal configuration code to
5239*4882a593Smuzhiyun * track the channel to be used for AP later
5240*4882a593Smuzhiyun * @bssid: (private) Used by the internal configuration code
5241*4882a593Smuzhiyun * @ssid: (private) Used by the internal configuration code
5242*4882a593Smuzhiyun * @ssid_len: (private) Used by the internal configuration code
5243*4882a593Smuzhiyun * @mesh_id_len: (private) Used by the internal configuration code
5244*4882a593Smuzhiyun * @mesh_id_up_len: (private) Used by the internal configuration code
5245*4882a593Smuzhiyun * @wext: (private) Used by the internal wireless extensions compat code
5246*4882a593Smuzhiyun * @wext.ibss: (private) IBSS data part of wext handling
5247*4882a593Smuzhiyun * @wext.connect: (private) connection handling data
5248*4882a593Smuzhiyun * @wext.keys: (private) (WEP) key data
5249*4882a593Smuzhiyun * @wext.ie: (private) extra elements for association
5250*4882a593Smuzhiyun * @wext.ie_len: (private) length of extra elements
5251*4882a593Smuzhiyun * @wext.bssid: (private) selected network BSSID
5252*4882a593Smuzhiyun * @wext.ssid: (private) selected network SSID
5253*4882a593Smuzhiyun * @wext.default_key: (private) selected default key index
5254*4882a593Smuzhiyun * @wext.default_mgmt_key: (private) selected default management key index
5255*4882a593Smuzhiyun * @wext.prev_bssid: (private) previous BSSID for reassociation
5256*4882a593Smuzhiyun * @wext.prev_bssid_valid: (private) previous BSSID validity
5257*4882a593Smuzhiyun * @use_4addr: indicates 4addr mode is used on this interface, must be
5258*4882a593Smuzhiyun * set by driver (if supported) on add_interface BEFORE registering the
5259*4882a593Smuzhiyun * netdev and may otherwise be used by driver read-only, will be update
5260*4882a593Smuzhiyun * by cfg80211 on change_interface
5261*4882a593Smuzhiyun * @mgmt_registrations: list of registrations for management frames
5262*4882a593Smuzhiyun * @mgmt_registrations_need_update: mgmt registrations were updated,
5263*4882a593Smuzhiyun * need to propagate the update to the driver
5264*4882a593Smuzhiyun * @mtx: mutex used to lock data in this struct, may be used by drivers
5265*4882a593Smuzhiyun * and some API functions require it held
5266*4882a593Smuzhiyun * @beacon_interval: beacon interval used on this device for transmitting
5267*4882a593Smuzhiyun * beacons, 0 when not valid
5268*4882a593Smuzhiyun * @address: The address for this device, valid only if @netdev is %NULL
5269*4882a593Smuzhiyun * @is_running: true if this is a non-netdev device that has been started, e.g.
5270*4882a593Smuzhiyun * the P2P Device.
5271*4882a593Smuzhiyun * @cac_started: true if DFS channel availability check has been started
5272*4882a593Smuzhiyun * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
5273*4882a593Smuzhiyun * @cac_time_ms: CAC time in ms
5274*4882a593Smuzhiyun * @ps: powersave mode is enabled
5275*4882a593Smuzhiyun * @ps_timeout: dynamic powersave timeout
5276*4882a593Smuzhiyun * @ap_unexpected_nlportid: (private) netlink port ID of application
5277*4882a593Smuzhiyun * registered for unexpected class 3 frames (AP mode)
5278*4882a593Smuzhiyun * @conn: (private) cfg80211 software SME connection state machine data
5279*4882a593Smuzhiyun * @connect_keys: (private) keys to set after connection is established
5280*4882a593Smuzhiyun * @conn_bss_type: connecting/connected BSS type
5281*4882a593Smuzhiyun * @conn_owner_nlportid: (private) connection owner socket port ID
5282*4882a593Smuzhiyun * @disconnect_wk: (private) auto-disconnect work
5283*4882a593Smuzhiyun * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
5284*4882a593Smuzhiyun * @ibss_fixed: (private) IBSS is using fixed BSSID
5285*4882a593Smuzhiyun * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
5286*4882a593Smuzhiyun * @event_list: (private) list for internal event processing
5287*4882a593Smuzhiyun * @event_lock: (private) lock for event list
5288*4882a593Smuzhiyun * @owner_nlportid: (private) owner socket port ID
5289*4882a593Smuzhiyun * @nl_owner_dead: (private) owner socket went away
5290*4882a593Smuzhiyun * @cqm_config: (private) nl80211 RSSI monitor state
5291*4882a593Smuzhiyun * @pmsr_list: (private) peer measurement requests
5292*4882a593Smuzhiyun * @pmsr_lock: (private) peer measurements requests/results lock
5293*4882a593Smuzhiyun * @pmsr_free_wk: (private) peer measurements cleanup work
5294*4882a593Smuzhiyun * @unprot_beacon_reported: (private) timestamp of last
5295*4882a593Smuzhiyun * unprotected beacon report
5296*4882a593Smuzhiyun */
5297*4882a593Smuzhiyun struct wireless_dev {
5298*4882a593Smuzhiyun struct wiphy *wiphy;
5299*4882a593Smuzhiyun enum nl80211_iftype iftype;
5300*4882a593Smuzhiyun
5301*4882a593Smuzhiyun /* the remainder of this struct should be private to cfg80211 */
5302*4882a593Smuzhiyun struct list_head list;
5303*4882a593Smuzhiyun struct net_device *netdev;
5304*4882a593Smuzhiyun
5305*4882a593Smuzhiyun u32 identifier;
5306*4882a593Smuzhiyun
5307*4882a593Smuzhiyun struct list_head mgmt_registrations;
5308*4882a593Smuzhiyun /*
5309*4882a593Smuzhiyun * ANDROID: mgmt_registrations_lock was restored to preserve ABI in
5310*4882a593Smuzhiyun * 5.10.77 due to backport of 09b1d5dc6ce1 ("cfg80211: fix management
5311*4882a593Smuzhiyun * registrations locking") but it is not used for anything so do not
5312*4882a593Smuzhiyun * touch this variable!
5313*4882a593Smuzhiyun */
5314*4882a593Smuzhiyun spinlock_t mgmt_registrations_lock;
5315*4882a593Smuzhiyun u8 mgmt_registrations_need_update:1;
5316*4882a593Smuzhiyun
5317*4882a593Smuzhiyun struct mutex mtx;
5318*4882a593Smuzhiyun
5319*4882a593Smuzhiyun bool use_4addr, is_running;
5320*4882a593Smuzhiyun
5321*4882a593Smuzhiyun u8 address[ETH_ALEN] __aligned(sizeof(u16));
5322*4882a593Smuzhiyun
5323*4882a593Smuzhiyun /* currently used for IBSS and SME - might be rearranged later */
5324*4882a593Smuzhiyun u8 ssid[IEEE80211_MAX_SSID_LEN];
5325*4882a593Smuzhiyun u8 ssid_len, mesh_id_len, mesh_id_up_len;
5326*4882a593Smuzhiyun struct cfg80211_conn *conn;
5327*4882a593Smuzhiyun struct cfg80211_cached_keys *connect_keys;
5328*4882a593Smuzhiyun enum ieee80211_bss_type conn_bss_type;
5329*4882a593Smuzhiyun u32 conn_owner_nlportid;
5330*4882a593Smuzhiyun
5331*4882a593Smuzhiyun struct work_struct disconnect_wk;
5332*4882a593Smuzhiyun u8 disconnect_bssid[ETH_ALEN];
5333*4882a593Smuzhiyun
5334*4882a593Smuzhiyun struct list_head event_list;
5335*4882a593Smuzhiyun spinlock_t event_lock;
5336*4882a593Smuzhiyun
5337*4882a593Smuzhiyun struct cfg80211_internal_bss *current_bss; /* associated / joined */
5338*4882a593Smuzhiyun struct cfg80211_chan_def preset_chandef;
5339*4882a593Smuzhiyun struct cfg80211_chan_def chandef;
5340*4882a593Smuzhiyun
5341*4882a593Smuzhiyun bool ibss_fixed;
5342*4882a593Smuzhiyun bool ibss_dfs_possible;
5343*4882a593Smuzhiyun
5344*4882a593Smuzhiyun bool ps;
5345*4882a593Smuzhiyun int ps_timeout;
5346*4882a593Smuzhiyun
5347*4882a593Smuzhiyun int beacon_interval;
5348*4882a593Smuzhiyun
5349*4882a593Smuzhiyun u32 ap_unexpected_nlportid;
5350*4882a593Smuzhiyun
5351*4882a593Smuzhiyun u32 owner_nlportid;
5352*4882a593Smuzhiyun bool nl_owner_dead;
5353*4882a593Smuzhiyun
5354*4882a593Smuzhiyun bool cac_started;
5355*4882a593Smuzhiyun unsigned long cac_start_time;
5356*4882a593Smuzhiyun unsigned int cac_time_ms;
5357*4882a593Smuzhiyun
5358*4882a593Smuzhiyun #ifdef CONFIG_CFG80211_WEXT
5359*4882a593Smuzhiyun /* wext data */
5360*4882a593Smuzhiyun struct {
5361*4882a593Smuzhiyun struct cfg80211_ibss_params ibss;
5362*4882a593Smuzhiyun struct cfg80211_connect_params connect;
5363*4882a593Smuzhiyun struct cfg80211_cached_keys *keys;
5364*4882a593Smuzhiyun const u8 *ie;
5365*4882a593Smuzhiyun size_t ie_len;
5366*4882a593Smuzhiyun u8 bssid[ETH_ALEN];
5367*4882a593Smuzhiyun u8 prev_bssid[ETH_ALEN];
5368*4882a593Smuzhiyun u8 ssid[IEEE80211_MAX_SSID_LEN];
5369*4882a593Smuzhiyun s8 default_key, default_mgmt_key;
5370*4882a593Smuzhiyun bool prev_bssid_valid;
5371*4882a593Smuzhiyun } wext;
5372*4882a593Smuzhiyun #endif
5373*4882a593Smuzhiyun
5374*4882a593Smuzhiyun struct cfg80211_cqm_config *cqm_config;
5375*4882a593Smuzhiyun
5376*4882a593Smuzhiyun struct list_head pmsr_list;
5377*4882a593Smuzhiyun spinlock_t pmsr_lock;
5378*4882a593Smuzhiyun struct work_struct pmsr_free_wk;
5379*4882a593Smuzhiyun
5380*4882a593Smuzhiyun unsigned long unprot_beacon_reported;
5381*4882a593Smuzhiyun
5382*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1);
5383*4882a593Smuzhiyun ANDROID_KABI_RESERVE(2);
5384*4882a593Smuzhiyun };
5385*4882a593Smuzhiyun
wdev_address(struct wireless_dev * wdev)5386*4882a593Smuzhiyun static inline u8 *wdev_address(struct wireless_dev *wdev)
5387*4882a593Smuzhiyun {
5388*4882a593Smuzhiyun if (wdev->netdev)
5389*4882a593Smuzhiyun return wdev->netdev->dev_addr;
5390*4882a593Smuzhiyun return wdev->address;
5391*4882a593Smuzhiyun }
5392*4882a593Smuzhiyun
wdev_running(struct wireless_dev * wdev)5393*4882a593Smuzhiyun static inline bool wdev_running(struct wireless_dev *wdev)
5394*4882a593Smuzhiyun {
5395*4882a593Smuzhiyun if (wdev->netdev)
5396*4882a593Smuzhiyun return netif_running(wdev->netdev);
5397*4882a593Smuzhiyun return wdev->is_running;
5398*4882a593Smuzhiyun }
5399*4882a593Smuzhiyun
5400*4882a593Smuzhiyun /**
5401*4882a593Smuzhiyun * wdev_priv - return wiphy priv from wireless_dev
5402*4882a593Smuzhiyun *
5403*4882a593Smuzhiyun * @wdev: The wireless device whose wiphy's priv pointer to return
5404*4882a593Smuzhiyun * Return: The wiphy priv of @wdev.
5405*4882a593Smuzhiyun */
wdev_priv(struct wireless_dev * wdev)5406*4882a593Smuzhiyun static inline void *wdev_priv(struct wireless_dev *wdev)
5407*4882a593Smuzhiyun {
5408*4882a593Smuzhiyun BUG_ON(!wdev);
5409*4882a593Smuzhiyun return wiphy_priv(wdev->wiphy);
5410*4882a593Smuzhiyun }
5411*4882a593Smuzhiyun
5412*4882a593Smuzhiyun /**
5413*4882a593Smuzhiyun * DOC: Utility functions
5414*4882a593Smuzhiyun *
5415*4882a593Smuzhiyun * cfg80211 offers a number of utility functions that can be useful.
5416*4882a593Smuzhiyun */
5417*4882a593Smuzhiyun
5418*4882a593Smuzhiyun /**
5419*4882a593Smuzhiyun * ieee80211_channel_equal - compare two struct ieee80211_channel
5420*4882a593Smuzhiyun *
5421*4882a593Smuzhiyun * @a: 1st struct ieee80211_channel
5422*4882a593Smuzhiyun * @b: 2nd struct ieee80211_channel
5423*4882a593Smuzhiyun * Return: true if center frequency of @a == @b
5424*4882a593Smuzhiyun */
5425*4882a593Smuzhiyun static inline bool
ieee80211_channel_equal(struct ieee80211_channel * a,struct ieee80211_channel * b)5426*4882a593Smuzhiyun ieee80211_channel_equal(struct ieee80211_channel *a,
5427*4882a593Smuzhiyun struct ieee80211_channel *b)
5428*4882a593Smuzhiyun {
5429*4882a593Smuzhiyun return (a->center_freq == b->center_freq &&
5430*4882a593Smuzhiyun a->freq_offset == b->freq_offset);
5431*4882a593Smuzhiyun }
5432*4882a593Smuzhiyun
5433*4882a593Smuzhiyun /**
5434*4882a593Smuzhiyun * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz
5435*4882a593Smuzhiyun * @chan: struct ieee80211_channel to convert
5436*4882a593Smuzhiyun * Return: The corresponding frequency (in KHz)
5437*4882a593Smuzhiyun */
5438*4882a593Smuzhiyun static inline u32
ieee80211_channel_to_khz(const struct ieee80211_channel * chan)5439*4882a593Smuzhiyun ieee80211_channel_to_khz(const struct ieee80211_channel *chan)
5440*4882a593Smuzhiyun {
5441*4882a593Smuzhiyun return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;
5442*4882a593Smuzhiyun }
5443*4882a593Smuzhiyun
5444*4882a593Smuzhiyun /**
5445*4882a593Smuzhiyun * ieee80211_s1g_channel_width - get allowed channel width from @chan
5446*4882a593Smuzhiyun *
5447*4882a593Smuzhiyun * Only allowed for band NL80211_BAND_S1GHZ
5448*4882a593Smuzhiyun * @chan: channel
5449*4882a593Smuzhiyun * Return: The allowed channel width for this center_freq
5450*4882a593Smuzhiyun */
5451*4882a593Smuzhiyun enum nl80211_chan_width
5452*4882a593Smuzhiyun ieee80211_s1g_channel_width(const struct ieee80211_channel *chan);
5453*4882a593Smuzhiyun
5454*4882a593Smuzhiyun /**
5455*4882a593Smuzhiyun * ieee80211_channel_to_freq_khz - convert channel number to frequency
5456*4882a593Smuzhiyun * @chan: channel number
5457*4882a593Smuzhiyun * @band: band, necessary due to channel number overlap
5458*4882a593Smuzhiyun * Return: The corresponding frequency (in KHz), or 0 if the conversion failed.
5459*4882a593Smuzhiyun */
5460*4882a593Smuzhiyun u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);
5461*4882a593Smuzhiyun
5462*4882a593Smuzhiyun /**
5463*4882a593Smuzhiyun * ieee80211_channel_to_frequency - convert channel number to frequency
5464*4882a593Smuzhiyun * @chan: channel number
5465*4882a593Smuzhiyun * @band: band, necessary due to channel number overlap
5466*4882a593Smuzhiyun * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
5467*4882a593Smuzhiyun */
5468*4882a593Smuzhiyun static inline int
ieee80211_channel_to_frequency(int chan,enum nl80211_band band)5469*4882a593Smuzhiyun ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
5470*4882a593Smuzhiyun {
5471*4882a593Smuzhiyun return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));
5472*4882a593Smuzhiyun }
5473*4882a593Smuzhiyun
5474*4882a593Smuzhiyun /**
5475*4882a593Smuzhiyun * ieee80211_freq_khz_to_channel - convert frequency to channel number
5476*4882a593Smuzhiyun * @freq: center frequency in KHz
5477*4882a593Smuzhiyun * Return: The corresponding channel, or 0 if the conversion failed.
5478*4882a593Smuzhiyun */
5479*4882a593Smuzhiyun int ieee80211_freq_khz_to_channel(u32 freq);
5480*4882a593Smuzhiyun
5481*4882a593Smuzhiyun /**
5482*4882a593Smuzhiyun * ieee80211_frequency_to_channel - convert frequency to channel number
5483*4882a593Smuzhiyun * @freq: center frequency in MHz
5484*4882a593Smuzhiyun * Return: The corresponding channel, or 0 if the conversion failed.
5485*4882a593Smuzhiyun */
5486*4882a593Smuzhiyun static inline int
ieee80211_frequency_to_channel(int freq)5487*4882a593Smuzhiyun ieee80211_frequency_to_channel(int freq)
5488*4882a593Smuzhiyun {
5489*4882a593Smuzhiyun return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));
5490*4882a593Smuzhiyun }
5491*4882a593Smuzhiyun
5492*4882a593Smuzhiyun /**
5493*4882a593Smuzhiyun * ieee80211_get_channel_khz - get channel struct from wiphy for specified
5494*4882a593Smuzhiyun * frequency
5495*4882a593Smuzhiyun * @wiphy: the struct wiphy to get the channel for
5496*4882a593Smuzhiyun * @freq: the center frequency (in KHz) of the channel
5497*4882a593Smuzhiyun * Return: The channel struct from @wiphy at @freq.
5498*4882a593Smuzhiyun */
5499*4882a593Smuzhiyun struct ieee80211_channel *
5500*4882a593Smuzhiyun ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);
5501*4882a593Smuzhiyun
5502*4882a593Smuzhiyun /**
5503*4882a593Smuzhiyun * ieee80211_get_channel - get channel struct from wiphy for specified frequency
5504*4882a593Smuzhiyun *
5505*4882a593Smuzhiyun * @wiphy: the struct wiphy to get the channel for
5506*4882a593Smuzhiyun * @freq: the center frequency (in MHz) of the channel
5507*4882a593Smuzhiyun * Return: The channel struct from @wiphy at @freq.
5508*4882a593Smuzhiyun */
5509*4882a593Smuzhiyun static inline struct ieee80211_channel *
ieee80211_get_channel(struct wiphy * wiphy,int freq)5510*4882a593Smuzhiyun ieee80211_get_channel(struct wiphy *wiphy, int freq)
5511*4882a593Smuzhiyun {
5512*4882a593Smuzhiyun return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));
5513*4882a593Smuzhiyun }
5514*4882a593Smuzhiyun
5515*4882a593Smuzhiyun /**
5516*4882a593Smuzhiyun * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
5517*4882a593Smuzhiyun * @chan: control channel to check
5518*4882a593Smuzhiyun *
5519*4882a593Smuzhiyun * The Preferred Scanning Channels (PSC) are defined in
5520*4882a593Smuzhiyun * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
5521*4882a593Smuzhiyun */
cfg80211_channel_is_psc(struct ieee80211_channel * chan)5522*4882a593Smuzhiyun static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
5523*4882a593Smuzhiyun {
5524*4882a593Smuzhiyun if (chan->band != NL80211_BAND_6GHZ)
5525*4882a593Smuzhiyun return false;
5526*4882a593Smuzhiyun
5527*4882a593Smuzhiyun return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
5528*4882a593Smuzhiyun }
5529*4882a593Smuzhiyun
5530*4882a593Smuzhiyun /**
5531*4882a593Smuzhiyun * ieee80211_get_response_rate - get basic rate for a given rate
5532*4882a593Smuzhiyun *
5533*4882a593Smuzhiyun * @sband: the band to look for rates in
5534*4882a593Smuzhiyun * @basic_rates: bitmap of basic rates
5535*4882a593Smuzhiyun * @bitrate: the bitrate for which to find the basic rate
5536*4882a593Smuzhiyun *
5537*4882a593Smuzhiyun * Return: The basic rate corresponding to a given bitrate, that
5538*4882a593Smuzhiyun * is the next lower bitrate contained in the basic rate map,
5539*4882a593Smuzhiyun * which is, for this function, given as a bitmap of indices of
5540*4882a593Smuzhiyun * rates in the band's bitrate table.
5541*4882a593Smuzhiyun */
5542*4882a593Smuzhiyun struct ieee80211_rate *
5543*4882a593Smuzhiyun ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
5544*4882a593Smuzhiyun u32 basic_rates, int bitrate);
5545*4882a593Smuzhiyun
5546*4882a593Smuzhiyun /**
5547*4882a593Smuzhiyun * ieee80211_mandatory_rates - get mandatory rates for a given band
5548*4882a593Smuzhiyun * @sband: the band to look for rates in
5549*4882a593Smuzhiyun * @scan_width: width of the control channel
5550*4882a593Smuzhiyun *
5551*4882a593Smuzhiyun * This function returns a bitmap of the mandatory rates for the given
5552*4882a593Smuzhiyun * band, bits are set according to the rate position in the bitrates array.
5553*4882a593Smuzhiyun */
5554*4882a593Smuzhiyun u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
5555*4882a593Smuzhiyun enum nl80211_bss_scan_width scan_width);
5556*4882a593Smuzhiyun
5557*4882a593Smuzhiyun /*
5558*4882a593Smuzhiyun * Radiotap parsing functions -- for controlled injection support
5559*4882a593Smuzhiyun *
5560*4882a593Smuzhiyun * Implemented in net/wireless/radiotap.c
5561*4882a593Smuzhiyun * Documentation in Documentation/networking/radiotap-headers.rst
5562*4882a593Smuzhiyun */
5563*4882a593Smuzhiyun
5564*4882a593Smuzhiyun struct radiotap_align_size {
5565*4882a593Smuzhiyun uint8_t align:4, size:4;
5566*4882a593Smuzhiyun };
5567*4882a593Smuzhiyun
5568*4882a593Smuzhiyun struct ieee80211_radiotap_namespace {
5569*4882a593Smuzhiyun const struct radiotap_align_size *align_size;
5570*4882a593Smuzhiyun int n_bits;
5571*4882a593Smuzhiyun uint32_t oui;
5572*4882a593Smuzhiyun uint8_t subns;
5573*4882a593Smuzhiyun };
5574*4882a593Smuzhiyun
5575*4882a593Smuzhiyun struct ieee80211_radiotap_vendor_namespaces {
5576*4882a593Smuzhiyun const struct ieee80211_radiotap_namespace *ns;
5577*4882a593Smuzhiyun int n_ns;
5578*4882a593Smuzhiyun };
5579*4882a593Smuzhiyun
5580*4882a593Smuzhiyun /**
5581*4882a593Smuzhiyun * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
5582*4882a593Smuzhiyun * @this_arg_index: index of current arg, valid after each successful call
5583*4882a593Smuzhiyun * to ieee80211_radiotap_iterator_next()
5584*4882a593Smuzhiyun * @this_arg: pointer to current radiotap arg; it is valid after each
5585*4882a593Smuzhiyun * call to ieee80211_radiotap_iterator_next() but also after
5586*4882a593Smuzhiyun * ieee80211_radiotap_iterator_init() where it will point to
5587*4882a593Smuzhiyun * the beginning of the actual data portion
5588*4882a593Smuzhiyun * @this_arg_size: length of the current arg, for convenience
5589*4882a593Smuzhiyun * @current_namespace: pointer to the current namespace definition
5590*4882a593Smuzhiyun * (or internally %NULL if the current namespace is unknown)
5591*4882a593Smuzhiyun * @is_radiotap_ns: indicates whether the current namespace is the default
5592*4882a593Smuzhiyun * radiotap namespace or not
5593*4882a593Smuzhiyun *
5594*4882a593Smuzhiyun * @_rtheader: pointer to the radiotap header we are walking through
5595*4882a593Smuzhiyun * @_max_length: length of radiotap header in cpu byte ordering
5596*4882a593Smuzhiyun * @_arg_index: next argument index
5597*4882a593Smuzhiyun * @_arg: next argument pointer
5598*4882a593Smuzhiyun * @_next_bitmap: internal pointer to next present u32
5599*4882a593Smuzhiyun * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
5600*4882a593Smuzhiyun * @_vns: vendor namespace definitions
5601*4882a593Smuzhiyun * @_next_ns_data: beginning of the next namespace's data
5602*4882a593Smuzhiyun * @_reset_on_ext: internal; reset the arg index to 0 when going to the
5603*4882a593Smuzhiyun * next bitmap word
5604*4882a593Smuzhiyun *
5605*4882a593Smuzhiyun * Describes the radiotap parser state. Fields prefixed with an underscore
5606*4882a593Smuzhiyun * must not be used by users of the parser, only by the parser internally.
5607*4882a593Smuzhiyun */
5608*4882a593Smuzhiyun
5609*4882a593Smuzhiyun struct ieee80211_radiotap_iterator {
5610*4882a593Smuzhiyun struct ieee80211_radiotap_header *_rtheader;
5611*4882a593Smuzhiyun const struct ieee80211_radiotap_vendor_namespaces *_vns;
5612*4882a593Smuzhiyun const struct ieee80211_radiotap_namespace *current_namespace;
5613*4882a593Smuzhiyun
5614*4882a593Smuzhiyun unsigned char *_arg, *_next_ns_data;
5615*4882a593Smuzhiyun __le32 *_next_bitmap;
5616*4882a593Smuzhiyun
5617*4882a593Smuzhiyun unsigned char *this_arg;
5618*4882a593Smuzhiyun int this_arg_index;
5619*4882a593Smuzhiyun int this_arg_size;
5620*4882a593Smuzhiyun
5621*4882a593Smuzhiyun int is_radiotap_ns;
5622*4882a593Smuzhiyun
5623*4882a593Smuzhiyun int _max_length;
5624*4882a593Smuzhiyun int _arg_index;
5625*4882a593Smuzhiyun uint32_t _bitmap_shifter;
5626*4882a593Smuzhiyun int _reset_on_ext;
5627*4882a593Smuzhiyun };
5628*4882a593Smuzhiyun
5629*4882a593Smuzhiyun int
5630*4882a593Smuzhiyun ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
5631*4882a593Smuzhiyun struct ieee80211_radiotap_header *radiotap_header,
5632*4882a593Smuzhiyun int max_length,
5633*4882a593Smuzhiyun const struct ieee80211_radiotap_vendor_namespaces *vns);
5634*4882a593Smuzhiyun
5635*4882a593Smuzhiyun int
5636*4882a593Smuzhiyun ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
5637*4882a593Smuzhiyun
5638*4882a593Smuzhiyun
5639*4882a593Smuzhiyun extern const unsigned char rfc1042_header[6];
5640*4882a593Smuzhiyun extern const unsigned char bridge_tunnel_header[6];
5641*4882a593Smuzhiyun
5642*4882a593Smuzhiyun /**
5643*4882a593Smuzhiyun * ieee80211_get_hdrlen_from_skb - get header length from data
5644*4882a593Smuzhiyun *
5645*4882a593Smuzhiyun * @skb: the frame
5646*4882a593Smuzhiyun *
5647*4882a593Smuzhiyun * Given an skb with a raw 802.11 header at the data pointer this function
5648*4882a593Smuzhiyun * returns the 802.11 header length.
5649*4882a593Smuzhiyun *
5650*4882a593Smuzhiyun * Return: The 802.11 header length in bytes (not including encryption
5651*4882a593Smuzhiyun * headers). Or 0 if the data in the sk_buff is too short to contain a valid
5652*4882a593Smuzhiyun * 802.11 header.
5653*4882a593Smuzhiyun */
5654*4882a593Smuzhiyun unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
5655*4882a593Smuzhiyun
5656*4882a593Smuzhiyun /**
5657*4882a593Smuzhiyun * ieee80211_hdrlen - get header length in bytes from frame control
5658*4882a593Smuzhiyun * @fc: frame control field in little-endian format
5659*4882a593Smuzhiyun * Return: The header length in bytes.
5660*4882a593Smuzhiyun */
5661*4882a593Smuzhiyun unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
5662*4882a593Smuzhiyun
5663*4882a593Smuzhiyun /**
5664*4882a593Smuzhiyun * ieee80211_get_mesh_hdrlen - get mesh extension header length
5665*4882a593Smuzhiyun * @meshhdr: the mesh extension header, only the flags field
5666*4882a593Smuzhiyun * (first byte) will be accessed
5667*4882a593Smuzhiyun * Return: The length of the extension header, which is always at
5668*4882a593Smuzhiyun * least 6 bytes and at most 18 if address 5 and 6 are present.
5669*4882a593Smuzhiyun */
5670*4882a593Smuzhiyun unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
5671*4882a593Smuzhiyun
5672*4882a593Smuzhiyun /**
5673*4882a593Smuzhiyun * DOC: Data path helpers
5674*4882a593Smuzhiyun *
5675*4882a593Smuzhiyun * In addition to generic utilities, cfg80211 also offers
5676*4882a593Smuzhiyun * functions that help implement the data path for devices
5677*4882a593Smuzhiyun * that do not do the 802.11/802.3 conversion on the device.
5678*4882a593Smuzhiyun */
5679*4882a593Smuzhiyun
5680*4882a593Smuzhiyun /**
5681*4882a593Smuzhiyun * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
5682*4882a593Smuzhiyun * @skb: the 802.11 data frame
5683*4882a593Smuzhiyun * @ehdr: pointer to a &struct ethhdr that will get the header, instead
5684*4882a593Smuzhiyun * of it being pushed into the SKB
5685*4882a593Smuzhiyun * @addr: the device MAC address
5686*4882a593Smuzhiyun * @iftype: the virtual interface type
5687*4882a593Smuzhiyun * @data_offset: offset of payload after the 802.11 header
5688*4882a593Smuzhiyun * Return: 0 on success. Non-zero on error.
5689*4882a593Smuzhiyun */
5690*4882a593Smuzhiyun int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
5691*4882a593Smuzhiyun const u8 *addr, enum nl80211_iftype iftype,
5692*4882a593Smuzhiyun u8 data_offset, bool is_amsdu);
5693*4882a593Smuzhiyun
5694*4882a593Smuzhiyun /**
5695*4882a593Smuzhiyun * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
5696*4882a593Smuzhiyun * @skb: the 802.11 data frame
5697*4882a593Smuzhiyun * @addr: the device MAC address
5698*4882a593Smuzhiyun * @iftype: the virtual interface type
5699*4882a593Smuzhiyun * Return: 0 on success. Non-zero on error.
5700*4882a593Smuzhiyun */
ieee80211_data_to_8023(struct sk_buff * skb,const u8 * addr,enum nl80211_iftype iftype)5701*4882a593Smuzhiyun static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
5702*4882a593Smuzhiyun enum nl80211_iftype iftype)
5703*4882a593Smuzhiyun {
5704*4882a593Smuzhiyun return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false);
5705*4882a593Smuzhiyun }
5706*4882a593Smuzhiyun
5707*4882a593Smuzhiyun /**
5708*4882a593Smuzhiyun * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
5709*4882a593Smuzhiyun *
5710*4882a593Smuzhiyun * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
5711*4882a593Smuzhiyun * The @list will be empty if the decode fails. The @skb must be fully
5712*4882a593Smuzhiyun * header-less before being passed in here; it is freed in this function.
5713*4882a593Smuzhiyun *
5714*4882a593Smuzhiyun * @skb: The input A-MSDU frame without any headers.
5715*4882a593Smuzhiyun * @list: The output list of 802.3 frames. It must be allocated and
5716*4882a593Smuzhiyun * initialized by the caller.
5717*4882a593Smuzhiyun * @addr: The device MAC address.
5718*4882a593Smuzhiyun * @iftype: The device interface type.
5719*4882a593Smuzhiyun * @extra_headroom: The hardware extra headroom for SKBs in the @list.
5720*4882a593Smuzhiyun * @check_da: DA to check in the inner ethernet header, or NULL
5721*4882a593Smuzhiyun * @check_sa: SA to check in the inner ethernet header, or NULL
5722*4882a593Smuzhiyun */
5723*4882a593Smuzhiyun void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
5724*4882a593Smuzhiyun const u8 *addr, enum nl80211_iftype iftype,
5725*4882a593Smuzhiyun const unsigned int extra_headroom,
5726*4882a593Smuzhiyun const u8 *check_da, const u8 *check_sa);
5727*4882a593Smuzhiyun
5728*4882a593Smuzhiyun /**
5729*4882a593Smuzhiyun * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
5730*4882a593Smuzhiyun * @skb: the data frame
5731*4882a593Smuzhiyun * @qos_map: Interworking QoS mapping or %NULL if not in use
5732*4882a593Smuzhiyun * Return: The 802.1p/1d tag.
5733*4882a593Smuzhiyun */
5734*4882a593Smuzhiyun unsigned int cfg80211_classify8021d(struct sk_buff *skb,
5735*4882a593Smuzhiyun struct cfg80211_qos_map *qos_map);
5736*4882a593Smuzhiyun
5737*4882a593Smuzhiyun /**
5738*4882a593Smuzhiyun * cfg80211_find_elem_match - match information element and byte array in data
5739*4882a593Smuzhiyun *
5740*4882a593Smuzhiyun * @eid: element ID
5741*4882a593Smuzhiyun * @ies: data consisting of IEs
5742*4882a593Smuzhiyun * @len: length of data
5743*4882a593Smuzhiyun * @match: byte array to match
5744*4882a593Smuzhiyun * @match_len: number of bytes in the match array
5745*4882a593Smuzhiyun * @match_offset: offset in the IE data where the byte array should match.
5746*4882a593Smuzhiyun * Note the difference to cfg80211_find_ie_match() which considers
5747*4882a593Smuzhiyun * the offset to start from the element ID byte, but here we take
5748*4882a593Smuzhiyun * the data portion instead.
5749*4882a593Smuzhiyun *
5750*4882a593Smuzhiyun * Return: %NULL if the element ID could not be found or if
5751*4882a593Smuzhiyun * the element is invalid (claims to be longer than the given
5752*4882a593Smuzhiyun * data) or if the byte array doesn't match; otherwise return the
5753*4882a593Smuzhiyun * requested element struct.
5754*4882a593Smuzhiyun *
5755*4882a593Smuzhiyun * Note: There are no checks on the element length other than
5756*4882a593Smuzhiyun * having to fit into the given data and being large enough for the
5757*4882a593Smuzhiyun * byte array to match.
5758*4882a593Smuzhiyun */
5759*4882a593Smuzhiyun const struct element *
5760*4882a593Smuzhiyun cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
5761*4882a593Smuzhiyun const u8 *match, unsigned int match_len,
5762*4882a593Smuzhiyun unsigned int match_offset);
5763*4882a593Smuzhiyun
5764*4882a593Smuzhiyun /**
5765*4882a593Smuzhiyun * cfg80211_find_ie_match - match information element and byte array in data
5766*4882a593Smuzhiyun *
5767*4882a593Smuzhiyun * @eid: element ID
5768*4882a593Smuzhiyun * @ies: data consisting of IEs
5769*4882a593Smuzhiyun * @len: length of data
5770*4882a593Smuzhiyun * @match: byte array to match
5771*4882a593Smuzhiyun * @match_len: number of bytes in the match array
5772*4882a593Smuzhiyun * @match_offset: offset in the IE where the byte array should match.
5773*4882a593Smuzhiyun * If match_len is zero, this must also be set to zero.
5774*4882a593Smuzhiyun * Otherwise this must be set to 2 or more, because the first
5775*4882a593Smuzhiyun * byte is the element id, which is already compared to eid, and
5776*4882a593Smuzhiyun * the second byte is the IE length.
5777*4882a593Smuzhiyun *
5778*4882a593Smuzhiyun * Return: %NULL if the element ID could not be found or if
5779*4882a593Smuzhiyun * the element is invalid (claims to be longer than the given
5780*4882a593Smuzhiyun * data) or if the byte array doesn't match, or a pointer to the first
5781*4882a593Smuzhiyun * byte of the requested element, that is the byte containing the
5782*4882a593Smuzhiyun * element ID.
5783*4882a593Smuzhiyun *
5784*4882a593Smuzhiyun * Note: There are no checks on the element length other than
5785*4882a593Smuzhiyun * having to fit into the given data and being large enough for the
5786*4882a593Smuzhiyun * byte array to match.
5787*4882a593Smuzhiyun */
5788*4882a593Smuzhiyun static inline const u8 *
cfg80211_find_ie_match(u8 eid,const u8 * ies,unsigned int len,const u8 * match,unsigned int match_len,unsigned int match_offset)5789*4882a593Smuzhiyun cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
5790*4882a593Smuzhiyun const u8 *match, unsigned int match_len,
5791*4882a593Smuzhiyun unsigned int match_offset)
5792*4882a593Smuzhiyun {
5793*4882a593Smuzhiyun /* match_offset can't be smaller than 2, unless match_len is
5794*4882a593Smuzhiyun * zero, in which case match_offset must be zero as well.
5795*4882a593Smuzhiyun */
5796*4882a593Smuzhiyun if (WARN_ON((match_len && match_offset < 2) ||
5797*4882a593Smuzhiyun (!match_len && match_offset)))
5798*4882a593Smuzhiyun return NULL;
5799*4882a593Smuzhiyun
5800*4882a593Smuzhiyun return (void *)cfg80211_find_elem_match(eid, ies, len,
5801*4882a593Smuzhiyun match, match_len,
5802*4882a593Smuzhiyun match_offset ?
5803*4882a593Smuzhiyun match_offset - 2 : 0);
5804*4882a593Smuzhiyun }
5805*4882a593Smuzhiyun
5806*4882a593Smuzhiyun /**
5807*4882a593Smuzhiyun * cfg80211_find_elem - find information element in data
5808*4882a593Smuzhiyun *
5809*4882a593Smuzhiyun * @eid: element ID
5810*4882a593Smuzhiyun * @ies: data consisting of IEs
5811*4882a593Smuzhiyun * @len: length of data
5812*4882a593Smuzhiyun *
5813*4882a593Smuzhiyun * Return: %NULL if the element ID could not be found or if
5814*4882a593Smuzhiyun * the element is invalid (claims to be longer than the given
5815*4882a593Smuzhiyun * data) or if the byte array doesn't match; otherwise return the
5816*4882a593Smuzhiyun * requested element struct.
5817*4882a593Smuzhiyun *
5818*4882a593Smuzhiyun * Note: There are no checks on the element length other than
5819*4882a593Smuzhiyun * having to fit into the given data.
5820*4882a593Smuzhiyun */
5821*4882a593Smuzhiyun static inline const struct element *
cfg80211_find_elem(u8 eid,const u8 * ies,int len)5822*4882a593Smuzhiyun cfg80211_find_elem(u8 eid, const u8 *ies, int len)
5823*4882a593Smuzhiyun {
5824*4882a593Smuzhiyun return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
5825*4882a593Smuzhiyun }
5826*4882a593Smuzhiyun
5827*4882a593Smuzhiyun /**
5828*4882a593Smuzhiyun * cfg80211_find_ie - find information element in data
5829*4882a593Smuzhiyun *
5830*4882a593Smuzhiyun * @eid: element ID
5831*4882a593Smuzhiyun * @ies: data consisting of IEs
5832*4882a593Smuzhiyun * @len: length of data
5833*4882a593Smuzhiyun *
5834*4882a593Smuzhiyun * Return: %NULL if the element ID could not be found or if
5835*4882a593Smuzhiyun * the element is invalid (claims to be longer than the given
5836*4882a593Smuzhiyun * data), or a pointer to the first byte of the requested
5837*4882a593Smuzhiyun * element, that is the byte containing the element ID.
5838*4882a593Smuzhiyun *
5839*4882a593Smuzhiyun * Note: There are no checks on the element length other than
5840*4882a593Smuzhiyun * having to fit into the given data.
5841*4882a593Smuzhiyun */
cfg80211_find_ie(u8 eid,const u8 * ies,int len)5842*4882a593Smuzhiyun static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
5843*4882a593Smuzhiyun {
5844*4882a593Smuzhiyun return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
5845*4882a593Smuzhiyun }
5846*4882a593Smuzhiyun
5847*4882a593Smuzhiyun /**
5848*4882a593Smuzhiyun * cfg80211_find_ext_elem - find information element with EID Extension in data
5849*4882a593Smuzhiyun *
5850*4882a593Smuzhiyun * @ext_eid: element ID Extension
5851*4882a593Smuzhiyun * @ies: data consisting of IEs
5852*4882a593Smuzhiyun * @len: length of data
5853*4882a593Smuzhiyun *
5854*4882a593Smuzhiyun * Return: %NULL if the etended element could not be found or if
5855*4882a593Smuzhiyun * the element is invalid (claims to be longer than the given
5856*4882a593Smuzhiyun * data) or if the byte array doesn't match; otherwise return the
5857*4882a593Smuzhiyun * requested element struct.
5858*4882a593Smuzhiyun *
5859*4882a593Smuzhiyun * Note: There are no checks on the element length other than
5860*4882a593Smuzhiyun * having to fit into the given data.
5861*4882a593Smuzhiyun */
5862*4882a593Smuzhiyun static inline const struct element *
cfg80211_find_ext_elem(u8 ext_eid,const u8 * ies,int len)5863*4882a593Smuzhiyun cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
5864*4882a593Smuzhiyun {
5865*4882a593Smuzhiyun return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
5866*4882a593Smuzhiyun &ext_eid, 1, 0);
5867*4882a593Smuzhiyun }
5868*4882a593Smuzhiyun
5869*4882a593Smuzhiyun /**
5870*4882a593Smuzhiyun * cfg80211_find_ext_ie - find information element with EID Extension in data
5871*4882a593Smuzhiyun *
5872*4882a593Smuzhiyun * @ext_eid: element ID Extension
5873*4882a593Smuzhiyun * @ies: data consisting of IEs
5874*4882a593Smuzhiyun * @len: length of data
5875*4882a593Smuzhiyun *
5876*4882a593Smuzhiyun * Return: %NULL if the extended element ID could not be found or if
5877*4882a593Smuzhiyun * the element is invalid (claims to be longer than the given
5878*4882a593Smuzhiyun * data), or a pointer to the first byte of the requested
5879*4882a593Smuzhiyun * element, that is the byte containing the element ID.
5880*4882a593Smuzhiyun *
5881*4882a593Smuzhiyun * Note: There are no checks on the element length other than
5882*4882a593Smuzhiyun * having to fit into the given data.
5883*4882a593Smuzhiyun */
cfg80211_find_ext_ie(u8 ext_eid,const u8 * ies,int len)5884*4882a593Smuzhiyun static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
5885*4882a593Smuzhiyun {
5886*4882a593Smuzhiyun return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
5887*4882a593Smuzhiyun &ext_eid, 1, 2);
5888*4882a593Smuzhiyun }
5889*4882a593Smuzhiyun
5890*4882a593Smuzhiyun /**
5891*4882a593Smuzhiyun * cfg80211_find_vendor_elem - find vendor specific information element in data
5892*4882a593Smuzhiyun *
5893*4882a593Smuzhiyun * @oui: vendor OUI
5894*4882a593Smuzhiyun * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
5895*4882a593Smuzhiyun * @ies: data consisting of IEs
5896*4882a593Smuzhiyun * @len: length of data
5897*4882a593Smuzhiyun *
5898*4882a593Smuzhiyun * Return: %NULL if the vendor specific element ID could not be found or if the
5899*4882a593Smuzhiyun * element is invalid (claims to be longer than the given data); otherwise
5900*4882a593Smuzhiyun * return the element structure for the requested element.
5901*4882a593Smuzhiyun *
5902*4882a593Smuzhiyun * Note: There are no checks on the element length other than having to fit into
5903*4882a593Smuzhiyun * the given data.
5904*4882a593Smuzhiyun */
5905*4882a593Smuzhiyun const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
5906*4882a593Smuzhiyun const u8 *ies,
5907*4882a593Smuzhiyun unsigned int len);
5908*4882a593Smuzhiyun
5909*4882a593Smuzhiyun /**
5910*4882a593Smuzhiyun * cfg80211_find_vendor_ie - find vendor specific information element in data
5911*4882a593Smuzhiyun *
5912*4882a593Smuzhiyun * @oui: vendor OUI
5913*4882a593Smuzhiyun * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
5914*4882a593Smuzhiyun * @ies: data consisting of IEs
5915*4882a593Smuzhiyun * @len: length of data
5916*4882a593Smuzhiyun *
5917*4882a593Smuzhiyun * Return: %NULL if the vendor specific element ID could not be found or if the
5918*4882a593Smuzhiyun * element is invalid (claims to be longer than the given data), or a pointer to
5919*4882a593Smuzhiyun * the first byte of the requested element, that is the byte containing the
5920*4882a593Smuzhiyun * element ID.
5921*4882a593Smuzhiyun *
5922*4882a593Smuzhiyun * Note: There are no checks on the element length other than having to fit into
5923*4882a593Smuzhiyun * the given data.
5924*4882a593Smuzhiyun */
5925*4882a593Smuzhiyun static inline const u8 *
cfg80211_find_vendor_ie(unsigned int oui,int oui_type,const u8 * ies,unsigned int len)5926*4882a593Smuzhiyun cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
5927*4882a593Smuzhiyun const u8 *ies, unsigned int len)
5928*4882a593Smuzhiyun {
5929*4882a593Smuzhiyun return (void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
5930*4882a593Smuzhiyun }
5931*4882a593Smuzhiyun
5932*4882a593Smuzhiyun /**
5933*4882a593Smuzhiyun * cfg80211_send_layer2_update - send layer 2 update frame
5934*4882a593Smuzhiyun *
5935*4882a593Smuzhiyun * @dev: network device
5936*4882a593Smuzhiyun * @addr: STA MAC address
5937*4882a593Smuzhiyun *
5938*4882a593Smuzhiyun * Wireless drivers can use this function to update forwarding tables in bridge
5939*4882a593Smuzhiyun * devices upon STA association.
5940*4882a593Smuzhiyun */
5941*4882a593Smuzhiyun void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
5942*4882a593Smuzhiyun
5943*4882a593Smuzhiyun /**
5944*4882a593Smuzhiyun * DOC: Regulatory enforcement infrastructure
5945*4882a593Smuzhiyun *
5946*4882a593Smuzhiyun * TODO
5947*4882a593Smuzhiyun */
5948*4882a593Smuzhiyun
5949*4882a593Smuzhiyun /**
5950*4882a593Smuzhiyun * regulatory_hint - driver hint to the wireless core a regulatory domain
5951*4882a593Smuzhiyun * @wiphy: the wireless device giving the hint (used only for reporting
5952*4882a593Smuzhiyun * conflicts)
5953*4882a593Smuzhiyun * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
5954*4882a593Smuzhiyun * should be in. If @rd is set this should be NULL. Note that if you
5955*4882a593Smuzhiyun * set this to NULL you should still set rd->alpha2 to some accepted
5956*4882a593Smuzhiyun * alpha2.
5957*4882a593Smuzhiyun *
5958*4882a593Smuzhiyun * Wireless drivers can use this function to hint to the wireless core
5959*4882a593Smuzhiyun * what it believes should be the current regulatory domain by
5960*4882a593Smuzhiyun * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
5961*4882a593Smuzhiyun * domain should be in or by providing a completely build regulatory domain.
5962*4882a593Smuzhiyun * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
5963*4882a593Smuzhiyun * for a regulatory domain structure for the respective country.
5964*4882a593Smuzhiyun *
5965*4882a593Smuzhiyun * The wiphy must have been registered to cfg80211 prior to this call.
5966*4882a593Smuzhiyun * For cfg80211 drivers this means you must first use wiphy_register(),
5967*4882a593Smuzhiyun * for mac80211 drivers you must first use ieee80211_register_hw().
5968*4882a593Smuzhiyun *
5969*4882a593Smuzhiyun * Drivers should check the return value, its possible you can get
5970*4882a593Smuzhiyun * an -ENOMEM.
5971*4882a593Smuzhiyun *
5972*4882a593Smuzhiyun * Return: 0 on success. -ENOMEM.
5973*4882a593Smuzhiyun */
5974*4882a593Smuzhiyun int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
5975*4882a593Smuzhiyun
5976*4882a593Smuzhiyun /**
5977*4882a593Smuzhiyun * regulatory_set_wiphy_regd - set regdom info for self managed drivers
5978*4882a593Smuzhiyun * @wiphy: the wireless device we want to process the regulatory domain on
5979*4882a593Smuzhiyun * @rd: the regulatory domain informatoin to use for this wiphy
5980*4882a593Smuzhiyun *
5981*4882a593Smuzhiyun * Set the regulatory domain information for self-managed wiphys, only they
5982*4882a593Smuzhiyun * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
5983*4882a593Smuzhiyun * information.
5984*4882a593Smuzhiyun *
5985*4882a593Smuzhiyun * Return: 0 on success. -EINVAL, -EPERM
5986*4882a593Smuzhiyun */
5987*4882a593Smuzhiyun int regulatory_set_wiphy_regd(struct wiphy *wiphy,
5988*4882a593Smuzhiyun struct ieee80211_regdomain *rd);
5989*4882a593Smuzhiyun
5990*4882a593Smuzhiyun /**
5991*4882a593Smuzhiyun * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers
5992*4882a593Smuzhiyun * @wiphy: the wireless device we want to process the regulatory domain on
5993*4882a593Smuzhiyun * @rd: the regulatory domain information to use for this wiphy
5994*4882a593Smuzhiyun *
5995*4882a593Smuzhiyun * This functions requires the RTNL to be held and applies the new regdomain
5996*4882a593Smuzhiyun * synchronously to this wiphy. For more details see
5997*4882a593Smuzhiyun * regulatory_set_wiphy_regd().
5998*4882a593Smuzhiyun *
5999*4882a593Smuzhiyun * Return: 0 on success. -EINVAL, -EPERM
6000*4882a593Smuzhiyun */
6001*4882a593Smuzhiyun int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
6002*4882a593Smuzhiyun struct ieee80211_regdomain *rd);
6003*4882a593Smuzhiyun
6004*4882a593Smuzhiyun /**
6005*4882a593Smuzhiyun * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
6006*4882a593Smuzhiyun * @wiphy: the wireless device we want to process the regulatory domain on
6007*4882a593Smuzhiyun * @regd: the custom regulatory domain to use for this wiphy
6008*4882a593Smuzhiyun *
6009*4882a593Smuzhiyun * Drivers can sometimes have custom regulatory domains which do not apply
6010*4882a593Smuzhiyun * to a specific country. Drivers can use this to apply such custom regulatory
6011*4882a593Smuzhiyun * domains. This routine must be called prior to wiphy registration. The
6012*4882a593Smuzhiyun * custom regulatory domain will be trusted completely and as such previous
6013*4882a593Smuzhiyun * default channel settings will be disregarded. If no rule is found for a
6014*4882a593Smuzhiyun * channel on the regulatory domain the channel will be disabled.
6015*4882a593Smuzhiyun * Drivers using this for a wiphy should also set the wiphy flag
6016*4882a593Smuzhiyun * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
6017*4882a593Smuzhiyun * that called this helper.
6018*4882a593Smuzhiyun */
6019*4882a593Smuzhiyun void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
6020*4882a593Smuzhiyun const struct ieee80211_regdomain *regd);
6021*4882a593Smuzhiyun
6022*4882a593Smuzhiyun /**
6023*4882a593Smuzhiyun * freq_reg_info - get regulatory information for the given frequency
6024*4882a593Smuzhiyun * @wiphy: the wiphy for which we want to process this rule for
6025*4882a593Smuzhiyun * @center_freq: Frequency in KHz for which we want regulatory information for
6026*4882a593Smuzhiyun *
6027*4882a593Smuzhiyun * Use this function to get the regulatory rule for a specific frequency on
6028*4882a593Smuzhiyun * a given wireless device. If the device has a specific regulatory domain
6029*4882a593Smuzhiyun * it wants to follow we respect that unless a country IE has been received
6030*4882a593Smuzhiyun * and processed already.
6031*4882a593Smuzhiyun *
6032*4882a593Smuzhiyun * Return: A valid pointer, or, when an error occurs, for example if no rule
6033*4882a593Smuzhiyun * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
6034*4882a593Smuzhiyun * check and PTR_ERR() to obtain the numeric return value. The numeric return
6035*4882a593Smuzhiyun * value will be -ERANGE if we determine the given center_freq does not even
6036*4882a593Smuzhiyun * have a regulatory rule for a frequency range in the center_freq's band.
6037*4882a593Smuzhiyun * See freq_in_rule_band() for our current definition of a band -- this is
6038*4882a593Smuzhiyun * purely subjective and right now it's 802.11 specific.
6039*4882a593Smuzhiyun */
6040*4882a593Smuzhiyun const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
6041*4882a593Smuzhiyun u32 center_freq);
6042*4882a593Smuzhiyun
6043*4882a593Smuzhiyun /**
6044*4882a593Smuzhiyun * reg_initiator_name - map regulatory request initiator enum to name
6045*4882a593Smuzhiyun * @initiator: the regulatory request initiator
6046*4882a593Smuzhiyun *
6047*4882a593Smuzhiyun * You can use this to map the regulatory request initiator enum to a
6048*4882a593Smuzhiyun * proper string representation.
6049*4882a593Smuzhiyun */
6050*4882a593Smuzhiyun const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
6051*4882a593Smuzhiyun
6052*4882a593Smuzhiyun /**
6053*4882a593Smuzhiyun * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
6054*4882a593Smuzhiyun * @wiphy: wiphy for which pre-CAC capability is checked.
6055*4882a593Smuzhiyun *
6056*4882a593Smuzhiyun * Pre-CAC is allowed only in some regdomains (notable ETSI).
6057*4882a593Smuzhiyun */
6058*4882a593Smuzhiyun bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
6059*4882a593Smuzhiyun
6060*4882a593Smuzhiyun /**
6061*4882a593Smuzhiyun * DOC: Internal regulatory db functions
6062*4882a593Smuzhiyun *
6063*4882a593Smuzhiyun */
6064*4882a593Smuzhiyun
6065*4882a593Smuzhiyun /**
6066*4882a593Smuzhiyun * reg_query_regdb_wmm - Query internal regulatory db for wmm rule
6067*4882a593Smuzhiyun * Regulatory self-managed driver can use it to proactively
6068*4882a593Smuzhiyun *
6069*4882a593Smuzhiyun * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
6070*4882a593Smuzhiyun * @freq: the freqency(in MHz) to be queried.
6071*4882a593Smuzhiyun * @rule: pointer to store the wmm rule from the regulatory db.
6072*4882a593Smuzhiyun *
6073*4882a593Smuzhiyun * Self-managed wireless drivers can use this function to query
6074*4882a593Smuzhiyun * the internal regulatory database to check whether the given
6075*4882a593Smuzhiyun * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
6076*4882a593Smuzhiyun *
6077*4882a593Smuzhiyun * Drivers should check the return value, its possible you can get
6078*4882a593Smuzhiyun * an -ENODATA.
6079*4882a593Smuzhiyun *
6080*4882a593Smuzhiyun * Return: 0 on success. -ENODATA.
6081*4882a593Smuzhiyun */
6082*4882a593Smuzhiyun int reg_query_regdb_wmm(char *alpha2, int freq,
6083*4882a593Smuzhiyun struct ieee80211_reg_rule *rule);
6084*4882a593Smuzhiyun
6085*4882a593Smuzhiyun /*
6086*4882a593Smuzhiyun * callbacks for asynchronous cfg80211 methods, notification
6087*4882a593Smuzhiyun * functions and BSS handling helpers
6088*4882a593Smuzhiyun */
6089*4882a593Smuzhiyun
6090*4882a593Smuzhiyun /**
6091*4882a593Smuzhiyun * cfg80211_scan_done - notify that scan finished
6092*4882a593Smuzhiyun *
6093*4882a593Smuzhiyun * @request: the corresponding scan request
6094*4882a593Smuzhiyun * @info: information about the completed scan
6095*4882a593Smuzhiyun */
6096*4882a593Smuzhiyun void cfg80211_scan_done(struct cfg80211_scan_request *request,
6097*4882a593Smuzhiyun struct cfg80211_scan_info *info);
6098*4882a593Smuzhiyun
6099*4882a593Smuzhiyun /**
6100*4882a593Smuzhiyun * cfg80211_sched_scan_results - notify that new scan results are available
6101*4882a593Smuzhiyun *
6102*4882a593Smuzhiyun * @wiphy: the wiphy which got scheduled scan results
6103*4882a593Smuzhiyun * @reqid: identifier for the related scheduled scan request
6104*4882a593Smuzhiyun */
6105*4882a593Smuzhiyun void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
6106*4882a593Smuzhiyun
6107*4882a593Smuzhiyun /**
6108*4882a593Smuzhiyun * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
6109*4882a593Smuzhiyun *
6110*4882a593Smuzhiyun * @wiphy: the wiphy on which the scheduled scan stopped
6111*4882a593Smuzhiyun * @reqid: identifier for the related scheduled scan request
6112*4882a593Smuzhiyun *
6113*4882a593Smuzhiyun * The driver can call this function to inform cfg80211 that the
6114*4882a593Smuzhiyun * scheduled scan had to be stopped, for whatever reason. The driver
6115*4882a593Smuzhiyun * is then called back via the sched_scan_stop operation when done.
6116*4882a593Smuzhiyun */
6117*4882a593Smuzhiyun void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
6118*4882a593Smuzhiyun
6119*4882a593Smuzhiyun /**
6120*4882a593Smuzhiyun * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped
6121*4882a593Smuzhiyun *
6122*4882a593Smuzhiyun * @wiphy: the wiphy on which the scheduled scan stopped
6123*4882a593Smuzhiyun * @reqid: identifier for the related scheduled scan request
6124*4882a593Smuzhiyun *
6125*4882a593Smuzhiyun * The driver can call this function to inform cfg80211 that the
6126*4882a593Smuzhiyun * scheduled scan had to be stopped, for whatever reason. The driver
6127*4882a593Smuzhiyun * is then called back via the sched_scan_stop operation when done.
6128*4882a593Smuzhiyun * This function should be called with rtnl locked.
6129*4882a593Smuzhiyun */
6130*4882a593Smuzhiyun void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy, u64 reqid);
6131*4882a593Smuzhiyun
6132*4882a593Smuzhiyun /**
6133*4882a593Smuzhiyun * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
6134*4882a593Smuzhiyun * @wiphy: the wiphy reporting the BSS
6135*4882a593Smuzhiyun * @data: the BSS metadata
6136*4882a593Smuzhiyun * @mgmt: the management frame (probe response or beacon)
6137*4882a593Smuzhiyun * @len: length of the management frame
6138*4882a593Smuzhiyun * @gfp: context flags
6139*4882a593Smuzhiyun *
6140*4882a593Smuzhiyun * This informs cfg80211 that BSS information was found and
6141*4882a593Smuzhiyun * the BSS should be updated/added.
6142*4882a593Smuzhiyun *
6143*4882a593Smuzhiyun * Return: A referenced struct, must be released with cfg80211_put_bss()!
6144*4882a593Smuzhiyun * Or %NULL on error.
6145*4882a593Smuzhiyun */
6146*4882a593Smuzhiyun struct cfg80211_bss * __must_check
6147*4882a593Smuzhiyun cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
6148*4882a593Smuzhiyun struct cfg80211_inform_bss *data,
6149*4882a593Smuzhiyun struct ieee80211_mgmt *mgmt, size_t len,
6150*4882a593Smuzhiyun gfp_t gfp);
6151*4882a593Smuzhiyun
6152*4882a593Smuzhiyun static inline struct cfg80211_bss * __must_check
cfg80211_inform_bss_width_frame(struct wiphy * wiphy,struct ieee80211_channel * rx_channel,enum nl80211_bss_scan_width scan_width,struct ieee80211_mgmt * mgmt,size_t len,s32 signal,gfp_t gfp)6153*4882a593Smuzhiyun cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
6154*4882a593Smuzhiyun struct ieee80211_channel *rx_channel,
6155*4882a593Smuzhiyun enum nl80211_bss_scan_width scan_width,
6156*4882a593Smuzhiyun struct ieee80211_mgmt *mgmt, size_t len,
6157*4882a593Smuzhiyun s32 signal, gfp_t gfp)
6158*4882a593Smuzhiyun {
6159*4882a593Smuzhiyun struct cfg80211_inform_bss data = {
6160*4882a593Smuzhiyun .chan = rx_channel,
6161*4882a593Smuzhiyun .scan_width = scan_width,
6162*4882a593Smuzhiyun .signal = signal,
6163*4882a593Smuzhiyun };
6164*4882a593Smuzhiyun
6165*4882a593Smuzhiyun return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
6166*4882a593Smuzhiyun }
6167*4882a593Smuzhiyun
6168*4882a593Smuzhiyun static inline struct cfg80211_bss * __must_check
cfg80211_inform_bss_frame(struct wiphy * wiphy,struct ieee80211_channel * rx_channel,struct ieee80211_mgmt * mgmt,size_t len,s32 signal,gfp_t gfp)6169*4882a593Smuzhiyun cfg80211_inform_bss_frame(struct wiphy *wiphy,
6170*4882a593Smuzhiyun struct ieee80211_channel *rx_channel,
6171*4882a593Smuzhiyun struct ieee80211_mgmt *mgmt, size_t len,
6172*4882a593Smuzhiyun s32 signal, gfp_t gfp)
6173*4882a593Smuzhiyun {
6174*4882a593Smuzhiyun struct cfg80211_inform_bss data = {
6175*4882a593Smuzhiyun .chan = rx_channel,
6176*4882a593Smuzhiyun .scan_width = NL80211_BSS_CHAN_WIDTH_20,
6177*4882a593Smuzhiyun .signal = signal,
6178*4882a593Smuzhiyun };
6179*4882a593Smuzhiyun
6180*4882a593Smuzhiyun return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
6181*4882a593Smuzhiyun }
6182*4882a593Smuzhiyun
6183*4882a593Smuzhiyun /**
6184*4882a593Smuzhiyun * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
6185*4882a593Smuzhiyun * @bssid: transmitter BSSID
6186*4882a593Smuzhiyun * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
6187*4882a593Smuzhiyun * @mbssid_index: BSSID index, taken from Multiple BSSID index element
6188*4882a593Smuzhiyun * @new_bssid: calculated nontransmitted BSSID
6189*4882a593Smuzhiyun */
cfg80211_gen_new_bssid(const u8 * bssid,u8 max_bssid,u8 mbssid_index,u8 * new_bssid)6190*4882a593Smuzhiyun static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
6191*4882a593Smuzhiyun u8 mbssid_index, u8 *new_bssid)
6192*4882a593Smuzhiyun {
6193*4882a593Smuzhiyun u64 bssid_u64 = ether_addr_to_u64(bssid);
6194*4882a593Smuzhiyun u64 mask = GENMASK_ULL(max_bssid - 1, 0);
6195*4882a593Smuzhiyun u64 new_bssid_u64;
6196*4882a593Smuzhiyun
6197*4882a593Smuzhiyun new_bssid_u64 = bssid_u64 & ~mask;
6198*4882a593Smuzhiyun
6199*4882a593Smuzhiyun new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
6200*4882a593Smuzhiyun
6201*4882a593Smuzhiyun u64_to_ether_addr(new_bssid_u64, new_bssid);
6202*4882a593Smuzhiyun }
6203*4882a593Smuzhiyun
6204*4882a593Smuzhiyun /**
6205*4882a593Smuzhiyun * cfg80211_is_element_inherited - returns if element ID should be inherited
6206*4882a593Smuzhiyun * @element: element to check
6207*4882a593Smuzhiyun * @non_inherit_element: non inheritance element
6208*4882a593Smuzhiyun */
6209*4882a593Smuzhiyun bool cfg80211_is_element_inherited(const struct element *element,
6210*4882a593Smuzhiyun const struct element *non_inherit_element);
6211*4882a593Smuzhiyun
6212*4882a593Smuzhiyun /**
6213*4882a593Smuzhiyun * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
6214*4882a593Smuzhiyun * @ie: ies
6215*4882a593Smuzhiyun * @ielen: length of IEs
6216*4882a593Smuzhiyun * @mbssid_elem: current MBSSID element
6217*4882a593Smuzhiyun * @sub_elem: current MBSSID subelement (profile)
6218*4882a593Smuzhiyun * @merged_ie: location of the merged profile
6219*4882a593Smuzhiyun * @max_copy_len: max merged profile length
6220*4882a593Smuzhiyun */
6221*4882a593Smuzhiyun size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
6222*4882a593Smuzhiyun const struct element *mbssid_elem,
6223*4882a593Smuzhiyun const struct element *sub_elem,
6224*4882a593Smuzhiyun u8 *merged_ie, size_t max_copy_len);
6225*4882a593Smuzhiyun
6226*4882a593Smuzhiyun /**
6227*4882a593Smuzhiyun * enum cfg80211_bss_frame_type - frame type that the BSS data came from
6228*4882a593Smuzhiyun * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
6229*4882a593Smuzhiyun * from a beacon or probe response
6230*4882a593Smuzhiyun * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
6231*4882a593Smuzhiyun * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
6232*4882a593Smuzhiyun */
6233*4882a593Smuzhiyun enum cfg80211_bss_frame_type {
6234*4882a593Smuzhiyun CFG80211_BSS_FTYPE_UNKNOWN,
6235*4882a593Smuzhiyun CFG80211_BSS_FTYPE_BEACON,
6236*4882a593Smuzhiyun CFG80211_BSS_FTYPE_PRESP,
6237*4882a593Smuzhiyun };
6238*4882a593Smuzhiyun
6239*4882a593Smuzhiyun /**
6240*4882a593Smuzhiyun * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
6241*4882a593Smuzhiyun *
6242*4882a593Smuzhiyun * @wiphy: the wiphy reporting the BSS
6243*4882a593Smuzhiyun * @data: the BSS metadata
6244*4882a593Smuzhiyun * @ftype: frame type (if known)
6245*4882a593Smuzhiyun * @bssid: the BSSID of the BSS
6246*4882a593Smuzhiyun * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
6247*4882a593Smuzhiyun * @capability: the capability field sent by the peer
6248*4882a593Smuzhiyun * @beacon_interval: the beacon interval announced by the peer
6249*4882a593Smuzhiyun * @ie: additional IEs sent by the peer
6250*4882a593Smuzhiyun * @ielen: length of the additional IEs
6251*4882a593Smuzhiyun * @gfp: context flags
6252*4882a593Smuzhiyun *
6253*4882a593Smuzhiyun * This informs cfg80211 that BSS information was found and
6254*4882a593Smuzhiyun * the BSS should be updated/added.
6255*4882a593Smuzhiyun *
6256*4882a593Smuzhiyun * Return: A referenced struct, must be released with cfg80211_put_bss()!
6257*4882a593Smuzhiyun * Or %NULL on error.
6258*4882a593Smuzhiyun */
6259*4882a593Smuzhiyun struct cfg80211_bss * __must_check
6260*4882a593Smuzhiyun cfg80211_inform_bss_data(struct wiphy *wiphy,
6261*4882a593Smuzhiyun struct cfg80211_inform_bss *data,
6262*4882a593Smuzhiyun enum cfg80211_bss_frame_type ftype,
6263*4882a593Smuzhiyun const u8 *bssid, u64 tsf, u16 capability,
6264*4882a593Smuzhiyun u16 beacon_interval, const u8 *ie, size_t ielen,
6265*4882a593Smuzhiyun gfp_t gfp);
6266*4882a593Smuzhiyun
6267*4882a593Smuzhiyun static inline struct cfg80211_bss * __must_check
cfg80211_inform_bss_width(struct wiphy * wiphy,struct ieee80211_channel * rx_channel,enum nl80211_bss_scan_width scan_width,enum cfg80211_bss_frame_type ftype,const u8 * bssid,u64 tsf,u16 capability,u16 beacon_interval,const u8 * ie,size_t ielen,s32 signal,gfp_t gfp)6268*4882a593Smuzhiyun cfg80211_inform_bss_width(struct wiphy *wiphy,
6269*4882a593Smuzhiyun struct ieee80211_channel *rx_channel,
6270*4882a593Smuzhiyun enum nl80211_bss_scan_width scan_width,
6271*4882a593Smuzhiyun enum cfg80211_bss_frame_type ftype,
6272*4882a593Smuzhiyun const u8 *bssid, u64 tsf, u16 capability,
6273*4882a593Smuzhiyun u16 beacon_interval, const u8 *ie, size_t ielen,
6274*4882a593Smuzhiyun s32 signal, gfp_t gfp)
6275*4882a593Smuzhiyun {
6276*4882a593Smuzhiyun struct cfg80211_inform_bss data = {
6277*4882a593Smuzhiyun .chan = rx_channel,
6278*4882a593Smuzhiyun .scan_width = scan_width,
6279*4882a593Smuzhiyun .signal = signal,
6280*4882a593Smuzhiyun };
6281*4882a593Smuzhiyun
6282*4882a593Smuzhiyun return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
6283*4882a593Smuzhiyun capability, beacon_interval, ie, ielen,
6284*4882a593Smuzhiyun gfp);
6285*4882a593Smuzhiyun }
6286*4882a593Smuzhiyun
6287*4882a593Smuzhiyun static inline struct cfg80211_bss * __must_check
cfg80211_inform_bss(struct wiphy * wiphy,struct ieee80211_channel * rx_channel,enum cfg80211_bss_frame_type ftype,const u8 * bssid,u64 tsf,u16 capability,u16 beacon_interval,const u8 * ie,size_t ielen,s32 signal,gfp_t gfp)6288*4882a593Smuzhiyun cfg80211_inform_bss(struct wiphy *wiphy,
6289*4882a593Smuzhiyun struct ieee80211_channel *rx_channel,
6290*4882a593Smuzhiyun enum cfg80211_bss_frame_type ftype,
6291*4882a593Smuzhiyun const u8 *bssid, u64 tsf, u16 capability,
6292*4882a593Smuzhiyun u16 beacon_interval, const u8 *ie, size_t ielen,
6293*4882a593Smuzhiyun s32 signal, gfp_t gfp)
6294*4882a593Smuzhiyun {
6295*4882a593Smuzhiyun struct cfg80211_inform_bss data = {
6296*4882a593Smuzhiyun .chan = rx_channel,
6297*4882a593Smuzhiyun .scan_width = NL80211_BSS_CHAN_WIDTH_20,
6298*4882a593Smuzhiyun .signal = signal,
6299*4882a593Smuzhiyun };
6300*4882a593Smuzhiyun
6301*4882a593Smuzhiyun return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
6302*4882a593Smuzhiyun capability, beacon_interval, ie, ielen,
6303*4882a593Smuzhiyun gfp);
6304*4882a593Smuzhiyun }
6305*4882a593Smuzhiyun
6306*4882a593Smuzhiyun /**
6307*4882a593Smuzhiyun * cfg80211_get_bss - get a BSS reference
6308*4882a593Smuzhiyun * @wiphy: the wiphy this BSS struct belongs to
6309*4882a593Smuzhiyun * @channel: the channel to search on (or %NULL)
6310*4882a593Smuzhiyun * @bssid: the desired BSSID (or %NULL)
6311*4882a593Smuzhiyun * @ssid: the desired SSID (or %NULL)
6312*4882a593Smuzhiyun * @ssid_len: length of the SSID (or 0)
6313*4882a593Smuzhiyun * @bss_type: type of BSS, see &enum ieee80211_bss_type
6314*4882a593Smuzhiyun * @privacy: privacy filter, see &enum ieee80211_privacy
6315*4882a593Smuzhiyun */
6316*4882a593Smuzhiyun struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
6317*4882a593Smuzhiyun struct ieee80211_channel *channel,
6318*4882a593Smuzhiyun const u8 *bssid,
6319*4882a593Smuzhiyun const u8 *ssid, size_t ssid_len,
6320*4882a593Smuzhiyun enum ieee80211_bss_type bss_type,
6321*4882a593Smuzhiyun enum ieee80211_privacy privacy);
6322*4882a593Smuzhiyun static inline struct cfg80211_bss *
cfg80211_get_ibss(struct wiphy * wiphy,struct ieee80211_channel * channel,const u8 * ssid,size_t ssid_len)6323*4882a593Smuzhiyun cfg80211_get_ibss(struct wiphy *wiphy,
6324*4882a593Smuzhiyun struct ieee80211_channel *channel,
6325*4882a593Smuzhiyun const u8 *ssid, size_t ssid_len)
6326*4882a593Smuzhiyun {
6327*4882a593Smuzhiyun return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
6328*4882a593Smuzhiyun IEEE80211_BSS_TYPE_IBSS,
6329*4882a593Smuzhiyun IEEE80211_PRIVACY_ANY);
6330*4882a593Smuzhiyun }
6331*4882a593Smuzhiyun
6332*4882a593Smuzhiyun /**
6333*4882a593Smuzhiyun * cfg80211_ref_bss - reference BSS struct
6334*4882a593Smuzhiyun * @wiphy: the wiphy this BSS struct belongs to
6335*4882a593Smuzhiyun * @bss: the BSS struct to reference
6336*4882a593Smuzhiyun *
6337*4882a593Smuzhiyun * Increments the refcount of the given BSS struct.
6338*4882a593Smuzhiyun */
6339*4882a593Smuzhiyun void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6340*4882a593Smuzhiyun
6341*4882a593Smuzhiyun /**
6342*4882a593Smuzhiyun * cfg80211_put_bss - unref BSS struct
6343*4882a593Smuzhiyun * @wiphy: the wiphy this BSS struct belongs to
6344*4882a593Smuzhiyun * @bss: the BSS struct
6345*4882a593Smuzhiyun *
6346*4882a593Smuzhiyun * Decrements the refcount of the given BSS struct.
6347*4882a593Smuzhiyun */
6348*4882a593Smuzhiyun void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6349*4882a593Smuzhiyun
6350*4882a593Smuzhiyun /**
6351*4882a593Smuzhiyun * cfg80211_unlink_bss - unlink BSS from internal data structures
6352*4882a593Smuzhiyun * @wiphy: the wiphy
6353*4882a593Smuzhiyun * @bss: the bss to remove
6354*4882a593Smuzhiyun *
6355*4882a593Smuzhiyun * This function removes the given BSS from the internal data structures
6356*4882a593Smuzhiyun * thereby making it no longer show up in scan results etc. Use this
6357*4882a593Smuzhiyun * function when you detect a BSS is gone. Normally BSSes will also time
6358*4882a593Smuzhiyun * out, so it is not necessary to use this function at all.
6359*4882a593Smuzhiyun */
6360*4882a593Smuzhiyun void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6361*4882a593Smuzhiyun
6362*4882a593Smuzhiyun /**
6363*4882a593Smuzhiyun * cfg80211_bss_iter - iterate all BSS entries
6364*4882a593Smuzhiyun *
6365*4882a593Smuzhiyun * This function iterates over the BSS entries associated with the given wiphy
6366*4882a593Smuzhiyun * and calls the callback for the iterated BSS. The iterator function is not
6367*4882a593Smuzhiyun * allowed to call functions that might modify the internal state of the BSS DB.
6368*4882a593Smuzhiyun *
6369*4882a593Smuzhiyun * @wiphy: the wiphy
6370*4882a593Smuzhiyun * @chandef: if given, the iterator function will be called only if the channel
6371*4882a593Smuzhiyun * of the currently iterated BSS is a subset of the given channel.
6372*4882a593Smuzhiyun * @iter: the iterator function to call
6373*4882a593Smuzhiyun * @iter_data: an argument to the iterator function
6374*4882a593Smuzhiyun */
6375*4882a593Smuzhiyun void cfg80211_bss_iter(struct wiphy *wiphy,
6376*4882a593Smuzhiyun struct cfg80211_chan_def *chandef,
6377*4882a593Smuzhiyun void (*iter)(struct wiphy *wiphy,
6378*4882a593Smuzhiyun struct cfg80211_bss *bss,
6379*4882a593Smuzhiyun void *data),
6380*4882a593Smuzhiyun void *iter_data);
6381*4882a593Smuzhiyun
6382*4882a593Smuzhiyun static inline enum nl80211_bss_scan_width
cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def * chandef)6383*4882a593Smuzhiyun cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
6384*4882a593Smuzhiyun {
6385*4882a593Smuzhiyun switch (chandef->width) {
6386*4882a593Smuzhiyun case NL80211_CHAN_WIDTH_5:
6387*4882a593Smuzhiyun return NL80211_BSS_CHAN_WIDTH_5;
6388*4882a593Smuzhiyun case NL80211_CHAN_WIDTH_10:
6389*4882a593Smuzhiyun return NL80211_BSS_CHAN_WIDTH_10;
6390*4882a593Smuzhiyun default:
6391*4882a593Smuzhiyun return NL80211_BSS_CHAN_WIDTH_20;
6392*4882a593Smuzhiyun }
6393*4882a593Smuzhiyun }
6394*4882a593Smuzhiyun
6395*4882a593Smuzhiyun /**
6396*4882a593Smuzhiyun * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
6397*4882a593Smuzhiyun * @dev: network device
6398*4882a593Smuzhiyun * @buf: authentication frame (header + body)
6399*4882a593Smuzhiyun * @len: length of the frame data
6400*4882a593Smuzhiyun *
6401*4882a593Smuzhiyun * This function is called whenever an authentication, disassociation or
6402*4882a593Smuzhiyun * deauthentication frame has been received and processed in station mode.
6403*4882a593Smuzhiyun * After being asked to authenticate via cfg80211_ops::auth() the driver must
6404*4882a593Smuzhiyun * call either this function or cfg80211_auth_timeout().
6405*4882a593Smuzhiyun * After being asked to associate via cfg80211_ops::assoc() the driver must
6406*4882a593Smuzhiyun * call either this function or cfg80211_auth_timeout().
6407*4882a593Smuzhiyun * While connected, the driver must calls this for received and processed
6408*4882a593Smuzhiyun * disassociation and deauthentication frames. If the frame couldn't be used
6409*4882a593Smuzhiyun * because it was unprotected, the driver must call the function
6410*4882a593Smuzhiyun * cfg80211_rx_unprot_mlme_mgmt() instead.
6411*4882a593Smuzhiyun *
6412*4882a593Smuzhiyun * This function may sleep. The caller must hold the corresponding wdev's mutex.
6413*4882a593Smuzhiyun */
6414*4882a593Smuzhiyun void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
6415*4882a593Smuzhiyun
6416*4882a593Smuzhiyun /**
6417*4882a593Smuzhiyun * cfg80211_auth_timeout - notification of timed out authentication
6418*4882a593Smuzhiyun * @dev: network device
6419*4882a593Smuzhiyun * @addr: The MAC address of the device with which the authentication timed out
6420*4882a593Smuzhiyun *
6421*4882a593Smuzhiyun * This function may sleep. The caller must hold the corresponding wdev's
6422*4882a593Smuzhiyun * mutex.
6423*4882a593Smuzhiyun */
6424*4882a593Smuzhiyun void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
6425*4882a593Smuzhiyun
6426*4882a593Smuzhiyun /**
6427*4882a593Smuzhiyun * cfg80211_rx_assoc_resp - notification of processed association response
6428*4882a593Smuzhiyun * @dev: network device
6429*4882a593Smuzhiyun * @bss: the BSS that association was requested with, ownership of the pointer
6430*4882a593Smuzhiyun * moves to cfg80211 in this call
6431*4882a593Smuzhiyun * @buf: (Re)Association Response frame (header + body)
6432*4882a593Smuzhiyun * @len: length of the frame data
6433*4882a593Smuzhiyun * @uapsd_queues: bitmap of queues configured for uapsd. Same format
6434*4882a593Smuzhiyun * as the AC bitmap in the QoS info field
6435*4882a593Smuzhiyun * @req_ies: information elements from the (Re)Association Request frame
6436*4882a593Smuzhiyun * @req_ies_len: length of req_ies data
6437*4882a593Smuzhiyun *
6438*4882a593Smuzhiyun * After being asked to associate via cfg80211_ops::assoc() the driver must
6439*4882a593Smuzhiyun * call either this function or cfg80211_auth_timeout().
6440*4882a593Smuzhiyun *
6441*4882a593Smuzhiyun * This function may sleep. The caller must hold the corresponding wdev's mutex.
6442*4882a593Smuzhiyun */
6443*4882a593Smuzhiyun void cfg80211_rx_assoc_resp(struct net_device *dev,
6444*4882a593Smuzhiyun struct cfg80211_bss *bss,
6445*4882a593Smuzhiyun const u8 *buf, size_t len,
6446*4882a593Smuzhiyun int uapsd_queues,
6447*4882a593Smuzhiyun const u8 *req_ies, size_t req_ies_len);
6448*4882a593Smuzhiyun
6449*4882a593Smuzhiyun /**
6450*4882a593Smuzhiyun * cfg80211_assoc_timeout - notification of timed out association
6451*4882a593Smuzhiyun * @dev: network device
6452*4882a593Smuzhiyun * @bss: The BSS entry with which association timed out.
6453*4882a593Smuzhiyun *
6454*4882a593Smuzhiyun * This function may sleep. The caller must hold the corresponding wdev's mutex.
6455*4882a593Smuzhiyun */
6456*4882a593Smuzhiyun void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
6457*4882a593Smuzhiyun
6458*4882a593Smuzhiyun /**
6459*4882a593Smuzhiyun * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
6460*4882a593Smuzhiyun * @dev: network device
6461*4882a593Smuzhiyun * @bss: The BSS entry with which association was abandoned.
6462*4882a593Smuzhiyun *
6463*4882a593Smuzhiyun * Call this whenever - for reasons reported through other API, like deauth RX,
6464*4882a593Smuzhiyun * an association attempt was abandoned.
6465*4882a593Smuzhiyun * This function may sleep. The caller must hold the corresponding wdev's mutex.
6466*4882a593Smuzhiyun */
6467*4882a593Smuzhiyun void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
6468*4882a593Smuzhiyun
6469*4882a593Smuzhiyun /**
6470*4882a593Smuzhiyun * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
6471*4882a593Smuzhiyun * @dev: network device
6472*4882a593Smuzhiyun * @buf: 802.11 frame (header + body)
6473*4882a593Smuzhiyun * @len: length of the frame data
6474*4882a593Smuzhiyun *
6475*4882a593Smuzhiyun * This function is called whenever deauthentication has been processed in
6476*4882a593Smuzhiyun * station mode. This includes both received deauthentication frames and
6477*4882a593Smuzhiyun * locally generated ones. This function may sleep. The caller must hold the
6478*4882a593Smuzhiyun * corresponding wdev's mutex.
6479*4882a593Smuzhiyun */
6480*4882a593Smuzhiyun void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
6481*4882a593Smuzhiyun
6482*4882a593Smuzhiyun /**
6483*4882a593Smuzhiyun * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
6484*4882a593Smuzhiyun * @dev: network device
6485*4882a593Smuzhiyun * @buf: received management frame (header + body)
6486*4882a593Smuzhiyun * @len: length of the frame data
6487*4882a593Smuzhiyun *
6488*4882a593Smuzhiyun * This function is called whenever a received deauthentication or dissassoc
6489*4882a593Smuzhiyun * frame has been dropped in station mode because of MFP being used but the
6490*4882a593Smuzhiyun * frame was not protected. This is also used to notify reception of a Beacon
6491*4882a593Smuzhiyun * frame that was dropped because it did not include a valid MME MIC while
6492*4882a593Smuzhiyun * beacon protection was enabled (BIGTK configured in station mode).
6493*4882a593Smuzhiyun *
6494*4882a593Smuzhiyun * This function may sleep.
6495*4882a593Smuzhiyun */
6496*4882a593Smuzhiyun void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
6497*4882a593Smuzhiyun const u8 *buf, size_t len);
6498*4882a593Smuzhiyun
6499*4882a593Smuzhiyun /**
6500*4882a593Smuzhiyun * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
6501*4882a593Smuzhiyun * @dev: network device
6502*4882a593Smuzhiyun * @addr: The source MAC address of the frame
6503*4882a593Smuzhiyun * @key_type: The key type that the received frame used
6504*4882a593Smuzhiyun * @key_id: Key identifier (0..3). Can be -1 if missing.
6505*4882a593Smuzhiyun * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
6506*4882a593Smuzhiyun * @gfp: allocation flags
6507*4882a593Smuzhiyun *
6508*4882a593Smuzhiyun * This function is called whenever the local MAC detects a MIC failure in a
6509*4882a593Smuzhiyun * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
6510*4882a593Smuzhiyun * primitive.
6511*4882a593Smuzhiyun */
6512*4882a593Smuzhiyun void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
6513*4882a593Smuzhiyun enum nl80211_key_type key_type, int key_id,
6514*4882a593Smuzhiyun const u8 *tsc, gfp_t gfp);
6515*4882a593Smuzhiyun
6516*4882a593Smuzhiyun /**
6517*4882a593Smuzhiyun * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
6518*4882a593Smuzhiyun *
6519*4882a593Smuzhiyun * @dev: network device
6520*4882a593Smuzhiyun * @bssid: the BSSID of the IBSS joined
6521*4882a593Smuzhiyun * @channel: the channel of the IBSS joined
6522*4882a593Smuzhiyun * @gfp: allocation flags
6523*4882a593Smuzhiyun *
6524*4882a593Smuzhiyun * This function notifies cfg80211 that the device joined an IBSS or
6525*4882a593Smuzhiyun * switched to a different BSSID. Before this function can be called,
6526*4882a593Smuzhiyun * either a beacon has to have been received from the IBSS, or one of
6527*4882a593Smuzhiyun * the cfg80211_inform_bss{,_frame} functions must have been called
6528*4882a593Smuzhiyun * with the locally generated beacon -- this guarantees that there is
6529*4882a593Smuzhiyun * always a scan result for this IBSS. cfg80211 will handle the rest.
6530*4882a593Smuzhiyun */
6531*4882a593Smuzhiyun void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
6532*4882a593Smuzhiyun struct ieee80211_channel *channel, gfp_t gfp);
6533*4882a593Smuzhiyun
6534*4882a593Smuzhiyun /**
6535*4882a593Smuzhiyun * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer
6536*4882a593Smuzhiyun * candidate
6537*4882a593Smuzhiyun *
6538*4882a593Smuzhiyun * @dev: network device
6539*4882a593Smuzhiyun * @macaddr: the MAC address of the new candidate
6540*4882a593Smuzhiyun * @ie: information elements advertised by the peer candidate
6541*4882a593Smuzhiyun * @ie_len: length of the information elements buffer
6542*4882a593Smuzhiyun * @gfp: allocation flags
6543*4882a593Smuzhiyun *
6544*4882a593Smuzhiyun * This function notifies cfg80211 that the mesh peer candidate has been
6545*4882a593Smuzhiyun * detected, most likely via a beacon or, less likely, via a probe response.
6546*4882a593Smuzhiyun * cfg80211 then sends a notification to userspace.
6547*4882a593Smuzhiyun */
6548*4882a593Smuzhiyun void cfg80211_notify_new_peer_candidate(struct net_device *dev,
6549*4882a593Smuzhiyun const u8 *macaddr, const u8 *ie, u8 ie_len,
6550*4882a593Smuzhiyun int sig_dbm, gfp_t gfp);
6551*4882a593Smuzhiyun
6552*4882a593Smuzhiyun /**
6553*4882a593Smuzhiyun * DOC: RFkill integration
6554*4882a593Smuzhiyun *
6555*4882a593Smuzhiyun * RFkill integration in cfg80211 is almost invisible to drivers,
6556*4882a593Smuzhiyun * as cfg80211 automatically registers an rfkill instance for each
6557*4882a593Smuzhiyun * wireless device it knows about. Soft kill is also translated
6558*4882a593Smuzhiyun * into disconnecting and turning all interfaces off, drivers are
6559*4882a593Smuzhiyun * expected to turn off the device when all interfaces are down.
6560*4882a593Smuzhiyun *
6561*4882a593Smuzhiyun * However, devices may have a hard RFkill line, in which case they
6562*4882a593Smuzhiyun * also need to interact with the rfkill subsystem, via cfg80211.
6563*4882a593Smuzhiyun * They can do this with a few helper functions documented here.
6564*4882a593Smuzhiyun */
6565*4882a593Smuzhiyun
6566*4882a593Smuzhiyun /**
6567*4882a593Smuzhiyun * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
6568*4882a593Smuzhiyun * @wiphy: the wiphy
6569*4882a593Smuzhiyun * @blocked: block status
6570*4882a593Smuzhiyun */
6571*4882a593Smuzhiyun void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
6572*4882a593Smuzhiyun
6573*4882a593Smuzhiyun /**
6574*4882a593Smuzhiyun * wiphy_rfkill_start_polling - start polling rfkill
6575*4882a593Smuzhiyun * @wiphy: the wiphy
6576*4882a593Smuzhiyun */
6577*4882a593Smuzhiyun void wiphy_rfkill_start_polling(struct wiphy *wiphy);
6578*4882a593Smuzhiyun
6579*4882a593Smuzhiyun /**
6580*4882a593Smuzhiyun * wiphy_rfkill_stop_polling - stop polling rfkill
6581*4882a593Smuzhiyun * @wiphy: the wiphy
6582*4882a593Smuzhiyun */
6583*4882a593Smuzhiyun void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
6584*4882a593Smuzhiyun
6585*4882a593Smuzhiyun /**
6586*4882a593Smuzhiyun * DOC: Vendor commands
6587*4882a593Smuzhiyun *
6588*4882a593Smuzhiyun * Occasionally, there are special protocol or firmware features that
6589*4882a593Smuzhiyun * can't be implemented very openly. For this and similar cases, the
6590*4882a593Smuzhiyun * vendor command functionality allows implementing the features with
6591*4882a593Smuzhiyun * (typically closed-source) userspace and firmware, using nl80211 as
6592*4882a593Smuzhiyun * the configuration mechanism.
6593*4882a593Smuzhiyun *
6594*4882a593Smuzhiyun * A driver supporting vendor commands must register them as an array
6595*4882a593Smuzhiyun * in struct wiphy, with handlers for each one, each command has an
6596*4882a593Smuzhiyun * OUI and sub command ID to identify it.
6597*4882a593Smuzhiyun *
6598*4882a593Smuzhiyun * Note that this feature should not be (ab)used to implement protocol
6599*4882a593Smuzhiyun * features that could openly be shared across drivers. In particular,
6600*4882a593Smuzhiyun * it must never be required to use vendor commands to implement any
6601*4882a593Smuzhiyun * "normal" functionality that higher-level userspace like connection
6602*4882a593Smuzhiyun * managers etc. need.
6603*4882a593Smuzhiyun */
6604*4882a593Smuzhiyun
6605*4882a593Smuzhiyun struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
6606*4882a593Smuzhiyun enum nl80211_commands cmd,
6607*4882a593Smuzhiyun enum nl80211_attrs attr,
6608*4882a593Smuzhiyun int approxlen);
6609*4882a593Smuzhiyun
6610*4882a593Smuzhiyun struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
6611*4882a593Smuzhiyun struct wireless_dev *wdev,
6612*4882a593Smuzhiyun enum nl80211_commands cmd,
6613*4882a593Smuzhiyun enum nl80211_attrs attr,
6614*4882a593Smuzhiyun unsigned int portid,
6615*4882a593Smuzhiyun int vendor_event_idx,
6616*4882a593Smuzhiyun int approxlen, gfp_t gfp);
6617*4882a593Smuzhiyun
6618*4882a593Smuzhiyun void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
6619*4882a593Smuzhiyun
6620*4882a593Smuzhiyun /**
6621*4882a593Smuzhiyun * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
6622*4882a593Smuzhiyun * @wiphy: the wiphy
6623*4882a593Smuzhiyun * @approxlen: an upper bound of the length of the data that will
6624*4882a593Smuzhiyun * be put into the skb
6625*4882a593Smuzhiyun *
6626*4882a593Smuzhiyun * This function allocates and pre-fills an skb for a reply to
6627*4882a593Smuzhiyun * a vendor command. Since it is intended for a reply, calling
6628*4882a593Smuzhiyun * it outside of a vendor command's doit() operation is invalid.
6629*4882a593Smuzhiyun *
6630*4882a593Smuzhiyun * The returned skb is pre-filled with some identifying data in
6631*4882a593Smuzhiyun * a way that any data that is put into the skb (with skb_put(),
6632*4882a593Smuzhiyun * nla_put() or similar) will end up being within the
6633*4882a593Smuzhiyun * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
6634*4882a593Smuzhiyun * with the skb is adding data for the corresponding userspace tool
6635*4882a593Smuzhiyun * which can then read that data out of the vendor data attribute.
6636*4882a593Smuzhiyun * You must not modify the skb in any other way.
6637*4882a593Smuzhiyun *
6638*4882a593Smuzhiyun * When done, call cfg80211_vendor_cmd_reply() with the skb and return
6639*4882a593Smuzhiyun * its error code as the result of the doit() operation.
6640*4882a593Smuzhiyun *
6641*4882a593Smuzhiyun * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6642*4882a593Smuzhiyun */
6643*4882a593Smuzhiyun static inline struct sk_buff *
cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy * wiphy,int approxlen)6644*4882a593Smuzhiyun cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6645*4882a593Smuzhiyun {
6646*4882a593Smuzhiyun return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
6647*4882a593Smuzhiyun NL80211_ATTR_VENDOR_DATA, approxlen);
6648*4882a593Smuzhiyun }
6649*4882a593Smuzhiyun
6650*4882a593Smuzhiyun /**
6651*4882a593Smuzhiyun * cfg80211_vendor_cmd_reply - send the reply skb
6652*4882a593Smuzhiyun * @skb: The skb, must have been allocated with
6653*4882a593Smuzhiyun * cfg80211_vendor_cmd_alloc_reply_skb()
6654*4882a593Smuzhiyun *
6655*4882a593Smuzhiyun * Since calling this function will usually be the last thing
6656*4882a593Smuzhiyun * before returning from the vendor command doit() you should
6657*4882a593Smuzhiyun * return the error code. Note that this function consumes the
6658*4882a593Smuzhiyun * skb regardless of the return value.
6659*4882a593Smuzhiyun *
6660*4882a593Smuzhiyun * Return: An error code or 0 on success.
6661*4882a593Smuzhiyun */
6662*4882a593Smuzhiyun int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
6663*4882a593Smuzhiyun
6664*4882a593Smuzhiyun /**
6665*4882a593Smuzhiyun * cfg80211_vendor_cmd_get_sender
6666*4882a593Smuzhiyun * @wiphy: the wiphy
6667*4882a593Smuzhiyun *
6668*4882a593Smuzhiyun * Return the current netlink port ID in a vendor command handler.
6669*4882a593Smuzhiyun * Valid to call only there.
6670*4882a593Smuzhiyun */
6671*4882a593Smuzhiyun unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
6672*4882a593Smuzhiyun
6673*4882a593Smuzhiyun /**
6674*4882a593Smuzhiyun * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
6675*4882a593Smuzhiyun * @wiphy: the wiphy
6676*4882a593Smuzhiyun * @wdev: the wireless device
6677*4882a593Smuzhiyun * @event_idx: index of the vendor event in the wiphy's vendor_events
6678*4882a593Smuzhiyun * @approxlen: an upper bound of the length of the data that will
6679*4882a593Smuzhiyun * be put into the skb
6680*4882a593Smuzhiyun * @gfp: allocation flags
6681*4882a593Smuzhiyun *
6682*4882a593Smuzhiyun * This function allocates and pre-fills an skb for an event on the
6683*4882a593Smuzhiyun * vendor-specific multicast group.
6684*4882a593Smuzhiyun *
6685*4882a593Smuzhiyun * If wdev != NULL, both the ifindex and identifier of the specified
6686*4882a593Smuzhiyun * wireless device are added to the event message before the vendor data
6687*4882a593Smuzhiyun * attribute.
6688*4882a593Smuzhiyun *
6689*4882a593Smuzhiyun * When done filling the skb, call cfg80211_vendor_event() with the
6690*4882a593Smuzhiyun * skb to send the event.
6691*4882a593Smuzhiyun *
6692*4882a593Smuzhiyun * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6693*4882a593Smuzhiyun */
6694*4882a593Smuzhiyun static inline struct sk_buff *
cfg80211_vendor_event_alloc(struct wiphy * wiphy,struct wireless_dev * wdev,int approxlen,int event_idx,gfp_t gfp)6695*4882a593Smuzhiyun cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
6696*4882a593Smuzhiyun int approxlen, int event_idx, gfp_t gfp)
6697*4882a593Smuzhiyun {
6698*4882a593Smuzhiyun return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6699*4882a593Smuzhiyun NL80211_ATTR_VENDOR_DATA,
6700*4882a593Smuzhiyun 0, event_idx, approxlen, gfp);
6701*4882a593Smuzhiyun }
6702*4882a593Smuzhiyun
6703*4882a593Smuzhiyun /**
6704*4882a593Smuzhiyun * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
6705*4882a593Smuzhiyun * @wiphy: the wiphy
6706*4882a593Smuzhiyun * @wdev: the wireless device
6707*4882a593Smuzhiyun * @event_idx: index of the vendor event in the wiphy's vendor_events
6708*4882a593Smuzhiyun * @portid: port ID of the receiver
6709*4882a593Smuzhiyun * @approxlen: an upper bound of the length of the data that will
6710*4882a593Smuzhiyun * be put into the skb
6711*4882a593Smuzhiyun * @gfp: allocation flags
6712*4882a593Smuzhiyun *
6713*4882a593Smuzhiyun * This function allocates and pre-fills an skb for an event to send to
6714*4882a593Smuzhiyun * a specific (userland) socket. This socket would previously have been
6715*4882a593Smuzhiyun * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
6716*4882a593Smuzhiyun * care to register a netlink notifier to see when the socket closes.
6717*4882a593Smuzhiyun *
6718*4882a593Smuzhiyun * If wdev != NULL, both the ifindex and identifier of the specified
6719*4882a593Smuzhiyun * wireless device are added to the event message before the vendor data
6720*4882a593Smuzhiyun * attribute.
6721*4882a593Smuzhiyun *
6722*4882a593Smuzhiyun * When done filling the skb, call cfg80211_vendor_event() with the
6723*4882a593Smuzhiyun * skb to send the event.
6724*4882a593Smuzhiyun *
6725*4882a593Smuzhiyun * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6726*4882a593Smuzhiyun */
6727*4882a593Smuzhiyun static inline struct sk_buff *
cfg80211_vendor_event_alloc_ucast(struct wiphy * wiphy,struct wireless_dev * wdev,unsigned int portid,int approxlen,int event_idx,gfp_t gfp)6728*4882a593Smuzhiyun cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
6729*4882a593Smuzhiyun struct wireless_dev *wdev,
6730*4882a593Smuzhiyun unsigned int portid, int approxlen,
6731*4882a593Smuzhiyun int event_idx, gfp_t gfp)
6732*4882a593Smuzhiyun {
6733*4882a593Smuzhiyun return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6734*4882a593Smuzhiyun NL80211_ATTR_VENDOR_DATA,
6735*4882a593Smuzhiyun portid, event_idx, approxlen, gfp);
6736*4882a593Smuzhiyun }
6737*4882a593Smuzhiyun
6738*4882a593Smuzhiyun /**
6739*4882a593Smuzhiyun * cfg80211_vendor_event - send the event
6740*4882a593Smuzhiyun * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
6741*4882a593Smuzhiyun * @gfp: allocation flags
6742*4882a593Smuzhiyun *
6743*4882a593Smuzhiyun * This function sends the given @skb, which must have been allocated
6744*4882a593Smuzhiyun * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
6745*4882a593Smuzhiyun */
cfg80211_vendor_event(struct sk_buff * skb,gfp_t gfp)6746*4882a593Smuzhiyun static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
6747*4882a593Smuzhiyun {
6748*4882a593Smuzhiyun __cfg80211_send_event_skb(skb, gfp);
6749*4882a593Smuzhiyun }
6750*4882a593Smuzhiyun
6751*4882a593Smuzhiyun #ifdef CONFIG_NL80211_TESTMODE
6752*4882a593Smuzhiyun /**
6753*4882a593Smuzhiyun * DOC: Test mode
6754*4882a593Smuzhiyun *
6755*4882a593Smuzhiyun * Test mode is a set of utility functions to allow drivers to
6756*4882a593Smuzhiyun * interact with driver-specific tools to aid, for instance,
6757*4882a593Smuzhiyun * factory programming.
6758*4882a593Smuzhiyun *
6759*4882a593Smuzhiyun * This chapter describes how drivers interact with it, for more
6760*4882a593Smuzhiyun * information see the nl80211 book's chapter on it.
6761*4882a593Smuzhiyun */
6762*4882a593Smuzhiyun
6763*4882a593Smuzhiyun /**
6764*4882a593Smuzhiyun * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
6765*4882a593Smuzhiyun * @wiphy: the wiphy
6766*4882a593Smuzhiyun * @approxlen: an upper bound of the length of the data that will
6767*4882a593Smuzhiyun * be put into the skb
6768*4882a593Smuzhiyun *
6769*4882a593Smuzhiyun * This function allocates and pre-fills an skb for a reply to
6770*4882a593Smuzhiyun * the testmode command. Since it is intended for a reply, calling
6771*4882a593Smuzhiyun * it outside of the @testmode_cmd operation is invalid.
6772*4882a593Smuzhiyun *
6773*4882a593Smuzhiyun * The returned skb is pre-filled with the wiphy index and set up in
6774*4882a593Smuzhiyun * a way that any data that is put into the skb (with skb_put(),
6775*4882a593Smuzhiyun * nla_put() or similar) will end up being within the
6776*4882a593Smuzhiyun * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
6777*4882a593Smuzhiyun * with the skb is adding data for the corresponding userspace tool
6778*4882a593Smuzhiyun * which can then read that data out of the testdata attribute. You
6779*4882a593Smuzhiyun * must not modify the skb in any other way.
6780*4882a593Smuzhiyun *
6781*4882a593Smuzhiyun * When done, call cfg80211_testmode_reply() with the skb and return
6782*4882a593Smuzhiyun * its error code as the result of the @testmode_cmd operation.
6783*4882a593Smuzhiyun *
6784*4882a593Smuzhiyun * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6785*4882a593Smuzhiyun */
6786*4882a593Smuzhiyun static inline struct sk_buff *
cfg80211_testmode_alloc_reply_skb(struct wiphy * wiphy,int approxlen)6787*4882a593Smuzhiyun cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6788*4882a593Smuzhiyun {
6789*4882a593Smuzhiyun return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
6790*4882a593Smuzhiyun NL80211_ATTR_TESTDATA, approxlen);
6791*4882a593Smuzhiyun }
6792*4882a593Smuzhiyun
6793*4882a593Smuzhiyun /**
6794*4882a593Smuzhiyun * cfg80211_testmode_reply - send the reply skb
6795*4882a593Smuzhiyun * @skb: The skb, must have been allocated with
6796*4882a593Smuzhiyun * cfg80211_testmode_alloc_reply_skb()
6797*4882a593Smuzhiyun *
6798*4882a593Smuzhiyun * Since calling this function will usually be the last thing
6799*4882a593Smuzhiyun * before returning from the @testmode_cmd you should return
6800*4882a593Smuzhiyun * the error code. Note that this function consumes the skb
6801*4882a593Smuzhiyun * regardless of the return value.
6802*4882a593Smuzhiyun *
6803*4882a593Smuzhiyun * Return: An error code or 0 on success.
6804*4882a593Smuzhiyun */
cfg80211_testmode_reply(struct sk_buff * skb)6805*4882a593Smuzhiyun static inline int cfg80211_testmode_reply(struct sk_buff *skb)
6806*4882a593Smuzhiyun {
6807*4882a593Smuzhiyun return cfg80211_vendor_cmd_reply(skb);
6808*4882a593Smuzhiyun }
6809*4882a593Smuzhiyun
6810*4882a593Smuzhiyun /**
6811*4882a593Smuzhiyun * cfg80211_testmode_alloc_event_skb - allocate testmode event
6812*4882a593Smuzhiyun * @wiphy: the wiphy
6813*4882a593Smuzhiyun * @approxlen: an upper bound of the length of the data that will
6814*4882a593Smuzhiyun * be put into the skb
6815*4882a593Smuzhiyun * @gfp: allocation flags
6816*4882a593Smuzhiyun *
6817*4882a593Smuzhiyun * This function allocates and pre-fills an skb for an event on the
6818*4882a593Smuzhiyun * testmode multicast group.
6819*4882a593Smuzhiyun *
6820*4882a593Smuzhiyun * The returned skb is set up in the same way as with
6821*4882a593Smuzhiyun * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
6822*4882a593Smuzhiyun * there, you should simply add data to it that will then end up in the
6823*4882a593Smuzhiyun * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
6824*4882a593Smuzhiyun * in any other way.
6825*4882a593Smuzhiyun *
6826*4882a593Smuzhiyun * When done filling the skb, call cfg80211_testmode_event() with the
6827*4882a593Smuzhiyun * skb to send the event.
6828*4882a593Smuzhiyun *
6829*4882a593Smuzhiyun * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6830*4882a593Smuzhiyun */
6831*4882a593Smuzhiyun static inline struct sk_buff *
cfg80211_testmode_alloc_event_skb(struct wiphy * wiphy,int approxlen,gfp_t gfp)6832*4882a593Smuzhiyun cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
6833*4882a593Smuzhiyun {
6834*4882a593Smuzhiyun return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
6835*4882a593Smuzhiyun NL80211_ATTR_TESTDATA, 0, -1,
6836*4882a593Smuzhiyun approxlen, gfp);
6837*4882a593Smuzhiyun }
6838*4882a593Smuzhiyun
6839*4882a593Smuzhiyun /**
6840*4882a593Smuzhiyun * cfg80211_testmode_event - send the event
6841*4882a593Smuzhiyun * @skb: The skb, must have been allocated with
6842*4882a593Smuzhiyun * cfg80211_testmode_alloc_event_skb()
6843*4882a593Smuzhiyun * @gfp: allocation flags
6844*4882a593Smuzhiyun *
6845*4882a593Smuzhiyun * This function sends the given @skb, which must have been allocated
6846*4882a593Smuzhiyun * by cfg80211_testmode_alloc_event_skb(), as an event. It always
6847*4882a593Smuzhiyun * consumes it.
6848*4882a593Smuzhiyun */
cfg80211_testmode_event(struct sk_buff * skb,gfp_t gfp)6849*4882a593Smuzhiyun static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
6850*4882a593Smuzhiyun {
6851*4882a593Smuzhiyun __cfg80211_send_event_skb(skb, gfp);
6852*4882a593Smuzhiyun }
6853*4882a593Smuzhiyun
6854*4882a593Smuzhiyun #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
6855*4882a593Smuzhiyun #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd),
6856*4882a593Smuzhiyun #else
6857*4882a593Smuzhiyun #define CFG80211_TESTMODE_CMD(cmd)
6858*4882a593Smuzhiyun #define CFG80211_TESTMODE_DUMP(cmd)
6859*4882a593Smuzhiyun #endif
6860*4882a593Smuzhiyun
6861*4882a593Smuzhiyun /**
6862*4882a593Smuzhiyun * struct cfg80211_fils_resp_params - FILS connection response params
6863*4882a593Smuzhiyun * @kek: KEK derived from a successful FILS connection (may be %NULL)
6864*4882a593Smuzhiyun * @kek_len: Length of @fils_kek in octets
6865*4882a593Smuzhiyun * @update_erp_next_seq_num: Boolean value to specify whether the value in
6866*4882a593Smuzhiyun * @erp_next_seq_num is valid.
6867*4882a593Smuzhiyun * @erp_next_seq_num: The next sequence number to use in ERP message in
6868*4882a593Smuzhiyun * FILS Authentication. This value should be specified irrespective of the
6869*4882a593Smuzhiyun * status for a FILS connection.
6870*4882a593Smuzhiyun * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
6871*4882a593Smuzhiyun * @pmk_len: Length of @pmk in octets
6872*4882a593Smuzhiyun * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
6873*4882a593Smuzhiyun * used for this FILS connection (may be %NULL).
6874*4882a593Smuzhiyun */
6875*4882a593Smuzhiyun struct cfg80211_fils_resp_params {
6876*4882a593Smuzhiyun const u8 *kek;
6877*4882a593Smuzhiyun size_t kek_len;
6878*4882a593Smuzhiyun bool update_erp_next_seq_num;
6879*4882a593Smuzhiyun u16 erp_next_seq_num;
6880*4882a593Smuzhiyun const u8 *pmk;
6881*4882a593Smuzhiyun size_t pmk_len;
6882*4882a593Smuzhiyun const u8 *pmkid;
6883*4882a593Smuzhiyun };
6884*4882a593Smuzhiyun
6885*4882a593Smuzhiyun /**
6886*4882a593Smuzhiyun * struct cfg80211_connect_resp_params - Connection response params
6887*4882a593Smuzhiyun * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
6888*4882a593Smuzhiyun * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6889*4882a593Smuzhiyun * the real status code for failures. If this call is used to report a
6890*4882a593Smuzhiyun * failure due to a timeout (e.g., not receiving an Authentication frame
6891*4882a593Smuzhiyun * from the AP) instead of an explicit rejection by the AP, -1 is used to
6892*4882a593Smuzhiyun * indicate that this is a failure, but without a status code.
6893*4882a593Smuzhiyun * @timeout_reason is used to report the reason for the timeout in that
6894*4882a593Smuzhiyun * case.
6895*4882a593Smuzhiyun * @bssid: The BSSID of the AP (may be %NULL)
6896*4882a593Smuzhiyun * @bss: Entry of bss to which STA got connected to, can be obtained through
6897*4882a593Smuzhiyun * cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6898*4882a593Smuzhiyun * bss from the connect_request and hold a reference to it and return
6899*4882a593Smuzhiyun * through this param to avoid a warning if the bss is expired during the
6900*4882a593Smuzhiyun * connection, esp. for those drivers implementing connect op.
6901*4882a593Smuzhiyun * Only one parameter among @bssid and @bss needs to be specified.
6902*4882a593Smuzhiyun * @req_ie: Association request IEs (may be %NULL)
6903*4882a593Smuzhiyun * @req_ie_len: Association request IEs length
6904*4882a593Smuzhiyun * @resp_ie: Association response IEs (may be %NULL)
6905*4882a593Smuzhiyun * @resp_ie_len: Association response IEs length
6906*4882a593Smuzhiyun * @fils: FILS connection response parameters.
6907*4882a593Smuzhiyun * @timeout_reason: Reason for connection timeout. This is used when the
6908*4882a593Smuzhiyun * connection fails due to a timeout instead of an explicit rejection from
6909*4882a593Smuzhiyun * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
6910*4882a593Smuzhiyun * not known. This value is used only if @status < 0 to indicate that the
6911*4882a593Smuzhiyun * failure is due to a timeout and not due to explicit rejection by the AP.
6912*4882a593Smuzhiyun * This value is ignored in other cases (@status >= 0).
6913*4882a593Smuzhiyun */
6914*4882a593Smuzhiyun struct cfg80211_connect_resp_params {
6915*4882a593Smuzhiyun int status;
6916*4882a593Smuzhiyun const u8 *bssid;
6917*4882a593Smuzhiyun struct cfg80211_bss *bss;
6918*4882a593Smuzhiyun const u8 *req_ie;
6919*4882a593Smuzhiyun size_t req_ie_len;
6920*4882a593Smuzhiyun const u8 *resp_ie;
6921*4882a593Smuzhiyun size_t resp_ie_len;
6922*4882a593Smuzhiyun struct cfg80211_fils_resp_params fils;
6923*4882a593Smuzhiyun enum nl80211_timeout_reason timeout_reason;
6924*4882a593Smuzhiyun };
6925*4882a593Smuzhiyun
6926*4882a593Smuzhiyun /**
6927*4882a593Smuzhiyun * cfg80211_connect_done - notify cfg80211 of connection result
6928*4882a593Smuzhiyun *
6929*4882a593Smuzhiyun * @dev: network device
6930*4882a593Smuzhiyun * @params: connection response parameters
6931*4882a593Smuzhiyun * @gfp: allocation flags
6932*4882a593Smuzhiyun *
6933*4882a593Smuzhiyun * It should be called by the underlying driver once execution of the connection
6934*4882a593Smuzhiyun * request from connect() has been completed. This is similar to
6935*4882a593Smuzhiyun * cfg80211_connect_bss(), but takes a structure pointer for connection response
6936*4882a593Smuzhiyun * parameters. Only one of the functions among cfg80211_connect_bss(),
6937*4882a593Smuzhiyun * cfg80211_connect_result(), cfg80211_connect_timeout(),
6938*4882a593Smuzhiyun * and cfg80211_connect_done() should be called.
6939*4882a593Smuzhiyun */
6940*4882a593Smuzhiyun void cfg80211_connect_done(struct net_device *dev,
6941*4882a593Smuzhiyun struct cfg80211_connect_resp_params *params,
6942*4882a593Smuzhiyun gfp_t gfp);
6943*4882a593Smuzhiyun
6944*4882a593Smuzhiyun /**
6945*4882a593Smuzhiyun * cfg80211_connect_bss - notify cfg80211 of connection result
6946*4882a593Smuzhiyun *
6947*4882a593Smuzhiyun * @dev: network device
6948*4882a593Smuzhiyun * @bssid: the BSSID of the AP
6949*4882a593Smuzhiyun * @bss: Entry of bss to which STA got connected to, can be obtained through
6950*4882a593Smuzhiyun * cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6951*4882a593Smuzhiyun * bss from the connect_request and hold a reference to it and return
6952*4882a593Smuzhiyun * through this param to avoid a warning if the bss is expired during the
6953*4882a593Smuzhiyun * connection, esp. for those drivers implementing connect op.
6954*4882a593Smuzhiyun * Only one parameter among @bssid and @bss needs to be specified.
6955*4882a593Smuzhiyun * @req_ie: association request IEs (maybe be %NULL)
6956*4882a593Smuzhiyun * @req_ie_len: association request IEs length
6957*4882a593Smuzhiyun * @resp_ie: association response IEs (may be %NULL)
6958*4882a593Smuzhiyun * @resp_ie_len: assoc response IEs length
6959*4882a593Smuzhiyun * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
6960*4882a593Smuzhiyun * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6961*4882a593Smuzhiyun * the real status code for failures. If this call is used to report a
6962*4882a593Smuzhiyun * failure due to a timeout (e.g., not receiving an Authentication frame
6963*4882a593Smuzhiyun * from the AP) instead of an explicit rejection by the AP, -1 is used to
6964*4882a593Smuzhiyun * indicate that this is a failure, but without a status code.
6965*4882a593Smuzhiyun * @timeout_reason is used to report the reason for the timeout in that
6966*4882a593Smuzhiyun * case.
6967*4882a593Smuzhiyun * @gfp: allocation flags
6968*4882a593Smuzhiyun * @timeout_reason: reason for connection timeout. This is used when the
6969*4882a593Smuzhiyun * connection fails due to a timeout instead of an explicit rejection from
6970*4882a593Smuzhiyun * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
6971*4882a593Smuzhiyun * not known. This value is used only if @status < 0 to indicate that the
6972*4882a593Smuzhiyun * failure is due to a timeout and not due to explicit rejection by the AP.
6973*4882a593Smuzhiyun * This value is ignored in other cases (@status >= 0).
6974*4882a593Smuzhiyun *
6975*4882a593Smuzhiyun * It should be called by the underlying driver once execution of the connection
6976*4882a593Smuzhiyun * request from connect() has been completed. This is similar to
6977*4882a593Smuzhiyun * cfg80211_connect_result(), but with the option of identifying the exact bss
6978*4882a593Smuzhiyun * entry for the connection. Only one of the functions among
6979*4882a593Smuzhiyun * cfg80211_connect_bss(), cfg80211_connect_result(),
6980*4882a593Smuzhiyun * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6981*4882a593Smuzhiyun */
6982*4882a593Smuzhiyun static inline void
cfg80211_connect_bss(struct net_device * dev,const u8 * bssid,struct cfg80211_bss * bss,const u8 * req_ie,size_t req_ie_len,const u8 * resp_ie,size_t resp_ie_len,int status,gfp_t gfp,enum nl80211_timeout_reason timeout_reason)6983*4882a593Smuzhiyun cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
6984*4882a593Smuzhiyun struct cfg80211_bss *bss, const u8 *req_ie,
6985*4882a593Smuzhiyun size_t req_ie_len, const u8 *resp_ie,
6986*4882a593Smuzhiyun size_t resp_ie_len, int status, gfp_t gfp,
6987*4882a593Smuzhiyun enum nl80211_timeout_reason timeout_reason)
6988*4882a593Smuzhiyun {
6989*4882a593Smuzhiyun struct cfg80211_connect_resp_params params;
6990*4882a593Smuzhiyun
6991*4882a593Smuzhiyun memset(¶ms, 0, sizeof(params));
6992*4882a593Smuzhiyun params.status = status;
6993*4882a593Smuzhiyun params.bssid = bssid;
6994*4882a593Smuzhiyun params.bss = bss;
6995*4882a593Smuzhiyun params.req_ie = req_ie;
6996*4882a593Smuzhiyun params.req_ie_len = req_ie_len;
6997*4882a593Smuzhiyun params.resp_ie = resp_ie;
6998*4882a593Smuzhiyun params.resp_ie_len = resp_ie_len;
6999*4882a593Smuzhiyun params.timeout_reason = timeout_reason;
7000*4882a593Smuzhiyun
7001*4882a593Smuzhiyun cfg80211_connect_done(dev, ¶ms, gfp);
7002*4882a593Smuzhiyun }
7003*4882a593Smuzhiyun
7004*4882a593Smuzhiyun /**
7005*4882a593Smuzhiyun * cfg80211_connect_result - notify cfg80211 of connection result
7006*4882a593Smuzhiyun *
7007*4882a593Smuzhiyun * @dev: network device
7008*4882a593Smuzhiyun * @bssid: the BSSID of the AP
7009*4882a593Smuzhiyun * @req_ie: association request IEs (maybe be %NULL)
7010*4882a593Smuzhiyun * @req_ie_len: association request IEs length
7011*4882a593Smuzhiyun * @resp_ie: association response IEs (may be %NULL)
7012*4882a593Smuzhiyun * @resp_ie_len: assoc response IEs length
7013*4882a593Smuzhiyun * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
7014*4882a593Smuzhiyun * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7015*4882a593Smuzhiyun * the real status code for failures.
7016*4882a593Smuzhiyun * @gfp: allocation flags
7017*4882a593Smuzhiyun *
7018*4882a593Smuzhiyun * It should be called by the underlying driver once execution of the connection
7019*4882a593Smuzhiyun * request from connect() has been completed. This is similar to
7020*4882a593Smuzhiyun * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
7021*4882a593Smuzhiyun * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
7022*4882a593Smuzhiyun * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7023*4882a593Smuzhiyun */
7024*4882a593Smuzhiyun static inline void
cfg80211_connect_result(struct net_device * dev,const u8 * bssid,const u8 * req_ie,size_t req_ie_len,const u8 * resp_ie,size_t resp_ie_len,u16 status,gfp_t gfp)7025*4882a593Smuzhiyun cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
7026*4882a593Smuzhiyun const u8 *req_ie, size_t req_ie_len,
7027*4882a593Smuzhiyun const u8 *resp_ie, size_t resp_ie_len,
7028*4882a593Smuzhiyun u16 status, gfp_t gfp)
7029*4882a593Smuzhiyun {
7030*4882a593Smuzhiyun cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
7031*4882a593Smuzhiyun resp_ie_len, status, gfp,
7032*4882a593Smuzhiyun NL80211_TIMEOUT_UNSPECIFIED);
7033*4882a593Smuzhiyun }
7034*4882a593Smuzhiyun
7035*4882a593Smuzhiyun /**
7036*4882a593Smuzhiyun * cfg80211_connect_timeout - notify cfg80211 of connection timeout
7037*4882a593Smuzhiyun *
7038*4882a593Smuzhiyun * @dev: network device
7039*4882a593Smuzhiyun * @bssid: the BSSID of the AP
7040*4882a593Smuzhiyun * @req_ie: association request IEs (maybe be %NULL)
7041*4882a593Smuzhiyun * @req_ie_len: association request IEs length
7042*4882a593Smuzhiyun * @gfp: allocation flags
7043*4882a593Smuzhiyun * @timeout_reason: reason for connection timeout.
7044*4882a593Smuzhiyun *
7045*4882a593Smuzhiyun * It should be called by the underlying driver whenever connect() has failed
7046*4882a593Smuzhiyun * in a sequence where no explicit authentication/association rejection was
7047*4882a593Smuzhiyun * received from the AP. This could happen, e.g., due to not being able to send
7048*4882a593Smuzhiyun * out the Authentication or Association Request frame or timing out while
7049*4882a593Smuzhiyun * waiting for the response. Only one of the functions among
7050*4882a593Smuzhiyun * cfg80211_connect_bss(), cfg80211_connect_result(),
7051*4882a593Smuzhiyun * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7052*4882a593Smuzhiyun */
7053*4882a593Smuzhiyun static inline void
cfg80211_connect_timeout(struct net_device * dev,const u8 * bssid,const u8 * req_ie,size_t req_ie_len,gfp_t gfp,enum nl80211_timeout_reason timeout_reason)7054*4882a593Smuzhiyun cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
7055*4882a593Smuzhiyun const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
7056*4882a593Smuzhiyun enum nl80211_timeout_reason timeout_reason)
7057*4882a593Smuzhiyun {
7058*4882a593Smuzhiyun cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
7059*4882a593Smuzhiyun gfp, timeout_reason);
7060*4882a593Smuzhiyun }
7061*4882a593Smuzhiyun
7062*4882a593Smuzhiyun /**
7063*4882a593Smuzhiyun * struct cfg80211_roam_info - driver initiated roaming information
7064*4882a593Smuzhiyun *
7065*4882a593Smuzhiyun * @channel: the channel of the new AP
7066*4882a593Smuzhiyun * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
7067*4882a593Smuzhiyun * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
7068*4882a593Smuzhiyun * @req_ie: association request IEs (maybe be %NULL)
7069*4882a593Smuzhiyun * @req_ie_len: association request IEs length
7070*4882a593Smuzhiyun * @resp_ie: association response IEs (may be %NULL)
7071*4882a593Smuzhiyun * @resp_ie_len: assoc response IEs length
7072*4882a593Smuzhiyun * @fils: FILS related roaming information.
7073*4882a593Smuzhiyun */
7074*4882a593Smuzhiyun struct cfg80211_roam_info {
7075*4882a593Smuzhiyun struct ieee80211_channel *channel;
7076*4882a593Smuzhiyun struct cfg80211_bss *bss;
7077*4882a593Smuzhiyun const u8 *bssid;
7078*4882a593Smuzhiyun const u8 *req_ie;
7079*4882a593Smuzhiyun size_t req_ie_len;
7080*4882a593Smuzhiyun const u8 *resp_ie;
7081*4882a593Smuzhiyun size_t resp_ie_len;
7082*4882a593Smuzhiyun struct cfg80211_fils_resp_params fils;
7083*4882a593Smuzhiyun };
7084*4882a593Smuzhiyun
7085*4882a593Smuzhiyun /**
7086*4882a593Smuzhiyun * cfg80211_roamed - notify cfg80211 of roaming
7087*4882a593Smuzhiyun *
7088*4882a593Smuzhiyun * @dev: network device
7089*4882a593Smuzhiyun * @info: information about the new BSS. struct &cfg80211_roam_info.
7090*4882a593Smuzhiyun * @gfp: allocation flags
7091*4882a593Smuzhiyun *
7092*4882a593Smuzhiyun * This function may be called with the driver passing either the BSSID of the
7093*4882a593Smuzhiyun * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
7094*4882a593Smuzhiyun * It should be called by the underlying driver whenever it roamed from one AP
7095*4882a593Smuzhiyun * to another while connected. Drivers which have roaming implemented in
7096*4882a593Smuzhiyun * firmware should pass the bss entry to avoid a race in bss entry timeout where
7097*4882a593Smuzhiyun * the bss entry of the new AP is seen in the driver, but gets timed out by the
7098*4882a593Smuzhiyun * time it is accessed in __cfg80211_roamed() due to delay in scheduling
7099*4882a593Smuzhiyun * rdev->event_work. In case of any failures, the reference is released
7100*4882a593Smuzhiyun * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
7101*4882a593Smuzhiyun * released while disconnecting from the current bss.
7102*4882a593Smuzhiyun */
7103*4882a593Smuzhiyun void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
7104*4882a593Smuzhiyun gfp_t gfp);
7105*4882a593Smuzhiyun
7106*4882a593Smuzhiyun /**
7107*4882a593Smuzhiyun * cfg80211_port_authorized - notify cfg80211 of successful security association
7108*4882a593Smuzhiyun *
7109*4882a593Smuzhiyun * @dev: network device
7110*4882a593Smuzhiyun * @bssid: the BSSID of the AP
7111*4882a593Smuzhiyun * @gfp: allocation flags
7112*4882a593Smuzhiyun *
7113*4882a593Smuzhiyun * This function should be called by a driver that supports 4 way handshake
7114*4882a593Smuzhiyun * offload after a security association was successfully established (i.e.,
7115*4882a593Smuzhiyun * the 4 way handshake was completed successfully). The call to this function
7116*4882a593Smuzhiyun * should be preceded with a call to cfg80211_connect_result(),
7117*4882a593Smuzhiyun * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
7118*4882a593Smuzhiyun * indicate the 802.11 association.
7119*4882a593Smuzhiyun */
7120*4882a593Smuzhiyun void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
7121*4882a593Smuzhiyun gfp_t gfp);
7122*4882a593Smuzhiyun
7123*4882a593Smuzhiyun /**
7124*4882a593Smuzhiyun * cfg80211_disconnected - notify cfg80211 that connection was dropped
7125*4882a593Smuzhiyun *
7126*4882a593Smuzhiyun * @dev: network device
7127*4882a593Smuzhiyun * @ie: information elements of the deauth/disassoc frame (may be %NULL)
7128*4882a593Smuzhiyun * @ie_len: length of IEs
7129*4882a593Smuzhiyun * @reason: reason code for the disconnection, set it to 0 if unknown
7130*4882a593Smuzhiyun * @locally_generated: disconnection was requested locally
7131*4882a593Smuzhiyun * @gfp: allocation flags
7132*4882a593Smuzhiyun *
7133*4882a593Smuzhiyun * After it calls this function, the driver should enter an idle state
7134*4882a593Smuzhiyun * and not try to connect to any AP any more.
7135*4882a593Smuzhiyun */
7136*4882a593Smuzhiyun void cfg80211_disconnected(struct net_device *dev, u16 reason,
7137*4882a593Smuzhiyun const u8 *ie, size_t ie_len,
7138*4882a593Smuzhiyun bool locally_generated, gfp_t gfp);
7139*4882a593Smuzhiyun
7140*4882a593Smuzhiyun /**
7141*4882a593Smuzhiyun * cfg80211_ready_on_channel - notification of remain_on_channel start
7142*4882a593Smuzhiyun * @wdev: wireless device
7143*4882a593Smuzhiyun * @cookie: the request cookie
7144*4882a593Smuzhiyun * @chan: The current channel (from remain_on_channel request)
7145*4882a593Smuzhiyun * @duration: Duration in milliseconds that the driver intents to remain on the
7146*4882a593Smuzhiyun * channel
7147*4882a593Smuzhiyun * @gfp: allocation flags
7148*4882a593Smuzhiyun */
7149*4882a593Smuzhiyun void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
7150*4882a593Smuzhiyun struct ieee80211_channel *chan,
7151*4882a593Smuzhiyun unsigned int duration, gfp_t gfp);
7152*4882a593Smuzhiyun
7153*4882a593Smuzhiyun /**
7154*4882a593Smuzhiyun * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
7155*4882a593Smuzhiyun * @wdev: wireless device
7156*4882a593Smuzhiyun * @cookie: the request cookie
7157*4882a593Smuzhiyun * @chan: The current channel (from remain_on_channel request)
7158*4882a593Smuzhiyun * @gfp: allocation flags
7159*4882a593Smuzhiyun */
7160*4882a593Smuzhiyun void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
7161*4882a593Smuzhiyun struct ieee80211_channel *chan,
7162*4882a593Smuzhiyun gfp_t gfp);
7163*4882a593Smuzhiyun
7164*4882a593Smuzhiyun /**
7165*4882a593Smuzhiyun * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
7166*4882a593Smuzhiyun * @wdev: wireless device
7167*4882a593Smuzhiyun * @cookie: the requested cookie
7168*4882a593Smuzhiyun * @chan: The current channel (from tx_mgmt request)
7169*4882a593Smuzhiyun * @gfp: allocation flags
7170*4882a593Smuzhiyun */
7171*4882a593Smuzhiyun void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
7172*4882a593Smuzhiyun struct ieee80211_channel *chan, gfp_t gfp);
7173*4882a593Smuzhiyun
7174*4882a593Smuzhiyun /**
7175*4882a593Smuzhiyun * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
7176*4882a593Smuzhiyun *
7177*4882a593Smuzhiyun * @sinfo: the station information
7178*4882a593Smuzhiyun * @gfp: allocation flags
7179*4882a593Smuzhiyun */
7180*4882a593Smuzhiyun int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
7181*4882a593Smuzhiyun
7182*4882a593Smuzhiyun /**
7183*4882a593Smuzhiyun * cfg80211_sinfo_release_content - release contents of station info
7184*4882a593Smuzhiyun * @sinfo: the station information
7185*4882a593Smuzhiyun *
7186*4882a593Smuzhiyun * Releases any potentially allocated sub-information of the station
7187*4882a593Smuzhiyun * information, but not the struct itself (since it's typically on
7188*4882a593Smuzhiyun * the stack.)
7189*4882a593Smuzhiyun */
cfg80211_sinfo_release_content(struct station_info * sinfo)7190*4882a593Smuzhiyun static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
7191*4882a593Smuzhiyun {
7192*4882a593Smuzhiyun kfree(sinfo->pertid);
7193*4882a593Smuzhiyun }
7194*4882a593Smuzhiyun
7195*4882a593Smuzhiyun /**
7196*4882a593Smuzhiyun * cfg80211_new_sta - notify userspace about station
7197*4882a593Smuzhiyun *
7198*4882a593Smuzhiyun * @dev: the netdev
7199*4882a593Smuzhiyun * @mac_addr: the station's address
7200*4882a593Smuzhiyun * @sinfo: the station information
7201*4882a593Smuzhiyun * @gfp: allocation flags
7202*4882a593Smuzhiyun */
7203*4882a593Smuzhiyun void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
7204*4882a593Smuzhiyun struct station_info *sinfo, gfp_t gfp);
7205*4882a593Smuzhiyun
7206*4882a593Smuzhiyun /**
7207*4882a593Smuzhiyun * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
7208*4882a593Smuzhiyun * @dev: the netdev
7209*4882a593Smuzhiyun * @mac_addr: the station's address
7210*4882a593Smuzhiyun * @sinfo: the station information/statistics
7211*4882a593Smuzhiyun * @gfp: allocation flags
7212*4882a593Smuzhiyun */
7213*4882a593Smuzhiyun void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
7214*4882a593Smuzhiyun struct station_info *sinfo, gfp_t gfp);
7215*4882a593Smuzhiyun
7216*4882a593Smuzhiyun /**
7217*4882a593Smuzhiyun * cfg80211_del_sta - notify userspace about deletion of a station
7218*4882a593Smuzhiyun *
7219*4882a593Smuzhiyun * @dev: the netdev
7220*4882a593Smuzhiyun * @mac_addr: the station's address
7221*4882a593Smuzhiyun * @gfp: allocation flags
7222*4882a593Smuzhiyun */
cfg80211_del_sta(struct net_device * dev,const u8 * mac_addr,gfp_t gfp)7223*4882a593Smuzhiyun static inline void cfg80211_del_sta(struct net_device *dev,
7224*4882a593Smuzhiyun const u8 *mac_addr, gfp_t gfp)
7225*4882a593Smuzhiyun {
7226*4882a593Smuzhiyun cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
7227*4882a593Smuzhiyun }
7228*4882a593Smuzhiyun
7229*4882a593Smuzhiyun /**
7230*4882a593Smuzhiyun * cfg80211_conn_failed - connection request failed notification
7231*4882a593Smuzhiyun *
7232*4882a593Smuzhiyun * @dev: the netdev
7233*4882a593Smuzhiyun * @mac_addr: the station's address
7234*4882a593Smuzhiyun * @reason: the reason for connection failure
7235*4882a593Smuzhiyun * @gfp: allocation flags
7236*4882a593Smuzhiyun *
7237*4882a593Smuzhiyun * Whenever a station tries to connect to an AP and if the station
7238*4882a593Smuzhiyun * could not connect to the AP as the AP has rejected the connection
7239*4882a593Smuzhiyun * for some reasons, this function is called.
7240*4882a593Smuzhiyun *
7241*4882a593Smuzhiyun * The reason for connection failure can be any of the value from
7242*4882a593Smuzhiyun * nl80211_connect_failed_reason enum
7243*4882a593Smuzhiyun */
7244*4882a593Smuzhiyun void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
7245*4882a593Smuzhiyun enum nl80211_connect_failed_reason reason,
7246*4882a593Smuzhiyun gfp_t gfp);
7247*4882a593Smuzhiyun
7248*4882a593Smuzhiyun /**
7249*4882a593Smuzhiyun * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
7250*4882a593Smuzhiyun * @wdev: wireless device receiving the frame
7251*4882a593Smuzhiyun * @freq: Frequency on which the frame was received in KHz
7252*4882a593Smuzhiyun * @sig_dbm: signal strength in dBm, or 0 if unknown
7253*4882a593Smuzhiyun * @buf: Management frame (header + body)
7254*4882a593Smuzhiyun * @len: length of the frame data
7255*4882a593Smuzhiyun * @flags: flags, as defined in enum nl80211_rxmgmt_flags
7256*4882a593Smuzhiyun *
7257*4882a593Smuzhiyun * This function is called whenever an Action frame is received for a station
7258*4882a593Smuzhiyun * mode interface, but is not processed in kernel.
7259*4882a593Smuzhiyun *
7260*4882a593Smuzhiyun * Return: %true if a user space application has registered for this frame.
7261*4882a593Smuzhiyun * For action frames, that makes it responsible for rejecting unrecognized
7262*4882a593Smuzhiyun * action frames; %false otherwise, in which case for action frames the
7263*4882a593Smuzhiyun * driver is responsible for rejecting the frame.
7264*4882a593Smuzhiyun */
7265*4882a593Smuzhiyun bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm,
7266*4882a593Smuzhiyun const u8 *buf, size_t len, u32 flags);
7267*4882a593Smuzhiyun
7268*4882a593Smuzhiyun /**
7269*4882a593Smuzhiyun * cfg80211_rx_mgmt - notification of received, unprocessed management frame
7270*4882a593Smuzhiyun * @wdev: wireless device receiving the frame
7271*4882a593Smuzhiyun * @freq: Frequency on which the frame was received in MHz
7272*4882a593Smuzhiyun * @sig_dbm: signal strength in dBm, or 0 if unknown
7273*4882a593Smuzhiyun * @buf: Management frame (header + body)
7274*4882a593Smuzhiyun * @len: length of the frame data
7275*4882a593Smuzhiyun * @flags: flags, as defined in enum nl80211_rxmgmt_flags
7276*4882a593Smuzhiyun *
7277*4882a593Smuzhiyun * This function is called whenever an Action frame is received for a station
7278*4882a593Smuzhiyun * mode interface, but is not processed in kernel.
7279*4882a593Smuzhiyun *
7280*4882a593Smuzhiyun * Return: %true if a user space application has registered for this frame.
7281*4882a593Smuzhiyun * For action frames, that makes it responsible for rejecting unrecognized
7282*4882a593Smuzhiyun * action frames; %false otherwise, in which case for action frames the
7283*4882a593Smuzhiyun * driver is responsible for rejecting the frame.
7284*4882a593Smuzhiyun */
cfg80211_rx_mgmt(struct wireless_dev * wdev,int freq,int sig_dbm,const u8 * buf,size_t len,u32 flags)7285*4882a593Smuzhiyun static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
7286*4882a593Smuzhiyun int sig_dbm, const u8 *buf, size_t len,
7287*4882a593Smuzhiyun u32 flags)
7288*4882a593Smuzhiyun {
7289*4882a593Smuzhiyun return cfg80211_rx_mgmt_khz(wdev, MHZ_TO_KHZ(freq), sig_dbm, buf, len,
7290*4882a593Smuzhiyun flags);
7291*4882a593Smuzhiyun }
7292*4882a593Smuzhiyun
7293*4882a593Smuzhiyun /**
7294*4882a593Smuzhiyun * cfg80211_mgmt_tx_status - notification of TX status for management frame
7295*4882a593Smuzhiyun * @wdev: wireless device receiving the frame
7296*4882a593Smuzhiyun * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
7297*4882a593Smuzhiyun * @buf: Management frame (header + body)
7298*4882a593Smuzhiyun * @len: length of the frame data
7299*4882a593Smuzhiyun * @ack: Whether frame was acknowledged
7300*4882a593Smuzhiyun * @gfp: context flags
7301*4882a593Smuzhiyun *
7302*4882a593Smuzhiyun * This function is called whenever a management frame was requested to be
7303*4882a593Smuzhiyun * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
7304*4882a593Smuzhiyun * transmission attempt.
7305*4882a593Smuzhiyun */
7306*4882a593Smuzhiyun void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
7307*4882a593Smuzhiyun const u8 *buf, size_t len, bool ack, gfp_t gfp);
7308*4882a593Smuzhiyun
7309*4882a593Smuzhiyun /**
7310*4882a593Smuzhiyun * cfg80211_control_port_tx_status - notification of TX status for control
7311*4882a593Smuzhiyun * port frames
7312*4882a593Smuzhiyun * @wdev: wireless device receiving the frame
7313*4882a593Smuzhiyun * @cookie: Cookie returned by cfg80211_ops::tx_control_port()
7314*4882a593Smuzhiyun * @buf: Data frame (header + body)
7315*4882a593Smuzhiyun * @len: length of the frame data
7316*4882a593Smuzhiyun * @ack: Whether frame was acknowledged
7317*4882a593Smuzhiyun * @gfp: context flags
7318*4882a593Smuzhiyun *
7319*4882a593Smuzhiyun * This function is called whenever a control port frame was requested to be
7320*4882a593Smuzhiyun * transmitted with cfg80211_ops::tx_control_port() to report the TX status of
7321*4882a593Smuzhiyun * the transmission attempt.
7322*4882a593Smuzhiyun */
7323*4882a593Smuzhiyun void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
7324*4882a593Smuzhiyun const u8 *buf, size_t len, bool ack,
7325*4882a593Smuzhiyun gfp_t gfp);
7326*4882a593Smuzhiyun
7327*4882a593Smuzhiyun /**
7328*4882a593Smuzhiyun * cfg80211_rx_control_port - notification about a received control port frame
7329*4882a593Smuzhiyun * @dev: The device the frame matched to
7330*4882a593Smuzhiyun * @skb: The skbuf with the control port frame. It is assumed that the skbuf
7331*4882a593Smuzhiyun * is 802.3 formatted (with 802.3 header). The skb can be non-linear.
7332*4882a593Smuzhiyun * This function does not take ownership of the skb, so the caller is
7333*4882a593Smuzhiyun * responsible for any cleanup. The caller must also ensure that
7334*4882a593Smuzhiyun * skb->protocol is set appropriately.
7335*4882a593Smuzhiyun * @unencrypted: Whether the frame was received unencrypted
7336*4882a593Smuzhiyun *
7337*4882a593Smuzhiyun * This function is used to inform userspace about a received control port
7338*4882a593Smuzhiyun * frame. It should only be used if userspace indicated it wants to receive
7339*4882a593Smuzhiyun * control port frames over nl80211.
7340*4882a593Smuzhiyun *
7341*4882a593Smuzhiyun * The frame is the data portion of the 802.3 or 802.11 data frame with all
7342*4882a593Smuzhiyun * network layer headers removed (e.g. the raw EAPoL frame).
7343*4882a593Smuzhiyun *
7344*4882a593Smuzhiyun * Return: %true if the frame was passed to userspace
7345*4882a593Smuzhiyun */
7346*4882a593Smuzhiyun bool cfg80211_rx_control_port(struct net_device *dev,
7347*4882a593Smuzhiyun struct sk_buff *skb, bool unencrypted);
7348*4882a593Smuzhiyun
7349*4882a593Smuzhiyun /**
7350*4882a593Smuzhiyun * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
7351*4882a593Smuzhiyun * @dev: network device
7352*4882a593Smuzhiyun * @rssi_event: the triggered RSSI event
7353*4882a593Smuzhiyun * @rssi_level: new RSSI level value or 0 if not available
7354*4882a593Smuzhiyun * @gfp: context flags
7355*4882a593Smuzhiyun *
7356*4882a593Smuzhiyun * This function is called when a configured connection quality monitoring
7357*4882a593Smuzhiyun * rssi threshold reached event occurs.
7358*4882a593Smuzhiyun */
7359*4882a593Smuzhiyun void cfg80211_cqm_rssi_notify(struct net_device *dev,
7360*4882a593Smuzhiyun enum nl80211_cqm_rssi_threshold_event rssi_event,
7361*4882a593Smuzhiyun s32 rssi_level, gfp_t gfp);
7362*4882a593Smuzhiyun
7363*4882a593Smuzhiyun /**
7364*4882a593Smuzhiyun * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
7365*4882a593Smuzhiyun * @dev: network device
7366*4882a593Smuzhiyun * @peer: peer's MAC address
7367*4882a593Smuzhiyun * @num_packets: how many packets were lost -- should be a fixed threshold
7368*4882a593Smuzhiyun * but probably no less than maybe 50, or maybe a throughput dependent
7369*4882a593Smuzhiyun * threshold (to account for temporary interference)
7370*4882a593Smuzhiyun * @gfp: context flags
7371*4882a593Smuzhiyun */
7372*4882a593Smuzhiyun void cfg80211_cqm_pktloss_notify(struct net_device *dev,
7373*4882a593Smuzhiyun const u8 *peer, u32 num_packets, gfp_t gfp);
7374*4882a593Smuzhiyun
7375*4882a593Smuzhiyun /**
7376*4882a593Smuzhiyun * cfg80211_cqm_txe_notify - TX error rate event
7377*4882a593Smuzhiyun * @dev: network device
7378*4882a593Smuzhiyun * @peer: peer's MAC address
7379*4882a593Smuzhiyun * @num_packets: how many packets were lost
7380*4882a593Smuzhiyun * @rate: % of packets which failed transmission
7381*4882a593Smuzhiyun * @intvl: interval (in s) over which the TX failure threshold was breached.
7382*4882a593Smuzhiyun * @gfp: context flags
7383*4882a593Smuzhiyun *
7384*4882a593Smuzhiyun * Notify userspace when configured % TX failures over number of packets in a
7385*4882a593Smuzhiyun * given interval is exceeded.
7386*4882a593Smuzhiyun */
7387*4882a593Smuzhiyun void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
7388*4882a593Smuzhiyun u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
7389*4882a593Smuzhiyun
7390*4882a593Smuzhiyun /**
7391*4882a593Smuzhiyun * cfg80211_cqm_beacon_loss_notify - beacon loss event
7392*4882a593Smuzhiyun * @dev: network device
7393*4882a593Smuzhiyun * @gfp: context flags
7394*4882a593Smuzhiyun *
7395*4882a593Smuzhiyun * Notify userspace about beacon loss from the connected AP.
7396*4882a593Smuzhiyun */
7397*4882a593Smuzhiyun void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
7398*4882a593Smuzhiyun
7399*4882a593Smuzhiyun /**
7400*4882a593Smuzhiyun * cfg80211_radar_event - radar detection event
7401*4882a593Smuzhiyun * @wiphy: the wiphy
7402*4882a593Smuzhiyun * @chandef: chandef for the current channel
7403*4882a593Smuzhiyun * @gfp: context flags
7404*4882a593Smuzhiyun *
7405*4882a593Smuzhiyun * This function is called when a radar is detected on the current chanenl.
7406*4882a593Smuzhiyun */
7407*4882a593Smuzhiyun void cfg80211_radar_event(struct wiphy *wiphy,
7408*4882a593Smuzhiyun struct cfg80211_chan_def *chandef, gfp_t gfp);
7409*4882a593Smuzhiyun
7410*4882a593Smuzhiyun /**
7411*4882a593Smuzhiyun * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
7412*4882a593Smuzhiyun * @dev: network device
7413*4882a593Smuzhiyun * @mac: MAC address of a station which opmode got modified
7414*4882a593Smuzhiyun * @sta_opmode: station's current opmode value
7415*4882a593Smuzhiyun * @gfp: context flags
7416*4882a593Smuzhiyun *
7417*4882a593Smuzhiyun * Driver should call this function when station's opmode modified via action
7418*4882a593Smuzhiyun * frame.
7419*4882a593Smuzhiyun */
7420*4882a593Smuzhiyun void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
7421*4882a593Smuzhiyun struct sta_opmode_info *sta_opmode,
7422*4882a593Smuzhiyun gfp_t gfp);
7423*4882a593Smuzhiyun
7424*4882a593Smuzhiyun /**
7425*4882a593Smuzhiyun * cfg80211_cac_event - Channel availability check (CAC) event
7426*4882a593Smuzhiyun * @netdev: network device
7427*4882a593Smuzhiyun * @chandef: chandef for the current channel
7428*4882a593Smuzhiyun * @event: type of event
7429*4882a593Smuzhiyun * @gfp: context flags
7430*4882a593Smuzhiyun *
7431*4882a593Smuzhiyun * This function is called when a Channel availability check (CAC) is finished
7432*4882a593Smuzhiyun * or aborted. This must be called to notify the completion of a CAC process,
7433*4882a593Smuzhiyun * also by full-MAC drivers.
7434*4882a593Smuzhiyun */
7435*4882a593Smuzhiyun void cfg80211_cac_event(struct net_device *netdev,
7436*4882a593Smuzhiyun const struct cfg80211_chan_def *chandef,
7437*4882a593Smuzhiyun enum nl80211_radar_event event, gfp_t gfp);
7438*4882a593Smuzhiyun
7439*4882a593Smuzhiyun
7440*4882a593Smuzhiyun /**
7441*4882a593Smuzhiyun * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
7442*4882a593Smuzhiyun * @dev: network device
7443*4882a593Smuzhiyun * @bssid: BSSID of AP (to avoid races)
7444*4882a593Smuzhiyun * @replay_ctr: new replay counter
7445*4882a593Smuzhiyun * @gfp: allocation flags
7446*4882a593Smuzhiyun */
7447*4882a593Smuzhiyun void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
7448*4882a593Smuzhiyun const u8 *replay_ctr, gfp_t gfp);
7449*4882a593Smuzhiyun
7450*4882a593Smuzhiyun /**
7451*4882a593Smuzhiyun * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
7452*4882a593Smuzhiyun * @dev: network device
7453*4882a593Smuzhiyun * @index: candidate index (the smaller the index, the higher the priority)
7454*4882a593Smuzhiyun * @bssid: BSSID of AP
7455*4882a593Smuzhiyun * @preauth: Whether AP advertises support for RSN pre-authentication
7456*4882a593Smuzhiyun * @gfp: allocation flags
7457*4882a593Smuzhiyun */
7458*4882a593Smuzhiyun void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
7459*4882a593Smuzhiyun const u8 *bssid, bool preauth, gfp_t gfp);
7460*4882a593Smuzhiyun
7461*4882a593Smuzhiyun /**
7462*4882a593Smuzhiyun * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
7463*4882a593Smuzhiyun * @dev: The device the frame matched to
7464*4882a593Smuzhiyun * @addr: the transmitter address
7465*4882a593Smuzhiyun * @gfp: context flags
7466*4882a593Smuzhiyun *
7467*4882a593Smuzhiyun * This function is used in AP mode (only!) to inform userspace that
7468*4882a593Smuzhiyun * a spurious class 3 frame was received, to be able to deauth the
7469*4882a593Smuzhiyun * sender.
7470*4882a593Smuzhiyun * Return: %true if the frame was passed to userspace (or this failed
7471*4882a593Smuzhiyun * for a reason other than not having a subscription.)
7472*4882a593Smuzhiyun */
7473*4882a593Smuzhiyun bool cfg80211_rx_spurious_frame(struct net_device *dev,
7474*4882a593Smuzhiyun const u8 *addr, gfp_t gfp);
7475*4882a593Smuzhiyun
7476*4882a593Smuzhiyun /**
7477*4882a593Smuzhiyun * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
7478*4882a593Smuzhiyun * @dev: The device the frame matched to
7479*4882a593Smuzhiyun * @addr: the transmitter address
7480*4882a593Smuzhiyun * @gfp: context flags
7481*4882a593Smuzhiyun *
7482*4882a593Smuzhiyun * This function is used in AP mode (only!) to inform userspace that
7483*4882a593Smuzhiyun * an associated station sent a 4addr frame but that wasn't expected.
7484*4882a593Smuzhiyun * It is allowed and desirable to send this event only once for each
7485*4882a593Smuzhiyun * station to avoid event flooding.
7486*4882a593Smuzhiyun * Return: %true if the frame was passed to userspace (or this failed
7487*4882a593Smuzhiyun * for a reason other than not having a subscription.)
7488*4882a593Smuzhiyun */
7489*4882a593Smuzhiyun bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
7490*4882a593Smuzhiyun const u8 *addr, gfp_t gfp);
7491*4882a593Smuzhiyun
7492*4882a593Smuzhiyun /**
7493*4882a593Smuzhiyun * cfg80211_probe_status - notify userspace about probe status
7494*4882a593Smuzhiyun * @dev: the device the probe was sent on
7495*4882a593Smuzhiyun * @addr: the address of the peer
7496*4882a593Smuzhiyun * @cookie: the cookie filled in @probe_client previously
7497*4882a593Smuzhiyun * @acked: indicates whether probe was acked or not
7498*4882a593Smuzhiyun * @ack_signal: signal strength (in dBm) of the ACK frame.
7499*4882a593Smuzhiyun * @is_valid_ack_signal: indicates the ack_signal is valid or not.
7500*4882a593Smuzhiyun * @gfp: allocation flags
7501*4882a593Smuzhiyun */
7502*4882a593Smuzhiyun void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
7503*4882a593Smuzhiyun u64 cookie, bool acked, s32 ack_signal,
7504*4882a593Smuzhiyun bool is_valid_ack_signal, gfp_t gfp);
7505*4882a593Smuzhiyun
7506*4882a593Smuzhiyun /**
7507*4882a593Smuzhiyun * cfg80211_report_obss_beacon_khz - report beacon from other APs
7508*4882a593Smuzhiyun * @wiphy: The wiphy that received the beacon
7509*4882a593Smuzhiyun * @frame: the frame
7510*4882a593Smuzhiyun * @len: length of the frame
7511*4882a593Smuzhiyun * @freq: frequency the frame was received on in KHz
7512*4882a593Smuzhiyun * @sig_dbm: signal strength in dBm, or 0 if unknown
7513*4882a593Smuzhiyun *
7514*4882a593Smuzhiyun * Use this function to report to userspace when a beacon was
7515*4882a593Smuzhiyun * received. It is not useful to call this when there is no
7516*4882a593Smuzhiyun * netdev that is in AP/GO mode.
7517*4882a593Smuzhiyun */
7518*4882a593Smuzhiyun void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
7519*4882a593Smuzhiyun size_t len, int freq, int sig_dbm);
7520*4882a593Smuzhiyun
7521*4882a593Smuzhiyun /**
7522*4882a593Smuzhiyun * cfg80211_report_obss_beacon - report beacon from other APs
7523*4882a593Smuzhiyun * @wiphy: The wiphy that received the beacon
7524*4882a593Smuzhiyun * @frame: the frame
7525*4882a593Smuzhiyun * @len: length of the frame
7526*4882a593Smuzhiyun * @freq: frequency the frame was received on
7527*4882a593Smuzhiyun * @sig_dbm: signal strength in dBm, or 0 if unknown
7528*4882a593Smuzhiyun *
7529*4882a593Smuzhiyun * Use this function to report to userspace when a beacon was
7530*4882a593Smuzhiyun * received. It is not useful to call this when there is no
7531*4882a593Smuzhiyun * netdev that is in AP/GO mode.
7532*4882a593Smuzhiyun */
cfg80211_report_obss_beacon(struct wiphy * wiphy,const u8 * frame,size_t len,int freq,int sig_dbm)7533*4882a593Smuzhiyun static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
7534*4882a593Smuzhiyun const u8 *frame, size_t len,
7535*4882a593Smuzhiyun int freq, int sig_dbm)
7536*4882a593Smuzhiyun {
7537*4882a593Smuzhiyun cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
7538*4882a593Smuzhiyun sig_dbm);
7539*4882a593Smuzhiyun }
7540*4882a593Smuzhiyun
7541*4882a593Smuzhiyun /**
7542*4882a593Smuzhiyun * cfg80211_reg_can_beacon - check if beaconing is allowed
7543*4882a593Smuzhiyun * @wiphy: the wiphy
7544*4882a593Smuzhiyun * @chandef: the channel definition
7545*4882a593Smuzhiyun * @iftype: interface type
7546*4882a593Smuzhiyun *
7547*4882a593Smuzhiyun * Return: %true if there is no secondary channel or the secondary channel(s)
7548*4882a593Smuzhiyun * can be used for beaconing (i.e. is not a radar channel etc.)
7549*4882a593Smuzhiyun */
7550*4882a593Smuzhiyun bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
7551*4882a593Smuzhiyun struct cfg80211_chan_def *chandef,
7552*4882a593Smuzhiyun enum nl80211_iftype iftype);
7553*4882a593Smuzhiyun
7554*4882a593Smuzhiyun /**
7555*4882a593Smuzhiyun * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
7556*4882a593Smuzhiyun * @wiphy: the wiphy
7557*4882a593Smuzhiyun * @chandef: the channel definition
7558*4882a593Smuzhiyun * @iftype: interface type
7559*4882a593Smuzhiyun *
7560*4882a593Smuzhiyun * Return: %true if there is no secondary channel or the secondary channel(s)
7561*4882a593Smuzhiyun * can be used for beaconing (i.e. is not a radar channel etc.). This version
7562*4882a593Smuzhiyun * also checks if IR-relaxation conditions apply, to allow beaconing under
7563*4882a593Smuzhiyun * more permissive conditions.
7564*4882a593Smuzhiyun *
7565*4882a593Smuzhiyun * Requires the RTNL to be held.
7566*4882a593Smuzhiyun */
7567*4882a593Smuzhiyun bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
7568*4882a593Smuzhiyun struct cfg80211_chan_def *chandef,
7569*4882a593Smuzhiyun enum nl80211_iftype iftype);
7570*4882a593Smuzhiyun
7571*4882a593Smuzhiyun /*
7572*4882a593Smuzhiyun * cfg80211_ch_switch_notify - update wdev channel and notify userspace
7573*4882a593Smuzhiyun * @dev: the device which switched channels
7574*4882a593Smuzhiyun * @chandef: the new channel definition
7575*4882a593Smuzhiyun *
7576*4882a593Smuzhiyun * Caller must acquire wdev_lock, therefore must only be called from sleepable
7577*4882a593Smuzhiyun * driver context!
7578*4882a593Smuzhiyun */
7579*4882a593Smuzhiyun void cfg80211_ch_switch_notify(struct net_device *dev,
7580*4882a593Smuzhiyun struct cfg80211_chan_def *chandef);
7581*4882a593Smuzhiyun
7582*4882a593Smuzhiyun /*
7583*4882a593Smuzhiyun * cfg80211_ch_switch_started_notify - notify channel switch start
7584*4882a593Smuzhiyun * @dev: the device on which the channel switch started
7585*4882a593Smuzhiyun * @chandef: the future channel definition
7586*4882a593Smuzhiyun * @count: the number of TBTTs until the channel switch happens
7587*4882a593Smuzhiyun *
7588*4882a593Smuzhiyun * Inform the userspace about the channel switch that has just
7589*4882a593Smuzhiyun * started, so that it can take appropriate actions (eg. starting
7590*4882a593Smuzhiyun * channel switch on other vifs), if necessary.
7591*4882a593Smuzhiyun */
7592*4882a593Smuzhiyun void cfg80211_ch_switch_started_notify(struct net_device *dev,
7593*4882a593Smuzhiyun struct cfg80211_chan_def *chandef,
7594*4882a593Smuzhiyun u8 count);
7595*4882a593Smuzhiyun
7596*4882a593Smuzhiyun /**
7597*4882a593Smuzhiyun * ieee80211_operating_class_to_band - convert operating class to band
7598*4882a593Smuzhiyun *
7599*4882a593Smuzhiyun * @operating_class: the operating class to convert
7600*4882a593Smuzhiyun * @band: band pointer to fill
7601*4882a593Smuzhiyun *
7602*4882a593Smuzhiyun * Returns %true if the conversion was successful, %false otherwise.
7603*4882a593Smuzhiyun */
7604*4882a593Smuzhiyun bool ieee80211_operating_class_to_band(u8 operating_class,
7605*4882a593Smuzhiyun enum nl80211_band *band);
7606*4882a593Smuzhiyun
7607*4882a593Smuzhiyun /**
7608*4882a593Smuzhiyun * ieee80211_chandef_to_operating_class - convert chandef to operation class
7609*4882a593Smuzhiyun *
7610*4882a593Smuzhiyun * @chandef: the chandef to convert
7611*4882a593Smuzhiyun * @op_class: a pointer to the resulting operating class
7612*4882a593Smuzhiyun *
7613*4882a593Smuzhiyun * Returns %true if the conversion was successful, %false otherwise.
7614*4882a593Smuzhiyun */
7615*4882a593Smuzhiyun bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
7616*4882a593Smuzhiyun u8 *op_class);
7617*4882a593Smuzhiyun
7618*4882a593Smuzhiyun /**
7619*4882a593Smuzhiyun * ieee80211_chandef_to_khz - convert chandef to frequency in KHz
7620*4882a593Smuzhiyun *
7621*4882a593Smuzhiyun * @chandef: the chandef to convert
7622*4882a593Smuzhiyun *
7623*4882a593Smuzhiyun * Returns the center frequency of chandef (1st segment) in KHz.
7624*4882a593Smuzhiyun */
7625*4882a593Smuzhiyun static inline u32
ieee80211_chandef_to_khz(const struct cfg80211_chan_def * chandef)7626*4882a593Smuzhiyun ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)
7627*4882a593Smuzhiyun {
7628*4882a593Smuzhiyun return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;
7629*4882a593Smuzhiyun }
7630*4882a593Smuzhiyun
7631*4882a593Smuzhiyun /*
7632*4882a593Smuzhiyun * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
7633*4882a593Smuzhiyun * @dev: the device on which the operation is requested
7634*4882a593Smuzhiyun * @peer: the MAC address of the peer device
7635*4882a593Smuzhiyun * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
7636*4882a593Smuzhiyun * NL80211_TDLS_TEARDOWN)
7637*4882a593Smuzhiyun * @reason_code: the reason code for teardown request
7638*4882a593Smuzhiyun * @gfp: allocation flags
7639*4882a593Smuzhiyun *
7640*4882a593Smuzhiyun * This function is used to request userspace to perform TDLS operation that
7641*4882a593Smuzhiyun * requires knowledge of keys, i.e., link setup or teardown when the AP
7642*4882a593Smuzhiyun * connection uses encryption. This is optional mechanism for the driver to use
7643*4882a593Smuzhiyun * if it can automatically determine when a TDLS link could be useful (e.g.,
7644*4882a593Smuzhiyun * based on traffic and signal strength for a peer).
7645*4882a593Smuzhiyun */
7646*4882a593Smuzhiyun void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
7647*4882a593Smuzhiyun enum nl80211_tdls_operation oper,
7648*4882a593Smuzhiyun u16 reason_code, gfp_t gfp);
7649*4882a593Smuzhiyun
7650*4882a593Smuzhiyun /*
7651*4882a593Smuzhiyun * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
7652*4882a593Smuzhiyun * @rate: given rate_info to calculate bitrate from
7653*4882a593Smuzhiyun *
7654*4882a593Smuzhiyun * return 0 if MCS index >= 32
7655*4882a593Smuzhiyun */
7656*4882a593Smuzhiyun u32 cfg80211_calculate_bitrate(struct rate_info *rate);
7657*4882a593Smuzhiyun
7658*4882a593Smuzhiyun /**
7659*4882a593Smuzhiyun * cfg80211_unregister_wdev - remove the given wdev
7660*4882a593Smuzhiyun * @wdev: struct wireless_dev to remove
7661*4882a593Smuzhiyun *
7662*4882a593Smuzhiyun * Call this function only for wdevs that have no netdev assigned,
7663*4882a593Smuzhiyun * e.g. P2P Devices. It removes the device from the list so that
7664*4882a593Smuzhiyun * it can no longer be used. It is necessary to call this function
7665*4882a593Smuzhiyun * even when cfg80211 requests the removal of the interface by
7666*4882a593Smuzhiyun * calling the del_virtual_intf() callback. The function must also
7667*4882a593Smuzhiyun * be called when the driver wishes to unregister the wdev, e.g.
7668*4882a593Smuzhiyun * when the device is unbound from the driver.
7669*4882a593Smuzhiyun *
7670*4882a593Smuzhiyun * Requires the RTNL to be held.
7671*4882a593Smuzhiyun */
7672*4882a593Smuzhiyun void cfg80211_unregister_wdev(struct wireless_dev *wdev);
7673*4882a593Smuzhiyun
7674*4882a593Smuzhiyun /**
7675*4882a593Smuzhiyun * struct cfg80211_ft_event_params - FT Information Elements
7676*4882a593Smuzhiyun * @ies: FT IEs
7677*4882a593Smuzhiyun * @ies_len: length of the FT IE in bytes
7678*4882a593Smuzhiyun * @target_ap: target AP's MAC address
7679*4882a593Smuzhiyun * @ric_ies: RIC IE
7680*4882a593Smuzhiyun * @ric_ies_len: length of the RIC IE in bytes
7681*4882a593Smuzhiyun */
7682*4882a593Smuzhiyun struct cfg80211_ft_event_params {
7683*4882a593Smuzhiyun const u8 *ies;
7684*4882a593Smuzhiyun size_t ies_len;
7685*4882a593Smuzhiyun const u8 *target_ap;
7686*4882a593Smuzhiyun const u8 *ric_ies;
7687*4882a593Smuzhiyun size_t ric_ies_len;
7688*4882a593Smuzhiyun };
7689*4882a593Smuzhiyun
7690*4882a593Smuzhiyun /**
7691*4882a593Smuzhiyun * cfg80211_ft_event - notify userspace about FT IE and RIC IE
7692*4882a593Smuzhiyun * @netdev: network device
7693*4882a593Smuzhiyun * @ft_event: IE information
7694*4882a593Smuzhiyun */
7695*4882a593Smuzhiyun void cfg80211_ft_event(struct net_device *netdev,
7696*4882a593Smuzhiyun struct cfg80211_ft_event_params *ft_event);
7697*4882a593Smuzhiyun
7698*4882a593Smuzhiyun /**
7699*4882a593Smuzhiyun * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
7700*4882a593Smuzhiyun * @ies: the input IE buffer
7701*4882a593Smuzhiyun * @len: the input length
7702*4882a593Smuzhiyun * @attr: the attribute ID to find
7703*4882a593Smuzhiyun * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
7704*4882a593Smuzhiyun * if the function is only called to get the needed buffer size
7705*4882a593Smuzhiyun * @bufsize: size of the output buffer
7706*4882a593Smuzhiyun *
7707*4882a593Smuzhiyun * The function finds a given P2P attribute in the (vendor) IEs and
7708*4882a593Smuzhiyun * copies its contents to the given buffer.
7709*4882a593Smuzhiyun *
7710*4882a593Smuzhiyun * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
7711*4882a593Smuzhiyun * malformed or the attribute can't be found (respectively), or the
7712*4882a593Smuzhiyun * length of the found attribute (which can be zero).
7713*4882a593Smuzhiyun */
7714*4882a593Smuzhiyun int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
7715*4882a593Smuzhiyun enum ieee80211_p2p_attr_id attr,
7716*4882a593Smuzhiyun u8 *buf, unsigned int bufsize);
7717*4882a593Smuzhiyun
7718*4882a593Smuzhiyun /**
7719*4882a593Smuzhiyun * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
7720*4882a593Smuzhiyun * @ies: the IE buffer
7721*4882a593Smuzhiyun * @ielen: the length of the IE buffer
7722*4882a593Smuzhiyun * @ids: an array with element IDs that are allowed before
7723*4882a593Smuzhiyun * the split. A WLAN_EID_EXTENSION value means that the next
7724*4882a593Smuzhiyun * EID in the list is a sub-element of the EXTENSION IE.
7725*4882a593Smuzhiyun * @n_ids: the size of the element ID array
7726*4882a593Smuzhiyun * @after_ric: array IE types that come after the RIC element
7727*4882a593Smuzhiyun * @n_after_ric: size of the @after_ric array
7728*4882a593Smuzhiyun * @offset: offset where to start splitting in the buffer
7729*4882a593Smuzhiyun *
7730*4882a593Smuzhiyun * This function splits an IE buffer by updating the @offset
7731*4882a593Smuzhiyun * variable to point to the location where the buffer should be
7732*4882a593Smuzhiyun * split.
7733*4882a593Smuzhiyun *
7734*4882a593Smuzhiyun * It assumes that the given IE buffer is well-formed, this
7735*4882a593Smuzhiyun * has to be guaranteed by the caller!
7736*4882a593Smuzhiyun *
7737*4882a593Smuzhiyun * It also assumes that the IEs in the buffer are ordered
7738*4882a593Smuzhiyun * correctly, if not the result of using this function will not
7739*4882a593Smuzhiyun * be ordered correctly either, i.e. it does no reordering.
7740*4882a593Smuzhiyun *
7741*4882a593Smuzhiyun * The function returns the offset where the next part of the
7742*4882a593Smuzhiyun * buffer starts, which may be @ielen if the entire (remainder)
7743*4882a593Smuzhiyun * of the buffer should be used.
7744*4882a593Smuzhiyun */
7745*4882a593Smuzhiyun size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
7746*4882a593Smuzhiyun const u8 *ids, int n_ids,
7747*4882a593Smuzhiyun const u8 *after_ric, int n_after_ric,
7748*4882a593Smuzhiyun size_t offset);
7749*4882a593Smuzhiyun
7750*4882a593Smuzhiyun /**
7751*4882a593Smuzhiyun * ieee80211_ie_split - split an IE buffer according to ordering
7752*4882a593Smuzhiyun * @ies: the IE buffer
7753*4882a593Smuzhiyun * @ielen: the length of the IE buffer
7754*4882a593Smuzhiyun * @ids: an array with element IDs that are allowed before
7755*4882a593Smuzhiyun * the split. A WLAN_EID_EXTENSION value means that the next
7756*4882a593Smuzhiyun * EID in the list is a sub-element of the EXTENSION IE.
7757*4882a593Smuzhiyun * @n_ids: the size of the element ID array
7758*4882a593Smuzhiyun * @offset: offset where to start splitting in the buffer
7759*4882a593Smuzhiyun *
7760*4882a593Smuzhiyun * This function splits an IE buffer by updating the @offset
7761*4882a593Smuzhiyun * variable to point to the location where the buffer should be
7762*4882a593Smuzhiyun * split.
7763*4882a593Smuzhiyun *
7764*4882a593Smuzhiyun * It assumes that the given IE buffer is well-formed, this
7765*4882a593Smuzhiyun * has to be guaranteed by the caller!
7766*4882a593Smuzhiyun *
7767*4882a593Smuzhiyun * It also assumes that the IEs in the buffer are ordered
7768*4882a593Smuzhiyun * correctly, if not the result of using this function will not
7769*4882a593Smuzhiyun * be ordered correctly either, i.e. it does no reordering.
7770*4882a593Smuzhiyun *
7771*4882a593Smuzhiyun * The function returns the offset where the next part of the
7772*4882a593Smuzhiyun * buffer starts, which may be @ielen if the entire (remainder)
7773*4882a593Smuzhiyun * of the buffer should be used.
7774*4882a593Smuzhiyun */
ieee80211_ie_split(const u8 * ies,size_t ielen,const u8 * ids,int n_ids,size_t offset)7775*4882a593Smuzhiyun static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
7776*4882a593Smuzhiyun const u8 *ids, int n_ids, size_t offset)
7777*4882a593Smuzhiyun {
7778*4882a593Smuzhiyun return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
7779*4882a593Smuzhiyun }
7780*4882a593Smuzhiyun
7781*4882a593Smuzhiyun /**
7782*4882a593Smuzhiyun * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
7783*4882a593Smuzhiyun * @wdev: the wireless device reporting the wakeup
7784*4882a593Smuzhiyun * @wakeup: the wakeup report
7785*4882a593Smuzhiyun * @gfp: allocation flags
7786*4882a593Smuzhiyun *
7787*4882a593Smuzhiyun * This function reports that the given device woke up. If it
7788*4882a593Smuzhiyun * caused the wakeup, report the reason(s), otherwise you may
7789*4882a593Smuzhiyun * pass %NULL as the @wakeup parameter to advertise that something
7790*4882a593Smuzhiyun * else caused the wakeup.
7791*4882a593Smuzhiyun */
7792*4882a593Smuzhiyun void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
7793*4882a593Smuzhiyun struct cfg80211_wowlan_wakeup *wakeup,
7794*4882a593Smuzhiyun gfp_t gfp);
7795*4882a593Smuzhiyun
7796*4882a593Smuzhiyun /**
7797*4882a593Smuzhiyun * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
7798*4882a593Smuzhiyun *
7799*4882a593Smuzhiyun * @wdev: the wireless device for which critical protocol is stopped.
7800*4882a593Smuzhiyun * @gfp: allocation flags
7801*4882a593Smuzhiyun *
7802*4882a593Smuzhiyun * This function can be called by the driver to indicate it has reverted
7803*4882a593Smuzhiyun * operation back to normal. One reason could be that the duration given
7804*4882a593Smuzhiyun * by .crit_proto_start() has expired.
7805*4882a593Smuzhiyun */
7806*4882a593Smuzhiyun void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
7807*4882a593Smuzhiyun
7808*4882a593Smuzhiyun /**
7809*4882a593Smuzhiyun * ieee80211_get_num_supported_channels - get number of channels device has
7810*4882a593Smuzhiyun * @wiphy: the wiphy
7811*4882a593Smuzhiyun *
7812*4882a593Smuzhiyun * Return: the number of channels supported by the device.
7813*4882a593Smuzhiyun */
7814*4882a593Smuzhiyun unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
7815*4882a593Smuzhiyun
7816*4882a593Smuzhiyun /**
7817*4882a593Smuzhiyun * cfg80211_check_combinations - check interface combinations
7818*4882a593Smuzhiyun *
7819*4882a593Smuzhiyun * @wiphy: the wiphy
7820*4882a593Smuzhiyun * @params: the interface combinations parameter
7821*4882a593Smuzhiyun *
7822*4882a593Smuzhiyun * This function can be called by the driver to check whether a
7823*4882a593Smuzhiyun * combination of interfaces and their types are allowed according to
7824*4882a593Smuzhiyun * the interface combinations.
7825*4882a593Smuzhiyun */
7826*4882a593Smuzhiyun int cfg80211_check_combinations(struct wiphy *wiphy,
7827*4882a593Smuzhiyun struct iface_combination_params *params);
7828*4882a593Smuzhiyun
7829*4882a593Smuzhiyun /**
7830*4882a593Smuzhiyun * cfg80211_iter_combinations - iterate over matching combinations
7831*4882a593Smuzhiyun *
7832*4882a593Smuzhiyun * @wiphy: the wiphy
7833*4882a593Smuzhiyun * @params: the interface combinations parameter
7834*4882a593Smuzhiyun * @iter: function to call for each matching combination
7835*4882a593Smuzhiyun * @data: pointer to pass to iter function
7836*4882a593Smuzhiyun *
7837*4882a593Smuzhiyun * This function can be called by the driver to check what possible
7838*4882a593Smuzhiyun * combinations it fits in at a given moment, e.g. for channel switching
7839*4882a593Smuzhiyun * purposes.
7840*4882a593Smuzhiyun */
7841*4882a593Smuzhiyun int cfg80211_iter_combinations(struct wiphy *wiphy,
7842*4882a593Smuzhiyun struct iface_combination_params *params,
7843*4882a593Smuzhiyun void (*iter)(const struct ieee80211_iface_combination *c,
7844*4882a593Smuzhiyun void *data),
7845*4882a593Smuzhiyun void *data);
7846*4882a593Smuzhiyun
7847*4882a593Smuzhiyun /*
7848*4882a593Smuzhiyun * cfg80211_stop_iface - trigger interface disconnection
7849*4882a593Smuzhiyun *
7850*4882a593Smuzhiyun * @wiphy: the wiphy
7851*4882a593Smuzhiyun * @wdev: wireless device
7852*4882a593Smuzhiyun * @gfp: context flags
7853*4882a593Smuzhiyun *
7854*4882a593Smuzhiyun * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
7855*4882a593Smuzhiyun * disconnected.
7856*4882a593Smuzhiyun *
7857*4882a593Smuzhiyun * Note: This doesn't need any locks and is asynchronous.
7858*4882a593Smuzhiyun */
7859*4882a593Smuzhiyun void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
7860*4882a593Smuzhiyun gfp_t gfp);
7861*4882a593Smuzhiyun
7862*4882a593Smuzhiyun /**
7863*4882a593Smuzhiyun * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
7864*4882a593Smuzhiyun * @wiphy: the wiphy to shut down
7865*4882a593Smuzhiyun *
7866*4882a593Smuzhiyun * This function shuts down all interfaces belonging to this wiphy by
7867*4882a593Smuzhiyun * calling dev_close() (and treating non-netdev interfaces as needed).
7868*4882a593Smuzhiyun * It shouldn't really be used unless there are some fatal device errors
7869*4882a593Smuzhiyun * that really can't be recovered in any other way.
7870*4882a593Smuzhiyun *
7871*4882a593Smuzhiyun * Callers must hold the RTNL and be able to deal with callbacks into
7872*4882a593Smuzhiyun * the driver while the function is running.
7873*4882a593Smuzhiyun */
7874*4882a593Smuzhiyun void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
7875*4882a593Smuzhiyun
7876*4882a593Smuzhiyun /**
7877*4882a593Smuzhiyun * wiphy_ext_feature_set - set the extended feature flag
7878*4882a593Smuzhiyun *
7879*4882a593Smuzhiyun * @wiphy: the wiphy to modify.
7880*4882a593Smuzhiyun * @ftidx: extended feature bit index.
7881*4882a593Smuzhiyun *
7882*4882a593Smuzhiyun * The extended features are flagged in multiple bytes (see
7883*4882a593Smuzhiyun * &struct wiphy.@ext_features)
7884*4882a593Smuzhiyun */
wiphy_ext_feature_set(struct wiphy * wiphy,enum nl80211_ext_feature_index ftidx)7885*4882a593Smuzhiyun static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
7886*4882a593Smuzhiyun enum nl80211_ext_feature_index ftidx)
7887*4882a593Smuzhiyun {
7888*4882a593Smuzhiyun u8 *ft_byte;
7889*4882a593Smuzhiyun
7890*4882a593Smuzhiyun ft_byte = &wiphy->ext_features[ftidx / 8];
7891*4882a593Smuzhiyun *ft_byte |= BIT(ftidx % 8);
7892*4882a593Smuzhiyun }
7893*4882a593Smuzhiyun
7894*4882a593Smuzhiyun /**
7895*4882a593Smuzhiyun * wiphy_ext_feature_isset - check the extended feature flag
7896*4882a593Smuzhiyun *
7897*4882a593Smuzhiyun * @wiphy: the wiphy to modify.
7898*4882a593Smuzhiyun * @ftidx: extended feature bit index.
7899*4882a593Smuzhiyun *
7900*4882a593Smuzhiyun * The extended features are flagged in multiple bytes (see
7901*4882a593Smuzhiyun * &struct wiphy.@ext_features)
7902*4882a593Smuzhiyun */
7903*4882a593Smuzhiyun static inline bool
wiphy_ext_feature_isset(struct wiphy * wiphy,enum nl80211_ext_feature_index ftidx)7904*4882a593Smuzhiyun wiphy_ext_feature_isset(struct wiphy *wiphy,
7905*4882a593Smuzhiyun enum nl80211_ext_feature_index ftidx)
7906*4882a593Smuzhiyun {
7907*4882a593Smuzhiyun u8 ft_byte;
7908*4882a593Smuzhiyun
7909*4882a593Smuzhiyun ft_byte = wiphy->ext_features[ftidx / 8];
7910*4882a593Smuzhiyun return (ft_byte & BIT(ftidx % 8)) != 0;
7911*4882a593Smuzhiyun }
7912*4882a593Smuzhiyun
7913*4882a593Smuzhiyun /**
7914*4882a593Smuzhiyun * cfg80211_free_nan_func - free NAN function
7915*4882a593Smuzhiyun * @f: NAN function that should be freed
7916*4882a593Smuzhiyun *
7917*4882a593Smuzhiyun * Frees all the NAN function and all it's allocated members.
7918*4882a593Smuzhiyun */
7919*4882a593Smuzhiyun void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
7920*4882a593Smuzhiyun
7921*4882a593Smuzhiyun /**
7922*4882a593Smuzhiyun * struct cfg80211_nan_match_params - NAN match parameters
7923*4882a593Smuzhiyun * @type: the type of the function that triggered a match. If it is
7924*4882a593Smuzhiyun * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
7925*4882a593Smuzhiyun * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
7926*4882a593Smuzhiyun * result.
7927*4882a593Smuzhiyun * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
7928*4882a593Smuzhiyun * @inst_id: the local instance id
7929*4882a593Smuzhiyun * @peer_inst_id: the instance id of the peer's function
7930*4882a593Smuzhiyun * @addr: the MAC address of the peer
7931*4882a593Smuzhiyun * @info_len: the length of the &info
7932*4882a593Smuzhiyun * @info: the Service Specific Info from the peer (if any)
7933*4882a593Smuzhiyun * @cookie: unique identifier of the corresponding function
7934*4882a593Smuzhiyun */
7935*4882a593Smuzhiyun struct cfg80211_nan_match_params {
7936*4882a593Smuzhiyun enum nl80211_nan_function_type type;
7937*4882a593Smuzhiyun u8 inst_id;
7938*4882a593Smuzhiyun u8 peer_inst_id;
7939*4882a593Smuzhiyun const u8 *addr;
7940*4882a593Smuzhiyun u8 info_len;
7941*4882a593Smuzhiyun const u8 *info;
7942*4882a593Smuzhiyun u64 cookie;
7943*4882a593Smuzhiyun };
7944*4882a593Smuzhiyun
7945*4882a593Smuzhiyun /**
7946*4882a593Smuzhiyun * cfg80211_nan_match - report a match for a NAN function.
7947*4882a593Smuzhiyun * @wdev: the wireless device reporting the match
7948*4882a593Smuzhiyun * @match: match notification parameters
7949*4882a593Smuzhiyun * @gfp: allocation flags
7950*4882a593Smuzhiyun *
7951*4882a593Smuzhiyun * This function reports that the a NAN function had a match. This
7952*4882a593Smuzhiyun * can be a subscribe that had a match or a solicited publish that
7953*4882a593Smuzhiyun * was sent. It can also be a follow up that was received.
7954*4882a593Smuzhiyun */
7955*4882a593Smuzhiyun void cfg80211_nan_match(struct wireless_dev *wdev,
7956*4882a593Smuzhiyun struct cfg80211_nan_match_params *match, gfp_t gfp);
7957*4882a593Smuzhiyun
7958*4882a593Smuzhiyun /**
7959*4882a593Smuzhiyun * cfg80211_nan_func_terminated - notify about NAN function termination.
7960*4882a593Smuzhiyun *
7961*4882a593Smuzhiyun * @wdev: the wireless device reporting the match
7962*4882a593Smuzhiyun * @inst_id: the local instance id
7963*4882a593Smuzhiyun * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
7964*4882a593Smuzhiyun * @cookie: unique NAN function identifier
7965*4882a593Smuzhiyun * @gfp: allocation flags
7966*4882a593Smuzhiyun *
7967*4882a593Smuzhiyun * This function reports that the a NAN function is terminated.
7968*4882a593Smuzhiyun */
7969*4882a593Smuzhiyun void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
7970*4882a593Smuzhiyun u8 inst_id,
7971*4882a593Smuzhiyun enum nl80211_nan_func_term_reason reason,
7972*4882a593Smuzhiyun u64 cookie, gfp_t gfp);
7973*4882a593Smuzhiyun
7974*4882a593Smuzhiyun /* ethtool helper */
7975*4882a593Smuzhiyun void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
7976*4882a593Smuzhiyun
7977*4882a593Smuzhiyun /**
7978*4882a593Smuzhiyun * cfg80211_external_auth_request - userspace request for authentication
7979*4882a593Smuzhiyun * @netdev: network device
7980*4882a593Smuzhiyun * @params: External authentication parameters
7981*4882a593Smuzhiyun * @gfp: allocation flags
7982*4882a593Smuzhiyun * Returns: 0 on success, < 0 on error
7983*4882a593Smuzhiyun */
7984*4882a593Smuzhiyun int cfg80211_external_auth_request(struct net_device *netdev,
7985*4882a593Smuzhiyun struct cfg80211_external_auth_params *params,
7986*4882a593Smuzhiyun gfp_t gfp);
7987*4882a593Smuzhiyun
7988*4882a593Smuzhiyun /**
7989*4882a593Smuzhiyun * cfg80211_pmsr_report - report peer measurement result data
7990*4882a593Smuzhiyun * @wdev: the wireless device reporting the measurement
7991*4882a593Smuzhiyun * @req: the original measurement request
7992*4882a593Smuzhiyun * @result: the result data
7993*4882a593Smuzhiyun * @gfp: allocation flags
7994*4882a593Smuzhiyun */
7995*4882a593Smuzhiyun void cfg80211_pmsr_report(struct wireless_dev *wdev,
7996*4882a593Smuzhiyun struct cfg80211_pmsr_request *req,
7997*4882a593Smuzhiyun struct cfg80211_pmsr_result *result,
7998*4882a593Smuzhiyun gfp_t gfp);
7999*4882a593Smuzhiyun
8000*4882a593Smuzhiyun /**
8001*4882a593Smuzhiyun * cfg80211_pmsr_complete - report peer measurement completed
8002*4882a593Smuzhiyun * @wdev: the wireless device reporting the measurement
8003*4882a593Smuzhiyun * @req: the original measurement request
8004*4882a593Smuzhiyun * @gfp: allocation flags
8005*4882a593Smuzhiyun *
8006*4882a593Smuzhiyun * Report that the entire measurement completed, after this
8007*4882a593Smuzhiyun * the request pointer will no longer be valid.
8008*4882a593Smuzhiyun */
8009*4882a593Smuzhiyun void cfg80211_pmsr_complete(struct wireless_dev *wdev,
8010*4882a593Smuzhiyun struct cfg80211_pmsr_request *req,
8011*4882a593Smuzhiyun gfp_t gfp);
8012*4882a593Smuzhiyun
8013*4882a593Smuzhiyun /**
8014*4882a593Smuzhiyun * cfg80211_iftype_allowed - check whether the interface can be allowed
8015*4882a593Smuzhiyun * @wiphy: the wiphy
8016*4882a593Smuzhiyun * @iftype: interface type
8017*4882a593Smuzhiyun * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
8018*4882a593Smuzhiyun * @check_swif: check iftype against software interfaces
8019*4882a593Smuzhiyun *
8020*4882a593Smuzhiyun * Check whether the interface is allowed to operate; additionally, this API
8021*4882a593Smuzhiyun * can be used to check iftype against the software interfaces when
8022*4882a593Smuzhiyun * check_swif is '1'.
8023*4882a593Smuzhiyun */
8024*4882a593Smuzhiyun bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
8025*4882a593Smuzhiyun bool is_4addr, u8 check_swif);
8026*4882a593Smuzhiyun
8027*4882a593Smuzhiyun
8028*4882a593Smuzhiyun /* Logging, debugging and troubleshooting/diagnostic helpers. */
8029*4882a593Smuzhiyun
8030*4882a593Smuzhiyun /* wiphy_printk helpers, similar to dev_printk */
8031*4882a593Smuzhiyun
8032*4882a593Smuzhiyun #define wiphy_printk(level, wiphy, format, args...) \
8033*4882a593Smuzhiyun dev_printk(level, &(wiphy)->dev, format, ##args)
8034*4882a593Smuzhiyun #define wiphy_emerg(wiphy, format, args...) \
8035*4882a593Smuzhiyun dev_emerg(&(wiphy)->dev, format, ##args)
8036*4882a593Smuzhiyun #define wiphy_alert(wiphy, format, args...) \
8037*4882a593Smuzhiyun dev_alert(&(wiphy)->dev, format, ##args)
8038*4882a593Smuzhiyun #define wiphy_crit(wiphy, format, args...) \
8039*4882a593Smuzhiyun dev_crit(&(wiphy)->dev, format, ##args)
8040*4882a593Smuzhiyun #define wiphy_err(wiphy, format, args...) \
8041*4882a593Smuzhiyun dev_err(&(wiphy)->dev, format, ##args)
8042*4882a593Smuzhiyun #define wiphy_warn(wiphy, format, args...) \
8043*4882a593Smuzhiyun dev_warn(&(wiphy)->dev, format, ##args)
8044*4882a593Smuzhiyun #define wiphy_notice(wiphy, format, args...) \
8045*4882a593Smuzhiyun dev_notice(&(wiphy)->dev, format, ##args)
8046*4882a593Smuzhiyun #define wiphy_info(wiphy, format, args...) \
8047*4882a593Smuzhiyun dev_info(&(wiphy)->dev, format, ##args)
8048*4882a593Smuzhiyun
8049*4882a593Smuzhiyun #define wiphy_err_ratelimited(wiphy, format, args...) \
8050*4882a593Smuzhiyun dev_err_ratelimited(&(wiphy)->dev, format, ##args)
8051*4882a593Smuzhiyun #define wiphy_warn_ratelimited(wiphy, format, args...) \
8052*4882a593Smuzhiyun dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
8053*4882a593Smuzhiyun
8054*4882a593Smuzhiyun #define wiphy_debug(wiphy, format, args...) \
8055*4882a593Smuzhiyun wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
8056*4882a593Smuzhiyun
8057*4882a593Smuzhiyun #define wiphy_dbg(wiphy, format, args...) \
8058*4882a593Smuzhiyun dev_dbg(&(wiphy)->dev, format, ##args)
8059*4882a593Smuzhiyun
8060*4882a593Smuzhiyun #if defined(VERBOSE_DEBUG)
8061*4882a593Smuzhiyun #define wiphy_vdbg wiphy_dbg
8062*4882a593Smuzhiyun #else
8063*4882a593Smuzhiyun #define wiphy_vdbg(wiphy, format, args...) \
8064*4882a593Smuzhiyun ({ \
8065*4882a593Smuzhiyun if (0) \
8066*4882a593Smuzhiyun wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \
8067*4882a593Smuzhiyun 0; \
8068*4882a593Smuzhiyun })
8069*4882a593Smuzhiyun #endif
8070*4882a593Smuzhiyun
8071*4882a593Smuzhiyun /*
8072*4882a593Smuzhiyun * wiphy_WARN() acts like wiphy_printk(), but with the key difference
8073*4882a593Smuzhiyun * of using a WARN/WARN_ON to get the message out, including the
8074*4882a593Smuzhiyun * file/line information and a backtrace.
8075*4882a593Smuzhiyun */
8076*4882a593Smuzhiyun #define wiphy_WARN(wiphy, format, args...) \
8077*4882a593Smuzhiyun WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
8078*4882a593Smuzhiyun
8079*4882a593Smuzhiyun /**
8080*4882a593Smuzhiyun * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
8081*4882a593Smuzhiyun * @netdev: network device
8082*4882a593Smuzhiyun * @owe_info: peer's owe info
8083*4882a593Smuzhiyun * @gfp: allocation flags
8084*4882a593Smuzhiyun */
8085*4882a593Smuzhiyun void cfg80211_update_owe_info_event(struct net_device *netdev,
8086*4882a593Smuzhiyun struct cfg80211_update_owe_info *owe_info,
8087*4882a593Smuzhiyun gfp_t gfp);
8088*4882a593Smuzhiyun
8089*4882a593Smuzhiyun /**
8090*4882a593Smuzhiyun * cfg80211_bss_flush - resets all the scan entries
8091*4882a593Smuzhiyun * @wiphy: the wiphy
8092*4882a593Smuzhiyun */
8093*4882a593Smuzhiyun void cfg80211_bss_flush(struct wiphy *wiphy);
8094*4882a593Smuzhiyun
8095*4882a593Smuzhiyun #endif /* __NET_CFG80211_H */
8096