0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include <net/mac80211.h>
0018
0019 #include "../ath.h"
0020
0021 #include "hw.h"
0022 #include "hw-ops.h"
0023
0024 #include "common-init.h"
0025 #include "common-beacon.h"
0026 #include "common-debug.h"
0027 #include "common-spectral.h"
0028
0029
0030
0031 #define WME_BA_BMP_SIZE 64
0032 #define WME_MAX_BA WME_BA_BMP_SIZE
0033 #define ATH_TID_MAX_BUFS (2 * WME_MAX_BA)
0034
0035 #define ATH_RSSI_DUMMY_MARKER 127
0036 #define ATH_RSSI_LPF_LEN 10
0037 #define RSSI_LPF_THRESHOLD -20
0038 #define ATH_RSSI_EP_MULTIPLIER (1<<7)
0039 #define ATH_EP_MUL(x, mul) ((x) * (mul))
0040 #define ATH_RSSI_IN(x) (ATH_EP_MUL((x), ATH_RSSI_EP_MULTIPLIER))
0041 #define ATH_LPF_RSSI(x, y, len) \
0042 ((x != ATH_RSSI_DUMMY_MARKER) ? (((x) * ((len) - 1) + (y)) / (len)) : (y))
0043 #define ATH_RSSI_LPF(x, y) do { \
0044 if ((y) >= RSSI_LPF_THRESHOLD) \
0045 x = ATH_LPF_RSSI((x), ATH_RSSI_IN((y)), ATH_RSSI_LPF_LEN); \
0046 } while (0)
0047 #define ATH_EP_RND(x, mul) \
0048 (((x) + ((mul)/2)) / (mul))
0049
0050 #define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024)
0051
0052 struct ath_beacon_config {
0053 struct ieee80211_vif *main_vif;
0054 int beacon_interval;
0055 u16 dtim_period;
0056 u16 bmiss_timeout;
0057 u8 dtim_count;
0058 u8 enable_beacon;
0059 bool ibss_creator;
0060 u32 nexttbtt;
0061 u32 intval;
0062 };
0063
0064 bool ath9k_cmn_rx_accept(struct ath_common *common,
0065 struct ieee80211_hdr *hdr,
0066 struct ieee80211_rx_status *rxs,
0067 struct ath_rx_status *rx_stats,
0068 bool *decrypt_error,
0069 unsigned int rxfilter);
0070 void ath9k_cmn_rx_skb_postprocess(struct ath_common *common,
0071 struct sk_buff *skb,
0072 struct ath_rx_status *rx_stats,
0073 struct ieee80211_rx_status *rxs,
0074 bool decrypt_error);
0075 int ath9k_cmn_process_rate(struct ath_common *common,
0076 struct ieee80211_hw *hw,
0077 struct ath_rx_status *rx_stats,
0078 struct ieee80211_rx_status *rxs);
0079 void ath9k_cmn_process_rssi(struct ath_common *common,
0080 struct ieee80211_hw *hw,
0081 struct ath_rx_status *rx_stats,
0082 struct ieee80211_rx_status *rxs);
0083 int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb);
0084 struct ath9k_channel *ath9k_cmn_get_channel(struct ieee80211_hw *hw,
0085 struct ath_hw *ah,
0086 struct cfg80211_chan_def *chandef);
0087 int ath9k_cmn_count_streams(unsigned int chainmask, int max);
0088 void ath9k_cmn_btcoex_bt_stomp(struct ath_common *common,
0089 enum ath_stomp_type stomp_type);
0090 void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow,
0091 u16 new_txpow, u16 *txpower);
0092 void ath9k_cmn_init_crypto(struct ath_hw *ah);