Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem

Conflicts:
	drivers/net/wireless/iwlwifi/iwl-testmode.c
This commit is contained in:
John W. Linville
2012-04-26 15:03:48 -04:00
123 changed files with 3465 additions and 2563 deletions

View File

@@ -618,19 +618,10 @@ static void ar5008_hw_init_bb(struct ath_hw *ah,
u32 synthDelay; u32 synthDelay;
synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY;
if (IS_CHAN_B(chan))
synthDelay = (4 * synthDelay) / 22;
else
synthDelay /= 10;
if (IS_CHAN_HALF_RATE(chan))
synthDelay *= 2;
else if (IS_CHAN_QUARTER_RATE(chan))
synthDelay *= 4;
REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN);
udelay(synthDelay + BASE_ACTIVATE_DELAY); ath9k_hw_synth_delay(ah, chan, synthDelay);
} }
static void ar5008_hw_init_chain_masks(struct ath_hw *ah) static void ar5008_hw_init_chain_masks(struct ath_hw *ah)
@@ -948,12 +939,8 @@ static bool ar5008_hw_rfbus_req(struct ath_hw *ah)
static void ar5008_hw_rfbus_done(struct ath_hw *ah) static void ar5008_hw_rfbus_done(struct ath_hw *ah)
{ {
u32 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; u32 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY;
if (IS_CHAN_B(ah->curchan))
synthDelay = (4 * synthDelay) / 22;
else
synthDelay /= 10;
udelay(synthDelay + BASE_ACTIVATE_DELAY); ath9k_hw_synth_delay(ah, ah->curchan, synthDelay);
REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0); REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0);
} }

View File

@@ -1000,10 +1000,12 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
if (mci && IS_CHAN_2GHZ(chan) && run_agc_cal) if (mci && IS_CHAN_2GHZ(chan) && run_agc_cal)
ar9003_mci_init_cal_req(ah, &is_reusable); ar9003_mci_init_cal_req(ah, &is_reusable);
txiqcal_done = ar9003_hw_tx_iq_cal_run(ah); if (!(IS_CHAN_HALF_RATE(chan) || IS_CHAN_QUARTER_RATE(chan))) {
REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS); txiqcal_done = ar9003_hw_tx_iq_cal_run(ah);
udelay(5); REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS);
REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); udelay(5);
REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN);
}
skip_tx_iqcal: skip_tx_iqcal:
if (run_agc_cal || !(ah->ah_flags & AH_FASTCC)) { if (run_agc_cal || !(ah->ah_flags & AH_FASTCC)) {

View File

@@ -4281,18 +4281,10 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray)
#undef POW_SM #undef POW_SM
} }
static void ar9003_hw_set_target_power_eeprom(struct ath_hw *ah, u16 freq, static void ar9003_hw_get_legacy_target_powers(struct ath_hw *ah, u16 freq,
u8 *targetPowerValT2) u8 *targetPowerValT2,
bool is2GHz)
{ {
/* XXX: hard code for now, need to get from eeprom struct */
u8 ht40PowerIncForPdadc = 0;
bool is2GHz = false;
unsigned int i = 0;
struct ath_common *common = ath9k_hw_common(ah);
if (freq < 4000)
is2GHz = true;
targetPowerValT2[ALL_TARGET_LEGACY_6_24] = targetPowerValT2[ALL_TARGET_LEGACY_6_24] =
ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_6_24, freq, ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_6_24, freq,
is2GHz); is2GHz);
@@ -4305,6 +4297,11 @@ static void ar9003_hw_set_target_power_eeprom(struct ath_hw *ah, u16 freq,
targetPowerValT2[ALL_TARGET_LEGACY_54] = targetPowerValT2[ALL_TARGET_LEGACY_54] =
ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_54, freq, ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_54, freq,
is2GHz); is2GHz);
}
static void ar9003_hw_get_cck_target_powers(struct ath_hw *ah, u16 freq,
u8 *targetPowerValT2)
{
targetPowerValT2[ALL_TARGET_LEGACY_1L_5L] = targetPowerValT2[ALL_TARGET_LEGACY_1L_5L] =
ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_1L_5L, ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_1L_5L,
freq); freq);
@@ -4314,6 +4311,11 @@ static void ar9003_hw_set_target_power_eeprom(struct ath_hw *ah, u16 freq,
ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11L, freq); ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11L, freq);
targetPowerValT2[ALL_TARGET_LEGACY_11S] = targetPowerValT2[ALL_TARGET_LEGACY_11S] =
ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11S, freq); ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11S, freq);
}
static void ar9003_hw_get_ht20_target_powers(struct ath_hw *ah, u16 freq,
u8 *targetPowerValT2, bool is2GHz)
{
targetPowerValT2[ALL_TARGET_HT20_0_8_16] = targetPowerValT2[ALL_TARGET_HT20_0_8_16] =
ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq, ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq,
is2GHz); is2GHz);
@@ -4356,6 +4358,16 @@ static void ar9003_hw_set_target_power_eeprom(struct ath_hw *ah, u16 freq,
targetPowerValT2[ALL_TARGET_HT20_23] = targetPowerValT2[ALL_TARGET_HT20_23] =
ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_23, freq, ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_23, freq,
is2GHz); is2GHz);
}
static void ar9003_hw_get_ht40_target_powers(struct ath_hw *ah,
u16 freq,
u8 *targetPowerValT2,
bool is2GHz)
{
/* XXX: hard code for now, need to get from eeprom struct */
u8 ht40PowerIncForPdadc = 0;
targetPowerValT2[ALL_TARGET_HT40_0_8_16] = targetPowerValT2[ALL_TARGET_HT40_0_8_16] =
ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq, ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq,
is2GHz) + ht40PowerIncForPdadc; is2GHz) + ht40PowerIncForPdadc;
@@ -4399,6 +4411,26 @@ static void ar9003_hw_set_target_power_eeprom(struct ath_hw *ah, u16 freq,
targetPowerValT2[ALL_TARGET_HT40_23] = targetPowerValT2[ALL_TARGET_HT40_23] =
ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_23, freq, ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_23, freq,
is2GHz) + ht40PowerIncForPdadc; is2GHz) + ht40PowerIncForPdadc;
}
static void ar9003_hw_get_target_power_eeprom(struct ath_hw *ah,
struct ath9k_channel *chan,
u8 *targetPowerValT2)
{
bool is2GHz = IS_CHAN_2GHZ(chan);
unsigned int i = 0;
struct ath_common *common = ath9k_hw_common(ah);
u16 freq = chan->channel;
if (is2GHz)
ar9003_hw_get_cck_target_powers(ah, freq, targetPowerValT2);
ar9003_hw_get_legacy_target_powers(ah, freq, targetPowerValT2, is2GHz);
ar9003_hw_get_ht20_target_powers(ah, freq, targetPowerValT2, is2GHz);
if (IS_CHAN_HT40(chan))
ar9003_hw_get_ht40_target_powers(ah, freq, targetPowerValT2,
is2GHz);
for (i = 0; i < ar9300RateSize; i++) { for (i = 0; i < ar9300RateSize; i++) {
ath_dbg(common, EEPROM, "TPC[%02d] 0x%08x\n", ath_dbg(common, EEPROM, "TPC[%02d] 0x%08x\n",
@@ -4778,9 +4810,6 @@ static void ar9003_hw_set_power_per_rate_table(struct ath_hw *ah,
scaledPower = ath9k_hw_get_scaled_power(ah, powerLimit, scaledPower = ath9k_hw_get_scaled_power(ah, powerLimit,
antenna_reduction); antenna_reduction);
/*
* Get target powers from EEPROM - our baseline for TX Power
*/
if (is2ghz) { if (is2ghz) {
/* Setup for CTL modes */ /* Setup for CTL modes */
/* CTL_11B, CTL_11G, CTL_2GHT20 */ /* CTL_11B, CTL_11G, CTL_2GHT20 */
@@ -4952,7 +4981,12 @@ static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah,
unsigned int i = 0, paprd_scale_factor = 0; unsigned int i = 0, paprd_scale_factor = 0;
u8 pwr_idx, min_pwridx = 0; u8 pwr_idx, min_pwridx = 0;
ar9003_hw_set_target_power_eeprom(ah, chan->channel, targetPowerValT2); memset(targetPowerValT2, 0 , sizeof(targetPowerValT2));
/*
* Get target powers from EEPROM - our baseline for TX Power
*/
ar9003_hw_get_target_power_eeprom(ah, chan, targetPowerValT2);
if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) { if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) {
if (IS_CHAN_2GHZ(chan)) if (IS_CHAN_2GHZ(chan))

View File

@@ -526,22 +526,10 @@ static void ar9003_hw_init_bb(struct ath_hw *ah,
* Value is in 100ns increments. * Value is in 100ns increments.
*/ */
synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY;
if (IS_CHAN_B(chan))
synthDelay = (4 * synthDelay) / 22;
else
synthDelay /= 10;
/* Activate the PHY (includes baseband activate + synthesizer on) */ /* Activate the PHY (includes baseband activate + synthesizer on) */
REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN);
ath9k_hw_synth_delay(ah, chan, synthDelay);
/*
* There is an issue if the AP starts the calibration before
* the base band timeout completes. This could result in the
* rx_clear false triggering. As a workaround we add delay an
* extra BASE_ACTIVATE_DELAY usecs to ensure this condition
* does not happen.
*/
udelay(synthDelay + BASE_ACTIVATE_DELAY);
} }
static void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx) static void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx)
@@ -723,6 +711,14 @@ static void ar9003_hw_set_rfmode(struct ath_hw *ah,
if (IS_CHAN_A_FAST_CLOCK(ah, chan)) if (IS_CHAN_A_FAST_CLOCK(ah, chan))
rfMode |= (AR_PHY_MODE_DYNAMIC | AR_PHY_MODE_DYN_CCK_DISABLE); rfMode |= (AR_PHY_MODE_DYNAMIC | AR_PHY_MODE_DYN_CCK_DISABLE);
if (IS_CHAN_QUARTER_RATE(chan))
rfMode |= AR_PHY_MODE_QUARTER;
if (IS_CHAN_HALF_RATE(chan))
rfMode |= AR_PHY_MODE_HALF;
if (rfMode & (AR_PHY_MODE_QUARTER | AR_PHY_MODE_HALF))
REG_RMW_FIELD(ah, AR_PHY_FRAME_CTL,
AR_PHY_FRAME_CTL_CF_OVERLAP_WINDOW, 3);
REG_WRITE(ah, AR_PHY_MODE, rfMode); REG_WRITE(ah, AR_PHY_MODE, rfMode);
} }
@@ -793,12 +789,8 @@ static bool ar9003_hw_rfbus_req(struct ath_hw *ah)
static void ar9003_hw_rfbus_done(struct ath_hw *ah) static void ar9003_hw_rfbus_done(struct ath_hw *ah)
{ {
u32 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; u32 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY;
if (IS_CHAN_B(ah->curchan))
synthDelay = (4 * synthDelay) / 22;
else
synthDelay /= 10;
udelay(synthDelay + BASE_ACTIVATE_DELAY); ath9k_hw_synth_delay(ah, ah->curchan, synthDelay);
REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0); REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0);
} }

View File

@@ -468,6 +468,9 @@
#define AR_PHY_ADDAC_PARA_CTL (AR_SM_BASE + 0x150) #define AR_PHY_ADDAC_PARA_CTL (AR_SM_BASE + 0x150)
#define AR_PHY_XPA_CFG (AR_SM_BASE + 0x158) #define AR_PHY_XPA_CFG (AR_SM_BASE + 0x158)
#define AR_PHY_FRAME_CTL_CF_OVERLAP_WINDOW 3
#define AR_PHY_FRAME_CTL_CF_OVERLAP_WINDOW_S 0
#define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A 0x0001FC00 #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A 0x0001FC00
#define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_S 10 #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_S 10
#define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_A 0x3FF #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_A 0x3FF

View File

@@ -817,8 +817,10 @@ void ath9k_set_beaconing_status(struct ath_softc *sc, bool status)
{ {
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
if (!ath_has_valid_bslot(sc)) if (!ath_has_valid_bslot(sc)) {
sc->sc_flags &= ~SC_OP_BEACONS;
return; return;
}
ath9k_ps_wakeup(sc); ath9k_ps_wakeup(sc);
if (status) { if (status) {

View File

@@ -108,9 +108,7 @@ void ath9k_hw_btcoex_init_scheme(struct ath_hw *ah)
return; return;
} }
if (AR_SREV_9462(ah)) { if (AR_SREV_9300_20_OR_LATER(ah)) {
btcoex_hw->scheme = ATH_BTCOEX_CFG_MCI;
} else if (AR_SREV_9300_20_OR_LATER(ah)) {
btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE; btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE;
btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9300; btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9300;
btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9300; btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9300;
@@ -284,11 +282,12 @@ void ath9k_hw_btcoex_enable(struct ath_hw *ah)
ath9k_hw_btcoex_enable_2wire(ah); ath9k_hw_btcoex_enable_2wire(ah);
break; break;
case ATH_BTCOEX_CFG_3WIRE: case ATH_BTCOEX_CFG_3WIRE:
if (AR_SREV_9462(ah)) {
ath9k_hw_btcoex_enable_mci(ah);
return;
}
ath9k_hw_btcoex_enable_3wire(ah); ath9k_hw_btcoex_enable_3wire(ah);
break; break;
case ATH_BTCOEX_CFG_MCI:
ath9k_hw_btcoex_enable_mci(ah);
return;
} }
REG_RMW(ah, AR_GPIO_PDPU, REG_RMW(ah, AR_GPIO_PDPU,
@@ -305,11 +304,12 @@ void ath9k_hw_btcoex_disable(struct ath_hw *ah)
int i; int i;
btcoex_hw->enabled = false; btcoex_hw->enabled = false;
if (btcoex_hw->scheme == ATH_BTCOEX_CFG_MCI) { if (AR_SREV_9462(ah)) {
ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE); ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE);
for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++)
REG_WRITE(ah, AR_MCI_COEX_WL_WEIGHTS(i), REG_WRITE(ah, AR_MCI_COEX_WL_WEIGHTS(i),
btcoex_hw->wlan_weight[i]); btcoex_hw->wlan_weight[i]);
return;
} }
ath9k_hw_set_gpio(ah, btcoex_hw->wlanactive_gpio, 0); ath9k_hw_set_gpio(ah, btcoex_hw->wlanactive_gpio, 0);

View File

@@ -51,7 +51,6 @@ enum ath_btcoex_scheme {
ATH_BTCOEX_CFG_NONE, ATH_BTCOEX_CFG_NONE,
ATH_BTCOEX_CFG_2WIRE, ATH_BTCOEX_CFG_2WIRE,
ATH_BTCOEX_CFG_3WIRE, ATH_BTCOEX_CFG_3WIRE,
ATH_BTCOEX_CFG_MCI,
}; };
struct ath9k_hw_mci { struct ath9k_hw_mci {

View File

@@ -148,11 +148,13 @@ void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data,
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
DFS_STAT_INC(sc, pulses_total);
if ((rs->rs_phyerr != ATH9K_PHYERR_RADAR) && if ((rs->rs_phyerr != ATH9K_PHYERR_RADAR) &&
(rs->rs_phyerr != ATH9K_PHYERR_FALSE_RADAR_EXT)) { (rs->rs_phyerr != ATH9K_PHYERR_FALSE_RADAR_EXT)) {
ath_dbg(common, DFS, ath_dbg(common, DFS,
"Error: rs_phyer=0x%x not a radar error\n", "Error: rs_phyer=0x%x not a radar error\n",
rs->rs_phyerr); rs->rs_phyerr);
DFS_STAT_INC(sc, pulses_no_dfs);
return; return;
} }
@@ -188,7 +190,9 @@ void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data,
"width=%d, rssi=%d, delta_ts=%llu\n", "width=%d, rssi=%d, delta_ts=%llu\n",
pe.freq, pe.ts, pe.width, pe.rssi, pe.ts-last_ts); pe.freq, pe.ts, pe.width, pe.rssi, pe.ts-last_ts);
last_ts = pe.ts; last_ts = pe.ts;
DFS_STAT_INC(sc, pulses_processed);
if (pd != NULL && pd->add_pulse(pd, &pe)) { if (pd != NULL && pd->add_pulse(pd, &pe)) {
DFS_STAT_INC(sc, radar_detected);
/* /*
* TODO: forward radar event to DFS management layer * TODO: forward radar event to DFS management layer
*/ */

View File

@@ -21,9 +21,15 @@
#include "ath9k.h" #include "ath9k.h"
#include "dfs_debug.h" #include "dfs_debug.h"
struct ath_dfs_pool_stats global_dfs_pool_stats = { 0 };
#define ATH9K_DFS_STAT(s, p) \ #define ATH9K_DFS_STAT(s, p) \
len += snprintf(buf + len, size - len, "%28s : %10u\n", s, \ len += snprintf(buf + len, size - len, "%28s : %10u\n", s, \
sc->debug.stats.dfs_stats.p); sc->debug.stats.dfs_stats.p);
#define ATH9K_DFS_POOL_STAT(s, p) \
len += snprintf(buf + len, size - len, "%28s : %10u\n", s, \
global_dfs_pool_stats.p);
static ssize_t read_file_dfs(struct file *file, char __user *user_buf, static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
@@ -43,6 +49,9 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
hw_ver->macVersion, hw_ver->macRev, hw_ver->macVersion, hw_ver->macRev,
(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_DFS) ? (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_DFS) ?
"enabled" : "disabled"); "enabled" : "disabled");
len += snprintf(buf + len, size - len, "Pulse detector statistics:\n");
ATH9K_DFS_STAT("pulse events reported ", pulses_total);
ATH9K_DFS_STAT("invalid pulse events ", pulses_no_dfs);
ATH9K_DFS_STAT("DFS pulses detected ", pulses_detected); ATH9K_DFS_STAT("DFS pulses detected ", pulses_detected);
ATH9K_DFS_STAT("Datalen discards ", datalen_discards); ATH9K_DFS_STAT("Datalen discards ", datalen_discards);
ATH9K_DFS_STAT("RSSI discards ", rssi_discards); ATH9K_DFS_STAT("RSSI discards ", rssi_discards);
@@ -50,6 +59,18 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
ATH9K_DFS_STAT("Primary channel pulses ", pri_phy_errors); ATH9K_DFS_STAT("Primary channel pulses ", pri_phy_errors);
ATH9K_DFS_STAT("Secondary channel pulses", ext_phy_errors); ATH9K_DFS_STAT("Secondary channel pulses", ext_phy_errors);
ATH9K_DFS_STAT("Dual channel pulses ", dc_phy_errors); ATH9K_DFS_STAT("Dual channel pulses ", dc_phy_errors);
len += snprintf(buf + len, size - len, "Radar detector statistics "
"(current DFS region: %d)\n", sc->dfs_detector->region);
ATH9K_DFS_STAT("Pulse events processed ", pulses_processed);
ATH9K_DFS_STAT("Radars detected ", radar_detected);
len += snprintf(buf + len, size - len, "Global Pool statistics:\n");
ATH9K_DFS_POOL_STAT("Pool references ", pool_reference);
ATH9K_DFS_POOL_STAT("Pulses allocated ", pulse_allocated);
ATH9K_DFS_POOL_STAT("Pulses alloc error ", pulse_alloc_error);
ATH9K_DFS_POOL_STAT("Pulses in use ", pulse_used);
ATH9K_DFS_POOL_STAT("Seqs. allocated ", pseq_allocated);
ATH9K_DFS_POOL_STAT("Seqs. alloc error ", pseq_alloc_error);
ATH9K_DFS_POOL_STAT("Seqs. in use ", pseq_used);
if (len > size) if (len > size)
len = size; len = size;
@@ -60,8 +81,33 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
return retval; return retval;
} }
/* magic number to prevent accidental reset of DFS statistics */
#define DFS_STATS_RESET_MAGIC 0x80000000
static ssize_t write_file_dfs(struct file *file, const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath_softc *sc = file->private_data;
unsigned long val;
char buf[32];
ssize_t len;
len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
buf[len] = '\0';
if (strict_strtoul(buf, 0, &val))
return -EINVAL;
if (val == DFS_STATS_RESET_MAGIC)
memset(&sc->debug.stats.dfs_stats, 0,
sizeof(sc->debug.stats.dfs_stats));
return count;
}
static const struct file_operations fops_dfs_stats = { static const struct file_operations fops_dfs_stats = {
.read = read_file_dfs, .read = read_file_dfs,
.write = write_file_dfs,
.open = simple_open, .open = simple_open,
.owner = THIS_MODULE, .owner = THIS_MODULE,
.llseek = default_llseek, .llseek = default_llseek,

View File

@@ -22,17 +22,23 @@
#include "hw.h" #include "hw.h"
/** /**
* struct ath_dfs_stats - DFS Statistics * struct ath_dfs_stats - DFS Statistics per wiphy
* * @pulses_total: pulses reported by HW
* @pulses_detected: No. of pulses detected so far * @pulses_no_dfs: pulses wrongly reported as DFS
* @datalen_discards: No. of pulses discarded due to invalid datalen * @pulses_detected: pulses detected so far
* @rssi_discards: No. of pulses discarded due to invalid RSSI * @datalen_discards: pulses discarded due to invalid datalen
* @bwinfo_discards: No. of pulses discarded due to invalid BW info * @rssi_discards: pulses discarded due to invalid RSSI
* @pri_phy_errors: No. of pulses reported for primary channel * @bwinfo_discards: pulses discarded due to invalid BW info
* @ext_phy_errors: No. of pulses reported for extension channel * @pri_phy_errors: pulses reported for primary channel
* @dc_phy_errors: No. of pulses reported for primary + extension channel * @ext_phy_errors: pulses reported for extension channel
* @dc_phy_errors: pulses reported for primary + extension channel
* @pulses_processed: pulses forwarded to detector
* @radar_detected: radars detected
*/ */
struct ath_dfs_stats { struct ath_dfs_stats {
/* pulse stats */
u32 pulses_total;
u32 pulses_no_dfs;
u32 pulses_detected; u32 pulses_detected;
u32 datalen_discards; u32 datalen_discards;
u32 rssi_discards; u32 rssi_discards;
@@ -40,18 +46,39 @@ struct ath_dfs_stats {
u32 pri_phy_errors; u32 pri_phy_errors;
u32 ext_phy_errors; u32 ext_phy_errors;
u32 dc_phy_errors; u32 dc_phy_errors;
/* pattern detection stats */
u32 pulses_processed;
u32 radar_detected;
}; };
/**
* struct ath_dfs_pool_stats - DFS Statistics for global pools
*/
struct ath_dfs_pool_stats {
u32 pool_reference;
u32 pulse_allocated;
u32 pulse_alloc_error;
u32 pulse_used;
u32 pseq_allocated;
u32 pseq_alloc_error;
u32 pseq_used;
};
#if defined(CONFIG_ATH9K_DFS_DEBUGFS) #if defined(CONFIG_ATH9K_DFS_DEBUGFS)
#define DFS_STAT_INC(sc, c) (sc->debug.stats.dfs_stats.c++) #define DFS_STAT_INC(sc, c) (sc->debug.stats.dfs_stats.c++)
void ath9k_dfs_init_debug(struct ath_softc *sc); void ath9k_dfs_init_debug(struct ath_softc *sc);
#define DFS_POOL_STAT_INC(c) (global_dfs_pool_stats.c++)
#define DFS_POOL_STAT_DEC(c) (global_dfs_pool_stats.c--)
extern struct ath_dfs_pool_stats global_dfs_pool_stats;
#else #else
#define DFS_STAT_INC(sc, c) do { } while (0) #define DFS_STAT_INC(sc, c) do { } while (0)
static inline void ath9k_dfs_init_debug(struct ath_softc *sc) { } static inline void ath9k_dfs_init_debug(struct ath_softc *sc) { }
#define DFS_POOL_STAT_INC(c) do { } while (0)
#define DFS_POOL_STAT_DEC(c) do { } while (0)
#endif /* CONFIG_ATH9K_DFS_DEBUGFS */ #endif /* CONFIG_ATH9K_DFS_DEBUGFS */
#endif /* ATH9K_DFS_DEBUG_H */ #endif /* ATH9K_DFS_DEBUG_H */

View File

@@ -15,9 +15,12 @@
*/ */
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/spinlock.h>
#include "ath9k.h"
#include "dfs_pattern_detector.h" #include "dfs_pattern_detector.h"
#include "dfs_pri_detector.h" #include "dfs_pri_detector.h"
#include "dfs_debug.h"
/** /**
* struct pri_sequence - sequence of pulses matching one PRI * struct pri_sequence - sequence of pulses matching one PRI
@@ -94,6 +97,81 @@ static u32 pde_get_multiple(u32 val, u32 fraction, u32 tolerance)
static u32 singleton_pool_references; static u32 singleton_pool_references;
static LIST_HEAD(pulse_pool); static LIST_HEAD(pulse_pool);
static LIST_HEAD(pseq_pool); static LIST_HEAD(pseq_pool);
static DEFINE_SPINLOCK(pool_lock);
static void pool_register_ref(void)
{
spin_lock_bh(&pool_lock);
singleton_pool_references++;
DFS_POOL_STAT_INC(pool_reference);
spin_unlock_bh(&pool_lock);
}
static void pool_deregister_ref(void)
{
spin_lock_bh(&pool_lock);
singleton_pool_references--;
DFS_POOL_STAT_DEC(pool_reference);
if (singleton_pool_references == 0) {
/* free singleton pools with no references left */
struct pri_sequence *ps, *ps0;
struct pulse_elem *p, *p0;
list_for_each_entry_safe(p, p0, &pulse_pool, head) {
list_del(&p->head);
DFS_POOL_STAT_DEC(pulse_allocated);
kfree(p);
}
list_for_each_entry_safe(ps, ps0, &pseq_pool, head) {
list_del(&ps->head);
DFS_POOL_STAT_DEC(pseq_allocated);
kfree(ps);
}
}
spin_unlock_bh(&pool_lock);
}
static void pool_put_pulse_elem(struct pulse_elem *pe)
{
spin_lock_bh(&pool_lock);
list_add(&pe->head, &pulse_pool);
DFS_POOL_STAT_DEC(pulse_used);
spin_unlock_bh(&pool_lock);
}
static void pool_put_pseq_elem(struct pri_sequence *pse)
{
spin_lock_bh(&pool_lock);
list_add(&pse->head, &pseq_pool);
DFS_POOL_STAT_DEC(pseq_used);
spin_unlock_bh(&pool_lock);
}
static struct pri_sequence *pool_get_pseq_elem(void)
{
struct pri_sequence *pse = NULL;
spin_lock_bh(&pool_lock);
if (!list_empty(&pseq_pool)) {
pse = list_first_entry(&pseq_pool, struct pri_sequence, head);
list_del(&pse->head);
DFS_POOL_STAT_INC(pseq_used);
}
spin_unlock_bh(&pool_lock);
return pse;
}
static struct pulse_elem *pool_get_pulse_elem(void)
{
struct pulse_elem *pe = NULL;
spin_lock_bh(&pool_lock);
if (!list_empty(&pulse_pool)) {
pe = list_first_entry(&pulse_pool, struct pulse_elem, head);
list_del(&pe->head);
DFS_POOL_STAT_INC(pulse_used);
}
spin_unlock_bh(&pool_lock);
return pe;
}
static struct pulse_elem *pulse_queue_get_tail(struct pri_detector *pde) static struct pulse_elem *pulse_queue_get_tail(struct pri_detector *pde)
{ {
@@ -110,7 +188,7 @@ static bool pulse_queue_dequeue(struct pri_detector *pde)
list_del_init(&p->head); list_del_init(&p->head);
pde->count--; pde->count--;
/* give it back to pool */ /* give it back to pool */
list_add(&p->head, &pulse_pool); pool_put_pulse_elem(p);
} }
return (pde->count > 0); return (pde->count > 0);
} }
@@ -138,16 +216,15 @@ static void pulse_queue_check_window(struct pri_detector *pde)
static bool pulse_queue_enqueue(struct pri_detector *pde, u64 ts) static bool pulse_queue_enqueue(struct pri_detector *pde, u64 ts)
{ {
struct pulse_elem *p; struct pulse_elem *p = pool_get_pulse_elem();
if (!list_empty(&pulse_pool)) { if (p == NULL) {
p = list_first_entry(&pulse_pool, struct pulse_elem, head);
list_del(&p->head);
} else {
p = kmalloc(sizeof(*p), GFP_KERNEL); p = kmalloc(sizeof(*p), GFP_KERNEL);
if (p == NULL) { if (p == NULL) {
pr_err("failed to allocate pulse_elem\n"); DFS_POOL_STAT_INC(pulse_alloc_error);
return false; return false;
} }
DFS_POOL_STAT_INC(pulse_allocated);
DFS_POOL_STAT_INC(pulse_used);
} }
INIT_LIST_HEAD(&p->head); INIT_LIST_HEAD(&p->head);
p->ts = ts; p->ts = ts;
@@ -220,15 +297,15 @@ static bool pseq_handler_create_sequences(struct pri_detector *pde,
/* this is a valid one, add it */ /* this is a valid one, add it */
ps.deadline_ts = ps.first_ts + ps.dur; ps.deadline_ts = ps.first_ts + ps.dur;
new_ps = pool_get_pseq_elem();
if (!list_empty(&pseq_pool)) { if (new_ps == NULL) {
new_ps = list_first_entry(&pseq_pool,
struct pri_sequence, head);
list_del(&new_ps->head);
} else {
new_ps = kmalloc(sizeof(*new_ps), GFP_KERNEL); new_ps = kmalloc(sizeof(*new_ps), GFP_KERNEL);
if (new_ps == NULL) if (new_ps == NULL) {
DFS_POOL_STAT_INC(pseq_alloc_error);
return false; return false;
}
DFS_POOL_STAT_INC(pseq_allocated);
DFS_POOL_STAT_INC(pseq_used);
} }
memcpy(new_ps, &ps, sizeof(ps)); memcpy(new_ps, &ps, sizeof(ps));
INIT_LIST_HEAD(&new_ps->head); INIT_LIST_HEAD(&new_ps->head);
@@ -250,7 +327,7 @@ pseq_handler_add_to_existing_seqs(struct pri_detector *pde, u64 ts)
/* first ensure that sequence is within window */ /* first ensure that sequence is within window */
if (ts > ps->deadline_ts) { if (ts > ps->deadline_ts) {
list_del_init(&ps->head); list_del_init(&ps->head);
list_add(&ps->head, &pseq_pool); pool_put_pseq_elem(ps);
continue; continue;
} }
@@ -299,11 +376,11 @@ static void pri_detector_reset(struct pri_detector *pde, u64 ts)
struct pulse_elem *p, *p0; struct pulse_elem *p, *p0;
list_for_each_entry_safe(ps, ps0, &pde->sequences, head) { list_for_each_entry_safe(ps, ps0, &pde->sequences, head) {
list_del_init(&ps->head); list_del_init(&ps->head);
list_add(&ps->head, &pseq_pool); pool_put_pseq_elem(ps);
} }
list_for_each_entry_safe(p, p0, &pde->pulses, head) { list_for_each_entry_safe(p, p0, &pde->pulses, head) {
list_del_init(&p->head); list_del_init(&p->head);
list_add(&p->head, &pulse_pool); pool_put_pulse_elem(p);
} }
pde->count = 0; pde->count = 0;
pde->last_ts = ts; pde->last_ts = ts;
@@ -312,22 +389,7 @@ static void pri_detector_reset(struct pri_detector *pde, u64 ts)
static void pri_detector_exit(struct pri_detector *de) static void pri_detector_exit(struct pri_detector *de)
{ {
pri_detector_reset(de, 0); pri_detector_reset(de, 0);
pool_deregister_ref();
singleton_pool_references--;
if (singleton_pool_references == 0) {
/* free singleton pools with no references left */
struct pri_sequence *ps, *ps0;
struct pulse_elem *p, *p0;
list_for_each_entry_safe(p, p0, &pulse_pool, head) {
list_del(&p->head);
kfree(p);
}
list_for_each_entry_safe(ps, ps0, &pseq_pool, head) {
list_del(&ps->head);
kfree(ps);
}
}
kfree(de); kfree(de);
} }
@@ -385,6 +447,6 @@ pri_detector_init(const struct radar_detector_specs *rs)
de->max_count = rs->ppb * 2; de->max_count = rs->ppb * 2;
de->rs = rs; de->rs = rs;
singleton_pool_references++; pool_register_ref();
return de; return de;
} }

View File

@@ -365,7 +365,7 @@ void ath9k_stop_btcoex(struct ath_softc *sc)
ath9k_hw_btcoex_disable(ah); ath9k_hw_btcoex_disable(ah);
if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE) if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE)
ath9k_btcoex_timer_pause(sc); ath9k_btcoex_timer_pause(sc);
if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_MCI) if (AR_SREV_9462(ah))
ath_mci_flush_profile(&sc->btcoex.mci); ath_mci_flush_profile(&sc->btcoex.mci);
} }
} }
@@ -376,7 +376,7 @@ void ath9k_deinit_btcoex(struct ath_softc *sc)
ath9k_hw_get_btcoex_scheme(sc->sc_ah) == ATH_BTCOEX_CFG_3WIRE) ath9k_hw_get_btcoex_scheme(sc->sc_ah) == ATH_BTCOEX_CFG_3WIRE)
ath_gen_timer_free(sc->sc_ah, sc->btcoex.no_stomp_timer); ath_gen_timer_free(sc->sc_ah, sc->btcoex.no_stomp_timer);
if (ath9k_hw_get_btcoex_scheme(sc->sc_ah) == ATH_BTCOEX_CFG_MCI) if (AR_SREV_9462(sc->sc_ah))
ath_mci_cleanup(sc); ath_mci_cleanup(sc);
} }
@@ -402,17 +402,16 @@ int ath9k_init_btcoex(struct ath_softc *sc)
txq = sc->tx.txq_map[WME_AC_BE]; txq = sc->tx.txq_map[WME_AC_BE];
ath9k_hw_init_btcoex_hw(sc->sc_ah, txq->axq_qnum); ath9k_hw_init_btcoex_hw(sc->sc_ah, txq->axq_qnum);
sc->btcoex.bt_stomp_type = ATH_BTCOEX_STOMP_LOW; sc->btcoex.bt_stomp_type = ATH_BTCOEX_STOMP_LOW;
break; if (AR_SREV_9462(ah)) {
case ATH_BTCOEX_CFG_MCI: sc->btcoex.duty_cycle = ATH_BTCOEX_DEF_DUTY_CYCLE;
sc->btcoex.bt_stomp_type = ATH_BTCOEX_STOMP_LOW; INIT_LIST_HEAD(&sc->btcoex.mci.info);
sc->btcoex.duty_cycle = ATH_BTCOEX_DEF_DUTY_CYCLE;
INIT_LIST_HEAD(&sc->btcoex.mci.info);
r = ath_mci_setup(sc); r = ath_mci_setup(sc);
if (r) if (r)
return r; return r;
ath9k_hw_btcoex_init_mci(ah); ath9k_hw_btcoex_init_mci(ah);
}
break; break;
default: default:

View File

@@ -191,6 +191,22 @@ bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout)
} }
EXPORT_SYMBOL(ath9k_hw_wait); EXPORT_SYMBOL(ath9k_hw_wait);
void ath9k_hw_synth_delay(struct ath_hw *ah, struct ath9k_channel *chan,
int hw_delay)
{
if (IS_CHAN_B(chan))
hw_delay = (4 * hw_delay) / 22;
else
hw_delay /= 10;
if (IS_CHAN_HALF_RATE(chan))
hw_delay *= 2;
else if (IS_CHAN_QUARTER_RATE(chan))
hw_delay *= 4;
udelay(hw_delay + BASE_ACTIVATE_DELAY);
}
void ath9k_hw_write_array(struct ath_hw *ah, struct ar5416IniArray *array, void ath9k_hw_write_array(struct ath_hw *ah, struct ar5416IniArray *array,
int column, unsigned int *writecnt) int column, unsigned int *writecnt)
{ {
@@ -1020,7 +1036,7 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah)
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ieee80211_conf *conf = &common->hw->conf; struct ieee80211_conf *conf = &common->hw->conf;
const struct ath9k_channel *chan = ah->curchan; const struct ath9k_channel *chan = ah->curchan;
int acktimeout, ctstimeout; int acktimeout, ctstimeout, ack_offset = 0;
int slottime; int slottime;
int sifstime; int sifstime;
int rx_lat = 0, tx_lat = 0, eifs = 0; int rx_lat = 0, tx_lat = 0, eifs = 0;
@@ -1041,6 +1057,11 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah)
rx_lat = 37; rx_lat = 37;
tx_lat = 54; tx_lat = 54;
if (IS_CHAN_5GHZ(chan))
sifstime = 16;
else
sifstime = 10;
if (IS_CHAN_HALF_RATE(chan)) { if (IS_CHAN_HALF_RATE(chan)) {
eifs = 175; eifs = 175;
rx_lat *= 2; rx_lat *= 2;
@@ -1048,8 +1069,9 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah)
if (IS_CHAN_A_FAST_CLOCK(ah, chan)) if (IS_CHAN_A_FAST_CLOCK(ah, chan))
tx_lat += 11; tx_lat += 11;
sifstime *= 2;
ack_offset = 16;
slottime = 13; slottime = 13;
sifstime = 32;
} else if (IS_CHAN_QUARTER_RATE(chan)) { } else if (IS_CHAN_QUARTER_RATE(chan)) {
eifs = 340; eifs = 340;
rx_lat = (rx_lat * 4) - 1; rx_lat = (rx_lat * 4) - 1;
@@ -1057,8 +1079,9 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah)
if (IS_CHAN_A_FAST_CLOCK(ah, chan)) if (IS_CHAN_A_FAST_CLOCK(ah, chan))
tx_lat += 22; tx_lat += 22;
sifstime *= 4;
ack_offset = 32;
slottime = 21; slottime = 21;
sifstime = 64;
} else { } else {
if (AR_SREV_9287(ah) && AR_SREV_9287_13_OR_LATER(ah)) { if (AR_SREV_9287(ah) && AR_SREV_9287_13_OR_LATER(ah)) {
eifs = AR_D_GBL_IFS_EIFS_ASYNC_FIFO; eifs = AR_D_GBL_IFS_EIFS_ASYNC_FIFO;
@@ -1072,14 +1095,10 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah)
tx_lat = MS(reg, AR_USEC_TX_LAT); tx_lat = MS(reg, AR_USEC_TX_LAT);
slottime = ah->slottime; slottime = ah->slottime;
if (IS_CHAN_5GHZ(chan))
sifstime = 16;
else
sifstime = 10;
} }
/* As defined by IEEE 802.11-2007 17.3.8.6 */ /* As defined by IEEE 802.11-2007 17.3.8.6 */
acktimeout = slottime + sifstime + 3 * ah->coverage_class; acktimeout = slottime + sifstime + 3 * ah->coverage_class + ack_offset;
ctstimeout = acktimeout; ctstimeout = acktimeout;
/* /*
@@ -1089,7 +1108,8 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah)
* BA frames in some implementations, but it has been found to fix ACK * BA frames in some implementations, but it has been found to fix ACK
* timeout issues in other cases as well. * timeout issues in other cases as well.
*/ */
if (conf->channel && conf->channel->band == IEEE80211_BAND_2GHZ) { if (conf->channel && conf->channel->band == IEEE80211_BAND_2GHZ &&
!IS_CHAN_HALF_RATE(chan) && !IS_CHAN_QUARTER_RATE(chan)) {
acktimeout += 64 - sifstime - ah->slottime; acktimeout += 64 - sifstime - ah->slottime;
ctstimeout += 48 - sifstime - ah->slottime; ctstimeout += 48 - sifstime - ah->slottime;
} }
@@ -1667,6 +1687,10 @@ static int ath9k_hw_do_fastcc(struct ath_hw *ah, struct ath9k_channel *chan)
if (chan->channel == ah->curchan->channel) if (chan->channel == ah->curchan->channel)
goto fail; goto fail;
if ((ah->curchan->channelFlags | chan->channelFlags) &
(CHANNEL_HALF | CHANNEL_QUARTER))
goto fail;
if ((chan->channelFlags & CHANNEL_ALL) != if ((chan->channelFlags & CHANNEL_ALL) !=
(ah->curchan->channelFlags & CHANNEL_ALL)) (ah->curchan->channelFlags & CHANNEL_ALL))
goto fail; goto fail;

View File

@@ -923,6 +923,8 @@ void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val);
void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna); void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna);
/* General Operation */ /* General Operation */
void ath9k_hw_synth_delay(struct ath_hw *ah, struct ath9k_channel *chan,
int hw_delay);
bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout); bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout);
void ath9k_hw_write_array(struct ath_hw *ah, struct ar5416IniArray *array, void ath9k_hw_write_array(struct ath_hw *ah, struct ar5416IniArray *array,
int column, unsigned int *writecnt); int column, unsigned int *writecnt);
@@ -959,7 +961,8 @@ bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
#ifdef CONFIG_ATH9K_DEBUGFS #ifdef CONFIG_ATH9K_DEBUGFS
void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause); void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause);
#else #else
static void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause) {} static inline void ath9k_debug_sync_cause(struct ath_common *common,
u32 sync_cause) {}
#endif #endif
/* Generic hw timer primitives */ /* Generic hw timer primitives */

View File

@@ -646,6 +646,24 @@ void ath9k_reload_chainmask_settings(struct ath_softc *sc)
setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap); setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap);
} }
static const struct ieee80211_iface_limit if_limits[] = {
{ .max = 2048, .types = BIT(NL80211_IFTYPE_STATION) |
BIT(NL80211_IFTYPE_P2P_CLIENT) |
BIT(NL80211_IFTYPE_WDS) },
{ .max = 8, .types =
#ifdef CONFIG_MAC80211_MESH
BIT(NL80211_IFTYPE_MESH_POINT) |
#endif
BIT(NL80211_IFTYPE_AP) |
BIT(NL80211_IFTYPE_P2P_GO) },
};
static const struct ieee80211_iface_combination if_comb = {
.limits = if_limits,
.n_limits = ARRAY_SIZE(if_limits),
.max_interfaces = 2048,
.num_different_channels = 1,
};
void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
{ {
@@ -675,6 +693,9 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_ADHOC) |
BIT(NL80211_IFTYPE_MESH_POINT); BIT(NL80211_IFTYPE_MESH_POINT);
hw->wiphy->iface_combinations = &if_comb;
hw->wiphy->n_iface_combinations = 1;
if (AR_SREV_5416(sc->sc_ah)) if (AR_SREV_5416(sc->sc_ah))
hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;

View File

@@ -133,8 +133,16 @@ EXPORT_SYMBOL(ath9k_hw_updatetxtriglevel);
void ath9k_hw_abort_tx_dma(struct ath_hw *ah) void ath9k_hw_abort_tx_dma(struct ath_hw *ah)
{ {
int maxdelay = 1000;
int i, q; int i, q;
if (ah->curchan) {
if (IS_CHAN_HALF_RATE(ah->curchan))
maxdelay *= 2;
else if (IS_CHAN_QUARTER_RATE(ah->curchan))
maxdelay *= 4;
}
REG_WRITE(ah, AR_Q_TXD, AR_Q_TXD_M); REG_WRITE(ah, AR_Q_TXD, AR_Q_TXD_M);
REG_SET_BIT(ah, AR_PCU_MISC, AR_PCU_FORCE_QUIET_COLL | AR_PCU_CLEAR_VMF); REG_SET_BIT(ah, AR_PCU_MISC, AR_PCU_FORCE_QUIET_COLL | AR_PCU_CLEAR_VMF);
@@ -142,7 +150,7 @@ void ath9k_hw_abort_tx_dma(struct ath_hw *ah)
REG_SET_BIT(ah, AR_D_GBL_IFS_MISC, AR_D_GBL_IFS_MISC_IGNORE_BACKOFF); REG_SET_BIT(ah, AR_D_GBL_IFS_MISC, AR_D_GBL_IFS_MISC_IGNORE_BACKOFF);
for (q = 0; q < AR_NUM_QCU; q++) { for (q = 0; q < AR_NUM_QCU; q++) {
for (i = 0; i < 1000; i++) { for (i = 0; i < maxdelay; i++) {
if (i) if (i)
udelay(5); udelay(5);

View File

@@ -113,21 +113,25 @@ void ath9k_ps_restore(struct ath_softc *sc)
struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_common *common = ath9k_hw_common(sc->sc_ah);
enum ath9k_power_mode mode; enum ath9k_power_mode mode;
unsigned long flags; unsigned long flags;
bool reset;
spin_lock_irqsave(&sc->sc_pm_lock, flags); spin_lock_irqsave(&sc->sc_pm_lock, flags);
if (--sc->ps_usecount != 0) if (--sc->ps_usecount != 0)
goto unlock; goto unlock;
if (sc->ps_idle && (sc->ps_flags & PS_WAIT_FOR_TX_ACK)) if (sc->ps_idle) {
ath9k_hw_setrxabort(sc->sc_ah, 1);
ath9k_hw_stopdmarecv(sc->sc_ah, &reset);
mode = ATH9K_PM_FULL_SLEEP; mode = ATH9K_PM_FULL_SLEEP;
else if (sc->ps_enabled && } else if (sc->ps_enabled &&
!(sc->ps_flags & (PS_WAIT_FOR_BEACON | !(sc->ps_flags & (PS_WAIT_FOR_BEACON |
PS_WAIT_FOR_CAB | PS_WAIT_FOR_CAB |
PS_WAIT_FOR_PSPOLL_DATA | PS_WAIT_FOR_PSPOLL_DATA |
PS_WAIT_FOR_TX_ACK))) PS_WAIT_FOR_TX_ACK))) {
mode = ATH9K_PM_NETWORK_SLEEP; mode = ATH9K_PM_NETWORK_SLEEP;
else } else {
goto unlock; goto unlock;
}
spin_lock(&common->cc_lock); spin_lock(&common->cc_lock);
ath_hw_cycle_counters_update(common); ath_hw_cycle_counters_update(common);
@@ -1100,14 +1104,7 @@ static void ath9k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
} }
} }
/* if (unlikely(sc->sc_ah->power_mode == ATH9K_PM_NETWORK_SLEEP)) {
* Cannot tx while the hardware is in full sleep, it first needs a full
* chip reset to recover from that
*/
if (unlikely(sc->sc_ah->power_mode == ATH9K_PM_FULL_SLEEP))
goto exit;
if (unlikely(sc->sc_ah->power_mode != ATH9K_PM_AWAKE)) {
/* /*
* We are using PS-Poll and mac80211 can request TX while in * We are using PS-Poll and mac80211 can request TX while in
* power save mode. Need to wake up hardware for the TX to be * power save mode. Need to wake up hardware for the TX to be
@@ -1126,12 +1123,21 @@ static void ath9k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
} }
/* /*
* The actual restore operation will happen only after * The actual restore operation will happen only after
* the sc_flags bit is cleared. We are just dropping * the ps_flags bit is cleared. We are just dropping
* the ps_usecount here. * the ps_usecount here.
*/ */
ath9k_ps_restore(sc); ath9k_ps_restore(sc);
} }
/*
* Cannot tx while the hardware is in full sleep, it first needs a full
* chip reset to recover from that
*/
if (unlikely(sc->sc_ah->power_mode == ATH9K_PM_FULL_SLEEP)) {
ath_err(common, "TX while HW is in FULL_SLEEP mode\n");
goto exit;
}
memset(&txctl, 0, sizeof(struct ath_tx_control)); memset(&txctl, 0, sizeof(struct ath_tx_control));
txctl.txq = sc->tx.txq_map[skb_get_queue_mapping(skb)]; txctl.txq = sc->tx.txq_map[skb_get_queue_mapping(skb)];
@@ -1245,7 +1251,6 @@ static void ath9k_reclaim_beacon(struct ath_softc *sc,
ath9k_set_beaconing_status(sc, false); ath9k_set_beaconing_status(sc, false);
ath_beacon_return(sc, avp); ath_beacon_return(sc, avp);
ath9k_set_beaconing_status(sc, true); ath9k_set_beaconing_status(sc, true);
sc->sc_flags &= ~SC_OP_BEACONS;
} }
static void ath9k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) static void ath9k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
@@ -1376,17 +1381,9 @@ static void ath9k_do_vif_add_setup(struct ieee80211_hw *hw,
ath9k_calculate_summary_state(hw, vif); ath9k_calculate_summary_state(hw, vif);
if (ath9k_uses_beacons(vif->type)) { if (ath9k_uses_beacons(vif->type)) {
int error; /* Reserve a beacon slot for the vif */
/* This may fail because upper levels do not have beacons
* properly configured yet. That's OK, we assume it
* will be properly configured and then we will be notified
* in the info_changed method and set up beacons properly
* there.
*/
ath9k_set_beaconing_status(sc, false); ath9k_set_beaconing_status(sc, false);
error = ath_beacon_alloc(sc, vif); ath_beacon_alloc(sc, vif);
if (!error)
ath_beacon_config(sc, vif);
ath9k_set_beaconing_status(sc, true); ath9k_set_beaconing_status(sc, true);
} }
} }
@@ -1537,6 +1534,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
static void ath9k_enable_ps(struct ath_softc *sc) static void ath9k_enable_ps(struct ath_softc *sc)
{ {
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah);
sc->ps_enabled = true; sc->ps_enabled = true;
if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) { if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) {
@@ -1546,11 +1544,13 @@ static void ath9k_enable_ps(struct ath_softc *sc)
} }
ath9k_hw_setrxabort(ah, 1); ath9k_hw_setrxabort(ah, 1);
} }
ath_dbg(common, PS, "PowerSave enabled\n");
} }
static void ath9k_disable_ps(struct ath_softc *sc) static void ath9k_disable_ps(struct ath_softc *sc)
{ {
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah);
sc->ps_enabled = false; sc->ps_enabled = false;
ath9k_hw_setpower(ah, ATH9K_PM_AWAKE); ath9k_hw_setpower(ah, ATH9K_PM_AWAKE);
@@ -1565,7 +1565,7 @@ static void ath9k_disable_ps(struct ath_softc *sc)
ath9k_hw_set_interrupts(ah); ath9k_hw_set_interrupts(ah);
} }
} }
ath_dbg(common, PS, "PowerSave disabled\n");
} }
static int ath9k_config(struct ieee80211_hw *hw, u32 changed) static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
@@ -1993,7 +1993,6 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath_vif *avp = (void *)vif->drv_priv; struct ath_vif *avp = (void *)vif->drv_priv;
int slottime; int slottime;
int error;
ath9k_ps_wakeup(sc); ath9k_ps_wakeup(sc);
mutex_lock(&sc->mutex); mutex_lock(&sc->mutex);
@@ -2026,13 +2025,25 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
} }
} }
/* Enable transmission of beacons (AP, IBSS, MESH) */ /*
if ((changed & BSS_CHANGED_BEACON) || * In case of AP mode, the HW TSF has to be reset
((changed & BSS_CHANGED_BEACON_ENABLED) && bss_conf->enable_beacon)) { * when the beacon interval changes.
*/
if ((changed & BSS_CHANGED_BEACON_INT) &&
(vif->type == NL80211_IFTYPE_AP))
sc->sc_flags |= SC_OP_TSF_RESET;
/* Configure beaconing (AP, IBSS, MESH) */
if (ath9k_uses_beacons(vif->type) &&
((changed & BSS_CHANGED_BEACON) ||
(changed & BSS_CHANGED_BEACON_ENABLED) ||
(changed & BSS_CHANGED_BEACON_INT))) {
ath9k_set_beaconing_status(sc, false); ath9k_set_beaconing_status(sc, false);
error = ath_beacon_alloc(sc, vif); if (bss_conf->enable_beacon)
if (!error) ath_beacon_alloc(sc, vif);
ath_beacon_config(sc, vif); else
avp->is_bslot_active = false;
ath_beacon_config(sc, vif);
ath9k_set_beaconing_status(sc, true); ath9k_set_beaconing_status(sc, true);
} }
@@ -2055,30 +2066,6 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
} }
} }
/* Disable transmission of beacons */
if ((changed & BSS_CHANGED_BEACON_ENABLED) &&
!bss_conf->enable_beacon) {
ath9k_set_beaconing_status(sc, false);
avp->is_bslot_active = false;
ath9k_set_beaconing_status(sc, true);
}
if (changed & BSS_CHANGED_BEACON_INT) {
/*
* In case of AP mode, the HW TSF has to be reset
* when the beacon interval changes.
*/
if (vif->type == NL80211_IFTYPE_AP) {
sc->sc_flags |= SC_OP_TSF_RESET;
ath9k_set_beaconing_status(sc, false);
error = ath_beacon_alloc(sc, vif);
if (!error)
ath_beacon_config(sc, vif);
ath9k_set_beaconing_status(sc, true);
} else
ath_beacon_config(sc, vif);
}
mutex_unlock(&sc->mutex); mutex_unlock(&sc->mutex);
ath9k_ps_restore(sc); ath9k_ps_restore(sc);
} }

View File

@@ -812,6 +812,7 @@ static bool ath9k_rx_accept(struct ath_common *common,
is_valid_tkip = rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID && is_valid_tkip = rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID &&
test_bit(rx_stats->rs_keyix, common->tkip_keymap); test_bit(rx_stats->rs_keyix, common->tkip_keymap);
strip_mic = is_valid_tkip && ieee80211_is_data(fc) && strip_mic = is_valid_tkip && ieee80211_is_data(fc) &&
ieee80211_has_protected(fc) &&
!(rx_stats->rs_status & !(rx_stats->rs_status &
(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_CRC | ATH9K_RXERR_MIC | (ATH9K_RXERR_DECRYPT | ATH9K_RXERR_CRC | ATH9K_RXERR_MIC |
ATH9K_RXERR_KEYMISS)); ATH9K_RXERR_KEYMISS));
@@ -907,7 +908,7 @@ static int ath9k_process_rate(struct ath_common *common,
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
enum ieee80211_band band; enum ieee80211_band band;
unsigned int i = 0; unsigned int i = 0;
struct ath_softc *sc = (struct ath_softc *) common->priv; struct ath_softc __maybe_unused *sc = common->priv;
band = hw->conf.channel->band; band = hw->conf.channel->band;
sband = hw->wiphy->bands[band]; sband = hw->wiphy->bands[band];

View File

@@ -5,7 +5,7 @@ iwlwifi-objs += iwl-ucode.o iwl-agn-tx.o iwl-debug.o
iwlwifi-objs += iwl-agn-lib.o iwl-agn-calib.o iwl-io.o iwlwifi-objs += iwl-agn-lib.o iwl-agn-calib.o iwl-io.o
iwlwifi-objs += iwl-agn-tt.o iwl-agn-sta.o iwl-agn-rx.o iwlwifi-objs += iwl-agn-tt.o iwl-agn-sta.o iwl-agn-rx.o
iwlwifi-objs += iwl-core.o iwl-eeprom.o iwl-power.o iwlwifi-objs += iwl-eeprom.o iwl-power.o
iwlwifi-objs += iwl-scan.o iwl-led.o iwlwifi-objs += iwl-scan.o iwl-led.o
iwlwifi-objs += iwl-agn-rxon.o iwl-agn-devices.o iwlwifi-objs += iwl-agn-rxon.o iwl-agn-devices.o
iwlwifi-objs += iwl-5000.o iwlwifi-objs += iwl-5000.o

View File

@@ -28,7 +28,8 @@
#include <linux/stringify.h> #include <linux/stringify.h>
#include "iwl-config.h" #include "iwl-config.h"
#include "iwl-cfg.h" #include "iwl-cfg.h"
#include "iwl-dev.h" /* still needed */ #include "iwl-csr.h"
#include "iwl-agn-hw.h"
/* Highest firmware API version supported */ /* Highest firmware API version supported */
#define IWL1000_UCODE_API_MAX 6 #define IWL1000_UCODE_API_MAX 6
@@ -42,6 +43,10 @@
#define IWL1000_UCODE_API_MIN 1 #define IWL1000_UCODE_API_MIN 1
#define IWL100_UCODE_API_MIN 5 #define IWL100_UCODE_API_MIN 5
/* EEPROM version */
#define EEPROM_1000_TX_POWER_VERSION (4)
#define EEPROM_1000_EEPROM_VERSION (0x15C)
#define IWL1000_FW_PRE "iwlwifi-1000-" #define IWL1000_FW_PRE "iwlwifi-1000-"
#define IWL1000_MODULE_FIRMWARE(api) IWL1000_FW_PRE __stringify(api) ".ucode" #define IWL1000_MODULE_FIRMWARE(api) IWL1000_FW_PRE __stringify(api) ".ucode"
@@ -66,7 +71,6 @@ static const struct iwl_base_params iwl1000_base_params = {
static const struct iwl_ht_params iwl1000_ht_params = { static const struct iwl_ht_params iwl1000_ht_params = {
.ht_greenfield_support = true, .ht_greenfield_support = true,
.use_rts_for_aggregation = true, /* use rts/cts protection */ .use_rts_for_aggregation = true, /* use rts/cts protection */
.smps_mode = IEEE80211_SMPS_DYNAMIC,
}; };
#define IWL_DEVICE_1000 \ #define IWL_DEVICE_1000 \

View File

@@ -28,7 +28,8 @@
#include <linux/stringify.h> #include <linux/stringify.h>
#include "iwl-config.h" #include "iwl-config.h"
#include "iwl-cfg.h" #include "iwl-cfg.h"
#include "iwl-dev.h" /* still needed */ #include "iwl-agn-hw.h"
#include "iwl-commands.h" /* needed for BT for now */
/* Highest firmware API version supported */ /* Highest firmware API version supported */
#define IWL2030_UCODE_API_MAX 6 #define IWL2030_UCODE_API_MAX 6
@@ -48,6 +49,11 @@
#define IWL105_UCODE_API_MIN 5 #define IWL105_UCODE_API_MIN 5
#define IWL135_UCODE_API_MIN 5 #define IWL135_UCODE_API_MIN 5
/* EEPROM version */
#define EEPROM_2000_TX_POWER_VERSION (6)
#define EEPROM_2000_EEPROM_VERSION (0x805)
#define IWL2030_FW_PRE "iwlwifi-2030-" #define IWL2030_FW_PRE "iwlwifi-2030-"
#define IWL2030_MODULE_FIRMWARE(api) IWL2030_FW_PRE __stringify(api) ".ucode" #define IWL2030_MODULE_FIRMWARE(api) IWL2030_FW_PRE __stringify(api) ".ucode"

View File

@@ -28,7 +28,8 @@
#include <linux/stringify.h> #include <linux/stringify.h>
#include "iwl-config.h" #include "iwl-config.h"
#include "iwl-cfg.h" #include "iwl-cfg.h"
#include "iwl-dev.h" /* still needed */ #include "iwl-agn-hw.h"
#include "iwl-csr.h"
/* Highest firmware API version supported */ /* Highest firmware API version supported */
#define IWL5000_UCODE_API_MAX 5 #define IWL5000_UCODE_API_MAX 5
@@ -38,6 +39,12 @@
#define IWL5000_UCODE_API_MIN 1 #define IWL5000_UCODE_API_MIN 1
#define IWL5150_UCODE_API_MIN 1 #define IWL5150_UCODE_API_MIN 1
/* EEPROM versions */
#define EEPROM_5000_TX_POWER_VERSION (4)
#define EEPROM_5000_EEPROM_VERSION (0x11A)
#define EEPROM_5050_TX_POWER_VERSION (4)
#define EEPROM_5050_EEPROM_VERSION (0x21E)
#define IWL5000_FW_PRE "iwlwifi-5000-" #define IWL5000_FW_PRE "iwlwifi-5000-"
#define IWL5000_MODULE_FIRMWARE(api) IWL5000_FW_PRE __stringify(api) ".ucode" #define IWL5000_MODULE_FIRMWARE(api) IWL5000_FW_PRE __stringify(api) ".ucode"

View File

@@ -28,7 +28,8 @@
#include <linux/stringify.h> #include <linux/stringify.h>
#include "iwl-config.h" #include "iwl-config.h"
#include "iwl-cfg.h" #include "iwl-cfg.h"
#include "iwl-dev.h" /* still needed */ #include "iwl-agn-hw.h"
#include "iwl-commands.h" /* needed for BT for now */
/* Highest firmware API version supported */ /* Highest firmware API version supported */
#define IWL6000_UCODE_API_MAX 6 #define IWL6000_UCODE_API_MAX 6
@@ -44,6 +45,20 @@
#define IWL6050_UCODE_API_MIN 4 #define IWL6050_UCODE_API_MIN 4
#define IWL6000G2_UCODE_API_MIN 4 #define IWL6000G2_UCODE_API_MIN 4
/* EEPROM versions */
#define EEPROM_6000_TX_POWER_VERSION (4)
#define EEPROM_6000_EEPROM_VERSION (0x423)
#define EEPROM_6050_TX_POWER_VERSION (4)
#define EEPROM_6050_EEPROM_VERSION (0x532)
#define EEPROM_6150_TX_POWER_VERSION (6)
#define EEPROM_6150_EEPROM_VERSION (0x553)
#define EEPROM_6005_TX_POWER_VERSION (6)
#define EEPROM_6005_EEPROM_VERSION (0x709)
#define EEPROM_6030_TX_POWER_VERSION (6)
#define EEPROM_6030_EEPROM_VERSION (0x709)
#define EEPROM_6035_TX_POWER_VERSION (6)
#define EEPROM_6035_EEPROM_VERSION (0x753)
#define IWL6000_FW_PRE "iwlwifi-6000-" #define IWL6000_FW_PRE "iwlwifi-6000-"
#define IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE __stringify(api) ".ucode" #define IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE __stringify(api) ".ucode"

View File

@@ -64,7 +64,6 @@
#include <net/mac80211.h> #include <net/mac80211.h>
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-core.h"
#include "iwl-agn-calib.h" #include "iwl-agn-calib.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-agn.h" #include "iwl-agn.h"
@@ -521,7 +520,7 @@ static int iwl_enhance_sensitivity_write(struct iwl_priv *priv)
iwl_prepare_legacy_sensitivity_tbl(priv, data, &cmd.enhance_table[0]); iwl_prepare_legacy_sensitivity_tbl(priv, data, &cmd.enhance_table[0]);
if (cfg(priv)->base_params->hd_v2) { if (priv->cfg->base_params->hd_v2) {
cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX] = cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX] =
HD_INA_NON_SQUARE_DET_OFDM_DATA_V2; HD_INA_NON_SQUARE_DET_OFDM_DATA_V2;
cmd.enhance_table[HD_INA_NON_SQUARE_DET_CCK_INDEX] = cmd.enhance_table[HD_INA_NON_SQUARE_DET_CCK_INDEX] =
@@ -895,7 +894,7 @@ static void iwlagn_gain_computation(struct iwl_priv *priv,
continue; continue;
} }
delta_g = (cfg(priv)->base_params->chain_noise_scale * delta_g = (priv->cfg->base_params->chain_noise_scale *
((s32)average_noise[default_chain] - ((s32)average_noise[default_chain] -
(s32)average_noise[i])) / 1500; (s32)average_noise[i])) / 1500;
@@ -1051,8 +1050,8 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
return; return;
/* Analyze signal for disconnected antenna */ /* Analyze signal for disconnected antenna */
if (cfg(priv)->bt_params && if (priv->cfg->bt_params &&
cfg(priv)->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 = priv->hw_params.valid_rx_ant;

View File

@@ -63,7 +63,6 @@
#define __iwl_calib_h__ #define __iwl_calib_h__
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-core.h"
#include "iwl-commands.h" #include "iwl-commands.h"
void iwl_chain_noise_calibration(struct iwl_priv *priv); void iwl_chain_noise_calibration(struct iwl_priv *priv);

View File

@@ -27,7 +27,6 @@
/* /*
* DVM device-specific data & functions * DVM device-specific data & functions
*/ */
#include "iwl-core.h"
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-commands.h" #include "iwl-commands.h"
@@ -60,13 +59,13 @@ static void iwl1000_set_ct_threshold(struct iwl_priv *priv)
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(trans(priv), CSR_HW_IF_CONFIG_REG, iwl_set_bit(priv->trans, 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(trans(priv), APMG_DIGITAL_SVR_REG, iwl_set_bits_mask_prph(priv->trans, 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);
} }
@@ -175,7 +174,7 @@ static void iwl1000_hw_set_hw_params(struct iwl_priv *priv)
priv->hw_params.tx_chains_num = priv->hw_params.tx_chains_num =
num_of_ant(priv->hw_params.valid_tx_ant); num_of_ant(priv->hw_params.valid_tx_ant);
if (cfg(priv)->rx_with_siso_diversity) if (priv->cfg->rx_with_siso_diversity)
priv->hw_params.rx_chains_num = 1; priv->hw_params.rx_chains_num = 1;
else else
priv->hw_params.rx_chains_num = priv->hw_params.rx_chains_num =
@@ -222,7 +221,7 @@ static void iwl2000_nic_config(struct iwl_priv *priv)
{ {
iwl_rf_config(priv); iwl_rf_config(priv);
iwl_set_bit(trans(priv), CSR_GP_DRIVER_REG, iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG,
CSR_GP_DRIVER_REG_BIT_RADIO_IQ_INVER); CSR_GP_DRIVER_REG_BIT_RADIO_IQ_INVER);
} }
@@ -256,7 +255,7 @@ static void iwl2000_hw_set_hw_params(struct iwl_priv *priv)
priv->hw_params.tx_chains_num = priv->hw_params.tx_chains_num =
num_of_ant(priv->hw_params.valid_tx_ant); num_of_ant(priv->hw_params.valid_tx_ant);
if (cfg(priv)->rx_with_siso_diversity) if (priv->cfg->rx_with_siso_diversity)
priv->hw_params.rx_chains_num = 1; priv->hw_params.rx_chains_num = 1;
else else
priv->hw_params.rx_chains_num = priv->hw_params.rx_chains_num =
@@ -318,7 +317,7 @@ static void iwl5000_nic_config(struct iwl_priv *priv)
* (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(trans(priv), APMG_PS_CTRL_REG, iwl_set_bits_mask_prph(priv->trans, 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);
} }
@@ -573,28 +572,28 @@ static void iwl6000_nic_config(struct iwl_priv *priv)
{ {
iwl_rf_config(priv); iwl_rf_config(priv);
switch (cfg(priv)->device_family) { switch (priv->cfg->device_family) {
case IWL_DEVICE_FAMILY_6005: case IWL_DEVICE_FAMILY_6005:
case IWL_DEVICE_FAMILY_6030: case IWL_DEVICE_FAMILY_6030:
case IWL_DEVICE_FAMILY_6000: case IWL_DEVICE_FAMILY_6000:
break; break;
case IWL_DEVICE_FAMILY_6000i: case IWL_DEVICE_FAMILY_6000i:
/* 2x2 IPA phy type */ /* 2x2 IPA phy type */
iwl_write32(trans(priv), CSR_GP_DRIVER_REG, iwl_write32(priv->trans, CSR_GP_DRIVER_REG,
CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA); CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA);
break; break;
case IWL_DEVICE_FAMILY_6050: case IWL_DEVICE_FAMILY_6050:
/* Indicate calibration version to uCode. */ /* Indicate calibration version to uCode. */
if (iwl_eeprom_calib_version(priv) >= 6) if (iwl_eeprom_calib_version(priv) >= 6)
iwl_set_bit(trans(priv), CSR_GP_DRIVER_REG, iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG,
CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
break; break;
case IWL_DEVICE_FAMILY_6150: case IWL_DEVICE_FAMILY_6150:
/* Indicate calibration version to uCode. */ /* Indicate calibration version to uCode. */
if (iwl_eeprom_calib_version(priv) >= 6) if (iwl_eeprom_calib_version(priv) >= 6)
iwl_set_bit(trans(priv), CSR_GP_DRIVER_REG, iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG,
CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
iwl_set_bit(trans(priv), CSR_GP_DRIVER_REG, iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG,
CSR_GP_DRIVER_REG_BIT_6050_1x2); CSR_GP_DRIVER_REG_BIT_6050_1x2);
break; break;
default: default:
@@ -633,7 +632,7 @@ static void iwl6000_hw_set_hw_params(struct iwl_priv *priv)
priv->hw_params.tx_chains_num = priv->hw_params.tx_chains_num =
num_of_ant(priv->hw_params.valid_tx_ant); num_of_ant(priv->hw_params.valid_tx_ant);
if (cfg(priv)->rx_with_siso_diversity) if (priv->cfg->rx_with_siso_diversity)
priv->hw_params.rx_chains_num = 1; priv->hw_params.rx_chains_num = 1;
else else
priv->hw_params.rx_chains_num = priv->hw_params.rx_chains_num =

View File

@@ -102,6 +102,17 @@
/* EEPROM */ /* EEPROM */
#define IWLAGN_EEPROM_IMG_SIZE 2048 #define IWLAGN_EEPROM_IMG_SIZE 2048
/* OTP */
/* lower blocks contain EEPROM image and calibration data */
#define OTP_LOW_IMAGE_SIZE (2 * 512 * sizeof(u16)) /* 2 KB */
/* high blocks contain PAPD data */
#define OTP_HIGH_IMAGE_SIZE_6x00 (6 * 512 * sizeof(u16)) /* 6 KB */
#define OTP_HIGH_IMAGE_SIZE_1000 (0x200 * sizeof(u16)) /* 1024 bytes */
#define OTP_MAX_LL_ITEMS_1000 (3) /* OTP blocks for 1000 */
#define OTP_MAX_LL_ITEMS_6x00 (4) /* OTP blocks for 6x00 */
#define OTP_MAX_LL_ITEMS_6x50 (7) /* OTP blocks for 6x50 */
#define OTP_MAX_LL_ITEMS_2x00 (4) /* OTP blocks for 2x00 */
#define IWLAGN_NUM_QUEUES 20 #define IWLAGN_NUM_QUEUES 20

View File

@@ -33,12 +33,11 @@
#include <linux/sched.h> #include <linux/sched.h>
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-core.h"
#include "iwl-io.h" #include "iwl-io.h"
#include "iwl-agn-hw.h" #include "iwl-agn-hw.h"
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-shared.h" #include "iwl-modparams.h"
int iwlagn_hw_valid_rtc_data_addr(u32 addr) int iwlagn_hw_valid_rtc_data_addr(u32 addr)
{ {
@@ -94,17 +93,6 @@ void iwlagn_temperature(struct iwl_priv *priv)
iwl_tt_handler(priv); iwl_tt_handler(priv);
} }
struct iwl_mod_params iwlagn_mod_params = {
.amsdu_size_8K = 1,
.restart_fw = 1,
.plcp_check = true,
.bt_coex_active = true,
.power_level = IWL_POWER_INDEX_1,
.bt_ch_announce = true,
.auto_agg = true,
/* the rest are 0 by default */
};
int iwlagn_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band) int iwlagn_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band)
{ {
int idx = 0; int idx = 0;
@@ -189,7 +177,7 @@ void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
goto done; goto done;
} }
IWL_DEBUG_INFO(priv, "wait transmit/flush all frames\n"); IWL_DEBUG_INFO(priv, "wait transmit/flush all frames\n");
iwl_trans_wait_tx_queue_empty(trans(priv)); iwl_trans_wait_tx_queue_empty(priv->trans);
done: done:
ieee80211_wake_queues(priv->hw); ieee80211_wake_queues(priv->hw);
mutex_unlock(&priv->mutex); mutex_unlock(&priv->mutex);
@@ -312,21 +300,21 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv)
BUILD_BUG_ON(sizeof(iwlagn_def_3w_lookup) != BUILD_BUG_ON(sizeof(iwlagn_def_3w_lookup) !=
sizeof(basic.bt3_lookup_table)); sizeof(basic.bt3_lookup_table));
if (cfg(priv)->bt_params) { if (priv->cfg->bt_params) {
/* /*
* newer generation of devices (2000 series and newer) * newer generation of devices (2000 series and newer)
* use the version 2 of the bt command * use the version 2 of the bt command
* we need to make sure sending the host command * we need to make sure sending the host command
* with correct data structure to avoid uCode assert * with correct data structure to avoid uCode assert
*/ */
if (cfg(priv)->bt_params->bt_session_2) { if (priv->cfg->bt_params->bt_session_2) {
bt_cmd_v2.prio_boost = cpu_to_le32( bt_cmd_v2.prio_boost = cpu_to_le32(
cfg(priv)->bt_params->bt_prio_boost); priv->cfg->bt_params->bt_prio_boost);
bt_cmd_v2.tx_prio_boost = 0; bt_cmd_v2.tx_prio_boost = 0;
bt_cmd_v2.rx_prio_boost = 0; bt_cmd_v2.rx_prio_boost = 0;
} else { } else {
bt_cmd_v1.prio_boost = bt_cmd_v1.prio_boost =
cfg(priv)->bt_params->bt_prio_boost; priv->cfg->bt_params->bt_prio_boost;
bt_cmd_v1.tx_prio_boost = 0; bt_cmd_v1.tx_prio_boost = 0;
bt_cmd_v1.rx_prio_boost = 0; bt_cmd_v1.rx_prio_boost = 0;
} }
@@ -345,7 +333,7 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv)
* (might be in monitor mode), or the interface is in * (might be in monitor mode), or the interface is in
* IBSS mode (no proper uCode support for coex then). * IBSS mode (no proper uCode support for coex then).
*/ */
if (!iwlagn_mod_params.bt_coex_active || if (!iwlwifi_mod_params.bt_coex_active ||
priv->iw_mode == NL80211_IFTYPE_ADHOC) { priv->iw_mode == NL80211_IFTYPE_ADHOC) {
basic.flags = IWLAGN_BT_FLAG_COEX_MODE_DISABLED; basic.flags = IWLAGN_BT_FLAG_COEX_MODE_DISABLED;
} else { } else {
@@ -374,7 +362,7 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv)
priv->bt_full_concurrent ? priv->bt_full_concurrent ?
"full concurrency" : "3-wire"); "full concurrency" : "3-wire");
if (cfg(priv)->bt_params->bt_session_2) { if (priv->cfg->bt_params->bt_session_2) {
memcpy(&bt_cmd_v2.basic, &basic, memcpy(&bt_cmd_v2.basic, &basic,
sizeof(basic)); sizeof(basic));
ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG,
@@ -740,8 +728,8 @@ static bool is_single_rx_stream(struct iwl_priv *priv)
*/ */
static int iwl_get_active_rx_chain_count(struct iwl_priv *priv) static int iwl_get_active_rx_chain_count(struct iwl_priv *priv)
{ {
if (cfg(priv)->bt_params && if (priv->cfg->bt_params &&
cfg(priv)->bt_params->advanced_bt_coexist && priv->cfg->bt_params->advanced_bt_coexist &&
(priv->bt_full_concurrent || (priv->bt_full_concurrent ||
priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) { priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) {
/* /*
@@ -812,8 +800,8 @@ void iwlagn_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
else else
active_chains = priv->hw_params.valid_rx_ant; active_chains = priv->hw_params.valid_rx_ant;
if (cfg(priv)->bt_params && if (priv->cfg->bt_params &&
cfg(priv)->bt_params->advanced_bt_coexist && priv->cfg->bt_params->advanced_bt_coexist &&
(priv->bt_full_concurrent || (priv->bt_full_concurrent ||
priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) { priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) {
/* /*
@@ -1132,7 +1120,7 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan)
memcpy(&rxon, &ctx->active, sizeof(rxon)); memcpy(&rxon, &ctx->active, sizeof(rxon));
priv->ucode_loaded = false; priv->ucode_loaded = false;
iwl_trans_stop_device(trans(priv)); iwl_trans_stop_device(priv->trans);
priv->wowlan = true; priv->wowlan = true;
@@ -1154,7 +1142,7 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan)
if (ret) if (ret)
goto out; goto out;
if (!iwlagn_mod_params.sw_crypto) { if (!iwlwifi_mod_params.sw_crypto) {
/* mark all keys clear */ /* mark all keys clear */
priv->ucode_key_table = 0; priv->ucode_key_table = 0;
ctx->key_mapping_keys = 0; ctx->key_mapping_keys = 0;
@@ -1260,7 +1248,7 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
return -EIO; return -EIO;
} }
return iwl_trans_send_cmd(trans(priv), cmd); return iwl_trans_send_cmd(priv->trans, cmd);
} }
int iwl_dvm_send_cmd_pdu(struct iwl_priv *priv, u8 id, int iwl_dvm_send_cmd_pdu(struct iwl_priv *priv, u8 id,

View File

@@ -36,9 +36,9 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-core.h"
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-op-mode.h" #include "iwl-op-mode.h"
#include "iwl-modparams.h"
#define RS_NAME "iwl-agn-rs" #define RS_NAME "iwl-agn-rs"
@@ -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 ((iwlagn_mod_params.auto_agg) || (load > IWL_AGG_LOAD_THRESHOLD)) { if ((iwlwifi_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);
@@ -1085,7 +1085,7 @@ done:
(priv->tm_fixed_rate != lq_sta->dbg_fixed_rate)) (priv->tm_fixed_rate != lq_sta->dbg_fixed_rate))
rs_program_fix_rate(priv, lq_sta); rs_program_fix_rate(priv, lq_sta);
#endif #endif
if (cfg(priv)->bt_params && cfg(priv)->bt_params->advanced_bt_coexist) if (priv->cfg->bt_params && priv->cfg->bt_params->advanced_bt_coexist)
rs_bt_update_lq(priv, ctx, lq_sta); rs_bt_update_lq(priv, ctx, lq_sta);
} }
@@ -3063,11 +3063,11 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
* overwrite if needed, pass aggregation time limit * overwrite if needed, pass aggregation time limit
* to uCode in uSec * to uCode in uSec
*/ */
if (priv && cfg(priv)->bt_params && if (priv && priv->cfg->bt_params &&
cfg(priv)->bt_params->agg_time_limit && priv->cfg->bt_params->agg_time_limit &&
priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH) priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)
lq_cmd->agg_params.agg_time_limit = lq_cmd->agg_params.agg_time_limit =
cpu_to_le16(cfg(priv)->bt_params->agg_time_limit); cpu_to_le16(priv->cfg->bt_params->agg_time_limit);
} }
static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)

View File

@@ -30,6 +30,7 @@
#include <net/mac80211.h> #include <net/mac80211.h>
#include "iwl-commands.h" #include "iwl-commands.h"
#include "iwl-config.h"
struct iwl_rate_info { struct iwl_rate_info {
u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */ u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */
@@ -174,32 +175,6 @@ enum {
IWL_RATE_11M_IEEE = 22, IWL_RATE_11M_IEEE = 22,
}; };
#define IWL_CCK_BASIC_RATES_MASK \
(IWL_RATE_1M_MASK | \
IWL_RATE_2M_MASK)
#define IWL_CCK_RATES_MASK \
(IWL_CCK_BASIC_RATES_MASK | \
IWL_RATE_5M_MASK | \
IWL_RATE_11M_MASK)
#define IWL_OFDM_BASIC_RATES_MASK \
(IWL_RATE_6M_MASK | \
IWL_RATE_12M_MASK | \
IWL_RATE_24M_MASK)
#define IWL_OFDM_RATES_MASK \
(IWL_OFDM_BASIC_RATES_MASK | \
IWL_RATE_9M_MASK | \
IWL_RATE_18M_MASK | \
IWL_RATE_36M_MASK | \
IWL_RATE_48M_MASK | \
IWL_RATE_54M_MASK)
#define IWL_BASIC_RATES_MASK \
(IWL_OFDM_BASIC_RATES_MASK | \
IWL_CCK_BASIC_RATES_MASK)
#define IWL_RATES_MASK ((1 << IWL_RATE_COUNT) - 1) #define IWL_RATES_MASK ((1 << IWL_RATE_COUNT) - 1)
#define IWL_INVALID_VALUE -1 #define IWL_INVALID_VALUE -1
@@ -306,15 +281,6 @@ enum iwl_table_type {
#define is_a_band(tbl) ((tbl) == LQ_A) #define is_a_band(tbl) ((tbl) == LQ_A)
#define is_g_and(tbl) ((tbl) == LQ_G) #define is_g_and(tbl) ((tbl) == LQ_G)
#define ANT_NONE 0x0
#define ANT_A BIT(0)
#define ANT_B BIT(1)
#define ANT_AB (ANT_A | ANT_B)
#define ANT_C BIT(2)
#define ANT_AC (ANT_A | ANT_C)
#define ANT_BC (ANT_B | ANT_C)
#define ANT_ABC (ANT_AB | ANT_C)
#define IWL_MAX_MCS_DISPLAY_SIZE 12 #define IWL_MAX_MCS_DISPLAY_SIZE 12
struct iwl_rate_mcs_info { struct iwl_rate_mcs_info {

View File

@@ -34,11 +34,10 @@
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include "iwl-eeprom.h" #include "iwl-eeprom.h"
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-core.h"
#include "iwl-io.h" #include "iwl-io.h"
#include "iwl-agn-calib.h" #include "iwl-agn-calib.h"
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-shared.h" #include "iwl-modparams.h"
#define IWL_CMD_ENTRY(x) [x] = #x #define IWL_CMD_ENTRY(x) [x] = #x
@@ -339,7 +338,7 @@ static void iwlagn_recover_from_statistics(struct iwl_priv *priv,
if (msecs < 99) if (msecs < 99)
return; return;
if (iwlagn_mod_params.plcp_check && if (iwlwifi_mod_params.plcp_check &&
!iwlagn_good_plcp_health(priv, cur_ofdm, cur_ofdm_ht, msecs)) !iwlagn_good_plcp_health(priv, cur_ofdm, cur_ofdm_ht, msecs))
iwl_force_rf_reset(priv, false); iwl_force_rf_reset(priv, false);
} }
@@ -604,16 +603,16 @@ static int iwlagn_rx_card_state_notif(struct iwl_priv *priv,
if (flags & (SW_CARD_DISABLED | HW_CARD_DISABLED | if (flags & (SW_CARD_DISABLED | HW_CARD_DISABLED |
CT_CARD_DISABLED)) { CT_CARD_DISABLED)) {
iwl_write32(trans(priv), CSR_UCODE_DRV_GP1_SET, iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_SET,
CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
iwl_write_direct32(trans(priv), HBUS_TARG_MBX_C, iwl_write_direct32(priv->trans, HBUS_TARG_MBX_C,
HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED);
if (!(flags & RXON_CARD_DISABLED)) { if (!(flags & RXON_CARD_DISABLED)) {
iwl_write32(trans(priv), CSR_UCODE_DRV_GP1_CLR, iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_CLR,
CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
iwl_write_direct32(trans(priv), HBUS_TARG_MBX_C, iwl_write_direct32(priv->trans, HBUS_TARG_MBX_C,
HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED);
} }
if (flags & CT_CARD_DISABLED) if (flags & CT_CARD_DISABLED)
@@ -636,7 +635,7 @@ static int iwlagn_rx_card_state_notif(struct iwl_priv *priv,
wiphy_rfkill_set_hw_state(priv->hw->wiphy, wiphy_rfkill_set_hw_state(priv->hw->wiphy,
test_bit(STATUS_RF_KILL_HW, &priv->status)); test_bit(STATUS_RF_KILL_HW, &priv->status));
else else
wake_up(&trans(priv)->wait_command_queue); wake_up(&priv->trans->wait_command_queue);
return 0; return 0;
} }
@@ -749,7 +748,7 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv,
} }
/* In case of HW accelerated crypto and bad decryption, drop */ /* In case of HW accelerated crypto and bad decryption, drop */
if (!iwlagn_mod_params.sw_crypto && if (!iwlwifi_mod_params.sw_crypto &&
iwlagn_set_decrypted_flag(priv, hdr, ampdu_status, stats)) iwlagn_set_decrypted_flag(priv, hdr, ampdu_status, stats))
return; return;
@@ -763,8 +762,6 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv,
p = rxb_steal_page(rxb); p = rxb_steal_page(rxb);
skb_add_rx_frag(skb, 0, p, offset, len, len); skb_add_rx_frag(skb, 0, p, offset, len, len);
iwl_update_stats(priv, false, fc, len);
/* /*
* Wake any queues that were stopped due to a passive channel tx * Wake any queues that were stopped due to a passive channel tx
* failure. This can happen because the regulatory enforcement in * failure. This can happen because the regulatory enforcement in
@@ -970,7 +967,6 @@ static int iwlagn_rx_reply_rx(struct iwl_priv *priv,
/* Find max signal strength (dBm) among 3 antenna/receiver chains */ /* Find max signal strength (dBm) among 3 antenna/receiver chains */
rx_status.signal = iwlagn_calc_rssi(priv, phy_res); rx_status.signal = iwlagn_calc_rssi(priv, phy_res);
iwl_dbg_log_rx_data_frame(priv, len, header);
IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, TSF %llu\n", IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, TSF %llu\n",
rx_status.signal, (unsigned long long)rx_status.mactime); rx_status.signal, (unsigned long long)rx_status.mactime);
@@ -1105,7 +1101,7 @@ void iwl_setup_rx_handlers(struct iwl_priv *priv)
iwl_notification_wait_init(&priv->notif_wait); iwl_notification_wait_init(&priv->notif_wait);
/* Set up BT Rx handlers */ /* Set up BT Rx handlers */
if (cfg(priv)->bt_params) if (priv->cfg->bt_params)
iwlagn_bt_rx_handler_setup(priv); iwlagn_bt_rx_handler_setup(priv);
} }

View File

@@ -27,10 +27,9 @@
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-core.h"
#include "iwl-agn-calib.h" #include "iwl-agn-calib.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-shared.h" #include "iwl-modparams.h"
/* /*
* initialize rxon structure with default values from eeprom * initialize rxon structure with default values from eeprom
@@ -88,11 +87,6 @@ void iwl_connection_init_rx_config(struct iwl_priv *priv,
iwl_set_flags_for_band(priv, ctx, priv->band, ctx->vif); iwl_set_flags_for_band(priv, ctx, priv->band, ctx->vif);
ctx->staging.ofdm_basic_rates =
(IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
ctx->staging.cck_basic_rates =
(IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
/* clear both MIX and PURE40 mode flag */ /* clear both MIX and PURE40 mode flag */
ctx->staging.flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED | ctx->staging.flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED |
RXON_FLG_CHANNEL_MODE_PURE_40); RXON_FLG_CHANNEL_MODE_PURE_40);
@@ -531,9 +525,9 @@ static int iwlagn_rxon_connect(struct iwl_priv *priv,
} }
if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION && if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION &&
cfg(priv)->ht_params && cfg(priv)->ht_params->smps_mode) priv->cfg->ht_params && priv->cfg->ht_params->smps_mode)
ieee80211_request_smps(ctx->vif, ieee80211_request_smps(ctx->vif,
cfg(priv)->ht_params->smps_mode); priv->cfg->ht_params->smps_mode);
return 0; return 0;
} }
@@ -772,19 +766,6 @@ void iwl_set_flags_for_band(struct iwl_priv *priv,
} }
} }
void iwl_set_rate(struct iwl_priv *priv)
{
struct iwl_rxon_context *ctx;
for_each_context(priv, ctx) {
ctx->staging.cck_basic_rates =
(IWL_CCK_BASIC_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
ctx->staging.ofdm_basic_rates =
(IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
}
}
static void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, static void iwl_set_rxon_hwcrypto(struct iwl_priv *priv,
struct iwl_rxon_context *ctx, int hw_decrypt) struct iwl_rxon_context *ctx, int hw_decrypt)
{ {
@@ -960,6 +941,97 @@ void iwl_print_rx_config_cmd(struct iwl_priv *priv,
} }
#endif #endif
static void iwl_calc_basic_rates(struct iwl_priv *priv,
struct iwl_rxon_context *ctx)
{
int lowest_present_ofdm = 100;
int lowest_present_cck = 100;
u8 cck = 0;
u8 ofdm = 0;
if (ctx->vif) {
struct ieee80211_supported_band *sband;
unsigned long basic = ctx->vif->bss_conf.basic_rates;
int i;
sband = priv->hw->wiphy->bands[priv->hw->conf.channel->band];
for_each_set_bit(i, &basic, BITS_PER_LONG) {
int hw = sband->bitrates[i].hw_value;
if (hw >= IWL_FIRST_OFDM_RATE) {
ofdm |= BIT(hw - IWL_FIRST_OFDM_RATE);
if (lowest_present_ofdm > hw)
lowest_present_ofdm = hw;
} else {
BUILD_BUG_ON(IWL_FIRST_CCK_RATE != 0);
cck |= BIT(hw);
if (lowest_present_cck > hw)
lowest_present_cck = hw;
}
}
}
/*
* Now we've got the basic rates as bitmaps in the ofdm and cck
* variables. This isn't sufficient though, as there might not
* be all the right rates in the bitmap. E.g. if the only basic
* rates are 5.5 Mbps and 11 Mbps, we still need to add 1 Mbps
* and 6 Mbps because the 802.11-2007 standard says in 9.6:
*
* [...] a STA responding to a received frame shall transmit
* its Control Response frame [...] at the highest rate in the
* BSSBasicRateSet parameter that is less than or equal to the
* rate of the immediately previous frame in the frame exchange
* sequence ([...]) and that is of the same modulation class
* ([...]) as the received frame. If no rate contained in the
* BSSBasicRateSet parameter meets these conditions, then the
* control frame sent in response to a received frame shall be
* transmitted at the highest mandatory rate of the PHY that is
* less than or equal to the rate of the received frame, and
* that is of the same modulation class as the received frame.
*
* As a consequence, we need to add all mandatory rates that are
* lower than all of the basic rates to these bitmaps.
*/
if (IWL_RATE_24M_INDEX < lowest_present_ofdm)
ofdm |= IWL_RATE_24M_MASK >> IWL_FIRST_OFDM_RATE;
if (IWL_RATE_12M_INDEX < lowest_present_ofdm)
ofdm |= IWL_RATE_12M_MASK >> IWL_FIRST_OFDM_RATE;
/* 6M already there or needed so always add */
ofdm |= IWL_RATE_6M_MASK >> IWL_FIRST_OFDM_RATE;
/*
* CCK is a bit more complex with DSSS vs. HR/DSSS vs. ERP.
* Note, however:
* - if no CCK rates are basic, it must be ERP since there must
* be some basic rates at all, so they're OFDM => ERP PHY
* (or we're in 5 GHz, and the cck bitmap will never be used)
* - if 11M is a basic rate, it must be ERP as well, so add 5.5M
* - if 5.5M is basic, 1M and 2M are mandatory
* - if 2M is basic, 1M is mandatory
* - if 1M is basic, that's the only valid ACK rate.
* As a consequence, it's not as complicated as it sounds, just add
* any lower rates to the ACK rate bitmap.
*/
if (IWL_RATE_11M_INDEX < lowest_present_ofdm)
ofdm |= IWL_RATE_11M_MASK >> IWL_FIRST_CCK_RATE;
if (IWL_RATE_5M_INDEX < lowest_present_ofdm)
ofdm |= IWL_RATE_5M_MASK >> IWL_FIRST_CCK_RATE;
if (IWL_RATE_2M_INDEX < lowest_present_ofdm)
ofdm |= IWL_RATE_2M_MASK >> IWL_FIRST_CCK_RATE;
/* 1M already there or needed so always add */
cck |= IWL_RATE_1M_MASK >> IWL_FIRST_CCK_RATE;
IWL_DEBUG_RATE(priv, "Set basic rates cck:0x%.2x ofdm:0x%.2x\n",
cck, ofdm);
/* "basic_rates" is a misnomer here -- should be called ACK rates */
ctx->staging.cck_basic_rates = cck;
ctx->staging.ofdm_basic_rates = ofdm;
}
/** /**
* iwlagn_commit_rxon - commit staging_rxon to hardware * iwlagn_commit_rxon - commit staging_rxon to hardware
* *
@@ -999,6 +1071,9 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
/* 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;
/* recalculate basic rates */
iwl_calc_basic_rates(priv, ctx);
/* /*
* force CTS-to-self frames protection if RTS-CTS is not preferred * force CTS-to-self frames protection if RTS-CTS is not preferred
* one aggregation protection method * one aggregation protection method
@@ -1055,7 +1130,7 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
return 0; return 0;
} }
iwl_set_rxon_hwcrypto(priv, ctx, !iwlagn_mod_params.sw_crypto); iwl_set_rxon_hwcrypto(priv, ctx, !iwlwifi_mod_params.sw_crypto);
IWL_DEBUG_INFO(priv, IWL_DEBUG_INFO(priv,
"Going to commit RXON\n" "Going to commit RXON\n"
@@ -1187,13 +1262,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
} }
iwl_update_bcast_stations(priv); iwl_update_bcast_stations(priv);
/*
* The list of supported rates and rate mask can be different
* for each band; since the band may have changed, reset
* the rate mask to what mac80211 lists.
*/
iwl_set_rate(priv);
} }
if (changed & (IEEE80211_CONF_CHANGE_PS | if (changed & (IEEE80211_CONF_CHANGE_PS |

View File

@@ -30,7 +30,6 @@
#include <net/mac80211.h> #include <net/mac80211.h>
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-core.h"
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-trans.h" #include "iwl-trans.h"

View File

@@ -37,11 +37,11 @@
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-eeprom.h" #include "iwl-eeprom.h"
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-core.h"
#include "iwl-io.h" #include "iwl-io.h"
#include "iwl-commands.h" #include "iwl-commands.h"
#include "iwl-debug.h" #include "iwl-debug.h"
#include "iwl-agn-tt.h" #include "iwl-agn-tt.h"
#include "iwl-modparams.h"
/* default Thermal Throttling transaction table /* default Thermal Throttling transaction table
* Current state | Throttling Down | Throttling Up * Current state | Throttling Down | Throttling Up
@@ -179,19 +179,19 @@ static void iwl_tt_check_exit_ct_kill(unsigned long data)
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(trans(priv), CSR_UCODE_DRV_GP1_CLR, iwl_write32(priv->trans, 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(trans(priv), CSR_UCODE_DRV_GP1_SET, iwl_write32(priv->trans, 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(trans(priv), CSR_UCODE_DRV_GP1); iwl_read32(priv->trans, CSR_UCODE_DRV_GP1);
spin_lock_irqsave(&trans(priv)->reg_lock, flags); spin_lock_irqsave(&priv->trans->reg_lock, flags);
if (likely(iwl_grab_nic_access(trans(priv)))) if (likely(iwl_grab_nic_access(priv->trans)))
iwl_release_nic_access(trans(priv)); iwl_release_nic_access(priv->trans);
spin_unlock_irqrestore(&trans(priv)->reg_lock, flags); spin_unlock_irqrestore(&priv->trans->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
@@ -632,7 +632,7 @@ void iwl_tt_initialize(struct iwl_priv *priv)
INIT_WORK(&priv->ct_enter, iwl_bg_ct_enter); INIT_WORK(&priv->ct_enter, iwl_bg_ct_enter);
INIT_WORK(&priv->ct_exit, iwl_bg_ct_exit); INIT_WORK(&priv->ct_exit, iwl_bg_ct_exit);
if (cfg(priv)->base_params->adv_thermal_throttle) { if (priv->cfg->base_params->adv_thermal_throttle) {
IWL_DEBUG_TEMP(priv, "Advanced Thermal Throttling\n"); IWL_DEBUG_TEMP(priv, "Advanced Thermal Throttling\n");
tt->restriction = kcalloc(IWL_TI_STATE_MAX, tt->restriction = kcalloc(IWL_TI_STATE_MAX,
sizeof(struct iwl_tt_restriction), sizeof(struct iwl_tt_restriction),

View File

@@ -34,7 +34,6 @@
#include <linux/ieee80211.h> #include <linux/ieee80211.h>
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-core.h"
#include "iwl-io.h" #include "iwl-io.h"
#include "iwl-agn-hw.h" #include "iwl-agn-hw.h"
#include "iwl-agn.h" #include "iwl-agn.h"
@@ -85,8 +84,8 @@ static void iwlagn_tx_cmd_build_basic(struct iwl_priv *priv,
else if (ieee80211_is_back_req(fc)) else if (ieee80211_is_back_req(fc))
tx_flags |= TX_CMD_FLG_ACK_MSK | TX_CMD_FLG_IMM_BA_RSP_MASK; tx_flags |= TX_CMD_FLG_ACK_MSK | TX_CMD_FLG_IMM_BA_RSP_MASK;
else if (info->band == IEEE80211_BAND_2GHZ && else if (info->band == IEEE80211_BAND_2GHZ &&
cfg(priv)->bt_params && priv->cfg->bt_params &&
cfg(priv)->bt_params->advanced_bt_coexist && priv->cfg->bt_params->advanced_bt_coexist &&
(ieee80211_is_auth(fc) || ieee80211_is_assoc_req(fc) || (ieee80211_is_auth(fc) || ieee80211_is_assoc_req(fc) ||
ieee80211_is_reassoc_req(fc) || ieee80211_is_reassoc_req(fc) ||
skb->protocol == cpu_to_be16(ETH_P_PAE))) skb->protocol == cpu_to_be16(ETH_P_PAE)))
@@ -203,8 +202,8 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv,
rate_flags |= RATE_MCS_CCK_MSK; rate_flags |= RATE_MCS_CCK_MSK;
/* Set up antennas */ /* Set up antennas */
if (cfg(priv)->bt_params && if (priv->cfg->bt_params &&
cfg(priv)->bt_params->advanced_bt_coexist && priv->cfg->bt_params->advanced_bt_coexist &&
priv->bt_full_concurrent) { priv->bt_full_concurrent) {
/* operated as 1x1 in full concurrency mode */ /* operated as 1x1 in full concurrency mode */
priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant, priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant,
@@ -396,12 +395,9 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
/* TODO need this for burst mode later on */ /* TODO need this for burst mode later on */
iwlagn_tx_cmd_build_basic(priv, skb, tx_cmd, info, hdr, sta_id); iwlagn_tx_cmd_build_basic(priv, skb, tx_cmd, info, hdr, sta_id);
iwl_dbg_log_tx_data_frame(priv, len, hdr);
iwlagn_tx_cmd_build_rate(priv, tx_cmd, info, fc); iwlagn_tx_cmd_build_rate(priv, tx_cmd, info, fc);
iwl_update_stats(priv, true, fc, len);
memset(&info->status, 0, sizeof(info->status)); memset(&info->status, 0, sizeof(info->status));
info->driver_data[0] = ctx; info->driver_data[0] = ctx;
@@ -467,7 +463,11 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
else else
txq_id = ctx->ac_to_queue[skb_get_queue_mapping(skb)]; txq_id = ctx->ac_to_queue[skb_get_queue_mapping(skb)];
if (iwl_trans_tx(trans(priv), skb, dev_cmd, txq_id)) WARN_ON_ONCE(!is_agg && txq_id != info->hw_queue);
WARN_ON_ONCE(is_agg &&
priv->queue_to_mac80211[txq_id] != info->hw_queue);
if (iwl_trans_tx(priv->trans, skb, dev_cmd, txq_id))
goto drop_unlock_sta; goto drop_unlock_sta;
if (ieee80211_is_data_qos(fc) && !ieee80211_is_qos_nullfunc(fc) && if (ieee80211_is_data_qos(fc) && !ieee80211_is_qos_nullfunc(fc) &&
@@ -496,14 +496,14 @@ drop_unlock_priv:
return -1; return -1;
} }
static int iwlagn_alloc_agg_txq(struct iwl_priv *priv, int ac) static int iwlagn_alloc_agg_txq(struct iwl_priv *priv, int mq)
{ {
int q; int q;
for (q = IWLAGN_FIRST_AMPDU_QUEUE; for (q = IWLAGN_FIRST_AMPDU_QUEUE;
q < cfg(priv)->base_params->num_of_queues; q++) { q < priv->cfg->base_params->num_of_queues; q++) {
if (!test_and_set_bit(q, priv->agg_q_alloc)) { if (!test_and_set_bit(q, priv->agg_q_alloc)) {
priv->queue_to_ac[q] = ac; priv->queue_to_mac80211[q] = mq;
return q; return q;
} }
} }
@@ -514,7 +514,7 @@ static int iwlagn_alloc_agg_txq(struct iwl_priv *priv, int ac)
static void iwlagn_dealloc_agg_txq(struct iwl_priv *priv, int q) static void iwlagn_dealloc_agg_txq(struct iwl_priv *priv, int q)
{ {
clear_bit(q, priv->agg_q_alloc); clear_bit(q, priv->agg_q_alloc);
priv->queue_to_ac[q] = IWL_INVALID_AC; priv->queue_to_mac80211[q] = IWL_INVALID_MAC80211_QUEUE;
} }
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,
@@ -522,6 +522,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
{ {
struct iwl_tid_data *tid_data; struct iwl_tid_data *tid_data;
int sta_id, txq_id; int sta_id, txq_id;
enum iwl_agg_state agg_state;
sta_id = iwl_sta_id(sta); sta_id = iwl_sta_id(sta);
@@ -545,6 +546,13 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
*/ */
IWL_DEBUG_HT(priv, "AGG stop before setup done\n"); IWL_DEBUG_HT(priv, "AGG stop before setup done\n");
goto turn_off; goto turn_off;
case IWL_AGG_STARTING:
/*
* This can happen when the session is stopped before
* we receive ADDBA response
*/
IWL_DEBUG_HT(priv, "AGG stop before AGG became operational\n");
goto turn_off;
case IWL_AGG_ON: case IWL_AGG_ON:
break; break;
default: default:
@@ -576,12 +584,17 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
IWL_DEBUG_TX_QUEUES(priv, "Can proceed: ssn = next_recl = %d\n", IWL_DEBUG_TX_QUEUES(priv, "Can proceed: ssn = next_recl = %d\n",
tid_data->agg.ssn); tid_data->agg.ssn);
turn_off: turn_off:
agg_state = priv->tid_data[sta_id][tid].agg.state;
priv->tid_data[sta_id][tid].agg.state = IWL_AGG_OFF; priv->tid_data[sta_id][tid].agg.state = IWL_AGG_OFF;
spin_unlock_bh(&priv->sta_lock); spin_unlock_bh(&priv->sta_lock);
if (test_bit(txq_id, priv->agg_q_alloc)) { if (test_bit(txq_id, priv->agg_q_alloc)) {
iwl_trans_tx_agg_disable(trans(priv), txq_id); /* If the transport didn't know that we wanted to start
* agreggation, don't tell it that we want to stop them
*/
if (agg_state != IWL_AGG_STARTING)
iwl_trans_tx_agg_disable(priv->trans, txq_id);
iwlagn_dealloc_agg_txq(priv, txq_id); iwlagn_dealloc_agg_txq(priv, txq_id);
} }
@@ -593,6 +606,7 @@ turn_off:
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)
{ {
struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif);
struct iwl_tid_data *tid_data; struct iwl_tid_data *tid_data;
int sta_id, txq_id, ret; int sta_id, txq_id, ret;
@@ -612,7 +626,7 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif,
return -ENXIO; return -ENXIO;
} }
txq_id = iwlagn_alloc_agg_txq(priv, tid_to_ac[tid]); txq_id = iwlagn_alloc_agg_txq(priv, ctx->ac_to_queue[tid_to_ac[tid]]);
if (txq_id < 0) { if (txq_id < 0) {
IWL_DEBUG_TX_QUEUES(priv, IWL_DEBUG_TX_QUEUES(priv,
"No free aggregation queue for %pM/%d\n", "No free aggregation queue for %pM/%d\n",
@@ -634,7 +648,7 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif,
if (*ssn == tid_data->next_reclaimed) { if (*ssn == tid_data->next_reclaimed) {
IWL_DEBUG_TX_QUEUES(priv, "Can proceed: ssn = next_recl = %d\n", IWL_DEBUG_TX_QUEUES(priv, "Can proceed: ssn = next_recl = %d\n",
tid_data->agg.ssn); tid_data->agg.ssn);
tid_data->agg.state = IWL_AGG_ON; tid_data->agg.state = IWL_AGG_STARTING;
ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
} else { } else {
IWL_DEBUG_TX_QUEUES(priv, "Can't proceed: ssn %d, " IWL_DEBUG_TX_QUEUES(priv, "Can't proceed: ssn %d, "
@@ -661,11 +675,12 @@ int iwlagn_tx_agg_oper(struct iwl_priv *priv, struct ieee80211_vif *vif,
spin_lock_bh(&priv->sta_lock); spin_lock_bh(&priv->sta_lock);
ssn = priv->tid_data[sta_priv->sta_id][tid].agg.ssn; ssn = priv->tid_data[sta_priv->sta_id][tid].agg.ssn;
q = priv->tid_data[sta_priv->sta_id][tid].agg.txq_id; q = priv->tid_data[sta_priv->sta_id][tid].agg.txq_id;
priv->tid_data[sta_priv->sta_id][tid].agg.state = IWL_AGG_ON;
spin_unlock_bh(&priv->sta_lock); spin_unlock_bh(&priv->sta_lock);
fifo = ctx->ac_to_fifo[tid_to_ac[tid]]; fifo = ctx->ac_to_fifo[tid_to_ac[tid]];
iwl_trans_tx_agg_setup(trans(priv), q, fifo, iwl_trans_tx_agg_setup(priv->trans, q, fifo,
sta_priv->sta_id, tid, sta_priv->sta_id, tid,
buf_size, ssn); buf_size, ssn);
@@ -732,7 +747,7 @@ static void iwlagn_check_ratid_empty(struct iwl_priv *priv, int sta_id, u8 tid)
IWL_DEBUG_TX_QUEUES(priv, IWL_DEBUG_TX_QUEUES(priv,
"Can continue DELBA flow ssn = next_recl =" "Can continue DELBA flow ssn = next_recl ="
" %d", tid_data->next_reclaimed); " %d", tid_data->next_reclaimed);
iwl_trans_tx_agg_disable(trans(priv), iwl_trans_tx_agg_disable(priv->trans,
tid_data->agg.txq_id); tid_data->agg.txq_id);
iwlagn_dealloc_agg_txq(priv, tid_data->agg.txq_id); iwlagn_dealloc_agg_txq(priv, tid_data->agg.txq_id);
tid_data->agg.state = IWL_AGG_OFF; tid_data->agg.state = IWL_AGG_OFF;
@@ -745,7 +760,7 @@ static void iwlagn_check_ratid_empty(struct iwl_priv *priv, int sta_id, u8 tid)
IWL_DEBUG_TX_QUEUES(priv, IWL_DEBUG_TX_QUEUES(priv,
"Can continue ADDBA flow ssn = next_recl =" "Can continue ADDBA flow ssn = next_recl ="
" %d", tid_data->next_reclaimed); " %d", tid_data->next_reclaimed);
tid_data->agg.state = IWL_AGG_ON; tid_data->agg.state = IWL_AGG_STARTING;
ieee80211_start_tx_ba_cb_irqsafe(vif, addr, tid); ieee80211_start_tx_ba_cb_irqsafe(vif, addr, tid);
} }
break; break;
@@ -909,8 +924,8 @@ static void iwl_rx_reply_tx_agg(struct iwl_priv *priv,
* notification again. * notification again.
*/ */
if (tx_resp->bt_kill_count && tx_resp->frame_count == 1 && if (tx_resp->bt_kill_count && tx_resp->frame_count == 1 &&
cfg(priv)->bt_params && priv->cfg->bt_params &&
cfg(priv)->bt_params->advanced_bt_coexist) { priv->cfg->bt_params->advanced_bt_coexist) {
IWL_DEBUG_COEX(priv, "receive reply tx w/ bt_kill\n"); IWL_DEBUG_COEX(priv, "receive reply tx w/ bt_kill\n");
} }
@@ -1092,7 +1107,7 @@ static int iwl_reclaim(struct iwl_priv *priv, int sta_id, int tid,
return 1; return 1;
} }
iwl_trans_reclaim(trans(priv), txq_id, ssn, skbs); iwl_trans_reclaim(priv->trans, txq_id, ssn, skbs);
return 0; return 0;
} }
@@ -1249,7 +1264,7 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
* (in Tx queue's circular buffer) of first TFD/frame in window */ * (in Tx queue's circular buffer) of first TFD/frame in window */
u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn);
if (scd_flow >= cfg(priv)->base_params->num_of_queues) { if (scd_flow >= priv->cfg->base_params->num_of_queues) {
IWL_ERR(priv, IWL_ERR(priv,
"BUG_ON scd_flow is bigger than number of queues\n"); "BUG_ON scd_flow is bigger than number of queues\n");
return 0; return 0;

View File

@@ -46,13 +46,13 @@
#include "iwl-eeprom.h" #include "iwl-eeprom.h"
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-core.h"
#include "iwl-io.h" #include "iwl-io.h"
#include "iwl-agn-calib.h" #include "iwl-agn-calib.h"
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-shared.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-op-mode.h" #include "iwl-op-mode.h"
#include "iwl-drv.h"
#include "iwl-modparams.h"
/****************************************************************************** /******************************************************************************
* *
@@ -348,14 +348,14 @@ static void iwl_print_cont_event_trace(struct iwl_priv *priv, u32 base,
ptr = base + (4 * sizeof(u32)) + (start_idx * 3 * sizeof(u32)); ptr = base + (4 * sizeof(u32)) + (start_idx * 3 * sizeof(u32));
/* Make sure device is powered up for SRAM reads */ /* Make sure device is powered up for SRAM reads */
spin_lock_irqsave(&trans(priv)->reg_lock, reg_flags); spin_lock_irqsave(&priv->trans->reg_lock, reg_flags);
if (unlikely(!iwl_grab_nic_access(trans(priv)))) { if (unlikely(!iwl_grab_nic_access(priv->trans))) {
spin_unlock_irqrestore(&trans(priv)->reg_lock, reg_flags); spin_unlock_irqrestore(&priv->trans->reg_lock, reg_flags);
return; return;
} }
/* Set starting address; reads will auto-increment */ /* Set starting address; reads will auto-increment */
iwl_write32(trans(priv), HBUS_TARG_MEM_RADDR, ptr); iwl_write32(priv->trans, HBUS_TARG_MEM_RADDR, ptr);
/* /*
* Refuse to read more than would have fit into the log from * Refuse to read more than would have fit into the log from
@@ -371,20 +371,20 @@ static void iwl_print_cont_event_trace(struct iwl_priv *priv, u32 base,
* place event id # at far right for easier visual parsing. * place event id # at far right for easier visual parsing.
*/ */
for (i = 0; i < num_events; i++) { for (i = 0; i < num_events; i++) {
ev = iwl_read32(trans(priv), HBUS_TARG_MEM_RDAT); ev = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT);
time = iwl_read32(trans(priv), HBUS_TARG_MEM_RDAT); time = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT);
if (mode == 0) { if (mode == 0) {
trace_iwlwifi_dev_ucode_cont_event( trace_iwlwifi_dev_ucode_cont_event(
trans(priv)->dev, 0, time, ev); priv->trans->dev, 0, time, ev);
} else { } else {
data = iwl_read32(trans(priv), HBUS_TARG_MEM_RDAT); data = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT);
trace_iwlwifi_dev_ucode_cont_event( trace_iwlwifi_dev_ucode_cont_event(
trans(priv)->dev, time, data, ev); priv->trans->dev, time, data, ev);
} }
} }
/* Allow device to power down */ /* Allow device to power down */
iwl_release_nic_access(trans(priv)); iwl_release_nic_access(priv->trans);
spin_unlock_irqrestore(&trans(priv)->reg_lock, reg_flags); spin_unlock_irqrestore(&priv->trans->reg_lock, reg_flags);
} }
static void iwl_continuous_event_trace(struct iwl_priv *priv) static void iwl_continuous_event_trace(struct iwl_priv *priv)
@@ -403,8 +403,7 @@ static void iwl_continuous_event_trace(struct iwl_priv *priv)
base = priv->device_pointers.log_event_table; base = priv->device_pointers.log_event_table;
if (iwlagn_hw_valid_rtc_data_addr(base)) { if (iwlagn_hw_valid_rtc_data_addr(base)) {
iwl_read_targ_mem_words(trans(priv), base, &read, sizeof(read)); iwl_read_targ_mem_words(priv->trans, base, &read, sizeof(read));
capacity = read.capacity; capacity = read.capacity;
mode = read.mode; mode = read.mode;
num_wraps = read.wrap_counter; num_wraps = read.wrap_counter;
@@ -444,7 +443,7 @@ static void iwl_continuous_event_trace(struct iwl_priv *priv)
else else
priv->event_log.wraps_once_count++; priv->event_log.wraps_once_count++;
trace_iwlwifi_dev_ucode_wrap_event(trans(priv)->dev, trace_iwlwifi_dev_ucode_wrap_event(priv->trans->dev,
num_wraps - priv->event_log.num_wraps, num_wraps - priv->event_log.num_wraps,
next_entry, priv->event_log.next_entry); next_entry, priv->event_log.next_entry);
@@ -579,24 +578,6 @@ static const u8 iwlagn_pan_ac_to_queue[] = {
7, 6, 5, 4, 7, 6, 5, 4,
}; };
static const u8 iwlagn_bss_queue_to_ac[] = {
IEEE80211_AC_VO,
IEEE80211_AC_VI,
IEEE80211_AC_BE,
IEEE80211_AC_BK,
};
static const u8 iwlagn_pan_queue_to_ac[] = {
IEEE80211_AC_VO,
IEEE80211_AC_VI,
IEEE80211_AC_BE,
IEEE80211_AC_BK,
IEEE80211_AC_BK,
IEEE80211_AC_BE,
IEEE80211_AC_VI,
IEEE80211_AC_VO,
};
void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags) void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags)
{ {
int i; int i;
@@ -670,12 +651,12 @@ void iwl_rf_kill_ct_config(struct iwl_priv *priv)
struct iwl_ct_kill_throttling_config adv_cmd; struct iwl_ct_kill_throttling_config adv_cmd;
int ret = 0; int ret = 0;
iwl_write32(trans(priv), CSR_UCODE_DRV_GP1_CLR, iwl_write32(priv->trans, 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;
if (cfg(priv)->base_params->support_ct_kill_exit) { if (priv->cfg->base_params->support_ct_kill_exit) {
adv_cmd.critical_temperature_enter = adv_cmd.critical_temperature_enter =
cpu_to_le32(priv->hw_params.ct_kill_threshold); cpu_to_le32(priv->hw_params.ct_kill_threshold);
adv_cmd.critical_temperature_exit = adv_cmd.critical_temperature_exit =
@@ -754,7 +735,7 @@ void iwl_send_bt_config(struct iwl_priv *priv)
.kill_cts_mask = 0, .kill_cts_mask = 0,
}; };
if (!iwlagn_mod_params.bt_coex_active) if (!iwlwifi_mod_params.bt_coex_active)
bt_cmd.flags = BT_COEX_DISABLE; bt_cmd.flags = BT_COEX_DISABLE;
else else
bt_cmd.flags = BT_COEX_ENABLE; bt_cmd.flags = BT_COEX_ENABLE;
@@ -792,10 +773,10 @@ int iwl_alive_start(struct iwl_priv *priv)
} }
/* download priority table before any calibration request */ /* download priority table before any calibration request */
if (cfg(priv)->bt_params && if (priv->cfg->bt_params &&
cfg(priv)->bt_params->advanced_bt_coexist) { priv->cfg->bt_params->advanced_bt_coexist) {
/* Configure Bluetooth device coexistence support */ /* Configure Bluetooth device coexistence support */
if (cfg(priv)->bt_params->bt_sco_disable) if (priv->cfg->bt_params->bt_sco_disable)
priv->bt_enable_pspoll = false; priv->bt_enable_pspoll = false;
else else
priv->bt_enable_pspoll = true; priv->bt_enable_pspoll = true;
@@ -932,9 +913,9 @@ void iwl_down(struct iwl_priv *priv)
priv->bt_status = 0; priv->bt_status = 0;
priv->cur_rssi_ctx = NULL; priv->cur_rssi_ctx = NULL;
priv->bt_is_sco = 0; priv->bt_is_sco = 0;
if (cfg(priv)->bt_params) if (priv->cfg->bt_params)
priv->bt_traffic_load = priv->bt_traffic_load =
cfg(priv)->bt_params->bt_init_traffic_load; priv->cfg->bt_params->bt_init_traffic_load;
else else
priv->bt_traffic_load = 0; priv->bt_traffic_load = 0;
priv->bt_full_concurrent = false; priv->bt_full_concurrent = false;
@@ -949,7 +930,7 @@ void iwl_down(struct iwl_priv *priv)
ieee80211_stop_queues(priv->hw); ieee80211_stop_queues(priv->hw);
priv->ucode_loaded = false; priv->ucode_loaded = false;
iwl_trans_stop_device(trans(priv)); iwl_trans_stop_device(priv->trans);
/* Clear out all status bits but a few that are stable across reset */ /* Clear out all status bits but a few that are stable across reset */
priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) <<
@@ -1031,12 +1012,12 @@ void iwlagn_prepare_restart(struct iwl_priv *priv)
priv->bt_status = bt_status; priv->bt_status = bt_status;
priv->bt_is_sco = bt_is_sco; priv->bt_is_sco = bt_is_sco;
/* reset all queues */ /* reset aggregation queues */
for (i = 0; i < IEEE80211_NUM_ACS; i++)
atomic_set(&priv->ac_stop_count[i], 0);
for (i = IWLAGN_FIRST_AMPDU_QUEUE; i < IWL_MAX_HW_QUEUES; i++) for (i = IWLAGN_FIRST_AMPDU_QUEUE; i < IWL_MAX_HW_QUEUES; i++)
priv->queue_to_ac[i] = IWL_INVALID_AC; priv->queue_to_mac80211[i] = IWL_INVALID_MAC80211_QUEUE;
/* and stop counts */
for (i = 0; i < IWL_MAX_HW_QUEUES; i++)
atomic_set(&priv->queue_stop_count[i], 0);
memset(priv->agg_q_alloc, 0, sizeof(priv->agg_q_alloc)); memset(priv->agg_q_alloc, 0, sizeof(priv->agg_q_alloc));
} }
@@ -1115,7 +1096,7 @@ void iwl_setup_deferred_work(struct iwl_priv *priv)
iwl_setup_scan_deferred_work(priv); iwl_setup_scan_deferred_work(priv);
if (cfg(priv)->bt_params) if (priv->cfg->bt_params)
iwlagn_bt_setup_deferred_work(priv); iwlagn_bt_setup_deferred_work(priv);
init_timer(&priv->statistics_periodic); init_timer(&priv->statistics_periodic);
@@ -1129,7 +1110,7 @@ void iwl_setup_deferred_work(struct iwl_priv *priv)
void iwl_cancel_deferred_work(struct iwl_priv *priv) void iwl_cancel_deferred_work(struct iwl_priv *priv)
{ {
if (cfg(priv)->bt_params) if (priv->cfg->bt_params)
iwlagn_bt_cancel_deferred_work(priv); iwlagn_bt_cancel_deferred_work(priv);
cancel_work_sync(&priv->run_time_calib_work); cancel_work_sync(&priv->run_time_calib_work);
@@ -1180,8 +1161,8 @@ static void iwl_init_ht_hw_capab(const struct iwl_priv *priv,
ht_info->ht_supported = true; ht_info->ht_supported = true;
if (cfg(priv)->ht_params && if (priv->cfg->ht_params &&
cfg(priv)->ht_params->ht_greenfield_support) priv->cfg->ht_params->ht_greenfield_support)
ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD; ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD;
ht_info->cap |= IEEE80211_HT_CAP_SGI_20; ht_info->cap |= IEEE80211_HT_CAP_SGI_20;
max_bit_rate = MAX_BIT_RATE_20_MHZ; max_bit_rate = MAX_BIT_RATE_20_MHZ;
@@ -1192,7 +1173,7 @@ static void iwl_init_ht_hw_capab(const struct iwl_priv *priv,
max_bit_rate = MAX_BIT_RATE_40_MHZ; max_bit_rate = MAX_BIT_RATE_40_MHZ;
} }
if (iwlagn_mod_params.amsdu_size_8K) if (iwlwifi_mod_params.amsdu_size_8K)
ht_info->cap |= IEEE80211_HT_CAP_MAX_AMSDU; ht_info->cap |= IEEE80211_HT_CAP_MAX_AMSDU;
ht_info->ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF; ht_info->ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF;
@@ -1325,7 +1306,7 @@ static int iwl_init_geos(struct iwl_priv *priv)
priv->hw_params.sku & EEPROM_SKU_CAP_BAND_52GHZ) { priv->hw_params.sku & EEPROM_SKU_CAP_BAND_52GHZ) {
IWL_INFO(priv, "Incorrectly detected BG card as ABG. " IWL_INFO(priv, "Incorrectly detected BG card as ABG. "
"Please send your %s to maintainer.\n", "Please send your %s to maintainer.\n",
trans(priv)->hw_id_str); priv->trans->hw_id_str);
priv->hw_params.sku &= ~EEPROM_SKU_CAP_BAND_52GHZ; priv->hw_params.sku &= ~EEPROM_SKU_CAP_BAND_52GHZ;
} }
@@ -1363,7 +1344,7 @@ int iwl_init_drv(struct iwl_priv *priv)
priv->band = IEEE80211_BAND_2GHZ; priv->band = IEEE80211_BAND_2GHZ;
priv->plcp_delta_threshold = priv->plcp_delta_threshold =
cfg(priv)->base_params->plcp_delta_threshold; priv->cfg->base_params->plcp_delta_threshold;
priv->iw_mode = NL80211_IFTYPE_STATION; priv->iw_mode = NL80211_IFTYPE_STATION;
priv->current_ht_config.smps = IEEE80211_SMPS_STATIC; priv->current_ht_config.smps = IEEE80211_SMPS_STATIC;
@@ -1380,8 +1361,8 @@ int iwl_init_drv(struct iwl_priv *priv)
iwl_init_scan_params(priv); iwl_init_scan_params(priv);
/* init bt coex */ /* init bt coex */
if (cfg(priv)->bt_params && if (priv->cfg->bt_params &&
cfg(priv)->bt_params->advanced_bt_coexist) { priv->cfg->bt_params->advanced_bt_coexist) {
priv->kill_ack_mask = IWLAGN_BT_KILL_ACK_MASK_DEFAULT; priv->kill_ack_mask = IWLAGN_BT_KILL_ACK_MASK_DEFAULT;
priv->kill_cts_mask = IWLAGN_BT_KILL_CTS_MASK_DEFAULT; priv->kill_cts_mask = IWLAGN_BT_KILL_CTS_MASK_DEFAULT;
priv->bt_valid = IWLAGN_BT_ALL_VALID_MSK; priv->bt_valid = IWLAGN_BT_ALL_VALID_MSK;
@@ -1426,11 +1407,11 @@ void iwl_uninit_drv(struct iwl_priv *priv)
void iwl_set_hw_params(struct iwl_priv *priv) void iwl_set_hw_params(struct iwl_priv *priv)
{ {
if (cfg(priv)->ht_params) if (priv->cfg->ht_params)
priv->hw_params.use_rts_for_aggregation = priv->hw_params.use_rts_for_aggregation =
cfg(priv)->ht_params->use_rts_for_aggregation; priv->cfg->ht_params->use_rts_for_aggregation;
if (iwlagn_mod_params.disable_11n & IWL_DISABLE_HT_ALL) if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_ALL)
priv->hw_params.sku &= ~EEPROM_SKU_CAP_11N_ENABLE; priv->hw_params.sku &= ~EEPROM_SKU_CAP_11N_ENABLE;
/* Device-specific setup */ /* Device-specific setup */
@@ -1441,32 +1422,32 @@ void iwl_set_hw_params(struct iwl_priv *priv)
void iwl_debug_config(struct iwl_priv *priv) void iwl_debug_config(struct iwl_priv *priv)
{ {
dev_printk(KERN_INFO, trans(priv)->dev, "CONFIG_IWLWIFI_DEBUG " dev_printk(KERN_INFO, priv->trans->dev, "CONFIG_IWLWIFI_DEBUG "
#ifdef CONFIG_IWLWIFI_DEBUG #ifdef CONFIG_IWLWIFI_DEBUG
"enabled\n"); "enabled\n");
#else #else
"disabled\n"); "disabled\n");
#endif #endif
dev_printk(KERN_INFO, trans(priv)->dev, "CONFIG_IWLWIFI_DEBUGFS " dev_printk(KERN_INFO, priv->trans->dev, "CONFIG_IWLWIFI_DEBUGFS "
#ifdef CONFIG_IWLWIFI_DEBUGFS #ifdef CONFIG_IWLWIFI_DEBUGFS
"enabled\n"); "enabled\n");
#else #else
"disabled\n"); "disabled\n");
#endif #endif
dev_printk(KERN_INFO, trans(priv)->dev, "CONFIG_IWLWIFI_DEVICE_TRACING " dev_printk(KERN_INFO, priv->trans->dev, "CONFIG_IWLWIFI_DEVICE_TRACING "
#ifdef CONFIG_IWLWIFI_DEVICE_TRACING #ifdef CONFIG_IWLWIFI_DEVICE_TRACING
"enabled\n"); "enabled\n");
#else #else
"disabled\n"); "disabled\n");
#endif #endif
dev_printk(KERN_INFO, trans(priv)->dev, "CONFIG_IWLWIFI_DEVICE_TESTMODE " dev_printk(KERN_INFO, priv->trans->dev, "CONFIG_IWLWIFI_DEVICE_TESTMODE "
#ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE #ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE
"enabled\n"); "enabled\n");
#else #else
"disabled\n"); "disabled\n");
#endif #endif
dev_printk(KERN_INFO, trans(priv)->dev, "CONFIG_IWLWIFI_P2P " dev_printk(KERN_INFO, priv->trans->dev, "CONFIG_IWLWIFI_P2P "
#ifdef CONFIG_IWLWIFI_P2P #ifdef CONFIG_IWLWIFI_P2P
"enabled\n"); "enabled\n");
#else #else
@@ -1475,6 +1456,7 @@ void iwl_debug_config(struct iwl_priv *priv)
} }
static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
const struct iwl_cfg *cfg,
const struct iwl_fw *fw) const struct iwl_fw *fw)
{ {
struct iwl_priv *priv; struct iwl_priv *priv;
@@ -1491,8 +1473,6 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
STATISTICS_NOTIFICATION, STATISTICS_NOTIFICATION,
REPLY_TX, REPLY_TX,
}; };
const u8 *q_to_ac;
int n_q_to_ac;
int i; int i;
/************************ /************************
@@ -1500,18 +1480,19 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
************************/ ************************/
hw = iwl_alloc_all(); hw = iwl_alloc_all();
if (!hw) { if (!hw) {
pr_err("%s: Cannot allocate network device\n", pr_err("%s: Cannot allocate network device\n", cfg->name);
cfg(trans)->name);
goto out; goto out;
} }
op_mode = hw->priv; op_mode = hw->priv;
op_mode->ops = &iwl_dvm_ops; op_mode->ops = &iwl_dvm_ops;
priv = IWL_OP_MODE_GET_DVM(op_mode); priv = IWL_OP_MODE_GET_DVM(op_mode);
priv->shrd = trans->shrd; priv->trans = trans;
priv->dev = trans->dev;
priv->cfg = cfg;
priv->fw = fw; priv->fw = fw;
switch (cfg(priv)->device_family) { switch (priv->cfg->device_family) {
case IWL_DEVICE_FAMILY_1000: case IWL_DEVICE_FAMILY_1000:
case IWL_DEVICE_FAMILY_100: case IWL_DEVICE_FAMILY_100:
priv->lib = &iwl1000_lib; priv->lib = &iwl1000_lib;
@@ -1545,7 +1526,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
} }
if (WARN_ON(!priv->lib)) if (WARN_ON(!priv->lib))
goto out_free_traffic_mem; goto out_free_hw;
/* /*
* Populate the state variables that the transport layer needs * Populate the state variables that the transport layer needs
@@ -1554,10 +1535,10 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
trans_cfg.op_mode = op_mode; trans_cfg.op_mode = op_mode;
trans_cfg.no_reclaim_cmds = no_reclaim_cmds; trans_cfg.no_reclaim_cmds = no_reclaim_cmds;
trans_cfg.n_no_reclaim_cmds = ARRAY_SIZE(no_reclaim_cmds); trans_cfg.n_no_reclaim_cmds = ARRAY_SIZE(no_reclaim_cmds);
trans_cfg.rx_buf_size_8k = iwlagn_mod_params.amsdu_size_8K; trans_cfg.rx_buf_size_8k = iwlwifi_mod_params.amsdu_size_8K;
if (!iwlagn_mod_params.wd_disable) if (!iwlwifi_mod_params.wd_disable)
trans_cfg.queue_watchdog_timeout = trans_cfg.queue_watchdog_timeout =
cfg(priv)->base_params->wd_timeout; priv->cfg->base_params->wd_timeout;
else else
trans_cfg.queue_watchdog_timeout = IWL_WATCHHDOG_DISABLED; trans_cfg.queue_watchdog_timeout = IWL_WATCHHDOG_DISABLED;
trans_cfg.command_names = iwl_dvm_cmd_strings; trans_cfg.command_names = iwl_dvm_cmd_strings;
@@ -1574,24 +1555,20 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
trans_cfg.queue_to_fifo = iwlagn_ipan_queue_to_tx_fifo; trans_cfg.queue_to_fifo = iwlagn_ipan_queue_to_tx_fifo;
trans_cfg.n_queue_to_fifo = trans_cfg.n_queue_to_fifo =
ARRAY_SIZE(iwlagn_ipan_queue_to_tx_fifo); ARRAY_SIZE(iwlagn_ipan_queue_to_tx_fifo);
q_to_ac = iwlagn_pan_queue_to_ac;
n_q_to_ac = ARRAY_SIZE(iwlagn_pan_queue_to_ac);
} else { } else {
priv->sta_key_max_num = STA_KEY_MAX_NUM; priv->sta_key_max_num = STA_KEY_MAX_NUM;
trans_cfg.cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM; trans_cfg.cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
trans_cfg.queue_to_fifo = iwlagn_default_queue_to_tx_fifo; trans_cfg.queue_to_fifo = iwlagn_default_queue_to_tx_fifo;
trans_cfg.n_queue_to_fifo = trans_cfg.n_queue_to_fifo =
ARRAY_SIZE(iwlagn_default_queue_to_tx_fifo); ARRAY_SIZE(iwlagn_default_queue_to_tx_fifo);
q_to_ac = iwlagn_bss_queue_to_ac;
n_q_to_ac = ARRAY_SIZE(iwlagn_bss_queue_to_ac);
} }
/* Configure transport layer */ /* Configure transport layer */
iwl_trans_configure(trans(priv), &trans_cfg); iwl_trans_configure(priv->trans, &trans_cfg);
/* At this point both hw and priv are allocated. */ /* At this point both hw and priv are allocated. */
SET_IEEE80211_DEV(priv->hw, trans(priv)->dev); SET_IEEE80211_DEV(priv->hw, priv->trans->dev);
/* show what debugging capabilities we have */ /* show what debugging capabilities we have */
iwl_debug_config(priv); iwl_debug_config(priv);
@@ -1600,40 +1577,37 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
/* is antenna coupling more than 35dB ? */ /* is antenna coupling more than 35dB ? */
priv->bt_ant_couple_ok = priv->bt_ant_couple_ok =
(iwlagn_mod_params.ant_coupling > (iwlwifi_mod_params.ant_coupling >
IWL_BT_ANTENNA_COUPLING_THRESHOLD) ? IWL_BT_ANTENNA_COUPLING_THRESHOLD) ?
true : false; true : false;
/* enable/disable bt channel inhibition */ /* enable/disable bt channel inhibition */
priv->bt_ch_announce = iwlagn_mod_params.bt_ch_announce; priv->bt_ch_announce = iwlwifi_mod_params.bt_ch_announce;
IWL_DEBUG_INFO(priv, "BT channel inhibition is %s\n", IWL_DEBUG_INFO(priv, "BT channel inhibition is %s\n",
(priv->bt_ch_announce) ? "On" : "Off"); (priv->bt_ch_announce) ? "On" : "Off");
if (iwl_alloc_traffic_mem(priv))
IWL_ERR(priv, "Not enough memory to generate traffic log\n");
/* these spin locks will be used in apm_ops.init and EEPROM access /* these spin locks will be used in apm_ops.init and EEPROM access
* we should init now * we should init now
*/ */
spin_lock_init(&trans(priv)->reg_lock); spin_lock_init(&priv->trans->reg_lock);
spin_lock_init(&priv->statistics.lock); spin_lock_init(&priv->statistics.lock);
/*********************** /***********************
* 2. Read REV register * 2. Read REV register
***********************/ ***********************/
IWL_INFO(priv, "Detected %s, REV=0x%X\n", IWL_INFO(priv, "Detected %s, REV=0x%X\n",
cfg(priv)->name, trans(priv)->hw_rev); priv->cfg->name, priv->trans->hw_rev);
if (iwl_trans_start_hw(trans(priv))) if (iwl_trans_start_hw(priv->trans))
goto out_free_traffic_mem; goto out_free_hw;
/* Read the EEPROM */ /* Read the EEPROM */
if (iwl_eeprom_init(priv, trans(priv)->hw_rev)) { if (iwl_eeprom_init(priv, priv->trans->hw_rev)) {
IWL_ERR(priv, "Unable to init EEPROM\n"); IWL_ERR(priv, "Unable to init EEPROM\n");
goto out_free_traffic_mem; goto out_free_hw;
} }
/* Reset chip to save power until we load uCode during "up". */ /* Reset chip to save power until we load uCode during "up". */
iwl_trans_stop_hw(trans(priv)); iwl_trans_stop_hw(priv->trans, false);
if (iwl_eeprom_check_version(priv)) if (iwl_eeprom_check_version(priv))
goto out_free_eeprom; goto out_free_eeprom;
@@ -1672,24 +1646,21 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
trans_cfg.queue_to_fifo = iwlagn_default_queue_to_tx_fifo; trans_cfg.queue_to_fifo = iwlagn_default_queue_to_tx_fifo;
trans_cfg.n_queue_to_fifo = trans_cfg.n_queue_to_fifo =
ARRAY_SIZE(iwlagn_default_queue_to_tx_fifo); ARRAY_SIZE(iwlagn_default_queue_to_tx_fifo);
q_to_ac = iwlagn_bss_queue_to_ac;
n_q_to_ac = ARRAY_SIZE(iwlagn_bss_queue_to_ac);
/* Configure transport layer again*/ /* Configure transport layer again*/
iwl_trans_configure(trans(priv), &trans_cfg); iwl_trans_configure(priv->trans, &trans_cfg);
} }
/******************* /*******************
* 5. Setup priv * 5. Setup priv
*******************/ *******************/
for (i = 0; i < IEEE80211_NUM_ACS; i++)
atomic_set(&priv->ac_stop_count[i], 0);
for (i = 0; i < IWL_MAX_HW_QUEUES; i++) { for (i = 0; i < IWL_MAX_HW_QUEUES; i++) {
if (i < n_q_to_ac) priv->queue_to_mac80211[i] = IWL_INVALID_MAC80211_QUEUE;
priv->queue_to_ac[i] = q_to_ac[i]; if (i < IWLAGN_FIRST_AMPDU_QUEUE &&
else i != IWL_DEFAULT_CMD_QUEUE_NUM &&
priv->queue_to_ac[i] = IWL_INVALID_AC; i != IWL_IPAN_CMD_QUEUE_NUM)
priv->queue_to_mac80211[i] = i;
atomic_set(&priv->queue_stop_count[i], 0);
} }
WARN_ON(trans_cfg.queue_to_fifo[trans_cfg.cmd_queue] != WARN_ON(trans_cfg.queue_to_fifo[trans_cfg.cmd_queue] !=
@@ -1745,8 +1716,7 @@ out_destroy_workqueue:
iwl_uninit_drv(priv); iwl_uninit_drv(priv);
out_free_eeprom: out_free_eeprom:
iwl_eeprom_free(priv); iwl_eeprom_free(priv);
out_free_traffic_mem: out_free_hw:
iwl_free_traffic_mem(priv);
ieee80211_free_hw(priv->hw); ieee80211_free_hw(priv->hw);
out: out:
op_mode = NULL; op_mode = NULL;
@@ -1768,7 +1738,7 @@ void iwl_op_mode_dvm_stop(struct iwl_op_mode *op_mode)
/*This will stop the queues, move the device to low power state */ /*This will stop the queues, move the device to low power state */
priv->ucode_loaded = false; priv->ucode_loaded = false;
iwl_trans_stop_device(trans(priv)); iwl_trans_stop_device(priv->trans);
iwl_eeprom_free(priv); iwl_eeprom_free(priv);
@@ -1780,12 +1750,12 @@ void iwl_op_mode_dvm_stop(struct iwl_op_mode *op_mode)
* until now... */ * until now... */
destroy_workqueue(priv->workqueue); destroy_workqueue(priv->workqueue);
priv->workqueue = NULL; priv->workqueue = NULL;
iwl_free_traffic_mem(priv);
iwl_uninit_drv(priv); iwl_uninit_drv(priv);
dev_kfree_skb(priv->beacon_skb); dev_kfree_skb(priv->beacon_skb);
iwl_trans_stop_hw(priv->trans, true);
ieee80211_free_hw(priv->hw); ieee80211_free_hw(priv->hw);
} }
@@ -1860,7 +1830,7 @@ static const char *desc_lookup(u32 num)
static void iwl_dump_nic_error_log(struct iwl_priv *priv) static void iwl_dump_nic_error_log(struct iwl_priv *priv)
{ {
struct iwl_trans *trans = trans(priv); struct iwl_trans *trans = priv->trans;
u32 base; u32 base;
struct iwl_error_event_table table; struct iwl_error_event_table table;
@@ -1950,7 +1920,7 @@ static int iwl_print_event_log(struct iwl_priv *priv, u32 start_idx,
u32 ev, time, data; /* event log data */ u32 ev, time, data; /* event log data */
unsigned long reg_flags; unsigned long reg_flags;
struct iwl_trans *trans = trans(priv); struct iwl_trans *trans = priv->trans;
if (num_events == 0) if (num_events == 0)
return pos; return pos;
@@ -2068,7 +2038,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
u32 logsize; u32 logsize;
int pos = 0; int pos = 0;
size_t bufsz = 0; size_t bufsz = 0;
struct iwl_trans *trans = trans(priv); struct iwl_trans *trans = priv->trans;
base = priv->device_pointers.log_event_table; base = priv->device_pointers.log_event_table;
if (priv->cur_ucode == IWL_UCODE_INIT) { if (priv->cur_ucode == IWL_UCODE_INIT) {
@@ -2184,7 +2154,7 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
* commands by clearing the ready bit */ * commands by clearing the ready bit */
clear_bit(STATUS_READY, &priv->status); clear_bit(STATUS_READY, &priv->status);
wake_up(&trans(priv)->wait_command_queue); wake_up(&priv->trans->wait_command_queue);
if (!ondemand) { if (!ondemand) {
/* /*
@@ -2208,7 +2178,7 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
} }
if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) { if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) {
if (iwlagn_mod_params.restart_fw) { if (iwlwifi_mod_params.restart_fw) {
IWL_DEBUG_FW_ERRORS(priv, IWL_DEBUG_FW_ERRORS(priv,
"Restarting adapter due to uCode error.\n"); "Restarting adapter due to uCode error.\n");
queue_work(priv->workqueue, &priv->restart); queue_work(priv->workqueue, &priv->restart);
@@ -2259,56 +2229,56 @@ static void iwl_wimax_active(struct iwl_op_mode *op_mode)
void iwl_stop_sw_queue(struct iwl_op_mode *op_mode, int queue) void iwl_stop_sw_queue(struct iwl_op_mode *op_mode, int queue)
{ {
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
int ac = priv->queue_to_ac[queue]; int mq = priv->queue_to_mac80211[queue];
if (WARN_ON_ONCE(ac == IWL_INVALID_AC)) if (WARN_ON_ONCE(mq == IWL_INVALID_MAC80211_QUEUE))
return; return;
if (atomic_inc_return(&priv->ac_stop_count[ac]) > 1) { if (atomic_inc_return(&priv->queue_stop_count[mq]) > 1) {
IWL_DEBUG_TX_QUEUES(priv, IWL_DEBUG_TX_QUEUES(priv,
"queue %d (AC %d) already stopped\n", "queue %d (mac80211 %d) already stopped\n",
queue, ac); queue, mq);
return; return;
} }
set_bit(ac, &priv->transport_queue_stop); set_bit(mq, &priv->transport_queue_stop);
ieee80211_stop_queue(priv->hw, ac); ieee80211_stop_queue(priv->hw, mq);
} }
void iwl_wake_sw_queue(struct iwl_op_mode *op_mode, int queue) void iwl_wake_sw_queue(struct iwl_op_mode *op_mode, int queue)
{ {
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
int ac = priv->queue_to_ac[queue]; int mq = priv->queue_to_mac80211[queue];
if (WARN_ON_ONCE(ac == IWL_INVALID_AC)) if (WARN_ON_ONCE(mq == IWL_INVALID_MAC80211_QUEUE))
return; return;
if (atomic_dec_return(&priv->ac_stop_count[ac]) > 0) { if (atomic_dec_return(&priv->queue_stop_count[mq]) > 0) {
IWL_DEBUG_TX_QUEUES(priv, IWL_DEBUG_TX_QUEUES(priv,
"queue %d (AC %d) already awake\n", "queue %d (mac80211 %d) already awake\n",
queue, ac); queue, mq);
return; return;
} }
clear_bit(ac, &priv->transport_queue_stop); clear_bit(mq, &priv->transport_queue_stop);
if (!priv->passive_no_rx) if (!priv->passive_no_rx)
ieee80211_wake_queue(priv->hw, ac); ieee80211_wake_queue(priv->hw, mq);
} }
void iwlagn_lift_passive_no_rx(struct iwl_priv *priv) void iwlagn_lift_passive_no_rx(struct iwl_priv *priv)
{ {
int ac; int mq;
if (!priv->passive_no_rx) if (!priv->passive_no_rx)
return; return;
for (ac = IEEE80211_AC_VO; ac < IEEE80211_NUM_ACS; ac++) { for (mq = 0; mq < IWLAGN_FIRST_AMPDU_QUEUE; mq++) {
if (!test_bit(ac, &priv->transport_queue_stop)) { if (!test_bit(mq, &priv->transport_queue_stop)) {
IWL_DEBUG_TX_QUEUES(priv, "Wake queue %d"); IWL_DEBUG_TX_QUEUES(priv, "Wake queue %d", mq);
ieee80211_wake_queue(priv->hw, ac); ieee80211_wake_queue(priv->hw, mq);
} else { } else {
IWL_DEBUG_TX_QUEUES(priv, "Don't wake queue %d"); IWL_DEBUG_TX_QUEUES(priv, "Don't wake queue %d", mq);
} }
} }
@@ -2398,77 +2368,3 @@ static void __exit iwl_exit(void)
module_exit(iwl_exit); module_exit(iwl_exit);
module_init(iwl_init); module_init(iwl_init);
#ifdef CONFIG_IWLWIFI_DEBUG
module_param_named(debug, iwlagn_mod_params.debug_level, uint,
S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(debug, "debug output mask");
#endif
module_param_named(swcrypto, iwlagn_mod_params.sw_crypto, int, S_IRUGO);
MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])");
module_param_named(11n_disable, iwlagn_mod_params.disable_11n, uint, S_IRUGO);
MODULE_PARM_DESC(11n_disable,
"disable 11n functionality, bitmap: 1: full, 2: agg TX, 4: agg RX");
module_param_named(amsdu_size_8K, iwlagn_mod_params.amsdu_size_8K,
int, S_IRUGO);
MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size");
module_param_named(fw_restart, iwlagn_mod_params.restart_fw, int, S_IRUGO);
MODULE_PARM_DESC(fw_restart, "restart firmware in case of error");
module_param_named(antenna_coupling, iwlagn_mod_params.ant_coupling,
int, S_IRUGO);
MODULE_PARM_DESC(antenna_coupling,
"specify antenna coupling in dB (defualt: 0 dB)");
module_param_named(bt_ch_inhibition, iwlagn_mod_params.bt_ch_announce,
bool, S_IRUGO);
MODULE_PARM_DESC(bt_ch_inhibition,
"Enable BT channel inhibition (default: enable)");
module_param_named(plcp_check, iwlagn_mod_params.plcp_check, bool, S_IRUGO);
MODULE_PARM_DESC(plcp_check, "Check plcp health (default: 1 [enabled])");
module_param_named(wd_disable, iwlagn_mod_params.wd_disable, int, S_IRUGO);
MODULE_PARM_DESC(wd_disable,
"Disable stuck queue watchdog timer 0=system default, "
"1=disable, 2=enable (default: 0)");
/*
* set bt_coex_active to true, uCode will do kill/defer
* every time the priority line is asserted (BT is sending signals on the
* priority line in the PCIx).
* set bt_coex_active to false, uCode will ignore the BT activity and
* perform the normal operation
*
* User might experience transmit issue on some platform due to WiFi/BT
* co-exist problem. The possible behaviors are:
* Able to scan and finding all the available AP
* Not able to associate with any AP
* On those platforms, WiFi communication can be restored by set
* "bt_coex_active" module parameter to "false"
*
* default: bt_coex_active = true (BT_COEX_ENABLE)
*/
module_param_named(bt_coex_active, iwlagn_mod_params.bt_coex_active,
bool, S_IRUGO);
MODULE_PARM_DESC(bt_coex_active, "enable wifi/bt co-exist (default: enable)");
module_param_named(led_mode, iwlagn_mod_params.led_mode, int, S_IRUGO);
MODULE_PARM_DESC(led_mode, "0=system default, "
"1=On(RF On)/Off(RF Off), 2=blinking, 3=Off (default: 0)");
module_param_named(power_save, iwlagn_mod_params.power_save,
bool, S_IRUGO);
MODULE_PARM_DESC(power_save,
"enable WiFi power management (default: disable)");
module_param_named(power_level, iwlagn_mod_params.power_level,
int, S_IRUGO);
MODULE_PARM_DESC(power_level,
"default power save level (range from 1 - 5, default: 1)");
module_param_named(auto_agg, iwlagn_mod_params.auto_agg,
bool, S_IRUGO);
MODULE_PARM_DESC(auto_agg,
"enable agg w/o check traffic load (default: enable)");

View File

@@ -64,6 +64,7 @@
#define __iwl_agn_h__ #define __iwl_agn_h__
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-config.h"
/* The first 11 queues (0-10) are used otherwise */ /* The first 11 queues (0-10) are used otherwise */
#define IWLAGN_FIRST_AMPDU_QUEUE 11 #define IWLAGN_FIRST_AMPDU_QUEUE 11
@@ -81,6 +82,7 @@ extern struct iwl_lib_ops iwl6000_lib;
extern struct iwl_lib_ops iwl6030_lib; extern struct iwl_lib_ops iwl6030_lib;
#define TIME_UNIT 1024
/***************************************************** /*****************************************************
* DRIVER STATUS FUNCTIONS * DRIVER STATUS FUNCTIONS
@@ -154,7 +156,6 @@ void iwl_set_flags_for_band(struct iwl_priv *priv,
struct iwl_rxon_context *ctx, struct iwl_rxon_context *ctx,
enum ieee80211_band band, enum ieee80211_band band,
struct ieee80211_vif *vif); struct ieee80211_vif *vif);
void iwl_set_rate(struct iwl_priv *priv);
/* uCode */ /* uCode */
int iwl_send_bt_env(struct iwl_priv *priv, u8 action, u8 type); int iwl_send_bt_env(struct iwl_priv *priv, u8 action, u8 type);
@@ -279,8 +280,8 @@ void iwlagn_bt_adjust_rssi_monitor(struct iwl_priv *priv, bool rssi_ena);
static inline bool iwl_advanced_bt_coexist(struct iwl_priv *priv) static inline bool iwl_advanced_bt_coexist(struct iwl_priv *priv)
{ {
return cfg(priv)->bt_params && return priv->cfg->bt_params &&
cfg(priv)->bt_params->advanced_bt_coexist; priv->cfg->bt_params->advanced_bt_coexist;
} }
#ifdef CONFIG_IWLWIFI_DEBUG #ifdef CONFIG_IWLWIFI_DEBUG
@@ -472,16 +473,29 @@ static inline void iwl_dvm_set_pmi(struct iwl_priv *priv, bool state)
set_bit(STATUS_POWER_PMI, &priv->status); set_bit(STATUS_POWER_PMI, &priv->status);
else else
clear_bit(STATUS_POWER_PMI, &priv->status); clear_bit(STATUS_POWER_PMI, &priv->status);
iwl_trans_set_pmi(trans(priv), state); iwl_trans_set_pmi(priv->trans, state);
} }
#ifdef CONFIG_IWLWIFI_DEBUGFS
int iwl_dbgfs_register(struct iwl_priv *priv, const char *name);
void iwl_dbgfs_unregister(struct iwl_priv *priv);
#else
static inline int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
{
return 0;
}
static inline void iwl_dbgfs_unregister(struct iwl_priv *priv)
{
}
#endif /* CONFIG_IWLWIFI_DEBUGFS */
#ifdef CONFIG_IWLWIFI_DEBUG #ifdef CONFIG_IWLWIFI_DEBUG
#define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \ #define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \
do { \ do { \
if (!iwl_is_rfkill((m))) \ if (!iwl_is_rfkill((m))) \
IWL_ERR(m, fmt, ##args); \ IWL_ERR(m, fmt, ##args); \
else \ else \
__iwl_err(trans(m)->dev, true, \ __iwl_err((m)->dev, true, \
!iwl_have_debug_level(IWL_DL_RADIO), \ !iwl_have_debug_level(IWL_DL_RADIO), \
fmt, ##args); \ fmt, ##args); \
} while (0) } while (0)
@@ -491,7 +505,7 @@ do { \
if (!iwl_is_rfkill((m))) \ if (!iwl_is_rfkill((m))) \
IWL_ERR(m, fmt, ##args); \ IWL_ERR(m, fmt, ##args); \
else \ else \
__iwl_err(trans(m)->dev, true, true, fmt, ##args); \ __iwl_err((m)->dev, true, true, fmt, ##args); \
} while (0) } while (0)
#endif /* CONFIG_IWLWIFI_DEBUG */ #endif /* CONFIG_IWLWIFI_DEBUG */

View File

@@ -101,6 +101,34 @@ enum iwl_led_mode {
IWL_LED_DISABLE, IWL_LED_DISABLE,
}; };
/*
* This is the threshold value of plcp error rate per 100mSecs. It is
* used to set and check for the validity of plcp_delta.
*/
#define IWL_MAX_PLCP_ERR_THRESHOLD_MIN 1
#define IWL_MAX_PLCP_ERR_THRESHOLD_DEF 50
#define IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF 100
#define IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF 200
#define IWL_MAX_PLCP_ERR_THRESHOLD_MAX 255
#define IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE 0
/* TX queue watchdog timeouts in mSecs */
#define IWL_WATCHHDOG_DISABLED 0
#define IWL_DEF_WD_TIMEOUT 2000
#define IWL_LONG_WD_TIMEOUT 10000
#define IWL_MAX_WD_TIMEOUT 120000
/* Antenna presence definitions */
#define ANT_NONE 0x0
#define ANT_A BIT(0)
#define ANT_B BIT(1)
#define ANT_C BIT(2)
#define ANT_AB (ANT_A | ANT_B)
#define ANT_AC (ANT_A | ANT_C)
#define ANT_BC (ANT_B | ANT_C)
#define ANT_ABC (ANT_A | ANT_B | ANT_C)
/* /*
* @max_ll_items: max number of OTP blocks * @max_ll_items: max number of OTP blocks
* @shadow_ram_support: shadow support for OTP memory * @shadow_ram_support: shadow support for OTP memory

View File

@@ -1,297 +0,0 @@
/******************************************************************************
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
* USA
*
* The full GNU General Public License is included in this distribution
* in the file called LICENSE.GPL.
*
* Contact Information:
* Intel Linux Wireless <ilw@linux.intel.com>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*****************************************************************************/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <net/mac80211.h>
#include "iwl-eeprom.h"
#include "iwl-debug.h"
#include "iwl-core.h"
#include "iwl-io.h"
#include "iwl-power.h"
#include "iwl-shared.h"
#include "iwl-agn.h"
#include "iwl-trans.h"
#ifdef CONFIG_IWLWIFI_DEBUGFS
#define IWL_TRAFFIC_DUMP_SIZE (IWL_TRAFFIC_ENTRY_SIZE * IWL_TRAFFIC_ENTRIES)
void iwl_reset_traffic_log(struct iwl_priv *priv)
{
priv->tx_traffic_idx = 0;
priv->rx_traffic_idx = 0;
if (priv->tx_traffic)
memset(priv->tx_traffic, 0, IWL_TRAFFIC_DUMP_SIZE);
if (priv->rx_traffic)
memset(priv->rx_traffic, 0, IWL_TRAFFIC_DUMP_SIZE);
}
int iwl_alloc_traffic_mem(struct iwl_priv *priv)
{
u32 traffic_size = IWL_TRAFFIC_DUMP_SIZE;
if (iwl_have_debug_level(IWL_DL_TX)) {
if (!priv->tx_traffic) {
priv->tx_traffic =
kzalloc(traffic_size, GFP_KERNEL);
if (!priv->tx_traffic)
return -ENOMEM;
}
}
if (iwl_have_debug_level(IWL_DL_RX)) {
if (!priv->rx_traffic) {
priv->rx_traffic =
kzalloc(traffic_size, GFP_KERNEL);
if (!priv->rx_traffic)
return -ENOMEM;
}
}
iwl_reset_traffic_log(priv);
return 0;
}
void iwl_free_traffic_mem(struct iwl_priv *priv)
{
kfree(priv->tx_traffic);
priv->tx_traffic = NULL;
kfree(priv->rx_traffic);
priv->rx_traffic = NULL;
}
void iwl_dbg_log_tx_data_frame(struct iwl_priv *priv,
u16 length, struct ieee80211_hdr *header)
{
__le16 fc;
u16 len;
if (likely(!iwl_have_debug_level(IWL_DL_TX)))
return;
if (!priv->tx_traffic)
return;
fc = header->frame_control;
if (ieee80211_is_data(fc)) {
len = (length > IWL_TRAFFIC_ENTRY_SIZE)
? IWL_TRAFFIC_ENTRY_SIZE : length;
memcpy((priv->tx_traffic +
(priv->tx_traffic_idx * IWL_TRAFFIC_ENTRY_SIZE)),
header, len);
priv->tx_traffic_idx =
(priv->tx_traffic_idx + 1) % IWL_TRAFFIC_ENTRIES;
}
}
void iwl_dbg_log_rx_data_frame(struct iwl_priv *priv,
u16 length, struct ieee80211_hdr *header)
{
__le16 fc;
u16 len;
if (likely(!iwl_have_debug_level(IWL_DL_RX)))
return;
if (!priv->rx_traffic)
return;
fc = header->frame_control;
if (ieee80211_is_data(fc)) {
len = (length > IWL_TRAFFIC_ENTRY_SIZE)
? IWL_TRAFFIC_ENTRY_SIZE : length;
memcpy((priv->rx_traffic +
(priv->rx_traffic_idx * IWL_TRAFFIC_ENTRY_SIZE)),
header, len);
priv->rx_traffic_idx =
(priv->rx_traffic_idx + 1) % IWL_TRAFFIC_ENTRIES;
}
}
const char *get_mgmt_string(int cmd)
{
#define IWL_CMD(x) case x: return #x
switch (cmd) {
IWL_CMD(MANAGEMENT_ASSOC_REQ);
IWL_CMD(MANAGEMENT_ASSOC_RESP);
IWL_CMD(MANAGEMENT_REASSOC_REQ);
IWL_CMD(MANAGEMENT_REASSOC_RESP);
IWL_CMD(MANAGEMENT_PROBE_REQ);
IWL_CMD(MANAGEMENT_PROBE_RESP);
IWL_CMD(MANAGEMENT_BEACON);
IWL_CMD(MANAGEMENT_ATIM);
IWL_CMD(MANAGEMENT_DISASSOC);
IWL_CMD(MANAGEMENT_AUTH);
IWL_CMD(MANAGEMENT_DEAUTH);
IWL_CMD(MANAGEMENT_ACTION);
default:
return "UNKNOWN";
}
#undef IWL_CMD
}
const char *get_ctrl_string(int cmd)
{
#define IWL_CMD(x) case x: return #x
switch (cmd) {
IWL_CMD(CONTROL_BACK_REQ);
IWL_CMD(CONTROL_BACK);
IWL_CMD(CONTROL_PSPOLL);
IWL_CMD(CONTROL_RTS);
IWL_CMD(CONTROL_CTS);
IWL_CMD(CONTROL_ACK);
IWL_CMD(CONTROL_CFEND);
IWL_CMD(CONTROL_CFENDACK);
default:
return "UNKNOWN";
}
#undef IWL_CMD
}
void iwl_clear_traffic_stats(struct iwl_priv *priv)
{
memset(&priv->tx_stats, 0, sizeof(struct traffic_stats));
memset(&priv->rx_stats, 0, sizeof(struct traffic_stats));
}
/*
* if CONFIG_IWLWIFI_DEBUGFS defined, iwl_update_stats function will
* record all the MGMT, CTRL and DATA pkt for both TX and Rx pass.
* Use debugFs to display the rx/rx_statistics
* if CONFIG_IWLWIFI_DEBUGFS not being defined, then no MGMT and CTRL
* information will be recorded, but DATA pkt still will be recorded
* for the reason of iwl_led.c need to control the led blinking based on
* number of tx and rx data.
*
*/
void iwl_update_stats(struct iwl_priv *priv, bool is_tx, __le16 fc, u16 len)
{
struct traffic_stats *stats;
if (is_tx)
stats = &priv->tx_stats;
else
stats = &priv->rx_stats;
if (ieee80211_is_mgmt(fc)) {
switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) {
case cpu_to_le16(IEEE80211_STYPE_ASSOC_REQ):
stats->mgmt[MANAGEMENT_ASSOC_REQ]++;
break;
case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
stats->mgmt[MANAGEMENT_ASSOC_RESP]++;
break;
case cpu_to_le16(IEEE80211_STYPE_REASSOC_REQ):
stats->mgmt[MANAGEMENT_REASSOC_REQ]++;
break;
case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
stats->mgmt[MANAGEMENT_REASSOC_RESP]++;
break;
case cpu_to_le16(IEEE80211_STYPE_PROBE_REQ):
stats->mgmt[MANAGEMENT_PROBE_REQ]++;
break;
case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
stats->mgmt[MANAGEMENT_PROBE_RESP]++;
break;
case cpu_to_le16(IEEE80211_STYPE_BEACON):
stats->mgmt[MANAGEMENT_BEACON]++;
break;
case cpu_to_le16(IEEE80211_STYPE_ATIM):
stats->mgmt[MANAGEMENT_ATIM]++;
break;
case cpu_to_le16(IEEE80211_STYPE_DISASSOC):
stats->mgmt[MANAGEMENT_DISASSOC]++;
break;
case cpu_to_le16(IEEE80211_STYPE_AUTH):
stats->mgmt[MANAGEMENT_AUTH]++;
break;
case cpu_to_le16(IEEE80211_STYPE_DEAUTH):
stats->mgmt[MANAGEMENT_DEAUTH]++;
break;
case cpu_to_le16(IEEE80211_STYPE_ACTION):
stats->mgmt[MANAGEMENT_ACTION]++;
break;
}
} else if (ieee80211_is_ctl(fc)) {
switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) {
case cpu_to_le16(IEEE80211_STYPE_BACK_REQ):
stats->ctrl[CONTROL_BACK_REQ]++;
break;
case cpu_to_le16(IEEE80211_STYPE_BACK):
stats->ctrl[CONTROL_BACK]++;
break;
case cpu_to_le16(IEEE80211_STYPE_PSPOLL):
stats->ctrl[CONTROL_PSPOLL]++;
break;
case cpu_to_le16(IEEE80211_STYPE_RTS):
stats->ctrl[CONTROL_RTS]++;
break;
case cpu_to_le16(IEEE80211_STYPE_CTS):
stats->ctrl[CONTROL_CTS]++;
break;
case cpu_to_le16(IEEE80211_STYPE_ACK):
stats->ctrl[CONTROL_ACK]++;
break;
case cpu_to_le16(IEEE80211_STYPE_CFEND):
stats->ctrl[CONTROL_CFEND]++;
break;
case cpu_to_le16(IEEE80211_STYPE_CFENDACK):
stats->ctrl[CONTROL_CFENDACK]++;
break;
}
} else {
/* data */
stats->data_cnt++;
stats->data_bytes += len;
}
}
#endif
int iwl_cmd_echo_test(struct iwl_priv *priv)
{
int ret;
struct iwl_host_cmd cmd = {
.id = REPLY_ECHO,
.len = { 0 },
.flags = CMD_SYNC,
};
ret = iwl_dvm_send_cmd(priv, &cmd);
if (ret)
IWL_ERR(priv, "echo testing fail: 0X%x\n", ret);
else
IWL_DEBUG_INFO(priv, "echo testing pass\n");
return ret;
}

View File

@@ -1,133 +0,0 @@
/******************************************************************************
*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
* USA
*
* The full GNU General Public License is included in this distribution
* in the file called LICENSE.GPL.
*
* Contact Information:
* Intel Linux Wireless <ilw@linux.intel.com>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*
* BSD LICENSE
*
* Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#ifndef __iwl_core_h__
#define __iwl_core_h__
#include "iwl-dev.h"
#include "iwl-io.h"
/************************
* forward declarations *
************************/
struct iwl_host_cmd;
struct iwl_cmd;
#define TIME_UNIT 1024
/***************************
* L i b *
***************************/
int iwl_cmd_echo_test(struct iwl_priv *priv);
#ifdef CONFIG_IWLWIFI_DEBUGFS
int iwl_alloc_traffic_mem(struct iwl_priv *priv);
void iwl_free_traffic_mem(struct iwl_priv *priv);
void iwl_dbg_log_tx_data_frame(struct iwl_priv *priv,
u16 length, struct ieee80211_hdr *header);
void iwl_dbg_log_rx_data_frame(struct iwl_priv *priv,
u16 length, struct ieee80211_hdr *header);
const char *get_mgmt_string(int cmd);
const char *get_ctrl_string(int cmd);
void iwl_clear_traffic_stats(struct iwl_priv *priv);
void iwl_update_stats(struct iwl_priv *priv, bool is_tx, __le16 fc,
u16 len);
void iwl_reset_traffic_log(struct iwl_priv *priv);
#else
static inline int iwl_alloc_traffic_mem(struct iwl_priv *priv)
{
return 0;
}
static inline void iwl_free_traffic_mem(struct iwl_priv *priv)
{
}
static inline void iwl_reset_traffic_log(struct iwl_priv *priv)
{
}
static inline void iwl_dbg_log_tx_data_frame(struct iwl_priv *priv,
u16 length, struct ieee80211_hdr *header)
{
}
static inline void iwl_dbg_log_rx_data_frame(struct iwl_priv *priv,
u16 length, struct ieee80211_hdr *header)
{
}
static inline void iwl_update_stats(struct iwl_priv *priv, bool is_tx,
__le16 fc, u16 len)
{
}
#endif
/*******************************************************************************
* Scanning
******************************************************************************/
/* traffic log definitions */
#define IWL_TRAFFIC_ENTRIES (256)
#define IWL_TRAFFIC_ENTRY_SIZE (64)
/*****************************************************
* S e n d i n g H o s t C o m m a n d s *
*****************************************************/
extern bool bt_siso_mode;
#endif /* __iwl_core_h__ */

View File

@@ -63,6 +63,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include "iwl-debug.h" #include "iwl-debug.h"
#include "iwl-devtrace.h"
#define __iwl_fn(fn) \ #define __iwl_fn(fn) \
void __iwl_ ##fn(struct device *dev, const char *fmt, ...) \ void __iwl_ ##fn(struct device *dev, const char *fmt, ...) \

View File

@@ -29,10 +29,13 @@
#ifndef __iwl_debug_h__ #ifndef __iwl_debug_h__
#define __iwl_debug_h__ #define __iwl_debug_h__
#include "iwl-shared.h" #include "iwl-modparams.h"
#include "iwl-devtrace.h"
struct iwl_priv;
static inline bool iwl_have_debug_level(u32 level)
{
return iwlwifi_mod_params.debug_level & level;
}
void __iwl_err(struct device *dev, bool rfkill_prefix, bool only_trace, void __iwl_err(struct device *dev, bool rfkill_prefix, bool only_trace,
const char *fmt, ...); const char *fmt, ...);
@@ -41,10 +44,10 @@ void __iwl_info(struct device *dev, const char *fmt, ...);
void __iwl_crit(struct device *dev, const char *fmt, ...); void __iwl_crit(struct device *dev, const char *fmt, ...);
/* No matter what is m (priv, bus, trans), this will work */ /* No matter what is m (priv, bus, trans), this will work */
#define IWL_ERR(m, f, a...) __iwl_err(trans(m)->dev, false, false, f, ## a) #define IWL_ERR(m, f, a...) __iwl_err((m)->dev, false, false, f, ## a)
#define IWL_WARN(m, f, a...) __iwl_warn(trans(m)->dev, f, ## a) #define IWL_WARN(m, f, a...) __iwl_warn((m)->dev, f, ## a)
#define IWL_INFO(m, f, a...) __iwl_info(trans(m)->dev, f, ## a) #define IWL_INFO(m, f, a...) __iwl_info((m)->dev, f, ## a)
#define IWL_CRIT(m, f, a...) __iwl_crit(trans(m)->dev, f, ## a) #define IWL_CRIT(m, f, a...) __iwl_crit((m)->dev, f, ## a)
#if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING) #if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING)
void __iwl_dbg(struct device *dev, void __iwl_dbg(struct device *dev,
@@ -65,9 +68,9 @@ do { \
} while (0) } while (0)
#define IWL_DEBUG(m, level, fmt, args...) \ #define IWL_DEBUG(m, level, fmt, args...) \
__iwl_dbg(trans(m)->dev, level, false, __func__, fmt, ##args) __iwl_dbg((m)->dev, level, false, __func__, fmt, ##args)
#define IWL_DEBUG_LIMIT(m, level, fmt, args...) \ #define IWL_DEBUG_LIMIT(m, level, fmt, args...) \
__iwl_dbg(trans(m)->dev, level, true, __func__, fmt, ##args) __iwl_dbg((m)->dev, level, true, __func__, fmt, ##args)
#ifdef CONFIG_IWLWIFI_DEBUG #ifdef CONFIG_IWLWIFI_DEBUG
#define iwl_print_hex_dump(m, level, p, len) \ #define iwl_print_hex_dump(m, level, p, len) \
@@ -80,19 +83,6 @@ do { \
#define iwl_print_hex_dump(m, level, p, len) #define iwl_print_hex_dump(m, level, p, len)
#endif /* CONFIG_IWLWIFI_DEBUG */ #endif /* CONFIG_IWLWIFI_DEBUG */
#ifdef CONFIG_IWLWIFI_DEBUGFS
int iwl_dbgfs_register(struct iwl_priv *priv, const char *name);
void iwl_dbgfs_unregister(struct iwl_priv *priv);
#else
static inline int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
{
return 0;
}
static inline void iwl_dbgfs_unregister(struct iwl_priv *priv)
{
}
#endif /* CONFIG_IWLWIFI_DEBUGFS */
/* /*
* To use the debug system: * To use the debug system:
* *

View File

@@ -37,9 +37,9 @@
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-debug.h" #include "iwl-debug.h"
#include "iwl-core.h"
#include "iwl-io.h" #include "iwl-io.h"
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-modparams.h"
/* create and remove of files */ /* create and remove of files */
#define DEBUGFS_ADD_FILE(name, parent, mode) do { \ #define DEBUGFS_ADD_FILE(name, parent, mode) do { \
@@ -111,105 +111,6 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
.llseek = generic_file_llseek, \ .llseek = generic_file_llseek, \
}; };
static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos) {
struct iwl_priv *priv = file->private_data;
char *buf;
int pos = 0;
int cnt;
ssize_t ret;
const size_t bufsz = 100 +
sizeof(char) * 50 * (MANAGEMENT_MAX + CONTROL_MAX);
buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf)
return -ENOMEM;
pos += scnprintf(buf + pos, bufsz - pos, "Management:\n");
for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) {
pos += scnprintf(buf + pos, bufsz - pos,
"\t%25s\t\t: %u\n",
get_mgmt_string(cnt),
priv->tx_stats.mgmt[cnt]);
}
pos += scnprintf(buf + pos, bufsz - pos, "Control\n");
for (cnt = 0; cnt < CONTROL_MAX; cnt++) {
pos += scnprintf(buf + pos, bufsz - pos,
"\t%25s\t\t: %u\n",
get_ctrl_string(cnt),
priv->tx_stats.ctrl[cnt]);
}
pos += scnprintf(buf + pos, bufsz - pos, "Data:\n");
pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n",
priv->tx_stats.data_cnt);
pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n",
priv->tx_stats.data_bytes);
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
kfree(buf);
return ret;
}
static ssize_t iwl_dbgfs_clear_traffic_statistics_write(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct iwl_priv *priv = file->private_data;
u32 clear_flag;
char buf[8];
int buf_size;
memset(buf, 0, sizeof(buf));
buf_size = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, buf_size))
return -EFAULT;
if (sscanf(buf, "%x", &clear_flag) != 1)
return -EFAULT;
iwl_clear_traffic_stats(priv);
return count;
}
static ssize_t iwl_dbgfs_rx_statistics_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos) {
struct iwl_priv *priv = file->private_data;
char *buf;
int pos = 0;
int cnt;
ssize_t ret;
const size_t bufsz = 100 +
sizeof(char) * 50 * (MANAGEMENT_MAX + CONTROL_MAX);
buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf)
return -ENOMEM;
pos += scnprintf(buf + pos, bufsz - pos, "Management:\n");
for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) {
pos += scnprintf(buf + pos, bufsz - pos,
"\t%25s\t\t: %u\n",
get_mgmt_string(cnt),
priv->rx_stats.mgmt[cnt]);
}
pos += scnprintf(buf + pos, bufsz - pos, "Control:\n");
for (cnt = 0; cnt < CONTROL_MAX; cnt++) {
pos += scnprintf(buf + pos, bufsz - pos,
"\t%25s\t\t: %u\n",
get_ctrl_string(cnt),
priv->rx_stats.ctrl[cnt]);
}
pos += scnprintf(buf + pos, bufsz - pos, "Data:\n");
pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n",
priv->rx_stats.data_cnt);
pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n",
priv->rx_stats.data_bytes);
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
kfree(buf);
return ret;
}
static ssize_t iwl_dbgfs_sram_read(struct file *file, static ssize_t iwl_dbgfs_sram_read(struct file *file,
char __user *user_buf, char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
@@ -230,10 +131,8 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file,
/* default is to dump the entire data segment */ /* default is to dump the entire data segment */
if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) {
priv->dbgfs_sram_offset = 0x800000; priv->dbgfs_sram_offset = 0x800000;
if (!priv->ucode_loaded) { if (!priv->ucode_loaded)
IWL_ERR(priv, "No uCode has been loadded.\n");
return -EINVAL; return -EINVAL;
}
img = &priv->fw->img[priv->cur_ucode]; img = &priv->fw->img[priv->cur_ucode];
priv->dbgfs_sram_len = img->sec[IWL_UCODE_SECTION_DATA].len; priv->dbgfs_sram_len = img->sec[IWL_UCODE_SECTION_DATA].len;
} }
@@ -259,7 +158,7 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file,
sram = priv->dbgfs_sram_offset & ~0x3; sram = priv->dbgfs_sram_offset & ~0x3;
/* read the first u32 from sram */ /* read the first u32 from sram */
val = iwl_read_targ_mem(trans(priv), sram); val = iwl_read_targ_mem(priv->trans, sram);
for (; len; len--) { for (; len; len--) {
/* put the address at the start of every line */ /* put the address at the start of every line */
@@ -278,7 +177,7 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file,
if (++offset == 4) { if (++offset == 4) {
sram += 4; sram += 4;
offset = 0; offset = 0;
val = iwl_read_targ_mem(trans(priv), sram); val = iwl_read_targ_mem(priv->trans, sram);
} }
/* put in extra spaces and split lines for human readability */ /* put in extra spaces and split lines for human readability */
@@ -408,26 +307,21 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file,
const u8 *ptr; const u8 *ptr;
char *buf; char *buf;
u16 eeprom_ver; u16 eeprom_ver;
size_t eeprom_len = cfg(priv)->base_params->eeprom_size; size_t eeprom_len = priv->cfg->base_params->eeprom_size;
buf_size = 4 * eeprom_len + 256; buf_size = 4 * eeprom_len + 256;
if (eeprom_len % 16) { if (eeprom_len % 16)
IWL_ERR(priv, "NVM size is not multiple of 16.\n");
return -ENODATA; return -ENODATA;
}
ptr = priv->eeprom; ptr = priv->eeprom;
if (!ptr) { if (!ptr)
IWL_ERR(priv, "Invalid EEPROM/OTP memory\n");
return -ENOMEM; return -ENOMEM;
}
/* 4 characters for byte 0xYY */ /* 4 characters for byte 0xYY */
buf = kzalloc(buf_size, GFP_KERNEL); buf = kzalloc(buf_size, GFP_KERNEL);
if (!buf) { if (!buf)
IWL_ERR(priv, "Can not allocate Buffer\n");
return -ENOMEM; return -ENOMEM;
}
eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION);
pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, " pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, "
"version: 0x%x\n", "version: 0x%x\n",
@@ -461,10 +355,8 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
return -EAGAIN; return -EAGAIN;
buf = kzalloc(bufsz, GFP_KERNEL); buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) { if (!buf)
IWL_ERR(priv, "Can not allocate Buffer\n");
return -ENOMEM; return -ENOMEM;
}
supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ); supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ);
if (supp_band) { if (supp_band) {
@@ -566,10 +458,8 @@ static ssize_t iwl_dbgfs_rx_handlers_read(struct file *file,
ssize_t ret; ssize_t ret;
buf = kzalloc(bufsz, GFP_KERNEL); buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) { if (!buf)
IWL_ERR(priv, "Can not allocate Buffer\n");
return -ENOMEM; return -ENOMEM;
}
for (cnt = 0; cnt < REPLY_MAX; cnt++) { for (cnt = 0; cnt < REPLY_MAX; cnt++) {
if (priv->rx_handlers_stats[cnt] > 0) if (priv->rx_handlers_stats[cnt] > 0)
@@ -683,11 +573,8 @@ static ssize_t iwl_dbgfs_disable_ht40_write(struct file *file,
return -EFAULT; return -EFAULT;
if (!iwl_is_any_associated(priv)) if (!iwl_is_any_associated(priv))
priv->disable_ht40 = ht40 ? true : false; priv->disable_ht40 = ht40 ? true : false;
else { else
IWL_ERR(priv, "Sta associated with AP - "
"Change to 40MHz channel support is not allowed\n");
return -EINVAL; return -EINVAL;
}
return count; return count;
} }
@@ -819,87 +706,6 @@ DEBUGFS_READ_FILE_OPS(temperature);
DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override); DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override);
DEBUGFS_READ_FILE_OPS(current_sleep_command); DEBUGFS_READ_FILE_OPS(current_sleep_command);
static ssize_t iwl_dbgfs_traffic_log_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{
struct iwl_priv *priv = file->private_data;
int pos = 0, ofs = 0;
int cnt = 0, entry;
char *buf;
int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) +
(cfg(priv)->base_params->num_of_queues * 32 * 8) + 400;
const u8 *ptr;
ssize_t ret;
buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) {
IWL_ERR(priv, "Can not allocate buffer\n");
return -ENOMEM;
}
if (priv->tx_traffic && iwl_have_debug_level(IWL_DL_TX)) {
ptr = priv->tx_traffic;
pos += scnprintf(buf + pos, bufsz - pos,
"Tx Traffic idx: %u\n", priv->tx_traffic_idx);
for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) {
for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16;
entry++, ofs += 16) {
pos += scnprintf(buf + pos, bufsz - pos,
"0x%.4x ", ofs);
hex_dump_to_buffer(ptr + ofs, 16, 16, 2,
buf + pos, bufsz - pos, 0);
pos += strlen(buf + pos);
if (bufsz - pos > 0)
buf[pos++] = '\n';
}
}
}
if (priv->rx_traffic && iwl_have_debug_level(IWL_DL_RX)) {
ptr = priv->rx_traffic;
pos += scnprintf(buf + pos, bufsz - pos,
"Rx Traffic idx: %u\n", priv->rx_traffic_idx);
for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) {
for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16;
entry++, ofs += 16) {
pos += scnprintf(buf + pos, bufsz - pos,
"0x%.4x ", ofs);
hex_dump_to_buffer(ptr + ofs, 16, 16, 2,
buf + pos, bufsz - pos, 0);
pos += strlen(buf + pos);
if (bufsz - pos > 0)
buf[pos++] = '\n';
}
}
}
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
kfree(buf);
return ret;
}
static ssize_t iwl_dbgfs_traffic_log_write(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct iwl_priv *priv = file->private_data;
char buf[8];
int buf_size;
int traffic_log;
memset(buf, 0, sizeof(buf));
buf_size = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, buf_size))
return -EFAULT;
if (sscanf(buf, "%d", &traffic_log) != 1)
return -EFAULT;
if (traffic_log == 0)
iwl_reset_traffic_log(priv);
return count;
}
static const char *fmt_value = " %-30s %10u\n"; static const char *fmt_value = " %-30s %10u\n";
static const char *fmt_hex = " %-30s 0x%02X\n"; static const char *fmt_hex = " %-30s 0x%02X\n";
static const char *fmt_table = " %-30s %10u %10u %10u %10u\n"; static const char *fmt_table = " %-30s %10u %10u %10u %10u\n";
@@ -950,10 +756,8 @@ static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file,
return -EAGAIN; return -EAGAIN;
buf = kzalloc(bufsz, GFP_KERNEL); buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) { if (!buf)
IWL_ERR(priv, "Can not allocate Buffer\n");
return -ENOMEM; return -ENOMEM;
}
/* /*
* the statistic information display here is based on * the statistic information display here is based on
@@ -1379,10 +1183,8 @@ static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
return -EAGAIN; return -EAGAIN;
buf = kzalloc(bufsz, GFP_KERNEL); buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) { if (!buf)
IWL_ERR(priv, "Can not allocate Buffer\n");
return -ENOMEM; return -ENOMEM;
}
/* the statistic information display here is based on /* the statistic information display here is based on
* the last statistics notification from uCode * the last statistics notification from uCode
@@ -1581,10 +1383,8 @@ static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
return -EAGAIN; return -EAGAIN;
buf = kzalloc(bufsz, GFP_KERNEL); buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) { if (!buf)
IWL_ERR(priv, "Can not allocate Buffer\n");
return -ENOMEM; return -ENOMEM;
}
/* the statistic information display here is based on /* the statistic information display here is based on
* the last statistics notification from uCode * the last statistics notification from uCode
@@ -1707,16 +1507,11 @@ static ssize_t iwl_dbgfs_ucode_bt_stats_read(struct file *file,
ret = iwl_send_statistics_request(priv, CMD_SYNC, false); ret = iwl_send_statistics_request(priv, CMD_SYNC, false);
mutex_unlock(&priv->mutex); mutex_unlock(&priv->mutex);
if (ret) { if (ret)
IWL_ERR(priv,
"Error sending statistics request: %zd\n", ret);
return -EAGAIN; return -EAGAIN;
}
buf = kzalloc(bufsz, GFP_KERNEL); buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) { if (!buf)
IWL_ERR(priv, "Can not allocate Buffer\n");
return -ENOMEM; return -ENOMEM;
}
/* /*
* the statistic information display here is based on * the statistic information display here is based on
@@ -1793,10 +1588,8 @@ static ssize_t iwl_dbgfs_reply_tx_error_read(struct file *file,
return -EAGAIN; return -EAGAIN;
buf = kzalloc(bufsz, GFP_KERNEL); buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) { if (!buf)
IWL_ERR(priv, "Can not allocate Buffer\n");
return -ENOMEM; return -ENOMEM;
}
pos += scnprintf(buf + pos, bufsz - pos, "Statistics_TX_Error:\n"); pos += scnprintf(buf + pos, bufsz - pos, "Statistics_TX_Error:\n");
pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t\t%u\n", pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t\t%u\n",
@@ -1936,10 +1729,8 @@ static ssize_t iwl_dbgfs_sensitivity_read(struct file *file,
data = &priv->sensitivity_data; data = &priv->sensitivity_data;
buf = kzalloc(bufsz, GFP_KERNEL); buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) { if (!buf)
IWL_ERR(priv, "Can not allocate Buffer\n");
return -ENOMEM; return -ENOMEM;
}
pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm:\t\t\t %u\n", pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm:\t\t\t %u\n",
data->auto_corr_ofdm); data->auto_corr_ofdm);
@@ -2017,10 +1808,8 @@ static ssize_t iwl_dbgfs_chain_noise_read(struct file *file,
data = &priv->chain_noise_data; data = &priv->chain_noise_data;
buf = kzalloc(bufsz, GFP_KERNEL); buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) { if (!buf)
IWL_ERR(priv, "Can not allocate Buffer\n");
return -ENOMEM; return -ENOMEM;
}
pos += scnprintf(buf + pos, bufsz - pos, "active_chains:\t\t\t %u\n", pos += scnprintf(buf + pos, bufsz - pos, "active_chains:\t\t\t %u\n",
data->active_chains); data->active_chains);
@@ -2071,7 +1860,7 @@ static ssize_t iwl_dbgfs_power_save_status_read(struct file *file,
const size_t bufsz = sizeof(buf); const size_t bufsz = sizeof(buf);
u32 pwrsave_status; u32 pwrsave_status;
pwrsave_status = iwl_read32(trans(priv), CSR_GP_CNTRL) & pwrsave_status = iwl_read32(priv->trans, CSR_GP_CNTRL) &
CSR_GP_REG_POWER_SAVE_STATUS_MSK; CSR_GP_REG_POWER_SAVE_STATUS_MSK;
pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: "); pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: ");
@@ -2380,7 +2169,7 @@ static ssize_t iwl_dbgfs_protection_mode_read(struct file *file,
char buf[40]; char buf[40];
const size_t bufsz = sizeof(buf); const size_t bufsz = sizeof(buf);
if (cfg(priv)->ht_params) if (priv->cfg->ht_params)
pos += scnprintf(buf + pos, bufsz - pos, pos += scnprintf(buf + pos, bufsz - pos,
"use %s for aggregation\n", "use %s for aggregation\n",
(priv->hw_params.use_rts_for_aggregation) ? (priv->hw_params.use_rts_for_aggregation) ?
@@ -2400,7 +2189,7 @@ static ssize_t iwl_dbgfs_protection_mode_write(struct file *file,
int buf_size; int buf_size;
int rts; int rts;
if (!cfg(priv)->ht_params) if (!priv->cfg->ht_params)
return -EINVAL; return -EINVAL;
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
@@ -2416,6 +2205,23 @@ static ssize_t iwl_dbgfs_protection_mode_write(struct file *file,
return count; return count;
} }
static int iwl_cmd_echo_test(struct iwl_priv *priv)
{
int ret;
struct iwl_host_cmd cmd = {
.id = REPLY_ECHO,
.len = { 0 },
.flags = CMD_SYNC,
};
ret = iwl_dvm_send_cmd(priv, &cmd);
if (ret)
IWL_ERR(priv, "echo testing fail: 0X%x\n", ret);
else
IWL_DEBUG_INFO(priv, "echo testing pass\n");
return ret;
}
static ssize_t iwl_dbgfs_echo_test_write(struct file *file, static ssize_t iwl_dbgfs_echo_test_write(struct file *file,
const char __user *user_buf, const char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
@@ -2499,9 +2305,27 @@ static ssize_t iwl_dbgfs_calib_disabled_read(struct file *file,
return simple_read_from_buffer(user_buf, count, ppos, buf, pos); return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
} }
DEBUGFS_READ_FILE_OPS(rx_statistics); static ssize_t iwl_dbgfs_calib_disabled_write(struct file *file,
DEBUGFS_READ_FILE_OPS(tx_statistics); const char __user *user_buf,
DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); size_t count, loff_t *ppos)
{
struct iwl_priv *priv = file->private_data;
char buf[8];
u32 calib_disabled;
int buf_size;
memset(buf, 0, sizeof(buf));
buf_size = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, buf_size))
return -EFAULT;
if (sscanf(buf, "%x", &calib_disabled) != 1)
return -EFAULT;
priv->calib_disabled = calib_disabled;
return count;
}
DEBUGFS_READ_FILE_OPS(ucode_rx_stats); DEBUGFS_READ_FILE_OPS(ucode_rx_stats);
DEBUGFS_READ_FILE_OPS(ucode_tx_stats); DEBUGFS_READ_FILE_OPS(ucode_tx_stats);
DEBUGFS_READ_FILE_OPS(ucode_general_stats); DEBUGFS_READ_FILE_OPS(ucode_general_stats);
@@ -2509,7 +2333,6 @@ DEBUGFS_READ_FILE_OPS(sensitivity);
DEBUGFS_READ_FILE_OPS(chain_noise); DEBUGFS_READ_FILE_OPS(chain_noise);
DEBUGFS_READ_FILE_OPS(power_save_status); DEBUGFS_READ_FILE_OPS(power_save_status);
DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics); DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics);
DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics);
DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing); DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing);
DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon);
DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta); DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta);
@@ -2523,7 +2346,7 @@ DEBUGFS_READ_WRITE_FILE_OPS(protection_mode);
DEBUGFS_READ_FILE_OPS(reply_tx_error); DEBUGFS_READ_FILE_OPS(reply_tx_error);
DEBUGFS_WRITE_FILE_OPS(echo_test); DEBUGFS_WRITE_FILE_OPS(echo_test);
DEBUGFS_READ_WRITE_FILE_OPS(log_event); DEBUGFS_READ_WRITE_FILE_OPS(log_event);
DEBUGFS_READ_FILE_OPS(calib_disabled); DEBUGFS_READ_WRITE_FILE_OPS(calib_disabled);
/* /*
* Create the debugfs files and directories * Create the debugfs files and directories
@@ -2564,12 +2387,8 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR); DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR);
DEBUGFS_ADD_FILE(temperature, dir_data, S_IRUSR); DEBUGFS_ADD_FILE(temperature, dir_data, S_IRUSR);
DEBUGFS_ADD_FILE(rx_statistics, dir_debug, S_IRUSR);
DEBUGFS_ADD_FILE(tx_statistics, dir_debug, S_IRUSR);
DEBUGFS_ADD_FILE(traffic_log, dir_debug, S_IWUSR | S_IRUSR);
DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR); DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR);
DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR); DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR);
DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR);
DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR);
DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR);
DEBUGFS_ADD_FILE(rf_reset, dir_debug, S_IWUSR | S_IRUSR); DEBUGFS_ADD_FILE(rf_reset, dir_debug, S_IWUSR | S_IRUSR);
@@ -2592,9 +2411,9 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR); DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR);
/* Calibrations disabled/enabled status*/ /* Calibrations disabled/enabled status*/
DEBUGFS_ADD_FILE(calib_disabled, dir_rf, S_IRUSR); DEBUGFS_ADD_FILE(calib_disabled, dir_rf, S_IWUSR | S_IRUSR);
if (iwl_trans_dbgfs_register(trans(priv), dir_debug)) if (iwl_trans_dbgfs_register(priv->trans, dir_debug))
goto err; goto err;
return 0; return 0;

View File

@@ -38,6 +38,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include "iwl-fw.h"
#include "iwl-eeprom.h" #include "iwl-eeprom.h"
#include "iwl-csr.h" #include "iwl-csr.h"
#include "iwl-debug.h" #include "iwl-debug.h"
@@ -47,7 +48,6 @@
#include "iwl-agn-rs.h" #include "iwl-agn-rs.h"
#include "iwl-agn-tt.h" #include "iwl-agn-tt.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-shared.h"
#include "iwl-op-mode.h" #include "iwl-op-mode.h"
#include "iwl-notif-wait.h" #include "iwl-notif-wait.h"
@@ -194,6 +194,7 @@ struct iwl_qos_info {
* These states relate to a specific RA / TID. * These states relate to a specific RA / TID.
* *
* @IWL_AGG_OFF: aggregation is not used * @IWL_AGG_OFF: aggregation is not used
* @IWL_AGG_STARTING: aggregation are starting (between start and oper)
* @IWL_AGG_ON: aggregation session is up * @IWL_AGG_ON: aggregation session is up
* @IWL_EMPTYING_HW_QUEUE_ADDBA: establishing a BA session - waiting for the * @IWL_EMPTYING_HW_QUEUE_ADDBA: establishing a BA session - waiting for the
* HW queue to be empty from packets for this RA /TID. * HW queue to be empty from packets for this RA /TID.
@@ -202,6 +203,7 @@ struct iwl_qos_info {
*/ */
enum iwl_agg_state { enum iwl_agg_state {
IWL_AGG_OFF = 0, IWL_AGG_OFF = 0,
IWL_AGG_STARTING,
IWL_AGG_ON, IWL_AGG_ON,
IWL_EMPTYING_HW_QUEUE_ADDBA, IWL_EMPTYING_HW_QUEUE_ADDBA,
IWL_EMPTYING_HW_QUEUE_DELBA, IWL_EMPTYING_HW_QUEUE_DELBA,
@@ -504,44 +506,6 @@ struct reply_agg_tx_error_statistics {
u32 unknown; u32 unknown;
}; };
/* management statistics */
enum iwl_mgmt_stats {
MANAGEMENT_ASSOC_REQ = 0,
MANAGEMENT_ASSOC_RESP,
MANAGEMENT_REASSOC_REQ,
MANAGEMENT_REASSOC_RESP,
MANAGEMENT_PROBE_REQ,
MANAGEMENT_PROBE_RESP,
MANAGEMENT_BEACON,
MANAGEMENT_ATIM,
MANAGEMENT_DISASSOC,
MANAGEMENT_AUTH,
MANAGEMENT_DEAUTH,
MANAGEMENT_ACTION,
MANAGEMENT_MAX,
};
/* control statistics */
enum iwl_ctrl_stats {
CONTROL_BACK_REQ = 0,
CONTROL_BACK,
CONTROL_PSPOLL,
CONTROL_RTS,
CONTROL_CTS,
CONTROL_ACK,
CONTROL_CFEND,
CONTROL_CFENDACK,
CONTROL_MAX,
};
struct traffic_stats {
#ifdef CONFIG_IWLWIFI_DEBUGFS
u32 mgmt[MANAGEMENT_MAX];
u32 ctrl[CONTROL_MAX];
u32 data_cnt;
u64 data_bytes;
#endif
};
/* /*
* schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds
* to perform continuous uCode event logging operation if enabled * to perform continuous uCode event logging operation if enabled
@@ -568,25 +532,8 @@ struct iwl_event_log {
int wraps_more_count; int wraps_more_count;
}; };
/*
* This is the threshold value of plcp error rate per 100mSecs. It is
* used to set and check for the validity of plcp_delta.
*/
#define IWL_MAX_PLCP_ERR_THRESHOLD_MIN (1)
#define IWL_MAX_PLCP_ERR_THRESHOLD_DEF (50)
#define IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF (100)
#define IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF (200)
#define IWL_MAX_PLCP_ERR_THRESHOLD_MAX (255)
#define IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE (0)
#define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3) #define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3)
/* TX queue watchdog timeouts in mSecs */
#define IWL_WATCHHDOG_DISABLED (0)
#define IWL_DEF_WD_TIMEOUT (2000)
#define IWL_LONG_WD_TIMEOUT (10000)
#define IWL_MAX_WD_TIMEOUT (120000)
/* BT Antenna Coupling Threshold (dB) */ /* BT Antenna Coupling Threshold (dB) */
#define IWL_BT_ANTENNA_COUPLING_THRESHOLD (35) #define IWL_BT_ANTENNA_COUPLING_THRESHOLD (35)
@@ -602,6 +549,13 @@ struct iwl_rf_reset {
unsigned long last_reset_jiffies; unsigned long last_reset_jiffies;
}; };
enum iwl_rxon_context_id {
IWL_RXON_CTX_BSS,
IWL_RXON_CTX_PAN,
NUM_IWL_RXON_CTX
};
/* extend beacon time format bit shifting */ /* extend beacon time format bit shifting */
/* /*
* for _agn devices * for _agn devices
@@ -742,12 +696,15 @@ struct iwl_wipan_noa_data {
}; };
/* Calibration disabling bit mask */ /* Calibration disabling bit mask */
#define IWL_SENSITIVITY_CALIB_DISABLED BIT(1) enum {
#define IWL_CHAIN_NOISE_CALIB_DISABLED BIT(2) IWL_CALIB_ENABLE_ALL = 0,
#define IWL_TX_POWER_CALIB_DISABLED BIT(3)
#define IWL_CALIB_ENABLE_ALL 0 IWL_SENSITIVITY_CALIB_DISABLED = BIT(0),
#define IWL_CALIB_DISABLE_ALL 0xFFFFFFFF IWL_CHAIN_NOISE_CALIB_DISABLED = BIT(1),
IWL_TX_POWER_CALIB_DISABLED = BIT(2),
IWL_CALIB_DISABLE_ALL = 0xFFFFFFFF,
};
#define IWL_OP_MODE_GET_DVM(_iwl_op_mode) \ #define IWL_OP_MODE_GET_DVM(_iwl_op_mode) \
((struct iwl_priv *) ((_iwl_op_mode)->op_mode_specific)) ((struct iwl_priv *) ((_iwl_op_mode)->op_mode_specific))
@@ -758,8 +715,9 @@ struct iwl_wipan_noa_data {
struct iwl_priv { struct iwl_priv {
/*data shared among all the driver's layers */ struct iwl_trans *trans;
struct iwl_shared *shrd; struct device *dev; /* for debug prints only */
const struct iwl_cfg *cfg;
const struct iwl_fw *fw; const struct iwl_fw *fw;
const struct iwl_lib_ops *lib; const struct iwl_lib_ops *lib;
unsigned long status; unsigned long status;
@@ -769,9 +727,9 @@ struct iwl_priv {
unsigned long transport_queue_stop; unsigned long transport_queue_stop;
bool passive_no_rx; bool passive_no_rx;
#define IWL_INVALID_AC 0xff #define IWL_INVALID_MAC80211_QUEUE 0xff
u8 queue_to_ac[IWL_MAX_HW_QUEUES]; u8 queue_to_mac80211[IWL_MAX_HW_QUEUES];
atomic_t ac_stop_count[IEEE80211_NUM_ACS]; atomic_t queue_stop_count[IWL_MAX_HW_QUEUES];
unsigned long agg_q_alloc[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)]; unsigned long agg_q_alloc[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)];
@@ -880,10 +838,6 @@ struct iwl_priv {
int activity_timer_active; int activity_timer_active;
/* counts mgmt, ctl, and data packets */
struct traffic_stats tx_stats;
struct traffic_stats rx_stats;
struct iwl_power_mgr power_data; struct iwl_power_mgr power_data;
struct iwl_tt_mgmt thermal_throttle; struct iwl_tt_mgmt thermal_throttle;
@@ -1003,10 +957,6 @@ struct iwl_priv {
#ifdef CONFIG_IWLWIFI_DEBUGFS #ifdef CONFIG_IWLWIFI_DEBUGFS
/* debugfs */ /* debugfs */
u16 tx_traffic_idx;
u16 rx_traffic_idx;
u8 *tx_traffic;
u8 *rx_traffic;
struct dentry *debugfs_dir; struct dentry *debugfs_dir;
u32 dbgfs_sram_offset, dbgfs_sram_len; u32 dbgfs_sram_offset, dbgfs_sram_len;
bool disable_ht40; bool disable_ht40;
@@ -1051,7 +1001,6 @@ struct iwl_priv {
}; /*iwl_priv */ }; /*iwl_priv */
extern struct kmem_cache *iwl_tx_cmd_pool; extern struct kmem_cache *iwl_tx_cmd_pool;
extern struct iwl_mod_params iwlagn_mod_params;
static inline struct iwl_rxon_context * static inline struct iwl_rxon_context *
iwl_rxon_ctx_from_vif(struct ieee80211_vif *vif) iwl_rxon_ctx_from_vif(struct ieee80211_vif *vif)

View File

@@ -67,9 +67,11 @@
#include "iwl-drv.h" #include "iwl-drv.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-shared.h"
#include "iwl-op-mode.h" #include "iwl-op-mode.h"
#include "iwl-agn-hw.h" #include "iwl-agn-hw.h"
#include "iwl-fw.h"
#include "iwl-config.h"
#include "iwl-modparams.h"
/* private includes */ /* private includes */
#include "iwl-fw-file.h" #include "iwl-fw-file.h"
@@ -77,8 +79,10 @@
/** /**
* struct iwl_drv - drv common data * struct iwl_drv - drv common data
* @fw: the iwl_fw structure * @fw: the iwl_fw structure
* @shrd: pointer to common shared structure
* @op_mode: the running op_mode * @op_mode: the running op_mode
* @trans: transport layer
* @dev: for debug prints only
* @cfg: configuration struct
* @fw_index: firmware revision to try loading * @fw_index: firmware revision to try loading
* @firmware_name: composite filename of ucode file to load * @firmware_name: composite filename of ucode file to load
* @request_firmware_complete: the firmware has been obtained from user space * @request_firmware_complete: the firmware has been obtained from user space
@@ -86,8 +90,10 @@
struct iwl_drv { struct iwl_drv {
struct iwl_fw fw; struct iwl_fw fw;
struct iwl_shared *shrd;
struct iwl_op_mode *op_mode; struct iwl_op_mode *op_mode;
struct iwl_trans *trans;
struct device *dev;
const struct iwl_cfg *cfg;
int fw_index; /* firmware we're trying to load */ int fw_index; /* firmware we're trying to load */
char firmware_name[25]; /* name of firmware file to load */ char firmware_name[25]; /* name of firmware file to load */
@@ -110,7 +116,7 @@ struct fw_sec {
static void iwl_free_fw_desc(struct iwl_drv *drv, struct fw_desc *desc) static void iwl_free_fw_desc(struct iwl_drv *drv, struct fw_desc *desc)
{ {
if (desc->v_addr) if (desc->v_addr)
dma_free_coherent(trans(drv)->dev, desc->len, dma_free_coherent(drv->trans->dev, desc->len,
desc->v_addr, desc->p_addr); desc->v_addr, desc->p_addr);
desc->v_addr = NULL; desc->v_addr = NULL;
desc->len = 0; desc->len = 0;
@@ -138,7 +144,7 @@ static int iwl_alloc_fw_desc(struct iwl_drv *drv, struct fw_desc *desc,
return -EINVAL; return -EINVAL;
} }
desc->v_addr = dma_alloc_coherent(trans(drv)->dev, sec->size, desc->v_addr = dma_alloc_coherent(drv->trans->dev, sec->size,
&desc->p_addr, GFP_KERNEL); &desc->p_addr, GFP_KERNEL);
if (!desc->v_addr) if (!desc->v_addr)
return -ENOMEM; return -ENOMEM;
@@ -156,8 +162,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context);
static int iwl_request_firmware(struct iwl_drv *drv, bool first) static int iwl_request_firmware(struct iwl_drv *drv, bool first)
{ {
const struct iwl_cfg *cfg = cfg(drv); const char *name_pre = drv->cfg->fw_name_pre;
const char *name_pre = cfg->fw_name_pre;
char tag[8]; char tag[8];
if (first) { if (first) {
@@ -166,14 +171,14 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first)
strcpy(tag, UCODE_EXPERIMENTAL_TAG); strcpy(tag, UCODE_EXPERIMENTAL_TAG);
} else if (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) { } else if (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) {
#endif #endif
drv->fw_index = cfg->ucode_api_max; drv->fw_index = drv->cfg->ucode_api_max;
sprintf(tag, "%d", drv->fw_index); sprintf(tag, "%d", drv->fw_index);
} else { } else {
drv->fw_index--; drv->fw_index--;
sprintf(tag, "%d", drv->fw_index); sprintf(tag, "%d", drv->fw_index);
} }
if (drv->fw_index < cfg->ucode_api_min) { if (drv->fw_index < drv->cfg->ucode_api_min) {
IWL_ERR(drv, "no suitable firmware found!\n"); IWL_ERR(drv, "no suitable firmware found!\n");
return -ENOENT; return -ENOENT;
} }
@@ -186,7 +191,7 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first)
drv->firmware_name); drv->firmware_name);
return request_firmware_nowait(THIS_MODULE, 1, drv->firmware_name, return request_firmware_nowait(THIS_MODULE, 1, drv->firmware_name,
trans(drv)->dev, drv->trans->dev,
GFP_KERNEL, drv, iwl_ucode_callback); GFP_KERNEL, drv, iwl_ucode_callback);
} }
@@ -725,14 +730,13 @@ static int validate_sec_sizes(struct iwl_drv *drv,
static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
{ {
struct iwl_drv *drv = context; struct iwl_drv *drv = context;
const struct iwl_cfg *cfg = cfg(drv);
struct iwl_fw *fw = &drv->fw; struct iwl_fw *fw = &drv->fw;
struct iwl_ucode_header *ucode; struct iwl_ucode_header *ucode;
int err; int err;
struct iwl_firmware_pieces pieces; struct iwl_firmware_pieces pieces;
const unsigned int api_max = cfg->ucode_api_max; const unsigned int api_max = drv->cfg->ucode_api_max;
unsigned int api_ok = cfg->ucode_api_ok; unsigned int api_ok = drv->cfg->ucode_api_ok;
const unsigned int api_min = cfg->ucode_api_min; const unsigned int api_min = drv->cfg->ucode_api_min;
u32 api_ver; u32 api_ver;
int i; int i;
@@ -811,7 +815,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
* In mvm uCode there is no difference between data and instructions * In mvm uCode there is no difference between data and instructions
* sections. * sections.
*/ */
if (!fw->mvm_fw && validate_sec_sizes(drv, &pieces, cfg)) if (!fw->mvm_fw && validate_sec_sizes(drv, &pieces, drv->cfg))
goto try_again; goto try_again;
/* Allocate ucode buffers for card's bus-master loading ... */ /* Allocate ucode buffers for card's bus-master loading ... */
@@ -835,14 +839,14 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
fw->init_evtlog_size = (pieces.init_evtlog_size - 16)/12; fw->init_evtlog_size = (pieces.init_evtlog_size - 16)/12;
else else
fw->init_evtlog_size = fw->init_evtlog_size =
cfg->base_params->max_event_log_size; drv->cfg->base_params->max_event_log_size;
fw->init_errlog_ptr = pieces.init_errlog_ptr; fw->init_errlog_ptr = pieces.init_errlog_ptr;
fw->inst_evtlog_ptr = pieces.inst_evtlog_ptr; fw->inst_evtlog_ptr = pieces.inst_evtlog_ptr;
if (pieces.inst_evtlog_size) if (pieces.inst_evtlog_size)
fw->inst_evtlog_size = (pieces.inst_evtlog_size - 16)/12; fw->inst_evtlog_size = (pieces.inst_evtlog_size - 16)/12;
else else
fw->inst_evtlog_size = fw->inst_evtlog_size =
cfg->base_params->max_event_log_size; drv->cfg->base_params->max_event_log_size;
fw->inst_errlog_ptr = pieces.inst_errlog_ptr; fw->inst_errlog_ptr = pieces.inst_errlog_ptr;
/* /*
@@ -858,7 +862,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
release_firmware(ucode_raw); release_firmware(ucode_raw);
complete(&drv->request_firmware_complete); complete(&drv->request_firmware_complete);
drv->op_mode = iwl_dvm_ops.start(drv->shrd->trans, &drv->fw); drv->op_mode = iwl_dvm_ops.start(drv->trans, drv->cfg, &drv->fw);
if (!drv->op_mode) if (!drv->op_mode)
goto out_unbind; goto out_unbind;
@@ -878,24 +882,23 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
release_firmware(ucode_raw); release_firmware(ucode_raw);
out_unbind: out_unbind:
complete(&drv->request_firmware_complete); complete(&drv->request_firmware_complete);
device_release_driver(trans(drv)->dev); device_release_driver(drv->trans->dev);
} }
int iwl_drv_start(struct iwl_shared *shrd, struct iwl_drv *iwl_drv_start(struct iwl_trans *trans,
struct iwl_trans *trans, const struct iwl_cfg *cfg) const struct iwl_cfg *cfg)
{ {
struct iwl_drv *drv; struct iwl_drv *drv;
int ret; int ret;
shrd->cfg = cfg;
drv = kzalloc(sizeof(*drv), GFP_KERNEL); drv = kzalloc(sizeof(*drv), GFP_KERNEL);
if (!drv) { if (!drv) {
dev_printk(KERN_ERR, trans->dev, "Couldn't allocate iwl_drv"); dev_printk(KERN_ERR, trans->dev, "Couldn't allocate iwl_drv");
return -ENOMEM; return NULL;
} }
drv->shrd = shrd; drv->trans = trans;
shrd->drv = drv; drv->dev = trans->dev;
drv->cfg = cfg;
init_completion(&drv->request_firmware_complete); init_completion(&drv->request_firmware_complete);
@@ -904,16 +907,14 @@ int iwl_drv_start(struct iwl_shared *shrd,
if (ret) { if (ret) {
dev_printk(KERN_ERR, trans->dev, "Couldn't request the fw"); dev_printk(KERN_ERR, trans->dev, "Couldn't request the fw");
kfree(drv); kfree(drv);
shrd->drv = NULL; drv = NULL;
} }
return ret; return drv;
} }
void iwl_drv_stop(struct iwl_shared *shrd) void iwl_drv_stop(struct iwl_drv *drv)
{ {
struct iwl_drv *drv = shrd->drv;
wait_for_completion(&drv->request_firmware_complete); wait_for_completion(&drv->request_firmware_complete);
/* op_mode can be NULL if its start failed */ /* op_mode can be NULL if its start failed */
@@ -923,5 +924,91 @@ void iwl_drv_stop(struct iwl_shared *shrd)
iwl_dealloc_ucode(drv); iwl_dealloc_ucode(drv);
kfree(drv); kfree(drv);
shrd->drv = NULL;
} }
/* shared module parameters */
struct iwl_mod_params iwlwifi_mod_params = {
.amsdu_size_8K = 1,
.restart_fw = 1,
.plcp_check = true,
.bt_coex_active = true,
.power_level = IWL_POWER_INDEX_1,
.bt_ch_announce = true,
.auto_agg = true,
/* the rest are 0 by default */
};
#ifdef CONFIG_IWLWIFI_DEBUG
module_param_named(debug, iwlwifi_mod_params.debug_level, uint,
S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(debug, "debug output mask");
#endif
module_param_named(swcrypto, iwlwifi_mod_params.sw_crypto, int, S_IRUGO);
MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])");
module_param_named(11n_disable, iwlwifi_mod_params.disable_11n, uint, S_IRUGO);
MODULE_PARM_DESC(11n_disable,
"disable 11n functionality, bitmap: 1: full, 2: agg TX, 4: agg RX");
module_param_named(amsdu_size_8K, iwlwifi_mod_params.amsdu_size_8K,
int, S_IRUGO);
MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size");
module_param_named(fw_restart, iwlwifi_mod_params.restart_fw, int, S_IRUGO);
MODULE_PARM_DESC(fw_restart, "restart firmware in case of error");
module_param_named(antenna_coupling, iwlwifi_mod_params.ant_coupling,
int, S_IRUGO);
MODULE_PARM_DESC(antenna_coupling,
"specify antenna coupling in dB (defualt: 0 dB)");
module_param_named(bt_ch_inhibition, iwlwifi_mod_params.bt_ch_announce,
bool, S_IRUGO);
MODULE_PARM_DESC(bt_ch_inhibition,
"Enable BT channel inhibition (default: enable)");
module_param_named(plcp_check, iwlwifi_mod_params.plcp_check, bool, S_IRUGO);
MODULE_PARM_DESC(plcp_check, "Check plcp health (default: 1 [enabled])");
module_param_named(wd_disable, iwlwifi_mod_params.wd_disable, int, S_IRUGO);
MODULE_PARM_DESC(wd_disable,
"Disable stuck queue watchdog timer 0=system default, "
"1=disable, 2=enable (default: 0)");
/*
* set bt_coex_active to true, uCode will do kill/defer
* every time the priority line is asserted (BT is sending signals on the
* priority line in the PCIx).
* set bt_coex_active to false, uCode will ignore the BT activity and
* perform the normal operation
*
* User might experience transmit issue on some platform due to WiFi/BT
* co-exist problem. The possible behaviors are:
* Able to scan and finding all the available AP
* Not able to associate with any AP
* On those platforms, WiFi communication can be restored by set
* "bt_coex_active" module parameter to "false"
*
* default: bt_coex_active = true (BT_COEX_ENABLE)
*/
module_param_named(bt_coex_active, iwlwifi_mod_params.bt_coex_active,
bool, S_IRUGO);
MODULE_PARM_DESC(bt_coex_active, "enable wifi/bt co-exist (default: enable)");
module_param_named(led_mode, iwlwifi_mod_params.led_mode, int, S_IRUGO);
MODULE_PARM_DESC(led_mode, "0=system default, "
"1=On(RF On)/Off(RF Off), 2=blinking, 3=Off (default: 0)");
module_param_named(power_save, iwlwifi_mod_params.power_save,
bool, S_IRUGO);
MODULE_PARM_DESC(power_save,
"enable WiFi power management (default: disable)");
module_param_named(power_level, iwlwifi_mod_params.power_level,
int, S_IRUGO);
MODULE_PARM_DESC(power_level,
"default power save level (range from 1 - 5, default: 1)");
module_param_named(auto_agg, iwlwifi_mod_params.auto_agg,
bool, S_IRUGO);
MODULE_PARM_DESC(auto_agg,
"enable agg w/o check traffic load (default: enable)");

View File

@@ -63,7 +63,12 @@
#ifndef __iwl_drv_h__ #ifndef __iwl_drv_h__
#define __iwl_drv_h__ #define __iwl_drv_h__
#include "iwl-shared.h" /* for all modules */
#define DRV_NAME "iwlwifi"
#define IWLWIFI_VERSION "in-tree:"
#define DRV_COPYRIGHT "Copyright(c) 2003-2012 Intel Corporation"
#define DRV_AUTHOR "<ilw@linux.intel.com>"
/** /**
* DOC: Driver system flows - drv component * DOC: Driver system flows - drv component
@@ -90,34 +95,32 @@
* 8) iwl_ucode_callback starts the wifi implementation to matches the fw * 8) iwl_ucode_callback starts the wifi implementation to matches the fw
*/ */
struct iwl_drv;
struct iwl_trans;
struct iwl_cfg;
/** /**
* iwl_drv_start - start the drv * iwl_drv_start - start the drv
* *
* @shrd: the shrd area
* @trans_ops: the ops of the transport * @trans_ops: the ops of the transport
* @cfg: device specific constants / virtual functions * @cfg: device specific constants / virtual functions
* *
* TODO: review the parameters given to this function
*
* starts the driver: fetches the firmware. This should be called by bus * starts the driver: fetches the firmware. This should be called by bus
* specific system flows implementations. For example, the bus specific probe * specific system flows implementations. For example, the bus specific probe
* function should do bus related operations only, and then call to this * function should do bus related operations only, and then call to this
* function. * function. It returns the driver object or %NULL if an error occured.
*/ */
int iwl_drv_start(struct iwl_shared *shrd, struct iwl_drv *iwl_drv_start(struct iwl_trans *trans,
struct iwl_trans *trans, const struct iwl_cfg *cfg); const struct iwl_cfg *cfg);
/** /**
* iwl_drv_stop - stop the drv * iwl_drv_stop - stop the drv
* *
* @shrd: the shrd area * @drv:
*
* TODO: review the parameters given to this function
* *
* Stop the driver. This should be called by bus specific system flows * Stop the driver. This should be called by bus specific system flows
* implementations. For example, the bus specific remove function should first * implementations. For example, the bus specific remove function should first
* call this function and then do the bus related operations only. * call this function and then do the bus related operations only.
*/ */
void iwl_drv_stop(struct iwl_shared *shrd); void iwl_drv_stop(struct iwl_drv *drv);
#endif /* __iwl_drv_h__ */ #endif /* __iwl_drv_h__ */

View File

@@ -68,9 +68,7 @@
#include <net/mac80211.h> #include <net/mac80211.h>
#include "iwl-commands.h"
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-core.h"
#include "iwl-debug.h" #include "iwl-debug.h"
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-eeprom.h" #include "iwl-eeprom.h"
@@ -189,7 +187,7 @@ static void iwl_eeprom_release_semaphore(struct iwl_trans *trans)
static int iwl_eeprom_verify_signature(struct iwl_priv *priv) static int iwl_eeprom_verify_signature(struct iwl_priv *priv)
{ {
u32 gp = iwl_read32(trans(priv), CSR_EEPROM_GP) & u32 gp = iwl_read32(priv->trans, CSR_EEPROM_GP) &
CSR_EEPROM_GP_VALID_MSK; CSR_EEPROM_GP_VALID_MSK;
int ret = 0; int ret = 0;
@@ -236,8 +234,8 @@ int iwl_eeprom_check_version(struct iwl_priv *priv)
eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION);
calib_ver = iwl_eeprom_calib_version(priv); calib_ver = iwl_eeprom_calib_version(priv);
if (eeprom_ver < cfg(priv)->eeprom_ver || if (eeprom_ver < priv->cfg->eeprom_ver ||
calib_ver < cfg(priv)->eeprom_calib_ver) calib_ver < priv->cfg->eeprom_calib_ver)
goto err; goto err;
IWL_INFO(priv, "device EEPROM VER=0x%x, CALIB=0x%x\n", IWL_INFO(priv, "device EEPROM VER=0x%x, CALIB=0x%x\n",
@@ -247,8 +245,8 @@ int iwl_eeprom_check_version(struct iwl_priv *priv)
err: err:
IWL_ERR(priv, "Unsupported (too old) EEPROM VER=0x%x < 0x%x " IWL_ERR(priv, "Unsupported (too old) EEPROM VER=0x%x < 0x%x "
"CALIB=0x%x < 0x%x\n", "CALIB=0x%x < 0x%x\n",
eeprom_ver, cfg(priv)->eeprom_ver, eeprom_ver, priv->cfg->eeprom_ver,
calib_ver, cfg(priv)->eeprom_calib_ver); calib_ver, priv->cfg->eeprom_calib_ver);
return -EINVAL; return -EINVAL;
} }
@@ -259,7 +257,7 @@ int iwl_eeprom_init_hw_params(struct iwl_priv *priv)
priv->hw_params.sku = iwl_eeprom_query16(priv, EEPROM_SKU_CAP); priv->hw_params.sku = iwl_eeprom_query16(priv, EEPROM_SKU_CAP);
if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE && if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE &&
!cfg(priv)->ht_params) { !priv->cfg->ht_params) {
IWL_ERR(priv, "Invalid 11n configuration\n"); IWL_ERR(priv, "Invalid 11n configuration\n");
return -EINVAL; return -EINVAL;
} }
@@ -277,10 +275,10 @@ int iwl_eeprom_init_hw_params(struct iwl_priv *priv)
priv->hw_params.valid_rx_ant = EEPROM_RF_CFG_RX_ANT_MSK(radio_cfg); priv->hw_params.valid_rx_ant = EEPROM_RF_CFG_RX_ANT_MSK(radio_cfg);
/* check overrides (some devices have wrong EEPROM) */ /* check overrides (some devices have wrong EEPROM) */
if (cfg(priv)->valid_tx_ant) if (priv->cfg->valid_tx_ant)
priv->hw_params.valid_tx_ant = cfg(priv)->valid_tx_ant; priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
if (cfg(priv)->valid_rx_ant) if (priv->cfg->valid_rx_ant)
priv->hw_params.valid_rx_ant = cfg(priv)->valid_rx_ant; priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
if (!priv->hw_params.valid_tx_ant || !priv->hw_params.valid_rx_ant) { if (!priv->hw_params.valid_tx_ant || !priv->hw_params.valid_rx_ant) {
IWL_ERR(priv, "Invalid chain (0x%X, 0x%X)\n", IWL_ERR(priv, "Invalid chain (0x%X, 0x%X)\n",
@@ -349,7 +347,7 @@ static u32 eeprom_indirect_address(struct iwl_priv *priv, u32 address)
const u8 *iwl_eeprom_query_addr(struct iwl_priv *priv, size_t offset) const u8 *iwl_eeprom_query_addr(struct iwl_priv *priv, size_t offset)
{ {
u32 address = eeprom_indirect_address(priv, offset); u32 address = eeprom_indirect_address(priv, offset);
BUG_ON(address >= cfg(priv)->base_params->eeprom_size); BUG_ON(address >= priv->cfg->base_params->eeprom_size);
return &priv->eeprom[address]; return &priv->eeprom[address];
} }
@@ -433,7 +431,7 @@ static int iwl_init_otp_access(struct iwl_trans *trans)
* CSR auto clock gate disable bit - * CSR auto clock gate disable bit -
* this is only applicable for HW with OTP shadow RAM * this is only applicable for HW with OTP shadow RAM
*/ */
if (cfg(trans)->base_params->shadow_ram_support) if (trans->cfg->base_params->shadow_ram_support)
iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
CSR_RESET_LINK_PWR_MGMT_DISABLED); CSR_RESET_LINK_PWR_MGMT_DISABLED);
} }
@@ -554,7 +552,7 @@ static int iwl_find_otp_image(struct iwl_trans *trans,
} }
/* more in the link list, continue */ /* more in the link list, continue */
usedblocks++; usedblocks++;
} while (usedblocks <= cfg(trans)->base_params->max_ll_items); } while (usedblocks <= trans->cfg->base_params->max_ll_items);
/* OTP has no valid blocks */ /* OTP has no valid blocks */
IWL_DEBUG_EEPROM(trans, "OTP has no valid blocks\n"); IWL_DEBUG_EEPROM(trans, "OTP has no valid blocks\n");
@@ -693,7 +691,7 @@ static void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv)
((txp->delta_20_in_40 & 0xf0) >> 4), ((txp->delta_20_in_40 & 0xf0) >> 4),
(txp->delta_20_in_40 & 0x0f)); (txp->delta_20_in_40 & 0x0f));
max_txp_avg = iwl_get_max_txpower_avg(cfg(priv), txp_array, idx, max_txp_avg = iwl_get_max_txpower_avg(priv->cfg, txp_array, idx,
&max_txp_avg_halfdbm); &max_txp_avg_halfdbm);
/* /*
@@ -719,18 +717,18 @@ static void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv)
int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev) int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
{ {
__le16 *e; __le16 *e;
u32 gp = iwl_read32(trans(priv), CSR_EEPROM_GP); u32 gp = iwl_read32(priv->trans, CSR_EEPROM_GP);
int sz; int sz;
int ret; int ret;
u16 addr; u16 addr;
u16 validblockaddr = 0; u16 validblockaddr = 0;
u16 cache_addr = 0; u16 cache_addr = 0;
priv->nvm_device_type = iwl_get_nvm_type(trans(priv), hw_rev); priv->nvm_device_type = iwl_get_nvm_type(priv->trans, hw_rev);
if (priv->nvm_device_type == -ENOENT) if (priv->nvm_device_type == -ENOENT)
return -ENOENT; return -ENOENT;
/* allocate eeprom */ /* allocate eeprom */
sz = cfg(priv)->base_params->eeprom_size; sz = priv->cfg->base_params->eeprom_size;
IWL_DEBUG_EEPROM(priv, "NVM size = %d\n", sz); IWL_DEBUG_EEPROM(priv, "NVM size = %d\n", sz);
priv->eeprom = kzalloc(sz, GFP_KERNEL); priv->eeprom = kzalloc(sz, GFP_KERNEL);
if (!priv->eeprom) { if (!priv->eeprom) {
@@ -747,7 +745,7 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
} }
/* Make sure driver (instead of uCode) is allowed to read EEPROM */ /* Make sure driver (instead of uCode) is allowed to read EEPROM */
ret = iwl_eeprom_acquire_semaphore(trans(priv)); ret = iwl_eeprom_acquire_semaphore(priv->trans);
if (ret < 0) { if (ret < 0) {
IWL_ERR(priv, "Failed to acquire EEPROM semaphore.\n"); IWL_ERR(priv, "Failed to acquire EEPROM semaphore.\n");
ret = -ENOENT; ret = -ENOENT;
@@ -756,22 +754,22 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) { if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) {
ret = iwl_init_otp_access(trans(priv)); ret = iwl_init_otp_access(priv->trans);
if (ret) { if (ret) {
IWL_ERR(priv, "Failed to initialize OTP access.\n"); IWL_ERR(priv, "Failed to initialize OTP access.\n");
ret = -ENOENT; ret = -ENOENT;
goto done; goto done;
} }
iwl_write32(trans(priv), CSR_EEPROM_GP, iwl_write32(priv->trans, CSR_EEPROM_GP,
iwl_read32(trans(priv), CSR_EEPROM_GP) & iwl_read32(priv->trans, CSR_EEPROM_GP) &
~CSR_EEPROM_GP_IF_OWNER_MSK); ~CSR_EEPROM_GP_IF_OWNER_MSK);
iwl_set_bit(trans(priv), CSR_OTP_GP_REG, iwl_set_bit(priv->trans, CSR_OTP_GP_REG,
CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK | CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK |
CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK); CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK);
/* traversing the linked list if no shadow ram supported */ /* traversing the linked list if no shadow ram supported */
if (!cfg(priv)->base_params->shadow_ram_support) { if (!priv->cfg->base_params->shadow_ram_support) {
if (iwl_find_otp_image(trans(priv), &validblockaddr)) { if (iwl_find_otp_image(priv->trans, &validblockaddr)) {
ret = -ENOENT; ret = -ENOENT;
goto done; goto done;
} }
@@ -780,7 +778,7 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
addr += sizeof(u16)) { addr += sizeof(u16)) {
__le16 eeprom_data; __le16 eeprom_data;
ret = iwl_read_otp_word(trans(priv), addr, ret = iwl_read_otp_word(priv->trans, addr,
&eeprom_data); &eeprom_data);
if (ret) if (ret)
goto done; goto done;
@@ -792,10 +790,10 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
for (addr = 0; addr < sz; addr += sizeof(u16)) { for (addr = 0; addr < sz; addr += sizeof(u16)) {
u32 r; u32 r;
iwl_write32(trans(priv), CSR_EEPROM_REG, iwl_write32(priv->trans, CSR_EEPROM_REG,
CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); CSR_EEPROM_REG_MSK_ADDR & (addr << 1));
ret = iwl_poll_bit(trans(priv), CSR_EEPROM_REG, ret = iwl_poll_bit(priv->trans, CSR_EEPROM_REG,
CSR_EEPROM_REG_READ_VALID_MSK, CSR_EEPROM_REG_READ_VALID_MSK,
CSR_EEPROM_REG_READ_VALID_MSK, CSR_EEPROM_REG_READ_VALID_MSK,
IWL_EEPROM_ACCESS_TIMEOUT); IWL_EEPROM_ACCESS_TIMEOUT);
@@ -804,7 +802,7 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
"Time out reading EEPROM[%d]\n", addr); "Time out reading EEPROM[%d]\n", addr);
goto done; goto done;
} }
r = iwl_read32(trans(priv), CSR_EEPROM_REG); r = iwl_read32(priv->trans, CSR_EEPROM_REG);
e[addr / 2] = cpu_to_le16(r >> 16); e[addr / 2] = cpu_to_le16(r >> 16);
} }
} }
@@ -816,7 +814,7 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
ret = 0; ret = 0;
done: done:
iwl_eeprom_release_semaphore(trans(priv)); iwl_eeprom_release_semaphore(priv->trans);
err: err:
if (ret) if (ret)
@@ -1132,7 +1130,7 @@ void iwl_rf_config(struct iwl_priv *priv)
/* write radio config values to register */ /* write radio config values to register */
if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX) { if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX) {
iwl_set_bit(trans(priv), CSR_HW_IF_CONFIG_REG, iwl_set_bit(priv->trans, CSR_HW_IF_CONFIG_REG,
EEPROM_RF_CFG_TYPE_MSK(radio_cfg) | EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
EEPROM_RF_CFG_STEP_MSK(radio_cfg) | EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
EEPROM_RF_CFG_DASH_MSK(radio_cfg)); EEPROM_RF_CFG_DASH_MSK(radio_cfg));
@@ -1144,7 +1142,7 @@ void iwl_rf_config(struct iwl_priv *priv)
WARN_ON(1); WARN_ON(1);
/* set CSR_HW_CONFIG_REG for uCode use */ /* set CSR_HW_CONFIG_REG for uCode use */
iwl_set_bit(trans(priv), CSR_HW_IF_CONFIG_REG, iwl_set_bit(priv->trans, 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);
} }

View File

@@ -206,59 +206,6 @@ struct iwl_eeprom_calib_hdr {
/* 6000 regulatory - indirect access */ /* 6000 regulatory - indirect access */
#define EEPROM_6000_REG_BAND_24_HT40_CHANNELS ((0x80)\ #define EEPROM_6000_REG_BAND_24_HT40_CHANNELS ((0x80)\
| INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 14 bytes */ | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 14 bytes */
/* 5000 Specific */
#define EEPROM_5000_TX_POWER_VERSION (4)
#define EEPROM_5000_EEPROM_VERSION (0x11A)
/* 5050 Specific */
#define EEPROM_5050_TX_POWER_VERSION (4)
#define EEPROM_5050_EEPROM_VERSION (0x21E)
/* 1000 Specific */
#define EEPROM_1000_TX_POWER_VERSION (4)
#define EEPROM_1000_EEPROM_VERSION (0x15C)
/* 6x00 Specific */
#define EEPROM_6000_TX_POWER_VERSION (4)
#define EEPROM_6000_EEPROM_VERSION (0x423)
/* 6x50 Specific */
#define EEPROM_6050_TX_POWER_VERSION (4)
#define EEPROM_6050_EEPROM_VERSION (0x532)
/* 6150 Specific */
#define EEPROM_6150_TX_POWER_VERSION (6)
#define EEPROM_6150_EEPROM_VERSION (0x553)
/* 6x05 Specific */
#define EEPROM_6005_TX_POWER_VERSION (6)
#define EEPROM_6005_EEPROM_VERSION (0x709)
/* 6x30 Specific */
#define EEPROM_6030_TX_POWER_VERSION (6)
#define EEPROM_6030_EEPROM_VERSION (0x709)
/* 2x00 Specific */
#define EEPROM_2000_TX_POWER_VERSION (6)
#define EEPROM_2000_EEPROM_VERSION (0x805)
/* 6x35 Specific */
#define EEPROM_6035_TX_POWER_VERSION (6)
#define EEPROM_6035_EEPROM_VERSION (0x753)
/* OTP */
/* lower blocks contain EEPROM image and calibration data */
#define OTP_LOW_IMAGE_SIZE (2 * 512 * sizeof(u16)) /* 2 KB */
/* high blocks contain PAPD data */
#define OTP_HIGH_IMAGE_SIZE_6x00 (6 * 512 * sizeof(u16)) /* 6 KB */
#define OTP_HIGH_IMAGE_SIZE_1000 (0x200 * sizeof(u16)) /* 1024 bytes */
#define OTP_MAX_LL_ITEMS_1000 (3) /* OTP blocks for 1000 */
#define OTP_MAX_LL_ITEMS_6x00 (4) /* OTP blocks for 6x00 */
#define OTP_MAX_LL_ITEMS_6x50 (7) /* OTP blocks for 6x50 */
#define OTP_MAX_LL_ITEMS_2x00 (4) /* OTP blocks for 2x00 */
/* 2.4 GHz */ /* 2.4 GHz */
extern const u8 iwl_eeprom_band_1[14]; extern const u8 iwl_eeprom_band_1[14];

View File

@@ -63,6 +63,7 @@
#ifndef __iwl_fw_h__ #ifndef __iwl_fw_h__
#define __iwl_fw_h__ #define __iwl_fw_h__
#include <linux/types.h> #include <linux/types.h>
#include <net/mac80211.h>
/** /**
* enum iwl_ucode_tlv_flag - ucode API flags * enum iwl_ucode_tlv_flag - ucode API flags

View File

@@ -30,7 +30,6 @@
#define __iwl_io_h__ #define __iwl_io_h__
#include "iwl-devtrace.h" #include "iwl-devtrace.h"
#include "iwl-shared.h"
#include "iwl-trans.h" #include "iwl-trans.h"
static inline void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val) static inline void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val)

View File

@@ -36,11 +36,10 @@
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-core.h"
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-io.h" #include "iwl-io.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-shared.h" #include "iwl-modparams.h"
/* Throughput OFF time(ms) ON time (ms) /* Throughput OFF time(ms) ON time (ms)
* >300 25 25 * >300 25 25
@@ -71,7 +70,7 @@ static const struct ieee80211_tpt_blink iwl_blink[] = {
/* Set led register off */ /* Set led register off */
void iwlagn_led_enable(struct iwl_priv *priv) void iwlagn_led_enable(struct iwl_priv *priv)
{ {
iwl_write32(trans(priv), CSR_LED_REG, CSR_LED_REG_TRUN_ON); iwl_write32(priv->trans, CSR_LED_REG, CSR_LED_REG_TRUN_ON);
} }
/* /*
@@ -107,9 +106,9 @@ static int iwl_send_led_cmd(struct iwl_priv *priv, struct iwl_led_cmd *led_cmd)
}; };
u32 reg; u32 reg;
reg = iwl_read32(trans(priv), CSR_LED_REG); reg = iwl_read32(priv->trans, CSR_LED_REG);
if (reg != (reg & CSR_LED_BSM_CTRL_MSK)) if (reg != (reg & CSR_LED_BSM_CTRL_MSK))
iwl_write32(trans(priv), CSR_LED_REG, iwl_write32(priv->trans, CSR_LED_REG,
reg & CSR_LED_BSM_CTRL_MSK); reg & CSR_LED_BSM_CTRL_MSK);
return iwl_dvm_send_cmd(priv, &cmd); return iwl_dvm_send_cmd(priv, &cmd);
@@ -138,11 +137,11 @@ static int iwl_led_cmd(struct iwl_priv *priv,
} }
IWL_DEBUG_LED(priv, "Led blink time compensation=%u\n", IWL_DEBUG_LED(priv, "Led blink time compensation=%u\n",
cfg(priv)->base_params->led_compensation); priv->cfg->base_params->led_compensation);
led_cmd.on = iwl_blink_compensation(priv, on, led_cmd.on = iwl_blink_compensation(priv, on,
cfg(priv)->base_params->led_compensation); priv->cfg->base_params->led_compensation);
led_cmd.off = iwl_blink_compensation(priv, off, led_cmd.off = iwl_blink_compensation(priv, off,
cfg(priv)->base_params->led_compensation); priv->cfg->base_params->led_compensation);
ret = iwl_send_led_cmd(priv, &led_cmd); ret = iwl_send_led_cmd(priv, &led_cmd);
if (!ret) { if (!ret) {
@@ -175,7 +174,7 @@ static int iwl_led_blink_set(struct led_classdev *led_cdev,
void iwl_leds_init(struct iwl_priv *priv) void iwl_leds_init(struct iwl_priv *priv)
{ {
int mode = iwlagn_mod_params.led_mode; int mode = iwlwifi_mod_params.led_mode;
int ret; int ret;
if (mode == IWL_LED_DISABLE) { if (mode == IWL_LED_DISABLE) {
@@ -183,7 +182,7 @@ void iwl_leds_init(struct iwl_priv *priv)
return; return;
} }
if (mode == IWL_LED_DEFAULT) if (mode == IWL_LED_DEFAULT)
mode = cfg(priv)->led_mode; mode = priv->cfg->led_mode;
priv->led.name = kasprintf(GFP_KERNEL, "%s-led", priv->led.name = kasprintf(GFP_KERNEL, "%s-led",
wiphy_name(priv->hw->wiphy)); wiphy_name(priv->hw->wiphy));
@@ -207,7 +206,7 @@ void iwl_leds_init(struct iwl_priv *priv)
break; break;
} }
ret = led_classdev_register(trans(priv)->dev, &priv->led); ret = led_classdev_register(priv->trans->dev, &priv->led);
if (ret) { if (ret) {
kfree(priv->led.name); kfree(priv->led.name);
return; return;

View File

@@ -44,13 +44,12 @@
#include "iwl-eeprom.h" #include "iwl-eeprom.h"
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-core.h"
#include "iwl-io.h" #include "iwl-io.h"
#include "iwl-agn-calib.h" #include "iwl-agn-calib.h"
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-shared.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-op-mode.h" #include "iwl-op-mode.h"
#include "iwl-modparams.h"
/***************************************************************************** /*****************************************************************************
* *
@@ -147,7 +146,13 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
IEEE80211_HW_AMPDU_AGGREGATION | IEEE80211_HW_AMPDU_AGGREGATION |
IEEE80211_HW_NEED_DTIM_PERIOD | IEEE80211_HW_NEED_DTIM_PERIOD |
IEEE80211_HW_SPECTRUM_MGMT | IEEE80211_HW_SPECTRUM_MGMT |
IEEE80211_HW_REPORTS_TX_ACK_STATUS; IEEE80211_HW_REPORTS_TX_ACK_STATUS |
IEEE80211_HW_QUEUE_CONTROL |
IEEE80211_HW_SUPPORTS_PS |
IEEE80211_HW_SUPPORTS_DYNAMIC_PS |
IEEE80211_HW_SCAN_WHILE_IDLE;
hw->offchannel_tx_hw_queue = IWL_AUX_QUEUE;
/* /*
* Including the following line will crash some AP's. This * Including the following line will crash some AP's. This
@@ -156,10 +161,6 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
hw->max_tx_aggregation_subframes = LINK_QUAL_AGG_FRAME_LIMIT_DEF; hw->max_tx_aggregation_subframes = LINK_QUAL_AGG_FRAME_LIMIT_DEF;
*/ */
hw->flags |= IEEE80211_HW_SUPPORTS_PS |
IEEE80211_HW_SUPPORTS_DYNAMIC_PS |
IEEE80211_HW_SCAN_WHILE_IDLE;
if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE) if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE)
hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS |
IEEE80211_HW_SUPPORTS_STATIC_SMPS; IEEE80211_HW_SUPPORTS_STATIC_SMPS;
@@ -198,13 +199,13 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
WIPHY_FLAG_IBSS_RSN; WIPHY_FLAG_IBSS_RSN;
if (priv->fw->img[IWL_UCODE_WOWLAN].sec[0].len && if (priv->fw->img[IWL_UCODE_WOWLAN].sec[0].len &&
trans(priv)->ops->wowlan_suspend && priv->trans->ops->wowlan_suspend &&
device_can_wakeup(trans(priv)->dev)) { device_can_wakeup(priv->trans->dev)) {
hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT | hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT |
WIPHY_WOWLAN_DISCONNECT | WIPHY_WOWLAN_DISCONNECT |
WIPHY_WOWLAN_EAP_IDENTITY_REQ | WIPHY_WOWLAN_EAP_IDENTITY_REQ |
WIPHY_WOWLAN_RFKILL_RELEASE; WIPHY_WOWLAN_RFKILL_RELEASE;
if (!iwlagn_mod_params.sw_crypto) if (!iwlwifi_mod_params.sw_crypto)
hw->wiphy->wowlan.flags |= hw->wiphy->wowlan.flags |=
WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | WIPHY_WOWLAN_SUPPORTS_GTK_REKEY |
WIPHY_WOWLAN_GTK_REKEY_FAILURE; WIPHY_WOWLAN_GTK_REKEY_FAILURE;
@@ -216,7 +217,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
IWLAGN_WOWLAN_MAX_PATTERN_LEN; IWLAGN_WOWLAN_MAX_PATTERN_LEN;
} }
if (iwlagn_mod_params.power_save) if (iwlwifi_mod_params.power_save)
hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;
else else
hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
@@ -225,8 +226,11 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
/* we create the 802.11 header and a zero-length SSID element */ /* we create the 802.11 header and a zero-length SSID element */
hw->wiphy->max_scan_ie_len = capa->max_probe_length - 24 - 2; hw->wiphy->max_scan_ie_len = capa->max_probe_length - 24 - 2;
/* Default value; 4 EDCA QOS priorities */ /*
hw->queues = 4; * We don't use all queues: 4 and 9 are unused and any
* aggregation queue gets mapped down to the AC queue.
*/
hw->queues = IWLAGN_FIRST_AMPDU_QUEUE;
hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL; hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL;
@@ -237,7 +241,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
&priv->bands[IEEE80211_BAND_5GHZ]; &priv->bands[IEEE80211_BAND_5GHZ];
hw->wiphy->hw_version = trans(priv)->hw_id; hw->wiphy->hw_version = priv->trans->hw_id;
iwl_leds_init(priv); iwl_leds_init(priv);
@@ -356,7 +360,7 @@ void iwlagn_mac_stop(struct ieee80211_hw *hw)
* even if interface is down, trans->down will leave the RF * even if interface is down, trans->down will leave the RF
* kill interrupt enabled * kill interrupt enabled
*/ */
iwl_trans_stop_hw(trans(priv)); iwl_trans_stop_hw(priv->trans, false);
IWL_DEBUG_MAC80211(priv, "leave\n"); IWL_DEBUG_MAC80211(priv, "leave\n");
} }
@@ -367,7 +371,7 @@ void iwlagn_mac_set_rekey_data(struct ieee80211_hw *hw,
{ {
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
if (iwlagn_mod_params.sw_crypto) if (iwlwifi_mod_params.sw_crypto)
return; return;
IWL_DEBUG_MAC80211(priv, "enter\n"); IWL_DEBUG_MAC80211(priv, "enter\n");
@@ -412,9 +416,9 @@ int iwlagn_mac_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
if (ret) if (ret)
goto error; goto error;
device_set_wakeup_enable(trans(priv)->dev, true); device_set_wakeup_enable(priv->trans->dev, true);
iwl_trans_wowlan_suspend(trans(priv)); iwl_trans_wowlan_suspend(priv->trans);
goto out; goto out;
@@ -441,19 +445,19 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw)
IWL_DEBUG_MAC80211(priv, "enter\n"); IWL_DEBUG_MAC80211(priv, "enter\n");
mutex_lock(&priv->mutex); mutex_lock(&priv->mutex);
iwl_write32(trans(priv), CSR_UCODE_DRV_GP1_CLR, iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_CLR,
CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE); CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE);
base = priv->device_pointers.error_event_table; base = priv->device_pointers.error_event_table;
if (iwlagn_hw_valid_rtc_data_addr(base)) { if (iwlagn_hw_valid_rtc_data_addr(base)) {
spin_lock_irqsave(&trans(priv)->reg_lock, flags); spin_lock_irqsave(&priv->trans->reg_lock, flags);
ret = iwl_grab_nic_access_silent(trans(priv)); ret = iwl_grab_nic_access_silent(priv->trans);
if (likely(ret == 0)) { if (likely(ret == 0)) {
iwl_write32(trans(priv), HBUS_TARG_MEM_RADDR, base); iwl_write32(priv->trans, HBUS_TARG_MEM_RADDR, base);
status = iwl_read32(trans(priv), HBUS_TARG_MEM_RDAT); status = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT);
iwl_release_nic_access(trans(priv)); iwl_release_nic_access(priv->trans);
} }
spin_unlock_irqrestore(&trans(priv)->reg_lock, flags); spin_unlock_irqrestore(&priv->trans->reg_lock, flags);
#ifdef CONFIG_IWLWIFI_DEBUGFS #ifdef CONFIG_IWLWIFI_DEBUGFS
if (ret == 0) { if (ret == 0) {
@@ -468,7 +472,7 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw)
if (priv->wowlan_sram) if (priv->wowlan_sram)
_iwl_read_targ_mem_words( _iwl_read_targ_mem_words(
trans(priv), 0x800000, priv->trans, 0x800000,
priv->wowlan_sram, priv->wowlan_sram,
img->sec[IWL_UCODE_SECTION_DATA].len / 4); img->sec[IWL_UCODE_SECTION_DATA].len / 4);
} }
@@ -480,7 +484,7 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw)
priv->wowlan = false; priv->wowlan = false;
device_set_wakeup_enable(trans(priv)->dev, false); device_set_wakeup_enable(priv->trans->dev, false);
iwlagn_prepare_restart(priv); iwlagn_prepare_restart(priv);
@@ -533,7 +537,7 @@ int iwlagn_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
IWL_DEBUG_MAC80211(priv, "enter\n"); IWL_DEBUG_MAC80211(priv, "enter\n");
if (iwlagn_mod_params.sw_crypto) { if (iwlwifi_mod_params.sw_crypto) {
IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
@@ -644,7 +648,7 @@ int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw,
switch (action) { switch (action) {
case IEEE80211_AMPDU_RX_START: case IEEE80211_AMPDU_RX_START:
if (iwlagn_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG) if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG)
break; break;
IWL_DEBUG_HT(priv, "start Rx\n"); IWL_DEBUG_HT(priv, "start Rx\n");
ret = iwl_sta_rx_agg_start(priv, sta, tid, *ssn); ret = iwl_sta_rx_agg_start(priv, sta, tid, *ssn);
@@ -654,9 +658,9 @@ int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw,
ret = iwl_sta_rx_agg_stop(priv, sta, tid); ret = iwl_sta_rx_agg_stop(priv, sta, tid);
break; break;
case IEEE80211_AMPDU_TX_START: case IEEE80211_AMPDU_TX_START:
if (!trans(priv)->ops->tx_agg_setup) if (!priv->trans->ops->tx_agg_setup)
break; break;
if (iwlagn_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG) if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG)
break; break;
IWL_DEBUG_HT(priv, "start Tx\n"); IWL_DEBUG_HT(priv, "start Tx\n");
ret = iwlagn_tx_agg_start(priv, vif, sta, tid, ssn); ret = iwlagn_tx_agg_start(priv, vif, sta, tid, ssn);
@@ -895,7 +899,6 @@ void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
iwl_set_rxon_ht(priv, ht_conf); iwl_set_rxon_ht(priv, ht_conf);
iwl_set_flags_for_band(priv, ctx, channel->band, ctx->vif); iwl_set_flags_for_band(priv, ctx, channel->band, ctx->vif);
iwl_set_rate(priv);
/* /*
* at this point, staging_rxon has the * at this point, staging_rxon has the
* configuration for channel switch * configuration for channel switch
@@ -1006,7 +1009,7 @@ void iwlagn_mac_flush(struct ieee80211_hw *hw, bool drop)
} }
} }
IWL_DEBUG_MAC80211(priv, "wait transmit/flush all frames\n"); IWL_DEBUG_MAC80211(priv, "wait transmit/flush all frames\n");
iwl_trans_wait_tx_queue_empty(trans(priv)); iwl_trans_wait_tx_queue_empty(priv->trans);
done: done:
mutex_unlock(&priv->mutex); mutex_unlock(&priv->mutex);
IWL_DEBUG_MAC80211(priv, "leave\n"); IWL_DEBUG_MAC80211(priv, "leave\n");
@@ -1130,8 +1133,8 @@ void iwlagn_mac_rssi_callback(struct ieee80211_hw *hw,
IWL_DEBUG_MAC80211(priv, "enter\n"); IWL_DEBUG_MAC80211(priv, "enter\n");
mutex_lock(&priv->mutex); mutex_lock(&priv->mutex);
if (cfg(priv)->bt_params && if (priv->cfg->bt_params &&
cfg(priv)->bt_params->advanced_bt_coexist) { priv->cfg->bt_params->advanced_bt_coexist) {
if (rssi_event == RSSI_EVENT_LOW) if (rssi_event == RSSI_EVENT_LOW)
priv->bt_enable_pspoll = true; priv->bt_enable_pspoll = true;
else if (rssi_event == RSSI_EVENT_HIGH) else if (rssi_event == RSSI_EVENT_HIGH)
@@ -1220,7 +1223,7 @@ static int iwl_set_mode(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
int iwl_setup_interface(struct iwl_priv *priv, struct iwl_rxon_context *ctx) int iwl_setup_interface(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
{ {
struct ieee80211_vif *vif = ctx->vif; struct ieee80211_vif *vif = ctx->vif;
int err; int err, ac;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->mutex);
@@ -1240,7 +1243,7 @@ int iwl_setup_interface(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
return err; return err;
} }
if (cfg(priv)->bt_params && cfg(priv)->bt_params->advanced_bt_coexist && if (priv->cfg->bt_params && priv->cfg->bt_params->advanced_bt_coexist &&
vif->type == NL80211_IFTYPE_ADHOC) { vif->type == NL80211_IFTYPE_ADHOC) {
/* /*
* pretend to have high BT traffic as long as we * pretend to have high BT traffic as long as we
@@ -1250,11 +1253,20 @@ int iwl_setup_interface(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
priv->bt_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_HIGH; priv->bt_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_HIGH;
} }
/* set up queue mappings */
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
vif->hw_queue[ac] = ctx->ac_to_queue[ac];
if (vif->type == NL80211_IFTYPE_AP)
vif->cab_queue = ctx->mcast_queue;
else
vif->cab_queue = IEEE80211_INVAL_HW_QUEUE;
return 0; return 0;
} }
static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, static int iwlagn_mac_add_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif) struct ieee80211_vif *vif)
{ {
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;

View File

@@ -68,42 +68,16 @@
#include <linux/gfp.h> #include <linux/gfp.h>
#include <net/mac80211.h> #include <net/mac80211.h>
#include "iwl-commands.h" extern struct iwl_mod_params iwlwifi_mod_params;
#include "iwl-fw.h"
#include "iwl-config.h"
/** enum iwl_power_level {
* DOC: shared area - role and goal IWL_POWER_INDEX_1,
* IWL_POWER_INDEX_2,
* The shared area contains all the data exported by the upper layer to the IWL_POWER_INDEX_3,
* other layers. Since the bus and transport layer shouldn't dereference IWL_POWER_INDEX_4,
* iwl_priv, all the data needed by the upper layer and the transport / bus IWL_POWER_INDEX_5,
* layer must be here. IWL_POWER_NUM
* The shared area also holds pointer to all the other layers. This allows a };
* layer to call a function from another layer.
*
* NOTE: All the layers hold a pointer to the shared area which must be shrd.
* A few macros assume that (_m)->shrd points to the shared area no matter
* what _m is.
*
* gets notifications about enumeration, suspend, resume.
* For the moment, the bus layer is not a linux kernel module as itself, and
* the module_init function of the driver must call the bus specific
* registration functions. These functions are listed at the end of this file.
* For the moment, there is only one implementation of this interface: PCI-e.
* This implementation is iwl-pci.c
*/
struct iwl_priv;
struct iwl_trans;
struct iwl_trans_ops;
#define DRV_NAME "iwlwifi"
#define IWLWIFI_VERSION "in-tree:"
#define DRV_COPYRIGHT "Copyright(c) 2003-2012 Intel Corporation"
#define DRV_AUTHOR "<ilw@linux.intel.com>"
extern struct iwl_mod_params iwlagn_mod_params;
#define IWL_DISABLE_HT_ALL BIT(0) #define IWL_DISABLE_HT_ALL BIT(0)
#define IWL_DISABLE_HT_TXAGG BIT(1) #define IWL_DISABLE_HT_TXAGG BIT(1)
@@ -147,38 +121,4 @@ struct iwl_mod_params {
bool auto_agg; bool auto_agg;
}; };
/**
* struct iwl_shared - shared fields for all the layers of the driver
*
* @wowlan: are we running wowlan uCode
* @bus: pointer to the bus layer data
* @cfg: see struct iwl_cfg
* @priv: pointer to the upper layer data
* @trans: pointer to the transport layer data
* @nic: pointer to the nic data
* @lock: protect general shared data
* @eeprom: pointer to the eeprom/OTP image
*/
struct iwl_shared {
const struct iwl_cfg *cfg;
struct iwl_trans *trans;
void *drv;
};
/*Whatever _m is (iwl_trans, iwl_priv, these macros will work */
#define cfg(_m) ((_m)->shrd->cfg)
#define trans(_m) ((_m)->shrd->trans)
static inline bool iwl_have_debug_level(u32 level)
{
return iwlagn_mod_params.debug_level & level;
}
enum iwl_rxon_context_id {
IWL_RXON_CTX_BSS,
IWL_RXON_CTX_PAN,
NUM_IWL_RXON_CTX
};
#endif /* #__iwl_shared_h__ */ #endif /* #__iwl_shared_h__ */

View File

@@ -69,6 +69,7 @@ struct sk_buff;
struct iwl_device_cmd; struct iwl_device_cmd;
struct iwl_rx_cmd_buffer; struct iwl_rx_cmd_buffer;
struct iwl_fw; struct iwl_fw;
struct iwl_cfg;
/** /**
* DOC: Operational mode - what is it ? * DOC: Operational mode - what is it ?
@@ -129,6 +130,7 @@ struct iwl_fw;
*/ */
struct iwl_op_mode_ops { struct iwl_op_mode_ops {
struct iwl_op_mode *(*start)(struct iwl_trans *trans, struct iwl_op_mode *(*start)(struct iwl_trans *trans,
const struct iwl_cfg *cfg,
const struct iwl_fw *fw); const struct iwl_fw *fw);
void (*stop)(struct iwl_op_mode *op_mode); void (*stop)(struct iwl_op_mode *op_mode);
int (*rx)(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb, int (*rx)(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb,

View File

@@ -67,11 +67,11 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/pci-aspm.h> #include <linux/pci-aspm.h>
#include "iwl-shared.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-cfg.h" #include "iwl-cfg.h"
#include "iwl-drv.h" #include "iwl-drv.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-trans-pcie-int.h"
#define IWL_PCI_DEVICE(dev, subdev, cfg) \ #define IWL_PCI_DEVICE(dev, subdev, cfg) \
.vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \
@@ -262,61 +262,46 @@ MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids);
/* PCI registers */ /* PCI registers */
#define PCI_CFG_RETRY_TIMEOUT 0x041 #define PCI_CFG_RETRY_TIMEOUT 0x041
#ifndef CONFIG_IWLWIFI_IDI
static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
struct iwl_shared *shrd;
struct iwl_trans *iwl_trans; struct iwl_trans *iwl_trans;
int err; struct iwl_trans_pcie *trans_pcie;
shrd = kzalloc(sizeof(*iwl_trans->shrd), GFP_KERNEL); iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg);
if (!shrd) { if (iwl_trans == NULL)
dev_printk(KERN_ERR, &pdev->dev, return -ENOMEM;
"Couldn't allocate iwl_shared");
err = -ENOMEM;
goto out_free_bus;
}
#ifdef CONFIG_IWLWIFI_IDI
iwl_trans = iwl_trans_idi_alloc(shrd, pdev, ent);
#else
iwl_trans = iwl_trans_pcie_alloc(shrd, pdev, ent);
#endif
if (iwl_trans == NULL) {
err = -ENOMEM;
goto out_free_bus;
}
shrd->trans = iwl_trans;
pci_set_drvdata(pdev, iwl_trans); pci_set_drvdata(pdev, iwl_trans);
err = iwl_drv_start(shrd, iwl_trans, cfg); trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans);
if (err) trans_pcie->drv = iwl_drv_start(iwl_trans, cfg);
if (!trans_pcie->drv)
goto out_free_trans; goto out_free_trans;
return 0; return 0;
out_free_trans: out_free_trans:
iwl_trans_free(iwl_trans); iwl_trans_pcie_free(iwl_trans);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
out_free_bus: return -EFAULT;
kfree(shrd);
return err;
} }
static void __devexit iwl_pci_remove(struct pci_dev *pdev) static void __devexit iwl_pci_remove(struct pci_dev *pdev)
{ {
struct iwl_trans *iwl_trans = pci_get_drvdata(pdev); struct iwl_trans *trans = pci_get_drvdata(pdev);
struct iwl_shared *shrd = iwl_trans->shrd; struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
iwl_drv_stop(shrd); iwl_drv_stop(trans_pcie->drv);
iwl_trans_free(shrd->trans); iwl_trans_pcie_free(trans);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
kfree(shrd);
} }
#endif /* CONFIG_IWLWIFI_IDI */
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int iwl_pci_suspend(struct device *device) static int iwl_pci_suspend(struct device *device)
@@ -361,6 +346,15 @@ static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume);
#endif #endif
#ifdef CONFIG_IWLWIFI_IDI
/*
* Defined externally in iwl-idi.c
*/
int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
void __devexit iwl_pci_remove(struct pci_dev *pdev);
#endif /* CONFIG_IWLWIFI_IDI */
static struct pci_driver iwl_pci_driver = { static struct pci_driver iwl_pci_driver = {
.name = DRV_NAME, .name = DRV_NAME,
.id_table = iwl_hw_card_ids, .id_table = iwl_hw_card_ids,

View File

@@ -65,14 +65,13 @@
#include <linux/string.h> #include <linux/string.h>
#include "iwl-debug.h" #include "iwl-debug.h"
#include "iwl-shared.h"
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-phy-db.h" #include "iwl-phy-db.h"
#define CHANNEL_NUM_SIZE 4 /* num of channels in calib_ch size */ #define CHANNEL_NUM_SIZE 4 /* num of channels in calib_ch size */
struct iwl_phy_db *iwl_phy_db_init(struct iwl_shared *shrd) struct iwl_phy_db *iwl_phy_db_init(struct device *dev)
{ {
struct iwl_phy_db *phy_db = kzalloc(sizeof(struct iwl_phy_db), struct iwl_phy_db *phy_db = kzalloc(sizeof(struct iwl_phy_db),
GFP_KERNEL); GFP_KERNEL);
@@ -80,7 +79,7 @@ struct iwl_phy_db *iwl_phy_db_init(struct iwl_shared *shrd)
if (!phy_db) if (!phy_db)
return phy_db; return phy_db;
phy_db->shrd = shrd; phy_db->dev = dev;
/* TODO: add default values of the phy db. */ /* TODO: add default values of the phy db. */
return phy_db; return phy_db;

View File

@@ -96,7 +96,7 @@ struct iwl_phy_db {
u32 channel_size; u32 channel_size;
/* for an access to the logger */ /* for an access to the logger */
const struct iwl_shared *shrd; struct device *dev;
}; };
enum iwl_phy_db_section_type { enum iwl_phy_db_section_type {
@@ -114,7 +114,7 @@ struct iwl_phy_db_chg_txp {
__le16 max_channel_idx; __le16 max_channel_idx;
} __packed; } __packed;
struct iwl_phy_db *iwl_phy_db_init(struct iwl_shared *shrd); struct iwl_phy_db *iwl_phy_db_init(struct device *dev);
void iwl_phy_db_free(struct iwl_phy_db *phy_db); void iwl_phy_db_free(struct iwl_phy_db *phy_db);

View File

@@ -37,13 +37,12 @@
#include "iwl-eeprom.h" #include "iwl-eeprom.h"
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-core.h"
#include "iwl-io.h" #include "iwl-io.h"
#include "iwl-commands.h" #include "iwl-commands.h"
#include "iwl-debug.h" #include "iwl-debug.h"
#include "iwl-power.h" #include "iwl-power.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-shared.h" #include "iwl-modparams.h"
/* /*
* Setting power level allows the card to go to sleep when not busy. * Setting power level allows the card to go to sleep when not busy.
@@ -167,7 +166,7 @@ static void iwl_static_sleep_cmd(struct iwl_priv *priv,
u8 skip; u8 skip;
u32 slp_itrvl; u32 slp_itrvl;
if (cfg(priv)->adv_pm) { if (priv->cfg->adv_pm) {
table = apm_range_2; table = apm_range_2;
if (period <= IWL_DTIM_RANGE_1_MAX) if (period <= IWL_DTIM_RANGE_1_MAX)
table = apm_range_1; table = apm_range_1;
@@ -215,13 +214,13 @@ static void iwl_static_sleep_cmd(struct iwl_priv *priv,
else else
cmd->flags &= ~IWL_POWER_SLEEP_OVER_DTIM_MSK; cmd->flags &= ~IWL_POWER_SLEEP_OVER_DTIM_MSK;
if (cfg(priv)->base_params->shadow_reg_enable) if (priv->cfg->base_params->shadow_reg_enable)
cmd->flags |= IWL_POWER_SHADOW_REG_ENA; cmd->flags |= IWL_POWER_SHADOW_REG_ENA;
else else
cmd->flags &= ~IWL_POWER_SHADOW_REG_ENA; cmd->flags &= ~IWL_POWER_SHADOW_REG_ENA;
if (iwl_advanced_bt_coexist(priv)) { if (iwl_advanced_bt_coexist(priv)) {
if (!cfg(priv)->bt_params->bt_sco_disable) if (!priv->cfg->bt_params->bt_sco_disable)
cmd->flags |= IWL_POWER_BT_SCO_ENA; cmd->flags |= IWL_POWER_BT_SCO_ENA;
else else
cmd->flags &= ~IWL_POWER_BT_SCO_ENA; cmd->flags &= ~IWL_POWER_BT_SCO_ENA;
@@ -295,7 +294,7 @@ static void iwl_power_build_cmd(struct iwl_priv *priv,
if (priv->wowlan) if (priv->wowlan)
iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, dtimper); iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, dtimper);
else if (!cfg(priv)->base_params->no_idle_support && else if (!priv->cfg->base_params->no_idle_support &&
priv->hw->conf.flags & IEEE80211_CONF_IDLE) priv->hw->conf.flags & IEEE80211_CONF_IDLE)
iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, 20); iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, 20);
else if (iwl_tt_is_low_power_state(priv)) { else if (iwl_tt_is_low_power_state(priv)) {
@@ -309,10 +308,10 @@ static void iwl_power_build_cmd(struct iwl_priv *priv,
priv->power_data.debug_sleep_level_override, priv->power_data.debug_sleep_level_override,
dtimper); dtimper);
else { else {
if (iwlagn_mod_params.power_level > IWL_POWER_INDEX_1 && if (iwlwifi_mod_params.power_level > IWL_POWER_INDEX_1 &&
iwlagn_mod_params.power_level <= IWL_POWER_INDEX_5) iwlwifi_mod_params.power_level <= IWL_POWER_INDEX_5)
iwl_static_sleep_cmd(priv, cmd, iwl_static_sleep_cmd(priv, cmd,
iwlagn_mod_params.power_level, dtimper); iwlwifi_mod_params.power_level, dtimper);
else else
iwl_static_sleep_cmd(priv, cmd, iwl_static_sleep_cmd(priv, cmd,
IWL_POWER_INDEX_1, dtimper); IWL_POWER_INDEX_1, dtimper);
@@ -378,7 +377,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force)
/* initialize to default */ /* initialize to default */
void iwl_power_initialize(struct iwl_priv *priv) void iwl_power_initialize(struct iwl_priv *priv)
{ {
priv->power_data.bus_pm = trans(priv)->pm_support; priv->power_data.bus_pm = priv->trans->pm_support;
priv->power_data.debug_sleep_level_override = -1; priv->power_data.debug_sleep_level_override = -1;

View File

@@ -30,15 +30,6 @@
#include "iwl-commands.h" #include "iwl-commands.h"
enum iwl_power_level {
IWL_POWER_INDEX_1,
IWL_POWER_INDEX_2,
IWL_POWER_INDEX_3,
IWL_POWER_INDEX_4,
IWL_POWER_INDEX_5,
IWL_POWER_NUM
};
struct iwl_power_mgr { struct iwl_power_mgr {
struct iwl_powertable_cmd sleep_cmd; struct iwl_powertable_cmd sleep_cmd;
struct iwl_powertable_cmd sleep_cmd_next; struct iwl_powertable_cmd sleep_cmd_next;

View File

@@ -32,7 +32,6 @@
#include "iwl-eeprom.h" #include "iwl-eeprom.h"
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-core.h"
#include "iwl-io.h" #include "iwl-io.h"
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-trans.h" #include "iwl-trans.h"
@@ -791,8 +790,8 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
* Internal scans are passive, so we can indiscriminately set * Internal scans are passive, so we can indiscriminately set
* the BT ignore flag on 2.4 GHz since it applies to TX only. * the BT ignore flag on 2.4 GHz since it applies to TX only.
*/ */
if (cfg(priv)->bt_params && if (priv->cfg->bt_params &&
cfg(priv)->bt_params->advanced_bt_coexist) priv->cfg->bt_params->advanced_bt_coexist)
scan->tx_cmd.tx_flags |= TX_CMD_FLG_IGNORE_BT; scan->tx_cmd.tx_flags |= TX_CMD_FLG_IGNORE_BT;
break; break;
case IEEE80211_BAND_5GHZ: case IEEE80211_BAND_5GHZ:
@@ -834,8 +833,8 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
band = priv->scan_band; band = priv->scan_band;
if (band == IEEE80211_BAND_2GHZ && if (band == IEEE80211_BAND_2GHZ &&
cfg(priv)->bt_params && priv->cfg->bt_params &&
cfg(priv)->bt_params->advanced_bt_coexist) { priv->cfg->bt_params->advanced_bt_coexist) {
/* transmit 2.4 GHz probes only on first antenna */ /* transmit 2.4 GHz probes only on first antenna */
scan_tx_antennas = first_antenna(scan_tx_antennas); scan_tx_antennas = first_antenna(scan_tx_antennas);
} }
@@ -863,8 +862,8 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
rx_ant = first_antenna(active_chains); rx_ant = first_antenna(active_chains);
} }
if (cfg(priv)->bt_params && if (priv->cfg->bt_params &&
cfg(priv)->bt_params->advanced_bt_coexist && priv->cfg->bt_params->advanced_bt_coexist &&
priv->bt_full_concurrent) { priv->bt_full_concurrent) {
/* operated as 1x1 in full concurrency mode */ /* operated as 1x1 in full concurrency mode */
rx_ant = first_antenna(rx_ant); rx_ant = first_antenna(rx_ant);

View File

@@ -71,7 +71,6 @@
#include <net/netlink.h> #include <net/netlink.h>
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-core.h"
#include "iwl-debug.h" #include "iwl-debug.h"
#include "iwl-io.h" #include "iwl-io.h"
#include "iwl-agn.h" #include "iwl-agn.h"
@@ -219,7 +218,7 @@ static void iwl_trace_cleanup(struct iwl_priv *priv)
if (priv->testmode_trace.trace_enabled) { if (priv->testmode_trace.trace_enabled) {
if (priv->testmode_trace.cpu_addr && if (priv->testmode_trace.cpu_addr &&
priv->testmode_trace.dma_addr) priv->testmode_trace.dma_addr)
dma_free_coherent(trans(priv)->dev, dma_free_coherent(priv->trans->dev,
priv->testmode_trace.total_size, priv->testmode_trace.total_size,
priv->testmode_trace.cpu_addr, priv->testmode_trace.cpu_addr,
priv->testmode_trace.dma_addr); priv->testmode_trace.dma_addr);
@@ -373,7 +372,7 @@ static int iwl_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb)
switch (cmd) { switch (cmd) {
case IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32: case IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32:
val32 = iwl_read_direct32(trans(priv), ofs); val32 = iwl_read_direct32(priv->trans, ofs);
IWL_INFO(priv, "32bit value to read 0x%x\n", val32); IWL_INFO(priv, "32bit value to read 0x%x\n", val32);
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20); skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20);
@@ -394,7 +393,7 @@ static int iwl_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb)
} else { } else {
val32 = nla_get_u32(tb[IWL_TM_ATTR_REG_VALUE32]); val32 = nla_get_u32(tb[IWL_TM_ATTR_REG_VALUE32]);
IWL_INFO(priv, "32bit value to write 0x%x\n", val32); IWL_INFO(priv, "32bit value to write 0x%x\n", val32);
iwl_write_direct32(trans(priv), ofs, val32); iwl_write_direct32(priv->trans, ofs, val32);
} }
break; break;
case IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8: case IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8:
@@ -404,7 +403,7 @@ static int iwl_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb)
} else { } else {
val8 = nla_get_u8(tb[IWL_TM_ATTR_REG_VALUE8]); val8 = nla_get_u8(tb[IWL_TM_ATTR_REG_VALUE8]);
IWL_INFO(priv, "8bit value to write 0x%x\n", val8); IWL_INFO(priv, "8bit value to write 0x%x\n", val8);
iwl_write8(trans(priv), ofs, val8); iwl_write8(priv->trans, ofs, val8);
} }
break; break;
default: default:
@@ -467,7 +466,7 @@ cfg_init_calib_error:
static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
{ {
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
struct iwl_trans *trans = trans(priv); struct iwl_trans *trans = priv->trans;
struct sk_buff *skb; struct sk_buff *skb;
unsigned char *rsp_data_ptr = NULL; unsigned char *rsp_data_ptr = NULL;
int status = 0, rsp_data_len = 0; int status = 0, rsp_data_len = 0;
@@ -476,8 +475,8 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) {
case IWL_TM_CMD_APP2DEV_GET_DEVICENAME: case IWL_TM_CMD_APP2DEV_GET_DEVICENAME:
rsp_data_ptr = (unsigned char *)cfg(priv)->name; rsp_data_ptr = (unsigned char *)priv->cfg->name;
rsp_data_len = strlen(cfg(priv)->name); rsp_data_len = strlen(priv->cfg->name);
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy,
rsp_data_len + 20); rsp_data_len + 20);
if (!skb) { if (!skb) {
@@ -538,7 +537,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
case IWL_TM_CMD_APP2DEV_GET_EEPROM: case IWL_TM_CMD_APP2DEV_GET_EEPROM:
if (priv->eeprom) { if (priv->eeprom) {
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy,
cfg(priv)->base_params->eeprom_size + 20); priv->cfg->base_params->eeprom_size + 20);
if (!skb) { if (!skb) {
IWL_ERR(priv, "Memory allocation fail\n"); IWL_ERR(priv, "Memory allocation fail\n");
return -ENOMEM; return -ENOMEM;
@@ -546,7 +545,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
if (nla_put_u32(skb, IWL_TM_ATTR_COMMAND, if (nla_put_u32(skb, IWL_TM_ATTR_COMMAND,
IWL_TM_CMD_DEV2APP_EEPROM_RSP) || IWL_TM_CMD_DEV2APP_EEPROM_RSP) ||
nla_put(skb, IWL_TM_ATTR_EEPROM, nla_put(skb, IWL_TM_ATTR_EEPROM,
cfg(priv)->base_params->eeprom_size, priv->cfg->base_params->eeprom_size,
priv->eeprom)) priv->eeprom))
goto nla_put_failure; goto nla_put_failure;
status = cfg80211_testmode_reply(skb); status = cfg80211_testmode_reply(skb);
@@ -583,7 +582,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
break; break;
case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID: case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID:
devid = trans(priv)->hw_id; devid = priv->trans->hw_id;
IWL_INFO(priv, "hw version: 0x%x\n", devid); IWL_INFO(priv, "hw version: 0x%x\n", devid);
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20); skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20);
@@ -650,7 +649,7 @@ static int iwl_testmode_trace(struct ieee80211_hw *hw, struct nlattr **tb)
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
struct sk_buff *skb; struct sk_buff *skb;
int status = 0; int status = 0;
struct device *dev = trans(priv)->dev; struct device *dev = priv->trans->dev;
switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) {
case IWL_TM_CMD_APP2DEV_BEGIN_TRACE: case IWL_TM_CMD_APP2DEV_BEGIN_TRACE:
@@ -792,7 +791,7 @@ static int iwl_testmode_ownership(struct ieee80211_hw *hw, struct nlattr **tb)
static int iwl_testmode_indirect_read(struct iwl_priv *priv, u32 addr, u32 size) static int iwl_testmode_indirect_read(struct iwl_priv *priv, u32 addr, u32 size)
{ {
struct iwl_trans *trans = trans(priv); struct iwl_trans *trans = priv->trans;
unsigned long flags; unsigned long flags;
int i; int i;
@@ -832,7 +831,7 @@ static int iwl_testmode_indirect_read(struct iwl_priv *priv, u32 addr, u32 size)
static int iwl_testmode_indirect_write(struct iwl_priv *priv, u32 addr, static int iwl_testmode_indirect_write(struct iwl_priv *priv, u32 addr,
u32 size, unsigned char *buf) u32 size, unsigned char *buf)
{ {
struct iwl_trans *trans = trans(priv); struct iwl_trans *trans = priv->trans;
u32 val, i; u32 val, i;
unsigned long flags; unsigned long flags;

View File

@@ -38,7 +38,6 @@
#include "iwl-fh.h" #include "iwl-fh.h"
#include "iwl-csr.h" #include "iwl-csr.h"
#include "iwl-shared.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-debug.h" #include "iwl-debug.h"
#include "iwl-io.h" #include "iwl-io.h"
@@ -180,30 +179,33 @@ struct iwl_queue {
* space less than this */ * space less than this */
}; };
#define TFD_TX_CMD_SLOTS 256
#define TFD_CMD_SLOTS 32
struct iwl_pcie_tx_queue_entry {
struct iwl_device_cmd *cmd;
struct sk_buff *skb;
struct iwl_cmd_meta meta;
};
/** /**
* struct iwl_tx_queue - Tx Queue for DMA * struct iwl_tx_queue - Tx Queue for DMA
* @q: generic Rx/Tx queue descriptor * @q: generic Rx/Tx queue descriptor
* @bd: base of circular buffer of TFDs * @tfds: transmit frame descriptors (DMA memory)
* @cmd: array of command/TX buffer pointers * @entries: transmit entries (driver state)
* @meta: array of meta data for each command/tx buffer * @lock: queue lock
* @dma_addr_cmd: physical address of cmd/tx buffer array * @stuck_timer: timer that fires if queue gets stuck
* @txb: array of per-TFD driver data * @trans_pcie: pointer back to transport (for timer)
* lock: queue lock
* @time_stamp: time (in jiffies) of last read_ptr change
* @need_update: indicates need to update read/write index * @need_update: indicates need to update read/write index
* @active: stores if queue is active
* *
* A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame
* descriptors) and required locking structures. * descriptors) and required locking structures.
*/ */
#define TFD_TX_CMD_SLOTS 256
#define TFD_CMD_SLOTS 32
struct iwl_tx_queue { struct iwl_tx_queue {
struct iwl_queue q; struct iwl_queue q;
struct iwl_tfd *tfds; struct iwl_tfd *tfds;
struct iwl_device_cmd **cmd; struct iwl_pcie_tx_queue_entry *entries;
struct iwl_cmd_meta *meta;
struct sk_buff **skbs;
spinlock_t lock; spinlock_t lock;
struct timer_list stuck_timer; struct timer_list stuck_timer;
struct iwl_trans_pcie *trans_pcie; struct iwl_trans_pcie *trans_pcie;
@@ -215,6 +217,7 @@ struct iwl_tx_queue {
* struct iwl_trans_pcie - PCIe transport specific data * struct iwl_trans_pcie - PCIe transport specific data
* @rxq: all the RX queue data * @rxq: all the RX queue data
* @rx_replenish: work that will be called when buffers need to be allocated * @rx_replenish: work that will be called when buffers need to be allocated
* @drv - pointer to iwl_drv
* @trans: pointer to the generic transport area * @trans: pointer to the generic transport area
* @irq - the irq number for the device * @irq - the irq number for the device
* @irq_requested: true when the irq has been requested * @irq_requested: true when the irq has been requested
@@ -235,6 +238,7 @@ struct iwl_trans_pcie {
struct iwl_rx_queue rxq; struct iwl_rx_queue rxq;
struct work_struct rx_replenish; struct work_struct rx_replenish;
struct iwl_trans *trans; struct iwl_trans *trans;
struct iwl_drv *drv;
/* INT ICT Table */ /* INT ICT Table */
__le32 *ict_tbl; __le32 *ict_tbl;
@@ -297,6 +301,11 @@ iwl_trans_pcie_get_trans(struct iwl_trans_pcie *trans_pcie)
trans_specific); trans_specific);
} }
struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
const struct pci_device_id *ent,
const struct iwl_cfg *cfg);
void iwl_trans_pcie_free(struct iwl_trans *trans);
/***************************************************** /*****************************************************
* RX * RX
******************************************************/ ******************************************************/
@@ -426,4 +435,10 @@ trans_pcie_get_cmd_string(struct iwl_trans_pcie *trans_pcie, u8 cmd)
return trans_pcie->command_names[cmd]; return trans_pcie->command_names[cmd];
} }
static inline bool iwl_is_rfkill_set(struct iwl_trans *trans)
{
return !(iwl_read32(trans, CSR_GP_CNTRL) &
CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW);
}
#endif /* __iwl_trans_int_pcie_h__ */ #endif /* __iwl_trans_int_pcie_h__ */

View File

@@ -140,7 +140,7 @@ void iwl_rx_queue_update_write_ptr(struct iwl_trans *trans,
if (q->need_update == 0) if (q->need_update == 0)
goto exit_unlock; goto exit_unlock;
if (cfg(trans)->base_params->shadow_reg_enable) { if (trans->cfg->base_params->shadow_reg_enable) {
/* shadow register enabled */ /* shadow register enabled */
/* Device expects a multiple of 8 */ /* Device expects a multiple of 8 */
q->write_actual = (q->write & ~0x7); q->write_actual = (q->write & ~0x7);
@@ -425,7 +425,7 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans,
cmd_index = get_cmd_index(&txq->q, index); cmd_index = get_cmd_index(&txq->q, index);
if (reclaim) if (reclaim)
cmd = txq->cmd[cmd_index]; cmd = txq->entries[cmd_index].cmd;
else else
cmd = NULL; cmd = NULL;
@@ -543,7 +543,7 @@ static void iwl_rx_handle(struct iwl_trans *trans)
static void iwl_irq_handle_error(struct iwl_trans *trans) static void iwl_irq_handle_error(struct iwl_trans *trans)
{ {
/* W/A for WiFi/WiMAX coex and WiMAX own the RF */ /* W/A for WiFi/WiMAX coex and WiMAX own the RF */
if (cfg(trans)->internal_wimax_coex && if (trans->cfg->internal_wimax_coex &&
(!(iwl_read_prph(trans, APMG_CLK_CTRL_REG) & (!(iwl_read_prph(trans, APMG_CLK_CTRL_REG) &
APMS_CLK_VAL_MRB_FUNC_MODE) || APMS_CLK_VAL_MRB_FUNC_MODE) ||
(iwl_read_prph(trans, APMG_PS_CTRL_REG) & (iwl_read_prph(trans, APMG_PS_CTRL_REG) &
@@ -648,8 +648,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
if (inta & CSR_INT_BIT_RF_KILL) { if (inta & CSR_INT_BIT_RF_KILL) {
bool hw_rfkill; bool hw_rfkill;
hw_rfkill = !(iwl_read32(trans, CSR_GP_CNTRL) & hw_rfkill = iwl_is_rfkill_set(trans);
CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW);
IWL_WARN(trans, "RF_KILL bit toggled to %s.\n", IWL_WARN(trans, "RF_KILL bit toggled to %s.\n",
hw_rfkill ? "disable radio" : "enable radio"); hw_rfkill ? "disable radio" : "enable radio");
@@ -680,7 +679,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
if (inta & CSR_INT_BIT_WAKEUP) { if (inta & CSR_INT_BIT_WAKEUP) {
IWL_DEBUG_ISR(trans, "Wakeup interrupt\n"); IWL_DEBUG_ISR(trans, "Wakeup interrupt\n");
iwl_rx_queue_update_write_ptr(trans, &trans_pcie->rxq); iwl_rx_queue_update_write_ptr(trans, &trans_pcie->rxq);
for (i = 0; i < cfg(trans)->base_params->num_of_queues; i++) for (i = 0; i < trans->cfg->base_params->num_of_queues; i++)
iwl_txq_update_write_ptr(trans, iwl_txq_update_write_ptr(trans,
&trans_pcie->txq[i]); &trans_pcie->txq[i]);

View File

@@ -37,6 +37,8 @@
#include "iwl-agn-hw.h" #include "iwl-agn-hw.h"
#include "iwl-op-mode.h" #include "iwl-op-mode.h"
#include "iwl-trans-pcie-int.h" #include "iwl-trans-pcie-int.h"
/* FIXME: need to abstract out TX command (once we know what it looks like) */
#include "iwl-commands.h"
#define IWL_TX_CRC_SIZE 4 #define IWL_TX_CRC_SIZE 4
#define IWL_TX_DELIMITER_SIZE 4 #define IWL_TX_DELIMITER_SIZE 4
@@ -58,7 +60,7 @@ void iwl_trans_txq_update_byte_cnt_tbl(struct iwl_trans *trans,
u16 len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; u16 len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE;
__le16 bc_ent; __le16 bc_ent;
struct iwl_tx_cmd *tx_cmd = struct iwl_tx_cmd *tx_cmd =
(struct iwl_tx_cmd *) txq->cmd[txq->q.write_ptr]->payload; (void *) txq->entries[txq->q.write_ptr].cmd->payload;
scd_bc_tbl = trans_pcie->scd_bc_tbls.addr; scd_bc_tbl = trans_pcie->scd_bc_tbls.addr;
@@ -99,7 +101,7 @@ void iwl_txq_update_write_ptr(struct iwl_trans *trans, struct iwl_tx_queue *txq)
if (txq->need_update == 0) if (txq->need_update == 0)
return; return;
if (cfg(trans)->base_params->shadow_reg_enable) { if (trans->cfg->base_params->shadow_reg_enable) {
/* shadow register enabled */ /* shadow register enabled */
iwl_write32(trans, HBUS_TARG_WRPTR, iwl_write32(trans, HBUS_TARG_WRPTR,
txq->q.write_ptr | (txq_id << 8)); txq->q.write_ptr | (txq_id << 8));
@@ -221,13 +223,14 @@ void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq,
lockdep_assert_held(&txq->lock); lockdep_assert_held(&txq->lock);
iwlagn_unmap_tfd(trans, &txq->meta[index], &tfd_tmp[index], dma_dir); iwlagn_unmap_tfd(trans, &txq->entries[index].meta,
&tfd_tmp[index], dma_dir);
/* free SKB */ /* free SKB */
if (txq->skbs) { if (txq->entries) {
struct sk_buff *skb; struct sk_buff *skb;
skb = txq->skbs[index]; skb = txq->entries[index].skb;
/* Can be called from irqs-disabled context /* Can be called from irqs-disabled context
* If skb is not NULL, it means that the whole queue is being * If skb is not NULL, it means that the whole queue is being
@@ -235,7 +238,7 @@ void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq,
*/ */
if (skb) { if (skb) {
iwl_op_mode_free_skb(trans->op_mode, skb); iwl_op_mode_free_skb(trans->op_mode, skb);
txq->skbs[index] = NULL; txq->entries[index].skb = NULL;
} }
} }
} }
@@ -358,7 +361,7 @@ static void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_trans *trans,
u8 sta_id = 0; u8 sta_id = 0;
__le16 bc_ent; __le16 bc_ent;
struct iwl_tx_cmd *tx_cmd = struct iwl_tx_cmd *tx_cmd =
(struct iwl_tx_cmd *) txq->cmd[txq->q.read_ptr]->payload; (void *)txq->entries[txq->q.read_ptr].cmd->payload;
WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX); WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX);
@@ -578,8 +581,8 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
} }
idx = get_cmd_index(q, q->write_ptr); idx = get_cmd_index(q, q->write_ptr);
out_cmd = txq->cmd[idx]; out_cmd = txq->entries[idx].cmd;
out_meta = &txq->meta[idx]; out_meta = &txq->entries[idx].meta;
memset(out_meta, 0, sizeof(*out_meta)); /* re-initialize to NULL */ memset(out_meta, 0, sizeof(*out_meta)); /* re-initialize to NULL */
if (cmd->flags & CMD_WANT_SKB) if (cmd->flags & CMD_WANT_SKB)
@@ -772,8 +775,8 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_cmd_buffer *rxb,
spin_lock(&txq->lock); spin_lock(&txq->lock);
cmd_index = get_cmd_index(&txq->q, index); cmd_index = get_cmd_index(&txq->q, index);
cmd = txq->cmd[cmd_index]; cmd = txq->entries[cmd_index].cmd;
meta = &txq->meta[cmd_index]; meta = &txq->entries[cmd_index].meta;
iwlagn_unmap_tfd(trans, meta, &txq->tfds[index], iwlagn_unmap_tfd(trans, meta, &txq->tfds[index],
DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
@@ -905,8 +908,8 @@ cancel:
* in later, it will possibly set an invalid * in later, it will possibly set an invalid
* address (cmd->meta.source). * address (cmd->meta.source).
*/ */
trans_pcie->txq[trans_pcie->cmd_queue].meta[cmd_idx].flags &= trans_pcie->txq[trans_pcie->cmd_queue].
~CMD_WANT_SKB; entries[cmd_idx].meta.flags &= ~CMD_WANT_SKB;
} }
if (cmd->resp_pkt) { if (cmd->resp_pkt) {
@@ -961,12 +964,12 @@ int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
q->read_ptr != index; q->read_ptr != index;
q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
if (WARN_ON_ONCE(txq->skbs[txq->q.read_ptr] == NULL)) if (WARN_ON_ONCE(txq->entries[txq->q.read_ptr].skb == NULL))
continue; continue;
__skb_queue_tail(skbs, txq->skbs[txq->q.read_ptr]); __skb_queue_tail(skbs, txq->entries[txq->q.read_ptr].skb);
txq->skbs[txq->q.read_ptr] = NULL; txq->entries[txq->q.read_ptr].skb = NULL;
iwlagn_txq_inval_byte_cnt_tbl(trans, txq); iwlagn_txq_inval_byte_cnt_tbl(trans, txq);

View File

@@ -68,18 +68,20 @@
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/gfp.h> #include <linux/gfp.h>
#include "iwl-drv.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-trans-pcie-int.h" #include "iwl-trans-pcie-int.h"
#include "iwl-csr.h" #include "iwl-csr.h"
#include "iwl-prph.h" #include "iwl-prph.h"
#include "iwl-shared.h"
#include "iwl-eeprom.h" #include "iwl-eeprom.h"
#include "iwl-agn-hw.h" #include "iwl-agn-hw.h"
/* FIXME: need to abstract out TX command (once we know what it looks like) */
#include "iwl-commands.h"
#define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo)))) #define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo))))
#define SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie) \ #define SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie) \
(((1<<cfg(trans)->base_params->num_of_queues) - 1) &\ (((1<<trans->cfg->base_params->num_of_queues) - 1) &\
(~(1<<(trans_pcie)->cmd_queue))) (~(1<<(trans_pcie)->cmd_queue)))
static int iwl_trans_rx_alloc(struct iwl_trans *trans) static int iwl_trans_rx_alloc(struct iwl_trans *trans)
@@ -334,7 +336,7 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
int i; int i;
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
if (WARN_ON(txq->meta || txq->cmd || txq->skbs || txq->tfds)) if (WARN_ON(txq->entries || txq->tfds))
return -EINVAL; return -EINVAL;
setup_timer(&txq->stuck_timer, iwl_trans_pcie_queue_stuck_timer, setup_timer(&txq->stuck_timer, iwl_trans_pcie_queue_stuck_timer,
@@ -343,35 +345,22 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
txq->q.n_window = slots_num; txq->q.n_window = slots_num;
txq->meta = kcalloc(slots_num, sizeof(txq->meta[0]), GFP_KERNEL); txq->entries = kcalloc(slots_num,
txq->cmd = kcalloc(slots_num, sizeof(txq->cmd[0]), GFP_KERNEL); sizeof(struct iwl_pcie_tx_queue_entry),
GFP_KERNEL);
if (!txq->meta || !txq->cmd) if (!txq->entries)
goto error; goto error;
if (txq_id == trans_pcie->cmd_queue) if (txq_id == trans_pcie->cmd_queue)
for (i = 0; i < slots_num; i++) { for (i = 0; i < slots_num; i++) {
txq->cmd[i] = kmalloc(sizeof(struct iwl_device_cmd), txq->entries[i].cmd =
GFP_KERNEL); kmalloc(sizeof(struct iwl_device_cmd),
if (!txq->cmd[i]) GFP_KERNEL);
if (!txq->entries[i].cmd)
goto error; goto error;
} }
/* Alloc driver data array and TFD circular buffer */
/* Driver private data, only for Tx (not command) queues,
* not shared with device. */
if (txq_id != trans_pcie->cmd_queue) {
txq->skbs = kcalloc(TFD_QUEUE_SIZE_MAX, sizeof(txq->skbs[0]),
GFP_KERNEL);
if (!txq->skbs) {
IWL_ERR(trans, "kmalloc for auxiliary BD "
"structures failed\n");
goto error;
}
} else {
txq->skbs = NULL;
}
/* Circular buffer of transmit frame descriptors (TFDs), /* Circular buffer of transmit frame descriptors (TFDs),
* shared with device */ * shared with device */
txq->tfds = dma_alloc_coherent(trans->dev, tfd_sz, txq->tfds = dma_alloc_coherent(trans->dev, tfd_sz,
@@ -384,17 +373,11 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
return 0; return 0;
error: error:
kfree(txq->skbs); if (txq->entries && txq_id == trans_pcie->cmd_queue)
txq->skbs = NULL;
/* since txq->cmd has been zeroed,
* all non allocated cmd[i] will be NULL */
if (txq->cmd && txq_id == trans_pcie->cmd_queue)
for (i = 0; i < slots_num; i++) for (i = 0; i < slots_num; i++)
kfree(txq->cmd[i]); kfree(txq->entries[i].cmd);
kfree(txq->meta); kfree(txq->entries);
kfree(txq->cmd); txq->entries = NULL;
txq->meta = NULL;
txq->cmd = NULL;
return -ENOMEM; return -ENOMEM;
@@ -406,7 +389,6 @@ static int iwl_trans_txq_init(struct iwl_trans *trans, struct iwl_tx_queue *txq,
int ret; int ret;
txq->need_update = 0; txq->need_update = 0;
memset(txq->meta, 0, sizeof(txq->meta[0]) * slots_num);
/* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise
* iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */ * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */
@@ -484,7 +466,7 @@ static void iwl_tx_queue_free(struct iwl_trans *trans, int txq_id)
if (txq_id == trans_pcie->cmd_queue) if (txq_id == trans_pcie->cmd_queue)
for (i = 0; i < txq->q.n_window; i++) for (i = 0; i < txq->q.n_window; i++)
kfree(txq->cmd[i]); kfree(txq->entries[i].cmd);
/* De-alloc circular buffer of TFDs */ /* De-alloc circular buffer of TFDs */
if (txq->q.n_bd) { if (txq->q.n_bd) {
@@ -493,15 +475,8 @@ static void iwl_tx_queue_free(struct iwl_trans *trans, int txq_id)
memset(&txq->q.dma_addr, 0, sizeof(txq->q.dma_addr)); memset(&txq->q.dma_addr, 0, sizeof(txq->q.dma_addr));
} }
/* De-alloc array of per-TFD driver data */ kfree(txq->entries);
kfree(txq->skbs); txq->entries = NULL;
txq->skbs = NULL;
/* deallocate arrays */
kfree(txq->cmd);
kfree(txq->meta);
txq->cmd = NULL;
txq->meta = NULL;
del_timer_sync(&txq->stuck_timer); del_timer_sync(&txq->stuck_timer);
@@ -522,7 +497,7 @@ static void iwl_trans_pcie_tx_free(struct iwl_trans *trans)
/* Tx queues */ /* Tx queues */
if (trans_pcie->txq) { if (trans_pcie->txq) {
for (txq_id = 0; for (txq_id = 0;
txq_id < cfg(trans)->base_params->num_of_queues; txq_id++) txq_id < trans->cfg->base_params->num_of_queues; txq_id++)
iwl_tx_queue_free(trans, txq_id); iwl_tx_queue_free(trans, txq_id);
} }
@@ -547,7 +522,7 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans)
int txq_id, slots_num; int txq_id, slots_num;
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
u16 scd_bc_tbls_size = cfg(trans)->base_params->num_of_queues * u16 scd_bc_tbls_size = trans->cfg->base_params->num_of_queues *
sizeof(struct iwlagn_scd_bc_tbl); sizeof(struct iwlagn_scd_bc_tbl);
/*It is not allowed to alloc twice, so warn when this happens. /*It is not allowed to alloc twice, so warn when this happens.
@@ -571,7 +546,7 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans)
goto error; goto error;
} }
trans_pcie->txq = kcalloc(cfg(trans)->base_params->num_of_queues, trans_pcie->txq = kcalloc(trans->cfg->base_params->num_of_queues,
sizeof(struct iwl_tx_queue), GFP_KERNEL); sizeof(struct iwl_tx_queue), GFP_KERNEL);
if (!trans_pcie->txq) { if (!trans_pcie->txq) {
IWL_ERR(trans, "Not enough memory for txq\n"); IWL_ERR(trans, "Not enough memory for txq\n");
@@ -580,7 +555,7 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans)
} }
/* Alloc and init all Tx queues, including the command queue (#4/#9) */ /* Alloc and init all Tx queues, including the command queue (#4/#9) */
for (txq_id = 0; txq_id < cfg(trans)->base_params->num_of_queues; for (txq_id = 0; txq_id < trans->cfg->base_params->num_of_queues;
txq_id++) { txq_id++) {
slots_num = (txq_id == trans_pcie->cmd_queue) ? slots_num = (txq_id == trans_pcie->cmd_queue) ?
TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
@@ -626,7 +601,7 @@ static int iwl_tx_init(struct iwl_trans *trans)
spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); spin_unlock_irqrestore(&trans_pcie->irq_lock, flags);
/* Alloc and init all Tx queues, including the command queue (#4/#9) */ /* Alloc and init all Tx queues, including the command queue (#4/#9) */
for (txq_id = 0; txq_id < cfg(trans)->base_params->num_of_queues; for (txq_id = 0; txq_id < trans->cfg->base_params->num_of_queues;
txq_id++) { txq_id++) {
slots_num = (txq_id == trans_pcie->cmd_queue) ? slots_num = (txq_id == trans_pcie->cmd_queue) ?
TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
@@ -749,9 +724,9 @@ static int iwl_apm_init(struct iwl_trans *trans)
iwl_apm_config(trans); iwl_apm_config(trans);
/* Configure analog phase-lock-loop before activating to D0A */ /* Configure analog phase-lock-loop before activating to D0A */
if (cfg(trans)->base_params->pll_cfg_val) if (trans->cfg->base_params->pll_cfg_val)
iwl_set_bit(trans, CSR_ANA_PLL_CFG, iwl_set_bit(trans, CSR_ANA_PLL_CFG,
cfg(trans)->base_params->pll_cfg_val); trans->cfg->base_params->pll_cfg_val);
/* /*
* Set "initialization complete" bit to move adapter from * Set "initialization complete" bit to move adapter from
@@ -861,7 +836,7 @@ static int iwl_nic_init(struct iwl_trans *trans)
if (iwl_tx_init(trans)) if (iwl_tx_init(trans))
return -ENOMEM; return -ENOMEM;
if (cfg(trans)->base_params->shadow_reg_enable) { if (trans->cfg->base_params->shadow_reg_enable) {
/* enable shadow regs in HW */ /* enable shadow regs in HW */
iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTRL, iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTRL,
0x800FFFFF); 0x800FFFFF);
@@ -1008,15 +983,13 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans,
return -EIO; return -EIO;
} }
/* If platform's RF_KILL switch is NOT set to KILL */ iwl_enable_rfkill_int(trans);
hw_rfkill = !(iwl_read32(trans, CSR_GP_CNTRL) &
CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW);
iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);
if (hw_rfkill) { /* If platform's RF_KILL switch is NOT set to KILL */
iwl_enable_rfkill_int(trans); hw_rfkill = iwl_is_rfkill_set(trans);
iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);
if (hw_rfkill)
return -ERFKILL; return -ERFKILL;
}
iwl_write32(trans, CSR_INT, 0xFFFFFFFF); iwl_write32(trans, CSR_INT, 0xFFFFFFFF);
@@ -1080,7 +1053,7 @@ static void iwl_tx_start(struct iwl_trans *trans)
iwl_write_targ_mem(trans, a, 0); iwl_write_targ_mem(trans, a, 0);
for (; a < trans_pcie->scd_base_addr + for (; a < trans_pcie->scd_base_addr +
SCD_TRANS_TBL_OFFSET_QUEUE( SCD_TRANS_TBL_OFFSET_QUEUE(
cfg(trans)->base_params->num_of_queues); trans->cfg->base_params->num_of_queues);
a += 4) a += 4)
iwl_write_targ_mem(trans, a, 0); iwl_write_targ_mem(trans, a, 0);
@@ -1103,7 +1076,7 @@ static void iwl_tx_start(struct iwl_trans *trans)
iwl_write_prph(trans, SCD_AGGR_SEL, 0); iwl_write_prph(trans, SCD_AGGR_SEL, 0);
/* initiate the queues */ /* initiate the queues */
for (i = 0; i < cfg(trans)->base_params->num_of_queues; i++) { for (i = 0; i < trans->cfg->base_params->num_of_queues; i++) {
iwl_write_prph(trans, SCD_QUEUE_RDPTR(i), 0); iwl_write_prph(trans, SCD_QUEUE_RDPTR(i), 0);
iwl_write_direct32(trans, HBUS_TARG_WRPTR, 0 | (i << 8)); iwl_write_direct32(trans, HBUS_TARG_WRPTR, 0 | (i << 8));
iwl_write_targ_mem(trans, trans_pcie->scd_base_addr + iwl_write_targ_mem(trans, trans_pcie->scd_base_addr +
@@ -1120,7 +1093,7 @@ static void iwl_tx_start(struct iwl_trans *trans)
} }
iwl_write_prph(trans, SCD_INTERRUPT_MASK, iwl_write_prph(trans, SCD_INTERRUPT_MASK,
IWL_MASK(0, cfg(trans)->base_params->num_of_queues)); IWL_MASK(0, trans->cfg->base_params->num_of_queues));
/* Activate all Tx DMA/FIFO channels */ /* Activate all Tx DMA/FIFO channels */
iwl_trans_txq_set_sched(trans, IWL_MASK(0, 7)); iwl_trans_txq_set_sched(trans, IWL_MASK(0, 7));
@@ -1188,7 +1161,7 @@ static int iwl_trans_tx_stop(struct iwl_trans *trans)
} }
/* Unmap DMA from host system and free skb's */ /* Unmap DMA from host system and free skb's */
for (txq_id = 0; txq_id < cfg(trans)->base_params->num_of_queues; for (txq_id = 0; txq_id < trans->cfg->base_params->num_of_queues;
txq_id++) txq_id++)
iwl_tx_queue_unmap(trans, txq_id); iwl_tx_queue_unmap(trans, txq_id);
@@ -1240,6 +1213,8 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
iwl_disable_interrupts(trans); iwl_disable_interrupts(trans);
spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); spin_unlock_irqrestore(&trans_pcie->irq_lock, flags);
iwl_enable_rfkill_int(trans);
/* wait to make sure we flush pending tasklet*/ /* wait to make sure we flush pending tasklet*/
synchronize_irq(trans_pcie->irq); synchronize_irq(trans_pcie->irq);
tasklet_kill(&trans_pcie->irq_tasklet); tasklet_kill(&trans_pcie->irq_tasklet);
@@ -1296,15 +1271,15 @@ static int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
spin_lock(&txq->lock); spin_lock(&txq->lock);
/* Set up driver data for this TFD */ /* Set up driver data for this TFD */
txq->skbs[q->write_ptr] = skb; txq->entries[q->write_ptr].skb = skb;
txq->cmd[q->write_ptr] = dev_cmd; txq->entries[q->write_ptr].cmd = dev_cmd;
dev_cmd->hdr.cmd = REPLY_TX; dev_cmd->hdr.cmd = REPLY_TX;
dev_cmd->hdr.sequence = cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) | dev_cmd->hdr.sequence = cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) |
INDEX_TO_SEQ(q->write_ptr))); INDEX_TO_SEQ(q->write_ptr)));
/* Set up first empty entry in queue's array of Tx/cmd buffers */ /* Set up first empty entry in queue's array of Tx/cmd buffers */
out_meta = &txq->meta[q->write_ptr]; out_meta = &txq->entries[q->write_ptr].meta;
/* /*
* Use the first empty entry in this queue's command buffer array * Use the first empty entry in this queue's command buffer array
@@ -1450,8 +1425,10 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans)
iwl_apm_init(trans); iwl_apm_init(trans);
hw_rfkill = !(iwl_read32(trans, CSR_GP_CNTRL) & /* From now on, the op_mode will be kept updated about RF kill state */
CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); iwl_enable_rfkill_int(trans);
hw_rfkill = iwl_is_rfkill_set(trans);
iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);
return err; return err;
@@ -1464,14 +1441,37 @@ error:
return err; return err;
} }
static void iwl_trans_pcie_stop_hw(struct iwl_trans *trans) static void iwl_trans_pcie_stop_hw(struct iwl_trans *trans,
bool op_mode_leaving)
{ {
bool hw_rfkill;
unsigned long flags;
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
iwl_apm_stop(trans); iwl_apm_stop(trans);
spin_lock_irqsave(&trans_pcie->irq_lock, flags);
iwl_disable_interrupts(trans);
spin_unlock_irqrestore(&trans_pcie->irq_lock, flags);
iwl_write32(trans, CSR_INT, 0xFFFFFFFF); iwl_write32(trans, CSR_INT, 0xFFFFFFFF);
/* Even if we stop the HW, we still want the RF kill interrupt */ if (!op_mode_leaving) {
iwl_enable_rfkill_int(trans); /*
* Even if we stop the HW, we still want the RF kill
* interrupt
*/
iwl_enable_rfkill_int(trans);
/*
* Check again since the RF kill state may have changed while
* all the interrupts were disabled, in this case we couldn't
* receive the RF kill interrupt and update the state in the
* op_mode.
*/
hw_rfkill = iwl_is_rfkill_set(trans);
iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);
}
} }
static void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, static void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn,
@@ -1548,7 +1548,7 @@ static void iwl_trans_pcie_configure(struct iwl_trans *trans,
trans_pcie->command_names = trans_cfg->command_names; trans_pcie->command_names = trans_cfg->command_names;
} }
static void iwl_trans_pcie_free(struct iwl_trans *trans) void iwl_trans_pcie_free(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie =
IWL_TRANS_GET_PCIE_TRANS(trans); IWL_TRANS_GET_PCIE_TRANS(trans);
@@ -1567,7 +1567,6 @@ static void iwl_trans_pcie_free(struct iwl_trans *trans)
pci_release_regions(trans_pcie->pci_dev); pci_release_regions(trans_pcie->pci_dev);
pci_disable_device(trans_pcie->pci_dev); pci_disable_device(trans_pcie->pci_dev);
trans->shrd->trans = NULL;
kfree(trans); kfree(trans);
} }
@@ -1591,16 +1590,14 @@ static int iwl_trans_pcie_resume(struct iwl_trans *trans)
{ {
bool hw_rfkill; bool hw_rfkill;
hw_rfkill = !(iwl_read32(trans, CSR_GP_CNTRL) & iwl_enable_rfkill_int(trans);
CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW);
if (hw_rfkill)
iwl_enable_rfkill_int(trans);
else
iwl_enable_interrupts(trans);
hw_rfkill = iwl_is_rfkill_set(trans);
iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);
if (!hw_rfkill)
iwl_enable_interrupts(trans);
return 0; return 0;
} }
#endif /* CONFIG_PM_SLEEP */ #endif /* CONFIG_PM_SLEEP */
@@ -1617,7 +1614,7 @@ static int iwl_trans_pcie_wait_tx_queue_empty(struct iwl_trans *trans)
int ret = 0; int ret = 0;
/* waiting for all the tx frames complete might take a while */ /* waiting for all the tx frames complete might take a while */
for (cnt = 0; cnt < cfg(trans)->base_params->num_of_queues; cnt++) { for (cnt = 0; cnt < trans->cfg->base_params->num_of_queues; cnt++) {
if (cnt == trans_pcie->cmd_queue) if (cnt == trans_pcie->cmd_queue)
continue; continue;
txq = &trans_pcie->txq[cnt]; txq = &trans_pcie->txq[cnt];
@@ -1829,17 +1826,16 @@ static ssize_t iwl_dbgfs_tx_queue_read(struct file *file,
int ret; int ret;
size_t bufsz; size_t bufsz;
bufsz = sizeof(char) * 64 * cfg(trans)->base_params->num_of_queues; bufsz = sizeof(char) * 64 * trans->cfg->base_params->num_of_queues;
if (!trans_pcie->txq) { if (!trans_pcie->txq)
IWL_ERR(trans, "txq not ready\n");
return -EAGAIN; return -EAGAIN;
}
buf = kzalloc(bufsz, GFP_KERNEL); buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
for (cnt = 0; cnt < cfg(trans)->base_params->num_of_queues; cnt++) { for (cnt = 0; cnt < trans->cfg->base_params->num_of_queues; cnt++) {
txq = &trans_pcie->txq[cnt]; txq = &trans_pcie->txq[cnt];
q = &txq->q; q = &txq->q;
pos += scnprintf(buf + pos, bufsz - pos, pos += scnprintf(buf + pos, bufsz - pos,
@@ -1895,10 +1891,8 @@ static ssize_t iwl_dbgfs_interrupt_read(struct file *file,
ssize_t ret; ssize_t ret;
buf = kzalloc(bufsz, GFP_KERNEL); buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) { if (!buf)
IWL_ERR(trans, "Can not allocate Buffer\n");
return -ENOMEM; return -ENOMEM;
}
pos += scnprintf(buf + pos, bufsz - pos, pos += scnprintf(buf + pos, bufsz - pos,
"Interrupt Statistics Report:\n"); "Interrupt Statistics Report:\n");
@@ -2049,7 +2043,7 @@ static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans,
#endif /*CONFIG_IWLWIFI_DEBUGFS */ #endif /*CONFIG_IWLWIFI_DEBUGFS */
const struct iwl_trans_ops trans_ops_pcie = { static const struct iwl_trans_ops trans_ops_pcie = {
.start_hw = iwl_trans_pcie_start_hw, .start_hw = iwl_trans_pcie_start_hw,
.stop_hw = iwl_trans_pcie_stop_hw, .stop_hw = iwl_trans_pcie_stop_hw,
.fw_alive = iwl_trans_pcie_fw_alive, .fw_alive = iwl_trans_pcie_fw_alive,
@@ -2066,8 +2060,6 @@ const struct iwl_trans_ops trans_ops_pcie = {
.tx_agg_disable = iwl_trans_pcie_tx_agg_disable, .tx_agg_disable = iwl_trans_pcie_tx_agg_disable,
.tx_agg_setup = iwl_trans_pcie_tx_agg_setup, .tx_agg_setup = iwl_trans_pcie_tx_agg_setup,
.free = iwl_trans_pcie_free,
.dbgfs_register = iwl_trans_pcie_dbgfs_register, .dbgfs_register = iwl_trans_pcie_dbgfs_register,
.wait_tx_queue_empty = iwl_trans_pcie_wait_tx_queue_empty, .wait_tx_queue_empty = iwl_trans_pcie_wait_tx_queue_empty,
@@ -2083,9 +2075,9 @@ const struct iwl_trans_ops trans_ops_pcie = {
.set_pmi = iwl_trans_pcie_set_pmi, .set_pmi = iwl_trans_pcie_set_pmi,
}; };
struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd, struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
struct pci_dev *pdev, const struct pci_device_id *ent,
const struct pci_device_id *ent) const struct iwl_cfg *cfg)
{ {
struct iwl_trans_pcie *trans_pcie; struct iwl_trans_pcie *trans_pcie;
struct iwl_trans *trans; struct iwl_trans *trans;
@@ -2101,7 +2093,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd,
trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
trans->ops = &trans_ops_pcie; trans->ops = &trans_ops_pcie;
trans->shrd = shrd; trans->cfg = cfg;
trans_pcie->trans = trans; trans_pcie->trans = trans;
spin_lock_init(&trans_pcie->irq_lock); spin_lock_init(&trans_pcie->irq_lock);
init_waitqueue_head(&trans_pcie->ucode_write_waitq); init_waitqueue_head(&trans_pcie->ucode_write_waitq);

View File

@@ -66,8 +66,9 @@
#include <linux/ieee80211.h> #include <linux/ieee80211.h>
#include <linux/mm.h> /* for page_address */ #include <linux/mm.h> /* for page_address */
#include "iwl-shared.h"
#include "iwl-debug.h" #include "iwl-debug.h"
#include "iwl-config.h"
#include "iwl-fw.h"
/** /**
* DOC: Transport layer - what is it ? * DOC: Transport layer - what is it ?
@@ -104,13 +105,6 @@
* 6) Eventually, the free function will be called. * 6) Eventually, the free function will be called.
*/ */
struct iwl_priv;
struct iwl_shared;
struct iwl_op_mode;
struct fw_img;
struct sk_buff;
struct dentry;
/** /**
* DOC: Host command section * DOC: Host command section
* *
@@ -326,6 +320,8 @@ struct iwl_trans_config {
const char **command_names; const char **command_names;
}; };
struct iwl_trans;
/** /**
* struct iwl_trans_ops - transport specific operations * struct iwl_trans_ops - transport specific operations
* *
@@ -334,7 +330,8 @@ struct iwl_trans_config {
* @start_hw: starts the HW- from that point on, the HW can send interrupts * @start_hw: starts the HW- from that point on, the HW can send interrupts
* May sleep * May sleep
* @stop_hw: stops the HW- from that point on, the HW will be in low power but * @stop_hw: stops the HW- from that point on, the HW will be in low power but
* will still issue interrupt if the HW RF kill is triggered. * will still issue interrupt if the HW RF kill is triggered unless
* op_mode_leaving is true.
* May sleep * May sleep
* @start_fw: allocates and inits all the resources for the transport * @start_fw: allocates and inits all the resources for the transport
* layer. Also kick a fw image. * layer. Also kick a fw image.
@@ -357,10 +354,6 @@ struct iwl_trans_config {
* May sleep * May sleep
* @tx_agg_disable: de-configure a Tx queue to send AMPDUs * @tx_agg_disable: de-configure a Tx queue to send AMPDUs
* Must be atomic * Must be atomic
* @free: release all the ressource for the transport layer itself such as
* irq, tasklet etc... From this point on, the device may not issue
* any interrupt (incl. RFKILL).
* May sleep
* @wait_tx_queue_empty: wait until all tx queues are empty * @wait_tx_queue_empty: wait until all tx queues are empty
* May sleep * May sleep
* @dbgfs_register: add the dbgfs files under this directory. Files will be * @dbgfs_register: add the dbgfs files under this directory. Files will be
@@ -378,7 +371,7 @@ struct iwl_trans_config {
struct iwl_trans_ops { struct iwl_trans_ops {
int (*start_hw)(struct iwl_trans *iwl_trans); int (*start_hw)(struct iwl_trans *iwl_trans);
void (*stop_hw)(struct iwl_trans *iwl_trans); void (*stop_hw)(struct iwl_trans *iwl_trans, bool op_mode_leaving);
int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw); int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw);
void (*fw_alive)(struct iwl_trans *trans); void (*fw_alive)(struct iwl_trans *trans);
void (*stop_device)(struct iwl_trans *trans); void (*stop_device)(struct iwl_trans *trans);
@@ -396,8 +389,6 @@ struct iwl_trans_ops {
int sta_id, int tid, int frame_limit, u16 ssn); int sta_id, int tid, int frame_limit, u16 ssn);
void (*tx_agg_disable)(struct iwl_trans *trans, int queue); void (*tx_agg_disable)(struct iwl_trans *trans, int queue);
void (*free)(struct iwl_trans *trans);
int (*dbgfs_register)(struct iwl_trans *trans, struct dentry* dir); int (*dbgfs_register)(struct iwl_trans *trans, struct dentry* dir);
int (*wait_tx_queue_empty)(struct iwl_trans *trans); int (*wait_tx_queue_empty)(struct iwl_trans *trans);
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
@@ -428,7 +419,7 @@ enum iwl_trans_state {
* *
* @ops - pointer to iwl_trans_ops * @ops - pointer to iwl_trans_ops
* @op_mode - pointer to the op_mode * @op_mode - pointer to the op_mode
* @shrd - pointer to iwl_shared which holds shared data from the upper layer * @cfg - pointer to the configuration
* @reg_lock - protect hw register access * @reg_lock - protect hw register access
* @dev - pointer to struct device * that represents the device * @dev - pointer to struct device * that represents the device
* @hw_id: a u32 with the ID of the device / subdevice. * @hw_id: a u32 with the ID of the device / subdevice.
@@ -440,7 +431,7 @@ enum iwl_trans_state {
struct iwl_trans { struct iwl_trans {
const struct iwl_trans_ops *ops; const struct iwl_trans_ops *ops;
struct iwl_op_mode *op_mode; struct iwl_op_mode *op_mode;
struct iwl_shared *shrd; const struct iwl_cfg *cfg;
enum iwl_trans_state state; enum iwl_trans_state state;
spinlock_t reg_lock; spinlock_t reg_lock;
@@ -477,11 +468,12 @@ static inline int iwl_trans_start_hw(struct iwl_trans *trans)
return trans->ops->start_hw(trans); return trans->ops->start_hw(trans);
} }
static inline void iwl_trans_stop_hw(struct iwl_trans *trans) static inline void iwl_trans_stop_hw(struct iwl_trans *trans,
bool op_mode_leaving)
{ {
might_sleep(); might_sleep();
trans->ops->stop_hw(trans); trans->ops->stop_hw(trans, op_mode_leaving);
trans->state = IWL_TRANS_NO_FW; trans->state = IWL_TRANS_NO_FW;
} }
@@ -566,11 +558,6 @@ static inline void iwl_trans_tx_agg_setup(struct iwl_trans *trans, int queue,
frame_limit, ssn); frame_limit, ssn);
} }
static inline void iwl_trans_free(struct iwl_trans *trans)
{
trans->ops->free(trans);
}
static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans) static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans)
{ {
WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE, WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
@@ -618,19 +605,9 @@ static inline void iwl_trans_set_pmi(struct iwl_trans *trans, bool state)
} }
/***************************************************** /*****************************************************
* Transport layers implementations + their allocation function * driver (transport) register/unregister functions
******************************************************/ ******************************************************/
struct pci_dev;
struct pci_device_id;
extern const struct iwl_trans_ops trans_ops_pcie;
struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd,
struct pci_dev *pdev,
const struct pci_device_id *ent);
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);
extern const struct iwl_trans_ops trans_ops_idi;
struct iwl_trans *iwl_trans_idi_alloc(struct iwl_shared *shrd,
void *pdev_void,
const void *ent_void);
#endif /* __iwl_trans_h__ */ #endif /* __iwl_trans_h__ */

View File

@@ -31,7 +31,6 @@
#include <linux/init.h> #include <linux/init.h>
#include "iwl-dev.h" #include "iwl-dev.h"
#include "iwl-core.h"
#include "iwl-io.h" #include "iwl-io.h"
#include "iwl-agn-hw.h" #include "iwl-agn-hw.h"
#include "iwl-agn.h" #include "iwl-agn.h"
@@ -145,8 +144,8 @@ int iwl_init_alive_start(struct iwl_priv *priv)
{ {
int ret; int ret;
if (cfg(priv)->bt_params && if (priv->cfg->bt_params &&
cfg(priv)->bt_params->advanced_bt_coexist) { priv->cfg->bt_params->advanced_bt_coexist) {
/* /*
* Tell uCode we are ready to perform calibration * Tell uCode we are ready to perform calibration
* need to perform this before any calibration * need to perform this before any calibration
@@ -168,8 +167,8 @@ int iwl_init_alive_start(struct iwl_priv *priv)
* temperature offset calibration is only needed for runtime ucode, * temperature offset calibration is only needed for runtime ucode,
* so prepare the value now. * so prepare the value now.
*/ */
if (cfg(priv)->need_temp_offset_calib) { if (priv->cfg->need_temp_offset_calib) {
if (cfg(priv)->temp_offset_v2) if (priv->cfg->temp_offset_v2)
return iwl_set_temperature_offset_calib_v2(priv); return iwl_set_temperature_offset_calib_v2(priv);
else else
return iwl_set_temperature_offset_calib(priv); return iwl_set_temperature_offset_calib(priv);
@@ -244,7 +243,7 @@ static int iwl_alive_notify(struct iwl_priv *priv)
{ {
int ret; int ret;
iwl_trans_fw_alive(trans(priv)); iwl_trans_fw_alive(priv->trans);
priv->passive_no_rx = false; priv->passive_no_rx = false;
priv->transport_queue_stop = 0; priv->transport_queue_stop = 0;
@@ -253,7 +252,7 @@ static int iwl_alive_notify(struct iwl_priv *priv)
if (ret) if (ret)
return ret; return ret;
if (!cfg(priv)->no_xtal_calib) { if (!priv->cfg->no_xtal_calib) {
ret = iwl_set_Xtal_calib(priv); ret = iwl_set_Xtal_calib(priv);
if (ret) if (ret)
return ret; return ret;
@@ -282,9 +281,9 @@ static int iwl_verify_sec_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(trans(priv), HBUS_TARG_MEM_RADDR, iwl_write_direct32(priv->trans, HBUS_TARG_MEM_RADDR,
i + fw_desc->offset); i + fw_desc->offset);
val = iwl_read32(trans(priv), HBUS_TARG_MEM_RDAT); val = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT);
if (val != le32_to_cpu(*image)) if (val != le32_to_cpu(*image))
return -EIO; return -EIO;
} }
@@ -303,14 +302,14 @@ static void iwl_print_mismatch_sec(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(trans(priv), HBUS_TARG_MEM_RADDR, iwl_write_direct32(priv->trans, HBUS_TARG_MEM_RADDR,
fw_desc->offset); fw_desc->offset);
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(trans(priv), HBUS_TARG_MEM_RDAT); val = iwl_read32(priv->trans, 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",
@@ -402,7 +401,7 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
alive_cmd, ARRAY_SIZE(alive_cmd), alive_cmd, ARRAY_SIZE(alive_cmd),
iwl_alive_fn, &alive_data); iwl_alive_fn, &alive_data);
ret = iwl_trans_start_fw(trans(priv), fw); ret = iwl_trans_start_fw(priv->trans, fw);
if (ret) { if (ret) {
priv->cur_ucode = old_type; priv->cur_ucode = old_type;
iwl_remove_notification(&priv->notif_wait, &alive_wait); iwl_remove_notification(&priv->notif_wait, &alive_wait);
@@ -526,7 +525,7 @@ int iwl_run_init_ucode(struct iwl_priv *priv)
iwl_remove_notification(&priv->notif_wait, &calib_wait); iwl_remove_notification(&priv->notif_wait, &calib_wait);
out: out:
/* Whatever happened, stop the device */ /* Whatever happened, stop the device */
iwl_trans_stop_device(trans(priv)); iwl_trans_stop_device(priv->trans);
priv->ucode_loaded = false; priv->ucode_loaded = false;
return ret; return ret;

View File

@@ -5,6 +5,7 @@
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/sched.h>
#include "dev.h" #include "dev.h"
#include "decl.h" #include "decl.h"

View File

@@ -738,6 +738,50 @@ done:
return ret; return ret;
} }
static void if_cs_prog_firmware(struct lbs_private *priv, int ret,
const struct firmware *helper,
const struct firmware *mainfw)
{
struct if_cs_card *card = priv->card;
if (ret) {
pr_err("failed to find firmware (%d)\n", ret);
return;
}
/* Load the firmware */
ret = if_cs_prog_helper(card, helper);
if (ret == 0 && (card->model != MODEL_8305))
ret = if_cs_prog_real(card, mainfw);
if (ret)
goto out;
/* Now actually get the IRQ */
ret = request_irq(card->p_dev->irq, if_cs_interrupt,
IRQF_SHARED, DRV_NAME, card);
if (ret) {
pr_err("error in request_irq\n");
goto out;
}
/*
* Clear any interrupt cause that happened while sending
* firmware/initializing card
*/
if_cs_write16(card, IF_CS_CARD_INT_CAUSE, IF_CS_BIT_MASK);
if_cs_enable_ints(card);
/* And finally bring the card up */
priv->fw_ready = 1;
if (lbs_start_card(priv) != 0) {
pr_err("could not activate card\n");
free_irq(card->p_dev->irq, card);
}
out:
release_firmware(helper);
release_firmware(mainfw);
}
/********************************************************************/ /********************************************************************/
@@ -809,8 +853,6 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
unsigned int prod_id; unsigned int prod_id;
struct lbs_private *priv; struct lbs_private *priv;
struct if_cs_card *card; struct if_cs_card *card;
const struct firmware *helper = NULL;
const struct firmware *mainfw = NULL;
lbs_deb_enter(LBS_DEB_CS); lbs_deb_enter(LBS_DEB_CS);
@@ -890,20 +932,6 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
goto out2; goto out2;
} }
ret = lbs_get_firmware(&p_dev->dev, card->model, &fw_table[0],
&helper, &mainfw);
if (ret) {
pr_err("failed to find firmware (%d)\n", ret);
goto out2;
}
/* Load the firmware early, before calling into libertas.ko */
ret = if_cs_prog_helper(card, helper);
if (ret == 0 && (card->model != MODEL_8305))
ret = if_cs_prog_real(card, mainfw);
if (ret)
goto out2;
/* Make this card known to the libertas driver */ /* Make this card known to the libertas driver */
priv = lbs_add_card(card, &p_dev->dev); priv = lbs_add_card(card, &p_dev->dev);
if (!priv) { if (!priv) {
@@ -911,37 +939,22 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
goto out2; goto out2;
} }
/* Finish setting up fields in lbs_private */ /* Set up fields in lbs_private */
card->priv = priv; card->priv = priv;
priv->card = card; priv->card = card;
priv->hw_host_to_card = if_cs_host_to_card; priv->hw_host_to_card = if_cs_host_to_card;
priv->enter_deep_sleep = NULL; priv->enter_deep_sleep = NULL;
priv->exit_deep_sleep = NULL; priv->exit_deep_sleep = NULL;
priv->reset_deep_sleep_wakeup = NULL; priv->reset_deep_sleep_wakeup = NULL;
priv->fw_ready = 1;
/* Now actually get the IRQ */ /* Get firmware */
ret = request_irq(p_dev->irq, if_cs_interrupt, ret = lbs_get_firmware_async(priv, &p_dev->dev, card->model, fw_table,
IRQF_SHARED, DRV_NAME, card); if_cs_prog_firmware);
if (ret) { if (ret) {
pr_err("error in request_irq\n"); pr_err("failed to find firmware (%d)\n", ret);
goto out3; goto out3;
} }
/*
* Clear any interrupt cause that happened while sending
* firmware/initializing card
*/
if_cs_write16(card, IF_CS_CARD_INT_CAUSE, IF_CS_BIT_MASK);
if_cs_enable_ints(card);
/* And finally bring the card up */
if (lbs_start_card(priv) != 0) {
pr_err("could not activate card\n");
goto out3;
}
ret = 0;
goto out; goto out;
out3: out3:
@@ -951,9 +964,6 @@ out2:
out1: out1:
pcmcia_disable_device(p_dev); pcmcia_disable_device(p_dev);
out: out:
release_firmware(helper);
release_firmware(mainfw);
lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret);
return ret; return ret;
} }

View File

@@ -233,21 +233,27 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
skb_push(skb_aggr, headroom); skb_push(skb_aggr, headroom);
/* if (adapter->iface_type == MWIFIEX_USB) {
* Padding per MSDU will affect the length of next adapter->data_sent = true;
* packet and hence the exact length of next packet ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA,
* is uncertain here. skb_aggr, NULL);
* } else {
* Also, aggregation of transmission buffer, while /*
* downloading the data to the card, wont gain much * Padding per MSDU will affect the length of next
* on the AMSDU packets as the AMSDU packets utilizes * packet and hence the exact length of next packet
* the transmission buffer space to the maximum * is uncertain here.
* (adapter->tx_buf_size). *
*/ * Also, aggregation of transmission buffer, while
tx_param.next_pkt_len = 0; * downloading the data to the card, wont gain much
* on the AMSDU packets as the AMSDU packets utilizes
* the transmission buffer space to the maximum
* (adapter->tx_buf_size).
*/
tx_param.next_pkt_len = 0;
ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA,
skb_aggr, &tx_param); skb_aggr, &tx_param);
}
switch (ret) { switch (ret) {
case -EBUSY: case -EBUSY:
spin_lock_irqsave(&priv->wmm.ra_list_spinlock, ra_list_flags); spin_lock_irqsave(&priv->wmm.ra_list_spinlock, ra_list_flags);

View File

@@ -30,3 +30,14 @@ config MWIFIEX_PCIE
If you choose to build it as a module, it will be called If you choose to build it as a module, it will be called
mwifiex_pcie. mwifiex_pcie.
config MWIFIEX_USB
tristate "Marvell WiFi-Ex Driver for USB8797"
depends on MWIFIEX && USB
select FW_LOADER
---help---
This adds support for wireless adapters based on Marvell
Avastar 88W8797 chipset with USB interface.
If you choose to build it as a module, it will be called
mwifiex_usb.

View File

@@ -42,3 +42,6 @@ obj-$(CONFIG_MWIFIEX_SDIO) += mwifiex_sdio.o
mwifiex_pcie-y += pcie.o mwifiex_pcie-y += pcie.o
obj-$(CONFIG_MWIFIEX_PCIE) += mwifiex_pcie.o obj-$(CONFIG_MWIFIEX_PCIE) += mwifiex_pcie.o
mwifiex_usb-y += usb.o
obj-$(CONFIG_MWIFIEX_USB) += mwifiex_usb.o

View File

@@ -139,6 +139,7 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
uint16_t cmd_size; uint16_t cmd_size;
struct timeval tstamp; struct timeval tstamp;
unsigned long flags; unsigned long flags;
__le32 tmp;
if (!adapter || !cmd_node) if (!adapter || !cmd_node)
return -1; return -1;
@@ -178,15 +179,28 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
le16_to_cpu(*(__le16 *) ((u8 *) host_cmd + S_DS_GEN)), cmd_size, le16_to_cpu(*(__le16 *) ((u8 *) host_cmd + S_DS_GEN)), cmd_size,
le16_to_cpu(host_cmd->seq_num)); le16_to_cpu(host_cmd->seq_num));
skb_push(cmd_node->cmd_skb, INTF_HEADER_LEN); if (adapter->iface_type == MWIFIEX_USB) {
tmp = cpu_to_le32(MWIFIEX_USB_TYPE_CMD);
ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, skb_push(cmd_node->cmd_skb, MWIFIEX_TYPE_LEN);
cmd_node->cmd_skb, NULL); memcpy(cmd_node->cmd_skb->data, &tmp, MWIFIEX_TYPE_LEN);
adapter->cmd_sent = true;
skb_pull(cmd_node->cmd_skb, INTF_HEADER_LEN); ret = adapter->if_ops.host_to_card(adapter,
MWIFIEX_USB_EP_CMD_EVENT,
cmd_node->cmd_skb, NULL);
skb_pull(cmd_node->cmd_skb, MWIFIEX_TYPE_LEN);
if (ret == -EBUSY)
cmd_node->cmd_skb = NULL;
} else {
skb_push(cmd_node->cmd_skb, INTF_HEADER_LEN);
ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD,
cmd_node->cmd_skb, NULL);
skb_pull(cmd_node->cmd_skb, INTF_HEADER_LEN);
}
if (ret == -1) { if (ret == -1) {
dev_err(adapter->dev, "DNLD_CMD: host to card failed\n"); dev_err(adapter->dev, "DNLD_CMD: host to card failed\n");
if (adapter->iface_type == MWIFIEX_USB)
adapter->cmd_sent = false;
if (cmd_node->wait_q_enabled) if (cmd_node->wait_q_enabled)
adapter->cmd_wait_q.status = -1; adapter->cmd_wait_q.status = -1;
mwifiex_insert_cmd_to_free_q(adapter, adapter->curr_cmd); mwifiex_insert_cmd_to_free_q(adapter, adapter->curr_cmd);
@@ -232,6 +246,9 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
struct mwifiex_opt_sleep_confirm *sleep_cfm_buf = struct mwifiex_opt_sleep_confirm *sleep_cfm_buf =
(struct mwifiex_opt_sleep_confirm *) (struct mwifiex_opt_sleep_confirm *)
adapter->sleep_cfm->data; adapter->sleep_cfm->data;
struct sk_buff *sleep_cfm_tmp;
__le32 tmp;
priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
sleep_cfm_buf->seq_num = sleep_cfm_buf->seq_num =
@@ -240,10 +257,28 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
priv->bss_type))); priv->bss_type)));
adapter->seq_num++; adapter->seq_num++;
skb_push(adapter->sleep_cfm, INTF_HEADER_LEN); if (adapter->iface_type == MWIFIEX_USB) {
ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, sleep_cfm_tmp =
adapter->sleep_cfm, NULL); dev_alloc_skb(sizeof(struct mwifiex_opt_sleep_confirm)
skb_pull(adapter->sleep_cfm, INTF_HEADER_LEN); + MWIFIEX_TYPE_LEN);
skb_put(sleep_cfm_tmp, sizeof(struct mwifiex_opt_sleep_confirm)
+ MWIFIEX_TYPE_LEN);
tmp = cpu_to_le32(MWIFIEX_USB_TYPE_CMD);
memcpy(sleep_cfm_tmp->data, &tmp, MWIFIEX_TYPE_LEN);
memcpy(sleep_cfm_tmp->data + MWIFIEX_TYPE_LEN,
adapter->sleep_cfm->data,
sizeof(struct mwifiex_opt_sleep_confirm));
ret = adapter->if_ops.host_to_card(adapter,
MWIFIEX_USB_EP_CMD_EVENT,
sleep_cfm_tmp, NULL);
if (ret != -EBUSY)
dev_kfree_skb_any(sleep_cfm_tmp);
} else {
skb_push(adapter->sleep_cfm, INTF_HEADER_LEN);
ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD,
adapter->sleep_cfm, NULL);
skb_pull(adapter->sleep_cfm, INTF_HEADER_LEN);
}
if (ret == -1) { if (ret == -1) {
dev_err(adapter->dev, "SLEEP_CFM: failed\n"); dev_err(adapter->dev, "SLEEP_CFM: failed\n");
@@ -343,7 +378,12 @@ int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter)
} }
if (!cmd_array[i].resp_skb) if (!cmd_array[i].resp_skb)
continue; continue;
dev_kfree_skb_any(cmd_array[i].resp_skb);
if (adapter->iface_type == MWIFIEX_USB)
adapter->if_ops.cmdrsp_complete(adapter,
cmd_array[i].resp_skb);
else
dev_kfree_skb_any(cmd_array[i].resp_skb);
} }
/* Release struct cmd_ctrl_node */ /* Release struct cmd_ctrl_node */
if (adapter->cmd_pool) { if (adapter->cmd_pool) {
@@ -1083,6 +1123,7 @@ mwifiex_process_hs_config(struct mwifiex_adapter *adapter)
MWIFIEX_BSS_ROLE_ANY), MWIFIEX_BSS_ROLE_ANY),
false); false);
} }
EXPORT_SYMBOL_GPL(mwifiex_process_hs_config);
/* /*
* This function handles the command response of a sleep confirm command. * This function handles the command response of a sleep confirm command.

View File

@@ -53,6 +53,7 @@
#define MWIFIEX_RATE_BITMAP_MCS127 159 #define MWIFIEX_RATE_BITMAP_MCS127 159
#define MWIFIEX_RX_DATA_BUF_SIZE (4 * 1024) #define MWIFIEX_RX_DATA_BUF_SIZE (4 * 1024)
#define MWIFIEX_RX_CMD_BUF_SIZE (2 * 1024)
#define MWIFIEX_RTS_MIN_VALUE (0) #define MWIFIEX_RTS_MIN_VALUE (0)
#define MWIFIEX_RTS_MAX_VALUE (2347) #define MWIFIEX_RTS_MAX_VALUE (2347)

View File

@@ -81,6 +81,11 @@ enum KEY_TYPE_ID {
#define FIRMWARE_READY_SDIO 0xfedc #define FIRMWARE_READY_SDIO 0xfedc
#define FIRMWARE_READY_PCIE 0xfedcba00 #define FIRMWARE_READY_PCIE 0xfedcba00
enum mwifiex_usb_ep {
MWIFIEX_USB_EP_CMD_EVENT = 1,
MWIFIEX_USB_EP_DATA = 2,
};
enum MWIFIEX_802_11_PRIVACY_FILTER { enum MWIFIEX_802_11_PRIVACY_FILTER {
MWIFIEX_802_11_PRIV_FILTER_ACCEPT_ALL, MWIFIEX_802_11_PRIV_FILTER_ACCEPT_ALL,
MWIFIEX_802_11_PRIV_FILTER_8021X_WEP MWIFIEX_802_11_PRIV_FILTER_8021X_WEP

View File

@@ -188,10 +188,10 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter)
adapter->cmd_sent = false; adapter->cmd_sent = false;
if (adapter->iface_type == MWIFIEX_PCIE) if (adapter->iface_type == MWIFIEX_SDIO)
adapter->data_sent = false;
else
adapter->data_sent = true; adapter->data_sent = true;
else
adapter->data_sent = false;
adapter->cmd_resp_received = false; adapter->cmd_resp_received = false;
adapter->event_received = false; adapter->event_received = false;
@@ -379,7 +379,8 @@ mwifiex_free_adapter(struct mwifiex_adapter *adapter)
dev_dbg(adapter->dev, "info: free scan table\n"); dev_dbg(adapter->dev, "info: free scan table\n");
adapter->if_ops.cleanup_if(adapter); if (adapter->if_ops.cleanup_if)
adapter->if_ops.cleanup_if(adapter);
if (adapter->sleep_cfm) if (adapter->sleep_cfm)
dev_kfree_skb_any(adapter->sleep_cfm); dev_kfree_skb_any(adapter->sleep_cfm);
@@ -419,6 +420,8 @@ int mwifiex_init_lock_list(struct mwifiex_adapter *adapter)
spin_lock_init(&adapter->cmd_pending_q_lock); spin_lock_init(&adapter->cmd_pending_q_lock);
spin_lock_init(&adapter->scan_pending_q_lock); spin_lock_init(&adapter->scan_pending_q_lock);
skb_queue_head_init(&adapter->usb_rx_data_q);
for (i = 0; i < adapter->priv_num; ++i) { for (i = 0; i < adapter->priv_num; ++i) {
INIT_LIST_HEAD(&adapter->bss_prio_tbl[i].bss_prio_head); INIT_LIST_HEAD(&adapter->bss_prio_tbl[i].bss_prio_head);
adapter->bss_prio_tbl[i].bss_prio_cur = NULL; adapter->bss_prio_tbl[i].bss_prio_cur = NULL;
@@ -574,6 +577,7 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter)
struct mwifiex_private *priv; struct mwifiex_private *priv;
s32 i; s32 i;
unsigned long flags; unsigned long flags;
struct sk_buff *skb;
/* mwifiex already shutdown */ /* mwifiex already shutdown */
if (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY) if (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY)
@@ -601,6 +605,18 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter)
spin_lock_irqsave(&adapter->mwifiex_lock, flags); spin_lock_irqsave(&adapter->mwifiex_lock, flags);
if (adapter->if_ops.data_complete) {
while ((skb = skb_dequeue(&adapter->usb_rx_data_q))) {
struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb);
priv = adapter->priv[rx_info->bss_num];
if (priv)
priv->stats.rx_dropped++;
adapter->if_ops.data_complete(adapter, skb);
}
}
/* Free adapter structure */ /* Free adapter structure */
mwifiex_free_adapter(adapter); mwifiex_free_adapter(adapter);
@@ -630,24 +646,28 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *adapter,
int ret; int ret;
u32 poll_num = 1; u32 poll_num = 1;
adapter->winner = 0; if (adapter->if_ops.check_fw_status) {
adapter->winner = 0;
/* Check if firmware is already running */ /* check if firmware is already running */
ret = adapter->if_ops.check_fw_status(adapter, poll_num); ret = adapter->if_ops.check_fw_status(adapter, poll_num);
if (!ret) { if (!ret) {
dev_notice(adapter->dev, dev_notice(adapter->dev,
"WLAN FW already running! Skip FW download\n"); "WLAN FW already running! Skip FW dnld\n");
goto done; goto done;
} }
poll_num = MAX_FIRMWARE_POLL_TRIES;
/* Check if we are the winner for downloading FW */ poll_num = MAX_FIRMWARE_POLL_TRIES;
if (!adapter->winner) {
dev_notice(adapter->dev, /* check if we are the winner for downloading FW */
"Other intf already running! Skip FW download\n"); if (!adapter->winner) {
poll_num = MAX_MULTI_INTERFACE_POLL_TRIES; dev_notice(adapter->dev,
goto poll_fw; "FW already running! Skip FW dnld\n");
poll_num = MAX_MULTI_INTERFACE_POLL_TRIES;
goto poll_fw;
}
} }
if (pmfw) { if (pmfw) {
/* Download firmware with helper */ /* Download firmware with helper */
ret = adapter->if_ops.prog_fw(adapter, pmfw); ret = adapter->if_ops.prog_fw(adapter, pmfw);
@@ -666,6 +686,8 @@ poll_fw:
} }
done: done:
/* re-enable host interrupt for mwifiex after fw dnld is successful */ /* re-enable host interrupt for mwifiex after fw dnld is successful */
adapter->if_ops.enable_int(adapter); if (adapter->if_ops.enable_int)
adapter->if_ops.enable_int(adapter);
return ret; return ret;
} }

View File

@@ -58,8 +58,9 @@ static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops,
memmove(&adapter->if_ops, if_ops, sizeof(struct mwifiex_if_ops)); memmove(&adapter->if_ops, if_ops, sizeof(struct mwifiex_if_ops));
/* card specific initialization has been deferred until now .. */ /* card specific initialization has been deferred until now .. */
if (adapter->if_ops.init_if(adapter)) if (adapter->if_ops.init_if)
goto error; if (adapter->if_ops.init_if(adapter))
goto error;
adapter->priv_num = 0; adapter->priv_num = 0;
@@ -140,6 +141,7 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter)
{ {
int ret = 0; int ret = 0;
unsigned long flags; unsigned long flags;
struct sk_buff *skb;
spin_lock_irqsave(&adapter->main_proc_lock, flags); spin_lock_irqsave(&adapter->main_proc_lock, flags);
@@ -161,7 +163,8 @@ process_start:
if (adapter->int_status) { if (adapter->int_status) {
if (adapter->hs_activated) if (adapter->hs_activated)
mwifiex_process_hs_config(adapter); mwifiex_process_hs_config(adapter);
adapter->if_ops.process_int_status(adapter); if (adapter->if_ops.process_int_status)
adapter->if_ops.process_int_status(adapter);
} }
/* Need to wake up the card ? */ /* Need to wake up the card ? */
@@ -174,6 +177,7 @@ process_start:
adapter->if_ops.wakeup(adapter); adapter->if_ops.wakeup(adapter);
continue; continue;
} }
if (IS_CARD_RX_RCVD(adapter)) { if (IS_CARD_RX_RCVD(adapter)) {
adapter->pm_wakeup_fw_try = false; adapter->pm_wakeup_fw_try = false;
if (adapter->ps_state == PS_STATE_SLEEP) if (adapter->ps_state == PS_STATE_SLEEP)
@@ -194,6 +198,11 @@ process_start:
} }
} }
/* Check Rx data for USB */
if (adapter->iface_type == MWIFIEX_USB)
while ((skb = skb_dequeue(&adapter->usb_rx_data_q)))
mwifiex_handle_rx_packet(adapter, skb);
/* Check for Cmd Resp */ /* Check for Cmd Resp */
if (adapter->cmd_resp_received) { if (adapter->cmd_resp_received) {
adapter->cmd_resp_received = false; adapter->cmd_resp_received = false;
@@ -317,7 +326,10 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context)
fw.fw_buf = (u8 *) adapter->firmware->data; fw.fw_buf = (u8 *) adapter->firmware->data;
fw.fw_len = adapter->firmware->size; fw.fw_len = adapter->firmware->size;
ret = mwifiex_dnld_fw(adapter, &fw); if (adapter->if_ops.dnld_fw)
ret = adapter->if_ops.dnld_fw(adapter, &fw);
else
ret = mwifiex_dnld_fw(adapter, &fw);
if (ret == -1) if (ret == -1)
goto done; goto done;
@@ -731,7 +743,8 @@ mwifiex_add_card(void *card, struct semaphore *sem,
err_init_fw: err_init_fw:
pr_debug("info: %s: unregister device\n", __func__); pr_debug("info: %s: unregister device\n", __func__);
adapter->if_ops.unregister_dev(adapter); if (adapter->if_ops.unregister_dev)
adapter->if_ops.unregister_dev(adapter);
err_registerdev: err_registerdev:
adapter->surprise_removed = true; adapter->surprise_removed = true;
mwifiex_terminate_workqueue(adapter); mwifiex_terminate_workqueue(adapter);
@@ -836,7 +849,8 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem)
/* Unregister device */ /* Unregister device */
dev_dbg(adapter->dev, "info: unregister device\n"); dev_dbg(adapter->dev, "info: unregister device\n");
adapter->if_ops.unregister_dev(adapter); if (adapter->if_ops.unregister_dev)
adapter->if_ops.unregister_dev(adapter);
/* Free adapter structure */ /* Free adapter structure */
dev_dbg(adapter->dev, "info: free adapter\n"); dev_dbg(adapter->dev, "info: free adapter\n");
mwifiex_free_adapter(adapter); mwifiex_free_adapter(adapter);

View File

@@ -92,9 +92,16 @@ enum {
#define MWIFIEX_OUI_NOT_PRESENT 0 #define MWIFIEX_OUI_NOT_PRESENT 0
#define MWIFIEX_OUI_PRESENT 1 #define MWIFIEX_OUI_PRESENT 1
/*
* Do not check for data_received for USB, as data_received
* is handled in mwifiex_usb_recv for USB
*/
#define IS_CARD_RX_RCVD(adapter) (adapter->cmd_resp_received || \ #define IS_CARD_RX_RCVD(adapter) (adapter->cmd_resp_received || \
adapter->event_received || \ adapter->event_received || \
adapter->data_received) ((adapter->iface_type != MWIFIEX_USB) && \
adapter->data_received) || \
((adapter->iface_type == MWIFIEX_USB) && \
!skb_queue_empty(&adapter->usb_rx_data_q)))
#define MWIFIEX_TYPE_CMD 1 #define MWIFIEX_TYPE_CMD 1
#define MWIFIEX_TYPE_DATA 0 #define MWIFIEX_TYPE_DATA 0
@@ -110,6 +117,11 @@ enum {
#define MWIFIEX_EVENT_HEADER_LEN 4 #define MWIFIEX_EVENT_HEADER_LEN 4
#define MWIFIEX_TYPE_LEN 4
#define MWIFIEX_USB_TYPE_CMD 0xF00DFACE
#define MWIFIEX_USB_TYPE_DATA 0xBEADC0DE
#define MWIFIEX_USB_TYPE_EVENT 0xBEEFFACE
struct mwifiex_dbg { struct mwifiex_dbg {
u32 num_cmd_host_to_card_failure; u32 num_cmd_host_to_card_failure;
u32 num_cmd_sleep_cfm_host_to_card_failure; u32 num_cmd_sleep_cfm_host_to_card_failure;
@@ -162,6 +174,7 @@ enum MWIFIEX_PS_STATE {
enum mwifiex_iface_type { enum mwifiex_iface_type {
MWIFIEX_SDIO, MWIFIEX_SDIO,
MWIFIEX_PCIE, MWIFIEX_PCIE,
MWIFIEX_USB
}; };
struct mwifiex_add_ba_param { struct mwifiex_add_ba_param {
@@ -546,6 +559,8 @@ struct mwifiex_if_ops {
void (*cleanup_mpa_buf) (struct mwifiex_adapter *); void (*cleanup_mpa_buf) (struct mwifiex_adapter *);
int (*cmdrsp_complete) (struct mwifiex_adapter *, struct sk_buff *); int (*cmdrsp_complete) (struct mwifiex_adapter *, struct sk_buff *);
int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *); int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *);
int (*data_complete) (struct mwifiex_adapter *, struct sk_buff *);
int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
}; };
struct mwifiex_adapter { struct mwifiex_adapter {
@@ -608,6 +623,7 @@ struct mwifiex_adapter {
struct list_head scan_pending_q; struct list_head scan_pending_q;
/* spin lock for scan_pending_q */ /* spin lock for scan_pending_q */
spinlock_t scan_pending_q_lock; spinlock_t scan_pending_q_lock;
struct sk_buff_head usb_rx_data_q;
u32 scan_processing; u32 scan_processing;
u16 region_code; u16 region_code;
struct mwifiex_802_11d_domain_reg domain_reg; struct mwifiex_802_11d_domain_reg domain_reg;

View File

@@ -1293,7 +1293,7 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta)
if (ret) if (ret)
return -1; return -1;
if (first_sta) { if (first_sta && (priv->adapter->iface_type != MWIFIEX_USB)) {
/* Enable auto deep sleep */ /* Enable auto deep sleep */
auto_ds.auto_ds = DEEP_SLEEP_ON; auto_ds.auto_ds = DEEP_SLEEP_ON;
auto_ds.idle_time = DEEP_SLEEP_IDLE_TIME; auto_ds.idle_time = DEEP_SLEEP_IDLE_TIME;

View File

@@ -145,7 +145,12 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter,
" rx_pkt_offset=%d, rx_pkt_length=%d\n", skb->len, " rx_pkt_offset=%d, rx_pkt_length=%d\n", skb->len,
local_rx_pd->rx_pkt_offset, local_rx_pd->rx_pkt_length); local_rx_pd->rx_pkt_offset, local_rx_pd->rx_pkt_length);
priv->stats.rx_dropped++; priv->stats.rx_dropped++;
dev_kfree_skb_any(skb);
if (adapter->if_ops.data_complete)
adapter->if_ops.data_complete(adapter, skb);
else
dev_kfree_skb_any(skb);
return ret; return ret;
} }
@@ -196,8 +201,12 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter,
(u8) local_rx_pd->rx_pkt_type, (u8) local_rx_pd->rx_pkt_type,
skb); skb);
if (ret || (rx_pkt_type == PKT_TYPE_BAR)) if (ret || (rx_pkt_type == PKT_TYPE_BAR)) {
dev_kfree_skb_any(skb); if (adapter->if_ops.data_complete)
adapter->if_ops.data_complete(adapter, skb);
else
dev_kfree_skb_any(skb);
}
if (ret) if (ret)
priv->stats.rx_dropped++; priv->stats.rx_dropped++;

View File

@@ -149,10 +149,14 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags)
local_tx_pd->bss_num = priv->bss_num; local_tx_pd->bss_num = priv->bss_num;
local_tx_pd->bss_type = priv->bss_type; local_tx_pd->bss_type = priv->bss_type;
skb_push(skb, INTF_HEADER_LEN); if (adapter->iface_type == MWIFIEX_USB) {
ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA,
ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, skb, NULL);
skb, NULL); } else {
skb_push(skb, INTF_HEADER_LEN);
ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA,
skb, NULL);
}
switch (ret) { switch (ret) {
case -EBUSY: case -EBUSY:
adapter->data_sent = true; adapter->data_sent = true;

View File

@@ -77,12 +77,23 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA)
local_tx_pd = local_tx_pd =
(struct txpd *) (head_ptr + INTF_HEADER_LEN); (struct txpd *) (head_ptr + INTF_HEADER_LEN);
if (adapter->iface_type == MWIFIEX_USB) {
ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, adapter->data_sent = true;
skb, tx_param); skb_pull(skb, INTF_HEADER_LEN);
ret = adapter->if_ops.host_to_card(adapter,
MWIFIEX_USB_EP_DATA,
skb, NULL);
} else {
ret = adapter->if_ops.host_to_card(adapter,
MWIFIEX_TYPE_DATA,
skb, tx_param);
}
} }
switch (ret) { switch (ret) {
case -ENOSR:
dev_err(adapter->dev, "data: -ENOSR is returned\n");
break;
case -EBUSY: case -EBUSY:
if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) && if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) &&
(adapter->pps_uapsd_mode) && (adapter->tx_lock_flag)) { (adapter->pps_uapsd_mode) && (adapter->tx_lock_flag)) {
@@ -135,6 +146,9 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter,
if (!priv) if (!priv)
goto done; goto done;
if (adapter->iface_type == MWIFIEX_USB)
adapter->data_sent = false;
mwifiex_set_trans_start(priv->netdev); mwifiex_set_trans_start(priv->netdev);
if (!status) { if (!status) {
priv->stats.tx_packets++; priv->stats.tx_packets++;
@@ -162,4 +176,5 @@ done:
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(mwifiex_write_data_complete);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,99 @@
/*
* This file contains definitions for mwifiex USB interface driver.
*
* Copyright (C) 2012, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this File in
* accordance with the terms and conditions of the License, a copy of which
* is available by writing to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
*
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
* this warranty disclaimer.
*/
#ifndef _MWIFIEX_USB_H
#define _MWIFIEX_USB_H
#include <linux/usb.h>
#define USB8797_VID 0x1286
#define USB8797_PID_1 0x2043
#define USB8797_PID_2 0x2044
#define USB8797_FW_DNLD 1
#define USB8797_FW_READY 2
#define USB8797_FW_MAX_RETRY 3
#define MWIFIEX_TX_DATA_URB 6
#define MWIFIEX_RX_DATA_URB 6
#define MWIFIEX_USB_TIMEOUT 100
#define USB8797_DEFAULT_FW_NAME "mrvl/usb8797_uapsta.bin"
#define FW_DNLD_TX_BUF_SIZE 620
#define FW_DNLD_RX_BUF_SIZE 2048
#define FW_HAS_LAST_BLOCK 0x00000004
#define FW_DATA_XMIT_SIZE \
(sizeof(struct fw_header) + dlen + sizeof(u32))
struct urb_context {
struct mwifiex_adapter *adapter;
struct sk_buff *skb;
struct urb *urb;
u8 ep;
};
struct usb_card_rec {
struct mwifiex_adapter *adapter;
struct usb_device *udev;
struct usb_interface *intf;
u8 rx_cmd_ep;
struct urb_context rx_cmd;
atomic_t rx_cmd_urb_pending;
struct urb_context rx_data_list[MWIFIEX_RX_DATA_URB];
u8 usb_boot_state;
u8 rx_data_ep;
atomic_t rx_data_urb_pending;
u8 tx_data_ep;
u8 tx_cmd_ep;
atomic_t tx_data_urb_pending;
atomic_t tx_cmd_urb_pending;
int bulk_out_maxpktsize;
struct urb_context tx_cmd;
int tx_data_ix;
struct urb_context tx_data_list[MWIFIEX_TX_DATA_URB];
};
struct fw_header {
__le32 dnld_cmd;
__le32 base_addr;
__le32 data_len;
__le32 crc;
};
struct fw_sync_header {
__le32 cmd;
__le32 seq_num;
};
struct fw_data {
struct fw_header fw_hdr;
__le32 seq_num;
u8 data[1];
};
/* This function is called after the card has woken up. */
static inline int
mwifiex_pm_wakeup_card_complete(struct mwifiex_adapter *adapter)
{
return 0;
}
#endif /*_MWIFIEX_USB_H */

View File

@@ -167,6 +167,28 @@ int mwifiex_recv_packet(struct mwifiex_adapter *adapter, struct sk_buff *skb)
skb->dev = priv->netdev; skb->dev = priv->netdev;
skb->protocol = eth_type_trans(skb, priv->netdev); skb->protocol = eth_type_trans(skb, priv->netdev);
skb->ip_summed = CHECKSUM_NONE; skb->ip_summed = CHECKSUM_NONE;
/* This is required only in case of 11n and USB as we alloc
* a buffer of 4K only if its 11N (to be able to receive 4K
* AMSDU packets). In case of SD we allocate buffers based
* on the size of packet and hence this is not needed.
*
* Modifying the truesize here as our allocation for each
* skb is 4K but we only receive 2K packets and this cause
* the kernel to start dropping packets in case where
* application has allocated buffer based on 2K size i.e.
* if there a 64K packet received (in IP fragments and
* application allocates 64K to receive this packet but
* this packet would almost double up because we allocate
* each 1.5K fragment in 4K and pass it up. As soon as the
* 64K limit hits kernel will start to drop rest of the
* fragments. Currently we fail the Filesndl-ht.scr script
* for UDP, hence this fix
*/
if ((adapter->iface_type == MWIFIEX_USB) &&
(skb->truesize > MWIFIEX_RX_DATA_BUF_SIZE))
skb->truesize += (skb->len - MWIFIEX_RX_DATA_BUF_SIZE);
priv->stats.rx_bytes += skb->len; priv->stats.rx_bytes += skb->len;
priv->stats.rx_packets++; priv->stats.rx_packets++;
if (in_interrupt()) if (in_interrupt())

View File

@@ -1120,11 +1120,19 @@ mwifiex_send_processed_packet(struct mwifiex_private *priv,
tx_info = MWIFIEX_SKB_TXCB(skb); tx_info = MWIFIEX_SKB_TXCB(skb);
spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, ra_list_flags); spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, ra_list_flags);
tx_param.next_pkt_len =
((skb_next) ? skb_next->len + if (adapter->iface_type == MWIFIEX_USB) {
sizeof(struct txpd) : 0); adapter->data_sent = true;
ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, skb, ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA,
&tx_param); skb, NULL);
} else {
tx_param.next_pkt_len =
((skb_next) ? skb_next->len +
sizeof(struct txpd) : 0);
ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA,
skb, &tx_param);
}
switch (ret) { switch (ret) {
case -EBUSY: case -EBUSY:
dev_dbg(adapter->dev, "data: -EBUSY is returned\n"); dev_dbg(adapter->dev, "data: -EBUSY is returned\n");

View File

@@ -83,6 +83,7 @@
#define REV_RT3090E 0x0211 #define REV_RT3090E 0x0211
#define REV_RT3390E 0x0211 #define REV_RT3390E 0x0211
#define REV_RT5390F 0x0502 #define REV_RT5390F 0x0502
#define REV_RT5390R 0x1502
/* /*
* Signal information. * Signal information.
@@ -98,7 +99,7 @@
#define EEPROM_BASE 0x0000 #define EEPROM_BASE 0x0000
#define EEPROM_SIZE 0x0110 #define EEPROM_SIZE 0x0110
#define BBP_BASE 0x0000 #define BBP_BASE 0x0000
#define BBP_SIZE 0x0080 #define BBP_SIZE 0x00ff
#define RF_BASE 0x0004 #define RF_BASE 0x0004
#define RF_SIZE 0x0010 #define RF_SIZE 0x0010

View File

@@ -3356,6 +3356,13 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
rt2800_register_write(rt2x00dev, GPIO_CTRL_CFG, reg); rt2800_register_write(rt2x00dev, GPIO_CTRL_CFG, reg);
} }
/* This chip has hardware antenna diversity*/
if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390R)) {
rt2800_bbp_write(rt2x00dev, 150, 0); /* Disable Antenna Software OFDM */
rt2800_bbp_write(rt2x00dev, 151, 0); /* Disable Antenna Software CCK */
rt2800_bbp_write(rt2x00dev, 154, 0); /* Clear previously selected antenna */
}
rt2800_bbp_read(rt2x00dev, 152, &value); rt2800_bbp_read(rt2x00dev, 152, &value);
if (ant == 0) if (ant == 0)
rt2x00_set_field8(&value, BBP152_RX_DEFAULT_ANT, 1); rt2x00_set_field8(&value, BBP152_RX_DEFAULT_ANT, 1);
@@ -4291,6 +4298,11 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
rt2x00dev->default_ant.rx = ANTENNA_A; rt2x00dev->default_ant.rx = ANTENNA_A;
} }
if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390R)) {
rt2x00dev->default_ant.tx = ANTENNA_HW_DIVERSITY; /* Unused */
rt2x00dev->default_ant.rx = ANTENNA_HW_DIVERSITY; /* Unused */
}
/* /*
* Determine external LNA informations. * Determine external LNA informations.
*/ */

View File

@@ -922,6 +922,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
{ USB_DEVICE(0x1482, 0x3c09) }, { USB_DEVICE(0x1482, 0x3c09) },
/* AirTies */ /* AirTies */
{ USB_DEVICE(0x1eda, 0x2012) }, { USB_DEVICE(0x1eda, 0x2012) },
{ USB_DEVICE(0x1eda, 0x2210) },
{ USB_DEVICE(0x1eda, 0x2310) }, { USB_DEVICE(0x1eda, 0x2310) },
/* Allwin */ /* Allwin */
{ USB_DEVICE(0x8516, 0x2070) }, { USB_DEVICE(0x8516, 0x2070) },
@@ -991,6 +992,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
/* DVICO */ /* DVICO */
{ USB_DEVICE(0x0fe9, 0xb307) }, { USB_DEVICE(0x0fe9, 0xb307) },
/* Edimax */ /* Edimax */
{ USB_DEVICE(0x7392, 0x4085) },
{ USB_DEVICE(0x7392, 0x7711) }, { USB_DEVICE(0x7392, 0x7711) },
{ USB_DEVICE(0x7392, 0x7717) }, { USB_DEVICE(0x7392, 0x7717) },
{ USB_DEVICE(0x7392, 0x7718) }, { USB_DEVICE(0x7392, 0x7718) },
@@ -1066,6 +1068,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
/* Philips */ /* Philips */
{ USB_DEVICE(0x0471, 0x200f) }, { USB_DEVICE(0x0471, 0x200f) },
/* Planex */ /* Planex */
{ USB_DEVICE(0x2019, 0x5201) },
{ USB_DEVICE(0x2019, 0xab25) }, { USB_DEVICE(0x2019, 0xab25) },
{ USB_DEVICE(0x2019, 0xed06) }, { USB_DEVICE(0x2019, 0xed06) },
/* Quanta */ /* Quanta */
@@ -1134,6 +1137,10 @@ static struct usb_device_id rt2800usb_device_table[] = {
#ifdef CONFIG_RT2800USB_RT33XX #ifdef CONFIG_RT2800USB_RT33XX
/* Belkin */ /* Belkin */
{ USB_DEVICE(0x050d, 0x945b) }, { USB_DEVICE(0x050d, 0x945b) },
/* Panasonic */
{ USB_DEVICE(0x083a, 0xb511) },
/* Philips */
{ USB_DEVICE(0x0471, 0x20dd) },
/* Ralink */ /* Ralink */
{ USB_DEVICE(0x148f, 0x3370) }, { USB_DEVICE(0x148f, 0x3370) },
{ USB_DEVICE(0x148f, 0x8070) }, { USB_DEVICE(0x148f, 0x8070) },
@@ -1145,6 +1152,8 @@ static struct usb_device_id rt2800usb_device_table[] = {
{ USB_DEVICE(0x8516, 0x3572) }, { USB_DEVICE(0x8516, 0x3572) },
/* Askey */ /* Askey */
{ USB_DEVICE(0x1690, 0x0744) }, { USB_DEVICE(0x1690, 0x0744) },
{ USB_DEVICE(0x1690, 0x0761) },
{ USB_DEVICE(0x1690, 0x0764) },
/* Cisco */ /* Cisco */
{ USB_DEVICE(0x167b, 0x4001) }, { USB_DEVICE(0x167b, 0x4001) },
/* EnGenius */ /* EnGenius */
@@ -1159,20 +1168,25 @@ static struct usb_device_id rt2800usb_device_table[] = {
/* Sitecom */ /* Sitecom */
{ USB_DEVICE(0x0df6, 0x0041) }, { USB_DEVICE(0x0df6, 0x0041) },
{ USB_DEVICE(0x0df6, 0x0062) }, { USB_DEVICE(0x0df6, 0x0062) },
{ USB_DEVICE(0x0df6, 0x0065) },
{ USB_DEVICE(0x0df6, 0x0066) },
{ USB_DEVICE(0x0df6, 0x0068) },
/* Toshiba */ /* Toshiba */
{ USB_DEVICE(0x0930, 0x0a07) }, { USB_DEVICE(0x0930, 0x0a07) },
/* Zinwell */ /* Zinwell */
{ USB_DEVICE(0x5a57, 0x0284) }, { USB_DEVICE(0x5a57, 0x0284) },
#endif #endif
#ifdef CONFIG_RT2800USB_RT53XX #ifdef CONFIG_RT2800USB_RT53XX
/* Alpha */
{ USB_DEVICE(0x2001, 0x3c15) },
{ USB_DEVICE(0x2001, 0x3c19) },
/* Arcadyan */ /* Arcadyan */
{ USB_DEVICE(0x043e, 0x7a12) }, { USB_DEVICE(0x043e, 0x7a12) },
/* Azurewave */ /* Azurewave */
{ USB_DEVICE(0x13d3, 0x3329) }, { USB_DEVICE(0x13d3, 0x3329) },
{ USB_DEVICE(0x13d3, 0x3365) }, { USB_DEVICE(0x13d3, 0x3365) },
/* D-Link */
{ USB_DEVICE(0x2001, 0x3c15) },
{ USB_DEVICE(0x2001, 0x3c19) },
{ USB_DEVICE(0x2001, 0x3c1c) },
{ USB_DEVICE(0x2001, 0x3c1d) },
/* LG innotek */ /* LG innotek */
{ USB_DEVICE(0x043e, 0x7a22) }, { USB_DEVICE(0x043e, 0x7a22) },
/* Panasonic */ /* Panasonic */
@@ -1224,12 +1238,8 @@ static struct usb_device_id rt2800usb_device_table[] = {
{ USB_DEVICE(0x07d1, 0x3c0b) }, { USB_DEVICE(0x07d1, 0x3c0b) },
{ USB_DEVICE(0x07d1, 0x3c17) }, { USB_DEVICE(0x07d1, 0x3c17) },
{ USB_DEVICE(0x2001, 0x3c17) }, { USB_DEVICE(0x2001, 0x3c17) },
/* Edimax */
{ USB_DEVICE(0x7392, 0x4085) },
/* Encore */ /* Encore */
{ USB_DEVICE(0x203d, 0x14a1) }, { USB_DEVICE(0x203d, 0x14a1) },
/* Fujitsu Stylistic 550 */
{ USB_DEVICE(0x1690, 0x0761) },
/* Gemtek */ /* Gemtek */
{ USB_DEVICE(0x15a9, 0x0010) }, { USB_DEVICE(0x15a9, 0x0010) },
/* Gigabyte */ /* Gigabyte */
@@ -1250,7 +1260,6 @@ static struct usb_device_id rt2800usb_device_table[] = {
{ USB_DEVICE(0x05a6, 0x0101) }, { USB_DEVICE(0x05a6, 0x0101) },
{ USB_DEVICE(0x1d4d, 0x0010) }, { USB_DEVICE(0x1d4d, 0x0010) },
/* Planex */ /* Planex */
{ USB_DEVICE(0x2019, 0x5201) },
{ USB_DEVICE(0x2019, 0xab24) }, { USB_DEVICE(0x2019, 0xab24) },
/* Qcom */ /* Qcom */
{ USB_DEVICE(0x18e8, 0x6259) }, { USB_DEVICE(0x18e8, 0x6259) },

View File

@@ -1282,7 +1282,7 @@ void rt2x00lib_dmadone(struct queue_entry *entry);
void rt2x00lib_txdone(struct queue_entry *entry, void rt2x00lib_txdone(struct queue_entry *entry,
struct txdone_entry_desc *txdesc); struct txdone_entry_desc *txdesc);
void rt2x00lib_txdone_noinfo(struct queue_entry *entry, u32 status); void rt2x00lib_txdone_noinfo(struct queue_entry *entry, u32 status);
void rt2x00lib_rxdone(struct queue_entry *entry); void rt2x00lib_rxdone(struct queue_entry *entry, gfp_t gfp);
/* /*
* mac80211 handlers. * mac80211 handlers.

View File

@@ -588,7 +588,7 @@ static int rt2x00lib_rxdone_read_signal(struct rt2x00_dev *rt2x00dev,
return 0; return 0;
} }
void rt2x00lib_rxdone(struct queue_entry *entry) void rt2x00lib_rxdone(struct queue_entry *entry, gfp_t gfp)
{ {
struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
struct rxdone_entry_desc rxdesc; struct rxdone_entry_desc rxdesc;
@@ -608,7 +608,7 @@ void rt2x00lib_rxdone(struct queue_entry *entry)
* Allocate a new sk_buffer. If no new buffer available, drop the * Allocate a new sk_buffer. If no new buffer available, drop the
* received frame and reuse the existing buffer. * received frame and reuse the existing buffer.
*/ */
skb = rt2x00queue_alloc_rxskb(entry); skb = rt2x00queue_alloc_rxskb(entry, gfp);
if (!skb) if (!skb)
goto submit_entry; goto submit_entry;

View File

@@ -103,7 +103,7 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
* rt2x00queue_alloc_rxskb - allocate a skb for RX purposes. * rt2x00queue_alloc_rxskb - allocate a skb for RX purposes.
* @entry: The entry for which the skb will be applicable. * @entry: The entry for which the skb will be applicable.
*/ */
struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry); struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry, gfp_t gfp);
/** /**
* rt2x00queue_free_skb - free a skb * rt2x00queue_free_skb - free a skb

View File

@@ -92,7 +92,7 @@ bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
/* /*
* Send the frame to rt2x00lib for further processing. * Send the frame to rt2x00lib for further processing.
*/ */
rt2x00lib_rxdone(entry); rt2x00lib_rxdone(entry, GFP_ATOMIC);
} }
return !max_rx; return !max_rx;

View File

@@ -33,7 +33,7 @@
#include "rt2x00.h" #include "rt2x00.h"
#include "rt2x00lib.h" #include "rt2x00lib.h"
struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry) struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry, gfp_t gfp)
{ {
struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
struct sk_buff *skb; struct sk_buff *skb;
@@ -68,7 +68,7 @@ struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry)
/* /*
* Allocate skbuffer. * Allocate skbuffer.
*/ */
skb = dev_alloc_skb(frame_size + head_size + tail_size); skb = __dev_alloc_skb(frame_size + head_size + tail_size, gfp);
if (!skb) if (!skb)
return NULL; return NULL;
@@ -1163,7 +1163,7 @@ static int rt2x00queue_alloc_rxskbs(struct data_queue *queue)
struct sk_buff *skb; struct sk_buff *skb;
for (i = 0; i < queue->limit; i++) { for (i = 0; i < queue->limit; i++) {
skb = rt2x00queue_alloc_rxskb(&queue->entries[i]); skb = rt2x00queue_alloc_rxskb(&queue->entries[i], GFP_KERNEL);
if (!skb) if (!skb)
return -ENOMEM; return -ENOMEM;
queue->entries[i].skb = skb; queue->entries[i].skb = skb;

View File

@@ -358,7 +358,7 @@ static void rt2x00usb_work_rxdone(struct work_struct *work)
/* /*
* Send the frame to rt2x00lib for further processing. * Send the frame to rt2x00lib for further processing.
*/ */
rt2x00lib_rxdone(entry); rt2x00lib_rxdone(entry, GFP_KERNEL);
} }
} }

View File

@@ -33,9 +33,6 @@
#include "../pci.h" #include "../pci.h"
#include "../base.h" #include "../base.h"
struct dig_t dm_digtable;
static struct ps_t dm_pstable;
#define BT_RSSI_STATE_NORMAL_POWER BIT_OFFSET_LEN_MASK_32(0, 1) #define BT_RSSI_STATE_NORMAL_POWER BIT_OFFSET_LEN_MASK_32(0, 1)
#define BT_RSSI_STATE_AMDPU_OFF BIT_OFFSET_LEN_MASK_32(1, 1) #define BT_RSSI_STATE_AMDPU_OFF BIT_OFFSET_LEN_MASK_32(1, 1)
#define BT_RSSI_STATE_SPECIAL_LOW BIT_OFFSET_LEN_MASK_32(2, 1) #define BT_RSSI_STATE_SPECIAL_LOW BIT_OFFSET_LEN_MASK_32(2, 1)
@@ -163,33 +160,37 @@ static const u8 cckswing_table_ch14[CCK_TABLE_SIZE][8] = {
static void rtl92c_dm_diginit(struct ieee80211_hw *hw) static void rtl92c_dm_diginit(struct ieee80211_hw *hw)
{ {
dm_digtable.dig_enable_flag = true; struct rtl_priv *rtlpriv = rtl_priv(hw);
dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; struct dig_t *dm_digtable = &rtlpriv->dm_digtable;
dm_digtable.cur_igvalue = 0x20;
dm_digtable.pre_igvalue = 0x0; dm_digtable->dig_enable_flag = true;
dm_digtable.cursta_connectctate = DIG_STA_DISCONNECT; dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX;
dm_digtable.presta_connectstate = DIG_STA_DISCONNECT; dm_digtable->cur_igvalue = 0x20;
dm_digtable.curmultista_connectstate = DIG_MULTISTA_DISCONNECT; dm_digtable->pre_igvalue = 0x0;
dm_digtable.rssi_lowthresh = DM_DIG_THRESH_LOW; dm_digtable->cursta_connectctate = DIG_STA_DISCONNECT;
dm_digtable.rssi_highthresh = DM_DIG_THRESH_HIGH; dm_digtable->presta_connectstate = DIG_STA_DISCONNECT;
dm_digtable.fa_lowthresh = DM_FALSEALARM_THRESH_LOW; dm_digtable->curmultista_connectstate = DIG_MULTISTA_DISCONNECT;
dm_digtable.fa_highthresh = DM_FALSEALARM_THRESH_HIGH; dm_digtable->rssi_lowthresh = DM_DIG_THRESH_LOW;
dm_digtable.rx_gain_range_max = DM_DIG_MAX; dm_digtable->rssi_highthresh = DM_DIG_THRESH_HIGH;
dm_digtable.rx_gain_range_min = DM_DIG_MIN; dm_digtable->fa_lowthresh = DM_FALSEALARM_THRESH_LOW;
dm_digtable.backoff_val = DM_DIG_BACKOFF_DEFAULT; dm_digtable->fa_highthresh = DM_FALSEALARM_THRESH_HIGH;
dm_digtable.backoff_val_range_max = DM_DIG_BACKOFF_MAX; dm_digtable->rx_gain_range_max = DM_DIG_MAX;
dm_digtable.backoff_val_range_min = DM_DIG_BACKOFF_MIN; dm_digtable->rx_gain_range_min = DM_DIG_MIN;
dm_digtable.pre_cck_pd_state = CCK_PD_STAGE_MAX; dm_digtable->backoff_val = DM_DIG_BACKOFF_DEFAULT;
dm_digtable.cur_cck_pd_state = CCK_PD_STAGE_MAX; dm_digtable->backoff_val_range_max = DM_DIG_BACKOFF_MAX;
dm_digtable->backoff_val_range_min = DM_DIG_BACKOFF_MIN;
dm_digtable->pre_cck_pd_state = CCK_PD_STAGE_MAX;
dm_digtable->cur_cck_pd_state = CCK_PD_STAGE_MAX;
} }
static u8 rtl92c_dm_initial_gain_min_pwdb(struct ieee80211_hw *hw) static u8 rtl92c_dm_initial_gain_min_pwdb(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct dig_t *dm_digtable = &rtlpriv->dm_digtable;
long rssi_val_min = 0; long rssi_val_min = 0;
if ((dm_digtable.curmultista_connectstate == DIG_MULTISTA_CONNECT) && if ((dm_digtable->curmultista_connectstate == DIG_MULTISTA_CONNECT) &&
(dm_digtable.cursta_connectctate == DIG_STA_CONNECT)) { (dm_digtable->cursta_connectctate == DIG_STA_CONNECT)) {
if (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb != 0) if (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb != 0)
rssi_val_min = rssi_val_min =
(rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb > (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb >
@@ -198,10 +199,10 @@ static u8 rtl92c_dm_initial_gain_min_pwdb(struct ieee80211_hw *hw)
rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
else else
rssi_val_min = rtlpriv->dm.undecorated_smoothed_pwdb; rssi_val_min = rtlpriv->dm.undecorated_smoothed_pwdb;
} else if (dm_digtable.cursta_connectctate == DIG_STA_CONNECT || } else if (dm_digtable->cursta_connectctate == DIG_STA_CONNECT ||
dm_digtable.cursta_connectctate == DIG_STA_BEFORE_CONNECT) { dm_digtable->cursta_connectctate == DIG_STA_BEFORE_CONNECT) {
rssi_val_min = rtlpriv->dm.undecorated_smoothed_pwdb; rssi_val_min = rtlpriv->dm.undecorated_smoothed_pwdb;
} else if (dm_digtable.curmultista_connectstate == } else if (dm_digtable->curmultista_connectstate ==
DIG_MULTISTA_CONNECT) { DIG_MULTISTA_CONNECT) {
rssi_val_min = rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; rssi_val_min = rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
} }
@@ -260,7 +261,8 @@ static void rtl92c_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw)
static void rtl92c_dm_ctrl_initgain_by_fa(struct ieee80211_hw *hw) static void rtl92c_dm_ctrl_initgain_by_fa(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
u8 value_igi = dm_digtable.cur_igvalue; struct dig_t *dm_digtable = &rtlpriv->dm_digtable;
u8 value_igi = dm_digtable->cur_igvalue;
if (rtlpriv->falsealm_cnt.cnt_all < DM_DIG_FA_TH0) if (rtlpriv->falsealm_cnt.cnt_all < DM_DIG_FA_TH0)
value_igi--; value_igi--;
@@ -277,43 +279,44 @@ static void rtl92c_dm_ctrl_initgain_by_fa(struct ieee80211_hw *hw)
if (rtlpriv->falsealm_cnt.cnt_all > 10000) if (rtlpriv->falsealm_cnt.cnt_all > 10000)
value_igi = 0x32; value_igi = 0x32;
dm_digtable.cur_igvalue = value_igi; dm_digtable->cur_igvalue = value_igi;
rtl92c_dm_write_dig(hw); rtl92c_dm_write_dig(hw);
} }
static void rtl92c_dm_ctrl_initgain_by_rssi(struct ieee80211_hw *hw) static void rtl92c_dm_ctrl_initgain_by_rssi(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct dig_t *dm_digtable = &rtlpriv->dm_digtable;
if (rtlpriv->falsealm_cnt.cnt_all > dm_digtable.fa_highthresh) { if (rtlpriv->falsealm_cnt.cnt_all > dm_digtable->fa_highthresh) {
if ((dm_digtable.backoff_val - 2) < if ((dm_digtable->backoff_val - 2) <
dm_digtable.backoff_val_range_min) dm_digtable->backoff_val_range_min)
dm_digtable.backoff_val = dm_digtable->backoff_val =
dm_digtable.backoff_val_range_min; dm_digtable->backoff_val_range_min;
else else
dm_digtable.backoff_val -= 2; dm_digtable->backoff_val -= 2;
} else if (rtlpriv->falsealm_cnt.cnt_all < dm_digtable.fa_lowthresh) { } else if (rtlpriv->falsealm_cnt.cnt_all < dm_digtable->fa_lowthresh) {
if ((dm_digtable.backoff_val + 2) > if ((dm_digtable->backoff_val + 2) >
dm_digtable.backoff_val_range_max) dm_digtable->backoff_val_range_max)
dm_digtable.backoff_val = dm_digtable->backoff_val =
dm_digtable.backoff_val_range_max; dm_digtable->backoff_val_range_max;
else else
dm_digtable.backoff_val += 2; dm_digtable->backoff_val += 2;
} }
if ((dm_digtable.rssi_val_min + 10 - dm_digtable.backoff_val) > if ((dm_digtable->rssi_val_min + 10 - dm_digtable->backoff_val) >
dm_digtable.rx_gain_range_max) dm_digtable->rx_gain_range_max)
dm_digtable.cur_igvalue = dm_digtable.rx_gain_range_max; dm_digtable->cur_igvalue = dm_digtable->rx_gain_range_max;
else if ((dm_digtable.rssi_val_min + 10 - else if ((dm_digtable->rssi_val_min + 10 -
dm_digtable.backoff_val) < dm_digtable.rx_gain_range_min) dm_digtable->backoff_val) < dm_digtable->rx_gain_range_min)
dm_digtable.cur_igvalue = dm_digtable.rx_gain_range_min; dm_digtable->cur_igvalue = dm_digtable->rx_gain_range_min;
else else
dm_digtable.cur_igvalue = dm_digtable.rssi_val_min + 10 - dm_digtable->cur_igvalue = dm_digtable->rssi_val_min + 10 -
dm_digtable.backoff_val; dm_digtable->backoff_val;
RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE,
"rssi_val_min = %x backoff_val %x\n", "rssi_val_min = %x backoff_val %x\n",
dm_digtable.rssi_val_min, dm_digtable.backoff_val); dm_digtable->rssi_val_min, dm_digtable->backoff_val);
rtl92c_dm_write_dig(hw); rtl92c_dm_write_dig(hw);
} }
@@ -322,6 +325,7 @@ static void rtl92c_dm_initial_gain_multi_sta(struct ieee80211_hw *hw)
{ {
static u8 initialized; /* initialized to false */ static u8 initialized; /* initialized to false */
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct dig_t *dm_digtable = &rtlpriv->dm_digtable;
struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
long rssi_strength = rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; long rssi_strength = rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
bool multi_sta = false; bool multi_sta = false;
@@ -330,68 +334,69 @@ static void rtl92c_dm_initial_gain_multi_sta(struct ieee80211_hw *hw)
multi_sta = true; multi_sta = true;
if (!multi_sta || if (!multi_sta ||
dm_digtable.cursta_connectctate != DIG_STA_DISCONNECT) { dm_digtable->cursta_connectctate != DIG_STA_DISCONNECT) {
initialized = false; initialized = false;
dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX;
return; return;
} else if (initialized == false) { } else if (initialized == false) {
initialized = true; initialized = true;
dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_0; dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_0;
dm_digtable.cur_igvalue = 0x20; dm_digtable->cur_igvalue = 0x20;
rtl92c_dm_write_dig(hw); rtl92c_dm_write_dig(hw);
} }
if (dm_digtable.curmultista_connectstate == DIG_MULTISTA_CONNECT) { if (dm_digtable->curmultista_connectstate == DIG_MULTISTA_CONNECT) {
if ((rssi_strength < dm_digtable.rssi_lowthresh) && if ((rssi_strength < dm_digtable->rssi_lowthresh) &&
(dm_digtable.dig_ext_port_stage != DIG_EXT_PORT_STAGE_1)) { (dm_digtable->dig_ext_port_stage != DIG_EXT_PORT_STAGE_1)) {
if (dm_digtable.dig_ext_port_stage == if (dm_digtable->dig_ext_port_stage ==
DIG_EXT_PORT_STAGE_2) { DIG_EXT_PORT_STAGE_2) {
dm_digtable.cur_igvalue = 0x20; dm_digtable->cur_igvalue = 0x20;
rtl92c_dm_write_dig(hw); rtl92c_dm_write_dig(hw);
} }
dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_1; dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_1;
} else if (rssi_strength > dm_digtable.rssi_highthresh) { } else if (rssi_strength > dm_digtable->rssi_highthresh) {
dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_2; dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_2;
rtl92c_dm_ctrl_initgain_by_fa(hw); rtl92c_dm_ctrl_initgain_by_fa(hw);
} }
} else if (dm_digtable.dig_ext_port_stage != DIG_EXT_PORT_STAGE_0) { } else if (dm_digtable->dig_ext_port_stage != DIG_EXT_PORT_STAGE_0) {
dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_0; dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_0;
dm_digtable.cur_igvalue = 0x20; dm_digtable->cur_igvalue = 0x20;
rtl92c_dm_write_dig(hw); rtl92c_dm_write_dig(hw);
} }
RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE,
"curmultista_connectstate = %x dig_ext_port_stage %x\n", "curmultista_connectstate = %x dig_ext_port_stage %x\n",
dm_digtable.curmultista_connectstate, dm_digtable->curmultista_connectstate,
dm_digtable.dig_ext_port_stage); dm_digtable->dig_ext_port_stage);
} }
static void rtl92c_dm_initial_gain_sta(struct ieee80211_hw *hw) static void rtl92c_dm_initial_gain_sta(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct dig_t *dm_digtable = &rtlpriv->dm_digtable;
RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE,
"presta_connectstate = %x, cursta_connectctate = %x\n", "presta_connectstate = %x, cursta_connectctate = %x\n",
dm_digtable.presta_connectstate, dm_digtable->presta_connectstate,
dm_digtable.cursta_connectctate); dm_digtable->cursta_connectctate);
if (dm_digtable.presta_connectstate == dm_digtable.cursta_connectctate if (dm_digtable->presta_connectstate == dm_digtable->cursta_connectctate
|| dm_digtable.cursta_connectctate == DIG_STA_BEFORE_CONNECT || dm_digtable->cursta_connectctate == DIG_STA_BEFORE_CONNECT
|| dm_digtable.cursta_connectctate == DIG_STA_CONNECT) { || dm_digtable->cursta_connectctate == DIG_STA_CONNECT) {
if (dm_digtable.cursta_connectctate != DIG_STA_DISCONNECT) { if (dm_digtable->cursta_connectctate != DIG_STA_DISCONNECT) {
dm_digtable.rssi_val_min = dm_digtable->rssi_val_min =
rtl92c_dm_initial_gain_min_pwdb(hw); rtl92c_dm_initial_gain_min_pwdb(hw);
rtl92c_dm_ctrl_initgain_by_rssi(hw); rtl92c_dm_ctrl_initgain_by_rssi(hw);
} }
} else { } else {
dm_digtable.rssi_val_min = 0; dm_digtable->rssi_val_min = 0;
dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX;
dm_digtable.backoff_val = DM_DIG_BACKOFF_DEFAULT; dm_digtable->backoff_val = DM_DIG_BACKOFF_DEFAULT;
dm_digtable.cur_igvalue = 0x20; dm_digtable->cur_igvalue = 0x20;
dm_digtable.pre_igvalue = 0; dm_digtable->pre_igvalue = 0;
rtl92c_dm_write_dig(hw); rtl92c_dm_write_dig(hw);
} }
} }
@@ -400,40 +405,41 @@ static void rtl92c_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
struct dig_t *dm_digtable = &rtlpriv->dm_digtable;
if (dm_digtable.cursta_connectctate == DIG_STA_CONNECT) { if (dm_digtable->cursta_connectctate == DIG_STA_CONNECT) {
dm_digtable.rssi_val_min = rtl92c_dm_initial_gain_min_pwdb(hw); dm_digtable->rssi_val_min = rtl92c_dm_initial_gain_min_pwdb(hw);
if (dm_digtable.pre_cck_pd_state == CCK_PD_STAGE_LowRssi) { if (dm_digtable->pre_cck_pd_state == CCK_PD_STAGE_LowRssi) {
if (dm_digtable.rssi_val_min <= 25) if (dm_digtable->rssi_val_min <= 25)
dm_digtable.cur_cck_pd_state = dm_digtable->cur_cck_pd_state =
CCK_PD_STAGE_LowRssi; CCK_PD_STAGE_LowRssi;
else else
dm_digtable.cur_cck_pd_state = dm_digtable->cur_cck_pd_state =
CCK_PD_STAGE_HighRssi; CCK_PD_STAGE_HighRssi;
} else { } else {
if (dm_digtable.rssi_val_min <= 20) if (dm_digtable->rssi_val_min <= 20)
dm_digtable.cur_cck_pd_state = dm_digtable->cur_cck_pd_state =
CCK_PD_STAGE_LowRssi; CCK_PD_STAGE_LowRssi;
else else
dm_digtable.cur_cck_pd_state = dm_digtable->cur_cck_pd_state =
CCK_PD_STAGE_HighRssi; CCK_PD_STAGE_HighRssi;
} }
} else { } else {
dm_digtable.cur_cck_pd_state = CCK_PD_STAGE_MAX; dm_digtable->cur_cck_pd_state = CCK_PD_STAGE_MAX;
} }
if (dm_digtable.pre_cck_pd_state != dm_digtable.cur_cck_pd_state) { if (dm_digtable->pre_cck_pd_state != dm_digtable->cur_cck_pd_state) {
if (dm_digtable.cur_cck_pd_state == CCK_PD_STAGE_LowRssi) { if (dm_digtable->cur_cck_pd_state == CCK_PD_STAGE_LowRssi) {
if (rtlpriv->falsealm_cnt.cnt_cck_fail > 800) if (rtlpriv->falsealm_cnt.cnt_cck_fail > 800)
dm_digtable.cur_cck_fa_state = dm_digtable->cur_cck_fa_state =
CCK_FA_STAGE_High; CCK_FA_STAGE_High;
else else
dm_digtable.cur_cck_fa_state = CCK_FA_STAGE_Low; dm_digtable->cur_cck_fa_state = CCK_FA_STAGE_Low;
if (dm_digtable.pre_cck_fa_state != if (dm_digtable->pre_cck_fa_state !=
dm_digtable.cur_cck_fa_state) { dm_digtable->cur_cck_fa_state) {
if (dm_digtable.cur_cck_fa_state == if (dm_digtable->cur_cck_fa_state ==
CCK_FA_STAGE_Low) CCK_FA_STAGE_Low)
rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2,
0x83); 0x83);
@@ -441,8 +447,8 @@ static void rtl92c_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw)
rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2,
0xcd); 0xcd);
dm_digtable.pre_cck_fa_state = dm_digtable->pre_cck_fa_state =
dm_digtable.cur_cck_fa_state; dm_digtable->cur_cck_fa_state;
} }
rtl_set_bbreg(hw, RCCK0_SYSTEM, MASKBYTE1, 0x40); rtl_set_bbreg(hw, RCCK0_SYSTEM, MASKBYTE1, 0x40);
@@ -458,11 +464,11 @@ static void rtl92c_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw)
rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT,
MASKBYTE2, 0xd3); MASKBYTE2, 0xd3);
} }
dm_digtable.pre_cck_pd_state = dm_digtable.cur_cck_pd_state; dm_digtable->pre_cck_pd_state = dm_digtable->cur_cck_pd_state;
} }
RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "CCKPDStage=%x\n", RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "CCKPDStage=%x\n",
dm_digtable.cur_cck_pd_state); dm_digtable->cur_cck_pd_state);
RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "is92C=%x\n", RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "is92C=%x\n",
IS_92C_SERIAL(rtlhal->version)); IS_92C_SERIAL(rtlhal->version));
@@ -470,31 +476,34 @@ static void rtl92c_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw)
static void rtl92c_dm_ctrl_initgain_by_twoport(struct ieee80211_hw *hw) static void rtl92c_dm_ctrl_initgain_by_twoport(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct dig_t *dm_digtable = &rtlpriv->dm_digtable;
struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
if (mac->act_scanning) if (mac->act_scanning)
return; return;
if (mac->link_state >= MAC80211_LINKED) if (mac->link_state >= MAC80211_LINKED)
dm_digtable.cursta_connectctate = DIG_STA_CONNECT; dm_digtable->cursta_connectctate = DIG_STA_CONNECT;
else else
dm_digtable.cursta_connectctate = DIG_STA_DISCONNECT; dm_digtable->cursta_connectctate = DIG_STA_DISCONNECT;
rtl92c_dm_initial_gain_sta(hw); rtl92c_dm_initial_gain_sta(hw);
rtl92c_dm_initial_gain_multi_sta(hw); rtl92c_dm_initial_gain_multi_sta(hw);
rtl92c_dm_cck_packet_detection_thresh(hw); rtl92c_dm_cck_packet_detection_thresh(hw);
dm_digtable.presta_connectstate = dm_digtable.cursta_connectctate; dm_digtable->presta_connectstate = dm_digtable->cursta_connectctate;
} }
static void rtl92c_dm_dig(struct ieee80211_hw *hw) static void rtl92c_dm_dig(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct dig_t *dm_digtable = &rtlpriv->dm_digtable;
if (rtlpriv->dm.dm_initialgain_enable == false) if (rtlpriv->dm.dm_initialgain_enable == false)
return; return;
if (dm_digtable.dig_enable_flag == false) if (dm_digtable->dig_enable_flag == false)
return; return;
rtl92c_dm_ctrl_initgain_by_twoport(hw); rtl92c_dm_ctrl_initgain_by_twoport(hw);
@@ -514,23 +523,24 @@ static void rtl92c_dm_init_dynamic_txpower(struct ieee80211_hw *hw)
void rtl92c_dm_write_dig(struct ieee80211_hw *hw) void rtl92c_dm_write_dig(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct dig_t *dm_digtable = &rtlpriv->dm_digtable;
RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
"cur_igvalue = 0x%x, pre_igvalue = 0x%x, backoff_val = %d\n", "cur_igvalue = 0x%x, pre_igvalue = 0x%x, backoff_val = %d\n",
dm_digtable.cur_igvalue, dm_digtable.pre_igvalue, dm_digtable->cur_igvalue, dm_digtable->pre_igvalue,
dm_digtable.backoff_val); dm_digtable->backoff_val);
dm_digtable.cur_igvalue += 2; dm_digtable->cur_igvalue += 2;
if (dm_digtable.cur_igvalue > 0x3f) if (dm_digtable->cur_igvalue > 0x3f)
dm_digtable.cur_igvalue = 0x3f; dm_digtable->cur_igvalue = 0x3f;
if (dm_digtable.pre_igvalue != dm_digtable.cur_igvalue) { if (dm_digtable->pre_igvalue != dm_digtable->cur_igvalue) {
rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f, rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f,
dm_digtable.cur_igvalue); dm_digtable->cur_igvalue);
rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, 0x7f, rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, 0x7f,
dm_digtable.cur_igvalue); dm_digtable->cur_igvalue);
dm_digtable.pre_igvalue = dm_digtable.cur_igvalue; dm_digtable->pre_igvalue = dm_digtable->cur_igvalue;
} }
} }
EXPORT_SYMBOL(rtl92c_dm_write_dig); EXPORT_SYMBOL(rtl92c_dm_write_dig);
@@ -1223,15 +1233,20 @@ static void rtl92c_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw)
static void rtl92c_dm_init_dynamic_bb_powersaving(struct ieee80211_hw *hw) static void rtl92c_dm_init_dynamic_bb_powersaving(struct ieee80211_hw *hw)
{ {
dm_pstable.pre_ccastate = CCA_MAX; struct rtl_priv *rtlpriv = rtl_priv(hw);
dm_pstable.cur_ccasate = CCA_MAX; struct ps_t *dm_pstable = &rtlpriv->dm_pstable;
dm_pstable.pre_rfstate = RF_MAX;
dm_pstable.cur_rfstate = RF_MAX; dm_pstable->pre_ccastate = CCA_MAX;
dm_pstable.rssi_val_min = 0; dm_pstable->cur_ccasate = CCA_MAX;
dm_pstable->pre_rfstate = RF_MAX;
dm_pstable->cur_rfstate = RF_MAX;
dm_pstable->rssi_val_min = 0;
} }
void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal) void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct ps_t *dm_pstable = &rtlpriv->dm_pstable;
static u8 initialize; static u8 initialize;
static u32 reg_874, reg_c70, reg_85c, reg_a74; static u32 reg_874, reg_c70, reg_85c, reg_a74;
@@ -1251,27 +1266,27 @@ void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal)
} }
if (!bforce_in_normal) { if (!bforce_in_normal) {
if (dm_pstable.rssi_val_min != 0) { if (dm_pstable->rssi_val_min != 0) {
if (dm_pstable.pre_rfstate == RF_NORMAL) { if (dm_pstable->pre_rfstate == RF_NORMAL) {
if (dm_pstable.rssi_val_min >= 30) if (dm_pstable->rssi_val_min >= 30)
dm_pstable.cur_rfstate = RF_SAVE; dm_pstable->cur_rfstate = RF_SAVE;
else else
dm_pstable.cur_rfstate = RF_NORMAL; dm_pstable->cur_rfstate = RF_NORMAL;
} else { } else {
if (dm_pstable.rssi_val_min <= 25) if (dm_pstable->rssi_val_min <= 25)
dm_pstable.cur_rfstate = RF_NORMAL; dm_pstable->cur_rfstate = RF_NORMAL;
else else
dm_pstable.cur_rfstate = RF_SAVE; dm_pstable->cur_rfstate = RF_SAVE;
} }
} else { } else {
dm_pstable.cur_rfstate = RF_MAX; dm_pstable->cur_rfstate = RF_MAX;
} }
} else { } else {
dm_pstable.cur_rfstate = RF_NORMAL; dm_pstable->cur_rfstate = RF_NORMAL;
} }
if (dm_pstable.pre_rfstate != dm_pstable.cur_rfstate) { if (dm_pstable->pre_rfstate != dm_pstable->cur_rfstate) {
if (dm_pstable.cur_rfstate == RF_SAVE) { if (dm_pstable->cur_rfstate == RF_SAVE) {
rtl_set_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, rtl_set_bbreg(hw, RFPGA0_XCD_RFINTERFACESW,
0x1C0000, 0x2); 0x1C0000, 0x2);
rtl_set_bbreg(hw, ROFDM0_AGCPARAMETER1, BIT(3), 0); rtl_set_bbreg(hw, ROFDM0_AGCPARAMETER1, BIT(3), 0);
@@ -1293,7 +1308,7 @@ void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal)
rtl_set_bbreg(hw, 0x818, BIT(28), 0x0); rtl_set_bbreg(hw, 0x818, BIT(28), 0x0);
} }
dm_pstable.pre_rfstate = dm_pstable.cur_rfstate; dm_pstable->pre_rfstate = dm_pstable->cur_rfstate;
} }
} }
EXPORT_SYMBOL(rtl92c_dm_rf_saving); EXPORT_SYMBOL(rtl92c_dm_rf_saving);
@@ -1301,36 +1316,37 @@ EXPORT_SYMBOL(rtl92c_dm_rf_saving);
static void rtl92c_dm_dynamic_bb_powersaving(struct ieee80211_hw *hw) static void rtl92c_dm_dynamic_bb_powersaving(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct ps_t *dm_pstable = &rtlpriv->dm_pstable;
struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
if (((mac->link_state == MAC80211_NOLINK)) && if (((mac->link_state == MAC80211_NOLINK)) &&
(rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) { (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) {
dm_pstable.rssi_val_min = 0; dm_pstable->rssi_val_min = 0;
RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, "Not connected to any\n"); RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, "Not connected to any\n");
} }
if (mac->link_state == MAC80211_LINKED) { if (mac->link_state == MAC80211_LINKED) {
if (mac->opmode == NL80211_IFTYPE_ADHOC) { if (mac->opmode == NL80211_IFTYPE_ADHOC) {
dm_pstable.rssi_val_min = dm_pstable->rssi_val_min =
rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD,
"AP Client PWDB = 0x%lx\n", "AP Client PWDB = 0x%lx\n",
dm_pstable.rssi_val_min); dm_pstable->rssi_val_min);
} else { } else {
dm_pstable.rssi_val_min = dm_pstable->rssi_val_min =
rtlpriv->dm.undecorated_smoothed_pwdb; rtlpriv->dm.undecorated_smoothed_pwdb;
RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD,
"STA Default Port PWDB = 0x%lx\n", "STA Default Port PWDB = 0x%lx\n",
dm_pstable.rssi_val_min); dm_pstable->rssi_val_min);
} }
} else { } else {
dm_pstable.rssi_val_min = dm_pstable->rssi_val_min =
rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD,
"AP Ext Port PWDB = 0x%lx\n", "AP Ext Port PWDB = 0x%lx\n",
dm_pstable.rssi_val_min); dm_pstable->rssi_val_min);
} }
if (IS_92C_SERIAL(rtlhal->version)) if (IS_92C_SERIAL(rtlhal->version))

View File

@@ -91,40 +91,6 @@
#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74 #define TX_POWER_NEAR_FIELD_THRESH_LVL2 74
#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 #define TX_POWER_NEAR_FIELD_THRESH_LVL1 67
struct ps_t {
u8 pre_ccastate;
u8 cur_ccasate;
u8 pre_rfstate;
u8 cur_rfstate;
long rssi_val_min;
};
struct dig_t {
u8 dig_enable_flag;
u8 dig_ext_port_stage;
u32 rssi_lowthresh;
u32 rssi_highthresh;
u32 fa_lowthresh;
u32 fa_highthresh;
u8 cursta_connectctate;
u8 presta_connectstate;
u8 curmultista_connectstate;
u8 pre_igvalue;
u8 cur_igvalue;
char backoff_val;
char backoff_val_range_max;
char backoff_val_range_min;
u8 rx_gain_range_max;
u8 rx_gain_range_min;
u8 rssi_val_min;
u8 pre_cck_pd_state;
u8 cur_cck_pd_state;
u8 pre_cck_fa_state;
u8 cur_cck_fa_state;
u8 pre_ccastate;
u8 cur_ccasate;
};
struct swat_t { struct swat_t {
u8 failure_cnt; u8 failure_cnt;
u8 try_flag; u8 try_flag;
@@ -189,7 +155,6 @@ enum dm_dig_connect_e {
DIG_CONNECT_MAX DIG_CONNECT_MAX
}; };
extern struct dig_t dm_digtable;
void rtl92c_dm_init(struct ieee80211_hw *hw); void rtl92c_dm_init(struct ieee80211_hw *hw);
void rtl92c_dm_watchdog(struct ieee80211_hw *hw); void rtl92c_dm_watchdog(struct ieee80211_hw *hw);
void rtl92c_dm_write_dig(struct ieee80211_hw *hw); void rtl92c_dm_write_dig(struct ieee80211_hw *hw);

View File

@@ -1881,6 +1881,7 @@ void rtl92c_phy_set_io(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_phy *rtlphy = &(rtlpriv->phy); struct rtl_phy *rtlphy = &(rtlpriv->phy);
struct dig_t dm_digtable = rtlpriv->dm_digtable;
RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE,
"--->Cmd(%#x), set_io_inprogress(%d)\n", "--->Cmd(%#x), set_io_inprogress(%d)\n",

View File

@@ -86,40 +86,6 @@
#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74 #define TX_POWER_NEAR_FIELD_THRESH_LVL2 74
#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 #define TX_POWER_NEAR_FIELD_THRESH_LVL1 67
struct ps_t {
u8 pre_ccastate;
u8 cur_ccasate;
u8 pre_rfstate;
u8 cur_rfstate;
long rssi_val_min;
};
struct dig_t {
u8 dig_enable_flag;
u8 dig_ext_port_stage;
u32 rssi_lowthresh;
u32 rssi_highthresh;
u32 fa_lowthresh;
u32 fa_highthresh;
u8 cursta_connectctate;
u8 presta_connectstate;
u8 curmultista_connectstate;
u8 pre_igvalue;
u8 cur_igvalue;
char backoff_val;
char backoff_val_range_max;
char backoff_val_range_min;
u8 rx_gain_range_max;
u8 rx_gain_range_min;
u8 rssi_val_min;
u8 pre_cck_pd_state;
u8 cur_cck_pd_state;
u8 pre_cck_fa_state;
u8 cur_cck_fa_state;
u8 pre_ccastate;
u8 cur_ccasate;
};
struct swat_t { struct swat_t {
u8 failure_cnt; u8 failure_cnt;
u8 try_flag; u8 try_flag;
@@ -184,7 +150,6 @@ enum dm_dig_connect_e {
DIG_CONNECT_MAX DIG_CONNECT_MAX
}; };
extern struct dig_t dm_digtable;
void rtl92c_dm_init(struct ieee80211_hw *hw); void rtl92c_dm_init(struct ieee80211_hw *hw);
void rtl92c_dm_watchdog(struct ieee80211_hw *hw); void rtl92c_dm_watchdog(struct ieee80211_hw *hw);
void rtl92c_dm_write_dig(struct ieee80211_hw *hw); void rtl92c_dm_write_dig(struct ieee80211_hw *hw);

Some files were not shown because too many files have changed in this diff Show More