mac80211.h

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

H
1,410
字号
 * @queues: number of available hardware transmit queues for *	data packets. WMM/QoS requires at least four. * * @rate_control_algorithm: rate control algorithm for this hardware. *	If unset (NULL), the default algorithm will be used. Must be *	set before calling ieee80211_register_hw(). */struct ieee80211_hw {	struct ieee80211_conf conf;	struct wiphy *wiphy;	struct workqueue_struct *workqueue;	const char *rate_control_algorithm;	void *priv;	u32 flags;	unsigned int extra_tx_headroom;	int channel_change_time;	u8 queues;	s8 max_rssi;	s8 max_signal;	s8 max_noise;};/** * SET_IEEE80211_DEV - set device for 802.11 hardware * * @hw: the &struct ieee80211_hw to set the device for * @dev: the &struct device of this 802.11 device */static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev){	set_wiphy_dev(hw->wiphy, dev);}/** * SET_IEEE80211_PERM_ADDR - set the permanenet MAC address for 802.11 hardware * * @hw: the &struct ieee80211_hw to set the MAC address for * @addr: the address to set */static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr){	memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN);}/** * DOC: Hardware crypto acceleration * * mac80211 is capable of taking advantage of many hardware * acceleration designs for encryption and decryption operations. * * The set_key() callback in the &struct ieee80211_ops for a given * device is called to enable hardware acceleration of encryption and * decryption. The callback takes an @address parameter that will be * the broadcast address for default keys, the other station's hardware * address for individual keys or the zero address for keys that will * be used only for transmission. * Multiple transmission keys with the same key index may be used when * VLANs are configured for an access point. * * The @local_address parameter will always be set to our own address, * this is only relevant if you support multiple local addresses. * * When transmitting, the TX control data will use the @hw_key_idx * selected by the driver by modifying the &struct ieee80211_key_conf * pointed to by the @key parameter to the set_key() function. * * The set_key() call for the %SET_KEY command should return 0 if * the key is now in use, -%EOPNOTSUPP or -%ENOSPC if it couldn't be * added; if you return 0 then hw_key_idx must be assigned to the * hardware key index, you are free to use the full u8 range. * * When the cmd is %DISABLE_KEY then it must succeed. * * Note that it is permissible to not decrypt a frame even if a key * for it has been uploaded to hardware, the stack will not make any * decision based on whether a key has been uploaded or not but rather * based on the receive flags. * * The &struct ieee80211_key_conf structure pointed to by the @key * parameter is guaranteed to be valid until another call to set_key() * removes it, but it can only be used as a cookie to differentiate * keys. *//** * DOC: Frame filtering * * mac80211 requires to see many management frames for proper * operation, and users may want to see many more frames when * in monitor mode. However, for best CPU usage and power consumption, * having as few frames as possible percolate through the stack is * desirable. Hence, the hardware should filter as much as possible. * * To achieve this, mac80211 uses filter flags (see below) to tell * the driver's configure_filter() function which frames should be * passed to mac80211 and which should be filtered out. * * The configure_filter() callback is invoked with the parameters * @mc_count and @mc_list for the combined multicast address list * of all virtual interfaces, @changed_flags telling which flags * were changed and @total_flags with the new flag states. * * If your device has no multicast address filters your driver will * need to check both the %FIF_ALLMULTI flag and the @mc_count * parameter to see whether multicast frames should be accepted * or dropped. * * All unsupported flags in @total_flags must be cleared, i.e. you * should clear all bits except those you honoured. *//** * enum ieee80211_filter_flags - hardware filter flags * * These flags determine what the filter in hardware should be * programmed to let through and what should not be passed to the * stack. It is always safe to pass more frames than requested, * but this has negative impact on power consumption. * * @FIF_PROMISC_IN_BSS: promiscuous mode within your BSS, *	think of the BSS as your network segment and then this corresponds *	to the regular ethernet device promiscuous mode. * * @FIF_ALLMULTI: pass all multicast frames, this is used if requested *	by the user or if the hardware is not capable of filtering by *	multicast address. * * @FIF_FCSFAIL: pass frames with failed FCS (but you need to set the *	%RX_FLAG_FAILED_FCS_CRC for them) * * @FIF_PLCPFAIL: pass frames with failed PLCP CRC (but you need to set *	the %RX_FLAG_FAILED_PLCP_CRC for them * * @FIF_BCN_PRBRESP_PROMISC: This flag is set during scanning to indicate *	to the hardware that it should not filter beacons or probe responses *	by BSSID. Filtering them can greatly reduce the amount of processing *	mac80211 needs to do and the amount of CPU wakeups, so you should *	honour this flag if possible. * * @FIF_CONTROL: pass control frames, if PROMISC_IN_BSS is not set then *	only those addressed to this station * * @FIF_OTHER_BSS: pass frames destined to other BSSes */enum ieee80211_filter_flags {	FIF_PROMISC_IN_BSS	= 1<<0,	FIF_ALLMULTI		= 1<<1,	FIF_FCSFAIL		= 1<<2,	FIF_PLCPFAIL		= 1<<3,	FIF_BCN_PRBRESP_PROMISC	= 1<<4,	FIF_CONTROL		= 1<<5,	FIF_OTHER_BSS		= 1<<6,};/** * enum ieee80211_erp_change_flags - erp change flags * * These flags are used with the erp_ie_changed() callback in * &struct ieee80211_ops to indicate which parameter(s) changed. * @IEEE80211_ERP_CHANGE_PROTECTION: protection changed * @IEEE80211_ERP_CHANGE_PREAMBLE: barker preamble mode changed */enum ieee80211_erp_change_flags {	IEEE80211_ERP_CHANGE_PROTECTION	= 1<<0,	IEEE80211_ERP_CHANGE_PREAMBLE	= 1<<1,};/** * struct ieee80211_ops - callbacks from mac80211 to the driver * * This structure contains various callbacks that the driver may * handle or, in some cases, must handle, for example to configure * the hardware to a new channel or to transmit a frame. * * @tx: Handler that 802.11 module calls for each transmitted frame. *	skb contains the buffer starting from the IEEE 802.11 header. *	The low-level driver should send the frame out based on *	configuration in the TX control data. Must be implemented and *	atomic. * * @start: Called before the first netdevice attached to the hardware *	is enabled. This should turn on the hardware and must turn on *	frame reception (for possibly enabled monitor interfaces.) *	Returns negative error codes, these may be seen in userspace, *	or zero. *	When the device is started it should not have a MAC address *	to avoid acknowledging frames before a non-monitor device *	is added. *	Must be implemented. * * @stop: Called after last netdevice attached to the hardware *	is disabled. This should turn off the hardware (at least *	it must turn off frame reception.) *	May be called right after add_interface if that rejects *	an interface. *	Must be implemented. * * @add_interface: Called when a netdevice attached to the hardware is *	enabled. Because it is not called for monitor mode devices, @open *	and @stop must be implemented. *	The driver should perform any initialization it needs before *	the device can be enabled. The initial configuration for the *	interface is given in the conf parameter. *	The callback may refuse to add an interface by returning a *	negative error code (which will be seen in userspace.) *	Must be implemented. * * @remove_interface: Notifies a driver that an interface is going down. *	The @stop callback is called after this if it is the last interface *	and no monitor interfaces are present. *	When all interfaces are removed, the MAC address in the hardware *	must be cleared so the device no longer acknowledges packets, *	the mac_addr member of the conf structure is, however, set to the *	MAC address of the device going away. *	Hence, this callback must be implemented. * * @config: Handler for configuration requests. IEEE 802.11 code calls this *	function to change hardware configuration, e.g., channel. * * @config_interface: Handler for configuration requests related to interfaces *	(e.g. BSSID changes.) * * @configure_filter: Configure the device's RX filter. *	See the section "Frame filtering" for more information. *	This callback must be implemented and atomic. * * @set_tim: Set TIM bit. If the hardware/firmware takes care of beacon *	generation (that is, %IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE is set) *	mac80211 calls this function when a TIM bit must be set or cleared *	for a given AID. Must be atomic. * * @set_key: See the section "Hardware crypto acceleration" *	This callback can sleep, and is only called between add_interface *	and remove_interface calls, i.e. while the interface with the *	given local_address is enabled. * * @hw_scan: Ask the hardware to service the scan request, no need to start *	the scan state machine in stack. * * @get_stats: return low-level statistics * * @get_sequence_counter: For devices that have internal sequence counters this *	callback allows mac80211 to access the current value of a counter. *	This callback seems not well-defined, tell us if you need it. * * @set_rts_threshold: Configuration of RTS threshold (if device needs it) * * @set_frag_threshold: Configuration of fragmentation threshold. Assign this if *	the device does fragmentation by itself; if this method is assigned then *	the stack will not do fragmentation. * * @set_retry_limit: Configuration of retry limits (if device needs it) * * @sta_notify: Notifies low level driver about addition or removal *	of assocaited station or AP. * * @erp_ie_changed: Handle ERP IE change notifications. Must be atomic. * * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), *	bursting) for a hardware TX queue. The @queue parameter uses the *	%IEEE80211_TX_QUEUE_* constants. Must be atomic. * * @get_tx_stats: Get statistics of the current TX queue status. This is used *	to get number of currently queued packets (queue length), maximum queue *	size (limit), and total number of packets sent using each TX queue *	(count). This information is used for WMM to find out which TX *	queues have room for more packets and by hostapd to provide *	statistics about the current queueing state to external programs. * * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, *	this is only used for IBSS mode debugging and, as such, is not a *	required function. Must be atomic. * * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize *	with other STAs in the IBSS. This is only used in IBSS mode. This *	function is optional if the firmware/hardware takes full care of *	TSF synchronization. * * @beacon_update: Setup beacon data for IBSS beacons. Unlike access point, *	IBSS uses a fixed beacon frame which is configured using this *	function. *	If the driver returns success (0) from this callback, it owns *	the skb. That means the driver is responsible to kfree_skb() it. *	The control structure is not dynamically allocated. That means the *	driver does not own the pointer and if it needs it somewhere *	outside of the context of this function, it must copy it *	somewhere else. *	This handler is required only for IBSS mode. * * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. *	This is needed only for IBSS mode and the result of this function is *	used to determine whether to reply to Probe Requests. */struct ieee80211_ops {	int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb,		  struct ieee80211_tx_control *control);	int (*start)(struct ieee80211_hw *hw);	void (*stop)(struct ieee80211_hw *hw);	int (*add_interface)(struct ieee80211_hw *hw,			     struct ieee80211_if_init_conf *conf);	void (*remove_interface)(struct ieee80211_hw *hw,				 struct ieee80211_if_init_conf *conf);	int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf);	int (*config_interface)(struct ieee80211_hw *hw,				int if_id, struct ieee80211_if_conf *conf);	void (*configure_filter)(struct ieee80211_hw *hw,				 unsigned int changed_flags,				 unsigned int *total_flags,				 int mc_count, struct dev_addr_list *mc_list);	int (*set_tim)(struct ieee80211_hw *hw, int aid, int set);	int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,		       const u8 *local_address, const u8 *address,		       struct ieee80211_key_conf *key);	int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len);	int (*get_stats)(struct ieee80211_hw *hw,			 struct ieee80211_low_level_stats *stats);	int (*get_sequence_counter)(struct ieee80211_hw *hw,				    u8* addr, u8 keyidx, u8 txrx,				    u32* iv32, u16* iv16);	int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);	int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);	int (*set_retry_limit)(struct ieee80211_hw *hw,			       u32 short_retry, u32 long_retr);	void (*sta_notify)(struct ieee80211_hw *hw, int if_id,			enum sta_notify_cmd, const u8 *addr);	void (*erp_ie_changed)(struct ieee80211_hw *hw, u8 changes,			       int cts_protection, int preamble);	int (*conf_tx)(struct ieee80211_hw *hw, int queue,		       const struct ieee80211_tx_queue_params *params);	int (*get_tx_stats)(struct ieee80211_hw *hw,			    struct ieee80211_tx_queue_stats *stats);	u64 (*get_tsf)(struct ieee80211_hw *hw);	void (*reset_tsf)(struct ieee80211_hw *hw);	int (*beacon_update)(struct ieee80211_hw *hw,			     struct sk_buff *skb,			     struct ieee80211_tx_control *control);	int (*tx_last_beacon)(struct ieee80211_hw *hw);};/** * ieee80211_alloc_hw -  Allocate a new hardware device * * This must be called once for each hardware device. The returned pointer * must be used to refer to this device when calling other functions. * mac80211 allocates a private data area for the driver pointed to by * @priv in &struct ieee80211_hw, the size of this area is given as * @priv_data_len. * * @priv_data_len: length of private data * @ops: callbacks for this device */struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,

⌨️ 快捷键说明

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