2012-03-07 19:06:27

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH 00/35] update for 3.4: iwlwifi 2012-03-07

Third set of major re-factor and clenup works happen in iwlwifi,
we move the code to the proper place and get ready for the next generation
of the devices


Amit Beka (2):
iwlwifi: fixed testmode notifications length
iwlwifi: add testmode command for rx forwarding

David Spinadel (1):
iwlwifi: add option to test MFP

Don Fry (3):
iwlwifi: separate status to priv and trans
iwlwifi: more status bit factoring
iwlwifi: correct status bit refactoring errors

Emmanuel Grumbach (2):
iwlwifi: log stop / wake queues
iwlwifi: restore PAN support

Johannes Berg (17):
iwlwifi: remove unused arguments from iwlagn_gain_computation
iwlwifi: remove unused argument from rs_initialize_lq
iwlwifi: move iwl_sta_id_or_broadcast to user
iwlwifi: remove unused argument from iwl_init_hw_rates
iwlwifi: remove two unused arguments in testmode
iwlwifi: remove unused argument from iwlagn_suspend
iwlwifi: redesign PASSIVE_NO_RX workaround
iwlwifi: transport's tx_agg_disable must be atomic
iwlwifi: remove BT handlers from lib_ops
iwlwifi: move BT/HT params to shared
iwlwifi: make EEPROM enhanced TX power a bool
iwlwifi: remove unused max_nrg_cck from sensitivity and constify
iwlwifi: return error if loading uCode failed
iwlwifi: remove messages from queue wake/stop
iwlwifi: make iwl_init_context static
iwlwifi: don't delete AP station directly
iwlwifi: always monitor for stuck queues

Meenakshi Venkataraman (3):
iwlwifi: configure transport layer from dvm op mode
iwlwifi: move setting up fw parameters
iwlwifi: move command queue number out of the iwl_shared struct

Stanislaw Gruszka (7):
iwlwifi: dump stack when fail to gain access to the device
iwlwifi: always check if got h/w access before write
iwlwifi: cleanup/fix memory barriers
iwlwifi: use writeb,writel,readl directly
iwlwifi: print DMA stop timeout error only if it happened
iwlwifi: reintroduce iwl_enable_rfkill_int
iwlwifi: make tx_cmd_pool kmem cache global

these patches are also available from wireless-next branch on
git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi.git



2012-03-07 19:06:36

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 23/35] iwlwifi: separate status to priv and trans

From: Don Fry <[email protected]>

The shared status bits are a mixture of transport and op mode bits.
Some are used just by one or the other, some are shared. Begin the
de-tangling of these bits.

Signed-off-by: Don Fry <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-agn-tt.c | 16 +++++++---------
drivers/net/wireless/iwlwifi/iwl-agn.h | 9 ++-------
drivers/net/wireless/iwlwifi/iwl-debugfs.c | 6 +-----
drivers/net/wireless/iwlwifi/iwl-dev.h | 1 +
drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h | 2 ++
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 2 --
7 files changed, 14 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index 6d8a857..3fed4bb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -1291,7 +1291,7 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan)

int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
{
- if (iwl_is_rfkill(priv->shrd) || iwl_is_ctkill(priv->shrd)) {
+ if (iwl_is_rfkill(priv->shrd) || iwl_is_ctkill(priv)) {
IWL_WARN(priv, "Not sending command - %s KILL\n",
iwl_is_rfkill(priv->shrd) ? "RF" : "CT");
return -EIO;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c
index 9a12b70..fa94153 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c
@@ -233,7 +233,7 @@ static void iwl_tt_ready_for_ct_kill(unsigned long data)
IWL_DEBUG_TEMP(priv, "entering CT_KILL state when "
"temperature timer expired\n");
tt->state = IWL_TI_CT_KILL;
- set_bit(STATUS_CT_KILL, &priv->shrd->status);
+ set_bit(STATUS_CT_KILL, &priv->status);
iwl_perform_ct_kill_task(priv, true);
}
}
@@ -313,22 +313,21 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
}
mutex_lock(&priv->mutex);
if (old_state == IWL_TI_CT_KILL)
- clear_bit(STATUS_CT_KILL, &priv->shrd->status);
+ clear_bit(STATUS_CT_KILL, &priv->status);
if (tt->state != IWL_TI_CT_KILL &&
iwl_power_update_mode(priv, true)) {
/* TT state not updated
* try again during next temperature read
*/
if (old_state == IWL_TI_CT_KILL)
- set_bit(STATUS_CT_KILL, &priv->shrd->status);
+ set_bit(STATUS_CT_KILL, &priv->status);
tt->state = old_state;
IWL_ERR(priv, "Cannot update power mode, "
"TT state not updated\n");
} else {
if (tt->state == IWL_TI_CT_KILL) {
if (force) {
- set_bit(STATUS_CT_KILL,
- &priv->shrd->status);
+ set_bit(STATUS_CT_KILL, &priv->status);
iwl_perform_ct_kill_task(priv, true);
} else {
iwl_prepare_ct_kill_task(priv);
@@ -454,7 +453,7 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
}
mutex_lock(&priv->mutex);
if (old_state == IWL_TI_CT_KILL)
- clear_bit(STATUS_CT_KILL, &priv->shrd->status);
+ clear_bit(STATUS_CT_KILL, &priv->status);
if (tt->state != IWL_TI_CT_KILL &&
iwl_power_update_mode(priv, true)) {
/* TT state not updated
@@ -463,7 +462,7 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
IWL_ERR(priv, "Cannot update power mode, "
"TT state not updated\n");
if (old_state == IWL_TI_CT_KILL)
- set_bit(STATUS_CT_KILL, &priv->shrd->status);
+ set_bit(STATUS_CT_KILL, &priv->status);
tt->state = old_state;
} else {
IWL_DEBUG_TEMP(priv,
@@ -474,8 +473,7 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
if (force) {
IWL_DEBUG_TEMP(priv,
"Enter IWL_TI_CT_KILL\n");
- set_bit(STATUS_CT_KILL,
- &priv->shrd->status);
+ set_bit(STATUS_CT_KILL, &priv->status);
iwl_perform_ct_kill_task(priv, true);
} else {
iwl_prepare_ct_kill_task(priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h
index 6345ab0..ede1852 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
@@ -367,11 +367,6 @@ static inline int iwl_is_alive(struct iwl_shared *shrd)
return test_bit(STATUS_ALIVE, &shrd->status);
}

-static inline int iwl_is_init(struct iwl_shared *shrd)
-{
- return test_bit(STATUS_INIT, &shrd->status);
-}
-
static inline int iwl_is_rfkill_hw(struct iwl_shared *shrd)
{
return test_bit(STATUS_RF_KILL_HW, &shrd->status);
@@ -382,9 +377,9 @@ static inline int iwl_is_rfkill(struct iwl_shared *shrd)
return iwl_is_rfkill_hw(shrd);
}

-static inline int iwl_is_ctkill(struct iwl_shared *shrd)
+static inline int iwl_is_ctkill(struct iwl_priv *priv)
{
- return test_bit(STATUS_CT_KILL, &shrd->status);
+ return test_bit(STATUS_CT_KILL, &priv->status);
}

static inline int iwl_is_ready_rf(struct iwl_shared *shrd)
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 5e1b078..71f8cc8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -530,15 +530,11 @@ static ssize_t iwl_dbgfs_status_read(struct file *file,
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n",
test_bit(STATUS_RF_KILL_HW, &priv->shrd->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_CT_KILL:\t\t %d\n",
- test_bit(STATUS_CT_KILL, &priv->shrd->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INIT:\t\t %d\n",
- test_bit(STATUS_INIT, &priv->shrd->status));
+ test_bit(STATUS_CT_KILL, &priv->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n",
test_bit(STATUS_ALIVE, &priv->shrd->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n",
test_bit(STATUS_READY, &priv->shrd->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_TEMPERATURE:\t %d\n",
- test_bit(STATUS_TEMPERATURE, &priv->shrd->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_GEO_CONFIGURED:\t %d\n",
test_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n",
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index c3f372e..1b05fae 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -713,6 +713,7 @@ struct iwl_priv {
/*data shared among all the driver's layers */
struct iwl_shared *shrd;
const struct iwl_fw *fw;
+ unsigned long status;

spinlock_t sta_lock;
struct mutex mutex;
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
index 93d89a3..16a32ae 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
@@ -247,6 +247,7 @@ struct iwl_tx_queue {
* @hw_base: pci hardware address support
* @ucode_write_complete: indicates that the ucode has been copied.
* @ucode_write_waitq: wait queue for uCode load
+ * @status - transport specific status flags
*/
struct iwl_trans_pcie {
struct iwl_rx_queue rxq;
@@ -287,6 +288,7 @@ struct iwl_trans_pcie {

bool ucode_write_complete;
wait_queue_head_t ucode_write_waitq;
+ unsigned long status;
};

#define IWL_TRANS_GET_PCIE_TRANS(_iwl_trans) \
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index 1d35d0e..4e56c3b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -840,8 +840,6 @@ static int iwl_nic_init(struct iwl_trans *trans)
0x800FFFFF);
}

- set_bit(STATUS_INIT, &trans->shrd->status);
-
return 0;
}

--
1.7.0.4


2012-03-07 20:23:34

by Joe Perches

[permalink] [raw]
Subject: [PATCH] iwlwifi: Add __printf verification

Make sure that arguments match formats.
All current uses do.

Signed-off-by: Joe Perches <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-debug.h | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
index 01b2330..42e6bbb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
@@ -34,10 +34,14 @@

struct iwl_priv;

+__printf(4, 5)
void __iwl_err(struct device *dev, bool rfkill_prefix, bool only_trace,
const char *fmt, ...);
+__printf(2, 3)
void __iwl_warn(struct device *dev, const char *fmt, ...);
+__printf(2, 3)
void __iwl_info(struct device *dev, const char *fmt, ...);
+__printf(2, 3)
void __iwl_crit(struct device *dev, const char *fmt, ...);

/* No matter what is m (priv, bus, trans), this will work */
@@ -47,10 +51,12 @@ void __iwl_crit(struct device *dev, const char *fmt, ...);
#define IWL_CRIT(m, f, a...) __iwl_crit(trans(m)->dev, f, ## a)

#if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING)
+__printf(6, 7)
void __iwl_dbg(struct iwl_shared *shared, struct device *dev,
u32 level, bool limit, const char *function,
const char *fmt, ...);
#else
+__printf(6, 7)
static inline void
__iwl_dbg(struct iwl_shared *shared, struct device *dev,
u32 level, bool limit, const char *function,



2012-03-07 19:06:30

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 08/35] iwlwifi: transport's tx_agg_disable must be atomic

From: Johannes Berg <[email protected]>

At least as long as it is called from the reclaim
flow (iwlagn_check_ratid_empty) it must be atomic.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-trans.h | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 609949f..ed6ab44 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -306,7 +306,7 @@ static inline struct page *rxb_steal_page(struct iwl_rx_cmd_buffer *r)
* ready and a successful ADDBA response has been received.
* May sleep
* @tx_agg_disable: de-configure a Tx queue to send AMPDUs
- * May sleep
+ * 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).
@@ -497,8 +497,6 @@ static inline int iwl_trans_reclaim(struct iwl_trans *trans, int sta_id,
static inline int iwl_trans_tx_agg_disable(struct iwl_trans *trans,
int sta_id, int tid)
{
- might_sleep();
-
if (trans->state != IWL_TRANS_FW_ALIVE)
IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);

--
1.7.0.4


2012-03-07 19:06:31

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 12/35] iwlwifi: remove unused max_nrg_cck from sensitivity and constify

From: Johannes Berg <[email protected]>

The sensitivity parameters are never modified, so they
should be const. Also remove the unused max_nrg_cck
value to save some space.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-1000.c | 3 +--
drivers/net/wireless/iwlwifi/iwl-2000.c | 3 +--
drivers/net/wireless/iwlwifi/iwl-5000.c | 4 +---
drivers/net/wireless/iwlwifi/iwl-6000.c | 3 +--
drivers/net/wireless/iwlwifi/iwl-dev.h | 1 -
5 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 798e24e..5b0d888 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -96,9 +96,8 @@ static void iwl1000_nic_config(struct iwl_priv *priv)
~APMG_SVR_VOLTAGE_CONFIG_BIT_MSK);
}

-static struct iwl_sensitivity_ranges iwl1000_sensitivity = {
+static const struct iwl_sensitivity_ranges iwl1000_sensitivity = {
.min_nrg_cck = 95,
- .max_nrg_cck = 0, /* not used, set to 0 */
.auto_corr_min_ofdm = 90,
.auto_corr_min_ofdm_mrc = 170,
.auto_corr_min_ofdm_x1 = 120,
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c
index 6931820..5635b9e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-2000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-2000.c
@@ -91,9 +91,8 @@ static void iwl2000_nic_config(struct iwl_priv *priv)
CSR_GP_DRIVER_REG_BIT_RADIO_IQ_INVER);
}

-static struct iwl_sensitivity_ranges iwl2000_sensitivity = {
+static const struct iwl_sensitivity_ranges iwl2000_sensitivity = {
.min_nrg_cck = 97,
- .max_nrg_cck = 0, /* not used, set to 0 */
.auto_corr_min_ofdm = 80,
.auto_corr_min_ofdm_mrc = 128,
.auto_corr_min_ofdm_x1 = 105,
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 0e97cfd..a805e97 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -75,9 +75,8 @@ static void iwl5000_nic_config(struct iwl_priv *priv)
~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS);
}

-static struct iwl_sensitivity_ranges iwl5000_sensitivity = {
+static const struct iwl_sensitivity_ranges iwl5000_sensitivity = {
.min_nrg_cck = 100,
- .max_nrg_cck = 0, /* not used, set to 0 */
.auto_corr_min_ofdm = 90,
.auto_corr_min_ofdm_mrc = 170,
.auto_corr_min_ofdm_x1 = 105,
@@ -102,7 +101,6 @@ static struct iwl_sensitivity_ranges iwl5000_sensitivity = {

static struct iwl_sensitivity_ranges iwl5150_sensitivity = {
.min_nrg_cck = 95,
- .max_nrg_cck = 0, /* not used, set to 0 */
.auto_corr_min_ofdm = 90,
.auto_corr_min_ofdm_mrc = 170,
.auto_corr_min_ofdm_x1 = 105,
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 9fbab01..64060cd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -113,9 +113,8 @@ static void iwl6000_nic_config(struct iwl_priv *priv)
cfg(priv)->additional_nic_config(priv);
}

-static struct iwl_sensitivity_ranges iwl6000_sensitivity = {
+static const struct iwl_sensitivity_ranges iwl6000_sensitivity = {
.min_nrg_cck = 110,
- .max_nrg_cck = 0, /* not used, set to 0 */
.auto_corr_min_ofdm = 80,
.auto_corr_min_ofdm_mrc = 128,
.auto_corr_min_ofdm_x1 = 105,
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 7442970..c3f372e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -294,7 +294,6 @@ struct iwl_vif_priv {

struct iwl_sensitivity_ranges {
u16 min_nrg_cck;
- u16 max_nrg_cck;

u16 nrg_th_cck;
u16 nrg_th_ofdm;
--
1.7.0.4


2012-03-07 19:06:36

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 21/35] iwlwifi: fixed testmode notifications length

From: Amit Beka <[email protected]>

The length of iwl_rx_packet doesn't include the
dword for the length itself, so add it manually.

Signed-off-by: Amit Beka <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-testmode.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-testmode.c b/drivers/net/wireless/iwlwifi/iwl-testmode.c
index b8044bc..b06c676 100644
--- a/drivers/net/wireless/iwlwifi/iwl-testmode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-testmode.c
@@ -185,7 +185,8 @@ static void iwl_testmode_ucode_rx_pkt(struct iwl_priv *priv,
return;
}
NLA_PUT_U32(skb, IWL_TM_ATTR_COMMAND, IWL_TM_CMD_DEV2APP_UCODE_RX_PKT);
- NLA_PUT(skb, IWL_TM_ATTR_UCODE_RX_PKT, length, data);
+ /* the length doesn't include len_n_flags field, so add it manually */
+ NLA_PUT(skb, IWL_TM_ATTR_UCODE_RX_PKT, length + sizeof(__le32), data);
cfg80211_testmode_event(skb, GFP_ATOMIC);
return;

--
1.7.0.4


2012-03-08 21:35:24

by Wey-Yi Guy

[permalink] [raw]
Subject: Re: [PATCH RESEND 29/35] iwlwifi: move command queue number out of the iwl_shared struct

John,

I push the revised version of patch, is it works for you?

Thanks
Wey

On Thu, 2012-03-08 at 14:19 -0500, John W. Linville wrote:
> This one didn't apply...
>
> On Wed, Mar 07, 2012 at 09:52:38AM -0800, Wey-Yi Guy wrote:
> > From: Meenakshi Venkataraman <[email protected]>
> >
> > The command queue number is required by the transport
> > layer, but it can be determined only by the op mode.
> > Move this parameter to the dvm op mode, and configure
> > the transport layer using an API.
> >
> > Signed-off-by: Meenakshi Venkataraman <[email protected]>
> > Signed-off-by: Wey-Yi Guy <[email protected]>
> > ---
> > drivers/net/wireless/iwlwifi/iwl-agn.c | 16 +++++-----
> > drivers/net/wireless/iwlwifi/iwl-shared.h | 2 -
> > drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h | 2 +
> > drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 2 +-
> > drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c | 24 +++++++-------
> > drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 34 +++++++++++++-------
> > drivers/net/wireless/iwlwifi/iwl-trans.h | 9 +++++
> > 7 files changed, 54 insertions(+), 35 deletions(-)
> >
> > diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
> > index d45def3..76ee2dd 100644
> > --- a/drivers/net/wireless/iwlwifi/iwl-agn.c
> > +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
> > @@ -1236,6 +1236,14 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
> > */
> > trans_cfg.op_mode = op_mode;
> >
> > + if (ucode_flags & IWL_UCODE_TLV_FLAGS_PAN) {
> > + priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
> > + trans_cfg.cmd_queue = IWL_IPAN_CMD_QUEUE_NUM;
> > + } else {
> > + priv->sta_key_max_num = STA_KEY_MAX_NUM;
> > + trans_cfg.cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
> > + }
> > +
> > /* Configure transport layer */
> > iwl_trans_configure(trans(priv), &trans_cfg);
> >
> > @@ -1336,14 +1344,6 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
> > priv->new_scan_threshold_behaviour =
> > !!(ucode_flags & IWL_UCODE_TLV_FLAGS_NEWSCAN);
> >
> > - if (ucode_flags & IWL_UCODE_TLV_FLAGS_PAN) {
> > - priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
> > - priv->shrd->cmd_queue = IWL_IPAN_CMD_QUEUE_NUM;
> > - } else {
> > - priv->sta_key_max_num = STA_KEY_MAX_NUM;
> > - priv->shrd->cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
> > - }
> > -
> > priv->phy_calib_chain_noise_reset_cmd =
> > fw->ucode_capa.standard_phy_calibration_size;
> > priv->phy_calib_chain_noise_gain_cmd =
> > diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h
> > index 0e24803..cf34087 100644
> > --- a/drivers/net/wireless/iwlwifi/iwl-shared.h
> > +++ b/drivers/net/wireless/iwlwifi/iwl-shared.h
> > @@ -366,7 +366,6 @@ struct iwl_cfg {
> > /**
> > * struct iwl_shared - shared fields for all the layers of the driver
> > *
> > - * @cmd_queue: command queue number
> > * @status: STATUS_*
> > * @wowlan: are we running wowlan uCode
> > * @valid_contexts: microcode/device supports multiple contexts
> > @@ -383,7 +382,6 @@ struct iwl_cfg {
> > * @device_pointers: pointers to ucode event tables
> > */
> > struct iwl_shared {
> > - u8 cmd_queue;
> > unsigned long status;
> > u8 valid_contexts;
> >
> > diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
> > index dd64e69..14e5d52 100644
> > --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
> > +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
> > @@ -248,6 +248,7 @@ struct iwl_tx_queue {
> > * @ucode_write_complete: indicates that the ucode has been copied.
> > * @ucode_write_waitq: wait queue for uCode load
> > * @status - transport specific status flags
> > + * @cmd_queue - command queue number
> > */
> > struct iwl_trans_pcie {
> > struct iwl_rx_queue rxq;
> > @@ -289,6 +290,7 @@ struct iwl_trans_pcie {
> > bool ucode_write_complete;
> > wait_queue_head_t ucode_write_waitq;
> > unsigned long status;
> > + u8 cmd_queue;
> > };
> >
> > #define IWL_TRANS_GET_PCIE_TRANS(_iwl_trans) \
> > diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
> > index 17e1487..9bc3c73 100644
> > --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
> > +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
> > @@ -361,7 +361,7 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans,
> > {
> > struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
> > struct iwl_rx_queue *rxq = &trans_pcie->rxq;
> > - struct iwl_tx_queue *txq = &trans_pcie->txq[trans->shrd->cmd_queue];
> > + struct iwl_tx_queue *txq = &trans_pcie->txq[trans_pcie->cmd_queue];
> > struct iwl_device_cmd *cmd;
> > unsigned long flags;
> > int len, err;
> > diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
> > index 8d13362..565c664 100644
> > --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
> > +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
> > @@ -397,7 +397,7 @@ static void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_trans *trans,
> >
> > WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX);
> >
> > - if (txq_id != trans->shrd->cmd_queue)
> > + if (txq_id != trans_pcie->cmd_queue)
> > sta_id = tx_cmd->sta_id;
> >
> > bc_ent = cpu_to_le16(1 | (sta_id << 12));
> > @@ -665,7 +665,7 @@ int iwl_trans_pcie_tx_agg_disable(struct iwl_trans *trans, int sta_id, int tid)
> > static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
> > {
> > struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
> > - struct iwl_tx_queue *txq = &trans_pcie->txq[trans->shrd->cmd_queue];
> > + struct iwl_tx_queue *txq = &trans_pcie->txq[trans_pcie->cmd_queue];
> > struct iwl_queue *q = &txq->q;
> > struct iwl_device_cmd *out_cmd;
> > struct iwl_cmd_meta *out_meta;
> > @@ -738,7 +738,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
> > out_cmd->hdr.cmd = cmd->id;
> > out_cmd->hdr.flags = 0;
> > out_cmd->hdr.sequence =
> > - cpu_to_le16(QUEUE_TO_SEQ(trans->shrd->cmd_queue) |
> > + cpu_to_le16(QUEUE_TO_SEQ(trans_pcie->cmd_queue) |
> > INDEX_TO_SEQ(q->write_ptr));
> >
> > /* and copy the data that needs to be copied */
> > @@ -758,7 +758,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
> > get_cmd_string(out_cmd->hdr.cmd),
> > out_cmd->hdr.cmd,
> > le16_to_cpu(out_cmd->hdr.sequence), cmd_size,
> > - q->write_ptr, idx, trans->shrd->cmd_queue);
> > + q->write_ptr, idx, trans_pcie->cmd_queue);
> >
> > phys_addr = dma_map_single(trans->dev, &out_cmd->hdr, copy_size,
> > DMA_BIDIRECTIONAL);
> > @@ -882,16 +882,16 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_cmd_buffer *rxb,
> > struct iwl_device_cmd *cmd;
> > struct iwl_cmd_meta *meta;
> > struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
> > - struct iwl_tx_queue *txq = &trans_pcie->txq[trans->shrd->cmd_queue];
> > + struct iwl_tx_queue *txq = &trans_pcie->txq[trans_pcie->cmd_queue];
> >
> > /* If a Tx command is being handled and it isn't in the actual
> > * command queue then there a command routing bug has been introduced
> > * in the queue management code. */
> > - if (WARN(txq_id != trans->shrd->cmd_queue,
> > + if (WARN(txq_id != trans_pcie->cmd_queue,
> > "wrong command queue %d (should be %d), sequence 0x%X readp=%d writep=%d\n",
> > - txq_id, trans->shrd->cmd_queue, sequence,
> > - trans_pcie->txq[trans->shrd->cmd_queue].q.read_ptr,
> > - trans_pcie->txq[trans->shrd->cmd_queue].q.write_ptr)) {
> > + txq_id, trans_pcie->cmd_queue, sequence,
> > + trans_pcie->txq[trans_pcie->cmd_queue].q.read_ptr,
> > + trans_pcie->txq[trans_pcie->cmd_queue].q.write_ptr)) {
> > iwl_print_hex_error(trans, pkt, 32);
> > return;
> > }
> > @@ -998,7 +998,7 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
> > if (!ret) {
> > if (test_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status)) {
> > struct iwl_tx_queue *txq =
> > - &trans_pcie->txq[trans->shrd->cmd_queue];
> > + &trans_pcie->txq[trans_pcie->cmd_queue];
> > struct iwl_queue *q = &txq->q;
> >
> > IWL_ERR(trans,
> > @@ -1035,7 +1035,7 @@ cancel:
> > * in later, it will possibly set an invalid
> > * address (cmd->meta.source).
> > */
> > - trans_pcie->txq[trans->shrd->cmd_queue].meta[cmd_idx].flags &=
> > + trans_pcie->txq[trans_pcie->cmd_queue].meta[cmd_idx].flags &=
> > ~CMD_WANT_SKB;
> > }
> >
> > @@ -1066,7 +1066,7 @@ int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
> > int freed = 0;
> >
> > /* This function is not meant to release cmd queue*/
> > - if (WARN_ON(txq_id == trans->shrd->cmd_queue))
> > + if (WARN_ON(txq_id == trans_pcie->cmd_queue))
> > return 0;
> >
> > lockdep_assert_held(&txq->lock);
> > diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
> > index b0d34f7..f28f4cb 100644
> > --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
> > +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
> > @@ -78,9 +78,9 @@
> >
> > #define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo))))
> >
> > -#define SCD_QUEUECHAIN_SEL_ALL(trans) \
> > +#define SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie) \
> > (((1<<cfg(trans)->base_params->num_of_queues) - 1) &\
> > - (~(1<<(trans)->shrd->cmd_queue)))
> > + (~(1<<(trans_pcie)->cmd_queue)))
> >
> >
> > static int iwl_trans_rx_alloc(struct iwl_trans *trans)
> > @@ -306,6 +306,7 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
> > {
> > size_t tfd_sz = sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX;
> > int i;
> > + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
> >
> > if (WARN_ON(txq->meta || txq->cmd || txq->skbs || txq->tfds))
> > return -EINVAL;
> > @@ -318,7 +319,7 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
> > if (!txq->meta || !txq->cmd)
> > goto error;
> >
> > - if (txq_id == trans->shrd->cmd_queue)
> > + if (txq_id == trans_pcie->cmd_queue)
> > for (i = 0; i < slots_num; i++) {
> > txq->cmd[i] = kmalloc(sizeof(struct iwl_device_cmd),
> > GFP_KERNEL);
> > @@ -329,7 +330,7 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
> > /* 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->shrd->cmd_queue) {
> > + if (txq_id != trans_pcie->cmd_queue) {
> > txq->skbs = kcalloc(TFD_QUEUE_SIZE_MAX, sizeof(txq->skbs[0]),
> > GFP_KERNEL);
> > if (!txq->skbs) {
> > @@ -357,7 +358,7 @@ error:
> > txq->skbs = NULL;
> > /* since txq->cmd has been zeroed,
> > * all non allocated cmd[i] will be NULL */
> > - if (txq->cmd && txq_id == trans->shrd->cmd_queue)
> > + if (txq->cmd && txq_id == trans_pcie->cmd_queue)
> > for (i = 0; i < slots_num; i++)
> > kfree(txq->cmd[i]);
> > kfree(txq->meta);
> > @@ -423,7 +424,7 @@ static void iwl_tx_queue_unmap(struct iwl_trans *trans, int txq_id)
> > /* In the command queue, all the TBs are mapped as BIDI
> > * so unmap them as such.
> > */
> > - if (txq_id == trans->shrd->cmd_queue)
> > + if (txq_id == trans_pcie->cmd_queue)
> > dma_dir = DMA_BIDIRECTIONAL;
> > else
> > dma_dir = DMA_TO_DEVICE;
> > @@ -459,7 +460,7 @@ static void iwl_tx_queue_free(struct iwl_trans *trans, int txq_id)
> >
> > /* De-alloc array of command/tx buffers */
> >
> > - if (txq_id == trans->shrd->cmd_queue)
> > + if (txq_id == trans_pcie->cmd_queue)
> > for (i = 0; i < txq->q.n_window; i++)
> > kfree(txq->cmd[i]);
> >
> > @@ -557,7 +558,7 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans)
> > /* 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;
> > txq_id++) {
> > - slots_num = (txq_id == trans->shrd->cmd_queue) ?
> > + slots_num = (txq_id == trans_pcie->cmd_queue) ?
> > TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
> > ret = iwl_trans_txq_alloc(trans, &trans_pcie->txq[txq_id],
> > slots_num, txq_id);
> > @@ -603,7 +604,7 @@ static int iwl_tx_init(struct iwl_trans *trans)
> > /* 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;
> > txq_id++) {
> > - slots_num = (txq_id == trans->shrd->cmd_queue) ?
> > + slots_num = (txq_id == trans_pcie->cmd_queue) ?
> > TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
> > ret = iwl_trans_txq_init(trans, &trans_pcie->txq[txq_id],
> > slots_num, txq_id);
> > @@ -1138,7 +1139,7 @@ static void iwl_tx_start(struct iwl_trans *trans)
> > reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN);
> >
> > iwl_write_prph(trans, SCD_QUEUECHAIN_SEL,
> > - SCD_QUEUECHAIN_SEL_ALL(trans));
> > + SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie));
> > iwl_write_prph(trans, SCD_AGGR_SEL, 0);
> >
> > /* initiate the queues */
> > @@ -1170,7 +1171,7 @@ static void iwl_tx_start(struct iwl_trans *trans)
> > else
> > queue_to_fifo = iwlagn_default_queue_to_tx_fifo;
> >
> > - iwl_trans_set_wr_ptrs(trans, trans->shrd->cmd_queue, 0);
> > + iwl_trans_set_wr_ptrs(trans, trans_pcie->cmd_queue, 0);
> >
> > /* make sure all queue are not stopped */
> > memset(&trans_pcie->queue_stopped[0], 0,
> > @@ -1622,6 +1623,14 @@ static u32 iwl_trans_pcie_read32(struct iwl_trans *trans, u32 ofs)
> > return readl(IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs);
> > }
> >
> > +static void iwl_trans_pcie_configure(struct iwl_trans *trans,
> > + const struct iwl_trans_config *trans_cfg)
> > +{
> > + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
> > +
> > + trans_pcie->cmd_queue = trans_cfg->cmd_queue;
> > +}
> > +
> > static void iwl_trans_pcie_free(struct iwl_trans *trans)
> > {
> > struct iwl_trans_pcie *trans_pcie =
> > @@ -1682,7 +1691,7 @@ static int iwl_trans_pcie_wait_tx_queue_empty(struct iwl_trans *trans)
> >
> > /* waiting for all the tx frames complete might take a while */
> > for (cnt = 0; cnt < cfg(trans)->base_params->num_of_queues; cnt++) {
> > - if (cnt == trans->shrd->cmd_queue)
> > + if (cnt == trans_pcie->cmd_queue)
> > continue;
> > txq = &trans_pcie->txq[cnt];
> > q = &txq->q;
> > @@ -2213,6 +2222,7 @@ const struct iwl_trans_ops trans_ops_pcie = {
> > .write8 = iwl_trans_pcie_write8,
> > .write32 = iwl_trans_pcie_write32,
> > .read32 = iwl_trans_pcie_read32,
> > + .configure = iwl_trans_pcie_configure,
> > };
> >
> > struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd,
> > diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
> > index b6fd427..a40c272 100644
> > --- a/drivers/net/wireless/iwlwifi/iwl-trans.h
> > +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
> > @@ -279,9 +279,12 @@ static inline struct page *rxb_steal_page(struct iwl_rx_cmd_buffer *r)
> > *
> > * @op_mode: pointer to the upper layer.
> > * Must be set before any other call.
> > + * @cmd_queue: the index of the command queue.
> > + * Must be set before start_fw.
> > */
> > struct iwl_trans_config {
> > struct iwl_op_mode *op_mode;
> > + u8 cmd_queue;
> > };
> >
> > /**
> > @@ -331,6 +334,8 @@ struct iwl_trans_config {
> > * @write8: write a u8 to a register at offset ofs from the BAR
> > * @write32: write a u32 to a register at offset ofs from the BAR
> > * @read32: read a u32 register at offset ofs from the BAR
> > + * @configure: configure parameters required by the transport layer from
> > + * the op_mode.
> > */
> > struct iwl_trans_ops {
> >
> > @@ -370,6 +375,8 @@ struct iwl_trans_ops {
> > void (*write8)(struct iwl_trans *trans, u32 ofs, u8 val);
> > void (*write32)(struct iwl_trans *trans, u32 ofs, u32 val);
> > u32 (*read32)(struct iwl_trans *trans, u32 ofs);
> > + void (*configure)(struct iwl_trans *trans,
> > + const struct iwl_trans_config *trans_cfg);
> > };
> >
> > /**
> > @@ -425,6 +432,8 @@ static inline void iwl_trans_configure(struct iwl_trans *trans,
> > * more
> > */
> > trans->op_mode = trans_cfg->op_mode;
> > +
> > + trans->ops->configure(trans, trans_cfg);
> > }
> >
> > static inline int iwl_trans_start_hw(struct iwl_trans *trans)
> > --
> > 1.7.0.4
> >
> >
>



2012-03-07 19:06:37

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 24/35] iwlwifi: make tx_cmd_pool kmem cache global

From: Stanislaw Gruszka <[email protected]>

Otherwise we are not able to run more than one device per driver:

[ 24.743045] kmem_cache_create: duplicate cache iwl_dev_cmd
[ 24.743051] Pid: 3165, comm: NetworkManager Not tainted 3.3.0-rc2-wl+ #5
[ 24.743054] Call Trace:
[ 24.743066] [<ffffffff811717d5>] kmem_cache_create+0x655/0x700
[ 24.743101] [<ffffffffa03b9f8b>] iwl_alive_notify+0x1cb/0x1f0 [iwlwifi]
[ 24.743111] [<ffffffffa03ba442>] iwl_load_ucode_wait_alive+0x1b2/0x220 [iwlwifi]
[ 24.743142] [<ffffffffa03ba893>] iwl_run_init_ucode+0x73/0x100 [iwlwifi]
[ 24.743152] [<ffffffffa03b8fa1>] __iwl_up+0x81/0x220 [iwlwifi]
[ 24.743161] [<ffffffffa03b91c0>] iwlagn_mac_start+0x80/0x190 [iwlwifi]
[ 24.743188] [<ffffffffa03307b3>] ieee80211_do_open+0x293/0x770 [mac80211]

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn-tx.c | 8 ++++----
drivers/net/wireless/iwlwifi/iwl-agn.c | 21 +++++++++++++++------
drivers/net/wireless/iwlwifi/iwl-core.c | 3 +--
drivers/net/wireless/iwlwifi/iwl-dev.h | 2 +-
drivers/net/wireless/iwlwifi/iwl-ucode.c | 9 ---------
5 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index 527fde0..1d67e6c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -367,7 +367,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
if (info->flags & IEEE80211_TX_CTL_AMPDU)
is_agg = true;

- dev_cmd = kmem_cache_alloc(priv->tx_cmd_pool, GFP_ATOMIC);
+ dev_cmd = kmem_cache_alloc(iwl_tx_cmd_pool, GFP_ATOMIC);

if (unlikely(!dev_cmd))
goto drop_unlock_priv;
@@ -458,7 +458,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)

drop_unlock_sta:
if (dev_cmd)
- kmem_cache_free(priv->tx_cmd_pool, dev_cmd);
+ kmem_cache_free(iwl_tx_cmd_pool, dev_cmd);
spin_unlock(&priv->sta_lock);
drop_unlock_priv:
return -1;
@@ -1078,7 +1078,7 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,

info = IEEE80211_SKB_CB(skb);
ctx = info->driver_data[0];
- kmem_cache_free(priv->tx_cmd_pool,
+ kmem_cache_free(iwl_tx_cmd_pool,
(info->driver_data[1]));

memset(&info->status, 0, sizeof(info->status));
@@ -1229,7 +1229,7 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
WARN_ON_ONCE(1);

info = IEEE80211_SKB_CB(skb);
- kmem_cache_free(priv->tx_cmd_pool, (info->driver_data[1]));
+ kmem_cache_free(iwl_tx_cmd_pool, (info->driver_data[1]));

if (freed == 1) {
/* this is the first skb we deliver in this batch */
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 64bc285..7927e3e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1102,8 +1102,6 @@ static void iwl_uninit_drv(struct iwl_priv *priv)
{
iwl_free_geos(priv);
iwl_free_channel_map(priv);
- if (priv->tx_cmd_pool)
- kmem_cache_destroy(priv->tx_cmd_pool);
kfree(priv->scan_cmd);
kfree(priv->beacon_cmd);
kfree(rcu_dereference_raw(priv->noa_data));
@@ -1477,6 +1475,9 @@ const struct iwl_op_mode_ops iwl_dvm_ops = {
* driver and module entry point
*
*****************************************************************************/
+
+struct kmem_cache *iwl_tx_cmd_pool;
+
static int __init iwl_init(void)
{

@@ -1484,20 +1485,27 @@ static int __init iwl_init(void)
pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n");
pr_info(DRV_COPYRIGHT "\n");

+ iwl_tx_cmd_pool = kmem_cache_create("iwl_dev_cmd",
+ sizeof(struct iwl_device_cmd),
+ sizeof(void *), 0, NULL);
+ if (!iwl_tx_cmd_pool)
+ return -ENOMEM;
+
ret = iwlagn_rate_control_register();
if (ret) {
pr_err("Unable to register rate control algorithm: %d\n", ret);
- return ret;
+ goto error_rc_register;
}

ret = iwl_pci_register_driver();
-
if (ret)
- goto error_register;
+ goto error_pci_register;
return ret;

-error_register:
+error_pci_register:
iwlagn_rate_control_unregister();
+error_rc_register:
+ kmem_cache_destroy(iwl_tx_cmd_pool);
return ret;
}

@@ -1505,6 +1513,7 @@ static void __exit iwl_exit(void)
{
iwl_pci_unregister_driver();
iwlagn_rate_control_unregister();
+ kmem_cache_destroy(iwl_tx_cmd_pool);
}

module_exit(iwl_exit);
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index c2e604b..6de2949 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1481,10 +1481,9 @@ void iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state)

void iwl_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb)
{
- struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
struct ieee80211_tx_info *info;

info = IEEE80211_SKB_CB(skb);
- kmem_cache_free(priv->tx_cmd_pool, (info->driver_data[1]));
+ kmem_cache_free(iwl_tx_cmd_pool, (info->driver_data[1]));
dev_kfree_skb_any(skb);
}
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 1b05fae..aa4b3b1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -725,7 +725,6 @@ struct iwl_priv {
struct ieee80211_hw *hw;
struct ieee80211_channel *ieee_channels;
struct ieee80211_rate *ieee_rates;
- struct kmem_cache *tx_cmd_pool;

struct list_head calib_results;

@@ -983,6 +982,7 @@ struct iwl_priv {
bool have_rekey_data;
}; /*iwl_priv */

+extern struct kmem_cache *iwl_tx_cmd_pool;
extern struct iwl_mod_params iwlagn_mod_params;

static inline struct iwl_rxon_context *
diff --git a/drivers/net/wireless/iwlwifi/iwl-ucode.c b/drivers/net/wireless/iwlwifi/iwl-ucode.c
index 404fd8e..d97cf44 100644
--- a/drivers/net/wireless/iwlwifi/iwl-ucode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-ucode.c
@@ -318,15 +318,6 @@ static int iwl_alive_notify(struct iwl_priv *priv)
{
int ret;

- if (!priv->tx_cmd_pool)
- priv->tx_cmd_pool =
- kmem_cache_create("iwl_dev_cmd",
- sizeof(struct iwl_device_cmd),
- sizeof(void *), 0, NULL);
-
- if (!priv->tx_cmd_pool)
- return -ENOMEM;
-
iwl_trans_fw_alive(trans(priv));

priv->passive_no_rx = false;
--
1.7.0.4


2012-03-07 19:06:32

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 14/35] iwlwifi: dump stack when fail to gain access to the device

From: Stanislaw Gruszka <[email protected]>

Print dump stack when the device is not responding. This should give
some more clue about the reason of failure. Also change the message we
print, since "MAC in deep sleep" is kinda confusing.

On the way add unlikely(), as fail to gain NIC access is hmm ...
unlikely.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-io.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c b/drivers/net/wireless/iwlwifi/iwl-io.c
index e2e3b5c..fc36535 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.c
+++ b/drivers/net/wireless/iwlwifi/iwl-io.c
@@ -121,10 +121,10 @@ int iwl_grab_nic_access_silent(struct iwl_trans *trans)
int iwl_grab_nic_access(struct iwl_trans *trans)
{
int ret = iwl_grab_nic_access_silent(trans);
- if (ret) {
+ if (unlikely(ret)) {
u32 val = iwl_read32(trans, CSR_GP_CNTRL);
- IWL_ERR(trans,
- "MAC is in deep sleep!. CSR_GP_CNTRL = 0x%08X\n", val);
+ WARN_ONCE(1, "Timeout waiting for hardware access "
+ "(CSR_GP_CNTRL 0x%08x)\n", val);
}

return ret;
--
1.7.0.4


2012-03-07 19:06:39

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 26/35] iwlwifi: configure transport layer from dvm op mode

From: Meenakshi Venkataraman <[email protected]>

Introduce the iwl_trans_config struct which contains
state variables that only the op mode can determine,
but which the transport layer needs to know.

Signed-off-by: Meenakshi Venkataraman <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 10 +++++++++-
drivers/net/wireless/iwlwifi/iwl-trans.h | 14 ++++++++++++--
2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 6ed2f78..83018ec 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1185,6 +1185,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
struct iwl_op_mode *op_mode;
u16 num_mac;
u32 ucode_flags;
+ struct iwl_trans_config trans_cfg;

/************************
* 1. Allocating HW data
@@ -1205,7 +1206,14 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
/* TODO: remove fw from shared data later */
priv->shrd->fw = fw;

- iwl_trans_configure(trans(priv), op_mode);
+ /*
+ * Populate the state variables that the transport layer needs
+ * to know about.
+ */
+ trans_cfg.op_mode = op_mode;
+
+ /* Configure transport layer */
+ iwl_trans_configure(trans(priv), &trans_cfg);

/* At this point both hw and priv are allocated. */

diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index ed6ab44..b6fd427 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -275,6 +275,16 @@ static inline struct page *rxb_steal_page(struct iwl_rx_cmd_buffer *r)
}

/**
+ * struct iwl_trans_config - transport configuration
+ *
+ * @op_mode: pointer to the upper layer.
+ * Must be set before any other call.
+ */
+struct iwl_trans_config {
+ struct iwl_op_mode *op_mode;
+};
+
+/**
* struct iwl_trans_ops - transport specific operations
*
* All the handlers MUST be implemented
@@ -408,13 +418,13 @@ struct iwl_trans {
};

static inline void iwl_trans_configure(struct iwl_trans *trans,
- struct iwl_op_mode *op_mode)
+ const struct iwl_trans_config *trans_cfg)
{
/*
* only set the op_mode for the moment. Later on, this function will do
* more
*/
- trans->op_mode = op_mode;
+ trans->op_mode = trans_cfg->op_mode;
}

static inline int iwl_trans_start_hw(struct iwl_trans *trans)
--
1.7.0.4


2012-03-07 19:06:30

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 05/35] iwlwifi: remove two unused arguments in testmode

From: Johannes Berg <[email protected]>

The dump functions never access the incoming
attributes, so don't pass them.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-testmode.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-testmode.c b/drivers/net/wireless/iwlwifi/iwl-testmode.c
index 5b06916..1d73209 100644
--- a/drivers/net/wireless/iwlwifi/iwl-testmode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-testmode.c
@@ -713,7 +713,7 @@ nla_put_failure:
return -EMSGSIZE;
}

-static int iwl_testmode_trace_dump(struct ieee80211_hw *hw, struct nlattr **tb,
+static int iwl_testmode_trace_dump(struct ieee80211_hw *hw,
struct sk_buff *skb,
struct netlink_callback *cb)
{
@@ -905,9 +905,9 @@ static int iwl_testmode_indirect_mem(struct ieee80211_hw *hw,
}
}

-static int iwl_testmode_buffer_dump(struct ieee80211_hw *hw, struct nlattr **tb,
- struct sk_buff *skb,
- struct netlink_callback *cb)
+static int iwl_testmode_buffer_dump(struct ieee80211_hw *hw,
+ struct sk_buff *skb,
+ struct netlink_callback *cb)
{
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
int idx, length;
@@ -1067,11 +1067,11 @@ int iwlagn_mac_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *skb,
switch (cmd) {
case IWL_TM_CMD_APP2DEV_READ_TRACE:
IWL_DEBUG_INFO(priv, "uCode trace cmd to driver\n");
- result = iwl_testmode_trace_dump(hw, tb, skb, cb);
+ result = iwl_testmode_trace_dump(hw, skb, cb);
break;
case IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_DUMP:
IWL_DEBUG_INFO(priv, "testmode sram dump cmd to driver\n");
- result = iwl_testmode_buffer_dump(hw, tb, skb, cb);
+ result = iwl_testmode_buffer_dump(hw, skb, cb);
break;
default:
result = -EINVAL;
--
1.7.0.4


2012-03-07 19:06:40

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 29/35] iwlwifi: move command queue number out of the iwl_shared struct

From: Meenakshi Venkataraman <[email protected]>

The command queue number is required by the transport
layer, but it can be determined only by the op mode.
Move this parameter to the dvm op mode, and configure
the transport layer using an API.

Signed-off-by: Meenakshi Venkataraman <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 16 +++++-----
drivers/net/wireless/iwlwifi/iwl-shared.h | 2 -
drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h | 2 +
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c | 24 +++++++-------
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 34 +++++++++++++-------
drivers/net/wireless/iwlwifi/iwl-trans.h | 9 +++++
7 files changed, 54 insertions(+), 35 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index d45def3..76ee2dd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1236,6 +1236,14 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
*/
trans_cfg.op_mode = op_mode;

+ if (ucode_flags & IWL_UCODE_TLV_FLAGS_PAN) {
+ priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
+ trans_cfg.cmd_queue = IWL_IPAN_CMD_QUEUE_NUM;
+ } else {
+ priv->sta_key_max_num = STA_KEY_MAX_NUM;
+ trans_cfg.cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
+ }
+
/* Configure transport layer */
iwl_trans_configure(trans(priv), &trans_cfg);

@@ -1336,14 +1344,6 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
priv->new_scan_threshold_behaviour =
!!(ucode_flags & IWL_UCODE_TLV_FLAGS_NEWSCAN);

- if (ucode_flags & IWL_UCODE_TLV_FLAGS_PAN) {
- priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
- priv->shrd->cmd_queue = IWL_IPAN_CMD_QUEUE_NUM;
- } else {
- priv->sta_key_max_num = STA_KEY_MAX_NUM;
- priv->shrd->cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
- }
-
priv->phy_calib_chain_noise_reset_cmd =
fw->ucode_capa.standard_phy_calibration_size;
priv->phy_calib_chain_noise_gain_cmd =
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h
index 0e24803..cf34087 100644
--- a/drivers/net/wireless/iwlwifi/iwl-shared.h
+++ b/drivers/net/wireless/iwlwifi/iwl-shared.h
@@ -366,7 +366,6 @@ struct iwl_cfg {
/**
* struct iwl_shared - shared fields for all the layers of the driver
*
- * @cmd_queue: command queue number
* @status: STATUS_*
* @wowlan: are we running wowlan uCode
* @valid_contexts: microcode/device supports multiple contexts
@@ -383,7 +382,6 @@ struct iwl_cfg {
* @device_pointers: pointers to ucode event tables
*/
struct iwl_shared {
- u8 cmd_queue;
unsigned long status;
u8 valid_contexts;

diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
index dd64e69..14e5d52 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
@@ -248,6 +248,7 @@ struct iwl_tx_queue {
* @ucode_write_complete: indicates that the ucode has been copied.
* @ucode_write_waitq: wait queue for uCode load
* @status - transport specific status flags
+ * @cmd_queue - command queue number
*/
struct iwl_trans_pcie {
struct iwl_rx_queue rxq;
@@ -289,6 +290,7 @@ struct iwl_trans_pcie {
bool ucode_write_complete;
wait_queue_head_t ucode_write_waitq;
unsigned long status;
+ u8 cmd_queue;
};

#define IWL_TRANS_GET_PCIE_TRANS(_iwl_trans) \
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
index 17e1487..9bc3c73 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
@@ -361,7 +361,7 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans,
{
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
struct iwl_rx_queue *rxq = &trans_pcie->rxq;
- struct iwl_tx_queue *txq = &trans_pcie->txq[trans->shrd->cmd_queue];
+ struct iwl_tx_queue *txq = &trans_pcie->txq[trans_pcie->cmd_queue];
struct iwl_device_cmd *cmd;
unsigned long flags;
int len, err;
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
index 8d13362..565c664 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
@@ -397,7 +397,7 @@ static void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_trans *trans,

WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX);

- if (txq_id != trans->shrd->cmd_queue)
+ if (txq_id != trans_pcie->cmd_queue)
sta_id = tx_cmd->sta_id;

bc_ent = cpu_to_le16(1 | (sta_id << 12));
@@ -665,7 +665,7 @@ int iwl_trans_pcie_tx_agg_disable(struct iwl_trans *trans, int sta_id, int tid)
static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
{
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
- struct iwl_tx_queue *txq = &trans_pcie->txq[trans->shrd->cmd_queue];
+ struct iwl_tx_queue *txq = &trans_pcie->txq[trans_pcie->cmd_queue];
struct iwl_queue *q = &txq->q;
struct iwl_device_cmd *out_cmd;
struct iwl_cmd_meta *out_meta;
@@ -738,7 +738,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
out_cmd->hdr.cmd = cmd->id;
out_cmd->hdr.flags = 0;
out_cmd->hdr.sequence =
- cpu_to_le16(QUEUE_TO_SEQ(trans->shrd->cmd_queue) |
+ cpu_to_le16(QUEUE_TO_SEQ(trans_pcie->cmd_queue) |
INDEX_TO_SEQ(q->write_ptr));

/* and copy the data that needs to be copied */
@@ -758,7 +758,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
get_cmd_string(out_cmd->hdr.cmd),
out_cmd->hdr.cmd,
le16_to_cpu(out_cmd->hdr.sequence), cmd_size,
- q->write_ptr, idx, trans->shrd->cmd_queue);
+ q->write_ptr, idx, trans_pcie->cmd_queue);

phys_addr = dma_map_single(trans->dev, &out_cmd->hdr, copy_size,
DMA_BIDIRECTIONAL);
@@ -882,16 +882,16 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_cmd_buffer *rxb,
struct iwl_device_cmd *cmd;
struct iwl_cmd_meta *meta;
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
- struct iwl_tx_queue *txq = &trans_pcie->txq[trans->shrd->cmd_queue];
+ struct iwl_tx_queue *txq = &trans_pcie->txq[trans_pcie->cmd_queue];

/* If a Tx command is being handled and it isn't in the actual
* command queue then there a command routing bug has been introduced
* in the queue management code. */
- if (WARN(txq_id != trans->shrd->cmd_queue,
+ if (WARN(txq_id != trans_pcie->cmd_queue,
"wrong command queue %d (should be %d), sequence 0x%X readp=%d writep=%d\n",
- txq_id, trans->shrd->cmd_queue, sequence,
- trans_pcie->txq[trans->shrd->cmd_queue].q.read_ptr,
- trans_pcie->txq[trans->shrd->cmd_queue].q.write_ptr)) {
+ txq_id, trans_pcie->cmd_queue, sequence,
+ trans_pcie->txq[trans_pcie->cmd_queue].q.read_ptr,
+ trans_pcie->txq[trans_pcie->cmd_queue].q.write_ptr)) {
iwl_print_hex_error(trans, pkt, 32);
return;
}
@@ -998,7 +998,7 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
if (!ret) {
if (test_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status)) {
struct iwl_tx_queue *txq =
- &trans_pcie->txq[trans->shrd->cmd_queue];
+ &trans_pcie->txq[trans_pcie->cmd_queue];
struct iwl_queue *q = &txq->q;

IWL_ERR(trans,
@@ -1035,7 +1035,7 @@ cancel:
* in later, it will possibly set an invalid
* address (cmd->meta.source).
*/
- trans_pcie->txq[trans->shrd->cmd_queue].meta[cmd_idx].flags &=
+ trans_pcie->txq[trans_pcie->cmd_queue].meta[cmd_idx].flags &=
~CMD_WANT_SKB;
}

@@ -1066,7 +1066,7 @@ int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
int freed = 0;

/* This function is not meant to release cmd queue*/
- if (WARN_ON(txq_id == trans->shrd->cmd_queue))
+ if (WARN_ON(txq_id == trans_pcie->cmd_queue))
return 0;

lockdep_assert_held(&txq->lock);
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index b0d34f7..f28f4cb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -78,9 +78,9 @@

#define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo))))

-#define SCD_QUEUECHAIN_SEL_ALL(trans) \
+#define SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie) \
(((1<<cfg(trans)->base_params->num_of_queues) - 1) &\
- (~(1<<(trans)->shrd->cmd_queue)))
+ (~(1<<(trans_pcie)->cmd_queue)))


static int iwl_trans_rx_alloc(struct iwl_trans *trans)
@@ -306,6 +306,7 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
{
size_t tfd_sz = sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX;
int i;
+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);

if (WARN_ON(txq->meta || txq->cmd || txq->skbs || txq->tfds))
return -EINVAL;
@@ -318,7 +319,7 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
if (!txq->meta || !txq->cmd)
goto error;

- if (txq_id == trans->shrd->cmd_queue)
+ if (txq_id == trans_pcie->cmd_queue)
for (i = 0; i < slots_num; i++) {
txq->cmd[i] = kmalloc(sizeof(struct iwl_device_cmd),
GFP_KERNEL);
@@ -329,7 +330,7 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
/* 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->shrd->cmd_queue) {
+ if (txq_id != trans_pcie->cmd_queue) {
txq->skbs = kcalloc(TFD_QUEUE_SIZE_MAX, sizeof(txq->skbs[0]),
GFP_KERNEL);
if (!txq->skbs) {
@@ -357,7 +358,7 @@ error:
txq->skbs = NULL;
/* since txq->cmd has been zeroed,
* all non allocated cmd[i] will be NULL */
- if (txq->cmd && txq_id == trans->shrd->cmd_queue)
+ if (txq->cmd && txq_id == trans_pcie->cmd_queue)
for (i = 0; i < slots_num; i++)
kfree(txq->cmd[i]);
kfree(txq->meta);
@@ -423,7 +424,7 @@ static void iwl_tx_queue_unmap(struct iwl_trans *trans, int txq_id)
/* In the command queue, all the TBs are mapped as BIDI
* so unmap them as such.
*/
- if (txq_id == trans->shrd->cmd_queue)
+ if (txq_id == trans_pcie->cmd_queue)
dma_dir = DMA_BIDIRECTIONAL;
else
dma_dir = DMA_TO_DEVICE;
@@ -459,7 +460,7 @@ static void iwl_tx_queue_free(struct iwl_trans *trans, int txq_id)

/* De-alloc array of command/tx buffers */

- if (txq_id == trans->shrd->cmd_queue)
+ if (txq_id == trans_pcie->cmd_queue)
for (i = 0; i < txq->q.n_window; i++)
kfree(txq->cmd[i]);

@@ -557,7 +558,7 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans)
/* 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;
txq_id++) {
- slots_num = (txq_id == trans->shrd->cmd_queue) ?
+ slots_num = (txq_id == trans_pcie->cmd_queue) ?
TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
ret = iwl_trans_txq_alloc(trans, &trans_pcie->txq[txq_id],
slots_num, txq_id);
@@ -603,7 +604,7 @@ static int iwl_tx_init(struct iwl_trans *trans)
/* 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;
txq_id++) {
- slots_num = (txq_id == trans->shrd->cmd_queue) ?
+ slots_num = (txq_id == trans_pcie->cmd_queue) ?
TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
ret = iwl_trans_txq_init(trans, &trans_pcie->txq[txq_id],
slots_num, txq_id);
@@ -1138,7 +1139,7 @@ static void iwl_tx_start(struct iwl_trans *trans)
reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN);

iwl_write_prph(trans, SCD_QUEUECHAIN_SEL,
- SCD_QUEUECHAIN_SEL_ALL(trans));
+ SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie));
iwl_write_prph(trans, SCD_AGGR_SEL, 0);

/* initiate the queues */
@@ -1170,7 +1171,7 @@ static void iwl_tx_start(struct iwl_trans *trans)
else
queue_to_fifo = iwlagn_default_queue_to_tx_fifo;

- iwl_trans_set_wr_ptrs(trans, trans->shrd->cmd_queue, 0);
+ iwl_trans_set_wr_ptrs(trans, trans_pcie->cmd_queue, 0);

/* make sure all queue are not stopped */
memset(&trans_pcie->queue_stopped[0], 0,
@@ -1622,6 +1623,14 @@ static u32 iwl_trans_pcie_read32(struct iwl_trans *trans, u32 ofs)
return readl(IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs);
}

+static void iwl_trans_pcie_configure(struct iwl_trans *trans,
+ const struct iwl_trans_config *trans_cfg)
+{
+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
+
+ trans_pcie->cmd_queue = trans_cfg->cmd_queue;
+}
+
static void iwl_trans_pcie_free(struct iwl_trans *trans)
{
struct iwl_trans_pcie *trans_pcie =
@@ -1682,7 +1691,7 @@ static int iwl_trans_pcie_wait_tx_queue_empty(struct iwl_trans *trans)

/* waiting for all the tx frames complete might take a while */
for (cnt = 0; cnt < cfg(trans)->base_params->num_of_queues; cnt++) {
- if (cnt == trans->shrd->cmd_queue)
+ if (cnt == trans_pcie->cmd_queue)
continue;
txq = &trans_pcie->txq[cnt];
q = &txq->q;
@@ -2213,6 +2222,7 @@ const struct iwl_trans_ops trans_ops_pcie = {
.write8 = iwl_trans_pcie_write8,
.write32 = iwl_trans_pcie_write32,
.read32 = iwl_trans_pcie_read32,
+ .configure = iwl_trans_pcie_configure,
};

struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd,
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index b6fd427..a40c272 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -279,9 +279,12 @@ static inline struct page *rxb_steal_page(struct iwl_rx_cmd_buffer *r)
*
* @op_mode: pointer to the upper layer.
* Must be set before any other call.
+ * @cmd_queue: the index of the command queue.
+ * Must be set before start_fw.
*/
struct iwl_trans_config {
struct iwl_op_mode *op_mode;
+ u8 cmd_queue;
};

/**
@@ -331,6 +334,8 @@ struct iwl_trans_config {
* @write8: write a u8 to a register at offset ofs from the BAR
* @write32: write a u32 to a register at offset ofs from the BAR
* @read32: read a u32 register at offset ofs from the BAR
+ * @configure: configure parameters required by the transport layer from
+ * the op_mode.
*/
struct iwl_trans_ops {

@@ -370,6 +375,8 @@ struct iwl_trans_ops {
void (*write8)(struct iwl_trans *trans, u32 ofs, u8 val);
void (*write32)(struct iwl_trans *trans, u32 ofs, u32 val);
u32 (*read32)(struct iwl_trans *trans, u32 ofs);
+ void (*configure)(struct iwl_trans *trans,
+ const struct iwl_trans_config *trans_cfg);
};

/**
@@ -425,6 +432,8 @@ static inline void iwl_trans_configure(struct iwl_trans *trans,
* more
*/
trans->op_mode = trans_cfg->op_mode;
+
+ trans->ops->configure(trans, trans_cfg);
}

static inline int iwl_trans_start_hw(struct iwl_trans *trans)
--
1.7.0.4


2012-03-08 14:04:07

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH RESEND 34/35] iwlwifi: correct status bit refactoring errors

On Thu, 2012-03-08 at 14:55 +0100, Stanislaw Gruszka wrote:

> > + priv->shrd->status &=
> > + test_bit(STATUS_FW_ERROR, &priv->shrd->status) <<
> > + STATUS_FW_ERROR;
>
> So we have now priv->shrd->status & priv->status, how do you prevent to
> confuse them? Also I still do not understand at all what for this ->shrd stuff
> is needed.

Yeah, hard to not confuse them ... we're removing ->shrd completely, I
have another 25 or so patches and then it'll be gone :-)

johannes


2012-03-07 19:06:32

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 15/35] iwlwifi: always check if got h/w access before write

From: Stanislaw Gruszka <[email protected]>

Before we write to the device registers always check if
iwl_grap_nic_access() was successful.

On the way change return type of grab_nic_access() to bool, and add
likely()/unlikely() statement.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn-tt.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-agn.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-io.c | 53 +++++++++++----------
drivers/net/wireless/iwlwifi/iwl-io.h | 2 +-
drivers/net/wireless/iwlwifi/iwl-mac80211.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 4 +-
6 files changed, 35 insertions(+), 30 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c
index 7712c55..9a12b70 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c
@@ -189,7 +189,7 @@ static void iwl_tt_check_exit_ct_kill(unsigned long data)
}
iwl_read32(trans(priv), CSR_UCODE_DRV_GP1);
spin_lock_irqsave(&trans(priv)->reg_lock, flags);
- if (!iwl_grab_nic_access(trans(priv)))
+ if (likely(iwl_grab_nic_access(trans(priv))))
iwl_release_nic_access(trans(priv));
spin_unlock_irqrestore(&trans(priv)->reg_lock, flags);

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 5f390f8..ce9ebeb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -327,7 +327,7 @@ static void iwl_print_cont_event_trace(struct iwl_priv *priv, u32 base,

/* Make sure device is powered up for SRAM reads */
spin_lock_irqsave(&trans(priv)->reg_lock, reg_flags);
- if (iwl_grab_nic_access(trans(priv))) {
+ if (unlikely(!iwl_grab_nic_access(trans(priv)))) {
spin_unlock_irqrestore(&trans(priv)->reg_lock, reg_flags);
return;
}
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c b/drivers/net/wireless/iwlwifi/iwl-io.c
index fc36535..fa69845 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.c
+++ b/drivers/net/wireless/iwlwifi/iwl-io.c
@@ -118,16 +118,17 @@ int iwl_grab_nic_access_silent(struct iwl_trans *trans)
return 0;
}

-int iwl_grab_nic_access(struct iwl_trans *trans)
+bool iwl_grab_nic_access(struct iwl_trans *trans)
{
int ret = iwl_grab_nic_access_silent(trans);
if (unlikely(ret)) {
u32 val = iwl_read32(trans, CSR_GP_CNTRL);
WARN_ONCE(1, "Timeout waiting for hardware access "
"(CSR_GP_CNTRL 0x%08x)\n", val);
+ return false;
}

- return ret;
+ return true;
}

void iwl_release_nic_access(struct iwl_trans *trans)
@@ -156,7 +157,7 @@ void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value)
unsigned long flags;

spin_lock_irqsave(&trans->reg_lock, flags);
- if (!iwl_grab_nic_access(trans)) {
+ if (likely(iwl_grab_nic_access(trans))) {
iwl_write32(trans, reg, value);
iwl_release_nic_access(trans);
}
@@ -211,7 +212,7 @@ void iwl_write_prph(struct iwl_trans *trans, u32 addr, u32 val)
unsigned long flags;

spin_lock_irqsave(&trans->reg_lock, flags);
- if (!iwl_grab_nic_access(trans)) {
+ if (likely(iwl_grab_nic_access(trans))) {
__iwl_write_prph(trans, addr, val);
iwl_release_nic_access(trans);
}
@@ -223,9 +224,11 @@ void iwl_set_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask)
unsigned long flags;

spin_lock_irqsave(&trans->reg_lock, flags);
- iwl_grab_nic_access(trans);
- __iwl_write_prph(trans, reg, __iwl_read_prph(trans, reg) | mask);
- iwl_release_nic_access(trans);
+ if (likely(iwl_grab_nic_access(trans))) {
+ __iwl_write_prph(trans, reg,
+ __iwl_read_prph(trans, reg) | mask);
+ iwl_release_nic_access(trans);
+ }
spin_unlock_irqrestore(&trans->reg_lock, flags);
}

@@ -235,10 +238,11 @@ void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 reg,
unsigned long flags;

spin_lock_irqsave(&trans->reg_lock, flags);
- iwl_grab_nic_access(trans);
- __iwl_write_prph(trans, reg,
- (__iwl_read_prph(trans, reg) & mask) | bits);
- iwl_release_nic_access(trans);
+ if (likely(iwl_grab_nic_access(trans))) {
+ __iwl_write_prph(trans, reg,
+ (__iwl_read_prph(trans, reg) & mask) | bits);
+ iwl_release_nic_access(trans);
+ }
spin_unlock_irqrestore(&trans->reg_lock, flags);
}

@@ -248,10 +252,11 @@ void iwl_clear_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask)
u32 val;

spin_lock_irqsave(&trans->reg_lock, flags);
- iwl_grab_nic_access(trans);
- val = __iwl_read_prph(trans, reg);
- __iwl_write_prph(trans, reg, (val & ~mask));
- iwl_release_nic_access(trans);
+ if (likely(iwl_grab_nic_access(trans))) {
+ val = __iwl_read_prph(trans, reg);
+ __iwl_write_prph(trans, reg, (val & ~mask));
+ iwl_release_nic_access(trans);
+ }
spin_unlock_irqrestore(&trans->reg_lock, flags);
}

@@ -263,15 +268,13 @@ void _iwl_read_targ_mem_words(struct iwl_trans *trans, u32 addr,
u32 *vals = buf;

spin_lock_irqsave(&trans->reg_lock, flags);
- iwl_grab_nic_access(trans);
-
- iwl_write32(trans, HBUS_TARG_MEM_RADDR, addr);
- rmb();
-
- for (offs = 0; offs < words; offs++)
- vals[offs] = iwl_read32(trans, HBUS_TARG_MEM_RDAT);
-
- iwl_release_nic_access(trans);
+ if (likely(iwl_grab_nic_access(trans))) {
+ iwl_write32(trans, HBUS_TARG_MEM_RADDR, addr);
+ rmb();
+ for (offs = 0; offs < words; offs++)
+ vals[offs] = iwl_read32(trans, HBUS_TARG_MEM_RDAT);
+ iwl_release_nic_access(trans);
+ }
spin_unlock_irqrestore(&trans->reg_lock, flags);
}

@@ -292,7 +295,7 @@ int _iwl_write_targ_mem_words(struct iwl_trans *trans, u32 addr,
u32 *vals = buf;

spin_lock_irqsave(&trans->reg_lock, flags);
- if (!iwl_grab_nic_access(trans)) {
+ if (likely(iwl_grab_nic_access(trans))) {
iwl_write32(trans, HBUS_TARG_MEM_WADDR, addr);
wmb();

diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h
index 1136dc1..09b8567 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.h
+++ b/drivers/net/wireless/iwlwifi/iwl-io.h
@@ -61,7 +61,7 @@ int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask,
int timeout);

int iwl_grab_nic_access_silent(struct iwl_trans *trans);
-int iwl_grab_nic_access(struct iwl_trans *trans);
+bool iwl_grab_nic_access(struct iwl_trans *trans);
void iwl_release_nic_access(struct iwl_trans *trans);

u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg);
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
index bdcbbd0..91a42c3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c
+++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
@@ -445,7 +445,7 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw)
if (iwlagn_hw_valid_rtc_data_addr(base)) {
spin_lock_irqsave(&trans(priv)->reg_lock, flags);
ret = iwl_grab_nic_access_silent(trans(priv));
- if (ret == 0) {
+ if (likely(ret == 0)) {
iwl_write32(trans(priv), HBUS_TARG_MEM_RADDR, base);
status = iwl_read32(trans(priv), HBUS_TARG_MEM_RDAT);
iwl_release_nic_access(trans(priv));
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
index 088354f..25e2f93 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
@@ -745,7 +745,8 @@ static int iwl_print_event_log(struct iwl_trans *trans, u32 start_idx,

/* Make sure device is powered up for SRAM reads */
spin_lock_irqsave(&trans->reg_lock, reg_flags);
- iwl_grab_nic_access(trans);
+ if (unlikely(!iwl_grab_nic_access(trans)))
+ goto out_unlock;

/* Set starting address; reads will auto-increment */
iwl_write32(trans, HBUS_TARG_MEM_RADDR, ptr);
@@ -785,6 +786,7 @@ static int iwl_print_event_log(struct iwl_trans *trans, u32 start_idx,

/* Allow device to power down */
iwl_release_nic_access(trans);
+out_unlock:
spin_unlock_irqrestore(&trans->reg_lock, reg_flags);
return pos;
}
--
1.7.0.4


2012-03-07 19:06:38

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 25/35] iwlwifi: log stop / wake queues

From: Emmanuel Grumbach <[email protected]>

There were a few missing occurences when we get PASSIVE_NO_RX
notification.

Signed-off-by: Emmanuel Grumbach <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn-tx.c | 2 ++
drivers/net/wireless/iwlwifi/iwl-agn.c | 6 +++++-
2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index 1d67e6c..1cd4831 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -1088,6 +1088,8 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
ctx->vif->type == NL80211_IFTYPE_STATION) {
/* block and stop all queues */
priv->passive_no_rx = true;
+ IWL_DEBUG_TX_QUEUES(priv, "stop all queues: "
+ "passive channel");
ieee80211_stop_queues(priv->hw);

IWL_DEBUG_TX_REPLY(priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 7927e3e..6ed2f78 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1450,8 +1450,12 @@ void iwlagn_lift_passive_no_rx(struct iwl_priv *priv)
return;

for (ac = IEEE80211_AC_VO; ac < IEEE80211_NUM_ACS; ac++) {
- if (!test_bit(ac, &priv->transport_queue_stop))
+ if (!test_bit(ac, &priv->transport_queue_stop)) {
+ IWL_DEBUG_TX_QUEUES(priv, "Wake queue %d");
ieee80211_wake_queue(priv->hw, ac);
+ } else {
+ IWL_DEBUG_TX_QUEUES(priv, "Don't wake queue %d");
+ }
}

priv->passive_no_rx = false;
--
1.7.0.4


2012-03-07 19:06:41

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 34/35] iwlwifi: correct status bit refactoring errors

From: Don Fry <[email protected]>

I missed a couple of status bits in my refactoring changes. This
fixes the ones I missed.

Signed-off-by: Don Fry <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn-rx.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-agn.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
index 3ad4333..cc0227c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
@@ -628,7 +628,7 @@ static int iwlagn_rx_card_state_notif(struct iwl_priv *priv,
struct iwl_rx_packet *pkt = rxb_addr(rxb);
struct iwl_card_state_notif *card_state_notif = (void *)pkt->data;
u32 flags = le32_to_cpu(card_state_notif->flags);
- unsigned long status = priv->shrd->status;
+ unsigned long status = priv->status;

IWL_DEBUG_RF_KILL(priv, "Card state received: HW:%s SW:%s CT:%s\n",
(flags & HW_CARD_DISABLED) ? "Kill" : "On",
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 3793dc4..28422c0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -819,15 +819,15 @@ void iwl_down(struct iwl_priv *priv)
iwl_trans_stop_device(trans(priv));

/* Clear out all status bits but a few that are stable across reset */
- priv->shrd->status &=
- test_bit(STATUS_RF_KILL_HW, &priv->status) <<
+ priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) <<
STATUS_RF_KILL_HW |
test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
STATUS_GEO_CONFIGURED |
- test_bit(STATUS_FW_ERROR, &priv->shrd->status) <<
- STATUS_FW_ERROR |
test_bit(STATUS_EXIT_PENDING, &priv->status) <<
STATUS_EXIT_PENDING;
+ priv->shrd->status &=
+ test_bit(STATUS_FW_ERROR, &priv->shrd->status) <<
+ STATUS_FW_ERROR;

dev_kfree_skb(priv->beacon_skb);
priv->beacon_skb = NULL;
--
1.7.0.4


2012-03-07 19:06:35

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 13/35] iwlwifi: return error if loading uCode failed

From: Johannes Berg <[email protected]>

In "iwlwifi: consolidate the start_device flow"
the code flow changed and the firmware is now
loaded by the transport layer, but the change
unfortunately lost error checking -- restore.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index 4844fb2..2a781b5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -1077,9 +1077,7 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans,
iwl_write32(trans, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);

/* Load the given image to the HW */
- iwl_load_given_ucode(trans, fw);
-
- return 0;
+ return iwl_load_given_ucode(trans, fw);
}

/*
--
1.7.0.4


2012-03-07 19:06:33

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 16/35] iwlwifi: cleanup/fix memory barriers

From: Stanislaw Gruszka <[email protected]>

wmb(), rmb() are not needed when writel(), readl() are used as
accessors for MMIO. We use them indirectly via iowrite32(),
ioread32().

What is needed mmiowb(), for synchronizing writes coming from
different CPUs on PCIe bridge (see in patch comments). This
fortunately is not needed on x86, where mmiowb() is just
defined as compiler barrier. As iwlwifi devices are most likely
not used on anything other than x86, this is not so important
fix.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 1 -
drivers/net/wireless/iwlwifi/iwl-io.c | 12 +++++++-----
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 1 -
3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index ce9ebeb..64bc285 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -334,7 +334,6 @@ static void iwl_print_cont_event_trace(struct iwl_priv *priv, u32 base,

/* Set starting address; reads will auto-increment */
iwl_write32(trans(priv), HBUS_TARG_MEM_RADDR, ptr);
- rmb();

/*
* Refuse to read more than would have fit into the log from
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c b/drivers/net/wireless/iwlwifi/iwl-io.c
index fa69845..081dd34 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.c
+++ b/drivers/net/wireless/iwlwifi/iwl-io.c
@@ -136,6 +136,13 @@ void iwl_release_nic_access(struct iwl_trans *trans)
lockdep_assert_held(&trans->reg_lock);
__iwl_clear_bit(trans, CSR_GP_CNTRL,
CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
+ /*
+ * Above we read the CSR_GP_CNTRL register, which will flush
+ * any previous writes, but we need the write that clears the
+ * MAC_ACCESS_REQ bit to be performed before any other writes
+ * scheduled on different CPUs (after we drop reg_lock).
+ */
+ mmiowb();
}

u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg)
@@ -182,7 +189,6 @@ int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask,
static inline u32 __iwl_read_prph(struct iwl_trans *trans, u32 reg)
{
iwl_write32(trans, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
- rmb();
return iwl_read32(trans, HBUS_TARG_PRPH_RDAT);
}

@@ -190,7 +196,6 @@ static inline void __iwl_write_prph(struct iwl_trans *trans, u32 addr, u32 val)
{
iwl_write32(trans, HBUS_TARG_PRPH_WADDR,
((addr & 0x0000FFFF) | (3 << 24)));
- wmb();
iwl_write32(trans, HBUS_TARG_PRPH_WDAT, val);
}

@@ -270,7 +275,6 @@ void _iwl_read_targ_mem_words(struct iwl_trans *trans, u32 addr,
spin_lock_irqsave(&trans->reg_lock, flags);
if (likely(iwl_grab_nic_access(trans))) {
iwl_write32(trans, HBUS_TARG_MEM_RADDR, addr);
- rmb();
for (offs = 0; offs < words; offs++)
vals[offs] = iwl_read32(trans, HBUS_TARG_MEM_RDAT);
iwl_release_nic_access(trans);
@@ -297,8 +301,6 @@ int _iwl_write_targ_mem_words(struct iwl_trans *trans, u32 addr,
spin_lock_irqsave(&trans->reg_lock, flags);
if (likely(iwl_grab_nic_access(trans))) {
iwl_write32(trans, HBUS_TARG_MEM_WADDR, addr);
- wmb();
-
for (offs = 0; offs < words; offs++)
iwl_write32(trans, HBUS_TARG_MEM_WDAT, vals[offs]);
iwl_release_nic_access(trans);
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
index 25e2f93..5b2e47a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
@@ -750,7 +750,6 @@ static int iwl_print_event_log(struct iwl_trans *trans, u32 start_idx,

/* Set starting address; reads will auto-increment */
iwl_write32(trans, HBUS_TARG_MEM_RADDR, ptr);
- rmb();

/* "time" is actually "data" for mode 0 (no timestamp).
* place event id # at far right for easier visual parsing. */
--
1.7.0.4


2012-03-07 19:06:29

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 03/35] iwlwifi: move iwl_sta_id_or_broadcast to user

From: Johannes Berg <[email protected]>

There's only one user, so the function
can be moved into the correct file. It
also loses an argument along the way.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn-tx.c | 31 ++++++++++++++++++++++++++++-
drivers/net/wireless/iwlwifi/iwl-agn.h | 31 -----------------------------
2 files changed, 30 insertions(+), 32 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index e707e99..14a6bde 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -248,6 +248,35 @@ static void iwlagn_tx_cmd_build_hwcrypto(struct iwl_priv *priv,
}
}

+/**
+ * iwl_sta_id_or_broadcast - return sta_id or broadcast sta
+ * @context: the current context
+ * @sta: mac80211 station
+ *
+ * In certain circumstances mac80211 passes a station pointer
+ * that may be %NULL, for example during TX or key setup. In
+ * that case, we need to use the broadcast station, so this
+ * inline wraps that pattern.
+ */
+static int iwl_sta_id_or_broadcast(struct iwl_rxon_context *context,
+ struct ieee80211_sta *sta)
+{
+ int sta_id;
+
+ if (!sta)
+ return context->bcast_sta_id;
+
+ sta_id = iwl_sta_id(sta);
+
+ /*
+ * mac80211 should not be passing a partially
+ * initialised station!
+ */
+ WARN_ON(sta_id == IWL_INVALID_STATION);
+
+ return sta_id;
+}
+
/*
* start REPLY_TX command process
*/
@@ -304,7 +333,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
sta_id = ctx->bcast_sta_id;
else {
/* Find index into station table for destination station */
- sta_id = iwl_sta_id_or_broadcast(priv, ctx, info->control.sta);
+ sta_id = iwl_sta_id_or_broadcast(ctx, info->control.sta);
if (sta_id == IWL_INVALID_STATION) {
IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",
hdr->addr1);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h
index ec3a90c..8384c05 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
@@ -258,37 +258,6 @@ static inline int iwl_sta_id(struct ieee80211_sta *sta)
return ((struct iwl_station_priv *)sta->drv_priv)->sta_id;
}

-/**
- * iwl_sta_id_or_broadcast - return sta_id or broadcast sta
- * @priv: iwl priv
- * @context: the current context
- * @sta: mac80211 station
- *
- * In certain circumstances mac80211 passes a station pointer
- * that may be %NULL, for example during TX or key setup. In
- * that case, we need to use the broadcast station, so this
- * inline wraps that pattern.
- */
-static inline int iwl_sta_id_or_broadcast(struct iwl_priv *priv,
- struct iwl_rxon_context *context,
- struct ieee80211_sta *sta)
-{
- int sta_id;
-
- if (!sta)
- return context->bcast_sta_id;
-
- sta_id = iwl_sta_id(sta);
-
- /*
- * mac80211 should not be passing a partially
- * initialised station!
- */
- WARN_ON(sta_id == IWL_INVALID_STATION);
-
- return sta_id;
-}
-
int iwlagn_alloc_bcast_station(struct iwl_priv *priv,
struct iwl_rxon_context *ctx);
int iwlagn_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
--
1.7.0.4


2012-03-07 19:06:35

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 20/35] iwlwifi: add testmode command for rx forwarding

From: Amit Beka <[email protected]>

Added a testmode command which tells iwl_rx_dispatch
to send the RX both as a notification to nl80211 and
with the registered RX handlers.

This is used for monitoring RX from userspace while preserving
the regular flows in the driver.

Signed-off-by: Amit Beka <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn-rx.c | 20 +++++++++++++---
drivers/net/wireless/iwlwifi/iwl-testmode.c | 32 ++++++++++++++++++++++++--
drivers/net/wireless/iwlwifi/iwl-testmode.h | 13 +++++++++-
3 files changed, 56 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
index e504675..8e7cdfa 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
@@ -1152,6 +1152,8 @@ int iwl_rx_dispatch(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb,
{
struct iwl_rx_packet *pkt = rxb_addr(rxb);
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
+ void (*pre_rx_handler)(struct iwl_priv *,
+ struct iwl_rx_cmd_buffer *);
int err = 0;

/*
@@ -1161,10 +1163,20 @@ int iwl_rx_dispatch(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb,
*/
iwl_notification_wait_notify(&priv->notif_wait, pkt);

- if (priv->pre_rx_handler &&
- priv->ucode_owner == IWL_OWNERSHIP_TM)
- priv->pre_rx_handler(priv, rxb);
- else {
+ /* RX data may be forwarded to userspace (using pre_rx_handler) in one
+ * of two cases: the first, that the user owns the uCode through
+ * testmode - in such case the pre_rx_handler is set and no further
+ * processing takes place. The other case is when the user want to
+ * monitor the rx w/o affecting the regular flow - the pre_rx_handler
+ * will be set but the ownership flag != IWL_OWNERSHIP_TM and the flow
+ * continues.
+ * We need to use ACCESS_ONCE to prevent a case where the handler
+ * changes between the check and the call.
+ */
+ pre_rx_handler = ACCESS_ONCE(priv->pre_rx_handler);
+ if (pre_rx_handler)
+ pre_rx_handler(priv, rxb);
+ if (priv->ucode_owner != IWL_OWNERSHIP_TM) {
/* Based on type of command response or notification,
* handle those that need handling via function in
* rx_handlers table. See iwl_setup_rx_handlers() */
diff --git a/drivers/net/wireless/iwlwifi/iwl-testmode.c b/drivers/net/wireless/iwlwifi/iwl-testmode.c
index 1d73209..b8044bc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-testmode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-testmode.c
@@ -125,6 +125,8 @@ struct nla_policy iwl_testmode_gnl_msg_policy[IWL_TM_ATTR_MAX] = {
[IWL_TM_ATTR_FW_TYPE] = { .type = NLA_U32, },
[IWL_TM_ATTR_FW_INST_SIZE] = { .type = NLA_U32, },
[IWL_TM_ATTR_FW_DATA_SIZE] = { .type = NLA_U32, },
+
+ [IWL_TM_ATTR_ENABLE_NOTIFICATION] = {.type = NLA_FLAG, },
};

/*
@@ -194,7 +196,7 @@ nla_put_failure:

void iwl_testmode_init(struct iwl_priv *priv)
{
- priv->pre_rx_handler = iwl_testmode_ucode_rx_pkt;
+ priv->pre_rx_handler = NULL;
priv->testmode_trace.trace_enabled = false;
priv->testmode_mem.read_in_progress = false;
}
@@ -770,9 +772,13 @@ static int iwl_testmode_ownership(struct ieee80211_hw *hw, struct nlattr **tb)
}

owner = nla_get_u8(tb[IWL_TM_ATTR_UCODE_OWNER]);
- if ((owner == IWL_OWNERSHIP_DRIVER) || (owner == IWL_OWNERSHIP_TM))
+ if (owner == IWL_OWNERSHIP_DRIVER) {
priv->ucode_owner = owner;
- else {
+ priv->pre_rx_handler = NULL;
+ } else if (owner == IWL_OWNERSHIP_TM) {
+ priv->pre_rx_handler = iwl_testmode_ucode_rx_pkt;
+ priv->ucode_owner = owner;
+ } else {
IWL_ERR(priv, "Invalid owner\n");
return -EINVAL;
}
@@ -937,6 +943,20 @@ static int iwl_testmode_buffer_dump(struct ieee80211_hw *hw,
return -ENOBUFS;
}

+static int iwl_testmode_notifications(struct ieee80211_hw *hw,
+ struct nlattr **tb)
+{
+ struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
+ bool enable;
+
+ enable = nla_get_flag(tb[IWL_TM_ATTR_ENABLE_NOTIFICATION]);
+ if (enable)
+ priv->pre_rx_handler = iwl_testmode_ucode_rx_pkt;
+ else
+ priv->pre_rx_handler = NULL;
+ return 0;
+}
+

/* The testmode gnl message handler that takes the gnl message from the
* user space and parses it per the policy iwl_testmode_gnl_msg_policy, then
@@ -1022,6 +1042,12 @@ int iwlagn_mac_testmode_cmd(struct ieee80211_hw *hw, void *data, int len)
result = iwl_testmode_indirect_mem(hw, tb);
break;

+ case IWL_TM_CMD_APP2DEV_NOTIFICATIONS:
+ IWL_DEBUG_INFO(priv, "testmode notifications cmd "
+ "to driver\n");
+ result = iwl_testmode_notifications(hw, tb);
+ break;
+
default:
IWL_ERR(priv, "Unknown testmode command\n");
result = -ENOSYS;
diff --git a/drivers/net/wireless/iwlwifi/iwl-testmode.h b/drivers/net/wireless/iwlwifi/iwl-testmode.h
index 69b2e80..6ba211b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-testmode.h
+++ b/drivers/net/wireless/iwlwifi/iwl-testmode.h
@@ -122,6 +122,9 @@
* Fore reading, a READ command is sent from the userspace and the data
* is returned when the user calls a DUMP command.
* For writing, only a WRITE command is used.
+ * @IWL_TM_CMD_APP2DEV_NOTIFICATIONS:
+ * Command to enable/disable notifications (currently RX packets) from the
+ * driver to userspace.
*/
enum iwl_tm_cmd_t {
IWL_TM_CMD_APP2DEV_UCODE = 1,
@@ -152,7 +155,8 @@ enum iwl_tm_cmd_t {
IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_READ = 26,
IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_DUMP = 27,
IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_WRITE = 28,
- IWL_TM_CMD_MAX = 29,
+ IWL_TM_CMD_APP2DEV_NOTIFICATIONS = 29,
+ IWL_TM_CMD_MAX = 30,
};

/*
@@ -256,6 +260,10 @@ enum iwl_tm_cmd_t {
* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_UCODE this flag
* indicates that the user wants to receive the response of the command
* in a reply SKB. If it's not present, the response is not returned.
+ * @IWL_TM_ATTR_ENABLE_NOTIFICATIONS:
+ * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_NOTIFICATIONS, this
+ * flag enables (if present) or disables (if not) the forwarding
+ * to userspace.
*/
enum iwl_tm_attr_t {
IWL_TM_ATTR_NOT_APPLICABLE = 0,
@@ -282,7 +290,8 @@ enum iwl_tm_attr_t {
IWL_TM_ATTR_FW_INST_SIZE = 21,
IWL_TM_ATTR_FW_DATA_SIZE = 22,
IWL_TM_ATTR_UCODE_CMD_SKB = 23,
- IWL_TM_ATTR_MAX = 24,
+ IWL_TM_ATTR_ENABLE_NOTIFICATION = 24,
+ IWL_TM_ATTR_MAX = 25,
};

/* uCode trace buffer */
--
1.7.0.4


2012-03-07 19:06:43

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 33/35] iwlwifi: restore PAN support

From: Emmanuel Grumbach <[email protected]>

in iwlwifi: move setting up fw parameters

Meenakshi moved code up to configure the transport layer, but this
code read the sku before it was set (from the EEPROM). This killed
P2P.
Only the ucode_flags are needed to configure the transport layer, not
the sku which _must_ be set after the EEPROM is read.

We need to reconfigure the transport in case the EEPROM disabled PAN
support. This is not the nicest thing to do, but we have no choice.
Document that we are allowed to configure the transport several times
before start_fw, but not after.

Signed-off-by: Emmanuel Grumbach <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 59 +++++++++++++++---------------
drivers/net/wireless/iwlwifi/iwl-trans.h | 3 +-
2 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index f150edc..3793dc4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1206,35 +1206,17 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
/* TODO: remove fw from shared data later */
priv->shrd->fw = fw;

- /************************
- * 2. Setup HW constants
- ************************/
- iwl_set_hw_params(priv);
+ /*
+ * Populate the state variables that the transport layer needs
+ * to know about.
+ */
+ trans_cfg.op_mode = op_mode;

ucode_flags = fw->ucode_capa.flags;

#ifndef CONFIG_IWLWIFI_P2P
ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
#endif
- if (!(hw_params(priv).sku & EEPROM_SKU_CAP_IPAN_ENABLE))
- ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
-
- /*
- * if not PAN, then don't support P2P -- might be a uCode
- * packaging bug or due to the eeprom check above
- */
- if (!(ucode_flags & IWL_UCODE_TLV_FLAGS_PAN))
- ucode_flags &= ~IWL_UCODE_TLV_FLAGS_P2P;
-
-
- /*****************************
- * Configure transport layer
- *****************************/
- /*
- * Populate the state variables that the transport layer needs
- * to know about.
- */
- trans_cfg.op_mode = op_mode;

if (ucode_flags & IWL_UCODE_TLV_FLAGS_PAN) {
priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
@@ -1277,7 +1259,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
spin_lock_init(&priv->statistics.lock);

/***********************
- * 3. Read REV register
+ * 2. Read REV register
***********************/
IWL_INFO(priv, "Detected %s, REV=0x%X\n",
cfg(priv)->name, trans(priv)->hw_rev);
@@ -1287,9 +1269,8 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
goto out_free_traffic_mem;

/*****************
- * 4. Read EEPROM
+ * 3. Read EEPROM
*****************/
- /* Read the EEPROM */
err = iwl_eeprom_init(trans(priv), trans(priv)->hw_rev);
/* Reset chip to save power until we load uCode during "up". */
iwl_trans_stop_hw(trans(priv));
@@ -1318,8 +1299,28 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
priv->hw->wiphy->n_addresses++;
}

+ /************************
+ * 4. Setup HW constants
+ ************************/
+ iwl_set_hw_params(priv);
+
+ if (!(hw_params(priv).sku & EEPROM_SKU_CAP_IPAN_ENABLE)) {
+ IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN");
+ ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
+ /*
+ * if not PAN, then don't support P2P -- might be a uCode
+ * packaging bug or due to the eeprom check above
+ */
+ ucode_flags &= ~IWL_UCODE_TLV_FLAGS_P2P;
+ priv->sta_key_max_num = STA_KEY_MAX_NUM;
+ trans_cfg.cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
+
+ /* Configure transport layer again*/
+ iwl_trans_configure(trans(priv), &trans_cfg);
+ }
+
/*******************
- * 6. Setup priv
+ * 5. Setup priv
*******************/

err = iwl_init_drv(priv);
@@ -1328,7 +1329,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
/* At this point both hw and priv are initialized. */

/********************
- * 7. Setup services
+ * 6. Setup services
********************/
iwl_setup_deferred_work(priv);
iwl_setup_rx_handlers(priv);
@@ -1355,7 +1356,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
/**************************************************
* This is still part of probe() in a sense...
*
- * 9. Setup and register with mac80211 and debugfs
+ * 7. Setup and register with mac80211 and debugfs
**************************************************/
err = iwlagn_mac_setup_register(priv, &fw->ucode_capa);
if (err)
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index a40c272..7d1990c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -335,7 +335,8 @@ struct iwl_trans_config {
* @write32: write a u32 to a register at offset ofs from the BAR
* @read32: read a u32 register at offset ofs from the BAR
* @configure: configure parameters required by the transport layer from
- * the op_mode.
+ * the op_mode. May be called several times before start_fw, can't be
+ * called after that.
*/
struct iwl_trans_ops {

--
1.7.0.4


2012-03-07 19:06:40

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 33/35] iwlwifi: don't delete AP station directly

From: Johannes Berg <[email protected]>

With the mac80211 deauth sequence changes, the
station is deleted before the device is set
unassociated. This can cause the device to get
confused as it expects the station to be there
while the associated bit is set.

To fix this, do not delete the AP station from
the device when mac80211 asks for deletion,
instead just mark it as unused and rely on the
unassociated RXON to drop it from the station
database in the device.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn-sta.c | 35 +++++++++++++++++++++++++++
drivers/net/wireless/iwlwifi/iwl-agn.h | 2 +
drivers/net/wireless/iwlwifi/iwl-mac80211.c | 22 ++++++++++++----
3 files changed, 53 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
index 23e9eab..c417560 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
@@ -546,6 +546,41 @@ out_err:
return -EINVAL;
}

+void iwl_deactivate_station(struct iwl_priv *priv, const u8 sta_id,
+ const u8 *addr)
+{
+ u8 tid;
+
+ if (!iwl_is_ready(priv)) {
+ IWL_DEBUG_INFO(priv,
+ "Unable to remove station %pM, device not ready.\n",
+ addr);
+ return;
+ }
+
+ IWL_DEBUG_ASSOC(priv, "Deactivating STA: %pM (%d)\n", addr, sta_id);
+
+ if (WARN_ON_ONCE(sta_id == IWL_INVALID_STATION))
+ return;
+
+ spin_lock_bh(&priv->sta_lock);
+
+ WARN_ON_ONCE(!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE));
+
+ for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++)
+ memset(&priv->tid_data[sta_id][tid], 0,
+ sizeof(priv->tid_data[sta_id][tid]));
+
+ priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE;
+
+ priv->num_stations--;
+
+ if (WARN_ON_ONCE(priv->num_stations < 0))
+ priv->num_stations = 0;
+
+ spin_unlock_bh(&priv->sta_lock);
+}
+
/**
* iwl_clear_ucode_stations - clear ucode station table bits
*
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h
index 5410dfd..3780a03 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
@@ -234,6 +234,8 @@ int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
struct ieee80211_sta *sta, u8 *sta_id_r);
int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id,
const u8 *addr);
+void iwl_deactivate_station(struct iwl_priv *priv, const u8 sta_id,
+ const u8 *addr);
u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
const u8 *addr, bool is_ap, struct ieee80211_sta *sta);

diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
index 54d3709..9212ee3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c
+++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
@@ -724,12 +724,22 @@ static int iwlagn_mac_sta_remove(struct ieee80211_hw *hw,
struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
int ret;

- IWL_DEBUG_INFO(priv, "proceeding to remove station %pM\n",
- sta->addr);
- ret = iwl_remove_station(priv, sta_priv->sta_id, sta->addr);
- if (ret)
- IWL_DEBUG_QUIET_RFKILL(priv, "Error removing station %pM\n",
- sta->addr);
+ IWL_DEBUG_INFO(priv, "proceeding to remove station %pM\n", sta->addr);
+
+ if (vif->type == NL80211_IFTYPE_STATION) {
+ /*
+ * Station will be removed from device when the RXON
+ * is set to unassociated -- just deactivate it here
+ * to avoid re-programming it.
+ */
+ ret = 0;
+ iwl_deactivate_station(priv, sta_priv->sta_id, sta->addr);
+ } else {
+ ret = iwl_remove_station(priv, sta_priv->sta_id, sta->addr);
+ if (ret)
+ IWL_DEBUG_QUIET_RFKILL(priv,
+ "Error removing station %pM\n", sta->addr);
+ }
return ret;
}

--
1.7.0.4


2012-03-07 19:06:31

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 10/35] iwlwifi: move BT/HT params to shared

From: Johannes Berg <[email protected]>

Hardware parameters will be shared, so
move the definitions into the shared
header file.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-core.h | 24 ------------------------
drivers/net/wireless/iwlwifi/iwl-shared.h | 24 ++++++++++++++++++++++++
2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 95f6b7b..635eb68 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -89,30 +89,6 @@ struct iwl_lib_ops {
void (*temperature)(struct iwl_priv *priv);
};

-/*
- * @advanced_bt_coexist: support advanced bt coexist
- * @bt_init_traffic_load: specify initial bt traffic load
- * @bt_prio_boost: default bt priority boost value
- * @agg_time_limit: maximum number of uSec in aggregation
- * @bt_sco_disable: uCode should not response to BT in SCO/ESCO mode
- */
-struct iwl_bt_params {
- bool advanced_bt_coexist;
- u8 bt_init_traffic_load;
- u8 bt_prio_boost;
- u16 agg_time_limit;
- bool bt_sco_disable;
- bool bt_session_2;
-};
-/*
- * @use_rts_for_aggregation: use rts/cts protection for HT traffic
- */
-struct iwl_ht_params {
- const bool ht_greenfield_support; /* if used set to true */
- bool use_rts_for_aggregation;
- enum ieee80211_smps_mode smps_mode;
-};
-
/***************************
* L i b *
***************************/
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h
index 2ab7462..0e24803 100644
--- a/drivers/net/wireless/iwlwifi/iwl-shared.h
+++ b/drivers/net/wireless/iwlwifi/iwl-shared.h
@@ -268,6 +268,30 @@ struct iwl_base_params {
const bool wd_disable;
};

+/*
+ * @advanced_bt_coexist: support advanced bt coexist
+ * @bt_init_traffic_load: specify initial bt traffic load
+ * @bt_prio_boost: default bt priority boost value
+ * @agg_time_limit: maximum number of uSec in aggregation
+ * @bt_sco_disable: uCode should not response to BT in SCO/ESCO mode
+ */
+struct iwl_bt_params {
+ bool advanced_bt_coexist;
+ u8 bt_init_traffic_load;
+ u8 bt_prio_boost;
+ u16 agg_time_limit;
+ bool bt_sco_disable;
+ bool bt_session_2;
+};
+/*
+ * @use_rts_for_aggregation: use rts/cts protection for HT traffic
+ */
+struct iwl_ht_params {
+ const bool ht_greenfield_support; /* if used set to true */
+ bool use_rts_for_aggregation;
+ enum ieee80211_smps_mode smps_mode;
+};
+
/**
* struct iwl_cfg
* @name: Offical name of the device
--
1.7.0.4


2012-03-08 19:32:10

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH RESEND 33/35] iwlwifi: restore PAN support

This one didn't apply either. Please check against wireless-next.

Thanks,

John

On Wed, Mar 07, 2012 at 09:52:41AM -0800, Wey-Yi Guy wrote:
> From: Emmanuel Grumbach <[email protected]>
>
> in iwlwifi: move setting up fw parameters
>
> Meenakshi moved code up to configure the transport layer, but this
> code read the sku before it was set (from the EEPROM). This killed
> P2P.
> Only the ucode_flags are needed to configure the transport layer, not
> the sku which _must_ be set after the EEPROM is read.
>
> We need to reconfigure the transport in case the EEPROM disabled PAN
> support. This is not the nicest thing to do, but we have no choice.
> Document that we are allowed to configure the transport several times
> before start_fw, but not after.
>
> Signed-off-by: Emmanuel Grumbach <[email protected]>
> Signed-off-by: Wey-Yi Guy <[email protected]>
> ---
> drivers/net/wireless/iwlwifi/iwl-agn.c | 59 +++++++++++++++---------------
> drivers/net/wireless/iwlwifi/iwl-trans.h | 3 +-
> 2 files changed, 32 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
> index f150edc..3793dc4 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-agn.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
> @@ -1206,35 +1206,17 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
> /* TODO: remove fw from shared data later */
> priv->shrd->fw = fw;
>
> - /************************
> - * 2. Setup HW constants
> - ************************/
> - iwl_set_hw_params(priv);
> + /*
> + * Populate the state variables that the transport layer needs
> + * to know about.
> + */
> + trans_cfg.op_mode = op_mode;
>
> ucode_flags = fw->ucode_capa.flags;
>
> #ifndef CONFIG_IWLWIFI_P2P
> ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
> #endif
> - if (!(hw_params(priv).sku & EEPROM_SKU_CAP_IPAN_ENABLE))
> - ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
> -
> - /*
> - * if not PAN, then don't support P2P -- might be a uCode
> - * packaging bug or due to the eeprom check above
> - */
> - if (!(ucode_flags & IWL_UCODE_TLV_FLAGS_PAN))
> - ucode_flags &= ~IWL_UCODE_TLV_FLAGS_P2P;
> -
> -
> - /*****************************
> - * Configure transport layer
> - *****************************/
> - /*
> - * Populate the state variables that the transport layer needs
> - * to know about.
> - */
> - trans_cfg.op_mode = op_mode;
>
> if (ucode_flags & IWL_UCODE_TLV_FLAGS_PAN) {
> priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
> @@ -1277,7 +1259,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
> spin_lock_init(&priv->statistics.lock);
>
> /***********************
> - * 3. Read REV register
> + * 2. Read REV register
> ***********************/
> IWL_INFO(priv, "Detected %s, REV=0x%X\n",
> cfg(priv)->name, trans(priv)->hw_rev);
> @@ -1287,9 +1269,8 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
> goto out_free_traffic_mem;
>
> /*****************
> - * 4. Read EEPROM
> + * 3. Read EEPROM
> *****************/
> - /* Read the EEPROM */
> err = iwl_eeprom_init(trans(priv), trans(priv)->hw_rev);
> /* Reset chip to save power until we load uCode during "up". */
> iwl_trans_stop_hw(trans(priv));
> @@ -1318,8 +1299,28 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
> priv->hw->wiphy->n_addresses++;
> }
>
> + /************************
> + * 4. Setup HW constants
> + ************************/
> + iwl_set_hw_params(priv);
> +
> + if (!(hw_params(priv).sku & EEPROM_SKU_CAP_IPAN_ENABLE)) {
> + IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN");
> + ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
> + /*
> + * if not PAN, then don't support P2P -- might be a uCode
> + * packaging bug or due to the eeprom check above
> + */
> + ucode_flags &= ~IWL_UCODE_TLV_FLAGS_P2P;
> + priv->sta_key_max_num = STA_KEY_MAX_NUM;
> + trans_cfg.cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
> +
> + /* Configure transport layer again*/
> + iwl_trans_configure(trans(priv), &trans_cfg);
> + }
> +
> /*******************
> - * 6. Setup priv
> + * 5. Setup priv
> *******************/
>
> err = iwl_init_drv(priv);
> @@ -1328,7 +1329,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
> /* At this point both hw and priv are initialized. */
>
> /********************
> - * 7. Setup services
> + * 6. Setup services
> ********************/
> iwl_setup_deferred_work(priv);
> iwl_setup_rx_handlers(priv);
> @@ -1355,7 +1356,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
> /**************************************************
> * This is still part of probe() in a sense...
> *
> - * 9. Setup and register with mac80211 and debugfs
> + * 7. Setup and register with mac80211 and debugfs
> **************************************************/
> err = iwlagn_mac_setup_register(priv, &fw->ucode_capa);
> if (err)
> diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
> index a40c272..7d1990c 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-trans.h
> +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
> @@ -335,7 +335,8 @@ struct iwl_trans_config {
> * @write32: write a u32 to a register at offset ofs from the BAR
> * @read32: read a u32 register at offset ofs from the BAR
> * @configure: configure parameters required by the transport layer from
> - * the op_mode.
> + * the op_mode. May be called several times before start_fw, can't be
> + * called after that.
> */
> struct iwl_trans_ops {
>
> --
> 1.7.0.4
>
>

--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.

2012-03-07 19:06:28

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 02/35] iwlwifi: remove unused argument from rs_initialize_lq

From: Johannes Berg <[email protected]>

The function never uses its conf argument,
so remove it.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 9895b80..53f8c51 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -2677,7 +2677,6 @@ out:
* which requires station table entry to exist).
*/
static void rs_initialize_lq(struct iwl_priv *priv,
- struct ieee80211_conf *conf,
struct ieee80211_sta *sta,
struct iwl_lq_sta *lq_sta)
{
@@ -2912,7 +2911,7 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i
lq_sta->dbg_fixed_rate = 0;
#endif

- rs_initialize_lq(priv, conf, sta, lq_sta);
+ rs_initialize_lq(priv, sta, lq_sta);
}

static void rs_fill_link_cmd(struct iwl_priv *priv,
--
1.7.0.4


2012-03-07 19:06:39

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 27/35] iwlwifi: move setting up fw parameters

From: Meenakshi Venkataraman <[email protected]>

Gather parameters required to configure the
transport layer before invoking the transport
configuration API.

Change-Id: I5b39da284af6d9b5432a08911b4e1173a4d7207d
Signed-off-by: Meenakshi Venkataraman <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 45 +++++++++++++++++---------------
1 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 83018ec..3973424 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1206,6 +1206,30 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
/* TODO: remove fw from shared data later */
priv->shrd->fw = fw;

+ /************************
+ * 2. Setup HW constants
+ ************************/
+ iwl_set_hw_params(priv);
+
+ ucode_flags = fw->ucode_capa.flags;
+
+#ifndef CONFIG_IWLWIFI_P2P
+ ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
+#endif
+ if (!(hw_params(priv).sku & EEPROM_SKU_CAP_IPAN_ENABLE))
+ ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
+
+ /*
+ * if not PAN, then don't support P2P -- might be a uCode
+ * packaging bug or due to the eeprom check above
+ */
+ if (!(ucode_flags & IWL_UCODE_TLV_FLAGS_PAN))
+ ucode_flags &= ~IWL_UCODE_TLV_FLAGS_P2P;
+
+
+ /*****************************
+ * Configure transport layer
+ *****************************/
/*
* Populate the state variables that the transport layer needs
* to know about.
@@ -1286,27 +1310,6 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
priv->hw->wiphy->n_addresses++;
}

- /************************
- * 5. Setup HW constants
- ************************/
- iwl_set_hw_params(priv);
-
- ucode_flags = fw->ucode_capa.flags;
-
-#ifndef CONFIG_IWLWIFI_P2P
- ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
-#endif
- if (!(hw_params(priv).sku & EEPROM_SKU_CAP_IPAN_ENABLE))
- ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
-
- /*
- * if not PAN, then don't support P2P -- might be a uCode
- * packaging bug or due to the eeprom check above
- */
- if (!(ucode_flags & IWL_UCODE_TLV_FLAGS_PAN))
- ucode_flags &= ~IWL_UCODE_TLV_FLAGS_P2P;
-
-
/*******************
* 6. Setup priv
*******************/
--
1.7.0.4


2012-03-07 19:06:41

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 35/35] iwlwifi: always monitor for stuck queues

From: Johannes Berg <[email protected]>

If we only monitor while associated, the following
can happen:
- we're associated, and the queue stuck check
runs, setting the queue "touch" time to X
- we disassociate, stopping the monitoring,
which leaves the time set to X
- almost 2s later, we associate, and enqueue
a frame
- before the frame is transmitted, we monitor
for stuck queues, and find the time set to
X, although it is now later than X + 2000ms,
so we decide that the queue is stuck and
erroneously restart the device

It happens more with P2P because there we can
go between associated/unassociated frequently.

Cc: [email protected]
Reported-by: Ben Cahill <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-core.c | 19 ++++---------------
1 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index b94e23c..8b85940 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1343,21 +1343,10 @@ void iwl_bg_watchdog(unsigned long data)
if (timeout == 0)
return;

- /* monitor and check for stuck cmd queue */
- if (iwl_check_stuck_queue(priv, priv->shrd->cmd_queue))
- return;
-
- /* monitor and check for other stuck queues */
- if (iwl_is_any_associated(priv)) {
- for (cnt = 0; cnt < cfg(priv)->base_params->num_of_queues;
- cnt++) {
- /* skip as we already checked the command queue */
- if (cnt == priv->shrd->cmd_queue)
- continue;
- if (iwl_check_stuck_queue(priv, cnt))
- return;
- }
- }
+ /* monitor and check for stuck queues */
+ for (cnt = 0; cnt < cfg(priv)->base_params->num_of_queues; cnt++)
+ if (iwl_check_stuck_queue(priv, cnt))
+ return;

mod_timer(&priv->watchdog, jiffies +
msecs_to_jiffies(IWL_WD_TICK(timeout)));
--
1.7.0.4


2012-03-08 13:55:41

by Stanislaw Gruszka

[permalink] [raw]
Subject: Re: [PATCH RESEND 34/35] iwlwifi: correct status bit refactoring errors

On Wed, Mar 07, 2012 at 09:52:43AM -0800, Wey-Yi Guy wrote:
> From: Don Fry <[email protected]>
>
> I missed a couple of status bits in my refactoring changes. This
> fixes the ones I missed.
>
> Signed-off-by: Don Fry <[email protected]>
> Signed-off-by: Wey-Yi Guy <[email protected]>
> ---
> drivers/net/wireless/iwlwifi/iwl-agn-rx.c | 2 +-
> drivers/net/wireless/iwlwifi/iwl-agn.c | 8 ++++----
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
> index 3ad4333..cc0227c 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
> @@ -628,7 +628,7 @@ static int iwlagn_rx_card_state_notif(struct iwl_priv *priv,
> struct iwl_rx_packet *pkt = rxb_addr(rxb);
> struct iwl_card_state_notif *card_state_notif = (void *)pkt->data;
> u32 flags = le32_to_cpu(card_state_notif->flags);
> - unsigned long status = priv->shrd->status;
> + unsigned long status = priv->status;
>
> IWL_DEBUG_RF_KILL(priv, "Card state received: HW:%s SW:%s CT:%s\n",
> (flags & HW_CARD_DISABLED) ? "Kill" : "On",
> diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
> index 3793dc4..28422c0 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-agn.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
> @@ -819,15 +819,15 @@ void iwl_down(struct iwl_priv *priv)
> iwl_trans_stop_device(trans(priv));
>
> /* Clear out all status bits but a few that are stable across reset */
> - priv->shrd->status &=
> - test_bit(STATUS_RF_KILL_HW, &priv->status) <<
> + priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) <<
> STATUS_RF_KILL_HW |
> test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
> STATUS_GEO_CONFIGURED |
> - test_bit(STATUS_FW_ERROR, &priv->shrd->status) <<
> - STATUS_FW_ERROR |
> test_bit(STATUS_EXIT_PENDING, &priv->status) <<
> STATUS_EXIT_PENDING;
> + priv->shrd->status &=
> + test_bit(STATUS_FW_ERROR, &priv->shrd->status) <<
> + STATUS_FW_ERROR;

So we have now priv->shrd->status & priv->status, how do you prevent to
confuse them? Also I still do not understand at all what for this ->shrd stuff
is needed.

Stanislaw

2012-03-07 19:06:40

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 28/35] iwlwifi: more status bit factoring

From: Don Fry <[email protected]>

Continue splitting the status bits between transport and op_mode.
All but a few are separated.

Signed-off-by: Don Fry <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 8 ++--
drivers/net/wireless/iwlwifi/iwl-agn-rx.c | 18 ++++----
drivers/net/wireless/iwlwifi/iwl-agn-rxon.c | 14 +++---
drivers/net/wireless/iwlwifi/iwl-agn-sta.c | 6 +-
drivers/net/wireless/iwlwifi/iwl-agn-tt.c | 20 ++++----
drivers/net/wireless/iwlwifi/iwl-agn-tx.c | 4 +-
drivers/net/wireless/iwlwifi/iwl-agn.c | 40 ++++++++--------
drivers/net/wireless/iwlwifi/iwl-agn.h | 31 +++++-------
drivers/net/wireless/iwlwifi/iwl-core.c | 31 ++++++-------
drivers/net/wireless/iwlwifi/iwl-debugfs.c | 38 +++++++--------
drivers/net/wireless/iwlwifi/iwl-led.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-mac80211.c | 34 +++++++-------
drivers/net/wireless/iwlwifi/iwl-power.c | 4 +-
drivers/net/wireless/iwlwifi/iwl-scan.c | 50 ++++++++++----------
drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h | 8 ++--
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 10 ++--
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 8 ++-
17 files changed, 160 insertions(+), 166 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index 3fed4bb..915183a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -51,7 +51,7 @@ int iwlagn_send_tx_power(struct iwl_priv *priv)
struct iwlagn_tx_power_dbm_cmd tx_power_cmd;
u8 tx_ant_cfg_cmd;

- if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->shrd->status),
+ if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->status),
"TX Power requested while scanning!\n"))
return -EAGAIN;

@@ -575,7 +575,7 @@ static void iwlagn_bt_traffic_change_work(struct work_struct *work)
* STATUS_SCANNING to avoid race when queue_work two times from
* different notifications, but quit and not perform any work at all.
*/
- if (test_bit(STATUS_SCAN_HW, &priv->shrd->status))
+ if (test_bit(STATUS_SCAN_HW, &priv->status))
goto out;

iwl_update_chain_flags(priv);
@@ -1291,9 +1291,9 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan)

int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
{
- if (iwl_is_rfkill(priv->shrd) || iwl_is_ctkill(priv)) {
+ if (iwl_is_rfkill(priv) || iwl_is_ctkill(priv)) {
IWL_WARN(priv, "Not sending command - %s KILL\n",
- iwl_is_rfkill(priv->shrd) ? "RF" : "CT");
+ iwl_is_rfkill(priv) ? "RF" : "CT");
return -EIO;
}

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
index 8e7cdfa..3ad4333 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
@@ -159,7 +159,7 @@ static int iwlagn_rx_csa(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
struct iwl_rxon_cmd *rxon = (void *)&ctx->active;

- if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status))
+ if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
return 0;

if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) {
@@ -355,7 +355,7 @@ static void iwlagn_recover_from_statistics(struct iwl_priv *priv,
{
unsigned int msecs;

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

msecs = jiffies_to_msecs(stamp - priv->rx_statistics_jiffies);
@@ -575,7 +575,7 @@ static int iwlagn_rx_statistics(struct iwl_priv *priv,

priv->rx_statistics_jiffies = stamp;

- set_bit(STATUS_STATISTICS, &priv->shrd->status);
+ set_bit(STATUS_STATISTICS, &priv->status);

/* Reschedule the statistics timer to occur in
* reg_recalib_period seconds to ensure we get a
@@ -584,7 +584,7 @@ static int iwlagn_rx_statistics(struct iwl_priv *priv,
mod_timer(&priv->statistics_periodic, jiffies +
msecs_to_jiffies(reg_recalib_period * 1000));

- if (unlikely(!test_bit(STATUS_SCANNING, &priv->shrd->status)) &&
+ if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) &&
(pkt->hdr.cmd == STATISTICS_NOTIFICATION)) {
iwlagn_rx_calc_noise(priv);
queue_work(priv->workqueue, &priv->run_time_calib_work);
@@ -658,18 +658,18 @@ static int iwlagn_rx_card_state_notif(struct iwl_priv *priv,
iwl_tt_exit_ct_kill(priv);

if (flags & HW_CARD_DISABLED)
- set_bit(STATUS_RF_KILL_HW, &priv->shrd->status);
+ set_bit(STATUS_RF_KILL_HW, &priv->status);
else
- clear_bit(STATUS_RF_KILL_HW, &priv->shrd->status);
+ clear_bit(STATUS_RF_KILL_HW, &priv->status);


if (!(flags & RXON_CARD_DISABLED))
iwl_scan_cancel(priv);

if ((test_bit(STATUS_RF_KILL_HW, &status) !=
- test_bit(STATUS_RF_KILL_HW, &priv->shrd->status)))
+ test_bit(STATUS_RF_KILL_HW, &priv->status)))
wiphy_rfkill_set_hw_state(priv->hw->wiphy,
- test_bit(STATUS_RF_KILL_HW, &priv->shrd->status));
+ test_bit(STATUS_RF_KILL_HW, &priv->status));
else
wake_up(&priv->shrd->wait_command_queue);
return 0;
@@ -691,7 +691,7 @@ static int iwlagn_rx_missed_beacon_notif(struct iwl_priv *priv,
le32_to_cpu(missed_beacon->total_missed_becons),
le32_to_cpu(missed_beacon->num_recvd_beacons),
le32_to_cpu(missed_beacon->num_expected_beacons));
- if (!test_bit(STATUS_SCANNING, &priv->shrd->status))
+ if (!test_bit(STATUS_SCANNING, &priv->status))
iwl_init_sensitivity(priv);
}
return 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
index 66e9a71..3690907 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
@@ -361,7 +361,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv)
slot0 = bcnint / 2;
slot1 = bcnint - slot0;

- if (test_bit(STATUS_SCAN_HW, &priv->shrd->status) ||
+ if (test_bit(STATUS_SCAN_HW, &priv->status) ||
(!ctx_bss->vif->bss_conf.idle &&
!ctx_bss->vif->bss_conf.assoc)) {
slot0 = dtim * bcnint * 3 - IWL_MIN_SLOT_TIME;
@@ -377,7 +377,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv)
ctx_pan->beacon_int;
slot1 = max_t(int, DEFAULT_BEACON_INTERVAL, slot1);

- if (test_bit(STATUS_SCAN_HW, &priv->shrd->status)) {
+ if (test_bit(STATUS_SCAN_HW, &priv->status)) {
slot0 = slot1 * 3 - IWL_MIN_SLOT_TIME;
slot1 = IWL_MIN_SLOT_TIME;
}
@@ -421,7 +421,7 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)

lockdep_assert_held(&priv->mutex);

- if (!iwl_is_alive(priv->shrd))
+ if (!iwl_is_alive(priv))
return -EBUSY;

/* This function hardcodes a bunch of dual-mode assumptions */
@@ -457,7 +457,7 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
* receive commit_rxon request
* abort any previous channel switch if still in process
*/
- if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status) &&
+ if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) &&
(priv->switch_channel != ctx->staging.channel)) {
IWL_DEBUG_11H(priv, "abort channel switch on %d\n",
le16_to_cpu(priv->switch_channel));
@@ -551,12 +551,12 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)

mutex_lock(&priv->mutex);

- if (unlikely(test_bit(STATUS_SCANNING, &priv->shrd->status))) {
+ if (unlikely(test_bit(STATUS_SCANNING, &priv->status))) {
IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
goto out;
}

- if (!iwl_is_ready(priv->shrd)) {
+ if (!iwl_is_ready(priv)) {
IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
goto out;
}
@@ -794,7 +794,7 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,

mutex_lock(&priv->mutex);

- if (unlikely(!iwl_is_ready(priv->shrd))) {
+ if (unlikely(!iwl_is_ready(priv))) {
IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
mutex_unlock(&priv->mutex);
return;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
index cf5cc10..23e9eab 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
@@ -490,7 +490,7 @@ int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id,
{
u8 tid;

- if (!iwl_is_ready(priv->shrd)) {
+ if (!iwl_is_ready(priv)) {
IWL_DEBUG_INFO(priv,
"Unable to remove station %pM, device not ready.\n",
addr);
@@ -598,7 +598,7 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
int ret;
bool send_lq;

- if (!iwl_is_ready(priv->shrd)) {
+ if (!iwl_is_ready(priv)) {
IWL_DEBUG_INFO(priv,
"Not ready yet, not restoring any stations.\n");
return;
@@ -997,7 +997,7 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv,
keyconf->keyidx);

memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0]));
- if (iwl_is_rfkill(priv->shrd)) {
+ if (iwl_is_rfkill(priv)) {
IWL_DEBUG_WEP(priv,
"Not sending REPLY_WEPKEY command due to RFKILL.\n");
/* but keys in device are clear anyway so return success */
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c
index fa94153..baaf5ba 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c
@@ -174,7 +174,7 @@ static void iwl_tt_check_exit_ct_kill(unsigned long data)
struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
unsigned long flags;

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

if (tt->state == IWL_TI_CT_KILL) {
@@ -225,7 +225,7 @@ static void iwl_tt_ready_for_ct_kill(unsigned long data)
struct iwl_priv *priv = (struct iwl_priv *)data;
struct iwl_tt_mgmt *tt = &priv->thermal_throttle;

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

/* temperature timer expired, ready to go into CT_KILL state */
@@ -504,10 +504,10 @@ static void iwl_bg_ct_enter(struct work_struct *work)
struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_enter);
struct iwl_tt_mgmt *tt = &priv->thermal_throttle;

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

- if (!iwl_is_ready(priv->shrd))
+ if (!iwl_is_ready(priv))
return;

if (tt->state != IWL_TI_CT_KILL) {
@@ -533,10 +533,10 @@ static void iwl_bg_ct_exit(struct work_struct *work)
struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_exit);
struct iwl_tt_mgmt *tt = &priv->thermal_throttle;

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

- if (!iwl_is_ready(priv->shrd))
+ if (!iwl_is_ready(priv))
return;

/* stop ct_kill_exit_tm timer */
@@ -563,7 +563,7 @@ static void iwl_bg_ct_exit(struct work_struct *work)

void iwl_tt_enter_ct_kill(struct iwl_priv *priv)
{
- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

IWL_DEBUG_TEMP(priv, "Queueing critical temperature enter.\n");
@@ -572,7 +572,7 @@ void iwl_tt_enter_ct_kill(struct iwl_priv *priv)

void iwl_tt_exit_ct_kill(struct iwl_priv *priv)
{
- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

IWL_DEBUG_TEMP(priv, "Queueing critical temperature exit.\n");
@@ -584,7 +584,7 @@ static void iwl_bg_tt_work(struct work_struct *work)
struct iwl_priv *priv = container_of(work, struct iwl_priv, tt_work);
s32 temp = priv->temperature; /* degrees CELSIUS except specified */

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

if (!priv->thermal_throttle.advanced_tt)
@@ -595,7 +595,7 @@ static void iwl_bg_tt_work(struct work_struct *work)

void iwl_tt_handler(struct iwl_priv *priv)
{
- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

IWL_DEBUG_TEMP(priv, "Queueing thermal throttling work.\n");
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index 1cd4831..34adedc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -297,7 +297,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
if (info->control.vif)
ctx = iwl_rxon_ctx_from_vif(info->control.vif);

- if (iwl_is_rfkill(priv->shrd)) {
+ if (iwl_is_rfkill(priv)) {
IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n");
goto drop_unlock_priv;
}
@@ -1000,7 +1000,7 @@ static void iwl_check_abort_status(struct iwl_priv *priv,
{
if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) {
IWL_ERR(priv, "Tx flush command to flush out all frames\n");
- if (!test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
queue_work(priv->workqueue, &priv->tx_flush);
}
}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 3973424..d45def3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -244,11 +244,11 @@ static void iwl_bg_bt_runtime_config(struct work_struct *work)
struct iwl_priv *priv =
container_of(work, struct iwl_priv, bt_runtime_config);

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

/* dont send host command if rf-kill is on */
- if (!iwl_is_ready_rf(priv->shrd))
+ if (!iwl_is_ready_rf(priv))
return;
iwlagn_send_advance_bt_config(priv);
}
@@ -261,11 +261,11 @@ static void iwl_bg_bt_full_concurrency(struct work_struct *work)

mutex_lock(&priv->mutex);

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
goto out;

/* dont send host command if rf-kill is on */
- if (!iwl_is_ready_rf(priv->shrd))
+ if (!iwl_is_ready_rf(priv))
goto out;

IWL_DEBUG_INFO(priv, "BT coex in %s mode\n",
@@ -300,11 +300,11 @@ static void iwl_bg_statistics_periodic(unsigned long data)
{
struct iwl_priv *priv = (struct iwl_priv *)data;

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

/* dont send host command if rf-kill is on */
- if (!iwl_is_ready_rf(priv->shrd))
+ if (!iwl_is_ready_rf(priv))
return;

iwl_send_statistics_request(priv, CMD_ASYNC, false);
@@ -461,7 +461,7 @@ static void iwl_bg_ucode_trace(unsigned long data)
{
struct iwl_priv *priv = (struct iwl_priv *)data;

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

if (priv->event_log.ucode_trace) {
@@ -477,11 +477,11 @@ static void iwl_bg_tx_flush(struct work_struct *work)
struct iwl_priv *priv =
container_of(work, struct iwl_priv, tx_flush);

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

/* do nothing if rf-kill is on */
- if (!iwl_is_ready_rf(priv->shrd))
+ if (!iwl_is_ready_rf(priv))
return;

IWL_DEBUG_INFO(priv, "device request: flush all tx frames\n");
@@ -640,12 +640,12 @@ int iwl_alive_start(struct iwl_priv *priv)
IWL_DEBUG_INFO(priv, "Runtime Alive received.\n");

/* After the ALIVE response, we can send host commands to the uCode */
- set_bit(STATUS_ALIVE, &priv->shrd->status);
+ set_bit(STATUS_ALIVE, &priv->status);

/* Enable watchdog to monitor the driver tx queues */
iwl_setup_watchdog(priv);

- if (iwl_is_rfkill(priv->shrd))
+ if (iwl_is_rfkill(priv))
return -ERFKILL;

if (priv->event_log.ucode_trace) {
@@ -719,7 +719,7 @@ int iwl_alive_start(struct iwl_priv *priv)
iwl_reset_run_time_calib(priv);
}

- set_bit(STATUS_READY, &priv->shrd->status);
+ set_bit(STATUS_READY, &priv->status);

/* Configure the adapter for unassociated operation */
ret = iwlagn_commit_rxon(priv, ctx);
@@ -786,7 +786,7 @@ void iwl_down(struct iwl_priv *priv)
ieee80211_remain_on_channel_expired(priv->hw);

exit_pending =
- test_and_set_bit(STATUS_EXIT_PENDING, &priv->shrd->status);
+ test_and_set_bit(STATUS_EXIT_PENDING, &priv->status);

/* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set
* to prevent rearm timer */
@@ -811,7 +811,7 @@ void iwl_down(struct iwl_priv *priv)
/* Wipe out the EXIT_PENDING status bit if we are not actually
* exiting the module */
if (!exit_pending)
- clear_bit(STATUS_EXIT_PENDING, &priv->shrd->status);
+ clear_bit(STATUS_EXIT_PENDING, &priv->status);

if (priv->mac80211_registered)
ieee80211_stop_queues(priv->hw);
@@ -820,13 +820,13 @@ void iwl_down(struct iwl_priv *priv)

/* Clear out all status bits but a few that are stable across reset */
priv->shrd->status &=
- test_bit(STATUS_RF_KILL_HW, &priv->shrd->status) <<
+ test_bit(STATUS_RF_KILL_HW, &priv->status) <<
STATUS_RF_KILL_HW |
- test_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status) <<
+ test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
STATUS_GEO_CONFIGURED |
test_bit(STATUS_FW_ERROR, &priv->shrd->status) <<
STATUS_FW_ERROR |
- test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) <<
+ test_bit(STATUS_EXIT_PENDING, &priv->status) <<
STATUS_EXIT_PENDING;

dev_kfree_skb(priv->beacon_skb);
@@ -846,8 +846,8 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work)

mutex_lock(&priv->mutex);

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) ||
- test_bit(STATUS_SCANNING, &priv->shrd->status)) {
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
+ test_bit(STATUS_SCANNING, &priv->status)) {
mutex_unlock(&priv->mutex);
return;
}
@@ -903,7 +903,7 @@ static void iwl_bg_restart(struct work_struct *data)
{
struct iwl_priv *priv = container_of(data, struct iwl_priv, restart);

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

if (test_and_clear_bit(STATUS_FW_ERROR, &priv->shrd->status)) {
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h
index ede1852..eb96855 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
@@ -353,28 +353,23 @@ static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv,

/* status checks */

-static inline int iwl_is_ready(struct iwl_shared *shrd)
+static inline int iwl_is_ready(struct iwl_priv *priv)
{
/* The adapter is 'ready' if READY and GEO_CONFIGURED bits are
* set but EXIT_PENDING is not */
- return test_bit(STATUS_READY, &shrd->status) &&
- test_bit(STATUS_GEO_CONFIGURED, &shrd->status) &&
- !test_bit(STATUS_EXIT_PENDING, &shrd->status);
+ return test_bit(STATUS_READY, &priv->status) &&
+ test_bit(STATUS_GEO_CONFIGURED, &priv->status) &&
+ !test_bit(STATUS_EXIT_PENDING, &priv->status);
}

-static inline int iwl_is_alive(struct iwl_shared *shrd)
+static inline int iwl_is_alive(struct iwl_priv *priv)
{
- return test_bit(STATUS_ALIVE, &shrd->status);
+ return test_bit(STATUS_ALIVE, &priv->status);
}

-static inline int iwl_is_rfkill_hw(struct iwl_shared *shrd)
+static inline int iwl_is_rfkill(struct iwl_priv *priv)
{
- return test_bit(STATUS_RF_KILL_HW, &shrd->status);
-}
-
-static inline int iwl_is_rfkill(struct iwl_shared *shrd)
-{
- return iwl_is_rfkill_hw(shrd);
+ return test_bit(STATUS_RF_KILL_HW, &priv->status);
}

static inline int iwl_is_ctkill(struct iwl_priv *priv)
@@ -382,18 +377,18 @@ static inline int iwl_is_ctkill(struct iwl_priv *priv)
return test_bit(STATUS_CT_KILL, &priv->status);
}

-static inline int iwl_is_ready_rf(struct iwl_shared *shrd)
+static inline int iwl_is_ready_rf(struct iwl_priv *priv)
{
- if (iwl_is_rfkill(shrd))
+ if (iwl_is_rfkill(priv))
return 0;

- return iwl_is_ready(shrd);
+ return iwl_is_ready(priv);
}

#ifdef CONFIG_IWLWIFI_DEBUG
#define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \
do { \
- if (!iwl_is_rfkill((m)->shrd)) \
+ if (!iwl_is_rfkill((m))) \
IWL_ERR(m, fmt, ##args); \
else \
__iwl_err(trans(m)->dev, true, \
@@ -403,7 +398,7 @@ do { \
#else
#define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \
do { \
- if (!iwl_is_rfkill((m)->shrd)) \
+ if (!iwl_is_rfkill((m))) \
IWL_ERR(m, fmt, ##args); \
else \
__iwl_err(trans(m)->dev, true, true, fmt, ##args); \
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 6de2949..b94e23c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -113,7 +113,7 @@ int iwl_init_geos(struct iwl_priv *priv)
if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates ||
priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) {
IWL_DEBUG_INFO(priv, "Geography modes already initialized.\n");
- set_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status);
+ set_bit(STATUS_GEO_CONFIGURED, &priv->status);
return 0;
}

@@ -212,7 +212,7 @@ int iwl_init_geos(struct iwl_priv *priv)
priv->bands[IEEE80211_BAND_2GHZ].n_channels,
priv->bands[IEEE80211_BAND_5GHZ].n_channels);

- set_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status);
+ set_bit(STATUS_GEO_CONFIGURED, &priv->status);

return 0;
}
@@ -224,7 +224,7 @@ void iwl_free_geos(struct iwl_priv *priv)
{
kfree(priv->ieee_channels);
kfree(priv->ieee_rates);
- clear_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status);
+ clear_bit(STATUS_GEO_CONFIGURED, &priv->status);
}

static bool iwl_is_channel_extension(struct iwl_priv *priv,
@@ -798,11 +798,10 @@ void iwl_chswitch_done(struct iwl_priv *priv, bool is_success)
*/
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

- if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING,
- &priv->shrd->status))
+ if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
ieee80211_chswitch_done(ctx->vif, is_success);
}

@@ -849,7 +848,7 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)

/* Keep the restart process from trying to send host
* commands by clearing the ready bit */
- clear_bit(STATUS_READY, &priv->shrd->status);
+ clear_bit(STATUS_READY, &priv->status);

wake_up(&priv->shrd->wait_command_queue);

@@ -874,7 +873,7 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
priv->reload_count = 0;
}

- if (!test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) {
+ if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) {
if (iwlagn_mod_params.restart_fw) {
IWL_DEBUG_FW_ERRORS(priv,
"Restarting adapter due to uCode error.\n");
@@ -912,7 +911,7 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
return -EINVAL;
}

- if (!iwl_is_ready_rf(priv->shrd))
+ if (!iwl_is_ready_rf(priv))
return -EIO;

/* scan complete and commit_rxon use tx_power_next value,
@@ -920,7 +919,7 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
priv->tx_power_next = tx_power;

/* do not set tx power when scanning or channel changing */
- defer = test_bit(STATUS_SCANNING, &priv->shrd->status) ||
+ defer = test_bit(STATUS_SCANNING, &priv->status) ||
memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging));
if (defer && !force) {
IWL_DEBUG_INFO(priv, "Deferring tx power set\n");
@@ -1219,7 +1218,7 @@ void iwl_update_stats(struct iwl_priv *priv, bool is_tx, __le16 fc, u16 len)

static void iwl_force_rf_reset(struct iwl_priv *priv)
{
- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

if (!iwl_is_any_associated(priv)) {
@@ -1244,7 +1243,7 @@ int iwl_force_reset(struct iwl_priv *priv, int mode, bool external)
{
struct iwl_force_reset *force_reset;

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return -EINVAL;

if (mode >= IWL_MAX_FORCE_RESET) {
@@ -1334,10 +1333,10 @@ void iwl_bg_watchdog(unsigned long data)
int cnt;
unsigned long timeout;

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

- if (iwl_is_rfkill(priv->shrd))
+ if (iwl_is_rfkill(priv))
return;

timeout = hw_params(priv).wd_timeout;
@@ -1472,9 +1471,9 @@ void iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state)
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);

if (state)
- set_bit(STATUS_RF_KILL_HW, &priv->shrd->status);
+ set_bit(STATUS_RF_KILL_HW, &priv->status);
else
- clear_bit(STATUS_RF_KILL_HW, &priv->shrd->status);
+ clear_bit(STATUS_RF_KILL_HW, &priv->status);

wiphy_rfkill_set_hw_state(priv->hw->wiphy, state);
}
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 71f8cc8..9b71c87 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -454,7 +454,7 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
char *buf;
ssize_t ret;

- if (!test_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status))
+ if (!test_bit(STATUS_GEO_CONFIGURED, &priv->status))
return -EAGAIN;

buf = kzalloc(bufsz, GFP_KERNEL);
@@ -525,28 +525,26 @@ static ssize_t iwl_dbgfs_status_read(struct file *file,

pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n",
test_bit(STATUS_HCMD_ACTIVE, &priv->shrd->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INT_ENABLED:\t %d\n",
- test_bit(STATUS_INT_ENABLED, &priv->shrd->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n",
- test_bit(STATUS_RF_KILL_HW, &priv->shrd->status));
+ test_bit(STATUS_RF_KILL_HW, &priv->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_CT_KILL:\t\t %d\n",
test_bit(STATUS_CT_KILL, &priv->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n",
- test_bit(STATUS_ALIVE, &priv->shrd->status));
+ test_bit(STATUS_ALIVE, &priv->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n",
- test_bit(STATUS_READY, &priv->shrd->status));
+ test_bit(STATUS_READY, &priv->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_GEO_CONFIGURED:\t %d\n",
- test_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status));
+ test_bit(STATUS_GEO_CONFIGURED, &priv->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n",
- test_bit(STATUS_EXIT_PENDING, &priv->shrd->status));
+ test_bit(STATUS_EXIT_PENDING, &priv->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n",
- test_bit(STATUS_STATISTICS, &priv->shrd->status));
+ test_bit(STATUS_STATISTICS, &priv->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCANNING:\t %d\n",
- test_bit(STATUS_SCANNING, &priv->shrd->status));
+ test_bit(STATUS_SCANNING, &priv->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_ABORTING:\t %d\n",
- test_bit(STATUS_SCAN_ABORTING, &priv->shrd->status));
+ test_bit(STATUS_SCAN_ABORTING, &priv->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_HW:\t\t %d\n",
- test_bit(STATUS_SCAN_HW, &priv->shrd->status));
+ test_bit(STATUS_SCAN_HW, &priv->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_POWER_PMI:\t %d\n",
test_bit(STATUS_POWER_PMI, &priv->shrd->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_FW_ERROR:\t %d\n",
@@ -752,7 +750,7 @@ static ssize_t iwl_dbgfs_sleep_level_override_write(struct file *file,
if (value != -1 && (value < 0 || value >= IWL_POWER_NUM))
return -EINVAL;

- if (!iwl_is_ready_rf(priv->shrd))
+ if (!iwl_is_ready_rf(priv))
return -EAGAIN;

priv->power_data.debug_sleep_level_override = value;
@@ -947,7 +945,7 @@ static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file,
struct statistics_rx_non_phy *delta_general, *max_general;
struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht;

- if (!iwl_is_alive(priv->shrd))
+ if (!iwl_is_alive(priv))
return -EAGAIN;

buf = kzalloc(bufsz, GFP_KERNEL);
@@ -1376,7 +1374,7 @@ static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
ssize_t ret;
struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;

- if (!iwl_is_alive(priv->shrd))
+ if (!iwl_is_alive(priv))
return -EAGAIN;

buf = kzalloc(bufsz, GFP_KERNEL);
@@ -1578,7 +1576,7 @@ static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
struct statistics_div *div, *accum_div, *delta_div, *max_div;

- if (!iwl_is_alive(priv->shrd))
+ if (!iwl_is_alive(priv))
return -EAGAIN;

buf = kzalloc(bufsz, GFP_KERNEL);
@@ -1697,7 +1695,7 @@ static ssize_t iwl_dbgfs_ucode_bt_stats_read(struct file *file,
ssize_t ret;
struct statistics_bt_activity *bt, *accum_bt;

- if (!iwl_is_alive(priv->shrd))
+ if (!iwl_is_alive(priv))
return -EAGAIN;

if (!priv->bt_enable_flag)
@@ -1790,7 +1788,7 @@ static ssize_t iwl_dbgfs_reply_tx_error_read(struct file *file,
(sizeof(struct reply_agg_tx_error_statistics) * 24) + 200;
ssize_t ret;

- if (!iwl_is_alive(priv->shrd))
+ if (!iwl_is_alive(priv))
return -EAGAIN;

buf = kzalloc(bufsz, GFP_KERNEL);
@@ -2148,7 +2146,7 @@ static ssize_t iwl_dbgfs_ucode_tracing_write(struct file *file,

if (trace) {
priv->event_log.ucode_trace = true;
- if (iwl_is_alive(priv->shrd)) {
+ if (iwl_is_alive(priv)) {
/* start collecting data now */
mod_timer(&priv->ucode_trace, jiffies);
}
@@ -2338,7 +2336,7 @@ static ssize_t iwl_dbgfs_txfifo_flush_write(struct file *file,
if (sscanf(buf, "%d", &flush) != 1)
return -EINVAL;

- if (iwl_is_rfkill(priv->shrd))
+ if (iwl_is_rfkill(priv))
return -EFAULT;

iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL);
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c
index f2f706f..1993a2b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-led.c
@@ -126,7 +126,7 @@ static int iwl_led_cmd(struct iwl_priv *priv,
};
int ret;

- if (!test_bit(STATUS_READY, &priv->shrd->status))
+ if (!test_bit(STATUS_READY, &priv->status))
return -EBUSY;

if (priv->blink_on == on && priv->blink_off == off)
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
index dcf39f8..54d3709 100644
--- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c
+++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
@@ -266,7 +266,7 @@ static int __iwl_up(struct iwl_priv *priv)

lockdep_assert_held(&priv->mutex);

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) {
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
IWL_WARN(priv, "Exit pending; will not bring the NIC up\n");
return -EIO;
}
@@ -297,9 +297,9 @@ static int __iwl_up(struct iwl_priv *priv)
return 0;

error:
- set_bit(STATUS_EXIT_PENDING, &priv->shrd->status);
+ set_bit(STATUS_EXIT_PENDING, &priv->status);
iwl_down(priv);
- clear_bit(STATUS_EXIT_PENDING, &priv->shrd->status);
+ clear_bit(STATUS_EXIT_PENDING, &priv->status);

IWL_ERR(priv, "Unable to initialize device.\n");
return ret;
@@ -322,7 +322,7 @@ static int iwlagn_mac_start(struct ieee80211_hw *hw)
IWL_DEBUG_INFO(priv, "Start UP work done.\n");

/* Now we should be done, and the READY bit should be set. */
- if (WARN_ON(!test_bit(STATUS_READY, &priv->shrd->status)))
+ if (WARN_ON(!test_bit(STATUS_READY, &priv->status)))
ret = -EIO;

iwlagn_led_enable(priv);
@@ -807,7 +807,7 @@ static int iwlagn_mac_sta_state(struct ieee80211_hw *hw,
* mac80211 might WARN if we fail, but due the way we
* (badly) handle hard rfkill, we might fail here
*/
- if (iwl_is_rfkill(priv->shrd))
+ if (iwl_is_rfkill(priv))
ret = 0;

mutex_unlock(&priv->mutex);
@@ -839,12 +839,12 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,

mutex_lock(&priv->mutex);

- if (iwl_is_rfkill(priv->shrd))
+ if (iwl_is_rfkill(priv))
goto out;

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) ||
- test_bit(STATUS_SCANNING, &priv->shrd->status) ||
- test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status))
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
+ test_bit(STATUS_SCANNING, &priv->status) ||
+ test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
goto out;

if (!iwl_is_associated_ctx(ctx))
@@ -884,10 +884,10 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
* at this point, staging_rxon has the
* configuration for channel switch
*/
- set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status);
+ set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
priv->switch_channel = cpu_to_le16(ch);
if (cfg(priv)->lib->set_channel_switch(priv, ch_switch)) {
- clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status);
+ clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
priv->switch_channel = 0;
ieee80211_chswitch_done(ctx->vif, false);
}
@@ -954,11 +954,11 @@ static void iwlagn_mac_flush(struct ieee80211_hw *hw, bool drop)
mutex_lock(&priv->mutex);
IWL_DEBUG_MAC80211(priv, "enter\n");

- if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) {
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
IWL_DEBUG_TX(priv, "Aborting flush due to device shutdown\n");
goto done;
}
- if (iwl_is_rfkill(priv->shrd)) {
+ if (iwl_is_rfkill(priv)) {
IWL_DEBUG_TX(priv, "Aborting flush due to RF Kill\n");
goto done;
}
@@ -999,7 +999,7 @@ static int iwlagn_mac_remain_on_channel(struct ieee80211_hw *hw,
IWL_DEBUG_MAC80211(priv, "enter\n");
mutex_lock(&priv->mutex);

- if (test_bit(STATUS_SCAN_HW, &priv->shrd->status)) {
+ if (test_bit(STATUS_SCAN_HW, &priv->status)) {
err = -EBUSY;
goto out;
}
@@ -1140,7 +1140,7 @@ static int iwlagn_mac_conf_tx(struct ieee80211_hw *hw,

IWL_DEBUG_MAC80211(priv, "enter\n");

- if (!iwl_is_ready_rf(priv->shrd)) {
+ if (!iwl_is_ready_rf(priv)) {
IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n");
return -EIO;
}
@@ -1241,7 +1241,7 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw,

iwlagn_disable_roc(priv);

- if (!iwl_is_ready_rf(priv->shrd)) {
+ if (!iwl_is_ready_rf(priv)) {
IWL_WARN(priv, "Try to add interface when device not ready\n");
err = -EINVAL;
goto out;
@@ -1365,7 +1365,7 @@ static int iwlagn_mac_change_interface(struct ieee80211_hw *hw,

mutex_lock(&priv->mutex);

- if (!ctx->vif || !iwl_is_ready_rf(priv->shrd)) {
+ if (!ctx->vif || !iwl_is_ready_rf(priv)) {
/*
* Huh? But wait ... this can maybe happen when
* we're in the middle of a firmware restart!
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
index f79ff16..958d9d0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.c
+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
@@ -392,12 +392,12 @@ int iwl_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd,
if (!memcmp(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)) && !force)
return 0;

- if (!iwl_is_ready_rf(priv->shrd))
+ if (!iwl_is_ready_rf(priv))
return -EIO;

/* scan complete use sleep_power_next, need to be updated */
memcpy(&priv->power_data.sleep_cmd_next, cmd, sizeof(*cmd));
- if (test_bit(STATUS_SCANNING, &priv->shrd->status) && !force) {
+ if (test_bit(STATUS_SCANNING, &priv->status) && !force) {
IWL_DEBUG_INFO(priv, "Defer power set mode while scanning\n");
return 0;
}
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 8c3fb32..902efe4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -66,9 +66,9 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
/* Exit instantly with error when device is not ready
* to receive scan abort command or it does not perform
* hardware scan currently */
- if (!test_bit(STATUS_READY, &priv->shrd->status) ||
- !test_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status) ||
- !test_bit(STATUS_SCAN_HW, &priv->shrd->status) ||
+ if (!test_bit(STATUS_READY, &priv->status) ||
+ !test_bit(STATUS_GEO_CONFIGURED, &priv->status) ||
+ !test_bit(STATUS_SCAN_HW, &priv->status) ||
test_bit(STATUS_FW_ERROR, &priv->shrd->status))
return -EIO;

@@ -118,18 +118,18 @@ static void iwl_process_scan_complete(struct iwl_priv *priv)

lockdep_assert_held(&priv->mutex);

- if (!test_and_clear_bit(STATUS_SCAN_COMPLETE, &priv->shrd->status))
+ if (!test_and_clear_bit(STATUS_SCAN_COMPLETE, &priv->status))
return;

IWL_DEBUG_SCAN(priv, "Completed scan.\n");

cancel_delayed_work(&priv->scan_check);

- aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &priv->shrd->status);
+ aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &priv->status);
if (aborted)
IWL_DEBUG_SCAN(priv, "Aborted scan completed.\n");

- if (!test_and_clear_bit(STATUS_SCANNING, &priv->shrd->status)) {
+ if (!test_and_clear_bit(STATUS_SCANNING, &priv->status)) {
IWL_DEBUG_SCAN(priv, "Scan already completed.\n");
goto out_settings;
}
@@ -165,7 +165,7 @@ out_complete:

out_settings:
/* Can we still talk to firmware ? */
- if (!iwl_is_ready_rf(priv->shrd))
+ if (!iwl_is_ready_rf(priv))
return;

iwlagn_post_scan(priv);
@@ -175,16 +175,16 @@ void iwl_force_scan_end(struct iwl_priv *priv)
{
lockdep_assert_held(&priv->mutex);

- if (!test_bit(STATUS_SCANNING, &priv->shrd->status)) {
+ if (!test_bit(STATUS_SCANNING, &priv->status)) {
IWL_DEBUG_SCAN(priv, "Forcing scan end while not scanning\n");
return;
}

IWL_DEBUG_SCAN(priv, "Forcing scan end\n");
- clear_bit(STATUS_SCANNING, &priv->shrd->status);
- clear_bit(STATUS_SCAN_HW, &priv->shrd->status);
- clear_bit(STATUS_SCAN_ABORTING, &priv->shrd->status);
- clear_bit(STATUS_SCAN_COMPLETE, &priv->shrd->status);
+ clear_bit(STATUS_SCANNING, &priv->status);
+ clear_bit(STATUS_SCAN_HW, &priv->status);
+ clear_bit(STATUS_SCAN_ABORTING, &priv->status);
+ clear_bit(STATUS_SCAN_COMPLETE, &priv->status);
iwl_complete_scan(priv, true);
}

@@ -194,12 +194,12 @@ static void iwl_do_scan_abort(struct iwl_priv *priv)

lockdep_assert_held(&priv->mutex);

- if (!test_bit(STATUS_SCANNING, &priv->shrd->status)) {
+ if (!test_bit(STATUS_SCANNING, &priv->status)) {
IWL_DEBUG_SCAN(priv, "Not performing scan to abort\n");
return;
}

- if (test_and_set_bit(STATUS_SCAN_ABORTING, &priv->shrd->status)) {
+ if (test_and_set_bit(STATUS_SCAN_ABORTING, &priv->status)) {
IWL_DEBUG_SCAN(priv, "Scan abort in progress\n");
return;
}
@@ -238,7 +238,7 @@ void iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms)
iwl_do_scan_abort(priv);

while (time_before_eq(jiffies, timeout)) {
- if (!test_bit(STATUS_SCAN_HW, &priv->shrd->status))
+ if (!test_bit(STATUS_SCAN_HW, &priv->status))
goto finished;
msleep(20);
}
@@ -350,8 +350,8 @@ static int iwl_rx_scan_complete_notif(struct iwl_priv *priv,
* to clear, we need to set SCAN_COMPLETE before clearing SCAN_HW
* to avoid a race there.
*/
- set_bit(STATUS_SCAN_COMPLETE, &priv->shrd->status);
- clear_bit(STATUS_SCAN_HW, &priv->shrd->status);
+ set_bit(STATUS_SCAN_COMPLETE, &priv->status);
+ clear_bit(STATUS_SCAN_HW, &priv->status);
queue_work(priv->workqueue, &priv->scan_completed);

if (priv->iw_mode != NL80211_IFTYPE_ADHOC &&
@@ -927,7 +927,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
scan->len = cpu_to_le16(cmd.len[0]);

/* set scan bit here for PAN params */
- set_bit(STATUS_SCAN_HW, &priv->shrd->status);
+ set_bit(STATUS_SCAN_HW, &priv->status);

ret = iwlagn_set_pan_params(priv);
if (ret)
@@ -935,7 +935,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)

ret = iwl_dvm_send_cmd(priv, &cmd);
if (ret) {
- clear_bit(STATUS_SCAN_HW, &priv->shrd->status);
+ clear_bit(STATUS_SCAN_HW, &priv->status);
iwlagn_set_pan_params(priv);
}

@@ -962,18 +962,18 @@ int __must_check iwl_scan_initiate(struct iwl_priv *priv,

cancel_delayed_work(&priv->scan_check);

- if (!iwl_is_ready_rf(priv->shrd)) {
+ if (!iwl_is_ready_rf(priv)) {
IWL_WARN(priv, "Request scan called when driver not ready.\n");
return -EIO;
}

- if (test_bit(STATUS_SCAN_HW, &priv->shrd->status)) {
+ if (test_bit(STATUS_SCAN_HW, &priv->status)) {
IWL_DEBUG_SCAN(priv,
"Multiple concurrent scan requests in parallel.\n");
return -EBUSY;
}

- if (test_bit(STATUS_SCAN_ABORTING, &priv->shrd->status)) {
+ if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
IWL_DEBUG_SCAN(priv, "Scan request while abort pending.\n");
return -EBUSY;
}
@@ -983,14 +983,14 @@ int __must_check iwl_scan_initiate(struct iwl_priv *priv,
scan_type == IWL_SCAN_ROC ? "remain-on-channel " :
"internal short ");

- set_bit(STATUS_SCANNING, &priv->shrd->status);
+ set_bit(STATUS_SCANNING, &priv->status);
priv->scan_type = scan_type;
priv->scan_start = jiffies;
priv->scan_band = band;

ret = iwlagn_request_scan(priv, vif);
if (ret) {
- clear_bit(STATUS_SCANNING, &priv->shrd->status);
+ clear_bit(STATUS_SCANNING, &priv->status);
priv->scan_type = IWL_SCAN_NORMAL;
return ret;
}
@@ -1025,7 +1025,7 @@ static void iwl_bg_start_internal_scan(struct work_struct *work)
goto unlock;
}

- if (test_bit(STATUS_SCANNING, &priv->shrd->status)) {
+ if (test_bit(STATUS_SCANNING, &priv->status)) {
IWL_DEBUG_SCAN(priv, "Scan already in progress.\n");
goto unlock;
}
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
index 16a32ae..dd64e69 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
@@ -356,7 +356,8 @@ void iwl_dump_csr(struct iwl_trans *trans);
******************************************************/
static inline void iwl_disable_interrupts(struct iwl_trans *trans)
{
- clear_bit(STATUS_INT_ENABLED, &trans->shrd->status);
+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
+ clear_bit(STATUS_INT_ENABLED, &trans_pcie->status);

/* disable interrupts from uCode/NIC to host */
iwl_write32(trans, CSR_INT_MASK, 0x00000000);
@@ -370,11 +371,10 @@ static inline void iwl_disable_interrupts(struct iwl_trans *trans)

static inline void iwl_enable_interrupts(struct iwl_trans *trans)
{
- struct iwl_trans_pcie *trans_pcie =
- IWL_TRANS_GET_PCIE_TRANS(trans);
+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);

IWL_DEBUG_ISR(trans, "Enabling interrupts\n");
- set_bit(STATUS_INT_ENABLED, &trans->shrd->status);
+ set_bit(STATUS_INT_ENABLED, &trans_pcie->status);
iwl_write32(trans, CSR_INT_MASK, trans_pcie->inta_mask);
}

diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
index 3eb7bd1..17e1487 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
@@ -1131,7 +1131,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)

/* Re-enable all interrupts */
/* only Re-enable if disabled by irq */
- if (test_bit(STATUS_INT_ENABLED, &trans->shrd->status))
+ if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status))
iwl_enable_interrupts(trans);
/* Re-enable RF_KILL if it occurred */
else if (handled & CSR_INT_BIT_RF_KILL)
@@ -1303,7 +1303,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
/* iwl_irq_tasklet() will service interrupts and re-enable them */
if (likely(inta))
tasklet_schedule(&trans_pcie->irq_tasklet);
- else if (test_bit(STATUS_INT_ENABLED, &trans->shrd->status) &&
+ else if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
!trans_pcie->inta)
iwl_enable_interrupts(trans);

@@ -1314,7 +1314,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
none:
/* re-enable interrupts here since we don't have anything to service. */
/* only Re-enable if disabled by irq and no schedules tasklet. */
- if (test_bit(STATUS_INT_ENABLED, &trans->shrd->status) &&
+ if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
!trans_pcie->inta)
iwl_enable_interrupts(trans);

@@ -1414,7 +1414,7 @@ irqreturn_t iwl_isr_ict(int irq, void *data)
/* iwl_irq_tasklet() will service interrupts and re-enable them */
if (likely(inta))
tasklet_schedule(&trans_pcie->irq_tasklet);
- else if (test_bit(STATUS_INT_ENABLED, &trans->shrd->status) &&
+ else if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
!trans_pcie->inta) {
/* Allow interrupt if was disabled by this handler and
* no tasklet was schedules, We should not enable interrupt,
@@ -1430,7 +1430,7 @@ irqreturn_t iwl_isr_ict(int irq, void *data)
/* re-enable interrupts here since we don't have anything to service.
* only Re-enable if disabled by irq.
*/
- if (test_bit(STATUS_INT_ENABLED, &trans->shrd->status) &&
+ if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
!trans_pcie->inta)
iwl_enable_interrupts(trans);

diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index 4e56c3b..b0d34f7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -691,6 +691,7 @@ static void iwl_apm_config(struct iwl_trans *trans)
*/
static int iwl_apm_init(struct iwl_trans *trans)
{
+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
int ret = 0;
IWL_DEBUG_INFO(trans, "Init card's basic functions\n");

@@ -760,7 +761,7 @@ static int iwl_apm_init(struct iwl_trans *trans)
iwl_set_bits_prph(trans, APMG_PCIDEV_STT_REG,
APMG_PCIDEV_STT_VAL_L1_ACT_DIS);

- set_bit(STATUS_DEVICE_ENABLED, &trans->shrd->status);
+ set_bit(STATUS_DEVICE_ENABLED, &trans_pcie->status);

out:
return ret;
@@ -786,9 +787,10 @@ static int iwl_apm_stop_master(struct iwl_trans *trans)

static void iwl_apm_stop(struct iwl_trans *trans)
{
+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
IWL_DEBUG_INFO(trans, "Stop card, put in low power state\n");

- clear_bit(STATUS_DEVICE_ENABLED, &trans->shrd->status);
+ clear_bit(STATUS_DEVICE_ENABLED, &trans_pcie->status);

/* Stop device's DMA activity */
iwl_apm_stop_master(trans);
@@ -1274,7 +1276,7 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
* restart. So don't process again if the device is
* already dead.
*/
- if (test_bit(STATUS_DEVICE_ENABLED, &trans->shrd->status)) {
+ if (test_bit(STATUS_DEVICE_ENABLED, &trans_pcie->status)) {
iwl_trans_tx_stop(trans);
#ifndef CONFIG_IWLWIFI_IDI
iwl_trans_rx_stop(trans);
--
1.7.0.4


2012-03-07 19:06:34

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 18/35] iwlwifi: print DMA stop timeout error only if it happened

From: Stanislaw Gruszka <[email protected]>

iwl_poll_direct_bit() return negative error value on timeout,
positive values do not indicate an error.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index ef7418d..75bb95e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -1219,7 +1219,7 @@ static void iwl_trans_pcie_fw_alive(struct iwl_trans *trans)
*/
static int iwl_trans_tx_stop(struct iwl_trans *trans)
{
- int ch, txq_id;
+ int ch, txq_id, ret;
unsigned long flags;
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);

@@ -1232,9 +1232,10 @@ static int iwl_trans_tx_stop(struct iwl_trans *trans)
for (ch = 0; ch < FH_TCSR_CHNL_NUM; ch++) {
iwl_write_direct32(trans,
FH_TCSR_CHNL_TX_CONFIG_REG(ch), 0x0);
- if (iwl_poll_direct_bit(trans, FH_TSSR_TX_STATUS_REG,
+ ret = iwl_poll_direct_bit(trans, FH_TSSR_TX_STATUS_REG,
FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch),
- 1000))
+ 1000);
+ if (ret < 0)
IWL_ERR(trans, "Failing on timeout while stopping"
" DMA channel %d [0x%08x]", ch,
iwl_read_direct32(trans,
--
1.7.0.4


2012-03-07 19:06:30

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 06/35] iwlwifi: remove unused argument from iwlagn_suspend

From: Johannes Berg <[email protected]>

There's not much point in passing priv and
hw pointers since they can be derived from
each other, and the function doesn't use
the hw pointer anyway. Remove it.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 3 +--
drivers/net/wireless/iwlwifi/iwl-agn.h | 3 +--
drivers/net/wireless/iwlwifi/iwl-mac80211.c | 2 +-
3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index b2ee1f9..6d8a857 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -1120,8 +1120,7 @@ int iwlagn_send_patterns(struct iwl_priv *priv,
return err;
}

-int iwlagn_suspend(struct iwl_priv *priv,
- struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
+int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan)
{
struct iwlagn_wowlan_wakeup_filter_cmd wakeup_filter_cmd;
struct iwl_rxon_cmd rxon;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h
index 8384c05..82930ef 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
@@ -141,8 +141,7 @@ int iwlagn_send_beacon_cmd(struct iwl_priv *priv);
#ifdef CONFIG_PM_SLEEP
int iwlagn_send_patterns(struct iwl_priv *priv,
struct cfg80211_wowlan *wowlan);
-int iwlagn_suspend(struct iwl_priv *priv,
- struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan);
+int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan);
#endif

/* rx */
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
index d2c1d71..bdcbbd0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c
+++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
@@ -405,7 +405,7 @@ static int iwlagn_mac_suspend(struct ieee80211_hw *hw,
goto out;
}

- ret = iwlagn_suspend(priv, hw, wowlan);
+ ret = iwlagn_suspend(priv, wowlan);
if (ret)
goto error;

--
1.7.0.4


2012-03-07 19:06:34

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 17/35] iwlwifi: use writeb,writel,readl directly

From: Stanislaw Gruszka <[email protected]>

That change will save us some CPU cycles at run time. Having port-based
I/O seems to be not possible for PCIe devices.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/Kconfig | 2 +-
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 13 ++++++-------
2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig
index ae08498..5afd06e 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -1,6 +1,6 @@
config IWLWIFI
tristate "Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi) "
- depends on PCI && MAC80211
+ depends on PCI && MAC80211 && HAS_IOMEM
select FW_LOADER
select NEW_LEDS
select LEDS_CLASS
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index 2a781b5..ef7418d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -1609,18 +1609,17 @@ static int iwl_trans_pcie_reclaim(struct iwl_trans *trans, int sta_id, int tid,

static void iwl_trans_pcie_write8(struct iwl_trans *trans, u32 ofs, u8 val)
{
- iowrite8(val, IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs);
+ writeb(val, IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs);
}

static void iwl_trans_pcie_write32(struct iwl_trans *trans, u32 ofs, u32 val)
{
- iowrite32(val, IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs);
+ writel(val, IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs);
}

static u32 iwl_trans_pcie_read32(struct iwl_trans *trans, u32 ofs)
{
- u32 val = ioread32(IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs);
- return val;
+ return readl(IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs);
}

static void iwl_trans_pcie_free(struct iwl_trans *trans)
@@ -1638,7 +1637,7 @@ static void iwl_trans_pcie_free(struct iwl_trans *trans)
}

pci_disable_msi(trans_pcie->pci_dev);
- pci_iounmap(trans_pcie->pci_dev, trans_pcie->hw_base);
+ iounmap(trans_pcie->hw_base);
pci_release_regions(trans_pcie->pci_dev);
pci_disable_device(trans_pcie->pci_dev);

@@ -2269,9 +2268,9 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd,
goto out_pci_disable_device;
}

- trans_pcie->hw_base = pci_iomap(pdev, 0, 0);
+ trans_pcie->hw_base = pci_ioremap_bar(pdev, 0);
if (!trans_pcie->hw_base) {
- dev_printk(KERN_ERR, &pdev->dev, "pci_iomap failed");
+ dev_printk(KERN_ERR, &pdev->dev, "pci_ioremap_bar failed");
err = -ENODEV;
goto out_pci_release_regions;
}
--
1.7.0.4


2012-03-08 19:32:10

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH RESEND 29/35] iwlwifi: move command queue number out of the iwl_shared struct

This one didn't apply...

On Wed, Mar 07, 2012 at 09:52:38AM -0800, Wey-Yi Guy wrote:
> From: Meenakshi Venkataraman <[email protected]>
>
> The command queue number is required by the transport
> layer, but it can be determined only by the op mode.
> Move this parameter to the dvm op mode, and configure
> the transport layer using an API.
>
> Signed-off-by: Meenakshi Venkataraman <[email protected]>
> Signed-off-by: Wey-Yi Guy <[email protected]>
> ---
> drivers/net/wireless/iwlwifi/iwl-agn.c | 16 +++++-----
> drivers/net/wireless/iwlwifi/iwl-shared.h | 2 -
> drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h | 2 +
> drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 2 +-
> drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c | 24 +++++++-------
> drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 34 +++++++++++++-------
> drivers/net/wireless/iwlwifi/iwl-trans.h | 9 +++++
> 7 files changed, 54 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
> index d45def3..76ee2dd 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-agn.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
> @@ -1236,6 +1236,14 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
> */
> trans_cfg.op_mode = op_mode;
>
> + if (ucode_flags & IWL_UCODE_TLV_FLAGS_PAN) {
> + priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
> + trans_cfg.cmd_queue = IWL_IPAN_CMD_QUEUE_NUM;
> + } else {
> + priv->sta_key_max_num = STA_KEY_MAX_NUM;
> + trans_cfg.cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
> + }
> +
> /* Configure transport layer */
> iwl_trans_configure(trans(priv), &trans_cfg);
>
> @@ -1336,14 +1344,6 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
> priv->new_scan_threshold_behaviour =
> !!(ucode_flags & IWL_UCODE_TLV_FLAGS_NEWSCAN);
>
> - if (ucode_flags & IWL_UCODE_TLV_FLAGS_PAN) {
> - priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
> - priv->shrd->cmd_queue = IWL_IPAN_CMD_QUEUE_NUM;
> - } else {
> - priv->sta_key_max_num = STA_KEY_MAX_NUM;
> - priv->shrd->cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
> - }
> -
> priv->phy_calib_chain_noise_reset_cmd =
> fw->ucode_capa.standard_phy_calibration_size;
> priv->phy_calib_chain_noise_gain_cmd =
> diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h
> index 0e24803..cf34087 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-shared.h
> +++ b/drivers/net/wireless/iwlwifi/iwl-shared.h
> @@ -366,7 +366,6 @@ struct iwl_cfg {
> /**
> * struct iwl_shared - shared fields for all the layers of the driver
> *
> - * @cmd_queue: command queue number
> * @status: STATUS_*
> * @wowlan: are we running wowlan uCode
> * @valid_contexts: microcode/device supports multiple contexts
> @@ -383,7 +382,6 @@ struct iwl_cfg {
> * @device_pointers: pointers to ucode event tables
> */
> struct iwl_shared {
> - u8 cmd_queue;
> unsigned long status;
> u8 valid_contexts;
>
> diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
> index dd64e69..14e5d52 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
> +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
> @@ -248,6 +248,7 @@ struct iwl_tx_queue {
> * @ucode_write_complete: indicates that the ucode has been copied.
> * @ucode_write_waitq: wait queue for uCode load
> * @status - transport specific status flags
> + * @cmd_queue - command queue number
> */
> struct iwl_trans_pcie {
> struct iwl_rx_queue rxq;
> @@ -289,6 +290,7 @@ struct iwl_trans_pcie {
> bool ucode_write_complete;
> wait_queue_head_t ucode_write_waitq;
> unsigned long status;
> + u8 cmd_queue;
> };
>
> #define IWL_TRANS_GET_PCIE_TRANS(_iwl_trans) \
> diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
> index 17e1487..9bc3c73 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
> @@ -361,7 +361,7 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans,
> {
> struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
> struct iwl_rx_queue *rxq = &trans_pcie->rxq;
> - struct iwl_tx_queue *txq = &trans_pcie->txq[trans->shrd->cmd_queue];
> + struct iwl_tx_queue *txq = &trans_pcie->txq[trans_pcie->cmd_queue];
> struct iwl_device_cmd *cmd;
> unsigned long flags;
> int len, err;
> diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
> index 8d13362..565c664 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
> @@ -397,7 +397,7 @@ static void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_trans *trans,
>
> WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX);
>
> - if (txq_id != trans->shrd->cmd_queue)
> + if (txq_id != trans_pcie->cmd_queue)
> sta_id = tx_cmd->sta_id;
>
> bc_ent = cpu_to_le16(1 | (sta_id << 12));
> @@ -665,7 +665,7 @@ int iwl_trans_pcie_tx_agg_disable(struct iwl_trans *trans, int sta_id, int tid)
> static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
> {
> struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
> - struct iwl_tx_queue *txq = &trans_pcie->txq[trans->shrd->cmd_queue];
> + struct iwl_tx_queue *txq = &trans_pcie->txq[trans_pcie->cmd_queue];
> struct iwl_queue *q = &txq->q;
> struct iwl_device_cmd *out_cmd;
> struct iwl_cmd_meta *out_meta;
> @@ -738,7 +738,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
> out_cmd->hdr.cmd = cmd->id;
> out_cmd->hdr.flags = 0;
> out_cmd->hdr.sequence =
> - cpu_to_le16(QUEUE_TO_SEQ(trans->shrd->cmd_queue) |
> + cpu_to_le16(QUEUE_TO_SEQ(trans_pcie->cmd_queue) |
> INDEX_TO_SEQ(q->write_ptr));
>
> /* and copy the data that needs to be copied */
> @@ -758,7 +758,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
> get_cmd_string(out_cmd->hdr.cmd),
> out_cmd->hdr.cmd,
> le16_to_cpu(out_cmd->hdr.sequence), cmd_size,
> - q->write_ptr, idx, trans->shrd->cmd_queue);
> + q->write_ptr, idx, trans_pcie->cmd_queue);
>
> phys_addr = dma_map_single(trans->dev, &out_cmd->hdr, copy_size,
> DMA_BIDIRECTIONAL);
> @@ -882,16 +882,16 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_cmd_buffer *rxb,
> struct iwl_device_cmd *cmd;
> struct iwl_cmd_meta *meta;
> struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
> - struct iwl_tx_queue *txq = &trans_pcie->txq[trans->shrd->cmd_queue];
> + struct iwl_tx_queue *txq = &trans_pcie->txq[trans_pcie->cmd_queue];
>
> /* If a Tx command is being handled and it isn't in the actual
> * command queue then there a command routing bug has been introduced
> * in the queue management code. */
> - if (WARN(txq_id != trans->shrd->cmd_queue,
> + if (WARN(txq_id != trans_pcie->cmd_queue,
> "wrong command queue %d (should be %d), sequence 0x%X readp=%d writep=%d\n",
> - txq_id, trans->shrd->cmd_queue, sequence,
> - trans_pcie->txq[trans->shrd->cmd_queue].q.read_ptr,
> - trans_pcie->txq[trans->shrd->cmd_queue].q.write_ptr)) {
> + txq_id, trans_pcie->cmd_queue, sequence,
> + trans_pcie->txq[trans_pcie->cmd_queue].q.read_ptr,
> + trans_pcie->txq[trans_pcie->cmd_queue].q.write_ptr)) {
> iwl_print_hex_error(trans, pkt, 32);
> return;
> }
> @@ -998,7 +998,7 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
> if (!ret) {
> if (test_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status)) {
> struct iwl_tx_queue *txq =
> - &trans_pcie->txq[trans->shrd->cmd_queue];
> + &trans_pcie->txq[trans_pcie->cmd_queue];
> struct iwl_queue *q = &txq->q;
>
> IWL_ERR(trans,
> @@ -1035,7 +1035,7 @@ cancel:
> * in later, it will possibly set an invalid
> * address (cmd->meta.source).
> */
> - trans_pcie->txq[trans->shrd->cmd_queue].meta[cmd_idx].flags &=
> + trans_pcie->txq[trans_pcie->cmd_queue].meta[cmd_idx].flags &=
> ~CMD_WANT_SKB;
> }
>
> @@ -1066,7 +1066,7 @@ int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
> int freed = 0;
>
> /* This function is not meant to release cmd queue*/
> - if (WARN_ON(txq_id == trans->shrd->cmd_queue))
> + if (WARN_ON(txq_id == trans_pcie->cmd_queue))
> return 0;
>
> lockdep_assert_held(&txq->lock);
> diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
> index b0d34f7..f28f4cb 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
> @@ -78,9 +78,9 @@
>
> #define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo))))
>
> -#define SCD_QUEUECHAIN_SEL_ALL(trans) \
> +#define SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie) \
> (((1<<cfg(trans)->base_params->num_of_queues) - 1) &\
> - (~(1<<(trans)->shrd->cmd_queue)))
> + (~(1<<(trans_pcie)->cmd_queue)))
>
>
> static int iwl_trans_rx_alloc(struct iwl_trans *trans)
> @@ -306,6 +306,7 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
> {
> size_t tfd_sz = sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX;
> int i;
> + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
>
> if (WARN_ON(txq->meta || txq->cmd || txq->skbs || txq->tfds))
> return -EINVAL;
> @@ -318,7 +319,7 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
> if (!txq->meta || !txq->cmd)
> goto error;
>
> - if (txq_id == trans->shrd->cmd_queue)
> + if (txq_id == trans_pcie->cmd_queue)
> for (i = 0; i < slots_num; i++) {
> txq->cmd[i] = kmalloc(sizeof(struct iwl_device_cmd),
> GFP_KERNEL);
> @@ -329,7 +330,7 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
> /* 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->shrd->cmd_queue) {
> + if (txq_id != trans_pcie->cmd_queue) {
> txq->skbs = kcalloc(TFD_QUEUE_SIZE_MAX, sizeof(txq->skbs[0]),
> GFP_KERNEL);
> if (!txq->skbs) {
> @@ -357,7 +358,7 @@ error:
> txq->skbs = NULL;
> /* since txq->cmd has been zeroed,
> * all non allocated cmd[i] will be NULL */
> - if (txq->cmd && txq_id == trans->shrd->cmd_queue)
> + if (txq->cmd && txq_id == trans_pcie->cmd_queue)
> for (i = 0; i < slots_num; i++)
> kfree(txq->cmd[i]);
> kfree(txq->meta);
> @@ -423,7 +424,7 @@ static void iwl_tx_queue_unmap(struct iwl_trans *trans, int txq_id)
> /* In the command queue, all the TBs are mapped as BIDI
> * so unmap them as such.
> */
> - if (txq_id == trans->shrd->cmd_queue)
> + if (txq_id == trans_pcie->cmd_queue)
> dma_dir = DMA_BIDIRECTIONAL;
> else
> dma_dir = DMA_TO_DEVICE;
> @@ -459,7 +460,7 @@ static void iwl_tx_queue_free(struct iwl_trans *trans, int txq_id)
>
> /* De-alloc array of command/tx buffers */
>
> - if (txq_id == trans->shrd->cmd_queue)
> + if (txq_id == trans_pcie->cmd_queue)
> for (i = 0; i < txq->q.n_window; i++)
> kfree(txq->cmd[i]);
>
> @@ -557,7 +558,7 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans)
> /* 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;
> txq_id++) {
> - slots_num = (txq_id == trans->shrd->cmd_queue) ?
> + slots_num = (txq_id == trans_pcie->cmd_queue) ?
> TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
> ret = iwl_trans_txq_alloc(trans, &trans_pcie->txq[txq_id],
> slots_num, txq_id);
> @@ -603,7 +604,7 @@ static int iwl_tx_init(struct iwl_trans *trans)
> /* 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;
> txq_id++) {
> - slots_num = (txq_id == trans->shrd->cmd_queue) ?
> + slots_num = (txq_id == trans_pcie->cmd_queue) ?
> TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
> ret = iwl_trans_txq_init(trans, &trans_pcie->txq[txq_id],
> slots_num, txq_id);
> @@ -1138,7 +1139,7 @@ static void iwl_tx_start(struct iwl_trans *trans)
> reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN);
>
> iwl_write_prph(trans, SCD_QUEUECHAIN_SEL,
> - SCD_QUEUECHAIN_SEL_ALL(trans));
> + SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie));
> iwl_write_prph(trans, SCD_AGGR_SEL, 0);
>
> /* initiate the queues */
> @@ -1170,7 +1171,7 @@ static void iwl_tx_start(struct iwl_trans *trans)
> else
> queue_to_fifo = iwlagn_default_queue_to_tx_fifo;
>
> - iwl_trans_set_wr_ptrs(trans, trans->shrd->cmd_queue, 0);
> + iwl_trans_set_wr_ptrs(trans, trans_pcie->cmd_queue, 0);
>
> /* make sure all queue are not stopped */
> memset(&trans_pcie->queue_stopped[0], 0,
> @@ -1622,6 +1623,14 @@ static u32 iwl_trans_pcie_read32(struct iwl_trans *trans, u32 ofs)
> return readl(IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs);
> }
>
> +static void iwl_trans_pcie_configure(struct iwl_trans *trans,
> + const struct iwl_trans_config *trans_cfg)
> +{
> + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
> +
> + trans_pcie->cmd_queue = trans_cfg->cmd_queue;
> +}
> +
> static void iwl_trans_pcie_free(struct iwl_trans *trans)
> {
> struct iwl_trans_pcie *trans_pcie =
> @@ -1682,7 +1691,7 @@ static int iwl_trans_pcie_wait_tx_queue_empty(struct iwl_trans *trans)
>
> /* waiting for all the tx frames complete might take a while */
> for (cnt = 0; cnt < cfg(trans)->base_params->num_of_queues; cnt++) {
> - if (cnt == trans->shrd->cmd_queue)
> + if (cnt == trans_pcie->cmd_queue)
> continue;
> txq = &trans_pcie->txq[cnt];
> q = &txq->q;
> @@ -2213,6 +2222,7 @@ const struct iwl_trans_ops trans_ops_pcie = {
> .write8 = iwl_trans_pcie_write8,
> .write32 = iwl_trans_pcie_write32,
> .read32 = iwl_trans_pcie_read32,
> + .configure = iwl_trans_pcie_configure,
> };
>
> struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd,
> diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
> index b6fd427..a40c272 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-trans.h
> +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
> @@ -279,9 +279,12 @@ static inline struct page *rxb_steal_page(struct iwl_rx_cmd_buffer *r)
> *
> * @op_mode: pointer to the upper layer.
> * Must be set before any other call.
> + * @cmd_queue: the index of the command queue.
> + * Must be set before start_fw.
> */
> struct iwl_trans_config {
> struct iwl_op_mode *op_mode;
> + u8 cmd_queue;
> };
>
> /**
> @@ -331,6 +334,8 @@ struct iwl_trans_config {
> * @write8: write a u8 to a register at offset ofs from the BAR
> * @write32: write a u32 to a register at offset ofs from the BAR
> * @read32: read a u32 register at offset ofs from the BAR
> + * @configure: configure parameters required by the transport layer from
> + * the op_mode.
> */
> struct iwl_trans_ops {
>
> @@ -370,6 +375,8 @@ struct iwl_trans_ops {
> void (*write8)(struct iwl_trans *trans, u32 ofs, u8 val);
> void (*write32)(struct iwl_trans *trans, u32 ofs, u32 val);
> u32 (*read32)(struct iwl_trans *trans, u32 ofs);
> + void (*configure)(struct iwl_trans *trans,
> + const struct iwl_trans_config *trans_cfg);
> };
>
> /**
> @@ -425,6 +432,8 @@ static inline void iwl_trans_configure(struct iwl_trans *trans,
> * more
> */
> trans->op_mode = trans_cfg->op_mode;
> +
> + trans->ops->configure(trans, trans_cfg);
> }
>
> static inline int iwl_trans_start_hw(struct iwl_trans *trans)
> --
> 1.7.0.4
>
>

--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.

2012-03-07 19:06:31

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 07/35] iwlwifi: redesign PASSIVE_NO_RX workaround

From: Johannes Berg <[email protected]>

The PASSIVE_NO_RX workaround currently crosses
through the op_mode and transport layers, which
is a bit odd. This also isn't necessary, if the
transport simply reports when queues are full
(or no longer full) the op_mode can keep track
of this state, and report to mac80211 only what
*it* thinks is appropriate. What is appropriate
can then be based on whether queues should be
stopped to wait for RX or not.

This significantly simplifies the transport API,
it no longer needs to expose anything to stop a
queue, nor to wake "any" queue, this can all be
handled in the upper layer completely.

Also simplify the handling to not be dependent
on the context, that makes little sense as the
queues are shared and both contexts have to be
on the same channel anyway.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn-rx.c | 8 +---
drivers/net/wireless/iwlwifi/iwl-agn-rxon.c | 8 +---
drivers/net/wireless/iwlwifi/iwl-agn-tx.c | 12 +++---
drivers/net/wireless/iwlwifi/iwl-agn.c | 33 +++++++++++++++++++
drivers/net/wireless/iwlwifi/iwl-agn.h | 5 +--
drivers/net/wireless/iwlwifi/iwl-core.c | 14 --------
drivers/net/wireless/iwlwifi/iwl-dev.h | 5 ++-
drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h | 12 -------
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 36 +-------------------
drivers/net/wireless/iwlwifi/iwl-trans.h | 36 ++-------------------
drivers/net/wireless/iwlwifi/iwl-ucode.c | 6 ++--
11 files changed, 56 insertions(+), 119 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
index 521c820..a9bdbad 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
@@ -807,16 +807,12 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv,
* sometimes even after already having transmitted frames for the
* association because the new RXON may reset the information.
*/
- if (unlikely(ieee80211_is_beacon(fc))) {
+ if (unlikely(ieee80211_is_beacon(fc) && priv->passive_no_rx)) {
for_each_context(priv, ctx) {
- if (!ctx->last_tx_rejected)
- continue;
if (compare_ether_addr(hdr->addr3,
ctx->active.bssid_addr))
continue;
- ctx->last_tx_rejected = false;
- iwl_trans_wake_any_queue(trans(priv), ctx->ctxid,
- "channel got active");
+ iwlagn_lift_passive_no_rx(priv);
}
}

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
index 9d955fa..66e9a71 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
@@ -833,12 +833,8 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
* not get stuck in this case either since it
* can happen if userspace gets confused.
*/
- if (ctx->last_tx_rejected) {
- ctx->last_tx_rejected = false;
- iwl_trans_wake_any_queue(trans(priv),
- ctx->ctxid,
- "Disassoc: flush queue");
- }
+ iwlagn_lift_passive_no_rx(priv);
+
ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;

if (ctx->ctxid == IWL_RXON_CTX_BSS)
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index 14a6bde..527fde0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -1064,8 +1064,8 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
}

/*we can free until ssn % q.n_bd not inclusive */
- WARN_ON(iwl_trans_reclaim(trans(priv), sta_id, tid, txq_id,
- ssn, status, &skbs));
+ WARN_ON(iwl_trans_reclaim(trans(priv), sta_id, tid,
+ txq_id, ssn, &skbs));
iwlagn_check_ratid_empty(priv, sta_id, tid);
freed = 0;

@@ -1086,9 +1086,9 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
if (status == TX_STATUS_FAIL_PASSIVE_NO_RX &&
iwl_is_associated_ctx(ctx) && ctx->vif &&
ctx->vif->type == NL80211_IFTYPE_STATION) {
- ctx->last_tx_rejected = true;
- iwl_trans_stop_queue(trans(priv), txq_id,
- "Tx on passive channel");
+ /* block and stop all queues */
+ priv->passive_no_rx = true;
+ ieee80211_stop_queues(priv->hw);

IWL_DEBUG_TX_REPLY(priv,
"TXQ %d status %s (0x%08x) "
@@ -1182,7 +1182,7 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
* block-ack window (we assume that they've been successfully
* transmitted ... if not, it's too late anyway). */
if (iwl_trans_reclaim(trans(priv), sta_id, tid, scd_flow,
- ba_resp_scd_ssn, 0, &reclaimed_skbs)) {
+ ba_resp_scd_ssn, &reclaimed_skbs)) {
spin_unlock(&priv->sta_lock);
return 0;
}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 397faf9..29f40ea 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1427,6 +1427,39 @@ static void iwl_nic_config(struct iwl_op_mode *op_mode)
cfg(priv)->lib->nic_config(priv);
}

+static void iwl_stop_sw_queue(struct iwl_op_mode *op_mode, u8 ac)
+{
+ struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
+
+ set_bit(ac, &priv->transport_queue_stop);
+ ieee80211_stop_queue(priv->hw, ac);
+}
+
+static void iwl_wake_sw_queue(struct iwl_op_mode *op_mode, u8 ac)
+{
+ struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
+
+ clear_bit(ac, &priv->transport_queue_stop);
+
+ if (!priv->passive_no_rx)
+ ieee80211_wake_queue(priv->hw, ac);
+}
+
+void iwlagn_lift_passive_no_rx(struct iwl_priv *priv)
+{
+ int ac;
+
+ if (!priv->passive_no_rx)
+ return;
+
+ for (ac = IEEE80211_AC_VO; ac < IEEE80211_NUM_ACS; ac++) {
+ if (!test_bit(ac, &priv->transport_queue_stop))
+ ieee80211_wake_queue(priv->hw, ac);
+ }
+
+ priv->passive_no_rx = false;
+}
+
const struct iwl_op_mode_ops iwl_dvm_ops = {
.start = iwl_op_mode_dvm_start,
.stop = iwl_op_mode_dvm_stop,
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h
index 82930ef..b56498b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
@@ -84,14 +84,13 @@ void iwl_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb);
int __must_check iwl_rx_dispatch(struct iwl_op_mode *op_mode,
struct iwl_rx_cmd_buffer *rxb,
struct iwl_device_cmd *cmd);
-void iwl_stop_sw_queue(struct iwl_op_mode *op_mode, u8 ac);
-void iwl_wake_sw_queue(struct iwl_op_mode *op_mode, u8 ac);
void iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state);
-void iwl_stop_sw_queue(struct iwl_op_mode *op_mode, u8 ac);
void iwl_nic_error(struct iwl_op_mode *op_mode);

bool iwl_check_for_ct_kill(struct iwl_priv *priv);

+void iwlagn_lift_passive_no_rx(struct iwl_priv *priv);
+
/* MAC80211 */
struct ieee80211_hw *iwl_alloc_all(void);
int iwlagn_mac_setup_register(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 6648c1b..c2e604b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1488,17 +1488,3 @@ void iwl_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb)
kmem_cache_free(priv->tx_cmd_pool, (info->driver_data[1]));
dev_kfree_skb_any(skb);
}
-
-void iwl_stop_sw_queue(struct iwl_op_mode *op_mode, u8 ac)
-{
- struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
-
- ieee80211_stop_queue(priv->hw, ac);
-}
-
-void iwl_wake_sw_queue(struct iwl_op_mode *op_mode, u8 ac)
-{
- struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
-
- ieee80211_wake_queue(priv->hw, ac);
-}
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index d1e722b..7442970 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -670,8 +670,6 @@ struct iwl_rxon_context {
bool enabled, is_40mhz;
u8 extension_chan_offset;
} ht;
-
- bool last_tx_rejected;
};

enum iwl_scan_type {
@@ -720,6 +718,9 @@ struct iwl_priv {
spinlock_t sta_lock;
struct mutex mutex;

+ unsigned long transport_queue_stop;
+ bool passive_no_rx;
+
/* ieee device used by generic ieee processing code */
struct ieee80211_hw *hw;
struct ieee80211_channel *ieee_channels;
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
index d13b8d1..4f73a6d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
@@ -451,18 +451,6 @@ static inline void iwl_stop_queue(struct iwl_trans *trans,
}
}

-#ifdef ieee80211_stop_queue
-#undef ieee80211_stop_queue
-#endif
-
-#define ieee80211_stop_queue DO_NOT_USE_ieee80211_stop_queue
-
-#ifdef ieee80211_wake_queue
-#undef ieee80211_wake_queue
-#endif
-
-#define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue
-
static inline void iwl_txq_ctx_activate(struct iwl_trans_pcie *trans_pcie,
int txq_id)
{
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index 836e067..4844fb2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -1568,8 +1568,7 @@ static void iwl_trans_pcie_stop_hw(struct iwl_trans *trans)
}

static int iwl_trans_pcie_reclaim(struct iwl_trans *trans, int sta_id, int tid,
- int txq_id, int ssn, u32 status,
- struct sk_buff_head *skbs)
+ int txq_id, int ssn, struct sk_buff_head *skbs)
{
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
struct iwl_tx_queue *txq = &trans_pcie->txq[txq_id];
@@ -1602,9 +1601,7 @@ static int iwl_trans_pcie_reclaim(struct iwl_trans *trans, int sta_id, int tid,
txq_id, iwl_get_queue_ac(txq), txq->q.read_ptr,
tfd_num, ssn);
freed = iwl_tx_queue_reclaim(trans, txq_id, tfd_num, skbs);
- if (iwl_queue_space(&txq->q) > txq->q.low_mark &&
- (!txq->sched_retry ||
- status != TX_STATUS_FAIL_PASSIVE_NO_RX))
+ if (iwl_queue_space(&txq->q) > txq->q.low_mark)
iwl_wake_queue(trans, txq, "Packets reclaimed");
}

@@ -1671,32 +1668,6 @@ static int iwl_trans_pcie_resume(struct iwl_trans *trans)
}
#endif /* CONFIG_PM_SLEEP */

-static void iwl_trans_pcie_wake_any_queue(struct iwl_trans *trans,
- enum iwl_rxon_context_id ctx,
- const char *msg)
-{
- u8 ac, txq_id;
- struct iwl_trans_pcie *trans_pcie =
- IWL_TRANS_GET_PCIE_TRANS(trans);
-
- for (ac = 0; ac < AC_NUM; ac++) {
- txq_id = trans_pcie->ac_to_queue[ctx][ac];
- IWL_DEBUG_TX_QUEUES(trans, "Queue Status: Q[%d] %s\n",
- ac,
- (atomic_read(&trans_pcie->queue_stop_count[ac]) > 0)
- ? "stopped" : "awake");
- iwl_wake_queue(trans, &trans_pcie->txq[txq_id], msg);
- }
-}
-
-static void iwl_trans_pcie_stop_queue(struct iwl_trans *trans, int txq_id,
- const char *msg)
-{
- struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
-
- iwl_stop_queue(trans, &trans_pcie->txq[txq_id], msg);
-}
-
#define IWL_FLUSH_WAIT_MS 2000

static int iwl_trans_pcie_wait_tx_queue_empty(struct iwl_trans *trans)
@@ -2218,8 +2189,6 @@ const struct iwl_trans_ops trans_ops_pcie = {

.wowlan_suspend = iwl_trans_pcie_wowlan_suspend,

- .wake_any_queue = iwl_trans_pcie_wake_any_queue,
-
.send_cmd = iwl_trans_pcie_send_cmd,

.tx = iwl_trans_pcie_tx,
@@ -2230,7 +2199,6 @@ const struct iwl_trans_ops trans_ops_pcie = {
.tx_agg_setup = iwl_trans_pcie_tx_agg_setup,

.free = iwl_trans_pcie_free,
- .stop_queue = iwl_trans_pcie_stop_queue,

.dbgfs_register = iwl_trans_pcie_dbgfs_register,

diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 15bb208..609949f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -289,7 +289,6 @@ static inline struct page *rxb_steal_page(struct iwl_rx_cmd_buffer *r)
* May sleep
* @fw_alive: called when the fw sends alive notification
* May sleep
- * @wake_any_queue: wake all the queues of a specfic context IWL_RXON_CTX_*
* @stop_device:stops the whole device (embedded CPU put to reset)
* May sleep
* @wowlan_suspend: put the device into the correct mode for WoWLAN during
@@ -312,7 +311,6 @@ static inline struct page *rxb_steal_page(struct iwl_rx_cmd_buffer *r)
* irq, tasklet etc... From this point on, the device may not issue
* any interrupt (incl. RFKILL).
* May sleep
- * @stop_queue: stop a specific queue
* @check_stuck_queue: check if a specific queue is stuck
* @wait_tx_queue_empty: wait until all tx queues are empty
* May sleep
@@ -334,18 +332,13 @@ struct iwl_trans_ops {

void (*wowlan_suspend)(struct iwl_trans *trans);

- void (*wake_any_queue)(struct iwl_trans *trans,
- enum iwl_rxon_context_id ctx,
- const char *msg);
-
int (*send_cmd)(struct iwl_trans *trans, struct iwl_host_cmd *cmd);

int (*tx)(struct iwl_trans *trans, struct sk_buff *skb,
struct iwl_device_cmd *dev_cmd, enum iwl_rxon_context_id ctx,
u8 sta_id, u8 tid);
int (*reclaim)(struct iwl_trans *trans, int sta_id, int tid,
- int txq_id, int ssn, u32 status,
- struct sk_buff_head *skbs);
+ int txq_id, int ssn, struct sk_buff_head *skbs);

int (*tx_agg_disable)(struct iwl_trans *trans,
int sta_id, int tid);
@@ -357,8 +350,6 @@ struct iwl_trans_ops {

void (*free)(struct iwl_trans *trans);

- void (*stop_queue)(struct iwl_trans *trans, int q, const char *msg);
-
int (*dbgfs_register)(struct iwl_trans *trans, struct dentry* dir);
int (*check_stuck_queue)(struct iwl_trans *trans, int q);
int (*wait_tx_queue_empty)(struct iwl_trans *trans);
@@ -474,17 +465,6 @@ static inline void iwl_trans_wowlan_suspend(struct iwl_trans *trans)
trans->ops->wowlan_suspend(trans);
}

-static inline void iwl_trans_wake_any_queue(struct iwl_trans *trans,
- enum iwl_rxon_context_id ctx,
- const char *msg)
-{
- if (trans->state != IWL_TRANS_FW_ALIVE)
- IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
-
- trans->ops->wake_any_queue(trans, ctx, msg);
-}
-
-
static inline int iwl_trans_send_cmd(struct iwl_trans *trans,
struct iwl_host_cmd *cmd)
{
@@ -505,14 +485,13 @@ static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
}

static inline int iwl_trans_reclaim(struct iwl_trans *trans, int sta_id,
- int tid, int txq_id, int ssn, u32 status,
+ int tid, int txq_id, int ssn,
struct sk_buff_head *skbs)
{
if (trans->state != IWL_TRANS_FW_ALIVE)
IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);

- return trans->ops->reclaim(trans, sta_id, tid, txq_id, ssn,
- status, skbs);
+ return trans->ops->reclaim(trans, sta_id, tid, txq_id, ssn, skbs);
}

static inline int iwl_trans_tx_agg_disable(struct iwl_trans *trans,
@@ -554,15 +533,6 @@ static inline void iwl_trans_free(struct iwl_trans *trans)
trans->ops->free(trans);
}

-static inline void iwl_trans_stop_queue(struct iwl_trans *trans, int q,
- const char *msg)
-{
- if (trans->state != IWL_TRANS_FW_ALIVE)
- IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
-
- trans->ops->stop_queue(trans, q, msg);
-}
-
static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans)
{
if (trans->state != IWL_TRANS_FW_ALIVE)
diff --git a/drivers/net/wireless/iwlwifi/iwl-ucode.c b/drivers/net/wireless/iwlwifi/iwl-ucode.c
index 8267dbe..404fd8e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-ucode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-ucode.c
@@ -316,7 +316,6 @@ int iwl_send_bt_env(struct iwl_priv *priv, u8 action, u8 type)

static int iwl_alive_notify(struct iwl_priv *priv)
{
- struct iwl_rxon_context *ctx;
int ret;

if (!priv->tx_cmd_pool)
@@ -329,8 +328,9 @@ static int iwl_alive_notify(struct iwl_priv *priv)
return -ENOMEM;

iwl_trans_fw_alive(trans(priv));
- for_each_context(priv, ctx)
- ctx->last_tx_rejected = false;
+
+ priv->passive_no_rx = false;
+ priv->transport_queue_stop = 0;

ret = iwl_send_wimax_coex(priv);
if (ret)
--
1.7.0.4


2012-03-07 19:06:37

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 19/35] iwlwifi: reintroduce iwl_enable_rfkill_int

From: Stanislaw Gruszka <[email protected]>

If device is disabled by rfkill switch, do not enable all interrupts,
but only CSR_INT_BIT_RF_KILL to receive rfkill state change. Unblocking
other interrupts might cause problems, since driver can not be prepared
for receive them.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h | 6 ++++++
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 6 ++----
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 13 ++++++++-----
3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
index 4f73a6d..93d89a3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
@@ -376,6 +376,12 @@ static inline void iwl_enable_interrupts(struct iwl_trans *trans)
iwl_write32(trans, CSR_INT_MASK, trans_pcie->inta_mask);
}

+static inline void iwl_enable_rfkill_int(struct iwl_trans *trans)
+{
+ IWL_DEBUG_ISR(trans, "Enabling rfkill interrupt\n");
+ iwl_write32(trans, CSR_INT_MASK, CSR_INT_BIT_RF_KILL);
+}
+
/*
* we have 8 bits used like this:
*
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
index 5b2e47a..3eb7bd1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
@@ -1134,10 +1134,8 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
if (test_bit(STATUS_INT_ENABLED, &trans->shrd->status))
iwl_enable_interrupts(trans);
/* Re-enable RF_KILL if it occurred */
- else if (handled & CSR_INT_BIT_RF_KILL) {
- IWL_DEBUG_ISR(trans, "Enabling rfkill interrupt\n");
- iwl_write32(trans, CSR_INT_MASK, CSR_INT_BIT_RF_KILL);
- }
+ else if (handled & CSR_INT_BIT_RF_KILL)
+ iwl_enable_rfkill_int(trans);
}

/******************************************************************************
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index 75bb95e..1d35d0e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -1051,7 +1051,7 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans,
iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);

if (hw_rfkill) {
- iwl_enable_interrupts(trans);
+ iwl_enable_rfkill_int(trans);
return -ERFKILL;
}

@@ -1562,8 +1562,7 @@ static void iwl_trans_pcie_stop_hw(struct iwl_trans *trans)
iwl_write32(trans, CSR_INT, 0xFFFFFFFF);

/* Even if we stop the HW, we still want the RF kill interrupt */
- IWL_DEBUG_ISR(trans, "Enabling rfkill interrupt\n");
- iwl_write32(trans, CSR_INT_MASK, CSR_INT_BIT_RF_KILL);
+ iwl_enable_rfkill_int(trans);
}

static int iwl_trans_pcie_reclaim(struct iwl_trans *trans, int sta_id, int tid,
@@ -1656,10 +1655,14 @@ static int iwl_trans_pcie_resume(struct iwl_trans *trans)
{
bool hw_rfkill;

- iwl_enable_interrupts(trans);
-
hw_rfkill = !(iwl_read32(trans, CSR_GP_CNTRL) &
CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW);
+
+ if (hw_rfkill)
+ iwl_enable_rfkill_int(trans);
+ else
+ iwl_enable_interrupts(trans);
+
iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);

return 0;
--
1.7.0.4


2012-03-07 19:06:30

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 04/35] iwlwifi: remove unused argument from iwl_init_hw_rates

From: Johannes Berg <[email protected]>

The function never uses the priv argument as it
only fills in the passed data, so remove the
argument.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 4cd375c..397faf9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1010,8 +1010,7 @@ void iwl_cancel_deferred_work(struct iwl_priv *priv)
del_timer_sync(&priv->ucode_trace);
}

-static void iwl_init_hw_rates(struct iwl_priv *priv,
- struct ieee80211_rate *rates)
+static void iwl_init_hw_rates(struct ieee80211_rate *rates)
{
int i;

@@ -1090,7 +1089,7 @@ static int iwl_init_drv(struct iwl_priv *priv)
IWL_ERR(priv, "initializing geos failed: %d\n", ret);
goto err_free_channel_map;
}
- iwl_init_hw_rates(priv, priv->ieee_rates);
+ iwl_init_hw_rates(priv->ieee_rates);

return 0;

--
1.7.0.4


2012-03-07 19:06:42

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 31/35] iwlwifi: make iwl_init_context static

From: Johannes Berg <[email protected]>

It's not needed anywhere but during init.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-agn.h | 1 -
2 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 76ee2dd..f150edc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -488,7 +488,7 @@ static void iwl_bg_tx_flush(struct work_struct *work)
iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL);
}

-void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags)
+static void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags)
{
int i;

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h
index eb96855..5410dfd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
@@ -118,7 +118,6 @@ void iwlagn_config_ht40(struct ieee80211_conf *conf,
int iwlagn_rx_calib_result(struct iwl_priv *priv,
struct iwl_rx_cmd_buffer *rxb,
struct iwl_device_cmd *cmd);
-void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags);
int iwl_send_bt_env(struct iwl_priv *priv, u8 action, u8 type);
void iwl_send_prio_tbl(struct iwl_priv *priv);
int iwl_init_alive_start(struct iwl_priv *priv);
--
1.7.0.4


2012-03-07 19:06:27

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 01/35] iwlwifi: remove unused arguments from iwlagn_gain_computation

From: Johannes Berg <[email protected]>

The function has two arguments it never uses,
remove them.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn-calib.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
index 579679e..84cbe7b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
@@ -879,10 +879,8 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
}

static void iwlagn_gain_computation(struct iwl_priv *priv,
- u32 average_noise[NUM_RX_CHAINS],
- u16 min_average_noise_antenna_i,
- u32 min_average_noise,
- u8 default_chain)
+ u32 average_noise[NUM_RX_CHAINS],
+ u8 default_chain)
{
int i;
s32 delta_g;
@@ -1087,7 +1085,6 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
min_average_noise, min_average_noise_antenna_i);

iwlagn_gain_computation(priv, average_noise,
- min_average_noise_antenna_i, min_average_noise,
find_first_chain(hw_params(priv).valid_rx_ant));

/* Some power changes may have been made during the calibration.
--
1.7.0.4


2012-03-07 19:06:31

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 09/35] iwlwifi: remove BT handlers from lib_ops

From: Johannes Berg <[email protected]>

There's no need to have operations for
these as they simply depend on whether
the device has built-in bluetooth, so
just duplicate the information already
there (whether bt_params is present or
not).

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-2000.c | 3 ---
drivers/net/wireless/iwlwifi/iwl-6000.c | 3 ---
drivers/net/wireless/iwlwifi/iwl-agn-rx.c | 5 ++---
drivers/net/wireless/iwlwifi/iwl-agn.c | 8 ++++----
drivers/net/wireless/iwlwifi/iwl-core.h | 6 ------
5 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c
index db6df69..2c03858 100644
--- a/drivers/net/wireless/iwlwifi/iwl-2000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-2000.c
@@ -154,9 +154,6 @@ static struct iwl_lib_ops iwl2000_lib = {

static struct iwl_lib_ops iwl2030_lib = {
.set_hw_params = iwl2000_hw_set_hw_params,
- .bt_rx_handler_setup = iwlagn_bt_rx_handler_setup,
- .bt_setup_deferred_work = iwlagn_bt_setup_deferred_work,
- .cancel_deferred_work = iwlagn_bt_cancel_deferred_work,
.nic_config = iwl2000_nic_config,
.eeprom_ops = {
.regulatory_bands = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 6f7d5f0..510a5c0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -250,9 +250,6 @@ static struct iwl_lib_ops iwl6000_lib = {

static struct iwl_lib_ops iwl6030_lib = {
.set_hw_params = iwl6000_hw_set_hw_params,
- .bt_rx_handler_setup = iwlagn_bt_rx_handler_setup,
- .bt_setup_deferred_work = iwlagn_bt_setup_deferred_work,
- .cancel_deferred_work = iwlagn_bt_cancel_deferred_work,
.set_channel_switch = iwl6000_hw_channel_switch,
.nic_config = iwl6000_nic_config,
.eeprom_ops = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
index a9bdbad..e504675 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
@@ -1143,9 +1143,8 @@ void iwl_setup_rx_handlers(struct iwl_priv *priv)
iwl_notification_wait_init(&priv->notif_wait);

/* Set up BT Rx handlers */
- if (cfg(priv)->lib->bt_rx_handler_setup)
- cfg(priv)->lib->bt_rx_handler_setup(priv);
-
+ if (cfg(priv)->bt_params)
+ iwlagn_bt_rx_handler_setup(priv);
}

int iwl_rx_dispatch(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb,
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 29f40ea..5f390f8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -976,8 +976,8 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv)

iwl_setup_scan_deferred_work(priv);

- if (cfg(priv)->lib->bt_setup_deferred_work)
- cfg(priv)->lib->bt_setup_deferred_work(priv);
+ if (cfg(priv)->bt_params)
+ iwlagn_bt_setup_deferred_work(priv);

init_timer(&priv->statistics_periodic);
priv->statistics_periodic.data = (unsigned long)priv;
@@ -994,8 +994,8 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv)

void iwl_cancel_deferred_work(struct iwl_priv *priv)
{
- if (cfg(priv)->lib->cancel_deferred_work)
- cfg(priv)->lib->cancel_deferred_work(priv);
+ if (cfg(priv)->bt_params)
+ iwlagn_bt_cancel_deferred_work(priv);

cancel_work_sync(&priv->run_time_calib_work);
cancel_work_sync(&priv->beacon_update);
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index e0423c4..95f6b7b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -77,12 +77,6 @@ struct iwl_cmd;
struct iwl_lib_ops {
/* set hw dependent parameters */
void (*set_hw_params)(struct iwl_priv *priv);
- /* setup BT Rx handler */
- void (*bt_rx_handler_setup)(struct iwl_priv *priv);
- /* setup BT related deferred work */
- void (*bt_setup_deferred_work)(struct iwl_priv *priv);
- /* cancel deferred work */
- void (*cancel_deferred_work)(struct iwl_priv *priv);
int (*set_channel_switch)(struct iwl_priv *priv,
struct ieee80211_channel_switch *ch_switch);
/* device specific configuration */
--
1.7.0.4


2012-03-07 19:06:40

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 30/35] iwlwifi: remove messages from queue wake/stop

From: Johannes Berg <[email protected]>

The only reason we ever stop/wake queues at
the transport level is now that they become
full (or non-full), so the messages aren't
useful any more -- remove them.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h | 36 ++++++++++----------
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 4 +-
2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
index 14e5d52..6796559 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
@@ -411,7 +411,7 @@ static inline u8 iwl_get_queue_ac(struct iwl_tx_queue *txq)
}

static inline void iwl_wake_queue(struct iwl_trans *trans,
- struct iwl_tx_queue *txq, const char *msg)
+ struct iwl_tx_queue *txq)
{
u8 queue = txq->swq_id;
u8 ac = queue & 3;
@@ -422,19 +422,19 @@ static inline void iwl_wake_queue(struct iwl_trans *trans,
if (test_and_clear_bit(hwq, trans_pcie->queue_stopped)) {
if (atomic_dec_return(&trans_pcie->queue_stop_count[ac]) <= 0) {
iwl_op_mode_queue_not_full(trans->op_mode, ac);
- IWL_DEBUG_TX_QUEUES(trans, "Wake hwq %d ac %d. %s",
- hwq, ac, msg);
+ IWL_DEBUG_TX_QUEUES(trans, "Wake hwq %d ac %d",
+ hwq, ac);
} else {
- IWL_DEBUG_TX_QUEUES(trans, "Don't wake hwq %d ac %d"
- " stop count %d. %s",
- hwq, ac, atomic_read(&trans_pcie->
- queue_stop_count[ac]), msg);
+ IWL_DEBUG_TX_QUEUES(trans,
+ "Don't wake hwq %d ac %d stop count %d",
+ hwq, ac,
+ atomic_read(&trans_pcie->queue_stop_count[ac]));
}
}
}

static inline void iwl_stop_queue(struct iwl_trans *trans,
- struct iwl_tx_queue *txq, const char *msg)
+ struct iwl_tx_queue *txq)
{
u8 queue = txq->swq_id;
u8 ac = queue & 3;
@@ -445,19 +445,19 @@ static inline void iwl_stop_queue(struct iwl_trans *trans,
if (!test_and_set_bit(hwq, trans_pcie->queue_stopped)) {
if (atomic_inc_return(&trans_pcie->queue_stop_count[ac]) > 0) {
iwl_op_mode_queue_full(trans->op_mode, ac);
- IWL_DEBUG_TX_QUEUES(trans, "Stop hwq %d ac %d"
- " stop count %d. %s",
- hwq, ac, atomic_read(&trans_pcie->
- queue_stop_count[ac]), msg);
+ IWL_DEBUG_TX_QUEUES(trans,
+ "Stop hwq %d ac %d stop count %d",
+ hwq, ac,
+ atomic_read(&trans_pcie->queue_stop_count[ac]));
} else {
- IWL_DEBUG_TX_QUEUES(trans, "Don't stop hwq %d ac %d"
- " stop count %d. %s",
- hwq, ac, atomic_read(&trans_pcie->
- queue_stop_count[ac]), msg);
+ IWL_DEBUG_TX_QUEUES(trans,
+ "Don't stop hwq %d ac %d stop count %d",
+ hwq, ac,
+ atomic_read(&trans_pcie->queue_stop_count[ac]));
}
} else {
- IWL_DEBUG_TX_QUEUES(trans, "stop hwq %d, but it is stopped/ %s",
- hwq, msg);
+ IWL_DEBUG_TX_QUEUES(trans, "stop hwq %d, but it is stopped",
+ hwq);
}
}

diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index f28f4cb..7c80897 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -1497,7 +1497,7 @@ static int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
txq->need_update = 1;
iwl_txq_update_write_ptr(trans, txq);
} else {
- iwl_stop_queue(trans, txq, "Queue is full");
+ iwl_stop_queue(trans, txq);
}
}
spin_unlock(&txq->lock);
@@ -1601,7 +1601,7 @@ static int iwl_trans_pcie_reclaim(struct iwl_trans *trans, int sta_id, int tid,
tfd_num, ssn);
freed = iwl_tx_queue_reclaim(trans, txq_id, tfd_num, skbs);
if (iwl_queue_space(&txq->q) > txq->q.low_mark)
- iwl_wake_queue(trans, txq, "Packets reclaimed");
+ iwl_wake_queue(trans, txq);
}

spin_unlock(&txq->lock);
--
1.7.0.4


2012-03-08 19:41:58

by Wey-Yi Guy

[permalink] [raw]
Subject: Re: [PATCH RESEND 33/35] iwlwifi: restore PAN support

Hi John,

Thank you, we will fix and re-send

Wey

On Thu, 2012-03-08 at 14:20 -0500, John W. Linville wrote:
> This one didn't apply either. Please check against wireless-next.
>
> Thanks,
>
> John
>
> On Wed, Mar 07, 2012 at 09:52:41AM -0800, Wey-Yi Guy wrote:
> > From: Emmanuel Grumbach <[email protected]>
> >
> > in iwlwifi: move setting up fw parameters
> >
> > Meenakshi moved code up to configure the transport layer, but this
> > code read the sku before it was set (from the EEPROM). This killed
> > P2P.
> > Only the ucode_flags are needed to configure the transport layer, not
> > the sku which _must_ be set after the EEPROM is read.
> >
> > We need to reconfigure the transport in case the EEPROM disabled PAN
> > support. This is not the nicest thing to do, but we have no choice.
> > Document that we are allowed to configure the transport several times
> > before start_fw, but not after.
> >
> > Signed-off-by: Emmanuel Grumbach <[email protected]>
> > Signed-off-by: Wey-Yi Guy <[email protected]>
> > ---
> > drivers/net/wireless/iwlwifi/iwl-agn.c | 59 +++++++++++++++---------------
> > drivers/net/wireless/iwlwifi/iwl-trans.h | 3 +-
> > 2 files changed, 32 insertions(+), 30 deletions(-)
> >
> > diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
> > index f150edc..3793dc4 100644
> > --- a/drivers/net/wireless/iwlwifi/iwl-agn.c
> > +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
> > @@ -1206,35 +1206,17 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
> > /* TODO: remove fw from shared data later */
> > priv->shrd->fw = fw;
> >
> > - /************************
> > - * 2. Setup HW constants
> > - ************************/
> > - iwl_set_hw_params(priv);
> > + /*
> > + * Populate the state variables that the transport layer needs
> > + * to know about.
> > + */
> > + trans_cfg.op_mode = op_mode;
> >
> > ucode_flags = fw->ucode_capa.flags;
> >
> > #ifndef CONFIG_IWLWIFI_P2P
> > ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
> > #endif
> > - if (!(hw_params(priv).sku & EEPROM_SKU_CAP_IPAN_ENABLE))
> > - ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
> > -
> > - /*
> > - * if not PAN, then don't support P2P -- might be a uCode
> > - * packaging bug or due to the eeprom check above
> > - */
> > - if (!(ucode_flags & IWL_UCODE_TLV_FLAGS_PAN))
> > - ucode_flags &= ~IWL_UCODE_TLV_FLAGS_P2P;
> > -
> > -
> > - /*****************************
> > - * Configure transport layer
> > - *****************************/
> > - /*
> > - * Populate the state variables that the transport layer needs
> > - * to know about.
> > - */
> > - trans_cfg.op_mode = op_mode;
> >
> > if (ucode_flags & IWL_UCODE_TLV_FLAGS_PAN) {
> > priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
> > @@ -1277,7 +1259,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
> > spin_lock_init(&priv->statistics.lock);
> >
> > /***********************
> > - * 3. Read REV register
> > + * 2. Read REV register
> > ***********************/
> > IWL_INFO(priv, "Detected %s, REV=0x%X\n",
> > cfg(priv)->name, trans(priv)->hw_rev);
> > @@ -1287,9 +1269,8 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
> > goto out_free_traffic_mem;
> >
> > /*****************
> > - * 4. Read EEPROM
> > + * 3. Read EEPROM
> > *****************/
> > - /* Read the EEPROM */
> > err = iwl_eeprom_init(trans(priv), trans(priv)->hw_rev);
> > /* Reset chip to save power until we load uCode during "up". */
> > iwl_trans_stop_hw(trans(priv));
> > @@ -1318,8 +1299,28 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
> > priv->hw->wiphy->n_addresses++;
> > }
> >
> > + /************************
> > + * 4. Setup HW constants
> > + ************************/
> > + iwl_set_hw_params(priv);
> > +
> > + if (!(hw_params(priv).sku & EEPROM_SKU_CAP_IPAN_ENABLE)) {
> > + IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN");
> > + ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
> > + /*
> > + * if not PAN, then don't support P2P -- might be a uCode
> > + * packaging bug or due to the eeprom check above
> > + */
> > + ucode_flags &= ~IWL_UCODE_TLV_FLAGS_P2P;
> > + priv->sta_key_max_num = STA_KEY_MAX_NUM;
> > + trans_cfg.cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
> > +
> > + /* Configure transport layer again*/
> > + iwl_trans_configure(trans(priv), &trans_cfg);
> > + }
> > +
> > /*******************
> > - * 6. Setup priv
> > + * 5. Setup priv
> > *******************/
> >
> > err = iwl_init_drv(priv);
> > @@ -1328,7 +1329,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
> > /* At this point both hw and priv are initialized. */
> >
> > /********************
> > - * 7. Setup services
> > + * 6. Setup services
> > ********************/
> > iwl_setup_deferred_work(priv);
> > iwl_setup_rx_handlers(priv);
> > @@ -1355,7 +1356,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
> > /**************************************************
> > * This is still part of probe() in a sense...
> > *
> > - * 9. Setup and register with mac80211 and debugfs
> > + * 7. Setup and register with mac80211 and debugfs
> > **************************************************/
> > err = iwlagn_mac_setup_register(priv, &fw->ucode_capa);
> > if (err)
> > diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
> > index a40c272..7d1990c 100644
> > --- a/drivers/net/wireless/iwlwifi/iwl-trans.h
> > +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
> > @@ -335,7 +335,8 @@ struct iwl_trans_config {
> > * @write32: write a u32 to a register at offset ofs from the BAR
> > * @read32: read a u32 register at offset ofs from the BAR
> > * @configure: configure parameters required by the transport layer from
> > - * the op_mode.
> > + * the op_mode. May be called several times before start_fw, can't be
> > + * called after that.
> > */
> > struct iwl_trans_ops {
> >
> > --
> > 1.7.0.4
> >
> >
>



2012-03-07 19:06:36

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 22/35] iwlwifi: add option to test MFP

From: David Spinadel <[email protected]>

Add a Kconfig symbol to enable MFP for testing even
if the firmware file doesn't advertise it.

Signed-off-by: David Spinadel <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/Kconfig | 9 +++++++++
drivers/net/wireless/iwlwifi/iwl-mac80211.c | 3 +++
2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig
index 5afd06e..2fe6273 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -127,3 +127,12 @@ config IWLWIFI_P2P
support when it is loaded.

Say Y only if you want to experiment with P2P.
+
+config IWLWIFI_EXPERIMENTAL_MFP
+ bool "support MFP (802.11w) even if uCode doesn't advertise"
+ depends on IWLWIFI
+ help
+ This option enables experimental MFP (802.11W) support
+ even if the microcode doesn't advertise it.
+
+ Say Y only if you want to experiment with MFP.
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
index 91a42c3..dcf39f8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c
+++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
@@ -163,7 +163,10 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS |
IEEE80211_HW_SUPPORTS_STATIC_SMPS;

+#ifndef CONFIG_IWLWIFI_EXPERIMENTAL_MFP
+ /* enable 11w if the uCode advertise */
if (capa->flags & IWL_UCODE_TLV_FLAGS_MFP)
+#endif /* !CONFIG_IWLWIFI_EXPERIMENTAL_MFP */
hw->flags |= IEEE80211_HW_MFP_CAPABLE;

hw->sta_data_size = sizeof(struct iwl_station_priv);
--
1.7.0.4


2012-03-07 19:06:31

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH RESEND 11/35] iwlwifi: make EEPROM enhanced TX power a bool

From: Johannes Berg <[email protected]>

There's no need to carry around the function
pointer when a boolean indicating that the
EEPROM stores enhanced TX power information
is sufficient.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-2000.c | 4 ++--
drivers/net/wireless/iwlwifi/iwl-6000.c | 4 ++--
drivers/net/wireless/iwlwifi/iwl-agn.h | 1 -
drivers/net/wireless/iwlwifi/iwl-eeprom.c | 6 +++---
drivers/net/wireless/iwlwifi/iwl-eeprom.h | 2 +-
5 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c
index 2c03858..6931820 100644
--- a/drivers/net/wireless/iwlwifi/iwl-2000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-2000.c
@@ -147,7 +147,7 @@ static struct iwl_lib_ops iwl2000_lib = {
EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
EEPROM_REGULATORY_BAND_NO_HT40,
},
- .update_enhanced_txpower = iwl_eeprom_enhanced_txpower,
+ .enhanced_txpower = true,
},
.temperature = iwlagn_temperature,
};
@@ -165,7 +165,7 @@ static struct iwl_lib_ops iwl2030_lib = {
EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
EEPROM_REGULATORY_BAND_NO_HT40,
},
- .update_enhanced_txpower = iwl_eeprom_enhanced_txpower,
+ .enhanced_txpower = true,
},
.temperature = iwlagn_temperature,
};
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 510a5c0..9fbab01 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -243,7 +243,7 @@ static struct iwl_lib_ops iwl6000_lib = {
EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
EEPROM_REG_BAND_52_HT40_CHANNELS
},
- .update_enhanced_txpower = iwl_eeprom_enhanced_txpower,
+ .enhanced_txpower = true,
},
.temperature = iwlagn_temperature,
};
@@ -262,7 +262,7 @@ static struct iwl_lib_ops iwl6030_lib = {
EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
EEPROM_REG_BAND_52_HT40_CHANNELS
},
- .update_enhanced_txpower = iwl_eeprom_enhanced_txpower,
+ .enhanced_txpower = true,
},
.temperature = iwlagn_temperature,
};
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h
index b56498b..6345ab0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
@@ -305,7 +305,6 @@ static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u32 flags)
}

/* eeprom */
-void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv);
void iwl_eeprom_get_mac(const struct iwl_shared *shrd, u8 *mac);

extern int iwl_alive_start(struct iwl_priv *priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
index e2d8084..23cea42 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
@@ -589,7 +589,7 @@ iwl_eeprom_enh_txp_read_element(struct iwl_priv *priv,
#define TXP_CHECK_AND_PRINT(x) ((txp->flags & IWL_EEPROM_ENH_TXP_FL_##x) \
? # x " " : "")

-void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv)
+static void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv)
{
struct iwl_shared *shrd = priv->shrd;
struct iwl_eeprom_enhanced_txpwr *txp_array, *txp;
@@ -1025,8 +1025,8 @@ int iwl_init_channel_map(struct iwl_priv *priv)
* driver need to process addition information
* to determine the max channel tx power limits
*/
- if (cfg(priv)->lib->eeprom_ops.update_enhanced_txpower)
- cfg(priv)->lib->eeprom_ops.update_enhanced_txpower(priv);
+ if (cfg(priv)->lib->eeprom_ops.enhanced_txpower)
+ iwl_eeprom_enhanced_txpower(priv);

return 0;
}
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index 3b17056..e4a7583 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -302,7 +302,7 @@ extern const u8 iwl_eeprom_band_1[14];

struct iwl_eeprom_ops {
const u32 regulatory_bands[7];
- void (*update_enhanced_txpower) (struct iwl_priv *priv);
+ bool enhanced_txpower;
};


--
1.7.0.4