Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
ath.h File Reference
#include <linux/skbuff.h>
#include <linux/if_ether.h>
#include <linux/spinlock.h>
#include <net/mac80211.h>

Go to the source code of this file.

Data Structures

struct  ath_ani
 
struct  ath_cycle_counters
 
struct  reg_dmn_pair_mapping
 
struct  ath_regulatory
 
struct  ath_keyval
 
struct  ath_ops
 
struct  ath_common
 

Macros

#define ATH_KEYMAX   128 /* max key cache size we handle */
 
#define ath_emerg(common, fmt,...)   ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS__)
 
#define ath_alert(common, fmt,...)   ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS__)
 
#define ath_crit(common, fmt,...)   ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS__)
 
#define ath_err(common, fmt,...)   ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS__)
 
#define ath_warn(common, fmt,...)   ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS__)
 
#define ath_notice(common, fmt,...)   ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS__)
 
#define ath_info(common, fmt,...)   ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS__)
 
#define ATH_DBG_DEFAULT   (ATH_DBG_FATAL)
 
#define ath_dbg(common, dbg_mask, fmt,...)   _ath_dbg(common, ATH_DBG_##dbg_mask, fmt, ##__VA_ARGS__)
 
#define ATH_DBG_WARN(foo, arg...)   do {} while (0)
 
#define ATH_DBG_WARN_ON_ONCE(foo)
 

Enumerations

enum  ath_device_state { ATH_HW_UNAVAILABLE, ATH_HW_INITIALIZED }
 
enum  ath_bus_type { ATH_PCI, ATH_AHB, ATH_USB }
 
enum  ath_crypt_caps { ATH_CRYPT_CAP_CIPHER_AESCCM = BIT(0), ATH_CRYPT_CAP_MIC_COMBINED = BIT(1) }
 
enum  ath_cipher {
  ATH_CIPHER_WEP = 0, ATH_CIPHER_AES_OCB = 1, ATH_CIPHER_AES_CCM = 2, ATH_CIPHER_CKIP = 3,
  ATH_CIPHER_TKIP = 4, ATH_CIPHER_CLR = 5, ATH_CIPHER_MIC = 127
}
 
enum  ATH_DEBUG {
  ATH_DBG_RESET = 0x00000001, ATH_DBG_QUEUE = 0x00000002, ATH_DBG_EEPROM = 0x00000004, ATH_DBG_CALIBRATE = 0x00000008,
  ATH_DBG_INTERRUPT = 0x00000010, ATH_DBG_REGULATORY = 0x00000020, ATH_DBG_ANI = 0x00000040, ATH_DBG_XMIT = 0x00000080,
  ATH_DBG_BEACON = 0x00000100, ATH_DBG_CONFIG = 0x00000200, ATH_DBG_FATAL = 0x00000400, ATH_DBG_PS = 0x00000800,
  ATH_DBG_HWTIMER = 0x00001000, ATH_DBG_BTCOEX = 0x00002000, ATH_DBG_WMI = 0x00004000, ATH_DBG_BSTUCK = 0x00008000,
  ATH_DBG_MCI = 0x00010000, ATH_DBG_DFS = 0x00020000, ATH_DBG_WOW = 0x00040000, ATH_DBG_ANY = 0xffffffff
}
 

Functions

struct sk_buffath_rxbuf_alloc (struct ath_common *common, u32 len, gfp_t gfp_mask)
 
void ath_hw_setbssidmask (struct ath_common *common)
 
void ath_key_delete (struct ath_common *common, struct ieee80211_key_conf *key)
 
int ath_key_config (struct ath_common *common, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_key_conf *key)
 
bool ath_hw_keyreset (struct ath_common *common, u16 entry)
 
void ath_hw_cycle_counters_update (struct ath_common *common)
 
int32_t ath_hw_get_listen_time (struct ath_common *common)
 
 __printf (3, 4) void ath_printk(const char *level
 

Variables

struct ath_commoncommon
 
struct ath_common const charfmt
 

Macro Definition Documentation

#define ath_alert (   common,
  fmt,
  ... 
)    ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS__)

Definition at line 185 of file ath.h.

#define ath_crit (   common,
  fmt,
  ... 
)    ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS__)

Definition at line 187 of file ath.h.

#define ath_dbg (   common,
  dbg_mask,
  fmt,
  ... 
)    _ath_dbg(common, ATH_DBG_##dbg_mask, fmt, ##__VA_ARGS__)
#define ATH_DBG_DEFAULT   (ATH_DBG_FATAL)

Definition at line 252 of file ath.h.

#define ATH_DBG_WARN (   foo,
  arg... 
)    do {} while (0)
#define ATH_DBG_WARN_ON_ONCE (   foo)
Value:
({ \
int __ret_warn_once = !!(foo); \
unlikely(__ret_warn_once); \
})
#define ath_emerg (   common,
  fmt,
  ... 
)    ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS__)

Definition at line 183 of file ath.h.

#define ath_err (   common,
  fmt,
  ... 
)    ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS__)

Definition at line 189 of file ath.h.

#define ath_info (   common,
  fmt,
  ... 
)    ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS__)

Definition at line 195 of file ath.h.

#define ATH_KEYMAX   128 /* max key cache size we handle */

Definition at line 33 of file ath.h.

#define ath_notice (   common,
  fmt,
  ... 
)    ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS__)

Definition at line 193 of file ath.h.

#define ath_warn (   common,
  fmt,
  ... 
)    ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS__)

Definition at line 191 of file ath.h.

Enumeration Type Documentation

Enumerator:
ATH_PCI 
ATH_AHB 
ATH_USB 

Definition at line 58 of file ath.h.

enum ath_cipher
Enumerator:
ATH_CIPHER_WEP 
ATH_CIPHER_AES_OCB 
ATH_CIPHER_AES_CCM 
ATH_CIPHER_CKIP 
ATH_CIPHER_TKIP 
ATH_CIPHER_CLR 
ATH_CIPHER_MIC 

Definition at line 95 of file ath.h.

Enumerator:
ATH_CRYPT_CAP_CIPHER_AESCCM 
ATH_CRYPT_CAP_MIC_COMBINED 

Definition at line 79 of file ath.h.

enum ATH_DEBUG

enum ath_debug_level - atheros wireless debug level

: reset processing : hardware queue management : eeprom processing : periodic calibration : interrupt processing : regulatory processing : adaptive noise immunitive processing : basic xmit operation : beacon handling : configuration of the hardware : fatal errors, this is the default, DBG_DEFAULT : power save processing : hardware timer handling : bluetooth coexistance : stuck beacons : Message Coexistence Interface, a private protocol used exclusively for WLAN-BT coexistence starting from AR9462. : radar datection : Wake on Wireless : enable all debugging

The debug level is used to control the amount and type of debugging output we want to see. Each driver has its own method for enabling debugging and modifying debug level states – but this is typically done through a module parameter 'debug' along with a respective 'debug' debugfs file entry.

Enumerator:
ATH_DBG_RESET 
ATH_DBG_QUEUE 
ATH_DBG_EEPROM 
ATH_DBG_CALIBRATE 
ATH_DBG_INTERRUPT 
ATH_DBG_REGULATORY 
ATH_DBG_ANI 
ATH_DBG_XMIT 
ATH_DBG_BEACON 
ATH_DBG_CONFIG 
ATH_DBG_FATAL 
ATH_DBG_PS 
ATH_DBG_HWTIMER 
ATH_DBG_BTCOEX 
ATH_DBG_WMI 
ATH_DBG_BSTUCK 
ATH_DBG_MCI 
ATH_DBG_DFS 
ATH_DBG_WOW 
ATH_DBG_ANY 

Definition at line 229 of file ath.h.

Enumerator:
ATH_HW_UNAVAILABLE 
ATH_HW_INITIALIZED 

Definition at line 53 of file ath.h.

Function Documentation

__printf ( ,
 
) const
void ath_hw_cycle_counters_update ( struct ath_common common)

ath_hw_cycle_counters_update - common function to update cycle counters

: the ath_common struct for the device.

This function is used to update all cycle counters in one place. It has to be called while holding common->cc_lock!

Definition at line 136 of file hw.c.

int32_t ath_hw_get_listen_time ( struct ath_common common)

Definition at line 172 of file hw.c.

bool ath_hw_keyreset ( struct ath_common common,
u16  entry 
)

Definition at line 42 of file key.c.

void ath_hw_setbssidmask ( struct ath_common common)

ath_hw_set_bssid_mask - filter out bssids we listen

: the ath_common struct for the device.

BSSID masking is a method used by AR5212 and newer hardware to inform PCU which bits of the interface's MAC address should be looked at when trying to decide which packets to ACK. In station mode and AP mode with a single BSS every bit matters since we lock to only one BSS. In AP mode with multiple BSSes (virtual interfaces) not every bit matters because hw must accept frames for all BSSes and so we tweak some bits of our mac address in order to have multiple BSSes.

NOTE: This is a simple filter and does not filter out all relevant frames. Some frames that are not for us might get ACKed from us by PCU because they just match the mask.

When handling multiple BSSes you can get the BSSID mask by computing the set of ~ ( MAC XOR BSSID ) for all bssids we handle.

When you do this you are essentially computing the common bits of all your BSSes. Later it is assumed the hardware will "and" (&) the BSSID mask with the MAC address to obtain the relevant bits and compare the result with (frame's BSSID & mask) to see if they match.

Simple example: on your card you have have two BSSes you have created with BSSID-01 and BSSID-02. Lets assume BSSID-01 will not use the MAC address. There is another BSSID-03 but you are not part of it. For simplicity's sake, assuming only 4 bits for a mac address and for BSSIDs you can then have:

             \

MAC: 0001 | BSSID-01: 0100 | –> Belongs to us BSSID-02: 1001 |

/

BSSID-03: 0110 | –> External

Our bssid_mask would then be:

        On loop iteration for BSSID-01:
        ~(0001 ^ 0100)  -> ~(0101)
                        ->   1010
        bssid_mask      =    1010

        On loop iteration for BSSID-02:
        bssid_mask &= ~(0001   ^   1001)
        bssid_mask =   (1010)  & ~(0001 ^ 1001)
        bssid_mask =   (1010)  & ~(1000)
        bssid_mask =   (1010)  &  (0111)
        bssid_mask =   0010

A bssid_mask of 0010 means "only pay attention to the second least significant bit". This is because its the only bit common amongst the MAC and all BSSIDs we support. To findout what the real common bit is we can simply "&" the bssid_mask now with any BSSID we have or our MAC address (we assume the hardware uses the MAC address).

Now, suppose there's an incoming frame for BSSID-03:

IFRAME-01: 0110

An easy eye-inspeciton of this already should tell you that this frame will not pass our check. This is because the bssid_mask tells the hardware to only look at the second least significant bit and the common bit amongst the MAC and BSSIDs is 0, this frame has the 2nd LSB as 1, which does not match 0.

So with IFRAME-01 we assume the hardware will do:

allow = (IFRAME-01 & bssid_mask) == (bssid_mask & MAC) ? 1 : 0;

–> allow = (0110 & 0010) == (0010 & 0001) ? 1 : 0; –> allow = (0010) == 0000 ? 1 : 0; –> allow = 0

Lets now test a frame that should work:

IFRAME-02: 0001 (we should allow)

allow = (IFRAME-02 & bssid_mask) == (bssid_mask & MAC) ? 1 : 0;

–> allow = (0001 & 0010) == (0010 & 0001) ? 1 :0; –> allow = (0000) == (0000) –> allow = 1

Other examples:

IFRAME-03: 0100 –> allowed IFRAME-04: 1001 –> allowed IFRAME-05: 1101 –> allowed but its not for us!!!

Definition at line 118 of file hw.c.

int ath_key_config ( struct ath_common common,
struct ieee80211_vif vif,
struct ieee80211_sta sta,
struct ieee80211_key_conf key 
)

Definition at line 470 of file key.c.

void ath_key_delete ( struct ath_common common,
struct ieee80211_key_conf key 
)

Definition at line 581 of file key.c.

struct sk_buff* ath_rxbuf_alloc ( struct ath_common common,
u32  len,
gfp_t  gfp_mask 
)
read

Definition at line 28 of file main.c.

Variable Documentation

Definition at line 180 of file ath.h.

enum ATH_DEBUG dbg_mask const char* fmt

Definition at line 180 of file ath.h.