4588 lines · 179.5 KB · C
RawDownload
/* * mac80211 <-> driver interface * * Copyright 2002-2005, Devicescape Software, Inc. * Copyright 2006-2007	Jiri Benc <jbenc@suse.cz> * Copyright 2007-2010	Johannes Berg <johannes@sipsolutions.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef MAC80211_H#define MAC80211_H #include <linux/bug.h>#include <linux/kernel.h>#include <linux/if_ether.h>#include <linux/skbuff.h>#include <linux/ieee80211.h>#include <net/cfg80211.h>#include <asm/unaligned.h> /** * DOC: Introduction * * mac80211 is the Linux stack for 802.11 hardware that implements * only partial functionality in hard- or firmware. This document * defines the interface between mac80211 and low-level hardware * drivers. */ /** * DOC: Calling mac80211 from interrupts * * Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsafe() can be * called in hardware interrupt context. The low-level driver must not call any * other functions in hardware interrupt context. If there is a need for such * call, the low-level driver should first ACK the interrupt and perform the * IEEE 802.11 code call after this, e.g. from a scheduled workqueue or even * tasklet function. * * NOTE: If the driver opts to use the _irqsafe() functions, it may not also *	 use the non-IRQ-safe functions! */ /** * DOC: Warning * * If you're reading this document and not the header file itself, it will * be incomplete because not all documentation has been converted yet. */ /** * DOC: Frame format * * As a general rule, when frames are passed between mac80211 and the driver, * they start with the IEEE 802.11 header and include the same octets that are * sent over the air except for the FCS which should be calculated by the * hardware. * * There are, however, various exceptions to this rule for advanced features: * * The first exception is for hardware encryption and decryption offload * where the IV/ICV may or may not be generated in hardware. * * Secondly, when the hardware handles fragmentation, the frame handed to * the driver from mac80211 is the MSDU, not the MPDU. * * Finally, for received frames, the driver is able to indicate that it has * filled a radiotap header and put that in front of the frame; if it does * not do so then mac80211 may add this under certain circumstances. */ /** * DOC: mac80211 workqueue * * mac80211 provides its own workqueue for drivers and internal mac80211 use. * The workqueue is a single threaded workqueue and can only be accessed by * helpers for sanity checking. Drivers must ensure all work added onto the * mac80211 workqueue should be cancelled on the driver stop() callback. * * mac80211 will flushed the workqueue upon interface removal and during * suspend. * * All work performed on the mac80211 workqueue must not acquire the RTNL lock. * */ struct device; /** * enum ieee80211_max_queues - maximum number of queues * * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. * @IEEE80211_MAX_QUEUE_MAP: bitmap with maximum queues set */enum ieee80211_max_queues {	IEEE80211_MAX_QUEUES =		16,	IEEE80211_MAX_QUEUE_MAP =	BIT(IEEE80211_MAX_QUEUES) - 1,}; #define IEEE80211_INVAL_HW_QUEUE	0xff /** * enum ieee80211_ac_numbers - AC numbers as used in mac80211 * @IEEE80211_AC_VO: voice * @IEEE80211_AC_VI: video * @IEEE80211_AC_BE: best effort * @IEEE80211_AC_BK: background */enum ieee80211_ac_numbers {	IEEE80211_AC_VO		= 0,	IEEE80211_AC_VI		= 1,	IEEE80211_AC_BE		= 2,	IEEE80211_AC_BK		= 3,};#define IEEE80211_NUM_ACS	4 /** * struct ieee80211_tx_queue_params - transmit queue configuration * * The information provided in this structure is required for QoS * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29. * * @aifs: arbitration interframe space [0..255] * @cw_min: minimum contention window [a value of the form *	2^n-1 in the range 1..32767] * @cw_max: maximum contention window [like @cw_min] * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled * @acm: is mandatory admission control required for the access category * @uapsd: is U-APSD mode enabled for the queue */struct ieee80211_tx_queue_params {	u16 txop;	u16 cw_min;	u16 cw_max;	u8 aifs;	bool acm;	bool uapsd;}; struct ieee80211_low_level_stats {	unsigned int dot11ACKFailureCount;	unsigned int dot11RTSFailureCount;	unsigned int dot11FCSErrorCount;	unsigned int dot11RTSSuccessCount;}; /** * enum ieee80211_chanctx_change - change flag for channel context * @IEEE80211_CHANCTX_CHANGE_WIDTH: The channel width changed * @IEEE80211_CHANCTX_CHANGE_RX_CHAINS: The number of RX chains changed * @IEEE80211_CHANCTX_CHANGE_RADAR: radar detection flag changed * @IEEE80211_CHANCTX_CHANGE_CHANNEL: switched to another operating channel, *	this is used only with channel switching with CSA */enum ieee80211_chanctx_change {	IEEE80211_CHANCTX_CHANGE_WIDTH		= BIT(0),	IEEE80211_CHANCTX_CHANGE_RX_CHAINS	= BIT(1),	IEEE80211_CHANCTX_CHANGE_RADAR		= BIT(2),	IEEE80211_CHANCTX_CHANGE_CHANNEL	= BIT(3),}; /** * struct ieee80211_chanctx_conf - channel context that vifs may be tuned to * * This is the driver-visible part. The ieee80211_chanctx * that contains it is visible in mac80211 only. * * @def: the channel definition * @rx_chains_static: The number of RX chains that must always be *	active on the channel to receive MIMO transmissions * @rx_chains_dynamic: The number of RX chains that must be enabled *	after RTS/CTS handshake to receive SMPS MIMO transmissions; *	this will always be >= @rx_chains_static. * @radar_enabled: whether radar detection is enabled on this channel. * @drv_priv: data area for driver use, will always be aligned to *	sizeof(void *), size is determined in hw information. */struct ieee80211_chanctx_conf {	struct cfg80211_chan_def def; 	u8 rx_chains_static, rx_chains_dynamic; 	bool radar_enabled; 	u8 drv_priv[0] __aligned(sizeof(void *));}; /** * enum ieee80211_bss_change - BSS change notification flags * * These flags are used with the bss_info_changed() callback * to indicate which BSS parameter changed. * * @BSS_CHANGED_ASSOC: association status changed (associated/disassociated), *	also implies a change in the AID. * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed * @BSS_CHANGED_ERP_PREAMBLE: preamble changed * @BSS_CHANGED_ERP_SLOT: slot timing changed * @BSS_CHANGED_HT: 802.11n parameters changed * @BSS_CHANGED_BASIC_RATES: Basic rateset changed * @BSS_CHANGED_BEACON_INT: Beacon interval changed * @BSS_CHANGED_BSSID: BSSID changed, for whatever *	reason (IBSS and managed mode) * @BSS_CHANGED_BEACON: Beacon data changed, retrieve *	new beacon (beaconing modes) * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be *	enabled/disabled (beaconing modes) * @BSS_CHANGED_CQM: Connection quality monitor config changed * @BSS_CHANGED_IBSS: IBSS join status changed * @BSS_CHANGED_ARP_FILTER: Hardware ARP filter address list or state changed. * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note *	that it is only ever disabled for station mode. * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface. * @BSS_CHANGED_SSID: SSID changed for this BSS (AP and IBSS mode) * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode) * @BSS_CHANGED_PS: PS changed for this BSS (STA mode) * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface * @BSS_CHANGED_P2P_PS: P2P powersave settings (CTWindow, opportunistic PS) *	changed (currently only in P2P client mode, GO mode will be later) * @BSS_CHANGED_BEACON_INFO: Data from the AP's beacon became available: *	currently dtim_period only is under consideration. * @BSS_CHANGED_BANDWIDTH: The bandwidth used by this interface changed, *	note that this is only called when it changes after the channel *	context had been assigned. */enum ieee80211_bss_change {	BSS_CHANGED_ASSOC		= 1<<0,	BSS_CHANGED_ERP_CTS_PROT	= 1<<1,	BSS_CHANGED_ERP_PREAMBLE	= 1<<2,	BSS_CHANGED_ERP_SLOT		= 1<<3,	BSS_CHANGED_HT			= 1<<4,	BSS_CHANGED_BASIC_RATES		= 1<<5,	BSS_CHANGED_BEACON_INT		= 1<<6,	BSS_CHANGED_BSSID		= 1<<7,	BSS_CHANGED_BEACON		= 1<<8,	BSS_CHANGED_BEACON_ENABLED	= 1<<9,	BSS_CHANGED_CQM			= 1<<10,	BSS_CHANGED_IBSS		= 1<<11,	BSS_CHANGED_ARP_FILTER		= 1<<12,	BSS_CHANGED_QOS			= 1<<13,	BSS_CHANGED_IDLE		= 1<<14,	BSS_CHANGED_SSID		= 1<<15,	BSS_CHANGED_AP_PROBE_RESP	= 1<<16,	BSS_CHANGED_PS			= 1<<17,	BSS_CHANGED_TXPOWER		= 1<<18,	BSS_CHANGED_P2P_PS		= 1<<19,	BSS_CHANGED_BEACON_INFO		= 1<<20,	BSS_CHANGED_BANDWIDTH		= 1<<21, 	/* when adding here, make sure to change ieee80211_reconfig */}; /* * The maximum number of IPv4 addresses listed for ARP filtering. If the number * of addresses for an interface increase beyond this value, hardware ARP * filtering will be disabled. */#define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4 /** * enum ieee80211_rssi_event - RSSI threshold event * An indicator for when RSSI goes below/above a certain threshold. * @RSSI_EVENT_HIGH: AP's rssi crossed the high threshold set by the driver. * @RSSI_EVENT_LOW: AP's rssi crossed the low threshold set by the driver. */enum ieee80211_rssi_event {	RSSI_EVENT_HIGH,	RSSI_EVENT_LOW,}; /** * struct ieee80211_bss_conf - holds the BSS's changing parameters * * This structure keeps information about a BSS (and an association * to that BSS) that can change during the lifetime of the BSS. * * @assoc: association status * @ibss_joined: indicates whether this station is part of an IBSS *	or not * @ibss_creator: indicates if a new IBSS network is being created * @aid: association ID number, valid only when @assoc is true * @use_cts_prot: use CTS protection * @use_short_preamble: use 802.11b short preamble; *	if the hardware cannot handle this it must set the *	IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE hardware flag * @use_short_slot: use short slot time (only relevant for ERP); *	if the hardware cannot handle this it must set the *	IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag * @dtim_period: num of beacons before the next DTIM, for beaconing, *	valid in station mode only if after the driver was notified *	with the %BSS_CHANGED_BEACON_INFO flag, will be non-zero then. * @sync_tsf: last beacon's/probe response's TSF timestamp (could be old *	as it may have been received during scanning long ago). If the *	HW flag %IEEE80211_HW_TIMING_BEACON_ONLY is set, then this can *	only come from a beacon, but might not become valid until after *	association when a beacon is received (which is notified with the *	%BSS_CHANGED_DTIM flag.) * @sync_device_ts: the device timestamp corresponding to the sync_tsf, *	the driver/device can use this to calculate synchronisation *	(see @sync_tsf) * @sync_dtim_count: Only valid when %IEEE80211_HW_TIMING_BEACON_ONLY *	is requested, see @sync_tsf/@sync_device_ts. * @beacon_int: beacon interval * @assoc_capability: capabilities taken from assoc resp * @basic_rates: bitmap of basic rates, each bit stands for an *	index into the rate table configured by the driver in *	the current band. * @beacon_rate: associated AP's beacon TX rate * @mcast_rate: per-band multicast rate index + 1 (0: disabled) * @bssid: The BSSID for this BSS * @enable_beacon: whether beaconing should be enabled or not * @chandef: Channel definition for this BSS -- the hardware might be *	configured a higher bandwidth than this BSS uses, for example. * @ht_operation_mode: HT operation mode like in &struct ieee80211_ht_operation. *	This field is only valid when the channel type is one of the HT types. * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value *	implies disabled * @cqm_rssi_hyst: Connection quality monitor RSSI hysteresis * @arp_addr_list: List of IPv4 addresses for hardware ARP filtering. The *	may filter ARP queries targeted for other addresses than listed here. *	The driver must allow ARP queries targeted for all address listed here *	to pass through. An empty list implies no ARP queries need to pass. * @arp_addr_cnt: Number of addresses currently on the list. Note that this *	may be larger than %IEEE80211_BSS_ARP_ADDR_LIST_LEN (the arp_addr_list *	array size), it's up to the driver what to do in that case. * @qos: This is a QoS-enabled BSS. * @idle: This interface is idle. There's also a global idle flag in the *	hardware config which may be more appropriate depending on what *	your driver/device needs to do. * @ps: power-save mode (STA only). This flag is NOT affected by *	offchannel/dynamic_ps operations. * @ssid: The SSID of the current vif. Valid in AP and IBSS mode. * @ssid_len: Length of SSID given in @ssid. * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode. * @txpower: TX power in dBm * @p2p_noa_attr: P2P NoA attribute for P2P powersave */struct ieee80211_bss_conf {	const u8 *bssid;	/* association related data */	bool assoc, ibss_joined;	bool ibss_creator;	u16 aid;	/* erp related data */	bool use_cts_prot;	bool use_short_preamble;	bool use_short_slot;	bool enable_beacon;	u8 dtim_period;	u16 beacon_int;	u16 assoc_capability;	u64 sync_tsf;	u32 sync_device_ts;	u8 sync_dtim_count;	u32 basic_rates;	struct ieee80211_rate *beacon_rate;	int mcast_rate[IEEE80211_NUM_BANDS];	u16 ht_operation_mode;	s32 cqm_rssi_thold;	u32 cqm_rssi_hyst;	struct cfg80211_chan_def chandef;	__be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN];	int arp_addr_cnt;	bool qos;	bool idle;	bool ps;	u8 ssid[IEEE80211_MAX_SSID_LEN];	size_t ssid_len;	bool hidden_ssid;	int txpower;	struct ieee80211_p2p_noa_attr p2p_noa_attr;}; /** * enum mac80211_tx_info_flags - flags to describe transmission information/status * * These flags are used with the @flags member of &ieee80211_tx_info. * * @IEEE80211_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame. * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence *	number to this frame, taking care of not overwriting the fragment *	number and increasing the sequence number only when the *	IEEE80211_TX_CTL_FIRST_FRAGMENT flag is set. mac80211 will properly *	assign sequence numbers to QoS-data frames but cannot do so correctly *	for non-QoS-data and management frames because beacons need them from *	that counter as well and mac80211 cannot guarantee proper sequencing. *	If this flag is set, the driver should instruct the hardware to *	assign a sequence number to the frame or assign one itself. Cf. IEEE *	802.11-2007 7.1.3.4.1 paragraph 3. This flag will always be set for *	beacons and always be clear for frames without a sequence number field. * @IEEE80211_TX_CTL_NO_ACK: tell the low level not to wait for an ack * @IEEE80211_TX_CTL_CLEAR_PS_FILT: clear powersave filter for destination *	station * @IEEE80211_TX_CTL_FIRST_FRAGMENT: this is a first fragment of the frame * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU * @IEEE80211_TX_CTL_INJECTED: Frame was injected, internal to mac80211. * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted *	because the destination STA was in powersave mode. Note that to *	avoid race conditions, the filter must be set by the hardware or *	firmware upon receiving a frame that indicates that the station *	went to sleep (must be done on device to filter frames already on *	the queue) and may only be unset after mac80211 gives the OK for *	that by setting the IEEE80211_TX_CTL_CLEAR_PS_FILT (see above), *	since only then is it guaranteed that no more frames are in the *	hardware queue. * @IEEE80211_TX_STAT_ACK: Frame was acknowledged * @IEEE80211_TX_STAT_AMPDU: The frame was aggregated, so status * 	is for the whole aggregation. * @IEEE80211_TX_STAT_AMPDU_NO_BACK: no block ack was returned, * 	so consider using block ack request (BAR). * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be *	set by rate control algorithms to indicate probe rate, will *	be cleared for fragmented frames (except on the last fragment) * @IEEE80211_TX_INTFL_OFFCHAN_TX_OK: Internal to mac80211. Used to indicate *	that a frame can be transmitted while the queues are stopped for *	off-channel operation. * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211, *	used to indicate that a pending frame requires TX processing before *	it can be sent out. * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211, *	used to indicate that a frame was already retried due to PS * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211, *	used to indicate frame should not be encrypted * @IEEE80211_TX_CTL_NO_PS_BUFFER: This frame is a response to a poll *	frame (PS-Poll or uAPSD) or a non-bufferable MMPDU and must *	be sent although the station is in powersave mode. * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the *	transmit function after the current frame, this can be used *	by drivers to kick the DMA queue only if unset or when the *	queue gets full. * @IEEE80211_TX_INTFL_RETRANSMISSION: This frame is being retransmitted *	after TX status because the destination was asleep, it must not *	be modified again (no seqno assignment, crypto, etc.) * @IEEE80211_TX_INTFL_MLME_CONN_TX: This frame was transmitted by the MLME *	code for connection establishment, this indicates that its status *	should kick the MLME state machine. * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211 *	MLME command (internal to mac80211 to figure out whether to send TX *	status to user space) * @IEEE80211_TX_CTL_LDPC: tells the driver to use LDPC for this frame * @IEEE80211_TX_CTL_STBC: Enables Space-Time Block Coding (STBC) for this *	frame and selects the maximum number of streams that it can use. * @IEEE80211_TX_CTL_TX_OFFCHAN: Marks this packet to be transmitted on *	the off-channel channel when a remain-on-channel offload is done *	in hardware -- normal packets still flow and are expected to be *	handled properly by the device. * @IEEE80211_TX_INTFL_TKIP_MIC_FAILURE: Marks this packet to be used for TKIP *	testing. It will be sent out with incorrect Michael MIC key to allow *	TKIP countermeasures to be tested. * @IEEE80211_TX_CTL_NO_CCK_RATE: This frame will be sent at non CCK rate. *	This flag is actually used for management frame especially for P2P *	frames not being sent at CCK rate in 2GHz band. * @IEEE80211_TX_STATUS_EOSP: This packet marks the end of service period, *	when its status is reported the service period ends. For frames in *	an SP that mac80211 transmits, it is already set; for driver frames *	the driver may set this flag. It is also used to do the same for *	PS-Poll responses. * @IEEE80211_TX_CTL_USE_MINRATE: This frame will be sent at lowest rate. *	This flag is used to send nullfunc frame at minimum rate when *	the nullfunc is used for connection monitoring purpose. * @IEEE80211_TX_CTL_DONTFRAG: Don't fragment this packet even if it *	would be fragmented by size (this is optional, only used for *	monitor injection). * @IEEE80211_TX_CTL_PS_RESPONSE: This frame is a response to a poll *	frame (PS-Poll or uAPSD). * * Note: If you have to add new flags to the enumeration, then don't *	 forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary. */enum mac80211_tx_info_flags {	IEEE80211_TX_CTL_REQ_TX_STATUS		= BIT(0),	IEEE80211_TX_CTL_ASSIGN_SEQ		= BIT(1),	IEEE80211_TX_CTL_NO_ACK			= BIT(2),	IEEE80211_TX_CTL_CLEAR_PS_FILT		= BIT(3),	IEEE80211_TX_CTL_FIRST_FRAGMENT		= BIT(4),	IEEE80211_TX_CTL_SEND_AFTER_DTIM	= BIT(5),	IEEE80211_TX_CTL_AMPDU			= BIT(6),	IEEE80211_TX_CTL_INJECTED		= BIT(7),	IEEE80211_TX_STAT_TX_FILTERED		= BIT(8),	IEEE80211_TX_STAT_ACK			= BIT(9),	IEEE80211_TX_STAT_AMPDU			= BIT(10),	IEEE80211_TX_STAT_AMPDU_NO_BACK		= BIT(11),	IEEE80211_TX_CTL_RATE_CTRL_PROBE	= BIT(12),	IEEE80211_TX_INTFL_OFFCHAN_TX_OK	= BIT(13),	IEEE80211_TX_INTFL_NEED_TXPROCESSING	= BIT(14),	IEEE80211_TX_INTFL_RETRIED		= BIT(15),	IEEE80211_TX_INTFL_DONT_ENCRYPT		= BIT(16),	IEEE80211_TX_CTL_NO_PS_BUFFER		= BIT(17),	IEEE80211_TX_CTL_MORE_FRAMES		= BIT(18),	IEEE80211_TX_INTFL_RETRANSMISSION	= BIT(19),	IEEE80211_TX_INTFL_MLME_CONN_TX		= BIT(20),	IEEE80211_TX_INTFL_NL80211_FRAME_TX	= BIT(21),	IEEE80211_TX_CTL_LDPC			= BIT(22),	IEEE80211_TX_CTL_STBC			= BIT(23) | BIT(24),	IEEE80211_TX_CTL_TX_OFFCHAN		= BIT(25),	IEEE80211_TX_INTFL_TKIP_MIC_FAILURE	= BIT(26),

Lines 1–500 of 4588.