mac80211.h

来自「linux 内核源代码」· C头文件 代码 · 共 1,410 行 · 第 1/4 页

H
1,410
字号
/* * mac80211 <-> driver interface * * Copyright 2002-2005, Devicescape Software, Inc. * Copyright 2006-2007	Jiri Benc <jbenc@suse.cz> * Copyright 2007	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/kernel.h>#include <linux/if_ether.h>#include <linux/skbuff.h>#include <linux/wireless.h>#include <linux/device.h>#include <linux/ieee80211.h>#include <net/wireless.h>#include <net/cfg80211.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 function. *//** * 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. */#define IEEE80211_CHAN_W_SCAN 0x00000001#define IEEE80211_CHAN_W_ACTIVE_SCAN 0x00000002#define IEEE80211_CHAN_W_IBSS 0x00000004/* Channel information structure. Low-level driver is expected to fill in chan, * freq, and val fields. Other fields will be filled in by 80211.o based on * hostapd information and low-level driver does not need to use them. The * limits for each channel will be provided in 'struct ieee80211_conf' when * configuring the low-level driver with hw->config callback. If a device has * a default regulatory domain, IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED * can be set to let the driver configure all fields */struct ieee80211_channel {	short chan; /* channel number (IEEE 802.11) */	short freq; /* frequency in MHz */	int val; /* hw specific value for the channel */	int flag; /* flag for hostapd use (IEEE80211_CHAN_*) */	unsigned char power_level;	unsigned char antenna_max;};#define IEEE80211_RATE_ERP 0x00000001#define IEEE80211_RATE_BASIC 0x00000002#define IEEE80211_RATE_PREAMBLE2 0x00000004#define IEEE80211_RATE_SUPPORTED 0x00000010#define IEEE80211_RATE_OFDM 0x00000020#define IEEE80211_RATE_CCK 0x00000040#define IEEE80211_RATE_MANDATORY 0x00000100#define IEEE80211_RATE_CCK_2 (IEEE80211_RATE_CCK | IEEE80211_RATE_PREAMBLE2)#define IEEE80211_RATE_MODULATION(f) \	(f & (IEEE80211_RATE_CCK | IEEE80211_RATE_OFDM))/* Low-level driver should set PREAMBLE2, OFDM and CCK flags. * BASIC, SUPPORTED, ERP, and MANDATORY flags are set in 80211.o based on the * configuration. */struct ieee80211_rate {	int rate; /* rate in 100 kbps */	int val; /* hw specific value for the rate */	int flags; /* IEEE80211_RATE_ flags */	int val2; /* hw specific value for the rate when using short preamble		   * (only when IEEE80211_RATE_PREAMBLE2 flag is set, i.e., for		   * 2, 5.5, and 11 Mbps) */	signed char min_rssi_ack;	unsigned char min_rssi_ack_delta;	/* following fields are set by 80211.o and need not be filled by the	 * low-level driver */	int rate_inv; /* inverse of the rate (LCM(all rates) / rate) for		       * optimizing channel utilization estimates */};/** * enum ieee80211_phymode - PHY modes * * @MODE_IEEE80211A: 5GHz as defined by 802.11a/802.11h * @MODE_IEEE80211B: 2.4 GHz as defined by 802.11b * @MODE_IEEE80211G: 2.4 GHz as defined by 802.11g (with OFDM), *	backwards compatible with 11b mode * @NUM_IEEE80211_MODES: internal */enum ieee80211_phymode {	MODE_IEEE80211A,	MODE_IEEE80211B,	MODE_IEEE80211G,	/* keep last */	NUM_IEEE80211_MODES};/** * struct ieee80211_hw_mode - PHY mode definition * * This structure describes the capabilities supported by the device * in a single PHY mode. * * @mode: the PHY mode for this definition * @num_channels: number of supported channels * @channels: pointer to array of supported channels * @num_rates: number of supported bitrates * @rates: pointer to array of supported bitrates * @list: internal */struct ieee80211_hw_mode {	struct list_head list;	struct ieee80211_channel *channels;	struct ieee80211_rate *rates;	enum ieee80211_phymode mode;	int num_channels;	int num_rates;};/** * struct ieee80211_tx_queue_params - transmit queue configuration * * The information provided in this structure is required for QoS * transmit queue configuration. * * @aifs: arbitration interface space [0..255, -1: use default] * @cw_min: minimum contention window [will be a value of the form *	2^n-1 in the range 1..1023; 0: use default] * @cw_max: maximum contention window [like @cw_min] * @burst_time: maximum burst time in units of 0.1ms, 0 meaning disabled */struct ieee80211_tx_queue_params {	int aifs;	int cw_min;	int cw_max;	int burst_time;};/** * struct ieee80211_tx_queue_stats_data - transmit queue statistics * * @len: number of packets in queue * @limit: queue length limit * @count: number of frames sent */struct ieee80211_tx_queue_stats_data {	unsigned int len;	unsigned int limit;	unsigned int count;};/** * enum ieee80211_tx_queue - transmit queue number * * These constants are used with some callbacks that take a * queue number to set parameters for a queue. * * @IEEE80211_TX_QUEUE_DATA0: data queue 0 * @IEEE80211_TX_QUEUE_DATA1: data queue 1 * @IEEE80211_TX_QUEUE_DATA2: data queue 2 * @IEEE80211_TX_QUEUE_DATA3: data queue 3 * @IEEE80211_TX_QUEUE_DATA4: data queue 4 * @IEEE80211_TX_QUEUE_SVP: ?? * @NUM_TX_DATA_QUEUES: number of data queues * @IEEE80211_TX_QUEUE_AFTER_BEACON: transmit queue for frames to be *	sent after a beacon * @IEEE80211_TX_QUEUE_BEACON: transmit queue for beacon frames */enum ieee80211_tx_queue {	IEEE80211_TX_QUEUE_DATA0,	IEEE80211_TX_QUEUE_DATA1,	IEEE80211_TX_QUEUE_DATA2,	IEEE80211_TX_QUEUE_DATA3,	IEEE80211_TX_QUEUE_DATA4,	IEEE80211_TX_QUEUE_SVP,	NUM_TX_DATA_QUEUES,/* due to stupidity in the sub-ioctl userspace interface, the items in * this struct need to have fixed values. As soon as it is removed, we can * fix these entries. */	IEEE80211_TX_QUEUE_AFTER_BEACON = 6,	IEEE80211_TX_QUEUE_BEACON = 7};struct ieee80211_tx_queue_stats {	struct ieee80211_tx_queue_stats_data data[NUM_TX_DATA_QUEUES];};struct ieee80211_low_level_stats {	unsigned int dot11ACKFailureCount;	unsigned int dot11RTSFailureCount;	unsigned int dot11FCSErrorCount;	unsigned int dot11RTSSuccessCount;};/* Transmit control fields. This data structure is passed to low-level driver * with each TX frame. The low-level driver is responsible for configuring * the hardware to use given values (depending on what is supported). */struct ieee80211_tx_control {	int tx_rate; /* Transmit rate, given as the hw specific value for the		      * rate (from struct ieee80211_rate) */	int rts_cts_rate; /* Transmit rate for RTS/CTS frame, given as the hw			   * specific value for the rate (from			   * struct ieee80211_rate) */#define IEEE80211_TXCTL_REQ_TX_STATUS	(1<<0)/* request TX status callback for						* this frame */#define IEEE80211_TXCTL_DO_NOT_ENCRYPT	(1<<1) /* send this frame without						* encryption; e.g., for EAPOL						* frames */#define IEEE80211_TXCTL_USE_RTS_CTS	(1<<2) /* use RTS-CTS before sending						* frame */#define IEEE80211_TXCTL_USE_CTS_PROTECT	(1<<3) /* use CTS protection for the						* frame (e.g., for combined						* 802.11g / 802.11b networks) */#define IEEE80211_TXCTL_NO_ACK		(1<<4) /* tell the low level not to						* wait for an ack */#define IEEE80211_TXCTL_RATE_CTRL_PROBE	(1<<5)#define IEEE80211_TXCTL_CLEAR_DST_MASK	(1<<6)#define IEEE80211_TXCTL_REQUEUE		(1<<7)#define IEEE80211_TXCTL_FIRST_FRAGMENT	(1<<8) /* this is a first fragment of						* the frame */#define IEEE80211_TXCTL_LONG_RETRY_LIMIT (1<<10) /* this frame should be send						  * using the through						  * set_retry_limit configured						  * long retry value */	u32 flags;			       /* tx control flags defined						* above */	u8 key_idx;		/* keyidx from hw->set_key(), undefined if				 * IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */	u8 retry_limit;		/* 1 = only first attempt, 2 = one retry, ..				 * This could be used when set_retry_limit				 * is not implemented by the driver */	u8 power_level;		/* per-packet transmit power level, in dBm */	u8 antenna_sel_tx; 	/* 0 = default/diversity, 1 = Ant0, 2 = Ant1 */	u8 icv_len;		/* length of the ICV/MIC field in octets */	u8 iv_len;		/* length of the IV field in octets */	u8 queue;		/* hardware queue to use for this frame;				 * 0 = highest, hw->queues-1 = lowest */	struct ieee80211_rate *rate;		/* internal 80211.o rate */	struct ieee80211_rate *rts_rate;	/* internal 80211.o rate						 * for RTS/CTS */	int alt_retry_rate; /* retry rate for the last retries, given as the			     * hw specific value for the rate (from			     * struct ieee80211_rate). To be used to limit			     * packet dropping when probing higher rates, if hw			     * supports multiple retry rates. -1 = not used */	int type;	/* internal */	int ifindex;	/* internal */};/** * enum mac80211_rx_flags - receive flags * * These flags are used with the @flag member of &struct ieee80211_rx_status. * @RX_FLAG_MMIC_ERROR: Michael MIC error was reported on this frame. *	Use together with %RX_FLAG_MMIC_STRIPPED. * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware. * @RX_FLAG_RADIOTAP: This frame starts with a radiotap header. * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame, *	verification has been done by the hardware. * @RX_FLAG_IV_STRIPPED: The IV/ICV are stripped from this frame. *	If this flag is set, the stack cannot do any replay detection *	hence the driver or hardware will have to do that. * @RX_FLAG_FAILED_FCS_CRC: Set this flag if the FCS check failed on *	the frame. * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on *	the frame. */enum mac80211_rx_flags {	RX_FLAG_MMIC_ERROR	= 1<<0,	RX_FLAG_DECRYPTED	= 1<<1,	RX_FLAG_RADIOTAP	= 1<<2,	RX_FLAG_MMIC_STRIPPED	= 1<<3,	RX_FLAG_IV_STRIPPED	= 1<<4,	RX_FLAG_FAILED_FCS_CRC	= 1<<5,	RX_FLAG_FAILED_PLCP_CRC = 1<<6,};/** * struct ieee80211_rx_status - receive status * * The low-level driver should provide this information (the subset * supported by hardware) to the 802.11 code with each received * frame. * @mactime: MAC timestamp as defined by 802.11 * @freq: frequency the radio was tuned to when receiving this frame, in MHz * @channel: channel the radio was tuned to * @phymode: active PHY mode * @ssi: signal strength when receiving this frame * @signal: used as 'qual' in statistics reporting * @noise: PHY noise when receiving this frame * @antenna: antenna used * @rate: data rate * @flag: %RX_FLAG_* */struct ieee80211_rx_status {	u64 mactime;	int freq;	int channel;	enum ieee80211_phymode phymode;	int ssi;	int signal;	int noise;	int antenna;	int rate;	int flag;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?