提交 9c223f9b 编写于 作者: D David S. Miller
无相关合并请求
...@@ -178,23 +178,29 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry); ...@@ -178,23 +178,29 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry);
void ath_hw_cycle_counters_update(struct ath_common *common); void ath_hw_cycle_counters_update(struct ath_common *common);
int32_t ath_hw_get_listen_time(struct ath_common *common); int32_t ath_hw_get_listen_time(struct ath_common *common);
extern __attribute__ ((format (printf, 3, 4))) int extern __attribute__((format (printf, 2, 3)))
ath_printk(const char *level, struct ath_common *common, const char *fmt, ...); void ath_printk(const char *level, const char *fmt, ...);
#define _ath_printk(level, common, fmt, ...) \
do { \
__always_unused struct ath_common *unused = common; \
ath_printk(level, fmt, ##__VA_ARGS__); \
} while (0)
#define ath_emerg(common, fmt, ...) \ #define ath_emerg(common, fmt, ...) \
ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS__) _ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS__)
#define ath_alert(common, fmt, ...) \ #define ath_alert(common, fmt, ...) \
ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS__) _ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS__)
#define ath_crit(common, fmt, ...) \ #define ath_crit(common, fmt, ...) \
ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS__) _ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS__)
#define ath_err(common, fmt, ...) \ #define ath_err(common, fmt, ...) \
ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS__) _ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS__)
#define ath_warn(common, fmt, ...) \ #define ath_warn(common, fmt, ...) \
ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS__) _ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS__)
#define ath_notice(common, fmt, ...) \ #define ath_notice(common, fmt, ...) \
ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS__) _ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS__)
#define ath_info(common, fmt, ...) \ #define ath_info(common, fmt, ...) \
ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS__) _ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS__)
/** /**
* enum ath_debug_level - atheros wireless debug level * enum ath_debug_level - atheros wireless debug level
...@@ -246,27 +252,21 @@ enum ATH_DEBUG { ...@@ -246,27 +252,21 @@ enum ATH_DEBUG {
#ifdef CONFIG_ATH_DEBUG #ifdef CONFIG_ATH_DEBUG
#define ath_dbg(common, dbg_mask, fmt, ...) \ #define ath_dbg(common, dbg_mask, fmt, ...) \
({ \ do { \
int rtn; \ if ((common)->debug_mask & dbg_mask) \
if ((common)->debug_mask & dbg_mask) \ _ath_printk(KERN_DEBUG, common, fmt, ##__VA_ARGS__); \
rtn = ath_printk(KERN_DEBUG, common, fmt, \ } while (0)
##__VA_ARGS__); \
else \
rtn = 0; \
\
rtn; \
})
#define ATH_DBG_WARN(foo, arg...) WARN(foo, arg) #define ATH_DBG_WARN(foo, arg...) WARN(foo, arg)
#define ATH_DBG_WARN_ON_ONCE(foo) WARN_ON_ONCE(foo) #define ATH_DBG_WARN_ON_ONCE(foo) WARN_ON_ONCE(foo)
#else #else
static inline __attribute__ ((format (printf, 3, 4))) int static inline __attribute__((format (printf, 3, 4)))
ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask, void ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask,
const char *fmt, ...) const char *fmt, ...)
{ {
return 0;
} }
#define ATH_DBG_WARN(foo, arg...) do {} while (0) #define ATH_DBG_WARN(foo, arg...) do {} while (0)
#define ATH_DBG_WARN_ON_ONCE(foo) ({ \ #define ATH_DBG_WARN_ON_ONCE(foo) ({ \
......
...@@ -643,7 +643,7 @@ static bool ath9k_hw_ani_read_counters(struct ath_hw *ah) ...@@ -643,7 +643,7 @@ static bool ath9k_hw_ani_read_counters(struct ath_hw *ah)
listenTime = ath_hw_get_listen_time(common); listenTime = ath_hw_get_listen_time(common);
if (listenTime <= 0) { if (listenTime <= 0) {
ah->stats.ast_ani_lneg++; ah->stats.ast_ani_lneg_or_lzero++;
ath9k_ani_restart(ah); ath9k_ani_restart(ah);
return false; return false;
} }
......
...@@ -148,8 +148,7 @@ struct ar5416Stats { ...@@ -148,8 +148,7 @@ struct ar5416Stats {
u32 ast_ani_ofdmerrs; u32 ast_ani_ofdmerrs;
u32 ast_ani_cckerrs; u32 ast_ani_cckerrs;
u32 ast_ani_reset; u32 ast_ani_reset;
u32 ast_ani_lzero; u32 ast_ani_lneg_or_lzero;
u32 ast_ani_lneg;
u32 avgbrssi; u32 avgbrssi;
struct ath9k_mib_stats ast_mibstats; struct ath9k_mib_stats ast_mibstats;
}; };
...@@ -159,7 +158,5 @@ void ath9k_enable_mib_counters(struct ath_hw *ah); ...@@ -159,7 +158,5 @@ void ath9k_enable_mib_counters(struct ath_hw *ah);
void ath9k_hw_disable_mib_counters(struct ath_hw *ah); void ath9k_hw_disable_mib_counters(struct ath_hw *ah);
void ath9k_hw_ani_setup(struct ath_hw *ah); void ath9k_hw_ani_setup(struct ath_hw *ah);
void ath9k_hw_ani_init(struct ath_hw *ah); void ath9k_hw_ani_init(struct ath_hw *ah);
int ath9k_hw_get_ani_channel_idx(struct ath_hw *ah,
struct ath9k_channel *chan);
#endif /* ANI_H */ #endif /* ANI_H */
...@@ -273,7 +273,7 @@ static int ar9002_hw_proc_txdesc(struct ath_hw *ah, void *ds, ...@@ -273,7 +273,7 @@ static int ar9002_hw_proc_txdesc(struct ath_hw *ah, void *ds,
static void ar9002_hw_set11n_txdesc(struct ath_hw *ah, void *ds, static void ar9002_hw_set11n_txdesc(struct ath_hw *ah, void *ds,
u32 pktLen, enum ath9k_pkt_type type, u32 pktLen, enum ath9k_pkt_type type,
u32 txPower, u32 keyIx, u32 txPower, u8 keyIx,
enum ath9k_key_type keyType, u32 flags) enum ath9k_key_type keyType, u32 flags)
{ {
struct ar5416_desc *ads = AR5416DESC(ds); struct ar5416_desc *ads = AR5416DESC(ds);
......
...@@ -3318,7 +3318,7 @@ static int ar9300_eeprom_restore_internal(struct ath_hw *ah, ...@@ -3318,7 +3318,7 @@ static int ar9300_eeprom_restore_internal(struct ath_hw *ah,
word = kzalloc(2048, GFP_KERNEL); word = kzalloc(2048, GFP_KERNEL);
if (!word) if (!word)
return -1; return -ENOMEM;
memcpy(mptr, &ar9300_default, mdata_size); memcpy(mptr, &ar9300_default, mdata_size);
......
...@@ -312,7 +312,7 @@ static int ar9003_hw_proc_txdesc(struct ath_hw *ah, void *ds, ...@@ -312,7 +312,7 @@ static int ar9003_hw_proc_txdesc(struct ath_hw *ah, void *ds,
static void ar9003_hw_set11n_txdesc(struct ath_hw *ah, void *ds, static void ar9003_hw_set11n_txdesc(struct ath_hw *ah, void *ds,
u32 pktlen, enum ath9k_pkt_type type, u32 txpower, u32 pktlen, enum ath9k_pkt_type type, u32 txpower,
u32 keyIx, enum ath9k_key_type keyType, u32 flags) u8 keyIx, enum ath9k_key_type keyType, u32 flags)
{ {
struct ar9003_txc *ads = (struct ar9003_txc *) ds; struct ar9003_txc *ads = (struct ar9003_txc *) ds;
......
...@@ -206,16 +206,17 @@ struct ath_atx_ac { ...@@ -206,16 +206,17 @@ struct ath_atx_ac {
}; };
struct ath_frame_info { struct ath_frame_info {
struct ath_buf *bf;
int framelen; int framelen;
u32 keyix;
enum ath9k_key_type keytype; enum ath9k_key_type keytype;
u8 keyix;
u8 retries; u8 retries;
u16 seqno;
}; };
struct ath_buf_state { struct ath_buf_state {
u8 bf_type; u8 bf_type;
u8 bfs_paprd; u8 bfs_paprd;
u16 seqno;
unsigned long bfs_paprd_timestamp; unsigned long bfs_paprd_timestamp;
}; };
...@@ -235,7 +236,7 @@ struct ath_buf { ...@@ -235,7 +236,7 @@ struct ath_buf {
struct ath_atx_tid { struct ath_atx_tid {
struct list_head list; struct list_head list;
struct list_head buf_q; struct sk_buff_head buf_q;
struct ath_node *an; struct ath_node *an;
struct ath_atx_ac *ac; struct ath_atx_ac *ac;
unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)]; unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)];
......
...@@ -711,7 +711,7 @@ static ssize_t read_file_stations(struct file *file, char __user *user_buf, ...@@ -711,7 +711,7 @@ static ssize_t read_file_stations(struct file *file, char __user *user_buf,
" tid: %p %s %s %i %p %p\n", " tid: %p %s %s %i %p %p\n",
tid, tid->sched ? "sched" : "idle", tid, tid->sched ? "sched" : "idle",
tid->paused ? "paused" : "running", tid->paused ? "paused" : "running",
list_empty(&tid->buf_q), skb_queue_empty(&tid->buf_q),
tid->an, tid->ac); tid->an, tid->ac);
if (len >= size) if (len >= size)
goto done; goto done;
...@@ -828,6 +828,8 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf, ...@@ -828,6 +828,8 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf,
void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
struct ath_tx_status *ts, struct ath_txq *txq) struct ath_tx_status *ts, struct ath_txq *txq)
{ {
#define TX_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].ts\
[sc->debug.tsidx].c)
int qnum = txq->axq_qnum; int qnum = txq->axq_qnum;
TX_STAT_INC(qnum, tx_pkts_all); TX_STAT_INC(qnum, tx_pkts_all);
...@@ -857,6 +859,26 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, ...@@ -857,6 +859,26 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
TX_STAT_INC(qnum, data_underrun); TX_STAT_INC(qnum, data_underrun);
if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN) if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN)
TX_STAT_INC(qnum, delim_underrun); TX_STAT_INC(qnum, delim_underrun);
spin_lock(&sc->debug.samp_lock);
TX_SAMP_DBG(jiffies) = jiffies;
TX_SAMP_DBG(rssi_ctl0) = ts->ts_rssi_ctl0;
TX_SAMP_DBG(rssi_ctl1) = ts->ts_rssi_ctl1;
TX_SAMP_DBG(rssi_ctl2) = ts->ts_rssi_ctl2;
TX_SAMP_DBG(rssi_ext0) = ts->ts_rssi_ext0;
TX_SAMP_DBG(rssi_ext1) = ts->ts_rssi_ext1;
TX_SAMP_DBG(rssi_ext2) = ts->ts_rssi_ext2;
TX_SAMP_DBG(rateindex) = ts->ts_rateindex;
TX_SAMP_DBG(isok) = !!(ts->ts_status & ATH9K_TXERR_MASK);
TX_SAMP_DBG(rts_fail_cnt) = ts->ts_shortretry;
TX_SAMP_DBG(data_fail_cnt) = ts->ts_longretry;
TX_SAMP_DBG(rssi) = ts->ts_rssi;
TX_SAMP_DBG(tid) = ts->tid;
TX_SAMP_DBG(qid) = ts->qid;
sc->debug.tsidx = (sc->debug.tsidx + 1) % ATH_DBG_MAX_SAMPLES;
spin_unlock(&sc->debug.samp_lock);
#undef TX_SAMP_DBG
} }
static const struct file_operations fops_xmit = { static const struct file_operations fops_xmit = {
...@@ -995,6 +1017,8 @@ void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) ...@@ -995,6 +1017,8 @@ void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs)
{ {
#define RX_STAT_INC(c) sc->debug.stats.rxstats.c++ #define RX_STAT_INC(c) sc->debug.stats.rxstats.c++
#define RX_PHY_ERR_INC(c) sc->debug.stats.rxstats.phy_err_stats[c]++ #define RX_PHY_ERR_INC(c) sc->debug.stats.rxstats.phy_err_stats[c]++
#define RX_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].rs\
[sc->debug.rsidx].c)
u32 phyerr; u32 phyerr;
...@@ -1030,8 +1054,25 @@ void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) ...@@ -1030,8 +1054,25 @@ void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs)
sc->debug.stats.rxstats.rs_antenna = rs->rs_antenna; sc->debug.stats.rxstats.rs_antenna = rs->rs_antenna;
spin_lock(&sc->debug.samp_lock);
RX_SAMP_DBG(jiffies) = jiffies;
RX_SAMP_DBG(rssi_ctl0) = rs->rs_rssi_ctl0;
RX_SAMP_DBG(rssi_ctl1) = rs->rs_rssi_ctl1;
RX_SAMP_DBG(rssi_ctl2) = rs->rs_rssi_ctl2;
RX_SAMP_DBG(rssi_ext0) = rs->rs_rssi_ext0;
RX_SAMP_DBG(rssi_ext1) = rs->rs_rssi_ext1;
RX_SAMP_DBG(rssi_ext2) = rs->rs_rssi_ext2;
RX_SAMP_DBG(antenna) = rs->rs_antenna;
RX_SAMP_DBG(rssi) = rs->rs_rssi;
RX_SAMP_DBG(rate) = rs->rs_rate;
RX_SAMP_DBG(is_mybeacon) = rs->is_mybeacon;
sc->debug.rsidx = (sc->debug.rsidx + 1) % ATH_DBG_MAX_SAMPLES;
spin_unlock(&sc->debug.samp_lock);
#undef RX_STAT_INC #undef RX_STAT_INC
#undef RX_PHY_ERR_INC #undef RX_PHY_ERR_INC
#undef RX_SAMP_DBG
} }
static const struct file_operations fops_recv = { static const struct file_operations fops_recv = {
...@@ -1272,6 +1313,269 @@ static const struct file_operations fops_modal_eeprom = { ...@@ -1272,6 +1313,269 @@ static const struct file_operations fops_modal_eeprom = {
.llseek = default_llseek, .llseek = default_llseek,
}; };
void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
{
#define ATH_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].c)
struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah);
unsigned long flags;
int i;
ath9k_ps_wakeup(sc);
spin_lock_irqsave(&common->cc_lock, flags);
ath_hw_cycle_counters_update(common);
spin_unlock_irqrestore(&common->cc_lock, flags);
spin_lock_bh(&sc->debug.samp_lock);
ATH_SAMP_DBG(cc.cycles) = common->cc_ani.cycles;
ATH_SAMP_DBG(cc.rx_busy) = common->cc_ani.rx_busy;
ATH_SAMP_DBG(cc.rx_frame) = common->cc_ani.rx_frame;
ATH_SAMP_DBG(cc.tx_frame) = common->cc_ani.tx_frame;
ATH_SAMP_DBG(noise) = ah->noise;
REG_WRITE_D(ah, AR_MACMISC,
((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) |
(AR_MACMISC_MISC_OBS_BUS_1 <<
AR_MACMISC_MISC_OBS_BUS_MSB_S)));
for (i = 0; i < ATH9K_NUM_DMA_DEBUG_REGS; i++)
ATH_SAMP_DBG(dma_dbg_reg_vals[i]) = REG_READ_D(ah,
AR_DMADBG_0 + (i * sizeof(u32)));
ATH_SAMP_DBG(pcu_obs) = REG_READ_D(ah, AR_OBS_BUS_1);
ATH_SAMP_DBG(pcu_cr) = REG_READ_D(ah, AR_CR);
memcpy(ATH_SAMP_DBG(nfCalHist), sc->caldata.nfCalHist,
sizeof(ATH_SAMP_DBG(nfCalHist)));
sc->debug.sampidx = (sc->debug.sampidx + 1) % ATH_DBG_MAX_SAMPLES;
spin_unlock_bh(&sc->debug.samp_lock);
ath9k_ps_restore(sc);
#undef ATH_SAMP_DBG
}
static int open_file_bb_mac_samps(struct inode *inode, struct file *file)
{
#define ATH_SAMP_DBG(c) bb_mac_samp[sampidx].c
struct ath_softc *sc = inode->i_private;
struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah);
struct ieee80211_conf *conf = &common->hw->conf;
struct ath_dbg_bb_mac_samp *bb_mac_samp;
struct ath9k_nfcal_hist *h;
int i, j, qcuOffset = 0, dcuOffset = 0;
u32 *qcuBase, *dcuBase, size = 30000, len = 0;
u32 sampidx = 0;
u8 *buf;
u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
u8 nread;
buf = vmalloc(size);
if (!buf)
return -ENOMEM;
bb_mac_samp = vmalloc(sizeof(*bb_mac_samp) * ATH_DBG_MAX_SAMPLES);
if (!bb_mac_samp) {
vfree(buf);
return -ENOMEM;
}
spin_lock_bh(&sc->debug.samp_lock);
memcpy(bb_mac_samp, sc->debug.bb_mac_samp,
sizeof(*bb_mac_samp) * ATH_DBG_MAX_SAMPLES);
spin_unlock_bh(&sc->debug.samp_lock);
len += snprintf(buf + len, size - len,
"Raw DMA Debug Dump:\n");
len += snprintf(buf + len, size - len, "Sample |\t");
for (i = 0; i < ATH9K_NUM_DMA_DEBUG_REGS; i++)
len += snprintf(buf + len, size - len, " DMA Reg%d |\t", i);
len += snprintf(buf + len, size - len, "\n");
for (sampidx = 0; sampidx < ATH_DBG_MAX_SAMPLES; sampidx++) {
len += snprintf(buf + len, size - len, "%d\t", sampidx);
for (i = 0; i < ATH9K_NUM_DMA_DEBUG_REGS; i++)
len += snprintf(buf + len, size - len, " %08x\t",
ATH_SAMP_DBG(dma_dbg_reg_vals[i]));
len += snprintf(buf + len, size - len, "\n");
}
len += snprintf(buf + len, size - len, "\n");
len += snprintf(buf + len, size - len,
"Sample Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n");
for (sampidx = 0; sampidx < ATH_DBG_MAX_SAMPLES; sampidx++) {
qcuBase = &ATH_SAMP_DBG(dma_dbg_reg_vals[0]);
dcuBase = &ATH_SAMP_DBG(dma_dbg_reg_vals[4]);
for (i = 0; i < ATH9K_NUM_QUEUES; i++,
qcuOffset += 4, dcuOffset += 5) {
if (i == 8) {
qcuOffset = 0;
qcuBase++;
}
if (i == 6) {
dcuOffset = 0;
dcuBase++;
}
if (!sc->debug.stats.txstats[i].queued)
continue;
len += snprintf(buf + len, size - len,
"%4d %7d %2x %1x %2x %2x\n",
sampidx, i,
(*qcuBase & (0x7 << qcuOffset)) >> qcuOffset,
(*qcuBase & (0x8 << qcuOffset)) >>
(qcuOffset + 3),
ATH_SAMP_DBG(dma_dbg_reg_vals[2]) &
(0x7 << (i * 3)) >> (i * 3),
(*dcuBase & (0x1f << dcuOffset)) >> dcuOffset);
}
len += snprintf(buf + len, size - len, "\n");
}
len += snprintf(buf + len, size - len,
"samp qcu_sh qcu_fh qcu_comp dcu_comp dcu_arb dcu_fp "
"ch_idle_dur ch_idle_dur_val txfifo_val0 txfifo_val1 "
"txfifo_dcu0 txfifo_dcu1 pcu_obs AR_CR\n");
for (sampidx = 0; sampidx < ATH_DBG_MAX_SAMPLES; sampidx++) {
qcuBase = &ATH_SAMP_DBG(dma_dbg_reg_vals[0]);
dcuBase = &ATH_SAMP_DBG(dma_dbg_reg_vals[4]);
len += snprintf(buf + len, size - len, "%4d %5x %5x ", sampidx,
(ATH_SAMP_DBG(dma_dbg_reg_vals[3]) & 0x003c0000) >> 18,
(ATH_SAMP_DBG(dma_dbg_reg_vals[3]) & 0x03c00000) >> 22);
len += snprintf(buf + len, size - len, "%7x %8x ",
(ATH_SAMP_DBG(dma_dbg_reg_vals[3]) & 0x1c000000) >> 26,
(ATH_SAMP_DBG(dma_dbg_reg_vals[6]) & 0x3));
len += snprintf(buf + len, size - len, "%7x %7x ",
(ATH_SAMP_DBG(dma_dbg_reg_vals[5]) & 0x06000000) >> 25,
(ATH_SAMP_DBG(dma_dbg_reg_vals[5]) & 0x38000000) >> 27);
len += snprintf(buf + len, size - len, "%7d %12d ",
(ATH_SAMP_DBG(dma_dbg_reg_vals[6]) & 0x000003fc) >> 2,
(ATH_SAMP_DBG(dma_dbg_reg_vals[6]) & 0x00000400) >> 10);
len += snprintf(buf + len, size - len, "%12d %12d ",
(ATH_SAMP_DBG(dma_dbg_reg_vals[6]) & 0x00000800) >> 11,
(ATH_SAMP_DBG(dma_dbg_reg_vals[6]) & 0x00001000) >> 12);
len += snprintf(buf + len, size - len, "%12d %12d ",
(ATH_SAMP_DBG(dma_dbg_reg_vals[6]) & 0x0001e000) >> 13,
(ATH_SAMP_DBG(dma_dbg_reg_vals[6]) & 0x001e0000) >> 17);
len += snprintf(buf + len, size - len, "0x%07x 0x%07x\n",
ATH_SAMP_DBG(pcu_obs), ATH_SAMP_DBG(pcu_cr));
}
len += snprintf(buf + len, size - len,
"Sample ChNoise Chain privNF #Reading Readings\n");
for (sampidx = 0; sampidx < ATH_DBG_MAX_SAMPLES; sampidx++) {
h = ATH_SAMP_DBG(nfCalHist);
if (!ATH_SAMP_DBG(noise))
continue;
for (i = 0; i < NUM_NF_READINGS; i++) {
if (!(chainmask & (1 << i)) ||
((i >= AR5416_MAX_CHAINS) && !conf_is_ht40(conf)))
continue;
nread = AR_PHY_CCA_FILTERWINDOW_LENGTH -
h[i].invalidNFcount;
len += snprintf(buf + len, size - len,
"%4d %5d %4d\t %d\t %d\t",
sampidx, ATH_SAMP_DBG(noise),
i, h[i].privNF, nread);
for (j = 0; j < nread; j++)
len += snprintf(buf + len, size - len,
" %d", h[i].nfCalBuffer[j]);
len += snprintf(buf + len, size - len, "\n");
}
}
len += snprintf(buf + len, size - len, "\nCycle counters:\n"
"Sample Total Rxbusy Rxframes Txframes\n");
for (sampidx = 0; sampidx < ATH_DBG_MAX_SAMPLES; sampidx++) {
if (!ATH_SAMP_DBG(cc.cycles))
continue;
len += snprintf(buf + len, size - len,
"%4d %08x %08x %08x %08x\n",
sampidx, ATH_SAMP_DBG(cc.cycles),
ATH_SAMP_DBG(cc.rx_busy),
ATH_SAMP_DBG(cc.rx_frame),
ATH_SAMP_DBG(cc.tx_frame));
}
len += snprintf(buf + len, size - len, "Tx status Dump :\n");
len += snprintf(buf + len, size - len,
"Sample rssi:- ctl0 ctl1 ctl2 ext0 ext1 ext2 comb "
"isok rts_fail data_fail rate tid qid tx_before(ms)\n");
for (sampidx = 0; sampidx < ATH_DBG_MAX_SAMPLES; sampidx++) {
for (i = 0; i < ATH_DBG_MAX_SAMPLES; i++) {
if (!ATH_SAMP_DBG(ts[i].jiffies))
continue;
len += snprintf(buf + len, size - len, "%4d \t"
"%8d %4d %4d %4d %4d %4d %4d %4d %4d "
"%4d %4d %2d %2d %d\n",
sampidx,
ATH_SAMP_DBG(ts[i].rssi_ctl0),
ATH_SAMP_DBG(ts[i].rssi_ctl1),
ATH_SAMP_DBG(ts[i].rssi_ctl2),
ATH_SAMP_DBG(ts[i].rssi_ext0),
ATH_SAMP_DBG(ts[i].rssi_ext1),
ATH_SAMP_DBG(ts[i].rssi_ext2),
ATH_SAMP_DBG(ts[i].rssi),
ATH_SAMP_DBG(ts[i].isok),
ATH_SAMP_DBG(ts[i].rts_fail_cnt),
ATH_SAMP_DBG(ts[i].data_fail_cnt),
ATH_SAMP_DBG(ts[i].rateindex),
ATH_SAMP_DBG(ts[i].tid),
ATH_SAMP_DBG(ts[i].qid),
jiffies_to_msecs(jiffies -
ATH_SAMP_DBG(ts[i].jiffies)));
}
}
len += snprintf(buf + len, size - len, "Rx status Dump :\n");
len += snprintf(buf + len, size - len, "Sample rssi:- ctl0 ctl1 ctl2 "
"ext0 ext1 ext2 comb beacon ant rate rx_before(ms)\n");
for (sampidx = 0; sampidx < ATH_DBG_MAX_SAMPLES; sampidx++) {
for (i = 0; i < ATH_DBG_MAX_SAMPLES; i++) {
if (!ATH_SAMP_DBG(rs[i].jiffies))
continue;
len += snprintf(buf + len, size - len, "%4d \t"
"%8d %4d %4d %4d %4d %4d %4d %s %4d %02x %d\n",
sampidx,
ATH_SAMP_DBG(rs[i].rssi_ctl0),
ATH_SAMP_DBG(rs[i].rssi_ctl1),
ATH_SAMP_DBG(rs[i].rssi_ctl2),
ATH_SAMP_DBG(rs[i].rssi_ext0),
ATH_SAMP_DBG(rs[i].rssi_ext1),
ATH_SAMP_DBG(rs[i].rssi_ext2),
ATH_SAMP_DBG(rs[i].rssi),
ATH_SAMP_DBG(rs[i].is_mybeacon) ?
"True" : "False",
ATH_SAMP_DBG(rs[i].antenna),
ATH_SAMP_DBG(rs[i].rate),
jiffies_to_msecs(jiffies -
ATH_SAMP_DBG(rs[i].jiffies)));
}
}
vfree(bb_mac_samp);
file->private_data = buf;
return 0;
#undef ATH_SAMP_DBG
}
static const struct file_operations fops_samps = {
.open = open_file_bb_mac_samps,
.read = ath9k_debugfs_read_buf,
.release = ath9k_debugfs_release_buf,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
int ath9k_init_debug(struct ath_hw *ah) int ath9k_init_debug(struct ath_hw *ah)
{ {
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
...@@ -1321,6 +1625,8 @@ int ath9k_init_debug(struct ath_hw *ah) ...@@ -1321,6 +1625,8 @@ int ath9k_init_debug(struct ath_hw *ah)
&fops_base_eeprom); &fops_base_eeprom);
debugfs_create_file("modal_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, debugfs_create_file("modal_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
&fops_modal_eeprom); &fops_modal_eeprom);
debugfs_create_file("samples", S_IRUSR, sc->debug.debugfs_phy, sc,
&fops_samps);
debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR, debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR,
sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask);
...@@ -1329,5 +1635,9 @@ int ath9k_init_debug(struct ath_hw *ah) ...@@ -1329,5 +1635,9 @@ int ath9k_init_debug(struct ath_hw *ah)
sc->debug.debugfs_phy, &sc->sc_ah->gpio_val); sc->debug.debugfs_phy, &sc->sc_ah->gpio_val);
sc->debug.regidx = 0; sc->debug.regidx = 0;
memset(&sc->debug.bb_mac_samp, 0, sizeof(sc->debug.bb_mac_samp));
sc->debug.sampidx = 0;
sc->debug.tsidx = 0;
sc->debug.rsidx = 0;
return 0; return 0;
} }
...@@ -177,14 +177,57 @@ struct ath_stats { ...@@ -177,14 +177,57 @@ struct ath_stats {
struct ath_rx_stats rxstats; struct ath_rx_stats rxstats;
}; };
#define ATH_DBG_MAX_SAMPLES 10
struct ath_dbg_bb_mac_samp {
u32 dma_dbg_reg_vals[ATH9K_NUM_DMA_DEBUG_REGS];
u32 pcu_obs, pcu_cr, noise;
struct {
u64 jiffies;
int8_t rssi_ctl0;
int8_t rssi_ctl1;
int8_t rssi_ctl2;
int8_t rssi_ext0;
int8_t rssi_ext1;
int8_t rssi_ext2;
int8_t rssi;
bool isok;
u8 rts_fail_cnt;
u8 data_fail_cnt;
u8 rateindex;
u8 qid;
u8 tid;
} ts[ATH_DBG_MAX_SAMPLES];
struct {
u64 jiffies;
int8_t rssi_ctl0;
int8_t rssi_ctl1;
int8_t rssi_ctl2;
int8_t rssi_ext0;
int8_t rssi_ext1;
int8_t rssi_ext2;
int8_t rssi;
bool is_mybeacon;
u8 antenna;
u8 rate;
} rs[ATH_DBG_MAX_SAMPLES];
struct ath_cycle_counters cc;
struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
};
struct ath9k_debug { struct ath9k_debug {
struct dentry *debugfs_phy; struct dentry *debugfs_phy;
u32 regidx; u32 regidx;
struct ath_stats stats; struct ath_stats stats;
spinlock_t samp_lock;
struct ath_dbg_bb_mac_samp bb_mac_samp[ATH_DBG_MAX_SAMPLES];
u8 sampidx;
u8 tsidx;
u8 rsidx;
}; };
int ath9k_init_debug(struct ath_hw *ah); int ath9k_init_debug(struct ath_hw *ah);
void ath9k_debug_samp_bb_mac(struct ath_softc *sc);
void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status); void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
struct ath_tx_status *ts, struct ath_txq *txq); struct ath_tx_status *ts, struct ath_txq *txq);
...@@ -197,6 +240,10 @@ static inline int ath9k_init_debug(struct ath_hw *ah) ...@@ -197,6 +240,10 @@ static inline int ath9k_init_debug(struct ath_hw *ah)
return 0; return 0;
} }
static inline void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
{
}
static inline void ath_debug_stat_interrupt(struct ath_softc *sc, static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
enum ath9k_int status) enum ath9k_int status)
{ {
......
...@@ -1300,6 +1300,7 @@ static void ath9k_htc_configure_filter(struct ieee80211_hw *hw, ...@@ -1300,6 +1300,7 @@ static void ath9k_htc_configure_filter(struct ieee80211_hw *hw,
if (priv->op_flags & OP_INVALID) { if (priv->op_flags & OP_INVALID) {
ath_dbg(ath9k_hw_common(priv->ah), ATH_DBG_ANY, ath_dbg(ath9k_hw_common(priv->ah), ATH_DBG_ANY,
"Unable to configure filter on invalid state\n"); "Unable to configure filter on invalid state\n");
mutex_unlock(&priv->mutex);
return; return;
} }
ath9k_htc_ps_wakeup(priv); ath9k_htc_ps_wakeup(priv);
......
...@@ -440,7 +440,7 @@ static void ath9k_hw_init_defaults(struct ath_hw *ah) ...@@ -440,7 +440,7 @@ static void ath9k_hw_init_defaults(struct ath_hw *ah)
if (AR_SREV_9100(ah)) if (AR_SREV_9100(ah))
ah->sta_id1_defaults |= AR_STA_ID1_AR9100_BA_FIX; ah->sta_id1_defaults |= AR_STA_ID1_AR9100_BA_FIX;
ah->enable_32kHz_clock = DONT_USE_32KHZ; ah->enable_32kHz_clock = DONT_USE_32KHZ;
ah->slottime = 20; ah->slottime = ATH9K_SLOT_TIME_9;
ah->globaltxtimeout = (u32) -1; ah->globaltxtimeout = (u32) -1;
ah->power_mode = ATH9K_PM_UNDEFINED; ah->power_mode = ATH9K_PM_UNDEFINED;
} }
...@@ -997,8 +997,14 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah) ...@@ -997,8 +997,14 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah)
slottime = 21; slottime = 21;
sifstime = 64; sifstime = 64;
} else { } else {
eifs = REG_READ(ah, AR_D_GBL_IFS_EIFS)/common->clockrate; if (AR_SREV_9287(ah) && AR_SREV_9287_13_OR_LATER(ah)) {
reg = REG_READ(ah, AR_USEC); eifs = AR_D_GBL_IFS_EIFS_ASYNC_FIFO;
reg = AR_USEC_ASYNC_FIFO;
} else {
eifs = REG_READ(ah, AR_D_GBL_IFS_EIFS)/
common->clockrate;
reg = REG_READ(ah, AR_USEC);
}
rx_lat = MS(reg, AR_USEC_RX_LAT); rx_lat = MS(reg, AR_USEC_RX_LAT);
tx_lat = MS(reg, AR_USEC_TX_LAT); tx_lat = MS(reg, AR_USEC_TX_LAT);
...@@ -2754,6 +2760,7 @@ static struct { ...@@ -2754,6 +2760,7 @@ static struct {
{ AR_SREV_VERSION_9271, "9271" }, { AR_SREV_VERSION_9271, "9271" },
{ AR_SREV_VERSION_9300, "9300" }, { AR_SREV_VERSION_9300, "9300" },
{ AR_SREV_VERSION_9330, "9330" }, { AR_SREV_VERSION_9330, "9330" },
{ AR_SREV_VERSION_9340, "9340" },
{ AR_SREV_VERSION_9485, "9485" }, { AR_SREV_VERSION_9485, "9485" },
}; };
......
...@@ -623,7 +623,7 @@ struct ath_hw_ops { ...@@ -623,7 +623,7 @@ struct ath_hw_ops {
struct ath_tx_status *ts); struct ath_tx_status *ts);
void (*set11n_txdesc)(struct ath_hw *ah, void *ds, void (*set11n_txdesc)(struct ath_hw *ah, void *ds,
u32 pktLen, enum ath9k_pkt_type type, u32 pktLen, enum ath9k_pkt_type type,
u32 txPower, u32 keyIx, u32 txPower, u8 keyIx,
enum ath9k_key_type keyType, enum ath9k_key_type keyType,
u32 flags); u32 flags);
void (*set11n_ratescenario)(struct ath_hw *ah, void *ds, void (*set11n_ratescenario)(struct ath_hw *ah, void *ds,
......
...@@ -572,6 +572,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, ...@@ -572,6 +572,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
mutex_init(&sc->mutex); mutex_init(&sc->mutex);
#ifdef CONFIG_ATH9K_DEBUGFS #ifdef CONFIG_ATH9K_DEBUGFS
spin_lock_init(&sc->nodes_lock); spin_lock_init(&sc->nodes_lock);
spin_lock_init(&sc->debug.samp_lock);
INIT_LIST_HEAD(&sc->nodes); INIT_LIST_HEAD(&sc->nodes);
#endif #endif
tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc); tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc);
......
...@@ -146,6 +146,7 @@ struct ath_rx_status { ...@@ -146,6 +146,7 @@ struct ath_rx_status {
u8 rs_moreaggr; u8 rs_moreaggr;
u8 rs_num_delims; u8 rs_num_delims;
u8 rs_flags; u8 rs_flags;
bool is_mybeacon;
u32 evm0; u32 evm0;
u32 evm1; u32 evm1;
u32 evm2; u32 evm2;
...@@ -194,7 +195,7 @@ struct ath_htc_rx_status { ...@@ -194,7 +195,7 @@ struct ath_htc_rx_status {
#define ATH9K_RX_DECRYPT_BUSY 0x40 #define ATH9K_RX_DECRYPT_BUSY 0x40
#define ATH9K_RXKEYIX_INVALID ((u8)-1) #define ATH9K_RXKEYIX_INVALID ((u8)-1)
#define ATH9K_TXKEYIX_INVALID ((u32)-1) #define ATH9K_TXKEYIX_INVALID ((u8)-1)
enum ath9k_phyerr { enum ath9k_phyerr {
ATH9K_PHYERR_UNDERRUN = 0, /* Transmit underrun */ ATH9K_PHYERR_UNDERRUN = 0, /* Transmit underrun */
......
...@@ -546,6 +546,7 @@ void ath_ani_calibrate(unsigned long data) ...@@ -546,6 +546,7 @@ void ath_ani_calibrate(unsigned long data)
* The interval must be the shortest necessary to satisfy ANI, * The interval must be the shortest necessary to satisfy ANI,
* short calibration and long calibration. * short calibration and long calibration.
*/ */
ath9k_debug_samp_bb_mac(sc);
cal_interval = ATH_LONG_CALINTERVAL; cal_interval = ATH_LONG_CALINTERVAL;
if (sc->sc_ah->config.enable_ani) if (sc->sc_ah->config.enable_ani)
cal_interval = min(cal_interval, cal_interval = min(cal_interval,
...@@ -978,6 +979,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) ...@@ -978,6 +979,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
sc->hw_busy_count = 0; sc->hw_busy_count = 0;
ath9k_debug_samp_bb_mac(sc);
/* Stop ANI */ /* Stop ANI */
del_timer_sync(&common->ani.timer); del_timer_sync(&common->ani.timer);
......
...@@ -937,7 +937,7 @@ static int ath9k_process_rate(struct ath_common *common, ...@@ -937,7 +937,7 @@ static int ath9k_process_rate(struct ath_common *common,
* No valid hardware bitrate found -- we should not get here * No valid hardware bitrate found -- we should not get here
* because hardware has already validated this frame as OK. * because hardware has already validated this frame as OK.
*/ */
ath_dbg(common, ATH_DBG_XMIT, ath_dbg(common, ATH_DBG_ANY,
"unsupported hw bitrate detected 0x%02x using 1 Mbit\n", "unsupported hw bitrate detected 0x%02x using 1 Mbit\n",
rx_stats->rs_rate); rx_stats->rs_rate);
...@@ -952,23 +952,12 @@ static void ath9k_process_rssi(struct ath_common *common, ...@@ -952,23 +952,12 @@ static void ath9k_process_rssi(struct ath_common *common,
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
struct ath_hw *ah = common->ah; struct ath_hw *ah = common->ah;
int last_rssi; int last_rssi;
__le16 fc;
if ((ah->opmode != NL80211_IFTYPE_STATION) && if (!rx_stats->is_mybeacon ||
(ah->opmode != NL80211_IFTYPE_ADHOC)) ((ah->opmode != NL80211_IFTYPE_STATION) &&
(ah->opmode != NL80211_IFTYPE_ADHOC)))
return; return;
fc = hdr->frame_control;
if (!ieee80211_is_beacon(fc) ||
compare_ether_addr(hdr->addr3, common->curbssid)) {
/* TODO: This doesn't work well if you have stations
* associated to two different APs because curbssid
* is just the last AP that any of the stations associated
* with.
*/
return;
}
if (rx_stats->rs_rssi != ATH9K_RSSI_BAD && !rx_stats->rs_moreaggr) if (rx_stats->rs_rssi != ATH9K_RSSI_BAD && !rx_stats->rs_moreaggr)
ATH_RSSI_LPF(sc->last_rssi, rx_stats->rs_rssi); ATH_RSSI_LPF(sc->last_rssi, rx_stats->rs_rssi);
...@@ -1838,6 +1827,11 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) ...@@ -1838,6 +1827,11 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
hdr = (struct ieee80211_hdr *) (hdr_skb->data + rx_status_len); hdr = (struct ieee80211_hdr *) (hdr_skb->data + rx_status_len);
rxs = IEEE80211_SKB_RXCB(hdr_skb); rxs = IEEE80211_SKB_RXCB(hdr_skb);
if (ieee80211_is_beacon(hdr->frame_control) &&
!compare_ether_addr(hdr->addr3, common->curbssid))
rs.is_mybeacon = true;
else
rs.is_mybeacon = false;
ath_debug_stat_rx(sc, &rs); ath_debug_stat_rx(sc, &rs);
......
...@@ -619,6 +619,7 @@ ...@@ -619,6 +619,7 @@
#define AR_D_GBL_IFS_EIFS 0x10b0 #define AR_D_GBL_IFS_EIFS 0x10b0
#define AR_D_GBL_IFS_EIFS_M 0x0000FFFF #define AR_D_GBL_IFS_EIFS_M 0x0000FFFF
#define AR_D_GBL_IFS_EIFS_RESV0 0xFFFF0000 #define AR_D_GBL_IFS_EIFS_RESV0 0xFFFF0000
#define AR_D_GBL_IFS_EIFS_ASYNC_FIFO 363
#define AR_D_GBL_IFS_MISC 0x10f0 #define AR_D_GBL_IFS_MISC 0x10f0
#define AR_D_GBL_IFS_MISC_LFSR_SLICE_SEL 0x00000007 #define AR_D_GBL_IFS_MISC_LFSR_SLICE_SEL 0x00000007
...@@ -1503,6 +1504,7 @@ enum { ...@@ -1503,6 +1504,7 @@ enum {
#define AR_USEC_TX_LAT_S 14 #define AR_USEC_TX_LAT_S 14
#define AR_USEC_RX_LAT 0x1F800000 #define AR_USEC_RX_LAT 0x1F800000
#define AR_USEC_RX_LAT_S 23 #define AR_USEC_RX_LAT_S 23
#define AR_USEC_ASYNC_FIFO 0x12E00074
#define AR_RESET_TSF 0x8020 #define AR_RESET_TSF 0x8020
#define AR_RESET_TSF_ONCE 0x01000000 #define AR_RESET_TSF_ONCE 0x01000000
......
...@@ -48,8 +48,9 @@ static u16 bits_per_symbol[][2] = { ...@@ -48,8 +48,9 @@ static u16 bits_per_symbol[][2] = {
#define IS_HT_RATE(_rate) ((_rate) & 0x80) #define IS_HT_RATE(_rate) ((_rate) & 0x80)
static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
struct ath_atx_tid *tid, struct ath_atx_tid *tid, struct sk_buff *skb);
struct list_head *bf_head); static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
int tx_flags, struct ath_txq *txq);
static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
struct ath_txq *txq, struct list_head *bf_q, struct ath_txq *txq, struct list_head *bf_q,
struct ath_tx_status *ts, int txok, int sendbar); struct ath_tx_status *ts, int txok, int sendbar);
...@@ -61,6 +62,10 @@ static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, ...@@ -61,6 +62,10 @@ static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
int txok, bool update_rc); int txok, bool update_rc);
static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
int seqno); int seqno);
static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
struct ath_txq *txq,
struct ath_atx_tid *tid,
struct sk_buff *skb);
enum { enum {
MCS_HT20, MCS_HT20,
...@@ -129,7 +134,7 @@ static void ath_tx_resume_tid(struct ath_softc *sc, struct ath_atx_tid *tid) ...@@ -129,7 +134,7 @@ static void ath_tx_resume_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
spin_lock_bh(&txq->axq_lock); spin_lock_bh(&txq->axq_lock);
tid->paused = false; tid->paused = false;
if (list_empty(&tid->buf_q)) if (skb_queue_empty(&tid->buf_q))
goto unlock; goto unlock;
ath_tx_queue_tid(txq, tid); ath_tx_queue_tid(txq, tid);
...@@ -149,6 +154,7 @@ static struct ath_frame_info *get_frame_info(struct sk_buff *skb) ...@@ -149,6 +154,7 @@ static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
{ {
struct ath_txq *txq = tid->ac->txq; struct ath_txq *txq = tid->ac->txq;
struct sk_buff *skb;
struct ath_buf *bf; struct ath_buf *bf;
struct list_head bf_head; struct list_head bf_head;
struct ath_tx_status ts; struct ath_tx_status ts;
...@@ -159,17 +165,17 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) ...@@ -159,17 +165,17 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
memset(&ts, 0, sizeof(ts)); memset(&ts, 0, sizeof(ts));
spin_lock_bh(&txq->axq_lock); spin_lock_bh(&txq->axq_lock);
while (!list_empty(&tid->buf_q)) { while ((skb = __skb_dequeue(&tid->buf_q))) {
bf = list_first_entry(&tid->buf_q, struct ath_buf, list); fi = get_frame_info(skb);
list_move_tail(&bf->list, &bf_head); bf = fi->bf;
spin_unlock_bh(&txq->axq_lock); spin_unlock_bh(&txq->axq_lock);
fi = get_frame_info(bf->bf_mpdu); if (bf && fi->retries) {
if (fi->retries) { list_add_tail(&bf->list, &bf_head);
ath_tx_update_baw(sc, tid, fi->seqno); ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 1); ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 1);
} else { } else {
ath_tx_send_normal(sc, txq, NULL, &bf_head); ath_tx_send_normal(sc, txq, NULL, skb);
} }
spin_lock_bh(&txq->axq_lock); spin_lock_bh(&txq->axq_lock);
} }
...@@ -219,6 +225,7 @@ static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq, ...@@ -219,6 +225,7 @@ static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq,
struct ath_atx_tid *tid) struct ath_atx_tid *tid)
{ {
struct sk_buff *skb;
struct ath_buf *bf; struct ath_buf *bf;
struct list_head bf_head; struct list_head bf_head;
struct ath_tx_status ts; struct ath_tx_status ts;
...@@ -227,16 +234,21 @@ static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq, ...@@ -227,16 +234,21 @@ static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq,
memset(&ts, 0, sizeof(ts)); memset(&ts, 0, sizeof(ts));
INIT_LIST_HEAD(&bf_head); INIT_LIST_HEAD(&bf_head);
for (;;) { while ((skb = __skb_dequeue(&tid->buf_q))) {
if (list_empty(&tid->buf_q)) fi = get_frame_info(skb);
break; bf = fi->bf;
if (!bf) {
spin_unlock(&txq->axq_lock);
ath_tx_complete(sc, skb, ATH_TX_ERROR, txq);
spin_lock(&txq->axq_lock);
continue;
}
bf = list_first_entry(&tid->buf_q, struct ath_buf, list); list_add_tail(&bf->list, &bf_head);
list_move_tail(&bf->list, &bf_head);
fi = get_frame_info(bf->bf_mpdu);
if (fi->retries) if (fi->retries)
ath_tx_update_baw(sc, tid, fi->seqno); ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
spin_unlock(&txq->axq_lock); spin_unlock(&txq->axq_lock);
ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0); ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0);
...@@ -326,7 +338,7 @@ static void ath_tx_count_frames(struct ath_softc *sc, struct ath_buf *bf, ...@@ -326,7 +338,7 @@ static void ath_tx_count_frames(struct ath_softc *sc, struct ath_buf *bf,
while (bf) { while (bf) {
fi = get_frame_info(bf->bf_mpdu); fi = get_frame_info(bf->bf_mpdu);
ba_index = ATH_BA_INDEX(seq_st, fi->seqno); ba_index = ATH_BA_INDEX(seq_st, bf->bf_state.seqno);
(*nframes)++; (*nframes)++;
if (!txok || (isaggr && !ATH_BA_ISSET(ba, ba_index))) if (!txok || (isaggr && !ATH_BA_ISSET(ba, ba_index)))
...@@ -349,7 +361,8 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, ...@@ -349,7 +361,8 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
struct ieee80211_tx_info *tx_info; struct ieee80211_tx_info *tx_info;
struct ath_atx_tid *tid = NULL; struct ath_atx_tid *tid = NULL;
struct ath_buf *bf_next, *bf_last = bf->bf_lastbf; struct ath_buf *bf_next, *bf_last = bf->bf_lastbf;
struct list_head bf_head, bf_pending; struct list_head bf_head;
struct sk_buff_head bf_pending;
u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0; u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0;
u32 ba[WME_BA_BMP_SIZE >> 5]; u32 ba[WME_BA_BMP_SIZE >> 5];
int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0; int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0;
...@@ -422,11 +435,12 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, ...@@ -422,11 +435,12 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
} }
} }
INIT_LIST_HEAD(&bf_pending); __skb_queue_head_init(&bf_pending);
INIT_LIST_HEAD(&bf_head);
ath_tx_count_frames(sc, bf, ts, txok, &nframes, &nbad); ath_tx_count_frames(sc, bf, ts, txok, &nframes, &nbad);
while (bf) { while (bf) {
u16 seqno = bf->bf_state.seqno;
txfail = txpending = sendbar = 0; txfail = txpending = sendbar = 0;
bf_next = bf->bf_next; bf_next = bf->bf_next;
...@@ -434,7 +448,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, ...@@ -434,7 +448,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
tx_info = IEEE80211_SKB_CB(skb); tx_info = IEEE80211_SKB_CB(skb);
fi = get_frame_info(skb); fi = get_frame_info(skb);
if (ATH_BA_ISSET(ba, ATH_BA_INDEX(seq_st, fi->seqno))) { if (ATH_BA_ISSET(ba, ATH_BA_INDEX(seq_st, seqno))) {
/* transmit completion, subframe is /* transmit completion, subframe is
* acked by block ack */ * acked by block ack */
acked_cnt++; acked_cnt++;
...@@ -467,10 +481,10 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, ...@@ -467,10 +481,10 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
* Make sure the last desc is reclaimed if it * Make sure the last desc is reclaimed if it
* not a holding desc. * not a holding desc.
*/ */
if (!bf_last->bf_stale || bf_next != NULL) INIT_LIST_HEAD(&bf_head);
if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) ||
bf_next != NULL || !bf_last->bf_stale)
list_move_tail(&bf->list, &bf_head); list_move_tail(&bf->list, &bf_head);
else
INIT_LIST_HEAD(&bf_head);
if (!txpending || (tid->state & AGGR_CLEANUP)) { if (!txpending || (tid->state & AGGR_CLEANUP)) {
/* /*
...@@ -478,7 +492,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, ...@@ -478,7 +492,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
* block-ack window * block-ack window
*/ */
spin_lock_bh(&txq->axq_lock); spin_lock_bh(&txq->axq_lock);
ath_tx_update_baw(sc, tid, fi->seqno); ath_tx_update_baw(sc, tid, seqno);
spin_unlock_bh(&txq->axq_lock); spin_unlock_bh(&txq->axq_lock);
if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) { if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) {
...@@ -506,7 +520,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, ...@@ -506,7 +520,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
*/ */
if (!tbf) { if (!tbf) {
spin_lock_bh(&txq->axq_lock); spin_lock_bh(&txq->axq_lock);
ath_tx_update_baw(sc, tid, fi->seqno); ath_tx_update_baw(sc, tid, seqno);
spin_unlock_bh(&txq->axq_lock); spin_unlock_bh(&txq->axq_lock);
bf->bf_state.bf_type |= bf->bf_state.bf_type |=
...@@ -521,7 +535,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, ...@@ -521,7 +535,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
ath9k_hw_cleartxdesc(sc->sc_ah, ath9k_hw_cleartxdesc(sc->sc_ah,
tbf->bf_desc); tbf->bf_desc);
list_add_tail(&tbf->list, &bf_head); fi->bf = tbf;
} else { } else {
/* /*
* Clear descriptor status words for * Clear descriptor status words for
...@@ -536,21 +550,21 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, ...@@ -536,21 +550,21 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
* Put this buffer to the temporary pending * Put this buffer to the temporary pending
* queue to retain ordering * queue to retain ordering
*/ */
list_splice_tail_init(&bf_head, &bf_pending); __skb_queue_tail(&bf_pending, skb);
} }
bf = bf_next; bf = bf_next;
} }
/* prepend un-acked frames to the beginning of the pending frame queue */ /* prepend un-acked frames to the beginning of the pending frame queue */
if (!list_empty(&bf_pending)) { if (!skb_queue_empty(&bf_pending)) {
if (an->sleeping) if (an->sleeping)
ieee80211_sta_set_tim(sta); ieee80211_sta_set_tim(sta);
spin_lock_bh(&txq->axq_lock); spin_lock_bh(&txq->axq_lock);
if (clear_filter) if (clear_filter)
tid->ac->clear_ps_filter = true; tid->ac->clear_ps_filter = true;
list_splice(&bf_pending, &tid->buf_q); skb_queue_splice(&bf_pending, &tid->buf_q);
if (!an->sleeping) if (!an->sleeping)
ath_tx_queue_tid(txq, tid); ath_tx_queue_tid(txq, tid);
spin_unlock_bh(&txq->axq_lock); spin_unlock_bh(&txq->axq_lock);
...@@ -582,7 +596,10 @@ static bool ath_lookup_legacy(struct ath_buf *bf) ...@@ -582,7 +596,10 @@ static bool ath_lookup_legacy(struct ath_buf *bf)
tx_info = IEEE80211_SKB_CB(skb); tx_info = IEEE80211_SKB_CB(skb);
rates = tx_info->control.rates; rates = tx_info->control.rates;
for (i = 3; i >= 0; i--) { for (i = 0; i < 4; i++) {
if (!rates[i].count || rates[i].idx < 0)
break;
if (!(rates[i].flags & IEEE80211_TX_RC_MCS)) if (!(rates[i].flags & IEEE80211_TX_RC_MCS))
return true; return true;
} }
...@@ -740,22 +757,33 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc, ...@@ -740,22 +757,33 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
int *aggr_len) int *aggr_len)
{ {
#define PADBYTES(_len) ((4 - ((_len) % 4)) % 4) #define PADBYTES(_len) ((4 - ((_len) % 4)) % 4)
struct ath_buf *bf, *bf_first, *bf_prev = NULL; struct ath_buf *bf, *bf_first = NULL, *bf_prev = NULL;
int rl = 0, nframes = 0, ndelim, prev_al = 0; int rl = 0, nframes = 0, ndelim, prev_al = 0;
u16 aggr_limit = 0, al = 0, bpad = 0, u16 aggr_limit = 0, al = 0, bpad = 0,
al_delta, h_baw = tid->baw_size / 2; al_delta, h_baw = tid->baw_size / 2;
enum ATH_AGGR_STATUS status = ATH_AGGR_DONE; enum ATH_AGGR_STATUS status = ATH_AGGR_DONE;
struct ieee80211_tx_info *tx_info; struct ieee80211_tx_info *tx_info;
struct ath_frame_info *fi; struct ath_frame_info *fi;
struct sk_buff *skb;
bf_first = list_first_entry(&tid->buf_q, struct ath_buf, list); u16 seqno;
do { do {
bf = list_first_entry(&tid->buf_q, struct ath_buf, list); skb = skb_peek(&tid->buf_q);
fi = get_frame_info(bf->bf_mpdu); fi = get_frame_info(skb);
bf = fi->bf;
if (!fi->bf)
bf = ath_tx_setup_buffer(sc, txq, tid, skb);
if (!bf)
continue;
bf->bf_state.bf_type |= BUF_AMPDU;
seqno = bf->bf_state.seqno;
if (!bf_first)
bf_first = bf;
/* do not step over block-ack window */ /* do not step over block-ack window */
if (!BAW_WITHIN(tid->seq_start, tid->baw_size, fi->seqno)) { if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno)) {
status = ATH_AGGR_BAW_CLOSED; status = ATH_AGGR_BAW_CLOSED;
break; break;
} }
...@@ -803,9 +831,11 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc, ...@@ -803,9 +831,11 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
/* link buffers of this frame to the aggregate */ /* link buffers of this frame to the aggregate */
if (!fi->retries) if (!fi->retries)
ath_tx_addto_baw(sc, tid, fi->seqno); ath_tx_addto_baw(sc, tid, seqno);
ath9k_hw_set11n_aggr_middle(sc->sc_ah, bf->bf_desc, ndelim); ath9k_hw_set11n_aggr_middle(sc->sc_ah, bf->bf_desc, ndelim);
list_move_tail(&bf->list, bf_q);
__skb_unlink(skb, &tid->buf_q);
list_add_tail(&bf->list, bf_q);
if (bf_prev) { if (bf_prev) {
bf_prev->bf_next = bf; bf_prev->bf_next = bf;
ath9k_hw_set_desc_link(sc->sc_ah, bf_prev->bf_desc, ath9k_hw_set_desc_link(sc->sc_ah, bf_prev->bf_desc,
...@@ -813,7 +843,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc, ...@@ -813,7 +843,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
} }
bf_prev = bf; bf_prev = bf;
} while (!list_empty(&tid->buf_q)); } while (!skb_queue_empty(&tid->buf_q));
*aggr_len = al; *aggr_len = al;
...@@ -831,7 +861,7 @@ static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq, ...@@ -831,7 +861,7 @@ static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
int aggr_len; int aggr_len;
do { do {
if (list_empty(&tid->buf_q)) if (skb_queue_empty(&tid->buf_q))
return; return;
INIT_LIST_HEAD(&bf_q); INIT_LIST_HEAD(&bf_q);
...@@ -952,7 +982,7 @@ bool ath_tx_aggr_sleep(struct ath_softc *sc, struct ath_node *an) ...@@ -952,7 +982,7 @@ bool ath_tx_aggr_sleep(struct ath_softc *sc, struct ath_node *an)
spin_lock_bh(&txq->axq_lock); spin_lock_bh(&txq->axq_lock);
if (!list_empty(&tid->buf_q)) if (!skb_queue_empty(&tid->buf_q))
buffered = true; buffered = true;
tid->sched = false; tid->sched = false;
...@@ -985,7 +1015,7 @@ void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an) ...@@ -985,7 +1015,7 @@ void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an)
spin_lock_bh(&txq->axq_lock); spin_lock_bh(&txq->axq_lock);
ac->clear_ps_filter = true; ac->clear_ps_filter = true;
if (!list_empty(&tid->buf_q) && !tid->paused) { if (!skb_queue_empty(&tid->buf_q) && !tid->paused) {
ath_tx_queue_tid(txq, tid); ath_tx_queue_tid(txq, tid);
ath_txq_schedule(sc, txq); ath_txq_schedule(sc, txq);
} }
...@@ -1329,7 +1359,7 @@ void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq) ...@@ -1329,7 +1359,7 @@ void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
* add tid to round-robin queue if more frames * add tid to round-robin queue if more frames
* are pending for the tid * are pending for the tid
*/ */
if (!list_empty(&tid->buf_q)) if (!skb_queue_empty(&tid->buf_q))
ath_tx_queue_tid(txq, tid); ath_tx_queue_tid(txq, tid);
if (tid == last_tid || if (tid == last_tid ||
...@@ -1421,12 +1451,11 @@ static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, ...@@ -1421,12 +1451,11 @@ static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
} }
static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid, static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
struct ath_buf *bf, struct ath_tx_control *txctl) struct sk_buff *skb, struct ath_tx_control *txctl)
{ {
struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu); struct ath_frame_info *fi = get_frame_info(skb);
struct list_head bf_head; struct list_head bf_head;
struct ath_buf *bf;
bf->bf_state.bf_type |= BUF_AMPDU;
/* /*
* Do not queue to h/w when any of the following conditions is true: * Do not queue to h/w when any of the following conditions is true:
...@@ -1435,26 +1464,30 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid, ...@@ -1435,26 +1464,30 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
* - seqno is not within block-ack window * - seqno is not within block-ack window
* - h/w queue depth exceeds low water mark * - h/w queue depth exceeds low water mark
*/ */
if (!list_empty(&tid->buf_q) || tid->paused || if (!skb_queue_empty(&tid->buf_q) || tid->paused ||
!BAW_WITHIN(tid->seq_start, tid->baw_size, fi->seqno) || !BAW_WITHIN(tid->seq_start, tid->baw_size, tid->seq_next) ||
txctl->txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) { txctl->txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) {
/* /*
* Add this frame to software queue for scheduling later * Add this frame to software queue for scheduling later
* for aggregation. * for aggregation.
*/ */
TX_STAT_INC(txctl->txq->axq_qnum, a_queued_sw); TX_STAT_INC(txctl->txq->axq_qnum, a_queued_sw);
list_add_tail(&bf->list, &tid->buf_q); __skb_queue_tail(&tid->buf_q, skb);
if (!txctl->an || !txctl->an->sleeping) if (!txctl->an || !txctl->an->sleeping)
ath_tx_queue_tid(txctl->txq, tid); ath_tx_queue_tid(txctl->txq, tid);
return; return;
} }
bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb);
if (!bf)
return;
bf->bf_state.bf_type |= BUF_AMPDU;
INIT_LIST_HEAD(&bf_head); INIT_LIST_HEAD(&bf_head);
list_add(&bf->list, &bf_head); list_add(&bf->list, &bf_head);
/* Add sub-frame to BAW */ /* Add sub-frame to BAW */
if (!fi->retries) ath_tx_addto_baw(sc, tid, bf->bf_state.seqno);
ath_tx_addto_baw(sc, tid, fi->seqno);
/* Queue to h/w without aggregation */ /* Queue to h/w without aggregation */
TX_STAT_INC(txctl->txq->axq_qnum, a_queued_hw); TX_STAT_INC(txctl->txq->axq_qnum, a_queued_hw);
...@@ -1464,13 +1497,21 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid, ...@@ -1464,13 +1497,21 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
} }
static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
struct ath_atx_tid *tid, struct ath_atx_tid *tid, struct sk_buff *skb)
struct list_head *bf_head)
{ {
struct ath_frame_info *fi; struct ath_frame_info *fi = get_frame_info(skb);
struct list_head bf_head;
struct ath_buf *bf; struct ath_buf *bf;
bf = list_first_entry(bf_head, struct ath_buf, list); bf = fi->bf;
if (!bf)
bf = ath_tx_setup_buffer(sc, txq, tid, skb);
if (!bf)
return;
INIT_LIST_HEAD(&bf_head);
list_add_tail(&bf->list, &bf_head);
bf->bf_state.bf_type &= ~BUF_AMPDU; bf->bf_state.bf_type &= ~BUF_AMPDU;
/* update starting sequence number for subsequent ADDBA request */ /* update starting sequence number for subsequent ADDBA request */
...@@ -1478,9 +1519,8 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, ...@@ -1478,9 +1519,8 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
INCR(tid->seq_start, IEEE80211_SEQ_MAX); INCR(tid->seq_start, IEEE80211_SEQ_MAX);
bf->bf_lastbf = bf; bf->bf_lastbf = bf;
fi = get_frame_info(bf->bf_mpdu);
ath_buf_set_rate(sc, bf, fi->framelen); ath_buf_set_rate(sc, bf, fi->framelen);
ath_tx_txqaddbuf(sc, txq, bf_head, false); ath_tx_txqaddbuf(sc, txq, &bf_head, false);
TX_STAT_INC(txq->axq_qnum, queued); TX_STAT_INC(txq->axq_qnum, queued);
} }
...@@ -1510,39 +1550,19 @@ static enum ath9k_pkt_type get_hw_packet_type(struct sk_buff *skb) ...@@ -1510,39 +1550,19 @@ static enum ath9k_pkt_type get_hw_packet_type(struct sk_buff *skb)
static void setup_frame_info(struct ieee80211_hw *hw, struct sk_buff *skb, static void setup_frame_info(struct ieee80211_hw *hw, struct sk_buff *skb,
int framelen) int framelen)
{ {
struct ath_softc *sc = hw->priv;
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
struct ieee80211_sta *sta = tx_info->control.sta; struct ieee80211_sta *sta = tx_info->control.sta;
struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; struct ieee80211_key_conf *hw_key = tx_info->control.hw_key;
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct ath_frame_info *fi = get_frame_info(skb); struct ath_frame_info *fi = get_frame_info(skb);
struct ath_node *an = NULL; struct ath_node *an = NULL;
struct ath_atx_tid *tid;
enum ath9k_key_type keytype; enum ath9k_key_type keytype;
u16 seqno = 0;
u8 tidno;
keytype = ath9k_cmn_get_hw_crypto_keytype(skb); keytype = ath9k_cmn_get_hw_crypto_keytype(skb);
if (sta) if (sta)
an = (struct ath_node *) sta->drv_priv; an = (struct ath_node *) sta->drv_priv;
hdr = (struct ieee80211_hdr *)skb->data;
if (an && ieee80211_is_data_qos(hdr->frame_control) &&
conf_is_ht(&hw->conf) && (sc->sc_flags & SC_OP_TXAGGR)) {
tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK;
/*
* Override seqno set by upper layer with the one
* in tx aggregation state.
*/
tid = ATH_AN_2_TID(an, tidno);
seqno = tid->seq_next;
hdr->seq_ctrl = cpu_to_le16(seqno << IEEE80211_SEQ_SEQ_SHIFT);
INCR(tid->seq_next, IEEE80211_SEQ_MAX);
}
memset(fi, 0, sizeof(*fi)); memset(fi, 0, sizeof(*fi));
if (hw_key) if (hw_key)
fi->keyix = hw_key->hw_key_idx; fi->keyix = hw_key->hw_key_idx;
...@@ -1552,7 +1572,6 @@ static void setup_frame_info(struct ieee80211_hw *hw, struct sk_buff *skb, ...@@ -1552,7 +1572,6 @@ static void setup_frame_info(struct ieee80211_hw *hw, struct sk_buff *skb,
fi->keyix = ATH9K_TXKEYIX_INVALID; fi->keyix = ATH9K_TXKEYIX_INVALID;
fi->keytype = keytype; fi->keytype = keytype;
fi->framelen = framelen; fi->framelen = framelen;
fi->seqno = seqno;
} }
static int setup_tx_flags(struct sk_buff *skb) static int setup_tx_flags(struct sk_buff *skb)
...@@ -1724,26 +1743,39 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len) ...@@ -1724,26 +1743,39 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len)
} }
static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw, /*
* Assign a descriptor (and sequence number if necessary,
* and map buffer for DMA. Frees skb on error
*/
static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
struct ath_txq *txq, struct ath_txq *txq,
struct ath_atx_tid *tid,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct ath_softc *sc = hw->priv;
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_frame_info *fi = get_frame_info(skb); struct ath_frame_info *fi = get_frame_info(skb);
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct ath_buf *bf; struct ath_buf *bf;
struct ath_desc *ds; struct ath_desc *ds;
int frm_type; int frm_type;
u16 seqno;
bf = ath_tx_get_buffer(sc); bf = ath_tx_get_buffer(sc);
if (!bf) { if (!bf) {
ath_dbg(common, ATH_DBG_XMIT, "TX buffers are full\n"); ath_dbg(common, ATH_DBG_XMIT, "TX buffers are full\n");
return NULL; goto error;
} }
ATH_TXBUF_RESET(bf); ATH_TXBUF_RESET(bf);
if (tid) {
seqno = tid->seq_next;
hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT);
INCR(tid->seq_next, IEEE80211_SEQ_MAX);
bf->bf_state.seqno = seqno;
}
bf->bf_flags = setup_tx_flags(skb); bf->bf_flags = setup_tx_flags(skb);
bf->bf_mpdu = skb; bf->bf_mpdu = skb;
...@@ -1755,7 +1787,7 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw, ...@@ -1755,7 +1787,7 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw,
ath_err(ath9k_hw_common(sc->sc_ah), ath_err(ath9k_hw_common(sc->sc_ah),
"dma_mapping_error() on TX\n"); "dma_mapping_error() on TX\n");
ath_tx_return_buffer(sc, bf); ath_tx_return_buffer(sc, bf);
return NULL; goto error;
} }
frm_type = get_hw_packet_type(skb); frm_type = get_hw_packet_type(skb);
...@@ -1774,19 +1806,23 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw, ...@@ -1774,19 +1806,23 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw,
bf->bf_buf_addr, bf->bf_buf_addr,
txq->axq_qnum); txq->axq_qnum);
fi->bf = bf;
return bf; return bf;
error:
dev_kfree_skb_any(skb);
return NULL;
} }
/* FIXME: tx power */ /* FIXME: tx power */
static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf, static void ath_tx_start_dma(struct ath_softc *sc, struct sk_buff *skb,
struct ath_tx_control *txctl) struct ath_tx_control *txctl)
{ {
struct sk_buff *skb = bf->bf_mpdu;
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct list_head bf_head;
struct ath_atx_tid *tid = NULL; struct ath_atx_tid *tid = NULL;
struct ath_buf *bf;
u8 tidno; u8 tidno;
spin_lock_bh(&txctl->txq->axq_lock); spin_lock_bh(&txctl->txq->axq_lock);
...@@ -1804,10 +1840,11 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf, ...@@ -1804,10 +1840,11 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,
* Try aggregation if it's a unicast data frame * Try aggregation if it's a unicast data frame
* and the destination is HT capable. * and the destination is HT capable.
*/ */
ath_tx_send_ampdu(sc, tid, bf, txctl); ath_tx_send_ampdu(sc, tid, skb, txctl);
} else { } else {
INIT_LIST_HEAD(&bf_head); bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb);
list_add_tail(&bf->list, &bf_head); if (!bf)
goto out;
bf->bf_state.bfs_paprd = txctl->paprd; bf->bf_state.bfs_paprd = txctl->paprd;
...@@ -1821,9 +1858,10 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf, ...@@ -1821,9 +1858,10 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,
if (tx_info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT) if (tx_info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
ath9k_hw_set_clrdmask(sc->sc_ah, bf->bf_desc, true); ath9k_hw_set_clrdmask(sc->sc_ah, bf->bf_desc, true);
ath_tx_send_normal(sc, txctl->txq, tid, &bf_head); ath_tx_send_normal(sc, txctl->txq, tid, skb);
} }
out:
spin_unlock_bh(&txctl->txq->axq_lock); spin_unlock_bh(&txctl->txq->axq_lock);
} }
...@@ -1837,7 +1875,6 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb, ...@@ -1837,7 +1875,6 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
struct ieee80211_vif *vif = info->control.vif; struct ieee80211_vif *vif = info->control.vif;
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
struct ath_txq *txq = txctl->txq; struct ath_txq *txq = txctl->txq;
struct ath_buf *bf;
int padpos, padsize; int padpos, padsize;
int frmlen = skb->len + FCS_LEN; int frmlen = skb->len + FCS_LEN;
int q; int q;
...@@ -1884,10 +1921,6 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb, ...@@ -1884,10 +1921,6 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
* info are no longer valid (overwritten by the ath_frame_info data. * info are no longer valid (overwritten by the ath_frame_info data.
*/ */
bf = ath_tx_setup_buffer(hw, txctl->txq, skb);
if (unlikely(!bf))
return -ENOMEM;
q = skb_get_queue_mapping(skb); q = skb_get_queue_mapping(skb);
spin_lock_bh(&txq->axq_lock); spin_lock_bh(&txq->axq_lock);
if (txq == sc->tx.txq_map[q] && if (txq == sc->tx.txq_map[q] &&
...@@ -1897,8 +1930,7 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb, ...@@ -1897,8 +1930,7 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
} }
spin_unlock_bh(&txq->axq_lock); spin_unlock_bh(&txq->axq_lock);
ath_tx_start_dma(sc, bf, txctl); ath_tx_start_dma(sc, skb, txctl);
return 0; return 0;
} }
...@@ -2391,7 +2423,7 @@ void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an) ...@@ -2391,7 +2423,7 @@ void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)
tid->sched = false; tid->sched = false;
tid->paused = false; tid->paused = false;
tid->state &= ~AGGR_CLEANUP; tid->state &= ~AGGR_CLEANUP;
INIT_LIST_HEAD(&tid->buf_q); __skb_queue_head_init(&tid->buf_q);
acno = TID_TO_WME_AC(tidno); acno = TID_TO_WME_AC(tidno);
tid->ac = &an->ac[acno]; tid->ac = &an->ac[acno];
tid->state &= ~AGGR_ADDBA_COMPLETE; tid->state &= ~AGGR_ADDBA_COMPLETE;
......
...@@ -57,22 +57,18 @@ struct sk_buff *ath_rxbuf_alloc(struct ath_common *common, ...@@ -57,22 +57,18 @@ struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
} }
EXPORT_SYMBOL(ath_rxbuf_alloc); EXPORT_SYMBOL(ath_rxbuf_alloc);
int ath_printk(const char *level, struct ath_common *common, void ath_printk(const char *level, const char *fmt, ...)
const char *fmt, ...)
{ {
struct va_format vaf; struct va_format vaf;
va_list args; va_list args;
int rtn;
va_start(args, fmt); va_start(args, fmt);
vaf.fmt = fmt; vaf.fmt = fmt;
vaf.va = &args; vaf.va = &args;
rtn = printk("%sath: %pV", level, &vaf); printk("%sath: %pV", level, &vaf);
va_end(args); va_end(args);
return rtn;
} }
EXPORT_SYMBOL(ath_printk); EXPORT_SYMBOL(ath_printk);
...@@ -124,12 +124,12 @@ config B43_PHY_LP ...@@ -124,12 +124,12 @@ config B43_PHY_LP
(802.11a support is optional, and currently disabled). (802.11a support is optional, and currently disabled).
config B43_PHY_HT config B43_PHY_HT
bool "Support for HT-PHY devices (BROKEN)" bool "Support for HT-PHY (high throughput) devices (EXPERIMENTAL)"
depends on B43 && BROKEN depends on B43 && EXPERIMENTAL
---help--- ---help---
Support for the HT-PHY. Support for the HT-PHY.
Say N, this is BROKEN and crashes driver. Enables support for BCM4331 and possibly other chipsets with that PHY.
config B43_PHY_LCN config B43_PHY_LCN
bool "Support for LCN-PHY devices (BROKEN)" bool "Support for LCN-PHY devices (BROKEN)"
......
...@@ -419,33 +419,34 @@ static int alloc_ringmemory(struct b43_dmaring *ring) ...@@ -419,33 +419,34 @@ static int alloc_ringmemory(struct b43_dmaring *ring)
gfp_t flags = GFP_KERNEL; gfp_t flags = GFP_KERNEL;
/* The specs call for 4K buffers for 30- and 32-bit DMA with 4K /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K
* alignment and 8K buffers for 64-bit DMA with 8K alignment. Testing * alignment and 8K buffers for 64-bit DMA with 8K alignment.
* has shown that 4K is sufficient for the latter as long as the buffer * In practice we could use smaller buffers for the latter, but the
* does not cross an 8K boundary. * alignment is really important because of the hardware bug. If bit
* * 0x00001000 is used in DMA address, some hardware (like BCM4331)
* For unknown reasons - possibly a hardware error - the BCM4311 rev * copies that bit into B43_DMA64_RXSTATUS and we get false values from
* 02, which uses 64-bit DMA, needs the ring buffer in very low memory, * B43_DMA64_RXSTATDPTR. Let's just use 8K buffers even if we don't use
* which accounts for the GFP_DMA flag below. * more than 256 slots for ring.
*
* The flags here must match the flags in free_ringmemory below!
*/ */
if (ring->type == B43_DMA_64BIT) u16 ring_mem_size = (ring->type == B43_DMA_64BIT) ?
flags |= GFP_DMA; B43_DMA64_RINGMEMSIZE : B43_DMA32_RINGMEMSIZE;
ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev, ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev,
B43_DMA_RINGMEMSIZE, ring_mem_size, &(ring->dmabase),
&(ring->dmabase), flags); flags);
if (!ring->descbase) { if (!ring->descbase) {
b43err(ring->dev->wl, "DMA ringmemory allocation failed\n"); b43err(ring->dev->wl, "DMA ringmemory allocation failed\n");
return -ENOMEM; return -ENOMEM;
} }
memset(ring->descbase, 0, B43_DMA_RINGMEMSIZE); memset(ring->descbase, 0, ring_mem_size);
return 0; return 0;
} }
static void free_ringmemory(struct b43_dmaring *ring) static void free_ringmemory(struct b43_dmaring *ring)
{ {
dma_free_coherent(ring->dev->dev->dma_dev, B43_DMA_RINGMEMSIZE, u16 ring_mem_size = (ring->type == B43_DMA_64BIT) ?
B43_DMA64_RINGMEMSIZE : B43_DMA32_RINGMEMSIZE;
dma_free_coherent(ring->dev->dev->dma_dev, ring_mem_size,
ring->descbase, ring->dmabase); ring->descbase, ring->dmabase);
} }
......
...@@ -161,7 +161,8 @@ struct b43_dmadesc_generic { ...@@ -161,7 +161,8 @@ struct b43_dmadesc_generic {
} __packed; } __packed;
/* Misc DMA constants */ /* Misc DMA constants */
#define B43_DMA_RINGMEMSIZE PAGE_SIZE #define B43_DMA32_RINGMEMSIZE 4096
#define B43_DMA64_RINGMEMSIZE 8192
/* Offset of frame with actual data */ /* Offset of frame with actual data */
#define B43_DMA0_RX_FW598_FO 38 #define B43_DMA0_RX_FW598_FO 38
#define B43_DMA0_RX_FW351_FO 30 #define B43_DMA0_RX_FW351_FO 30
......
...@@ -4131,10 +4131,13 @@ static void b43_op_configure_filter(struct ieee80211_hw *hw, ...@@ -4131,10 +4131,13 @@ static void b43_op_configure_filter(struct ieee80211_hw *hw,
* because the core might be gone away while we unlocked the mutex. */ * because the core might be gone away while we unlocked the mutex. */
static struct b43_wldev * b43_wireless_core_stop(struct b43_wldev *dev) static struct b43_wldev * b43_wireless_core_stop(struct b43_wldev *dev)
{ {
struct b43_wl *wl = dev->wl; struct b43_wl *wl;
struct b43_wldev *orig_dev; struct b43_wldev *orig_dev;
u32 mask; u32 mask;
if (!dev)
return NULL;
wl = dev->wl;
redo: redo:
if (!dev || b43_status(dev) < B43_STAT_STARTED) if (!dev || b43_status(dev) < B43_STAT_STARTED)
return dev; return dev;
......
...@@ -43,6 +43,8 @@ ...@@ -43,6 +43,8 @@
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-helpers.h" #include "iwl-helpers.h"
#include "iwl-agn-hw.h" #include "iwl-agn-hw.h"
#include "iwl-shared.h"
#include "iwl-pci.h"
/* Highest firmware API version supported */ /* Highest firmware API version supported */
#define IWL1000_UCODE_API_MAX 6 #define IWL1000_UCODE_API_MAX 6
...@@ -76,21 +78,21 @@ ...@@ -76,21 +78,21 @@
static void iwl1000_set_ct_threshold(struct iwl_priv *priv) static void iwl1000_set_ct_threshold(struct iwl_priv *priv)
{ {
/* want Celsius */ /* want Celsius */
priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY; hw_params(priv).ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY;
priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD; hw_params(priv).ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
} }
/* NIC configuration for 1000 series */ /* NIC configuration for 1000 series */
static void iwl1000_nic_config(struct iwl_priv *priv) static void iwl1000_nic_config(struct iwl_priv *priv)
{ {
/* set CSR_HW_CONFIG_REG for uCode use */ /* set CSR_HW_CONFIG_REG for uCode use */
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, iwl_set_bit(bus(priv), CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
/* Setting digital SVR for 1000 card to 1.32V */ /* Setting digital SVR for 1000 card to 1.32V */
/* locking is acquired in iwl_set_bits_mask_prph() function */ /* locking is acquired in iwl_set_bits_mask_prph() function */
iwl_set_bits_mask_prph(priv, APMG_DIGITAL_SVR_REG, iwl_set_bits_mask_prph(bus(priv), APMG_DIGITAL_SVR_REG,
APMG_SVR_DIGITAL_VOLTAGE_1_32, APMG_SVR_DIGITAL_VOLTAGE_1_32,
~APMG_SVR_VOLTAGE_CONFIG_BIT_MSK); ~APMG_SVR_VOLTAGE_CONFIG_BIT_MSK);
} }
...@@ -127,43 +129,39 @@ static int iwl1000_hw_set_hw_params(struct iwl_priv *priv) ...@@ -127,43 +129,39 @@ static int iwl1000_hw_set_hw_params(struct iwl_priv *priv)
priv->cfg->base_params->num_of_queues = priv->cfg->base_params->num_of_queues =
iwlagn_mod_params.num_of_queues; iwlagn_mod_params.num_of_queues;
priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues; hw_params(priv).max_txq_num = priv->cfg->base_params->num_of_queues;
priv->hw_params.scd_bc_tbls_size = hw_params(priv).max_stations = IWLAGN_STATION_COUNT;
priv->cfg->base_params->num_of_queues *
sizeof(struct iwlagn_scd_bc_tbl);
priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
priv->hw_params.max_stations = IWLAGN_STATION_COUNT;
priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID; priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE; hw_params(priv).max_data_size = IWLAGN_RTC_DATA_SIZE;
priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE; hw_params(priv).max_inst_size = IWLAGN_RTC_INST_SIZE;
priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ); hw_params(priv).ht40_channel = BIT(IEEE80211_BAND_2GHZ);
priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant); hw_params(priv).tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
if (priv->cfg->rx_with_siso_diversity) if (priv->cfg->rx_with_siso_diversity)
priv->hw_params.rx_chains_num = 1; hw_params(priv).rx_chains_num = 1;
else else
priv->hw_params.rx_chains_num = hw_params(priv).rx_chains_num =
num_of_ant(priv->cfg->valid_rx_ant); num_of_ant(priv->cfg->valid_rx_ant);
priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; hw_params(priv).valid_tx_ant = priv->cfg->valid_tx_ant;
priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; hw_params(priv).valid_rx_ant = priv->cfg->valid_rx_ant;
iwl1000_set_ct_threshold(priv); iwl1000_set_ct_threshold(priv);
/* Set initial sensitivity parameters */ /* Set initial sensitivity parameters */
/* Set initial calibration set */ /* Set initial calibration set */
priv->hw_params.sens = &iwl1000_sensitivity; hw_params(priv).sens = &iwl1000_sensitivity;
priv->hw_params.calib_init_cfg = hw_params(priv).calib_init_cfg =
BIT(IWL_CALIB_XTAL) | BIT(IWL_CALIB_XTAL) |
BIT(IWL_CALIB_LO) | BIT(IWL_CALIB_LO) |
BIT(IWL_CALIB_TX_IQ) | BIT(IWL_CALIB_TX_IQ) |
BIT(IWL_CALIB_TX_IQ_PERD) | BIT(IWL_CALIB_TX_IQ_PERD) |
BIT(IWL_CALIB_BASE_BAND); BIT(IWL_CALIB_BASE_BAND);
if (priv->cfg->need_dc_calib) if (priv->cfg->need_dc_calib)
priv->hw_params.calib_init_cfg |= BIT(IWL_CALIB_DC); hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_DC);
priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS; hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
return 0; return 0;
} }
......
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
#include "iwl-helpers.h" #include "iwl-helpers.h"
#include "iwl-agn-hw.h" #include "iwl-agn-hw.h"
#include "iwl-6000-hw.h" #include "iwl-6000-hw.h"
#include "iwl-shared.h"
#include "iwl-pci.h"
/* Highest firmware API version supported */ /* Highest firmware API version supported */
#define IWL2030_UCODE_API_MAX 6 #define IWL2030_UCODE_API_MAX 6
...@@ -78,8 +80,8 @@ ...@@ -78,8 +80,8 @@
static void iwl2000_set_ct_threshold(struct iwl_priv *priv) static void iwl2000_set_ct_threshold(struct iwl_priv *priv)
{ {
/* want Celsius */ /* want Celsius */
priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD; hw_params(priv).ct_kill_threshold = CT_KILL_THRESHOLD;
priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD; hw_params(priv).ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
} }
/* NIC configuration for 2000 series */ /* NIC configuration for 2000 series */
...@@ -88,7 +90,7 @@ static void iwl2000_nic_config(struct iwl_priv *priv) ...@@ -88,7 +90,7 @@ static void iwl2000_nic_config(struct iwl_priv *priv)
iwl_rf_config(priv); iwl_rf_config(priv);
if (priv->cfg->iq_invert) if (priv->cfg->iq_invert)
iwl_set_bit(priv, CSR_GP_DRIVER_REG, iwl_set_bit(bus(priv), CSR_GP_DRIVER_REG,
CSR_GP_DRIVER_REG_BIT_RADIO_IQ_INVER); CSR_GP_DRIVER_REG_BIT_RADIO_IQ_INVER);
} }
...@@ -124,44 +126,40 @@ static int iwl2000_hw_set_hw_params(struct iwl_priv *priv) ...@@ -124,44 +126,40 @@ static int iwl2000_hw_set_hw_params(struct iwl_priv *priv)
priv->cfg->base_params->num_of_queues = priv->cfg->base_params->num_of_queues =
iwlagn_mod_params.num_of_queues; iwlagn_mod_params.num_of_queues;
priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues; hw_params(priv).max_txq_num = priv->cfg->base_params->num_of_queues;
priv->hw_params.scd_bc_tbls_size = hw_params(priv).max_stations = IWLAGN_STATION_COUNT;
priv->cfg->base_params->num_of_queues *
sizeof(struct iwlagn_scd_bc_tbl);
priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
priv->hw_params.max_stations = IWLAGN_STATION_COUNT;
priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID; priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE; hw_params(priv).max_data_size = IWL60_RTC_DATA_SIZE;
priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE; hw_params(priv).max_inst_size = IWL60_RTC_INST_SIZE;
priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ); hw_params(priv).ht40_channel = BIT(IEEE80211_BAND_2GHZ);
priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant); hw_params(priv).tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
if (priv->cfg->rx_with_siso_diversity) if (priv->cfg->rx_with_siso_diversity)
priv->hw_params.rx_chains_num = 1; hw_params(priv).rx_chains_num = 1;
else else
priv->hw_params.rx_chains_num = hw_params(priv).rx_chains_num =
num_of_ant(priv->cfg->valid_rx_ant); num_of_ant(priv->cfg->valid_rx_ant);
priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; hw_params(priv).valid_tx_ant = priv->cfg->valid_tx_ant;
priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; hw_params(priv).valid_rx_ant = priv->cfg->valid_rx_ant;
iwl2000_set_ct_threshold(priv); iwl2000_set_ct_threshold(priv);
/* Set initial sensitivity parameters */ /* Set initial sensitivity parameters */
/* Set initial calibration set */ /* Set initial calibration set */
priv->hw_params.sens = &iwl2000_sensitivity; hw_params(priv).sens = &iwl2000_sensitivity;
priv->hw_params.calib_init_cfg = hw_params(priv).calib_init_cfg =
BIT(IWL_CALIB_XTAL) | BIT(IWL_CALIB_XTAL) |
BIT(IWL_CALIB_LO) | BIT(IWL_CALIB_LO) |
BIT(IWL_CALIB_TX_IQ) | BIT(IWL_CALIB_TX_IQ) |
BIT(IWL_CALIB_BASE_BAND); BIT(IWL_CALIB_BASE_BAND);
if (priv->cfg->need_dc_calib) if (priv->cfg->need_dc_calib)
priv->hw_params.calib_rt_cfg |= IWL_CALIB_CFG_DC_IDX; hw_params(priv).calib_rt_cfg |= IWL_CALIB_CFG_DC_IDX;
if (priv->cfg->need_temp_offset_calib) if (priv->cfg->need_temp_offset_calib)
priv->hw_params.calib_init_cfg |= BIT(IWL_CALIB_TEMP_OFFSET); hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_TEMP_OFFSET);
priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS; hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
return 0; return 0;
} }
...@@ -179,7 +177,7 @@ static struct iwl_lib_ops iwl2000_lib = { ...@@ -179,7 +177,7 @@ static struct iwl_lib_ops iwl2000_lib = {
EEPROM_6000_REG_BAND_24_HT40_CHANNELS, EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
EEPROM_REGULATORY_BAND_NO_HT40, EEPROM_REGULATORY_BAND_NO_HT40,
}, },
.update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower, .update_enhanced_txpower = iwl_eeprom_enhanced_txpower,
}, },
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}; };
...@@ -200,7 +198,7 @@ static struct iwl_lib_ops iwl2030_lib = { ...@@ -200,7 +198,7 @@ static struct iwl_lib_ops iwl2030_lib = {
EEPROM_6000_REG_BAND_24_HT40_CHANNELS, EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
EEPROM_REGULATORY_BAND_NO_HT40, EEPROM_REGULATORY_BAND_NO_HT40,
}, },
.update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower, .update_enhanced_txpower = iwl_eeprom_enhanced_txpower,
}, },
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}; };
...@@ -284,6 +282,11 @@ struct iwl_cfg iwl2000_2bg_cfg = { ...@@ -284,6 +282,11 @@ struct iwl_cfg iwl2000_2bg_cfg = {
IWL_DEVICE_2000, IWL_DEVICE_2000,
}; };
struct iwl_cfg iwl2000_2bgn_d_cfg = {
.name = "2000D Series 2x2 BGN",
IWL_DEVICE_2000,
};
#define IWL_DEVICE_2030 \ #define IWL_DEVICE_2030 \
.fw_name_pre = IWL2030_FW_PRE, \ .fw_name_pre = IWL2030_FW_PRE, \
.ucode_api_max = IWL2030_UCODE_API_MAX, \ .ucode_api_max = IWL2030_UCODE_API_MAX, \
......
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
#include "iwl-agn-hw.h" #include "iwl-agn-hw.h"
#include "iwl-5000-hw.h" #include "iwl-5000-hw.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-shared.h"
#include "iwl-pci.h"
/* Highest firmware API version supported */ /* Highest firmware API version supported */
#define IWL5000_UCODE_API_MAX 5 #define IWL5000_UCODE_API_MAX 5
...@@ -68,18 +70,18 @@ static void iwl5000_nic_config(struct iwl_priv *priv) ...@@ -68,18 +70,18 @@ static void iwl5000_nic_config(struct iwl_priv *priv)
iwl_rf_config(priv); iwl_rf_config(priv);
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->shrd->lock, flags);
/* W/A : NIC is stuck in a reset state after Early PCIe power off /* W/A : NIC is stuck in a reset state after Early PCIe power off
* (PCIe power is lost before PERST# is asserted), * (PCIe power is lost before PERST# is asserted),
* causing ME FW to lose ownership and not being able to obtain it back. * causing ME FW to lose ownership and not being able to obtain it back.
*/ */
iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, iwl_set_bits_mask_prph(bus(priv), APMG_PS_CTRL_REG,
APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS, APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS,
~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS); ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS);
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->shrd->lock, flags);
} }
static struct iwl_sensitivity_ranges iwl5000_sensitivity = { static struct iwl_sensitivity_ranges iwl5000_sensitivity = {
...@@ -139,13 +141,13 @@ static void iwl5150_set_ct_threshold(struct iwl_priv *priv) ...@@ -139,13 +141,13 @@ static void iwl5150_set_ct_threshold(struct iwl_priv *priv)
s32 threshold = (s32)CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY) - s32 threshold = (s32)CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY) -
iwl_temp_calib_to_offset(priv); iwl_temp_calib_to_offset(priv);
priv->hw_params.ct_kill_threshold = threshold * volt2temp_coef; hw_params(priv).ct_kill_threshold = threshold * volt2temp_coef;
} }
static void iwl5000_set_ct_threshold(struct iwl_priv *priv) static void iwl5000_set_ct_threshold(struct iwl_priv *priv)
{ {
/* want Celsius */ /* want Celsius */
priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY; hw_params(priv).ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY;
} }
static int iwl5000_hw_set_hw_params(struct iwl_priv *priv) static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
...@@ -155,38 +157,34 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv) ...@@ -155,38 +157,34 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
priv->cfg->base_params->num_of_queues = priv->cfg->base_params->num_of_queues =
iwlagn_mod_params.num_of_queues; iwlagn_mod_params.num_of_queues;
priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues; hw_params(priv).max_txq_num = priv->cfg->base_params->num_of_queues;
priv->hw_params.scd_bc_tbls_size = hw_params(priv).max_stations = IWLAGN_STATION_COUNT;
priv->cfg->base_params->num_of_queues *
sizeof(struct iwlagn_scd_bc_tbl);
priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
priv->hw_params.max_stations = IWLAGN_STATION_COUNT;
priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID; priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE; hw_params(priv).max_data_size = IWLAGN_RTC_DATA_SIZE;
priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE; hw_params(priv).max_inst_size = IWLAGN_RTC_INST_SIZE;
priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) | hw_params(priv).ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
BIT(IEEE80211_BAND_5GHZ); BIT(IEEE80211_BAND_5GHZ);
priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant); hw_params(priv).tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant); hw_params(priv).rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; hw_params(priv).valid_tx_ant = priv->cfg->valid_tx_ant;
priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; hw_params(priv).valid_rx_ant = priv->cfg->valid_rx_ant;
iwl5000_set_ct_threshold(priv); iwl5000_set_ct_threshold(priv);
/* Set initial sensitivity parameters */ /* Set initial sensitivity parameters */
/* Set initial calibration set */ /* Set initial calibration set */
priv->hw_params.sens = &iwl5000_sensitivity; hw_params(priv).sens = &iwl5000_sensitivity;
priv->hw_params.calib_init_cfg = hw_params(priv).calib_init_cfg =
BIT(IWL_CALIB_XTAL) | BIT(IWL_CALIB_XTAL) |
BIT(IWL_CALIB_LO) | BIT(IWL_CALIB_LO) |
BIT(IWL_CALIB_TX_IQ) | BIT(IWL_CALIB_TX_IQ) |
BIT(IWL_CALIB_TX_IQ_PERD) | BIT(IWL_CALIB_TX_IQ_PERD) |
BIT(IWL_CALIB_BASE_BAND); BIT(IWL_CALIB_BASE_BAND);
priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS; hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
return 0; return 0;
} }
...@@ -198,38 +196,34 @@ static int iwl5150_hw_set_hw_params(struct iwl_priv *priv) ...@@ -198,38 +196,34 @@ static int iwl5150_hw_set_hw_params(struct iwl_priv *priv)
priv->cfg->base_params->num_of_queues = priv->cfg->base_params->num_of_queues =
iwlagn_mod_params.num_of_queues; iwlagn_mod_params.num_of_queues;
priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues; hw_params(priv).max_txq_num = priv->cfg->base_params->num_of_queues;
priv->hw_params.scd_bc_tbls_size = hw_params(priv).max_stations = IWLAGN_STATION_COUNT;
priv->cfg->base_params->num_of_queues *
sizeof(struct iwlagn_scd_bc_tbl);
priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
priv->hw_params.max_stations = IWLAGN_STATION_COUNT;
priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID; priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE; hw_params(priv).max_data_size = IWLAGN_RTC_DATA_SIZE;
priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE; hw_params(priv).max_inst_size = IWLAGN_RTC_INST_SIZE;
priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) | hw_params(priv).ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
BIT(IEEE80211_BAND_5GHZ); BIT(IEEE80211_BAND_5GHZ);
priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant); hw_params(priv).tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant); hw_params(priv).rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; hw_params(priv).valid_tx_ant = priv->cfg->valid_tx_ant;
priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; hw_params(priv).valid_rx_ant = priv->cfg->valid_rx_ant;
iwl5150_set_ct_threshold(priv); iwl5150_set_ct_threshold(priv);
/* Set initial sensitivity parameters */ /* Set initial sensitivity parameters */
/* Set initial calibration set */ /* Set initial calibration set */
priv->hw_params.sens = &iwl5150_sensitivity; hw_params(priv).sens = &iwl5150_sensitivity;
priv->hw_params.calib_init_cfg = hw_params(priv).calib_init_cfg =
BIT(IWL_CALIB_LO) | BIT(IWL_CALIB_LO) |
BIT(IWL_CALIB_TX_IQ) | BIT(IWL_CALIB_TX_IQ) |
BIT(IWL_CALIB_BASE_BAND); BIT(IWL_CALIB_BASE_BAND);
if (priv->cfg->need_dc_calib) if (priv->cfg->need_dc_calib)
priv->hw_params.calib_init_cfg |= BIT(IWL_CALIB_DC); hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_DC);
priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS; hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
return 0; return 0;
} }
...@@ -314,7 +308,7 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv, ...@@ -314,7 +308,7 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
return -EFAULT; return -EFAULT;
} }
return trans_send_cmd(&priv->trans, &hcmd); return iwl_trans_send_cmd(trans(priv), &hcmd);
} }
static struct iwl_lib_ops iwl5000_lib = { static struct iwl_lib_ops iwl5000_lib = {
......
...@@ -45,6 +45,8 @@ ...@@ -45,6 +45,8 @@
#include "iwl-agn-hw.h" #include "iwl-agn-hw.h"
#include "iwl-6000-hw.h" #include "iwl-6000-hw.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-shared.h"
#include "iwl-pci.h"
/* Highest firmware API version supported */ /* Highest firmware API version supported */
#define IWL6000_UCODE_API_MAX 4 #define IWL6000_UCODE_API_MAX 4
...@@ -74,15 +76,15 @@ ...@@ -74,15 +76,15 @@
static void iwl6000_set_ct_threshold(struct iwl_priv *priv) static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
{ {
/* want Celsius */ /* want Celsius */
priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD; hw_params(priv).ct_kill_threshold = CT_KILL_THRESHOLD;
priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD; hw_params(priv).ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
} }
static void iwl6050_additional_nic_config(struct iwl_priv *priv) static void iwl6050_additional_nic_config(struct iwl_priv *priv)
{ {
/* Indicate calibration version to uCode. */ /* Indicate calibration version to uCode. */
if (iwlagn_eeprom_calib_version(priv) >= 6) if (iwlagn_eeprom_calib_version(priv) >= 6)
iwl_set_bit(priv, CSR_GP_DRIVER_REG, iwl_set_bit(bus(priv), CSR_GP_DRIVER_REG,
CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
} }
...@@ -90,9 +92,9 @@ static void iwl6150_additional_nic_config(struct iwl_priv *priv) ...@@ -90,9 +92,9 @@ static void iwl6150_additional_nic_config(struct iwl_priv *priv)
{ {
/* Indicate calibration version to uCode. */ /* Indicate calibration version to uCode. */
if (iwlagn_eeprom_calib_version(priv) >= 6) if (iwlagn_eeprom_calib_version(priv) >= 6)
iwl_set_bit(priv, CSR_GP_DRIVER_REG, iwl_set_bit(bus(priv), CSR_GP_DRIVER_REG,
CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
iwl_set_bit(priv, CSR_GP_DRIVER_REG, iwl_set_bit(bus(priv), CSR_GP_DRIVER_REG,
CSR_GP_DRIVER_REG_BIT_6050_1x2); CSR_GP_DRIVER_REG_BIT_6050_1x2);
} }
...@@ -104,7 +106,7 @@ static void iwl6000_nic_config(struct iwl_priv *priv) ...@@ -104,7 +106,7 @@ static void iwl6000_nic_config(struct iwl_priv *priv)
/* no locking required for register write */ /* no locking required for register write */
if (priv->cfg->pa_type == IWL_PA_INTERNAL) { if (priv->cfg->pa_type == IWL_PA_INTERNAL) {
/* 2x2 IPA phy type */ /* 2x2 IPA phy type */
iwl_write32(priv, CSR_GP_DRIVER_REG, iwl_write32(bus(priv), CSR_GP_DRIVER_REG,
CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA); CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA);
} }
/* do additional nic configuration if needed */ /* do additional nic configuration if needed */
...@@ -144,45 +146,41 @@ static int iwl6000_hw_set_hw_params(struct iwl_priv *priv) ...@@ -144,45 +146,41 @@ static int iwl6000_hw_set_hw_params(struct iwl_priv *priv)
priv->cfg->base_params->num_of_queues = priv->cfg->base_params->num_of_queues =
iwlagn_mod_params.num_of_queues; iwlagn_mod_params.num_of_queues;
priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues; hw_params(priv).max_txq_num = priv->cfg->base_params->num_of_queues;
priv->hw_params.scd_bc_tbls_size = hw_params(priv).max_stations = IWLAGN_STATION_COUNT;
priv->cfg->base_params->num_of_queues *
sizeof(struct iwlagn_scd_bc_tbl);
priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
priv->hw_params.max_stations = IWLAGN_STATION_COUNT;
priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID; priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE; hw_params(priv).max_data_size = IWL60_RTC_DATA_SIZE;
priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE; hw_params(priv).max_inst_size = IWL60_RTC_INST_SIZE;
priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) | hw_params(priv).ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
BIT(IEEE80211_BAND_5GHZ); BIT(IEEE80211_BAND_5GHZ);
priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant); hw_params(priv).tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
if (priv->cfg->rx_with_siso_diversity) if (priv->cfg->rx_with_siso_diversity)
priv->hw_params.rx_chains_num = 1; hw_params(priv).rx_chains_num = 1;
else else
priv->hw_params.rx_chains_num = hw_params(priv).rx_chains_num =
num_of_ant(priv->cfg->valid_rx_ant); num_of_ant(priv->cfg->valid_rx_ant);
priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; hw_params(priv).valid_tx_ant = priv->cfg->valid_tx_ant;
priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; hw_params(priv).valid_rx_ant = priv->cfg->valid_rx_ant;
iwl6000_set_ct_threshold(priv); iwl6000_set_ct_threshold(priv);
/* Set initial sensitivity parameters */ /* Set initial sensitivity parameters */
/* Set initial calibration set */ /* Set initial calibration set */
priv->hw_params.sens = &iwl6000_sensitivity; hw_params(priv).sens = &iwl6000_sensitivity;
priv->hw_params.calib_init_cfg = hw_params(priv).calib_init_cfg =
BIT(IWL_CALIB_XTAL) | BIT(IWL_CALIB_XTAL) |
BIT(IWL_CALIB_LO) | BIT(IWL_CALIB_LO) |
BIT(IWL_CALIB_TX_IQ) | BIT(IWL_CALIB_TX_IQ) |
BIT(IWL_CALIB_BASE_BAND); BIT(IWL_CALIB_BASE_BAND);
if (priv->cfg->need_dc_calib) if (priv->cfg->need_dc_calib)
priv->hw_params.calib_rt_cfg |= IWL_CALIB_CFG_DC_IDX; hw_params(priv).calib_rt_cfg |= IWL_CALIB_CFG_DC_IDX;
if (priv->cfg->need_temp_offset_calib) if (priv->cfg->need_temp_offset_calib)
priv->hw_params.calib_init_cfg |= BIT(IWL_CALIB_TEMP_OFFSET); hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_TEMP_OFFSET);
priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS; hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
return 0; return 0;
} }
...@@ -255,7 +253,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv, ...@@ -255,7 +253,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
return -EFAULT; return -EFAULT;
} }
return trans_send_cmd(&priv->trans, &hcmd); return iwl_trans_send_cmd(trans(priv), &hcmd);
} }
static struct iwl_lib_ops iwl6000_lib = { static struct iwl_lib_ops iwl6000_lib = {
...@@ -272,7 +270,7 @@ static struct iwl_lib_ops iwl6000_lib = { ...@@ -272,7 +270,7 @@ static struct iwl_lib_ops iwl6000_lib = {
EEPROM_6000_REG_BAND_24_HT40_CHANNELS, EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
EEPROM_REG_BAND_52_HT40_CHANNELS EEPROM_REG_BAND_52_HT40_CHANNELS
}, },
.update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower, .update_enhanced_txpower = iwl_eeprom_enhanced_txpower,
}, },
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}; };
...@@ -294,7 +292,7 @@ static struct iwl_lib_ops iwl6030_lib = { ...@@ -294,7 +292,7 @@ static struct iwl_lib_ops iwl6030_lib = {
EEPROM_6000_REG_BAND_24_HT40_CHANNELS, EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
EEPROM_REG_BAND_52_HT40_CHANNELS EEPROM_REG_BAND_52_HT40_CHANNELS
}, },
.update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower, .update_enhanced_txpower = iwl_eeprom_enhanced_txpower,
}, },
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}; };
...@@ -395,6 +393,12 @@ struct iwl_cfg iwl6005_2bg_cfg = { ...@@ -395,6 +393,12 @@ struct iwl_cfg iwl6005_2bg_cfg = {
IWL_DEVICE_6005, IWL_DEVICE_6005,
}; };
struct iwl_cfg iwl6005_2agn_sff_cfg = {
.name = "Intel(R) Centrino(R) Advanced-N 6205S AGN",
IWL_DEVICE_6005,
.ht_params = &iwl6000_ht_params,
};
#define IWL_DEVICE_6030 \ #define IWL_DEVICE_6030 \
.fw_name_pre = IWL6030_FW_PRE, \ .fw_name_pre = IWL6030_FW_PRE, \
.ucode_api_max = IWL6000G2_UCODE_API_MAX, \ .ucode_api_max = IWL6000G2_UCODE_API_MAX, \
......
...@@ -93,12 +93,12 @@ int iwl_send_calib_results(struct iwl_priv *priv) ...@@ -93,12 +93,12 @@ int iwl_send_calib_results(struct iwl_priv *priv)
}; };
for (i = 0; i < IWL_CALIB_MAX; i++) { for (i = 0; i < IWL_CALIB_MAX; i++) {
if ((BIT(i) & priv->hw_params.calib_init_cfg) && if ((BIT(i) & hw_params(priv).calib_init_cfg) &&
priv->calib_results[i].buf) { priv->calib_results[i].buf) {
hcmd.len[0] = priv->calib_results[i].buf_len; hcmd.len[0] = priv->calib_results[i].buf_len;
hcmd.data[0] = priv->calib_results[i].buf; hcmd.data[0] = priv->calib_results[i].buf;
hcmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY; hcmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY;
ret = trans_send_cmd(&priv->trans, &hcmd); ret = iwl_trans_send_cmd(trans(priv), &hcmd);
if (ret) { if (ret) {
IWL_ERR(priv, "Error %d iteration %d\n", IWL_ERR(priv, "Error %d iteration %d\n",
ret, i); ret, i);
...@@ -174,7 +174,7 @@ static int iwl_sens_energy_cck(struct iwl_priv *priv, ...@@ -174,7 +174,7 @@ static int iwl_sens_energy_cck(struct iwl_priv *priv,
u32 max_false_alarms = MAX_FA_CCK * rx_enable_time; u32 max_false_alarms = MAX_FA_CCK * rx_enable_time;
u32 min_false_alarms = MIN_FA_CCK * rx_enable_time; u32 min_false_alarms = MIN_FA_CCK * rx_enable_time;
struct iwl_sensitivity_data *data = NULL; struct iwl_sensitivity_data *data = NULL;
const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens; const struct iwl_sensitivity_ranges *ranges = hw_params(priv).sens;
data = &(priv->sensitivity_data); data = &(priv->sensitivity_data);
...@@ -357,7 +357,7 @@ static int iwl_sens_auto_corr_ofdm(struct iwl_priv *priv, ...@@ -357,7 +357,7 @@ static int iwl_sens_auto_corr_ofdm(struct iwl_priv *priv,
u32 max_false_alarms = MAX_FA_OFDM * rx_enable_time; u32 max_false_alarms = MAX_FA_OFDM * rx_enable_time;
u32 min_false_alarms = MIN_FA_OFDM * rx_enable_time; u32 min_false_alarms = MIN_FA_OFDM * rx_enable_time;
struct iwl_sensitivity_data *data = NULL; struct iwl_sensitivity_data *data = NULL;
const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens; const struct iwl_sensitivity_ranges *ranges = hw_params(priv).sens;
data = &(priv->sensitivity_data); data = &(priv->sensitivity_data);
...@@ -484,7 +484,7 @@ static int iwl_sensitivity_write(struct iwl_priv *priv) ...@@ -484,7 +484,7 @@ static int iwl_sensitivity_write(struct iwl_priv *priv)
memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]), memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]),
sizeof(u16)*HD_TABLE_SIZE); sizeof(u16)*HD_TABLE_SIZE);
return trans_send_cmd(&priv->trans, &cmd_out); return iwl_trans_send_cmd(trans(priv), &cmd_out);
} }
/* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */ /* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */
...@@ -573,7 +573,7 @@ static int iwl_enhance_sensitivity_write(struct iwl_priv *priv) ...@@ -573,7 +573,7 @@ static int iwl_enhance_sensitivity_write(struct iwl_priv *priv)
&(cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX]), &(cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX]),
sizeof(u16)*ENHANCE_HD_TABLE_ENTRIES); sizeof(u16)*ENHANCE_HD_TABLE_ENTRIES);
return trans_send_cmd(&priv->trans, &cmd_out); return iwl_trans_send_cmd(trans(priv), &cmd_out);
} }
void iwl_init_sensitivity(struct iwl_priv *priv) void iwl_init_sensitivity(struct iwl_priv *priv)
...@@ -581,7 +581,7 @@ void iwl_init_sensitivity(struct iwl_priv *priv) ...@@ -581,7 +581,7 @@ void iwl_init_sensitivity(struct iwl_priv *priv)
int ret = 0; int ret = 0;
int i; int i;
struct iwl_sensitivity_data *data = NULL; struct iwl_sensitivity_data *data = NULL;
const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens; const struct iwl_sensitivity_ranges *ranges = hw_params(priv).sens;
if (priv->disable_sens_cal) if (priv->disable_sens_cal)
return; return;
...@@ -658,13 +658,13 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv) ...@@ -658,13 +658,13 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv)
return; return;
} }
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->shrd->lock, flags);
rx_info = &priv->statistics.rx_non_phy; rx_info = &priv->statistics.rx_non_phy;
ofdm = &priv->statistics.rx_ofdm; ofdm = &priv->statistics.rx_ofdm;
cck = &priv->statistics.rx_cck; cck = &priv->statistics.rx_cck;
if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) {
IWL_DEBUG_CALIB(priv, "<< invalid data.\n"); IWL_DEBUG_CALIB(priv, "<< invalid data.\n");
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->shrd->lock, flags);
return; return;
} }
...@@ -688,7 +688,7 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv) ...@@ -688,7 +688,7 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv)
statis.beacon_energy_c = statis.beacon_energy_c =
le32_to_cpu(rx_info->beacon_energy_c); le32_to_cpu(rx_info->beacon_energy_c);
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->shrd->lock, flags);
IWL_DEBUG_CALIB(priv, "rx_enable_time = %u usecs\n", rx_enable_time); IWL_DEBUG_CALIB(priv, "rx_enable_time = %u usecs\n", rx_enable_time);
...@@ -821,21 +821,21 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig, ...@@ -821,21 +821,21 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
* To be safe, simply mask out any chains that we know * To be safe, simply mask out any chains that we know
* are not on the device. * are not on the device.
*/ */
active_chains &= priv->hw_params.valid_rx_ant; active_chains &= hw_params(priv).valid_rx_ant;
num_tx_chains = 0; num_tx_chains = 0;
for (i = 0; i < NUM_RX_CHAINS; i++) { for (i = 0; i < NUM_RX_CHAINS; i++) {
/* loops on all the bits of /* loops on all the bits of
* priv->hw_setting.valid_tx_ant */ * priv->hw_setting.valid_tx_ant */
u8 ant_msk = (1 << i); u8 ant_msk = (1 << i);
if (!(priv->hw_params.valid_tx_ant & ant_msk)) if (!(hw_params(priv).valid_tx_ant & ant_msk))
continue; continue;
num_tx_chains++; num_tx_chains++;
if (data->disconn_array[i] == 0) if (data->disconn_array[i] == 0)
/* there is a Tx antenna connected */ /* there is a Tx antenna connected */
break; break;
if (num_tx_chains == priv->hw_params.tx_chains_num && if (num_tx_chains == hw_params(priv).tx_chains_num &&
data->disconn_array[i]) { data->disconn_array[i]) {
/* /*
* If all chains are disconnected * If all chains are disconnected
...@@ -852,12 +852,13 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig, ...@@ -852,12 +852,13 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
} }
} }
if (active_chains != priv->hw_params.valid_rx_ant && if (active_chains != hw_params(priv).valid_rx_ant &&
active_chains != priv->chain_noise_data.active_chains) active_chains != priv->chain_noise_data.active_chains)
IWL_DEBUG_CALIB(priv, IWL_DEBUG_CALIB(priv,
"Detected that not all antennas are connected! " "Detected that not all antennas are connected! "
"Connected: %#x, valid: %#x.\n", "Connected: %#x, valid: %#x.\n",
active_chains, priv->hw_params.valid_rx_ant); active_chains,
hw_params(priv).valid_rx_ant);
/* Save for use within RXON, TX, SCAN commands, etc. */ /* Save for use within RXON, TX, SCAN commands, etc. */
data->active_chains = active_chains; data->active_chains = active_chains;
...@@ -917,7 +918,7 @@ static void iwlagn_gain_computation(struct iwl_priv *priv, ...@@ -917,7 +918,7 @@ static void iwlagn_gain_computation(struct iwl_priv *priv,
priv->phy_calib_chain_noise_gain_cmd); priv->phy_calib_chain_noise_gain_cmd);
cmd.delta_gain_1 = data->delta_gain_code[1]; cmd.delta_gain_1 = data->delta_gain_code[1];
cmd.delta_gain_2 = data->delta_gain_code[2]; cmd.delta_gain_2 = data->delta_gain_code[2];
trans_send_cmd_pdu(&priv->trans, REPLY_PHY_CALIBRATION_CMD, iwl_trans_send_cmd_pdu(trans(priv), REPLY_PHY_CALIBRATION_CMD,
CMD_ASYNC, sizeof(cmd), &cmd); CMD_ASYNC, sizeof(cmd), &cmd);
data->radio_write = 1; data->radio_write = 1;
...@@ -975,13 +976,13 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv) ...@@ -975,13 +976,13 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
return; return;
} }
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->shrd->lock, flags);
rx_info = &priv->statistics.rx_non_phy; rx_info = &priv->statistics.rx_non_phy;
if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) {
IWL_DEBUG_CALIB(priv, " << Interference data unavailable\n"); IWL_DEBUG_CALIB(priv, " << Interference data unavailable\n");
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->shrd->lock, flags);
return; return;
} }
...@@ -996,7 +997,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv) ...@@ -996,7 +997,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
if ((rxon_chnum != stat_chnum) || (rxon_band24 != stat_band24)) { if ((rxon_chnum != stat_chnum) || (rxon_band24 != stat_band24)) {
IWL_DEBUG_CALIB(priv, "Stats not from chan=%d, band24=%d\n", IWL_DEBUG_CALIB(priv, "Stats not from chan=%d, band24=%d\n",
rxon_chnum, rxon_band24); rxon_chnum, rxon_band24);
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->shrd->lock, flags);
return; return;
} }
...@@ -1015,7 +1016,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv) ...@@ -1015,7 +1016,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
chain_sig_b = le32_to_cpu(rx_info->beacon_rssi_b) & IN_BAND_FILTER; chain_sig_b = le32_to_cpu(rx_info->beacon_rssi_b) & IN_BAND_FILTER;
chain_sig_c = le32_to_cpu(rx_info->beacon_rssi_c) & IN_BAND_FILTER; chain_sig_c = le32_to_cpu(rx_info->beacon_rssi_c) & IN_BAND_FILTER;
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->shrd->lock, flags);
data->beacon_count++; data->beacon_count++;
...@@ -1046,7 +1047,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv) ...@@ -1046,7 +1047,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
priv->cfg->bt_params->advanced_bt_coexist) { priv->cfg->bt_params->advanced_bt_coexist) {
/* Disable disconnected antenna algorithm for advanced /* Disable disconnected antenna algorithm for advanced
bt coex, assuming valid antennas are connected */ bt coex, assuming valid antennas are connected */
data->active_chains = priv->hw_params.valid_rx_ant; data->active_chains = hw_params(priv).valid_rx_ant;
for (i = 0; i < NUM_RX_CHAINS; i++) for (i = 0; i < NUM_RX_CHAINS; i++)
if (!(data->active_chains & (1<<i))) if (!(data->active_chains & (1<<i)))
data->disconn_array[i] = 1; data->disconn_array[i] = 1;
......
...@@ -195,7 +195,7 @@ static s8 iwl_get_max_txpower_avg(struct iwl_priv *priv, ...@@ -195,7 +195,7 @@ static s8 iwl_get_max_txpower_avg(struct iwl_priv *priv,
} }
static void static void
iwlcore_eeprom_enh_txp_read_element(struct iwl_priv *priv, iwl_eeprom_enh_txp_read_element(struct iwl_priv *priv,
struct iwl_eeprom_enhanced_txpwr *txp, struct iwl_eeprom_enhanced_txpwr *txp,
s8 max_txpower_avg) s8 max_txpower_avg)
{ {
...@@ -235,7 +235,7 @@ iwlcore_eeprom_enh_txp_read_element(struct iwl_priv *priv, ...@@ -235,7 +235,7 @@ iwlcore_eeprom_enh_txp_read_element(struct iwl_priv *priv,
#define TXP_CHECK_AND_PRINT(x) ((txp->flags & IWL_EEPROM_ENH_TXP_FL_##x) \ #define TXP_CHECK_AND_PRINT(x) ((txp->flags & IWL_EEPROM_ENH_TXP_FL_##x) \
? # x " " : "") ? # x " " : "")
void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv) void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv)
{ {
struct iwl_eeprom_enhanced_txpwr *txp_array, *txp; struct iwl_eeprom_enhanced_txpwr *txp_array, *txp;
int idx, entries; int idx, entries;
...@@ -294,6 +294,6 @@ void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv) ...@@ -294,6 +294,6 @@ void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv)
if (max_txp_avg_halfdbm > priv->tx_power_lmt_in_half_dbm) if (max_txp_avg_halfdbm > priv->tx_power_lmt_in_half_dbm)
priv->tx_power_lmt_in_half_dbm = max_txp_avg_halfdbm; priv->tx_power_lmt_in_half_dbm = max_txp_avg_halfdbm;
iwlcore_eeprom_enh_txp_read_element(priv, txp, max_txp_avg); iwl_eeprom_enh_txp_read_element(priv, txp, max_txp_avg);
} }
} }
...@@ -95,17 +95,4 @@ ...@@ -95,17 +95,4 @@
#define IWLAGN_NUM_AMPDU_QUEUES 9 #define IWLAGN_NUM_AMPDU_QUEUES 9
#define IWLAGN_FIRST_AMPDU_QUEUE 11 #define IWLAGN_FIRST_AMPDU_QUEUE 11
/* Fixed (non-configurable) rx data from phy */
/**
* struct iwlagn_schedq_bc_tbl scheduler byte count table
* base physical address provided by SCD_DRAM_BASE_ADDR
* @tfd_offset 0-12 - tx command byte count
* 12-16 - station index
*/
struct iwlagn_scd_bc_tbl {
__le16 tfd_offset[TFD_QUEUE_BC_SIZE];
} __packed;
#endif /* __iwl_agn_hw_h__ */ #endif /* __iwl_agn_hw_h__ */
...@@ -297,10 +297,10 @@ static u8 rs_tl_add_packet(struct iwl_lq_sta *lq_data, ...@@ -297,10 +297,10 @@ static u8 rs_tl_add_packet(struct iwl_lq_sta *lq_data,
u8 *qc = ieee80211_get_qos_ctl(hdr); u8 *qc = ieee80211_get_qos_ctl(hdr);
tid = qc[0] & 0xf; tid = qc[0] & 0xf;
} else } else
return MAX_TID_COUNT; return IWL_MAX_TID_COUNT;
if (unlikely(tid >= TID_MAX_LOAD_COUNT)) if (unlikely(tid >= TID_MAX_LOAD_COUNT))
return MAX_TID_COUNT; return IWL_MAX_TID_COUNT;
tl = &lq_data->load[tid]; tl = &lq_data->load[tid];
...@@ -313,7 +313,7 @@ static u8 rs_tl_add_packet(struct iwl_lq_sta *lq_data, ...@@ -313,7 +313,7 @@ static u8 rs_tl_add_packet(struct iwl_lq_sta *lq_data,
tl->queue_count = 1; tl->queue_count = 1;
tl->head = 0; tl->head = 0;
tl->packet_count[0] = 1; tl->packet_count[0] = 1;
return MAX_TID_COUNT; return IWL_MAX_TID_COUNT;
} }
time_diff = TIME_WRAP_AROUND(tl->time_stamp, curr_time); time_diff = TIME_WRAP_AROUND(tl->time_stamp, curr_time);
...@@ -420,7 +420,7 @@ static int rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, ...@@ -420,7 +420,7 @@ static int rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv,
load = rs_tl_get_load(lq_data, tid); load = rs_tl_get_load(lq_data, tid);
if (load > IWL_AGG_LOAD_THRESHOLD) { if ((iwlagn_mod_params.auto_agg) || (load > IWL_AGG_LOAD_THRESHOLD)) {
IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n", IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n",
sta->addr, tid); sta->addr, tid);
ret = ieee80211_start_tx_ba_session(sta, tid, 5000); ret = ieee80211_start_tx_ba_session(sta, tid, 5000);
...@@ -819,7 +819,7 @@ static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta, ...@@ -819,7 +819,7 @@ static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta,
if (num_of_ant(tbl->ant_type) > 1) if (num_of_ant(tbl->ant_type) > 1)
tbl->ant_type = tbl->ant_type =
first_antenna(priv->hw_params.valid_tx_ant); first_antenna(hw_params(priv).valid_tx_ant);
tbl->is_ht40 = 0; tbl->is_ht40 = 0;
tbl->is_SGI = 0; tbl->is_SGI = 0;
...@@ -877,12 +877,12 @@ static void rs_bt_update_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, ...@@ -877,12 +877,12 @@ static void rs_bt_update_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
* Is there a need to switch between * Is there a need to switch between
* full concurrency and 3-wire? * full concurrency and 3-wire?
*/ */
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->shrd->lock, flags);
if (priv->bt_ci_compliance && priv->bt_ant_couple_ok) if (priv->bt_ci_compliance && priv->bt_ant_couple_ok)
full_concurrent = true; full_concurrent = true;
else else
full_concurrent = false; full_concurrent = false;
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->shrd->lock, flags);
} }
if ((priv->bt_traffic_load != priv->last_bt_traffic_load) || if ((priv->bt_traffic_load != priv->last_bt_traffic_load) ||
(priv->bt_full_concurrent != full_concurrent)) { (priv->bt_full_concurrent != full_concurrent)) {
...@@ -893,7 +893,7 @@ static void rs_bt_update_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, ...@@ -893,7 +893,7 @@ static void rs_bt_update_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
rs_fill_link_cmd(priv, lq_sta, tbl->current_rate); rs_fill_link_cmd(priv, lq_sta, tbl->current_rate);
iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false);
queue_work(priv->workqueue, &priv->bt_full_concurrency); queue_work(priv->shrd->workqueue, &priv->bt_full_concurrency);
} }
} }
...@@ -1293,7 +1293,7 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv, ...@@ -1293,7 +1293,7 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv,
return -1; return -1;
/* Need both Tx chains/antennas to support MIMO */ /* Need both Tx chains/antennas to support MIMO */
if (priv->hw_params.tx_chains_num < 2) if (hw_params(priv).tx_chains_num < 2)
return -1; return -1;
IWL_DEBUG_RATE(priv, "LQ: try to switch to MIMO2\n"); IWL_DEBUG_RATE(priv, "LQ: try to switch to MIMO2\n");
...@@ -1349,7 +1349,7 @@ static int rs_switch_to_mimo3(struct iwl_priv *priv, ...@@ -1349,7 +1349,7 @@ static int rs_switch_to_mimo3(struct iwl_priv *priv,
return -1; return -1;
/* Need both Tx chains/antennas to support MIMO */ /* Need both Tx chains/antennas to support MIMO */
if (priv->hw_params.tx_chains_num < 3) if (hw_params(priv).tx_chains_num < 3)
return -1; return -1;
IWL_DEBUG_RATE(priv, "LQ: try to switch to MIMO3\n"); IWL_DEBUG_RATE(priv, "LQ: try to switch to MIMO3\n");
...@@ -1448,8 +1448,8 @@ static int rs_move_legacy_other(struct iwl_priv *priv, ...@@ -1448,8 +1448,8 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
u32 sz = (sizeof(struct iwl_scale_tbl_info) - u32 sz = (sizeof(struct iwl_scale_tbl_info) -
(sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
u8 start_action; u8 start_action;
u8 valid_tx_ant = priv->hw_params.valid_tx_ant; u8 valid_tx_ant = hw_params(priv).valid_tx_ant;
u8 tx_chains_num = priv->hw_params.tx_chains_num; u8 tx_chains_num = hw_params(priv).tx_chains_num;
int ret = 0; int ret = 0;
u8 update_search_tbl_counter = 0; u8 update_search_tbl_counter = 0;
...@@ -1459,14 +1459,16 @@ static int rs_move_legacy_other(struct iwl_priv *priv, ...@@ -1459,14 +1459,16 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
break; break;
case IWL_BT_COEX_TRAFFIC_LOAD_LOW: case IWL_BT_COEX_TRAFFIC_LOAD_LOW:
/* avoid antenna B unless MIMO */ /* avoid antenna B unless MIMO */
valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); valid_tx_ant =
first_antenna(hw_params(priv).valid_tx_ant);
if (tbl->action == IWL_LEGACY_SWITCH_ANTENNA2) if (tbl->action == IWL_LEGACY_SWITCH_ANTENNA2)
tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; tbl->action = IWL_LEGACY_SWITCH_ANTENNA1;
break; break;
case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: case IWL_BT_COEX_TRAFFIC_LOAD_HIGH:
case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS:
/* avoid antenna B and MIMO */ /* avoid antenna B and MIMO */
valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); valid_tx_ant =
first_antenna(hw_params(priv).valid_tx_ant);
if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2 && if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2 &&
tbl->action != IWL_LEGACY_SWITCH_SISO) tbl->action != IWL_LEGACY_SWITCH_SISO)
tbl->action = IWL_LEGACY_SWITCH_SISO; tbl->action = IWL_LEGACY_SWITCH_SISO;
...@@ -1489,7 +1491,8 @@ static int rs_move_legacy_other(struct iwl_priv *priv, ...@@ -1489,7 +1491,8 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; tbl->action = IWL_LEGACY_SWITCH_ANTENNA1;
else if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2) else if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2)
tbl->action = IWL_LEGACY_SWITCH_SISO; tbl->action = IWL_LEGACY_SWITCH_SISO;
valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); valid_tx_ant =
first_antenna(hw_params(priv).valid_tx_ant);
} }
start_action = tbl->action; start_action = tbl->action;
...@@ -1623,8 +1626,8 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, ...@@ -1623,8 +1626,8 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
u32 sz = (sizeof(struct iwl_scale_tbl_info) - u32 sz = (sizeof(struct iwl_scale_tbl_info) -
(sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
u8 start_action; u8 start_action;
u8 valid_tx_ant = priv->hw_params.valid_tx_ant; u8 valid_tx_ant = hw_params(priv).valid_tx_ant;
u8 tx_chains_num = priv->hw_params.tx_chains_num; u8 tx_chains_num = hw_params(priv).tx_chains_num;
u8 update_search_tbl_counter = 0; u8 update_search_tbl_counter = 0;
int ret; int ret;
...@@ -1634,14 +1637,16 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, ...@@ -1634,14 +1637,16 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
break; break;
case IWL_BT_COEX_TRAFFIC_LOAD_LOW: case IWL_BT_COEX_TRAFFIC_LOAD_LOW:
/* avoid antenna B unless MIMO */ /* avoid antenna B unless MIMO */
valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); valid_tx_ant =
first_antenna(hw_params(priv).valid_tx_ant);
if (tbl->action == IWL_SISO_SWITCH_ANTENNA2) if (tbl->action == IWL_SISO_SWITCH_ANTENNA2)
tbl->action = IWL_SISO_SWITCH_ANTENNA1; tbl->action = IWL_SISO_SWITCH_ANTENNA1;
break; break;
case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: case IWL_BT_COEX_TRAFFIC_LOAD_HIGH:
case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS:
/* avoid antenna B and MIMO */ /* avoid antenna B and MIMO */
valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); valid_tx_ant =
first_antenna(hw_params(priv).valid_tx_ant);
if (tbl->action != IWL_SISO_SWITCH_ANTENNA1) if (tbl->action != IWL_SISO_SWITCH_ANTENNA1)
tbl->action = IWL_SISO_SWITCH_ANTENNA1; tbl->action = IWL_SISO_SWITCH_ANTENNA1;
break; break;
...@@ -1658,7 +1663,8 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, ...@@ -1658,7 +1663,8 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
/* configure as 1x1 if bt full concurrency */ /* configure as 1x1 if bt full concurrency */
if (priv->bt_full_concurrent) { if (priv->bt_full_concurrent) {
valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); valid_tx_ant =
first_antenna(hw_params(priv).valid_tx_ant);
if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2) if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2)
tbl->action = IWL_SISO_SWITCH_ANTENNA1; tbl->action = IWL_SISO_SWITCH_ANTENNA1;
} }
...@@ -1794,8 +1800,8 @@ static int rs_move_mimo2_to_other(struct iwl_priv *priv, ...@@ -1794,8 +1800,8 @@ static int rs_move_mimo2_to_other(struct iwl_priv *priv,
u32 sz = (sizeof(struct iwl_scale_tbl_info) - u32 sz = (sizeof(struct iwl_scale_tbl_info) -
(sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
u8 start_action; u8 start_action;
u8 valid_tx_ant = priv->hw_params.valid_tx_ant; u8 valid_tx_ant = hw_params(priv).valid_tx_ant;
u8 tx_chains_num = priv->hw_params.tx_chains_num; u8 tx_chains_num = hw_params(priv).tx_chains_num;
u8 update_search_tbl_counter = 0; u8 update_search_tbl_counter = 0;
int ret; int ret;
...@@ -1964,8 +1970,8 @@ static int rs_move_mimo3_to_other(struct iwl_priv *priv, ...@@ -1964,8 +1970,8 @@ static int rs_move_mimo3_to_other(struct iwl_priv *priv,
u32 sz = (sizeof(struct iwl_scale_tbl_info) - u32 sz = (sizeof(struct iwl_scale_tbl_info) -
(sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
u8 start_action; u8 start_action;
u8 valid_tx_ant = priv->hw_params.valid_tx_ant; u8 valid_tx_ant = hw_params(priv).valid_tx_ant;
u8 tx_chains_num = priv->hw_params.tx_chains_num; u8 tx_chains_num = hw_params(priv).tx_chains_num;
int ret; int ret;
u8 update_search_tbl_counter = 0; u8 update_search_tbl_counter = 0;
...@@ -2208,7 +2214,6 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) ...@@ -2208,7 +2214,6 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search)
/* /*
* setup rate table in uCode * setup rate table in uCode
* return rate_n_flags as used in the table
*/ */
static void rs_update_rate_tbl(struct iwl_priv *priv, static void rs_update_rate_tbl(struct iwl_priv *priv,
struct iwl_rxon_context *ctx, struct iwl_rxon_context *ctx,
...@@ -2255,7 +2260,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, ...@@ -2255,7 +2260,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
u8 done_search = 0; u8 done_search = 0;
u16 high_low; u16 high_low;
s32 sr; s32 sr;
u8 tid = MAX_TID_COUNT; u8 tid = IWL_MAX_TID_COUNT;
struct iwl_tid_data *tid_data; struct iwl_tid_data *tid_data;
struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
struct iwl_rxon_context *ctx = sta_priv->common.ctx; struct iwl_rxon_context *ctx = sta_priv->common.ctx;
...@@ -2274,8 +2279,9 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, ...@@ -2274,8 +2279,9 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
lq_sta->supp_rates = sta->supp_rates[lq_sta->band]; lq_sta->supp_rates = sta->supp_rates[lq_sta->band];
tid = rs_tl_add_packet(lq_sta, hdr); tid = rs_tl_add_packet(lq_sta, hdr);
if ((tid != MAX_TID_COUNT) && (lq_sta->tx_agg_tid_en & (1 << tid))) { if ((tid != IWL_MAX_TID_COUNT) &&
tid_data = &priv->stations[lq_sta->lq.sta_id].tid[tid]; (lq_sta->tx_agg_tid_en & (1 << tid))) {
tid_data = &priv->shrd->tid_data[lq_sta->lq.sta_id][tid];
if (tid_data->agg.state == IWL_AGG_OFF) if (tid_data->agg.state == IWL_AGG_OFF)
lq_sta->is_agg = 0; lq_sta->is_agg = 0;
else else
...@@ -2645,9 +2651,10 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, ...@@ -2645,9 +2651,10 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
iwl_ht_enabled(priv)) { iwl_ht_enabled(priv)) {
if ((lq_sta->last_tpt > IWL_AGG_TPT_THREHOLD) && if ((lq_sta->last_tpt > IWL_AGG_TPT_THREHOLD) &&
(lq_sta->tx_agg_tid_en & (1 << tid)) && (lq_sta->tx_agg_tid_en & (1 << tid)) &&
(tid != MAX_TID_COUNT)) { (tid != IWL_MAX_TID_COUNT)) {
u8 sta_id = lq_sta->lq.sta_id;
tid_data = tid_data =
&priv->stations[lq_sta->lq.sta_id].tid[tid]; &priv->shrd->tid_data[sta_id][tid];
if (tid_data->agg.state == IWL_AGG_OFF) { if (tid_data->agg.state == IWL_AGG_OFF) {
IWL_DEBUG_RATE(priv, IWL_DEBUG_RATE(priv,
"try to aggregate tid %d\n", "try to aggregate tid %d\n",
...@@ -2703,7 +2710,7 @@ static void rs_initialize_lq(struct iwl_priv *priv, ...@@ -2703,7 +2710,7 @@ static void rs_initialize_lq(struct iwl_priv *priv,
i = lq_sta->last_txrate_idx; i = lq_sta->last_txrate_idx;
valid_tx_ant = priv->hw_params.valid_tx_ant; valid_tx_ant = hw_params(priv).valid_tx_ant;
if (!lq_sta->search_better_tbl) if (!lq_sta->search_better_tbl)
active_tbl = lq_sta->active_tbl; active_tbl = lq_sta->active_tbl;
...@@ -2886,15 +2893,15 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i ...@@ -2886,15 +2893,15 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i
/* These values will be overridden later */ /* These values will be overridden later */
lq_sta->lq.general_params.single_stream_ant_msk = lq_sta->lq.general_params.single_stream_ant_msk =
first_antenna(priv->hw_params.valid_tx_ant); first_antenna(hw_params(priv).valid_tx_ant);
lq_sta->lq.general_params.dual_stream_ant_msk = lq_sta->lq.general_params.dual_stream_ant_msk =
priv->hw_params.valid_tx_ant & hw_params(priv).valid_tx_ant &
~first_antenna(priv->hw_params.valid_tx_ant); ~first_antenna(hw_params(priv).valid_tx_ant);
if (!lq_sta->lq.general_params.dual_stream_ant_msk) { if (!lq_sta->lq.general_params.dual_stream_ant_msk) {
lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB; lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB;
} else if (num_of_ant(priv->hw_params.valid_tx_ant) == 2) { } else if (num_of_ant(hw_params(priv).valid_tx_ant) == 2) {
lq_sta->lq.general_params.dual_stream_ant_msk = lq_sta->lq.general_params.dual_stream_ant_msk =
priv->hw_params.valid_tx_ant; hw_params(priv).valid_tx_ant;
} }
/* as default allow aggregation for all tids */ /* as default allow aggregation for all tids */
...@@ -2940,7 +2947,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv, ...@@ -2940,7 +2947,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
if (priv && priv->bt_full_concurrent) { if (priv && priv->bt_full_concurrent) {
/* 1x1 only */ /* 1x1 only */
tbl_type.ant_type = tbl_type.ant_type =
first_antenna(priv->hw_params.valid_tx_ant); first_antenna(hw_params(priv).valid_tx_ant);
} }
/* How many times should we repeat the initial rate? */ /* How many times should we repeat the initial rate? */
...@@ -2972,7 +2979,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv, ...@@ -2972,7 +2979,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
if (priv->bt_full_concurrent) if (priv->bt_full_concurrent)
valid_tx_ant = ANT_A; valid_tx_ant = ANT_A;
else else
valid_tx_ant = priv->hw_params.valid_tx_ant; valid_tx_ant = hw_params(priv).valid_tx_ant;
} }
/* Fill rest of rate table */ /* Fill rest of rate table */
...@@ -3006,7 +3013,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv, ...@@ -3006,7 +3013,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
if (priv && priv->bt_full_concurrent) { if (priv && priv->bt_full_concurrent) {
/* 1x1 only */ /* 1x1 only */
tbl_type.ant_type = tbl_type.ant_type =
first_antenna(priv->hw_params.valid_tx_ant); first_antenna(hw_params(priv).valid_tx_ant);
} }
/* Indicate to uCode which entries might be MIMO. /* Indicate to uCode which entries might be MIMO.
...@@ -3097,7 +3104,7 @@ static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, ...@@ -3097,7 +3104,7 @@ static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta,
u8 ant_sel_tx; u8 ant_sel_tx;
priv = lq_sta->drv; priv = lq_sta->drv;
valid_tx_ant = priv->hw_params.valid_tx_ant; valid_tx_ant = hw_params(priv).valid_tx_ant;
if (lq_sta->dbg_fixed_rate) { if (lq_sta->dbg_fixed_rate) {
ant_sel_tx = ant_sel_tx =
((lq_sta->dbg_fixed_rate & RATE_MCS_ANT_ABC_MSK) ((lq_sta->dbg_fixed_rate & RATE_MCS_ANT_ABC_MSK)
...@@ -3168,9 +3175,9 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, ...@@ -3168,9 +3175,9 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
desc += sprintf(buff+desc, "fixed rate 0x%X\n", desc += sprintf(buff+desc, "fixed rate 0x%X\n",
lq_sta->dbg_fixed_rate); lq_sta->dbg_fixed_rate);
desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n", desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n",
(priv->hw_params.valid_tx_ant & ANT_A) ? "ANT_A," : "", (hw_params(priv).valid_tx_ant & ANT_A) ? "ANT_A," : "",
(priv->hw_params.valid_tx_ant & ANT_B) ? "ANT_B," : "", (hw_params(priv).valid_tx_ant & ANT_B) ? "ANT_B," : "",
(priv->hw_params.valid_tx_ant & ANT_C) ? "ANT_C" : ""); (hw_params(priv).valid_tx_ant & ANT_C) ? "ANT_C" : "");
desc += sprintf(buff+desc, "lq type %s\n", desc += sprintf(buff+desc, "lq type %s\n",
(is_legacy(tbl->lq_type)) ? "legacy" : "HT"); (is_legacy(tbl->lq_type)) ? "legacy" : "HT");
if (is_Ht(tbl->lq_type)) { if (is_Ht(tbl->lq_type)) {
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "iwl-agn-calib.h" #include "iwl-agn-calib.h"
#include "iwl-helpers.h" #include "iwl-helpers.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-shared.h"
static int iwlagn_disable_bss(struct iwl_priv *priv, static int iwlagn_disable_bss(struct iwl_priv *priv,
struct iwl_rxon_context *ctx, struct iwl_rxon_context *ctx,
...@@ -40,7 +41,7 @@ static int iwlagn_disable_bss(struct iwl_priv *priv, ...@@ -40,7 +41,7 @@ static int iwlagn_disable_bss(struct iwl_priv *priv,
int ret; int ret;
send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
ret = trans_send_cmd_pdu(&priv->trans, ctx->rxon_cmd, ret = iwl_trans_send_cmd_pdu(trans(priv), ctx->rxon_cmd,
CMD_SYNC, sizeof(*send), send); CMD_SYNC, sizeof(*send), send);
send->filter_flags = old_filter; send->filter_flags = old_filter;
...@@ -66,7 +67,7 @@ static int iwlagn_disable_pan(struct iwl_priv *priv, ...@@ -66,7 +67,7 @@ static int iwlagn_disable_pan(struct iwl_priv *priv,
send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
send->dev_type = RXON_DEV_TYPE_P2P; send->dev_type = RXON_DEV_TYPE_P2P;
ret = trans_send_cmd_pdu(&priv->trans, ctx->rxon_cmd, ret = iwl_trans_send_cmd_pdu(trans(priv), ctx->rxon_cmd,
CMD_SYNC, sizeof(*send), send); CMD_SYNC, sizeof(*send), send);
send->filter_flags = old_filter; send->filter_flags = old_filter;
...@@ -92,7 +93,7 @@ static int iwlagn_disconn_pan(struct iwl_priv *priv, ...@@ -92,7 +93,7 @@ static int iwlagn_disconn_pan(struct iwl_priv *priv,
int ret; int ret;
send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
ret = trans_send_cmd_pdu(&priv->trans, ctx->rxon_cmd, CMD_SYNC, ret = iwl_trans_send_cmd_pdu(trans(priv), ctx->rxon_cmd, CMD_SYNC,
sizeof(*send), send); sizeof(*send), send);
send->filter_flags = old_filter; send->filter_flags = old_filter;
...@@ -121,7 +122,7 @@ static void iwlagn_update_qos(struct iwl_priv *priv, ...@@ -121,7 +122,7 @@ static void iwlagn_update_qos(struct iwl_priv *priv,
ctx->qos_data.qos_active, ctx->qos_data.qos_active,
ctx->qos_data.def_qos_parm.qos_flags); ctx->qos_data.def_qos_parm.qos_flags);
ret = trans_send_cmd_pdu(&priv->trans, ctx->qos_cmd, CMD_SYNC, ret = iwl_trans_send_cmd_pdu(trans(priv), ctx->qos_cmd, CMD_SYNC,
sizeof(struct iwl_qosparam_cmd), sizeof(struct iwl_qosparam_cmd),
&ctx->qos_data.def_qos_parm); &ctx->qos_data.def_qos_parm);
if (ret) if (ret)
...@@ -131,7 +132,7 @@ static void iwlagn_update_qos(struct iwl_priv *priv, ...@@ -131,7 +132,7 @@ static void iwlagn_update_qos(struct iwl_priv *priv,
static int iwlagn_update_beacon(struct iwl_priv *priv, static int iwlagn_update_beacon(struct iwl_priv *priv,
struct ieee80211_vif *vif) struct ieee80211_vif *vif)
{ {
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
dev_kfree_skb(priv->beacon_skb); dev_kfree_skb(priv->beacon_skb);
priv->beacon_skb = ieee80211_beacon_get(priv->hw, vif); priv->beacon_skb = ieee80211_beacon_get(priv->hw, vif);
...@@ -180,7 +181,7 @@ static int iwlagn_send_rxon_assoc(struct iwl_priv *priv, ...@@ -180,7 +181,7 @@ static int iwlagn_send_rxon_assoc(struct iwl_priv *priv,
ctx->staging.ofdm_ht_triple_stream_basic_rates; ctx->staging.ofdm_ht_triple_stream_basic_rates;
rxon_assoc.acquisition_data = ctx->staging.acquisition_data; rxon_assoc.acquisition_data = ctx->staging.acquisition_data;
ret = trans_send_cmd_pdu(&priv->trans, ctx->rxon_assoc_cmd, ret = iwl_trans_send_cmd_pdu(trans(priv), ctx->rxon_assoc_cmd,
CMD_ASYNC, sizeof(rxon_assoc), &rxon_assoc); CMD_ASYNC, sizeof(rxon_assoc), &rxon_assoc);
return ret; return ret;
} }
...@@ -266,7 +267,7 @@ static int iwlagn_rxon_connect(struct iwl_priv *priv, ...@@ -266,7 +267,7 @@ static int iwlagn_rxon_connect(struct iwl_priv *priv,
* Associated RXON doesn't clear the station table in uCode, * Associated RXON doesn't clear the station table in uCode,
* so we don't need to restore stations etc. after this. * so we don't need to restore stations etc. after this.
*/ */
ret = trans_send_cmd_pdu(&priv->trans, ctx->rxon_cmd, CMD_SYNC, ret = iwl_trans_send_cmd_pdu(trans(priv), ctx->rxon_cmd, CMD_SYNC,
sizeof(struct iwl_rxon_cmd), &ctx->staging); sizeof(struct iwl_rxon_cmd), &ctx->staging);
if (ret) { if (ret) {
IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); IWL_ERR(priv, "Error setting new RXON (%d)\n", ret);
...@@ -315,7 +316,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv) ...@@ -315,7 +316,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv)
BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2);
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
ctx_bss = &priv->contexts[IWL_RXON_CTX_BSS]; ctx_bss = &priv->contexts[IWL_RXON_CTX_BSS];
ctx_pan = &priv->contexts[IWL_RXON_CTX_PAN]; ctx_pan = &priv->contexts[IWL_RXON_CTX_PAN];
...@@ -362,7 +363,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv) ...@@ -362,7 +363,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv)
slot0 = bcnint / 2; slot0 = bcnint / 2;
slot1 = bcnint - slot0; slot1 = bcnint - slot0;
if (test_bit(STATUS_SCAN_HW, &priv->status) || if (test_bit(STATUS_SCAN_HW, &priv->shrd->status) ||
(!ctx_bss->vif->bss_conf.idle && (!ctx_bss->vif->bss_conf.idle &&
!ctx_bss->vif->bss_conf.assoc)) { !ctx_bss->vif->bss_conf.assoc)) {
slot0 = dtim * bcnint * 3 - IWL_MIN_SLOT_TIME; slot0 = dtim * bcnint * 3 - IWL_MIN_SLOT_TIME;
...@@ -378,7 +379,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv) ...@@ -378,7 +379,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv)
ctx_pan->beacon_int; ctx_pan->beacon_int;
slot1 = max_t(int, DEFAULT_BEACON_INTERVAL, slot1); slot1 = max_t(int, DEFAULT_BEACON_INTERVAL, slot1);
if (test_bit(STATUS_SCAN_HW, &priv->status)) { if (test_bit(STATUS_SCAN_HW, &priv->shrd->status)) {
slot0 = slot1 * 3 - IWL_MIN_SLOT_TIME; slot0 = slot1 * 3 - IWL_MIN_SLOT_TIME;
slot1 = IWL_MIN_SLOT_TIME; slot1 = IWL_MIN_SLOT_TIME;
} }
...@@ -387,7 +388,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv) ...@@ -387,7 +388,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv)
cmd.slots[0].width = cpu_to_le16(slot0); cmd.slots[0].width = cpu_to_le16(slot0);
cmd.slots[1].width = cpu_to_le16(slot1); cmd.slots[1].width = cpu_to_le16(slot1);
ret = trans_send_cmd_pdu(&priv->trans, REPLY_WIPAN_PARAMS, CMD_SYNC, ret = iwl_trans_send_cmd_pdu(trans(priv), REPLY_WIPAN_PARAMS, CMD_SYNC,
sizeof(cmd), &cmd); sizeof(cmd), &cmd);
if (ret) if (ret)
IWL_ERR(priv, "Error setting PAN parameters (%d)\n", ret); IWL_ERR(priv, "Error setting PAN parameters (%d)\n", ret);
...@@ -420,12 +421,12 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ...@@ -420,12 +421,12 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
bool new_assoc = !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK); bool new_assoc = !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK);
int ret; int ret;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
if (test_bit(STATUS_EXIT_PENDING, &priv->status)) if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
return -EINVAL; return -EINVAL;
if (!iwl_is_alive(priv)) if (!iwl_is_alive(priv->shrd))
return -EBUSY; return -EBUSY;
/* This function hardcodes a bunch of dual-mode assumptions */ /* This function hardcodes a bunch of dual-mode assumptions */
...@@ -434,6 +435,10 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ...@@ -434,6 +435,10 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
if (!ctx->is_active) if (!ctx->is_active)
return 0; return 0;
/* override BSSID if necessary due to preauth */
if (ctx->preauth_bssid)
memcpy(ctx->staging.bssid_addr, ctx->bssid, ETH_ALEN);
/* always get timestamp with Rx frame */ /* always get timestamp with Rx frame */
ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK; ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK;
...@@ -462,7 +467,7 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ...@@ -462,7 +467,7 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
* receive commit_rxon request * receive commit_rxon request
* abort any previous channel switch if still in process * abort any previous channel switch if still in process
*/ */
if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) && if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status) &&
(priv->switch_channel != ctx->staging.channel)) { (priv->switch_channel != ctx->staging.channel)) {
IWL_DEBUG_11H(priv, "abort channel switch on %d\n", IWL_DEBUG_11H(priv, "abort channel switch on %d\n",
le16_to_cpu(priv->switch_channel)); le16_to_cpu(priv->switch_channel));
...@@ -536,14 +541,14 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) ...@@ -536,14 +541,14 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
IWL_DEBUG_MAC80211(priv, "changed %#x", changed); IWL_DEBUG_MAC80211(priv, "changed %#x", changed);
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
if (unlikely(test_bit(STATUS_SCANNING, &priv->status))) { if (unlikely(test_bit(STATUS_SCANNING, &priv->shrd->status))) {
IWL_DEBUG_MAC80211(priv, "leave - scanning\n"); IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
goto out; goto out;
} }
if (!iwl_is_ready(priv)) { if (!iwl_is_ready(priv->shrd)) {
IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
goto out; goto out;
} }
...@@ -575,7 +580,7 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) ...@@ -575,7 +580,7 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
goto out; goto out;
} }
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->shrd->lock, flags);
for_each_context(priv, ctx) { for_each_context(priv, ctx) {
/* Configure HT40 channels */ /* Configure HT40 channels */
...@@ -619,7 +624,7 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) ...@@ -619,7 +624,7 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
ctx->vif); ctx->vif);
} }
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->shrd->lock, flags);
iwl_update_bcast_stations(priv); iwl_update_bcast_stations(priv);
...@@ -651,7 +656,7 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) ...@@ -651,7 +656,7 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
iwlagn_commit_rxon(priv, ctx); iwlagn_commit_rxon(priv, ctx);
} }
out: out:
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
return ret; return ret;
} }
...@@ -666,7 +671,7 @@ static void iwlagn_check_needed_chains(struct iwl_priv *priv, ...@@ -666,7 +671,7 @@ static void iwlagn_check_needed_chains(struct iwl_priv *priv,
struct ieee80211_sta_ht_cap *ht_cap; struct ieee80211_sta_ht_cap *ht_cap;
bool need_multiple; bool need_multiple;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
switch (vif->type) { switch (vif->type) {
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
...@@ -770,7 +775,7 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv) ...@@ -770,7 +775,7 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv)
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
iwl_set_calib_hdr(&cmd.hdr, iwl_set_calib_hdr(&cmd.hdr,
priv->phy_calib_chain_noise_reset_cmd); priv->phy_calib_chain_noise_reset_cmd);
ret = trans_send_cmd_pdu(&priv->trans, ret = iwl_trans_send_cmd_pdu(trans(priv),
REPLY_PHY_CALIBRATION_CMD, REPLY_PHY_CALIBRATION_CMD,
CMD_SYNC, sizeof(cmd), &cmd); CMD_SYNC, sizeof(cmd), &cmd);
if (ret) if (ret)
...@@ -791,17 +796,17 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, ...@@ -791,17 +796,17 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
int ret; int ret;
bool force = false; bool force = false;
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
if (unlikely(!iwl_is_ready(priv))) { if (unlikely(!iwl_is_ready(priv->shrd))) {
IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
return; return;
} }
if (unlikely(!ctx->vif)) { if (unlikely(!ctx->vif)) {
IWL_DEBUG_MAC80211(priv, "leave - vif is NULL\n"); IWL_DEBUG_MAC80211(priv, "leave - vif is NULL\n");
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
return; return;
} }
...@@ -834,7 +839,8 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, ...@@ -834,7 +839,8 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
*/ */
if (ctx->last_tx_rejected) { if (ctx->last_tx_rejected) {
ctx->last_tx_rejected = false; ctx->last_tx_rejected = false;
iwl_wake_any_queue(priv, ctx); iwl_trans_wake_any_queue(trans(priv),
ctx->ctxid);
} }
ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
...@@ -895,6 +901,7 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, ...@@ -895,6 +901,7 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
if (!priv->disable_chain_noise_cal) if (!priv->disable_chain_noise_cal)
iwlagn_chain_noise_reset(priv); iwlagn_chain_noise_reset(priv);
priv->start_calib = 1; priv->start_calib = 1;
WARN_ON(ctx->preauth_bssid);
} }
if (changes & BSS_CHANGED_IBSS) { if (changes & BSS_CHANGED_IBSS) {
...@@ -912,7 +919,7 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, ...@@ -912,7 +919,7 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
IWL_ERR(priv, "Error sending IBSS beacon\n"); IWL_ERR(priv, "Error sending IBSS beacon\n");
} }
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
} }
void iwlagn_post_scan(struct iwl_priv *priv) void iwlagn_post_scan(struct iwl_priv *priv)
......
...@@ -49,7 +49,7 @@ iwl_sta_alloc_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, u8 sta_id) ...@@ -49,7 +49,7 @@ iwl_sta_alloc_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, u8 sta_id)
return NULL; return NULL;
} }
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
/* Set up the rate scaling to start at selected rate, fall back /* Set up the rate scaling to start at selected rate, fall back
* all the way down to 1M in IEEE order, and then spin on 1M */ * all the way down to 1M in IEEE order, and then spin on 1M */
...@@ -63,23 +63,23 @@ iwl_sta_alloc_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, u8 sta_id) ...@@ -63,23 +63,23 @@ iwl_sta_alloc_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, u8 sta_id)
if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE) if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE)
rate_flags |= RATE_MCS_CCK_MSK; rate_flags |= RATE_MCS_CCK_MSK;
rate_flags |= first_antenna(priv->hw_params.valid_tx_ant) << rate_flags |= first_antenna(hw_params(priv).valid_tx_ant) <<
RATE_MCS_ANT_POS; RATE_MCS_ANT_POS;
rate_n_flags = iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags); rate_n_flags = iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags);
for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++)
link_cmd->rs_table[i].rate_n_flags = rate_n_flags; link_cmd->rs_table[i].rate_n_flags = rate_n_flags;
link_cmd->general_params.single_stream_ant_msk = link_cmd->general_params.single_stream_ant_msk =
first_antenna(priv->hw_params.valid_tx_ant); first_antenna(hw_params(priv).valid_tx_ant);
link_cmd->general_params.dual_stream_ant_msk = link_cmd->general_params.dual_stream_ant_msk =
priv->hw_params.valid_tx_ant & hw_params(priv).valid_tx_ant &
~first_antenna(priv->hw_params.valid_tx_ant); ~first_antenna(hw_params(priv).valid_tx_ant);
if (!link_cmd->general_params.dual_stream_ant_msk) { if (!link_cmd->general_params.dual_stream_ant_msk) {
link_cmd->general_params.dual_stream_ant_msk = ANT_AB; link_cmd->general_params.dual_stream_ant_msk = ANT_AB;
} else if (num_of_ant(priv->hw_params.valid_tx_ant) == 2) { } else if (num_of_ant(hw_params(priv).valid_tx_ant) == 2) {
link_cmd->general_params.dual_stream_ant_msk = link_cmd->general_params.dual_stream_ant_msk =
priv->hw_params.valid_tx_ant; hw_params(priv).valid_tx_ant;
} }
link_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; link_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF;
...@@ -116,9 +116,9 @@ int iwlagn_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx ...@@ -116,9 +116,9 @@ int iwlagn_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx
if (sta_id_r) if (sta_id_r)
*sta_id_r = sta_id; *sta_id_r = sta_id;
spin_lock_irqsave(&priv->sta_lock, flags); spin_lock_irqsave(&priv->shrd->sta_lock, flags);
priv->stations[sta_id].used |= IWL_STA_LOCAL; priv->stations[sta_id].used |= IWL_STA_LOCAL;
spin_unlock_irqrestore(&priv->sta_lock, flags); spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
/* Set up default rate scaling table in device's station table */ /* Set up default rate scaling table in device's station table */
link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id); link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id);
...@@ -132,9 +132,9 @@ int iwlagn_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx ...@@ -132,9 +132,9 @@ int iwlagn_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx
if (ret) if (ret)
IWL_ERR(priv, "Link quality command failed (%d)\n", ret); IWL_ERR(priv, "Link quality command failed (%d)\n", ret);
spin_lock_irqsave(&priv->sta_lock, flags); spin_lock_irqsave(&priv->shrd->sta_lock, flags);
priv->stations[sta_id].lq = link_cmd; priv->stations[sta_id].lq = link_cmd;
spin_unlock_irqrestore(&priv->sta_lock, flags); spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
return 0; return 0;
} }
...@@ -189,7 +189,7 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, ...@@ -189,7 +189,7 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv,
cmd.len[0] = cmd_size; cmd.len[0] = cmd_size;
if (not_empty || send_if_empty) if (not_empty || send_if_empty)
return trans_send_cmd(&priv->trans, &cmd); return iwl_trans_send_cmd(trans(priv), &cmd);
else else
return 0; return 0;
} }
...@@ -197,7 +197,7 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, ...@@ -197,7 +197,7 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv,
int iwl_restore_default_wep_keys(struct iwl_priv *priv, int iwl_restore_default_wep_keys(struct iwl_priv *priv,
struct iwl_rxon_context *ctx) struct iwl_rxon_context *ctx)
{ {
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
return iwl_send_static_wepkey_cmd(priv, ctx, false); return iwl_send_static_wepkey_cmd(priv, ctx, false);
} }
...@@ -208,13 +208,13 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv, ...@@ -208,13 +208,13 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv,
{ {
int ret; int ret;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
IWL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n", IWL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n",
keyconf->keyidx); keyconf->keyidx);
memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0])); memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0]));
if (iwl_is_rfkill(priv)) { if (iwl_is_rfkill(priv->shrd)) {
IWL_DEBUG_WEP(priv, "Not sending REPLY_WEPKEY command due to RFKILL.\n"); IWL_DEBUG_WEP(priv, "Not sending REPLY_WEPKEY command due to RFKILL.\n");
/* but keys in device are clear anyway so return success */ /* but keys in device are clear anyway so return success */
return 0; return 0;
...@@ -232,7 +232,7 @@ int iwl_set_default_wep_key(struct iwl_priv *priv, ...@@ -232,7 +232,7 @@ int iwl_set_default_wep_key(struct iwl_priv *priv,
{ {
int ret; int ret;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
if (keyconf->keylen != WEP_KEY_LEN_128 && if (keyconf->keylen != WEP_KEY_LEN_128 &&
keyconf->keylen != WEP_KEY_LEN_64) { keyconf->keylen != WEP_KEY_LEN_64) {
...@@ -311,9 +311,9 @@ static int iwlagn_send_sta_key(struct iwl_priv *priv, ...@@ -311,9 +311,9 @@ static int iwlagn_send_sta_key(struct iwl_priv *priv,
struct iwl_addsta_cmd sta_cmd; struct iwl_addsta_cmd sta_cmd;
int i; int i;
spin_lock_irqsave(&priv->sta_lock, flags); spin_lock_irqsave(&priv->shrd->sta_lock, flags);
memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(sta_cmd)); memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(sta_cmd));
spin_unlock_irqrestore(&priv->sta_lock, flags); spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
key_flags = cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); key_flags = cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
key_flags |= STA_KEY_FLG_MAP_KEY_MSK; key_flags |= STA_KEY_FLG_MAP_KEY_MSK;
...@@ -388,16 +388,16 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv, ...@@ -388,16 +388,16 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv,
if (sta_id == IWL_INVALID_STATION) if (sta_id == IWL_INVALID_STATION)
return -ENOENT; return -ENOENT;
spin_lock_irqsave(&priv->sta_lock, flags); spin_lock_irqsave(&priv->shrd->sta_lock, flags);
memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(sta_cmd)); memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(sta_cmd));
if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE))
sta_id = IWL_INVALID_STATION; sta_id = IWL_INVALID_STATION;
spin_unlock_irqrestore(&priv->sta_lock, flags); spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
if (sta_id == IWL_INVALID_STATION) if (sta_id == IWL_INVALID_STATION)
return 0; return 0;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
ctx->key_mapping_keys--; ctx->key_mapping_keys--;
...@@ -430,7 +430,7 @@ int iwl_set_dynamic_key(struct iwl_priv *priv, ...@@ -430,7 +430,7 @@ int iwl_set_dynamic_key(struct iwl_priv *priv,
if (sta_id == IWL_INVALID_STATION) if (sta_id == IWL_INVALID_STATION)
return -EINVAL; return -EINVAL;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
keyconf->hw_key_idx = iwl_get_free_ucode_key_offset(priv); keyconf->hw_key_idx = iwl_get_free_ucode_key_offset(priv);
if (keyconf->hw_key_idx == WEP_INVALID_OFFSET) if (keyconf->hw_key_idx == WEP_INVALID_OFFSET)
...@@ -493,18 +493,18 @@ int iwlagn_alloc_bcast_station(struct iwl_priv *priv, ...@@ -493,18 +493,18 @@ int iwlagn_alloc_bcast_station(struct iwl_priv *priv,
unsigned long flags; unsigned long flags;
u8 sta_id; u8 sta_id;
spin_lock_irqsave(&priv->sta_lock, flags); spin_lock_irqsave(&priv->shrd->sta_lock, flags);
sta_id = iwl_prep_station(priv, ctx, iwl_bcast_addr, false, NULL); sta_id = iwl_prep_station(priv, ctx, iwl_bcast_addr, false, NULL);
if (sta_id == IWL_INVALID_STATION) { if (sta_id == IWL_INVALID_STATION) {
IWL_ERR(priv, "Unable to prepare broadcast station\n"); IWL_ERR(priv, "Unable to prepare broadcast station\n");
spin_unlock_irqrestore(&priv->sta_lock, flags); spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
return -EINVAL; return -EINVAL;
} }
priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE; priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE;
priv->stations[sta_id].used |= IWL_STA_BCAST; priv->stations[sta_id].used |= IWL_STA_BCAST;
spin_unlock_irqrestore(&priv->sta_lock, flags); spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id); link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id);
if (!link_cmd) { if (!link_cmd) {
...@@ -513,9 +513,9 @@ int iwlagn_alloc_bcast_station(struct iwl_priv *priv, ...@@ -513,9 +513,9 @@ int iwlagn_alloc_bcast_station(struct iwl_priv *priv,
return -ENOMEM; return -ENOMEM;
} }
spin_lock_irqsave(&priv->sta_lock, flags); spin_lock_irqsave(&priv->shrd->sta_lock, flags);
priv->stations[sta_id].lq = link_cmd; priv->stations[sta_id].lq = link_cmd;
spin_unlock_irqrestore(&priv->sta_lock, flags); spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
return 0; return 0;
} }
...@@ -539,13 +539,13 @@ int iwl_update_bcast_station(struct iwl_priv *priv, ...@@ -539,13 +539,13 @@ int iwl_update_bcast_station(struct iwl_priv *priv,
return -ENOMEM; return -ENOMEM;
} }
spin_lock_irqsave(&priv->sta_lock, flags); spin_lock_irqsave(&priv->shrd->sta_lock, flags);
if (priv->stations[sta_id].lq) if (priv->stations[sta_id].lq)
kfree(priv->stations[sta_id].lq); kfree(priv->stations[sta_id].lq);
else else
IWL_DEBUG_INFO(priv, "Bcast station rate scaling has not been initialized yet.\n"); IWL_DEBUG_INFO(priv, "Bcast station rate scaling has not been initialized yet.\n");
priv->stations[sta_id].lq = link_cmd; priv->stations[sta_id].lq = link_cmd;
spin_unlock_irqrestore(&priv->sta_lock, flags); spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
return 0; return 0;
} }
...@@ -572,15 +572,15 @@ int iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid) ...@@ -572,15 +572,15 @@ int iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid)
unsigned long flags; unsigned long flags;
struct iwl_addsta_cmd sta_cmd; struct iwl_addsta_cmd sta_cmd;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
/* Remove "disable" flag, to enable Tx for this TID */ /* Remove "disable" flag, to enable Tx for this TID */
spin_lock_irqsave(&priv->sta_lock, flags); spin_lock_irqsave(&priv->shrd->sta_lock, flags);
priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_TID_DISABLE_TX; priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_TID_DISABLE_TX;
priv->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid)); priv->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid));
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd));
spin_unlock_irqrestore(&priv->sta_lock, flags); spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
} }
...@@ -592,20 +592,20 @@ int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, ...@@ -592,20 +592,20 @@ int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta,
int sta_id; int sta_id;
struct iwl_addsta_cmd sta_cmd; struct iwl_addsta_cmd sta_cmd;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
sta_id = iwl_sta_id(sta); sta_id = iwl_sta_id(sta);
if (sta_id == IWL_INVALID_STATION) if (sta_id == IWL_INVALID_STATION)
return -ENXIO; return -ENXIO;
spin_lock_irqsave(&priv->sta_lock, flags); spin_lock_irqsave(&priv->shrd->sta_lock, flags);
priv->stations[sta_id].sta.station_flags_msk = 0; priv->stations[sta_id].sta.station_flags_msk = 0;
priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK; priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK;
priv->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid; priv->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid;
priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn); priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn);
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd));
spin_unlock_irqrestore(&priv->sta_lock, flags); spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
} }
...@@ -617,7 +617,7 @@ int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, ...@@ -617,7 +617,7 @@ int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta,
int sta_id; int sta_id;
struct iwl_addsta_cmd sta_cmd; struct iwl_addsta_cmd sta_cmd;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
sta_id = iwl_sta_id(sta); sta_id = iwl_sta_id(sta);
if (sta_id == IWL_INVALID_STATION) { if (sta_id == IWL_INVALID_STATION) {
...@@ -625,13 +625,13 @@ int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, ...@@ -625,13 +625,13 @@ int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta,
return -ENXIO; return -ENXIO;
} }
spin_lock_irqsave(&priv->sta_lock, flags); spin_lock_irqsave(&priv->shrd->sta_lock, flags);
priv->stations[sta_id].sta.station_flags_msk = 0; priv->stations[sta_id].sta.station_flags_msk = 0;
priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK; priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK;
priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid; priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid;
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd));
spin_unlock_irqrestore(&priv->sta_lock, flags); spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
} }
...@@ -640,14 +640,14 @@ static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id) ...@@ -640,14 +640,14 @@ static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&priv->sta_lock, flags); spin_lock_irqsave(&priv->shrd->sta_lock, flags);
priv->stations[sta_id].sta.station_flags &= ~STA_FLG_PWR_SAVE_MSK; priv->stations[sta_id].sta.station_flags &= ~STA_FLG_PWR_SAVE_MSK;
priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK; priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK;
priv->stations[sta_id].sta.sta.modify_mask = 0; priv->stations[sta_id].sta.sta.modify_mask = 0;
priv->stations[sta_id].sta.sleep_tx_count = 0; priv->stations[sta_id].sta.sleep_tx_count = 0;
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
spin_unlock_irqrestore(&priv->sta_lock, flags); spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
} }
...@@ -655,7 +655,7 @@ void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt) ...@@ -655,7 +655,7 @@ void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&priv->sta_lock, flags); spin_lock_irqsave(&priv->shrd->sta_lock, flags);
priv->stations[sta_id].sta.station_flags |= STA_FLG_PWR_SAVE_MSK; priv->stations[sta_id].sta.station_flags |= STA_FLG_PWR_SAVE_MSK;
priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK; priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK;
priv->stations[sta_id].sta.sta.modify_mask = priv->stations[sta_id].sta.sta.modify_mask =
...@@ -663,7 +663,7 @@ void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt) ...@@ -663,7 +663,7 @@ void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt)
priv->stations[sta_id].sta.sleep_tx_count = cpu_to_le16(cnt); priv->stations[sta_id].sta.sleep_tx_count = cpu_to_le16(cnt);
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
spin_unlock_irqrestore(&priv->sta_lock, flags); spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
} }
......
...@@ -176,24 +176,24 @@ static void iwl_tt_check_exit_ct_kill(unsigned long data) ...@@ -176,24 +176,24 @@ static void iwl_tt_check_exit_ct_kill(unsigned long data)
struct iwl_tt_mgmt *tt = &priv->thermal_throttle; struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
unsigned long flags; unsigned long flags;
if (test_bit(STATUS_EXIT_PENDING, &priv->status)) if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
return; return;
if (tt->state == IWL_TI_CT_KILL) { if (tt->state == IWL_TI_CT_KILL) {
if (priv->thermal_throttle.ct_kill_toggle) { if (priv->thermal_throttle.ct_kill_toggle) {
iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, iwl_write32(bus(priv), CSR_UCODE_DRV_GP1_CLR,
CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT);
priv->thermal_throttle.ct_kill_toggle = false; priv->thermal_throttle.ct_kill_toggle = false;
} else { } else {
iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, iwl_write32(bus(priv), CSR_UCODE_DRV_GP1_SET,
CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT);
priv->thermal_throttle.ct_kill_toggle = true; priv->thermal_throttle.ct_kill_toggle = true;
} }
iwl_read32(priv, CSR_UCODE_DRV_GP1); iwl_read32(bus(priv), CSR_UCODE_DRV_GP1);
spin_lock_irqsave(&priv->reg_lock, flags); spin_lock_irqsave(&bus(priv)->reg_lock, flags);
if (!iwl_grab_nic_access(priv)) if (!iwl_grab_nic_access(bus(priv)))
iwl_release_nic_access(priv); iwl_release_nic_access(bus(priv));
spin_unlock_irqrestore(&priv->reg_lock, flags); spin_unlock_irqrestore(&bus(priv)->reg_lock, flags);
/* Reschedule the ct_kill timer to occur in /* Reschedule the ct_kill timer to occur in
* CT_KILL_EXIT_DURATION seconds to ensure we get a * CT_KILL_EXIT_DURATION seconds to ensure we get a
...@@ -209,7 +209,7 @@ static void iwl_perform_ct_kill_task(struct iwl_priv *priv, ...@@ -209,7 +209,7 @@ static void iwl_perform_ct_kill_task(struct iwl_priv *priv,
{ {
if (stop) { if (stop) {
IWL_DEBUG_TEMP(priv, "Stop all queues\n"); IWL_DEBUG_TEMP(priv, "Stop all queues\n");
if (priv->mac80211_registered) if (priv->shrd->mac80211_registered)
ieee80211_stop_queues(priv->hw); ieee80211_stop_queues(priv->hw);
IWL_DEBUG_TEMP(priv, IWL_DEBUG_TEMP(priv,
"Schedule 5 seconds CT_KILL Timer\n"); "Schedule 5 seconds CT_KILL Timer\n");
...@@ -217,7 +217,7 @@ static void iwl_perform_ct_kill_task(struct iwl_priv *priv, ...@@ -217,7 +217,7 @@ static void iwl_perform_ct_kill_task(struct iwl_priv *priv,
jiffies + CT_KILL_EXIT_DURATION * HZ); jiffies + CT_KILL_EXIT_DURATION * HZ);
} else { } else {
IWL_DEBUG_TEMP(priv, "Wake all queues\n"); IWL_DEBUG_TEMP(priv, "Wake all queues\n");
if (priv->mac80211_registered) if (priv->shrd->mac80211_registered)
ieee80211_wake_queues(priv->hw); ieee80211_wake_queues(priv->hw);
} }
} }
...@@ -227,7 +227,7 @@ static void iwl_tt_ready_for_ct_kill(unsigned long data) ...@@ -227,7 +227,7 @@ static void iwl_tt_ready_for_ct_kill(unsigned long data)
struct iwl_priv *priv = (struct iwl_priv *)data; struct iwl_priv *priv = (struct iwl_priv *)data;
struct iwl_tt_mgmt *tt = &priv->thermal_throttle; struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
if (test_bit(STATUS_EXIT_PENDING, &priv->status)) if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
return; return;
/* temperature timer expired, ready to go into CT_KILL state */ /* temperature timer expired, ready to go into CT_KILL state */
...@@ -235,7 +235,7 @@ static void iwl_tt_ready_for_ct_kill(unsigned long data) ...@@ -235,7 +235,7 @@ static void iwl_tt_ready_for_ct_kill(unsigned long data)
IWL_DEBUG_TEMP(priv, "entering CT_KILL state when " IWL_DEBUG_TEMP(priv, "entering CT_KILL state when "
"temperature timer expired\n"); "temperature timer expired\n");
tt->state = IWL_TI_CT_KILL; tt->state = IWL_TI_CT_KILL;
set_bit(STATUS_CT_KILL, &priv->status); set_bit(STATUS_CT_KILL, &priv->shrd->status);
iwl_perform_ct_kill_task(priv, true); iwl_perform_ct_kill_task(priv, true);
} }
} }
...@@ -313,23 +313,24 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp, bool force) ...@@ -313,23 +313,24 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
tt->tt_power_mode = IWL_POWER_INDEX_5; tt->tt_power_mode = IWL_POWER_INDEX_5;
break; break;
} }
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
if (old_state == IWL_TI_CT_KILL) if (old_state == IWL_TI_CT_KILL)
clear_bit(STATUS_CT_KILL, &priv->status); clear_bit(STATUS_CT_KILL, &priv->shrd->status);
if (tt->state != IWL_TI_CT_KILL && if (tt->state != IWL_TI_CT_KILL &&
iwl_power_update_mode(priv, true)) { iwl_power_update_mode(priv, true)) {
/* TT state not updated /* TT state not updated
* try again during next temperature read * try again during next temperature read
*/ */
if (old_state == IWL_TI_CT_KILL) if (old_state == IWL_TI_CT_KILL)
set_bit(STATUS_CT_KILL, &priv->status); set_bit(STATUS_CT_KILL, &priv->shrd->status);
tt->state = old_state; tt->state = old_state;
IWL_ERR(priv, "Cannot update power mode, " IWL_ERR(priv, "Cannot update power mode, "
"TT state not updated\n"); "TT state not updated\n");
} else { } else {
if (tt->state == IWL_TI_CT_KILL) { if (tt->state == IWL_TI_CT_KILL) {
if (force) { if (force) {
set_bit(STATUS_CT_KILL, &priv->status); set_bit(STATUS_CT_KILL,
&priv->shrd->status);
iwl_perform_ct_kill_task(priv, true); iwl_perform_ct_kill_task(priv, true);
} else { } else {
iwl_prepare_ct_kill_task(priv); iwl_prepare_ct_kill_task(priv);
...@@ -343,7 +344,7 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp, bool force) ...@@ -343,7 +344,7 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
IWL_DEBUG_TEMP(priv, "Power Index change to %u\n", IWL_DEBUG_TEMP(priv, "Power Index change to %u\n",
tt->tt_power_mode); tt->tt_power_mode);
} }
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
} }
} }
...@@ -453,9 +454,9 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force) ...@@ -453,9 +454,9 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
* in case get disabled before */ * in case get disabled before */
iwl_set_rxon_ht(priv, &priv->current_ht_config); iwl_set_rxon_ht(priv, &priv->current_ht_config);
} }
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
if (old_state == IWL_TI_CT_KILL) if (old_state == IWL_TI_CT_KILL)
clear_bit(STATUS_CT_KILL, &priv->status); clear_bit(STATUS_CT_KILL, &priv->shrd->status);
if (tt->state != IWL_TI_CT_KILL && if (tt->state != IWL_TI_CT_KILL &&
iwl_power_update_mode(priv, true)) { iwl_power_update_mode(priv, true)) {
/* TT state not updated /* TT state not updated
...@@ -464,7 +465,7 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force) ...@@ -464,7 +465,7 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
IWL_ERR(priv, "Cannot update power mode, " IWL_ERR(priv, "Cannot update power mode, "
"TT state not updated\n"); "TT state not updated\n");
if (old_state == IWL_TI_CT_KILL) if (old_state == IWL_TI_CT_KILL)
set_bit(STATUS_CT_KILL, &priv->status); set_bit(STATUS_CT_KILL, &priv->shrd->status);
tt->state = old_state; tt->state = old_state;
} else { } else {
IWL_DEBUG_TEMP(priv, IWL_DEBUG_TEMP(priv,
...@@ -475,7 +476,8 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force) ...@@ -475,7 +476,8 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
if (force) { if (force) {
IWL_DEBUG_TEMP(priv, IWL_DEBUG_TEMP(priv,
"Enter IWL_TI_CT_KILL\n"); "Enter IWL_TI_CT_KILL\n");
set_bit(STATUS_CT_KILL, &priv->status); set_bit(STATUS_CT_KILL,
&priv->shrd->status);
iwl_perform_ct_kill_task(priv, true); iwl_perform_ct_kill_task(priv, true);
} else { } else {
iwl_prepare_ct_kill_task(priv); iwl_prepare_ct_kill_task(priv);
...@@ -487,7 +489,7 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force) ...@@ -487,7 +489,7 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
iwl_perform_ct_kill_task(priv, false); iwl_perform_ct_kill_task(priv, false);
} }
} }
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
} }
} }
...@@ -506,10 +508,10 @@ static void iwl_bg_ct_enter(struct work_struct *work) ...@@ -506,10 +508,10 @@ static void iwl_bg_ct_enter(struct work_struct *work)
struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_enter); struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_enter);
struct iwl_tt_mgmt *tt = &priv->thermal_throttle; struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
if (test_bit(STATUS_EXIT_PENDING, &priv->status)) if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
return; return;
if (!iwl_is_ready(priv)) if (!iwl_is_ready(priv->shrd))
return; return;
if (tt->state != IWL_TI_CT_KILL) { if (tt->state != IWL_TI_CT_KILL) {
...@@ -535,10 +537,10 @@ static void iwl_bg_ct_exit(struct work_struct *work) ...@@ -535,10 +537,10 @@ static void iwl_bg_ct_exit(struct work_struct *work)
struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_exit); struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_exit);
struct iwl_tt_mgmt *tt = &priv->thermal_throttle; struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
if (test_bit(STATUS_EXIT_PENDING, &priv->status)) if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
return; return;
if (!iwl_is_ready(priv)) if (!iwl_is_ready(priv->shrd))
return; return;
/* stop ct_kill_exit_tm timer */ /* stop ct_kill_exit_tm timer */
...@@ -565,20 +567,20 @@ static void iwl_bg_ct_exit(struct work_struct *work) ...@@ -565,20 +567,20 @@ static void iwl_bg_ct_exit(struct work_struct *work)
void iwl_tt_enter_ct_kill(struct iwl_priv *priv) void iwl_tt_enter_ct_kill(struct iwl_priv *priv)
{ {
if (test_bit(STATUS_EXIT_PENDING, &priv->status)) if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
return; return;
IWL_DEBUG_TEMP(priv, "Queueing critical temperature enter.\n"); IWL_DEBUG_TEMP(priv, "Queueing critical temperature enter.\n");
queue_work(priv->workqueue, &priv->ct_enter); queue_work(priv->shrd->workqueue, &priv->ct_enter);
} }
void iwl_tt_exit_ct_kill(struct iwl_priv *priv) void iwl_tt_exit_ct_kill(struct iwl_priv *priv)
{ {
if (test_bit(STATUS_EXIT_PENDING, &priv->status)) if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
return; return;
IWL_DEBUG_TEMP(priv, "Queueing critical temperature exit.\n"); IWL_DEBUG_TEMP(priv, "Queueing critical temperature exit.\n");
queue_work(priv->workqueue, &priv->ct_exit); queue_work(priv->shrd->workqueue, &priv->ct_exit);
} }
static void iwl_bg_tt_work(struct work_struct *work) static void iwl_bg_tt_work(struct work_struct *work)
...@@ -586,7 +588,7 @@ static void iwl_bg_tt_work(struct work_struct *work) ...@@ -586,7 +588,7 @@ static void iwl_bg_tt_work(struct work_struct *work)
struct iwl_priv *priv = container_of(work, struct iwl_priv, tt_work); struct iwl_priv *priv = container_of(work, struct iwl_priv, tt_work);
s32 temp = priv->temperature; /* degrees CELSIUS except specified */ s32 temp = priv->temperature; /* degrees CELSIUS except specified */
if (test_bit(STATUS_EXIT_PENDING, &priv->status)) if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
return; return;
if (priv->cfg->base_params->temperature_kelvin) if (priv->cfg->base_params->temperature_kelvin)
...@@ -600,11 +602,11 @@ static void iwl_bg_tt_work(struct work_struct *work) ...@@ -600,11 +602,11 @@ static void iwl_bg_tt_work(struct work_struct *work)
void iwl_tt_handler(struct iwl_priv *priv) void iwl_tt_handler(struct iwl_priv *priv)
{ {
if (test_bit(STATUS_EXIT_PENDING, &priv->status)) if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
return; return;
IWL_DEBUG_TEMP(priv, "Queueing thermal throttling work.\n"); IWL_DEBUG_TEMP(priv, "Queueing thermal throttling work.\n");
queue_work(priv->workqueue, &priv->tt_work); queue_work(priv->shrd->workqueue, &priv->tt_work);
} }
/* Thermal throttling initialization /* Thermal throttling initialization
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-agn-calib.h" #include "iwl-agn-calib.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-fh.h"
static struct iwl_wimax_coex_event_entry cu_priorities[COEX_NUM_OF_EVENTS] = { static struct iwl_wimax_coex_event_entry cu_priorities[COEX_NUM_OF_EVENTS] = {
{COEX_CU_UNASSOC_IDLE_RP, COEX_CU_UNASSOC_IDLE_WP, {COEX_CU_UNASSOC_IDLE_RP, COEX_CU_UNASSOC_IDLE_WP,
...@@ -84,29 +85,29 @@ static int iwlagn_load_section(struct iwl_priv *priv, const char *name, ...@@ -84,29 +85,29 @@ static int iwlagn_load_section(struct iwl_priv *priv, const char *name,
priv->ucode_write_complete = 0; priv->ucode_write_complete = 0;
iwl_write_direct32(priv, iwl_write_direct32(bus(priv),
FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL), FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL),
FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE); FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE);
iwl_write_direct32(priv, iwl_write_direct32(bus(priv),
FH_SRVC_CHNL_SRAM_ADDR_REG(FH_SRVC_CHNL), dst_addr); FH_SRVC_CHNL_SRAM_ADDR_REG(FH_SRVC_CHNL), dst_addr);
iwl_write_direct32(priv, iwl_write_direct32(bus(priv),
FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL), FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL),
phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK); phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK);
iwl_write_direct32(priv, iwl_write_direct32(bus(priv),
FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL), FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL),
(iwl_get_dma_hi_addr(phy_addr) (iwl_get_dma_hi_addr(phy_addr)
<< FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_cnt); << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_cnt);
iwl_write_direct32(priv, iwl_write_direct32(bus(priv),
FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL), FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL),
1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM | 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM |
1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX | 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX |
FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID); FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID);
iwl_write_direct32(priv, iwl_write_direct32(bus(priv),
FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL), FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL),
FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |
FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE |
...@@ -193,7 +194,7 @@ static int iwlagn_send_calib_cfg(struct iwl_priv *priv) ...@@ -193,7 +194,7 @@ static int iwlagn_send_calib_cfg(struct iwl_priv *priv)
calib_cfg_cmd.ucd_calib_cfg.flags = calib_cfg_cmd.ucd_calib_cfg.flags =
IWL_CALIB_CFG_FLAG_SEND_COMPLETE_NTFY_MSK; IWL_CALIB_CFG_FLAG_SEND_COMPLETE_NTFY_MSK;
return trans_send_cmd(&priv->trans, &cmd); return iwl_trans_send_cmd(trans(priv), &cmd);
} }
void iwlagn_rx_calib_result(struct iwl_priv *priv, void iwlagn_rx_calib_result(struct iwl_priv *priv,
...@@ -291,7 +292,7 @@ static int iwlagn_send_wimax_coex(struct iwl_priv *priv) ...@@ -291,7 +292,7 @@ static int iwlagn_send_wimax_coex(struct iwl_priv *priv)
/* coexistence is disabled */ /* coexistence is disabled */
memset(&coex_cmd, 0, sizeof(coex_cmd)); memset(&coex_cmd, 0, sizeof(coex_cmd));
} }
return trans_send_cmd_pdu(&priv->trans, return iwl_trans_send_cmd_pdu(trans(priv),
COEX_PRIORITY_TABLE_CMD, CMD_SYNC, COEX_PRIORITY_TABLE_CMD, CMD_SYNC,
sizeof(coex_cmd), &coex_cmd); sizeof(coex_cmd), &coex_cmd);
} }
...@@ -324,7 +325,7 @@ void iwlagn_send_prio_tbl(struct iwl_priv *priv) ...@@ -324,7 +325,7 @@ void iwlagn_send_prio_tbl(struct iwl_priv *priv)
memcpy(prio_tbl_cmd.prio_tbl, iwlagn_bt_prio_tbl, memcpy(prio_tbl_cmd.prio_tbl, iwlagn_bt_prio_tbl,
sizeof(iwlagn_bt_prio_tbl)); sizeof(iwlagn_bt_prio_tbl));
if (trans_send_cmd_pdu(&priv->trans, if (iwl_trans_send_cmd_pdu(trans(priv),
REPLY_BT_COEX_PRIO_TABLE, CMD_SYNC, REPLY_BT_COEX_PRIO_TABLE, CMD_SYNC,
sizeof(prio_tbl_cmd), &prio_tbl_cmd)) sizeof(prio_tbl_cmd), &prio_tbl_cmd))
IWL_ERR(priv, "failed to send BT prio tbl command\n"); IWL_ERR(priv, "failed to send BT prio tbl command\n");
...@@ -337,7 +338,7 @@ int iwlagn_send_bt_env(struct iwl_priv *priv, u8 action, u8 type) ...@@ -337,7 +338,7 @@ int iwlagn_send_bt_env(struct iwl_priv *priv, u8 action, u8 type)
env_cmd.action = action; env_cmd.action = action;
env_cmd.type = type; env_cmd.type = type;
ret = trans_send_cmd_pdu(&priv->trans, ret = iwl_trans_send_cmd_pdu(trans(priv),
REPLY_BT_COEX_PROT_ENV, CMD_SYNC, REPLY_BT_COEX_PROT_ENV, CMD_SYNC,
sizeof(env_cmd), &env_cmd); sizeof(env_cmd), &env_cmd);
if (ret) if (ret)
...@@ -350,7 +351,16 @@ static int iwlagn_alive_notify(struct iwl_priv *priv) ...@@ -350,7 +351,16 @@ static int iwlagn_alive_notify(struct iwl_priv *priv)
{ {
int ret; int ret;
trans_tx_start(&priv->trans); if (!priv->tx_cmd_pool)
priv->tx_cmd_pool =
kmem_cache_create("iwlagn_dev_cmd",
sizeof(struct iwl_device_cmd),
sizeof(void *), 0, NULL);
if (!priv->tx_cmd_pool)
return -ENOMEM;
iwl_trans_tx_start(trans(priv));
ret = iwlagn_send_wimax_coex(priv); ret = iwlagn_send_wimax_coex(priv);
if (ret) if (ret)
...@@ -369,7 +379,7 @@ static int iwlagn_alive_notify(struct iwl_priv *priv) ...@@ -369,7 +379,7 @@ static int iwlagn_alive_notify(struct iwl_priv *priv)
* using sample data 100 bytes apart. If these sample points are good, * using sample data 100 bytes apart. If these sample points are good,
* it's a pretty good bet that everything between them is good, too. * it's a pretty good bet that everything between them is good, too.
*/ */
static int iwlcore_verify_inst_sparse(struct iwl_priv *priv, static int iwl_verify_inst_sparse(struct iwl_priv *priv,
struct fw_desc *fw_desc) struct fw_desc *fw_desc)
{ {
__le32 *image = (__le32 *)fw_desc->v_addr; __le32 *image = (__le32 *)fw_desc->v_addr;
...@@ -383,9 +393,9 @@ static int iwlcore_verify_inst_sparse(struct iwl_priv *priv, ...@@ -383,9 +393,9 @@ static int iwlcore_verify_inst_sparse(struct iwl_priv *priv,
/* read data comes through single port, auto-incr addr */ /* read data comes through single port, auto-incr addr */
/* NOTE: Use the debugless read so we don't flood kernel log /* NOTE: Use the debugless read so we don't flood kernel log
* if IWL_DL_IO is set */ * if IWL_DL_IO is set */
iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, iwl_write_direct32(bus(priv), HBUS_TARG_MEM_RADDR,
i + IWLAGN_RTC_INST_LOWER_BOUND); i + IWLAGN_RTC_INST_LOWER_BOUND);
val = iwl_read32(priv, HBUS_TARG_MEM_RDAT); val = iwl_read32(bus(priv), HBUS_TARG_MEM_RDAT);
if (val != le32_to_cpu(*image)) if (val != le32_to_cpu(*image))
return -EIO; return -EIO;
} }
...@@ -404,14 +414,14 @@ static void iwl_print_mismatch_inst(struct iwl_priv *priv, ...@@ -404,14 +414,14 @@ static void iwl_print_mismatch_inst(struct iwl_priv *priv,
IWL_DEBUG_FW(priv, "ucode inst image size is %u\n", len); IWL_DEBUG_FW(priv, "ucode inst image size is %u\n", len);
iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, iwl_write_direct32(bus(priv), HBUS_TARG_MEM_RADDR,
IWLAGN_RTC_INST_LOWER_BOUND); IWLAGN_RTC_INST_LOWER_BOUND);
for (offs = 0; for (offs = 0;
offs < len && errors < 20; offs < len && errors < 20;
offs += sizeof(u32), image++) { offs += sizeof(u32), image++) {
/* read data comes through single port, auto-incr addr */ /* read data comes through single port, auto-incr addr */
val = iwl_read32(priv, HBUS_TARG_MEM_RDAT); val = iwl_read32(bus(priv), HBUS_TARG_MEM_RDAT);
if (val != le32_to_cpu(*image)) { if (val != le32_to_cpu(*image)) {
IWL_ERR(priv, "uCode INST section at " IWL_ERR(priv, "uCode INST section at "
"offset 0x%x, is 0x%x, s/b 0x%x\n", "offset 0x%x, is 0x%x, s/b 0x%x\n",
...@@ -427,7 +437,7 @@ static void iwl_print_mismatch_inst(struct iwl_priv *priv, ...@@ -427,7 +437,7 @@ static void iwl_print_mismatch_inst(struct iwl_priv *priv,
*/ */
static int iwl_verify_ucode(struct iwl_priv *priv, struct fw_img *img) static int iwl_verify_ucode(struct iwl_priv *priv, struct fw_img *img)
{ {
if (!iwlcore_verify_inst_sparse(priv, &img->code)) { if (!iwl_verify_inst_sparse(priv, &img->code)) {
IWL_DEBUG_FW(priv, "uCode is good in inst SRAM\n"); IWL_DEBUG_FW(priv, "uCode is good in inst SRAM\n");
return 0; return 0;
} }
...@@ -478,7 +488,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, ...@@ -478,7 +488,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
int ret; int ret;
enum iwlagn_ucode_type old_type; enum iwlagn_ucode_type old_type;
ret = trans_start_device(&priv->trans); ret = iwl_trans_start_device(trans(priv));
if (ret) if (ret)
return ret; return ret;
...@@ -495,7 +505,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, ...@@ -495,7 +505,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
return ret; return ret;
} }
trans_kick_nic(&priv->trans); iwl_trans_kick_nic(trans(priv));
/* /*
* Some things may run in the background now, but we * Some things may run in the background now, but we
...@@ -545,7 +555,7 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv) ...@@ -545,7 +555,7 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv)
struct iwl_notification_wait calib_wait; struct iwl_notification_wait calib_wait;
int ret; int ret;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
/* No init ucode required? Curious, but maybe ok */ /* No init ucode required? Curious, but maybe ok */
if (!priv->ucode_init.code.len) if (!priv->ucode_init.code.len)
...@@ -580,6 +590,6 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv) ...@@ -580,6 +590,6 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv)
iwlagn_remove_notification(priv, &calib_wait); iwlagn_remove_notification(priv, &calib_wait);
out: out:
/* Whatever happened, stop the device */ /* Whatever happened, stop the device */
trans_stop_device(&priv->trans); iwl_trans_stop_device(trans(priv));
return ret; return ret;
} }
...@@ -65,54 +65,9 @@ ...@@ -65,54 +65,9 @@
#include "iwl-dev.h" #include "iwl-dev.h"
/* configuration for the _agn devices */
extern struct iwl_cfg iwl5300_agn_cfg;
extern struct iwl_cfg iwl5100_agn_cfg;
extern struct iwl_cfg iwl5350_agn_cfg;
extern struct iwl_cfg iwl5100_bgn_cfg;
extern struct iwl_cfg iwl5100_abg_cfg;
extern struct iwl_cfg iwl5150_agn_cfg;
extern struct iwl_cfg iwl5150_abg_cfg;
extern struct iwl_cfg iwl6005_2agn_cfg;
extern struct iwl_cfg iwl6005_2abg_cfg;
extern struct iwl_cfg iwl6005_2bg_cfg;
extern struct iwl_cfg iwl1030_bgn_cfg;
extern struct iwl_cfg iwl1030_bg_cfg;
extern struct iwl_cfg iwl6030_2agn_cfg;
extern struct iwl_cfg iwl6030_2abg_cfg;
extern struct iwl_cfg iwl6030_2bgn_cfg;
extern struct iwl_cfg iwl6030_2bg_cfg;
extern struct iwl_cfg iwl6000i_2agn_cfg;
extern struct iwl_cfg iwl6000i_2abg_cfg;
extern struct iwl_cfg iwl6000i_2bg_cfg;
extern struct iwl_cfg iwl6000_3agn_cfg;
extern struct iwl_cfg iwl6050_2agn_cfg;
extern struct iwl_cfg iwl6050_2abg_cfg;
extern struct iwl_cfg iwl6150_bgn_cfg;
extern struct iwl_cfg iwl6150_bg_cfg;
extern struct iwl_cfg iwl1000_bgn_cfg;
extern struct iwl_cfg iwl1000_bg_cfg;
extern struct iwl_cfg iwl100_bgn_cfg;
extern struct iwl_cfg iwl100_bg_cfg;
extern struct iwl_cfg iwl130_bgn_cfg;
extern struct iwl_cfg iwl130_bg_cfg;
extern struct iwl_cfg iwl2000_2bgn_cfg;
extern struct iwl_cfg iwl2000_2bg_cfg;
extern struct iwl_cfg iwl2030_2bgn_cfg;
extern struct iwl_cfg iwl2030_2bg_cfg;
extern struct iwl_cfg iwl6035_2agn_cfg;
extern struct iwl_cfg iwl6035_2abg_cfg;
extern struct iwl_cfg iwl6035_2bg_cfg;
extern struct iwl_cfg iwl105_bg_cfg;
extern struct iwl_cfg iwl105_bgn_cfg;
extern struct iwl_cfg iwl135_bg_cfg;
extern struct iwl_cfg iwl135_bgn_cfg;
extern struct iwl_mod_params iwlagn_mod_params;
extern struct ieee80211_ops iwlagn_hw_ops; extern struct ieee80211_ops iwlagn_hw_ops;
int iwl_reset_ict(struct iwl_priv *priv); int iwl_reset_ict(struct iwl_trans *trans);
static inline void iwl_set_calib_hdr(struct iwl_calib_hdr *hdr, u8 cmd) static inline void iwl_set_calib_hdr(struct iwl_calib_hdr *hdr, u8 cmd)
{ {
...@@ -122,10 +77,6 @@ static inline void iwl_set_calib_hdr(struct iwl_calib_hdr *hdr, u8 cmd) ...@@ -122,10 +77,6 @@ static inline void iwl_set_calib_hdr(struct iwl_calib_hdr *hdr, u8 cmd)
hdr->data_valid = 1; hdr->data_valid = 1;
} }
/* tx queue */
void iwl_free_tfds_in_queue(struct iwl_priv *priv,
int sta_id, int tid, int freed);
/* RXON */ /* RXON */
int iwlagn_set_pan_params(struct iwl_priv *priv); int iwlagn_set_pan_params(struct iwl_priv *priv);
int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx); int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx);
...@@ -147,13 +98,10 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, ...@@ -147,13 +98,10 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
enum iwlagn_ucode_type ucode_type); enum iwlagn_ucode_type ucode_type);
/* lib */ /* lib */
void iwl_check_abort_status(struct iwl_priv *priv,
u8 frame_count, u32 status);
int iwlagn_hw_valid_rtc_data_addr(u32 addr); int iwlagn_hw_valid_rtc_data_addr(u32 addr);
int iwlagn_send_tx_power(struct iwl_priv *priv); int iwlagn_send_tx_power(struct iwl_priv *priv);
void iwlagn_temperature(struct iwl_priv *priv); void iwlagn_temperature(struct iwl_priv *priv);
u16 iwlagn_eeprom_calib_version(struct iwl_priv *priv); u16 iwlagn_eeprom_calib_version(struct iwl_priv *priv);
int iwlagn_wait_tx_queue_empty(struct iwl_priv *priv);
int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control); int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control);
void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control); void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control);
int iwlagn_send_beacon_cmd(struct iwl_priv *priv); int iwlagn_send_beacon_cmd(struct iwl_priv *priv);
...@@ -165,21 +113,14 @@ void iwl_rx_dispatch(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb); ...@@ -165,21 +113,14 @@ void iwl_rx_dispatch(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb);
/* tx */ /* tx */
void iwlagn_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq,
int index);
void iwlagn_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags,
struct ieee80211_tx_info *info);
int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb); int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb);
int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, u16 tid, u16 *ssn); struct ieee80211_sta *sta, u16 tid, u16 *ssn);
int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, u16 tid); struct ieee80211_sta *sta, u16 tid);
int iwlagn_txq_check_empty(struct iwl_priv *priv,
int sta_id, u8 tid, int txq_id);
void iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, void iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
struct iwl_rx_mem_buffer *rxb); struct iwl_rx_mem_buffer *rxb);
void iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb); void iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb);
int iwlagn_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index);
static inline u32 iwl_tx_status_to_mac80211(u32 status) static inline u32 iwl_tx_status_to_mac80211(u32 status)
{ {
...@@ -287,7 +228,7 @@ static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u32 flags) ...@@ -287,7 +228,7 @@ static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u32 flags)
} }
/* eeprom */ /* eeprom */
void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv); void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv);
void iwl_eeprom_get_mac(const struct iwl_priv *priv, u8 *mac); void iwl_eeprom_get_mac(const struct iwl_priv *priv, u8 *mac);
/* notification wait support */ /* notification wait support */
......
...@@ -60,16 +60,22 @@ ...@@ -60,16 +60,22 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*****************************************************************************/ *****************************************************************************/
#ifndef __iwl_pci_h__ #ifndef __iwl_bus_h__
#define __iwl_pci_h__ #define __iwl_bus_h__
/*This file includes the declaration that are exported from the bus layer */
#include <linux/types.h>
#include <linux/spinlock.h>
struct iwl_shared;
struct iwl_bus; struct iwl_bus;
/** /**
* struct iwl_bus_ops - bus specific operations * struct iwl_bus_ops - bus specific operations
* @get_pm_support: must returns true if the bus can go to sleep * @get_pm_support: must returns true if the bus can go to sleep
* @apm_config: will be called during the config of the APM configuration * @apm_config: will be called during the config of the APM configuration
* @set_drv_data: set the drv_data pointer to the bus layer * @set_drv_data: set the shared data pointer to the bus layer
* @get_hw_id: prints the hw_id in the provided buffer * @get_hw_id: prints the hw_id in the provided buffer
* @write8: write a byte to register at offset ofs * @write8: write a byte to register at offset ofs
* @write32: write a dword to register at offset ofs * @write32: write a dword to register at offset ofs
...@@ -78,20 +84,29 @@ struct iwl_bus; ...@@ -78,20 +84,29 @@ struct iwl_bus;
struct iwl_bus_ops { struct iwl_bus_ops {
bool (*get_pm_support)(struct iwl_bus *bus); bool (*get_pm_support)(struct iwl_bus *bus);
void (*apm_config)(struct iwl_bus *bus); void (*apm_config)(struct iwl_bus *bus);
void (*set_drv_data)(struct iwl_bus *bus, void *drv_data); void (*set_drv_data)(struct iwl_bus *bus, struct iwl_shared *shrd);
void (*get_hw_id)(struct iwl_bus *bus, char buf[], int buf_len); void (*get_hw_id)(struct iwl_bus *bus, char buf[], int buf_len);
void (*write8)(struct iwl_bus *bus, u32 ofs, u8 val); void (*write8)(struct iwl_bus *bus, u32 ofs, u8 val);
void (*write32)(struct iwl_bus *bus, u32 ofs, u32 val); void (*write32)(struct iwl_bus *bus, u32 ofs, u32 val);
u32 (*read32)(struct iwl_bus *bus, u32 ofs); u32 (*read32)(struct iwl_bus *bus, u32 ofs);
}; };
/**
* struct iwl_bus - bus common data
* @dev - pointer to struct device * that represent the device
* @ops - pointer to iwl_bus_ops
* @shrd - pointer to iwl_shared which holds shared data from the upper layer
* @irq - the irq number for the device
* @reg_lock - protect hw register access
*/
struct iwl_bus { struct iwl_bus {
/* Common data to all buses */ /* Common data to all buses */
void *drv_data; /* driver's context */
struct device *dev; struct device *dev;
struct iwl_bus_ops *ops; const struct iwl_bus_ops *ops;
struct iwl_shared *shrd;
unsigned int irq; unsigned int irq;
spinlock_t reg_lock;
/* pointer to bus specific struct */ /* pointer to bus specific struct */
/*Ensure that this pointer will always be aligned to sizeof pointer */ /*Ensure that this pointer will always be aligned to sizeof pointer */
...@@ -108,9 +123,10 @@ static inline void bus_apm_config(struct iwl_bus *bus) ...@@ -108,9 +123,10 @@ static inline void bus_apm_config(struct iwl_bus *bus)
bus->ops->apm_config(bus); bus->ops->apm_config(bus);
} }
static inline void bus_set_drv_data(struct iwl_bus *bus, void *drv_data) static inline void bus_set_drv_data(struct iwl_bus *bus,
struct iwl_shared *shrd)
{ {
bus->ops->set_drv_data(bus, drv_data); bus->ops->set_drv_data(bus, shrd);
} }
static inline void bus_get_hw_id(struct iwl_bus *bus, char buf[], int buf_len) static inline void bus_get_hw_id(struct iwl_bus *bus, char buf[], int buf_len)
...@@ -136,4 +152,4 @@ static inline u32 bus_read32(struct iwl_bus *bus, u32 ofs) ...@@ -136,4 +152,4 @@ static inline u32 bus_read32(struct iwl_bus *bus, u32 ofs)
int __must_check iwl_pci_register_driver(void); int __must_check iwl_pci_register_driver(void);
void iwl_pci_unregister_driver(void); void iwl_pci_unregister_driver(void);
#endif #endif /* __iwl_bus_h__ */
...@@ -69,6 +69,9 @@ ...@@ -69,6 +69,9 @@
#ifndef __iwl_commands_h__ #ifndef __iwl_commands_h__
#define __iwl_commands_h__ #define __iwl_commands_h__
#include <linux/etherdevice.h>
#include <linux/ieee80211.h>
struct iwl_priv; struct iwl_priv;
/* uCode version contains 4 values: Major/Minor/API/Serial */ /* uCode version contains 4 values: Major/Minor/API/Serial */
...@@ -670,7 +673,6 @@ struct iwl_rxon_assoc_cmd { ...@@ -670,7 +673,6 @@ struct iwl_rxon_assoc_cmd {
#define IWL_CONN_MAX_LISTEN_INTERVAL 10 #define IWL_CONN_MAX_LISTEN_INTERVAL 10
#define IWL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */ #define IWL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */
#define IWL39_MAX_UCODE_BEACON_INTERVAL 1 /* 1024 */
/* /*
* REPLY_RXON_TIMING = 0x14 (command, has simple generic response) * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
...@@ -806,6 +808,7 @@ struct iwl_qosparam_cmd { ...@@ -806,6 +808,7 @@ struct iwl_qosparam_cmd {
#define IWLAGN_STATION_COUNT 16 #define IWLAGN_STATION_COUNT 16
#define IWL_INVALID_STATION 255 #define IWL_INVALID_STATION 255
#define IWL_MAX_TID_COUNT 9
#define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2) #define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2)
#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8) #define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8)
...@@ -3909,6 +3912,7 @@ struct iwlagn_wowlan_kek_kck_material_cmd { ...@@ -3909,6 +3912,7 @@ struct iwlagn_wowlan_kek_kck_material_cmd {
* Union of all expected notifications/responses: * Union of all expected notifications/responses:
* *
*****************************************************************************/ *****************************************************************************/
#define FH_RSCSR_FRAME_SIZE_MSK (0x00003FFF) /* bits 0-13 */
struct iwl_rx_packet { struct iwl_rx_packet {
/* /*
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include <linux/tracepoint.h> #include <linux/tracepoint.h>
struct iwl_priv;
#if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__) #if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__)
#undef TRACE_EVENT #undef TRACE_EVENT
#define TRACE_EVENT(name, proto, ...) \ #define TRACE_EVENT(name, proto, ...) \
......
...@@ -301,7 +301,6 @@ void iwl_eeprom_free(struct iwl_priv *priv); ...@@ -301,7 +301,6 @@ void iwl_eeprom_free(struct iwl_priv *priv);
int iwl_eeprom_check_version(struct iwl_priv *priv); int iwl_eeprom_check_version(struct iwl_priv *priv);
int iwl_eeprom_check_sku(struct iwl_priv *priv); int iwl_eeprom_check_sku(struct iwl_priv *priv);
const u8 *iwl_eeprom_query_addr(const struct iwl_priv *priv, size_t offset); const u8 *iwl_eeprom_query_addr(const struct iwl_priv *priv, size_t offset);
int iwlcore_eeprom_verify_signature(struct iwl_priv *priv);
u16 iwl_eeprom_query16(const struct iwl_priv *priv, size_t offset); u16 iwl_eeprom_query16(const struct iwl_priv *priv, size_t offset);
int iwl_init_channel_map(struct iwl_priv *priv); int iwl_init_channel_map(struct iwl_priv *priv);
void iwl_free_channel_map(struct iwl_priv *priv); void iwl_free_channel_map(struct iwl_priv *priv);
......
此差异已折叠。
...@@ -217,8 +217,8 @@ ...@@ -217,8 +217,8 @@
((SCD_TRANS_TBL_MEM_LOWER_BOUND + ((x) * 2)) & 0xfffc) ((SCD_TRANS_TBL_MEM_LOWER_BOUND + ((x) * 2)) & 0xfffc)
#define SCD_QUEUECHAIN_SEL_ALL(priv) \ #define SCD_QUEUECHAIN_SEL_ALL(priv) \
(((1<<(priv)->hw_params.max_txq_num) - 1) &\ (((1<<hw_params(priv).max_txq_num) - 1) &\
(~(1<<(priv)->cmd_queue))) (~(1<<(priv)->shrd->cmd_queue)))
#define SCD_BASE (PRPH_BASE + 0xa02c00) #define SCD_BASE (PRPH_BASE + 0xa02c00)
......
此差异已折叠。
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#endif /* CONFIG_P54_SPI_DEFAULT_EEPROM */ #endif /* CONFIG_P54_SPI_DEFAULT_EEPROM */
MODULE_FIRMWARE("3826.arm"); MODULE_FIRMWARE("3826.arm");
MODULE_ALIAS("stlc45xx");
/* /*
* gpios should be handled in board files and provided via platform data, * gpios should be handled in board files and provided via platform data,
...@@ -738,3 +737,4 @@ MODULE_LICENSE("GPL"); ...@@ -738,3 +737,4 @@ MODULE_LICENSE("GPL");
MODULE_AUTHOR("Christian Lamparter <chunkeey@web.de>"); MODULE_AUTHOR("Christian Lamparter <chunkeey@web.de>");
MODULE_ALIAS("spi:cx3110x"); MODULE_ALIAS("spi:cx3110x");
MODULE_ALIAS("spi:p54spi"); MODULE_ALIAS("spi:p54spi");
MODULE_ALIAS("spi:stlc45xx");
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部