Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
pcu.c File Reference
#include <asm/unaligned.h>
#include "ath5k.h"
#include "reg.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define ATH5K_MAX_TSF_READ   10
 

Functions

int ath5k_hw_get_frame_duration (struct ath5k_hw *ah, enum ieee80211_band band, int len, struct ieee80211_rate *rate, bool shortpre)
 
unsigned int ath5k_hw_get_default_slottime (struct ath5k_hw *ah)
 
unsigned int ath5k_hw_get_default_sifs (struct ath5k_hw *ah)
 
void ath5k_hw_update_mib_counters (struct ath5k_hw *ah)
 
int ath5k_hw_set_lladdr (struct ath5k_hw *ah, const u8 *mac)
 
void ath5k_hw_set_bssid (struct ath5k_hw *ah)
 
void ath5k_hw_set_bssid_mask (struct ath5k_hw *ah, const u8 *mask)
 
void ath5k_hw_set_mcast_filter (struct ath5k_hw *ah, u32 filter0, u32 filter1)
 
u32 ath5k_hw_get_rx_filter (struct ath5k_hw *ah)
 
void ath5k_hw_set_rx_filter (struct ath5k_hw *ah, u32 filter)
 
u64 ath5k_hw_get_tsf64 (struct ath5k_hw *ah)
 
void ath5k_hw_set_tsf64 (struct ath5k_hw *ah, u64 tsf64)
 
void ath5k_hw_reset_tsf (struct ath5k_hw *ah)
 
void ath5k_hw_init_beacon_timers (struct ath5k_hw *ah, u32 next_beacon, u32 interval)
 
bool ath5k_hw_check_beacon_timers (struct ath5k_hw *ah, int intval)
 
void ath5k_hw_set_coverage_class (struct ath5k_hw *ah, u8 coverage_class)
 
void ath5k_hw_start_rx_pcu (struct ath5k_hw *ah)
 
void ath5k_hw_stop_rx_pcu (struct ath5k_hw *ah)
 
int ath5k_hw_set_opmode (struct ath5k_hw *ah, enum nl80211_iftype op_mode)
 
void ath5k_hw_pcu_init (struct ath5k_hw *ah, enum nl80211_iftype op_mode)
 

Macro Definition Documentation

#define ATH5K_MAX_TSF_READ   10

Definition at line 550 of file pcu.c.

Function Documentation

bool ath5k_hw_check_beacon_timers ( struct ath5k_hw ah,
int  intval 
)

ath5k_hw_check_beacon_timers() - Check if the beacon timers are correct : The &struct ath5k_hw : beacon interval

This is a workaround for IBSS mode

The need for this function arises from the fact that we have 4 separate HW timer registers (TIMER0 - TIMER3), which are closely related to the next beacon target time (NBTT), and that the HW updates these timers separately based on the current TSF value. The hardware increments each timer by the beacon interval, when the local TSF converted to TU is equal to the value stored in the timer.

The reception of a beacon with the same BSSID can update the local HW TSF at any time - this is something we can't avoid. If the TSF jumps to a time which is later than the time stored in a timer, this timer will not be updated until the TSF in TU wraps around at 16 bit (the size of the timers) and reaches the time which is stored in the timer.

The problem is that these timers are closely related to TIMER0 (NBTT) and that they define a time "window". When the TSF jumps between two timers (e.g. ATIM and NBTT), the one in the past will be left behind (not updated), while the one in the future will be updated every beacon interval. This causes the window to get larger, until the TSF wraps around as described above and the timer which was left behind gets updated again. But - because the beacon interval is usually not an exact divisor of the size of the timers (16 bit), an unwanted "window" between these timers has developed!

This is especially important with the ATIM window, because during the ATIM window only ATIM frames and no data frames are allowed to be sent, which creates transmission pauses after each beacon. This symptom has been described as "ramping ping" because ping times increase linearly for some time and then drop down again. A wrong window on the DMA beacon timer has the same effect, so we check for these two conditions.

Returns true if O.K.

Definition at line 793 of file pcu.c.

unsigned int ath5k_hw_get_default_sifs ( struct ath5k_hw ah)

ath5k_hw_get_default_sifs() - Get the default SIFS for current mode : The &struct ath5k_hw

Definition at line 204 of file pcu.c.

unsigned int ath5k_hw_get_default_slottime ( struct ath5k_hw ah)

ath5k_hw_get_default_slottime() - Get the default slot time for current mode : The &struct ath5k_hw

Definition at line 173 of file pcu.c.

int ath5k_hw_get_frame_duration ( struct ath5k_hw ah,
enum ieee80211_band  band,
int  len,
struct ieee80211_rate rate,
bool  shortpre 
)

Definition at line 113 of file pcu.c.

u32 ath5k_hw_get_rx_filter ( struct ath5k_hw ah)

ath5k_hw_get_rx_filter() - Get current rx filter : The &struct ath5k_hw

Returns the RX filter by reading rx filter and phy error filter registers. RX filter is used to set the allowed frame types that PCU will accept and pass to the driver. For a list of frame types check out reg.h.

Definition at line 480 of file pcu.c.

u64 ath5k_hw_get_tsf64 ( struct ath5k_hw ah)

ath5k_hw_get_tsf64() - Get the full 64bit TSF : The &struct ath5k_hw

Returns the current TSF

Definition at line 559 of file pcu.c.

void ath5k_hw_init_beacon_timers ( struct ath5k_hw ah,
u32  next_beacon,
u32  interval 
)

ath5k_hw_init_beacon_timers() - Initialize beacon timers : The &struct ath5k_hw : Next TBTT : Current beacon interval

This function is used to initialize beacon timers based on current operation mode and settings.

Definition at line 645 of file pcu.c.

void ath5k_hw_pcu_init ( struct ath5k_hw ah,
enum nl80211_iftype  op_mode 
)

ath5k_hw_pcu_init() - Initialize PCU : The &struct ath5k_hw : One of enum nl80211_iftype : One of enum ath5k_driver_mode

This function is used to initialize PCU by setting current operation mode and various other settings.

Definition at line 950 of file pcu.c.

void ath5k_hw_reset_tsf ( struct ath5k_hw ah)

ath5k_hw_reset_tsf() - Force a TSF reset : The &struct ath5k_hw

Forces a TSF reset on PCU

Definition at line 619 of file pcu.c.

void ath5k_hw_set_bssid ( struct ath5k_hw ah)

ath5k_hw_set_bssid() - Set current BSSID on hw : The &struct ath5k_hw

Sets the current BSSID and BSSID mask we have from the common struct into the hardware

Definition at line 396 of file pcu.c.

void ath5k_hw_set_bssid_mask ( struct ath5k_hw ah,
const u8 mask 
)

ath5k_hw_set_bssid_mask() - Filter out bssids we listen : The &struct ath5k_hw : The BSSID mask to set (array of octets)

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.

For more information check out ../hw.c of the common ath module.

Definition at line 445 of file pcu.c.

void ath5k_hw_set_coverage_class ( struct ath5k_hw ah,
u8  coverage_class 
)

ath5k_hw_set_coverage_class() - Set IEEE 802.11 coverage class : The &struct ath5k_hw : IEEE 802.11 coverage class number

Sets IFS intervals and ACK/CTS timeouts for given coverage class.

Definition at line 820 of file pcu.c.

int ath5k_hw_set_lladdr ( struct ath5k_hw ah,
const u8 mac 
)

ath5k_hw_set_lladdr() - Set station id : The &struct ath5k_hw : The card's mac address (array of octets)

Set station id on hw using the provided mac address

Definition at line 368 of file pcu.c.

void ath5k_hw_set_mcast_filter ( struct ath5k_hw ah,
u32  filter0,
u32  filter1 
)

ath5k_hw_set_mcast_filter() - Set multicast filter : The &struct ath5k_hw : Lower 32bits of muticast filter : Higher 16bits of multicast filter

Definition at line 463 of file pcu.c.

int ath5k_hw_set_opmode ( struct ath5k_hw ah,
enum nl80211_iftype  op_mode 
)

ath5k_hw_set_opmode() - Set PCU operating mode : The &struct ath5k_hw : One of enum nl80211_iftype

Configure PCU for the various operating modes (AP/STA etc)

Definition at line 873 of file pcu.c.

void ath5k_hw_set_rx_filter ( struct ath5k_hw ah,
u32  filter 
)

ath5k_hw_set_rx_filter() - Set rx filter : The &struct ath5k_hw : RX filter mask (see reg.h)

Sets RX filter register and also handles PHY error filter register on 5212 and newer chips so that we have proper PHY error reporting.

Definition at line 509 of file pcu.c.

void ath5k_hw_set_tsf64 ( struct ath5k_hw ah,
u64  tsf64 
)

ath5k_hw_set_tsf64() - Set a new 64bit TSF : The &struct ath5k_hw : The new 64bit TSF

Sets the new TSF

Definition at line 606 of file pcu.c.

void ath5k_hw_start_rx_pcu ( struct ath5k_hw ah)

ath5k_hw_start_rx_pcu() - Start RX engine : The &struct ath5k_hw

Starts RX engine on PCU so that hw can process RXed frames (ACK etc).

NOTE: RX DMA should be already enabled using ath5k_hw_start_rx_dma

Definition at line 848 of file pcu.c.

void ath5k_hw_stop_rx_pcu ( struct ath5k_hw ah)

at5k_hw_stop_rx_pcu() - Stop RX engine : The &struct ath5k_hw

Stops RX engine on PCU

Definition at line 860 of file pcu.c.

void ath5k_hw_update_mib_counters ( struct ath5k_hw ah)

ath5k_hw_update_mib_counters() - Update MIB counters (mac layer statistics) : The &struct ath5k_hw

Reads MIB counters from PCU and updates sw statistics. Is called after a MIB interrupt, because one of these counters might have reached their maximum and triggered the MIB interrupt, to let us read and clear the counter.

NOTE: Is called in interrupt context!

Definition at line 241 of file pcu.c.