Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
util.c File Reference
#include <net/mac80211.h>
#include <linux/netdevice.h>
#include <linux/export.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/skbuff.h>
#include <linux/etherdevice.h>
#include <linux/if_arp.h>
#include <linux/bitmap.h>
#include <linux/crc32.h>
#include <net/net_namespace.h>
#include <net/cfg80211.h>
#include <net/rtnetlink.h>
#include "ieee80211_i.h"
#include "driver-ops.h"
#include "rate.h"
#include "mesh.h"
#include "wme.h"
#include "led.h"
#include "wep.h"

Go to the source code of this file.

Functions

struct ieee80211_hwwiphy_to_ieee80211_hw (struct wiphy *wiphy)
 
 EXPORT_SYMBOL (wiphy_to_ieee80211_hw)
 
u8ieee80211_get_bssid (struct ieee80211_hdr *hdr, size_t len, enum nl80211_iftype type)
 
void ieee80211_tx_set_protected (struct ieee80211_tx_data *tx)
 
int ieee80211_frame_duration (enum ieee80211_band band, size_t len, int rate, int erp, int short_preamble)
 
__le16 ieee80211_generic_frame_duration (struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum ieee80211_band band, size_t frame_len, struct ieee80211_rate *rate)
 
 EXPORT_SYMBOL (ieee80211_generic_frame_duration)
 
__le16 ieee80211_rts_duration (struct ieee80211_hw *hw, struct ieee80211_vif *vif, size_t frame_len, const struct ieee80211_tx_info *frame_txctl)
 
 EXPORT_SYMBOL (ieee80211_rts_duration)
 
__le16 ieee80211_ctstoself_duration (struct ieee80211_hw *hw, struct ieee80211_vif *vif, size_t frame_len, const struct ieee80211_tx_info *frame_txctl)
 
 EXPORT_SYMBOL (ieee80211_ctstoself_duration)
 
void ieee80211_propagate_queue_wake (struct ieee80211_local *local, int queue)
 
void ieee80211_wake_queue_by_reason (struct ieee80211_hw *hw, int queue, enum queue_stop_reason reason)
 
void ieee80211_wake_queue (struct ieee80211_hw *hw, int queue)
 
 EXPORT_SYMBOL (ieee80211_wake_queue)
 
void ieee80211_stop_queue_by_reason (struct ieee80211_hw *hw, int queue, enum queue_stop_reason reason)
 
void ieee80211_stop_queue (struct ieee80211_hw *hw, int queue)
 
 EXPORT_SYMBOL (ieee80211_stop_queue)
 
void ieee80211_add_pending_skb (struct ieee80211_local *local, struct sk_buff *skb)
 
void ieee80211_add_pending_skbs_fn (struct ieee80211_local *local, struct sk_buff_head *skbs, void(*fn)(void *data), void *data)
 
void ieee80211_stop_queues_by_reason (struct ieee80211_hw *hw, enum queue_stop_reason reason)
 
void ieee80211_stop_queues (struct ieee80211_hw *hw)
 
 EXPORT_SYMBOL (ieee80211_stop_queues)
 
int ieee80211_queue_stopped (struct ieee80211_hw *hw, int queue)
 
 EXPORT_SYMBOL (ieee80211_queue_stopped)
 
void ieee80211_wake_queues_by_reason (struct ieee80211_hw *hw, enum queue_stop_reason reason)
 
void ieee80211_wake_queues (struct ieee80211_hw *hw)
 
 EXPORT_SYMBOL (ieee80211_wake_queues)
 
void ieee80211_iterate_active_interfaces (struct ieee80211_hw *hw, void(*iterator)(void *data, u8 *mac, struct ieee80211_vif *vif), void *data)
 
 EXPORT_SYMBOL_GPL (ieee80211_iterate_active_interfaces)
 
void ieee80211_iterate_active_interfaces_atomic (struct ieee80211_hw *hw, void(*iterator)(void *data, u8 *mac, struct ieee80211_vif *vif), void *data)
 
 EXPORT_SYMBOL_GPL (ieee80211_iterate_active_interfaces_atomic)
 
void ieee80211_queue_work (struct ieee80211_hw *hw, struct work_struct *work)
 
 EXPORT_SYMBOL (ieee80211_queue_work)
 
void ieee80211_queue_delayed_work (struct ieee80211_hw *hw, struct delayed_work *dwork, unsigned long delay)
 
 EXPORT_SYMBOL (ieee80211_queue_delayed_work)
 
u32 ieee802_11_parse_elems_crc (u8 *start, size_t len, struct ieee802_11_elems *elems, u64 filter, u32 crc)
 
void ieee802_11_parse_elems (u8 *start, size_t len, struct ieee802_11_elems *elems)
 
void ieee80211_set_wmm_default (struct ieee80211_sub_if_data *sdata, bool bss_notify)
 
void ieee80211_sta_def_wmm_params (struct ieee80211_sub_if_data *sdata, const size_t supp_rates_len, const u8 *supp_rates)
 
u32 ieee80211_mandatory_rates (struct ieee80211_local *local, enum ieee80211_band band)
 
void ieee80211_send_auth (struct ieee80211_sub_if_data *sdata, u16 transaction, u16 auth_alg, u8 *extra, size_t extra_len, const u8 *da, const u8 *bssid, const u8 *key, u8 key_len, u8 key_idx)
 
void ieee80211_send_deauth_disassoc (struct ieee80211_sub_if_data *sdata, const u8 *bssid, u16 stype, u16 reason, bool send_frame, u8 *frame_buf)
 
int ieee80211_build_preq_ies (struct ieee80211_local *local, u8 *buffer, const u8 *ie, size_t ie_len, enum ieee80211_band band, u32 rate_mask, u8 channel)
 
struct sk_buffieee80211_build_probe_req (struct ieee80211_sub_if_data *sdata, u8 *dst, u32 ratemask, struct ieee80211_channel *chan, const u8 *ssid, size_t ssid_len, const u8 *ie, size_t ie_len, bool directed)
 
void ieee80211_send_probe_req (struct ieee80211_sub_if_data *sdata, u8 *dst, const u8 *ssid, size_t ssid_len, const u8 *ie, size_t ie_len, u32 ratemask, bool directed, bool no_cck, struct ieee80211_channel *channel)
 
u32 ieee80211_sta_get_rates (struct ieee80211_local *local, struct ieee802_11_elems *elems, enum ieee80211_band band, u32 *basic_rates)
 
void ieee80211_stop_device (struct ieee80211_local *local)
 
int ieee80211_reconfig (struct ieee80211_local *local)
 
void ieee80211_resume_disconnect (struct ieee80211_vif *vif)
 
 EXPORT_SYMBOL_GPL (ieee80211_resume_disconnect)
 
void ieee80211_recalc_smps (struct ieee80211_local *local)
 
size_t ieee80211_ie_split (const u8 *ies, size_t ielen, const u8 *ids, int n_ids, size_t offset)
 
size_t ieee80211_ie_split_vendor (const u8 *ies, size_t ielen, size_t offset)
 
void ieee80211_enable_rssi_reports (struct ieee80211_vif *vif, int rssi_min_thold, int rssi_max_thold)
 
 EXPORT_SYMBOL (ieee80211_enable_rssi_reports)
 
void ieee80211_disable_rssi_reports (struct ieee80211_vif *vif)
 
 EXPORT_SYMBOL (ieee80211_disable_rssi_reports)
 
u8ieee80211_ie_build_ht_cap (u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, u16 cap)
 
u8ieee80211_ie_build_vht_cap (u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, u32 cap)
 
u8ieee80211_ie_build_ht_oper (u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, struct ieee80211_channel *channel, enum nl80211_channel_type channel_type, u16 prot_mode)
 
enum nl80211_channel_type ieee80211_ht_oper_to_channel_type (struct ieee80211_ht_operation *ht_oper)
 
int ieee80211_add_srates_ie (struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, bool need_basic, enum ieee80211_band band)
 
int ieee80211_add_ext_srates_ie (struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, bool need_basic, enum ieee80211_band band)
 
int ieee80211_ave_rssi (struct ieee80211_vif *vif)
 
 EXPORT_SYMBOL_GPL (ieee80211_ave_rssi)
 

Variables

voidmac80211_wiphy_privid = &mac80211_wiphy_privid
 

Function Documentation

EXPORT_SYMBOL ( wiphy_to_ieee80211_hw  )
EXPORT_SYMBOL ( ieee80211_generic_frame_duration  )
EXPORT_SYMBOL ( ieee80211_rts_duration  )
EXPORT_SYMBOL ( ieee80211_ctstoself_duration  )
EXPORT_SYMBOL ( ieee80211_wake_queue  )
EXPORT_SYMBOL ( ieee80211_stop_queue  )
EXPORT_SYMBOL ( ieee80211_stop_queues  )
EXPORT_SYMBOL ( ieee80211_queue_stopped  )
EXPORT_SYMBOL ( ieee80211_wake_queues  )
EXPORT_SYMBOL ( ieee80211_queue_work  )
EXPORT_SYMBOL ( ieee80211_queue_delayed_work  )
EXPORT_SYMBOL ( ieee80211_enable_rssi_reports  )
EXPORT_SYMBOL ( ieee80211_disable_rssi_reports  )
EXPORT_SYMBOL_GPL ( ieee80211_iterate_active_interfaces  )
EXPORT_SYMBOL_GPL ( ieee80211_resume_disconnect  )
EXPORT_SYMBOL_GPL ( ieee80211_ave_rssi  )
int ieee80211_add_ext_srates_ie ( struct ieee80211_sub_if_data sdata,
struct sk_buff skb,
bool  need_basic,
enum ieee80211_band  band 
)

Definition at line 1933 of file util.c.

void ieee80211_add_pending_skb ( struct ieee80211_local local,
struct sk_buff skb 
)

Definition at line 400 of file util.c.

void ieee80211_add_pending_skbs_fn ( struct ieee80211_local local,
struct sk_buff_head skbs,
void(*)(void *data fn,
void data 
)

Definition at line 420 of file util.c.

int ieee80211_add_srates_ie ( struct ieee80211_sub_if_data sdata,
struct sk_buff skb,
bool  need_basic,
enum ieee80211_band  band 
)

Definition at line 1901 of file util.c.

int ieee80211_ave_rssi ( struct ieee80211_vif vif)

ieee80211_ave_rssi - report the average rssi for the specified interface

: the specified virtual interface

This function return the average rssi value for the requested interface. It assumes that the given vif is valid.

Definition at line 1968 of file util.c.

int ieee80211_build_preq_ies ( struct ieee80211_local local,
u8 buffer,
const u8 ie,
size_t  ie_len,
enum ieee80211_band  band,
u32  rate_mask,
u8  channel 
)

Definition at line 1077 of file util.c.

struct sk_buff* ieee80211_build_probe_req ( struct ieee80211_sub_if_data sdata,
u8 dst,
u32  ratemask,
struct ieee80211_channel chan,
const u8 ssid,
size_t  ssid_len,
const u8 ie,
size_t  ie_len,
bool  directed 
)
read

Definition at line 1181 of file util.c.

__le16 ieee80211_ctstoself_duration ( struct ieee80211_hw hw,
struct ieee80211_vif vif,
size_t  frame_len,
const struct ieee80211_tx_info frame_txctl 
)

ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame : pointer obtained from ieee80211_alloc_hw(). : &struct ieee80211_vif pointer from the add_interface callback. : the length of the frame that is going to be protected by the CTS-to-self. : &struct ieee80211_tx_info of the frame.

If the CTS-to-self is generated in firmware, but the host system must provide the duration field, the low-level driver uses this function to receive the duration field value in little-endian byteorder.

Definition at line 229 of file util.c.

void ieee80211_disable_rssi_reports ( struct ieee80211_vif vif)

Definition at line 1772 of file util.c.

void ieee80211_enable_rssi_reports ( struct ieee80211_vif vif,
int  rssi_min_thold,
int  rssi_max_thold 
)

Definition at line 1758 of file util.c.

int ieee80211_frame_duration ( enum ieee80211_band  band,
size_t  len,
int  rate,
int  erp,
int  short_preamble 
)

Definition at line 109 of file util.c.

__le16 ieee80211_generic_frame_duration ( struct ieee80211_hw hw,
struct ieee80211_vif vif,
enum ieee80211_band  band,
size_t  frame_len,
struct ieee80211_rate rate 
)

ieee80211_generic_frame_duration - Calculate the duration field for a frame : pointer obtained from ieee80211_alloc_hw(). : &struct ieee80211_vif pointer from the add_interface callback. : the band to calculate the frame duration on : the length of the frame. : the rate at which the frame is going to be transmitted.

Calculate the duration field of some generic frame, given its length and transmission rate (in 100kbps).

Definition at line 163 of file util.c.

u8* ieee80211_get_bssid ( struct ieee80211_hdr hdr,
size_t  len,
enum nl80211_iftype  type 
)

Definition at line 49 of file util.c.

enum nl80211_channel_type ieee80211_ht_oper_to_channel_type ( struct ieee80211_ht_operation ht_oper)

Definition at line 1877 of file util.c.

u8* ieee80211_ie_build_ht_cap ( u8 pos,
struct ieee80211_sta_ht_cap ht_cap,
u16  cap 
)

Definition at line 1780 of file util.c.

u8* ieee80211_ie_build_ht_oper ( u8 pos,
struct ieee80211_sta_ht_cap ht_cap,
struct ieee80211_channel channel,
enum nl80211_channel_type  channel_type,
u16  prot_mode 
)

Definition at line 1836 of file util.c.

u8* ieee80211_ie_build_vht_cap ( u8 pos,
struct ieee80211_sta_vht_cap vht_cap,
u32  cap 
)

Definition at line 1815 of file util.c.

size_t ieee80211_ie_split ( const u8 ies,
size_t  ielen,
const u8 ids,
int  n_ids,
size_t  offset 
)

ieee80211_ie_split - split an IE buffer according to ordering

: the IE buffer : the length of the IE buffer : an array with element IDs that are allowed before the split : the size of the element ID array : offset where to start splitting in the buffer

This function splits an IE buffer by updating the variable to point to the location where the buffer should be split.

It assumes that the given IE buffer is well-formed, this has to be guaranteed by the caller!

It also assumes that the IEs in the buffer are ordered correctly, if not the result of using this function will not be ordered correctly either, i.e. it does no reordering.

The function returns the offset where the next part of the buffer starts, which may be if the entire (remainder) of the buffer should be used.

Definition at line 1719 of file util.c.

size_t ieee80211_ie_split_vendor ( const u8 ies,
size_t  ielen,
size_t  offset 
)

Definition at line 1730 of file util.c.

void ieee80211_iterate_active_interfaces ( struct ieee80211_hw hw,
void(*)(void *data, u8 *mac, struct ieee80211_vif *vif)  iterator,
void data 
)

ieee80211_iterate_active_interfaces - iterate active interfaces

This function iterates over the interfaces associated with a given hardware that are currently active and calls the callback for them. This function allows the iterator function to sleep, when the iterator function is atomic can be used. Does not iterate over a new interface during add_interface()

: the hardware struct of which the interfaces should be iterated over : the iterator function to call : first argument of the iterator function

Definition at line 514 of file util.c.

void ieee80211_iterate_active_interfaces_atomic ( struct ieee80211_hw hw,
void(*)(void *data, u8 *mac, struct ieee80211_vif *vif)  iterator,
void data 
)

ieee80211_iterate_active_interfaces_atomic - iterate active interfaces

This function iterates over the interfaces associated with a given hardware that are currently active and calls the callback for them. This function requires the iterator callback function to be atomic, if that is not desired, use instead. Does not iterate over a new interface during add_interface()

: the hardware struct of which the interfaces should be iterated over : the iterator function to call, cannot sleep : first argument of the iterator function

Definition at line 547 of file util.c.

u32 ieee80211_mandatory_rates ( struct ieee80211_local local,
enum ieee80211_band  band 
)

Definition at line 972 of file util.c.

void ieee80211_propagate_queue_wake ( struct ieee80211_local local,
int  queue 
)

Definition at line 268 of file util.c.

void ieee80211_queue_delayed_work ( struct ieee80211_hw hw,
struct delayed_work dwork,
unsigned long  delay 
)

ieee80211_queue_delayed_work - add work onto the mac80211 workqueue

Drivers and mac80211 use this to queue delayed work onto the mac80211 workqueue.

: the hardware struct for the interface we are adding work for : delayable work to queue onto the mac80211 workqueue : number of jiffies to wait before queueing

Definition at line 606 of file util.c.

int ieee80211_queue_stopped ( struct ieee80211_hw hw,
int  queue 
)

ieee80211_queue_stopped - test status of the queue : pointer as obtained from ieee80211_alloc_hw(). : queue number (counted from zero).

Drivers should use this function instead of netif_stop_queue.

Definition at line 477 of file util.c.

void ieee80211_queue_work ( struct ieee80211_hw hw,
struct work_struct work 
)

ieee80211_queue_work - add work onto the mac80211 workqueue

Drivers and mac80211 use this to add work onto the mac80211 workqueue. This helper ensures drivers are not queueing work when they should not be.

: the hardware struct for the interface we are adding work for : the work we want to add onto the mac80211 workqueue

Definition at line 595 of file util.c.

void ieee80211_recalc_smps ( struct ieee80211_local local)

Definition at line 1639 of file util.c.

int ieee80211_reconfig ( struct ieee80211_local local)

Definition at line 1307 of file util.c.

void ieee80211_resume_disconnect ( struct ieee80211_vif vif)

ieee80211_resume_disconnect - disconnect from AP after resume

: &struct ieee80211_vif pointer from the add_interface callback.

Instructs mac80211 to disconnect from the AP after resume. Drivers can use this after WoWLAN if they know that the connection cannot be kept up, for example because keys were used while the device was asleep but the replay counters or similar cannot be retrieved from the device during resume.

Note that due to implementation issues, if the driver uses the reconfiguration functionality during resume the interface will still be added as associated first during resume and then disconnect normally later.

This function can only be called from the resume callback and the driver must not be holding any of its own locks while it calls this function, or at least not any locks it needs in the key configuration paths (if it supports HW crypto).

Definition at line 1593 of file util.c.

__le16 ieee80211_rts_duration ( struct ieee80211_hw hw,
struct ieee80211_vif vif,
size_t  frame_len,
const struct ieee80211_tx_info frame_txctl 
)

ieee80211_rts_duration - Get the duration field for an RTS frame : pointer obtained from ieee80211_alloc_hw(). : &struct ieee80211_vif pointer from the add_interface callback. : the length of the frame that is going to be protected by the RTS. : &struct ieee80211_tx_info of the frame.

If the RTS is generated in firmware, but the host system must provide the duration field, the low-level driver uses this function to receive the duration field value in little-endian byteorder.

Definition at line 189 of file util.c.

void ieee80211_send_auth ( struct ieee80211_sub_if_data sdata,
u16  transaction,
u16  auth_alg,
u8 extra,
size_t  extra_len,
const u8 da,
const u8 bssid,
const u8 key,
u8  key_len,
u8  key_idx 
)

Definition at line 998 of file util.c.

void ieee80211_send_deauth_disassoc ( struct ieee80211_sub_if_data sdata,
const u8 bssid,
u16  stype,
u16  reason,
bool  send_frame,
u8 frame_buf 
)

Definition at line 1038 of file util.c.

void ieee80211_send_probe_req ( struct ieee80211_sub_if_data sdata,
u8 dst,
const u8 ssid,
size_t  ssid_len,
const u8 ie,
size_t  ie_len,
u32  ratemask,
bool  directed,
bool  no_cck,
struct ieee80211_channel channel 
)

Definition at line 1233 of file util.c.

void ieee80211_set_wmm_default ( struct ieee80211_sub_if_data sdata,
bool  bss_notify 
)

Definition at line 858 of file util.c.

void ieee80211_sta_def_wmm_params ( struct ieee80211_sub_if_data sdata,
const size_t  supp_rates_len,
const u8 supp_rates 
)

Definition at line 951 of file util.c.

u32 ieee80211_sta_get_rates ( struct ieee80211_local local,
struct ieee802_11_elems elems,
enum ieee80211_band  band,
u32 basic_rates 
)

Definition at line 1252 of file util.c.

void ieee80211_stop_device ( struct ieee80211_local local)

Definition at line 1296 of file util.c.

void ieee80211_stop_queue ( struct ieee80211_hw hw,
int  queue 
)

ieee80211_stop_queue - stop specific queue : pointer as obtained from ieee80211_alloc_hw(). : queue number (counted from zero).

Drivers should use this function instead of netif_stop_queue.

Definition at line 393 of file util.c.

void ieee80211_stop_queue_by_reason ( struct ieee80211_hw hw,
int  queue,
enum queue_stop_reason  reason 
)

Definition at line 382 of file util.c.

void ieee80211_stop_queues ( struct ieee80211_hw hw)

ieee80211_stop_queues - stop all queues : pointer as obtained from ieee80211_alloc_hw().

Drivers should use this function instead of netif_stop_queue.

Definition at line 470 of file util.c.

void ieee80211_stop_queues_by_reason ( struct ieee80211_hw hw,
enum queue_stop_reason  reason 
)

Definition at line 455 of file util.c.

void ieee80211_tx_set_protected ( struct ieee80211_tx_data tx)

Definition at line 98 of file util.c.

void ieee80211_wake_queue ( struct ieee80211_hw hw,
int  queue 
)

ieee80211_wake_queue - wake specific queue : pointer as obtained from ieee80211_alloc_hw(). : queue number (counted from zero).

Drivers should use this function instead of netif_wake_queue.

Definition at line 339 of file util.c.

void ieee80211_wake_queue_by_reason ( struct ieee80211_hw hw,
int  queue,
enum queue_stop_reason  reason 
)

Definition at line 328 of file util.c.

void ieee80211_wake_queues ( struct ieee80211_hw hw)

ieee80211_wake_queues - wake all queues : pointer as obtained from ieee80211_alloc_hw().

Drivers should use this function instead of netif_wake_queue.

Definition at line 508 of file util.c.

void ieee80211_wake_queues_by_reason ( struct ieee80211_hw hw,
enum queue_stop_reason  reason 
)

Definition at line 493 of file util.c.

void ieee802_11_parse_elems ( u8 start,
size_t  len,
struct ieee802_11_elems elems 
)

Definition at line 852 of file util.c.

u32 ieee802_11_parse_elems_crc ( u8 start,
size_t  len,
struct ieee802_11_elems elems,
u64  filter,
u32  crc 
)

Definition at line 619 of file util.c.

struct ieee80211_hw* wiphy_to_ieee80211_hw ( struct wiphy wiphy)
read

wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy

: the &struct wiphy which we want to query

mac80211 drivers can use this to get to their respective &struct ieee80211_hw. Drivers wishing to get to their own private structure can then access it via hw->priv. Note that mac802111 drivers should not use wiphy_priv() to try to get their private driver structure as this is already used internally by mac80211.

Definition at line 39 of file util.c.

Variable Documentation

void* mac80211_wiphy_privid = &mac80211_wiphy_privid

Definition at line 37 of file util.c.