42 #include <linux/kernel.h>
50 #ifdef CONFIG_CARL9170_LEDS
53 #ifdef CONFIG_CARL9170_WPC
54 #include <linux/input.h>
63 #ifdef CONFIG_CARL9170_DEBUGFS
67 #define CARL9170FW_NAME "carl9170-1.fw"
69 #define PAYLOAD_MAX (CARL9170_MAX_CMD_LEN / 4 - 1)
79 #define CARL9170_MAX_RX_BUFFER_SIZE 8192
88 #define CARL9170_NUM_TID 16
89 #define WME_BA_BMP_SIZE 64
90 #define CARL9170_TX_USER_RATE_TRIES 3
97 #define TID_TO_WME_AC(_tid) \
98 ((((_tid) == 0) || ((_tid) == 3)) ? WME_AC_BE : \
99 (((_tid) == 1) || ((_tid) == 2)) ? WME_AC_BK : \
100 (((_tid) == 4) || ((_tid) == 5)) ? WME_AC_VI : \
103 #define SEQ_DIFF(_start, _seq) \
104 (((_start) - (_seq)) & 0x0fff)
105 #define SEQ_PREV(_seq) \
106 (((_seq) - 1) & 0x0fff)
107 #define SEQ_NEXT(_seq) \
108 (((_seq) + 1) & 0x0fff)
109 #define BAW_WITHIN(_start, _bawsz, _seqno) \
110 ((((_seqno) - (_start)) & 0xfff) < (_bawsz))
122 #define CARL9170_BAW_BITS (2 * WME_BA_BMP_SIZE)
123 #define CARL9170_BAW_SIZE (BITS_TO_LONGS(CARL9170_BAW_BITS))
124 #define CARL9170_BAW_LEN (DIV_ROUND_UP(CARL9170_BAW_BITS, BITS_PER_BYTE))
150 #define CARL9170_QUEUE_TIMEOUT 256
151 #define CARL9170_BUMP_QUEUE 1000
152 #define CARL9170_TX_TIMEOUT 2500
153 #define CARL9170_JANITOR_DELAY 128
154 #define CARL9170_QUEUE_STUCK_TIMEOUT 5500
155 #define CARL9170_STAT_WORK 30000
157 #define CARL9170_NUM_TX_AGG_MAX 30
171 #define CARL9170_NUM_TX_LIMIT_HARD ((AR9170_TXQ_DEPTH * 3) / 2)
172 #define CARL9170_NUM_TX_LIMIT_SOFT (AR9170_TXQ_DEPTH)
193 #define AR9170_NUM_RX_URBS 16
194 #define AR9170_NUM_RX_URBS_MUL 2
195 #define AR9170_NUM_TX_URBS 8
196 #define AR9170_NUM_RX_URBS_POOL (AR9170_NUM_RX_URBS_MUL * AR9170_NUM_RX_URBS)
203 #ifdef CONFIG_CARL9170_LEDS
206 struct carl9170_led {
210 unsigned int toggled;
364 #ifdef CONFIG_CARL9170_LEDS
435 #ifdef CONFIG_CARL9170_WPC
438 struct input_dev *
pbc;
444 #ifdef CONFIG_CARL9170_DEBUGFS
461 #ifdef CONFIG_CARL9170_HWRNG
462 # define CARL9170_HWRNG_CACHE_SIZE CARL9170_MAX_CMD_PAYLOAD_LEN
467 u16 cache[CARL9170_HWRNG_CACHE_SIZE /
sizeof(
u16)];
468 unsigned int cache_idx;
506 #define CHK_DEV_STATE(a, s) (((struct ar9170 *)a)->state >= (s))
507 #define IS_INITIALIZED(a) (CHK_DEV_STATE(a, CARL9170_STOPPED))
508 #define IS_ACCEPTING_CMD(a) (CHK_DEV_STATE(a, CARL9170_IDLE))
509 #define IS_STARTED(a) (CHK_DEV_STATE(a, CARL9170_STARTED))
511 static inline void __carl9170_set_state(
struct ar9170 *
ar,
514 ar->
state = newstate;
517 static inline void carl9170_set_state(
struct ar9170 *
ar,
523 __carl9170_set_state(ar, newstate);
524 spin_unlock_irqrestore(&ar->
state_lock, flags);
527 static inline void carl9170_set_state_when(
struct ar9170 *
ar,
534 __carl9170_set_state(ar, newstate);
535 spin_unlock_irqrestore(&ar->
state_lock, flags);
573 const u8 ktype,
const u8 keyidx,
const u8 *keydata,
const int keylen);
598 #ifdef CONFIG_CARL9170_LEDS
599 int carl9170_led_register(
struct ar9170 *ar);
600 void carl9170_led_unregister(
struct ar9170 *ar);
625 skb->
data)->frame_data;
633 static inline u16 carl9170_get_seq(
struct sk_buff *skb)
635 return get_seq_h(carl9170_get_hdr(skb));
643 static inline u16 carl9170_get_tid(
struct sk_buff *skb)
645 return get_tid_h(carl9170_get_hdr(skb));
661 return carl9170_get_vif(cvif);
672 ret = (carl9170_get_main_vif(ar) == vif);