2010-03-17 16:55:25 +08:00
|
|
|
/*
|
2011-05-17 16:06:18 +08:00
|
|
|
* Copyright (c) 2010-2011 Atheros Communications Inc.
|
2010-03-17 16:55:25 +08:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HTC_H
|
|
|
|
#define HTC_H
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/usb.h>
|
|
|
|
#include <linux/firmware.h>
|
|
|
|
#include <linux/skbuff.h>
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <linux/leds.h>
|
2010-03-30 01:52:38 +08:00
|
|
|
#include <linux/slab.h>
|
2010-03-17 16:55:25 +08:00
|
|
|
#include <net/mac80211.h>
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "htc_hst.h"
|
|
|
|
#include "hif_usb.h"
|
|
|
|
#include "wmi.h"
|
|
|
|
|
|
|
|
#define ATH_STA_SHORT_CALINTERVAL 1000 /* 1 second */
|
2011-02-21 10:19:38 +08:00
|
|
|
#define ATH_AP_SHORT_CALINTERVAL 100 /* 100 ms */
|
2010-03-17 16:55:25 +08:00
|
|
|
#define ATH_ANI_POLLINTERVAL 100 /* 100 ms */
|
|
|
|
#define ATH_LONG_CALINTERVAL 30000 /* 30 seconds */
|
|
|
|
#define ATH_RESTART_CALINTERVAL 1200000 /* 20 minutes */
|
|
|
|
|
|
|
|
#define ATH_DEFAULT_BMISS_LIMIT 10
|
|
|
|
#define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024)
|
|
|
|
#define TSF_TO_TU(_h, _l) \
|
|
|
|
((((u32)(_h)) << 22) | (((u32)(_l)) >> 10))
|
|
|
|
|
|
|
|
extern struct ieee80211_ops ath9k_htc_ops;
|
2010-03-24 16:12:13 +08:00
|
|
|
extern int htc_modparam_nohwcrypt;
|
2010-03-17 16:55:25 +08:00
|
|
|
|
|
|
|
enum htc_phymode {
|
2011-05-17 15:11:20 +08:00
|
|
|
HTC_MODE_11NA = 0,
|
|
|
|
HTC_MODE_11NG = 1
|
2010-03-17 16:55:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
enum htc_opmode {
|
|
|
|
HTC_M_STA = 1,
|
|
|
|
HTC_M_IBSS = 0,
|
|
|
|
HTC_M_AHDEMO = 3,
|
|
|
|
HTC_M_HOSTAP = 6,
|
|
|
|
HTC_M_MONITOR = 8,
|
|
|
|
HTC_M_WDS = 2
|
|
|
|
};
|
|
|
|
|
2011-04-13 13:54:31 +08:00
|
|
|
#define ATH9K_HTC_AMPDU 1
|
2010-03-17 16:55:25 +08:00
|
|
|
#define ATH9K_HTC_NORMAL 2
|
2011-04-13 13:54:31 +08:00
|
|
|
#define ATH9K_HTC_BEACON 3
|
|
|
|
#define ATH9K_HTC_MGMT 4
|
2010-03-17 16:55:25 +08:00
|
|
|
|
|
|
|
#define ATH9K_HTC_TX_CTSONLY 0x1
|
|
|
|
#define ATH9K_HTC_TX_RTSCTS 0x2
|
|
|
|
|
|
|
|
struct tx_frame_hdr {
|
|
|
|
u8 data_type;
|
|
|
|
u8 node_idx;
|
|
|
|
u8 vif_idx;
|
|
|
|
u8 tidno;
|
2011-01-16 13:26:37 +08:00
|
|
|
__be32 flags; /* ATH9K_HTC_TX_* */
|
2010-03-17 16:55:25 +08:00
|
|
|
u8 key_type;
|
|
|
|
u8 keyix;
|
2011-04-13 13:55:12 +08:00
|
|
|
u8 cookie;
|
|
|
|
u8 pad;
|
2010-03-17 16:55:25 +08:00
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct tx_mgmt_hdr {
|
|
|
|
u8 node_idx;
|
|
|
|
u8 vif_idx;
|
|
|
|
u8 tidno;
|
|
|
|
u8 flags;
|
|
|
|
u8 key_type;
|
|
|
|
u8 keyix;
|
2011-04-13 13:55:12 +08:00
|
|
|
u8 cookie;
|
|
|
|
u8 pad;
|
2010-03-17 16:55:25 +08:00
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct tx_beacon_header {
|
|
|
|
u8 vif_index;
|
2011-04-13 13:52:59 +08:00
|
|
|
u8 len_changed;
|
2010-03-17 16:55:25 +08:00
|
|
|
u16 rev;
|
|
|
|
} __packed;
|
|
|
|
|
2011-04-20 17:03:28 +08:00
|
|
|
#define MAX_TX_AMPDU_SUBFRAMES_9271 17
|
|
|
|
#define MAX_TX_AMPDU_SUBFRAMES_7010 22
|
|
|
|
|
2010-03-17 16:55:25 +08:00
|
|
|
struct ath9k_htc_cap_target {
|
2011-04-20 17:03:28 +08:00
|
|
|
__be32 ampdu_limit;
|
2010-03-17 16:55:25 +08:00
|
|
|
u8 ampdu_subframes;
|
2011-04-20 17:03:28 +08:00
|
|
|
u8 enable_coex;
|
2010-03-17 16:55:25 +08:00
|
|
|
u8 tx_chainmask;
|
2011-04-13 13:54:49 +08:00
|
|
|
u8 pad;
|
2010-03-17 16:55:25 +08:00
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct ath9k_htc_target_vif {
|
|
|
|
u8 index;
|
2011-04-13 13:54:43 +08:00
|
|
|
u8 opmode;
|
2010-03-17 16:55:25 +08:00
|
|
|
u8 myaddr[ETH_ALEN];
|
|
|
|
u8 ath_cap;
|
2011-04-13 13:54:43 +08:00
|
|
|
__be16 rtsthreshold;
|
|
|
|
u8 pad;
|
2010-03-17 16:55:25 +08:00
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct ath9k_htc_target_sta {
|
|
|
|
u8 macaddr[ETH_ALEN];
|
|
|
|
u8 bssid[ETH_ALEN];
|
|
|
|
u8 sta_index;
|
|
|
|
u8 vif_index;
|
|
|
|
u8 is_vif_sta;
|
2011-05-17 15:11:31 +08:00
|
|
|
__be16 flags;
|
2011-04-13 13:54:37 +08:00
|
|
|
__be16 htcap;
|
|
|
|
__be16 maxampdu;
|
|
|
|
u8 pad;
|
2010-03-17 16:55:25 +08:00
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct ath9k_htc_target_aggr {
|
|
|
|
u8 sta_index;
|
|
|
|
u8 tidno;
|
|
|
|
u8 aggr_enable;
|
|
|
|
u8 padding;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
#define ATH_HTC_RATE_MAX 30
|
|
|
|
|
|
|
|
#define WLAN_RC_DS_FLAG 0x01
|
|
|
|
#define WLAN_RC_40_FLAG 0x02
|
|
|
|
#define WLAN_RC_SGI_FLAG 0x04
|
|
|
|
#define WLAN_RC_HT_FLAG 0x08
|
|
|
|
|
|
|
|
struct ath9k_htc_rateset {
|
|
|
|
u8 rs_nrates;
|
|
|
|
u8 rs_rates[ATH_HTC_RATE_MAX];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ath9k_htc_rate {
|
|
|
|
struct ath9k_htc_rateset legacy_rates;
|
|
|
|
struct ath9k_htc_rateset ht_rates;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct ath9k_htc_target_rate {
|
|
|
|
u8 sta_index;
|
|
|
|
u8 isnew;
|
2010-04-16 14:24:03 +08:00
|
|
|
__be32 capflags;
|
2010-03-17 16:55:25 +08:00
|
|
|
struct ath9k_htc_rate rates;
|
|
|
|
};
|
|
|
|
|
2011-04-27 19:43:23 +08:00
|
|
|
struct ath9k_htc_target_rate_mask {
|
|
|
|
u8 vif_index;
|
|
|
|
u8 band;
|
|
|
|
__be32 mask;
|
|
|
|
u16 pad;
|
|
|
|
} __packed;
|
|
|
|
|
2011-04-13 13:56:58 +08:00
|
|
|
struct ath9k_htc_target_int_stats {
|
|
|
|
__be32 rx;
|
|
|
|
__be32 rxorn;
|
|
|
|
__be32 rxeol;
|
|
|
|
__be32 txurn;
|
|
|
|
__be32 txto;
|
|
|
|
__be32 cst;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct ath9k_htc_target_tx_stats {
|
|
|
|
__be32 xretries;
|
|
|
|
__be32 fifoerr;
|
|
|
|
__be32 filtered;
|
|
|
|
__be32 timer_exp;
|
|
|
|
__be32 shortretries;
|
|
|
|
__be32 longretries;
|
|
|
|
__be32 qnull;
|
|
|
|
__be32 encap_fail;
|
|
|
|
__be32 nobuf;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct ath9k_htc_target_rx_stats {
|
|
|
|
__be32 nobuf;
|
|
|
|
__be32 host_send;
|
|
|
|
__be32 host_done;
|
2010-03-17 16:55:25 +08:00
|
|
|
} __packed;
|
|
|
|
|
2011-02-21 10:18:00 +08:00
|
|
|
#define ATH9K_HTC_MAX_VIF 2
|
2011-02-21 10:19:23 +08:00
|
|
|
#define ATH9K_HTC_MAX_BCN_VIF 2
|
2011-02-21 10:18:00 +08:00
|
|
|
|
2011-02-21 10:19:15 +08:00
|
|
|
#define INC_VIF(_priv, _type) do { \
|
|
|
|
switch (_type) { \
|
|
|
|
case NL80211_IFTYPE_STATION: \
|
|
|
|
_priv->num_sta_vif++; \
|
|
|
|
break; \
|
|
|
|
case NL80211_IFTYPE_ADHOC: \
|
|
|
|
_priv->num_ibss_vif++; \
|
|
|
|
break; \
|
2011-02-21 10:19:23 +08:00
|
|
|
case NL80211_IFTYPE_AP: \
|
|
|
|
_priv->num_ap_vif++; \
|
|
|
|
break; \
|
2011-02-21 10:19:15 +08:00
|
|
|
default: \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define DEC_VIF(_priv, _type) do { \
|
|
|
|
switch (_type) { \
|
|
|
|
case NL80211_IFTYPE_STATION: \
|
|
|
|
_priv->num_sta_vif--; \
|
|
|
|
break; \
|
|
|
|
case NL80211_IFTYPE_ADHOC: \
|
|
|
|
_priv->num_ibss_vif--; \
|
|
|
|
break; \
|
2011-02-21 10:19:23 +08:00
|
|
|
case NL80211_IFTYPE_AP: \
|
|
|
|
_priv->num_ap_vif--; \
|
|
|
|
break; \
|
2011-02-21 10:19:15 +08:00
|
|
|
default: \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2010-03-17 16:55:25 +08:00
|
|
|
struct ath9k_htc_vif {
|
|
|
|
u8 index;
|
2011-02-21 10:18:53 +08:00
|
|
|
u16 seq_no;
|
2011-02-27 11:50:40 +08:00
|
|
|
bool beacon_configured;
|
2011-04-13 13:53:08 +08:00
|
|
|
int bslot;
|
2011-04-13 13:53:17 +08:00
|
|
|
__le64 tsfadjust;
|
2010-03-17 16:55:25 +08:00
|
|
|
};
|
|
|
|
|
2011-02-21 10:18:46 +08:00
|
|
|
struct ath9k_vif_iter_data {
|
|
|
|
const u8 *hw_macaddr;
|
|
|
|
u8 mask[ETH_ALEN];
|
|
|
|
};
|
|
|
|
|
2010-03-17 16:55:25 +08:00
|
|
|
#define ATH9K_HTC_MAX_STA 8
|
|
|
|
#define ATH9K_HTC_MAX_TID 8
|
|
|
|
|
|
|
|
enum tid_aggr_state {
|
|
|
|
AGGR_STOP = 0,
|
|
|
|
AGGR_PROGRESS,
|
|
|
|
AGGR_START,
|
|
|
|
AGGR_OPERATIONAL
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ath9k_htc_sta {
|
|
|
|
u8 index;
|
|
|
|
enum tid_aggr_state tid_state[ATH9K_HTC_MAX_TID];
|
|
|
|
};
|
|
|
|
|
|
|
|
#define ATH9K_HTC_RXBUF 256
|
|
|
|
#define HTC_RX_FRAME_HEADER_SIZE 40
|
|
|
|
|
|
|
|
struct ath9k_htc_rxbuf {
|
|
|
|
bool in_process;
|
|
|
|
struct sk_buff *skb;
|
|
|
|
struct ath_htc_rx_status rxstatus;
|
|
|
|
struct list_head list;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ath9k_htc_rx {
|
|
|
|
int last_rssi; /* FIXME: per-STA */
|
|
|
|
struct list_head rxbuf;
|
|
|
|
spinlock_t rxbuflock;
|
|
|
|
};
|
|
|
|
|
2011-04-13 13:56:39 +08:00
|
|
|
#define ATH9K_HTC_TX_CLEANUP_INTERVAL 50 /* ms */
|
2011-05-17 15:12:34 +08:00
|
|
|
#define ATH9K_HTC_TX_TIMEOUT_INTERVAL 3000 /* ms */
|
2011-04-13 13:56:39 +08:00
|
|
|
#define ATH9K_HTC_TX_RESERVE 10
|
2011-05-17 15:12:34 +08:00
|
|
|
#define ATH9K_HTC_TX_TIMEOUT_COUNT 40
|
2011-04-13 13:55:29 +08:00
|
|
|
#define ATH9K_HTC_TX_THRESHOLD (MAX_TX_BUF_NUM - ATH9K_HTC_TX_RESERVE)
|
|
|
|
|
|
|
|
#define ATH9K_HTC_OP_TX_QUEUES_STOP BIT(0)
|
2011-04-13 13:56:18 +08:00
|
|
|
#define ATH9K_HTC_OP_TX_DRAIN BIT(1)
|
2011-04-13 13:55:00 +08:00
|
|
|
|
2011-04-13 13:55:29 +08:00
|
|
|
struct ath9k_htc_tx {
|
|
|
|
u8 flags;
|
|
|
|
int queued_cnt;
|
2011-04-13 13:56:18 +08:00
|
|
|
struct sk_buff_head mgmt_ep_queue;
|
|
|
|
struct sk_buff_head cab_ep_queue;
|
|
|
|
struct sk_buff_head data_be_queue;
|
|
|
|
struct sk_buff_head data_bk_queue;
|
|
|
|
struct sk_buff_head data_vi_queue;
|
|
|
|
struct sk_buff_head data_vo_queue;
|
2011-04-13 13:55:59 +08:00
|
|
|
struct sk_buff_head tx_failed;
|
2011-04-13 13:55:47 +08:00
|
|
|
DECLARE_BITMAP(tx_slot, MAX_TX_BUF_NUM);
|
2011-04-13 13:56:39 +08:00
|
|
|
struct timer_list cleanup_timer;
|
2011-04-13 13:55:29 +08:00
|
|
|
spinlock_t tx_lock;
|
2011-04-13 13:55:00 +08:00
|
|
|
};
|
|
|
|
|
2010-03-17 16:55:25 +08:00
|
|
|
struct ath9k_htc_tx_ctl {
|
|
|
|
u8 type; /* ATH9K_HTC_* */
|
2011-04-13 13:55:35 +08:00
|
|
|
u8 epid;
|
2011-04-13 13:55:41 +08:00
|
|
|
u8 txok;
|
2011-04-13 13:56:11 +08:00
|
|
|
u8 sta_idx;
|
2011-04-13 13:56:39 +08:00
|
|
|
unsigned long timestamp;
|
2010-03-17 16:55:25 +08:00
|
|
|
};
|
|
|
|
|
2011-04-13 13:54:31 +08:00
|
|
|
static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(struct sk_buff *skb)
|
|
|
|
{
|
|
|
|
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
|
|
|
|
|
|
|
|
BUILD_BUG_ON(sizeof(struct ath9k_htc_tx_ctl) >
|
|
|
|
IEEE80211_TX_INFO_DRIVER_DATA_SIZE);
|
|
|
|
return (struct ath9k_htc_tx_ctl *) &tx_info->driver_data;
|
|
|
|
}
|
|
|
|
|
2010-03-17 16:55:25 +08:00
|
|
|
#ifdef CONFIG_ATH9K_HTC_DEBUGFS
|
|
|
|
|
|
|
|
#define TX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++)
|
|
|
|
#define RX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.rx_stats.c++)
|
2011-04-13 13:53:34 +08:00
|
|
|
#define CAB_STAT_INC priv->debug.tx_stats.cab_queued++
|
2010-03-17 16:55:25 +08:00
|
|
|
|
2010-05-14 13:48:54 +08:00
|
|
|
#define TX_QSTAT_INC(q) (priv->debug.tx_stats.queue_stats[q]++)
|
|
|
|
|
2011-04-13 13:54:10 +08:00
|
|
|
void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv,
|
|
|
|
struct ath_htc_rx_status *rxs);
|
|
|
|
|
2010-03-17 16:55:25 +08:00
|
|
|
struct ath_tx_stats {
|
|
|
|
u32 buf_queued;
|
|
|
|
u32 buf_completed;
|
|
|
|
u32 skb_queued;
|
2011-04-13 13:55:59 +08:00
|
|
|
u32 skb_success;
|
|
|
|
u32 skb_failed;
|
2011-04-13 13:53:34 +08:00
|
|
|
u32 cab_queued;
|
2010-05-14 13:48:54 +08:00
|
|
|
u32 queue_stats[WME_NUM_AC];
|
2010-03-17 16:55:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ath_rx_stats {
|
|
|
|
u32 skb_allocated;
|
|
|
|
u32 skb_completed;
|
|
|
|
u32 skb_dropped;
|
2011-04-13 13:54:10 +08:00
|
|
|
u32 err_crc;
|
|
|
|
u32 err_decrypt_crc;
|
|
|
|
u32 err_mic;
|
|
|
|
u32 err_pre_delim;
|
|
|
|
u32 err_post_delim;
|
|
|
|
u32 err_decrypt_busy;
|
|
|
|
u32 err_phy;
|
|
|
|
u32 err_phy_stats[ATH9K_PHYERR_MAX];
|
2010-03-17 16:55:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ath9k_debug {
|
|
|
|
struct dentry *debugfs_phy;
|
|
|
|
struct ath_tx_stats tx_stats;
|
|
|
|
struct ath_rx_stats rx_stats;
|
|
|
|
};
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define TX_STAT_INC(c) do { } while (0)
|
|
|
|
#define RX_STAT_INC(c) do { } while (0)
|
2011-04-13 13:53:34 +08:00
|
|
|
#define CAB_STAT_INC do { } while (0)
|
2010-03-17 16:55:25 +08:00
|
|
|
|
2010-06-03 04:53:58 +08:00
|
|
|
#define TX_QSTAT_INC(c) do { } while (0)
|
|
|
|
|
2011-04-13 13:54:10 +08:00
|
|
|
static inline void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv,
|
|
|
|
struct ath_htc_rx_status *rxs)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-03-17 16:55:25 +08:00
|
|
|
#endif /* CONFIG_ATH9K_HTC_DEBUGFS */
|
|
|
|
|
|
|
|
#define ATH_LED_PIN_DEF 1
|
2011-03-15 22:25:35 +08:00
|
|
|
#define ATH_LED_PIN_9287 10
|
2010-03-17 16:55:25 +08:00
|
|
|
#define ATH_LED_PIN_9271 15
|
2010-06-30 17:16:31 +08:00
|
|
|
#define ATH_LED_PIN_7010 12
|
2010-03-17 16:55:25 +08:00
|
|
|
|
2011-04-13 13:53:08 +08:00
|
|
|
#define BSTUCK_THRESHOLD 10
|
|
|
|
|
2011-04-13 13:53:44 +08:00
|
|
|
/*
|
|
|
|
* Adjust these when the max. no of beaconing interfaces is
|
|
|
|
* increased.
|
|
|
|
*/
|
|
|
|
#define DEFAULT_SWBA_RESPONSE 40 /* in TUs */
|
|
|
|
#define MIN_SWBA_RESPONSE 10 /* in TUs */
|
|
|
|
|
2010-04-05 17:18:06 +08:00
|
|
|
struct htc_beacon_config {
|
2011-04-13 13:53:08 +08:00
|
|
|
struct ieee80211_vif *bslot[ATH9K_HTC_MAX_BCN_VIF];
|
2010-04-05 17:18:06 +08:00
|
|
|
u16 beacon_interval;
|
|
|
|
u16 dtim_period;
|
|
|
|
u16 bmiss_timeout;
|
2011-04-13 13:53:08 +08:00
|
|
|
u32 bmiss_cnt;
|
2010-04-05 17:18:06 +08:00
|
|
|
};
|
|
|
|
|
2010-08-18 22:27:49 +08:00
|
|
|
struct ath_btcoex {
|
|
|
|
u32 bt_priority_cnt;
|
|
|
|
unsigned long bt_priority_time;
|
|
|
|
int bt_stomp_type; /* Types of BT stomping */
|
|
|
|
u32 btcoex_no_stomp;
|
|
|
|
u32 btcoex_period;
|
|
|
|
u32 btscan_no_stomp;
|
|
|
|
};
|
|
|
|
|
2012-02-22 15:11:47 +08:00
|
|
|
#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
|
2012-02-22 15:11:41 +08:00
|
|
|
void ath9k_htc_init_btcoex(struct ath9k_htc_priv *priv, char *product);
|
2012-02-22 15:11:36 +08:00
|
|
|
void ath9k_htc_start_btcoex(struct ath9k_htc_priv *priv);
|
|
|
|
void ath9k_htc_stop_btcoex(struct ath9k_htc_priv *priv);
|
2012-02-22 15:11:47 +08:00
|
|
|
#else
|
|
|
|
static inline void ath9k_htc_init_btcoex(struct ath9k_htc_priv *priv, char *product)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline void ath9k_htc_start_btcoex(struct ath9k_htc_priv *priv)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline void ath9k_htc_stop_btcoex(struct ath9k_htc_priv *priv)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */
|
2010-08-18 22:27:49 +08:00
|
|
|
|
|
|
|
#define OP_INVALID BIT(0)
|
|
|
|
#define OP_SCANNING BIT(1)
|
2011-04-28 18:44:05 +08:00
|
|
|
#define OP_ENABLE_BEACON BIT(2)
|
|
|
|
#define OP_BT_PRIORITY_DETECTED BIT(3)
|
|
|
|
#define OP_BT_SCAN BIT(4)
|
|
|
|
#define OP_ANI_RUNNING BIT(5)
|
|
|
|
#define OP_TSF_RESET BIT(6)
|
2010-03-17 16:55:25 +08:00
|
|
|
|
|
|
|
struct ath9k_htc_priv {
|
|
|
|
struct device *dev;
|
|
|
|
struct ieee80211_hw *hw;
|
|
|
|
struct ath_hw *ah;
|
|
|
|
struct htc_target *htc;
|
|
|
|
struct wmi *wmi;
|
|
|
|
|
2011-04-13 13:52:51 +08:00
|
|
|
u16 fw_version_major;
|
|
|
|
u16 fw_version_minor;
|
|
|
|
|
2010-03-17 16:55:25 +08:00
|
|
|
enum htc_endpoint_id wmi_cmd_ep;
|
|
|
|
enum htc_endpoint_id beacon_ep;
|
|
|
|
enum htc_endpoint_id cab_ep;
|
|
|
|
enum htc_endpoint_id uapsd_ep;
|
|
|
|
enum htc_endpoint_id mgmt_ep;
|
|
|
|
enum htc_endpoint_id data_be_ep;
|
|
|
|
enum htc_endpoint_id data_bk_ep;
|
|
|
|
enum htc_endpoint_id data_vi_ep;
|
|
|
|
enum htc_endpoint_id data_vo_ep;
|
|
|
|
|
2011-02-21 10:18:00 +08:00
|
|
|
u8 vif_slot;
|
|
|
|
u8 mon_vif_idx;
|
|
|
|
u8 sta_slot;
|
|
|
|
u8 vif_sta_pos[ATH9K_HTC_MAX_VIF];
|
2011-02-21 10:19:15 +08:00
|
|
|
u8 num_ibss_vif;
|
|
|
|
u8 num_sta_vif;
|
2011-05-17 15:12:03 +08:00
|
|
|
u8 num_sta_assoc_vif;
|
2011-02-21 10:19:23 +08:00
|
|
|
u8 num_ap_vif;
|
2011-02-21 10:18:00 +08:00
|
|
|
|
2010-03-17 16:55:25 +08:00
|
|
|
u16 curtxpow;
|
|
|
|
u16 txpowlimit;
|
|
|
|
u16 nvifs;
|
|
|
|
u16 nstations;
|
2011-02-21 10:18:39 +08:00
|
|
|
bool rearm_ani;
|
|
|
|
bool reconfig_beacon;
|
2011-04-13 13:55:00 +08:00
|
|
|
unsigned int rxfilter;
|
2012-06-25 16:24:41 +08:00
|
|
|
unsigned long op_flags;
|
2010-03-17 16:55:25 +08:00
|
|
|
|
2011-01-15 04:03:28 +08:00
|
|
|
struct ath9k_hw_cal_data caldata;
|
2011-04-13 13:55:00 +08:00
|
|
|
struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
|
2010-07-31 06:12:00 +08:00
|
|
|
|
2010-03-17 16:55:25 +08:00
|
|
|
spinlock_t beacon_lock;
|
2011-04-13 13:55:00 +08:00
|
|
|
struct htc_beacon_config cur_beacon_conf;
|
2010-03-17 16:55:25 +08:00
|
|
|
|
2011-04-13 13:55:00 +08:00
|
|
|
struct ath9k_htc_rx rx;
|
|
|
|
struct ath9k_htc_tx tx;
|
2010-03-29 18:37:17 +08:00
|
|
|
|
2010-12-28 16:58:27 +08:00
|
|
|
struct tasklet_struct swba_tasklet;
|
2010-03-17 16:55:25 +08:00
|
|
|
struct tasklet_struct rx_tasklet;
|
2011-02-21 10:19:38 +08:00
|
|
|
struct delayed_work ani_work;
|
2011-04-13 13:56:18 +08:00
|
|
|
struct tasklet_struct tx_failed_tasklet;
|
2010-04-05 17:18:05 +08:00
|
|
|
struct work_struct ps_work;
|
2010-12-28 16:58:27 +08:00
|
|
|
struct work_struct fatal_work;
|
2010-04-05 17:18:05 +08:00
|
|
|
|
|
|
|
struct mutex htc_pm_lock;
|
|
|
|
unsigned long ps_usecount;
|
|
|
|
bool ps_enabled;
|
2010-04-27 15:35:37 +08:00
|
|
|
bool ps_idle;
|
2010-03-17 16:55:25 +08:00
|
|
|
|
2011-04-28 18:44:05 +08:00
|
|
|
#ifdef CONFIG_MAC80211_LEDS
|
|
|
|
enum led_brightness brightness;
|
|
|
|
bool led_registered;
|
|
|
|
char led_name[32];
|
|
|
|
struct led_classdev led_cdev;
|
|
|
|
struct work_struct led_work;
|
|
|
|
#endif
|
2010-05-14 13:48:56 +08:00
|
|
|
|
|
|
|
int beaconq;
|
|
|
|
int cabq;
|
2010-06-12 12:33:50 +08:00
|
|
|
int hwq_map[WME_NUM_AC];
|
2010-03-17 16:55:25 +08:00
|
|
|
|
2012-02-22 15:11:47 +08:00
|
|
|
#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
|
2010-08-18 22:27:49 +08:00
|
|
|
struct ath_btcoex btcoex;
|
2012-02-22 15:11:47 +08:00
|
|
|
#endif
|
|
|
|
|
2010-08-18 22:27:49 +08:00
|
|
|
struct delayed_work coex_period_work;
|
|
|
|
struct delayed_work duty_cycle_work;
|
2010-03-17 16:55:25 +08:00
|
|
|
#ifdef CONFIG_ATH9K_HTC_DEBUGFS
|
|
|
|
struct ath9k_debug debug;
|
|
|
|
#endif
|
|
|
|
struct mutex mutex;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline void ath_read_cachesize(struct ath_common *common, int *csz)
|
|
|
|
{
|
|
|
|
common->bus_ops->read_cachesize(common, csz);
|
|
|
|
}
|
|
|
|
|
2010-12-28 16:58:27 +08:00
|
|
|
void ath9k_htc_reset(struct ath9k_htc_priv *priv);
|
|
|
|
|
2011-04-13 13:53:08 +08:00
|
|
|
void ath9k_htc_assign_bslot(struct ath9k_htc_priv *priv,
|
|
|
|
struct ieee80211_vif *vif);
|
|
|
|
void ath9k_htc_remove_bslot(struct ath9k_htc_priv *priv,
|
|
|
|
struct ieee80211_vif *vif);
|
2011-04-13 13:53:17 +08:00
|
|
|
void ath9k_htc_set_tsfadjust(struct ath9k_htc_priv *priv,
|
|
|
|
struct ieee80211_vif *vif);
|
2010-06-01 17:44:19 +08:00
|
|
|
void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv);
|
2010-03-17 16:55:25 +08:00
|
|
|
void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
|
2010-04-05 17:18:06 +08:00
|
|
|
struct ieee80211_vif *vif);
|
2011-02-21 10:18:39 +08:00
|
|
|
void ath9k_htc_beacon_reconfig(struct ath9k_htc_priv *priv);
|
2011-04-13 13:53:52 +08:00
|
|
|
void ath9k_htc_swba(struct ath9k_htc_priv *priv,
|
|
|
|
struct wmi_event_swba *swba);
|
2010-03-17 16:55:25 +08:00
|
|
|
|
|
|
|
void ath9k_htc_rxep(void *priv, struct sk_buff *skb,
|
|
|
|
enum htc_endpoint_id ep_id);
|
|
|
|
void ath9k_htc_txep(void *priv, struct sk_buff *skb, enum htc_endpoint_id ep_id,
|
|
|
|
bool txok);
|
2010-05-06 17:15:47 +08:00
|
|
|
void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb,
|
|
|
|
enum htc_endpoint_id ep_id, bool txok);
|
2010-03-17 16:55:25 +08:00
|
|
|
|
2011-04-20 17:03:28 +08:00
|
|
|
int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv,
|
|
|
|
u8 enable_coex);
|
2011-02-21 10:19:38 +08:00
|
|
|
void ath9k_htc_ani_work(struct work_struct *work);
|
|
|
|
void ath9k_htc_start_ani(struct ath9k_htc_priv *priv);
|
|
|
|
void ath9k_htc_stop_ani(struct ath9k_htc_priv *priv);
|
2010-03-17 16:55:25 +08:00
|
|
|
|
|
|
|
int ath9k_tx_init(struct ath9k_htc_priv *priv);
|
2011-04-13 13:53:34 +08:00
|
|
|
int ath9k_htc_tx_start(struct ath9k_htc_priv *priv,
|
2011-04-13 13:55:47 +08:00
|
|
|
struct sk_buff *skb, u8 slot, bool is_cab);
|
2010-03-17 16:55:25 +08:00
|
|
|
void ath9k_tx_cleanup(struct ath9k_htc_priv *priv);
|
2010-06-12 12:33:50 +08:00
|
|
|
bool ath9k_htc_txq_setup(struct ath9k_htc_priv *priv, int subtype);
|
2010-05-14 13:48:56 +08:00
|
|
|
int ath9k_htc_cabq_setup(struct ath9k_htc_priv *priv);
|
2010-03-17 16:55:25 +08:00
|
|
|
int get_hw_qnum(u16 queue, int *hwq_map);
|
2010-03-24 16:12:13 +08:00
|
|
|
int ath_htc_txq_update(struct ath9k_htc_priv *priv, int qnum,
|
|
|
|
struct ath9k_tx_queue_info *qinfo);
|
2011-04-13 13:55:29 +08:00
|
|
|
void ath9k_htc_check_stop_queues(struct ath9k_htc_priv *priv);
|
|
|
|
void ath9k_htc_check_wake_queues(struct ath9k_htc_priv *priv);
|
2011-04-13 13:55:47 +08:00
|
|
|
int ath9k_htc_tx_get_slot(struct ath9k_htc_priv *priv);
|
|
|
|
void ath9k_htc_tx_clear_slot(struct ath9k_htc_priv *priv, int slot);
|
2011-04-13 13:55:59 +08:00
|
|
|
void ath9k_htc_tx_drain(struct ath9k_htc_priv *priv);
|
2011-04-13 13:56:18 +08:00
|
|
|
void ath9k_htc_txstatus(struct ath9k_htc_priv *priv, void *wmi_event);
|
|
|
|
void ath9k_tx_failed_tasklet(unsigned long data);
|
2011-04-13 13:56:39 +08:00
|
|
|
void ath9k_htc_tx_cleanup_timer(unsigned long data);
|
2010-03-17 16:55:25 +08:00
|
|
|
|
|
|
|
int ath9k_rx_init(struct ath9k_htc_priv *priv);
|
|
|
|
void ath9k_rx_cleanup(struct ath9k_htc_priv *priv);
|
|
|
|
void ath9k_host_rx_init(struct ath9k_htc_priv *priv);
|
|
|
|
void ath9k_rx_tasklet(unsigned long data);
|
2010-03-29 18:37:09 +08:00
|
|
|
u32 ath9k_htc_calcrxfilter(struct ath9k_htc_priv *priv);
|
2010-03-17 16:55:25 +08:00
|
|
|
|
2010-04-05 17:18:05 +08:00
|
|
|
void ath9k_htc_ps_wakeup(struct ath9k_htc_priv *priv);
|
|
|
|
void ath9k_htc_ps_restore(struct ath9k_htc_priv *priv);
|
|
|
|
void ath9k_ps_work(struct work_struct *work);
|
2010-12-01 15:00:27 +08:00
|
|
|
bool ath9k_htc_setpower(struct ath9k_htc_priv *priv,
|
|
|
|
enum ath9k_power_mode mode);
|
2010-04-05 17:18:05 +08:00
|
|
|
|
2010-03-17 16:55:25 +08:00
|
|
|
void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv);
|
2010-12-28 16:58:52 +08:00
|
|
|
void ath9k_htc_rfkill_poll_state(struct ieee80211_hw *hw);
|
2011-04-28 18:44:05 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_MAC80211_LEDS
|
2010-03-17 16:55:25 +08:00
|
|
|
void ath9k_init_leds(struct ath9k_htc_priv *priv);
|
|
|
|
void ath9k_deinit_leds(struct ath9k_htc_priv *priv);
|
2011-04-28 18:44:05 +08:00
|
|
|
void ath9k_led_work(struct work_struct *work);
|
|
|
|
#else
|
|
|
|
static inline void ath9k_init_leds(struct ath9k_htc_priv *priv)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ath9k_deinit_leds(struct ath9k_htc_priv *priv)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ath9k_led_work(struct work_struct *work)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
2010-03-17 16:55:25 +08:00
|
|
|
|
|
|
|
int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev,
|
2010-11-19 19:23:22 +08:00
|
|
|
u16 devid, char *product, u32 drv_info);
|
2010-03-17 16:55:25 +08:00
|
|
|
void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug);
|
|
|
|
#ifdef CONFIG_PM
|
2010-12-01 15:00:27 +08:00
|
|
|
void ath9k_htc_suspend(struct htc_target *htc_handle);
|
2010-03-17 16:55:25 +08:00
|
|
|
int ath9k_htc_resume(struct htc_target *htc_handle);
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_ATH9K_HTC_DEBUGFS
|
2010-03-24 16:12:13 +08:00
|
|
|
int ath9k_htc_init_debug(struct ath_hw *ah);
|
2010-03-17 16:55:25 +08:00
|
|
|
#else
|
2010-03-24 16:12:13 +08:00
|
|
|
static inline int ath9k_htc_init_debug(struct ath_hw *ah) { return 0; };
|
2010-03-17 16:55:25 +08:00
|
|
|
#endif /* CONFIG_ATH9K_HTC_DEBUGFS */
|
|
|
|
|
|
|
|
#endif /* HTC_H */
|