2008-12-22 03:38:39

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 00/10] iwlwifi driver 12/22 updates

Hi John,

Patches 7~9 are generic iwlwifi cleanup. Others are iwl3945 merging into
iwlagn patches, among which patch 10 should fix a regression reported by
Kalle Valo.

Thanks,
-yi

[PATCH 01/10] iwl3945: rearrange 3945 tfd
[PATCH 02/10] iwl3945: adding utils ops
[PATCH 03/10] iwl3945: sync tx queue data structure with iwlagn
[PATCH 04/10] iwl3945: remove iwl-3945-led.[ch]
[PATCH 05/10] iwl3945: switch to the iwl-core send_card_state routine
[PATCH 06/10] iwl3945: use iwl3945_tx_cmd instead of iwl_tx_cmd
[PATCH 07/10] iwlwifi: move sysfs status entry to debugfs
[PATCH 08/10] iwlwifi: kill retry_rate sysfs for iwlagn
[PATCH 09/10] iwlwifi: fix warning 'Should it be static'
[PATCH 10/10] iwl3945: use rx queue management infrastructure from iwlcore


2008-12-25 02:20:19

by Sedat Dilek

[permalink] [raw]
Subject: Re: [PATCH 10/10] iwl3945: use rx queue management infrastructure from iwlcore

With wireless-testing master-2008-12-23 (also plus 2.6.28-rc9-git4
patch) everthing OK in iwl3945-world.
Both Linux kernel works fine.
Thank you for the gift.

-Sedat

# env COLUMNS=250 dpkg -l | grep linux-image | grep 2.6.28-rc9
ii linux-image-2.6.28-rc9-git4-wl-gcc44
2.6.28~rc9+git4+wl~git20081223.fd1dae5~dileX+1 Linux kernel
binary image for version 2.6.28-rc9-git4-wl-gcc44
ii linux-image-2.6.28-rc9-wl-gcc44
2.6.28~rc9+wl~git20081223.fd1dae5~dileX+1 Linux kernel
binary image for version 2.6.28-rc9-wl-gcc44

On Tue, Dec 23, 2008 at 9:43 PM, Kalle Valo <[email protected]> wrote:
> Zhu Yi <[email protected]> writes:
>
>> On Mon, 2008-12-22 at 22:07 +0800, Kalle Valo wrote:
>>> Yes, ifconfig up works but now iwlist wlan0 scan crashes. I just
>>> tested this once due to lack of time.
>>>
>>> I hope I get my wifi working before Christmas ;)
>>
>> http://marc.info/?l=linux-wireless&m=123000088608330&w=2 should fix the
>> problem. Thanks a lot for your testing.
>
> Yes, that patch fixed it. Now my wifi is working again, thank you for
> the present! :)
>
> Just to be clear, these are the patches I have applied on top of
> current wireless-testing:
>
> Revert "iwl3945: remove iwl-3945-led.[ch]"
> iwl3945: use rx queue management infrastructure from iwlcore
> iwlwifi: fix warning 'Should it be static'
> iwlwifi: kill retry_rate sysfs for iwlagn
> iwlwifi: move sysfs status entry to debugfs
> iwl3945: use iwl3945_tx_cmd instead of iwl_tx_cmd
> iwl3945: switch to the iwl-core send_card_state routine
> iwl3945: remove iwl-3945-led.[ch]
> iwl3945: sync tx queue data structure with iwlagn
> iwl3945: adding utils ops
> iwl3945: rearrange 3945 tfd
>
> If I spot any regressions, you will hear from me ;)
>
> --
> Kalle Valo
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2008-12-22 03:38:41

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 02/10] iwl3945: adding utils ops

From: Kolekar, Abhijeet <[email protected]>

The patch implements iwl_hcmd_utils_ops for 3945.

Signed-off-by: Samuel Ortiz <[email protected]>
Signed-off-by: Abhijeet Kolekar <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-3945.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 24cdc5c..a0aea81 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -2377,6 +2377,19 @@ int iwl3945_hw_tx_queue_init(struct iwl_priv *priv, struct iwl3945_tx_queue *txq
return 0;
}

+/*
+ * HCMD utils
+ */
+static u16 iwl3945_get_hcmd_size(u8 cmd_id, u16 len)
+{
+ switch (cmd_id) {
+ case REPLY_RXON:
+ return (u16) sizeof(struct iwl3945_rxon_cmd);
+ default:
+ return len;
+ }
+}
+
/**
* iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table
*/
@@ -2694,8 +2707,13 @@ static struct iwl_lib_ops iwl3945_lib = {
},
};

+static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = {
+ .get_hcmd_size = iwl3945_get_hcmd_size,
+};
+
static struct iwl_ops iwl3945_ops = {
.lib = &iwl3945_lib,
+ .utils = &iwl3945_hcmd_utils,
};

static struct iwl_cfg iwl3945_bg_cfg = {
--
1.5.3.6


2008-12-22 03:38:48

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 07/10] iwlwifi: move sysfs status entry to debugfs

From: Winkler, Tomas <[email protected]>

This patch moves priv->status sysfs entry to debugfs. It is for
debugging only anyway.

Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 11 -----------
drivers/net/wireless/iwlwifi/iwl-debug.h | 1 +
drivers/net/wireless/iwlwifi/iwl-debugfs.c | 10 +++++++++-
3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 05cd04c..ecf8141 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3667,16 +3667,6 @@ static ssize_t show_statistics(struct device *d,

static DEVICE_ATTR(statistics, S_IRUGO, show_statistics, NULL);

-static ssize_t show_status(struct device *d,
- struct device_attribute *attr, char *buf)
-{
- struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
- if (!iwl_is_alive(priv))
- return -EAGAIN;
- return sprintf(buf, "0x%08x\n", (int)priv->status);
-}
-
-static DEVICE_ATTR(status, S_IRUGO, show_status, NULL);

/*****************************************************************************
*
@@ -3732,7 +3722,6 @@ static struct attribute *iwl_sysfs_entries[] = {
&dev_attr_power_level.attr,
&dev_attr_retry_rate.attr,
&dev_attr_statistics.attr,
- &dev_attr_status.attr,
&dev_attr_temperature.attr,
&dev_attr_tx_power.attr,
#ifdef CONFIG_IWLWIFI_DEBUG
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
index 798f946..057781c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
@@ -72,6 +72,7 @@ struct iwl_debugfs {
struct dentry *file_tx_statistics;
struct dentry *file_log_event;
struct dentry *file_channels;
+ struct dentry *file_status;
} dbgfs_data_files;
struct dir_rf_files {
struct dentry *file_disable_sensitivity;
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index ecb3900..61949c8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -63,6 +63,14 @@
goto err; \
} while (0)

+#define DEBUGFS_ADD_X32(name, parent, ptr) do { \
+ dbgfs->dbgfs_##parent##_files.file_##name = \
+ debugfs_create_x32(#name, 0444, dbgfs->dir_##parent, ptr); \
+ if (IS_ERR(dbgfs->dbgfs_##parent##_files.file_##name) \
+ || !dbgfs->dbgfs_##parent##_files.file_##name) \
+ goto err; \
+} while (0)
+
#define DEBUGFS_REMOVE(name) do { \
debugfs_remove(name); \
name = NULL; \
@@ -419,7 +427,6 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
return ret;
}

-
DEBUGFS_READ_WRITE_FILE_OPS(sram);
DEBUGFS_WRITE_FILE_OPS(log_event);
DEBUGFS_READ_FILE_OPS(eeprom);
@@ -461,6 +468,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
DEBUGFS_ADD_FILE(rx_statistics, data);
DEBUGFS_ADD_FILE(tx_statistics, data);
DEBUGFS_ADD_FILE(channels, data);
+ DEBUGFS_ADD_X32(status, data, (u32 *)&priv->status);
DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal);
DEBUGFS_ADD_BOOL(disable_chain_noise, rf,
&priv->disable_chain_noise_cal);
--
1.5.3.6


2008-12-22 03:55:28

by Harvey Harrison

[permalink] [raw]
Subject: Re: [PATCH 01/10] iwl3945: rearrange 3945 tfd

A few small things I noticed:

On Mon, 2008-12-22 at 11:31 +0800, Zhu Yi wrote:
> From: Winkler, Tomas <[email protected]>
> diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-fh.h b/drivers/net/wireless/iwlwifi/iwl-3945-fh.h
> index bbcd0ce..53ed249 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-3945-fh.h
> +++ b/drivers/net/wireless/iwlwifi/iwl-3945-fh.h
> @@ -172,7 +172,17 @@
>
> #define FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000)
>
> -#define TFD_QUEUE_SIZE_MAX (256)
> +struct iwl3945_tfd_tb {
> + __le32 addr;
> + __le32 len;
> +} __attribute__ ((packed));
> +
> +struct iwl3945_tfd {
> + __le32 control_flags;
> + struct iwl3945_tfd_tb tbs[4];
> + u8 __pad[28];
> +} __attribute__ ((packed));
> +

Packed doesn't really buy anything with these two structs, if you still
want it, you can also use plain __packed (see compiler-gcc.h)

> static inline u8 iwl3945_hw_get_rate(__le16 rate_n_flags)
> {
> return le16_to_cpu(rate_n_flags) & 0xFF;
> diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
> index 131bae7..24cdc5c 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-3945.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
> @@ -38,6 +38,7 @@
> #include <asm/unaligned.h>
> #include <net/mac80211.h>
>
> +#include "iwl-fh.h"
> #include "iwl-3945-fh.h"
> #include "iwl-commands.h"
> #include "iwl-3945.h"
> @@ -307,7 +308,7 @@ static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv,
> {
> struct iwl3945_tx_queue *txq = &priv->txq39[txq_id];
> struct iwl_queue *q = &txq->q;
> - struct iwl3945_tx_info *tx_info;
> + struct iwl_tx_info *tx_info;
>
> BUG_ON(txq_id == IWL_CMD_QUEUE_NUM);
>
> @@ -728,7 +729,7 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr,
> {
> int count;
> u32 pad;
> - struct iwl3945_tfd_frame *tfd = (struct iwl3945_tfd_frame *)ptr;
> + struct iwl3945_tfd *tfd = (struct iwl3945_tfd *)ptr;

void pointer, no cast needed (although maybe that should get cleaned up.

Cheers,

Harvey


2008-12-22 03:38:40

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 01/10] iwl3945: rearrange 3945 tfd

From: Winkler, Tomas <[email protected]>

This patch moves 3945 TFD structures to iwl-3945-fh.h. It renames them
similarly to AGN naming. This patch also eliminates iwl3945_tx_info and
fixes endianity issue in iwl3945_tx_skb and iwl3945_enqueue_hcmd caused
by ugly casting.

Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-3945-fh.h | 12 +++++++-
drivers/net/wireless/iwlwifi/iwl-3945-hw.h | 11 -------
drivers/net/wireless/iwlwifi/iwl-3945.c | 19 +++++++------
drivers/net/wireless/iwlwifi/iwl-3945.h | 8 +-----
drivers/net/wireless/iwlwifi/iwl-dev.h | 13 +++++----
drivers/net/wireless/iwlwifi/iwl3945-base.c | 40 +++++++++++---------------
6 files changed, 46 insertions(+), 57 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-fh.h b/drivers/net/wireless/iwlwifi/iwl-3945-fh.h
index bbcd0ce..53ed249 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-fh.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-fh.h
@@ -172,7 +172,17 @@

#define FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000)

-#define TFD_QUEUE_SIZE_MAX (256)
+struct iwl3945_tfd_tb {
+ __le32 addr;
+ __le32 len;
+} __attribute__ ((packed));
+
+struct iwl3945_tfd {
+ __le32 control_flags;
+ struct iwl3945_tfd_tb tbs[4];
+ u8 __pad[28];
+} __attribute__ ((packed));
+

#endif /* __iwl_3945_fh_h__ */

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
index fc1b774..1ba59df 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
@@ -304,17 +304,6 @@ struct iwl3945_shared {
__le32 tx_base_ptr[8];
} __attribute__ ((packed));

-struct iwl3945_tfd_frame_data {
- __le32 addr;
- __le32 len;
-} __attribute__ ((packed));
-
-struct iwl3945_tfd_frame {
- __le32 control_flags;
- struct iwl3945_tfd_frame_data pa[4];
- u8 reserved[28];
-} __attribute__ ((packed));
-
static inline u8 iwl3945_hw_get_rate(__le16 rate_n_flags)
{
return le16_to_cpu(rate_n_flags) & 0xFF;
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 131bae7..24cdc5c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -38,6 +38,7 @@
#include <asm/unaligned.h>
#include <net/mac80211.h>

+#include "iwl-fh.h"
#include "iwl-3945-fh.h"
#include "iwl-commands.h"
#include "iwl-3945.h"
@@ -307,7 +308,7 @@ static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv,
{
struct iwl3945_tx_queue *txq = &priv->txq39[txq_id];
struct iwl_queue *q = &txq->q;
- struct iwl3945_tx_info *tx_info;
+ struct iwl_tx_info *tx_info;

BUG_ON(txq_id == IWL_CMD_QUEUE_NUM);

@@ -728,7 +729,7 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr,
{
int count;
u32 pad;
- struct iwl3945_tfd_frame *tfd = (struct iwl3945_tfd_frame *)ptr;
+ struct iwl3945_tfd *tfd = (struct iwl3945_tfd *)ptr;

count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags));
pad = TFD_CTL_PAD_GET(le32_to_cpu(tfd->control_flags));
@@ -739,8 +740,8 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr,
return -EINVAL;
}

- tfd->pa[count].addr = cpu_to_le32(addr);
- tfd->pa[count].len = cpu_to_le32(len);
+ tfd->tbs[count].addr = cpu_to_le32(addr);
+ tfd->tbs[count].len = cpu_to_le32(len);

count++;

@@ -757,8 +758,8 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr,
*/
int iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl3945_tx_queue *txq)
{
- struct iwl3945_tfd_frame *bd_tmp = (struct iwl3945_tfd_frame *)&txq->bd[0];
- struct iwl3945_tfd_frame *bd = &bd_tmp[txq->q.read_ptr];
+ struct iwl3945_tfd *tfd_tmp = (struct iwl3945_tfd *)&txq->tfds[0];
+ struct iwl3945_tfd *tfd = &tfd_tmp[txq->q.read_ptr];
struct pci_dev *dev = priv->pci_dev;
int i;
int counter;
@@ -769,7 +770,7 @@ int iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl3945_tx_queue *txq)
return 0;

/* sanity check */
- counter = TFD_CTL_COUNT_GET(le32_to_cpu(bd->control_flags));
+ counter = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags));
if (counter > NUM_TFD_CHUNKS) {
IWL_ERR(priv, "Too many chunks: %i\n", counter);
/* @todo issue fatal error, it is quite serious situation */
@@ -779,8 +780,8 @@ int iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl3945_tx_queue *txq)
/* unmap chunks if any */

for (i = 1; i < counter; i++) {
- pci_unmap_single(dev, le32_to_cpu(bd->pa[i].addr),
- le32_to_cpu(bd->pa[i].len), PCI_DMA_TODEVICE);
+ pci_unmap_single(dev, le32_to_cpu(tfd->tbs[i].addr),
+ le32_to_cpu(tfd->tbs[i].len), PCI_DMA_TODEVICE);
if (txq->txb[txq->q.read_ptr].skb[0]) {
struct sk_buff *skb = txq->txb[txq->q.read_ptr].skb[0];
if (txq->txb[txq->q.read_ptr].skb[0]) {
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index aff6a3a..716c4b4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -45,6 +45,7 @@ extern struct pci_device_id iwl3945_hw_card_ids[];

#include "iwl-csr.h"
#include "iwl-prph.h"
+#include "iwl-fh.h"
#include "iwl-3945-hw.h"
#include "iwl-debug.h"
#include "iwl-power.h"
@@ -107,13 +108,6 @@ enum iwl3945_antenna {

int iwl3945_x2_queue_used(const struct iwl_queue *q, int i);

-#define MAX_NUM_OF_TBS (20)
-
-/* One for each TFD */
-struct iwl3945_tx_info {
- struct sk_buff *skb[MAX_NUM_OF_TBS];
-};
-
#include "iwl-agn-rs.h"

#define IWL_TX_FIFO_AC0 0
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 8981c05..1ad4d08 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -36,14 +36,15 @@
#include <linux/kernel.h>
#include <net/ieee80211_radiotap.h>

-#include "iwl-rfkill.h"
#include "iwl-eeprom.h"
-#include "iwl-4965-hw.h"
-#include "iwl-3945-hw.h"
-#include "iwl-3945-led.h"
#include "iwl-csr.h"
#include "iwl-prph.h"
+#include "iwl-fh.h"
#include "iwl-debug.h"
+#include "iwl-rfkill.h"
+#include "iwl-4965-hw.h"
+#include "iwl-3945-hw.h"
+#include "iwl-3945-led.h"
#include "iwl-led.h"
#include "iwl-power.h"
#include "iwl-agn-rs.h"
@@ -239,10 +240,10 @@ struct iwl_channel_info {
*/
struct iwl3945_tx_queue {
struct iwl_queue q;
- struct iwl3945_tfd_frame *bd;
+ struct iwl3945_tfd *tfds;
struct iwl_cmd *cmd;
dma_addr_t dma_addr_cmd;
- struct iwl3945_tx_info *txb;
+ struct iwl_tx_info *txb;
int need_update;
int active;
};
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 4b4ed65..5a0e25b 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -48,9 +48,10 @@

#define DRV_NAME "iwl3945"

+#include "iwl-fh.h"
+#include "iwl-3945-fh.h"
#include "iwl-commands.h"
#include "iwl-3945.h"
-#include "iwl-3945-fh.h"
#include "iwl-helpers.h"
#include "iwl-core.h"
#include "iwl-dev.h"
@@ -180,13 +181,13 @@ static int iwl3945_tx_queue_alloc(struct iwl_priv *priv,

/* Circular buffer of transmit frame descriptors (TFDs),
* shared with device */
- txq->bd = pci_alloc_consistent(dev,
- sizeof(txq->bd[0]) * TFD_QUEUE_SIZE_MAX,
+ txq->tfds = pci_alloc_consistent(dev,
+ sizeof(txq->tfds[0]) * TFD_QUEUE_SIZE_MAX,
&txq->q.dma_addr);

- if (!txq->bd) {
+ if (!txq->tfds) {
IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n",
- sizeof(txq->bd[0]) * TFD_QUEUE_SIZE_MAX);
+ sizeof(txq->tfds[0]) * TFD_QUEUE_SIZE_MAX);
goto error;
}
txq->q.id = id;
@@ -278,8 +279,8 @@ void iwl3945_tx_queue_free(struct iwl_priv *priv, struct iwl3945_tx_queue *txq)

/* De-alloc circular buffer of TFDs */
if (txq->q.n_bd)
- pci_free_consistent(dev, sizeof(struct iwl3945_tfd_frame) *
- txq->q.n_bd, txq->bd, txq->q.dma_addr);
+ pci_free_consistent(dev, sizeof(struct iwl3945_tfd) *
+ txq->q.n_bd, txq->tfds, txq->q.dma_addr);

/* De-alloc array of per-TFD driver data */
kfree(txq->txb);
@@ -446,14 +447,12 @@ static int iwl3945_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
{
struct iwl3945_tx_queue *txq = &priv->txq39[IWL_CMD_QUEUE_NUM];
struct iwl_queue *q = &txq->q;
- struct iwl3945_tfd_frame *tfd;
- u32 *control_flags;
+ struct iwl3945_tfd *tfd;
struct iwl_cmd *out_cmd;
u32 idx;
u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr));
dma_addr_t phys_addr;
int pad;
- u16 count;
int ret;
unsigned long flags;

@@ -476,11 +475,9 @@ static int iwl3945_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)

spin_lock_irqsave(&priv->hcmd_lock, flags);

- tfd = &txq->bd[q->write_ptr];
+ tfd = &txq->tfds[q->write_ptr];
memset(tfd, 0, sizeof(*tfd));

- control_flags = (u32 *) tfd;
-
idx = get_cmd_index(q, q->write_ptr, cmd->meta.flags & CMD_SIZE_HUGE);
out_cmd = &txq->cmd[idx];

@@ -502,8 +499,7 @@ static int iwl3945_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size);

pad = U32_PAD(cmd->len);
- count = TFD_CTL_COUNT_GET(*control_flags);
- *control_flags = TFD_CTL_COUNT_SET(count) | TFD_CTL_PAD_SET(pad);
+ tfd->control_flags |= cpu_to_le32(TFD_CTL_PAD_SET(pad));

IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, "
"%d bytes at %d[%d]:%d\n",
@@ -2235,8 +2231,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
{
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
- struct iwl3945_tfd_frame *tfd;
- u32 *control_flags;
+ struct iwl3945_tfd *tfd;
int txq_id = skb_get_queue_mapping(skb);
struct iwl3945_tx_queue *txq = NULL;
struct iwl_queue *q = NULL;
@@ -2323,13 +2318,12 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
spin_lock_irqsave(&priv->lock, flags);

/* Set up first empty TFD within this queue's circular TFD buffer */
- tfd = &txq->bd[q->write_ptr];
+ tfd = &txq->tfds[q->write_ptr];
memset(tfd, 0, sizeof(*tfd));
- control_flags = (u32 *) tfd;
idx = get_cmd_index(q, q->write_ptr, 0);

/* Set up driver data for this TFD */
- memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl3945_tx_info));
+ memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info));
txq->txb[q->write_ptr].skb[0] = skb;

/* Init first empty entry in queue's array of Tx/cmd buffers */
@@ -2393,12 +2387,12 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)

if (!len)
/* If there is no payload, then we use only one Tx buffer */
- *control_flags = TFD_CTL_COUNT_SET(1);
+ tfd->control_flags = cpu_to_le32(TFD_CTL_COUNT_SET(1));
else
/* Else use 2 buffers.
* Tell 3945 about any padding after MAC header */
- *control_flags = TFD_CTL_COUNT_SET(2) |
- TFD_CTL_PAD_SET(U32_PAD(len));
+ tfd->control_flags = cpu_to_le32(TFD_CTL_COUNT_SET(2) |
+ TFD_CTL_PAD_SET(U32_PAD(len)));

/* Total # bytes to be transmitted */
len = (u16)skb->len;
--
1.5.3.6


2008-12-23 20:43:16

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 10/10] iwl3945: use rx queue management infrastructure from iwlcore

Zhu Yi <[email protected]> writes:

> On Mon, 2008-12-22 at 22:07 +0800, Kalle Valo wrote:
>> Yes, ifconfig up works but now iwlist wlan0 scan crashes. I just
>> tested this once due to lack of time.
>>
>> I hope I get my wifi working before Christmas ;)
>
> http://marc.info/?l=linux-wireless&m=123000088608330&w=2 should fix the
> problem. Thanks a lot for your testing.

Yes, that patch fixed it. Now my wifi is working again, thank you for
the present! :)

Just to be clear, these are the patches I have applied on top of
current wireless-testing:

Revert "iwl3945: remove iwl-3945-led.[ch]"
iwl3945: use rx queue management infrastructure from iwlcore
iwlwifi: fix warning 'Should it be static'
iwlwifi: kill retry_rate sysfs for iwlagn
iwlwifi: move sysfs status entry to debugfs
iwl3945: use iwl3945_tx_cmd instead of iwl_tx_cmd
iwl3945: switch to the iwl-core send_card_state routine
iwl3945: remove iwl-3945-led.[ch]
iwl3945: sync tx queue data structure with iwlagn
iwl3945: adding utils ops
iwl3945: rearrange 3945 tfd

If I spot any regressions, you will hear from me ;)

--
Kalle Valo

2008-12-22 03:38:45

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 05/10] iwl3945: switch to the iwl-core send_card_state routine

From: Samuel Ortiz <[email protected]>

Switch iwl3945 to use iwl-core:send_card_state routine.

Signed-off-by: Samuel Ortiz <[email protected]>
Signed-off-by: Abhijeet Kolekar <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-core.c | 3 +-
drivers/net/wireless/iwlwifi/iwl-core.h | 3 ++
drivers/net/wireless/iwlwifi/iwl3945-base.c | 34 +--------------------------
3 files changed, 6 insertions(+), 34 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index d3bcbba..eaae79b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1370,7 +1370,7 @@ EXPORT_SYMBOL(iwl_rf_kill_ct_config);
* When in the 'halt' state, the card is shut down and must be fully
* restarted to come back on.
*/
-static int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag)
+int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag)
{
struct iwl_host_cmd cmd = {
.id = REPLY_CARD_STATE_CMD,
@@ -1381,6 +1381,7 @@ static int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag)

return iwl_send_cmd(priv, &cmd);
}
+EXPORT_SYMBOL(iwl_send_card_state);

void iwl_radio_kill_sw_disable_radio(struct iwl_priv *priv)
{
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 7c3a20a..2abda89 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -342,6 +342,9 @@ int iwl_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len,

int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd);

+int iwl_send_card_state(struct iwl_priv *priv, u32 flags,
+ u8 meta_flag);
+
/*****************************************************
* PCI *
*****************************************************/
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 408a6d0..7cace6d 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1078,38 +1078,6 @@ static int iwl3945_send_scan_abort(struct iwl_priv *priv)
return rc;
}

-static int iwl3945_card_state_sync_callback(struct iwl_priv *priv,
- struct iwl_cmd *cmd,
- struct sk_buff *skb)
-{
- return 1;
-}
-
-/*
- * CARD_STATE_CMD
- *
- * Use: Sets the device's internal card state to enable, disable, or halt
- *
- * When in the 'enable' state the card operates as normal.
- * When in the 'disable' state, the card enters into a low power mode.
- * When in the 'halt' state, the card is shut down and must be fully
- * restarted to come back on.
- */
-static int iwl3945_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag)
-{
- struct iwl_host_cmd cmd = {
- .id = REPLY_CARD_STATE_CMD,
- .len = sizeof(u32),
- .data = &flags,
- .meta.flags = meta_flag,
- };
-
- if (meta_flag & CMD_ASYNC)
- cmd.meta.u.callback = iwl3945_card_state_sync_callback;
-
- return iwl3945_send_cmd(priv, &cmd);
-}
-
static int iwl3945_add_sta_sync_callback(struct iwl_priv *priv,
struct iwl_cmd *cmd, struct sk_buff *skb)
{
@@ -2548,7 +2516,7 @@ static void iwl3945_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
iwl_write32(priv, CSR_UCODE_DRV_GP1_SET,
CSR_UCODE_SW_BIT_RFKILL);
spin_unlock_irqrestore(&priv->lock, flags);
- iwl3945_send_card_state(priv, CARD_STATE_CMD_DISABLE, 0);
+ iwl_send_card_state(priv, CARD_STATE_CMD_DISABLE, 0);
set_bit(STATUS_RF_KILL_SW, &priv->status);
}
return;
--
1.5.3.6


2008-12-22 03:38:43

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 03/10] iwl3945: sync tx queue data structure with iwlagn

From: Samuel Ortiz <[email protected]>

We are now using the iwl_tx_queue for iwl3945. To reach that goal, we
included the 3945 specific tfd frame structure to iwl_tx_queue. This
has no effect on the current iwlagn code.

Signed-off-by: Samuel Ortiz <[email protected]>
Signed-off-by: Abhijeet Kolekar <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-3945-hw.h | 4 -
drivers/net/wireless/iwlwifi/iwl-3945.c | 14 ++--
drivers/net/wireless/iwlwifi/iwl-3945.h | 8 +-
drivers/net/wireless/iwlwifi/iwl-4965-hw.h | 3 -
drivers/net/wireless/iwlwifi/iwl-dev.h | 28 +-----
drivers/net/wireless/iwlwifi/iwl-fh.h | 11 +++
drivers/net/wireless/iwlwifi/iwl3945-base.c | 125 ++++++++++++++++----------
7 files changed, 103 insertions(+), 90 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
index 1ba59df..c9db98c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
@@ -240,7 +240,6 @@ struct iwl3945_eeprom {

#define TFD_QUEUE_MIN 0
#define TFD_QUEUE_MAX 6
-#define TFD_QUEUE_SIZE_MAX (256)

#define IWL_NUM_SCAN_RATES (2)

@@ -262,9 +261,6 @@ struct iwl3945_eeprom {
#define TFD_CTL_PAD_SET(n) (n << 28)
#define TFD_CTL_PAD_GET(ctl) (ctl >> 28)

-#define TFD_TX_CMD_SLOTS 256
-#define TFD_CMD_SLOTS 32
-
/*
* RX related structures and functions
*/
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index a0aea81..41556b4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -306,7 +306,7 @@ int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate)
static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv,
int txq_id, int index)
{
- struct iwl3945_tx_queue *txq = &priv->txq39[txq_id];
+ struct iwl_tx_queue *txq = &priv->txq[txq_id];
struct iwl_queue *q = &txq->q;
struct iwl_tx_info *tx_info;

@@ -337,7 +337,7 @@ static void iwl3945_rx_reply_tx(struct iwl_priv *priv,
u16 sequence = le16_to_cpu(pkt->hdr.sequence);
int txq_id = SEQ_TO_QUEUE(sequence);
int index = SEQ_TO_INDEX(sequence);
- struct iwl3945_tx_queue *txq = &priv->txq39[txq_id];
+ struct iwl_tx_queue *txq = &priv->txq[txq_id];
struct ieee80211_tx_info *info;
struct iwl3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
u32 status = le32_to_cpu(tx_resp->status);
@@ -756,9 +756,9 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr,
*
* Does NOT advance any indexes
*/
-int iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl3945_tx_queue *txq)
+int iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
{
- struct iwl3945_tfd *tfd_tmp = (struct iwl3945_tfd *)&txq->tfds[0];
+ struct iwl3945_tfd *tfd_tmp = (struct iwl3945_tfd *)&txq->tfds39[0];
struct iwl3945_tfd *tfd = &tfd_tmp[txq->q.read_ptr];
struct pci_dev *dev = priv->pci_dev;
int i;
@@ -1062,7 +1062,7 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv)
for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++) {
slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ?
TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
- rc = iwl3945_tx_queue_init(priv, &priv->txq39[txq_id], slots_num,
+ rc = iwl3945_tx_queue_init(priv, &priv->txq[txq_id], slots_num,
txq_id);
if (rc) {
IWL_ERR(priv, "Tx %d queue init failed\n", txq_id);
@@ -1252,7 +1252,7 @@ void iwl3945_hw_txq_ctx_free(struct iwl_priv *priv)

/* Tx queues */
for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++)
- iwl3945_tx_queue_free(priv, &priv->txq39[txq_id]);
+ iwl3945_tx_queue_free(priv, &priv->txq[txq_id]);
}

void iwl3945_hw_txq_ctx_stop(struct iwl_priv *priv)
@@ -2343,7 +2343,7 @@ int iwl3945_hw_rxq_stop(struct iwl_priv *priv)
return 0;
}

-int iwl3945_hw_tx_queue_init(struct iwl_priv *priv, struct iwl3945_tx_queue *txq)
+int iwl3945_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq)
{
int rc;
unsigned long flags;
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index 716c4b4..e584032 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -219,9 +219,9 @@ extern void iwl3945_rx_queue_reset(struct iwl_priv *priv,
extern int iwl3945_calc_db_from_ratio(int sig_ratio);
extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm);
extern int iwl3945_tx_queue_init(struct iwl_priv *priv,
- struct iwl3945_tx_queue *txq, int count, u32 id);
+ struct iwl_tx_queue *txq, int count, u32 id);
extern void iwl3945_rx_replenish(void *data);
-extern void iwl3945_tx_queue_free(struct iwl_priv *priv, struct iwl3945_tx_queue *txq);
+extern void iwl3945_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq);
extern int iwl3945_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len,
const void *data);
extern int __must_check iwl3945_send_cmd(struct iwl_priv *priv,
@@ -270,10 +270,10 @@ extern void iwl3945_hw_txq_ctx_stop(struct iwl_priv *priv);
extern int iwl3945_hw_nic_reset(struct iwl_priv *priv);
extern int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd,
dma_addr_t addr, u16 len);
-extern int iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl3945_tx_queue *txq);
+extern int iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq);
extern int iwl3945_hw_get_temperature(struct iwl_priv *priv);
extern int iwl3945_hw_tx_queue_init(struct iwl_priv *priv,
- struct iwl3945_tx_queue *txq);
+ struct iwl_tx_queue *txq);
extern unsigned int iwl3945_hw_get_beacon_cmd(struct iwl_priv *priv,
struct iwl3945_frame *frame, u8 rate);
void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv, struct iwl_cmd *cmd,
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
index 9330b5a..e751c53 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
@@ -114,9 +114,6 @@
#define RX_QUEUE_MASK 255
#define RX_QUEUE_SIZE_LOG 8

-#define TFD_TX_CMD_SLOTS 256
-#define TFD_CMD_SLOTS 32
-
/*
* RX related structures and functions
*/
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 1ad4d08..9b9d743 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -134,9 +134,13 @@ struct iwl_tx_info {
* A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame
* descriptors) and required locking structures.
*/
+#define TFD_TX_CMD_SLOTS 256
+#define TFD_CMD_SLOTS 32
+
struct iwl_tx_queue {
struct iwl_queue q;
struct iwl_tfd *tfds;
+ struct iwl3945_tfd *tfds39;
struct iwl_cmd *cmd[TFD_TX_CMD_SLOTS];
struct iwl_tx_info *txb;
u8 need_update;
@@ -226,28 +230,6 @@ struct iwl_channel_info {
struct iwl3945_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES];
};

-/**
- * struct iwl3945_tx_queue - Tx Queue for DMA
- * @q: generic Rx/Tx queue descriptor
- * @bd: base of circular buffer of TFDs
- * @cmd: array of command/Tx buffers
- * @dma_addr_cmd: physical address of cmd/tx buffer array
- * @txb: array of per-TFD driver data
- * @need_update: indicates need to update read/write index
- *
- * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame
- * descriptors) and required locking structures.
- */
-struct iwl3945_tx_queue {
- struct iwl_queue q;
- struct iwl3945_tfd *tfds;
- struct iwl_cmd *cmd;
- dma_addr_t dma_addr_cmd;
- struct iwl_tx_info *txb;
- int need_update;
- int active;
-};
-
#define IWL_TX_FIFO_AC0 0
#define IWL_TX_FIFO_AC1 1
#define IWL_TX_FIFO_AC2 2
@@ -1099,8 +1081,6 @@ struct iwl_priv {
struct iwl3945_rxon_cmd staging39_rxon;
struct iwl3945_rxon_cmd recovery39_rxon;

- struct iwl3945_tx_queue txq39[IWL39_MAX_NUM_QUEUES];
-
struct iwl3945_power_mgr power_data_39;
struct iwl3945_notif_statistics statistics_39;

diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h
index 7c19790..313b03b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-fh.h
+++ b/drivers/net/wireless/iwlwifi/iwl-fh.h
@@ -478,6 +478,17 @@ struct iwl_tfd {
__le32 __pad;
} __attribute__ ((packed));

+struct iwl3945_tfd_frame_data {
+ __le32 addr;
+ __le32 len;
+} __attribute__ ((packed));
+
+struct iwl3945_tfd_frame {
+ __le32 control_flags;
+ struct iwl3945_tfd_frame_data pa[4];
+ u8 reserved[28];
+} __attribute__ ((packed));
+

/* Keep Warm Size */
#define IWL_KW_SIZE 0x1000 /* 4k */
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 5a0e25b..98f5b7f 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -57,7 +57,7 @@
#include "iwl-dev.h"

static int iwl3945_tx_queue_update_write_ptr(struct iwl_priv *priv,
- struct iwl3945_tx_queue *txq);
+ struct iwl_tx_queue *txq);

/*
* module name, copyright, version, etc.
@@ -162,7 +162,7 @@ static int iwl3945_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
* iwl3945_tx_queue_alloc - Alloc driver data and TFD CB for one Tx/cmd queue
*/
static int iwl3945_tx_queue_alloc(struct iwl_priv *priv,
- struct iwl3945_tx_queue *txq, u32 id)
+ struct iwl_tx_queue *txq, u32 id)
{
struct pci_dev *dev = priv->pci_dev;

@@ -181,13 +181,13 @@ static int iwl3945_tx_queue_alloc(struct iwl_priv *priv,

/* Circular buffer of transmit frame descriptors (TFDs),
* shared with device */
- txq->tfds = pci_alloc_consistent(dev,
- sizeof(txq->tfds[0]) * TFD_QUEUE_SIZE_MAX,
+ txq->tfds39 = pci_alloc_consistent(dev,
+ sizeof(txq->tfds39[0]) * TFD_QUEUE_SIZE_MAX,
&txq->q.dma_addr);

- if (!txq->tfds) {
+ if (!txq->tfds39) {
IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n",
- sizeof(txq->tfds[0]) * TFD_QUEUE_SIZE_MAX);
+ sizeof(txq->tfds39[0]) * TFD_QUEUE_SIZE_MAX);
goto error;
}
txq->q.id = id;
@@ -205,10 +205,9 @@ static int iwl3945_tx_queue_alloc(struct iwl_priv *priv,
* iwl3945_tx_queue_init - Allocate and initialize one tx/cmd queue
*/
int iwl3945_tx_queue_init(struct iwl_priv *priv,
- struct iwl3945_tx_queue *txq, int slots_num, u32 txq_id)
+ struct iwl_tx_queue *txq, int slots_num, u32 txq_id)
{
- struct pci_dev *dev = priv->pci_dev;
- int len;
+ int len, i;
int rc = 0;

/*
@@ -219,20 +218,25 @@ int iwl3945_tx_queue_init(struct iwl_priv *priv,
* For data Tx queues (all other queues), no super-size command
* space is needed.
*/
- len = sizeof(struct iwl_cmd) * slots_num;
- if (txq_id == IWL_CMD_QUEUE_NUM)
- len += IWL_MAX_SCAN_SIZE;
- txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd);
- if (!txq->cmd)
- return -ENOMEM;
+ len = sizeof(struct iwl_cmd);
+ for (i = 0; i <= slots_num; i++) {
+ if (i == slots_num) {
+ if (txq_id == IWL_CMD_QUEUE_NUM)
+ len += IWL_MAX_SCAN_SIZE;
+ else
+ continue;
+ }
+
+ txq->cmd[i] = kmalloc(len, GFP_KERNEL);
+ if (!txq->cmd[i])
+ goto err;
+ }

/* Alloc driver data array and TFD circular buffer */
rc = iwl3945_tx_queue_alloc(priv, txq, txq_id);
- if (rc) {
- pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd);
+ if (rc)
+ goto err;

- return -ENOMEM;
- }
txq->need_update = 0;

/* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise
@@ -246,6 +250,17 @@ int iwl3945_tx_queue_init(struct iwl_priv *priv,
iwl3945_hw_tx_queue_init(priv, txq);

return 0;
+err:
+ for (i = 0; i < slots_num; i++) {
+ kfree(txq->cmd[i]);
+ txq->cmd[i] = NULL;
+ }
+
+ if (txq_id == IWL_CMD_QUEUE_NUM) {
+ kfree(txq->cmd[slots_num]);
+ txq->cmd[slots_num] = NULL;
+ }
+ return -ENOMEM;
}

/**
@@ -256,11 +271,11 @@ int iwl3945_tx_queue_init(struct iwl_priv *priv,
* Free all buffers.
* 0-fill, but do not free "txq" descriptor structure.
*/
-void iwl3945_tx_queue_free(struct iwl_priv *priv, struct iwl3945_tx_queue *txq)
+void iwl3945_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq)
{
struct iwl_queue *q = &txq->q;
struct pci_dev *dev = priv->pci_dev;
- int len;
+ int len, i;

if (q->n_bd == 0)
return;
@@ -275,12 +290,13 @@ void iwl3945_tx_queue_free(struct iwl_priv *priv, struct iwl3945_tx_queue *txq)
len += IWL_MAX_SCAN_SIZE;

/* De-alloc array of command/tx buffers */
- pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd);
+ for (i = 0; i < TFD_TX_CMD_SLOTS; i++)
+ kfree(txq->cmd[i]);

/* De-alloc circular buffer of TFDs */
if (txq->q.n_bd)
pci_free_consistent(dev, sizeof(struct iwl3945_tfd) *
- txq->q.n_bd, txq->tfds, txq->q.dma_addr);
+ txq->q.n_bd, txq->tfds39, txq->q.dma_addr);

/* De-alloc array of per-TFD driver data */
kfree(txq->txb);
@@ -445,7 +461,7 @@ u8 iwl3945_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flag
*/
static int iwl3945_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
{
- struct iwl3945_tx_queue *txq = &priv->txq39[IWL_CMD_QUEUE_NUM];
+ struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM];
struct iwl_queue *q = &txq->q;
struct iwl3945_tfd *tfd;
struct iwl_cmd *out_cmd;
@@ -453,7 +469,7 @@ static int iwl3945_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr));
dma_addr_t phys_addr;
int pad;
- int ret;
+ int ret, len;
unsigned long flags;

/* If any of the command structures end up being larger than
@@ -475,11 +491,11 @@ static int iwl3945_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)

spin_lock_irqsave(&priv->hcmd_lock, flags);

- tfd = &txq->tfds[q->write_ptr];
+ tfd = &txq->tfds39[q->write_ptr];
memset(tfd, 0, sizeof(*tfd));

idx = get_cmd_index(q, q->write_ptr, cmd->meta.flags & CMD_SIZE_HUGE);
- out_cmd = &txq->cmd[idx];
+ out_cmd = txq->cmd[idx];

out_cmd->hdr.cmd = cmd->id;
memcpy(&out_cmd->meta, &cmd->meta, sizeof(cmd->meta));
@@ -494,8 +510,15 @@ static int iwl3945_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
if (out_cmd->meta.flags & CMD_SIZE_HUGE)
out_cmd->hdr.sequence |= SEQ_HUGE_FRAME;

- phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx +
- offsetof(struct iwl_cmd, hdr);
+ len = (idx == TFD_CMD_SLOTS) ?
+ IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd);
+
+ phys_addr = pci_map_single(priv->pci_dev, out_cmd,
+ len, PCI_DMA_TODEVICE);
+ pci_unmap_addr_set(&out_cmd->meta, mapping, phys_addr);
+ pci_unmap_len_set(&out_cmd->meta, len, len);
+ phys_addr += offsetof(struct iwl_cmd, hdr);
+
iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size);

pad = U32_PAD(cmd->len);
@@ -621,7 +644,7 @@ cancel:
* TX cmd queue. Otherwise in case the cmd comes
* in later, it will possibly set an invalid
* address (cmd->meta.source). */
- qcmd = &priv->txq39[IWL_CMD_QUEUE_NUM].cmd[cmd_idx];
+ qcmd = priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_idx];
qcmd->meta.flags &= ~CMD_WANT_SKB;
}
fail:
@@ -2233,7 +2256,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct iwl3945_tfd *tfd;
int txq_id = skb_get_queue_mapping(skb);
- struct iwl3945_tx_queue *txq = NULL;
+ struct iwl_tx_queue *txq = NULL;
struct iwl_queue *q = NULL;
dma_addr_t phys_addr;
dma_addr_t txcmd_phys;
@@ -2312,13 +2335,13 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
}

/* Descriptor for chosen Tx queue */
- txq = &priv->txq39[txq_id];
+ txq = &priv->txq[txq_id];
q = &txq->q;

spin_lock_irqsave(&priv->lock, flags);

/* Set up first empty TFD within this queue's circular TFD buffer */
- tfd = &txq->tfds[q->write_ptr];
+ tfd = &txq->tfds39[q->write_ptr];
memset(tfd, 0, sizeof(*tfd));
idx = get_cmd_index(q, q->write_ptr, 0);

@@ -2327,7 +2350,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
txq->txb[q->write_ptr].skb[0] = skb;

/* Init first empty entry in queue's array of Tx/cmd buffers */
- out_cmd = &txq->cmd[idx];
+ out_cmd = txq->cmd[idx];
memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr));
memset(&out_cmd->cmd.tx, 0, sizeof(out_cmd->cmd.tx));

@@ -2366,8 +2389,14 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)

/* Physical address of this Tx command's header (not MAC header!),
* within command buffer array. */
- txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl_cmd) * idx +
- offsetof(struct iwl_cmd, hdr);
+ txcmd_phys = pci_map_single(priv->pci_dev,
+ out_cmd, sizeof(struct iwl_cmd),
+ PCI_DMA_TODEVICE);
+ pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys);
+ pci_unmap_len_set(&out_cmd->meta, len, sizeof(struct iwl_cmd));
+ /* Add buffer containing Tx command and MAC(!) header to TFD's
+ * first entry */
+ txcmd_phys += offsetof(struct iwl_cmd, hdr);

/* Add buffer containing Tx command and MAC(!) header to TFD's
* first entry */
@@ -3082,7 +3111,7 @@ static void iwl3945_setup_rx_handlers(struct iwl_priv *priv)
static void iwl3945_cmd_queue_reclaim(struct iwl_priv *priv,
int txq_id, int index)
{
- struct iwl3945_tx_queue *txq = &priv->txq39[txq_id];
+ struct iwl_tx_queue *txq = &priv->txq[txq_id];
struct iwl_queue *q = &txq->q;
int nfreed = 0;

@@ -3127,8 +3156,8 @@ static void iwl3945_tx_cmd_complete(struct iwl_priv *priv,

BUG_ON(txq_id != IWL_CMD_QUEUE_NUM);

- cmd_index = get_cmd_index(&priv->txq39[IWL_CMD_QUEUE_NUM].q, index, huge);
- cmd = &priv->txq39[IWL_CMD_QUEUE_NUM].cmd[cmd_index];
+ cmd_index = get_cmd_index(&priv->txq[IWL_CMD_QUEUE_NUM].q, index, huge);
+ cmd = priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_index];

/* Input error checking is done when commands are added to queue. */
if (cmd->meta.flags & CMD_WANT_SKB) {
@@ -3684,7 +3713,7 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
* iwl3945_tx_queue_update_write_ptr - Send new write index to hardware
*/
static int iwl3945_tx_queue_update_write_ptr(struct iwl_priv *priv,
- struct iwl3945_tx_queue *txq)
+ struct iwl_tx_queue *txq)
{
u32 reg = 0;
int rc = 0;
@@ -4098,12 +4127,12 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
if (inta & CSR_INT_BIT_WAKEUP) {
IWL_DEBUG_ISR("Wakeup interrupt\n");
iwl3945_rx_queue_update_write_ptr(priv, &priv->rxq);
- iwl3945_tx_queue_update_write_ptr(priv, &priv->txq39[0]);
- iwl3945_tx_queue_update_write_ptr(priv, &priv->txq39[1]);
- iwl3945_tx_queue_update_write_ptr(priv, &priv->txq39[2]);
- iwl3945_tx_queue_update_write_ptr(priv, &priv->txq39[3]);
- iwl3945_tx_queue_update_write_ptr(priv, &priv->txq39[4]);
- iwl3945_tx_queue_update_write_ptr(priv, &priv->txq39[5]);
+ iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[0]);
+ iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[1]);
+ iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[2]);
+ iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[3]);
+ iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[4]);
+ iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[5]);

handled |= CSR_INT_BIT_WAKEUP;
}
@@ -6752,7 +6781,7 @@ static int iwl3945_mac_get_tx_stats(struct ieee80211_hw *hw,
{
struct iwl_priv *priv = hw->priv;
int i, avail;
- struct iwl3945_tx_queue *txq;
+ struct iwl_tx_queue *txq;
struct iwl_queue *q;
unsigned long flags;

@@ -6766,7 +6795,7 @@ static int iwl3945_mac_get_tx_stats(struct ieee80211_hw *hw,
spin_lock_irqsave(&priv->lock, flags);

for (i = 0; i < AC_NUM; i++) {
- txq = &priv->txq39[i];
+ txq = &priv->txq[i];
q = &txq->q;
avail = iwl_queue_space(q);

--
1.5.3.6


2008-12-22 03:38:47

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 06/10] iwl3945: use iwl3945_tx_cmd instead of iwl_tx_cmd

From: Winkler, Tomas <[email protected]>

The patch replaces iwl_tx_cmd with iwl3945_tx_cmd to complete
transitions introduced by commit
77cb4db173d72d1a8c6c89015784a815bfd85221 "iwlwifi: use iwl_cmd instead
of iwl3945_cmd"

Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl3945-base.c | 64 ++++++++++++++-------------
1 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 7cace6d..32cfc8f 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2047,36 +2047,37 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
struct sk_buff *skb_frag,
int last_frag)
{
+ struct iwl3945_tx_cmd *tx = (struct iwl3945_tx_cmd *)cmd->cmd.payload;
struct iwl3945_hw_key *keyinfo =
&priv->stations_39[info->control.hw_key->hw_key_idx].keyinfo;

switch (keyinfo->alg) {
case ALG_CCMP:
- cmd->cmd.tx.sec_ctl = TX_CMD_SEC_CCM;
- memcpy(cmd->cmd.tx.key, keyinfo->key, keyinfo->keylen);
+ tx->sec_ctl = TX_CMD_SEC_CCM;
+ memcpy(tx->key, keyinfo->key, keyinfo->keylen);
IWL_DEBUG_TX("tx_cmd with AES hwcrypto\n");
break;

case ALG_TKIP:
#if 0
- cmd->cmd.tx.sec_ctl = TX_CMD_SEC_TKIP;
+ tx->sec_ctl = TX_CMD_SEC_TKIP;

if (last_frag)
- memcpy(cmd->cmd.tx.tkip_mic.byte, skb_frag->tail - 8,
+ memcpy(tx->tkip_mic.byte, skb_frag->tail - 8,
8);
else
- memset(cmd->cmd.tx.tkip_mic.byte, 0, 8);
+ memset(tx->tkip_mic.byte, 0, 8);
#endif
break;

case ALG_WEP:
- cmd->cmd.tx.sec_ctl = TX_CMD_SEC_WEP |
+ tx->sec_ctl = TX_CMD_SEC_WEP |
(info->control.hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT;

if (keyinfo->keylen == 13)
- cmd->cmd.tx.sec_ctl |= TX_CMD_SEC_KEY128;
+ tx->sec_ctl |= TX_CMD_SEC_KEY128;

- memcpy(&cmd->cmd.tx.key[3], keyinfo->key, keyinfo->keylen);
+ memcpy(&tx->key[3], keyinfo->key, keyinfo->keylen);

IWL_DEBUG_TX("Configuring packet for WEP encryption "
"with key %d\n", info->control.hw_key->hw_key_idx);
@@ -2094,14 +2095,14 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv,
struct iwl_cmd *cmd,
struct ieee80211_tx_info *info,
- struct ieee80211_hdr *hdr,
- int is_unicast, u8 std_id)
+ struct ieee80211_hdr *hdr, u8 std_id)
{
+ struct iwl3945_tx_cmd *tx = (struct iwl3945_tx_cmd *)cmd->cmd.payload;
+ __le32 tx_flags = tx->tx_flags;
__le16 fc = hdr->frame_control;
- __le32 tx_flags = cmd->cmd.tx.tx_flags;
u8 rc_flags = info->control.rates[0].flags;

- cmd->cmd.tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
+ tx->stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
tx_flags |= TX_CMD_FLG_ACK_MSK;
if (ieee80211_is_mgmt(fc))
@@ -2114,13 +2115,13 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv,
tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
}

- cmd->cmd.tx.sta_id = std_id;
+ tx->sta_id = std_id;
if (ieee80211_has_morefrags(fc))
tx_flags |= TX_CMD_FLG_MORE_FRAG_MSK;

if (ieee80211_is_data_qos(fc)) {
u8 *qc = ieee80211_get_qos_ctl(hdr);
- cmd->cmd.tx.tid_tspec = qc[0] & 0xf;
+ tx->tid_tspec = qc[0] & 0xf;
tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK;
} else {
tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
@@ -2140,16 +2141,16 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv,
tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK);
if (ieee80211_is_mgmt(fc)) {
if (ieee80211_is_assoc_req(fc) || ieee80211_is_reassoc_req(fc))
- cmd->cmd.tx.timeout.pm_frame_timeout = cpu_to_le16(3);
+ tx->timeout.pm_frame_timeout = cpu_to_le16(3);
else
- cmd->cmd.tx.timeout.pm_frame_timeout = cpu_to_le16(2);
+ tx->timeout.pm_frame_timeout = cpu_to_le16(2);
} else {
- cmd->cmd.tx.timeout.pm_frame_timeout = 0;
+ tx->timeout.pm_frame_timeout = 0;
}

- cmd->cmd.tx.driver_txop = 0;
- cmd->cmd.tx.tx_flags = tx_flags;
- cmd->cmd.tx.next_frame_len = 0;
+ tx->driver_txop = 0;
+ tx->tx_flags = tx_flags;
+ tx->next_frame_len = 0;
}

/**
@@ -2220,12 +2221,13 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct iwl3945_tfd *tfd;
- int txq_id = skb_get_queue_mapping(skb);
+ struct iwl3945_tx_cmd *tx;
struct iwl_tx_queue *txq = NULL;
struct iwl_queue *q = NULL;
+ struct iwl_cmd *out_cmd = NULL;
dma_addr_t phys_addr;
dma_addr_t txcmd_phys;
- struct iwl_cmd *out_cmd = NULL;
+ int txq_id = skb_get_queue_mapping(skb);
u16 len, idx, len_org, hdr_len;
u8 id;
u8 unicast;
@@ -2316,8 +2318,9 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)

/* Init first empty entry in queue's array of Tx/cmd buffers */
out_cmd = txq->cmd[idx];
+ tx = (struct iwl3945_tx_cmd *)out_cmd->cmd.payload;
memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr));
- memset(&out_cmd->cmd.tx, 0, sizeof(out_cmd->cmd.tx));
+ memset(tx, 0, sizeof(*tx));

/*
* Set up the Tx-command (not MAC!) header.
@@ -2330,7 +2333,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
INDEX_TO_SEQ(q->write_ptr)));

/* Copy MAC header from skb into command buffer */
- memcpy(out_cmd->cmd.tx.hdr, hdr, hdr_len);
+ memcpy(tx->hdr, hdr, hdr_len);

/*
* Use the first empty entry in this queue's command buffer array
@@ -2390,16 +2393,16 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)

/* Total # bytes to be transmitted */
len = (u16)skb->len;
- out_cmd->cmd.tx.len = cpu_to_le16(len);
+ tx->len = cpu_to_le16(len);

/* TODO need this for burst mode later on */
- iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, unicast, sta_id);
+ iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id);

/* set is_hcca to 0; it probably will never be implemented */
iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0);

- out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_A_MSK;
- out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_B_MSK;
+ tx->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK;
+ tx->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK;

if (!ieee80211_has_morefrags(hdr->frame_control)) {
txq->need_update = 1;
@@ -2410,10 +2413,9 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
txq->need_update = 0;
}

- iwl_print_hex_dump(priv, IWL_DL_TX, out_cmd->cmd.payload,
- sizeof(out_cmd->cmd.tx));
+ iwl_print_hex_dump(priv, IWL_DL_TX, tx, sizeof(*tx));

- iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr,
+ iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx->hdr,
ieee80211_hdrlen(fc));

/* Tell device the write index *just past* this latest filled TFD */
--
1.5.3.6


2008-12-22 03:38:49

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 08/10] iwlwifi: kill retry_rate sysfs for iwlagn

From: Winkler, Tomas <[email protected]>

This patch kills retry_rate in sysfs for iwlagn. It's not used.

Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 26 --------------------------
drivers/net/wireless/iwlwifi/iwl-core.c | 1 -
2 files changed, 0 insertions(+), 27 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index ecf8141..002a151 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3540,31 +3540,6 @@ static ssize_t store_filter_flags(struct device *d,
static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags,
store_filter_flags);

-static ssize_t store_retry_rate(struct device *d,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct iwl_priv *priv = dev_get_drvdata(d);
- long val;
- int ret = strict_strtol(buf, 10, &val);
- if (!ret)
- return ret;
-
- priv->retry_rate = (val > 0) ? val : 1;
-
- return count;
-}
-
-static ssize_t show_retry_rate(struct device *d,
- struct device_attribute *attr, char *buf)
-{
- struct iwl_priv *priv = dev_get_drvdata(d);
- return sprintf(buf, "%d", priv->retry_rate);
-}
-
-static DEVICE_ATTR(retry_rate, S_IWUSR | S_IRUSR, show_retry_rate,
- store_retry_rate);
-
static ssize_t store_power_level(struct device *d,
struct device_attribute *attr,
const char *buf, size_t count)
@@ -3720,7 +3695,6 @@ static struct attribute *iwl_sysfs_entries[] = {
&dev_attr_flags.attr,
&dev_attr_filter_flags.attr,
&dev_attr_power_level.attr,
- &dev_attr_retry_rate.attr,
&dev_attr_statistics.attr,
&dev_attr_temperature.attr,
&dev_attr_tx_power.attr,
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index eaae79b..44e27fd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -863,7 +863,6 @@ int iwl_init_drv(struct iwl_priv *priv)
{
int ret;

- priv->retry_rate = 1;
priv->ibss_beacon = NULL;

spin_lock_init(&priv->lock);
--
1.5.3.6


2008-12-23 07:39:38

by Sedat Dilek

[permalink] [raw]
Subject: Re: [PATCH 10/10] iwl3945: use rx queue management infrastructure from iwlcore

Hiho,

No Xmas-bells ringing here.

I applied the patch-series 01/10 till 10/10 and afterwards I reverted
04_10_iwl3945-remove-iwl-3945-led.[ch].patch with Yi's revert-patch.

On the first sight, everything seems OK.
iwlist, wpa_cli gave the expected values back, but there is no DNS
resolved properly, e.g. ping.
This new state is also not usable for me :-).

What does this mean?
[...]
/var/log/syslog:Dec 23 08:18:05 seduxbox kernel: mac80211-phy0: failed
to set key (2, ff:ff:ff:ff:ff:ff) to hardware (-22)
[...]
Do I need any mac80211-patches additionally?

The file exists:
$ ls -l /lib/modules/2.6.28-rc9-git3-wl-gcc44/kernel/drivers/crypto/padlock-aes.ko
-rw-r--r-- 1 root root 11724 2008-12-23 07:46
/lib/modules/2.6.28-rc9-git3-wl-gcc44/kernel/drivers/crypto/padlock-aes.ko

Kind Regards,
Sedat

----- Investigations -----

[...]
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: EXT4-fs: mounted
filesystem with ordered data mode.
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: kjournald starting.
Commit interval 5 seconds
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: EXT3 FS on sda6,
internal journal
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: EXT3-fs: mounted
filesystem with ordered data mode.
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: iwl3945 0000:10:00.0:
PCI INT A -> GSI 17 (level, low) -> IRQ 17
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: iwl3945 0000:10:00.0:
restoring config space at offset 0x1 (was 0x100002, writing 0x100006)
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: iwl3945 0000:10:00.0:
irq 1274 for MSI/MSI-X
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: iwl3945 0000:10:00.0:
firmware: requesting iwlwifi-3945-2.ucode
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: iwl3945 0000:10:00.0:
loaded firmware version 15.28.2.8
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: Registered led
device: iwl-phy0:radio
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: Registered led
device: iwl-phy0:assoc
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: Registered led
device: iwl-phy0:RX
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: Registered led
device: iwl-phy0:TX
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: NET: Registered
protocol family 17
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: NET: Registered
protocol family 10
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: lo: Disabled Privacy Extensions
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: ADDRCONF(NETDEV_UP):
wlan0: link is not ready
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: wlan0: authenticate
with AP 00:1c:4a:41:62:2e
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: wlan0: authenticated
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: wlan0: associate with
AP 00:1c:4a:41:62:2e
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: wlan0: RX AssocResp
from 00:1c:4a:41:62:2e (capab=0x411 status=0 aid=1)
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: wlan0: associated
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel:
ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
/var/log/syslog-Dec 23 08:18:05 seduxbox kernel: padlock: VIA PadLock
not detected.
/var/log/syslog-Dec 23 08:18:05 seduxbox modprobe: WARNING: Error
inserting padlock_aes
(/lib/modules/2.6.28-rc9-git3-wl-gcc44/kernel/drivers/crypto/padlock-aes.ko):
No such device
/var/log/syslog:Dec 23 08:18:05 seduxbox kernel: mac80211-phy0: failed
to set key (2, ff:ff:ff:ff:ff:ff) to hardware (-22)
[...]

On Tue, Dec 23, 2008 at 3:58 AM, Zhu Yi <[email protected]> wrote:
> On Mon, 2008-12-22 at 22:07 +0800, Kalle Valo wrote:
>> Yes, ifconfig up works but now iwlist wlan0 scan crashes. I just
>> tested this once due to lack of time.
>>
>> I hope I get my wifi working before Christmas ;)
>
> http://marc.info/?l=linux-wireless&m=123000088608330&w=2 should fix the
> problem. Thanks a lot for your testing.
>
> Thanks,
> -yi
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2008-12-23 12:49:40

by Sedat Dilek

[permalink] [raw]
Subject: Re: [PATCH 10/10] iwl3945: use rx queue management infrastructure from iwlcore

The same error-message and as described before no DNS is resolved with
latest iwlwifi-2.6.git, also.
I added info about wpa_supplicant version I am using, maybe this is important.

-SD

----- Investigations -----

[...]
/var/log/syslog:Dec 23 10:05:35 seduxbox kernel: mac80211-phy0: failed
to set key (1, ff:ff:ff:ff:ff:ff) to hardware (-22)
[...]

# env COLUMNS=180 dpkg -l | grep linux-image | grep 2.6.28-rc9
ii linux-image-2.6.28-rc9-git3-wl-gcc44
2.6.28~rc9+git3+wl~git20081219.30b5741+ Linux kernel binary image for
version 2.6.28-rc9-git3-wl-gcc44
ii linux-image-2.6.28-rc9-iwlwifi26-gcc44
2.6.28~rc9+iwlwifi26~git20081223.f4f5c9 Linux kernel binary image for
version 2.6.28-rc9-iwlwifi26-gcc44

# env COLUMNS=120 dpkg -l | grep wpa
ii wpagui 0.6.6-1+c0.sidux.1 graphical user
interface for wpa_supplicant
ii wpasupplicant 0.6.6-1+c0.sidux.1 client support
for WPA and WPA2 (IEEE 802.11i)

root@seduxbox:~# modprobe -r -v iwl3945
rmmod /lib/modules/2.6.28-rc9-iwlwifi26-gcc44/kernel/drivers/net/wireless/iwlwifi/iwl3945.ko
rmmod /lib/modules/2.6.28-rc9-iwlwifi26-gcc44/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko
rmmod /lib/modules/2.6.28-rc9-iwlwifi26-gcc44/kernel/net/mac80211/mac80211.ko
rmmod /lib/modules/2.6.28-rc9-iwlwifi26-gcc44/kernel/net/rfkill/rfkill.ko
rmmod /lib/modules/2.6.28-rc9-iwlwifi26-gcc44/kernel/drivers/leds/led-class.ko
rmmod /lib/modules/2.6.28-rc9-iwlwifi26-gcc44/kernel/net/wireless/cfg80211.ko
root@seduxbox:~# modprobe -v iwl3945 debug=0x43fff
insmod /lib/modules/2.6.28-rc9-iwlwifi26-gcc44/kernel/net/wireless/cfg80211.ko
insmod /lib/modules/2.6.28-rc9-iwlwifi26-gcc44/kernel/drivers/leds/led-class.ko
insmod /lib/modules/2.6.28-rc9-iwlwifi26-gcc44/kernel/net/rfkill/rfkill.ko
insmod /lib/modules/2.6.28-rc9-iwlwifi26-gcc44/kernel/net/mac80211/mac80211.ko
insmod /lib/modules/2.6.28-rc9-iwlwifi26-gcc44/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko
insmod /lib/modules/2.6.28-rc9-iwlwifi26-gcc44/kernel/drivers/net/wireless/iwlwifi/iwl3945.ko
debug=0x43fff

root@seduxbox:~# ping http://www.heise.de
ping: unknown host http://www.heise.de

root@seduxbox:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet static
address 192.168.2.103
broadcast 192.168.2.255
dns-nameservers 192.168.2.1 217.237.151.142 217.237.150.188
gateway 192.168.2.1
netmask 255.255.255.0
network 192.168.2.0
wpa-psk <mySecretPassword>
wpa-ssid WLAN-001C4A41622E

root@seduxbox:~# lsmod | grep iwl
iwl3945 82308 0
iwlcore 85248 1 iwl3945
mac80211 139048 2 iwl3945,iwlcore
rfkill 14004 3 iwl3945,iwlcore
led_class 7812 2 iwl3945,iwlcore
cfg80211 36888 3 iwl3945,iwlcore,mac80211

root@seduxbox:~# tail -f /var/log/messages
Dec 23 13:31:06 seduxbox kernel: reserve_memtype failed
0xd8000000-0xdc000000, track write-combining, req write-combining
Dec 23 13:31:06 seduxbox kernel: Xorg:5236 conflicting memory types
d8000000-dc000000 write-combining<->uncached-minus
Dec 23 13:31:06 seduxbox kernel: reserve_memtype failed
0xd8000000-0xdc000000, track write-combining, req write-combining
Dec 23 13:31:06 seduxbox kernel: Xorg:5254 freeing invalid memtype
d8000000-dc000000
Dec 23 13:31:07 seduxbox kernel: Xorg:5236 conflicting memory types
d8000000-dc000000 write-combining<->uncached-minus
Dec 23 13:31:07 seduxbox kernel: reserve_memtype failed
0xd8000000-0xdc000000, track write-combining, req write-combining
Dec 23 13:31:07 seduxbox kernel: Xorg:5258 freeing invalid memtype
d8000000-dc000000
Dec 23 13:31:19 seduxbox kernel: ADDRCONF(NETDEV_CHANGE): wlan0: link
becomes ready
Dec 23 13:31:20 seduxbox kernel: padlock: VIA PadLock not detected.
Dec 23 13:32:22 seduxbox kernel: iwl3945 0000:10:00.0: PCI INT A disabled
Dec 23 13:32:49 seduxbox kernel: cfg80211: Using static regulatory domain info
Dec 23 13:32:49 seduxbox kernel: cfg80211: Regulatory domain: US
Dec 23 13:32:49 seduxbox kernel: (start_freq - end_freq @ bandwidth),
(max_antenna_gain, max_eirp)
Dec 23 13:32:49 seduxbox kernel: (2402000 KHz - 2472000 KHz @ 40000
KHz), (600 mBi, 2700 mBm)
Dec 23 13:32:49 seduxbox kernel: (5170000 KHz - 5190000 KHz @ 40000
KHz), (600 mBi, 2300 mBm)
Dec 23 13:32:49 seduxbox kernel: (5190000 KHz - 5210000 KHz @ 40000
KHz), (600 mBi, 2300 mBm)
Dec 23 13:32:49 seduxbox kernel: (5210000 KHz - 5230000 KHz @ 40000
KHz), (600 mBi, 2300 mBm)
Dec 23 13:32:49 seduxbox kernel: (5230000 KHz - 5330000 KHz @ 40000
KHz), (600 mBi, 2300 mBm)
Dec 23 13:32:49 seduxbox kernel: (5735000 KHz - 5835000 KHz @ 40000
KHz), (600 mBi, 3000 mBm)
Dec 23 13:32:49 seduxbox kernel: cfg80211: Calling CRDA for country: US
Dec 23 13:32:50 seduxbox kernel: iwl3945: Intel(R) PRO/Wireless
3945ABG/BG Network Connection driver for Linux, 1.2.26ks
Dec 23 13:32:50 seduxbox kernel: iwl3945: Copyright(c) 2003-2008 Intel
Corporation
Dec 23 13:32:50 seduxbox kernel: iwl3945 0000:10:00.0: PCI INT A ->
GSI 17 (level, low) -> IRQ 17
Dec 23 13:32:50 seduxbox kernel: iwl3945 0000:10:00.0: Tunable
channels: 13 802.11bg, 23 802.11a channels
Dec 23 13:32:50 seduxbox kernel: iwl3945 0000:10:00.0: Detected Intel
Wireless WiFi Link 3945ABG
Dec 23 13:32:50 seduxbox kernel: iwl3945 0000:10:00.0: PCI INT A ->
GSI 17 (level, low) -> IRQ 17
Dec 23 13:32:50 seduxbox kernel: iwl3945 0000:10:00.0: firmware:
requesting iwlwifi-3945-2.ucode
Dec 23 13:32:50 seduxbox kernel: iwl3945 0000:10:00.0: loaded firmware
version 15.28.2.8
Dec 23 13:32:50 seduxbox kernel: Registered led device: iwl-phy0:radio
Dec 23 13:32:50 seduxbox kernel: Registered led device: iwl-phy0:assoc
Dec 23 13:32:50 seduxbox kernel: Registered led device: iwl-phy0:RX
Dec 23 13:32:50 seduxbox kernel: Registered led device: iwl-phy0:TX
Dec 23 13:32:50 seduxbox kernel: ADDRCONF(NETDEV_UP): wlan0: link is not ready
Dec 23 13:32:53 seduxbox kernel: ADDRCONF(NETDEV_CHANGE): wlan0: link
becomes ready

root@seduxbox:~# tail -50 /var/log/kern.log
Dec 23 13:31:07 seduxbox kernel: reserve_memtype failed
0xd8000000-0xdc000000, track write-combining, req write-combining
Dec 23 13:31:07 seduxbox kernel: Xorg:5258 freeing invalid memtype
d8000000-dc000000
Dec 23 13:31:19 seduxbox kernel: wlan0: authenticate with AP 00:1c:4a:41:62:2e
Dec 23 13:31:19 seduxbox kernel: wlan0: authenticated
Dec 23 13:31:19 seduxbox kernel: wlan0: associate with AP 00:1c:4a:41:62:2e
Dec 23 13:31:19 seduxbox kernel: wlan0: RX AssocResp from
00:1c:4a:41:62:2e (capab=0x411 status=0 aid=1)
Dec 23 13:31:19 seduxbox kernel: wlan0: associated
Dec 23 13:31:19 seduxbox kernel: ADDRCONF(NETDEV_CHANGE): wlan0: link
becomes ready
Dec 23 13:31:20 seduxbox kernel: padlock: VIA PadLock not detected.
Dec 23 13:31:20 seduxbox kernel: mac80211-phy0: failed to set key (2,
ff:ff:ff:ff:ff:ff) to hardware (-22)
Dec 23 13:31:29 seduxbox kernel: wlan0: no IPv6 routers present
Dec 23 13:32:22 seduxbox kernel: wlan0: deauthenticating by local
choice (reason=3)
Dec 23 13:32:22 seduxbox kernel: iwl3945 0000:10:00.0: MAC is in deep sleep!
Dec 23 13:32:22 seduxbox kernel: iwl3945 0000:10:00.0: MAC is in deep sleep!
Dec 23 13:32:22 seduxbox kernel: iwl3945 0000:10:00.0: MAC is in deep sleep!
Dec 23 13:32:22 seduxbox kernel: iwl3945 0000:10:00.0: PCI INT A disabled
Dec 23 13:32:49 seduxbox kernel: cfg80211: Using static regulatory domain info
Dec 23 13:32:49 seduxbox kernel: cfg80211: Regulatory domain: US
Dec 23 13:32:49 seduxbox kernel: (start_freq - end_freq @ bandwidth),
(max_antenna_gain, max_eirp)
Dec 23 13:32:49 seduxbox kernel: (2402000 KHz - 2472000 KHz @ 40000
KHz), (600 mBi, 2700 mBm)
Dec 23 13:32:49 seduxbox kernel: (5170000 KHz - 5190000 KHz @ 40000
KHz), (600 mBi, 2300 mBm)
Dec 23 13:32:49 seduxbox kernel: (5190000 KHz - 5210000 KHz @ 40000
KHz), (600 mBi, 2300 mBm)
Dec 23 13:32:49 seduxbox kernel: (5210000 KHz - 5230000 KHz @ 40000
KHz), (600 mBi, 2300 mBm)
Dec 23 13:32:49 seduxbox kernel: (5230000 KHz - 5330000 KHz @ 40000
KHz), (600 mBi, 2300 mBm)
Dec 23 13:32:49 seduxbox kernel: (5735000 KHz - 5835000 KHz @ 40000
KHz), (600 mBi, 3000 mBm)
Dec 23 13:32:49 seduxbox kernel: cfg80211: Calling CRDA for country: US
Dec 23 13:32:50 seduxbox kernel: iwl3945: Intel(R) PRO/Wireless
3945ABG/BG Network Connection driver for Linux, 1.2.26ks
Dec 23 13:32:50 seduxbox kernel: iwl3945: Copyright(c) 2003-2008 Intel
Corporation
Dec 23 13:32:50 seduxbox kernel: iwl3945 0000:10:00.0: PCI INT A ->
GSI 17 (level, low) -> IRQ 17
Dec 23 13:32:50 seduxbox kernel: iwl3945 0000:10:00.0: setting latency
timer to 64
Dec 23 13:32:50 seduxbox kernel: iwl3945 0000:10:00.0: Tunable
channels: 13 802.11bg, 23 802.11a channels
Dec 23 13:32:50 seduxbox kernel: iwl3945 0000:10:00.0: Detected Intel
Wireless WiFi Link 3945ABG
Dec 23 13:32:50 seduxbox kernel: phy0: Selected rate control algorithm
'iwl-3945-rs'
Dec 23 13:32:50 seduxbox kernel: iwl3945 0000:10:00.0: PCI INT A ->
GSI 17 (level, low) -> IRQ 17
Dec 23 13:32:50 seduxbox kernel: iwl3945 0000:10:00.0: irq 1274 for MSI/MSI-X
Dec 23 13:32:50 seduxbox kernel: iwl3945 0000:10:00.0: firmware:
requesting iwlwifi-3945-2.ucode
Dec 23 13:32:50 seduxbox kernel: iwl3945 0000:10:00.0: loaded firmware
version 15.28.2.8
Dec 23 13:32:50 seduxbox kernel: Registered led device: iwl-phy0:radio
Dec 23 13:32:50 seduxbox kernel: Registered led device: iwl-phy0:assoc
Dec 23 13:32:50 seduxbox kernel: Registered led device: iwl-phy0:RX
Dec 23 13:32:50 seduxbox kernel: Registered led device: iwl-phy0:TX
Dec 23 13:32:50 seduxbox kernel: ADDRCONF(NETDEV_UP): wlan0: link is not ready
Dec 23 13:32:53 seduxbox kernel: wlan0: authenticate with AP 00:1c:4a:41:62:2e
Dec 23 13:32:53 seduxbox kernel: wlan0: authenticated
Dec 23 13:32:53 seduxbox kernel: wlan0: associate with AP 00:1c:4a:41:62:2e
Dec 23 13:32:53 seduxbox kernel: wlan0: RX AssocResp from
00:1c:4a:41:62:2e (capab=0x411 status=0 aid=1)
Dec 23 13:32:53 seduxbox kernel: wlan0: associated
Dec 23 13:32:53 seduxbox kernel: ADDRCONF(NETDEV_CHANGE): wlan0: link
becomes ready
Dec 23 13:32:54 seduxbox kernel: mac80211-phy0: failed to set key (1,
ff:ff:ff:ff:ff:ff) to hardware (-22)
Dec 23 13:33:03 seduxbox kernel: wlan0: no IPv6 routers present

[EOI] - End Of Investigations

On Tue, Dec 23, 2008 at 3:58 AM, Zhu Yi <[email protected]> wrote:
> On Mon, 2008-12-22 at 22:07 +0800, Kalle Valo wrote:
>> Yes, ifconfig up works but now iwlist wlan0 scan crashes. I just
>> tested this once due to lack of time.
>>
>> I hope I get my wifi working before Christmas ;)
>
> http://marc.info/?l=linux-wireless&m=123000088608330&w=2 should fix the
> problem. Thanks a lot for your testing.
>
> Thanks,
> -yi
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2008-12-22 03:38:51

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 09/10] iwlwifi: fix warning 'Should it be static'

From: Winkler, Tomas <[email protected]>

This patch adds static for functions iwl3945_apm_reset() and
iwl3945_init_drv(). It fixes compile warnings.

Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-3945.c | 2 +-
drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index ae68f2b..fb2c2db 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -1315,7 +1315,7 @@ static void iwl3945_apm_stop(struct iwl_priv *priv)
spin_unlock_irqrestore(&priv->lock, flags);
}

-int iwl3945_apm_reset(struct iwl_priv *priv)
+static int iwl3945_apm_reset(struct iwl_priv *priv)
{
int rc;
unsigned long flags;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 32cfc8f..2e5c4d8 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -7423,7 +7423,7 @@ static struct ieee80211_ops iwl3945_hw_ops = {
.hw_scan = iwl3945_mac_hw_scan
};

-int iwl3945_init_drv(struct iwl_priv *priv)
+static int iwl3945_init_drv(struct iwl_priv *priv)
{
int ret;

--
1.5.3.6


2008-12-22 03:38:52

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 10/10] iwl3945: use rx queue management infrastructure from iwlcore

From: Winkler, Tomas <[email protected]>

This patch uses rx queue alloc free and reset function from iwlcore.
This should fix the regression reported by Kalle Valo.

Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-3945.c | 4 +-
drivers/net/wireless/iwlwifi/iwl-3945.h | 3 -
drivers/net/wireless/iwlwifi/iwl3945-base.c | 81 +--------------------------
3 files changed, 3 insertions(+), 85 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index fb2c2db..77c55a6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -1195,13 +1195,13 @@ int iwl3945_hw_nic_init(struct iwl_priv *priv)

/* Allocate the RX queue, or reset if it is already allocated */
if (!rxq->bd) {
- rc = iwl3945_rx_queue_alloc(priv);
+ rc = iwl_rx_queue_alloc(priv);
if (rc) {
IWL_ERR(priv, "Unable to initialize Rx queue\n");
return -ENOMEM;
}
} else
- iwl3945_rx_queue_reset(priv, rxq);
+ iwl_rx_queue_reset(priv, rxq);

iwl3945_rx_replenish(priv);

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index 941746b..bd41643 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -212,9 +212,6 @@ extern u8 iwl3945_add_station(struct iwl_priv *priv, const u8 *bssid,
int is_ap, u8 flags);
extern int iwl3945_power_init_handle(struct iwl_priv *priv);
extern int iwl3945_eeprom_init(struct iwl_priv *priv);
-extern int iwl3945_rx_queue_alloc(struct iwl_priv *priv);
-extern void iwl3945_rx_queue_reset(struct iwl_priv *priv,
- struct iwl_rx_queue *rxq);
extern int iwl3945_calc_db_from_ratio(int sig_ratio);
extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm);
extern int iwl3945_tx_queue_init(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 2e5c4d8..c098cac 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -3189,7 +3189,6 @@ static void iwl3945_tx_cmd_complete(struct iwl_priv *priv,
*
* Driver sequence:
*
- * iwl3945_rx_queue_alloc() Allocates rx_free
* iwl3945_rx_replenish() Replenishes rx_free list from rx_used, and calls
* iwl3945_rx_queue_restock
* iwl3945_rx_queue_restock() Moves available buffers from rx_free into Rx
@@ -3408,84 +3407,6 @@ void iwl3945_rx_replenish(void *data)
spin_unlock_irqrestore(&priv->lock, flags);
}

-/* Assumes that the skb field of the buffers in 'pool' is kept accurate.
- * If an SKB has been detached, the POOL needs to have its SKB set to NULL
- * This free routine walks the list of POOL entries and if SKB is set to
- * non NULL it is unmapped and freed
- */
-static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
-{
- int i;
- for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) {
- if (rxq->pool[i].skb != NULL) {
- pci_unmap_single(priv->pci_dev,
- rxq->pool[i].real_dma_addr,
- IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
- dev_kfree_skb(rxq->pool[i].skb);
- }
- }
-
- pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd,
- rxq->dma_addr);
- rxq->bd = NULL;
-}
-
-int iwl3945_rx_queue_alloc(struct iwl_priv *priv)
-{
- struct iwl_rx_queue *rxq = &priv->rxq;
- struct pci_dev *dev = priv->pci_dev;
- int i;
-
- spin_lock_init(&rxq->lock);
- INIT_LIST_HEAD(&rxq->rx_free);
- INIT_LIST_HEAD(&rxq->rx_used);
-
- /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */
- rxq->bd = pci_alloc_consistent(dev, 4 * RX_QUEUE_SIZE, &rxq->dma_addr);
- if (!rxq->bd)
- return -ENOMEM;
-
- /* Fill the rx_used queue with _all_ of the Rx buffers */
- for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++)
- list_add_tail(&rxq->pool[i].list, &rxq->rx_used);
-
- /* Set us so that we have processed and used all buffers, but have
- * not restocked the Rx queue with fresh buffers */
- rxq->read = rxq->write = 0;
- rxq->free_count = 0;
- rxq->need_update = 0;
- return 0;
-}
-
-void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
-{
- unsigned long flags;
- int i;
- spin_lock_irqsave(&rxq->lock, flags);
- INIT_LIST_HEAD(&rxq->rx_free);
- INIT_LIST_HEAD(&rxq->rx_used);
- /* Fill the rx_used queue with _all_ of the Rx buffers */
- for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) {
- /* In the reset function, these buffers may have been allocated
- * to an SKB, so we need to unmap and free potential storage */
- if (rxq->pool[i].skb != NULL) {
- pci_unmap_single(priv->pci_dev,
- rxq->pool[i].real_dma_addr,
- IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
- priv->alloc_rxb_skb--;
- dev_kfree_skb(rxq->pool[i].skb);
- rxq->pool[i].skb = NULL;
- }
- list_add_tail(&rxq->pool[i].list, &rxq->rx_used);
- }
-
- /* Set us so that we have processed and used all buffers, but have
- * not restocked the Rx queue with fresh buffers */
- rxq->read = rxq->write = 0;
- rxq->free_count = 0;
- spin_unlock_irqrestore(&rxq->lock, flags);
-}
-
/* Convert linear signal-to-noise ratio into dB */
static u8 ratio2dB[100] = {
/* 0 1 2 3 4 5 6 7 8 9 */
@@ -7746,7 +7667,7 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
iwl3945_dealloc_ucode_pci(priv);

if (priv->rxq.bd)
- iwl3945_rx_queue_free(priv, &priv->rxq);
+ iwl_rx_queue_free(priv, &priv->rxq);
iwl3945_hw_txq_ctx_free(priv);

iwl3945_unset_hw_params(priv);
--
1.5.3.6


2008-12-22 03:38:44

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 04/10] iwl3945: remove iwl-3945-led.[ch]

From: Samuel Ortiz <[email protected]>

We no longer need the 3945 specific LED files and structures. Remove
iwl-3945-led.[ch] and use iwl-led.[ch] instead.

Signed-off-by: Samuel Ortiz <[email protected]>
Signed-off-by: Abhijeet Kolekar <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/Kconfig | 1 +
drivers/net/wireless/iwlwifi/Makefile | 3 -
drivers/net/wireless/iwlwifi/iwl-3945-led.c | 409 ---------------------------
drivers/net/wireless/iwlwifi/iwl-3945-led.h | 60 ----
drivers/net/wireless/iwlwifi/iwl-3945.c | 10 +-
drivers/net/wireless/iwlwifi/iwl-3945.h | 1 -
drivers/net/wireless/iwlwifi/iwl-dev.h | 11 +-
drivers/net/wireless/iwlwifi/iwl3945-base.c | 7 +-
8 files changed, 5 insertions(+), 497 deletions(-)
delete mode 100644 drivers/net/wireless/iwlwifi/iwl-3945-led.c
delete mode 100644 drivers/net/wireless/iwlwifi/iwl-3945-led.h

diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig
index 47bee0e..5ed2030 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -146,6 +146,7 @@ config IWL3945_SPECTRUM_MEASUREMENT
config IWL3945_LEDS
bool "Enable LEDS features in iwl3945 driver"
depends on IWL3945
+ select IWLWIFI_LEDS
---help---
This option enables LEDS for the iwl3945 driver.

diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile
index 0be9e6b..9808992 100644
--- a/drivers/net/wireless/iwlwifi/Makefile
+++ b/drivers/net/wireless/iwlwifi/Makefile
@@ -15,6 +15,3 @@ iwlagn-$(CONFIG_IWL5000) += iwl-5000.o

obj-$(CONFIG_IWL3945) += iwl3945.o
iwl3945-objs := iwl3945-base.o iwl-3945.o iwl-3945-rs.o
-iwl3945-$(CONFIG_IWL3945_LEDS) += iwl-3945-led.o
-
-
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-led.c b/drivers/net/wireless/iwlwifi/iwl-3945-led.c
deleted file mode 100644
index 10e68d6..0000000
--- a/drivers/net/wireless/iwlwifi/iwl-3945-led.c
+++ /dev/null
@@ -1,409 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- * The full GNU General Public License is included in this distribution in the
- * file called LICENSE.
- *
- * Contact Information:
- * Intel Linux Wireless <[email protected]>
- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
- *
- *****************************************************************************/
-
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/dma-mapping.h>
-#include <linux/delay.h>
-#include <linux/skbuff.h>
-#include <linux/netdevice.h>
-#include <linux/wireless.h>
-#include <net/mac80211.h>
-#include <linux/etherdevice.h>
-#include <asm/unaligned.h>
-
-#include "iwl-commands.h"
-#include "iwl-3945.h"
-
-
-static const struct {
- u16 brightness;
- u8 on_time;
- u8 off_time;
-} blink_tbl[] =
-{
- {300, 25, 25},
- {200, 40, 40},
- {100, 55, 55},
- {70, 65, 65},
- {50, 75, 75},
- {20, 85, 85},
- {15, 95, 95 },
- {10, 110, 110},
- {5, 130, 130},
- {0, 167, 167},
- /*SOLID_ON*/
- {-1, IWL_LED_SOLID, 0}
-};
-
-#define IWL_1MB_RATE (128 * 1024)
-#define IWL_LED_THRESHOLD (16)
-#define IWL_MAX_BLINK_TBL (ARRAY_SIZE(blink_tbl) - 1) /*Exclude Solid on*/
-#define IWL_SOLID_BLINK_IDX (ARRAY_SIZE(blink_tbl) - 1)
-
-static int iwl3945_led_cmd_callback(struct iwl_priv *priv,
- struct iwl_cmd *cmd,
- struct sk_buff *skb)
-{
- return 1;
-}
-
-static inline int iwl3945_brightness_to_idx(enum led_brightness brightness)
-{
- return fls(0x000000FF & (u32)brightness);
-}
-
-/* Send led command */
-static int iwl_send_led_cmd(struct iwl_priv *priv,
- struct iwl_led_cmd *led_cmd)
-{
- struct iwl_host_cmd cmd = {
- .id = REPLY_LEDS_CMD,
- .len = sizeof(struct iwl_led_cmd),
- .data = led_cmd,
- .meta.flags = CMD_ASYNC,
- .meta.u.callback = iwl3945_led_cmd_callback,
- };
-
- return iwl3945_send_cmd(priv, &cmd);
-}
-
-
-
-/* Set led on command */
-static int iwl3945_led_pattern(struct iwl_priv *priv, int led_id,
- unsigned int idx)
-{
- struct iwl_led_cmd led_cmd = {
- .id = led_id,
- .interval = IWL_DEF_LED_INTRVL
- };
-
- BUG_ON(idx > IWL_MAX_BLINK_TBL);
-
- led_cmd.on = blink_tbl[idx].on_time;
- led_cmd.off = blink_tbl[idx].off_time;
-
- return iwl_send_led_cmd(priv, &led_cmd);
-}
-
-
-/* Set led on command */
-static int iwl3945_led_on(struct iwl_priv *priv, int led_id)
-{
- struct iwl_led_cmd led_cmd = {
- .id = led_id,
- .on = IWL_LED_SOLID,
- .off = 0,
- .interval = IWL_DEF_LED_INTRVL
- };
- return iwl_send_led_cmd(priv, &led_cmd);
-}
-
-/* Set led off command */
-static int iwl3945_led_off(struct iwl_priv *priv, int led_id)
-{
- struct iwl_led_cmd led_cmd = {
- .id = led_id,
- .on = 0,
- .off = 0,
- .interval = IWL_DEF_LED_INTRVL
- };
- IWL_DEBUG_LED("led off %d\n", led_id);
- return iwl_send_led_cmd(priv, &led_cmd);
-}
-
-/*
- * brightness call back function for Tx/Rx LED
- */
-static int iwl3945_led_associated(struct iwl_priv *priv, int led_id)
-{
- if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
- !test_bit(STATUS_READY, &priv->status))
- return 0;
-
-
- /* start counting Tx/Rx bytes */
- if (!priv->last_blink_time && priv->allow_blinking)
- priv->last_blink_time = jiffies;
- return 0;
-}
-
-/*
- * brightness call back for association and radio
- */
-static void iwl3945_led_brightness_set(struct led_classdev *led_cdev,
- enum led_brightness brightness)
-{
- struct iwl3945_led *led = container_of(led_cdev,
- struct iwl3945_led, led_dev);
- struct iwl_priv *priv = led->priv;
-
- if (test_bit(STATUS_EXIT_PENDING, &priv->status))
- return;
-
- switch (brightness) {
- case LED_FULL:
- if (led->type == IWL_LED_TRG_ASSOC) {
- priv->allow_blinking = 1;
- IWL_DEBUG_LED("MAC is associated\n");
- }
- if (led->led_on)
- led->led_on(priv, IWL_LED_LINK);
- break;
- case LED_OFF:
- if (led->type == IWL_LED_TRG_ASSOC) {
- priv->allow_blinking = 0;
- IWL_DEBUG_LED("MAC is disassociated\n");
- }
- if (led->led_off)
- led->led_off(priv, IWL_LED_LINK);
- break;
- default:
- if (led->led_pattern) {
- int idx = iwl3945_brightness_to_idx(brightness);
- led->led_pattern(priv, IWL_LED_LINK, idx);
- }
- break;
- }
-}
-
-
-
-/*
- * Register led class with the system
- */
-static int iwl3945_led_register_led(struct iwl_priv *priv,
- struct iwl3945_led *led,
- enum led_type type, u8 set_led,
- char *trigger)
-{
- struct device *device = wiphy_dev(priv->hw->wiphy);
- int ret;
-
- led->led_dev.name = led->name;
- led->led_dev.brightness_set = iwl3945_led_brightness_set;
- led->led_dev.default_trigger = trigger;
-
- led->priv = priv;
- led->type = type;
-
- ret = led_classdev_register(device, &led->led_dev);
- if (ret) {
- IWL_ERR(priv, "Error: failed to register led handler.\n");
- return ret;
- }
-
- led->registered = 1;
-
- if (set_led && led->led_on)
- led->led_on(priv, IWL_LED_LINK);
- return 0;
-}
-
-
-/*
- * calculate blink rate according to last 2 sec Tx/Rx activities
- */
-static inline u8 get_blink_rate(struct iwl_priv *priv)
-{
- int index;
- u64 current_tpt = priv->rxtxpackets;
- s64 tpt = current_tpt - priv->led_tpt;
-
- if (tpt < 0)
- tpt = -tpt;
- priv->led_tpt = current_tpt;
-
- if (!priv->allow_blinking)
- index = IWL_MAX_BLINK_TBL;
- else
- for (index = 0; index < IWL_MAX_BLINK_TBL; index++)
- if (tpt > (blink_tbl[index].brightness * IWL_1MB_RATE))
- break;
- return index;
-}
-
-static inline int is_rf_kill(struct iwl_priv *priv)
-{
- return test_bit(STATUS_RF_KILL_HW, &priv->status) ||
- test_bit(STATUS_RF_KILL_SW, &priv->status);
-}
-
-/*
- * this function called from handler. Since setting Led command can
- * happen very frequent we postpone led command to be called from
- * REPLY handler so we know ucode is up
- */
-void iwl3945_led_background(struct iwl_priv *priv)
-{
- u8 blink_idx;
-
- if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
- priv->last_blink_time = 0;
- return;
- }
- if (is_rf_kill(priv)) {
- priv->last_blink_time = 0;
- return;
- }
-
- if (!priv->allow_blinking) {
- priv->last_blink_time = 0;
- if (priv->last_blink_rate != IWL_SOLID_BLINK_IDX) {
- priv->last_blink_rate = IWL_SOLID_BLINK_IDX;
- iwl3945_led_pattern(priv, IWL_LED_LINK,
- IWL_SOLID_BLINK_IDX);
- }
- return;
- }
- if (!priv->last_blink_time ||
- !time_after(jiffies, priv->last_blink_time +
- msecs_to_jiffies(1000)))
- return;
-
- blink_idx = get_blink_rate(priv);
-
- /* call only if blink rate change */
- if (blink_idx != priv->last_blink_rate)
- iwl3945_led_pattern(priv, IWL_LED_LINK, blink_idx);
-
- priv->last_blink_time = jiffies;
- priv->last_blink_rate = blink_idx;
- priv->rxtxpackets = 0;
-}
-
-
-/* Register all led handler */
-int iwl3945_led_register(struct iwl_priv *priv)
-{
- char *trigger;
- int ret;
-
- priv->last_blink_rate = 0;
- priv->rxtxpackets = 0;
- priv->led_tpt = 0;
- priv->last_blink_time = 0;
- priv->allow_blinking = 0;
-
- trigger = ieee80211_get_radio_led_name(priv->hw);
- snprintf(priv->led39[IWL_LED_TRG_RADIO].name,
- sizeof(priv->led39[IWL_LED_TRG_RADIO].name), "iwl-%s:radio",
- wiphy_name(priv->hw->wiphy));
-
- priv->led39[IWL_LED_TRG_RADIO].led_on = iwl3945_led_on;
- priv->led39[IWL_LED_TRG_RADIO].led_off = iwl3945_led_off;
- priv->led39[IWL_LED_TRG_RADIO].led_pattern = NULL;
-
- ret = iwl3945_led_register_led(priv,
- &priv->led39[IWL_LED_TRG_RADIO],
- IWL_LED_TRG_RADIO, 1, trigger);
-
- if (ret)
- goto exit_fail;
-
- trigger = ieee80211_get_assoc_led_name(priv->hw);
- snprintf(priv->led39[IWL_LED_TRG_ASSOC].name,
- sizeof(priv->led39[IWL_LED_TRG_ASSOC].name), "iwl-%s:assoc",
- wiphy_name(priv->hw->wiphy));
-
- ret = iwl3945_led_register_led(priv,
- &priv->led39[IWL_LED_TRG_ASSOC],
- IWL_LED_TRG_ASSOC, 0, trigger);
-
- /* for assoc always turn led on */
- priv->led39[IWL_LED_TRG_ASSOC].led_on = iwl3945_led_on;
- priv->led39[IWL_LED_TRG_ASSOC].led_off = iwl3945_led_on;
- priv->led39[IWL_LED_TRG_ASSOC].led_pattern = NULL;
-
- if (ret)
- goto exit_fail;
-
- trigger = ieee80211_get_rx_led_name(priv->hw);
- snprintf(priv->led39[IWL_LED_TRG_RX].name,
- sizeof(priv->led39[IWL_LED_TRG_RX].name), "iwl-%s:RX",
- wiphy_name(priv->hw->wiphy));
-
- ret = iwl3945_led_register_led(priv,
- &priv->led39[IWL_LED_TRG_RX],
- IWL_LED_TRG_RX, 0, trigger);
-
- priv->led39[IWL_LED_TRG_RX].led_on = iwl3945_led_associated;
- priv->led39[IWL_LED_TRG_RX].led_off = iwl3945_led_associated;
- priv->led39[IWL_LED_TRG_RX].led_pattern = iwl3945_led_pattern;
-
- if (ret)
- goto exit_fail;
-
- trigger = ieee80211_get_tx_led_name(priv->hw);
- snprintf(priv->led39[IWL_LED_TRG_TX].name,
- sizeof(priv->led39[IWL_LED_TRG_TX].name), "iwl-%s:TX",
- wiphy_name(priv->hw->wiphy));
-
- ret = iwl3945_led_register_led(priv,
- &priv->led39[IWL_LED_TRG_TX],
- IWL_LED_TRG_TX, 0, trigger);
-
- priv->led39[IWL_LED_TRG_TX].led_on = iwl3945_led_associated;
- priv->led39[IWL_LED_TRG_TX].led_off = iwl3945_led_associated;
- priv->led39[IWL_LED_TRG_TX].led_pattern = iwl3945_led_pattern;
-
- if (ret)
- goto exit_fail;
-
- return 0;
-
-exit_fail:
- iwl3945_led_unregister(priv);
- return ret;
-}
-
-
-/* unregister led class */
-static void iwl3945_led_unregister_led(struct iwl3945_led *led, u8 set_led)
-{
- if (!led->registered)
- return;
-
- led_classdev_unregister(&led->led_dev);
-
- if (set_led)
- led->led_dev.brightness_set(&led->led_dev, LED_OFF);
- led->registered = 0;
-}
-
-/* Unregister all led handlers */
-void iwl3945_led_unregister(struct iwl_priv *priv)
-{
- iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_ASSOC], 0);
- iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_RX], 0);
- iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_TX], 0);
- iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_RADIO], 1);
-}
-
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-led.h b/drivers/net/wireless/iwlwifi/iwl-3945-led.h
deleted file mode 100644
index 859bb9b..0000000
--- a/drivers/net/wireless/iwlwifi/iwl-3945-led.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- * The full GNU General Public License is included in this distribution in the
- * file called LICENSE.
- *
- * Contact Information:
- * Intel Linux Wireless <[email protected]>
- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
- *
- *****************************************************************************/
-
-#ifndef IWL3945_LEDS_H
-#define IWL3945_LEDS_H
-
-struct iwl_priv;
-
-#ifdef CONFIG_IWL3945_LEDS
-
-#include "iwl-led.h"
-
-struct iwl3945_led {
- struct iwl_priv *priv;
- struct led_classdev led_dev;
- char name[32];
-
- int (*led_on) (struct iwl_priv *priv, int led_id);
- int (*led_off) (struct iwl_priv *priv, int led_id);
- int (*led_pattern) (struct iwl_priv *priv, int led_id,
- unsigned int idx);
-
- enum led_type type;
- unsigned int registered;
-};
-
-extern int iwl3945_led_register(struct iwl_priv *priv);
-extern void iwl3945_led_unregister(struct iwl_priv *priv);
-extern void iwl3945_led_background(struct iwl_priv *priv);
-
-#else
-static inline int iwl3945_led_register(struct iwl_priv *priv) { return 0; }
-static inline void iwl3945_led_unregister(struct iwl_priv *priv) {}
-static inline void iwl3945_led_background(struct iwl_priv *priv) {}
-#endif /* CONFIG_IWL3945_LEDS */
-
-#endif /* IWL3945_LEDS_H */
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 41556b4..ae68f2b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -399,7 +399,7 @@ void iwl3945_hw_rx_statistics(struct iwl_priv *priv, struct iwl_rx_mem_buffer *r

memcpy(&priv->statistics_39, pkt->u.raw, sizeof(priv->statistics_39));

- iwl3945_led_background(priv);
+ iwl_leds_background(priv);

priv->last_statistics_time = jiffies;
}
@@ -576,9 +576,6 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv,
struct ieee80211_rx_status *stats)
{
struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
-#ifdef CONFIG_IWL3945_LEDS
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IWL_RX_DATA(pkt);
-#endif
struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt);
short len = le16_to_cpu(rx_hdr->len);
@@ -603,11 +600,6 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv,
if (iwl3945_mod_params.sw_crypto)
iwl3945_set_decrypted_flag(priv, rxb->skb,
le32_to_cpu(rx_end->status), stats);
-
-#ifdef CONFIG_IWL3945_LEDS
- if (ieee80211_is_data(hdr->frame_control))
- priv->rxtxpackets += len;
-#endif
ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats);
rxb->skb = NULL;
}
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index e584032..941746b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -50,7 +50,6 @@ extern struct pci_device_id iwl3945_hw_card_ids[];
#include "iwl-debug.h"
#include "iwl-power.h"
#include "iwl-dev.h"
-#include "iwl-3945-led.h"

/* Highest firmware API version supported */
#define IWL3945_UCODE_API_MAX 2
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 9b9d743..ef1099c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -44,7 +44,6 @@
#include "iwl-rfkill.h"
#include "iwl-4965-hw.h"
#include "iwl-3945-hw.h"
-#include "iwl-3945-led.h"
#include "iwl-led.h"
#include "iwl-power.h"
#include "iwl-agn-rs.h"
@@ -904,21 +903,13 @@ struct iwl_priv {
struct rfkill *rfkill;
#endif

-#if defined(CONFIG_IWLWIFI_LEDS) || defined(CONFIG_IWL3945_LEDS)
+#ifdef CONFIG_IWLWIFI_LEDS
unsigned long last_blink_time;
u8 last_blink_rate;
u8 allow_blinking;
u64 led_tpt;
-#endif
-
-#ifdef CONFIG_IWLWIFI_LEDS
struct iwl_led led[IWL_LED_TRG_MAX];
#endif
-
-#ifdef CONFIG_IWL3945_LEDS
- struct iwl3945_led led39[IWL_LED_TRG_MAX];
- unsigned int rxtxpackets;
-#endif
u16 active_rate;
u16 active_rate_basic;

diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 98f5b7f..408a6d0 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2177,9 +2177,6 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv,
cmd->cmd.tx.timeout.pm_frame_timeout = cpu_to_le16(2);
} else {
cmd->cmd.tx.timeout.pm_frame_timeout = 0;
-#ifdef CONFIG_IWL3945_LEDS
- priv->rxtxpackets += le16_to_cpu(cmd->cmd.tx.len);
-#endif
}

cmd->cmd.tx.driver_txop = 0;
@@ -5386,7 +5383,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv)

iwl3945_reg_txpower_periodic(priv);

- iwl3945_led_register(priv);
+ iwl_leds_register(priv);

IWL_DEBUG_INFO("ALIVE processing complete.\n");
set_bit(STATUS_READY, &priv->status);
@@ -5424,7 +5421,7 @@ static void __iwl3945_down(struct iwl_priv *priv)
if (!exit_pending)
set_bit(STATUS_EXIT_PENDING, &priv->status);

- iwl3945_led_unregister(priv);
+ iwl_leds_unregister(priv);
iwl3945_clear_stations_table(priv);

/* Unblock any waiting calls */
--
1.5.3.6


2008-12-23 02:57:08

by Zhu Yi

[permalink] [raw]
Subject: Re: [PATCH 10/10] iwl3945: use rx queue management infrastructure from iwlcore

On Mon, 2008-12-22 at 22:07 +0800, Kalle Valo wrote:
> Yes, ifconfig up works but now iwlist wlan0 scan crashes. I just
> tested this once due to lack of time.
>
> I hope I get my wifi working before Christmas ;)

http://marc.info/?l=linux-wireless&m=123000088608330&w=2 should fix the
problem. Thanks a lot for your testing.

Thanks,
-yi


2008-12-22 14:08:03

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 10/10] iwl3945: use rx queue management infrastructure from iwlcore

Zhu Yi <[email protected]> writes:

> From: Winkler, Tomas <[email protected]>
>
> This patch uses rx queue alloc free and reset function from iwlcore.
> This should fix the regression reported by Kalle Valo.

Yes, ifconfig up works but now iwlist wlan0 scan crashes. I just
tested this once due to lack of time.

I hope I get my wifi working before Christmas ;)

[18031.912914] iwl3945: Intel(R) PRO/Wireless 3945ABG/BG Network Connection driver for Linux, 1.2.26kd
[18031.912929] iwl3945: Copyright(c) 2003-2008 Intel Corporation
[18031.913084] iwl3945 0000:03:00.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
[18031.972027] iwl3945 0000:03:00.0: Tunable channels: 13 802.11bg, 23 802.11a channels
[18031.972043] iwl3945 0000:03:00.0: Detected Intel Wireless WiFi Link 3945ABG
[18068.633607] iwl3945 0000:03:00.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
[18068.634164] iwl3945 0000:03:00.0: firmware: requesting iwlwifi-3945-2.ucode
[18068.758728] iwl3945 0000:03:00.0: iwlwifi-3945-2.ucode firmware file req failed: -2
[18068.758746] iwl3945 0000:03:00.0: firmware: requesting iwlwifi-3945-1.ucode
[18068.803611] iwl3945 0000:03:00.0: Loaded firmware iwlwifi-3945-1.ucode, which is deprecated. Please use API v2 instead.
[18068.803629] iwl3945 0000:03:00.0: Firmware has old API version. Expected 2, got 1. New firmware can be obtained from http://www.intellinuxwireless.org.
[18068.803638] iwl3945 0000:03:00.0: loaded firmware version 15.28.1.6
[18068.864814] Registered led device: iwl-phy1:radio
[18068.864869] Registered led device: iwl-phy1:assoc
[18068.864916] Registered led device: iwl-phy1:RX
[18068.864958] Registered led device: iwl-phy1:TX
[18068.895330] ADDRCONF(NETDEV_UP): wlan0: link is not ready
[18074.727526] BUG: unable to handle kernel NULL pointer dereference at 00000980
[18074.727549] IP: [<f9a3ee5c>] iwl_enqueue_hcmd+0x155/0x3a2 [iwlcore]
[18074.727583] *pde = 00000000
[18074.727593] Oops: 0002 [#1] SMP
[18074.727605] last sysfs file: /sys/class/firmware/0000:03:00.0/loading
[18074.727611] Modules linked in: iwl3945 iwlcore netconsole configfs cdc_acm cdc_ether usbnet mii pl2303 usbserial i915 drm rfcomm l2cap cpufreq_ondemand binfmt_misc ipv6 fuse acpi_cpufreq freq_table loop snd_hda_intel snd_pcm arc4 ecb snd_seq snd_timer snd_seq_device snd mac80211 thinkpad_acpi hci_usb soundcore pcmcia rfkill lib80211 video backlight i2c_i801 psmouse pcspkr cfg80211 bluetooth yenta_socket rsrc_nonstatic pcmcia_core snd_page_alloc rng_core output led_class battery ac nvram ext3 aes_i586 dm_mirror dm_region_hash dm_mod sd_mod ide_pci_generic sdhci ehci_hcd e1000e processor [last unloaded: iwlcore][18074.727916] Pid: 0, comm: swapper Not tainted (2.6.28-rc9-wl #105) 1703Y1F
[18074.727924] EIP: 0060:[<f9a3ee5c>] EFLAGS: 00010002 CPU: 0
[18074.727949] EIP is at iwl_enqueue_hcmd+0x155/0x3a2 [iwlcore]
[18074.727963] ESI: 00000000 EDI: 00000980 EBP: c03b1d80 ESP: c03b1d40
[18074.727970] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
[18074.727977] Process swapper (pid: 0, ti=c03b0000 task=c037732c task.ti=c03b0000)
eebc148c c011a998 c03b1d60
f2689c00 c03b1dac[18074.728049] f9a3a8ef cea6b0fc d55555d5[18074.728084] Call Trace:
[18074.728089] [<f9a3a8ef>] ? iwl_send_cmd_async+0x44/0x8a [iwlcore]
[18074.728136] [<f9a3ae4c>] ? iwl_send_cmd+0xe/0x1a [iwlcore]
[<f9a47656>] ? iwl4965_led_pattern+0x156/0x15e [iwlcore]
[18074.728192] [<f9a3a982>] ? iwl_generic_cmd_callback+0x0/0x108 [iwlcore]
[18074.728220] [<f9a47917>] ? iwl_leds_background+0x66/0x207 [iwlcore]
[18074.728249] [<f9b65ae5>] ? iwl3945_hw_rx_statistics+0x92/0xa9 [iwl3945]
[<f9b5a41d>] ? iwl3945_irq_tasklet+0x863/0x1058 [iwl3945]
[18074.728297] [<c01373aa>] ? update_wall_time+0x5e1/0x712
[18074.728312] [<c0125cf9>] ? irq_exit+0x38/0x6d
[<c010502d>] ? do_IRQ+0x6f/0x86
[<c01039f3>] ? common_interrupt+0x23/0x28
[18074.728390] [<c01e7918>] ? acpi_os_release_lock+0x8/0xa
[18074.728435] [<f806bf80>] ? acpi_idle_enter_bm+0xca/0x35a [processor]
[18074.728457] [<c0240839>] ? cpuidle_idle_call+0x60/0x93
[<c0101f60>] ? cpu_idle+0x6b/0x87
[<c02935ca>] ? rest_init+0x4e/0x50
f0 2c 86 c0 4d 45 f0 8b 00 8b 38 00 00 01 b9 89 55 d4 ab c0 0c 01 38 00 8b 00 00 iwl_enqueue_hcmd+0x155/0x3a2 [iwlcore][18074.728457] Kernel panic - not syncing: Fatal exception in interrupt
[18074.728457] ------------[ cut here ]------------
[18074.728457] WARNING: at kernel/smp.c:333 smp_call_function_mask+0x28/0x17d()
[18074.728457] Modules linked in: iwl3945 configfs cdc_acm usbnet usbserial rfcomm l2cap fuse loop arc4 snd_seq mac80211 soundcore pcmcia rfkill i2c_i801 pcspkr yenta_socket snd_page_alloc rng_core led_class ac jbd mbcache sha256_generic dm_crypt dm_log dm_mod sd_mod ata_generic ide_pci_generic ide_core uhci_hcd usbcore fan
[18074.728457] Pid: 0, comm: swapper Tainted: G D 2.6.28-rc9-wl #105
[18074.728457] [<c029f7fb>] ? printk+0xf/0x14
[18074.728457] [<c01219a3>] warn_on_slowpath+0x41/0x63
[18074.728457] [<c025a4f2>] ? netpoll_send_udp+0x1e8/0x1f2
[18074.728457] [<f96f8178>] ? write_msg+0xb1/0xb9 [netconsole]
[18074.728457] [<c013dd9c>] smp_call_function_mask+0x28/0x17d
[18074.728457] [<c01100c7>] ? stop_this_cpu+0x0/0x36
[18074.728457] [<c01100ba>] native_smp_send_stop+0x1b/0x28
[18074.728457] [<c029f759>] panic+0x41/0xd4
[18074.728457] [<c0105703>] die+0x5b/0x63
[18074.728457] [<c0115e45>] do_page_fault+0x549/0x63c
[18074.728457] [<c011d49f>] ? default_wake_function+0xb/0xd
[18074.728457] [<c01317fe>] ? autoremove_wake_function+0xf/0x33
[18074.728457] [<c0131858>] ? wake_bit_function+0x36/0x43
[18074.728457] [<c01196e4>] ? __wake_up_common+0x35/0x5b
[18074.728457] [<c0131788>] ? __wake_up_bit+0x2c/0x32
[18074.728457] [<c014ebe9>] ? mempool_free+0x64/0x6b
[18074.728457] [<c014ea00>] ? mempool_free_slab+0xe/0x10
[18074.728457] [<c014ebe9>] ? mempool_free+0x64/0x6b
[18074.728457] [<c01158fc>] ? do_page_fault+0x0/0x63c
[18074.728457] [<c01400d8>] ? load_module+0x6dd/0x1908
[18074.728457] [<f9a3ee5c>] ? iwl_enqueue_hcmd+0x155/0x3a2 [iwlcore]
[18074.728457] [<c011a998>] ? enqueue_task_fair+0x131/0x17a
[18074.728457] [<f9a3ae4c>] iwl_send_cmd+0xe/0x1a [iwlcore]
[18074.728457] [<f9a47656>] iwl4965_led_pattern+0x156/0x15e [iwlcore]
[18074.728457] [<f9a3a982>] ? iwl_generic_cmd_callback+0x0/0x108 [iwlcore]
[18074.728457] [<f9a47917>] iwl_leds_background+0x66/0x207 [iwlcore]
[18074.728457] [<f9b65ae5>] iwl3945_hw_rx_statistics+0x92/0xa9 [iwl3945]
[18074.728457] [<c01373aa>] ? update_wall_time+0x5e1/0x712
[18074.728457] [<c012555d>] tasklet_action+0x61/0xac
[18074.728457] [<c0125bf4>] do_softirq+0x35/0x3a
[18074.728457] [<c010502d>] do_IRQ+0x6f/0x86
[18074.728457] [<f806c3a8>] ? acpi_idle_enter_simple+0x198/0x205 [processor]
[18074.728457] [<c01e7918>] ? acpi_os_release_lock+0x8/0xa
[18074.728457] [<f806bf80>] acpi_idle_enter_bm+0xca/0x35a [processor]
[18074.728457] [<c024125e>] ? menu_select+0x38/0x86
[18074.728457] [<c0240839>] cpuidle_idle_call+0x60/0x93
[18074.728457] [<c02935ca>] rest_init+0x4e/0x50
[18074.728457] ------------[ cut here ]------------
[18074.728457] WARNING: at kernel/smp.c:220 smp_call_function_single+0x2d/0x9c()
[18074.728457] Modules linked in: iwl3945 cdc_acm mii i915 drm binfmt_misc fuse freq_table snd_pcm arc4 ecb snd thinkpad_acpi soundcore pcmcia backlight psmouse bluetooth rsrc_nonstatic pcmcia_core battery button ext3 jbd mbcache cbc dm_region_hash dm_snapshot dm_mod libata ide_pci_generic sdhci_pci sdhci ehci_hcd ide_core usbcore processor fan
[18074.728457] Pid: 0, comm: swapper Tainted: G D W 2.6.28-rc9-wl #105
[18074.728457] Call Trace:
[18074.728457] [<c029f7fb>] ? printk+0xf/0x14
[18074.728457] [<c01219a3>] warn_on_slowpath+0x41/0x63
[18074.728457] [<c02a1abf>] ? _spin_unlock+0x8/0xa
[18074.728457] [<c025a4f2>] ? netpoll_send_udp+0x1e8/0x1f2
[18074.728457] [<f96f8178>] ? write_msg+0xb1/0xb9 [netconsole]
[18074.728457] [<c013dd05>] smp_call_function_single+0x2d/0x9c
[18074.728457] [<c013ddeb>] smp_call_function_mask+0x77/0x17d
[18074.728457] [<c01100c7>] ? stop_this_cpu+0x0/0x36
[18074.728457] [<c01100ba>] native_smp_send_stop+0x1b/0x28
[18074.728457] [<c0105158>] oops_end+0x5d/0x71
[18074.728457] [<c0115e45>] do_page_fault+0x549/0x63c
[18074.728457] [<c011d49f>] ? default_wake_function+0xb/0xd
[18074.728457] [<c0131858>] ? wake_bit_function+0x36/0x43
[18074.728457] [<c01196e4>] ? __wake_up_common+0x35/0x5b
[18074.728457] [<c0119db3>] ? __wake_up+0x31/0x3b
[18074.728457] [<c014ea00>] ? mempool_free_slab+0xe/0x10
[18074.728457] [<c01895b2>] ? bio_free+0x31/0x35
[18074.728457] [<c014ea00>] ? mempool_free_slab+0xe/0x10
[18074.728457] [<c01158fc>] ? do_page_fault+0x0/0x63c
[18074.728457] [<c01400d8>] ? load_module+0x6dd/0x1908
[18074.728457] [<f9a3ee5c>] ? iwl_enqueue_hcmd+0x155/0x3a2 [iwlcore]
[18074.728457] [<c011a998>] ? enqueue_task_fair+0x131/0x17a
[18074.728457] [<f9a3a8ef>] iwl_send_cmd_async+0x44/0x8a [iwlcore]
[18074.728457] [<f9a47656>] iwl4965_led_pattern+0x156/0x15e [iwlcore]
[18074.728457] [<f9a3a982>] ? iwl_generic_cmd_callback+0x0/0x108 [iwlcore]
[18074.728457] [<f9a47917>] iwl_leds_background+0x66/0x207 [iwlcore]
[18074.728457] [<f9b65ae5>] iwl3945_hw_rx_statistics+0x92/0xa9 [iwl3945]
[18074.728457] [<f9b5a41d>] iwl3945_irq_tasklet+0x863/0x1058 [iwl3945]
[18074.728457] [<c01373aa>] ? update_wall_time+0x5e1/0x712
[18074.728457] [<c012555d>] tasklet_action+0x61/0xac
[18074.728457] [<c0125bf4>] do_softirq+0x35/0x3a
[18074.728457] [<c010502d>] do_IRQ+0x6f/0x86
[18074.728457] [<f806c3a8>] ? acpi_idle_enter_simple+0x198/0x205 [processor]
[18074.728457] [<c01e7918>] ? acpi_os_release_lock+0x8/0xa
[18074.728457] [<f806bf80>] acpi_idle_enter_bm+0xca/0x35a [processor]
[18074.728457] [<c0240839>] cpuidle_idle_call+0x60/0x93
[18074.728457] [<c0101f60>] cpu_idle+0x6b/0x87
[18074.728457] ---[ end trace 7a31e9607358195d ]---

--
Kalle Valo