2011-11-18 08:20:52

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 01/77] iwlegacy: remove tracing

This is not useful.

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/Kconfig | 17 --
drivers/net/wireless/iwlegacy/Makefile | 3 -
drivers/net/wireless/iwlegacy/iwl-4965-tx.c | 6 -
drivers/net/wireless/iwlegacy/iwl-devtrace.c | 42 -----
drivers/net/wireless/iwlegacy/iwl-devtrace.h | 210 --------------------------
drivers/net/wireless/iwlegacy/iwl-io.h | 4 -
drivers/net/wireless/iwlegacy/iwl-tx.c | 3 -
drivers/net/wireless/iwlegacy/iwl3945-base.c | 3 -
drivers/net/wireless/iwlegacy/iwl4965-base.c | 5 -
9 files changed, 0 insertions(+), 293 deletions(-)
delete mode 100644 drivers/net/wireless/iwlegacy/iwl-devtrace.c
delete mode 100644 drivers/net/wireless/iwlegacy/iwl-devtrace.h

diff --git a/drivers/net/wireless/iwlegacy/Kconfig b/drivers/net/wireless/iwlegacy/Kconfig
index aef65cd..2a1ae10 100644
--- a/drivers/net/wireless/iwlegacy/Kconfig
+++ b/drivers/net/wireless/iwlegacy/Kconfig
@@ -43,23 +43,6 @@ config IWLWIFI_LEGACY_DEBUGFS
is a low-impact option that allows getting insight into the
driver's state at runtime.

-config IWLWIFI_LEGACY_DEVICE_TRACING
- bool "iwlwifilegacy legacy device access tracing"
- depends on IWLWIFI_LEGACY
- depends on EVENT_TRACING
- help
- Say Y here to trace all commands, including TX frames and IO
- accesses, sent to the device. If you say yes, iwlwifilegacy will
- register with the ftrace framework for event tracing and dump
- all this information to the ringbuffer, you may need to
- increase the ringbuffer size. See the ftrace documentation
- for more information.
-
- When tracing is not enabled, this option still has some
- (though rather small) overhead.
-
- If unsure, say Y so we can help you better when problems
- occur.
endmenu

config IWL4965
diff --git a/drivers/net/wireless/iwlegacy/Makefile b/drivers/net/wireless/iwlegacy/Makefile
index d56aeb3..4f67e45 100644
--- a/drivers/net/wireless/iwlegacy/Makefile
+++ b/drivers/net/wireless/iwlegacy/Makefile
@@ -3,12 +3,9 @@ iwl-legacy-objs := iwl-core.o iwl-eeprom.o iwl-hcmd.o iwl-power.o
iwl-legacy-objs += iwl-rx.o iwl-tx.o iwl-sta.o
iwl-legacy-objs += iwl-scan.o iwl-led.o
iwl-legacy-$(CONFIG_IWLWIFI_LEGACY_DEBUGFS) += iwl-debugfs.o
-iwl-legacy-$(CONFIG_IWLWIFI_LEGACY_DEVICE_TRACING) += iwl-devtrace.o

iwl-legacy-objs += $(iwl-legacy-m)

-CFLAGS_iwl-devtrace.o := -I$(src)
-
# 4965
obj-$(CONFIG_IWL4965) += iwl4965.o
iwl4965-objs := iwl-4965.o iwl4965-base.o iwl-4965-rs.o iwl-4965-led.o
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
index 7f12e36..e421fdf 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
@@ -513,12 +513,6 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
pci_dma_sync_single_for_device(priv->pci_dev, txcmd_phys,
firstlen, PCI_DMA_BIDIRECTIONAL);

- trace_iwlwifi_legacy_dev_tx(priv,
- &((struct iwl_tfd *)txq->tfds)[txq->q.write_ptr],
- sizeof(struct iwl_tfd),
- &out_cmd->hdr, firstlen,
- skb->data + hdr_len, secondlen);
-
/* Tell device the write index *just past* this latest filled TFD */
q->write_ptr = iwl_legacy_queue_inc_wrap(q->write_ptr, q->n_bd);
iwl_legacy_txq_update_write_ptr(priv, txq);
diff --git a/drivers/net/wireless/iwlegacy/iwl-devtrace.c b/drivers/net/wireless/iwlegacy/iwl-devtrace.c
deleted file mode 100644
index acec991..0000000
--- a/drivers/net/wireless/iwlegacy/iwl-devtrace.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2009 - 2011 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/module.h>
-
-/* sparse doesn't like tracepoint macros */
-#ifndef __CHECKER__
-#include "iwl-dev.h"
-
-#define CREATE_TRACE_POINTS
-#include "iwl-devtrace.h"
-
-EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_iowrite8);
-EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_ioread32);
-EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_iowrite32);
-EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_rx);
-EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_tx);
-EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_ucode_error);
-#endif
diff --git a/drivers/net/wireless/iwlegacy/iwl-devtrace.h b/drivers/net/wireless/iwlegacy/iwl-devtrace.h
deleted file mode 100644
index a443725..0000000
--- a/drivers/net/wireless/iwlegacy/iwl-devtrace.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2009 - 2011 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
- *
- *****************************************************************************/
-
-#if !defined(__IWLWIFI_LEGACY_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ)
-#define __IWLWIFI_LEGACY_DEVICE_TRACE
-
-#include <linux/tracepoint.h>
-
-#if !defined(CONFIG_IWLWIFI_LEGACY_DEVICE_TRACING) || defined(__CHECKER__)
-#undef TRACE_EVENT
-#define TRACE_EVENT(name, proto, ...) \
-static inline void trace_ ## name(proto) {}
-#endif
-
-
-#define PRIV_ENTRY __field(struct iwl_priv *, priv)
-#define PRIV_ASSIGN (__entry->priv = priv)
-
-#undef TRACE_SYSTEM
-#define TRACE_SYSTEM iwlwifi_legacy_io
-
-TRACE_EVENT(iwlwifi_legacy_dev_ioread32,
- TP_PROTO(struct iwl_priv *priv, u32 offs, u32 val),
- TP_ARGS(priv, offs, val),
- TP_STRUCT__entry(
- PRIV_ENTRY
- __field(u32, offs)
- __field(u32, val)
- ),
- TP_fast_assign(
- PRIV_ASSIGN;
- __entry->offs = offs;
- __entry->val = val;
- ),
- TP_printk("[%p] read io[%#x] = %#x", __entry->priv,
- __entry->offs, __entry->val)
-);
-
-TRACE_EVENT(iwlwifi_legacy_dev_iowrite8,
- TP_PROTO(struct iwl_priv *priv, u32 offs, u8 val),
- TP_ARGS(priv, offs, val),
- TP_STRUCT__entry(
- PRIV_ENTRY
- __field(u32, offs)
- __field(u8, val)
- ),
- TP_fast_assign(
- PRIV_ASSIGN;
- __entry->offs = offs;
- __entry->val = val;
- ),
- TP_printk("[%p] write io[%#x] = %#x)", __entry->priv,
- __entry->offs, __entry->val)
-);
-
-TRACE_EVENT(iwlwifi_legacy_dev_iowrite32,
- TP_PROTO(struct iwl_priv *priv, u32 offs, u32 val),
- TP_ARGS(priv, offs, val),
- TP_STRUCT__entry(
- PRIV_ENTRY
- __field(u32, offs)
- __field(u32, val)
- ),
- TP_fast_assign(
- PRIV_ASSIGN;
- __entry->offs = offs;
- __entry->val = val;
- ),
- TP_printk("[%p] write io[%#x] = %#x)", __entry->priv,
- __entry->offs, __entry->val)
-);
-
-#undef TRACE_SYSTEM
-#define TRACE_SYSTEM iwlwifi_legacy_ucode
-
-#undef TRACE_SYSTEM
-#define TRACE_SYSTEM iwlwifi
-
-TRACE_EVENT(iwlwifi_legacy_dev_hcmd,
- TP_PROTO(struct iwl_priv *priv, void *hcmd, size_t len, u32 flags),
- TP_ARGS(priv, hcmd, len, flags),
- TP_STRUCT__entry(
- PRIV_ENTRY
- __dynamic_array(u8, hcmd, len)
- __field(u32, flags)
- ),
- TP_fast_assign(
- PRIV_ASSIGN;
- memcpy(__get_dynamic_array(hcmd), hcmd, len);
- __entry->flags = flags;
- ),
- TP_printk("[%p] hcmd %#.2x (%ssync)",
- __entry->priv, ((u8 *)__get_dynamic_array(hcmd))[0],
- __entry->flags & CMD_ASYNC ? "a" : "")
-);
-
-TRACE_EVENT(iwlwifi_legacy_dev_rx,
- TP_PROTO(struct iwl_priv *priv, void *rxbuf, size_t len),
- TP_ARGS(priv, rxbuf, len),
- TP_STRUCT__entry(
- PRIV_ENTRY
- __dynamic_array(u8, rxbuf, len)
- ),
- TP_fast_assign(
- PRIV_ASSIGN;
- memcpy(__get_dynamic_array(rxbuf), rxbuf, len);
- ),
- TP_printk("[%p] RX cmd %#.2x",
- __entry->priv, ((u8 *)__get_dynamic_array(rxbuf))[4])
-);
-
-TRACE_EVENT(iwlwifi_legacy_dev_tx,
- TP_PROTO(struct iwl_priv *priv, void *tfd, size_t tfdlen,
- void *buf0, size_t buf0_len,
- void *buf1, size_t buf1_len),
- TP_ARGS(priv, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len),
- TP_STRUCT__entry(
- PRIV_ENTRY
-
- __field(size_t, framelen)
- __dynamic_array(u8, tfd, tfdlen)
-
- /*
- * Do not insert between or below these items,
- * we want to keep the frame together (except
- * for the possible padding).
- */
- __dynamic_array(u8, buf0, buf0_len)
- __dynamic_array(u8, buf1, buf1_len)
- ),
- TP_fast_assign(
- PRIV_ASSIGN;
- __entry->framelen = buf0_len + buf1_len;
- memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
- memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
- memcpy(__get_dynamic_array(buf1), buf1, buf1_len);
- ),
- TP_printk("[%p] TX %.2x (%zu bytes)",
- __entry->priv,
- ((u8 *)__get_dynamic_array(buf0))[0],
- __entry->framelen)
-);
-
-TRACE_EVENT(iwlwifi_legacy_dev_ucode_error,
- TP_PROTO(struct iwl_priv *priv, u32 desc, u32 time,
- u32 data1, u32 data2, u32 line, u32 blink1,
- u32 blink2, u32 ilink1, u32 ilink2),
- TP_ARGS(priv, desc, time, data1, data2, line,
- blink1, blink2, ilink1, ilink2),
- TP_STRUCT__entry(
- PRIV_ENTRY
- __field(u32, desc)
- __field(u32, time)
- __field(u32, data1)
- __field(u32, data2)
- __field(u32, line)
- __field(u32, blink1)
- __field(u32, blink2)
- __field(u32, ilink1)
- __field(u32, ilink2)
- ),
- TP_fast_assign(
- PRIV_ASSIGN;
- __entry->desc = desc;
- __entry->time = time;
- __entry->data1 = data1;
- __entry->data2 = data2;
- __entry->line = line;
- __entry->blink1 = blink1;
- __entry->blink2 = blink2;
- __entry->ilink1 = ilink1;
- __entry->ilink2 = ilink2;
- ),
- TP_printk("[%p] #%02d %010u data 0x%08X 0x%08X line %u, "
- "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X",
- __entry->priv, __entry->desc, __entry->time, __entry->data1,
- __entry->data2, __entry->line, __entry->blink1,
- __entry->blink2, __entry->ilink1, __entry->ilink2)
-);
-
-#endif /* __IWLWIFI_DEVICE_TRACE */
-
-#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
-#undef TRACE_INCLUDE_FILE
-#define TRACE_INCLUDE_FILE iwl-devtrace
-#include <trace/define_trace.h>
diff --git a/drivers/net/wireless/iwlegacy/iwl-io.h b/drivers/net/wireless/iwlegacy/iwl-io.h
index 5cc5d34..868ef01 100644
--- a/drivers/net/wireless/iwlegacy/iwl-io.h
+++ b/drivers/net/wireless/iwlegacy/iwl-io.h
@@ -33,7 +33,6 @@

#include "iwl-dev.h"
#include "iwl-debug.h"
-#include "iwl-devtrace.h"

/*
* IO, register, and NIC memory access functions
@@ -65,7 +64,6 @@

static inline void _iwl_legacy_write8(struct iwl_priv *priv, u32 ofs, u8 val)
{
- trace_iwlwifi_legacy_dev_iowrite8(priv, ofs, val);
iowrite8(val, priv->hw_base + ofs);
}

@@ -86,7 +84,6 @@ __iwl_legacy_write8(const char *f, u32 l, struct iwl_priv *priv,

static inline void _iwl_legacy_write32(struct iwl_priv *priv, u32 ofs, u32 val)
{
- trace_iwlwifi_legacy_dev_iowrite32(priv, ofs, val);
iowrite32(val, priv->hw_base + ofs);
}

@@ -107,7 +104,6 @@ __iwl_legacy_write32(const char *f, u32 l, struct iwl_priv *priv,
static inline u32 _iwl_legacy_read32(struct iwl_priv *priv, u32 ofs)
{
u32 val = ioread32(priv->hw_base + ofs);
- trace_iwlwifi_legacy_dev_ioread32(priv, ofs, val);
return val;
}

diff --git a/drivers/net/wireless/iwlegacy/iwl-tx.c b/drivers/net/wireless/iwlegacy/iwl-tx.c
index ef9e268..e1a559b 100644
--- a/drivers/net/wireless/iwlegacy/iwl-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-tx.c
@@ -539,9 +539,6 @@ int iwl_legacy_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
dma_unmap_addr_set(out_meta, mapping, phys_addr);
dma_unmap_len_set(out_meta, len, fix_size);

- trace_iwlwifi_legacy_dev_hcmd(priv, &out_cmd->hdr,
- fix_size, cmd->flags);
-
priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
phys_addr, fix_size, 1,
U32_PAD(cmd->len));
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index b282d86..7507819 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -1246,7 +1246,6 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)

len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK;
len += sizeof(u32); /* account for status word */
- trace_iwlwifi_legacy_dev_rx(priv, pkt, len);

/* Reclaim a command buffer only if this packet is a response
* to a (driver-originated) command.
@@ -1403,8 +1402,6 @@ void iwl3945_dump_nic_error_log(struct iwl_priv *priv)
"%-13s (0x%X) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n",
iwl3945_desc_lookup(desc), desc, time, blink1, blink2,
ilink1, ilink2, data1);
- trace_iwlwifi_legacy_dev_ucode_error(priv, desc, time, data1, 0,
- 0, blink1, blink2, ilink1, ilink2);
}
}

diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
index d2fba9e..fd2f7a4 100644
--- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
@@ -679,7 +679,6 @@ void iwl4965_rx_handle(struct iwl_priv *priv)

len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK;
len += sizeof(u32); /* account for status word */
- trace_iwlwifi_legacy_dev_rx(priv, pkt, len);

/* Reclaim a command buffer only if this packet is a response
* to a (driver-originated) command.
@@ -1569,10 +1568,6 @@ void iwl4965_dump_nic_error_log(struct iwl_priv *priv)
time = iwl_legacy_read_targ_mem(priv, base + 11 * sizeof(u32));
hcmd = iwl_legacy_read_targ_mem(priv, base + 22 * sizeof(u32));

- trace_iwlwifi_legacy_dev_ucode_error(priv, desc,
- time, data1, data2, line,
- blink1, blink2, ilink1, ilink2);
-
IWL_ERR(priv, "Desc Time "
"data1 data2 line\n");
IWL_ERR(priv, "%-28s (0x%04X) %010u 0x%08X 0x%08X %u\n",
--
1.7.1



2011-11-18 08:22:50

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 56/77] iwlegacy: remove iwl-helpers.h

This file was already merged into common.h

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/iwl-helpers.h | 187 ---------------------------
1 files changed, 0 insertions(+), 187 deletions(-)
delete mode 100644 drivers/net/wireless/iwlegacy/iwl-helpers.h

diff --git a/drivers/net/wireless/iwlegacy/iwl-helpers.h b/drivers/net/wireless/iwlegacy/iwl-helpers.h
deleted file mode 100644
index 2db83fc..0000000
--- a/drivers/net/wireless/iwlegacy/iwl-helpers.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved.
- *
- * Portions of this file are derived from the ipw3945 project, as well
- * as portions of the ieee80211 subsystem header files.
- *
- * 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 __il_helpers_h__
-#define __il_helpers_h__
-
-#include <linux/ctype.h>
-#include <net/mac80211.h>
-
-#include "iwl-io.h"
-
-/**
- * il_queue_inc_wrap - increment queue idx, wrap back to beginning
- * @idx -- current idx
- * @n_bd -- total number of entries in queue (must be power of 2)
- */
-static inline int il_queue_inc_wrap(int idx, int n_bd)
-{
- return ++idx & (n_bd - 1);
-}
-
-/**
- * il_queue_dec_wrap - decrement queue idx, wrap back to end
- * @idx -- current idx
- * @n_bd -- total number of entries in queue (must be power of 2)
- */
-static inline int il_queue_dec_wrap(int idx, int n_bd)
-{
- return --idx & (n_bd - 1);
-}
-
-/* TODO: Move fw_desc functions to iwl-pci.ko */
-static inline void il_free_fw_desc(struct pci_dev *pci_dev,
- struct fw_desc *desc)
-{
- if (desc->v_addr)
- dma_free_coherent(&pci_dev->dev, desc->len,
- desc->v_addr, desc->p_addr);
- desc->v_addr = NULL;
- desc->len = 0;
-}
-
-static inline int il_alloc_fw_desc(struct pci_dev *pci_dev,
- struct fw_desc *desc)
-{
- if (!desc->len) {
- desc->v_addr = NULL;
- return -EINVAL;
- }
-
- desc->v_addr = dma_alloc_coherent(&pci_dev->dev, desc->len,
- &desc->p_addr, GFP_KERNEL);
- return (desc->v_addr != NULL) ? 0 : -ENOMEM;
-}
-
-/*
- * we have 8 bits used like this:
- *
- * 7 6 5 4 3 2 1 0
- * | | | | | | | |
- * | | | | | | +-+-------- AC queue (0-3)
- * | | | | | |
- * | +-+-+-+-+------------ HW queue ID
- * |
- * +---------------------- unused
- */
-static inline void
-il_set_swq_id(struct il_tx_queue *txq, u8 ac, u8 hwq)
-{
- BUG_ON(ac > 3); /* only have 2 bits */
- BUG_ON(hwq > 31); /* only use 5 bits */
-
- txq->swq_id = (hwq << 2) | ac;
-}
-
-static inline void il_wake_queue(struct il_priv *il,
- struct il_tx_queue *txq)
-{
- u8 queue = txq->swq_id;
- u8 ac = queue & 3;
- u8 hwq = (queue >> 2) & 0x1f;
-
- if (test_and_clear_bit(hwq, il->queue_stopped))
- if (atomic_dec_return(&il->queue_stop_count[ac]) <= 0)
- ieee80211_wake_queue(il->hw, ac);
-}
-
-static inline void il_stop_queue(struct il_priv *il,
- struct il_tx_queue *txq)
-{
- u8 queue = txq->swq_id;
- u8 ac = queue & 3;
- u8 hwq = (queue >> 2) & 0x1f;
-
- if (!test_and_set_bit(hwq, il->queue_stopped))
- if (atomic_inc_return(&il->queue_stop_count[ac]) > 0)
- ieee80211_stop_queue(il->hw, ac);
-}
-
-#ifdef ieee80211_stop_queue
-#undef ieee80211_stop_queue
-#endif
-
-#define ieee80211_stop_queue DO_NOT_USE_ieee80211_stop_queue
-
-#ifdef ieee80211_wake_queue
-#undef ieee80211_wake_queue
-#endif
-
-#define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue
-
-static inline void il_disable_interrupts(struct il_priv *il)
-{
- clear_bit(S_INT_ENABLED, &il->status);
-
- /* disable interrupts from uCode/NIC to host */
- _il_wr(il, CSR_INT_MASK, 0x00000000);
-
- /* acknowledge/clear/reset any interrupts still pending
- * from uCode or flow handler (Rx/Tx DMA) */
- _il_wr(il, CSR_INT, 0xffffffff);
- _il_wr(il, CSR_FH_INT_STATUS, 0xffffffff);
- D_ISR("Disabled interrupts\n");
-}
-
-static inline void il_enable_rfkill_int(struct il_priv *il)
-{
- D_ISR("Enabling rfkill interrupt\n");
- _il_wr(il, CSR_INT_MASK, CSR_INT_BIT_RF_KILL);
-}
-
-static inline void il_enable_interrupts(struct il_priv *il)
-{
- D_ISR("Enabling interrupts\n");
- set_bit(S_INT_ENABLED, &il->status);
- _il_wr(il, CSR_INT_MASK, il->inta_mask);
-}
-
-/**
- * il_beacon_time_mask_low - mask of lower 32 bit of beacon time
- * @il -- pointer to il_priv data structure
- * @tsf_bits -- number of bits need to shift for masking)
- */
-static inline u32 il_beacon_time_mask_low(struct il_priv *il,
- u16 tsf_bits)
-{
- return (1 << tsf_bits) - 1;
-}
-
-/**
- * il_beacon_time_mask_high - mask of higher 32 bit of beacon time
- * @il -- pointer to il_priv data structure
- * @tsf_bits -- number of bits need to shift for masking)
- */
-static inline u32 il_beacon_time_mask_high(struct il_priv *il,
- u16 tsf_bits)
-{
- return ((1 << (32 - tsf_bits)) - 1) << tsf_bits;
-}
-
-#endif /* __il_helpers_h__ */
--
1.7.1


2011-11-18 08:22:14

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 38/77] iwlegacy: add accidentally removed comments

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/4965-mac.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index d817d8d..a8a6461 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -1411,6 +1411,33 @@ void il4965_reply_stats(struct il_priv *il,
il4965_rx_stats(il, rxb);
}

+
+/*
+ * mac80211 queues, ACs, hardware queues, FIFOs.
+ *
+ * Cf. http://wireless.kernel.org/en/developers/Documentation/mac80211/queues
+ *
+ * Mac80211 uses the following numbers, which we get as from it
+ * by way of skb_get_queue_mapping(skb):
+ *
+ * VO 0
+ * VI 1
+ * BE 2
+ * BK 3
+ *
+ *
+ * Regular (not A-MPDU) frames are put into hardware queues corresponding
+ * to the FIFOs, see comments in iwl-prph.h. Aggregated frames get their
+ * own queue per aggregation session (RA/TID combination), such queues are
+ * set up to map into FIFOs too, for which we need an AC->FIFO mapping. In
+ * order to map frames to the right queue, we also need an AC->hw queue
+ * mapping. This is implemented here.
+ *
+ * Due to the way hw queues are set up (by the hw specific modules like
+ * iwl-4965.c), the AC->hw queue mapping is the identity
+ * mapping.
+ */
+
static const u8 tid_to_ac[] = {
IEEE80211_AC_BE,
IEEE80211_AC_BK,
--
1.7.1


2011-11-18 08:20:54

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 02/77] iwlegacy: rename iwl to il

iwl_legacy prefix result in long function names, what cause that we
have frequent line split and not readable code. Also iwl_foo symbols
are duplicated in iwlwifi driver, what is annoying when editing
kernel tree with cscope.

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c | 32 +-
drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h | 12 +-
drivers/net/wireless/iwlegacy/iwl-3945-fh.h | 12 +-
drivers/net/wireless/iwlegacy/iwl-3945-hw.h | 46 +-
drivers/net/wireless/iwlegacy/iwl-3945-led.c | 14 +-
drivers/net/wireless/iwlegacy/iwl-3945-led.h | 8 +-
drivers/net/wireless/iwlegacy/iwl-3945-rs.c | 468 +++---
drivers/net/wireless/iwlegacy/iwl-3945.c | 1200 ++++++++--------
drivers/net/wireless/iwlegacy/iwl-3945.h | 186 ++--
drivers/net/wireless/iwlegacy/iwl-4965-calib.c | 210 ++--
drivers/net/wireless/iwlegacy/iwl-4965-calib.h | 16 +-
drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c | 32 +-
drivers/net/wireless/iwlegacy/iwl-4965-debugfs.h | 12 +-
drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c | 26 +-
drivers/net/wireless/iwlegacy/iwl-4965-hw.h | 82 +-
drivers/net/wireless/iwlegacy/iwl-4965-led.c | 20 +-
drivers/net/wireless/iwlegacy/iwl-4965-led.h | 10 +-
drivers/net/wireless/iwlegacy/iwl-4965-lib.c | 380 +++---
drivers/net/wireless/iwlegacy/iwl-4965-rs.c | 1112 ++++++++--------
drivers/net/wireless/iwlegacy/iwl-4965-rx.c | 52 +-
drivers/net/wireless/iwlegacy/iwl-4965-sta.c | 258 ++--
drivers/net/wireless/iwlegacy/iwl-4965-tx.c | 442 +++---
drivers/net/wireless/iwlegacy/iwl-4965-ucode.c | 50 +-
drivers/net/wireless/iwlegacy/iwl-4965.c | 846 ++++++------
drivers/net/wireless/iwlegacy/iwl-4965.h | 202 ++--
drivers/net/wireless/iwlegacy/iwl-commands.h | 506 ++++----
drivers/net/wireless/iwlegacy/iwl-core.c | 994 +++++++-------
drivers/net/wireless/iwlegacy/iwl-core.h | 434 +++---
drivers/net/wireless/iwlegacy/iwl-csr.h | 16 +-
drivers/net/wireless/iwlegacy/iwl-debug.h | 194 ++--
drivers/net/wireless/iwlegacy/iwl-debugfs.c | 284 ++--
drivers/net/wireless/iwlegacy/iwl-dev.h | 440 +++---
drivers/net/wireless/iwlegacy/iwl-eeprom.c | 156 +-
drivers/net/wireless/iwlegacy/iwl-eeprom.h | 60 +-
drivers/net/wireless/iwlegacy/iwl-fh.h | 38 +-
drivers/net/wireless/iwlegacy/iwl-hcmd.c | 186 ++--
drivers/net/wireless/iwlegacy/iwl-helpers.h | 66 +-
drivers/net/wireless/iwlegacy/iwl-io.h | 326 +++---
drivers/net/wireless/iwlegacy/iwl-led.c | 60 +-
drivers/net/wireless/iwlegacy/iwl-led.h | 34 +-
drivers/net/wireless/iwlegacy/iwl-legacy-rs.h | 404 +++---
drivers/net/wireless/iwlegacy/iwl-power.c | 64 +-
drivers/net/wireless/iwlegacy/iwl-power.h | 32 +-
drivers/net/wireless/iwlegacy/iwl-prph.h | 18 +-
drivers/net/wireless/iwlegacy/iwl-rx.c | 72 +-
drivers/net/wireless/iwlegacy/iwl-scan.c | 258 ++--
drivers/net/wireless/iwlegacy/iwl-spectrum.h | 4 +-
drivers/net/wireless/iwlegacy/iwl-sta.c | 376 +++---
drivers/net/wireless/iwlegacy/iwl-sta.h | 78 +-
drivers/net/wireless/iwlegacy/iwl-tx.c | 200 ++--
drivers/net/wireless/iwlegacy/iwl3945-base.c | 1664 +++++++++++-----------
drivers/net/wireless/iwlegacy/iwl4965-base.c | 1382 +++++++++---------
52 files changed, 7037 insertions(+), 7037 deletions(-)

1.2M patch can be downloaded from:
http://people.redhat.com/sgruszka/iwlegacy-2011-11-16/0002-iwlegacy-rename-iwl-to-il.patch

2011-11-21 07:42:44

by Stanislaw Gruszka

[permalink] [raw]
Subject: Re: [PATCH 45/77] iwlegacy: s/rx_reply/hdl/

On Fri, Nov 18, 2011 at 06:02:08PM -0500, Pavel Roskin wrote:
> Why do you want it?
For the same reason as in other patches - for make code shorter.

>I understand rx_reply,
Actually rx_reply is confusing name for interrupt handler.

> but I don't understand
> "hdl". Is it Hairy Definition Language? :)
:-) it's shortcut from "handler", but you known it, don't you ?

Stanislaw

2011-11-18 22:58:31

by Pavel Roskin

[permalink] [raw]
Subject: Re: [PATCH 41/77] iwlegacy: s/STATUS_/S_/

On Fri, 18 Nov 2011 09:22:03 +0100
Stanislaw Gruszka <[email protected]> wrote:

> Signed-off-by: Stanislaw Gruszka <[email protected]>

I think this particular change would make the code less readable. It's
one thing to replace TABLE with TBL, but S_ can be anything - signed,
special, settable, stable...

> - set_bit(STATUS_RF_KILL_HW, &il->status);
> + set_bit(S_RF_KILL_HW, &il->status);

You may want to replace RF_KILL with RFKILL if you are desperate to
shorten variable names.

--
Regards,
Pavel Roskin

2011-11-18 08:21:20

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 15/77] iwlegacy: rename il_{read,write}_prph

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/iwl-3945.c | 48 +++++++++++++-------------
drivers/net/wireless/iwlegacy/iwl-4965-tx.c | 2 +-
drivers/net/wireless/iwlegacy/iwl-4965.c | 34 +++++++++---------
drivers/net/wireless/iwlegacy/iwl-core.c | 6 ++--
drivers/net/wireless/iwlegacy/iwl-io.h | 23 ++++++------
drivers/net/wireless/iwlegacy/iwl3945-base.c | 12 +++---
drivers/net/wireless/iwlegacy/iwl4965-base.c | 18 +++++-----
7 files changed, 72 insertions(+), 71 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.c b/drivers/net/wireless/iwlegacy/iwl-3945.c
index fc8ddb6..cdea5b0 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945.c
@@ -797,18 +797,18 @@ static int il3945_tx_reset(struct il_priv *il)
{

/* bypass mode */
- il_write_prph(il, ALM_SCD_MODE_REG, 0x2);
+ il_wr_prph(il, ALM_SCD_MODE_REG, 0x2);

/* RA 0 is active */
- il_write_prph(il, ALM_SCD_ARASTAT_REG, 0x01);
+ il_wr_prph(il, ALM_SCD_ARASTAT_REG, 0x01);

/* all 6 fifo are active */
- il_write_prph(il, ALM_SCD_TXFACT_REG, 0x3f);
+ il_wr_prph(il, ALM_SCD_TXFACT_REG, 0x3f);

- il_write_prph(il, ALM_SCD_SBYP_MODE_1_REG, 0x010000);
- il_write_prph(il, ALM_SCD_SBYP_MODE_2_REG, 0x030002);
- il_write_prph(il, ALM_SCD_TXF4MF_REG, 0x000004);
- il_write_prph(il, ALM_SCD_TXF5MF_REG, 0x000005);
+ il_wr_prph(il, ALM_SCD_SBYP_MODE_1_REG, 0x010000);
+ il_wr_prph(il, ALM_SCD_SBYP_MODE_2_REG, 0x030002);
+ il_wr_prph(il, ALM_SCD_TXF4MF_REG, 0x000004);
+ il_wr_prph(il, ALM_SCD_TXF5MF_REG, 0x000005);

il_wr(il, FH39_TSSR_CBB_BASE,
il->_3945.shared_phys);
@@ -878,8 +878,8 @@ static int il3945_apm_init(struct il_priv *il)
int ret = il_apm_init(il);

/* Clear APMG (NIC's internal power management) interrupts */
- il_write_prph(il, APMG_RTC_INT_MSK_REG, 0x0);
- il_write_prph(il, APMG_RTC_INT_STT_REG, 0xFFFFFFFF);
+ il_wr_prph(il, APMG_RTC_INT_MSK_REG, 0x0);
+ il_wr_prph(il, APMG_RTC_INT_STT_REG, 0xFFFFFFFF);

/* Reset radio chip */
il_set_bits_prph(il, APMG_PS_CTRL_REG,
@@ -1025,8 +1025,8 @@ void il3945_hw_txq_ctx_stop(struct il_priv *il)
int txq_id;

/* stop SCD */
- il_write_prph(il, ALM_SCD_MODE_REG, 0);
- il_write_prph(il, ALM_SCD_TXFACT_REG, 0);
+ il_wr_prph(il, ALM_SCD_MODE_REG, 0);
+ il_wr_prph(il, ALM_SCD_TXFACT_REG, 0);

/* reset TFD queues */
for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) {
@@ -2475,11 +2475,11 @@ static int il3945_verify_bsm(struct il_priv *il)
D_INFO("Begin verify bsm\n");

/* verify BSM SRAM contents */
- val = il_read_prph(il, BSM_WR_DWCOUNT_REG);
+ val = il_rd_prph(il, BSM_WR_DWCOUNT_REG);
for (reg = BSM_SRAM_LOWER_BOUND;
reg < BSM_SRAM_LOWER_BOUND + len;
reg += sizeof(u32), image++) {
- val = il_read_prph(il, reg);
+ val = il_rd_prph(il, reg);
if (val != le32_to_cpu(*image)) {
IL_ERR("BSM uCode verification failed at "
"addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n",
@@ -2583,16 +2583,16 @@ static int il3945_load_bsm(struct il_priv *il)
inst_len = il->ucode_init.len;
data_len = il->ucode_init_data.len;

- il_write_prph(il, BSM_DRAM_INST_PTR_REG, pinst);
- il_write_prph(il, BSM_DRAM_DATA_PTR_REG, pdata);
- il_write_prph(il, BSM_DRAM_INST_BYTECOUNT_REG, inst_len);
- il_write_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, data_len);
+ il_wr_prph(il, BSM_DRAM_INST_PTR_REG, pinst);
+ il_wr_prph(il, BSM_DRAM_DATA_PTR_REG, pdata);
+ il_wr_prph(il, BSM_DRAM_INST_BYTECOUNT_REG, inst_len);
+ il_wr_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, data_len);

/* Fill BSM memory with bootstrap instructions */
for (reg_offset = BSM_SRAM_LOWER_BOUND;
reg_offset < BSM_SRAM_LOWER_BOUND + len;
reg_offset += sizeof(u32), image++)
- _il_write_prph(il, reg_offset,
+ _il_wr_prph(il, reg_offset,
le32_to_cpu(*image));

rc = il3945_verify_bsm(il);
@@ -2600,19 +2600,19 @@ static int il3945_load_bsm(struct il_priv *il)
return rc;

/* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */
- il_write_prph(il, BSM_WR_MEM_SRC_REG, 0x0);
- il_write_prph(il, BSM_WR_MEM_DST_REG,
+ il_wr_prph(il, BSM_WR_MEM_SRC_REG, 0x0);
+ il_wr_prph(il, BSM_WR_MEM_DST_REG,
IWL39_RTC_INST_LOWER_BOUND);
- il_write_prph(il, BSM_WR_DWCOUNT_REG, len / sizeof(u32));
+ il_wr_prph(il, BSM_WR_DWCOUNT_REG, len / sizeof(u32));

/* Load bootstrap code into instruction SRAM now,
* to prepare to load "initialize" uCode */
- il_write_prph(il, BSM_WR_CTRL_REG,
+ il_wr_prph(il, BSM_WR_CTRL_REG,
BSM_WR_CTRL_REG_BIT_START);

/* Wait for load of bootstrap uCode to finish */
for (i = 0; i < 100; i++) {
- done = il_read_prph(il, BSM_WR_CTRL_REG);
+ done = il_rd_prph(il, BSM_WR_CTRL_REG);
if (!(done & BSM_WR_CTRL_REG_BIT_START))
break;
udelay(10);
@@ -2626,7 +2626,7 @@ static int il3945_load_bsm(struct il_priv *il)

/* Enable future boot loads whenever power management unit triggers it
* (e.g. when powering back up after power-save shutdown) */
- il_write_prph(il, BSM_WR_CTRL_REG,
+ il_wr_prph(il, BSM_WR_CTRL_REG,
BSM_WR_CTRL_REG_BIT_START_EN);

return 0;
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
index 25c9b71..f86a3b9 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
@@ -754,7 +754,7 @@ static void il4965_tx_queue_stop_scheduler(struct il_priv *il,
{
/* Simply stop the queue, but don't change any configuration;
* the SCD_ACT_EN bit is the write-enable mask for the ACTIVE bit. */
- il_write_prph(il,
+ il_wr_prph(il,
IWL49_SCD_QUEUE_STATUS_BITS(txq_id),
(0 << IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE)|
(1 << IWL49_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN));
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c
index 7b422f2..a745032 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.c
@@ -72,11 +72,11 @@ static int il4965_verify_bsm(struct il_priv *il)
D_INFO("Begin verify bsm\n");

/* verify BSM SRAM contents */
- val = il_read_prph(il, BSM_WR_DWCOUNT_REG);
+ val = il_rd_prph(il, BSM_WR_DWCOUNT_REG);
for (reg = BSM_SRAM_LOWER_BOUND;
reg < BSM_SRAM_LOWER_BOUND + len;
reg += sizeof(u32), image++) {
- val = il_read_prph(il, reg);
+ val = il_rd_prph(il, reg);
if (val != le32_to_cpu(*image)) {
IL_ERR("BSM uCode verification failed at "
"addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n",
@@ -156,34 +156,34 @@ static int il4965_load_bsm(struct il_priv *il)
inst_len = il->ucode_init.len;
data_len = il->ucode_init_data.len;

- il_write_prph(il, BSM_DRAM_INST_PTR_REG, pinst);
- il_write_prph(il, BSM_DRAM_DATA_PTR_REG, pdata);
- il_write_prph(il, BSM_DRAM_INST_BYTECOUNT_REG, inst_len);
- il_write_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, data_len);
+ il_wr_prph(il, BSM_DRAM_INST_PTR_REG, pinst);
+ il_wr_prph(il, BSM_DRAM_DATA_PTR_REG, pdata);
+ il_wr_prph(il, BSM_DRAM_INST_BYTECOUNT_REG, inst_len);
+ il_wr_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, data_len);

/* Fill BSM memory with bootstrap instructions */
for (reg_offset = BSM_SRAM_LOWER_BOUND;
reg_offset < BSM_SRAM_LOWER_BOUND + len;
reg_offset += sizeof(u32), image++)
- _il_write_prph(il, reg_offset, le32_to_cpu(*image));
+ _il_wr_prph(il, reg_offset, le32_to_cpu(*image));

ret = il4965_verify_bsm(il);
if (ret)
return ret;

/* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */
- il_write_prph(il, BSM_WR_MEM_SRC_REG, 0x0);
- il_write_prph(il,
+ il_wr_prph(il, BSM_WR_MEM_SRC_REG, 0x0);
+ il_wr_prph(il,
BSM_WR_MEM_DST_REG, IWL49_RTC_INST_LOWER_BOUND);
- il_write_prph(il, BSM_WR_DWCOUNT_REG, len / sizeof(u32));
+ il_wr_prph(il, BSM_WR_DWCOUNT_REG, len / sizeof(u32));

/* Load bootstrap code into instruction SRAM now,
* to prepare to load "initialize" uCode */
- il_write_prph(il, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START);
+ il_wr_prph(il, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START);

/* Wait for load of bootstrap uCode to finish */
for (i = 0; i < 100; i++) {
- done = il_read_prph(il, BSM_WR_CTRL_REG);
+ done = il_rd_prph(il, BSM_WR_CTRL_REG);
if (!(done & BSM_WR_CTRL_REG_BIT_START))
break;
udelay(10);
@@ -197,7 +197,7 @@ static int il4965_load_bsm(struct il_priv *il)

/* Enable future boot loads whenever power management unit triggers it
* (e.g. when powering back up after power-save shutdown) */
- il_write_prph(il,
+ il_wr_prph(il,
BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START_EN);


@@ -224,14 +224,14 @@ static int il4965_set_ucode_ptrs(struct il_priv *il)
pdata = il->ucode_data_backup.p_addr >> 4;

/* Tell bootstrap uCode where to find image to load */
- il_write_prph(il, BSM_DRAM_INST_PTR_REG, pinst);
- il_write_prph(il, BSM_DRAM_DATA_PTR_REG, pdata);
- il_write_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG,
+ il_wr_prph(il, BSM_DRAM_INST_PTR_REG, pinst);
+ il_wr_prph(il, BSM_DRAM_DATA_PTR_REG, pdata);
+ il_wr_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG,
il->ucode_data.len);

/* Inst byte count must be last to set up, bit 31 signals uCode
* that all new ptr/size info is in place */
- il_write_prph(il, BSM_DRAM_INST_BYTECOUNT_REG,
+ il_wr_prph(il, BSM_DRAM_INST_BYTECOUNT_REG,
il->ucode_code.len | BSM_DRAM_INST_LOAD);
D_INFO("Runtime uCode pointers are set.\n");

diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index d2534fb..ed44159 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -1069,7 +1069,7 @@ int il_apm_init(struct il_priv *il)

/*
* Wait for clock stabilization; once stabilized, access to
- * device-internal resources is supported, e.g. il_write_prph()
+ * device-internal resources is supported, e.g. il_wr_prph()
* and accesses to uCode SRAM.
*/
ret = _il_poll_bit(il, CSR_GP_CNTRL,
@@ -1089,10 +1089,10 @@ int il_apm_init(struct il_priv *il)
* set by default in "CLK_CTRL_REG" after reset.
*/
if (il->cfg->base_params->use_bsm)
- il_write_prph(il, APMG_CLK_EN_REG,
+ il_wr_prph(il, APMG_CLK_EN_REG,
APMG_CLK_VAL_DMA_CLK_RQT | APMG_CLK_VAL_BSM_CLK_RQT);
else
- il_write_prph(il, APMG_CLK_EN_REG,
+ il_wr_prph(il, APMG_CLK_EN_REG,
APMG_CLK_VAL_DMA_CLK_RQT);
udelay(20);

diff --git a/drivers/net/wireless/iwlegacy/iwl-io.h b/drivers/net/wireless/iwlegacy/iwl-io.h
index f435942..8cb924d 100644
--- a/drivers/net/wireless/iwlegacy/iwl-io.h
+++ b/drivers/net/wireless/iwlegacy/iwl-io.h
@@ -197,26 +197,27 @@ static inline int il_poll_bit(struct il_priv *il, u32 addr,
return -ETIMEDOUT;
}

-static inline u32 _il_read_prph(struct il_priv *il, u32 reg)
+static inline u32 _il_rd_prph(struct il_priv *il, u32 reg)
{
_il_wr(il, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
rmb();
return _il_rd(il, HBUS_TARG_PRPH_RDAT);
}
-static inline u32 il_read_prph(struct il_priv *il, u32 reg)
+
+static inline u32 il_rd_prph(struct il_priv *il, u32 reg)
{
unsigned long reg_flags;
u32 val;

spin_lock_irqsave(&il->reg_lock, reg_flags);
_il_grab_nic_access(il);
- val = _il_read_prph(il, reg);
+ val = _il_rd_prph(il, reg);
_il_release_nic_access(il);
spin_unlock_irqrestore(&il->reg_lock, reg_flags);
return val;
}

-static inline void _il_write_prph(struct il_priv *il,
+static inline void _il_wr_prph(struct il_priv *il,
u32 addr, u32 val)
{
_il_wr(il, HBUS_TARG_PRPH_WADDR,
@@ -226,20 +227,20 @@ static inline void _il_write_prph(struct il_priv *il,
}

static inline void
-il_write_prph(struct il_priv *il, u32 addr, u32 val)
+il_wr_prph(struct il_priv *il, u32 addr, u32 val)
{
unsigned long reg_flags;

spin_lock_irqsave(&il->reg_lock, reg_flags);
if (!_il_grab_nic_access(il)) {
- _il_write_prph(il, addr, val);
+ _il_wr_prph(il, addr, val);
_il_release_nic_access(il);
}
spin_unlock_irqrestore(&il->reg_lock, reg_flags);
}

#define _il_set_bits_prph(il, reg, mask) \
-_il_write_prph(il, reg, (_il_read_prph(il, reg) | mask))
+_il_wr_prph(il, reg, (_il_rd_prph(il, reg) | mask))

static inline void
il_set_bits_prph(struct il_priv *il, u32 reg, u32 mask)
@@ -254,8 +255,8 @@ il_set_bits_prph(struct il_priv *il, u32 reg, u32 mask)
}

#define _il_set_bits_mask_prph(il, reg, bits, mask) \
-_il_write_prph(il, reg, \
- ((_il_read_prph(il, reg) & mask) | bits))
+_il_wr_prph(il, reg, \
+ ((_il_rd_prph(il, reg) & mask) | bits))

static inline void il_set_bits_mask_prph(struct il_priv *il, u32 reg,
u32 bits, u32 mask)
@@ -277,8 +278,8 @@ static inline void il_clear_bits_prph(struct il_priv

spin_lock_irqsave(&il->reg_lock, reg_flags);
_il_grab_nic_access(il);
- val = _il_read_prph(il, reg);
- _il_write_prph(il, reg, (val & ~mask));
+ val = _il_rd_prph(il, reg);
+ _il_wr_prph(il, reg, (val & ~mask));
_il_release_nic_access(il);
spin_unlock_irqrestore(&il->reg_lock, reg_flags);
}
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index a0b5a74..5037216 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -2122,14 +2122,14 @@ static int il3945_set_ucode_ptrs(struct il_priv *il)
pdata = il->ucode_data_backup.p_addr;

/* Tell bootstrap uCode where to find image to load */
- il_write_prph(il, BSM_DRAM_INST_PTR_REG, pinst);
- il_write_prph(il, BSM_DRAM_DATA_PTR_REG, pdata);
- il_write_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG,
+ il_wr_prph(il, BSM_DRAM_INST_PTR_REG, pinst);
+ il_wr_prph(il, BSM_DRAM_DATA_PTR_REG, pdata);
+ il_wr_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG,
il->ucode_data.len);

/* Inst byte count must be last to set up, bit 31 signals uCode
* that all new ptr/size info is in place */
- il_write_prph(il, BSM_DRAM_INST_BYTECOUNT_REG,
+ il_wr_prph(il, BSM_DRAM_INST_BYTECOUNT_REG,
il->ucode_code.len | BSM_DRAM_INST_LOAD);

D_INFO("Runtime uCode pointers are set.\n");
@@ -2210,7 +2210,7 @@ static void il3945_alive_start(struct il_priv *il)
goto restart;
}

- rfkill = il_read_prph(il, APMG_RFKILL_REG);
+ rfkill = il_rd_prph(il, APMG_RFKILL_REG);
D_INFO("RFKILL status: 0x%x\n", rfkill);

if (rfkill & 0x1) {
@@ -2342,7 +2342,7 @@ static void __il3945_down(struct il_priv *il)
il3945_hw_rxq_stop(il);

/* Power-down device's busmaster DMA clocks */
- il_write_prph(il, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT);
+ il_wr_prph(il, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT);
udelay(5);

/* Stop the device, and put it in low power state */
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
index b0668ea..0f7d44c 100644
--- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
@@ -1622,7 +1622,7 @@ static int il4965_alive_notify(struct il_priv *il)
spin_lock_irqsave(&il->lock, flags);

/* Clear 4965's internal Tx Scheduler data base */
- il->scd_base_addr = il_read_prph(il,
+ il->scd_base_addr = il_rd_prph(il,
IWL49_SCD_SRAM_BASE_ADDR);
a = il->scd_base_addr + IWL49_SCD_CONTEXT_DATA_OFFSET;
for (; a < il->scd_base_addr + IWL49_SCD_TX_STTS_BITMAP_OFFSET; a += 4)
@@ -1634,7 +1634,7 @@ static int il4965_alive_notify(struct il_priv *il)
il_write_targ_mem(il, a, 0);

/* Tel 4965 where to find Tx byte count tables */
- il_write_prph(il, IWL49_SCD_DRAM_BASE_ADDR,
+ il_wr_prph(il, IWL49_SCD_DRAM_BASE_ADDR,
il->scd_bc_tbls.dma >> 10);

/* Enable DMA channel */
@@ -1650,13 +1650,13 @@ static int il4965_alive_notify(struct il_priv *il)
reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN);

/* Disable chain mode for all queues */
- il_write_prph(il, IWL49_SCD_QUEUECHAIN_SEL, 0);
+ il_wr_prph(il, IWL49_SCD_QUEUECHAIN_SEL, 0);

/* Initialize each Tx queue (including the command queue) */
for (i = 0; i < il->hw_params.max_txq_num; i++) {

/* TFD circular buffer read/write indexes */
- il_write_prph(il, IWL49_SCD_QUEUE_RDPTR(i), 0);
+ il_wr_prph(il, IWL49_SCD_QUEUE_RDPTR(i), 0);
il_wr(il, HBUS_TARG_WRPTR, 0 | (i << 8));

/* Max Tx Window size for Scheduler-ACK mode */
@@ -1675,7 +1675,7 @@ static int il4965_alive_notify(struct il_priv *il)
IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK);

}
- il_write_prph(il, IWL49_SCD_INTERRUPT_MASK,
+ il_wr_prph(il, IWL49_SCD_INTERRUPT_MASK,
(1 << il->hw_params.max_txq_num) - 1);

/* Activate all Tx DMA/FIFO channels */
@@ -1868,7 +1868,7 @@ static void __il4965_down(struct il_priv *il)
il4965_rxq_stop(il);

/* Power-down device's busmaster DMA clocks */
- il_write_prph(il, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT);
+ il_wr_prph(il, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT);
udelay(5);

/* Make sure (redundant) we've released our request to stay awake */
@@ -2733,7 +2733,7 @@ void il4965_set_wr_ptrs(struct il_priv *il, int txq_id, u32 index)
{
il_wr(il, HBUS_TARG_WRPTR,
(index & 0xff) | (txq_id << 8));
- il_write_prph(il, IWL49_SCD_QUEUE_RDPTR(txq_id), index);
+ il_wr_prph(il, IWL49_SCD_QUEUE_RDPTR(txq_id), index);
}

void il4965_tx_queue_set_status(struct il_priv *il,
@@ -2746,7 +2746,7 @@ void il4965_tx_queue_set_status(struct il_priv *il,
int active = test_bit(txq_id, &il->txq_ctx_active_msk) ? 1 : 0;

/* Set up and activate */
- il_write_prph(il, IWL49_SCD_QUEUE_STATUS_BITS(txq_id),
+ il_wr_prph(il, IWL49_SCD_QUEUE_STATUS_BITS(txq_id),
(active << IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE) |
(tx_fifo_id << IWL49_SCD_QUEUE_STTS_REG_POS_TXF) |
(scd_retry << IWL49_SCD_QUEUE_STTS_REG_POS_WSL) |
@@ -3195,7 +3195,7 @@ static void __devexit il4965_pci_remove(struct pci_dev *pdev)
*/
void il4965_txq_set_sched(struct il_priv *il, u32 mask)
{
- il_write_prph(il, IWL49_SCD_TXFACT, mask);
+ il_wr_prph(il, IWL49_SCD_TXFACT, mask);
}

/*****************************************************************************
--
1.7.1


2011-11-18 08:21:07

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 08/77] iwlegacy: remove il argument from IWL_ERR/INFO/WARN/CRIT

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c | 6 +-
drivers/net/wireless/iwlegacy/iwl-3945.c | 48 ++++----
drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c | 6 +-
drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c | 4 +-
drivers/net/wireless/iwlegacy/iwl-4965-lib.c | 16 ++--
drivers/net/wireless/iwlegacy/iwl-4965-rs.c | 22 ++--
drivers/net/wireless/iwlegacy/iwl-4965-sta.c | 22 ++--
drivers/net/wireless/iwlegacy/iwl-4965-tx.c | 32 +++---
drivers/net/wireless/iwlegacy/iwl-4965-ucode.c | 4 +-
drivers/net/wireless/iwlegacy/iwl-4965.c | 50 ++++----
drivers/net/wireless/iwlegacy/iwl-core.c | 64 +++++-----
drivers/net/wireless/iwlegacy/iwl-debug.h | 8 +-
drivers/net/wireless/iwlegacy/iwl-debugfs.c | 24 ++--
drivers/net/wireless/iwlegacy/iwl-eeprom.c | 10 +-
drivers/net/wireless/iwlegacy/iwl-hcmd.c | 14 +-
drivers/net/wireless/iwlegacy/iwl-io.h | 2 +-
drivers/net/wireless/iwlegacy/iwl-led.c | 2 +-
drivers/net/wireless/iwlegacy/iwl-power.c | 2 +-
drivers/net/wireless/iwlegacy/iwl-scan.c | 2 +-
drivers/net/wireless/iwlegacy/iwl-sta.c | 26 ++--
drivers/net/wireless/iwlegacy/iwl-tx.c | 12 +-
drivers/net/wireless/iwlegacy/iwl3945-base.c | 130 +++++++++++-----------
drivers/net/wireless/iwlegacy/iwl4965-base.c | 132 +++++++++++-----------
23 files changed, 319 insertions(+), 319 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c
index b767979..40e3a70 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c
@@ -71,7 +71,7 @@ ssize_t il3945_ucode_rx_stats_read(struct file *file,

buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) {
- IL_ERR(il, "Can not allocate Buffer\n");
+ IL_ERR("Can not allocate Buffer\n");
return -ENOMEM;
}

@@ -341,7 +341,7 @@ ssize_t il3945_ucode_tx_stats_read(struct file *file,

buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) {
- IL_ERR(il, "Can not allocate Buffer\n");
+ IL_ERR("Can not allocate Buffer\n");
return -ENOMEM;
}

@@ -440,7 +440,7 @@ ssize_t il3945_ucode_general_stats_read(struct file *file,

buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) {
- IL_ERR(il, "Can not allocate Buffer\n");
+ IL_ERR("Can not allocate Buffer\n");
return -ENOMEM;
}

diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.c b/drivers/net/wireless/iwlegacy/iwl-3945.c
index a1e2a42..cf47fdb 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945.c
@@ -166,7 +166,7 @@ void il3945_disable_events(struct il_priv *il)

base = le32_to_cpu(il->card_alive.log_event_table_ptr);
if (!il3945_hw_valid_rtc_data_addr(base)) {
- IL_ERR(il, "Invalid event log pointer 0x%08X\n", base);
+ IL_ERR("Invalid event log pointer 0x%08X\n", base);
return;
}

@@ -317,7 +317,7 @@ static void il3945_rx_reply_tx(struct il_priv *il,
int fail;

if ((index >= txq->q.n_bd) || (il_queue_used(&txq->q, index) == 0)) {
- IL_ERR(il, "Read index for DMA queue txq_id (%d) index %d "
+ IL_ERR("Read index for DMA queue txq_id (%d) index %d "
"is out of range [0-%d] %d %d\n", txq_id,
index, txq->q.n_bd, txq->q.write_ptr,
txq->q.read_ptr);
@@ -350,7 +350,7 @@ static void il3945_rx_reply_tx(struct il_priv *il,
il3945_tx_queue_reclaim(il, txq_id, index);

if (status & TX_ABORT_REQUIRED_MSK)
- IL_ERR(il, "TODO: Implement Tx ABORT REQUIRED!!!\n");
+ IL_ERR("TODO: Implement Tx ABORT REQUIRED!!!\n");
}


@@ -484,7 +484,7 @@ static void il3945_pass_packet_to_mac80211(struct il_priv *il,

skb = dev_alloc_skb(128);
if (!skb) {
- IL_ERR(il, "dev_alloc_skb failed\n");
+ IL_ERR("dev_alloc_skb failed\n");
return;
}

@@ -600,7 +600,7 @@ int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il,
count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags));

if ((count >= NUM_TFD_CHUNKS) || (count < 0)) {
- IL_ERR(il, "Error can not send more than %d chunks\n",
+ IL_ERR("Error can not send more than %d chunks\n",
NUM_TFD_CHUNKS);
return -EINVAL;
}
@@ -633,7 +633,7 @@ void il3945_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq)
/* sanity check */
counter = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags));
if (counter > NUM_TFD_CHUNKS) {
- IL_ERR(il, "Too many chunks: %i\n", counter);
+ IL_ERR("Too many chunks: %i\n", counter);
/* @todo issue fatal error, it is quite serious situation */
return;
}
@@ -855,7 +855,7 @@ static int il3945_txq_ctx_reset(struct il_priv *il)
rc = il_tx_queue_init(il, &il->txq[txq_id],
slots_num, txq_id);
if (rc) {
- IL_ERR(il, "Tx %d queue init failed\n", txq_id);
+ IL_ERR("Tx %d queue init failed\n", txq_id);
goto error;
}
}
@@ -971,7 +971,7 @@ int il3945_hw_nic_init(struct il_priv *il)
if (!rxq->bd) {
rc = il_rx_queue_alloc(il);
if (rc) {
- IL_ERR(il, "Unable to initialize Rx queue\n");
+ IL_ERR("Unable to initialize Rx queue\n");
return -ENOMEM;
}
} else
@@ -1078,7 +1078,7 @@ static int il3945_hw_reg_txpower_get_temperature(struct il_priv *il)

/* handle insane temp reading */
if (il3945_hw_reg_temp_out_of_range(temperature)) {
- IL_ERR(il, "Error bad temperature value %d\n", temperature);
+ IL_ERR("Error bad temperature value %d\n", temperature);

/* if really really hot(?),
* substitute the 3rd band/group's temp measured at factory */
@@ -1388,7 +1388,7 @@ static int il3945_send_tx_power(struct il_priv *il)
txpower.band = (il->band == IEEE80211_BAND_5GHZ) ? 0 : 1;
ch_info = il_get_channel_info(il, il->band, chan);
if (!ch_info) {
- IL_ERR(il,
+ IL_ERR(
"Failed to get channel info for channel %d [%d]\n",
chan, il->band);
return -EINVAL;
@@ -1686,7 +1686,7 @@ static int il3945_send_rxon_assoc(struct il_priv *il,

pkt = (struct il_rx_packet *)cmd.reply_page;
if (pkt->hdr.flags & IL_CMD_FAILED_MSK) {
- IL_ERR(il, "Bad return from REPLY_RXON_ASSOC command\n");
+ IL_ERR("Bad return from REPLY_RXON_ASSOC command\n");
rc = -EIO;
}

@@ -1727,7 +1727,7 @@ int il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)

rc = il_check_rxon_cmd(il, ctx);
if (rc) {
- IL_ERR(il, "Invalid RXON configuration. Not committing.\n");
+ IL_ERR("Invalid RXON configuration. Not committing.\n");
return -EINVAL;
}

@@ -1739,7 +1739,7 @@ int il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
rc = il_send_rxon_assoc(il,
&il->contexts[IL_RXON_CTX_BSS]);
if (rc) {
- IL_ERR(il, "Error setting RXON_ASSOC "
+ IL_ERR("Error setting RXON_ASSOC "
"configuration (%d).\n", rc);
return rc;
}
@@ -1775,7 +1775,7 @@ int il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
* active_rxon back to what it was previously */
if (rc) {
active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK;
- IL_ERR(il, "Error clearing ASSOC_MSK on current "
+ IL_ERR("Error clearing ASSOC_MSK on current "
"configuration (%d).\n", rc);
return rc;
}
@@ -1807,7 +1807,7 @@ int il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
sizeof(struct il3945_rxon_cmd),
staging_rxon);
if (rc) {
- IL_ERR(il, "Error setting new configuration (%d).\n", rc);
+ IL_ERR("Error setting new configuration (%d).\n", rc);
return rc;
}

@@ -1824,14 +1824,14 @@ int il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
* send a new TXPOWER command or we won't be able to Tx any frames */
rc = il_set_tx_power(il, il->tx_power_next, true);
if (rc) {
- IL_ERR(il, "Error setting Tx power (%d).\n", rc);
+ IL_ERR("Error setting Tx power (%d).\n", rc);
return rc;
}

/* Init the hardware's rate fallback order based on the band */
rc = il3945_init_hw_rate_table(il);
if (rc) {
- IL_ERR(il, "Error setting HW rate table: %02X\n", rc);
+ IL_ERR("Error setting HW rate table: %02X\n", rc);
return -EIO;
}

@@ -1989,7 +1989,7 @@ static void il3945_hw_reg_init_channel_groups(struct il_priv *il)

/* sanity check on factory saturation power value */
if (group->saturation_power < 40) {
- IL_WARN(il, "Error: saturation power is %d, "
+ IL_WARN("Error: saturation power is %d, "
"less than minimum expected 40\n",
group->saturation_power);
return;
@@ -2119,7 +2119,7 @@ int il3945_txpower_set_from_eeprom(struct il_priv *il)
ch_info->group_index,
&power_idx);
if (rc) {
- IL_ERR(il, "Invalid power index\n");
+ IL_ERR("Invalid power index\n");
return rc;
}
pwr_info->base_power_index = (u8) power_idx;
@@ -2187,7 +2187,7 @@ int il3945_hw_rxq_stop(struct il_priv *il)
rc = il_poll_direct_bit(il, FH39_RSSR_STATUS,
FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000);
if (rc < 0)
- IL_ERR(il, "Can't stop Rx DMA.\n");
+ IL_ERR("Can't stop Rx DMA.\n");

return 0;
}
@@ -2263,7 +2263,7 @@ static int il3945_add_bssid_station(struct il_priv *il,

ret = il_add_station_common(il, ctx, addr, 0, NULL, &sta_id);
if (ret) {
- IL_ERR(il, "Unable to add station %pM\n", addr);
+ IL_ERR("Unable to add station %pM\n", addr);
return ret;
}

@@ -2390,7 +2390,7 @@ int il3945_hw_set_hw_params(struct il_priv *il)
sizeof(struct il3945_shared),
&il->_3945.shared_phys, GFP_KERNEL);
if (!il->_3945.shared_virt) {
- IL_ERR(il, "failed to allocate pci memory\n");
+ IL_ERR("failed to allocate pci memory\n");
return -ENOMEM;
}

@@ -2481,7 +2481,7 @@ static int il3945_verify_bsm(struct il_priv *il)
reg += sizeof(u32), image++) {
val = il_read_prph(il, reg);
if (val != le32_to_cpu(*image)) {
- IL_ERR(il, "BSM uCode verification failed at "
+ IL_ERR("BSM uCode verification failed at "
"addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n",
BSM_SRAM_LOWER_BOUND,
reg - BSM_SRAM_LOWER_BOUND, len,
@@ -2620,7 +2620,7 @@ static int il3945_load_bsm(struct il_priv *il)
if (i < 100)
D_INFO("BSM write complete, poll %d iterations\n", i);
else {
- IL_ERR(il, "BSM write did not complete!\n");
+ IL_ERR("BSM write did not complete!\n");
return -EIO;
}

diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c
index 8ea0ac2..ebb71a6 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c
@@ -75,7 +75,7 @@ ssize_t il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf,

buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) {
- IL_ERR(il, "Can not allocate Buffer\n");
+ IL_ERR("Can not allocate Buffer\n");
return -ENOMEM;
}

@@ -501,7 +501,7 @@ ssize_t il4965_ucode_tx_stats_read(struct file *file,

buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) {
- IL_ERR(il, "Can not allocate Buffer\n");
+ IL_ERR("Can not allocate Buffer\n");
return -ENOMEM;
}

@@ -679,7 +679,7 @@ il4965_ucode_general_stats_read(struct file *file, char __user *user_buf,

buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) {
- IL_ERR(il, "Can not allocate Buffer\n");
+ IL_ERR("Can not allocate Buffer\n");
return -ENOMEM;
}

diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c b/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c
index ef8b0d5..016472d 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c
@@ -129,12 +129,12 @@ int il4965_eeprom_check_version(struct il_priv *il)
calib_ver < il->cfg->eeprom_calib_ver)
goto err;

- IL_INFO(il, "device EEPROM VER=0x%x, CALIB=0x%x\n",
+ IL_INFO("device EEPROM VER=0x%x, CALIB=0x%x\n",
eeprom_ver, calib_ver);

return 0;
err:
- IL_ERR(il, "Unsupported (too old) EEPROM VER=0x%x < 0x%x "
+ IL_ERR("Unsupported (too old) EEPROM VER=0x%x < 0x%x "
"CALIB=0x%x < 0x%x\n",
eeprom_ver, il->cfg->eeprom_ver,
calib_ver, il->cfg->eeprom_calib_ver);
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
index b51ae3d..f4df28d 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
@@ -44,7 +44,7 @@ void il4965_check_abort_status(struct il_priv *il,
u8 frame_count, u32 status)
{
if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) {
- IL_ERR(il, "Tx flush command to flush out all frames\n");
+ IL_ERR("Tx flush command to flush out all frames\n");
if (!test_bit(STATUS_EXIT_PENDING, &il->status))
queue_work(il->workqueue, &il->tx_flush);
}
@@ -176,7 +176,7 @@ int il4965_hw_nic_init(struct il_priv *il)
if (!rxq->bd) {
ret = il_rx_queue_alloc(il);
if (ret) {
- IL_ERR(il, "Unable to initialize Rx queue\n");
+ IL_ERR("Unable to initialize Rx queue\n");
return -ENOMEM;
}
} else
@@ -309,7 +309,7 @@ static void il4965_rx_allocate(struct il_priv *il, gfp_t priority)

if ((rxq->free_count <= RX_LOW_WATERMARK) &&
net_ratelimit())
- IL_CRIT(il,
+ IL_CRIT(
"Failed to alloc_pages with %s. "
"Only %u free buffers remaining.\n",
priority == GFP_ATOMIC ?
@@ -549,7 +549,7 @@ static void il4965_pass_packet_to_mac80211(struct il_priv *il,

skb = dev_alloc_skb(128);
if (!skb) {
- IL_ERR(il, "dev_alloc_skb failed\n");
+ IL_ERR("dev_alloc_skb failed\n");
return;
}

@@ -598,7 +598,7 @@ void il4965_rx_reply_rx(struct il_priv *il,
ampdu_status = le32_to_cpu(rx_pkt_status);
} else {
if (!il->_4965.last_phy_res_valid) {
- IL_ERR(il, "MPDU frame without cached PHY data\n");
+ IL_ERR("MPDU frame without cached PHY data\n");
return;
}
phy_res = &il->_4965.last_phy_res;
@@ -880,7 +880,7 @@ int il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
rate = IL_RATE_6M_PLCP;
break;
default:
- IL_WARN(il, "Invalid scan band\n");
+ IL_WARN("Invalid scan band\n");
return -EIO;
}

@@ -1184,9 +1184,9 @@ int il4965_dump_fh(struct il_priv *il, char **buf, bool display)
return pos;
}
#endif
- IL_ERR(il, "FH register values:\n");
+ IL_ERR("FH register values:\n");
for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) {
- IL_ERR(il, " %34s: 0X%08x\n",
+ IL_ERR(" %34s: 0X%08x\n",
il4965_get_fh_string(fh_tbl[i]),
il_read_direct32(il, fh_tbl[i]));
}
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
index b53cf1b..93bb31d 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
@@ -367,12 +367,12 @@ static int il4965_rs_tl_turn_on_agg_for_tid(struct il_priv *il,
* this might be cause by reloading firmware
* stop the tx ba session here
*/
- IL_ERR(il, "Fail start Tx agg on tid: %d\n",
+ IL_ERR("Fail start Tx agg on tid: %d\n",
tid);
ieee80211_stop_tx_ba_session(sta, tid);
}
} else {
- IL_ERR(il, "Aggregation not enabled for tid %d "
+ IL_ERR("Aggregation not enabled for tid %d "
"because load = %u\n", tid, load);
}
return ret;
@@ -385,7 +385,7 @@ static void il4965_rs_tl_turn_on_agg(struct il_priv *il, u8 tid,
if (tid < TID_MAX_LOAD_COUNT)
il4965_rs_tl_turn_on_agg_for_tid(il, lq_data, tid, sta);
else
- IL_ERR(il, "tid exceeds max load count: %d/%d\n",
+ IL_ERR("tid exceeds max load count: %d/%d\n",
tid, TID_MAX_LOAD_COUNT);
}

@@ -505,7 +505,7 @@ static u32 il4965_rate_n_flags_from_tbl(struct il_priv *il,

} else if (is_Ht(tbl->lq_type)) {
if (index > IL_LAST_OFDM_RATE) {
- IL_ERR(il, "Invalid HT rate index %d\n", index);
+ IL_ERR("Invalid HT rate index %d\n", index);
index = IL_LAST_OFDM_RATE;
}
rate_n_flags = RATE_MCS_HT_MSK;
@@ -515,7 +515,7 @@ static u32 il4965_rate_n_flags_from_tbl(struct il_priv *il,
else
rate_n_flags |= il_rates[index].plcp_mimo2;
} else {
- IL_ERR(il, "Invalid tbl->lq_type %d\n", tbl->lq_type);
+ IL_ERR("Invalid tbl->lq_type %d\n", tbl->lq_type);
}

rate_n_flags |= ((tbl->ant_type << RATE_MCS_ANT_POS) &
@@ -535,7 +535,7 @@ static u32 il4965_rate_n_flags_from_tbl(struct il_priv *il,
rate_n_flags |= RATE_MCS_GF_MSK;
if (is_siso(tbl->lq_type) && tbl->is_SGI) {
rate_n_flags &= ~RATE_MCS_SGI_MSK;
- IL_ERR(il, "GF was set with SGI:SISO\n");
+ IL_ERR("GF was set with SGI:SISO\n");
}
}
}
@@ -1480,7 +1480,7 @@ static int il4965_rs_move_siso_to_other(struct il_priv *il,
if (!tbl->is_SGI)
break;
else
- IL_ERR(il,
+ IL_ERR(
"SGI was set in GF+SISO\n");
}
search_tbl->is_SGI = !tbl->is_SGI;
@@ -1851,7 +1851,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
rate_scale_index_msk = rate_mask;

if (!((1 << index) & rate_scale_index_msk)) {
- IL_ERR(il, "Current Rate is not valid\n");
+ IL_ERR("Current Rate is not valid\n");
if (lq_sta->search_better_tbl) {
/* revert to active table if search table is not valid*/
tbl->lq_type = LQ_NONE;
@@ -1867,7 +1867,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,

/* Get expected throughput table and history window for current rate */
if (!tbl->expected_tpt) {
- IL_ERR(il, "tbl->expected_tpt is NULL\n");
+ IL_ERR("tbl->expected_tpt is NULL\n");
return;
}

@@ -1909,7 +1909,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
* actual average throughput */
if (window->average_tpt != ((window->success_ratio *
tbl->expected_tpt[index] + 64) / 128)) {
- IL_ERR(il,
+ IL_ERR(
"expected_tpt should have been calculated by now\n");
window->average_tpt = ((window->success_ratio *
tbl->expected_tpt[index] + 64) / 128);
@@ -2590,7 +2590,7 @@ static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta,
D_RATE("Fixed rate ON\n");
} else {
lq_sta->dbg_fixed_rate = 0;
- IL_ERR(il,
+ IL_ERR(
"Invalid antenna selection 0x%X, Valid is 0x%X\n",
ant_sel_tx, valid_tx_ant);
D_RATE("Fixed rate OFF\n");
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
index 3019baf..a82d444 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
@@ -44,7 +44,7 @@ il4965_sta_alloc_lq(struct il_priv *il, u8 sta_id)

link_cmd = kzalloc(sizeof(struct il_link_quality_cmd), GFP_KERNEL);
if (!link_cmd) {
- IL_ERR(il, "Unable to allocate memory for LQ cmd.\n");
+ IL_ERR("Unable to allocate memory for LQ cmd.\n");
return NULL;
}
/* Set up the rate scaling to start at selected rate, fall back
@@ -105,7 +105,7 @@ il4965_add_bssid_station(struct il_priv *il, struct il_rxon_context *ctx,

ret = il_add_station_common(il, ctx, addr, 0, NULL, &sta_id);
if (ret) {
- IL_ERR(il, "Unable to add station %pM\n", addr);
+ IL_ERR("Unable to add station %pM\n", addr);
return ret;
}

@@ -119,7 +119,7 @@ il4965_add_bssid_station(struct il_priv *il, struct il_rxon_context *ctx,
/* Set up default rate scaling table in device's station table */
link_cmd = il4965_sta_alloc_lq(il, sta_id);
if (!link_cmd) {
- IL_ERR(il,
+ IL_ERR(
"Unable to initialize rate scaling for station %pM.\n",
addr);
return -ENOMEM;
@@ -127,7 +127,7 @@ il4965_add_bssid_station(struct il_priv *il, struct il_rxon_context *ctx,

ret = il_send_lq_cmd(il, ctx, link_cmd, CMD_SYNC, true);
if (ret)
- IL_ERR(il, "Link quality command failed (%d)\n", ret);
+ IL_ERR("Link quality command failed (%d)\n", ret);

spin_lock_irqsave(&il->sta_lock, flags);
il->stations[sta_id].lq = link_cmd;
@@ -467,7 +467,7 @@ int il4965_remove_dynamic_key(struct il_priv *il,
}

if (il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET) {
- IL_WARN(il, "Removing wrong key %d 0x%x\n",
+ IL_WARN("Removing wrong key %d 0x%x\n",
keyconf->keyidx, key_flags);
spin_unlock_irqrestore(&il->sta_lock, flags);
return 0;
@@ -475,7 +475,7 @@ int il4965_remove_dynamic_key(struct il_priv *il,

if (!test_and_clear_bit(il->stations[sta_id].sta.key.key_offset,
&il->ucode_key_table))
- IL_ERR(il, "index %d not used in uCode key table.\n",
+ IL_ERR("index %d not used in uCode key table.\n",
il->stations[sta_id].sta.key.key_offset);
memset(&il->stations[sta_id].keyinfo, 0,
sizeof(struct il_hw_key));
@@ -525,7 +525,7 @@ int il4965_set_dynamic_key(struct il_priv *il, struct il_rxon_context *ctx,
keyconf, sta_id);
break;
default:
- IL_ERR(il,
+ IL_ERR(
"Unknown alg: %s cipher = %x\n", __func__,
keyconf->cipher);
ret = -EINVAL;
@@ -557,7 +557,7 @@ int il4965_alloc_bcast_station(struct il_priv *il,
sta_id = il_prep_station(il, ctx, il_bcast_addr,
false, NULL);
if (sta_id == IL_INVALID_STATION) {
- IL_ERR(il, "Unable to prepare broadcast station\n");
+ IL_ERR("Unable to prepare broadcast station\n");
spin_unlock_irqrestore(&il->sta_lock, flags);

return -EINVAL;
@@ -569,7 +569,7 @@ int il4965_alloc_bcast_station(struct il_priv *il,

link_cmd = il4965_sta_alloc_lq(il, sta_id);
if (!link_cmd) {
- IL_ERR(il,
+ IL_ERR(
"Unable to initialize rate scaling for bcast station.\n");
return -ENOMEM;
}
@@ -596,7 +596,7 @@ static int il4965_update_bcast_station(struct il_priv *il,

link_cmd = il4965_sta_alloc_lq(il, sta_id);
if (!link_cmd) {
- IL_ERR(il,
+ IL_ERR(
"Unable to initialize rate scaling for bcast station.\n");
return -ENOMEM;
}
@@ -686,7 +686,7 @@ int il4965_sta_rx_agg_stop(struct il_priv *il, struct ieee80211_sta *sta,

sta_id = il_sta_id(sta);
if (sta_id == IL_INVALID_STATION) {
- IL_ERR(il, "Invalid station for AGG tid %d\n", tid);
+ IL_ERR("Invalid station for AGG tid %d\n", tid);
return -ENXIO;
}

diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
index efc21be..66dd172 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
@@ -258,7 +258,7 @@ static void il4965_tx_cmd_build_hwcrypto(struct il_priv *il,
break;

default:
- IL_ERR(il, "Unknown encode cipher %x\n", keyconf->cipher);
+ IL_ERR("Unknown encode cipher %x\n", keyconf->cipher);
break;
}
}
@@ -619,13 +619,13 @@ int il4965_txq_ctx_alloc(struct il_priv *il)
ret = il4965_alloc_dma_ptr(il, &il->scd_bc_tbls,
il->hw_params.scd_bc_tbls_size);
if (ret) {
- IL_ERR(il, "Scheduler BC Table allocation failed\n");
+ IL_ERR("Scheduler BC Table allocation failed\n");
goto error_bc_tbls;
}
/* Alloc keep-warm buffer */
ret = il4965_alloc_dma_ptr(il, &il->kw, IL_KW_SIZE);
if (ret) {
- IL_ERR(il, "Keep Warm allocation failed\n");
+ IL_ERR("Keep Warm allocation failed\n");
goto error_kw;
}

@@ -652,7 +652,7 @@ int il4965_txq_ctx_alloc(struct il_priv *il)
&il->txq[txq_id], slots_num,
txq_id);
if (ret) {
- IL_ERR(il, "Tx %d queue init failed\n", txq_id);
+ IL_ERR("Tx %d queue init failed\n", txq_id);
goto error;
}
}
@@ -712,7 +712,7 @@ void il4965_txq_ctx_stop(struct il_priv *il)
if (il_poll_direct_bit(il, FH_TSSR_TX_STATUS_REG,
FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch),
1000))
- IL_ERR(il, "Failing on timeout while stopping"
+ IL_ERR("Failing on timeout while stopping"
" DMA channel %d [0x%08x]", ch,
il_read_direct32(il,
FH_TSSR_TX_STATUS_REG));
@@ -803,7 +803,7 @@ static int il4965_txq_agg_enable(struct il_priv *il, int txq_id,
if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) ||
(IWL49_FIRST_AMPDU_QUEUE +
il->cfg->base_params->num_of_ampdu_queues <= txq_id)) {
- IL_WARN(il,
+ IL_WARN(
"queue number out of range: %d, must be %d to %d\n",
txq_id, IWL49_FIRST_AMPDU_QUEUE,
IWL49_FIRST_AMPDU_QUEUE +
@@ -871,25 +871,25 @@ int il4965_tx_agg_start(struct il_priv *il, struct ieee80211_vif *vif,
if (unlikely(tx_fifo < 0))
return tx_fifo;

- IL_WARN(il, "%s on ra = %pM tid = %d\n",
+ IL_WARN("%s on ra = %pM tid = %d\n",
__func__, sta->addr, tid);

sta_id = il_sta_id(sta);
if (sta_id == IL_INVALID_STATION) {
- IL_ERR(il, "Start AGG on invalid station\n");
+ IL_ERR("Start AGG on invalid station\n");
return -ENXIO;
}
if (unlikely(tid >= MAX_TID_COUNT))
return -EINVAL;

if (il->stations[sta_id].tid[tid].agg.state != IL_AGG_OFF) {
- IL_ERR(il, "Start AGG when state is not IL_AGG_OFF !\n");
+ IL_ERR("Start AGG when state is not IL_AGG_OFF !\n");
return -ENXIO;
}

txq_id = il4965_txq_ctx_activate_free(il);
if (txq_id == -1) {
- IL_ERR(il, "No free aggregation queue available\n");
+ IL_ERR("No free aggregation queue available\n");
return -ENXIO;
}

@@ -932,7 +932,7 @@ static int il4965_txq_agg_disable(struct il_priv *il, u16 txq_id,
if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) ||
(IWL49_FIRST_AMPDU_QUEUE +
il->cfg->base_params->num_of_ampdu_queues <= txq_id)) {
- IL_WARN(il,
+ IL_WARN(
"queue number out of range: %d, must be %d to %d\n",
txq_id, IWL49_FIRST_AMPDU_QUEUE,
IWL49_FIRST_AMPDU_QUEUE +
@@ -973,7 +973,7 @@ int il4965_tx_agg_stop(struct il_priv *il, struct ieee80211_vif *vif,
sta_id = il_sta_id(sta);

if (sta_id == IL_INVALID_STATION) {
- IL_ERR(il, "Invalid station for AGG tid %d\n", tid);
+ IL_ERR("Invalid station for AGG tid %d\n", tid);
return -ENXIO;
}

@@ -996,7 +996,7 @@ int il4965_tx_agg_stop(struct il_priv *il, struct ieee80211_vif *vif,
case IL_AGG_ON:
break;
default:
- IL_WARN(il, "Stopping AGG while state not ON or starting\n");
+ IL_WARN("Stopping AGG while state not ON or starting\n");
}

write_ptr = il->txq[txq_id].q.write_ptr;
@@ -1115,7 +1115,7 @@ int il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int index)
struct ieee80211_hdr *hdr;

if ((index >= q->n_bd) || (il_queue_used(q, index) == 0)) {
- IL_ERR(il, "Read index for DMA queue txq id (%d), index %d, "
+ IL_ERR("Read index for DMA queue txq id (%d), index %d, "
"is out of range [0-%d] %d %d.\n", txq_id,
index, q->n_bd, q->write_ptr, q->read_ptr);
return 0;
@@ -1163,7 +1163,7 @@ static int il4965_tx_status_reply_compressed_ba(struct il_priv *il,

if (unlikely(!agg->wait_for_ba)) {
if (unlikely(ba_resp->bitmap))
- IL_ERR(il, "Received BA when not expected\n");
+ IL_ERR("Received BA when not expected\n");
return -EINVAL;
}

@@ -1266,7 +1266,7 @@ void il4965_rx_reply_compressed_ba(struct il_priv *il,
u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn);

if (scd_flow >= il->hw_params.max_txq_num) {
- IL_ERR(il,
+ IL_ERR(
"BUG_ON scd_flow is bigger than number of queues\n");
return;
}
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-ucode.c b/drivers/net/wireless/iwlegacy/iwl-4965-ucode.c
index d1e1775..3fa939e 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-ucode.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-ucode.c
@@ -99,7 +99,7 @@ static int il4965_verify_inst_full(struct il_priv *il, __le32 *image,
* if IL_DL_IO is set */
val = _il_read_direct32(il, HBUS_TARG_MEM_RDAT);
if (val != le32_to_cpu(*image)) {
- IL_ERR(il, "uCode INST section is invalid at "
+ IL_ERR("uCode INST section is invalid at "
"offset 0x%x, is 0x%x, s/b 0x%x\n",
save_len - len, val, le32_to_cpu(*image));
ret = -EIO;
@@ -153,7 +153,7 @@ int il4965_verify_ucode(struct il_priv *il)
return 0;
}

- IL_ERR(il, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n");
+ IL_ERR("NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n");

/* Since nothing seems to match, show first several data entries in
* instruction SRAM, so maybe visual inspection will give a clue.
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c
index cc28e0e..7b422f2 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.c
@@ -78,7 +78,7 @@ static int il4965_verify_bsm(struct il_priv *il)
reg += sizeof(u32), image++) {
val = il_read_prph(il, reg);
if (val != le32_to_cpu(*image)) {
- IL_ERR(il, "BSM uCode verification failed at "
+ IL_ERR("BSM uCode verification failed at "
"addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n",
BSM_SRAM_LOWER_BOUND,
reg - BSM_SRAM_LOWER_BOUND, len,
@@ -191,7 +191,7 @@ static int il4965_load_bsm(struct il_priv *il)
if (i < 100)
D_INFO("BSM write complete, poll %d iterations\n", i);
else {
- IL_ERR(il, "BSM write did not complete!\n");
+ IL_ERR("BSM write did not complete!\n");
return -EIO;
}

@@ -343,7 +343,7 @@ static void il4965_chain_noise_reset(struct il_priv *il)
cmd.diff_gain_c = 0;
if (il_send_cmd_pdu(il, REPLY_PHY_CALIBRATION_CMD,
sizeof(cmd), &cmd))
- IL_ERR(il,
+ IL_ERR(
"Could not send REPLY_PHY_CALIBRATION_CMD\n");
data->state = IL_CHAIN_NOISE_ACCUMULATE;
D_CALIB("Run chain_noise_calibrate\n");
@@ -548,7 +548,7 @@ static int il4965_interpolate_chan(struct il_priv *il, u32 channel,

s = il4965_get_sub_band(il, channel);
if (s >= EEPROM_TX_POWER_BANDS) {
- IL_ERR(il, "Tx Power can not find channel %d\n", channel);
+ IL_ERR("Tx Power can not find channel %d\n", channel);
return -1;
}

@@ -912,7 +912,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel,
* and 2) mimo txpower balance between Tx chains. */
txatten_grp = il4965_get_tx_atten_grp(channel);
if (txatten_grp < 0) {
- IL_ERR(il, "Can't find txatten group for channel %d.\n",
+ IL_ERR("Can't find txatten group for channel %d.\n",
channel);
return txatten_grp;
}
@@ -1078,12 +1078,12 @@ static int il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel,

/* stay within the table! */
if (power_index > 107) {
- IL_WARN(il, "txpower index %d > 107\n",
+ IL_WARN("txpower index %d > 107\n",
power_index);
power_index = 107;
}
if (power_index < 0) {
- IL_WARN(il, "txpower index %d < 0\n",
+ IL_WARN("txpower index %d < 0\n",
power_index);
power_index = 0;
}
@@ -1207,7 +1207,7 @@ static int il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)

ret = il_check_rxon_cmd(il, ctx);
if (ret) {
- IL_ERR(il, "Invalid RXON configuration. Not committing.\n");
+ IL_ERR("Invalid RXON configuration. Not committing.\n");
return -EINVAL;
}

@@ -1228,7 +1228,7 @@ static int il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
if (!il_full_rxon_required(il, ctx)) {
ret = il_send_rxon_assoc(il, ctx);
if (ret) {
- IL_ERR(il, "Error setting RXON_ASSOC (%d)\n", ret);
+ IL_ERR("Error setting RXON_ASSOC (%d)\n", ret);
return ret;
}

@@ -1258,14 +1258,14 @@ static int il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
* active_rxon back to what it was previously */
if (ret) {
active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK;
- IL_ERR(il, "Error clearing ASSOC_MSK (%d)\n", ret);
+ IL_ERR("Error clearing ASSOC_MSK (%d)\n", ret);
return ret;
}
il_clear_ucode_stations(il, ctx);
il_restore_stations(il, ctx);
ret = il4965_restore_default_wep_keys(il, ctx);
if (ret) {
- IL_ERR(il, "Failed to restore WEP keys (%d)\n", ret);
+ IL_ERR("Failed to restore WEP keys (%d)\n", ret);
return ret;
}
}
@@ -1289,7 +1289,7 @@ static int il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
ret = il_send_cmd_pdu(il, ctx->rxon_cmd,
sizeof(struct il_rxon_cmd), &ctx->staging);
if (ret) {
- IL_ERR(il, "Error setting new RXON (%d)\n", ret);
+ IL_ERR("Error setting new RXON (%d)\n", ret);
return ret;
}
D_INFO("Return from !new_assoc RXON.\n");
@@ -1298,7 +1298,7 @@ static int il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
il_restore_stations(il, ctx);
ret = il4965_restore_default_wep_keys(il, ctx);
if (ret) {
- IL_ERR(il, "Failed to restore WEP keys (%d)\n", ret);
+ IL_ERR("Failed to restore WEP keys (%d)\n", ret);
return ret;
}
}
@@ -1310,7 +1310,7 @@ static int il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
ret = il_send_cmd_pdu(il, ctx->rxon_cmd,
sizeof(struct il_rxon_cmd), &ctx->staging);
if (ret) {
- IL_ERR(il, "Error setting new RXON (%d)\n", ret);
+ IL_ERR("Error setting new RXON (%d)\n", ret);
return ret;
}
memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon));
@@ -1323,7 +1323,7 @@ static int il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
* send a new TXPOWER command or we won't be able to Tx any frames */
ret = il_set_tx_power(il, il->tx_power_next, true);
if (ret) {
- IL_ERR(il, "Error sending TX power (%d)\n", ret);
+ IL_ERR("Error sending TX power (%d)\n", ret);
return ret;
}

@@ -1393,7 +1393,7 @@ static int il4965_hw_channel_switch(struct il_priv *il,
if (ch_info)
cmd.expect_beacon = il_is_channel_radar(ch_info);
else {
- IL_ERR(il, "invalid channel switch from %u to %u\n",
+ IL_ERR("invalid channel switch from %u to %u\n",
ctx->active.channel, ch);
return -EFAULT;
}
@@ -1479,7 +1479,7 @@ static int il4965_hw_get_temperature(struct il_priv *il)
D_TEMP("Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt);

if (R3 == R1) {
- IL_ERR(il, "Calibration conflict R1 == R3\n");
+ IL_ERR("Calibration conflict R1 == R3\n");
return -1;
}

@@ -1666,7 +1666,7 @@ static int il4965_tx_status_reply_tx(struct il_priv *il,

hdr = il_tx_queue_get_hdr(il, txq_id, idx);
if (!hdr) {
- IL_ERR(il,
+ IL_ERR(
"BUG_ON idx doesn't point to valid skb"
" idx=%d, txq_id=%d\n", idx, txq_id);
return -1;
@@ -1674,7 +1674,7 @@ static int il4965_tx_status_reply_tx(struct il_priv *il,

sc = le16_to_cpu(hdr->seq_ctrl);
if (idx != (SEQ_TO_SN(sc) & 0xff)) {
- IL_ERR(il,
+ IL_ERR(
"BUG_ON idx doesn't match seq control"
" idx=%d, seq_idx=%d, seq=%d\n",
idx, SEQ_TO_SN(sc), hdr->seq_ctrl);
@@ -1750,7 +1750,7 @@ static u8 il4965_find_station(struct il_priv *il, const u8 *addr)
(!(il->stations[ret].used & IL_STA_UCODE_ACTIVE) ||
((il->stations[ret].used & IL_STA_UCODE_ACTIVE) &&
(il->stations[ret].used & IL_STA_UCODE_INPROGRESS)))) {
- IL_ERR(il, "Requested station info for sta %d before ready.\n",
+ IL_ERR("Requested station info for sta %d before ready.\n",
ret);
ret = IL_INVALID_STATION;
}
@@ -1790,7 +1790,7 @@ static void il4965_rx_reply_tx(struct il_priv *il,
unsigned long flags;

if ((index >= txq->q.n_bd) || (il_queue_used(&txq->q, index) == 0)) {
- IL_ERR(il, "Read index for DMA queue txq_id (%d) index %d "
+ IL_ERR("Read index for DMA queue txq_id (%d) index %d "
"is out of range [0-%d] %d %d\n", txq_id,
index, txq->q.n_bd, txq->q.write_ptr,
txq->q.read_ptr);
@@ -1809,7 +1809,7 @@ static void il4965_rx_reply_tx(struct il_priv *il,

sta_id = il4965_get_ra_sta_id(il, hdr);
if (txq->sched_retry && unlikely(sta_id == IL_INVALID_STATION)) {
- IL_ERR(il, "Station not known\n");
+ IL_ERR("Station not known\n");
return;
}

@@ -1943,7 +1943,7 @@ static void il4965_post_associate(struct il_priv *il)

ret = il_send_rxon_timing(il, ctx);
if (ret)
- IL_WARN(il, "RXON timing - "
+ IL_WARN("RXON timing - "
"Attempting to continue.\n");

ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
@@ -1982,7 +1982,7 @@ static void il4965_post_associate(struct il_priv *il)
il4965_send_beacon_cmd(il);
break;
default:
- IL_ERR(il, "%s Should not be called in %d mode\n",
+ IL_ERR("%s Should not be called in %d mode\n",
__func__, vif->type);
break;
}
@@ -2019,7 +2019,7 @@ static void il4965_config_ap(struct il_priv *il)
/* RXON Timing */
ret = il_send_rxon_timing(il, ctx);
if (ret)
- IL_WARN(il, "RXON timing failed - "
+ IL_WARN("RXON timing failed - "
"Attempting to continue.\n");

/* AP has all antennas */
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index e6c7e9d..42be833 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -253,14 +253,14 @@ int il_init_geos(struct il_priv *il)

if ((il->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
il->cfg->sku & IL_SKU_A) {
- IL_INFO(il, "Incorrectly detected BG card as ABG. "
+ IL_INFO("Incorrectly detected BG card as ABG. "
"Please send your PCI ID 0x%04X:0x%04X to maintainer.\n",
il->pci_dev->device,
il->pci_dev->subsystem_device);
il->cfg->sku &= ~IL_SKU_A;
}

- IL_INFO(il, "Tunable channels: %d 802.11bg, %d 802.11a channels\n",
+ IL_INFO("Tunable channels: %d 802.11bg, %d 802.11a channels\n",
il->bands[IEEE80211_BAND_2GHZ].n_channels,
il->bands[IEEE80211_BAND_5GHZ].n_channels);

@@ -431,65 +431,65 @@ il_check_rxon_cmd(struct il_priv *il, struct il_rxon_context *ctx)

if (rxon->flags & RXON_FLG_BAND_24G_MSK) {
if (rxon->flags & RXON_FLG_TGJ_NARROW_BAND_MSK) {
- IL_WARN(il, "check 2.4G: wrong narrow\n");
+ IL_WARN("check 2.4G: wrong narrow\n");
error = true;
}
if (rxon->flags & RXON_FLG_RADAR_DETECT_MSK) {
- IL_WARN(il, "check 2.4G: wrong radar\n");
+ IL_WARN("check 2.4G: wrong radar\n");
error = true;
}
} else {
if (!(rxon->flags & RXON_FLG_SHORT_SLOT_MSK)) {
- IL_WARN(il, "check 5.2G: not short slot!\n");
+ IL_WARN("check 5.2G: not short slot!\n");
error = true;
}
if (rxon->flags & RXON_FLG_CCK_MSK) {
- IL_WARN(il, "check 5.2G: CCK!\n");
+ IL_WARN("check 5.2G: CCK!\n");
error = true;
}
}
if ((rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1) {
- IL_WARN(il, "mac/bssid mcast!\n");
+ IL_WARN("mac/bssid mcast!\n");
error = true;
}

/* make sure basic rates 6Mbps and 1Mbps are supported */
if ((rxon->ofdm_basic_rates & IL_RATE_6M_MASK) == 0 &&
(rxon->cck_basic_rates & IL_RATE_1M_MASK) == 0) {
- IL_WARN(il, "neither 1 nor 6 are basic\n");
+ IL_WARN("neither 1 nor 6 are basic\n");
error = true;
}

if (le16_to_cpu(rxon->assoc_id) > 2007) {
- IL_WARN(il, "aid > 2007\n");
+ IL_WARN("aid > 2007\n");
error = true;
}

if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK))
== (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) {
- IL_WARN(il, "CCK and short slot\n");
+ IL_WARN("CCK and short slot\n");
error = true;
}

if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK))
== (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) {
- IL_WARN(il, "CCK and auto detect");
+ IL_WARN("CCK and auto detect");
error = true;
}

if ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK |
RXON_FLG_TGG_PROTECT_MSK)) ==
RXON_FLG_TGG_PROTECT_MSK) {
- IL_WARN(il, "TGg but no auto-detect\n");
+ IL_WARN("TGg but no auto-detect\n");
error = true;
}

if (error)
- IL_WARN(il, "Tuning to channel %d\n",
+ IL_WARN("Tuning to channel %d\n",
le16_to_cpu(rxon->channel));

if (error) {
- IL_ERR(il, "Invalid RXON\n");
+ IL_ERR("Invalid RXON\n");
return -EINVAL;
}
return 0;
@@ -626,7 +626,7 @@ static void _il_set_rxon_ht(struct il_priv *il,
case IEEE80211_HT_PARAM_CHA_SEC_NONE:
default:
/* channel location only valid if in Mixed mode */
- IL_ERR(il,
+ IL_ERR(
"invalid extension channel offset\n");
break;
}
@@ -778,7 +778,7 @@ void il_connection_init_rx_config(struct il_priv *il,
break;

default:
- IL_ERR(il, "Unsupported interface type %d\n",
+ IL_ERR("Unsupported interface type %d\n",
ctx->vif->type);
break;
}
@@ -828,7 +828,7 @@ void il_set_rate(struct il_priv *il)

hw = il_get_hw_mode(il, il->band);
if (!hw) {
- IL_ERR(il, "Failed to set rate: unable to get hw mode\n");
+ IL_ERR("Failed to set rate: unable to get hw mode\n");
return;
}

@@ -882,7 +882,7 @@ void il_rx_csa(struct il_priv *il, struct il_rx_mem_buffer *rxb)
le16_to_cpu(csa->channel));
il_chswitch_done(il, true);
} else {
- IL_ERR(il, "CSA notif (fail) : channel %d\n",
+ IL_ERR("CSA notif (fail) : channel %d\n",
le16_to_cpu(csa->channel));
il_chswitch_done(il, false);
}
@@ -925,7 +925,7 @@ void il_irq_handle_error(struct il_priv *il)
/* Cancel currently queued command. */
clear_bit(STATUS_HCMD_ACTIVE, &il->status);

- IL_ERR(il, "Loaded firmware version: %s\n",
+ IL_ERR("Loaded firmware version: %s\n",
il->hw->wiphy->fw_version);

il->cfg->ops->lib->dump_nic_error_log(il);
@@ -963,7 +963,7 @@ static int il_apm_stop_master(struct il_priv *il)
ret = il_poll_bit(il, CSR_RESET, CSR_RESET_REG_FLAG_MASTER_DISABLED,
CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
if (ret)
- IL_WARN(il, "Master Disable Timed Out, 100 usec\n");
+ IL_WARN("Master Disable Timed Out, 100 usec\n");

D_INFO("stop master\n");

@@ -1123,14 +1123,14 @@ int il_set_tx_power(struct il_priv *il, s8 tx_power, bool force)

/* 0 dBm mean 1 milliwatt */
if (tx_power < 0) {
- IL_WARN(il,
+ IL_WARN(
"Requested user TXPOWER %d below 1 mW.\n",
tx_power);
return -EINVAL;
}

if (tx_power > il->tx_power_device_lmt) {
- IL_WARN(il,
+ IL_WARN(
"Requested user TXPOWER %d above upper limit %d.\n",
tx_power, il->tx_power_device_lmt);
return -EINVAL;
@@ -1184,7 +1184,7 @@ void il_send_bt_config(struct il_priv *il)

if (il_send_cmd_pdu(il, REPLY_BT_CONFIG,
sizeof(struct il_bt_cmd), &bt_cmd))
- IL_ERR(il, "failed to send BT Coex Config\n");
+ IL_ERR("failed to send BT Coex Config\n");
}
EXPORT_SYMBOL(il_send_bt_config);

@@ -1235,7 +1235,7 @@ void il_rx_reply_error(struct il_priv *il,
{
struct il_rx_packet *pkt = rxb_addr(rxb);

- IL_ERR(il, "Error Reply type 0x%08X cmd %s (0x%02X) "
+ IL_ERR("Error Reply type 0x%08X cmd %s (0x%02X) "
"seq 0x%04X ser 0x%08X\n",
le32_to_cpu(pkt->u.err_resp.error_type),
il_get_cmd_string(pkt->u.err_resp.cmd_id),
@@ -1354,7 +1354,7 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
mutex_lock(&il->mutex);

if (!il_is_ready_rf(il)) {
- IL_WARN(il, "Try to add interface when device not ready\n");
+ IL_WARN("Try to add interface when device not ready\n");
err = -EINVAL;
goto out;
}
@@ -1454,7 +1454,7 @@ int il_alloc_txq_mem(struct il_priv *il)
il->cfg->base_params->num_of_queues,
GFP_KERNEL);
if (!il->txq) {
- IL_ERR(il, "Not enough memory for txq\n");
+ IL_ERR("Not enough memory for txq\n");
return -ENOMEM;
}
return 0;
@@ -1743,7 +1743,7 @@ int il_force_reset(struct il_priv *il, bool external)
return 0;
}

- IL_ERR(il, "On demand firmware reload\n");
+ IL_ERR("On demand firmware reload\n");

/* Set the FW error flag -- cleared on il_down */
set_bit(STATUS_FW_ERROR, &il->status);
@@ -1847,7 +1847,7 @@ static int il_check_stuck_queue(struct il_priv *il, int cnt)
msecs_to_jiffies(il->cfg->base_params->wd_timeout);

if (time_after(jiffies, timeout)) {
- IL_ERR(il, "Queue %d stuck for %u ms.\n",
+ IL_ERR("Queue %d stuck for %u ms.\n",
q->id, il->cfg->base_params->wd_timeout);
ret = il_force_reset(il, false);
return (ret == -EAGAIN) ? 0 : 1;
@@ -2363,7 +2363,7 @@ static void il_beacon_update(struct ieee80211_hw *hw,
lockdep_assert_held(&il->mutex);

if (!il->beacon_ctx) {
- IL_ERR(il, "update beacon but no beacon context!\n");
+ IL_ERR("update beacon but no beacon context!\n");
dev_kfree_skb(skb);
return;
}
@@ -2440,7 +2440,7 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw,
* below/in post_associate will fail.
*/
if (il_scan_cancel_timeout(il, 100)) {
- IL_WARN(il,
+ IL_WARN(
"Aborted scan still in progress after 100ms\n");
D_MAC80211(
"leaving - scan abort failed.\n");
@@ -2554,7 +2554,7 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw,
ret = il->cfg->ops->legacy->manage_ibss_station(il, vif,
bss_conf->ibss_joined);
if (ret)
- IL_ERR(il, "failed to %s IBSS station %pM\n",
+ IL_ERR("failed to %s IBSS station %pM\n",
bss_conf->ibss_joined ? "add" : "remove",
bss_conf->bssid);
}
@@ -2599,7 +2599,7 @@ irqreturn_t il_isr(int irq, void *data)
if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) {
/* Hardware disappeared. It might have already raised
* an interrupt */
- IL_WARN(il, "HARDWARE GONE?? INTA == 0x%08x\n", inta);
+ IL_WARN("HARDWARE GONE?? INTA == 0x%08x\n", inta);
goto unplugged;
}

diff --git a/drivers/net/wireless/iwlegacy/iwl-debug.h b/drivers/net/wireless/iwlegacy/iwl-debug.h
index 2c5c42f..373188d 100644
--- a/drivers/net/wireless/iwlegacy/iwl-debug.h
+++ b/drivers/net/wireless/iwlegacy/iwl-debug.h
@@ -32,10 +32,10 @@
struct il_priv;
extern u32 il_debug_level;

-#define IL_ERR(p, f, a...) dev_err(&((p)->pci_dev->dev), f, ## a)
-#define IL_WARN(p, f, a...) dev_warn(&((p)->pci_dev->dev), f, ## a)
-#define IL_INFO(p, f, a...) dev_info(&((p)->pci_dev->dev), f, ## a)
-#define IL_CRIT(p, f, a...) dev_crit(&((p)->pci_dev->dev), f, ## a)
+#define IL_ERR(f, a...) dev_err(&il->pci_dev->dev, f, ## a)
+#define IL_WARN(f, a...) dev_warn(&il->pci_dev->dev, f, ## a)
+#define IL_INFO(f, a...) dev_info(&il->pci_dev->dev, f, ## a)
+#define IL_CRIT(f, a...) dev_crit(&il->pci_dev->dev, f, ## a)

#define il_print_hex_error(il, p, len) \
do { \
diff --git a/drivers/net/wireless/iwlegacy/iwl-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-debugfs.c
index a811c17..45b71a8 100644
--- a/drivers/net/wireless/iwlegacy/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-debugfs.c
@@ -358,20 +358,20 @@ static ssize_t il_dbgfs_nvm_read(struct file *file,
buf_size = 4 * eeprom_len + 256;

if (eeprom_len % 16) {
- IL_ERR(il, "NVM size is not multiple of 16.\n");
+ IL_ERR("NVM size is not multiple of 16.\n");
return -ENODATA;
}

ptr = il->eeprom;
if (!ptr) {
- IL_ERR(il, "Invalid EEPROM memory\n");
+ IL_ERR("Invalid EEPROM memory\n");
return -ENOMEM;
}

/* 4 characters for byte 0xYY */
buf = kzalloc(buf_size, GFP_KERNEL);
if (!buf) {
- IL_ERR(il, "Can not allocate Buffer\n");
+ IL_ERR("Can not allocate Buffer\n");
return -ENOMEM;
}
eeprom_ver = il_eeprom_query16(il, EEPROM_VERSION);
@@ -407,7 +407,7 @@ il_dbgfs_channels_read(struct file *file, char __user *user_buf,

buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) {
- IL_ERR(il, "Can not allocate Buffer\n");
+ IL_ERR("Can not allocate Buffer\n");
return -ENOMEM;
}

@@ -519,7 +519,7 @@ static ssize_t il_dbgfs_interrupt_read(struct file *file,

buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) {
- IL_ERR(il, "Can not allocate Buffer\n");
+ IL_ERR("Can not allocate Buffer\n");
return -ENOMEM;
}

@@ -640,7 +640,7 @@ static ssize_t il_dbgfs_disable_ht40_write(struct file *file,
if (!il_is_any_associated(il))
il->disable_ht40 = ht40 ? true : false;
else {
- IL_ERR(il, "Sta associated with AP - "
+ IL_ERR("Sta associated with AP - "
"Change to 40MHz channel support is not allowed\n");
return -EINVAL;
}
@@ -689,12 +689,12 @@ static ssize_t il_dbgfs_traffic_log_read(struct file *file,
ssize_t ret;

if (!il->txq) {
- IL_ERR(il, "txq not ready\n");
+ IL_ERR("txq not ready\n");
return -EAGAIN;
}
buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) {
- IL_ERR(il, "Can not allocate buffer\n");
+ IL_ERR("Can not allocate buffer\n");
return -ENOMEM;
}
pos += scnprintf(buf + pos, bufsz - pos, "Tx Queue\n");
@@ -787,7 +787,7 @@ static ssize_t il_dbgfs_tx_queue_read(struct file *file,
il->cfg->base_params->num_of_queues;

if (!il->txq) {
- IL_ERR(il, "txq not ready\n");
+ IL_ERR("txq not ready\n");
return -EAGAIN;
}
buf = kzalloc(bufsz, GFP_KERNEL);
@@ -884,7 +884,7 @@ static ssize_t il_dbgfs_sensitivity_read(struct file *file,
data = &il->sensitivity_data;
buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) {
- IL_ERR(il, "Can not allocate Buffer\n");
+ IL_ERR("Can not allocate Buffer\n");
return -ENOMEM;
}

@@ -965,7 +965,7 @@ static ssize_t il_dbgfs_chain_noise_read(struct file *file,
data = &il->chain_noise_data;
buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) {
- IL_ERR(il, "Can not allocate Buffer\n");
+ IL_ERR("Can not allocate Buffer\n");
return -ENOMEM;
}

@@ -1292,7 +1292,7 @@ int il_dbgfs_register(struct il_priv *il, const char *name)
return 0;

err:
- IL_ERR(il, "Can't create the debugfs directory\n");
+ IL_ERR("Can't create the debugfs directory\n");
il_dbgfs_unregister(il);
return -ENOMEM;
}
diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.c b/drivers/net/wireless/iwlegacy/iwl-eeprom.c
index 33fe598..5f0fd2a 100644
--- a/drivers/net/wireless/iwlegacy/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlegacy/iwl-eeprom.c
@@ -153,7 +153,7 @@ static int il_eeprom_verify_signature(struct il_priv *il)
case CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K:
break;
default:
- IL_ERR(il, "bad EEPROM signature,"
+ IL_ERR("bad EEPROM signature,"
"EEPROM_GP=0x%08x\n", gp);
ret = -ENOENT;
break;
@@ -206,7 +206,7 @@ int il_eeprom_init(struct il_priv *il)

ret = il_eeprom_verify_signature(il);
if (ret < 0) {
- IL_ERR(il, "EEPROM not found, EEPROM_GP=0x%08x\n", gp);
+ IL_ERR("EEPROM not found, EEPROM_GP=0x%08x\n", gp);
ret = -ENOENT;
goto err;
}
@@ -214,7 +214,7 @@ int il_eeprom_init(struct il_priv *il)
/* Make sure driver (instead of uCode) is allowed to read EEPROM */
ret = il->cfg->ops->lib->eeprom_ops.acquire_semaphore(il);
if (ret < 0) {
- IL_ERR(il, "Failed to acquire EEPROM semaphore.\n");
+ IL_ERR("Failed to acquire EEPROM semaphore.\n");
ret = -ENOENT;
goto err;
}
@@ -231,7 +231,7 @@ int il_eeprom_init(struct il_priv *il)
CSR_EEPROM_REG_READ_VALID_MSK,
IL_EEPROM_ACCESS_TIMEOUT);
if (ret < 0) {
- IL_ERR(il, "Time out reading EEPROM[%d]\n",
+ IL_ERR("Time out reading EEPROM[%d]\n",
addr);
goto done;
}
@@ -399,7 +399,7 @@ int il_init_channel_map(struct il_priv *il)
il->channel_info = kzalloc(sizeof(struct il_channel_info) *
il->channel_count, GFP_KERNEL);
if (!il->channel_info) {
- IL_ERR(il, "Could not allocate channel_info\n");
+ IL_ERR("Could not allocate channel_info\n");
il->channel_count = 0;
return -ENOMEM;
}
diff --git a/drivers/net/wireless/iwlegacy/iwl-hcmd.c b/drivers/net/wireless/iwlegacy/iwl-hcmd.c
index 61cf0d8..8f87bd8 100644
--- a/drivers/net/wireless/iwlegacy/iwl-hcmd.c
+++ b/drivers/net/wireless/iwlegacy/iwl-hcmd.c
@@ -95,7 +95,7 @@ static void il_generic_cmd_callback(struct il_priv *il,
struct il_rx_packet *pkt)
{
if (pkt->hdr.flags & IL_CMD_FAILED_MSK) {
- IL_ERR(il, "Bad return from %s (0x%08X)\n",
+ IL_ERR("Bad return from %s (0x%08X)\n",
il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
return;
}
@@ -133,7 +133,7 @@ il_send_cmd_async(struct il_priv *il, struct il_host_cmd *cmd)

ret = il_enqueue_hcmd(il, cmd);
if (ret < 0) {
- IL_ERR(il, "Error sending %s: enqueue_hcmd failed: %d\n",
+ IL_ERR("Error sending %s: enqueue_hcmd failed: %d\n",
il_get_cmd_string(cmd->id), ret);
return ret;
}
@@ -162,7 +162,7 @@ int il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd)
cmd_idx = il_enqueue_hcmd(il, cmd);
if (cmd_idx < 0) {
ret = cmd_idx;
- IL_ERR(il, "Error sending %s: enqueue_hcmd failed: %d\n",
+ IL_ERR("Error sending %s: enqueue_hcmd failed: %d\n",
il_get_cmd_string(cmd->id), ret);
goto out;
}
@@ -172,7 +172,7 @@ int il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd)
HOST_COMPLETE_TIMEOUT);
if (!ret) {
if (test_bit(STATUS_HCMD_ACTIVE, &il->status)) {
- IL_ERR(il,
+ IL_ERR(
"Error sending %s: time out after %dms.\n",
il_get_cmd_string(cmd->id),
jiffies_to_msecs(HOST_COMPLETE_TIMEOUT));
@@ -187,19 +187,19 @@ int il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd)
}

if (test_bit(STATUS_RF_KILL_HW, &il->status)) {
- IL_ERR(il, "Command %s aborted: RF KILL Switch\n",
+ IL_ERR("Command %s aborted: RF KILL Switch\n",
il_get_cmd_string(cmd->id));
ret = -ECANCELED;
goto fail;
}
if (test_bit(STATUS_FW_ERROR, &il->status)) {
- IL_ERR(il, "Command %s failed: FW Error\n",
+ IL_ERR("Command %s failed: FW Error\n",
il_get_cmd_string(cmd->id));
ret = -EIO;
goto fail;
}
if ((cmd->flags & CMD_WANT_SKB) && !cmd->reply_page) {
- IL_ERR(il, "Error: Response NULL in '%s'\n",
+ IL_ERR("Error: Response NULL in '%s'\n",
il_get_cmd_string(cmd->id));
ret = -EIO;
goto cancel;
diff --git a/drivers/net/wireless/iwlegacy/iwl-io.h b/drivers/net/wireless/iwlegacy/iwl-io.h
index d6aae8d..1afd5c0 100644
--- a/drivers/net/wireless/iwlegacy/iwl-io.h
+++ b/drivers/net/wireless/iwlegacy/iwl-io.h
@@ -132,7 +132,7 @@ static inline int _il_grab_nic_access(struct il_priv *il)
CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 15000);
if (ret < 0) {
val = _il_read32(il, CSR_GP_CNTRL);
- IL_ERR(il,
+ IL_ERR(
"MAC is in deep sleep!. CSR_GP_CNTRL = 0x%08X\n", val);
_il_write32(il, CSR_RESET,
CSR_RESET_REG_FLAG_FORCE_NMI);
diff --git a/drivers/net/wireless/iwlegacy/iwl-led.c b/drivers/net/wireless/iwlegacy/iwl-led.c
index b4d71cf..a283804 100644
--- a/drivers/net/wireless/iwlegacy/iwl-led.c
+++ b/drivers/net/wireless/iwlegacy/iwl-led.c
@@ -88,7 +88,7 @@ static inline u8 il_blink_compensation(struct il_priv *il,
u8 time, u16 compensation)
{
if (!compensation) {
- IL_ERR(il, "undefined blink compensation: "
+ IL_ERR("undefined blink compensation: "
"use pre-defined blinking time\n");
return time;
}
diff --git a/drivers/net/wireless/iwlegacy/iwl-power.c b/drivers/net/wireless/iwlegacy/iwl-power.c
index 33aec39..6c6e5e7 100644
--- a/drivers/net/wireless/iwlegacy/iwl-power.c
+++ b/drivers/net/wireless/iwlegacy/iwl-power.c
@@ -136,7 +136,7 @@ il_power_set_mode(struct il_priv *il, struct il_powertable_cmd *cmd,

memcpy(&il->power_data.sleep_cmd, cmd, sizeof(*cmd));
} else
- IL_ERR(il, "set power fail, ret = %d", ret);
+ IL_ERR("set power fail, ret = %d", ret);

return ret;
}
diff --git a/drivers/net/wireless/iwlegacy/iwl-scan.c b/drivers/net/wireless/iwlegacy/iwl-scan.c
index c534dce..3687104 100644
--- a/drivers/net/wireless/iwlegacy/iwl-scan.c
+++ b/drivers/net/wireless/iwlegacy/iwl-scan.c
@@ -341,7 +341,7 @@ static int il_scan_initiate(struct il_priv *il,
cancel_delayed_work(&il->scan_check);

if (!il_is_ready_rf(il)) {
- IL_WARN(il, "Request scan called when driver not ready.\n");
+ IL_WARN("Request scan called when driver not ready.\n");
return -EIO;
}

diff --git a/drivers/net/wireless/iwlegacy/iwl-sta.c b/drivers/net/wireless/iwlegacy/iwl-sta.c
index a48af85..42033d2 100644
--- a/drivers/net/wireless/iwlegacy/iwl-sta.c
+++ b/drivers/net/wireless/iwlegacy/iwl-sta.c
@@ -41,7 +41,7 @@ static void il_sta_ucode_activate(struct il_priv *il, u8 sta_id)
{

if (!(il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE))
- IL_ERR(il,
+ IL_ERR(
"ACTIVATE a non DRIVER active station id %u addr %pM\n",
sta_id, il->stations[sta_id].sta.sta.addr);

@@ -67,7 +67,7 @@ static int il_process_add_sta_resp(struct il_priv *il,
int ret = -EIO;

if (pkt->hdr.flags & IL_CMD_FAILED_MSK) {
- IL_ERR(il, "Bad return from REPLY_ADD_STA (0x%08X)\n",
+ IL_ERR("Bad return from REPLY_ADD_STA (0x%08X)\n",
pkt->hdr.flags);
return ret;
}
@@ -84,16 +84,16 @@ static int il_process_add_sta_resp(struct il_priv *il,
ret = 0;
break;
case ADD_STA_NO_ROOM_IN_TABLE:
- IL_ERR(il, "Adding station %d failed, no room in table.\n",
+ IL_ERR("Adding station %d failed, no room in table.\n",
sta_id);
break;
case ADD_STA_NO_BLOCK_ACK_RESOURCE:
- IL_ERR(il,
+ IL_ERR(
"Adding station %d failed, no block ack resource.\n",
sta_id);
break;
case ADD_STA_MODIFY_NON_EXIST_STA:
- IL_ERR(il, "Attempting to modify non-existing station %d\n",
+ IL_ERR("Attempting to modify non-existing station %d\n",
sta_id);
break;
default:
@@ -206,7 +206,7 @@ static void il_set_ht_add_station(struct il_priv *il, u8 index,
case WLAN_HT_CAP_SM_PS_DISABLED:
break;
default:
- IL_WARN(il, "Invalid MIMO PS mode %d\n", mimo_ps_mode);
+ IL_WARN("Invalid MIMO PS mode %d\n", mimo_ps_mode);
break;
}

@@ -343,7 +343,7 @@ il_add_station_common(struct il_priv *il,
spin_lock_irqsave(&il->sta_lock, flags_spin);
sta_id = il_prep_station(il, ctx, addr, is_ap, sta);
if (sta_id == IL_INVALID_STATION) {
- IL_ERR(il, "Unable to prepare station %pM for addition\n",
+ IL_ERR("Unable to prepare station %pM for addition\n",
addr);
spin_unlock_irqrestore(&il->sta_lock, flags_spin);
return -EINVAL;
@@ -380,7 +380,7 @@ il_add_station_common(struct il_priv *il,
ret = il_send_add_sta(il, &sta_cmd, CMD_SYNC);
if (ret) {
spin_lock_irqsave(&il->sta_lock, flags_spin);
- IL_ERR(il, "Adding station %pM failed.\n",
+ IL_ERR("Adding station %pM failed.\n",
il->stations[sta_id].sta.sta.addr);
il->stations[sta_id].used &= ~IL_STA_DRIVER_ACTIVE;
il->stations[sta_id].used &= ~IL_STA_UCODE_INPROGRESS;
@@ -402,7 +402,7 @@ static void il_sta_ucode_deactivate(struct il_priv *il, u8 sta_id)
if ((il->stations[sta_id].used &
(IL_STA_UCODE_ACTIVE | IL_STA_DRIVER_ACTIVE)) !=
IL_STA_UCODE_ACTIVE)
- IL_ERR(il, "removed non active STA %u\n", sta_id);
+ IL_ERR("removed non active STA %u\n", sta_id);

il->stations[sta_id].used &= ~IL_STA_UCODE_ACTIVE;

@@ -440,7 +440,7 @@ static int il_send_remove_station(struct il_priv *il,

pkt = (struct il_rx_packet *)cmd.reply_page;
if (pkt->hdr.flags & IL_CMD_FAILED_MSK) {
- IL_ERR(il, "Bad return from REPLY_REMOVE_STA (0x%08X)\n",
+ IL_ERR("Bad return from REPLY_REMOVE_STA (0x%08X)\n",
pkt->hdr.flags);
ret = -EIO;
}
@@ -458,7 +458,7 @@ static int il_send_remove_station(struct il_priv *il,
break;
default:
ret = -EIO;
- IL_ERR(il, "REPLY_REMOVE_STA failed\n");
+ IL_ERR("REPLY_REMOVE_STA failed\n");
break;
}
}
@@ -618,7 +618,7 @@ il_restore_stations(struct il_priv *il, struct il_rxon_context *ctx)
ret = il_send_add_sta(il, &sta_cmd, CMD_SYNC);
if (ret) {
spin_lock_irqsave(&il->sta_lock, flags_spin);
- IL_ERR(il, "Adding station %pM failed.\n",
+ IL_ERR("Adding station %pM failed.\n",
il->stations[i].sta.sta.addr);
il->stations[i].used &=
~IL_STA_DRIVER_ACTIVE;
@@ -808,7 +808,7 @@ int il_mac_sta_remove(struct ieee80211_hw *hw,
sta->addr);
ret = il_remove_station(il, sta_common->sta_id, sta->addr);
if (ret)
- IL_ERR(il, "Error removing station %pM\n",
+ IL_ERR("Error removing station %pM\n",
sta->addr);
mutex_unlock(&il->mutex);
return ret;
diff --git a/drivers/net/wireless/iwlegacy/iwl-tx.c b/drivers/net/wireless/iwlegacy/iwl-tx.c
index 22617c4..cfc015a 100644
--- a/drivers/net/wireless/iwlegacy/iwl-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-tx.c
@@ -299,7 +299,7 @@ static int il_tx_queue_alloc(struct il_priv *il,
txq->txb = kzalloc(sizeof(txq->txb[0]) *
TFD_QUEUE_SIZE_MAX, GFP_KERNEL);
if (!txq->txb) {
- IL_ERR(il, "kmalloc for auxiliary BD "
+ IL_ERR("kmalloc for auxiliary BD "
"structures failed\n");
goto error;
}
@@ -312,7 +312,7 @@ static int il_tx_queue_alloc(struct il_priv *il,
txq->tfds = dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr,
GFP_KERNEL);
if (!txq->tfds) {
- IL_ERR(il, "pci_alloc_consistent(%zd) failed\n", tfd_sz);
+ IL_ERR("pci_alloc_consistent(%zd) failed\n", tfd_sz);
goto error;
}
txq->q.id = id;
@@ -461,7 +461,7 @@ int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd)
BUG_ON(fix_size > IL_MAX_CMD_SIZE);

if (il_is_rfkill(il) || il_is_ctkill(il)) {
- IL_WARN(il, "Not sending command - %s KILL\n",
+ IL_WARN("Not sending command - %s KILL\n",
il_is_rfkill(il) ? "RF" : "CT");
return -EIO;
}
@@ -471,7 +471,7 @@ int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd)
if (il_queue_space(q) < ((cmd->flags & CMD_ASYNC) ? 2 : 1)) {
spin_unlock_irqrestore(&il->hcmd_lock, flags);

- IL_ERR(il, "Restarting adapter due to command queue full\n");
+ IL_ERR("Restarting adapter due to command queue full\n");
queue_work(il->workqueue, &il->restart);
return -ENOSPC;
}
@@ -566,7 +566,7 @@ static void il_hcmd_queue_reclaim(struct il_priv *il, int txq_id,
int nfreed = 0;

if ((idx >= q->n_bd) || (il_queue_used(q, idx) == 0)) {
- IL_ERR(il, "Read index for DMA queue txq id (%d), index %d, "
+ IL_ERR("Read index for DMA queue txq id (%d), index %d, "
"is out of range [0-%d] %d %d.\n", txq_id,
idx, q->n_bd, q->write_ptr, q->read_ptr);
return;
@@ -576,7 +576,7 @@ static void il_hcmd_queue_reclaim(struct il_priv *il, int txq_id,
q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) {

if (nfreed++ > 0) {
- IL_ERR(il, "HCMD skipped: index (%d) %d %d\n", idx,
+ IL_ERR("HCMD skipped: index (%d) %d %d\n", idx,
q->write_ptr, q->read_ptr);
queue_work(il->workqueue, &il->restart);
}
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index 8aa22a0..8a6b193 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -127,7 +127,7 @@ __le32 il3945_get_antenna_flags(const struct il_priv *il)
}

/* bad antenna selector value */
- IL_ERR(il, "Bad antenna selector value (0x%x)\n",
+ IL_ERR("Bad antenna selector value (0x%x)\n",
il3945_mod_params.antenna);

return 0; /* "diversity" is default if error */
@@ -236,7 +236,7 @@ static int il3945_set_dynamic_key(struct il_priv *il,
ret = il3945_set_wep_dynamic_key_info(il, keyconf, sta_id);
break;
default:
- IL_ERR(il, "Unknown alg: %s alg=%x\n", __func__,
+ IL_ERR("Unknown alg: %s alg=%x\n", __func__,
keyconf->cipher);
ret = -EINVAL;
}
@@ -262,7 +262,7 @@ static int il3945_set_static_key(struct il_priv *il,
key->cipher == WLAN_CIPHER_SUITE_WEP104)
return -EOPNOTSUPP;

- IL_ERR(il, "Static key invalid: cipher %x\n", key->cipher);
+ IL_ERR("Static key invalid: cipher %x\n", key->cipher);
return -EINVAL;
}

@@ -281,7 +281,7 @@ static void il3945_clear_free_frames(struct il_priv *il)
}

if (il->frames_count) {
- IL_WARN(il, "%d frames still in use. Did we lose one?\n",
+ IL_WARN("%d frames still in use. Did we lose one?\n",
il->frames_count);
il->frames_count = 0;
}
@@ -294,7 +294,7 @@ static struct il3945_frame *il3945_get_free_frame(struct il_priv *il)
if (list_empty(&il->free_frames)) {
frame = kzalloc(sizeof(*frame), GFP_KERNEL);
if (!frame) {
- IL_ERR(il, "Could not allocate frame!\n");
+ IL_ERR("Could not allocate frame!\n");
return NULL;
}

@@ -339,7 +339,7 @@ static int il3945_send_beacon_cmd(struct il_priv *il)
frame = il3945_get_free_frame(il);

if (!frame) {
- IL_ERR(il, "Could not obtain free frame buffer for beacon "
+ IL_ERR("Could not obtain free frame buffer for beacon "
"command.\n");
return -ENOMEM;
}
@@ -401,7 +401,7 @@ static void il3945_build_tx_cmd_hwcrypto(struct il_priv *il,
break;

default:
- IL_ERR(il, "Unknown encode cipher %x\n", keyinfo->cipher);
+ IL_ERR("Unknown encode cipher %x\n", keyinfo->cipher);
break;
}
}
@@ -491,7 +491,7 @@ static int il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)
}

if ((ieee80211_get_tx_rate(il->hw, info)->hw_value & 0xFF) == IL_INVALID_RATE) {
- IL_ERR(il, "ERROR: No TX rate available.\n");
+ IL_ERR("ERROR: No TX rate available.\n");
goto drop_unlock;
}

@@ -718,7 +718,7 @@ static int il3945_get_measurement(struct il_priv *il,

pkt = (struct il_rx_packet *)cmd.reply_page;
if (pkt->hdr.flags & IL_CMD_FAILED_MSK) {
- IL_ERR(il, "Bad return from REPLY_RX_ON_ASSOC command\n");
+ IL_ERR("Bad return from REPLY_RX_ON_ASSOC command\n");
rc = -EIO;
}

@@ -777,7 +777,7 @@ static void il3945_rx_reply_alive(struct il_priv *il,
queue_delayed_work(il->workqueue, pwork,
msecs_to_jiffies(5));
else
- IL_WARN(il, "uCode did not respond OK.\n");
+ IL_WARN("uCode did not respond OK.\n");
}

static void il3945_rx_reply_add_sta(struct il_priv *il,
@@ -820,7 +820,7 @@ static void il3945_rx_card_state_notif(struct il_priv *il,
u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags);
unsigned long status = il->status;

- IL_WARN(il, "Card state received: HW:%s SW:%s\n",
+ IL_WARN("Card state received: HW:%s SW:%s\n",
(flags & HW_CARD_DISABLED) ? "Kill" : "On",
(flags & SW_CARD_DISABLED) ? "Kill" : "On");

@@ -1043,7 +1043,7 @@ static void il3945_rx_allocate(struct il_priv *il, gfp_t priority)
D_INFO("Failed to allocate SKB buffer.\n");
if ((rxq->free_count <= RX_LOW_WATERMARK) &&
net_ratelimit())
- IL_CRIT(il, "Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n",
+ IL_CRIT("Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n",
priority == GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL",
rxq->free_count);
/* We don't reschedule replenish work here -- we will
@@ -1287,7 +1287,7 @@ static void il3945_rx_handle(struct il_priv *il)
if (rxb->page)
il_tx_cmd_complete(il, rxb);
else
- IL_WARN(il, "Claim null rxb?\n");
+ IL_WARN("Claim null rxb?\n");
}

/* Reuse the page if possible. For notification packets and
@@ -1366,7 +1366,7 @@ void il3945_dump_nic_error_log(struct il_priv *il)
base = le32_to_cpu(il->card_alive.error_event_table_ptr);

if (!il3945_hw_valid_rtc_data_addr(base)) {
- IL_ERR(il, "Not valid error log pointer 0x%08X\n", base);
+ IL_ERR("Not valid error log pointer 0x%08X\n", base);
return;
}

@@ -1374,12 +1374,12 @@ void il3945_dump_nic_error_log(struct il_priv *il)
count = il_read_targ_mem(il, base);

if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) {
- IL_ERR(il, "Start IWL Error Log Dump:\n");
- IL_ERR(il, "Status: 0x%08lX, count: %d\n",
+ IL_ERR("Start IWL Error Log Dump:\n");
+ IL_ERR("Status: 0x%08lX, count: %d\n",
il->status, count);
}

- IL_ERR(il, "Desc Time asrtPC blink2 "
+ IL_ERR("Desc Time asrtPC blink2 "
"ilink1 nmiPC Line\n");
for (i = ERROR_START_OFFSET;
i < (count * ERROR_ELEM_SIZE) + ERROR_START_OFFSET;
@@ -1398,7 +1398,7 @@ void il3945_dump_nic_error_log(struct il_priv *il)
data1 =
il_read_targ_mem(il, base + i + 6 * sizeof(u32));

- IL_ERR(il,
+ IL_ERR(
"%-13s (0x%X) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n",
il3945_desc_lookup(desc), desc, time, blink1, blink2,
ilink1, ilink2, data1);
@@ -1450,7 +1450,7 @@ static void il3945_irq_tasklet(struct il_priv *il)

/* Now service all interrupt bits discovered above. */
if (inta & CSR_INT_BIT_HW_ERR) {
- IL_ERR(il, "Hardware error detected. Restarting.\n");
+ IL_ERR("Hardware error detected. Restarting.\n");

/* Tell the device to stop sending interrupts */
il_disable_interrupts(il);
@@ -1484,7 +1484,7 @@ static void il3945_irq_tasklet(struct il_priv *il)

/* Error detected by uCode */
if (inta & CSR_INT_BIT_SW_ERR) {
- IL_ERR(il, "Microcode SW error detected. "
+ IL_ERR("Microcode SW error detected. "
"Restarting 0x%X.\n", inta);
il->isr_stats.sw++;
il_irq_handle_error(il);
@@ -1526,14 +1526,14 @@ static void il3945_irq_tasklet(struct il_priv *il)
}

if (inta & ~handled) {
- IL_ERR(il, "Unhandled INTA bits 0x%08x\n", inta & ~handled);
+ IL_ERR("Unhandled INTA bits 0x%08x\n", inta & ~handled);
il->isr_stats.unhandled++;
}

if (inta & ~il->inta_mask) {
- IL_WARN(il, "Disabled INTA bits 0x%08x were pending\n",
+ IL_WARN("Disabled INTA bits 0x%08x were pending\n",
inta & ~il->inta_mask);
- IL_WARN(il, " with FH_INT = 0x%08x\n", inta_fh);
+ IL_WARN(" with FH_INT = 0x%08x\n", inta_fh);
}

/* Re-enable all interrupts */
@@ -1708,7 +1708,7 @@ static int il3945_verify_inst_full(struct il_priv *il, __le32 *image, u32 len)
* if IL_DL_IO is set */
val = _il_read_direct32(il, HBUS_TARG_MEM_RDAT);
if (val != le32_to_cpu(*image)) {
- IL_ERR(il, "uCode INST section is invalid at "
+ IL_ERR("uCode INST section is invalid at "
"offset 0x%x, is 0x%x, s/b 0x%x\n",
save_len - len, val, le32_to_cpu(*image));
rc = -EIO;
@@ -1750,7 +1750,7 @@ static int il3945_verify_inst_sparse(struct il_priv *il, __le32 *image, u32 len)
val = _il_read_direct32(il, HBUS_TARG_MEM_RDAT);
if (val != le32_to_cpu(*image)) {
#if 0 /* Enable this if you want to see details */
- IL_ERR(il, "uCode INST section is invalid at "
+ IL_ERR("uCode INST section is invalid at "
"offset 0x%x, is 0x%x, s/b 0x%x\n",
i, val, *image);
#endif
@@ -1802,7 +1802,7 @@ static int il3945_verify_ucode(struct il_priv *il)
return 0;
}

- IL_ERR(il, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n");
+ IL_ERR("NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n");

/* Since nothing seems to match, show first several data entries in
* instruction SRAM, so maybe visual inspection will give a clue.
@@ -1867,7 +1867,7 @@ static int il3945_read_ucode(struct il_priv *il)
sprintf(buf, "%s%u%s", name_pre, index, ".ucode");
ret = request_firmware(&ucode_raw, buf, &il->pci_dev->dev);
if (ret < 0) {
- IL_ERR(il, "%s firmware file req failed: %d\n",
+ IL_ERR("%s firmware file req failed: %d\n",
buf, ret);
if (ret == -ENOENT)
continue;
@@ -1875,7 +1875,7 @@ static int il3945_read_ucode(struct il_priv *il)
goto error;
} else {
if (index < api_max)
- IL_ERR(il, "Loaded firmware %s, "
+ IL_ERR("Loaded firmware %s, "
"which is deprecated. "
" Please use API v%u instead.\n",
buf, api_max);
@@ -1891,7 +1891,7 @@ static int il3945_read_ucode(struct il_priv *il)

/* Make sure that we got at least our header! */
if (ucode_raw->size < il3945_ucode_get_header_size(1)) {
- IL_ERR(il, "File size way too small!\n");
+ IL_ERR("File size way too small!\n");
ret = -EINVAL;
goto err_release;
}
@@ -1913,7 +1913,7 @@ static int il3945_read_ucode(struct il_priv *il)
* on the API version read from firmware header from here on forward */

if (api_ver < api_min || api_ver > api_max) {
- IL_ERR(il, "Driver unable to support your firmware API. "
+ IL_ERR("Driver unable to support your firmware API. "
"Driver supports v%u, firmware is v%u.\n",
api_max, api_ver);
il->ucode_ver = 0;
@@ -1921,12 +1921,12 @@ static int il3945_read_ucode(struct il_priv *il)
goto err_release;
}
if (api_ver != api_max)
- IL_ERR(il, "Firmware has old API version. Expected %u, "
+ IL_ERR("Firmware has old API version. Expected %u, "
"got %u. New firmware can be obtained "
"from http://www.intellinuxwireless.org.\n",
api_max, api_ver);

- IL_INFO(il, "loaded firmware version %u.%u.%u.%u\n",
+ IL_INFO("loaded firmware version %u.%u.%u.%u\n",
IL_UCODE_MAJOR(il->ucode_ver),
IL_UCODE_MINOR(il->ucode_ver),
IL_UCODE_API(il->ucode_ver),
@@ -2091,7 +2091,7 @@ static int il3945_read_ucode(struct il_priv *il)
return 0;

err_pci_alloc:
- IL_ERR(il, "failed to allocate pci memory\n");
+ IL_ERR("failed to allocate pci memory\n");
ret = -ENOMEM;
il3945_dealloc_ucode_pci(il);

@@ -2380,7 +2380,7 @@ static int il3945_alloc_bcast_station(struct il_priv *il)
sta_id = il_prep_station(il, ctx,
il_bcast_addr, false, NULL);
if (sta_id == IL_INVALID_STATION) {
- IL_ERR(il, "Unable to prepare broadcast station\n");
+ IL_ERR("Unable to prepare broadcast station\n");
spin_unlock_irqrestore(&il->sta_lock, flags);

return -EINVAL;
@@ -2402,12 +2402,12 @@ static int __il3945_up(struct il_priv *il)
return rc;

if (test_bit(STATUS_EXIT_PENDING, &il->status)) {
- IL_WARN(il, "Exit pending; will not bring the NIC up\n");
+ IL_WARN("Exit pending; will not bring the NIC up\n");
return -EIO;
}

if (!il->ucode_data_backup.v_addr || !il->ucode_data.v_addr) {
- IL_ERR(il, "ucode not available for device bring up\n");
+ IL_ERR("ucode not available for device bring up\n");
return -EIO;
}

@@ -2417,7 +2417,7 @@ static int __il3945_up(struct il_priv *il)
clear_bit(STATUS_RF_KILL_HW, &il->status);
else {
set_bit(STATUS_RF_KILL_HW, &il->status);
- IL_WARN(il, "Radio disabled by HW RF Kill switch\n");
+ IL_WARN("Radio disabled by HW RF Kill switch\n");
return -ENODEV;
}

@@ -2425,7 +2425,7 @@ static int __il3945_up(struct il_priv *il)

rc = il3945_hw_nic_init(il);
if (rc) {
- IL_ERR(il, "Unable to int nic\n");
+ IL_ERR("Unable to int nic\n");
return rc;
}

@@ -2460,7 +2460,7 @@ static int __il3945_up(struct il_priv *il)
rc = il->cfg->ops->lib->load_ucode(il);

if (rc) {
- IL_ERR(il,
+ IL_ERR(
"Unable to set up bootstrap uCode: %d\n", rc);
continue;
}
@@ -2479,7 +2479,7 @@ static int __il3945_up(struct il_priv *il)

/* tried to restart and config the device for as long as our
* patience could withstand */
- IL_ERR(il, "Unable to initialize device after %d attempts.\n", i);
+ IL_ERR("Unable to initialize device after %d attempts.\n", i);
return -EIO;
}

@@ -2650,7 +2650,7 @@ int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
band = IEEE80211_BAND_5GHZ;
break;
default:
- IL_WARN(il, "Invalid scan band\n");
+ IL_WARN("Invalid scan band\n");
return -EIO;
}

@@ -2770,7 +2770,7 @@ void il3945_post_associate(struct il_priv *il)

rc = il_send_rxon_timing(il, ctx);
if (rc)
- IL_WARN(il, "REPLY_RXON_TIMING failed - "
+ IL_WARN("REPLY_RXON_TIMING failed - "
"Attempting to continue.\n");

ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
@@ -2802,7 +2802,7 @@ void il3945_post_associate(struct il_priv *il)
il3945_send_beacon_cmd(il);
break;
default:
- IL_ERR(il, "%s Should not be called in %d mode\n",
+ IL_ERR("%s Should not be called in %d mode\n",
__func__, ctx->vif->type);
break;
}
@@ -2832,7 +2832,7 @@ static int il3945_mac_start(struct ieee80211_hw *hw)
if (!il->ucode_code.len) {
ret = il3945_read_ucode(il);
if (ret) {
- IL_ERR(il, "Could not read microcode: %d\n", ret);
+ IL_ERR("Could not read microcode: %d\n", ret);
mutex_unlock(&il->mutex);
goto out_release_irq;
}
@@ -2854,7 +2854,7 @@ static int il3945_mac_start(struct ieee80211_hw *hw)
UCODE_READY_TIMEOUT);
if (!ret) {
if (!test_bit(STATUS_READY, &il->status)) {
- IL_ERR(il,
+ IL_ERR(
"Wait for START_ALIVE timeout after %dms.\n",
jiffies_to_msecs(UCODE_READY_TIMEOUT));
ret = -ETIMEDOUT;
@@ -2934,7 +2934,7 @@ void il3945_config_ap(struct il_priv *il)
/* RXON Timing */
rc = il_send_rxon_timing(il, ctx);
if (rc)
- IL_WARN(il, "REPLY_RXON_TIMING failed - "
+ IL_WARN("REPLY_RXON_TIMING failed - "
"Attempting to continue.\n");

ctx->staging.assoc_id = 0;
@@ -3045,7 +3045,7 @@ static int il3945_mac_sta_add(struct ieee80211_hw *hw,
&il->contexts[IL_RXON_CTX_BSS],
sta->addr, is_ap, sta, &sta_id);
if (ret) {
- IL_ERR(il, "Unable to add station %pM (%d)\n",
+ IL_ERR("Unable to add station %pM (%d)\n",
sta->addr, ret);
/* Should we return success if return code is EEXIST ? */
mutex_unlock(&il->mutex);
@@ -3147,11 +3147,11 @@ static ssize_t il3945_store_debug_level(struct device *d,

ret = strict_strtoul(buf, 0, &val);
if (ret)
- IL_INFO(il, "%s is not in hex or decimal form.\n", buf);
+ IL_INFO("%s is not in hex or decimal form.\n", buf);
else {
il->debug_level = val;
if (il_alloc_traffic_mem(il))
- IL_ERR(il,
+ IL_ERR(
"Not enough memory to generate traffic log\n");
}
return strnlen(buf, count);
@@ -3192,7 +3192,7 @@ static ssize_t il3945_store_tx_power(struct device *d,

val = simple_strtoul(p, &p, 10);
if (p == buf)
- IL_INFO(il, ": %s is not in decimal form.\n", buf);
+ IL_INFO(": %s is not in decimal form.\n", buf);
else
il3945_hw_reg_set_txpower(il, val);

@@ -3222,7 +3222,7 @@ static ssize_t il3945_store_flags(struct device *d,
if (le32_to_cpu(ctx->staging.flags) != flags) {
/* Cancel any currently running scans... */
if (il_scan_cancel_timeout(il, 100))
- IL_WARN(il, "Could not cancel scan.\n");
+ IL_WARN("Could not cancel scan.\n");
else {
D_INFO("Committing rxon.flags = 0x%04X\n",
flags);
@@ -3259,7 +3259,7 @@ static ssize_t il3945_store_filter_flags(struct device *d,
if (le32_to_cpu(ctx->staging.filter_flags) != filter_flags) {
/* Cancel any currently running scans... */
if (il_scan_cancel_timeout(il, 100))
- IL_WARN(il, "Could not cancel scan.\n");
+ IL_WARN("Could not cancel scan.\n");
else {
D_INFO("Committing rxon.filter_flags = "
"0x%04X\n", filter_flags);
@@ -3551,14 +3551,14 @@ static int il3945_init_drv(struct il_priv *il)
il->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD;

if (eeprom->version < EEPROM_3945_EEPROM_VERSION) {
- IL_WARN(il, "Unsupported EEPROM version: 0x%04X\n",
+ IL_WARN("Unsupported EEPROM version: 0x%04X\n",
eeprom->version);
ret = -EINVAL;
goto err;
}
ret = il_init_channel_map(il);
if (ret) {
- IL_ERR(il, "initializing regulatory failed: %d\n", ret);
+ IL_ERR("initializing regulatory failed: %d\n", ret);
goto err;
}

@@ -3570,7 +3570,7 @@ static int il3945_init_drv(struct il_priv *il)

ret = il_init_geos(il);
if (ret) {
- IL_ERR(il, "initializing geos failed: %d\n", ret);
+ IL_ERR("initializing geos failed: %d\n", ret);
goto err_free_channel_map;
}
il3945_init_hw_rates(il, il->ieee_rates);
@@ -3624,7 +3624,7 @@ static int il3945_setup_mac(struct il_priv *il)

ret = ieee80211_register_hw(il->hw);
if (ret) {
- IL_ERR(il, "Failed to register hw (error %d)\n", ret);
+ IL_ERR("Failed to register hw (error %d)\n", ret);
return ret;
}
il->mac80211_registered = 1;
@@ -3692,7 +3692,7 @@ static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *en
il->inta_mask = CSR_INI_SET_MASK;

if (il_alloc_traffic_mem(il))
- IL_ERR(il, "Not enough memory to generate traffic log\n");
+ IL_ERR("Not enough memory to generate traffic log\n");

/***************************
* 2. Initializing PCI bus
@@ -3711,7 +3711,7 @@ static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *en
if (!err)
err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
if (err) {
- IL_WARN(il, "No suitable DMA available.\n");
+ IL_WARN("No suitable DMA available.\n");
goto out_pci_disable_device;
}

@@ -3757,7 +3757,7 @@ static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *en
/* Read the EEPROM */
err = il_eeprom_init(il);
if (err) {
- IL_ERR(il, "Unable to init EEPROM\n");
+ IL_ERR("Unable to init EEPROM\n");
goto out_iounmap;
}
/* MAC Address location in EEPROM same for 3945/4965 */
@@ -3770,7 +3770,7 @@ static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *en
* ********************/
/* Device-specific setup */
if (il3945_hw_set_hw_params(il)) {
- IL_ERR(il, "failed to set hw settings\n");
+ IL_ERR("failed to set hw settings\n");
goto out_eeprom_free;
}

@@ -3780,11 +3780,11 @@ static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *en

err = il3945_init_drv(il);
if (err) {
- IL_ERR(il, "initializing driver failed\n");
+ IL_ERR("initializing driver failed\n");
goto out_unset_hw_params;
}

- IL_INFO(il, "Detected Intel Wireless WiFi Link %s\n",
+ IL_INFO("Detected Intel Wireless WiFi Link %s\n",
il->cfg->name);

/***********************
@@ -3800,13 +3800,13 @@ static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *en
err = request_irq(il->pci_dev->irq, il_isr,
IRQF_SHARED, DRV_NAME, il);
if (err) {
- IL_ERR(il, "Error allocating IRQ %d\n", il->pci_dev->irq);
+ IL_ERR("Error allocating IRQ %d\n", il->pci_dev->irq);
goto out_disable_msi;
}

err = sysfs_create_group(&pdev->dev.kobj, &il3945_attribute_group);
if (err) {
- IL_ERR(il, "failed to create sysfs device attributes\n");
+ IL_ERR("failed to create sysfs device attributes\n");
goto out_release_irq;
}

@@ -3829,7 +3829,7 @@ static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *en

err = il_dbgfs_register(il, DRV_NAME);
if (err)
- IL_ERR(il, "failed to create debugfs files. Ignoring error: %d\n", err);
+ IL_ERR("failed to create debugfs files. Ignoring error: %d\n", err);

/* Start monitoring the killswitch */
queue_delayed_work(il->workqueue, &il->_3945.rfkill_poll,
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
index 88dc8db..df7e0a4 100644
--- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
@@ -115,7 +115,7 @@ static void il4965_clear_free_frames(struct il_priv *il)
}

if (il->frames_count) {
- IL_WARN(il, "%d frames still in use. Did we lose one?\n",
+ IL_WARN("%d frames still in use. Did we lose one?\n",
il->frames_count);
il->frames_count = 0;
}
@@ -128,7 +128,7 @@ static struct il_frame *il4965_get_free_frame(struct il_priv *il)
if (list_empty(&il->free_frames)) {
frame = kzalloc(sizeof(*frame), GFP_KERNEL);
if (!frame) {
- IL_ERR(il, "Could not allocate frame!\n");
+ IL_ERR("Could not allocate frame!\n");
return NULL;
}

@@ -188,7 +188,7 @@ static void il4965_set_beacon_tim(struct il_priv *il,
tx_beacon_cmd->tim_idx = cpu_to_le16(tim_idx);
tx_beacon_cmd->tim_size = beacon[tim_idx+1];
} else
- IL_WARN(il, "Unable to find TIM Element in beacon\n");
+ IL_WARN("Unable to find TIM Element in beacon\n");
}

static unsigned int il4965_hw_get_beacon_cmd(struct il_priv *il,
@@ -206,7 +206,7 @@ static unsigned int il4965_hw_get_beacon_cmd(struct il_priv *il,
lockdep_assert_held(&il->mutex);

if (!il->beacon_ctx) {
- IL_ERR(il, "trying to build beacon w/o beacon context!\n");
+ IL_ERR("trying to build beacon w/o beacon context!\n");
return 0;
}

@@ -254,14 +254,14 @@ int il4965_send_beacon_cmd(struct il_priv *il)

frame = il4965_get_free_frame(il);
if (!frame) {
- IL_ERR(il, "Could not obtain free frame buffer for beacon "
+ IL_ERR("Could not obtain free frame buffer for beacon "
"command.\n");
return -ENOMEM;
}

frame_size = il4965_hw_get_beacon_cmd(il, frame);
if (!frame_size) {
- IL_ERR(il, "Error configuring the beacon command\n");
+ IL_ERR("Error configuring the beacon command\n");
il4965_free_frame(il, frame);
return -EINVAL;
}
@@ -336,7 +336,7 @@ void il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq)
num_tbs = il4965_tfd_get_num_tbs(tfd);

if (num_tbs >= IL_NUM_OF_TBS) {
- IL_ERR(il, "Too many chunks: %i\n", num_tbs);
+ IL_ERR("Too many chunks: %i\n", num_tbs);
/* @todo issue fatal error, it is quite serious situation */
return;
}
@@ -388,14 +388,14 @@ int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *il,

/* Each TFD can point to a maximum 20 Tx buffers */
if (num_tbs >= IL_NUM_OF_TBS) {
- IL_ERR(il, "Error can not send more than %d chunks\n",
+ IL_ERR("Error can not send more than %d chunks\n",
IL_NUM_OF_TBS);
return -EINVAL;
}

BUG_ON(addr & ~DMA_BIT_MASK(36));
if (unlikely(addr & ~IL_TX_DMA_MASK))
- IL_ERR(il, "Unaligned address = %llx\n",
+ IL_ERR("Unaligned address = %llx\n",
(unsigned long long)addr);

il4965_tfd_set_tb(tfd, num_tbs, addr, len);
@@ -460,7 +460,7 @@ static void il4965_rx_reply_alive(struct il_priv *il,
queue_delayed_work(il->workqueue, pwork,
msecs_to_jiffies(5));
else
- IL_WARN(il, "uCode did not respond OK.\n");
+ IL_WARN("uCode did not respond OK.\n");
}

/**
@@ -725,7 +725,7 @@ void il4965_rx_handle(struct il_priv *il)
if (rxb->page)
il_tx_cmd_complete(il, rxb);
else
- IL_WARN(il, "Claim null rxb?\n");
+ IL_WARN("Claim null rxb?\n");
}

/* Reuse the page if possible. For notification packets and
@@ -818,7 +818,7 @@ static void il4965_irq_tasklet(struct il_priv *il)

/* Now service all interrupt bits discovered above. */
if (inta & CSR_INT_BIT_HW_ERR) {
- IL_ERR(il, "Hardware error detected. Restarting.\n");
+ IL_ERR("Hardware error detected. Restarting.\n");

/* Tell the device to stop sending interrupts */
il_disable_interrupts(il);
@@ -857,7 +857,7 @@ static void il4965_irq_tasklet(struct il_priv *il)
CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW))
hw_rf_kill = 1;

- IL_WARN(il, "RF_KILL bit toggled to %s.\n",
+ IL_WARN("RF_KILL bit toggled to %s.\n",
hw_rf_kill ? "disable radio" : "enable radio");

il->isr_stats.rfkill++;
@@ -880,14 +880,14 @@ static void il4965_irq_tasklet(struct il_priv *il)

/* Chip got too hot and stopped itself */
if (inta & CSR_INT_BIT_CT_KILL) {
- IL_ERR(il, "Microcode CT kill error detected.\n");
+ IL_ERR("Microcode CT kill error detected.\n");
il->isr_stats.ctkill++;
handled |= CSR_INT_BIT_CT_KILL;
}

/* Error detected by uCode */
if (inta & CSR_INT_BIT_SW_ERR) {
- IL_ERR(il, "Microcode SW error detected. "
+ IL_ERR("Microcode SW error detected. "
" Restarting 0x%X.\n", inta);
il->isr_stats.sw++;
il_irq_handle_error(il);
@@ -928,14 +928,14 @@ static void il4965_irq_tasklet(struct il_priv *il)
}

if (inta & ~handled) {
- IL_ERR(il, "Unhandled INTA bits 0x%08x\n", inta & ~handled);
+ IL_ERR("Unhandled INTA bits 0x%08x\n", inta & ~handled);
il->isr_stats.unhandled++;
}

if (inta & ~(il->inta_mask)) {
- IL_WARN(il, "Disabled INTA bits 0x%08x were pending\n",
+ IL_WARN("Disabled INTA bits 0x%08x were pending\n",
inta & ~il->inta_mask);
- IL_WARN(il, " with FH_INT = 0x%08x\n", inta_fh);
+ IL_WARN(" with FH_INT = 0x%08x\n", inta_fh);
}

/* Re-enable all interrupts */
@@ -993,11 +993,11 @@ static ssize_t il4965_store_debug_level(struct device *d,

ret = strict_strtoul(buf, 0, &val);
if (ret)
- IL_ERR(il, "%s is not in hex or decimal form.\n", buf);
+ IL_ERR("%s is not in hex or decimal form.\n", buf);
else {
il->debug_level = val;
if (il_alloc_traffic_mem(il))
- IL_ERR(il,
+ IL_ERR(
"Not enough memory to generate traffic log\n");
}
return strnlen(buf, count);
@@ -1044,11 +1044,11 @@ static ssize_t il4965_store_tx_power(struct device *d,

ret = strict_strtoul(buf, 10, &val);
if (ret)
- IL_INFO(il, "%s is not in decimal form.\n", buf);
+ IL_INFO("%s is not in decimal form.\n", buf);
else {
ret = il_set_tx_power(il, val, false);
if (ret)
- IL_ERR(il, "failed setting tx power (0x%d).\n",
+ IL_ERR("failed setting tx power (0x%d).\n",
ret);
else
ret = count;
@@ -1114,7 +1114,7 @@ static int __must_check il4965_request_firmware(struct il_priv *il, bool first)
}

if (il->fw_index < il->cfg->ucode_api_min) {
- IL_ERR(il, "no suitable firmware found!\n");
+ IL_ERR("no suitable firmware found!\n");
return -ENOENT;
}

@@ -1151,7 +1151,7 @@ static int il4965_load_firmware(struct il_priv *il,
case 2:
hdr_size = 24;
if (ucode_raw->size < hdr_size) {
- IL_ERR(il, "File size too small!\n");
+ IL_ERR("File size too small!\n");
return -EINVAL;
}
pieces->inst_size = le32_to_cpu(ucode->v1.inst_size);
@@ -1169,7 +1169,7 @@ static int il4965_load_firmware(struct il_priv *il,
pieces->data_size + pieces->init_size +
pieces->init_data_size + pieces->boot_size) {

- IL_ERR(il,
+ IL_ERR(
"uCode file size %d does not match expected size\n",
(int)ucode_raw->size);
return -EINVAL;
@@ -1214,7 +1214,7 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context)

if (!ucode_raw) {
if (il->fw_index <= il->cfg->ucode_api_max)
- IL_ERR(il,
+ IL_ERR(
"request for firmware file '%s' failed.\n",
il->firmware_name);
goto try_again;
@@ -1225,7 +1225,7 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context)

/* Make sure that we got at least the API version number */
if (ucode_raw->size < 4) {
- IL_ERR(il, "File size way too small!\n");
+ IL_ERR("File size way too small!\n");
goto try_again;
}

@@ -1245,7 +1245,7 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context)
* on the API version read from firmware header from here on forward
*/
if (api_ver < api_min || api_ver > api_max) {
- IL_ERR(il,
+ IL_ERR(
"Driver unable to support your firmware API. "
"Driver supports v%u, firmware is v%u.\n",
api_max, api_ver);
@@ -1253,13 +1253,13 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context)
}

if (api_ver != api_max)
- IL_ERR(il,
+ IL_ERR(
"Firmware has old API version. Expected v%u, "
"got v%u. New firmware can be obtained "
"from http://www.intellinuxwireless.org.\n",
api_max, api_ver);

- IL_INFO(il, "loaded firmware version %u.%u.%u.%u\n",
+ IL_INFO("loaded firmware version %u.%u.%u.%u\n",
IL_UCODE_MAJOR(il->ucode_ver),
IL_UCODE_MINOR(il->ucode_ver),
IL_UCODE_API(il->ucode_ver),
@@ -1294,31 +1294,31 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context)

/* Verify that uCode images will fit in card's SRAM */
if (pieces.inst_size > il->hw_params.max_inst_size) {
- IL_ERR(il, "uCode instr len %Zd too large to fit in\n",
+ IL_ERR("uCode instr len %Zd too large to fit in\n",
pieces.inst_size);
goto try_again;
}

if (pieces.data_size > il->hw_params.max_data_size) {
- IL_ERR(il, "uCode data len %Zd too large to fit in\n",
+ IL_ERR("uCode data len %Zd too large to fit in\n",
pieces.data_size);
goto try_again;
}

if (pieces.init_size > il->hw_params.max_inst_size) {
- IL_ERR(il, "uCode init instr len %Zd too large to fit in\n",
+ IL_ERR("uCode init instr len %Zd too large to fit in\n",
pieces.init_size);
goto try_again;
}

if (pieces.init_data_size > il->hw_params.max_data_size) {
- IL_ERR(il, "uCode init data len %Zd too large to fit in\n",
+ IL_ERR("uCode init data len %Zd too large to fit in\n",
pieces.init_data_size);
goto try_again;
}

if (pieces.boot_size > il->hw_params.max_bsm_size) {
- IL_ERR(il, "uCode boot instr len %Zd too large to fit in\n",
+ IL_ERR("uCode boot instr len %Zd too large to fit in\n",
pieces.boot_size);
goto try_again;
}
@@ -1427,13 +1427,13 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context)

err = il_dbgfs_register(il, DRV_NAME);
if (err)
- IL_ERR(il,
+ IL_ERR(
"failed to create debugfs files. Ignoring error: %d\n", err);

err = sysfs_create_group(&il->pci_dev->dev.kobj,
&il_attribute_group);
if (err) {
- IL_ERR(il, "failed to create sysfs device attributes\n");
+ IL_ERR("failed to create sysfs device attributes\n");
goto out_unbind;
}

@@ -1450,7 +1450,7 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context)
return;

err_pci_alloc:
- IL_ERR(il, "failed to allocate pci memory\n");
+ IL_ERR("failed to allocate pci memory\n");
il4965_dealloc_ucode_pci(il);
out_unbind:
complete(&il->_4965.firmware_loading_complete);
@@ -1541,7 +1541,7 @@ void il4965_dump_nic_error_log(struct il_priv *il)
}

if (!il->cfg->ops->lib->is_valid_rtc_data_addr(base)) {
- IL_ERR(il,
+ IL_ERR(
"Not valid error log pointer 0x%08X for %s uCode\n",
base, (il->ucode_type == UCODE_INIT) ? "Init" : "RT");
return;
@@ -1550,8 +1550,8 @@ void il4965_dump_nic_error_log(struct il_priv *il)
count = il_read_targ_mem(il, base);

if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) {
- IL_ERR(il, "Start IWL Error Log Dump:\n");
- IL_ERR(il, "Status: 0x%08lX, count: %d\n",
+ IL_ERR("Start IWL Error Log Dump:\n");
+ IL_ERR("Status: 0x%08lX, count: %d\n",
il->status, count);
}

@@ -1568,12 +1568,12 @@ void il4965_dump_nic_error_log(struct il_priv *il)
time = il_read_targ_mem(il, base + 11 * sizeof(u32));
hcmd = il_read_targ_mem(il, base + 22 * sizeof(u32));

- IL_ERR(il, "Desc Time "
+ IL_ERR("Desc Time "
"data1 data2 line\n");
- IL_ERR(il, "%-28s (0x%04X) %010u 0x%08X 0x%08X %u\n",
+ IL_ERR("%-28s (0x%04X) %010u 0x%08X 0x%08X %u\n",
il4965_desc_lookup(desc), desc, time, data1, data2, line);
- IL_ERR(il, "pc blink1 blink2 ilink1 ilink2 hcmd\n");
- IL_ERR(il, "0x%05X 0x%05X 0x%05X 0x%05X 0x%05X 0x%05X\n",
+ IL_ERR("pc blink1 blink2 ilink1 ilink2 hcmd\n");
+ IL_ERR("0x%05X 0x%05X 0x%05X 0x%05X 0x%05X 0x%05X\n",
pc, blink1, blink2, ilink1, ilink2, hcmd);
}

@@ -1594,7 +1594,7 @@ static void il4965_rf_kill_ct_config(struct il_priv *il)
ret = il_send_cmd_pdu(il, REPLY_CT_KILL_CONFIG_CMD,
sizeof(cmd), &cmd);
if (ret)
- IL_ERR(il, "REPLY_CT_KILL_CONFIG_CMD failed\n");
+ IL_ERR("REPLY_CT_KILL_CONFIG_CMD failed\n");
else
D_INFO("REPLY_CT_KILL_CONFIG_CMD "
"succeeded, "
@@ -1740,7 +1740,7 @@ static void il4965_alive_start(struct il_priv *il)

ret = il4965_alive_notify(il);
if (ret) {
- IL_WARN(il,
+ IL_WARN(
"Could not complete ALIVE transition [ntf]: %d\n", ret);
goto restart;
}
@@ -1955,12 +1955,12 @@ static int __il4965_up(struct il_priv *il)
int ret;

if (test_bit(STATUS_EXIT_PENDING, &il->status)) {
- IL_WARN(il, "Exit pending; will not bring the NIC up\n");
+ IL_WARN("Exit pending; will not bring the NIC up\n");
return -EIO;
}

if (!il->ucode_data_backup.v_addr || !il->ucode_data.v_addr) {
- IL_ERR(il, "ucode not available for device bringup\n");
+ IL_ERR("ucode not available for device bringup\n");
return -EIO;
}

@@ -1975,7 +1975,7 @@ static int __il4965_up(struct il_priv *il)
il4965_prepare_card_hw(il);

if (!il->hw_ready) {
- IL_WARN(il, "Exit HW not ready\n");
+ IL_WARN("Exit HW not ready\n");
return -EIO;
}

@@ -1990,7 +1990,7 @@ static int __il4965_up(struct il_priv *il)
wiphy_rfkill_set_hw_state(il->hw->wiphy, true);

il_enable_interrupts(il);
- IL_WARN(il, "Radio disabled by HW RF Kill switch\n");
+ IL_WARN("Radio disabled by HW RF Kill switch\n");
return 0;
}

@@ -2001,7 +2001,7 @@ static int __il4965_up(struct il_priv *il)

ret = il4965_hw_nic_init(il);
if (ret) {
- IL_ERR(il, "Unable to init nic\n");
+ IL_ERR("Unable to init nic\n");
return ret;
}

@@ -2032,7 +2032,7 @@ static int __il4965_up(struct il_priv *il)
ret = il->cfg->ops->lib->load_ucode(il);

if (ret) {
- IL_ERR(il, "Unable to set up bootstrap uCode: %d\n",
+ IL_ERR("Unable to set up bootstrap uCode: %d\n",
ret);
continue;
}
@@ -2051,7 +2051,7 @@ static int __il4965_up(struct il_priv *il)

/* tried to restart and config the device for as long as our
* patience could withstand */
- IL_ERR(il, "Unable to initialize device after %d attempts.\n", i);
+ IL_ERR("Unable to initialize device after %d attempts.\n", i);
return -EIO;
}

@@ -2229,7 +2229,7 @@ static int il4965_mac_setup_register(struct il_priv *il,

ret = ieee80211_register_hw(il->hw);
if (ret) {
- IL_ERR(il, "Failed to register hw (error %d)\n", ret);
+ IL_ERR("Failed to register hw (error %d)\n", ret);
return ret;
}
il->mac80211_registered = 1;
@@ -2265,7 +2265,7 @@ int il4965_mac_start(struct ieee80211_hw *hw)
UCODE_READY_TIMEOUT);
if (!ret) {
if (!test_bit(STATUS_READY, &il->status)) {
- IL_ERR(il, "START_ALIVE timeout after %dms.\n",
+ IL_ERR("START_ALIVE timeout after %dms.\n",
jiffies_to_msecs(UCODE_READY_TIMEOUT));
return -ETIMEDOUT;
}
@@ -2475,7 +2475,7 @@ int il4965_mac_sta_add(struct ieee80211_hw *hw,
ret = il_add_station_common(il, vif_priv->ctx, sta->addr,
is_ap, sta, &sta_id);
if (ret) {
- IL_ERR(il, "Unable to add station %pM (%d)\n",
+ IL_ERR("Unable to add station %pM (%d)\n",
sta->addr, ret);
/* Should we return success if return code is EEXIST ? */
mutex_unlock(&il->mutex);
@@ -2792,13 +2792,13 @@ static int il4965_init_drv(struct il_priv *il)

ret = il_init_channel_map(il);
if (ret) {
- IL_ERR(il, "initializing regulatory failed: %d\n", ret);
+ IL_ERR("initializing regulatory failed: %d\n", ret);
goto err;
}

ret = il_init_geos(il);
if (ret) {
- IL_ERR(il, "initializing geos failed: %d\n", ret);
+ IL_ERR("initializing geos failed: %d\n", ret);
goto err_free_channel_map;
}
il4965_init_hw_rates(il, il->ieee_rates);
@@ -2917,7 +2917,7 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
il->inta_mask = CSR_INI_SET_MASK;

if (il_alloc_traffic_mem(il))
- IL_ERR(il, "Not enough memory to generate traffic log\n");
+ IL_ERR("Not enough memory to generate traffic log\n");

/**************************
* 2. Initializing PCI bus
@@ -2942,7 +2942,7 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
DMA_BIT_MASK(32));
/* both attempts failed: */
if (err) {
- IL_WARN(il, "No suitable DMA available.\n");
+ IL_WARN("No suitable DMA available.\n");
goto out_pci_disable_device;
}
}
@@ -2981,7 +2981,7 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
il_write32(il, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);

il4965_hw_detect(il);
- IL_INFO(il, "Detected %s, REV=0x%X\n",
+ IL_INFO("Detected %s, REV=0x%X\n",
il->cfg->name, il->hw_rev);

/* We disable the RETRY_TIMEOUT register (0x41) to keep
@@ -2990,7 +2990,7 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)

il4965_prepare_card_hw(il);
if (!il->hw_ready) {
- IL_WARN(il, "Failed, HW not ready\n");
+ IL_WARN("Failed, HW not ready\n");
goto out_iounmap;
}

@@ -3000,7 +3000,7 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* Read the EEPROM */
err = il_eeprom_init(il);
if (err) {
- IL_ERR(il, "Unable to init EEPROM\n");
+ IL_ERR("Unable to init EEPROM\n");
goto out_iounmap;
}
err = il4965_eeprom_check_version(il);
@@ -3020,7 +3020,7 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
* 5. Setup HW constants
************************/
if (il4965_set_hw_params(il)) {
- IL_ERR(il, "failed to set hw parameters\n");
+ IL_ERR("failed to set hw parameters\n");
goto out_free_eeprom;
}

@@ -3045,7 +3045,7 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
err = request_irq(il->pci_dev->irq, il_isr,
IRQF_SHARED, DRV_NAME, il);
if (err) {
- IL_ERR(il, "Error allocating IRQ %d\n", il->pci_dev->irq);
+ IL_ERR("Error allocating IRQ %d\n", il->pci_dev->irq);
goto out_disable_msi;
}

--
1.7.1


2011-11-18 08:22:03

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 33/77] iwlegacy: merge iwl-4965-sta.c into 4965-mac.c

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/4965-mac.c | 677 ++++++++++++++++++++++++
drivers/net/wireless/iwlegacy/Makefile | 1 -
drivers/net/wireless/iwlegacy/iwl-4965-sta.c | 712 --------------------------
3 files changed, 677 insertions(+), 713 deletions(-)
delete mode 100644 drivers/net/wireless/iwlegacy/iwl-4965-sta.c

diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index 4a8ad8d..142d39f 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -86,6 +86,683 @@ MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
MODULE_LICENSE("GPL");
MODULE_ALIAS("iwl4965");

+static struct il_link_quality_cmd *
+il4965_sta_alloc_lq(struct il_priv *il, u8 sta_id)
+{
+ int i, r;
+ struct il_link_quality_cmd *link_cmd;
+ u32 rate_flags = 0;
+ __le32 rate_n_flags;
+
+ link_cmd = kzalloc(sizeof(struct il_link_quality_cmd), GFP_KERNEL);
+ if (!link_cmd) {
+ IL_ERR("Unable to allocate memory for LQ cmd.\n");
+ return NULL;
+ }
+ /* Set up the rate scaling to start at selected rate, fall back
+ * all the way down to 1M in IEEE order, and then spin on 1M */
+ if (il->band == IEEE80211_BAND_5GHZ)
+ r = RATE_6M_IDX;
+ else
+ r = RATE_1M_IDX;
+
+ if (r >= IL_FIRST_CCK_RATE && r <= IL_LAST_CCK_RATE)
+ rate_flags |= RATE_MCS_CCK_MSK;
+
+ rate_flags |= il4965_first_antenna(il->hw_params.valid_tx_ant) <<
+ RATE_MCS_ANT_POS;
+ rate_n_flags = il4965_hw_set_rate_n_flags(il_rates[r].plcp,
+ rate_flags);
+ for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++)
+ link_cmd->rs_table[i].rate_n_flags = rate_n_flags;
+
+ link_cmd->general_params.single_stream_ant_msk =
+ il4965_first_antenna(il->hw_params.valid_tx_ant);
+
+ link_cmd->general_params.dual_stream_ant_msk =
+ il->hw_params.valid_tx_ant &
+ ~il4965_first_antenna(il->hw_params.valid_tx_ant);
+ if (!link_cmd->general_params.dual_stream_ant_msk) {
+ link_cmd->general_params.dual_stream_ant_msk = ANT_AB;
+ } else if (il4965_num_of_ant(il->hw_params.valid_tx_ant) == 2) {
+ link_cmd->general_params.dual_stream_ant_msk =
+ il->hw_params.valid_tx_ant;
+ }
+
+ link_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF;
+ link_cmd->agg_params.agg_time_limit =
+ cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF);
+
+ link_cmd->sta_id = sta_id;
+
+ return link_cmd;
+}
+
+/*
+ * il4965_add_bssid_station - Add the special IBSS BSSID station
+ *
+ * Function sleeps.
+ */
+int
+il4965_add_bssid_station(struct il_priv *il, struct il_rxon_context *ctx,
+ const u8 *addr, u8 *sta_id_r)
+{
+ int ret;
+ u8 sta_id;
+ struct il_link_quality_cmd *link_cmd;
+ unsigned long flags;
+
+ if (sta_id_r)
+ *sta_id_r = IL_INVALID_STATION;
+
+ ret = il_add_station_common(il, ctx, addr, 0, NULL, &sta_id);
+ if (ret) {
+ IL_ERR("Unable to add station %pM\n", addr);
+ return ret;
+ }
+
+ if (sta_id_r)
+ *sta_id_r = sta_id;
+
+ spin_lock_irqsave(&il->sta_lock, flags);
+ il->stations[sta_id].used |= IL_STA_LOCAL;
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+
+ /* Set up default rate scaling table in device's station table */
+ link_cmd = il4965_sta_alloc_lq(il, sta_id);
+ if (!link_cmd) {
+ IL_ERR(
+ "Unable to initialize rate scaling for station %pM.\n",
+ addr);
+ return -ENOMEM;
+ }
+
+ ret = il_send_lq_cmd(il, ctx, link_cmd, CMD_SYNC, true);
+ if (ret)
+ IL_ERR("Link quality command failed (%d)\n", ret);
+
+ spin_lock_irqsave(&il->sta_lock, flags);
+ il->stations[sta_id].lq = link_cmd;
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+
+ return 0;
+}
+
+static int il4965_static_wepkey_cmd(struct il_priv *il,
+ struct il_rxon_context *ctx,
+ bool send_if_empty)
+{
+ int i, not_empty = 0;
+ u8 buff[sizeof(struct il_wep_cmd) +
+ sizeof(struct il_wep_key) * WEP_KEYS_MAX];
+ struct il_wep_cmd *wep_cmd = (struct il_wep_cmd *)buff;
+ size_t cmd_size = sizeof(struct il_wep_cmd);
+ struct il_host_cmd cmd = {
+ .id = ctx->wep_key_cmd,
+ .data = wep_cmd,
+ .flags = CMD_SYNC,
+ };
+
+ might_sleep();
+
+ memset(wep_cmd, 0, cmd_size +
+ (sizeof(struct il_wep_key) * WEP_KEYS_MAX));
+
+ for (i = 0; i < WEP_KEYS_MAX ; i++) {
+ wep_cmd->key[i].key_idx = i;
+ if (ctx->wep_keys[i].key_size) {
+ wep_cmd->key[i].key_offset = i;
+ not_empty = 1;
+ } else {
+ wep_cmd->key[i].key_offset = WEP_INVALID_OFFSET;
+ }
+
+ wep_cmd->key[i].key_size = ctx->wep_keys[i].key_size;
+ memcpy(&wep_cmd->key[i].key[3], ctx->wep_keys[i].key,
+ ctx->wep_keys[i].key_size);
+ }
+
+ wep_cmd->global_key_type = WEP_KEY_WEP_TYPE;
+ wep_cmd->num_keys = WEP_KEYS_MAX;
+
+ cmd_size += sizeof(struct il_wep_key) * WEP_KEYS_MAX;
+
+ cmd.len = cmd_size;
+
+ if (not_empty || send_if_empty)
+ return il_send_cmd(il, &cmd);
+ else
+ return 0;
+}
+
+int il4965_restore_default_wep_keys(struct il_priv *il,
+ struct il_rxon_context *ctx)
+{
+ lockdep_assert_held(&il->mutex);
+
+ return il4965_static_wepkey_cmd(il, ctx, false);
+}
+
+int il4965_remove_default_wep_key(struct il_priv *il,
+ struct il_rxon_context *ctx,
+ struct ieee80211_key_conf *keyconf)
+{
+ int ret;
+
+ lockdep_assert_held(&il->mutex);
+
+ D_WEP("Removing default WEP key: idx=%d\n",
+ keyconf->keyidx);
+
+ memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0]));
+ if (il_is_rfkill(il)) {
+ D_WEP(
+ "Not sending REPLY_WEPKEY command due to RFKILL.\n");
+ /* but keys in device are clear anyway so return success */
+ return 0;
+ }
+ ret = il4965_static_wepkey_cmd(il, ctx, 1);
+ D_WEP("Remove default WEP key: idx=%d ret=%d\n",
+ keyconf->keyidx, ret);
+
+ return ret;
+}
+
+int il4965_set_default_wep_key(struct il_priv *il,
+ struct il_rxon_context *ctx,
+ struct ieee80211_key_conf *keyconf)
+{
+ int ret;
+
+ lockdep_assert_held(&il->mutex);
+
+ if (keyconf->keylen != WEP_KEY_LEN_128 &&
+ keyconf->keylen != WEP_KEY_LEN_64) {
+ D_WEP("Bad WEP key length %d\n", keyconf->keylen);
+ return -EINVAL;
+ }
+
+ keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV;
+ keyconf->hw_key_idx = HW_KEY_DEFAULT;
+ il->stations[ctx->ap_sta_id].keyinfo.cipher = keyconf->cipher;
+
+ ctx->wep_keys[keyconf->keyidx].key_size = keyconf->keylen;
+ memcpy(&ctx->wep_keys[keyconf->keyidx].key, &keyconf->key,
+ keyconf->keylen);
+
+ ret = il4965_static_wepkey_cmd(il, ctx, false);
+ D_WEP("Set default WEP key: len=%d idx=%d ret=%d\n",
+ keyconf->keylen, keyconf->keyidx, ret);
+
+ return ret;
+}
+
+static int il4965_set_wep_dynamic_key_info(struct il_priv *il,
+ struct il_rxon_context *ctx,
+ struct ieee80211_key_conf *keyconf,
+ u8 sta_id)
+{
+ unsigned long flags;
+ __le16 key_flags = 0;
+ struct il_addsta_cmd sta_cmd;
+
+ lockdep_assert_held(&il->mutex);
+
+ keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV;
+
+ key_flags |= (STA_KEY_FLG_WEP | STA_KEY_FLG_MAP_KEY_MSK);
+ key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
+ key_flags &= ~STA_KEY_FLG_INVALID;
+
+ if (keyconf->keylen == WEP_KEY_LEN_128)
+ key_flags |= STA_KEY_FLG_KEY_SIZE_MSK;
+
+ if (sta_id == ctx->bcast_sta_id)
+ key_flags |= STA_KEY_MULTICAST_MSK;
+
+ spin_lock_irqsave(&il->sta_lock, flags);
+
+ il->stations[sta_id].keyinfo.cipher = keyconf->cipher;
+ il->stations[sta_id].keyinfo.keylen = keyconf->keylen;
+ il->stations[sta_id].keyinfo.keyidx = keyconf->keyidx;
+
+ memcpy(il->stations[sta_id].keyinfo.key,
+ keyconf->key, keyconf->keylen);
+
+ memcpy(&il->stations[sta_id].sta.key.key[3],
+ keyconf->key, keyconf->keylen);
+
+ if ((il->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
+ == STA_KEY_FLG_NO_ENC)
+ il->stations[sta_id].sta.key.key_offset =
+ il_get_free_ucode_key_idx(il);
+ /* else, we are overriding an existing key => no need to allocated room
+ * in uCode. */
+
+ WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
+ "no space for a new key");
+
+ il->stations[sta_id].sta.key.key_flags = key_flags;
+ il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
+ il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
+
+ memcpy(&sta_cmd, &il->stations[sta_id].sta,
+ sizeof(struct il_addsta_cmd));
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+
+ return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
+}
+
+static int il4965_set_ccmp_dynamic_key_info(struct il_priv *il,
+ struct il_rxon_context *ctx,
+ struct ieee80211_key_conf *keyconf,
+ u8 sta_id)
+{
+ unsigned long flags;
+ __le16 key_flags = 0;
+ struct il_addsta_cmd sta_cmd;
+
+ lockdep_assert_held(&il->mutex);
+
+ key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK);
+ key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
+ key_flags &= ~STA_KEY_FLG_INVALID;
+
+ if (sta_id == ctx->bcast_sta_id)
+ key_flags |= STA_KEY_MULTICAST_MSK;
+
+ keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
+
+ spin_lock_irqsave(&il->sta_lock, flags);
+ il->stations[sta_id].keyinfo.cipher = keyconf->cipher;
+ il->stations[sta_id].keyinfo.keylen = keyconf->keylen;
+
+ memcpy(il->stations[sta_id].keyinfo.key, keyconf->key,
+ keyconf->keylen);
+
+ memcpy(il->stations[sta_id].sta.key.key, keyconf->key,
+ keyconf->keylen);
+
+ if ((il->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
+ == STA_KEY_FLG_NO_ENC)
+ il->stations[sta_id].sta.key.key_offset =
+ il_get_free_ucode_key_idx(il);
+ /* else, we are overriding an existing key => no need to allocated room
+ * in uCode. */
+
+ WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
+ "no space for a new key");
+
+ il->stations[sta_id].sta.key.key_flags = key_flags;
+ il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
+ il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
+
+ memcpy(&sta_cmd, &il->stations[sta_id].sta,
+ sizeof(struct il_addsta_cmd));
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+
+ return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
+}
+
+static int il4965_set_tkip_dynamic_key_info(struct il_priv *il,
+ struct il_rxon_context *ctx,
+ struct ieee80211_key_conf *keyconf,
+ u8 sta_id)
+{
+ unsigned long flags;
+ int ret = 0;
+ __le16 key_flags = 0;
+
+ key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
+ key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
+ key_flags &= ~STA_KEY_FLG_INVALID;
+
+ if (sta_id == ctx->bcast_sta_id)
+ key_flags |= STA_KEY_MULTICAST_MSK;
+
+ keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
+ keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
+
+ spin_lock_irqsave(&il->sta_lock, flags);
+
+ il->stations[sta_id].keyinfo.cipher = keyconf->cipher;
+ il->stations[sta_id].keyinfo.keylen = 16;
+
+ if ((il->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
+ == STA_KEY_FLG_NO_ENC)
+ il->stations[sta_id].sta.key.key_offset =
+ il_get_free_ucode_key_idx(il);
+ /* else, we are overriding an existing key => no need to allocated room
+ * in uCode. */
+
+ WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
+ "no space for a new key");
+
+ il->stations[sta_id].sta.key.key_flags = key_flags;
+
+
+ /* This copy is acutally not needed: we get the key with each TX */
+ memcpy(il->stations[sta_id].keyinfo.key, keyconf->key, 16);
+
+ memcpy(il->stations[sta_id].sta.key.key, keyconf->key, 16);
+
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+
+ return ret;
+}
+
+void il4965_update_tkip_key(struct il_priv *il,
+ struct il_rxon_context *ctx,
+ struct ieee80211_key_conf *keyconf,
+ struct ieee80211_sta *sta, u32 iv32, u16 *phase1key)
+{
+ u8 sta_id;
+ unsigned long flags;
+ int i;
+
+ if (il_scan_cancel(il)) {
+ /* cancel scan failed, just live w/ bad key and rely
+ briefly on SW decryption */
+ return;
+ }
+
+ sta_id = il_sta_id_or_broadcast(il, ctx, sta);
+ if (sta_id == IL_INVALID_STATION)
+ return;
+
+ spin_lock_irqsave(&il->sta_lock, flags);
+
+ il->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32;
+
+ for (i = 0; i < 5; i++)
+ il->stations[sta_id].sta.key.tkip_rx_ttak[i] =
+ cpu_to_le16(phase1key[i]);
+
+ il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
+ il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
+
+ il_send_add_sta(il, &il->stations[sta_id].sta, CMD_ASYNC);
+
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+
+}
+
+int il4965_remove_dynamic_key(struct il_priv *il,
+ struct il_rxon_context *ctx,
+ struct ieee80211_key_conf *keyconf,
+ u8 sta_id)
+{
+ unsigned long flags;
+ u16 key_flags;
+ u8 keyidx;
+ struct il_addsta_cmd sta_cmd;
+
+ lockdep_assert_held(&il->mutex);
+
+ ctx->key_mapping_keys--;
+
+ spin_lock_irqsave(&il->sta_lock, flags);
+ key_flags = le16_to_cpu(il->stations[sta_id].sta.key.key_flags);
+ keyidx = (key_flags >> STA_KEY_FLG_KEYID_POS) & 0x3;
+
+ D_WEP("Remove dynamic key: idx=%d sta=%d\n",
+ keyconf->keyidx, sta_id);
+
+ if (keyconf->keyidx != keyidx) {
+ /* We need to remove a key with idx different that the one
+ * in the uCode. This means that the key we need to remove has
+ * been replaced by another one with different idx.
+ * Don't do anything and return ok
+ */
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+ return 0;
+ }
+
+ if (il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET) {
+ IL_WARN("Removing wrong key %d 0x%x\n",
+ keyconf->keyidx, key_flags);
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+ return 0;
+ }
+
+ if (!test_and_clear_bit(il->stations[sta_id].sta.key.key_offset,
+ &il->ucode_key_table))
+ IL_ERR("idx %d not used in uCode key table.\n",
+ il->stations[sta_id].sta.key.key_offset);
+ memset(&il->stations[sta_id].keyinfo, 0,
+ sizeof(struct il_hw_key));
+ memset(&il->stations[sta_id].sta.key, 0,
+ sizeof(struct il4965_keyinfo));
+ il->stations[sta_id].sta.key.key_flags =
+ STA_KEY_FLG_NO_ENC | STA_KEY_FLG_INVALID;
+ il->stations[sta_id].sta.key.key_offset = WEP_INVALID_OFFSET;
+ il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
+ il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
+
+ if (il_is_rfkill(il)) {
+ D_WEP(
+ "Not sending REPLY_ADD_STA command because RFKILL enabled.\n");
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+ return 0;
+ }
+ memcpy(&sta_cmd, &il->stations[sta_id].sta,
+ sizeof(struct il_addsta_cmd));
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+
+ return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
+}
+
+int il4965_set_dynamic_key(struct il_priv *il, struct il_rxon_context *ctx,
+ struct ieee80211_key_conf *keyconf, u8 sta_id)
+{
+ int ret;
+
+ lockdep_assert_held(&il->mutex);
+
+ ctx->key_mapping_keys++;
+ keyconf->hw_key_idx = HW_KEY_DYNAMIC;
+
+ switch (keyconf->cipher) {
+ case WLAN_CIPHER_SUITE_CCMP:
+ ret = il4965_set_ccmp_dynamic_key_info(il, ctx,
+ keyconf, sta_id);
+ break;
+ case WLAN_CIPHER_SUITE_TKIP:
+ ret = il4965_set_tkip_dynamic_key_info(il, ctx,
+ keyconf, sta_id);
+ break;
+ case WLAN_CIPHER_SUITE_WEP40:
+ case WLAN_CIPHER_SUITE_WEP104:
+ ret = il4965_set_wep_dynamic_key_info(il, ctx,
+ keyconf, sta_id);
+ break;
+ default:
+ IL_ERR(
+ "Unknown alg: %s cipher = %x\n", __func__,
+ keyconf->cipher);
+ ret = -EINVAL;
+ }
+
+ D_WEP(
+ "Set dynamic key: cipher=%x len=%d idx=%d sta=%d ret=%d\n",
+ keyconf->cipher, keyconf->keylen, keyconf->keyidx,
+ sta_id, ret);
+
+ return ret;
+}
+
+/**
+ * il4965_alloc_bcast_station - add broadcast station into driver's station table.
+ *
+ * This adds the broadcast station into the driver's station table
+ * and marks it driver active, so that it will be restored to the
+ * device at the next best time.
+ */
+int il4965_alloc_bcast_station(struct il_priv *il,
+ struct il_rxon_context *ctx)
+{
+ struct il_link_quality_cmd *link_cmd;
+ unsigned long flags;
+ u8 sta_id;
+
+ spin_lock_irqsave(&il->sta_lock, flags);
+ sta_id = il_prep_station(il, ctx, il_bcast_addr,
+ false, NULL);
+ if (sta_id == IL_INVALID_STATION) {
+ IL_ERR("Unable to prepare broadcast station\n");
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+
+ return -EINVAL;
+ }
+
+ il->stations[sta_id].used |= IL_STA_DRIVER_ACTIVE;
+ il->stations[sta_id].used |= IL_STA_BCAST;
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+
+ link_cmd = il4965_sta_alloc_lq(il, sta_id);
+ if (!link_cmd) {
+ IL_ERR(
+ "Unable to initialize rate scaling for bcast station.\n");
+ return -ENOMEM;
+ }
+
+ spin_lock_irqsave(&il->sta_lock, flags);
+ il->stations[sta_id].lq = link_cmd;
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+
+ return 0;
+}
+
+/**
+ * il4965_update_bcast_station - update broadcast station's LQ command
+ *
+ * Only used by iwl4965. Placed here to have all bcast station management
+ * code together.
+ */
+static int il4965_update_bcast_station(struct il_priv *il,
+ struct il_rxon_context *ctx)
+{
+ unsigned long flags;
+ struct il_link_quality_cmd *link_cmd;
+ u8 sta_id = ctx->bcast_sta_id;
+
+ link_cmd = il4965_sta_alloc_lq(il, sta_id);
+ if (!link_cmd) {
+ IL_ERR(
+ "Unable to initialize rate scaling for bcast station.\n");
+ return -ENOMEM;
+ }
+
+ spin_lock_irqsave(&il->sta_lock, flags);
+ if (il->stations[sta_id].lq)
+ kfree(il->stations[sta_id].lq);
+ else
+ D_INFO(
+ "Bcast station rate scaling has not been initialized yet.\n");
+ il->stations[sta_id].lq = link_cmd;
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+
+ return 0;
+}
+
+int il4965_update_bcast_stations(struct il_priv *il)
+{
+ return il4965_update_bcast_station(il, &il->ctx);
+}
+
+/**
+ * il4965_sta_tx_modify_enable_tid - Enable Tx for this TID in station table
+ */
+int il4965_sta_tx_modify_enable_tid(struct il_priv *il, int sta_id, int tid)
+{
+ unsigned long flags;
+ struct il_addsta_cmd sta_cmd;
+
+ lockdep_assert_held(&il->mutex);
+
+ /* Remove "disable" flag, to enable Tx for this TID */
+ spin_lock_irqsave(&il->sta_lock, flags);
+ il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_TID_DISABLE_TX;
+ il->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid));
+ il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
+ memcpy(&sta_cmd, &il->stations[sta_id].sta,
+ sizeof(struct il_addsta_cmd));
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+
+ return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
+}
+
+int il4965_sta_rx_agg_start(struct il_priv *il, struct ieee80211_sta *sta,
+ int tid, u16 ssn)
+{
+ unsigned long flags;
+ int sta_id;
+ struct il_addsta_cmd sta_cmd;
+
+ lockdep_assert_held(&il->mutex);
+
+ sta_id = il_sta_id(sta);
+ if (sta_id == IL_INVALID_STATION)
+ return -ENXIO;
+
+ spin_lock_irqsave(&il->sta_lock, flags);
+ il->stations[sta_id].sta.station_flags_msk = 0;
+ il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK;
+ il->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid;
+ il->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn);
+ il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
+ memcpy(&sta_cmd, &il->stations[sta_id].sta,
+ sizeof(struct il_addsta_cmd));
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+
+ return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
+}
+
+int il4965_sta_rx_agg_stop(struct il_priv *il, struct ieee80211_sta *sta,
+ int tid)
+{
+ unsigned long flags;
+ int sta_id;
+ struct il_addsta_cmd sta_cmd;
+
+ lockdep_assert_held(&il->mutex);
+
+ sta_id = il_sta_id(sta);
+ if (sta_id == IL_INVALID_STATION) {
+ IL_ERR("Invalid station for AGG tid %d\n", tid);
+ return -ENXIO;
+ }
+
+ spin_lock_irqsave(&il->sta_lock, flags);
+ il->stations[sta_id].sta.station_flags_msk = 0;
+ il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK;
+ il->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid;
+ il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
+ memcpy(&sta_cmd, &il->stations[sta_id].sta,
+ sizeof(struct il_addsta_cmd));
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+
+ return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
+}
+
+void
+il4965_sta_modify_sleep_tx_count(struct il_priv *il, int sta_id, int cnt)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&il->sta_lock, flags);
+ il->stations[sta_id].sta.station_flags |= STA_FLG_PWR_SAVE_MSK;
+ il->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK;
+ il->stations[sta_id].sta.sta.modify_mask =
+ STA_MODIFY_SLEEP_TX_COUNT_MSK;
+ il->stations[sta_id].sta.sleep_tx_count = cpu_to_le16(cnt);
+ il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
+ il_send_add_sta(il,
+ &il->stations[sta_id].sta, CMD_ASYNC);
+ spin_unlock_irqrestore(&il->sta_lock, flags);
+
+}
+
void il4965_update_chain_flags(struct il_priv *il)
{
if (il->cfg->ops->hcmd->set_rxon_chain) {
diff --git a/drivers/net/wireless/iwlegacy/Makefile b/drivers/net/wireless/iwlegacy/Makefile
index 43daa07..0643fda 100644
--- a/drivers/net/wireless/iwlegacy/Makefile
+++ b/drivers/net/wireless/iwlegacy/Makefile
@@ -11,7 +11,6 @@ obj-$(CONFIG_IWL4965) += iwl4965.o
iwl4965-objs := 4965.o 4965-mac.o iwl-4965-rs.o
iwl4965-objs += iwl-4965-tx.o
iwl4965-objs += iwl-4965-lib.o iwl-4965-rx.o iwl-4965-calib.o
-iwl4965-objs += iwl-4965-sta.o
iwl4965-$(CONFIG_IWLEGACY_DEBUGFS) += iwl-4965-debugfs.o

# 3945
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
deleted file mode 100644
index 337bf0c..0000000
--- a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
+++ /dev/null
@@ -1,712 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved.
- *
- * Portions of this file are derived from the ipw3945 project, as well
- * as portions of the ieee80211 subsystem header files.
- *
- * 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 <net/mac80211.h>
-
-#include "iwl-dev.h"
-#include "iwl-core.h"
-#include "iwl-sta.h"
-#include "iwl-4965.h"
-
-static struct il_link_quality_cmd *
-il4965_sta_alloc_lq(struct il_priv *il, u8 sta_id)
-{
- int i, r;
- struct il_link_quality_cmd *link_cmd;
- u32 rate_flags = 0;
- __le32 rate_n_flags;
-
- link_cmd = kzalloc(sizeof(struct il_link_quality_cmd), GFP_KERNEL);
- if (!link_cmd) {
- IL_ERR("Unable to allocate memory for LQ cmd.\n");
- return NULL;
- }
- /* Set up the rate scaling to start at selected rate, fall back
- * all the way down to 1M in IEEE order, and then spin on 1M */
- if (il->band == IEEE80211_BAND_5GHZ)
- r = RATE_6M_IDX;
- else
- r = RATE_1M_IDX;
-
- if (r >= IL_FIRST_CCK_RATE && r <= IL_LAST_CCK_RATE)
- rate_flags |= RATE_MCS_CCK_MSK;
-
- rate_flags |= il4965_first_antenna(il->hw_params.valid_tx_ant) <<
- RATE_MCS_ANT_POS;
- rate_n_flags = il4965_hw_set_rate_n_flags(il_rates[r].plcp,
- rate_flags);
- for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++)
- link_cmd->rs_table[i].rate_n_flags = rate_n_flags;
-
- link_cmd->general_params.single_stream_ant_msk =
- il4965_first_antenna(il->hw_params.valid_tx_ant);
-
- link_cmd->general_params.dual_stream_ant_msk =
- il->hw_params.valid_tx_ant &
- ~il4965_first_antenna(il->hw_params.valid_tx_ant);
- if (!link_cmd->general_params.dual_stream_ant_msk) {
- link_cmd->general_params.dual_stream_ant_msk = ANT_AB;
- } else if (il4965_num_of_ant(il->hw_params.valid_tx_ant) == 2) {
- link_cmd->general_params.dual_stream_ant_msk =
- il->hw_params.valid_tx_ant;
- }
-
- link_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF;
- link_cmd->agg_params.agg_time_limit =
- cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF);
-
- link_cmd->sta_id = sta_id;
-
- return link_cmd;
-}
-
-/*
- * il4965_add_bssid_station - Add the special IBSS BSSID station
- *
- * Function sleeps.
- */
-int
-il4965_add_bssid_station(struct il_priv *il, struct il_rxon_context *ctx,
- const u8 *addr, u8 *sta_id_r)
-{
- int ret;
- u8 sta_id;
- struct il_link_quality_cmd *link_cmd;
- unsigned long flags;
-
- if (sta_id_r)
- *sta_id_r = IL_INVALID_STATION;
-
- ret = il_add_station_common(il, ctx, addr, 0, NULL, &sta_id);
- if (ret) {
- IL_ERR("Unable to add station %pM\n", addr);
- return ret;
- }
-
- if (sta_id_r)
- *sta_id_r = sta_id;
-
- spin_lock_irqsave(&il->sta_lock, flags);
- il->stations[sta_id].used |= IL_STA_LOCAL;
- spin_unlock_irqrestore(&il->sta_lock, flags);
-
- /* Set up default rate scaling table in device's station table */
- link_cmd = il4965_sta_alloc_lq(il, sta_id);
- if (!link_cmd) {
- IL_ERR(
- "Unable to initialize rate scaling for station %pM.\n",
- addr);
- return -ENOMEM;
- }
-
- ret = il_send_lq_cmd(il, ctx, link_cmd, CMD_SYNC, true);
- if (ret)
- IL_ERR("Link quality command failed (%d)\n", ret);
-
- spin_lock_irqsave(&il->sta_lock, flags);
- il->stations[sta_id].lq = link_cmd;
- spin_unlock_irqrestore(&il->sta_lock, flags);
-
- return 0;
-}
-
-static int il4965_static_wepkey_cmd(struct il_priv *il,
- struct il_rxon_context *ctx,
- bool send_if_empty)
-{
- int i, not_empty = 0;
- u8 buff[sizeof(struct il_wep_cmd) +
- sizeof(struct il_wep_key) * WEP_KEYS_MAX];
- struct il_wep_cmd *wep_cmd = (struct il_wep_cmd *)buff;
- size_t cmd_size = sizeof(struct il_wep_cmd);
- struct il_host_cmd cmd = {
- .id = ctx->wep_key_cmd,
- .data = wep_cmd,
- .flags = CMD_SYNC,
- };
-
- might_sleep();
-
- memset(wep_cmd, 0, cmd_size +
- (sizeof(struct il_wep_key) * WEP_KEYS_MAX));
-
- for (i = 0; i < WEP_KEYS_MAX ; i++) {
- wep_cmd->key[i].key_idx = i;
- if (ctx->wep_keys[i].key_size) {
- wep_cmd->key[i].key_offset = i;
- not_empty = 1;
- } else {
- wep_cmd->key[i].key_offset = WEP_INVALID_OFFSET;
- }
-
- wep_cmd->key[i].key_size = ctx->wep_keys[i].key_size;
- memcpy(&wep_cmd->key[i].key[3], ctx->wep_keys[i].key,
- ctx->wep_keys[i].key_size);
- }
-
- wep_cmd->global_key_type = WEP_KEY_WEP_TYPE;
- wep_cmd->num_keys = WEP_KEYS_MAX;
-
- cmd_size += sizeof(struct il_wep_key) * WEP_KEYS_MAX;
-
- cmd.len = cmd_size;
-
- if (not_empty || send_if_empty)
- return il_send_cmd(il, &cmd);
- else
- return 0;
-}
-
-int il4965_restore_default_wep_keys(struct il_priv *il,
- struct il_rxon_context *ctx)
-{
- lockdep_assert_held(&il->mutex);
-
- return il4965_static_wepkey_cmd(il, ctx, false);
-}
-
-int il4965_remove_default_wep_key(struct il_priv *il,
- struct il_rxon_context *ctx,
- struct ieee80211_key_conf *keyconf)
-{
- int ret;
-
- lockdep_assert_held(&il->mutex);
-
- D_WEP("Removing default WEP key: idx=%d\n",
- keyconf->keyidx);
-
- memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0]));
- if (il_is_rfkill(il)) {
- D_WEP(
- "Not sending REPLY_WEPKEY command due to RFKILL.\n");
- /* but keys in device are clear anyway so return success */
- return 0;
- }
- ret = il4965_static_wepkey_cmd(il, ctx, 1);
- D_WEP("Remove default WEP key: idx=%d ret=%d\n",
- keyconf->keyidx, ret);
-
- return ret;
-}
-
-int il4965_set_default_wep_key(struct il_priv *il,
- struct il_rxon_context *ctx,
- struct ieee80211_key_conf *keyconf)
-{
- int ret;
-
- lockdep_assert_held(&il->mutex);
-
- if (keyconf->keylen != WEP_KEY_LEN_128 &&
- keyconf->keylen != WEP_KEY_LEN_64) {
- D_WEP("Bad WEP key length %d\n", keyconf->keylen);
- return -EINVAL;
- }
-
- keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV;
- keyconf->hw_key_idx = HW_KEY_DEFAULT;
- il->stations[ctx->ap_sta_id].keyinfo.cipher = keyconf->cipher;
-
- ctx->wep_keys[keyconf->keyidx].key_size = keyconf->keylen;
- memcpy(&ctx->wep_keys[keyconf->keyidx].key, &keyconf->key,
- keyconf->keylen);
-
- ret = il4965_static_wepkey_cmd(il, ctx, false);
- D_WEP("Set default WEP key: len=%d idx=%d ret=%d\n",
- keyconf->keylen, keyconf->keyidx, ret);
-
- return ret;
-}
-
-static int il4965_set_wep_dynamic_key_info(struct il_priv *il,
- struct il_rxon_context *ctx,
- struct ieee80211_key_conf *keyconf,
- u8 sta_id)
-{
- unsigned long flags;
- __le16 key_flags = 0;
- struct il_addsta_cmd sta_cmd;
-
- lockdep_assert_held(&il->mutex);
-
- keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV;
-
- key_flags |= (STA_KEY_FLG_WEP | STA_KEY_FLG_MAP_KEY_MSK);
- key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
- key_flags &= ~STA_KEY_FLG_INVALID;
-
- if (keyconf->keylen == WEP_KEY_LEN_128)
- key_flags |= STA_KEY_FLG_KEY_SIZE_MSK;
-
- if (sta_id == ctx->bcast_sta_id)
- key_flags |= STA_KEY_MULTICAST_MSK;
-
- spin_lock_irqsave(&il->sta_lock, flags);
-
- il->stations[sta_id].keyinfo.cipher = keyconf->cipher;
- il->stations[sta_id].keyinfo.keylen = keyconf->keylen;
- il->stations[sta_id].keyinfo.keyidx = keyconf->keyidx;
-
- memcpy(il->stations[sta_id].keyinfo.key,
- keyconf->key, keyconf->keylen);
-
- memcpy(&il->stations[sta_id].sta.key.key[3],
- keyconf->key, keyconf->keylen);
-
- if ((il->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
- == STA_KEY_FLG_NO_ENC)
- il->stations[sta_id].sta.key.key_offset =
- il_get_free_ucode_key_idx(il);
- /* else, we are overriding an existing key => no need to allocated room
- * in uCode. */
-
- WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
- "no space for a new key");
-
- il->stations[sta_id].sta.key.key_flags = key_flags;
- il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
- il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
-
- memcpy(&sta_cmd, &il->stations[sta_id].sta,
- sizeof(struct il_addsta_cmd));
- spin_unlock_irqrestore(&il->sta_lock, flags);
-
- return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
-}
-
-static int il4965_set_ccmp_dynamic_key_info(struct il_priv *il,
- struct il_rxon_context *ctx,
- struct ieee80211_key_conf *keyconf,
- u8 sta_id)
-{
- unsigned long flags;
- __le16 key_flags = 0;
- struct il_addsta_cmd sta_cmd;
-
- lockdep_assert_held(&il->mutex);
-
- key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK);
- key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
- key_flags &= ~STA_KEY_FLG_INVALID;
-
- if (sta_id == ctx->bcast_sta_id)
- key_flags |= STA_KEY_MULTICAST_MSK;
-
- keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
-
- spin_lock_irqsave(&il->sta_lock, flags);
- il->stations[sta_id].keyinfo.cipher = keyconf->cipher;
- il->stations[sta_id].keyinfo.keylen = keyconf->keylen;
-
- memcpy(il->stations[sta_id].keyinfo.key, keyconf->key,
- keyconf->keylen);
-
- memcpy(il->stations[sta_id].sta.key.key, keyconf->key,
- keyconf->keylen);
-
- if ((il->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
- == STA_KEY_FLG_NO_ENC)
- il->stations[sta_id].sta.key.key_offset =
- il_get_free_ucode_key_idx(il);
- /* else, we are overriding an existing key => no need to allocated room
- * in uCode. */
-
- WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
- "no space for a new key");
-
- il->stations[sta_id].sta.key.key_flags = key_flags;
- il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
- il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
-
- memcpy(&sta_cmd, &il->stations[sta_id].sta,
- sizeof(struct il_addsta_cmd));
- spin_unlock_irqrestore(&il->sta_lock, flags);
-
- return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
-}
-
-static int il4965_set_tkip_dynamic_key_info(struct il_priv *il,
- struct il_rxon_context *ctx,
- struct ieee80211_key_conf *keyconf,
- u8 sta_id)
-{
- unsigned long flags;
- int ret = 0;
- __le16 key_flags = 0;
-
- key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
- key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
- key_flags &= ~STA_KEY_FLG_INVALID;
-
- if (sta_id == ctx->bcast_sta_id)
- key_flags |= STA_KEY_MULTICAST_MSK;
-
- keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
- keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
-
- spin_lock_irqsave(&il->sta_lock, flags);
-
- il->stations[sta_id].keyinfo.cipher = keyconf->cipher;
- il->stations[sta_id].keyinfo.keylen = 16;
-
- if ((il->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
- == STA_KEY_FLG_NO_ENC)
- il->stations[sta_id].sta.key.key_offset =
- il_get_free_ucode_key_idx(il);
- /* else, we are overriding an existing key => no need to allocated room
- * in uCode. */
-
- WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
- "no space for a new key");
-
- il->stations[sta_id].sta.key.key_flags = key_flags;
-
-
- /* This copy is acutally not needed: we get the key with each TX */
- memcpy(il->stations[sta_id].keyinfo.key, keyconf->key, 16);
-
- memcpy(il->stations[sta_id].sta.key.key, keyconf->key, 16);
-
- spin_unlock_irqrestore(&il->sta_lock, flags);
-
- return ret;
-}
-
-void il4965_update_tkip_key(struct il_priv *il,
- struct il_rxon_context *ctx,
- struct ieee80211_key_conf *keyconf,
- struct ieee80211_sta *sta, u32 iv32, u16 *phase1key)
-{
- u8 sta_id;
- unsigned long flags;
- int i;
-
- if (il_scan_cancel(il)) {
- /* cancel scan failed, just live w/ bad key and rely
- briefly on SW decryption */
- return;
- }
-
- sta_id = il_sta_id_or_broadcast(il, ctx, sta);
- if (sta_id == IL_INVALID_STATION)
- return;
-
- spin_lock_irqsave(&il->sta_lock, flags);
-
- il->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32;
-
- for (i = 0; i < 5; i++)
- il->stations[sta_id].sta.key.tkip_rx_ttak[i] =
- cpu_to_le16(phase1key[i]);
-
- il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
- il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
-
- il_send_add_sta(il, &il->stations[sta_id].sta, CMD_ASYNC);
-
- spin_unlock_irqrestore(&il->sta_lock, flags);
-
-}
-
-int il4965_remove_dynamic_key(struct il_priv *il,
- struct il_rxon_context *ctx,
- struct ieee80211_key_conf *keyconf,
- u8 sta_id)
-{
- unsigned long flags;
- u16 key_flags;
- u8 keyidx;
- struct il_addsta_cmd sta_cmd;
-
- lockdep_assert_held(&il->mutex);
-
- ctx->key_mapping_keys--;
-
- spin_lock_irqsave(&il->sta_lock, flags);
- key_flags = le16_to_cpu(il->stations[sta_id].sta.key.key_flags);
- keyidx = (key_flags >> STA_KEY_FLG_KEYID_POS) & 0x3;
-
- D_WEP("Remove dynamic key: idx=%d sta=%d\n",
- keyconf->keyidx, sta_id);
-
- if (keyconf->keyidx != keyidx) {
- /* We need to remove a key with idx different that the one
- * in the uCode. This means that the key we need to remove has
- * been replaced by another one with different idx.
- * Don't do anything and return ok
- */
- spin_unlock_irqrestore(&il->sta_lock, flags);
- return 0;
- }
-
- if (il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET) {
- IL_WARN("Removing wrong key %d 0x%x\n",
- keyconf->keyidx, key_flags);
- spin_unlock_irqrestore(&il->sta_lock, flags);
- return 0;
- }
-
- if (!test_and_clear_bit(il->stations[sta_id].sta.key.key_offset,
- &il->ucode_key_table))
- IL_ERR("idx %d not used in uCode key table.\n",
- il->stations[sta_id].sta.key.key_offset);
- memset(&il->stations[sta_id].keyinfo, 0,
- sizeof(struct il_hw_key));
- memset(&il->stations[sta_id].sta.key, 0,
- sizeof(struct il4965_keyinfo));
- il->stations[sta_id].sta.key.key_flags =
- STA_KEY_FLG_NO_ENC | STA_KEY_FLG_INVALID;
- il->stations[sta_id].sta.key.key_offset = WEP_INVALID_OFFSET;
- il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
- il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
-
- if (il_is_rfkill(il)) {
- D_WEP(
- "Not sending REPLY_ADD_STA command because RFKILL enabled.\n");
- spin_unlock_irqrestore(&il->sta_lock, flags);
- return 0;
- }
- memcpy(&sta_cmd, &il->stations[sta_id].sta,
- sizeof(struct il_addsta_cmd));
- spin_unlock_irqrestore(&il->sta_lock, flags);
-
- return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
-}
-
-int il4965_set_dynamic_key(struct il_priv *il, struct il_rxon_context *ctx,
- struct ieee80211_key_conf *keyconf, u8 sta_id)
-{
- int ret;
-
- lockdep_assert_held(&il->mutex);
-
- ctx->key_mapping_keys++;
- keyconf->hw_key_idx = HW_KEY_DYNAMIC;
-
- switch (keyconf->cipher) {
- case WLAN_CIPHER_SUITE_CCMP:
- ret = il4965_set_ccmp_dynamic_key_info(il, ctx,
- keyconf, sta_id);
- break;
- case WLAN_CIPHER_SUITE_TKIP:
- ret = il4965_set_tkip_dynamic_key_info(il, ctx,
- keyconf, sta_id);
- break;
- case WLAN_CIPHER_SUITE_WEP40:
- case WLAN_CIPHER_SUITE_WEP104:
- ret = il4965_set_wep_dynamic_key_info(il, ctx,
- keyconf, sta_id);
- break;
- default:
- IL_ERR(
- "Unknown alg: %s cipher = %x\n", __func__,
- keyconf->cipher);
- ret = -EINVAL;
- }
-
- D_WEP(
- "Set dynamic key: cipher=%x len=%d idx=%d sta=%d ret=%d\n",
- keyconf->cipher, keyconf->keylen, keyconf->keyidx,
- sta_id, ret);
-
- return ret;
-}
-
-/**
- * il4965_alloc_bcast_station - add broadcast station into driver's station table.
- *
- * This adds the broadcast station into the driver's station table
- * and marks it driver active, so that it will be restored to the
- * device at the next best time.
- */
-int il4965_alloc_bcast_station(struct il_priv *il,
- struct il_rxon_context *ctx)
-{
- struct il_link_quality_cmd *link_cmd;
- unsigned long flags;
- u8 sta_id;
-
- spin_lock_irqsave(&il->sta_lock, flags);
- sta_id = il_prep_station(il, ctx, il_bcast_addr,
- false, NULL);
- if (sta_id == IL_INVALID_STATION) {
- IL_ERR("Unable to prepare broadcast station\n");
- spin_unlock_irqrestore(&il->sta_lock, flags);
-
- return -EINVAL;
- }
-
- il->stations[sta_id].used |= IL_STA_DRIVER_ACTIVE;
- il->stations[sta_id].used |= IL_STA_BCAST;
- spin_unlock_irqrestore(&il->sta_lock, flags);
-
- link_cmd = il4965_sta_alloc_lq(il, sta_id);
- if (!link_cmd) {
- IL_ERR(
- "Unable to initialize rate scaling for bcast station.\n");
- return -ENOMEM;
- }
-
- spin_lock_irqsave(&il->sta_lock, flags);
- il->stations[sta_id].lq = link_cmd;
- spin_unlock_irqrestore(&il->sta_lock, flags);
-
- return 0;
-}
-
-/**
- * il4965_update_bcast_station - update broadcast station's LQ command
- *
- * Only used by iwl4965. Placed here to have all bcast station management
- * code together.
- */
-static int il4965_update_bcast_station(struct il_priv *il,
- struct il_rxon_context *ctx)
-{
- unsigned long flags;
- struct il_link_quality_cmd *link_cmd;
- u8 sta_id = ctx->bcast_sta_id;
-
- link_cmd = il4965_sta_alloc_lq(il, sta_id);
- if (!link_cmd) {
- IL_ERR(
- "Unable to initialize rate scaling for bcast station.\n");
- return -ENOMEM;
- }
-
- spin_lock_irqsave(&il->sta_lock, flags);
- if (il->stations[sta_id].lq)
- kfree(il->stations[sta_id].lq);
- else
- D_INFO(
- "Bcast station rate scaling has not been initialized yet.\n");
- il->stations[sta_id].lq = link_cmd;
- spin_unlock_irqrestore(&il->sta_lock, flags);
-
- return 0;
-}
-
-int il4965_update_bcast_stations(struct il_priv *il)
-{
- return il4965_update_bcast_station(il, &il->ctx);
-}
-
-/**
- * il4965_sta_tx_modify_enable_tid - Enable Tx for this TID in station table
- */
-int il4965_sta_tx_modify_enable_tid(struct il_priv *il, int sta_id, int tid)
-{
- unsigned long flags;
- struct il_addsta_cmd sta_cmd;
-
- lockdep_assert_held(&il->mutex);
-
- /* Remove "disable" flag, to enable Tx for this TID */
- spin_lock_irqsave(&il->sta_lock, flags);
- il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_TID_DISABLE_TX;
- il->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid));
- il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
- memcpy(&sta_cmd, &il->stations[sta_id].sta,
- sizeof(struct il_addsta_cmd));
- spin_unlock_irqrestore(&il->sta_lock, flags);
-
- return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
-}
-
-int il4965_sta_rx_agg_start(struct il_priv *il, struct ieee80211_sta *sta,
- int tid, u16 ssn)
-{
- unsigned long flags;
- int sta_id;
- struct il_addsta_cmd sta_cmd;
-
- lockdep_assert_held(&il->mutex);
-
- sta_id = il_sta_id(sta);
- if (sta_id == IL_INVALID_STATION)
- return -ENXIO;
-
- spin_lock_irqsave(&il->sta_lock, flags);
- il->stations[sta_id].sta.station_flags_msk = 0;
- il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK;
- il->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid;
- il->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn);
- il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
- memcpy(&sta_cmd, &il->stations[sta_id].sta,
- sizeof(struct il_addsta_cmd));
- spin_unlock_irqrestore(&il->sta_lock, flags);
-
- return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
-}
-
-int il4965_sta_rx_agg_stop(struct il_priv *il, struct ieee80211_sta *sta,
- int tid)
-{
- unsigned long flags;
- int sta_id;
- struct il_addsta_cmd sta_cmd;
-
- lockdep_assert_held(&il->mutex);
-
- sta_id = il_sta_id(sta);
- if (sta_id == IL_INVALID_STATION) {
- IL_ERR("Invalid station for AGG tid %d\n", tid);
- return -ENXIO;
- }
-
- spin_lock_irqsave(&il->sta_lock, flags);
- il->stations[sta_id].sta.station_flags_msk = 0;
- il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK;
- il->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid;
- il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
- memcpy(&sta_cmd, &il->stations[sta_id].sta,
- sizeof(struct il_addsta_cmd));
- spin_unlock_irqrestore(&il->sta_lock, flags);
-
- return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
-}
-
-void
-il4965_sta_modify_sleep_tx_count(struct il_priv *il, int sta_id, int cnt)
-{
- unsigned long flags;
-
- spin_lock_irqsave(&il->sta_lock, flags);
- il->stations[sta_id].sta.station_flags |= STA_FLG_PWR_SAVE_MSK;
- il->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK;
- il->stations[sta_id].sta.sta.modify_mask =
- STA_MODIFY_SLEEP_TX_COUNT_MSK;
- il->stations[sta_id].sta.sleep_tx_count = cpu_to_le16(cnt);
- il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
- il_send_add_sta(il,
- &il->stations[sta_id].sta, CMD_ASYNC);
- spin_unlock_irqrestore(&il->sta_lock, flags);
-
-}
--
1.7.1


2011-11-18 08:23:01

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 62/77] iwlegacy: use FH49_ prefix in 4965 code

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/4965-mac.c | 96 +++++++-------
drivers/net/wireless/iwlegacy/4965.c | 2 +-
drivers/net/wireless/iwlegacy/common.h | 2 +-
drivers/net/wireless/iwlegacy/iwl-fh.h | 206 +++++++++++++++---------------
4 files changed, 153 insertions(+), 153 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index 82b6a7b..9e3f74c 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -138,22 +138,22 @@ int il4965_rx_init(struct il_priv *il, struct il_rx_queue *rxq)
u32 rb_timeout = 0;

if (il->cfg->mod_params->amsdu_size_8K)
- rb_size = FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_8K;
+ rb_size = FH49_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_8K;
else
- rb_size = FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K;
+ rb_size = FH49_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K;

/* Stop Rx DMA */
- il_wr(il, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
+ il_wr(il, FH49_MEM_RCSR_CHNL0_CONFIG_REG, 0);

/* Reset driver's Rx queue write idx */
- il_wr(il, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0);
+ il_wr(il, FH49_RSCSR_CHNL0_RBDCB_WPTR_REG, 0);

/* Tell device where to find RBD circular buffer in DRAM */
- il_wr(il, FH_RSCSR_CHNL0_RBDCB_BASE_REG,
+ il_wr(il, FH49_RSCSR_CHNL0_RBDCB_BASE_REG,
(u32)(rxq->bd_dma >> 8));

/* Tell device where in DRAM to update its Rx status */
- il_wr(il, FH_RSCSR_CHNL0_STTS_WPTR_REG,
+ il_wr(il, FH49_RSCSR_CHNL0_STTS_WPTR_REG,
rxq->rb_stts_dma >> 4);

/* Enable Rx DMA
@@ -162,13 +162,13 @@ int il4965_rx_init(struct il_priv *il, struct il_rx_queue *rxq)
* RB timeout 0x10
* 256 RBDs
*/
- il_wr(il, FH_MEM_RCSR_CHNL0_CONFIG_REG,
- FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL |
- FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL |
- FH_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MSK |
+ il_wr(il, FH49_MEM_RCSR_CHNL0_CONFIG_REG,
+ FH49_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL |
+ FH49_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL |
+ FH49_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MSK |
rb_size|
- (rb_timeout << FH_RCSR_RX_CONFIG_REG_IRQ_RBTH_POS)|
- (rfdnlog << FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS));
+ (rb_timeout << FH49_RCSR_RX_CONFIG_REG_IRQ_RBTH_POS)|
+ (rfdnlog << FH49_RCSR_RX_CONFIG_RBDCB_SIZE_POS));

/* Set interrupt coalescing timer to default (2048 usecs) */
il_write8(il, CSR_INT_COALESCING, IL_HOST_INT_TIMEOUT_DEF);
@@ -443,9 +443,9 @@ int il4965_rxq_stop(struct il_priv *il)
{

/* stop Rx DMA */
- il_wr(il, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
- il_poll_bit(il, FH_MEM_RSSR_RX_STATUS_REG,
- FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000);
+ il_wr(il, FH49_MEM_RCSR_CHNL0_CONFIG_REG, 0);
+ il_poll_bit(il, FH49_MEM_RSSR_RX_STATUS_REG,
+ FH49_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000);

return 0;
}
@@ -1180,15 +1180,15 @@ u8 il4965_toggle_tx_ant(struct il_priv *il, u8 ant, u8 valid)
static const char *il4965_get_fh_string(int cmd)
{
switch (cmd) {
- IL_CMD(FH_RSCSR_CHNL0_STTS_WPTR_REG);
- IL_CMD(FH_RSCSR_CHNL0_RBDCB_BASE_REG);
- IL_CMD(FH_RSCSR_CHNL0_WPTR);
- IL_CMD(FH_MEM_RCSR_CHNL0_CONFIG_REG);
- IL_CMD(FH_MEM_RSSR_SHARED_CTRL_REG);
- IL_CMD(FH_MEM_RSSR_RX_STATUS_REG);
- IL_CMD(FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV);
- IL_CMD(FH_TSSR_TX_STATUS_REG);
- IL_CMD(FH_TSSR_TX_ERROR_REG);
+ IL_CMD(FH49_RSCSR_CHNL0_STTS_WPTR_REG);
+ IL_CMD(FH49_RSCSR_CHNL0_RBDCB_BASE_REG);
+ IL_CMD(FH49_RSCSR_CHNL0_WPTR);
+ IL_CMD(FH49_MEM_RCSR_CHNL0_CONFIG_REG);
+ IL_CMD(FH49_MEM_RSSR_SHARED_CTRL_REG);
+ IL_CMD(FH49_MEM_RSSR_RX_STATUS_REG);
+ IL_CMD(FH49_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV);
+ IL_CMD(FH49_TSSR_TX_STATUS_REG);
+ IL_CMD(FH49_TSSR_TX_ERROR_REG);
default:
return "UNKNOWN";
}
@@ -1202,15 +1202,15 @@ int il4965_dump_fh(struct il_priv *il, char **buf, bool display)
size_t bufsz = 0;
#endif
static const u32 fh_tbl[] = {
- FH_RSCSR_CHNL0_STTS_WPTR_REG,
- FH_RSCSR_CHNL0_RBDCB_BASE_REG,
- FH_RSCSR_CHNL0_WPTR,
- FH_MEM_RCSR_CHNL0_CONFIG_REG,
- FH_MEM_RSSR_SHARED_CTRL_REG,
- FH_MEM_RSSR_RX_STATUS_REG,
- FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV,
- FH_TSSR_TX_STATUS_REG,
- FH_TSSR_TX_ERROR_REG
+ FH49_RSCSR_CHNL0_STTS_WPTR_REG,
+ FH49_RSCSR_CHNL0_RBDCB_BASE_REG,
+ FH49_RSCSR_CHNL0_WPTR,
+ FH49_MEM_RCSR_CHNL0_CONFIG_REG,
+ FH49_MEM_RSSR_SHARED_CTRL_REG,
+ FH49_MEM_RSSR_RX_STATUS_REG,
+ FH49_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV,
+ FH49_TSSR_TX_STATUS_REG,
+ FH49_TSSR_TX_ERROR_REG
};
#ifdef CONFIG_IWLEGACY_DEBUG
if (display) {
@@ -2010,7 +2010,7 @@ int il4965_txq_ctx_alloc(struct il_priv *il)
il4965_txq_set_sched(il, 0);

/* Tell NIC where to find the "keep warm" buffer */
- il_wr(il, FH_KW_MEM_ADDR_REG, il->kw.dma >> 4);
+ il_wr(il, FH49_KW_MEM_ADDR_REG, il->kw.dma >> 4);

spin_unlock_irqrestore(&il->lock, flags);

@@ -2049,7 +2049,7 @@ void il4965_txq_ctx_reset(struct il_priv *il)
il4965_txq_set_sched(il, 0);

/* Tell NIC where to find the "keep warm" buffer */
- il_wr(il, FH_KW_MEM_ADDR_REG, il->kw.dma >> 4);
+ il_wr(il, FH49_KW_MEM_ADDR_REG, il->kw.dma >> 4);

spin_unlock_irqrestore(&il->lock, flags);

@@ -2078,14 +2078,14 @@ void il4965_txq_ctx_stop(struct il_priv *il)
/* Stop each Tx DMA channel, and wait for it to be idle */
for (ch = 0; ch < il->hw_params.dma_chnl_num; ch++) {
il_wr(il,
- FH_TCSR_CHNL_TX_CONFIG_REG(ch), 0x0);
- if (il_poll_bit(il, FH_TSSR_TX_STATUS_REG,
- FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch),
+ FH49_TCSR_CHNL_TX_CONFIG_REG(ch), 0x0);
+ if (il_poll_bit(il, FH49_TSSR_TX_STATUS_REG,
+ FH49_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch),
1000))
IL_ERR("Failing on timeout while stopping"
" DMA channel %d [0x%08x]", ch,
il_rd(il,
- FH_TSSR_TX_STATUS_REG));
+ FH49_TSSR_TX_STATUS_REG));
}
spin_unlock_irqrestore(&il->lock, flags);

@@ -3743,7 +3743,7 @@ int il4965_hw_tx_queue_init(struct il_priv *il,
int txq_id = txq->q.id;

/* Circular buffer (TFD queue in DRAM) physical base address */
- il_wr(il, FH_MEM_CBBC_QUEUE(txq_id),
+ il_wr(il, FH49_MEM_CBBC_QUEUE(txq_id),
txq->q.dma_addr >> 8);

return 0;
@@ -4262,7 +4262,7 @@ static void il4965_irq_tasklet(struct il_priv *il)
if (inta & ~(il->inta_mask)) {
IL_WARN("Disabled INTA bits 0x%08x were pending\n",
inta & ~il->inta_mask);
- IL_WARN(" with FH_INT = 0x%08x\n", inta_fh);
+ IL_WARN(" with FH49_INT = 0x%08x\n", inta_fh);
}

/* Re-enable all interrupts */
@@ -4798,7 +4798,7 @@ static const char * const desc_lookup_text[] = {
"HW_ERROR_TEMPERATURE",
"ILLEGAL_CHAN_FREQ",
"VCC_NOT_STBL",
- "FH_ERROR",
+ "FH49_ERROR",
"NMI_INTERRUPT_HOST",
"NMI_INTERRUPT_ACTION_PT",
"NMI_INTERRUPT_UNKNOWN",
@@ -4969,14 +4969,14 @@ static int il4965_alive_notify(struct il_priv *il)
/* Enable DMA channel */
for (chan = 0; chan < FH49_TCSR_CHNL_NUM ; chan++)
il_wr(il,
- FH_TCSR_CHNL_TX_CONFIG_REG(chan),
- FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |
- FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE);
+ FH49_TCSR_CHNL_TX_CONFIG_REG(chan),
+ FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |
+ FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE);

/* Update FH chicken bits */
- reg_val = il_rd(il, FH_TX_CHICKEN_BITS_REG);
- il_wr(il, FH_TX_CHICKEN_BITS_REG,
- reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN);
+ reg_val = il_rd(il, FH49_TX_CHICKEN_BITS_REG);
+ il_wr(il, FH49_TX_CHICKEN_BITS_REG,
+ reg_val | FH49_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN);

/* Disable chain mode for all queues */
il_wr_prph(il, IL49_SCD_QUEUECHAIN_SEL, 0);
diff --git a/drivers/net/wireless/iwlegacy/4965.c b/drivers/net/wireless/iwlegacy/4965.c
index 4b97717..cbbb2c0 100644
--- a/drivers/net/wireless/iwlegacy/4965.c
+++ b/drivers/net/wireless/iwlegacy/4965.c
@@ -630,7 +630,7 @@ static int il4965_hw_set_hw_params(struct il_priv *il)
il->hw_params.max_bsm_size = BSM_SRAM_SIZE;
il->hw_params.ht40_channel = BIT(IEEE80211_BAND_5GHZ);

- il->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
+ il->hw_params.rx_wrt_ptr_reg = FH49_RSCSR_CHNL0_WPTR;

il->hw_params.tx_chains_num = il4965_num_of_ant(il->cfg->valid_tx_ant);
il->hw_params.rx_chains_num = il4965_num_of_ant(il->cfg->valid_rx_ant);
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h
index 8ae4e3f..be057aa 100644
--- a/drivers/net/wireless/iwlegacy/common.h
+++ b/drivers/net/wireless/iwlegacy/common.h
@@ -2835,7 +2835,7 @@ struct il_tfd_tb {
* contiguous 256 TFDs x 128 bytes-per-TFD = 32 KBytes
*
* Driver must indicate the physical address of the base of each
- * circular buffer via the FH_MEM_CBBC_QUEUE registers.
+ * circular buffer via the FH49_MEM_CBBC_QUEUE registers.
*
* Each TFD contains pointer/size information for up to 20 data buffers
* in host DRAM. These buffers collectively contain the (one) frame described
diff --git a/drivers/net/wireless/iwlegacy/iwl-fh.h b/drivers/net/wireless/iwlegacy/iwl-fh.h
index 7846bae..ac7c212 100644
--- a/drivers/net/wireless/iwlegacy/iwl-fh.h
+++ b/drivers/net/wireless/iwlegacy/iwl-fh.h
@@ -71,8 +71,8 @@
* This I/O area is directly read/writable by driver (e.g. Linux uses writel())
* Addresses are offsets from device's PCI hardware base address.
*/
-#define FH_MEM_LOWER_BOUND (0x1000)
-#define FH_MEM_UPPER_BOUND (0x2000)
+#define FH49_MEM_LOWER_BOUND (0x1000)
+#define FH49_MEM_UPPER_BOUND (0x2000)

/**
* Keep-Warm (KW) buffer base address.
@@ -83,7 +83,7 @@
* from going into a power-savings mode that would cause higher DRAM latency,
* and possible data over/under-runs, before all Tx/Rx is complete.
*
- * Driver loads FH_KW_MEM_ADDR_REG with the physical address (bits 35:4)
+ * Driver loads FH49_KW_MEM_ADDR_REG with the physical address (bits 35:4)
* of the buffer, which must be 4K aligned. Once this is set up, the 4965
* automatically invokes keep-warm accesses when normal accesses might not
* be sufficient to maintain fast DRAM response.
@@ -91,7 +91,7 @@
* Bit fields:
* 31-0: Keep-warm buffer physical base address [35:4], must be 4K aligned
*/
-#define FH_KW_MEM_ADDR_REG (FH_MEM_LOWER_BOUND + 0x97C)
+#define FH49_KW_MEM_ADDR_REG (FH49_MEM_LOWER_BOUND + 0x97C)


/**
@@ -106,11 +106,11 @@
* Bit fields in each pointer register:
* 27-0: TFD CB physical base address [35:8], must be 256-byte aligned
*/
-#define FH_MEM_CBBC_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0)
-#define FH_MEM_CBBC_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10)
+#define FH49_MEM_CBBC_LOWER_BOUND (FH49_MEM_LOWER_BOUND + 0x9D0)
+#define FH49_MEM_CBBC_UPPER_BOUND (FH49_MEM_LOWER_BOUND + 0xA10)

/* Find TFD CB base pointer for given queue (range 0-15). */
-#define FH_MEM_CBBC_QUEUE(x) (FH_MEM_CBBC_LOWER_BOUND + (x) * 0x4)
+#define FH49_MEM_CBBC_QUEUE(x) (FH49_MEM_CBBC_LOWER_BOUND + (x) * 0x4)


/**
@@ -132,18 +132,18 @@
* Each entry (1 dword) points to a receive buffer (RB) of consistent size
* (typically 4K, although 8K or 16K are also selectable by driver).
* Driver sets up RB size and number of RBDs in the CB via Rx config
- * register FH_MEM_RCSR_CHNL0_CONFIG_REG.
+ * register FH49_MEM_RCSR_CHNL0_CONFIG_REG.
*
* Bit fields within one RBD:
* 27-0: Receive Buffer physical address bits [35:8], 256-byte aligned
*
* Driver sets physical address [35:8] of base of RBD circular buffer
- * into FH_RSCSR_CHNL0_RBDCB_BASE_REG [27:0].
+ * into FH49_RSCSR_CHNL0_RBDCB_BASE_REG [27:0].
*
* 2) Rx status buffer, 8 bytes, in which 4965 indicates which Rx Buffers
* (RBs) have been filled, via a "write pointer", actually the idx of
* the RB's corresponding RBD within the circular buffer. Driver sets
- * physical address [35:4] into FH_RSCSR_CHNL0_STTS_WPTR_REG [31:0].
+ * physical address [35:4] into FH49_RSCSR_CHNL0_STTS_WPTR_REG [31:0].
*
* Bit fields in lower dword of Rx status buffer (upper dword not used
* by driver; see struct il4965_shared, val0):
@@ -154,7 +154,7 @@
* As the driver prepares Receive Buffers (RBs) for 4965 to fill, driver must
* enter pointers to these RBs into contiguous RBD circular buffer entries,
* and update the 4965's "write" idx register,
- * FH_RSCSR_CHNL0_RBDCB_WPTR_REG.
+ * FH49_RSCSR_CHNL0_RBDCB_WPTR_REG.
*
* This "write" idx corresponds to the *next* RBD that the driver will make
* available, i.e. one RBD past the tail of the ready-to-fill RBDs within
@@ -182,23 +182,23 @@
* and "read" idxes; that is, make sure that there are no more than 254
* buffers waiting to be filled.
*/
-#define FH_MEM_RSCSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xBC0)
-#define FH_MEM_RSCSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xC00)
-#define FH_MEM_RSCSR_CHNL0 (FH_MEM_RSCSR_LOWER_BOUND)
+#define FH49_MEM_RSCSR_LOWER_BOUND (FH49_MEM_LOWER_BOUND + 0xBC0)
+#define FH49_MEM_RSCSR_UPPER_BOUND (FH49_MEM_LOWER_BOUND + 0xC00)
+#define FH49_MEM_RSCSR_CHNL0 (FH49_MEM_RSCSR_LOWER_BOUND)

/**
* Physical base address of 8-byte Rx Status buffer.
* Bit fields:
* 31-0: Rx status buffer physical base address [35:4], must 16-byte aligned.
*/
-#define FH_RSCSR_CHNL0_STTS_WPTR_REG (FH_MEM_RSCSR_CHNL0)
+#define FH49_RSCSR_CHNL0_STTS_WPTR_REG (FH49_MEM_RSCSR_CHNL0)

/**
* Physical base address of Rx Buffer Descriptor Circular Buffer.
* Bit fields:
* 27-0: RBD CD physical base address [35:8], must be 256-byte aligned.
*/
-#define FH_RSCSR_CHNL0_RBDCB_BASE_REG (FH_MEM_RSCSR_CHNL0 + 0x004)
+#define FH49_RSCSR_CHNL0_RBDCB_BASE_REG (FH49_MEM_RSCSR_CHNL0 + 0x004)

/**
* Rx write pointer (idx, really!).
@@ -206,20 +206,20 @@
* 11-0: Index of driver's most recent prepared-to-be-filled RBD, + 1.
* NOTE: For 256-entry circular buffer, use only bits [7:0].
*/
-#define FH_RSCSR_CHNL0_RBDCB_WPTR_REG (FH_MEM_RSCSR_CHNL0 + 0x008)
-#define FH_RSCSR_CHNL0_WPTR (FH_RSCSR_CHNL0_RBDCB_WPTR_REG)
+#define FH49_RSCSR_CHNL0_RBDCB_WPTR_REG (FH49_MEM_RSCSR_CHNL0 + 0x008)
+#define FH49_RSCSR_CHNL0_WPTR (FH49_RSCSR_CHNL0_RBDCB_WPTR_REG)


/**
* Rx Config/Status Registers (RCSR)
* Rx Config Reg for channel 0 (only channel used)
*
- * Driver must initialize FH_MEM_RCSR_CHNL0_CONFIG_REG as follows for
+ * Driver must initialize FH49_MEM_RCSR_CHNL0_CONFIG_REG as follows for
* normal operation (see bit fields).
*
- * Clearing FH_MEM_RCSR_CHNL0_CONFIG_REG to 0 turns off Rx DMA.
- * Driver should poll FH_MEM_RSSR_RX_STATUS_REG for
- * FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (bit 24) before continuing.
+ * Clearing FH49_MEM_RCSR_CHNL0_CONFIG_REG to 0 turns off Rx DMA.
+ * Driver should poll FH49_MEM_RSSR_RX_STATUS_REG for
+ * FH49_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (bit 24) before continuing.
*
* Bit fields:
* 31-30: Rx DMA channel enable: '00' off/pause, '01' pause at end of frame,
@@ -236,67 +236,67 @@
* typical value 0x10 (about 1/2 msec)
* 3- 0: reserved
*/
-#define FH_MEM_RCSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xC00)
-#define FH_MEM_RCSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xCC0)
-#define FH_MEM_RCSR_CHNL0 (FH_MEM_RCSR_LOWER_BOUND)
+#define FH49_MEM_RCSR_LOWER_BOUND (FH49_MEM_LOWER_BOUND + 0xC00)
+#define FH49_MEM_RCSR_UPPER_BOUND (FH49_MEM_LOWER_BOUND + 0xCC0)
+#define FH49_MEM_RCSR_CHNL0 (FH49_MEM_RCSR_LOWER_BOUND)

-#define FH_MEM_RCSR_CHNL0_CONFIG_REG (FH_MEM_RCSR_CHNL0)
+#define FH49_MEM_RCSR_CHNL0_CONFIG_REG (FH49_MEM_RCSR_CHNL0)

-#define FH_RCSR_CHNL0_RX_CONFIG_RB_TIMEOUT_MSK (0x00000FF0) /* bits 4-11 */
-#define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_MSK (0x00001000) /* bits 12 */
-#define FH_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MSK (0x00008000) /* bit 15 */
-#define FH_RCSR_CHNL0_RX_CONFIG_RB_SIZE_MSK (0x00030000) /* bits 16-17 */
-#define FH_RCSR_CHNL0_RX_CONFIG_RBDBC_SIZE_MSK (0x00F00000) /* bits 20-23 */
-#define FH_RCSR_CHNL0_RX_CONFIG_DMA_CHNL_EN_MSK (0xC0000000) /* bits 30-31*/
+#define FH49_RCSR_CHNL0_RX_CONFIG_RB_TIMEOUT_MSK (0x00000FF0) /* bits 4-11 */
+#define FH49_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_MSK (0x00001000) /* bits 12 */
+#define FH49_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MSK (0x00008000) /* bit 15 */
+#define FH49_RCSR_CHNL0_RX_CONFIG_RB_SIZE_MSK (0x00030000) /* bits 16-17 */
+#define FH49_RCSR_CHNL0_RX_CONFIG_RBDBC_SIZE_MSK (0x00F00000) /* bits 20-23 */
+#define FH49_RCSR_CHNL0_RX_CONFIG_DMA_CHNL_EN_MSK (0xC0000000) /* bits 30-31*/

-#define FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS (20)
-#define FH_RCSR_RX_CONFIG_REG_IRQ_RBTH_POS (4)
+#define FH49_RCSR_RX_CONFIG_RBDCB_SIZE_POS (20)
+#define FH49_RCSR_RX_CONFIG_REG_IRQ_RBTH_POS (4)
#define RX_RB_TIMEOUT (0x10)

-#define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_VAL (0x00000000)
-#define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_EOF_VAL (0x40000000)
-#define FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL (0x80000000)
+#define FH49_RCSR_RX_CONFIG_CHNL_EN_PAUSE_VAL (0x00000000)
+#define FH49_RCSR_RX_CONFIG_CHNL_EN_PAUSE_EOF_VAL (0x40000000)
+#define FH49_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL (0x80000000)

-#define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K (0x00000000)
-#define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_8K (0x00010000)
-#define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_12K (0x00020000)
-#define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_16K (0x00030000)
+#define FH49_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K (0x00000000)
+#define FH49_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_8K (0x00010000)
+#define FH49_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_12K (0x00020000)
+#define FH49_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_16K (0x00030000)

-#define FH_RCSR_CHNL0_RX_IGNORE_RXF_EMPTY (0x00000004)
-#define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_NO_INT_VAL (0x00000000)
-#define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL (0x00001000)
+#define FH49_RCSR_CHNL0_RX_IGNORE_RXF_EMPTY (0x00000004)
+#define FH49_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_NO_INT_VAL (0x00000000)
+#define FH49_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL (0x00001000)

/**
* Rx Shared Status Registers (RSSR)
*
* After stopping Rx DMA channel (writing 0 to
- * FH_MEM_RCSR_CHNL0_CONFIG_REG), driver must poll
- * FH_MEM_RSSR_RX_STATUS_REG until Rx channel is idle.
+ * FH49_MEM_RCSR_CHNL0_CONFIG_REG), driver must poll
+ * FH49_MEM_RSSR_RX_STATUS_REG until Rx channel is idle.
*
* Bit fields:
* 24: 1 = Channel 0 is idle
*
- * FH_MEM_RSSR_SHARED_CTRL_REG and FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV
+ * FH49_MEM_RSSR_SHARED_CTRL_REG and FH49_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV
* contain default values that should not be altered by the driver.
*/
-#define FH_MEM_RSSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xC40)
-#define FH_MEM_RSSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xD00)
+#define FH49_MEM_RSSR_LOWER_BOUND (FH49_MEM_LOWER_BOUND + 0xC40)
+#define FH49_MEM_RSSR_UPPER_BOUND (FH49_MEM_LOWER_BOUND + 0xD00)

-#define FH_MEM_RSSR_SHARED_CTRL_REG (FH_MEM_RSSR_LOWER_BOUND)
-#define FH_MEM_RSSR_RX_STATUS_REG (FH_MEM_RSSR_LOWER_BOUND + 0x004)
-#define FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV\
- (FH_MEM_RSSR_LOWER_BOUND + 0x008)
+#define FH49_MEM_RSSR_SHARED_CTRL_REG (FH49_MEM_RSSR_LOWER_BOUND)
+#define FH49_MEM_RSSR_RX_STATUS_REG (FH49_MEM_RSSR_LOWER_BOUND + 0x004)
+#define FH49_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV\
+ (FH49_MEM_RSSR_LOWER_BOUND + 0x008)

-#define FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000)
+#define FH49_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000)

-#define FH_MEM_TFDIB_REG1_ADDR_BITSHIFT 28
+#define FH49_MEM_TFDIB_REG1_ADDR_BITSHIFT 28

/* TFDB Area - TFDs buffer table */
-#define FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK (0xFFFFFFFF)
-#define FH_TFDIB_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x900)
-#define FH_TFDIB_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0x958)
-#define FH_TFDIB_CTRL0_REG(_chnl) (FH_TFDIB_LOWER_BOUND + 0x8 * (_chnl))
-#define FH_TFDIB_CTRL1_REG(_chnl) (FH_TFDIB_LOWER_BOUND + 0x8 * (_chnl) + 0x4)
+#define FH49_MEM_TFDIB_DRAM_ADDR_LSB_MSK (0xFFFFFFFF)
+#define FH49_TFDIB_LOWER_BOUND (FH49_MEM_LOWER_BOUND + 0x900)
+#define FH49_TFDIB_UPPER_BOUND (FH49_MEM_LOWER_BOUND + 0x958)
+#define FH49_TFDIB_CTRL0_REG(_chnl) (FH49_TFDIB_LOWER_BOUND + 0x8 * (_chnl))
+#define FH49_TFDIB_CTRL1_REG(_chnl) (FH49_TFDIB_LOWER_BOUND + 0x8 * (_chnl) + 0x4)

/**
* Transmit DMA Channel Control/Status Registers (TCSR)
@@ -306,10 +306,10 @@
* which feed the DMA/FIFO channels); config regs are separated by 0x20 bytes.
*
* To use a Tx DMA channel, driver must initialize its
- * FH_TCSR_CHNL_TX_CONFIG_REG(chnl) with:
+ * FH49_TCSR_CHNL_TX_CONFIG_REG(chnl) with:
*
- * FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |
- * FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL
+ * FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |
+ * FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL
*
* All other bits should be 0.
*
@@ -320,62 +320,62 @@
* 3: Enable internal DMA requests (1, normal operation), disable (0)
* 2- 0: Reserved, set to "0"
*/
-#define FH_TCSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xD00)
-#define FH_TCSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xE60)
+#define FH49_TCSR_LOWER_BOUND (FH49_MEM_LOWER_BOUND + 0xD00)
+#define FH49_TCSR_UPPER_BOUND (FH49_MEM_LOWER_BOUND + 0xE60)

/* Find Control/Status reg for given Tx DMA/FIFO channel */
#define FH49_TCSR_CHNL_NUM (7)
#define FH50_TCSR_CHNL_NUM (8)

/* TCSR: tx_config register values */
-#define FH_TCSR_CHNL_TX_CONFIG_REG(_chnl) \
- (FH_TCSR_LOWER_BOUND + 0x20 * (_chnl))
-#define FH_TCSR_CHNL_TX_CREDIT_REG(_chnl) \
- (FH_TCSR_LOWER_BOUND + 0x20 * (_chnl) + 0x4)
-#define FH_TCSR_CHNL_TX_BUF_STS_REG(_chnl) \
- (FH_TCSR_LOWER_BOUND + 0x20 * (_chnl) + 0x8)
+#define FH49_TCSR_CHNL_TX_CONFIG_REG(_chnl) \
+ (FH49_TCSR_LOWER_BOUND + 0x20 * (_chnl))
+#define FH49_TCSR_CHNL_TX_CREDIT_REG(_chnl) \
+ (FH49_TCSR_LOWER_BOUND + 0x20 * (_chnl) + 0x4)
+#define FH49_TCSR_CHNL_TX_BUF_STS_REG(_chnl) \
+ (FH49_TCSR_LOWER_BOUND + 0x20 * (_chnl) + 0x8)

-#define FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000)
-#define FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRV (0x00000001)
+#define FH49_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000)
+#define FH49_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRV (0x00000001)

-#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE (0x00000000)
-#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE (0x00000008)
+#define FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE (0x00000000)
+#define FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE (0x00000008)

-#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_NOINT (0x00000000)
-#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD (0x00100000)
-#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000)
+#define FH49_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_NOINT (0x00000000)
+#define FH49_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD (0x00100000)
+#define FH49_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000)

-#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000)
-#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_ENDTFD (0x00400000)
-#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_IFTFD (0x00800000)
+#define FH49_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000)
+#define FH49_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_ENDTFD (0x00400000)
+#define FH49_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_IFTFD (0x00800000)

-#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000)
-#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE_EOF (0x40000000)
-#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000)
+#define FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000)
+#define FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE_EOF (0x40000000)
+#define FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000)

-#define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_EMPTY (0x00000000)
-#define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_WAIT (0x00002000)
-#define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00000003)
+#define FH49_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_EMPTY (0x00000000)
+#define FH49_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_WAIT (0x00002000)
+#define FH49_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00000003)

-#define FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM (20)
-#define FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX (12)
+#define FH49_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM (20)
+#define FH49_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX (12)

/**
* Tx Shared Status Registers (TSSR)
*
* After stopping Tx DMA channel (writing 0 to
- * FH_TCSR_CHNL_TX_CONFIG_REG(chnl)), driver must poll
- * FH_TSSR_TX_STATUS_REG until selected Tx channel is idle
+ * FH49_TCSR_CHNL_TX_CONFIG_REG(chnl)), driver must poll
+ * FH49_TSSR_TX_STATUS_REG until selected Tx channel is idle
* (channel's buffers empty | no pending requests).
*
* Bit fields:
* 31-24: 1 = Channel buffers empty (channel 7:0)
* 23-16: 1 = No pending requests (channel 7:0)
*/
-#define FH_TSSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xEA0)
-#define FH_TSSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xEC0)
+#define FH49_TSSR_LOWER_BOUND (FH49_MEM_LOWER_BOUND + 0xEA0)
+#define FH49_TSSR_UPPER_BOUND (FH49_MEM_LOWER_BOUND + 0xEC0)

-#define FH_TSSR_TX_STATUS_REG (FH_TSSR_LOWER_BOUND + 0x010)
+#define FH49_TSSR_TX_STATUS_REG (FH49_TSSR_LOWER_BOUND + 0x010)

/**
* Bit fields for TSSR(Tx Shared Status & Control) error status register:
@@ -394,22 +394,22 @@
* synchronized to the TxFIFO status
* uCode/driver must write "1" in order to clear this flag
*/
-#define FH_TSSR_TX_ERROR_REG (FH_TSSR_LOWER_BOUND + 0x018)
+#define FH49_TSSR_TX_ERROR_REG (FH49_TSSR_LOWER_BOUND + 0x018)

-#define FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_chnl) ((1 << (_chnl)) << 16)
+#define FH49_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_chnl) ((1 << (_chnl)) << 16)

/* Tx service channels */
-#define FH_SRVC_CHNL (9)
-#define FH_SRVC_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9C8)
-#define FH_SRVC_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0)
-#define FH_SRVC_CHNL_SRAM_ADDR_REG(_chnl) \
- (FH_SRVC_LOWER_BOUND + ((_chnl) - 9) * 0x4)
+#define FH49_SRVC_CHNL (9)
+#define FH49_SRVC_LOWER_BOUND (FH49_MEM_LOWER_BOUND + 0x9C8)
+#define FH49_SRVC_UPPER_BOUND (FH49_MEM_LOWER_BOUND + 0x9D0)
+#define FH49_SRVC_CHNL_SRAM_ADDR_REG(_chnl) \
+ (FH49_SRVC_LOWER_BOUND + ((_chnl) - 9) * 0x4)

-#define FH_TX_CHICKEN_BITS_REG (FH_MEM_LOWER_BOUND + 0xE98)
+#define FH49_TX_CHICKEN_BITS_REG (FH49_MEM_LOWER_BOUND + 0xE98)
/* Instruct FH to increment the retry count of a packet when
* it is brought from the memory to TX-FIFO
*/
-#define FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN (0x00000002)
+#define FH49_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN (0x00000002)

/* Keep Warm Size */
#define IL_KW_SIZE 0x1000 /* 4k */
--
1.7.1


2011-11-18 08:21:50

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 29/77] iwlegacy: merge iwl-4965-led.c into 4965.c

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/4965-mac.c | 1 -
drivers/net/wireless/iwlegacy/4965.c | 31 +++++++++++-
drivers/net/wireless/iwlegacy/Makefile | 2 +-
drivers/net/wireless/iwlegacy/iwl-4965-led.c | 73 --------------------------
drivers/net/wireless/iwlegacy/iwl-4965-led.h | 33 ------------
drivers/net/wireless/iwlegacy/iwl-4965.h | 2 +
6 files changed, 33 insertions(+), 109 deletions(-)
delete mode 100644 drivers/net/wireless/iwlegacy/iwl-4965-led.c
delete mode 100644 drivers/net/wireless/iwlegacy/iwl-4965-led.h

diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index df86431..4a8ad8d 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -58,7 +58,6 @@
#include "iwl-sta.h"
#include "iwl-4965-calib.h"
#include "iwl-4965.h"
-#include "iwl-4965-led.h"


/******************************************************************************
diff --git a/drivers/net/wireless/iwlegacy/4965.c b/drivers/net/wireless/iwlegacy/4965.c
index bdfb3a6..8f68b94 100644
--- a/drivers/net/wireless/iwlegacy/4965.c
+++ b/drivers/net/wireless/iwlegacy/4965.c
@@ -44,10 +44,39 @@
#include "iwl-helpers.h"
#include "iwl-4965-calib.h"
#include "iwl-sta.h"
-#include "iwl-4965-led.h"
#include "iwl-4965.h"
#include "iwl-4965-debugfs.h"

+/* Send led command */
+static int
+il4965_send_led_cmd(struct il_priv *il, struct il_led_cmd *led_cmd)
+{
+ struct il_host_cmd cmd = {
+ .id = REPLY_LEDS_CMD,
+ .len = sizeof(struct il_led_cmd),
+ .data = led_cmd,
+ .flags = CMD_ASYNC,
+ .callback = NULL,
+ };
+ u32 reg;
+
+ reg = _il_rd(il, CSR_LED_REG);
+ if (reg != (reg & CSR_LED_BSM_CTRL_MSK))
+ _il_wr(il, CSR_LED_REG, reg & CSR_LED_BSM_CTRL_MSK);
+
+ return il_send_cmd(il, &cmd);
+}
+
+/* Set led register off */
+void il4965_led_enable(struct il_priv *il)
+{
+ _il_wr(il, CSR_LED_REG, CSR_LED_REG_TRUN_ON);
+}
+
+const struct il_led_ops il4965_led_ops = {
+ .cmd = il4965_send_led_cmd,
+};
+
static int il4965_send_tx_power(struct il_priv *il);
static int il4965_hw_get_temperature(struct il_priv *il);

diff --git a/drivers/net/wireless/iwlegacy/Makefile b/drivers/net/wireless/iwlegacy/Makefile
index cd8ac73..b909352 100644
--- a/drivers/net/wireless/iwlegacy/Makefile
+++ b/drivers/net/wireless/iwlegacy/Makefile
@@ -8,7 +8,7 @@ iwl-legacy-objs += $(iwl-legacy-m)

# 4965
obj-$(CONFIG_IWL4965) += iwl4965.o
-iwl4965-objs := 4965.o 4965-mac.o iwl-4965-rs.o iwl-4965-led.o
+iwl4965-objs := 4965.o 4965-mac.o iwl-4965-rs.o
iwl4965-objs += iwl-4965-ucode.o iwl-4965-tx.o
iwl4965-objs += iwl-4965-lib.o iwl-4965-rx.o iwl-4965-calib.o
iwl4965-objs += iwl-4965-sta.o iwl-4965-eeprom.o
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-led.c b/drivers/net/wireless/iwlegacy/iwl-4965-led.c
deleted file mode 100644
index 4854157..0000000
--- a/drivers/net/wireless/iwlegacy/iwl-4965-led.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2003 - 2011 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 <net/mac80211.h>
-#include <linux/etherdevice.h>
-#include <asm/unaligned.h>
-
-#include "iwl-commands.h"
-#include "iwl-dev.h"
-#include "iwl-core.h"
-#include "iwl-io.h"
-#include "iwl-4965-led.h"
-
-/* Send led command */
-static int
-il4965_send_led_cmd(struct il_priv *il, struct il_led_cmd *led_cmd)
-{
- struct il_host_cmd cmd = {
- .id = REPLY_LEDS_CMD,
- .len = sizeof(struct il_led_cmd),
- .data = led_cmd,
- .flags = CMD_ASYNC,
- .callback = NULL,
- };
- u32 reg;
-
- reg = _il_rd(il, CSR_LED_REG);
- if (reg != (reg & CSR_LED_BSM_CTRL_MSK))
- _il_wr(il, CSR_LED_REG, reg & CSR_LED_BSM_CTRL_MSK);
-
- return il_send_cmd(il, &cmd);
-}
-
-/* Set led register off */
-void il4965_led_enable(struct il_priv *il)
-{
- _il_wr(il, CSR_LED_REG, CSR_LED_REG_TRUN_ON);
-}
-
-const struct il_led_ops il4965_led_ops = {
- .cmd = il4965_send_led_cmd,
-};
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-led.h b/drivers/net/wireless/iwlegacy/iwl-4965-led.h
deleted file mode 100644
index e804fe1..0000000
--- a/drivers/net/wireless/iwlegacy/iwl-4965-led.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2003 - 2011 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 __il_4965_led_h__
-#define __il_4965_led_h__
-
-extern const struct il_led_ops il4965_led_ops;
-void il4965_led_enable(struct il_priv *il);
-
-#endif /* __il_4965_led_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.h b/drivers/net/wireless/iwlegacy/iwl-4965.h
index 8076bbe..c0bb45b 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.h
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.h
@@ -279,4 +279,6 @@ int il4965_mac_sta_add(struct ieee80211_hw *hw,
void il4965_mac_channel_switch(struct ieee80211_hw *hw,
struct ieee80211_channel_switch *ch_switch);

+void il4965_led_enable(struct il_priv *il);
+
#endif /* __il_4965_h__ */
--
1.7.1


2011-11-18 08:21:45

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 26/77] iwlegacy: s/TABLE/TBL/

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/iwl-3945-fh.h | 32 +++++++-------
drivers/net/wireless/iwlegacy/iwl-3945.c | 52 ++++++++++++------------
drivers/net/wireless/iwlegacy/iwl-4965-calib.c | 6 +-
drivers/net/wireless/iwlegacy/iwl-4965-rs.c | 8 ++--
drivers/net/wireless/iwlegacy/iwl-4965.c | 6 +-
drivers/net/wireless/iwlegacy/iwl-commands.h | 44 ++++++++++----------
drivers/net/wireless/iwlegacy/iwl-csr.h | 2 +-
drivers/net/wireless/iwlegacy/iwl-dev.h | 2 +-
drivers/net/wireless/iwlegacy/iwl-hcmd.c | 4 +-
drivers/net/wireless/iwlegacy/iwl-legacy-rs.h | 30 +++++++-------
drivers/net/wireless/iwlegacy/iwl-power.c | 2 +-
drivers/net/wireless/iwlegacy/iwl-prph.h | 4 +-
drivers/net/wireless/iwlegacy/iwl-sta.c | 2 +-
drivers/net/wireless/iwlegacy/iwl3945-base.c | 2 +-
drivers/net/wireless/iwlegacy/iwl4965-base.c | 2 +-
15 files changed, 99 insertions(+), 99 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-fh.h b/drivers/net/wireless/iwlegacy/iwl-3945-fh.h
index b98cabb..aa44a90 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-fh.h
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-fh.h
@@ -74,25 +74,25 @@
#define FH39_MEM_LOWER_BOUND (0x0800)
#define FH39_MEM_UPPER_BOUND (0x1000)

-#define FH39_CBCC_TABLE (FH39_MEM_LOWER_BOUND + 0x140)
-#define FH39_TFDB_TABLE (FH39_MEM_LOWER_BOUND + 0x180)
-#define FH39_RCSR_TABLE (FH39_MEM_LOWER_BOUND + 0x400)
-#define FH39_RSSR_TABLE (FH39_MEM_LOWER_BOUND + 0x4c0)
-#define FH39_TCSR_TABLE (FH39_MEM_LOWER_BOUND + 0x500)
-#define FH39_TSSR_TABLE (FH39_MEM_LOWER_BOUND + 0x680)
+#define FH39_CBCC_TBL (FH39_MEM_LOWER_BOUND + 0x140)
+#define FH39_TFDB_TBL (FH39_MEM_LOWER_BOUND + 0x180)
+#define FH39_RCSR_TBL (FH39_MEM_LOWER_BOUND + 0x400)
+#define FH39_RSSR_TBL (FH39_MEM_LOWER_BOUND + 0x4c0)
+#define FH39_TCSR_TBL (FH39_MEM_LOWER_BOUND + 0x500)
+#define FH39_TSSR_TBL (FH39_MEM_LOWER_BOUND + 0x680)

/* TFDB (Transmit Frame Buffer Descriptor) */
-#define FH39_TFDB(_ch, buf) (FH39_TFDB_TABLE + \
+#define FH39_TFDB(_ch, buf) (FH39_TFDB_TBL + \
((_ch) * 2 + (buf)) * 0x28)
-#define FH39_TFDB_CHNL_BUF_CTRL_REG(_ch) (FH39_TFDB_TABLE + 0x50 * (_ch))
+#define FH39_TFDB_CHNL_BUF_CTRL_REG(_ch) (FH39_TFDB_TBL + 0x50 * (_ch))

/* CBCC channel is [0,2] */
-#define FH39_CBCC(_ch) (FH39_CBCC_TABLE + (_ch) * 0x8)
+#define FH39_CBCC(_ch) (FH39_CBCC_TBL + (_ch) * 0x8)
#define FH39_CBCC_CTRL(_ch) (FH39_CBCC(_ch) + 0x00)
#define FH39_CBCC_BASE(_ch) (FH39_CBCC(_ch) + 0x04)

/* RCSR channel is [0,2] */
-#define FH39_RCSR(_ch) (FH39_RCSR_TABLE + (_ch) * 0x40)
+#define FH39_RCSR(_ch) (FH39_RCSR_TBL + (_ch) * 0x40)
#define FH39_RCSR_CONFIG(_ch) (FH39_RCSR(_ch) + 0x00)
#define FH39_RCSR_RBD_BASE(_ch) (FH39_RCSR(_ch) + 0x04)
#define FH39_RCSR_WPTR(_ch) (FH39_RCSR(_ch) + 0x20)
@@ -101,19 +101,19 @@
#define FH39_RSCSR_CHNL0_WPTR (FH39_RCSR_WPTR(0))

/* RSSR */
-#define FH39_RSSR_CTRL (FH39_RSSR_TABLE + 0x000)
-#define FH39_RSSR_STATUS (FH39_RSSR_TABLE + 0x004)
+#define FH39_RSSR_CTRL (FH39_RSSR_TBL + 0x000)
+#define FH39_RSSR_STATUS (FH39_RSSR_TBL + 0x004)

/* TCSR */
-#define FH39_TCSR(_ch) (FH39_TCSR_TABLE + (_ch) * 0x20)
+#define FH39_TCSR(_ch) (FH39_TCSR_TBL + (_ch) * 0x20)
#define FH39_TCSR_CONFIG(_ch) (FH39_TCSR(_ch) + 0x00)
#define FH39_TCSR_CREDIT(_ch) (FH39_TCSR(_ch) + 0x04)
#define FH39_TCSR_BUFF_STTS(_ch) (FH39_TCSR(_ch) + 0x08)

/* TSSR */
-#define FH39_TSSR_CBB_BASE (FH39_TSSR_TABLE + 0x000)
-#define FH39_TSSR_MSG_CONFIG (FH39_TSSR_TABLE + 0x008)
-#define FH39_TSSR_TX_STATUS (FH39_TSSR_TABLE + 0x010)
+#define FH39_TSSR_CBB_BASE (FH39_TSSR_TBL + 0x000)
+#define FH39_TSSR_MSG_CONFIG (FH39_TSSR_TBL + 0x008)
+#define FH39_TSSR_TX_STATUS (FH39_TSSR_TBL + 0x010)


/* DBM */
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.c b/drivers/net/wireless/iwlegacy/iwl-3945.c
index 96a7628..b6abf34 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945.c
@@ -60,8 +60,8 @@
RATE_##rn##M_IDX, \
RATE_##pp##M_IDX, \
RATE_##np##M_IDX, \
- RATE_##r##M_IDX_TABLE, \
- RATE_##ip##M_IDX_TABLE }
+ RATE_##r##M_IDX_TBL, \
+ RATE_##ip##M_IDX_TBL }

/*
* Parameter order:
@@ -1330,7 +1330,7 @@ static void il3945_hw_reg_set_scan_power(struct il_priv *il, u32 scan_tbl_idx,
/* use this channel group's 6Mbit clipping/saturation pwr,
* but cap at regulatory scan power restriction (set during init
* based on eeprom channel data) for this channel. */
- power = min(ch_info->scan_power, clip_pwrs[RATE_6M_IDX_TABLE]);
+ power = min(ch_info->scan_power, clip_pwrs[RATE_6M_IDX_TBL]);

power = min(power, il->tx_power_user_lmt);
scan_power_info->requested_power = power;
@@ -1342,7 +1342,7 @@ static void il3945_hw_reg_set_scan_power(struct il_priv *il, u32 scan_tbl_idx,
* *idx*. */
power_idx = ch_info->power_info[rate_idx].power_table_idx
- (power - ch_info->power_info
- [RATE_6M_IDX_TABLE].requested_power) * 2;
+ [RATE_6M_IDX_TBL].requested_power) * 2;

/* store reference idx that we use when adjusting *all* scan
* powers. So we can accommodate user (all channel) or spectrum
@@ -1394,7 +1394,7 @@ static int il3945_send_tx_power(struct il_priv *il)
}

if (!il_is_channel_valid(ch_info)) {
- D_POWER("Not calling TX_PWR_TABLE_CMD on "
+ D_POWER("Not calling TX_PWR_TBL_CMD on "
"non-Tx channel.\n");
return 0;
}
@@ -1428,7 +1428,7 @@ static int il3945_send_tx_power(struct il_priv *il)
txpower.power[i].rate);
}

- return il_send_cmd_pdu(il, REPLY_TX_PWR_TABLE_CMD,
+ return il_send_cmd_pdu(il, REPLY_TX_PWR_TBL_CMD,
sizeof(struct il3945_txpowertable_cmd),
&txpower);

@@ -1466,7 +1466,7 @@ static int il3945_hw_reg_set_new_power(struct il_priv *il,
power_info = ch_info->power_info;

/* update OFDM Txpower settings */
- for (i = RATE_6M_IDX_TABLE; i <= RATE_54M_IDX_TABLE;
+ for (i = RATE_6M_IDX_TBL; i <= RATE_54M_IDX_TBL;
i++, ++power_info) {
int delta_idx;

@@ -1490,14 +1490,14 @@ static int il3945_hw_reg_set_new_power(struct il_priv *il,
* ... all CCK power settings for a given channel are the *same*. */
if (power_changed) {
power =
- ch_info->power_info[RATE_12M_IDX_TABLE].
+ ch_info->power_info[RATE_12M_IDX_TBL].
requested_power + IL_CCK_FROM_OFDM_POWER_DIFF;

/* do all CCK rates' il3945_channel_power_info structures */
- for (i = RATE_1M_IDX_TABLE; i <= RATE_11M_IDX_TABLE; i++) {
+ for (i = RATE_1M_IDX_TBL; i <= RATE_11M_IDX_TBL; i++) {
power_info->requested_power = power;
power_info->base_power_idx =
- ch_info->power_info[RATE_12M_IDX_TABLE].
+ ch_info->power_info[RATE_12M_IDX_TBL].
base_power_idx + IL_CCK_FROM_OFDM_IDX_DIFF;
++power_info;
}
@@ -1597,7 +1597,7 @@ static int il3945_hw_reg_comp_txpower_temp(struct il_priv *il)
for (scan_tbl_idx = 0;
scan_tbl_idx < IL_NUM_SCAN_RATES; scan_tbl_idx++) {
s32 actual_idx = (scan_tbl_idx == 0) ?
- RATE_1M_IDX_TABLE : RATE_6M_IDX_TABLE;
+ RATE_1M_IDX_TBL : RATE_6M_IDX_TBL;
il3945_hw_reg_set_scan_power(il, scan_tbl_idx,
actual_idx, clip_pwrs,
ch_info, a_band);
@@ -2012,19 +2012,19 @@ static void il3945_hw_reg_init_channel_groups(struct il_priv *il)
for (rate_idx = 0;
rate_idx < RATE_COUNT_3945; rate_idx++, clip_pwrs++) {
switch (rate_idx) {
- case RATE_36M_IDX_TABLE:
+ case RATE_36M_IDX_TBL:
if (i == 0) /* B/G */
*clip_pwrs = satur_pwr;
else /* A */
*clip_pwrs = satur_pwr - 5;
break;
- case RATE_48M_IDX_TABLE:
+ case RATE_48M_IDX_TBL:
if (i == 0)
*clip_pwrs = satur_pwr - 7;
else
*clip_pwrs = satur_pwr - 10;
break;
- case RATE_54M_IDX_TABLE:
+ case RATE_54M_IDX_TBL:
if (i == 0)
*clip_pwrs = satur_pwr - 9;
else
@@ -2139,7 +2139,7 @@ int il3945_txpower_set_from_eeprom(struct il_priv *il)
}

/* set tx power for CCK rates, based on OFDM 12 Mbit settings*/
- pwr_info = &ch_info->power_info[RATE_12M_IDX_TABLE];
+ pwr_info = &ch_info->power_info[RATE_12M_IDX_TBL];
power = pwr_info->requested_power +
IL_CCK_FROM_OFDM_POWER_DIFF;
pwr_idx = pwr_info->power_table_idx +
@@ -2169,7 +2169,7 @@ int il3945_txpower_set_from_eeprom(struct il_priv *il)
for (scan_tbl_idx = 0;
scan_tbl_idx < IL_NUM_SCAN_RATES; scan_tbl_idx++) {
s32 actual_idx = (scan_tbl_idx == 0) ?
- RATE_1M_IDX_TABLE : RATE_6M_IDX_TABLE;
+ RATE_1M_IDX_TBL : RATE_6M_IDX_TBL;
il3945_hw_reg_set_scan_power(il, scan_tbl_idx,
actual_idx, clip_pwrs, ch_info, a_band);
}
@@ -2223,7 +2223,7 @@ static u16 il3945_get_hcmd_size(u8 cmd_id, u16 len)
switch (cmd_id) {
case REPLY_RXON:
return sizeof(struct il3945_rxon_cmd);
- case POWER_TABLE_CMD:
+ case POWER_TBL_CMD:
return sizeof(struct il3945_powertable_cmd);
default:
return len;
@@ -2326,17 +2326,17 @@ int il3945_init_hw_rate_table(struct il_priv *il)
D_RATE("Select A mode rate scale\n");
/* If one of the following CCK rates is used,
* have it fall back to the 6M OFDM rate */
- for (i = RATE_1M_IDX_TABLE;
- i <= RATE_11M_IDX_TABLE; i++)
+ for (i = RATE_1M_IDX_TBL;
+ i <= RATE_11M_IDX_TBL; i++)
table[i].next_rate_idx =
il3945_rates[IL_FIRST_OFDM_RATE].table_rs_idx;

/* Don't fall back to CCK rates */
- table[RATE_12M_IDX_TABLE].next_rate_idx =
- RATE_9M_IDX_TABLE;
+ table[RATE_12M_IDX_TBL].next_rate_idx =
+ RATE_9M_IDX_TBL;

/* Don't drop out of OFDM rates */
- table[RATE_6M_IDX_TABLE].next_rate_idx =
+ table[RATE_6M_IDX_TBL].next_rate_idx =
il3945_rates[IL_FIRST_OFDM_RATE].table_rs_idx;
break;

@@ -2349,14 +2349,14 @@ int il3945_init_hw_rate_table(struct il_priv *il)
il_is_associated(il)) {

idx = IL_FIRST_CCK_RATE;
- for (i = RATE_6M_IDX_TABLE;
- i <= RATE_54M_IDX_TABLE; i++)
+ for (i = RATE_6M_IDX_TBL;
+ i <= RATE_54M_IDX_TBL; i++)
table[i].next_rate_idx =
il3945_rates[idx].table_rs_idx;

- idx = RATE_11M_IDX_TABLE;
+ idx = RATE_11M_IDX_TBL;
/* CCK shouldn't fall back to OFDM... */
- table[idx].next_rate_idx = RATE_5M_IDX_TABLE;
+ table[idx].next_rate_idx = RATE_5M_IDX_TBL;
}
break;

diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-calib.c b/drivers/net/wireless/iwlegacy/iwl-4965-calib.c
index d622b27..1d873a6 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-calib.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-calib.c
@@ -429,18 +429,18 @@ static int il4965_sensitivity_write(struct il_priv *il)
il4965_prepare_legacy_sensitivity_tbl(il, data, &cmd.table[0]);

/* Update uCode's "work" table, and copy it to DSP */
- cmd.control = SENSITIVITY_CMD_CONTROL_WORK_TABLE;
+ cmd.control = SENSITIVITY_CMD_CONTROL_WORK_TBL;

/* Don't send command to uCode if nothing has changed */
if (!memcmp(&cmd.table[0], &(il->sensitivity_tbl[0]),
- sizeof(u16)*HD_TABLE_SIZE)) {
+ sizeof(u16)*HD_TBL_SIZE)) {
D_CALIB("No change in SENSITIVITY_CMD\n");
return 0;
}

/* Copy table for comparison next time */
memcpy(&(il->sensitivity_tbl[0]), &(cmd.table[0]),
- sizeof(u16)*HD_TABLE_SIZE);
+ sizeof(u16)*HD_TBL_SIZE);

return il_send_cmd(il, &cmd_out);
}
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
index b8f8064..4a54311 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
@@ -1001,11 +1001,11 @@ static void il4965_rs_set_stay_in_table(struct il_priv *il, u8 is_legacy,
D_RATE("we are staying in the same table\n");
lq_sta->stay_in_tbl = 1; /* only place this gets set */
if (is_legacy) {
- lq_sta->table_count_limit = IL_LEGACY_TABLE_COUNT;
+ lq_sta->table_count_limit = IL_LEGACY_TBL_COUNT;
lq_sta->max_failure_limit = IL_LEGACY_FAILURE_LIMIT;
lq_sta->max_success_limit = IL_LEGACY_SUCCESS_LIMIT;
} else {
- lq_sta->table_count_limit = IL_NONE_LEGACY_TABLE_COUNT;
+ lq_sta->table_count_limit = IL_NONE_LEGACY_TBL_COUNT;
lq_sta->max_failure_limit = IL_NONE_LEGACY_FAILURE_LIMIT;
lq_sta->max_success_limit = IL_NONE_LEGACY_SUCCESS_LIMIT;
}
@@ -1916,7 +1916,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
* continuing to use the setup that we've been trying. */
if (win->average_tpt > lq_sta->last_tpt) {

- D_RATE("LQ: SWITCHING TO NEW TABLE "
+ D_RATE("LQ: SWITCHING TO NEW TBL "
"suc=%d cur-tpt=%d old-tpt=%d\n",
win->success_ratio,
win->average_tpt,
@@ -1932,7 +1932,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
/* Else poor success; go back to mode in "active" table */
} else {

- D_RATE("LQ: GOING BACK TO THE OLD TABLE "
+ D_RATE("LQ: GOING BACK TO THE OLD TBL "
"suc=%d cur-tpt=%d old-tpt=%d\n",
win->success_ratio,
win->average_tpt,
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c
index 8fd383e..bdfb3a6 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.c
@@ -1010,7 +1010,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel,
}

/* for each of 33 bit-rates (including 1 for CCK) */
- for (i = 0; i < POWER_TABLE_NUM_ENTRIES; i++) {
+ for (i = 0; i < POWER_TBL_NUM_ENTRIES; i++) {
u8 is_mimo_rate;
union il4965_tx_power_dual_stream tx_power;

@@ -1072,7 +1072,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel,
power_idx += 9;

/* CCK, rate 32, reduce txpower for CCK */
- if (i == POWER_TABLE_CCK_ENTRY)
+ if (i == POWER_TBL_CCK_ENTRY)
power_idx +=
IL_TX_POWER_CCK_COMPENSATION_C_STEP;

@@ -1144,7 +1144,7 @@ static int il4965_send_tx_power(struct il_priv *il)
goto out;

ret = il_send_cmd_pdu(il,
- REPLY_TX_PWR_TABLE_CMD, sizeof(cmd), &cmd);
+ REPLY_TX_PWR_TBL_CMD, sizeof(cmd), &cmd);

out:
return ret;
diff --git a/drivers/net/wireless/iwlegacy/iwl-commands.h b/drivers/net/wireless/iwlegacy/iwl-commands.h
index 4083912..e6688b1 100644
--- a/drivers/net/wireless/iwlegacy/iwl-commands.h
+++ b/drivers/net/wireless/iwlegacy/iwl-commands.h
@@ -114,7 +114,7 @@ enum {
SPECTRUM_MEASURE_NOTIFICATION = 0x75,

/* Power Management */
- POWER_TABLE_CMD = 0x77,
+ POWER_TBL_CMD = 0x77,
PM_SLEEP_NOTIFICATION = 0x7A,
PM_DEBUG_STATISTIC_NOTIFIC = 0x7B,

@@ -130,7 +130,7 @@ enum {
REPLY_TX_BEACON = 0x91,

/* Miscellaneous commands */
- REPLY_TX_PWR_TABLE_CMD = 0x97,
+ REPLY_TX_PWR_TBL_CMD = 0x97,

/* Bluetooth device coexistence config command */
REPLY_BT_CONFIG = 0x9b,
@@ -214,7 +214,7 @@ struct il_cmd_header {
/**
* struct il3945_tx_power
*
- * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
+ * Used in REPLY_TX_PWR_TBL_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
*
* Each entry contains two values:
* 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained
@@ -233,7 +233,7 @@ struct il3945_tx_power {
/**
* struct il3945_power_per_rate
*
- * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
+ * Used in REPLY_TX_PWR_TBL_CMD, REPLY_CHANNEL_SWITCH
*/
struct il3945_power_per_rate {
u8 rate; /* plcp */
@@ -326,9 +326,9 @@ struct il3945_power_per_rate {
#define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK)
#define RATE_ANT_NUM 3

-#define POWER_TABLE_NUM_ENTRIES 33
-#define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32
-#define POWER_TABLE_CCK_ENTRY 32
+#define POWER_TBL_NUM_ENTRIES 33
+#define POWER_TBL_NUM_HT_OFDM_ENTRIES 32
+#define POWER_TBL_CCK_ENTRY 32

#define IL_PWR_NUM_HT_OFDM_ENTRIES 24
#define IL_PWR_CCK_ENTRIES 2
@@ -336,7 +336,7 @@ struct il3945_power_per_rate {
/**
* union il4965_tx_power_dual_stream
*
- * Host format used for REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
+ * Host format used for REPLY_TX_PWR_TBL_CMD, REPLY_CHANNEL_SWITCH
* Use __le32 version (struct tx_power_dual_stream) when building command.
*
* Driver provides radio gain and DSP attenuation settings to device in pairs,
@@ -360,7 +360,7 @@ union il4965_tx_power_dual_stream {
/**
* struct tx_power_dual_stream
*
- * Table entries in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
+ * Table entries in REPLY_TX_PWR_TBL_CMD, REPLY_CHANNEL_SWITCH
*
* Same format as il_tx_power_dual_stream, but __le32
*/
@@ -371,10 +371,10 @@ struct tx_power_dual_stream {
/**
* struct il4965_tx_power_db
*
- * Entire table within REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
+ * Entire table within REPLY_TX_PWR_TBL_CMD, REPLY_CHANNEL_SWITCH
*/
struct il4965_tx_power_db {
- struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
+ struct tx_power_dual_stream power_tbl[POWER_TBL_NUM_ENTRIES];
} __packed;

/******************************************************************************
@@ -653,7 +653,7 @@ enum {
* channel.
*
* NOTE: All RXONs wipe clean the internal txpower table. Driver must
- * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
+ * issue a new REPLY_TX_PWR_TBL_CMD after each REPLY_RXON (0x10),
* regardless of whether RXON_FILTER_ASSOC_MSK is set.
*/

@@ -1067,7 +1067,7 @@ struct il_addsta_cmd {


#define ADD_STA_SUCCESS_MSK 0x1
-#define ADD_STA_NO_ROOM_IN_TABLE 0x2
+#define ADD_STA_NO_ROOM_IN_TBL 0x2
#define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4
#define ADD_STA_MODIFY_NON_EXIST_STA 0x8
/*
@@ -1271,7 +1271,7 @@ struct il_rx_mpdu_res_start {
* command, as set up by the REPLY_RATE_SCALE (for 3945) or
* REPLY_TX_LINK_QUALITY_CMD (4965).
*
- * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD.
+ * Driver sets up transmit power for various rates via REPLY_TX_PWR_TBL_CMD.
* This command must be executed after every RXON command, before Tx can occur.
*****************************************************************************/

@@ -1754,7 +1754,7 @@ struct il_compressed_ba_resp {
} __packed;

/*
- * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
+ * REPLY_TX_PWR_TBL_CMD = 0x97 (command, has simple generic response)
*
* See details under "TXPOWER" in iwl-4965-hw.h.
*/
@@ -1909,7 +1909,7 @@ struct il_link_qual_agg_params {
* procedures are possible, and may work better for particular environments.
*
*
- * FILLING THE RATE TABLE
+ * FILLING THE RATE TBL
*
* Given a particular initial rate and mode, as determined by the rate
* scaling algorithm described below, the Linux driver uses the following
@@ -2263,7 +2263,7 @@ struct il_spectrum_notification {
* struct il_powertable_cmd - Power Table Command
* @flags: See below:
*
- * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
+ * POWER_TBL_CMD = 0x77 (command, has simple generic response)
*
* PM allow:
* bit 0 - '0' Driver not allow power management
@@ -2290,7 +2290,7 @@ struct il_spectrum_notification {
* '10' force xtal sleep
* '11' Illegal set
*
- * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then
+ * NOTE: if sleep_interval[SLEEP_INTRVL_TBL_SIZE-1] > DTIM period then
* ucode assume sleep over DTIM is allowed and we don't need to wake up
* for every DTIM.
*/
@@ -3219,7 +3219,7 @@ struct il_missed_beacon_notif {
/*
* Table entries in SENSITIVITY_CMD (struct il_sensitivity_cmd)
*/
-#define HD_TABLE_SIZE (11) /* number of entries */
+#define HD_TBL_SIZE (11) /* number of entries */
#define HD_MIN_ENERGY_CCK_DET_IDX (0) /* table idxes */
#define HD_MIN_ENERGY_OFDM_DET_IDX (1)
#define HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX (2)
@@ -3233,8 +3233,8 @@ struct il_missed_beacon_notif {
#define HD_OFDM_ENERGY_TH_IN_IDX (10)

/* Control field in struct il_sensitivity_cmd */
-#define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE cpu_to_le16(0)
-#define SENSITIVITY_CMD_CONTROL_WORK_TABLE cpu_to_le16(1)
+#define SENSITIVITY_CMD_CONTROL_DEFAULT_TBL cpu_to_le16(0)
+#define SENSITIVITY_CMD_CONTROL_WORK_TBL cpu_to_le16(1)

/**
* struct il_sensitivity_cmd
@@ -3245,7 +3245,7 @@ struct il_missed_beacon_notif {
*/
struct il_sensitivity_cmd {
__le16 control; /* always use "1" */
- __le16 table[HD_TABLE_SIZE]; /* use HD_* as idx */
+ __le16 table[HD_TBL_SIZE]; /* use HD_* as idx */
} __packed;


diff --git a/drivers/net/wireless/iwlegacy/iwl-csr.h b/drivers/net/wireless/iwlegacy/iwl-csr.h
index 34edec3..4db0429 100644
--- a/drivers/net/wireless/iwlegacy/iwl-csr.h
+++ b/drivers/net/wireless/iwlegacy/iwl-csr.h
@@ -357,7 +357,7 @@
/* HPET MEM debug */
#define CSR_DBG_HPET_MEM_REG_VAL (0xFFFF0000)

-/* DRAM INT TABLE */
+/* DRAM INT TBL */
#define CSR_DRAM_INT_TBL_ENABLE (1 << 31)
#define CSR_DRAM_INIT_TBL_WRAP_CHECK (1 << 27)

diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h
index 2555f9f..7c86d19 100644
--- a/drivers/net/wireless/iwlegacy/iwl-dev.h
+++ b/drivers/net/wireless/iwlegacy/iwl-dev.h
@@ -1060,7 +1060,7 @@ struct il_priv {
u8 start_calib;
struct il_sensitivity_data sensitivity_data;
struct il_chain_noise_data chain_noise_data;
- __le16 sensitivity_tbl[HD_TABLE_SIZE];
+ __le16 sensitivity_tbl[HD_TBL_SIZE];

struct il_ht_config current_ht_config;

diff --git a/drivers/net/wireless/iwlegacy/iwl-hcmd.c b/drivers/net/wireless/iwlegacy/iwl-hcmd.c
index e63777b..0b11f2f 100644
--- a/drivers/net/wireless/iwlegacy/iwl-hcmd.c
+++ b/drivers/net/wireless/iwlegacy/iwl-hcmd.c
@@ -58,7 +58,7 @@ const char *il_get_cmd_string(u8 cmd)
IL_CMD(CHANNEL_SWITCH_NOTIFICATION);
IL_CMD(REPLY_SPECTRUM_MEASUREMENT_CMD);
IL_CMD(SPECTRUM_MEASURE_NOTIFICATION);
- IL_CMD(POWER_TABLE_CMD);
+ IL_CMD(POWER_TBL_CMD);
IL_CMD(PM_SLEEP_NOTIFICATION);
IL_CMD(PM_DEBUG_STATISTIC_NOTIFIC);
IL_CMD(REPLY_SCAN_CMD);
@@ -68,7 +68,7 @@ const char *il_get_cmd_string(u8 cmd)
IL_CMD(SCAN_COMPLETE_NOTIFICATION);
IL_CMD(BEACON_NOTIFICATION);
IL_CMD(REPLY_TX_BEACON);
- IL_CMD(REPLY_TX_PWR_TABLE_CMD);
+ IL_CMD(REPLY_TX_PWR_TBL_CMD);
IL_CMD(REPLY_BT_CONFIG);
IL_CMD(REPLY_STATISTICS_CMD);
IL_CMD(STATISTICS_NOTIFICATION);
diff --git a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
index bc09a5d..58e04cb 100644
--- a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
+++ b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
@@ -80,19 +80,19 @@ enum {
};

enum {
- RATE_6M_IDX_TABLE = 0,
- RATE_9M_IDX_TABLE,
- RATE_12M_IDX_TABLE,
- RATE_18M_IDX_TABLE,
- RATE_24M_IDX_TABLE,
- RATE_36M_IDX_TABLE,
- RATE_48M_IDX_TABLE,
- RATE_54M_IDX_TABLE,
- RATE_1M_IDX_TABLE,
- RATE_2M_IDX_TABLE,
- RATE_5M_IDX_TABLE,
- RATE_11M_IDX_TABLE,
- RATE_INVM_IDX_TABLE = RATE_INVM_IDX - 1,
+ RATE_6M_IDX_TBL = 0,
+ RATE_9M_IDX_TBL,
+ RATE_12M_IDX_TBL,
+ RATE_18M_IDX_TBL,
+ RATE_24M_IDX_TBL,
+ RATE_36M_IDX_TBL,
+ RATE_48M_IDX_TBL,
+ RATE_54M_IDX_TBL,
+ RATE_1M_IDX_TBL,
+ RATE_2M_IDX_TBL,
+ RATE_5M_IDX_TBL,
+ RATE_11M_IDX_TBL,
+ RATE_INVM_IDX_TBL = RATE_INVM_IDX - 1,
};

enum {
@@ -213,11 +213,11 @@ enum {
* searching for a new modulation mode */
#define IL_LEGACY_FAILURE_LIMIT 160
#define IL_LEGACY_SUCCESS_LIMIT 480
-#define IL_LEGACY_TABLE_COUNT 160
+#define IL_LEGACY_TBL_COUNT 160

#define IL_NONE_LEGACY_FAILURE_LIMIT 400
#define IL_NONE_LEGACY_SUCCESS_LIMIT 4500
-#define IL_NONE_LEGACY_TABLE_COUNT 1500
+#define IL_NONE_LEGACY_TBL_COUNT 1500

/* Success ratio (ACKed / attempted tx frames) values (perfect is 128 * 100) */
#define IL_RS_GOOD_RATIO 12800 /* 100% */
diff --git a/drivers/net/wireless/iwlegacy/iwl-power.c b/drivers/net/wireless/iwlegacy/iwl-power.c
index 6c6e5e7..051623a 100644
--- a/drivers/net/wireless/iwlegacy/iwl-power.c
+++ b/drivers/net/wireless/iwlegacy/iwl-power.c
@@ -88,7 +88,7 @@ il_set_power(struct il_priv *il, struct il_powertable_cmd *cmd)
le32_to_cpu(cmd->sleep_interval[3]),
le32_to_cpu(cmd->sleep_interval[4]));

- return il_send_cmd_pdu(il, POWER_TABLE_CMD,
+ return il_send_cmd_pdu(il, POWER_TBL_CMD,
sizeof(struct il_powertable_cmd), cmd);
}

diff --git a/drivers/net/wireless/iwlegacy/iwl-prph.h b/drivers/net/wireless/iwlegacy/iwl-prph.h
index 8128c87..e34d907 100644
--- a/drivers/net/wireless/iwlegacy/iwl-prph.h
+++ b/drivers/net/wireless/iwlegacy/iwl-prph.h
@@ -189,7 +189,7 @@
* procedure.
*
* This save/restore method is mostly for autonomous power management during
- * normal operation (result of POWER_TABLE_CMD). Platform suspend/resume and
+ * normal operation (result of POWER_TBL_CMD). Platform suspend/resume and
* RFKILL should use complete restarts (with total re-initialization) of uCode,
* allowing total shutdown (including BSM memory).
*
@@ -494,7 +494,7 @@
* When queue is in Scheduler-ACK mode, frames placed in a that queue must be
* for only one combination of receiver address (RA) and traffic ID (TID), i.e.
* one QOS priority level destined for one station (for this wireless link,
- * not final destination). The SCD_TRANSLATE_TABLE area provides 16 16-bit
+ * not final destination). The SCD_TRANSLATE_TBL area provides 16 16-bit
* mappings, one for each of the 16 queues. If queue is not in Scheduler-ACK
* mode, the device ignores the mapping value.
*
diff --git a/drivers/net/wireless/iwlegacy/iwl-sta.c b/drivers/net/wireless/iwlegacy/iwl-sta.c
index a7fe9ea..ffb966b 100644
--- a/drivers/net/wireless/iwlegacy/iwl-sta.c
+++ b/drivers/net/wireless/iwlegacy/iwl-sta.c
@@ -83,7 +83,7 @@ static int il_process_add_sta_resp(struct il_priv *il,
il_sta_ucode_activate(il, sta_id);
ret = 0;
break;
- case ADD_STA_NO_ROOM_IN_TABLE:
+ case ADD_STA_NO_ROOM_IN_TBL:
IL_ERR("Adding station %d failed, no room in table.\n",
sta_id);
break;
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index 9244208..41104e7 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -885,7 +885,7 @@ static void il3945_setup_rx_handlers(struct il_priv *il)
* Rx theory of operation
*
* The host allocates 32 DMA target addresses and passes the host address
- * to the firmware at register IL_RFDS_TABLE_LOWER + N * RFD_SIZE where N is
+ * to the firmware at register IL_RFDS_TBL_LOWER + N * RFD_SIZE where N is
* 0 to 31
*
* Rx Queue Indexes
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
index afdec78..043d51e 100644
--- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
@@ -1470,7 +1470,7 @@ static const char * const desc_lookup_text[] = {
"HW_ERROR_TUNE_LOCK",
"HW_ERROR_TEMPERATURE",
"ILLEGAL_CHAN_FREQ",
- "VCC_NOT_STABLE",
+ "VCC_NOT_STBL",
"FH_ERROR",
"NMI_INTERRUPT_HOST",
"NMI_INTERRUPT_ACTION_PT",
--
1.7.1


2011-11-18 23:03:08

by Pavel Roskin

[permalink] [raw]
Subject: Re: [PATCH 43/77] iwlegacy: rename REPLY_ to N_ or C_

On Fri, 18 Nov 2011 09:22:05 +0100
Stanislaw Gruszka <[email protected]> wrote:

> Signed-off-by: Stanislaw Gruszka <[email protected]>

The explanation for the change is missing.

--
Regards,
Pavel Roskin

2011-11-18 08:22:19

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 40/77] iwlegacy: move iwl-3945-{,hw,fh,debugfs}.h to 3945.h

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/3945-debug.c | 5 +-
drivers/net/wireless/iwlegacy/3945-mac.c | 3 +-
drivers/net/wireless/iwlegacy/3945-rs.c | 2 +-
drivers/net/wireless/iwlegacy/3945.c | 4 +-
drivers/net/wireless/iwlegacy/3945.h | 667 ++++++++++++++++++++++
drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h | 60 --
drivers/net/wireless/iwlegacy/iwl-3945-fh.h | 187 ------
drivers/net/wireless/iwlegacy/iwl-3945-hw.h | 291 ----------
drivers/net/wireless/iwlegacy/iwl-3945.h | 308 ----------
drivers/net/wireless/iwlegacy/iwl-dev.h | 3 +-
10 files changed, 675 insertions(+), 855 deletions(-)
create mode 100644 drivers/net/wireless/iwlegacy/3945.h
delete mode 100644 drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h
delete mode 100644 drivers/net/wireless/iwlegacy/iwl-3945-fh.h
delete mode 100644 drivers/net/wireless/iwlegacy/iwl-3945-hw.h
delete mode 100644 drivers/net/wireless/iwlegacy/iwl-3945.h

diff --git a/drivers/net/wireless/iwlegacy/3945-debug.c b/drivers/net/wireless/iwlegacy/3945-debug.c
index 88b3d8f..9c837c3 100644
--- a/drivers/net/wireless/iwlegacy/3945-debug.c
+++ b/drivers/net/wireless/iwlegacy/3945-debug.c
@@ -26,8 +26,9 @@
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*****************************************************************************/

-#include "iwl-3945-debugfs.h"
-
+#include "iwl-dev.h"
+#include "iwl-core.h"
+#include "3945.h"

static int il3945_stats_flag(struct il_priv *il, char *buf, int bufsz)
{
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
index 151c8fa..17edbdf 100644
--- a/drivers/net/wireless/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
@@ -52,10 +52,9 @@
#define DRV_NAME "iwl3945"

#include "iwl-fh.h"
-#include "iwl-3945-fh.h"
#include "iwl-commands.h"
#include "iwl-sta.h"
-#include "iwl-3945.h"
+#include "3945.h"
#include "iwl-core.h"
#include "iwl-helpers.h"
#include "iwl-dev.h"
diff --git a/drivers/net/wireless/iwlegacy/3945-rs.c b/drivers/net/wireless/iwlegacy/3945-rs.c
index f84ed5e..0d2beba 100644
--- a/drivers/net/wireless/iwlegacy/3945-rs.c
+++ b/drivers/net/wireless/iwlegacy/3945-rs.c
@@ -37,7 +37,7 @@
#include <linux/workqueue.h>

#include "iwl-commands.h"
-#include "iwl-3945.h"
+#include "3945.h"
#include "iwl-sta.h"

#define RS_NAME "iwl-3945-rs"
diff --git a/drivers/net/wireless/iwlegacy/3945.c b/drivers/net/wireless/iwlegacy/3945.c
index b41e60b..17615c3 100644
--- a/drivers/net/wireless/iwlegacy/3945.c
+++ b/drivers/net/wireless/iwlegacy/3945.c
@@ -40,15 +40,13 @@
#include <net/mac80211.h>

#include "iwl-fh.h"
-#include "iwl-3945-fh.h"
#include "iwl-commands.h"
#include "iwl-sta.h"
-#include "iwl-3945.h"
#include "iwl-eeprom.h"
#include "iwl-core.h"
#include "iwl-helpers.h"
#include "iwl-led.h"
-#include "iwl-3945-debugfs.h"
+#include "3945.h"

/* Send led command */
static int il3945_send_led_cmd(struct il_priv *il,
diff --git a/drivers/net/wireless/iwlegacy/3945.h b/drivers/net/wireless/iwlegacy/3945.h
new file mode 100644
index 0000000..d65565f
--- /dev/null
+++ b/drivers/net/wireless/iwlegacy/3945.h
@@ -0,0 +1,667 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2003 - 2011 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 __il_3945_h__
+#define __il_3945_h__
+
+#include <linux/pci.h> /* for struct pci_device_id */
+#include <linux/kernel.h>
+#include <net/ieee80211_radiotap.h>
+
+/* Hardware specific file defines the PCI IDs table for that hardware module */
+extern const struct pci_device_id il3945_hw_card_ids[];
+
+#include "iwl-csr.h"
+#include "iwl-prph.h"
+#include "iwl-fh.h"
+#include "iwl-debug.h"
+#include "iwl-power.h"
+#include "iwl-dev.h"
+#include "iwl-led.h"
+#include "iwl-eeprom.h"
+
+/* Highest firmware API version supported */
+#define IL3945_UCODE_API_MAX 2
+
+/* Lowest firmware API version supported */
+#define IL3945_UCODE_API_MIN 1
+
+#define IL3945_FW_PRE "iwlwifi-3945-"
+#define _IL3945_MODULE_FIRMWARE(api) IL3945_FW_PRE #api ".ucode"
+#define IL3945_MODULE_FIRMWARE(api) _IL3945_MODULE_FIRMWARE(api)
+
+/* Default noise level to report when noise measurement is not available.
+ * This may be because we're:
+ * 1) Not associated (4965, no beacon stats being sent to driver)
+ * 2) Scanning (noise measurement does not apply to associated channel)
+ * 3) Receiving CCK (3945 delivers noise info only for OFDM frames)
+ * Use default noise value of -127 ... this is below the range of measurable
+ * Rx dBm for either 3945 or 4965, so it can indicate "unmeasurable" to user.
+ * Also, -127 works better than 0 when averaging frames with/without
+ * noise info (e.g. averaging might be done in app); measured dBm values are
+ * always negative ... using a negative value as the default keeps all
+ * averages within an s8's (used in some apps) range of negative values. */
+#define IL_NOISE_MEAS_NOT_AVAILABLE (-127)
+
+/* Module parameters accessible from iwl-*.c */
+extern struct il_mod_params il3945_mod_params;
+
+struct il3945_rate_scale_data {
+ u64 data;
+ s32 success_counter;
+ s32 success_ratio;
+ s32 counter;
+ s32 average_tpt;
+ unsigned long stamp;
+};
+
+struct il3945_rs_sta {
+ spinlock_t lock;
+ struct il_priv *il;
+ s32 *expected_tpt;
+ unsigned long last_partial_flush;
+ unsigned long last_flush;
+ u32 flush_time;
+ u32 last_tx_packets;
+ u32 tx_packets;
+ u8 tgg;
+ u8 flush_pending;
+ u8 start_rate;
+ struct timer_list rate_scale_flush;
+ struct il3945_rate_scale_data win[RATE_COUNT_3945];
+#ifdef CONFIG_MAC80211_DEBUGFS
+ struct dentry *rs_sta_dbgfs_stats_table_file;
+#endif
+
+ /* used to be in sta_info */
+ int last_txrate_idx;
+};
+
+
+/*
+ * The common struct MUST be first because it is shared between
+ * 3945 and 4965!
+ */
+struct il3945_sta_priv {
+ struct il_station_priv_common common;
+ struct il3945_rs_sta rs_sta;
+};
+
+enum il3945_antenna {
+ IL_ANTENNA_DIVERSITY,
+ IL_ANTENNA_MAIN,
+ IL_ANTENNA_AUX
+};
+
+/*
+ * RTS threshold here is total size [2347] minus 4 FCS bytes
+ * Per spec:
+ * a value of 0 means RTS on all data/management packets
+ * a value > max MSDU size means no RTS
+ * else RTS for data/management frames where MPDU is larger
+ * than RTS value.
+ */
+#define DEFAULT_RTS_THRESHOLD 2347U
+#define MIN_RTS_THRESHOLD 0U
+#define MAX_RTS_THRESHOLD 2347U
+#define MAX_MSDU_SIZE 2304U
+#define MAX_MPDU_SIZE 2346U
+#define DEFAULT_BEACON_INTERVAL 100U
+#define DEFAULT_SHORT_RETRY_LIMIT 7U
+#define DEFAULT_LONG_RETRY_LIMIT 4U
+
+#define IL_TX_FIFO_AC0 0
+#define IL_TX_FIFO_AC1 1
+#define IL_TX_FIFO_AC2 2
+#define IL_TX_FIFO_AC3 3
+#define IL_TX_FIFO_HCCA_1 5
+#define IL_TX_FIFO_HCCA_2 6
+#define IL_TX_FIFO_NONE 7
+
+#define IEEE80211_DATA_LEN 2304
+#define IEEE80211_4ADDR_LEN 30
+#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
+#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
+
+struct il3945_frame {
+ union {
+ struct ieee80211_hdr frame;
+ struct il3945_tx_beacon_cmd beacon;
+ u8 raw[IEEE80211_FRAME_LEN];
+ u8 cmd[360];
+ } u;
+ struct list_head list;
+};
+
+#define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
+#define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
+#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
+
+#define SUP_RATE_11A_MAX_NUM_CHANNELS 8
+#define SUP_RATE_11B_MAX_NUM_CHANNELS 4
+#define SUP_RATE_11G_MAX_NUM_CHANNELS 12
+
+#define IL_SUPPORTED_RATES_IE_LEN 8
+
+#define SCAN_INTERVAL 100
+
+#define MAX_TID_COUNT 9
+
+#define IL_INVALID_RATE 0xFF
+#define IL_INVALID_VALUE -1
+
+#define STA_PS_STATUS_WAKE 0
+#define STA_PS_STATUS_SLEEP 1
+
+struct il3945_ibss_seq {
+ u8 mac[ETH_ALEN];
+ u16 seq_num;
+ u16 frag_num;
+ unsigned long packet_time;
+ struct list_head list;
+};
+
+#define IL_RX_HDR(x) ((struct il3945_rx_frame_hdr *)(\
+ x->u.rx_frame.stats.payload + \
+ x->u.rx_frame.stats.phy_count))
+#define IL_RX_END(x) ((struct il3945_rx_frame_end *)(\
+ IL_RX_HDR(x)->payload + \
+ le16_to_cpu(IL_RX_HDR(x)->len)))
+#define IL_RX_STATS(x) (&x->u.rx_frame.stats)
+#define IL_RX_DATA(x) (IL_RX_HDR(x)->payload)
+
+
+/******************************************************************************
+ *
+ * Functions implemented in iwl3945-base.c which are forward declared here
+ * for use by iwl-*.c
+ *
+ *****************************************************************************/
+extern int il3945_calc_db_from_ratio(int sig_ratio);
+extern void il3945_rx_replenish(void *data);
+extern void il3945_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq);
+extern unsigned int il3945_fill_beacon_frame(struct il_priv *il,
+ struct ieee80211_hdr *hdr, int left);
+extern int il3945_dump_nic_event_log(struct il_priv *il, bool full_log,
+ char **buf, bool display);
+extern void il3945_dump_nic_error_log(struct il_priv *il);
+
+/******************************************************************************
+ *
+ * Functions implemented in iwl-[34]*.c which are forward declared here
+ * for use by iwl3945-base.c
+ *
+ * NOTE: The implementation of these functions are hardware specific
+ * which is why they are in the hardware specific files (vs. iwl-base.c)
+ *
+ * Naming convention --
+ * il3945_ <-- Its part of iwlwifi (should be changed to il3945_)
+ * il3945_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW)
+ * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX)
+ * il3945_bg_ <-- Called from work queue context
+ * il3945_mac_ <-- mac80211 callback
+ *
+ ****************************************************************************/
+extern void il3945_hw_rx_handler_setup(struct il_priv *il);
+extern void il3945_hw_setup_deferred_work(struct il_priv *il);
+extern void il3945_hw_cancel_deferred_work(struct il_priv *il);
+extern int il3945_hw_rxq_stop(struct il_priv *il);
+extern int il3945_hw_set_hw_params(struct il_priv *il);
+extern int il3945_hw_nic_init(struct il_priv *il);
+extern int il3945_hw_nic_stop_master(struct il_priv *il);
+extern void il3945_hw_txq_ctx_free(struct il_priv *il);
+extern void il3945_hw_txq_ctx_stop(struct il_priv *il);
+extern int il3945_hw_nic_reset(struct il_priv *il);
+extern int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il,
+ struct il_tx_queue *txq,
+ dma_addr_t addr, u16 len,
+ u8 reset, u8 pad);
+extern void il3945_hw_txq_free_tfd(struct il_priv *il,
+ struct il_tx_queue *txq);
+extern int il3945_hw_get_temperature(struct il_priv *il);
+extern int il3945_hw_tx_queue_init(struct il_priv *il,
+ struct il_tx_queue *txq);
+extern unsigned int il3945_hw_get_beacon_cmd(struct il_priv *il,
+ struct il3945_frame *frame, u8 rate);
+void il3945_hw_build_tx_cmd_rate(struct il_priv *il,
+ struct il_device_cmd *cmd,
+ struct ieee80211_tx_info *info,
+ struct ieee80211_hdr *hdr,
+ int sta_id, int tx_id);
+extern int il3945_hw_reg_send_txpower(struct il_priv *il);
+extern int il3945_hw_reg_set_txpower(struct il_priv *il, s8 power);
+extern void il3945_hw_rx_stats(struct il_priv *il,
+ struct il_rx_buf *rxb);
+void il3945_reply_stats(struct il_priv *il,
+ struct il_rx_buf *rxb);
+extern void il3945_disable_events(struct il_priv *il);
+extern int il4965_get_temperature(const struct il_priv *il);
+extern void il3945_post_associate(struct il_priv *il);
+extern void il3945_config_ap(struct il_priv *il);
+
+extern int il3945_commit_rxon(struct il_priv *il,
+ struct il_rxon_context *ctx);
+
+/**
+ * il3945_hw_find_station - Find station id for a given BSSID
+ * @bssid: MAC address of station ID to find
+ *
+ * NOTE: This should not be hardware specific but the code has
+ * not yet been merged into a single common layer for managing the
+ * station tables.
+ */
+extern u8 il3945_hw_find_station(struct il_priv *il, const u8 *bssid);
+
+extern struct ieee80211_ops il3945_hw_ops;
+
+extern __le32 il3945_get_antenna_flags(const struct il_priv *il);
+extern int il3945_init_hw_rate_table(struct il_priv *il);
+extern void il3945_reg_txpower_periodic(struct il_priv *il);
+extern int il3945_txpower_set_from_eeprom(struct il_priv *il);
+
+extern const struct il_channel_info *il3945_get_channel_info(
+ const struct il_priv *il, enum ieee80211_band band, u16 channel);
+
+extern int il3945_rs_next_rate(struct il_priv *il, int rate);
+
+/* scanning */
+int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif);
+void il3945_post_scan(struct il_priv *il);
+
+/* rates */
+extern const struct il3945_rate_info il3945_rates[RATE_COUNT_3945];
+
+
+
+/* RSSI to dBm */
+#define IL39_RSSI_OFFSET 95
+
+/*
+ * EEPROM related constants, enums, and structures.
+ */
+#define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7)
+
+/*
+ * Mapping of a Tx power level, at factory calibration temperature,
+ * to a radio/DSP gain table idx.
+ * One for each of 5 "sample" power levels in each band.
+ * v_det is measured at the factory, using the 3945's built-in power amplifier
+ * (PA) output voltage detector. This same detector is used during Tx of
+ * long packets in normal operation to provide feedback as to proper output
+ * level.
+ * Data copied from EEPROM.
+ * DO NOT ALTER THIS STRUCTURE!!!
+ */
+struct il3945_eeprom_txpower_sample {
+ u8 gain_idx; /* idx into power (gain) setup table ... */
+ s8 power; /* ... for this pwr level for this chnl group */
+ u16 v_det; /* PA output voltage */
+} __packed;
+
+/*
+ * Mappings of Tx power levels -> nominal radio/DSP gain table idxes.
+ * One for each channel group (a.k.a. "band") (1 for BG, 4 for A).
+ * Tx power setup code interpolates between the 5 "sample" power levels
+ * to determine the nominal setup for a requested power level.
+ * Data copied from EEPROM.
+ * DO NOT ALTER THIS STRUCTURE!!!
+ */
+struct il3945_eeprom_txpower_group {
+ struct il3945_eeprom_txpower_sample samples[5]; /* 5 power levels */
+ s32 a, b, c, d, e; /* coefficients for voltage->power
+ * formula (signed) */
+ s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on
+ * frequency (signed) */
+ s8 saturation_power; /* highest power possible by h/w in this
+ * band */
+ u8 group_channel; /* "representative" channel # in this band */
+ s16 temperature; /* h/w temperature at factory calib this band
+ * (signed) */
+} __packed;
+
+/*
+ * Temperature-based Tx-power compensation data, not band-specific.
+ * These coefficients are use to modify a/b/c/d/e coeffs based on
+ * difference between current temperature and factory calib temperature.
+ * Data copied from EEPROM.
+ */
+struct il3945_eeprom_temperature_corr {
+ u32 Ta;
+ u32 Tb;
+ u32 Tc;
+ u32 Td;
+ u32 Te;
+} __packed;
+
+/*
+ * EEPROM map
+ */
+struct il3945_eeprom {
+ u8 reserved0[16];
+ u16 device_id; /* abs.ofs: 16 */
+ u8 reserved1[2];
+ u16 pmc; /* abs.ofs: 20 */
+ u8 reserved2[20];
+ u8 mac_address[6]; /* abs.ofs: 42 */
+ u8 reserved3[58];
+ u16 board_revision; /* abs.ofs: 106 */
+ u8 reserved4[11];
+ u8 board_pba_number[9]; /* abs.ofs: 119 */
+ u8 reserved5[8];
+ u16 version; /* abs.ofs: 136 */
+ u8 sku_cap; /* abs.ofs: 138 */
+ u8 leds_mode; /* abs.ofs: 139 */
+ u16 oem_mode;
+ u16 wowlan_mode; /* abs.ofs: 142 */
+ u16 leds_time_interval; /* abs.ofs: 144 */
+ u8 leds_off_time; /* abs.ofs: 146 */
+ u8 leds_on_time; /* abs.ofs: 147 */
+ u8 almgor_m_version; /* abs.ofs: 148 */
+ u8 antenna_switch_type; /* abs.ofs: 149 */
+ u8 reserved6[42];
+ u8 sku_id[4]; /* abs.ofs: 192 */
+
+/*
+ * Per-channel regulatory data.
+ *
+ * Each channel that *might* be supported by 3945 has a fixed location
+ * in EEPROM containing EEPROM_CHANNEL_* usage flags (LSB) and max regulatory
+ * txpower (MSB).
+ *
+ * Entries immediately below are for 20 MHz channel width.
+ *
+ * 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
+ */
+ u16 band_1_count; /* abs.ofs: 196 */
+ struct il_eeprom_channel band_1_channels[14]; /* abs.ofs: 198 */
+
+/*
+ * 4.9 GHz channels 183, 184, 185, 187, 188, 189, 192, 196,
+ * 5.0 GHz channels 7, 8, 11, 12, 16
+ * (4915-5080MHz) (none of these is ever supported)
+ */
+ u16 band_2_count; /* abs.ofs: 226 */
+ struct il_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */
+
+/*
+ * 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
+ * (5170-5320MHz)
+ */
+ u16 band_3_count; /* abs.ofs: 254 */
+ struct il_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */
+
+/*
+ * 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
+ * (5500-5700MHz)
+ */
+ u16 band_4_count; /* abs.ofs: 280 */
+ struct il_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */
+
+/*
+ * 5.7 GHz channels 145, 149, 153, 157, 161, 165
+ * (5725-5825MHz)
+ */
+ u16 band_5_count; /* abs.ofs: 304 */
+ struct il_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */
+
+ u8 reserved9[194];
+
+/*
+ * 3945 Txpower calibration data.
+ */
+#define IL_NUM_TX_CALIB_GROUPS 5
+ struct il3945_eeprom_txpower_group groups[IL_NUM_TX_CALIB_GROUPS];
+/* abs.ofs: 512 */
+ struct il3945_eeprom_temperature_corr corrections; /* abs.ofs: 832 */
+ u8 reserved16[172]; /* fill out to full 1024 byte block */
+} __packed;
+
+#define IL3945_EEPROM_IMG_SIZE 1024
+
+/* End of EEPROM */
+
+#define PCI_CFG_REV_ID_BIT_BASIC_SKU (0x40) /* bit 6 */
+#define PCI_CFG_REV_ID_BIT_RTP (0x80) /* bit 7 */
+
+/* 4 DATA + 1 CMD. There are 2 HCCA queues that are not used. */
+#define IL39_NUM_QUEUES 5
+#define IL39_CMD_QUEUE_NUM 4
+
+#define IL_DEFAULT_TX_RETRY 15
+
+/*********************************************/
+
+#define RFD_SIZE 4
+#define NUM_TFD_CHUNKS 4
+
+#define RX_QUEUE_SIZE 256
+#define RX_QUEUE_MASK 255
+#define RX_QUEUE_SIZE_LOG 8
+
+#define TFD_CTL_COUNT_SET(n) (n << 24)
+#define TFD_CTL_COUNT_GET(ctl) ((ctl >> 24) & 7)
+#define TFD_CTL_PAD_SET(n) (n << 28)
+#define TFD_CTL_PAD_GET(ctl) (ctl >> 28)
+
+/* Sizes and addresses for instruction and data memory (SRAM) in
+ * 3945's embedded processor. Driver access is via HBUS_TARG_MEM_* regs. */
+#define IL39_RTC_INST_LOWER_BOUND (0x000000)
+#define IL39_RTC_INST_UPPER_BOUND (0x014000)
+
+#define IL39_RTC_DATA_LOWER_BOUND (0x800000)
+#define IL39_RTC_DATA_UPPER_BOUND (0x808000)
+
+#define IL39_RTC_INST_SIZE (IL39_RTC_INST_UPPER_BOUND - \
+ IL39_RTC_INST_LOWER_BOUND)
+#define IL39_RTC_DATA_SIZE (IL39_RTC_DATA_UPPER_BOUND - \
+ IL39_RTC_DATA_LOWER_BOUND)
+
+#define IL39_MAX_INST_SIZE IL39_RTC_INST_SIZE
+#define IL39_MAX_DATA_SIZE IL39_RTC_DATA_SIZE
+
+/* Size of uCode instruction memory in bootstrap state machine */
+#define IL39_MAX_BSM_SIZE IL39_RTC_INST_SIZE
+
+static inline int il3945_hw_valid_rtc_data_addr(u32 addr)
+{
+ return (addr >= IL39_RTC_DATA_LOWER_BOUND &&
+ addr < IL39_RTC_DATA_UPPER_BOUND);
+}
+
+/* Base physical address of il3945_shared is provided to FH_TSSR_CBB_BASE
+ * and &il3945_shared.rx_read_ptr[0] is provided to FH_RCSR_RPTR_ADDR(0) */
+struct il3945_shared {
+ __le32 tx_base_ptr[8];
+} __packed;
+
+static inline u8 il3945_hw_get_rate(__le16 rate_n_flags)
+{
+ return le16_to_cpu(rate_n_flags) & 0xFF;
+}
+
+static inline u16 il3945_hw_get_rate_n_flags(__le16 rate_n_flags)
+{
+ return le16_to_cpu(rate_n_flags);
+}
+
+static inline __le16 il3945_hw_set_rate_n_flags(u8 rate, u16 flags)
+{
+ return cpu_to_le16((u16)rate|flags);
+}
+
+/************************************/
+/* iwl3945 Flow Handler Definitions */
+/************************************/
+
+/**
+ * This I/O area is directly read/writable by driver (e.g. Linux uses writel())
+ * Addresses are offsets from device's PCI hardware base address.
+ */
+#define FH39_MEM_LOWER_BOUND (0x0800)
+#define FH39_MEM_UPPER_BOUND (0x1000)
+
+#define FH39_CBCC_TBL (FH39_MEM_LOWER_BOUND + 0x140)
+#define FH39_TFDB_TBL (FH39_MEM_LOWER_BOUND + 0x180)
+#define FH39_RCSR_TBL (FH39_MEM_LOWER_BOUND + 0x400)
+#define FH39_RSSR_TBL (FH39_MEM_LOWER_BOUND + 0x4c0)
+#define FH39_TCSR_TBL (FH39_MEM_LOWER_BOUND + 0x500)
+#define FH39_TSSR_TBL (FH39_MEM_LOWER_BOUND + 0x680)
+
+/* TFDB (Transmit Frame Buffer Descriptor) */
+#define FH39_TFDB(_ch, buf) (FH39_TFDB_TBL + \
+ ((_ch) * 2 + (buf)) * 0x28)
+#define FH39_TFDB_CHNL_BUF_CTRL_REG(_ch) (FH39_TFDB_TBL + 0x50 * (_ch))
+
+/* CBCC channel is [0,2] */
+#define FH39_CBCC(_ch) (FH39_CBCC_TBL + (_ch) * 0x8)
+#define FH39_CBCC_CTRL(_ch) (FH39_CBCC(_ch) + 0x00)
+#define FH39_CBCC_BASE(_ch) (FH39_CBCC(_ch) + 0x04)
+
+/* RCSR channel is [0,2] */
+#define FH39_RCSR(_ch) (FH39_RCSR_TBL + (_ch) * 0x40)
+#define FH39_RCSR_CONFIG(_ch) (FH39_RCSR(_ch) + 0x00)
+#define FH39_RCSR_RBD_BASE(_ch) (FH39_RCSR(_ch) + 0x04)
+#define FH39_RCSR_WPTR(_ch) (FH39_RCSR(_ch) + 0x20)
+#define FH39_RCSR_RPTR_ADDR(_ch) (FH39_RCSR(_ch) + 0x24)
+
+#define FH39_RSCSR_CHNL0_WPTR (FH39_RCSR_WPTR(0))
+
+/* RSSR */
+#define FH39_RSSR_CTRL (FH39_RSSR_TBL + 0x000)
+#define FH39_RSSR_STATUS (FH39_RSSR_TBL + 0x004)
+
+/* TCSR */
+#define FH39_TCSR(_ch) (FH39_TCSR_TBL + (_ch) * 0x20)
+#define FH39_TCSR_CONFIG(_ch) (FH39_TCSR(_ch) + 0x00)
+#define FH39_TCSR_CREDIT(_ch) (FH39_TCSR(_ch) + 0x04)
+#define FH39_TCSR_BUFF_STTS(_ch) (FH39_TCSR(_ch) + 0x08)
+
+/* TSSR */
+#define FH39_TSSR_CBB_BASE (FH39_TSSR_TBL + 0x000)
+#define FH39_TSSR_MSG_CONFIG (FH39_TSSR_TBL + 0x008)
+#define FH39_TSSR_TX_STATUS (FH39_TSSR_TBL + 0x010)
+
+
+/* DBM */
+
+#define FH39_SRVC_CHNL (6)
+
+#define FH39_RCSR_RX_CONFIG_REG_POS_RBDC_SIZE (20)
+#define FH39_RCSR_RX_CONFIG_REG_POS_IRQ_RBTH (4)
+
+#define FH39_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN (0x08000000)
+
+#define FH39_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE (0x80000000)
+
+#define FH39_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE (0x20000000)
+
+#define FH39_RCSR_RX_CONFIG_REG_VAL_MAX_FRAG_SIZE_128 (0x01000000)
+
+#define FH39_RCSR_RX_CONFIG_REG_VAL_IRQ_DEST_INT_HOST (0x00001000)
+
+#define FH39_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH (0x00000000)
+
+#define FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000)
+#define FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRIVER (0x00000001)
+
+#define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL (0x00000000)
+#define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL (0x00000008)
+
+#define FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000)
+
+#define FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000)
+
+#define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000)
+#define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000)
+
+#define FH39_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00004000)
+
+#define FH39_TCSR_CHNL_TX_BUF_STS_REG_BIT_TFDB_WPTR (0x00000001)
+
+#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON (0xFF000000)
+#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON (0x00FF0000)
+
+#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B (0x00000400)
+
+#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON (0x00000100)
+#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON (0x00000080)
+
+#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH (0x00000020)
+#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH (0x00000005)
+
+#define FH39_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_ch) (BIT(_ch) << 24)
+#define FH39_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_ch) (BIT(_ch) << 16)
+
+#define FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_ch) \
+ (FH39_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_ch) | \
+ FH39_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_ch))
+
+#define FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000)
+
+struct il3945_tfd_tb {
+ __le32 addr;
+ __le32 len;
+} __packed;
+
+struct il3945_tfd {
+ __le32 control_flags;
+ struct il3945_tfd_tb tbs[4];
+ u8 __pad[28];
+} __packed;
+
+#ifdef CONFIG_IWLEGACY_DEBUGFS
+ssize_t il3945_ucode_rx_stats_read(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos);
+ssize_t il3945_ucode_tx_stats_read(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos);
+ssize_t il3945_ucode_general_stats_read(struct file *file,
+ char __user *user_buf, size_t count,
+ loff_t *ppos);
+#else
+static ssize_t il3945_ucode_rx_stats_read(struct file *file,
+ char __user *user_buf, size_t count,
+ loff_t *ppos)
+{
+ return 0;
+}
+static ssize_t il3945_ucode_tx_stats_read(struct file *file,
+ char __user *user_buf, size_t count,
+ loff_t *ppos)
+{
+ return 0;
+}
+static ssize_t il3945_ucode_general_stats_read(struct file *file,
+ char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ return 0;
+}
+#endif
+
+/* Requires full declaration of il_priv before including */
+#include "iwl-io.h"
+
+#endif
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h b/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h
deleted file mode 100644
index 9d1a4a0..0000000
--- a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/******************************************************************************
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
- * USA
- *
- * The full GNU General Public License is included in this distribution
- * in the file called LICENSE.GPL.
- *
- * Contact Information:
- * Intel Linux Wireless <[email protected]>
- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
- *****************************************************************************/
-
-#include "iwl-dev.h"
-#include "iwl-core.h"
-#include "iwl-debug.h"
-
-#ifdef CONFIG_IWLEGACY_DEBUGFS
-ssize_t il3945_ucode_rx_stats_read(struct file *file, char __user *user_buf,
- size_t count, loff_t *ppos);
-ssize_t il3945_ucode_tx_stats_read(struct file *file, char __user *user_buf,
- size_t count, loff_t *ppos);
-ssize_t il3945_ucode_general_stats_read(struct file *file,
- char __user *user_buf, size_t count,
- loff_t *ppos);
-#else
-static ssize_t il3945_ucode_rx_stats_read(struct file *file,
- char __user *user_buf, size_t count,
- loff_t *ppos)
-{
- return 0;
-}
-static ssize_t il3945_ucode_tx_stats_read(struct file *file,
- char __user *user_buf, size_t count,
- loff_t *ppos)
-{
- return 0;
-}
-static ssize_t il3945_ucode_general_stats_read(struct file *file,
- char __user *user_buf,
- size_t count, loff_t *ppos)
-{
- return 0;
-}
-#endif
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-fh.h b/drivers/net/wireless/iwlegacy/iwl-3945-fh.h
deleted file mode 100644
index aa44a90..0000000
--- a/drivers/net/wireless/iwlegacy/iwl-3945-fh.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/******************************************************************************
- *
- * This file is provided under a dual BSD/GPLv2 license. When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
- * USA
- *
- * The full GNU General Public License is included in this distribution
- * in the file called LICENSE.GPL.
- *
- * Contact Information:
- * Intel Linux Wireless <[email protected]>
- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
- *
- * BSD LICENSE
- *
- * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *****************************************************************************/
-#ifndef __il_3945_fh_h__
-#define __il_3945_fh_h__
-
-/************************************/
-/* iwl3945 Flow Handler Definitions */
-/************************************/
-
-/**
- * This I/O area is directly read/writable by driver (e.g. Linux uses writel())
- * Addresses are offsets from device's PCI hardware base address.
- */
-#define FH39_MEM_LOWER_BOUND (0x0800)
-#define FH39_MEM_UPPER_BOUND (0x1000)
-
-#define FH39_CBCC_TBL (FH39_MEM_LOWER_BOUND + 0x140)
-#define FH39_TFDB_TBL (FH39_MEM_LOWER_BOUND + 0x180)
-#define FH39_RCSR_TBL (FH39_MEM_LOWER_BOUND + 0x400)
-#define FH39_RSSR_TBL (FH39_MEM_LOWER_BOUND + 0x4c0)
-#define FH39_TCSR_TBL (FH39_MEM_LOWER_BOUND + 0x500)
-#define FH39_TSSR_TBL (FH39_MEM_LOWER_BOUND + 0x680)
-
-/* TFDB (Transmit Frame Buffer Descriptor) */
-#define FH39_TFDB(_ch, buf) (FH39_TFDB_TBL + \
- ((_ch) * 2 + (buf)) * 0x28)
-#define FH39_TFDB_CHNL_BUF_CTRL_REG(_ch) (FH39_TFDB_TBL + 0x50 * (_ch))
-
-/* CBCC channel is [0,2] */
-#define FH39_CBCC(_ch) (FH39_CBCC_TBL + (_ch) * 0x8)
-#define FH39_CBCC_CTRL(_ch) (FH39_CBCC(_ch) + 0x00)
-#define FH39_CBCC_BASE(_ch) (FH39_CBCC(_ch) + 0x04)
-
-/* RCSR channel is [0,2] */
-#define FH39_RCSR(_ch) (FH39_RCSR_TBL + (_ch) * 0x40)
-#define FH39_RCSR_CONFIG(_ch) (FH39_RCSR(_ch) + 0x00)
-#define FH39_RCSR_RBD_BASE(_ch) (FH39_RCSR(_ch) + 0x04)
-#define FH39_RCSR_WPTR(_ch) (FH39_RCSR(_ch) + 0x20)
-#define FH39_RCSR_RPTR_ADDR(_ch) (FH39_RCSR(_ch) + 0x24)
-
-#define FH39_RSCSR_CHNL0_WPTR (FH39_RCSR_WPTR(0))
-
-/* RSSR */
-#define FH39_RSSR_CTRL (FH39_RSSR_TBL + 0x000)
-#define FH39_RSSR_STATUS (FH39_RSSR_TBL + 0x004)
-
-/* TCSR */
-#define FH39_TCSR(_ch) (FH39_TCSR_TBL + (_ch) * 0x20)
-#define FH39_TCSR_CONFIG(_ch) (FH39_TCSR(_ch) + 0x00)
-#define FH39_TCSR_CREDIT(_ch) (FH39_TCSR(_ch) + 0x04)
-#define FH39_TCSR_BUFF_STTS(_ch) (FH39_TCSR(_ch) + 0x08)
-
-/* TSSR */
-#define FH39_TSSR_CBB_BASE (FH39_TSSR_TBL + 0x000)
-#define FH39_TSSR_MSG_CONFIG (FH39_TSSR_TBL + 0x008)
-#define FH39_TSSR_TX_STATUS (FH39_TSSR_TBL + 0x010)
-
-
-/* DBM */
-
-#define FH39_SRVC_CHNL (6)
-
-#define FH39_RCSR_RX_CONFIG_REG_POS_RBDC_SIZE (20)
-#define FH39_RCSR_RX_CONFIG_REG_POS_IRQ_RBTH (4)
-
-#define FH39_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN (0x08000000)
-
-#define FH39_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE (0x80000000)
-
-#define FH39_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE (0x20000000)
-
-#define FH39_RCSR_RX_CONFIG_REG_VAL_MAX_FRAG_SIZE_128 (0x01000000)
-
-#define FH39_RCSR_RX_CONFIG_REG_VAL_IRQ_DEST_INT_HOST (0x00001000)
-
-#define FH39_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH (0x00000000)
-
-#define FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000)
-#define FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRIVER (0x00000001)
-
-#define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL (0x00000000)
-#define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL (0x00000008)
-
-#define FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000)
-
-#define FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000)
-
-#define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000)
-#define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000)
-
-#define FH39_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00004000)
-
-#define FH39_TCSR_CHNL_TX_BUF_STS_REG_BIT_TFDB_WPTR (0x00000001)
-
-#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON (0xFF000000)
-#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON (0x00FF0000)
-
-#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B (0x00000400)
-
-#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON (0x00000100)
-#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON (0x00000080)
-
-#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH (0x00000020)
-#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH (0x00000005)
-
-#define FH39_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_ch) (BIT(_ch) << 24)
-#define FH39_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_ch) (BIT(_ch) << 16)
-
-#define FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_ch) \
- (FH39_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_ch) | \
- FH39_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_ch))
-
-#define FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000)
-
-struct il3945_tfd_tb {
- __le32 addr;
- __le32 len;
-} __packed;
-
-struct il3945_tfd {
- __le32 control_flags;
- struct il3945_tfd_tb tbs[4];
- u8 __pad[28];
-} __packed;
-
-
-#endif /* __il_3945_fh_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
deleted file mode 100644
index 53e5fb4..0000000
--- a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
+++ /dev/null
@@ -1,291 +0,0 @@
-/******************************************************************************
- *
- * This file is provided under a dual BSD/GPLv2 license. When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
- * USA
- *
- * The full GNU General Public License is included in this distribution
- * in the file called LICENSE.GPL.
- *
- * Contact Information:
- * Intel Linux Wireless <[email protected]>
- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
- *
- * BSD LICENSE
- *
- * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *****************************************************************************/
-/*
- * Please use this file (iwl-3945-hw.h) only for hardware-related definitions.
- * Please use iwl-commands.h for uCode API definitions.
- * Please use iwl-3945.h for driver implementation definitions.
- */
-
-#ifndef __il_3945_hw__
-#define __il_3945_hw__
-
-#include "iwl-eeprom.h"
-
-/* RSSI to dBm */
-#define IL39_RSSI_OFFSET 95
-
-/*
- * EEPROM related constants, enums, and structures.
- */
-#define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7)
-
-/*
- * Mapping of a Tx power level, at factory calibration temperature,
- * to a radio/DSP gain table idx.
- * One for each of 5 "sample" power levels in each band.
- * v_det is measured at the factory, using the 3945's built-in power amplifier
- * (PA) output voltage detector. This same detector is used during Tx of
- * long packets in normal operation to provide feedback as to proper output
- * level.
- * Data copied from EEPROM.
- * DO NOT ALTER THIS STRUCTURE!!!
- */
-struct il3945_eeprom_txpower_sample {
- u8 gain_idx; /* idx into power (gain) setup table ... */
- s8 power; /* ... for this pwr level for this chnl group */
- u16 v_det; /* PA output voltage */
-} __packed;
-
-/*
- * Mappings of Tx power levels -> nominal radio/DSP gain table idxes.
- * One for each channel group (a.k.a. "band") (1 for BG, 4 for A).
- * Tx power setup code interpolates between the 5 "sample" power levels
- * to determine the nominal setup for a requested power level.
- * Data copied from EEPROM.
- * DO NOT ALTER THIS STRUCTURE!!!
- */
-struct il3945_eeprom_txpower_group {
- struct il3945_eeprom_txpower_sample samples[5]; /* 5 power levels */
- s32 a, b, c, d, e; /* coefficients for voltage->power
- * formula (signed) */
- s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on
- * frequency (signed) */
- s8 saturation_power; /* highest power possible by h/w in this
- * band */
- u8 group_channel; /* "representative" channel # in this band */
- s16 temperature; /* h/w temperature at factory calib this band
- * (signed) */
-} __packed;
-
-/*
- * Temperature-based Tx-power compensation data, not band-specific.
- * These coefficients are use to modify a/b/c/d/e coeffs based on
- * difference between current temperature and factory calib temperature.
- * Data copied from EEPROM.
- */
-struct il3945_eeprom_temperature_corr {
- u32 Ta;
- u32 Tb;
- u32 Tc;
- u32 Td;
- u32 Te;
-} __packed;
-
-/*
- * EEPROM map
- */
-struct il3945_eeprom {
- u8 reserved0[16];
- u16 device_id; /* abs.ofs: 16 */
- u8 reserved1[2];
- u16 pmc; /* abs.ofs: 20 */
- u8 reserved2[20];
- u8 mac_address[6]; /* abs.ofs: 42 */
- u8 reserved3[58];
- u16 board_revision; /* abs.ofs: 106 */
- u8 reserved4[11];
- u8 board_pba_number[9]; /* abs.ofs: 119 */
- u8 reserved5[8];
- u16 version; /* abs.ofs: 136 */
- u8 sku_cap; /* abs.ofs: 138 */
- u8 leds_mode; /* abs.ofs: 139 */
- u16 oem_mode;
- u16 wowlan_mode; /* abs.ofs: 142 */
- u16 leds_time_interval; /* abs.ofs: 144 */
- u8 leds_off_time; /* abs.ofs: 146 */
- u8 leds_on_time; /* abs.ofs: 147 */
- u8 almgor_m_version; /* abs.ofs: 148 */
- u8 antenna_switch_type; /* abs.ofs: 149 */
- u8 reserved6[42];
- u8 sku_id[4]; /* abs.ofs: 192 */
-
-/*
- * Per-channel regulatory data.
- *
- * Each channel that *might* be supported by 3945 has a fixed location
- * in EEPROM containing EEPROM_CHANNEL_* usage flags (LSB) and max regulatory
- * txpower (MSB).
- *
- * Entries immediately below are for 20 MHz channel width.
- *
- * 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
- */
- u16 band_1_count; /* abs.ofs: 196 */
- struct il_eeprom_channel band_1_channels[14]; /* abs.ofs: 198 */
-
-/*
- * 4.9 GHz channels 183, 184, 185, 187, 188, 189, 192, 196,
- * 5.0 GHz channels 7, 8, 11, 12, 16
- * (4915-5080MHz) (none of these is ever supported)
- */
- u16 band_2_count; /* abs.ofs: 226 */
- struct il_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */
-
-/*
- * 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
- * (5170-5320MHz)
- */
- u16 band_3_count; /* abs.ofs: 254 */
- struct il_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */
-
-/*
- * 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
- * (5500-5700MHz)
- */
- u16 band_4_count; /* abs.ofs: 280 */
- struct il_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */
-
-/*
- * 5.7 GHz channels 145, 149, 153, 157, 161, 165
- * (5725-5825MHz)
- */
- u16 band_5_count; /* abs.ofs: 304 */
- struct il_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */
-
- u8 reserved9[194];
-
-/*
- * 3945 Txpower calibration data.
- */
-#define IL_NUM_TX_CALIB_GROUPS 5
- struct il3945_eeprom_txpower_group groups[IL_NUM_TX_CALIB_GROUPS];
-/* abs.ofs: 512 */
- struct il3945_eeprom_temperature_corr corrections; /* abs.ofs: 832 */
- u8 reserved16[172]; /* fill out to full 1024 byte block */
-} __packed;
-
-#define IL3945_EEPROM_IMG_SIZE 1024
-
-/* End of EEPROM */
-
-#define PCI_CFG_REV_ID_BIT_BASIC_SKU (0x40) /* bit 6 */
-#define PCI_CFG_REV_ID_BIT_RTP (0x80) /* bit 7 */
-
-/* 4 DATA + 1 CMD. There are 2 HCCA queues that are not used. */
-#define IL39_NUM_QUEUES 5
-#define IL39_CMD_QUEUE_NUM 4
-
-#define IL_DEFAULT_TX_RETRY 15
-
-/*********************************************/
-
-#define RFD_SIZE 4
-#define NUM_TFD_CHUNKS 4
-
-#define RX_QUEUE_SIZE 256
-#define RX_QUEUE_MASK 255
-#define RX_QUEUE_SIZE_LOG 8
-
-#define U32_PAD(n) ((4-(n))&0x3)
-
-#define TFD_CTL_COUNT_SET(n) (n << 24)
-#define TFD_CTL_COUNT_GET(ctl) ((ctl >> 24) & 7)
-#define TFD_CTL_PAD_SET(n) (n << 28)
-#define TFD_CTL_PAD_GET(ctl) (ctl >> 28)
-
-/* Sizes and addresses for instruction and data memory (SRAM) in
- * 3945's embedded processor. Driver access is via HBUS_TARG_MEM_* regs. */
-#define IL39_RTC_INST_LOWER_BOUND (0x000000)
-#define IL39_RTC_INST_UPPER_BOUND (0x014000)
-
-#define IL39_RTC_DATA_LOWER_BOUND (0x800000)
-#define IL39_RTC_DATA_UPPER_BOUND (0x808000)
-
-#define IL39_RTC_INST_SIZE (IL39_RTC_INST_UPPER_BOUND - \
- IL39_RTC_INST_LOWER_BOUND)
-#define IL39_RTC_DATA_SIZE (IL39_RTC_DATA_UPPER_BOUND - \
- IL39_RTC_DATA_LOWER_BOUND)
-
-#define IL39_MAX_INST_SIZE IL39_RTC_INST_SIZE
-#define IL39_MAX_DATA_SIZE IL39_RTC_DATA_SIZE
-
-/* Size of uCode instruction memory in bootstrap state machine */
-#define IL39_MAX_BSM_SIZE IL39_RTC_INST_SIZE
-
-static inline int il3945_hw_valid_rtc_data_addr(u32 addr)
-{
- return (addr >= IL39_RTC_DATA_LOWER_BOUND &&
- addr < IL39_RTC_DATA_UPPER_BOUND);
-}
-
-/* Base physical address of il3945_shared is provided to FH_TSSR_CBB_BASE
- * and &il3945_shared.rx_read_ptr[0] is provided to FH_RCSR_RPTR_ADDR(0) */
-struct il3945_shared {
- __le32 tx_base_ptr[8];
-} __packed;
-
-static inline u8 il3945_hw_get_rate(__le16 rate_n_flags)
-{
- return le16_to_cpu(rate_n_flags) & 0xFF;
-}
-
-static inline u16 il3945_hw_get_rate_n_flags(__le16 rate_n_flags)
-{
- return le16_to_cpu(rate_n_flags);
-}
-
-static inline __le16 il3945_hw_set_rate_n_flags(u8 rate, u16 flags)
-{
- return cpu_to_le16((u16)rate|flags);
-}
-#endif
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.h b/drivers/net/wireless/iwlegacy/iwl-3945.h
deleted file mode 100644
index 80fcbf8..0000000
--- a/drivers/net/wireless/iwlegacy/iwl-3945.h
+++ /dev/null
@@ -1,308 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2003 - 2011 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
- *
- *****************************************************************************/
-/*
- * Please use this file (iwl-3945.h) for driver implementation definitions.
- * Please use iwl-3945-commands.h for uCode API definitions.
- * Please use iwl-3945-hw.h for hardware-related definitions.
- */
-
-#ifndef __il_3945_h__
-#define __il_3945_h__
-
-#include <linux/pci.h> /* for struct pci_device_id */
-#include <linux/kernel.h>
-#include <net/ieee80211_radiotap.h>
-
-/* Hardware specific file defines the PCI IDs table for that hardware module */
-extern const struct pci_device_id il3945_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"
-#include "iwl-dev.h"
-#include "iwl-led.h"
-
-/* Highest firmware API version supported */
-#define IL3945_UCODE_API_MAX 2
-
-/* Lowest firmware API version supported */
-#define IL3945_UCODE_API_MIN 1
-
-#define IL3945_FW_PRE "iwlwifi-3945-"
-#define _IL3945_MODULE_FIRMWARE(api) IL3945_FW_PRE #api ".ucode"
-#define IL3945_MODULE_FIRMWARE(api) _IL3945_MODULE_FIRMWARE(api)
-
-/* Default noise level to report when noise measurement is not available.
- * This may be because we're:
- * 1) Not associated (4965, no beacon stats being sent to driver)
- * 2) Scanning (noise measurement does not apply to associated channel)
- * 3) Receiving CCK (3945 delivers noise info only for OFDM frames)
- * Use default noise value of -127 ... this is below the range of measurable
- * Rx dBm for either 3945 or 4965, so it can indicate "unmeasurable" to user.
- * Also, -127 works better than 0 when averaging frames with/without
- * noise info (e.g. averaging might be done in app); measured dBm values are
- * always negative ... using a negative value as the default keeps all
- * averages within an s8's (used in some apps) range of negative values. */
-#define IL_NOISE_MEAS_NOT_AVAILABLE (-127)
-
-/* Module parameters accessible from iwl-*.c */
-extern struct il_mod_params il3945_mod_params;
-
-struct il3945_rate_scale_data {
- u64 data;
- s32 success_counter;
- s32 success_ratio;
- s32 counter;
- s32 average_tpt;
- unsigned long stamp;
-};
-
-struct il3945_rs_sta {
- spinlock_t lock;
- struct il_priv *il;
- s32 *expected_tpt;
- unsigned long last_partial_flush;
- unsigned long last_flush;
- u32 flush_time;
- u32 last_tx_packets;
- u32 tx_packets;
- u8 tgg;
- u8 flush_pending;
- u8 start_rate;
- struct timer_list rate_scale_flush;
- struct il3945_rate_scale_data win[RATE_COUNT_3945];
-#ifdef CONFIG_MAC80211_DEBUGFS
- struct dentry *rs_sta_dbgfs_stats_table_file;
-#endif
-
- /* used to be in sta_info */
- int last_txrate_idx;
-};
-
-
-/*
- * The common struct MUST be first because it is shared between
- * 3945 and 4965!
- */
-struct il3945_sta_priv {
- struct il_station_priv_common common;
- struct il3945_rs_sta rs_sta;
-};
-
-enum il3945_antenna {
- IL_ANTENNA_DIVERSITY,
- IL_ANTENNA_MAIN,
- IL_ANTENNA_AUX
-};
-
-/*
- * RTS threshold here is total size [2347] minus 4 FCS bytes
- * Per spec:
- * a value of 0 means RTS on all data/management packets
- * a value > max MSDU size means no RTS
- * else RTS for data/management frames where MPDU is larger
- * than RTS value.
- */
-#define DEFAULT_RTS_THRESHOLD 2347U
-#define MIN_RTS_THRESHOLD 0U
-#define MAX_RTS_THRESHOLD 2347U
-#define MAX_MSDU_SIZE 2304U
-#define MAX_MPDU_SIZE 2346U
-#define DEFAULT_BEACON_INTERVAL 100U
-#define DEFAULT_SHORT_RETRY_LIMIT 7U
-#define DEFAULT_LONG_RETRY_LIMIT 4U
-
-#define IL_TX_FIFO_AC0 0
-#define IL_TX_FIFO_AC1 1
-#define IL_TX_FIFO_AC2 2
-#define IL_TX_FIFO_AC3 3
-#define IL_TX_FIFO_HCCA_1 5
-#define IL_TX_FIFO_HCCA_2 6
-#define IL_TX_FIFO_NONE 7
-
-#define IEEE80211_DATA_LEN 2304
-#define IEEE80211_4ADDR_LEN 30
-#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
-#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
-
-struct il3945_frame {
- union {
- struct ieee80211_hdr frame;
- struct il3945_tx_beacon_cmd beacon;
- u8 raw[IEEE80211_FRAME_LEN];
- u8 cmd[360];
- } u;
- struct list_head list;
-};
-
-#define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
-#define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
-#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
-
-#define SUP_RATE_11A_MAX_NUM_CHANNELS 8
-#define SUP_RATE_11B_MAX_NUM_CHANNELS 4
-#define SUP_RATE_11G_MAX_NUM_CHANNELS 12
-
-#define IL_SUPPORTED_RATES_IE_LEN 8
-
-#define SCAN_INTERVAL 100
-
-#define MAX_TID_COUNT 9
-
-#define IL_INVALID_RATE 0xFF
-#define IL_INVALID_VALUE -1
-
-#define STA_PS_STATUS_WAKE 0
-#define STA_PS_STATUS_SLEEP 1
-
-struct il3945_ibss_seq {
- u8 mac[ETH_ALEN];
- u16 seq_num;
- u16 frag_num;
- unsigned long packet_time;
- struct list_head list;
-};
-
-#define IL_RX_HDR(x) ((struct il3945_rx_frame_hdr *)(\
- x->u.rx_frame.stats.payload + \
- x->u.rx_frame.stats.phy_count))
-#define IL_RX_END(x) ((struct il3945_rx_frame_end *)(\
- IL_RX_HDR(x)->payload + \
- le16_to_cpu(IL_RX_HDR(x)->len)))
-#define IL_RX_STATS(x) (&x->u.rx_frame.stats)
-#define IL_RX_DATA(x) (IL_RX_HDR(x)->payload)
-
-
-/******************************************************************************
- *
- * Functions implemented in iwl3945-base.c which are forward declared here
- * for use by iwl-*.c
- *
- *****************************************************************************/
-extern int il3945_calc_db_from_ratio(int sig_ratio);
-extern void il3945_rx_replenish(void *data);
-extern void il3945_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq);
-extern unsigned int il3945_fill_beacon_frame(struct il_priv *il,
- struct ieee80211_hdr *hdr, int left);
-extern int il3945_dump_nic_event_log(struct il_priv *il, bool full_log,
- char **buf, bool display);
-extern void il3945_dump_nic_error_log(struct il_priv *il);
-
-/******************************************************************************
- *
- * Functions implemented in iwl-[34]*.c which are forward declared here
- * for use by iwl3945-base.c
- *
- * NOTE: The implementation of these functions are hardware specific
- * which is why they are in the hardware specific files (vs. iwl-base.c)
- *
- * Naming convention --
- * il3945_ <-- Its part of iwlwifi (should be changed to il3945_)
- * il3945_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW)
- * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX)
- * il3945_bg_ <-- Called from work queue context
- * il3945_mac_ <-- mac80211 callback
- *
- ****************************************************************************/
-extern void il3945_hw_rx_handler_setup(struct il_priv *il);
-extern void il3945_hw_setup_deferred_work(struct il_priv *il);
-extern void il3945_hw_cancel_deferred_work(struct il_priv *il);
-extern int il3945_hw_rxq_stop(struct il_priv *il);
-extern int il3945_hw_set_hw_params(struct il_priv *il);
-extern int il3945_hw_nic_init(struct il_priv *il);
-extern int il3945_hw_nic_stop_master(struct il_priv *il);
-extern void il3945_hw_txq_ctx_free(struct il_priv *il);
-extern void il3945_hw_txq_ctx_stop(struct il_priv *il);
-extern int il3945_hw_nic_reset(struct il_priv *il);
-extern int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il,
- struct il_tx_queue *txq,
- dma_addr_t addr, u16 len,
- u8 reset, u8 pad);
-extern void il3945_hw_txq_free_tfd(struct il_priv *il,
- struct il_tx_queue *txq);
-extern int il3945_hw_get_temperature(struct il_priv *il);
-extern int il3945_hw_tx_queue_init(struct il_priv *il,
- struct il_tx_queue *txq);
-extern unsigned int il3945_hw_get_beacon_cmd(struct il_priv *il,
- struct il3945_frame *frame, u8 rate);
-void il3945_hw_build_tx_cmd_rate(struct il_priv *il,
- struct il_device_cmd *cmd,
- struct ieee80211_tx_info *info,
- struct ieee80211_hdr *hdr,
- int sta_id, int tx_id);
-extern int il3945_hw_reg_send_txpower(struct il_priv *il);
-extern int il3945_hw_reg_set_txpower(struct il_priv *il, s8 power);
-extern void il3945_hw_rx_stats(struct il_priv *il,
- struct il_rx_buf *rxb);
-void il3945_reply_stats(struct il_priv *il,
- struct il_rx_buf *rxb);
-extern void il3945_disable_events(struct il_priv *il);
-extern int il4965_get_temperature(const struct il_priv *il);
-extern void il3945_post_associate(struct il_priv *il);
-extern void il3945_config_ap(struct il_priv *il);
-
-extern int il3945_commit_rxon(struct il_priv *il,
- struct il_rxon_context *ctx);
-
-/**
- * il3945_hw_find_station - Find station id for a given BSSID
- * @bssid: MAC address of station ID to find
- *
- * NOTE: This should not be hardware specific but the code has
- * not yet been merged into a single common layer for managing the
- * station tables.
- */
-extern u8 il3945_hw_find_station(struct il_priv *il, const u8 *bssid);
-
-extern struct ieee80211_ops il3945_hw_ops;
-
-/*
- * Forward declare iwl-3945.c functions for iwl3945-base.c
- */
-extern __le32 il3945_get_antenna_flags(const struct il_priv *il);
-extern int il3945_init_hw_rate_table(struct il_priv *il);
-extern void il3945_reg_txpower_periodic(struct il_priv *il);
-extern int il3945_txpower_set_from_eeprom(struct il_priv *il);
-
-extern const struct il_channel_info *il3945_get_channel_info(
- const struct il_priv *il, enum ieee80211_band band, u16 channel);
-
-extern int il3945_rs_next_rate(struct il_priv *il, int rate);
-
-/* scanning */
-int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif);
-void il3945_post_scan(struct il_priv *il);
-
-/* rates */
-extern const struct il3945_rate_info il3945_rates[RATE_COUNT_3945];
-
-/* Requires full declaration of il_priv before including */
-#include "iwl-io.h"
-
-#endif
diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h
index 97b2573..f7c3b43 100644
--- a/drivers/net/wireless/iwlegacy/iwl-dev.h
+++ b/drivers/net/wireless/iwlegacy/iwl-dev.h
@@ -45,11 +45,12 @@
#include "iwl-fh.h"
#include "iwl-debug.h"
#include "4965.h"
-#include "iwl-3945-hw.h"
#include "iwl-led.h"
#include "iwl-power.h"
#include "iwl-legacy-rs.h"

+#define U32_PAD(n) ((4-(n))&0x3)
+
struct il_tx_queue;

/* CT-KILL constants */
--
1.7.1


2011-11-18 08:22:44

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 53/77] iwlegacy: rename iwl-csr.h to csr.h

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/3945.h | 1 -
drivers/net/wireless/iwlegacy/csr.h | 422 +++++++++++++++++++++++++++++++
drivers/net/wireless/iwlegacy/iwl-csr.h | 422 -------------------------------
drivers/net/wireless/iwlegacy/iwl-dev.h | 2 +-
4 files changed, 423 insertions(+), 424 deletions(-)
create mode 100644 drivers/net/wireless/iwlegacy/csr.h
delete mode 100644 drivers/net/wireless/iwlegacy/iwl-csr.h

diff --git a/drivers/net/wireless/iwlegacy/3945.h b/drivers/net/wireless/iwlegacy/3945.h
index 7559a5e..e89ca5d 100644
--- a/drivers/net/wireless/iwlegacy/3945.h
+++ b/drivers/net/wireless/iwlegacy/3945.h
@@ -34,7 +34,6 @@
/* Hardware specific file defines the PCI IDs table for that hardware module */
extern const struct pci_device_id il3945_hw_card_ids[];

-#include "iwl-csr.h"
#include "iwl-prph.h"
#include "iwl-debug.h"
#include "iwl-power.h"
diff --git a/drivers/net/wireless/iwlegacy/csr.h b/drivers/net/wireless/iwlegacy/csr.h
new file mode 100644
index 0000000..4db0429
--- /dev/null
+++ b/drivers/net/wireless/iwlegacy/csr.h
@@ -0,0 +1,422 @@
+/******************************************************************************
+ *
+ * This file is provided under a dual BSD/GPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
+ * USA
+ *
+ * The full GNU General Public License is included in this distribution
+ * in the file called LICENSE.GPL.
+ *
+ * Contact Information:
+ * Intel Linux Wireless <[email protected]>
+ * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *****************************************************************************/
+#ifndef __il_csr_h__
+#define __il_csr_h__
+/*
+ * CSR (control and status registers)
+ *
+ * CSR registers are mapped directly into PCI bus space, and are accessible
+ * whenever platform supplies power to device, even when device is in
+ * low power states due to driver-invoked device resets
+ * (e.g. CSR_RESET_REG_FLAG_SW_RESET) or uCode-driven power-saving modes.
+ *
+ * Use _il_wr() and _il_rd() family to access these registers;
+ * these provide simple PCI bus access, without waking up the MAC.
+ * Do not use il_wr() family for these registers;
+ * no need to "grab nic access" via CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ.
+ * The MAC (uCode processor, etc.) does not need to be powered up for accessing
+ * the CSR registers.
+ *
+ * NOTE: Device does need to be awake in order to read this memory
+ * via CSR_EEPROM register
+ */
+#define CSR_BASE (0x000)
+
+#define CSR_HW_IF_CONFIG_REG (CSR_BASE+0x000) /* hardware interface config */
+#define CSR_INT_COALESCING (CSR_BASE+0x004) /* accum ints, 32-usec units */
+#define CSR_INT (CSR_BASE+0x008) /* host interrupt status/ack */
+#define CSR_INT_MASK (CSR_BASE+0x00c) /* host interrupt enable */
+#define CSR_FH_INT_STATUS (CSR_BASE+0x010) /* busmaster int status/ack*/
+#define CSR_GPIO_IN (CSR_BASE+0x018) /* read external chip pins */
+#define CSR_RESET (CSR_BASE+0x020) /* busmaster enable, NMI, etc*/
+#define CSR_GP_CNTRL (CSR_BASE+0x024)
+
+/* 2nd byte of CSR_INT_COALESCING, not accessible via _il_wr()! */
+#define CSR_INT_PERIODIC_REG (CSR_BASE+0x005)
+
+/*
+ * Hardware revision info
+ * Bit fields:
+ * 31-8: Reserved
+ * 7-4: Type of device: see CSR_HW_REV_TYPE_xxx definitions
+ * 3-2: Revision step: 0 = A, 1 = B, 2 = C, 3 = D
+ * 1-0: "Dash" (-) value, as in A-1, etc.
+ *
+ * NOTE: Revision step affects calculation of CCK txpower for 4965.
+ * NOTE: See also CSR_HW_REV_WA_REG (work-around for bug in 4965).
+ */
+#define CSR_HW_REV (CSR_BASE+0x028)
+
+/*
+ * EEPROM memory reads
+ *
+ * NOTE: Device must be awake, initialized via apm_ops.init(),
+ * in order to read.
+ */
+#define CSR_EEPROM_REG (CSR_BASE+0x02c)
+#define CSR_EEPROM_GP (CSR_BASE+0x030)
+
+#define CSR_GIO_REG (CSR_BASE+0x03C)
+#define CSR_GP_UCODE_REG (CSR_BASE+0x048)
+#define CSR_GP_DRIVER_REG (CSR_BASE+0x050)
+
+/*
+ * UCODE-DRIVER GP (general purpose) mailbox registers.
+ * SET/CLR registers set/clear bit(s) if "1" is written.
+ */
+#define CSR_UCODE_DRV_GP1 (CSR_BASE+0x054)
+#define CSR_UCODE_DRV_GP1_SET (CSR_BASE+0x058)
+#define CSR_UCODE_DRV_GP1_CLR (CSR_BASE+0x05c)
+#define CSR_UCODE_DRV_GP2 (CSR_BASE+0x060)
+
+#define CSR_LED_REG (CSR_BASE+0x094)
+#define CSR_DRAM_INT_TBL_REG (CSR_BASE+0x0A0)
+
+/* GIO Chicken Bits (PCI Express bus link power management) */
+#define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100)
+
+/* Analog phase-lock-loop configuration */
+#define CSR_ANA_PLL_CFG (CSR_BASE+0x20c)
+
+/*
+ * CSR Hardware Revision Workaround Register. Indicates hardware rev;
+ * "step" determines CCK backoff for txpower calculation. Used for 4965 only.
+ * See also CSR_HW_REV register.
+ * Bit fields:
+ * 3-2: 0 = A, 1 = B, 2 = C, 3 = D step
+ * 1-0: "Dash" (-) value, as in C-1, etc.
+ */
+#define CSR_HW_REV_WA_REG (CSR_BASE+0x22C)
+
+#define CSR_DBG_HPET_MEM_REG (CSR_BASE+0x240)
+#define CSR_DBG_LINK_PWR_MGMT_REG (CSR_BASE+0x250)
+
+/* Bits for CSR_HW_IF_CONFIG_REG */
+#define CSR49_HW_IF_CONFIG_REG_BIT_4965_R (0x00000010)
+#define CSR_HW_IF_CONFIG_REG_MSK_BOARD_VER (0x00000C00)
+#define CSR_HW_IF_CONFIG_REG_BIT_MAC_SI (0x00000100)
+#define CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI (0x00000200)
+
+#define CSR39_HW_IF_CONFIG_REG_BIT_3945_MB (0x00000100)
+#define CSR39_HW_IF_CONFIG_REG_BIT_3945_MM (0x00000200)
+#define CSR39_HW_IF_CONFIG_REG_BIT_SKU_MRC (0x00000400)
+#define CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE (0x00000800)
+#define CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A (0x00000000)
+#define CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B (0x00001000)
+
+#define CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A (0x00080000)
+#define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000)
+#define CSR_HW_IF_CONFIG_REG_BIT_NIC_READY (0x00400000) /* PCI_OWN_SEM */
+#define CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE (0x02000000) /* ME_OWN */
+#define CSR_HW_IF_CONFIG_REG_PREPARE (0x08000000) /* WAKE_ME */
+
+#define CSR_INT_PERIODIC_DIS (0x00) /* disable periodic int*/
+#define CSR_INT_PERIODIC_ENA (0xFF) /* 255*32 usec ~ 8 msec*/
+
+/* interrupt flags in INTA, set by uCode or hardware (e.g. dma),
+ * acknowledged (reset) by host writing "1" to flagged bits. */
+#define CSR_INT_BIT_FH_RX (1 << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */
+#define CSR_INT_BIT_HW_ERR (1 << 29) /* DMA hardware error FH_INT[31] */
+#define CSR_INT_BIT_RX_PERIODIC (1 << 28) /* Rx periodic */
+#define CSR_INT_BIT_FH_TX (1 << 27) /* Tx DMA FH_INT[1:0] */
+#define CSR_INT_BIT_SCD (1 << 26) /* TXQ pointer advanced */
+#define CSR_INT_BIT_SW_ERR (1 << 25) /* uCode error */
+#define CSR_INT_BIT_RF_KILL (1 << 7) /* HW RFKILL switch GP_CNTRL[27] toggled */
+#define CSR_INT_BIT_CT_KILL (1 << 6) /* Critical temp (chip too hot) rfkill */
+#define CSR_INT_BIT_SW_RX (1 << 3) /* Rx, command responses, 3945 */
+#define CSR_INT_BIT_WAKEUP (1 << 1) /* NIC controller waking up (pwr mgmt) */
+#define CSR_INT_BIT_ALIVE (1 << 0) /* uCode interrupts once it initializes */
+
+#define CSR_INI_SET_MASK (CSR_INT_BIT_FH_RX | \
+ CSR_INT_BIT_HW_ERR | \
+ CSR_INT_BIT_FH_TX | \
+ CSR_INT_BIT_SW_ERR | \
+ CSR_INT_BIT_RF_KILL | \
+ CSR_INT_BIT_SW_RX | \
+ CSR_INT_BIT_WAKEUP | \
+ CSR_INT_BIT_ALIVE)
+
+/* interrupt flags in FH (flow handler) (PCI busmaster DMA) */
+#define CSR_FH_INT_BIT_ERR (1 << 31) /* Error */
+#define CSR_FH_INT_BIT_HI_PRIOR (1 << 30) /* High priority Rx, bypass coalescing */
+#define CSR39_FH_INT_BIT_RX_CHNL2 (1 << 18) /* Rx channel 2 (3945 only) */
+#define CSR_FH_INT_BIT_RX_CHNL1 (1 << 17) /* Rx channel 1 */
+#define CSR_FH_INT_BIT_RX_CHNL0 (1 << 16) /* Rx channel 0 */
+#define CSR39_FH_INT_BIT_TX_CHNL6 (1 << 6) /* Tx channel 6 (3945 only) */
+#define CSR_FH_INT_BIT_TX_CHNL1 (1 << 1) /* Tx channel 1 */
+#define CSR_FH_INT_BIT_TX_CHNL0 (1 << 0) /* Tx channel 0 */
+
+#define CSR39_FH_INT_RX_MASK (CSR_FH_INT_BIT_HI_PRIOR | \
+ CSR39_FH_INT_BIT_RX_CHNL2 | \
+ CSR_FH_INT_BIT_RX_CHNL1 | \
+ CSR_FH_INT_BIT_RX_CHNL0)
+
+
+#define CSR39_FH_INT_TX_MASK (CSR39_FH_INT_BIT_TX_CHNL6 | \
+ CSR_FH_INT_BIT_TX_CHNL1 | \
+ CSR_FH_INT_BIT_TX_CHNL0)
+
+#define CSR49_FH_INT_RX_MASK (CSR_FH_INT_BIT_HI_PRIOR | \
+ CSR_FH_INT_BIT_RX_CHNL1 | \
+ CSR_FH_INT_BIT_RX_CHNL0)
+
+#define CSR49_FH_INT_TX_MASK (CSR_FH_INT_BIT_TX_CHNL1 | \
+ CSR_FH_INT_BIT_TX_CHNL0)
+
+/* GPIO */
+#define CSR_GPIO_IN_BIT_AUX_POWER (0x00000200)
+#define CSR_GPIO_IN_VAL_VAUX_PWR_SRC (0x00000000)
+#define CSR_GPIO_IN_VAL_VMAIN_PWR_SRC (0x00000200)
+
+/* RESET */
+#define CSR_RESET_REG_FLAG_NEVO_RESET (0x00000001)
+#define CSR_RESET_REG_FLAG_FORCE_NMI (0x00000002)
+#define CSR_RESET_REG_FLAG_SW_RESET (0x00000080)
+#define CSR_RESET_REG_FLAG_MASTER_DISABLED (0x00000100)
+#define CSR_RESET_REG_FLAG_STOP_MASTER (0x00000200)
+#define CSR_RESET_LINK_PWR_MGMT_DISABLED (0x80000000)
+
+/*
+ * GP (general purpose) CONTROL REGISTER
+ * Bit fields:
+ * 27: HW_RF_KILL_SW
+ * Indicates state of (platform's) hardware RF-Kill switch
+ * 26-24: POWER_SAVE_TYPE
+ * Indicates current power-saving mode:
+ * 000 -- No power saving
+ * 001 -- MAC power-down
+ * 010 -- PHY (radio) power-down
+ * 011 -- Error
+ * 9-6: SYS_CONFIG
+ * Indicates current system configuration, reflecting pins on chip
+ * as forced high/low by device circuit board.
+ * 4: GOING_TO_SLEEP
+ * Indicates MAC is entering a power-saving sleep power-down.
+ * Not a good time to access device-internal resources.
+ * 3: MAC_ACCESS_REQ
+ * Host sets this to request and maintain MAC wakeup, to allow host
+ * access to device-internal resources. Host must wait for
+ * MAC_CLOCK_READY (and !GOING_TO_SLEEP) before accessing non-CSR
+ * device registers.
+ * 2: INIT_DONE
+ * Host sets this to put device into fully operational D0 power mode.
+ * Host resets this after SW_RESET to put device into low power mode.
+ * 0: MAC_CLOCK_READY
+ * Indicates MAC (ucode processor, etc.) is powered up and can run.
+ * Internal resources are accessible.
+ * NOTE: This does not indicate that the processor is actually running.
+ * NOTE: This does not indicate that 4965 or 3945 has completed
+ * init or post-power-down restore of internal SRAM memory.
+ * Use CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP as indication that
+ * SRAM is restored and uCode is in normal operation mode.
+ * Later devices (5xxx/6xxx/1xxx) use non-volatile SRAM, and
+ * do not need to save/restore it.
+ * NOTE: After device reset, this bit remains "0" until host sets
+ * INIT_DONE
+ */
+#define CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY (0x00000001)
+#define CSR_GP_CNTRL_REG_FLAG_INIT_DONE (0x00000004)
+#define CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ (0x00000008)
+#define CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP (0x00000010)
+
+#define CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN (0x00000001)
+
+#define CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE (0x07000000)
+#define CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE (0x04000000)
+#define CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000)
+
+
+/* EEPROM REG */
+#define CSR_EEPROM_REG_READ_VALID_MSK (0x00000001)
+#define CSR_EEPROM_REG_BIT_CMD (0x00000002)
+#define CSR_EEPROM_REG_MSK_ADDR (0x0000FFFC)
+#define CSR_EEPROM_REG_MSK_DATA (0xFFFF0000)
+
+/* EEPROM GP */
+#define CSR_EEPROM_GP_VALID_MSK (0x00000007) /* signature */
+#define CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180)
+#define CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K (0x00000002)
+#define CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K (0x00000004)
+
+/* GP REG */
+#define CSR_GP_REG_POWER_SAVE_STATUS_MSK (0x03000000) /* bit 24/25 */
+#define CSR_GP_REG_NO_POWER_SAVE (0x00000000)
+#define CSR_GP_REG_MAC_POWER_SAVE (0x01000000)
+#define CSR_GP_REG_PHY_POWER_SAVE (0x02000000)
+#define CSR_GP_REG_POWER_SAVE_ERROR (0x03000000)
+
+
+/* CSR GIO */
+#define CSR_GIO_REG_VAL_L0S_ENABLED (0x00000002)
+
+/*
+ * UCODE-DRIVER GP (general purpose) mailbox register 1
+ * Host driver and uCode write and/or read this register to communicate with
+ * each other.
+ * Bit fields:
+ * 4: UCODE_DISABLE
+ * Host sets this to request permanent halt of uCode, same as
+ * sending CARD_STATE command with "halt" bit set.
+ * 3: CT_KILL_EXIT
+ * Host sets this to request exit from CT_KILL state, i.e. host thinks
+ * device temperature is low enough to continue normal operation.
+ * 2: CMD_BLOCKED
+ * Host sets this during RF KILL power-down sequence (HW, SW, CT KILL)
+ * to release uCode to clear all Tx and command queues, enter
+ * unassociated mode, and power down.
+ * NOTE: Some devices also use HBUS_TARG_MBX_C register for this bit.
+ * 1: SW_BIT_RFKILL
+ * Host sets this when issuing CARD_STATE command to request
+ * device sleep.
+ * 0: MAC_SLEEP
+ * uCode sets this when preparing a power-saving power-down.
+ * uCode resets this when power-up is complete and SRAM is sane.
+ * NOTE: 3945/4965 saves internal SRAM data to host when powering down,
+ * and must restore this data after powering back up.
+ * MAC_SLEEP is the best indication that restore is complete.
+ * Later devices (5xxx/6xxx/1xxx) use non-volatile SRAM, and
+ * do not need to save/restore it.
+ */
+#define CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP (0x00000001)
+#define CSR_UCODE_SW_BIT_RFKILL (0x00000002)
+#define CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED (0x00000004)
+#define CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT (0x00000008)
+
+/* GIO Chicken Bits (PCI Express bus link power management) */
+#define CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX (0x00800000)
+#define CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER (0x20000000)
+
+/* LED */
+#define CSR_LED_BSM_CTRL_MSK (0xFFFFFFDF)
+#define CSR_LED_REG_TRUN_ON (0x78)
+#define CSR_LED_REG_TRUN_OFF (0x38)
+
+/* ANA_PLL */
+#define CSR39_ANA_PLL_CFG_VAL (0x01000000)
+
+/* HPET MEM debug */
+#define CSR_DBG_HPET_MEM_REG_VAL (0xFFFF0000)
+
+/* DRAM INT TBL */
+#define CSR_DRAM_INT_TBL_ENABLE (1 << 31)
+#define CSR_DRAM_INIT_TBL_WRAP_CHECK (1 << 27)
+
+/*
+ * HBUS (Host-side Bus)
+ *
+ * HBUS registers are mapped directly into PCI bus space, but are used
+ * to indirectly access device's internal memory or registers that
+ * may be powered-down.
+ *
+ * Use il_wr()/il_rd() family
+ * for these registers;
+ * host must "grab nic access" via CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ
+ * to make sure the MAC (uCode processor, etc.) is powered up for accessing
+ * internal resources.
+ *
+ * Do not use _il_wr()/_il_rd() family to access these registers;
+ * these provide only simple PCI bus access, without waking up the MAC.
+ */
+#define HBUS_BASE (0x400)
+
+/*
+ * Registers for accessing device's internal SRAM memory (e.g. SCD SRAM
+ * structures, error log, event log, verifying uCode load).
+ * First write to address register, then read from or write to data register
+ * to complete the job. Once the address register is set up, accesses to
+ * data registers auto-increment the address by one dword.
+ * Bit usage for address registers (read or write):
+ * 0-31: memory address within device
+ */
+#define HBUS_TARG_MEM_RADDR (HBUS_BASE+0x00c)
+#define HBUS_TARG_MEM_WADDR (HBUS_BASE+0x010)
+#define HBUS_TARG_MEM_WDAT (HBUS_BASE+0x018)
+#define HBUS_TARG_MEM_RDAT (HBUS_BASE+0x01c)
+
+/* Mailbox C, used as workaround alternative to CSR_UCODE_DRV_GP1 mailbox */
+#define HBUS_TARG_MBX_C (HBUS_BASE+0x030)
+#define HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED (0x00000004)
+
+/*
+ * Registers for accessing device's internal peripheral registers
+ * (e.g. SCD, BSM, etc.). First write to address register,
+ * then read from or write to data register to complete the job.
+ * Bit usage for address registers (read or write):
+ * 0-15: register address (offset) within device
+ * 24-25: (# bytes - 1) to read or write (e.g. 3 for dword)
+ */
+#define HBUS_TARG_PRPH_WADDR (HBUS_BASE+0x044)
+#define HBUS_TARG_PRPH_RADDR (HBUS_BASE+0x048)
+#define HBUS_TARG_PRPH_WDAT (HBUS_BASE+0x04c)
+#define HBUS_TARG_PRPH_RDAT (HBUS_BASE+0x050)
+
+/*
+ * Per-Tx-queue write pointer (idx, really!)
+ * Indicates idx to next TFD that driver will fill (1 past latest filled).
+ * Bit usage:
+ * 0-7: queue write idx
+ * 11-8: queue selector
+ */
+#define HBUS_TARG_WRPTR (HBUS_BASE+0x060)
+
+#endif /* !__il_csr_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-csr.h b/drivers/net/wireless/iwlegacy/iwl-csr.h
deleted file mode 100644
index 4db0429..0000000
--- a/drivers/net/wireless/iwlegacy/iwl-csr.h
+++ /dev/null
@@ -1,422 +0,0 @@
-/******************************************************************************
- *
- * This file is provided under a dual BSD/GPLv2 license. When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
- * USA
- *
- * The full GNU General Public License is included in this distribution
- * in the file called LICENSE.GPL.
- *
- * Contact Information:
- * Intel Linux Wireless <[email protected]>
- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
- *
- * BSD LICENSE
- *
- * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *****************************************************************************/
-#ifndef __il_csr_h__
-#define __il_csr_h__
-/*
- * CSR (control and status registers)
- *
- * CSR registers are mapped directly into PCI bus space, and are accessible
- * whenever platform supplies power to device, even when device is in
- * low power states due to driver-invoked device resets
- * (e.g. CSR_RESET_REG_FLAG_SW_RESET) or uCode-driven power-saving modes.
- *
- * Use _il_wr() and _il_rd() family to access these registers;
- * these provide simple PCI bus access, without waking up the MAC.
- * Do not use il_wr() family for these registers;
- * no need to "grab nic access" via CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ.
- * The MAC (uCode processor, etc.) does not need to be powered up for accessing
- * the CSR registers.
- *
- * NOTE: Device does need to be awake in order to read this memory
- * via CSR_EEPROM register
- */
-#define CSR_BASE (0x000)
-
-#define CSR_HW_IF_CONFIG_REG (CSR_BASE+0x000) /* hardware interface config */
-#define CSR_INT_COALESCING (CSR_BASE+0x004) /* accum ints, 32-usec units */
-#define CSR_INT (CSR_BASE+0x008) /* host interrupt status/ack */
-#define CSR_INT_MASK (CSR_BASE+0x00c) /* host interrupt enable */
-#define CSR_FH_INT_STATUS (CSR_BASE+0x010) /* busmaster int status/ack*/
-#define CSR_GPIO_IN (CSR_BASE+0x018) /* read external chip pins */
-#define CSR_RESET (CSR_BASE+0x020) /* busmaster enable, NMI, etc*/
-#define CSR_GP_CNTRL (CSR_BASE+0x024)
-
-/* 2nd byte of CSR_INT_COALESCING, not accessible via _il_wr()! */
-#define CSR_INT_PERIODIC_REG (CSR_BASE+0x005)
-
-/*
- * Hardware revision info
- * Bit fields:
- * 31-8: Reserved
- * 7-4: Type of device: see CSR_HW_REV_TYPE_xxx definitions
- * 3-2: Revision step: 0 = A, 1 = B, 2 = C, 3 = D
- * 1-0: "Dash" (-) value, as in A-1, etc.
- *
- * NOTE: Revision step affects calculation of CCK txpower for 4965.
- * NOTE: See also CSR_HW_REV_WA_REG (work-around for bug in 4965).
- */
-#define CSR_HW_REV (CSR_BASE+0x028)
-
-/*
- * EEPROM memory reads
- *
- * NOTE: Device must be awake, initialized via apm_ops.init(),
- * in order to read.
- */
-#define CSR_EEPROM_REG (CSR_BASE+0x02c)
-#define CSR_EEPROM_GP (CSR_BASE+0x030)
-
-#define CSR_GIO_REG (CSR_BASE+0x03C)
-#define CSR_GP_UCODE_REG (CSR_BASE+0x048)
-#define CSR_GP_DRIVER_REG (CSR_BASE+0x050)
-
-/*
- * UCODE-DRIVER GP (general purpose) mailbox registers.
- * SET/CLR registers set/clear bit(s) if "1" is written.
- */
-#define CSR_UCODE_DRV_GP1 (CSR_BASE+0x054)
-#define CSR_UCODE_DRV_GP1_SET (CSR_BASE+0x058)
-#define CSR_UCODE_DRV_GP1_CLR (CSR_BASE+0x05c)
-#define CSR_UCODE_DRV_GP2 (CSR_BASE+0x060)
-
-#define CSR_LED_REG (CSR_BASE+0x094)
-#define CSR_DRAM_INT_TBL_REG (CSR_BASE+0x0A0)
-
-/* GIO Chicken Bits (PCI Express bus link power management) */
-#define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100)
-
-/* Analog phase-lock-loop configuration */
-#define CSR_ANA_PLL_CFG (CSR_BASE+0x20c)
-
-/*
- * CSR Hardware Revision Workaround Register. Indicates hardware rev;
- * "step" determines CCK backoff for txpower calculation. Used for 4965 only.
- * See also CSR_HW_REV register.
- * Bit fields:
- * 3-2: 0 = A, 1 = B, 2 = C, 3 = D step
- * 1-0: "Dash" (-) value, as in C-1, etc.
- */
-#define CSR_HW_REV_WA_REG (CSR_BASE+0x22C)
-
-#define CSR_DBG_HPET_MEM_REG (CSR_BASE+0x240)
-#define CSR_DBG_LINK_PWR_MGMT_REG (CSR_BASE+0x250)
-
-/* Bits for CSR_HW_IF_CONFIG_REG */
-#define CSR49_HW_IF_CONFIG_REG_BIT_4965_R (0x00000010)
-#define CSR_HW_IF_CONFIG_REG_MSK_BOARD_VER (0x00000C00)
-#define CSR_HW_IF_CONFIG_REG_BIT_MAC_SI (0x00000100)
-#define CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI (0x00000200)
-
-#define CSR39_HW_IF_CONFIG_REG_BIT_3945_MB (0x00000100)
-#define CSR39_HW_IF_CONFIG_REG_BIT_3945_MM (0x00000200)
-#define CSR39_HW_IF_CONFIG_REG_BIT_SKU_MRC (0x00000400)
-#define CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE (0x00000800)
-#define CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A (0x00000000)
-#define CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B (0x00001000)
-
-#define CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A (0x00080000)
-#define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000)
-#define CSR_HW_IF_CONFIG_REG_BIT_NIC_READY (0x00400000) /* PCI_OWN_SEM */
-#define CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE (0x02000000) /* ME_OWN */
-#define CSR_HW_IF_CONFIG_REG_PREPARE (0x08000000) /* WAKE_ME */
-
-#define CSR_INT_PERIODIC_DIS (0x00) /* disable periodic int*/
-#define CSR_INT_PERIODIC_ENA (0xFF) /* 255*32 usec ~ 8 msec*/
-
-/* interrupt flags in INTA, set by uCode or hardware (e.g. dma),
- * acknowledged (reset) by host writing "1" to flagged bits. */
-#define CSR_INT_BIT_FH_RX (1 << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */
-#define CSR_INT_BIT_HW_ERR (1 << 29) /* DMA hardware error FH_INT[31] */
-#define CSR_INT_BIT_RX_PERIODIC (1 << 28) /* Rx periodic */
-#define CSR_INT_BIT_FH_TX (1 << 27) /* Tx DMA FH_INT[1:0] */
-#define CSR_INT_BIT_SCD (1 << 26) /* TXQ pointer advanced */
-#define CSR_INT_BIT_SW_ERR (1 << 25) /* uCode error */
-#define CSR_INT_BIT_RF_KILL (1 << 7) /* HW RFKILL switch GP_CNTRL[27] toggled */
-#define CSR_INT_BIT_CT_KILL (1 << 6) /* Critical temp (chip too hot) rfkill */
-#define CSR_INT_BIT_SW_RX (1 << 3) /* Rx, command responses, 3945 */
-#define CSR_INT_BIT_WAKEUP (1 << 1) /* NIC controller waking up (pwr mgmt) */
-#define CSR_INT_BIT_ALIVE (1 << 0) /* uCode interrupts once it initializes */
-
-#define CSR_INI_SET_MASK (CSR_INT_BIT_FH_RX | \
- CSR_INT_BIT_HW_ERR | \
- CSR_INT_BIT_FH_TX | \
- CSR_INT_BIT_SW_ERR | \
- CSR_INT_BIT_RF_KILL | \
- CSR_INT_BIT_SW_RX | \
- CSR_INT_BIT_WAKEUP | \
- CSR_INT_BIT_ALIVE)
-
-/* interrupt flags in FH (flow handler) (PCI busmaster DMA) */
-#define CSR_FH_INT_BIT_ERR (1 << 31) /* Error */
-#define CSR_FH_INT_BIT_HI_PRIOR (1 << 30) /* High priority Rx, bypass coalescing */
-#define CSR39_FH_INT_BIT_RX_CHNL2 (1 << 18) /* Rx channel 2 (3945 only) */
-#define CSR_FH_INT_BIT_RX_CHNL1 (1 << 17) /* Rx channel 1 */
-#define CSR_FH_INT_BIT_RX_CHNL0 (1 << 16) /* Rx channel 0 */
-#define CSR39_FH_INT_BIT_TX_CHNL6 (1 << 6) /* Tx channel 6 (3945 only) */
-#define CSR_FH_INT_BIT_TX_CHNL1 (1 << 1) /* Tx channel 1 */
-#define CSR_FH_INT_BIT_TX_CHNL0 (1 << 0) /* Tx channel 0 */
-
-#define CSR39_FH_INT_RX_MASK (CSR_FH_INT_BIT_HI_PRIOR | \
- CSR39_FH_INT_BIT_RX_CHNL2 | \
- CSR_FH_INT_BIT_RX_CHNL1 | \
- CSR_FH_INT_BIT_RX_CHNL0)
-
-
-#define CSR39_FH_INT_TX_MASK (CSR39_FH_INT_BIT_TX_CHNL6 | \
- CSR_FH_INT_BIT_TX_CHNL1 | \
- CSR_FH_INT_BIT_TX_CHNL0)
-
-#define CSR49_FH_INT_RX_MASK (CSR_FH_INT_BIT_HI_PRIOR | \
- CSR_FH_INT_BIT_RX_CHNL1 | \
- CSR_FH_INT_BIT_RX_CHNL0)
-
-#define CSR49_FH_INT_TX_MASK (CSR_FH_INT_BIT_TX_CHNL1 | \
- CSR_FH_INT_BIT_TX_CHNL0)
-
-/* GPIO */
-#define CSR_GPIO_IN_BIT_AUX_POWER (0x00000200)
-#define CSR_GPIO_IN_VAL_VAUX_PWR_SRC (0x00000000)
-#define CSR_GPIO_IN_VAL_VMAIN_PWR_SRC (0x00000200)
-
-/* RESET */
-#define CSR_RESET_REG_FLAG_NEVO_RESET (0x00000001)
-#define CSR_RESET_REG_FLAG_FORCE_NMI (0x00000002)
-#define CSR_RESET_REG_FLAG_SW_RESET (0x00000080)
-#define CSR_RESET_REG_FLAG_MASTER_DISABLED (0x00000100)
-#define CSR_RESET_REG_FLAG_STOP_MASTER (0x00000200)
-#define CSR_RESET_LINK_PWR_MGMT_DISABLED (0x80000000)
-
-/*
- * GP (general purpose) CONTROL REGISTER
- * Bit fields:
- * 27: HW_RF_KILL_SW
- * Indicates state of (platform's) hardware RF-Kill switch
- * 26-24: POWER_SAVE_TYPE
- * Indicates current power-saving mode:
- * 000 -- No power saving
- * 001 -- MAC power-down
- * 010 -- PHY (radio) power-down
- * 011 -- Error
- * 9-6: SYS_CONFIG
- * Indicates current system configuration, reflecting pins on chip
- * as forced high/low by device circuit board.
- * 4: GOING_TO_SLEEP
- * Indicates MAC is entering a power-saving sleep power-down.
- * Not a good time to access device-internal resources.
- * 3: MAC_ACCESS_REQ
- * Host sets this to request and maintain MAC wakeup, to allow host
- * access to device-internal resources. Host must wait for
- * MAC_CLOCK_READY (and !GOING_TO_SLEEP) before accessing non-CSR
- * device registers.
- * 2: INIT_DONE
- * Host sets this to put device into fully operational D0 power mode.
- * Host resets this after SW_RESET to put device into low power mode.
- * 0: MAC_CLOCK_READY
- * Indicates MAC (ucode processor, etc.) is powered up and can run.
- * Internal resources are accessible.
- * NOTE: This does not indicate that the processor is actually running.
- * NOTE: This does not indicate that 4965 or 3945 has completed
- * init or post-power-down restore of internal SRAM memory.
- * Use CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP as indication that
- * SRAM is restored and uCode is in normal operation mode.
- * Later devices (5xxx/6xxx/1xxx) use non-volatile SRAM, and
- * do not need to save/restore it.
- * NOTE: After device reset, this bit remains "0" until host sets
- * INIT_DONE
- */
-#define CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY (0x00000001)
-#define CSR_GP_CNTRL_REG_FLAG_INIT_DONE (0x00000004)
-#define CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ (0x00000008)
-#define CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP (0x00000010)
-
-#define CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN (0x00000001)
-
-#define CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE (0x07000000)
-#define CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE (0x04000000)
-#define CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000)
-
-
-/* EEPROM REG */
-#define CSR_EEPROM_REG_READ_VALID_MSK (0x00000001)
-#define CSR_EEPROM_REG_BIT_CMD (0x00000002)
-#define CSR_EEPROM_REG_MSK_ADDR (0x0000FFFC)
-#define CSR_EEPROM_REG_MSK_DATA (0xFFFF0000)
-
-/* EEPROM GP */
-#define CSR_EEPROM_GP_VALID_MSK (0x00000007) /* signature */
-#define CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180)
-#define CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K (0x00000002)
-#define CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K (0x00000004)
-
-/* GP REG */
-#define CSR_GP_REG_POWER_SAVE_STATUS_MSK (0x03000000) /* bit 24/25 */
-#define CSR_GP_REG_NO_POWER_SAVE (0x00000000)
-#define CSR_GP_REG_MAC_POWER_SAVE (0x01000000)
-#define CSR_GP_REG_PHY_POWER_SAVE (0x02000000)
-#define CSR_GP_REG_POWER_SAVE_ERROR (0x03000000)
-
-
-/* CSR GIO */
-#define CSR_GIO_REG_VAL_L0S_ENABLED (0x00000002)
-
-/*
- * UCODE-DRIVER GP (general purpose) mailbox register 1
- * Host driver and uCode write and/or read this register to communicate with
- * each other.
- * Bit fields:
- * 4: UCODE_DISABLE
- * Host sets this to request permanent halt of uCode, same as
- * sending CARD_STATE command with "halt" bit set.
- * 3: CT_KILL_EXIT
- * Host sets this to request exit from CT_KILL state, i.e. host thinks
- * device temperature is low enough to continue normal operation.
- * 2: CMD_BLOCKED
- * Host sets this during RF KILL power-down sequence (HW, SW, CT KILL)
- * to release uCode to clear all Tx and command queues, enter
- * unassociated mode, and power down.
- * NOTE: Some devices also use HBUS_TARG_MBX_C register for this bit.
- * 1: SW_BIT_RFKILL
- * Host sets this when issuing CARD_STATE command to request
- * device sleep.
- * 0: MAC_SLEEP
- * uCode sets this when preparing a power-saving power-down.
- * uCode resets this when power-up is complete and SRAM is sane.
- * NOTE: 3945/4965 saves internal SRAM data to host when powering down,
- * and must restore this data after powering back up.
- * MAC_SLEEP is the best indication that restore is complete.
- * Later devices (5xxx/6xxx/1xxx) use non-volatile SRAM, and
- * do not need to save/restore it.
- */
-#define CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP (0x00000001)
-#define CSR_UCODE_SW_BIT_RFKILL (0x00000002)
-#define CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED (0x00000004)
-#define CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT (0x00000008)
-
-/* GIO Chicken Bits (PCI Express bus link power management) */
-#define CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX (0x00800000)
-#define CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER (0x20000000)
-
-/* LED */
-#define CSR_LED_BSM_CTRL_MSK (0xFFFFFFDF)
-#define CSR_LED_REG_TRUN_ON (0x78)
-#define CSR_LED_REG_TRUN_OFF (0x38)
-
-/* ANA_PLL */
-#define CSR39_ANA_PLL_CFG_VAL (0x01000000)
-
-/* HPET MEM debug */
-#define CSR_DBG_HPET_MEM_REG_VAL (0xFFFF0000)
-
-/* DRAM INT TBL */
-#define CSR_DRAM_INT_TBL_ENABLE (1 << 31)
-#define CSR_DRAM_INIT_TBL_WRAP_CHECK (1 << 27)
-
-/*
- * HBUS (Host-side Bus)
- *
- * HBUS registers are mapped directly into PCI bus space, but are used
- * to indirectly access device's internal memory or registers that
- * may be powered-down.
- *
- * Use il_wr()/il_rd() family
- * for these registers;
- * host must "grab nic access" via CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ
- * to make sure the MAC (uCode processor, etc.) is powered up for accessing
- * internal resources.
- *
- * Do not use _il_wr()/_il_rd() family to access these registers;
- * these provide only simple PCI bus access, without waking up the MAC.
- */
-#define HBUS_BASE (0x400)
-
-/*
- * Registers for accessing device's internal SRAM memory (e.g. SCD SRAM
- * structures, error log, event log, verifying uCode load).
- * First write to address register, then read from or write to data register
- * to complete the job. Once the address register is set up, accesses to
- * data registers auto-increment the address by one dword.
- * Bit usage for address registers (read or write):
- * 0-31: memory address within device
- */
-#define HBUS_TARG_MEM_RADDR (HBUS_BASE+0x00c)
-#define HBUS_TARG_MEM_WADDR (HBUS_BASE+0x010)
-#define HBUS_TARG_MEM_WDAT (HBUS_BASE+0x018)
-#define HBUS_TARG_MEM_RDAT (HBUS_BASE+0x01c)
-
-/* Mailbox C, used as workaround alternative to CSR_UCODE_DRV_GP1 mailbox */
-#define HBUS_TARG_MBX_C (HBUS_BASE+0x030)
-#define HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED (0x00000004)
-
-/*
- * Registers for accessing device's internal peripheral registers
- * (e.g. SCD, BSM, etc.). First write to address register,
- * then read from or write to data register to complete the job.
- * Bit usage for address registers (read or write):
- * 0-15: register address (offset) within device
- * 24-25: (# bytes - 1) to read or write (e.g. 3 for dword)
- */
-#define HBUS_TARG_PRPH_WADDR (HBUS_BASE+0x044)
-#define HBUS_TARG_PRPH_RADDR (HBUS_BASE+0x048)
-#define HBUS_TARG_PRPH_WDAT (HBUS_BASE+0x04c)
-#define HBUS_TARG_PRPH_RDAT (HBUS_BASE+0x050)
-
-/*
- * Per-Tx-queue write pointer (idx, really!)
- * Indicates idx to next TFD that driver will fill (1 past latest filled).
- * Bit usage:
- * 0-7: queue write idx
- * 11-8: queue selector
- */
-#define HBUS_TARG_WRPTR (HBUS_BASE+0x060)
-
-#endif /* !__il_csr_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h
index 991b455..ce5bc53 100644
--- a/drivers/net/wireless/iwlegacy/iwl-dev.h
+++ b/drivers/net/wireless/iwlegacy/iwl-dev.h
@@ -40,7 +40,7 @@
#include <net/ieee80211_radiotap.h>

#include "iwl-eeprom.h"
-#include "iwl-csr.h"
+#include "csr.h"
#include "iwl-prph.h"
#include "iwl-debug.h"
#include "4965.h"
--
1.7.1


2011-11-18 08:21:41

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 24/77] iwlegacy: s/INDEX/IDX/

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/iwl-3945-rs.c | 36 +++++-----
drivers/net/wireless/iwlegacy/iwl-3945.c | 82 +++++++++++-----------
drivers/net/wireless/iwlegacy/iwl-4965-calib.c | 22 +++---
drivers/net/wireless/iwlegacy/iwl-4965-hw.h | 4 +-
drivers/net/wireless/iwlegacy/iwl-4965-rs.c | 36 +++++-----
drivers/net/wireless/iwlegacy/iwl-4965-sta.c | 4 +-
drivers/net/wireless/iwlegacy/iwl-4965-tx.c | 4 +-
drivers/net/wireless/iwlegacy/iwl-4965.c | 8 +-
drivers/net/wireless/iwlegacy/iwl-commands.h | 60 ++++++++--------
drivers/net/wireless/iwlegacy/iwl-fh.h | 2 +-
drivers/net/wireless/iwlegacy/iwl-legacy-rs.h | 90 ++++++++++++------------
drivers/net/wireless/iwlegacy/iwl-power.h | 10 ++--
drivers/net/wireless/iwlegacy/iwl-rx.c | 8 +-
drivers/net/wireless/iwlegacy/iwl-tx.c | 4 +-
drivers/net/wireless/iwlegacy/iwl3945-base.c | 10 ++--
15 files changed, 190 insertions(+), 190 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
index 92fa436..4d83c62 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
@@ -64,27 +64,27 @@ struct il3945_tpt_entry {
};

static struct il3945_tpt_entry il3945_tpt_table_a[] = {
- {-60, RATE_54M_INDEX},
- {-64, RATE_48M_INDEX},
- {-72, RATE_36M_INDEX},
- {-80, RATE_24M_INDEX},
- {-84, RATE_18M_INDEX},
- {-85, RATE_12M_INDEX},
- {-87, RATE_9M_INDEX},
- {-89, RATE_6M_INDEX}
+ {-60, RATE_54M_IDX},
+ {-64, RATE_48M_IDX},
+ {-72, RATE_36M_IDX},
+ {-80, RATE_24M_IDX},
+ {-84, RATE_18M_IDX},
+ {-85, RATE_12M_IDX},
+ {-87, RATE_9M_IDX},
+ {-89, RATE_6M_IDX}
};

static struct il3945_tpt_entry il3945_tpt_table_g[] = {
- {-60, RATE_54M_INDEX},
- {-64, RATE_48M_INDEX},
- {-68, RATE_36M_INDEX},
- {-80, RATE_24M_INDEX},
- {-84, RATE_18M_INDEX},
- {-85, RATE_12M_INDEX},
- {-86, RATE_11M_INDEX},
- {-88, RATE_5M_INDEX},
- {-90, RATE_2M_INDEX},
- {-92, RATE_1M_INDEX}
+ {-60, RATE_54M_IDX},
+ {-64, RATE_48M_IDX},
+ {-68, RATE_36M_IDX},
+ {-80, RATE_24M_IDX},
+ {-84, RATE_18M_IDX},
+ {-85, RATE_12M_IDX},
+ {-86, RATE_11M_IDX},
+ {-88, RATE_5M_IDX},
+ {-90, RATE_2M_IDX},
+ {-92, RATE_1M_IDX}
};

#define RATE_MAX_WINDOW 62
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.c b/drivers/net/wireless/iwlegacy/iwl-3945.c
index 728a90c..3908bff 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945.c
@@ -52,16 +52,16 @@
#include "iwl-3945-debugfs.h"

#define IL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \
- [RATE_##r##M_INDEX] = { RATE_##r##M_PLCP, \
+ [RATE_##r##M_IDX] = { RATE_##r##M_PLCP, \
RATE_##r##M_IEEE, \
- RATE_##ip##M_INDEX, \
- RATE_##in##M_INDEX, \
- RATE_##rp##M_INDEX, \
- RATE_##rn##M_INDEX, \
- RATE_##pp##M_INDEX, \
- RATE_##np##M_INDEX, \
- RATE_##r##M_INDEX_TABLE, \
- RATE_##ip##M_INDEX_TABLE }
+ RATE_##ip##M_IDX, \
+ RATE_##in##M_IDX, \
+ RATE_##rp##M_IDX, \
+ RATE_##rn##M_IDX, \
+ RATE_##pp##M_IDX, \
+ RATE_##np##M_IDX, \
+ RATE_##r##M_IDX_TABLE, \
+ RATE_##ip##M_IDX_TABLE }

/*
* Parameter order:
@@ -246,16 +246,16 @@ int il3945_rs_next_rate(struct il_priv *il, int rate)

switch (il->band) {
case IEEE80211_BAND_5GHZ:
- if (rate == RATE_12M_INDEX)
- next_rate = RATE_9M_INDEX;
- else if (rate == RATE_6M_INDEX)
- next_rate = RATE_6M_INDEX;
+ if (rate == RATE_12M_IDX)
+ next_rate = RATE_9M_IDX;
+ else if (rate == RATE_6M_IDX)
+ next_rate = RATE_6M_IDX;
break;
case IEEE80211_BAND_2GHZ:
if (!(il->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) &&
il_is_associated(il)) {
- if (rate == RATE_11M_INDEX)
- next_rate = RATE_5M_INDEX;
+ if (rate == RATE_11M_IDX)
+ next_rate = RATE_5M_IDX;
}
break;

@@ -307,7 +307,7 @@ static void il3945_rx_reply_tx(struct il_priv *il,
struct il_rx_pkt *pkt = rxb_addr(rxb);
u16 sequence = le16_to_cpu(pkt->hdr.sequence);
int txq_id = SEQ_TO_QUEUE(sequence);
- int index = SEQ_TO_INDEX(sequence);
+ int index = SEQ_TO_IDX(sequence);
struct il_tx_queue *txq = &il->txq[txq_id];
struct ieee80211_tx_info *info;
struct il3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
@@ -1133,7 +1133,7 @@ static int il3945_is_temp_calib_needed(struct il_priv *il)

#define IL_MAX_GAIN_ENTRIES 78
#define IL_CCK_FROM_OFDM_POWER_DIFF -5
-#define IL_CCK_FROM_OFDM_INDEX_DIFF (10)
+#define IL_CCK_FROM_OFDM_IDX_DIFF (10)

/* radio and DSP power table, each step is 1/2 dB.
* 1st number is for RF analog gain, 2nd number is for DSP pre-DAC gain. */
@@ -1330,7 +1330,7 @@ static void il3945_hw_reg_set_scan_power(struct il_priv *il, u32 scan_tbl_index,
/* use this channel group's 6Mbit clipping/saturation pwr,
* but cap at regulatory scan power restriction (set during init
* based on eeprom channel data) for this channel. */
- power = min(ch_info->scan_power, clip_pwrs[RATE_6M_INDEX_TABLE]);
+ power = min(ch_info->scan_power, clip_pwrs[RATE_6M_IDX_TABLE]);

power = min(power, il->tx_power_user_lmt);
scan_power_info->requested_power = power;
@@ -1342,7 +1342,7 @@ static void il3945_hw_reg_set_scan_power(struct il_priv *il, u32 scan_tbl_index,
* *index*. */
power_index = ch_info->power_info[rate_index].power_table_index
- (power - ch_info->power_info
- [RATE_6M_INDEX_TABLE].requested_power) * 2;
+ [RATE_6M_IDX_TABLE].requested_power) * 2;

/* store reference index that we use when adjusting *all* scan
* powers. So we can accommodate user (all channel) or spectrum
@@ -1466,7 +1466,7 @@ static int il3945_hw_reg_set_new_power(struct il_priv *il,
power_info = ch_info->power_info;

/* update OFDM Txpower settings */
- for (i = RATE_6M_INDEX_TABLE; i <= RATE_54M_INDEX_TABLE;
+ for (i = RATE_6M_IDX_TABLE; i <= RATE_54M_IDX_TABLE;
i++, ++power_info) {
int delta_idx;

@@ -1490,15 +1490,15 @@ static int il3945_hw_reg_set_new_power(struct il_priv *il,
* ... all CCK power settings for a given channel are the *same*. */
if (power_changed) {
power =
- ch_info->power_info[RATE_12M_INDEX_TABLE].
+ ch_info->power_info[RATE_12M_IDX_TABLE].
requested_power + IL_CCK_FROM_OFDM_POWER_DIFF;

/* do all CCK rates' il3945_channel_power_info structures */
- for (i = RATE_1M_INDEX_TABLE; i <= RATE_11M_INDEX_TABLE; i++) {
+ for (i = RATE_1M_IDX_TABLE; i <= RATE_11M_IDX_TABLE; i++) {
power_info->requested_power = power;
power_info->base_power_index =
- ch_info->power_info[RATE_12M_INDEX_TABLE].
- base_power_index + IL_CCK_FROM_OFDM_INDEX_DIFF;
+ ch_info->power_info[RATE_12M_IDX_TABLE].
+ base_power_index + IL_CCK_FROM_OFDM_IDX_DIFF;
++power_info;
}
}
@@ -1597,7 +1597,7 @@ static int il3945_hw_reg_comp_txpower_temp(struct il_priv *il)
for (scan_tbl_index = 0;
scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) {
s32 actual_index = (scan_tbl_index == 0) ?
- RATE_1M_INDEX_TABLE : RATE_6M_INDEX_TABLE;
+ RATE_1M_IDX_TABLE : RATE_6M_IDX_TABLE;
il3945_hw_reg_set_scan_power(il, scan_tbl_index,
actual_index, clip_pwrs,
ch_info, a_band);
@@ -2012,19 +2012,19 @@ static void il3945_hw_reg_init_channel_groups(struct il_priv *il)
for (rate_index = 0;
rate_index < RATE_COUNT_3945; rate_index++, clip_pwrs++) {
switch (rate_index) {
- case RATE_36M_INDEX_TABLE:
+ case RATE_36M_IDX_TABLE:
if (i == 0) /* B/G */
*clip_pwrs = satur_pwr;
else /* A */
*clip_pwrs = satur_pwr - 5;
break;
- case RATE_48M_INDEX_TABLE:
+ case RATE_48M_IDX_TABLE:
if (i == 0)
*clip_pwrs = satur_pwr - 7;
else
*clip_pwrs = satur_pwr - 10;
break;
- case RATE_54M_INDEX_TABLE:
+ case RATE_54M_IDX_TABLE:
if (i == 0)
*clip_pwrs = satur_pwr - 9;
else
@@ -2139,13 +2139,13 @@ int il3945_txpower_set_from_eeprom(struct il_priv *il)
}

/* set tx power for CCK rates, based on OFDM 12 Mbit settings*/
- pwr_info = &ch_info->power_info[RATE_12M_INDEX_TABLE];
+ pwr_info = &ch_info->power_info[RATE_12M_IDX_TABLE];
power = pwr_info->requested_power +
IL_CCK_FROM_OFDM_POWER_DIFF;
pwr_index = pwr_info->power_table_index +
- IL_CCK_FROM_OFDM_INDEX_DIFF;
+ IL_CCK_FROM_OFDM_IDX_DIFF;
base_pwr_index = pwr_info->base_power_index +
- IL_CCK_FROM_OFDM_INDEX_DIFF;
+ IL_CCK_FROM_OFDM_IDX_DIFF;

/* stay within table range */
pwr_index = il3945_hw_reg_fix_power_index(pwr_index);
@@ -2169,7 +2169,7 @@ int il3945_txpower_set_from_eeprom(struct il_priv *il)
for (scan_tbl_index = 0;
scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) {
s32 actual_index = (scan_tbl_index == 0) ?
- RATE_1M_INDEX_TABLE : RATE_6M_INDEX_TABLE;
+ RATE_1M_IDX_TABLE : RATE_6M_IDX_TABLE;
il3945_hw_reg_set_scan_power(il, scan_tbl_index,
actual_index, clip_pwrs, ch_info, a_band);
}
@@ -2326,17 +2326,17 @@ int il3945_init_hw_rate_table(struct il_priv *il)
D_RATE("Select A mode rate scale\n");
/* If one of the following CCK rates is used,
* have it fall back to the 6M OFDM rate */
- for (i = RATE_1M_INDEX_TABLE;
- i <= RATE_11M_INDEX_TABLE; i++)
+ for (i = RATE_1M_IDX_TABLE;
+ i <= RATE_11M_IDX_TABLE; i++)
table[i].next_rate_index =
il3945_rates[IL_FIRST_OFDM_RATE].table_rs_index;

/* Don't fall back to CCK rates */
- table[RATE_12M_INDEX_TABLE].next_rate_index =
- RATE_9M_INDEX_TABLE;
+ table[RATE_12M_IDX_TABLE].next_rate_index =
+ RATE_9M_IDX_TABLE;

/* Don't drop out of OFDM rates */
- table[RATE_6M_INDEX_TABLE].next_rate_index =
+ table[RATE_6M_IDX_TABLE].next_rate_index =
il3945_rates[IL_FIRST_OFDM_RATE].table_rs_index;
break;

@@ -2349,14 +2349,14 @@ int il3945_init_hw_rate_table(struct il_priv *il)
il_is_associated(il)) {

index = IL_FIRST_CCK_RATE;
- for (i = RATE_6M_INDEX_TABLE;
- i <= RATE_54M_INDEX_TABLE; i++)
+ for (i = RATE_6M_IDX_TABLE;
+ i <= RATE_54M_IDX_TABLE; i++)
table[i].next_rate_index =
il3945_rates[index].table_rs_index;

- index = RATE_11M_INDEX_TABLE;
+ index = RATE_11M_IDX_TABLE;
/* CCK shouldn't fall back to OFDM... */
- table[index].next_rate_index = RATE_5M_INDEX_TABLE;
+ table[index].next_rate_index = RATE_5M_IDX_TABLE;
}
break;

diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-calib.c b/drivers/net/wireless/iwlegacy/iwl-4965-calib.c
index bb3bc15..d622b27 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-calib.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-calib.c
@@ -374,30 +374,30 @@ static void il4965_prepare_legacy_sensitivity_tbl(struct il_priv *il,
struct il_sensitivity_data *data,
__le16 *tbl)
{
- tbl[HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX] =
+ tbl[HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX] =
cpu_to_le16((u16)data->auto_corr_ofdm);
- tbl[HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX] =
+ tbl[HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX] =
cpu_to_le16((u16)data->auto_corr_ofdm_mrc);
- tbl[HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX] =
+ tbl[HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX] =
cpu_to_le16((u16)data->auto_corr_ofdm_x1);
- tbl[HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX] =
+ tbl[HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX] =
cpu_to_le16((u16)data->auto_corr_ofdm_mrc_x1);

- tbl[HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX] =
+ tbl[HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX] =
cpu_to_le16((u16)data->auto_corr_cck);
- tbl[HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX] =
+ tbl[HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX] =
cpu_to_le16((u16)data->auto_corr_cck_mrc);

- tbl[HD_MIN_ENERGY_CCK_DET_INDEX] =
+ tbl[HD_MIN_ENERGY_CCK_DET_IDX] =
cpu_to_le16((u16)data->nrg_th_cck);
- tbl[HD_MIN_ENERGY_OFDM_DET_INDEX] =
+ tbl[HD_MIN_ENERGY_OFDM_DET_IDX] =
cpu_to_le16((u16)data->nrg_th_ofdm);

- tbl[HD_BARKER_CORR_TH_ADD_MIN_INDEX] =
+ tbl[HD_BARKER_CORR_TH_ADD_MIN_IDX] =
cpu_to_le16(data->barker_corr_th_min);
- tbl[HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX] =
+ tbl[HD_BARKER_CORR_TH_ADD_MIN_MRC_IDX] =
cpu_to_le16(data->barker_corr_th_min_mrc);
- tbl[HD_OFDM_ENERGY_TH_IN_INDEX] =
+ tbl[HD_OFDM_ENERGY_TH_IN_IDX] =
cpu_to_le16(data->nrg_th_cca);

D_CALIB("ofdm: ac %u mrc %u x1 %u mrc_x1 %u thresh %u\n",
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
index 83748c7..2c1b000 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
@@ -433,8 +433,8 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
* present during factory calibration). A 5 Ghz EEPROM index of "40"
* corresponds to the 49th entry in the table used by the driver.
*/
-#define MIN_TX_GAIN_INDEX (0) /* highest gain, lowest idx, 2.4 */
-#define MIN_TX_GAIN_INDEX_52GHZ_EXT (-9) /* highest gain, lowest idx, 5 */
+#define MIN_TX_GAIN_IDX (0) /* highest gain, lowest idx, 2.4 */
+#define MIN_TX_GAIN_IDX_52GHZ_EXT (-9) /* highest gain, lowest idx, 5 */

/**
* 2.4 GHz gain table
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
index e31ee20..7478e91 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
@@ -56,13 +56,13 @@
#define RATE_SCALE_FLUSH_INTVL (3*HZ)

static u8 rs_ht_to_legacy[] = {
- RATE_6M_INDEX, RATE_6M_INDEX,
- RATE_6M_INDEX, RATE_6M_INDEX,
- RATE_6M_INDEX,
- RATE_6M_INDEX, RATE_9M_INDEX,
- RATE_12M_INDEX, RATE_18M_INDEX,
- RATE_24M_INDEX, RATE_36M_INDEX,
- RATE_48M_INDEX, RATE_54M_INDEX
+ RATE_6M_IDX, RATE_6M_IDX,
+ RATE_6M_IDX, RATE_6M_IDX,
+ RATE_6M_IDX,
+ RATE_6M_IDX, RATE_9M_IDX,
+ RATE_12M_IDX, RATE_18M_IDX,
+ RATE_24M_IDX, RATE_36M_IDX,
+ RATE_48M_IDX, RATE_54M_IDX
};

static const u8 ant_toggle_lookup[] = {
@@ -77,16 +77,16 @@ static const u8 ant_toggle_lookup[] = {
};

#define IL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \
- [RATE_##r##M_INDEX] = { RATE_##r##M_PLCP, \
+ [RATE_##r##M_IDX] = { RATE_##r##M_PLCP, \
RATE_SISO_##s##M_PLCP, \
RATE_MIMO2_##s##M_PLCP,\
RATE_##r##M_IEEE, \
- RATE_##ip##M_INDEX, \
- RATE_##in##M_INDEX, \
- RATE_##rp##M_INDEX, \
- RATE_##rn##M_INDEX, \
- RATE_##pp##M_INDEX, \
- RATE_##np##M_INDEX }
+ RATE_##ip##M_IDX, \
+ RATE_##in##M_IDX, \
+ RATE_##rp##M_IDX, \
+ RATE_##rn##M_IDX, \
+ RATE_##pp##M_IDX, \
+ RATE_##np##M_IDX }

/*
* Parameter order:
@@ -125,7 +125,7 @@ static int il4965_hwrate_to_plcp_idx(u32 rate_n_flags)

idx += IL_FIRST_OFDM_RATE;
/* skip 9M not supported in ht*/
- if (idx >= RATE_9M_INDEX)
+ if (idx >= RATE_9M_IDX)
idx += 1;
if (idx >= IL_FIRST_OFDM_RATE && idx <= IL_LAST_OFDM_RATE)
return idx;
@@ -218,7 +218,7 @@ static const struct il_rate_mcs_info il_rate_mcs[RATE_COUNT] = {
{ "60", "64QAM 5/6"},
};

-#define MCS_INDEX_PER_STREAM (8)
+#define MCS_IDX_PER_STREAM (8)

static inline u8 il4965_rs_extract_rate(u32 rate_n_flags)
{
@@ -856,7 +856,7 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
/* For HT packets, map MCS to PLCP */
if (mac_flags & IEEE80211_TX_RC_MCS) {
mac_index &= RATE_MCS_CODE_MSK; /* Remove # of streams */
- if (mac_index >= (RATE_9M_INDEX - IL_FIRST_OFDM_RATE))
+ if (mac_index >= (RATE_9M_IDX - IL_FIRST_OFDM_RATE))
mac_index++;
/*
* mac80211 HT index is always zero-indexed; we need to move
@@ -2276,7 +2276,7 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
rate_idx = (rate_idx > 0) ? (rate_idx - 1) : 0;
if (il4965_rs_extract_rate(lq_sta->last_rate_n_flags) >=
RATE_MIMO2_6M_PLCP)
- rate_idx = rate_idx + MCS_INDEX_PER_STREAM;
+ rate_idx = rate_idx + MCS_IDX_PER_STREAM;
info->control.rates[0].flags = IEEE80211_TX_RC_MCS;
if (lq_sta->last_rate_n_flags & RATE_MCS_SGI_MSK)
info->control.rates[0].flags |=
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
index 278517c..c50d639 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
@@ -50,9 +50,9 @@ il4965_sta_alloc_lq(struct il_priv *il, u8 sta_id)
/* Set up the rate scaling to start at selected rate, fall back
* all the way down to 1M in IEEE order, and then spin on 1M */
if (il->band == IEEE80211_BAND_5GHZ)
- r = RATE_6M_INDEX;
+ r = RATE_6M_IDX;
else
- r = RATE_1M_INDEX;
+ r = RATE_1M_IDX;

if (r >= IL_FIRST_CCK_RATE && r <= IL_LAST_CCK_RATE)
rate_flags |= RATE_MCS_CCK_MSK;
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
index 9671e10..8f18d36 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
@@ -423,7 +423,7 @@ int il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)
*/
out_cmd->hdr.cmd = REPLY_TX;
out_cmd->hdr.sequence = cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) |
- INDEX_TO_SEQ(q->write_ptr)));
+ IDX_TO_SEQ(q->write_ptr)));

/* Copy MAC header from skb into command buffer */
memcpy(tx_cmd->hdr, hdr, hdr_len);
@@ -1172,7 +1172,7 @@ static int il4965_tx_status_reply_compressed_ba(struct il_priv *il,
ba_resp->seq_ctl);

/* Calculate shift to align block-ack bits with our Tx win bits */
- sh = agg->start_idx - SEQ_TO_INDEX(seq_ctl >> 4);
+ sh = agg->start_idx - SEQ_TO_IDX(seq_ctl >> 4);
if (sh < 0) /* tbw something is wrong with indices */
sh += 0x100;

diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c
index f62475d..58bdf93 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.c
@@ -632,9 +632,9 @@ static s32 get_min_power_index(s32 rate_power_index, u32 band)
{
if (!band) {
if ((rate_power_index & 7) <= 4)
- return MIN_TX_GAIN_INDEX_52GHZ_EXT;
+ return MIN_TX_GAIN_IDX_52GHZ_EXT;
}
- return MIN_TX_GAIN_INDEX;
+ return MIN_TX_GAIN_IDX;
}

struct gain_entry {
@@ -1654,7 +1654,7 @@ static int il4965_tx_status_reply_tx(struct il_priv *il,
u16 sc;
status = le16_to_cpu(frame_status[i].status);
seq = le16_to_cpu(frame_status[i].sequence);
- idx = SEQ_TO_INDEX(seq);
+ idx = SEQ_TO_IDX(seq);
txq_id = SEQ_TO_QUEUE(seq);

if (status & (AGG_TX_STATE_FEW_BYTES_MSK |
@@ -1777,7 +1777,7 @@ static void il4965_rx_reply_tx(struct il_priv *il,
struct il_rx_pkt *pkt = rxb_addr(rxb);
u16 sequence = le16_to_cpu(pkt->hdr.sequence);
int txq_id = SEQ_TO_QUEUE(sequence);
- int index = SEQ_TO_INDEX(sequence);
+ int index = SEQ_TO_IDX(sequence);
struct il_tx_queue *txq = &il->txq[txq_id];
struct ieee80211_hdr *hdr;
struct ieee80211_tx_info *info;
diff --git a/drivers/net/wireless/iwlegacy/iwl-commands.h b/drivers/net/wireless/iwlegacy/iwl-commands.h
index aed1101..002f1d7 100644
--- a/drivers/net/wireless/iwlegacy/iwl-commands.h
+++ b/drivers/net/wireless/iwlegacy/iwl-commands.h
@@ -168,8 +168,8 @@ enum {

#define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f)
#define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8)
-#define SEQ_TO_INDEX(s) ((s) & 0xff)
-#define INDEX_TO_SEQ(i) ((i) & 0xff)
+#define SEQ_TO_IDX(s) ((s) & 0xff)
+#define IDX_TO_SEQ(i) ((i) & 0xff)
#define SEQ_HUGE_FRAME cpu_to_le16(0x4000)
#define SEQ_RX_FRAME cpu_to_le16(0x8000)

@@ -3116,10 +3116,10 @@ struct il_missed_beacon_notif {
* maximum sensitivity):
*
* START / MIN / MAX
- * HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX 90 / 85 / 120
- * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX 170 / 170 / 210
- * HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX 105 / 105 / 140
- * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX 220 / 220 / 270
+ * HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX 90 / 85 / 120
+ * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX 170 / 170 / 210
+ * HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX 105 / 105 / 140
+ * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX 220 / 220 / 270
*
* If actual rate of OFDM false alarms (+ plcp_errors) is too high
* (greater than 50 for each 204.8 msecs listening), reduce sensitivity
@@ -3156,26 +3156,26 @@ struct il_missed_beacon_notif {
* (notice that the start points for CCK are at maximum sensitivity):
*
* START / MIN / MAX
- * HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX 125 / 125 / 200
- * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX 200 / 200 / 400
- * HD_MIN_ENERGY_CCK_DET_INDEX 100 / 0 / 100
+ * HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX 125 / 125 / 200
+ * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX 200 / 200 / 400
+ * HD_MIN_ENERGY_CCK_DET_IDX 100 / 0 / 100
*
* If actual rate of CCK false alarms (+ plcp_errors) is too high
* (greater than 50 for each 204.8 msecs listening), method for reducing
* sensitivity is:
*
- * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX,
+ * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX,
* up to max 400.
*
- * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is < 160,
+ * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX is < 160,
* sensitivity has been reduced a significant amount; bring it up to
* a moderate 161. Otherwise, *add* 3, up to max 200.
*
- * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is > 160,
+ * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX is > 160,
* sensitivity has been reduced only a moderate or small amount;
- * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_INDEX,
+ * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_IDX,
* down to min 0. Otherwise (if gain has been significantly reduced),
- * don't change the HD_MIN_ENERGY_CCK_DET_INDEX value.
+ * don't change the HD_MIN_ENERGY_CCK_DET_IDX value.
*
* b) Save a snapshot of the "silence reference".
*
@@ -3191,13 +3191,13 @@ struct il_missed_beacon_notif {
*
* Method for increasing sensitivity:
*
- * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX,
+ * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX,
* down to min 125.
*
- * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX,
+ * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX,
* down to min 200.
*
- * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_INDEX, up to max 100.
+ * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_IDX, up to max 100.
*
* If actual rate of CCK false alarms (+ plcp_errors) is within good range
* (between 5 and 50 for each 204.8 msecs listening):
@@ -3206,13 +3206,13 @@ struct il_missed_beacon_notif {
*
* 2) If previous beacon had too many CCK false alarms (+ plcp_errors),
* give some extra margin to energy threshold by *subtracting* 8
- * from value in HD_MIN_ENERGY_CCK_DET_INDEX.
+ * from value in HD_MIN_ENERGY_CCK_DET_IDX.
*
* For all cases (too few, too many, good range), make sure that the CCK
* detection threshold (energy) is below the energy level for robust
* detection over the past 10 beacon periods, the "Max cck energy".
* Lower values mean higher energy; this means making sure that the value
- * in HD_MIN_ENERGY_CCK_DET_INDEX is at or *above* "Max cck energy".
+ * in HD_MIN_ENERGY_CCK_DET_IDX is at or *above* "Max cck energy".
*
*/

@@ -3220,17 +3220,17 @@ struct il_missed_beacon_notif {
* Table entries in SENSITIVITY_CMD (struct il_sensitivity_cmd)
*/
#define HD_TABLE_SIZE (11) /* number of entries */
-#define HD_MIN_ENERGY_CCK_DET_INDEX (0) /* table indexes */
-#define HD_MIN_ENERGY_OFDM_DET_INDEX (1)
-#define HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX (2)
-#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX (3)
-#define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX (4)
-#define HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX (5)
-#define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX (6)
-#define HD_BARKER_CORR_TH_ADD_MIN_INDEX (7)
-#define HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX (8)
-#define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX (9)
-#define HD_OFDM_ENERGY_TH_IN_INDEX (10)
+#define HD_MIN_ENERGY_CCK_DET_IDX (0) /* table indexes */
+#define HD_MIN_ENERGY_OFDM_DET_IDX (1)
+#define HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX (2)
+#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX (3)
+#define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX (4)
+#define HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX (5)
+#define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX (6)
+#define HD_BARKER_CORR_TH_ADD_MIN_IDX (7)
+#define HD_BARKER_CORR_TH_ADD_MIN_MRC_IDX (8)
+#define HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX (9)
+#define HD_OFDM_ENERGY_TH_IN_IDX (10)

/* Control field in struct il_sensitivity_cmd */
#define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE cpu_to_le16(0)
diff --git a/drivers/net/wireless/iwlegacy/iwl-fh.h b/drivers/net/wireless/iwlegacy/iwl-fh.h
index 0ae36df..e993e3e 100644
--- a/drivers/net/wireless/iwlegacy/iwl-fh.h
+++ b/drivers/net/wireless/iwlegacy/iwl-fh.h
@@ -162,7 +162,7 @@
* RBs), should be 8 after preparing the first 8 RBs (for example), and must
* wrap back to 0 at the end of the circular buffer (but don't wrap before
* "read" index has advanced past 1! See below).
- * NOTE: 4965 EXPECTS THE WRITE INDEX TO BE INCREMENTED IN MULTIPLES OF 8.
+ * NOTE: 4965 EXPECTS THE WRITE IDX TO BE INCREMENTED IN MULTIPLES OF 8.
*
* As the 4965 fills RBs (referenced from contiguous RBDs within the circular
* buffer), it updates the Rx status buffer in host DRAM, 2) described above,
diff --git a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
index 6670f2e..f3ee0dd 100644
--- a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
+++ b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
@@ -59,64 +59,64 @@ struct il3945_rate_info {
* struct il_rate_info il_rates[RATE_COUNT];
*/
enum {
- RATE_1M_INDEX = 0,
- RATE_2M_INDEX,
- RATE_5M_INDEX,
- RATE_11M_INDEX,
- RATE_6M_INDEX,
- RATE_9M_INDEX,
- RATE_12M_INDEX,
- RATE_18M_INDEX,
- RATE_24M_INDEX,
- RATE_36M_INDEX,
- RATE_48M_INDEX,
- RATE_54M_INDEX,
- RATE_60M_INDEX,
+ RATE_1M_IDX = 0,
+ RATE_2M_IDX,
+ RATE_5M_IDX,
+ RATE_11M_IDX,
+ RATE_6M_IDX,
+ RATE_9M_IDX,
+ RATE_12M_IDX,
+ RATE_18M_IDX,
+ RATE_24M_IDX,
+ RATE_36M_IDX,
+ RATE_48M_IDX,
+ RATE_54M_IDX,
+ RATE_60M_IDX,
RATE_COUNT,
RATE_COUNT_LEGACY = RATE_COUNT - 1, /* Excluding 60M */
RATE_COUNT_3945 = RATE_COUNT - 1,
- RATE_INVM_INDEX = RATE_COUNT,
+ RATE_INVM_IDX = RATE_COUNT,
RATE_INVALID = RATE_COUNT,
};

enum {
- RATE_6M_INDEX_TABLE = 0,
- RATE_9M_INDEX_TABLE,
- RATE_12M_INDEX_TABLE,
- RATE_18M_INDEX_TABLE,
- RATE_24M_INDEX_TABLE,
- RATE_36M_INDEX_TABLE,
- RATE_48M_INDEX_TABLE,
- RATE_54M_INDEX_TABLE,
- RATE_1M_INDEX_TABLE,
- RATE_2M_INDEX_TABLE,
- RATE_5M_INDEX_TABLE,
- RATE_11M_INDEX_TABLE,
- RATE_INVM_INDEX_TABLE = RATE_INVM_INDEX - 1,
+ RATE_6M_IDX_TABLE = 0,
+ RATE_9M_IDX_TABLE,
+ RATE_12M_IDX_TABLE,
+ RATE_18M_IDX_TABLE,
+ RATE_24M_IDX_TABLE,
+ RATE_36M_IDX_TABLE,
+ RATE_48M_IDX_TABLE,
+ RATE_54M_IDX_TABLE,
+ RATE_1M_IDX_TABLE,
+ RATE_2M_IDX_TABLE,
+ RATE_5M_IDX_TABLE,
+ RATE_11M_IDX_TABLE,
+ RATE_INVM_IDX_TABLE = RATE_INVM_IDX - 1,
};

enum {
- IL_FIRST_OFDM_RATE = RATE_6M_INDEX,
- IL39_LAST_OFDM_RATE = RATE_54M_INDEX,
- IL_LAST_OFDM_RATE = RATE_60M_INDEX,
- IL_FIRST_CCK_RATE = RATE_1M_INDEX,
- IL_LAST_CCK_RATE = RATE_11M_INDEX,
+ IL_FIRST_OFDM_RATE = RATE_6M_IDX,
+ IL39_LAST_OFDM_RATE = RATE_54M_IDX,
+ IL_LAST_OFDM_RATE = RATE_60M_IDX,
+ IL_FIRST_CCK_RATE = RATE_1M_IDX,
+ IL_LAST_CCK_RATE = RATE_11M_IDX,
};

/* #define vs. enum to keep from defaulting to 'large integer' */
-#define RATE_6M_MASK (1 << RATE_6M_INDEX)
-#define RATE_9M_MASK (1 << RATE_9M_INDEX)
-#define RATE_12M_MASK (1 << RATE_12M_INDEX)
-#define RATE_18M_MASK (1 << RATE_18M_INDEX)
-#define RATE_24M_MASK (1 << RATE_24M_INDEX)
-#define RATE_36M_MASK (1 << RATE_36M_INDEX)
-#define RATE_48M_MASK (1 << RATE_48M_INDEX)
-#define RATE_54M_MASK (1 << RATE_54M_INDEX)
-#define RATE_60M_MASK (1 << RATE_60M_INDEX)
-#define RATE_1M_MASK (1 << RATE_1M_INDEX)
-#define RATE_2M_MASK (1 << RATE_2M_INDEX)
-#define RATE_5M_MASK (1 << RATE_5M_INDEX)
-#define RATE_11M_MASK (1 << RATE_11M_INDEX)
+#define RATE_6M_MASK (1 << RATE_6M_IDX)
+#define RATE_9M_MASK (1 << RATE_9M_IDX)
+#define RATE_12M_MASK (1 << RATE_12M_IDX)
+#define RATE_18M_MASK (1 << RATE_18M_IDX)
+#define RATE_24M_MASK (1 << RATE_24M_IDX)
+#define RATE_36M_MASK (1 << RATE_36M_IDX)
+#define RATE_48M_MASK (1 << RATE_48M_IDX)
+#define RATE_54M_MASK (1 << RATE_54M_IDX)
+#define RATE_60M_MASK (1 << RATE_60M_IDX)
+#define RATE_1M_MASK (1 << RATE_1M_IDX)
+#define RATE_2M_MASK (1 << RATE_2M_IDX)
+#define RATE_5M_MASK (1 << RATE_5M_IDX)
+#define RATE_11M_MASK (1 << RATE_11M_IDX)

/* uCode API values for legacy bit rates, both OFDM and CCK */
enum {
diff --git a/drivers/net/wireless/iwlegacy/iwl-power.h b/drivers/net/wireless/iwlegacy/iwl-power.h
index e149f78..e4a0ef2 100644
--- a/drivers/net/wireless/iwlegacy/iwl-power.h
+++ b/drivers/net/wireless/iwlegacy/iwl-power.h
@@ -31,11 +31,11 @@
#include "iwl-commands.h"

enum il_power_level {
- IL_POWER_INDEX_1,
- IL_POWER_INDEX_2,
- IL_POWER_INDEX_3,
- IL_POWER_INDEX_4,
- IL_POWER_INDEX_5,
+ IL_POWER_IDX_1,
+ IL_POWER_IDX_2,
+ IL_POWER_IDX_3,
+ IL_POWER_IDX_4,
+ IL_POWER_IDX_5,
IL_POWER_NUM
};

diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c
index a6bee84..5c0d131 100644
--- a/drivers/net/wireless/iwlegacy/iwl-rx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-rx.c
@@ -62,7 +62,7 @@
* WRITE = READ.
*
* During initialization, the host sets up the READ queue position to the first
- * INDEX position, and WRITE to the last (READ - 1 wrapped)
+ * IDX position, and WRITE to the last (READ - 1 wrapped)
*
* When the firmware places a packet in a buffer, it will advance the READ index
* and fire the RX interrupt. The driver can then query the READ index and
@@ -74,13 +74,13 @@
* iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled
* to replenish the iwl->rxq->rx_free.
* + In il_rx_replenish (scheduled) if 'processed' != 'read' then the
- * iwl->rxq is replenished and the READ INDEX is updated (updating the
+ * iwl->rxq is replenished and the READ IDX is updated (updating the
* 'processed' and 'read' driver indexes as well)
* + A received packet is processed and handed to the kernel network stack,
* detached from the iwl->rxq. The driver 'processed' index is updated.
* + The Host/Firmware iwl->rxq is replenished at tasklet time from the rx_free
* list. If there are no allocated buffers in iwl->rxq->rx_free, the READ
- * INDEX is not incremented and iwl->status(RX_STALLED) is set. If there
+ * IDX is not incremented and iwl->status(RX_STALLED) is set. If there
* were enough free buffers and RX_STALLED is set it is cleared.
*
*
@@ -96,7 +96,7 @@
*
* -- enable interrupts --
* ISR - il_rx() Detach il_rx_bufs from pool up to the
- * READ INDEX, detaching the SKB from the pool.
+ * READ IDX, detaching the SKB from the pool.
* Moves the packet buffer from queue to rx_used.
* Calls il_rx_queue_restock to refill any empty
* slots.
diff --git a/drivers/net/wireless/iwlegacy/iwl-tx.c b/drivers/net/wireless/iwlegacy/iwl-tx.c
index b9c417c..45114b4 100644
--- a/drivers/net/wireless/iwlegacy/iwl-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-tx.c
@@ -500,7 +500,7 @@ int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd)

out_cmd->hdr.flags = 0;
out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(il->cmd_queue) |
- INDEX_TO_SEQ(q->write_ptr));
+ IDX_TO_SEQ(q->write_ptr));
if (cmd->flags & CMD_SIZE_HUGE)
out_cmd->hdr.sequence |= SEQ_HUGE_FRAME;
len = sizeof(struct il_device_cmd);
@@ -598,7 +598,7 @@ il_tx_cmd_complete(struct il_priv *il, struct il_rx_buf *rxb)
struct il_rx_pkt *pkt = rxb_addr(rxb);
u16 sequence = le16_to_cpu(pkt->hdr.sequence);
int txq_id = SEQ_TO_QUEUE(sequence);
- int index = SEQ_TO_INDEX(sequence);
+ int index = SEQ_TO_IDX(sequence);
int cmd_index;
bool huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME);
struct il_device_cmd *cmd;
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index 1fc9bfb..017b297 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -563,7 +563,7 @@ static int il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)
*/
out_cmd->hdr.cmd = REPLY_TX;
out_cmd->hdr.sequence = cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) |
- INDEX_TO_SEQ(q->write_ptr)));
+ IDX_TO_SEQ(q->write_ptr)));

/* Copy MAC header from skb into command buffer */
memcpy(tx_cmd->hdr, hdr, hdr_len);
@@ -903,7 +903,7 @@ static void il3945_setup_rx_handlers(struct il_priv *il)
* WRITE = READ.
*
* During initialization, the host sets up the READ queue position to the first
- * INDEX position, and WRITE to the last (READ - 1 wrapped)
+ * IDX position, and WRITE to the last (READ - 1 wrapped)
*
* When the firmware places a packet in a buffer, it will advance the READ index
* and fire the RX interrupt. The driver can then query the READ index and
@@ -915,13 +915,13 @@ static void il3945_setup_rx_handlers(struct il_priv *il)
* iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled
* to replenish the iwl->rxq->rx_free.
* + In il3945_rx_replenish (scheduled) if 'processed' != 'read' then the
- * iwl->rxq is replenished and the READ INDEX is updated (updating the
+ * iwl->rxq is replenished and the READ IDX is updated (updating the
* 'processed' and 'read' driver indexes as well)
* + A received packet is processed and handed to the kernel network stack,
* detached from the iwl->rxq. The driver 'processed' index is updated.
* + The Host/Firmware iwl->rxq is replenished at tasklet time from the rx_free
* list. If there are no allocated buffers in iwl->rxq->rx_free, the READ
- * INDEX is not incremented and iwl->status(RX_STALLED) is set. If there
+ * IDX is not incremented and iwl->status(RX_STALLED) is set. If there
* were enough free buffers and RX_STALLED is set it is cleared.
*
*
@@ -936,7 +936,7 @@ static void il3945_setup_rx_handlers(struct il_priv *il)
*
* -- enable interrupts --
* ISR - il3945_rx() Detach il_rx_bufs from pool up to the
- * READ INDEX, detaching the SKB from the pool.
+ * READ IDX, detaching the SKB from the pool.
* Moves the packet buffer from queue to rx_used.
* Calls il3945_rx_queue_restock to refill any empty
* slots.
--
1.7.1


2011-11-18 08:21:34

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 21/77] iwlegacy: s/statistics/stats/

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c | 90 +++++++++---------
drivers/net/wireless/iwlegacy/iwl-3945-rs.c | 2 +-
drivers/net/wireless/iwlegacy/iwl-3945.c | 44 ++++----
drivers/net/wireless/iwlegacy/iwl-3945.h | 6 +-
drivers/net/wireless/iwlegacy/iwl-4965-calib.c | 36 ++++----
drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c | 94 +++++++++---------
drivers/net/wireless/iwlegacy/iwl-4965-hw.h | 4 +-
drivers/net/wireless/iwlegacy/iwl-4965-rs.c | 4 +-
drivers/net/wireless/iwlegacy/iwl-4965-rx.c | 66 +++++++-------
drivers/net/wireless/iwlegacy/iwl-4965.c | 12 +-
drivers/net/wireless/iwlegacy/iwl-4965.h | 4 +-
drivers/net/wireless/iwlegacy/iwl-commands.h | 112 +++++++++++-----------
drivers/net/wireless/iwlegacy/iwl-core.c | 20 ++--
drivers/net/wireless/iwlegacy/iwl-core.h | 6 +-
drivers/net/wireless/iwlegacy/iwl-debugfs.c | 28 +++---
drivers/net/wireless/iwlegacy/iwl-dev.h | 32 +++---
drivers/net/wireless/iwlegacy/iwl-legacy-rs.h | 2 +-
drivers/net/wireless/iwlegacy/iwl-scan.c | 2 +-
drivers/net/wireless/iwlegacy/iwl3945-base.c | 10 +-
drivers/net/wireless/iwlegacy/iwl4965-base.c | 34 ++++----
20 files changed, 304 insertions(+), 304 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c
index 40e3a70..88b3d8f 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c
@@ -29,22 +29,22 @@
#include "iwl-3945-debugfs.h"


-static int il3945_statistics_flag(struct il_priv *il, char *buf, int bufsz)
+static int il3945_stats_flag(struct il_priv *il, char *buf, int bufsz)
{
int p = 0;

p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n",
- le32_to_cpu(il->_3945.statistics.flag));
- if (le32_to_cpu(il->_3945.statistics.flag) &
+ le32_to_cpu(il->_3945.stats.flag));
+ if (le32_to_cpu(il->_3945.stats.flag) &
UCODE_STATISTICS_CLEAR_MSK)
p += scnprintf(buf + p, bufsz - p,
"\tStatistics have been cleared\n");
p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n",
- (le32_to_cpu(il->_3945.statistics.flag) &
+ (le32_to_cpu(il->_3945.stats.flag) &
UCODE_STATISTICS_FREQUENCY_MSK)
? "2.4 GHz" : "5.2 GHz");
p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n",
- (le32_to_cpu(il->_3945.statistics.flag) &
+ (le32_to_cpu(il->_3945.stats.flag) &
UCODE_STATISTICS_NARROW_BAND_MSK)
? "enabled" : "disabled");
return p;
@@ -57,14 +57,14 @@ ssize_t il3945_ucode_rx_stats_read(struct file *file,
struct il_priv *il = file->private_data;
int pos = 0;
char *buf;
- int bufsz = sizeof(struct iwl39_statistics_rx_phy) * 40 +
- sizeof(struct iwl39_statistics_rx_non_phy) * 40 + 400;
+ int bufsz = sizeof(struct iwl39_stats_rx_phy) * 40 +
+ sizeof(struct iwl39_stats_rx_non_phy) * 40 + 400;
ssize_t ret;
- struct iwl39_statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm,
+ struct iwl39_stats_rx_phy *ofdm, *accum_ofdm, *delta_ofdm,
*max_ofdm;
- struct iwl39_statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck;
- struct iwl39_statistics_rx_non_phy *general, *accum_general;
- struct iwl39_statistics_rx_non_phy *delta_general, *max_general;
+ struct iwl39_stats_rx_phy *cck, *accum_cck, *delta_cck, *max_cck;
+ struct iwl39_stats_rx_non_phy *general, *accum_general;
+ struct iwl39_stats_rx_non_phy *delta_general, *max_general;

if (!il_is_alive(il))
return -EAGAIN;
@@ -77,23 +77,23 @@ ssize_t il3945_ucode_rx_stats_read(struct file *file,

/*
* The statistic information display here is based on
- * the last statistics notification from uCode
+ * the last stats notification from uCode
* might not reflect the current uCode activity
*/
- ofdm = &il->_3945.statistics.rx.ofdm;
- cck = &il->_3945.statistics.rx.cck;
- general = &il->_3945.statistics.rx.general;
- accum_ofdm = &il->_3945.accum_statistics.rx.ofdm;
- accum_cck = &il->_3945.accum_statistics.rx.cck;
- accum_general = &il->_3945.accum_statistics.rx.general;
- delta_ofdm = &il->_3945.delta_statistics.rx.ofdm;
- delta_cck = &il->_3945.delta_statistics.rx.cck;
- delta_general = &il->_3945.delta_statistics.rx.general;
+ ofdm = &il->_3945.stats.rx.ofdm;
+ cck = &il->_3945.stats.rx.cck;
+ general = &il->_3945.stats.rx.general;
+ accum_ofdm = &il->_3945.accum_stats.rx.ofdm;
+ accum_cck = &il->_3945.accum_stats.rx.cck;
+ accum_general = &il->_3945.accum_stats.rx.general;
+ delta_ofdm = &il->_3945.delta_stats.rx.ofdm;
+ delta_cck = &il->_3945.delta_stats.rx.cck;
+ delta_general = &il->_3945.delta_stats.rx.general;
max_ofdm = &il->_3945.max_delta.rx.ofdm;
max_cck = &il->_3945.max_delta.rx.cck;
max_general = &il->_3945.max_delta.rx.general;

- pos += il3945_statistics_flag(il, buf, bufsz);
+ pos += il3945_stats_flag(il, buf, bufsz);
pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
"acumulative delta max\n",
"Statistics_Rx - OFDM:");
@@ -332,9 +332,9 @@ ssize_t il3945_ucode_tx_stats_read(struct file *file,
struct il_priv *il = file->private_data;
int pos = 0;
char *buf;
- int bufsz = (sizeof(struct iwl39_statistics_tx) * 48) + 250;
+ int bufsz = (sizeof(struct iwl39_stats_tx) * 48) + 250;
ssize_t ret;
- struct iwl39_statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
+ struct iwl39_stats_tx *tx, *accum_tx, *delta_tx, *max_tx;

if (!il_is_alive(il))
return -EAGAIN;
@@ -347,14 +347,14 @@ ssize_t il3945_ucode_tx_stats_read(struct file *file,

/*
* The statistic information display here is based on
- * the last statistics notification from uCode
+ * the last stats notification from uCode
* might not reflect the current uCode activity
*/
- tx = &il->_3945.statistics.tx;
- accum_tx = &il->_3945.accum_statistics.tx;
- delta_tx = &il->_3945.delta_statistics.tx;
+ tx = &il->_3945.stats.tx;
+ accum_tx = &il->_3945.accum_stats.tx;
+ delta_tx = &il->_3945.delta_stats.tx;
max_tx = &il->_3945.max_delta.tx;
- pos += il3945_statistics_flag(il, buf, bufsz);
+ pos += il3945_stats_flag(il, buf, bufsz);
pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
"acumulative delta max\n",
"Statistics_Tx:");
@@ -428,12 +428,12 @@ ssize_t il3945_ucode_general_stats_read(struct file *file,
struct il_priv *il = file->private_data;
int pos = 0;
char *buf;
- int bufsz = sizeof(struct iwl39_statistics_general) * 10 + 300;
+ int bufsz = sizeof(struct iwl39_stats_general) * 10 + 300;
ssize_t ret;
- struct iwl39_statistics_general *general, *accum_general;
- struct iwl39_statistics_general *delta_general, *max_general;
- struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
- struct iwl39_statistics_div *div, *accum_div, *delta_div, *max_div;
+ struct iwl39_stats_general *general, *accum_general;
+ struct iwl39_stats_general *delta_general, *max_general;
+ struct stats_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
+ struct iwl39_stats_div *div, *accum_div, *delta_div, *max_div;

if (!il_is_alive(il))
return -EAGAIN;
@@ -446,22 +446,22 @@ ssize_t il3945_ucode_general_stats_read(struct file *file,

/*
* The statistic information display here is based on
- * the last statistics notification from uCode
+ * the last stats notification from uCode
* might not reflect the current uCode activity
*/
- general = &il->_3945.statistics.general;
- dbg = &il->_3945.statistics.general.dbg;
- div = &il->_3945.statistics.general.div;
- accum_general = &il->_3945.accum_statistics.general;
- delta_general = &il->_3945.delta_statistics.general;
+ general = &il->_3945.stats.general;
+ dbg = &il->_3945.stats.general.dbg;
+ div = &il->_3945.stats.general.div;
+ accum_general = &il->_3945.accum_stats.general;
+ delta_general = &il->_3945.delta_stats.general;
max_general = &il->_3945.max_delta.general;
- accum_dbg = &il->_3945.accum_statistics.general.dbg;
- delta_dbg = &il->_3945.delta_statistics.general.dbg;
+ accum_dbg = &il->_3945.accum_stats.general.dbg;
+ delta_dbg = &il->_3945.delta_stats.general.dbg;
max_dbg = &il->_3945.max_delta.general.dbg;
- accum_div = &il->_3945.accum_statistics.general.div;
- delta_div = &il->_3945.delta_statistics.general.div;
+ accum_div = &il->_3945.accum_stats.general.div;
+ delta_div = &il->_3945.delta_stats.general.div;
max_div = &il->_3945.max_delta.general.div;
- pos += il3945_statistics_flag(il, buf, bufsz);
+ pos += il3945_stats_flag(il, buf, bufsz);
pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
"acumulative delta max\n",
"Statistics_General:");
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
index 0707301..ebee6c3 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
@@ -158,7 +158,7 @@ static int il3945_rate_scale_flush_windows(struct il3945_rs_sta *rs_sta)
/*
* For each rate, if we have collected data on that rate
* and it has been more than IL_RATE_WIN_FLUSH
- * since we flushed, clear out the gathered statistics
+ * since we flushed, clear out the gathered stats
*/
for (i = 0; i < IL_RATE_COUNT_3945; i++) {
if (!rs_sta->win[i].counter)
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.c b/drivers/net/wireless/iwlegacy/iwl-3945.c
index ad78d3f..fa4c33a 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945.c
@@ -362,7 +362,7 @@ static void il3945_rx_reply_tx(struct il_priv *il,
*
*****************************************************************************/
#ifdef CONFIG_IWLEGACY_DEBUGFS
-static void il3945_accumulative_statistics(struct il_priv *il,
+static void il3945_accumulative_stats(struct il_priv *il,
__le32 *stats)
{
int i;
@@ -370,12 +370,12 @@ static void il3945_accumulative_statistics(struct il_priv *il,
u32 *accum_stats;
u32 *delta, *max_delta;

- prev_stats = (__le32 *)&il->_3945.statistics;
- accum_stats = (u32 *)&il->_3945.accum_statistics;
- delta = (u32 *)&il->_3945.delta_statistics;
+ prev_stats = (__le32 *)&il->_3945.stats;
+ accum_stats = (u32 *)&il->_3945.accum_stats;
+ delta = (u32 *)&il->_3945.delta_stats;
max_delta = (u32 *)&il->_3945.max_delta;

- for (i = sizeof(__le32); i < sizeof(struct il3945_notif_statistics);
+ for (i = sizeof(__le32); i < sizeof(struct il3945_notif_stats);
i += sizeof(__le32), stats++, prev_stats++, delta++,
max_delta++, accum_stats++) {
if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) {
@@ -387,30 +387,30 @@ static void il3945_accumulative_statistics(struct il_priv *il,
}
}

- /* reset accumulative statistics for "no-counter" type statistics */
- il->_3945.accum_statistics.general.temperature =
- il->_3945.statistics.general.temperature;
- il->_3945.accum_statistics.general.ttl_timestamp =
- il->_3945.statistics.general.ttl_timestamp;
+ /* reset accumulative stats for "no-counter" type stats */
+ il->_3945.accum_stats.general.temperature =
+ il->_3945.stats.general.temperature;
+ il->_3945.accum_stats.general.ttl_timestamp =
+ il->_3945.stats.general.ttl_timestamp;
}
#endif

-void il3945_hw_rx_statistics(struct il_priv *il,
+void il3945_hw_rx_stats(struct il_priv *il,
struct il_rx_buf *rxb)
{
struct il_rx_pkt *pkt = rxb_addr(rxb);

D_RX("Statistics notification received (%d vs %d).\n",
- (int)sizeof(struct il3945_notif_statistics),
+ (int)sizeof(struct il3945_notif_stats),
le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK);
#ifdef CONFIG_IWLEGACY_DEBUGFS
- il3945_accumulative_statistics(il, (__le32 *)&pkt->u.raw);
+ il3945_accumulative_stats(il, (__le32 *)&pkt->u.raw);
#endif

- memcpy(&il->_3945.statistics, pkt->u.raw, sizeof(il->_3945.statistics));
+ memcpy(&il->_3945.stats, pkt->u.raw, sizeof(il->_3945.stats));
}

-void il3945_reply_statistics(struct il_priv *il,
+void il3945_reply_stats(struct il_priv *il,
struct il_rx_buf *rxb)
{
struct il_rx_pkt *pkt = rxb_addr(rxb);
@@ -418,16 +418,16 @@ void il3945_reply_statistics(struct il_priv *il,

if (le32_to_cpu(*flag) & UCODE_STATISTICS_CLEAR_MSK) {
#ifdef CONFIG_IWLEGACY_DEBUGFS
- memset(&il->_3945.accum_statistics, 0,
- sizeof(struct il3945_notif_statistics));
- memset(&il->_3945.delta_statistics, 0,
- sizeof(struct il3945_notif_statistics));
+ memset(&il->_3945.accum_stats, 0,
+ sizeof(struct il3945_notif_stats));
+ memset(&il->_3945.delta_stats, 0,
+ sizeof(struct il3945_notif_stats));
memset(&il->_3945.max_delta, 0,
- sizeof(struct il3945_notif_statistics));
+ sizeof(struct il3945_notif_stats));
#endif
D_RX("Statistics have been cleared\n");
}
- il3945_hw_rx_statistics(il, rxb);
+ il3945_hw_rx_stats(il, rxb);
}


@@ -437,7 +437,7 @@ void il3945_reply_statistics(struct il_priv *il,
*
******************************************************************************/

-/* This is necessary only for a number of statistics, see the caller. */
+/* This is necessary only for a number of stats, see the caller. */
static int il3945_is_network_packet(struct il_priv *il,
struct ieee80211_hdr *header)
{
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.h b/drivers/net/wireless/iwlegacy/iwl-3945.h
index 8a294ca..967e733 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945.h
+++ b/drivers/net/wireless/iwlegacy/iwl-3945.h
@@ -60,7 +60,7 @@ extern const struct pci_device_id il3945_hw_card_ids[];

/* Default noise level to report when noise measurement is not available.
* This may be because we're:
- * 1) Not associated (4965, no beacon statistics being sent to driver)
+ * 1) Not associated (4965, no beacon stats being sent to driver)
* 2) Scanning (noise measurement does not apply to associated channel)
* 3) Receiving CCK (3945 delivers noise info only for OFDM frames)
* Use default noise value of -127 ... this is below the range of measurable
@@ -258,9 +258,9 @@ void il3945_hw_build_tx_cmd_rate(struct il_priv *il,
int sta_id, int tx_id);
extern int il3945_hw_reg_send_txpower(struct il_priv *il);
extern int il3945_hw_reg_set_txpower(struct il_priv *il, s8 power);
-extern void il3945_hw_rx_statistics(struct il_priv *il,
+extern void il3945_hw_rx_stats(struct il_priv *il,
struct il_rx_buf *rxb);
-void il3945_reply_statistics(struct il_priv *il,
+void il3945_reply_stats(struct il_priv *il,
struct il_rx_buf *rxb);
extern void il3945_disable_events(struct il_priv *il);
extern int il4965_get_temperature(const struct il_priv *il);
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-calib.c b/drivers/net/wireless/iwlegacy/iwl-4965-calib.c
index 4c2b491..bb3bc15 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-calib.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-calib.c
@@ -71,7 +71,7 @@
* INIT calibrations framework
*****************************************************************************/

-struct statistics_general_data {
+struct stats_general_data {
u32 beacon_silence_rssi_a;
u32 beacon_silence_rssi_b;
u32 beacon_silence_rssi_c;
@@ -106,7 +106,7 @@ void il4965_calib_free_results(struct il_priv *il)
static int il4965_sens_energy_cck(struct il_priv *il,
u32 norm_fa,
u32 rx_enable_time,
- struct statistics_general_data *rx_info)
+ struct stats_general_data *rx_info)
{
u32 max_nrg_cck = 0;
int i = 0;
@@ -509,10 +509,10 @@ void il4965_sensitivity_calibration(struct il_priv *il, void *resp)
u32 norm_fa_ofdm;
u32 norm_fa_cck;
struct il_sensitivity_data *data = NULL;
- struct statistics_rx_non_phy *rx_info;
- struct statistics_rx_phy *ofdm, *cck;
+ struct stats_rx_non_phy *rx_info;
+ struct stats_rx_phy *ofdm, *cck;
unsigned long flags;
- struct statistics_general_data statis;
+ struct stats_general_data statis;

if (il->disable_sens_cal)
return;
@@ -526,9 +526,9 @@ void il4965_sensitivity_calibration(struct il_priv *il, void *resp)

spin_lock_irqsave(&il->lock, flags);

- rx_info = &(((struct il_notif_statistics *)resp)->rx.general);
- ofdm = &(((struct il_notif_statistics *)resp)->rx.ofdm);
- cck = &(((struct il_notif_statistics *)resp)->rx.cck);
+ rx_info = &(((struct il_notif_stats *)resp)->rx.general);
+ ofdm = &(((struct il_notif_stats *)resp)->rx.ofdm);
+ cck = &(((struct il_notif_stats *)resp)->rx.cck);

if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) {
D_CALIB("<< invalid data.\n");
@@ -565,9 +565,9 @@ void il4965_sensitivity_calibration(struct il_priv *il, void *resp)
return;
}

- /* These statistics increase monotonically, and do not reset
+ /* These stats increase monotonically, and do not reset
* at each beacon. Calculate difference from last value, or just
- * use the new statistics value if it has reset or wrapped around. */
+ * use the new stats value if it has reset or wrapped around. */
if (data->last_bad_plcp_cnt_cck > bad_plcp_cck)
data->last_bad_plcp_cnt_cck = bad_plcp_cck;
else {
@@ -793,7 +793,7 @@ static void il4965_gain_computation(struct il_priv *il,


/*
- * Accumulate 16 beacons of signal and noise statistics for each of
+ * Accumulate 16 beacons of signal and noise stats for each of
* 3 receivers/antennas/rx-chains, then figure out:
* 1) Which antennas are connected.
* 2) Differential rx gain settings to balance the 3 receivers.
@@ -818,7 +818,7 @@ void il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp)
u8 rxon_band24;
u8 stat_band24;
unsigned long flags;
- struct statistics_rx_non_phy *rx_info;
+ struct stats_rx_non_phy *rx_info;

struct il_rxon_context *ctx = &il->ctx;

@@ -839,7 +839,7 @@ void il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp)

spin_lock_irqsave(&il->lock, flags);

- rx_info = &(((struct il_notif_statistics *)stat_resp)->
+ rx_info = &(((struct il_notif_stats *)stat_resp)->
rx.general);

if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) {
@@ -851,10 +851,10 @@ void il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp)
rxon_band24 = !!(ctx->staging.flags & RXON_FLG_BAND_24G_MSK);
rxon_chnum = le16_to_cpu(ctx->staging.channel);

- stat_band24 = !!(((struct il_notif_statistics *)
+ stat_band24 = !!(((struct il_notif_stats *)
stat_resp)->flag &
STATISTICS_REPLY_FLG_BAND_24G_MSK);
- stat_chnum = le32_to_cpu(((struct il_notif_statistics *)
+ stat_chnum = le32_to_cpu(((struct il_notif_stats *)
stat_resp)->flag) >> 16;

/* Make sure we accumulate data for just the associated channel
@@ -867,7 +867,7 @@ void il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp)
}

/*
- * Accumulate beacon statistics values across
+ * Accumulate beacon stats values across
* "chain_noise_num_beacons"
*/
chain_noise_a = le32_to_cpu(rx_info->beacon_silence_rssi_a) &
@@ -960,7 +960,7 @@ void il4965_reset_run_time_calib(struct il_priv *il)
il->chain_noise_data.delta_gain_code[i] =
CHAIN_NOISE_DELTA_GAIN_INIT_VAL;

- /* Ask for statistics now, the uCode will send notification
+ /* Ask for stats now, the uCode will send notification
* periodically after association */
- il_send_statistics_request(il, CMD_ASYNC, true);
+ il_send_stats_request(il, CMD_ASYNC, true);
}
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c
index ebb71a6..89e5828 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c
@@ -33,12 +33,12 @@ static const char *fmt_table = " %-30s %10u %10u %10u %10u\n";
static const char *fmt_header =
"%-32s current cumulative delta max\n";

-static int il4965_statistics_flag(struct il_priv *il, char *buf, int bufsz)
+static int il4965_stats_flag(struct il_priv *il, char *buf, int bufsz)
{
int p = 0;
u32 flag;

- flag = le32_to_cpu(il->_4965.statistics.flag);
+ flag = le32_to_cpu(il->_4965.stats.flag);

p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", flag);
if (flag & UCODE_STATISTICS_CLEAR_MSK)
@@ -60,15 +60,15 @@ ssize_t il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf,
struct il_priv *il = file->private_data;
int pos = 0;
char *buf;
- int bufsz = sizeof(struct statistics_rx_phy) * 40 +
- sizeof(struct statistics_rx_non_phy) * 40 +
- sizeof(struct statistics_rx_ht_phy) * 40 + 400;
+ int bufsz = sizeof(struct stats_rx_phy) * 40 +
+ sizeof(struct stats_rx_non_phy) * 40 +
+ sizeof(struct stats_rx_ht_phy) * 40 + 400;
ssize_t ret;
- struct statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm;
- struct statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck;
- struct statistics_rx_non_phy *general, *accum_general;
- struct statistics_rx_non_phy *delta_general, *max_general;
- struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht;
+ struct stats_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm;
+ struct stats_rx_phy *cck, *accum_cck, *delta_cck, *max_cck;
+ struct stats_rx_non_phy *general, *accum_general;
+ struct stats_rx_non_phy *delta_general, *max_general;
+ struct stats_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht;

if (!il_is_alive(il))
return -EAGAIN;
@@ -81,27 +81,27 @@ ssize_t il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf,

/*
* the statistic information display here is based on
- * the last statistics notification from uCode
+ * the last stats notification from uCode
* might not reflect the current uCode activity
*/
- ofdm = &il->_4965.statistics.rx.ofdm;
- cck = &il->_4965.statistics.rx.cck;
- general = &il->_4965.statistics.rx.general;
- ht = &il->_4965.statistics.rx.ofdm_ht;
- accum_ofdm = &il->_4965.accum_statistics.rx.ofdm;
- accum_cck = &il->_4965.accum_statistics.rx.cck;
- accum_general = &il->_4965.accum_statistics.rx.general;
- accum_ht = &il->_4965.accum_statistics.rx.ofdm_ht;
- delta_ofdm = &il->_4965.delta_statistics.rx.ofdm;
- delta_cck = &il->_4965.delta_statistics.rx.cck;
- delta_general = &il->_4965.delta_statistics.rx.general;
- delta_ht = &il->_4965.delta_statistics.rx.ofdm_ht;
+ ofdm = &il->_4965.stats.rx.ofdm;
+ cck = &il->_4965.stats.rx.cck;
+ general = &il->_4965.stats.rx.general;
+ ht = &il->_4965.stats.rx.ofdm_ht;
+ accum_ofdm = &il->_4965.accum_stats.rx.ofdm;
+ accum_cck = &il->_4965.accum_stats.rx.cck;
+ accum_general = &il->_4965.accum_stats.rx.general;
+ accum_ht = &il->_4965.accum_stats.rx.ofdm_ht;
+ delta_ofdm = &il->_4965.delta_stats.rx.ofdm;
+ delta_cck = &il->_4965.delta_stats.rx.cck;
+ delta_general = &il->_4965.delta_stats.rx.general;
+ delta_ht = &il->_4965.delta_stats.rx.ofdm_ht;
max_ofdm = &il->_4965.max_delta.rx.ofdm;
max_cck = &il->_4965.max_delta.rx.cck;
max_general = &il->_4965.max_delta.rx.general;
max_ht = &il->_4965.max_delta.rx.ofdm_ht;

- pos += il4965_statistics_flag(il, buf, bufsz);
+ pos += il4965_stats_flag(il, buf, bufsz);
pos += scnprintf(buf + pos, bufsz - pos,
fmt_header, "Statistics_Rx - OFDM:");
pos += scnprintf(buf + pos, bufsz - pos,
@@ -492,9 +492,9 @@ ssize_t il4965_ucode_tx_stats_read(struct file *file,
struct il_priv *il = file->private_data;
int pos = 0;
char *buf;
- int bufsz = (sizeof(struct statistics_tx) * 48) + 250;
+ int bufsz = (sizeof(struct stats_tx) * 48) + 250;
ssize_t ret;
- struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
+ struct stats_tx *tx, *accum_tx, *delta_tx, *max_tx;

if (!il_is_alive(il))
return -EAGAIN;
@@ -506,15 +506,15 @@ ssize_t il4965_ucode_tx_stats_read(struct file *file,
}

/* the statistic information display here is based on
- * the last statistics notification from uCode
+ * the last stats notification from uCode
* might not reflect the current uCode activity
*/
- tx = &il->_4965.statistics.tx;
- accum_tx = &il->_4965.accum_statistics.tx;
- delta_tx = &il->_4965.delta_statistics.tx;
+ tx = &il->_4965.stats.tx;
+ accum_tx = &il->_4965.accum_stats.tx;
+ delta_tx = &il->_4965.delta_stats.tx;
max_tx = &il->_4965.max_delta.tx;

- pos += il4965_statistics_flag(il, buf, bufsz);
+ pos += il4965_stats_flag(il, buf, bufsz);
pos += scnprintf(buf + pos, bufsz - pos,
fmt_header, "Statistics_Tx:");
pos += scnprintf(buf + pos, bufsz - pos,
@@ -667,12 +667,12 @@ il4965_ucode_general_stats_read(struct file *file, char __user *user_buf,
struct il_priv *il = file->private_data;
int pos = 0;
char *buf;
- int bufsz = sizeof(struct statistics_general) * 10 + 300;
+ int bufsz = sizeof(struct stats_general) * 10 + 300;
ssize_t ret;
- struct statistics_general_common *general, *accum_general;
- struct statistics_general_common *delta_general, *max_general;
- struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
- struct statistics_div *div, *accum_div, *delta_div, *max_div;
+ struct stats_general_common *general, *accum_general;
+ struct stats_general_common *delta_general, *max_general;
+ struct stats_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
+ struct stats_div *div, *accum_div, *delta_div, *max_div;

if (!il_is_alive(il))
return -EAGAIN;
@@ -684,23 +684,23 @@ il4965_ucode_general_stats_read(struct file *file, char __user *user_buf,
}

/* the statistic information display here is based on
- * the last statistics notification from uCode
+ * the last stats notification from uCode
* might not reflect the current uCode activity
*/
- general = &il->_4965.statistics.general.common;
- dbg = &il->_4965.statistics.general.common.dbg;
- div = &il->_4965.statistics.general.common.div;
- accum_general = &il->_4965.accum_statistics.general.common;
- accum_dbg = &il->_4965.accum_statistics.general.common.dbg;
- accum_div = &il->_4965.accum_statistics.general.common.div;
- delta_general = &il->_4965.delta_statistics.general.common;
+ general = &il->_4965.stats.general.common;
+ dbg = &il->_4965.stats.general.common.dbg;
+ div = &il->_4965.stats.general.common.div;
+ accum_general = &il->_4965.accum_stats.general.common;
+ accum_dbg = &il->_4965.accum_stats.general.common.dbg;
+ accum_div = &il->_4965.accum_stats.general.common.div;
+ delta_general = &il->_4965.delta_stats.general.common;
max_general = &il->_4965.max_delta.general.common;
- delta_dbg = &il->_4965.delta_statistics.general.common.dbg;
+ delta_dbg = &il->_4965.delta_stats.general.common.dbg;
max_dbg = &il->_4965.max_delta.general.common.dbg;
- delta_div = &il->_4965.delta_statistics.general.common.div;
+ delta_div = &il->_4965.delta_stats.general.common.div;
max_div = &il->_4965.max_delta.general.common.div;

- pos += il4965_statistics_flag(il, buf, bufsz);
+ pos += il4965_stats_flag(il, buf, bufsz);
pos += scnprintf(buf + pos, bufsz - pos,
fmt_header, "Statistics_General:");
pos += scnprintf(buf + pos, bufsz - pos,
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
index ecebc69..21ff694 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
@@ -119,7 +119,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
*
* uCode provides all 4 values to the driver via the "initialize alive"
* notification (see struct il4965_init_alive_resp). After the runtime uCode
- * image loads, uCode updates the R4 value via statistics notifications
+ * image loads, uCode updates the R4 value via stats notifications
* (see STATISTICS_NOTIFICATION), which occur after each received beacon
* when associated, or can be requested via REPLY_STATISTICS_CMD.
*
@@ -159,7 +159,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
*
* 1) EEPROM
* 2) "initialize" alive notification
- * 3) statistics notifications
+ * 3) stats notifications
*
* EEPROM data consists of:
*
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
index 9c8cc32..e99a20c 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
@@ -242,7 +242,7 @@ static inline u8 il4965_rs_is_valid_ant(u8 valid_antenna, u8 ant_type)
}

/*
- * removes the old data from the statistics. All data that is older than
+ * removes the old data from the stats. All data that is older than
* TID_MAX_TIME_DIFF, will be deleted.
*/
static void
@@ -991,7 +991,7 @@ done:
* Begin a period of staying with a selected modulation mode.
* Set "stay_in_tbl" flag to prevent any mode switches.
* Set frame tx success limits according to legacy vs. high-throughput,
- * and reset overall (spanning all rates) tx success history statistics.
+ * and reset overall (spanning all rates) tx success history stats.
* These control how long we stay using same modulation mode before
* searching for a new mode.
*/
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rx.c b/drivers/net/wireless/iwlegacy/iwl-4965-rx.c
index 9ccec09..b322957 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-rx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-rx.c
@@ -67,13 +67,13 @@ void il4965_rx_missed_beacon_notif(struct il_priv *il,
* exactly when to expect beacons, therefore only when we're associated. */
static void il4965_rx_calc_noise(struct il_priv *il)
{
- struct statistics_rx_non_phy *rx_info;
+ struct stats_rx_non_phy *rx_info;
int num_active_rx = 0;
int total_silence = 0;
int bcn_silence_a, bcn_silence_b, bcn_silence_c;
int last_rx_noise;

- rx_info = &(il->_4965.statistics.rx.general);
+ rx_info = &(il->_4965.stats.rx.general);
bcn_silence_a =
le32_to_cpu(rx_info->beacon_silence_rssi_a) & IN_BAND_FILTER;
bcn_silence_b =
@@ -107,28 +107,28 @@ static void il4965_rx_calc_noise(struct il_priv *il)

#ifdef CONFIG_IWLEGACY_DEBUGFS
/*
- * based on the assumption of all statistics counter are in DWORD
+ * based on the assumption of all stats counter are in DWORD
* FIXME: This function is for debugging, do not deal with
* the case of counters roll-over.
*/
-static void il4965_accumulative_statistics(struct il_priv *il,
+static void il4965_accumulative_stats(struct il_priv *il,
__le32 *stats)
{
int i, size;
__le32 *prev_stats;
u32 *accum_stats;
u32 *delta, *max_delta;
- struct statistics_general_common *general, *accum_general;
- struct statistics_tx *tx, *accum_tx;
-
- prev_stats = (__le32 *)&il->_4965.statistics;
- accum_stats = (u32 *)&il->_4965.accum_statistics;
- size = sizeof(struct il_notif_statistics);
- general = &il->_4965.statistics.general.common;
- accum_general = &il->_4965.accum_statistics.general.common;
- tx = &il->_4965.statistics.tx;
- accum_tx = &il->_4965.accum_statistics.tx;
- delta = (u32 *)&il->_4965.delta_statistics;
+ struct stats_general_common *general, *accum_general;
+ struct stats_tx *tx, *accum_tx;
+
+ prev_stats = (__le32 *)&il->_4965.stats;
+ accum_stats = (u32 *)&il->_4965.accum_stats;
+ size = sizeof(struct il_notif_stats);
+ general = &il->_4965.stats.general.common;
+ accum_general = &il->_4965.accum_stats.general.common;
+ tx = &il->_4965.stats.tx;
+ accum_tx = &il->_4965.accum_stats.tx;
+ delta = (u32 *)&il->_4965.delta_stats;
max_delta = (u32 *)&il->_4965.max_delta;

for (i = sizeof(__le32); i < size;
@@ -143,7 +143,7 @@ static void il4965_accumulative_statistics(struct il_priv *il,
}
}

- /* reset accumulative statistics for "no-counter" type statistics */
+ /* reset accumulative stats for "no-counter" type stats */
accum_general->temperature = general->temperature;
accum_general->ttl_timestamp = general->ttl_timestamp;
}
@@ -151,7 +151,7 @@ static void il4965_accumulative_statistics(struct il_priv *il,

#define REG_RECALIB_PERIOD (60)

-void il4965_rx_statistics(struct il_priv *il,
+void il4965_rx_stats(struct il_priv *il,
struct il_rx_buf *rxb)
{
int change;
@@ -159,31 +159,31 @@ void il4965_rx_statistics(struct il_priv *il,

D_RX(
"Statistics notification received (%d vs %d).\n",
- (int)sizeof(struct il_notif_statistics),
+ (int)sizeof(struct il_notif_stats),
le32_to_cpu(pkt->len_n_flags) &
FH_RSCSR_FRAME_SIZE_MSK);

- change = ((il->_4965.statistics.general.common.temperature !=
+ change = ((il->_4965.stats.general.common.temperature !=
pkt->u.stats.general.common.temperature) ||
- ((il->_4965.statistics.flag &
+ ((il->_4965.stats.flag &
STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
(pkt->u.stats.flag &
STATISTICS_REPLY_FLG_HT40_MODE_MSK)));
#ifdef CONFIG_IWLEGACY_DEBUGFS
- il4965_accumulative_statistics(il, (__le32 *)&pkt->u.stats);
+ il4965_accumulative_stats(il, (__le32 *)&pkt->u.stats);
#endif

- /* TODO: reading some of statistics is unneeded */
- memcpy(&il->_4965.statistics, &pkt->u.stats,
- sizeof(il->_4965.statistics));
+ /* TODO: reading some of stats is unneeded */
+ memcpy(&il->_4965.stats, &pkt->u.stats,
+ sizeof(il->_4965.stats));

set_bit(STATUS_STATISTICS, &il->status);

- /* Reschedule the statistics timer to occur in
+ /* Reschedule the stats timer to occur in
* REG_RECALIB_PERIOD seconds to ensure we get a
* thermal update even if the uCode doesn't give
* us one */
- mod_timer(&il->statistics_periodic, jiffies +
+ mod_timer(&il->stats_periodic, jiffies +
msecs_to_jiffies(REG_RECALIB_PERIOD * 1000));

if (unlikely(!test_bit(STATUS_SCANNING, &il->status)) &&
@@ -195,21 +195,21 @@ void il4965_rx_statistics(struct il_priv *il,
il->cfg->ops->lib->temp_ops.temperature(il);
}

-void il4965_reply_statistics(struct il_priv *il,
+void il4965_reply_stats(struct il_priv *il,
struct il_rx_buf *rxb)
{
struct il_rx_pkt *pkt = rxb_addr(rxb);

if (le32_to_cpu(pkt->u.stats.flag) & UCODE_STATISTICS_CLEAR_MSK) {
#ifdef CONFIG_IWLEGACY_DEBUGFS
- memset(&il->_4965.accum_statistics, 0,
- sizeof(struct il_notif_statistics));
- memset(&il->_4965.delta_statistics, 0,
- sizeof(struct il_notif_statistics));
+ memset(&il->_4965.accum_stats, 0,
+ sizeof(struct il_notif_stats));
+ memset(&il->_4965.delta_stats, 0,
+ sizeof(struct il_notif_stats));
memset(&il->_4965.max_delta, 0,
- sizeof(struct il_notif_statistics));
+ sizeof(struct il_notif_stats));
#endif
D_RX("Statistics have been cleared\n");
}
- il4965_rx_statistics(il, rxb);
+ il4965_rx_stats(il, rxb);
}
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c
index 5dd963e..9cfc140 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.c
@@ -1436,9 +1436,9 @@ static void il4965_txq_update_byte_cnt_tbl(struct il_priv *il,

/**
* il4965_hw_get_temperature - return the calibrated temperature (in Kelvin)
- * @statistics: Provides the temperature reading from the uCode
+ * @stats: Provides the temperature reading from the uCode
*
- * A return of <0 indicates bogus data in the statistics
+ * A return of <0 indicates bogus data in the stats
*/
static int il4965_hw_get_temperature(struct il_priv *il)
{
@@ -1448,7 +1448,7 @@ static int il4965_hw_get_temperature(struct il_priv *il)
u32 R4;

if (test_bit(STATUS_TEMPERATURE, &il->status) &&
- (il->_4965.statistics.flag &
+ (il->_4965.stats.flag &
STATISTICS_REPLY_FLG_HT40_MODE_MSK)) {
D_TEMP("Running HT40 temperature calibration\n");
R1 = (s32)le32_to_cpu(il->card_alive_init.therm_r1[1]);
@@ -1466,14 +1466,14 @@ static int il4965_hw_get_temperature(struct il_priv *il)
/*
* Temperature is only 23 bits, so sign extend out to 32.
*
- * NOTE If we haven't received a statistics notification yet
+ * NOTE If we haven't received a stats notification yet
* with an updated temperature, use R4 provided to us in the
* "initialize" ALIVE response.
*/
if (!test_bit(STATUS_TEMPERATURE, &il->status))
vt = sign_extend32(R4, 23);
else
- vt = sign_extend32(le32_to_cpu(il->_4965.statistics.
+ vt = sign_extend32(le32_to_cpu(il->_4965.stats.
general.common.temperature), 23);

D_TEMP("Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt);
@@ -1512,7 +1512,7 @@ static int il4965_is_temp_calib_needed(struct il_priv *il)
int temp_diff;

if (!test_bit(STATUS_STATISTICS, &il->status)) {
- D_TEMP("Temperature not updated -- no statistics.\n");
+ D_TEMP("Temperature not updated -- no stats.\n");
return 0;
}

diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.h b/drivers/net/wireless/iwlegacy/iwl-4965.h
index b5b27f4..a75b62c 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.h
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.h
@@ -174,9 +174,9 @@ void il4965_rx_missed_beacon_notif(struct il_priv *il,
struct il_rx_buf *rxb);
bool il4965_good_plcp_health(struct il_priv *il,
struct il_rx_pkt *pkt);
-void il4965_rx_statistics(struct il_priv *il,
+void il4965_rx_stats(struct il_priv *il,
struct il_rx_buf *rxb);
-void il4965_reply_statistics(struct il_priv *il,
+void il4965_reply_stats(struct il_priv *il,
struct il_rx_buf *rxb);

/* scan */
diff --git a/drivers/net/wireless/iwlegacy/iwl-commands.h b/drivers/net/wireless/iwlegacy/iwl-commands.h
index d9873cb..ea6c0f5 100644
--- a/drivers/net/wireless/iwlegacy/iwl-commands.h
+++ b/drivers/net/wireless/iwlegacy/iwl-commands.h
@@ -2016,7 +2016,7 @@ struct il_link_qual_agg_params {
* good performance; higher rate is sure to have poorer success.
*
* 6) Re-evaluate the rate after each tx frame. If working with block-
- * acknowledge, history and statistics may be calculated for the entire
+ * acknowledge, history and stats may be calculated for the entire
* block (including prior history that fits within the history windows),
* before re-evaluation.
*
@@ -2637,7 +2637,7 @@ struct il_scanresults_notification {
u8 num_probe_not_sent; /* not enough time to send */
__le32 tsf_low;
__le32 tsf_high;
- __le32 statistics[NUMBER_OF_STATISTICS];
+ __le32 stats[NUMBER_OF_STATISTICS];
} __packed;

/*
@@ -2727,9 +2727,9 @@ struct rate_histogram {
} failed;
} __packed;

-/* statistics command response */
+/* stats command response */

-struct iwl39_statistics_rx_phy {
+struct iwl39_stats_rx_phy {
__le32 ina_cnt;
__le32 fina_cnt;
__le32 plcp_err;
@@ -2747,7 +2747,7 @@ struct iwl39_statistics_rx_phy {
__le32 sent_cts_cnt;
} __packed;

-struct iwl39_statistics_rx_non_phy {
+struct iwl39_stats_rx_non_phy {
__le32 bogus_cts; /* CTS received when not expecting CTS */
__le32 bogus_ack; /* ACK received when not expecting ACK */
__le32 non_bssid_frames; /* number of frames with BSSID that
@@ -2758,13 +2758,13 @@ struct iwl39_statistics_rx_non_phy {
* our serving channel */
} __packed;

-struct iwl39_statistics_rx {
- struct iwl39_statistics_rx_phy ofdm;
- struct iwl39_statistics_rx_phy cck;
- struct iwl39_statistics_rx_non_phy general;
+struct iwl39_stats_rx {
+ struct iwl39_stats_rx_phy ofdm;
+ struct iwl39_stats_rx_phy cck;
+ struct iwl39_stats_rx_non_phy general;
} __packed;

-struct iwl39_statistics_tx {
+struct iwl39_stats_tx {
__le32 preamble_cnt;
__le32 rx_detected_cnt;
__le32 bt_prio_defer_cnt;
@@ -2776,31 +2776,31 @@ struct iwl39_statistics_tx {
__le32 actual_ack_cnt;
} __packed;

-struct statistics_dbg {
+struct stats_dbg {
__le32 burst_check;
__le32 burst_count;
__le32 wait_for_silence_timeout_cnt;
__le32 reserved[3];
} __packed;

-struct iwl39_statistics_div {
+struct iwl39_stats_div {
__le32 tx_on_a;
__le32 tx_on_b;
__le32 exec_time;
__le32 probe_time;
} __packed;

-struct iwl39_statistics_general {
+struct iwl39_stats_general {
__le32 temperature;
- struct statistics_dbg dbg;
+ struct stats_dbg dbg;
__le32 sleep_time;
__le32 slots_out;
__le32 slots_idle;
__le32 ttl_timestamp;
- struct iwl39_statistics_div div;
+ struct iwl39_stats_div div;
} __packed;

-struct statistics_rx_phy {
+struct stats_rx_phy {
__le32 ina_cnt;
__le32 fina_cnt;
__le32 plcp_err;
@@ -2823,7 +2823,7 @@ struct statistics_rx_phy {
__le32 reserved3;
} __packed;

-struct statistics_rx_ht_phy {
+struct stats_rx_ht_phy {
__le32 plcp_err;
__le32 overrun_err;
__le32 early_overrun_err;
@@ -2838,7 +2838,7 @@ struct statistics_rx_ht_phy {

#define INTERFERENCE_DATA_AVAILABLE cpu_to_le32(1)

-struct statistics_rx_non_phy {
+struct stats_rx_non_phy {
__le32 bogus_cts; /* CTS received when not expecting CTS */
__le32 bogus_ack; /* ACK received when not expecting ACK */
__le32 non_bssid_frames; /* number of frames with BSSID that
@@ -2871,28 +2871,28 @@ struct statistics_rx_non_phy {
__le32 beacon_energy_c;
} __packed;

-struct statistics_rx {
- struct statistics_rx_phy ofdm;
- struct statistics_rx_phy cck;
- struct statistics_rx_non_phy general;
- struct statistics_rx_ht_phy ofdm_ht;
+struct stats_rx {
+ struct stats_rx_phy ofdm;
+ struct stats_rx_phy cck;
+ struct stats_rx_non_phy general;
+ struct stats_rx_ht_phy ofdm_ht;
} __packed;

/**
- * struct statistics_tx_power - current tx power
+ * struct stats_tx_power - current tx power
*
* @ant_a: current tx power on chain a in 1/2 dB step
* @ant_b: current tx power on chain b in 1/2 dB step
* @ant_c: current tx power on chain c in 1/2 dB step
*/
-struct statistics_tx_power {
+struct stats_tx_power {
u8 ant_a;
u8 ant_b;
u8 ant_c;
u8 reserved;
} __packed;

-struct statistics_tx_non_phy_agg {
+struct stats_tx_non_phy_agg {
__le32 ba_timeout;
__le32 ba_reschedule_frames;
__le32 scd_query_agg_frame_cnt;
@@ -2905,7 +2905,7 @@ struct statistics_tx_non_phy_agg {
__le32 rx_ba_rsp_cnt;
} __packed;

-struct statistics_tx {
+struct stats_tx {
__le32 preamble_cnt;
__le32 rx_detected_cnt;
__le32 bt_prio_defer_cnt;
@@ -2920,13 +2920,13 @@ struct statistics_tx {
__le32 burst_abort_missing_next_frame_cnt;
__le32 cts_timeout_collision;
__le32 ack_or_ba_timeout_collision;
- struct statistics_tx_non_phy_agg agg;
+ struct stats_tx_non_phy_agg agg;

__le32 reserved1;
} __packed;


-struct statistics_div {
+struct stats_div {
__le32 tx_on_a;
__le32 tx_on_b;
__le32 exec_time;
@@ -2935,14 +2935,14 @@ struct statistics_div {
__le32 reserved2;
} __packed;

-struct statistics_general_common {
+struct stats_general_common {
__le32 temperature; /* radio temperature */
- struct statistics_dbg dbg;
+ struct stats_dbg dbg;
__le32 sleep_time;
__le32 slots_out;
__le32 slots_idle;
__le32 ttl_timestamp;
- struct statistics_div div;
+ struct stats_div div;
__le32 rx_enable_counter;
/*
* num_of_sos_states:
@@ -2952,8 +2952,8 @@ struct statistics_general_common {
__le32 num_of_sos_states;
} __packed;

-struct statistics_general {
- struct statistics_general_common common;
+struct stats_general {
+ struct stats_general_common common;
__le32 reserved2;
__le32 reserved3;
} __packed;
@@ -2966,11 +2966,11 @@ struct statistics_general {
* REPLY_STATISTICS_CMD = 0x9c,
* all devices identical.
*
- * This command triggers an immediate response containing uCode statistics.
+ * This command triggers an immediate response containing uCode stats.
* The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
*
* If the CLEAR_STATS configuration flag is set, uCode will clear its
- * internal copy of the statistics (counters) after issuing the response.
+ * internal copy of the stats (counters) after issuing the response.
* This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
*
* If the DISABLE_NOTIF configuration flag is set, uCode will not issue
@@ -2979,7 +2979,7 @@ struct statistics_general {
*/
#define IL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */
#define IL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */
-struct il_statistics_cmd {
+struct il_stats_cmd {
__le32 configuration_flags; /* IL_STATS_CONF_* */
} __packed;

@@ -2994,25 +2994,25 @@ struct il_statistics_cmd {
* cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
* 0x9c with CLEAR_STATS bit set (see above).
*
- * uCode also issues this notification during scans. uCode clears statistics
- * appropriately so that each notification contains statistics for only the
+ * uCode also issues this notification during scans. uCode clears stats
+ * appropriately so that each notification contains stats for only the
* one channel that has just been scanned.
*/
#define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2)
#define STATISTICS_REPLY_FLG_HT40_MODE_MSK cpu_to_le32(0x8)

-struct il3945_notif_statistics {
+struct il3945_notif_stats {
__le32 flag;
- struct iwl39_statistics_rx rx;
- struct iwl39_statistics_tx tx;
- struct iwl39_statistics_general general;
+ struct iwl39_stats_rx rx;
+ struct iwl39_stats_tx tx;
+ struct iwl39_stats_general general;
} __packed;

-struct il_notif_statistics {
+struct il_notif_stats {
__le32 flag;
- struct statistics_rx rx;
- struct statistics_tx tx;
- struct statistics_general general;
+ struct stats_rx rx;
+ struct stats_tx tx;
+ struct stats_general general;
} __packed;

/*
@@ -3078,10 +3078,10 @@ struct il_missed_beacon_notif {
*
* While associated, uCode delivers STATISTICS_NOTIFICATIONs after each
* received beacon. These provide information to the driver to analyze the
- * sensitivity. Don't analyze statistics that come in from scanning, or any
- * other non-associated-network source. Pertinent statistics include:
+ * sensitivity. Don't analyze stats that come in from scanning, or any
+ * other non-associated-network source. Pertinent stats include:
*
- * From "general" statistics (struct statistics_rx_non_phy):
+ * From "general" stats (struct stats_rx_non_phy):
*
* (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level)
* Measure of energy of desired signal. Used for establishing a level
@@ -3094,7 +3094,7 @@ struct il_missed_beacon_notif {
* uSecs of actual Rx time during beacon period (varies according to
* how much time was spent transmitting).
*
- * From "cck" and "ofdm" statistics (struct statistics_rx_phy), separately:
+ * From "cck" and "ofdm" stats (struct stats_rx_phy), separately:
*
* false_alarm_cnt
* Signal locks abandoned early (before phy-level header).
@@ -3255,8 +3255,8 @@ struct il_sensitivity_cmd {
* This command sets the relative gains of 4965 device's 3 radio receiver chains.
*
* After the first association, driver should accumulate signal and noise
- * statistics from the STATISTICS_NOTIFICATIONs that follow the first 20
- * beacons from the associated network (don't collect statistics that come
+ * stats from the STATISTICS_NOTIFICATIONs that follow the first 20
+ * beacons from the associated network (don't collect stats that come
* in from scanning, or any other non-network source).
*
* DISCONNECTED ANTENNA:
@@ -3264,7 +3264,7 @@ struct il_sensitivity_cmd {
* Driver should determine which antennas are actually connected, by comparing
* average beacon signal levels for the 3 Rx chains. Accumulate (add) the
* following values over 20 beacons, one accumulator for each of the chains
- * a/b/c, from struct statistics_rx_non_phy:
+ * a/b/c, from struct stats_rx_non_phy:
*
* beacon_rssi_[abc] & 0x0FF (unsigned, units in dB)
*
@@ -3283,7 +3283,7 @@ struct il_sensitivity_cmd {
* to antennas, see above) for gain, by comparing the average signal levels
* detected during the silence after each beacon (background noise).
* Accumulate (add) the following values over 20 beacons, one accumulator for
- * each of the chains a/b/c, from struct statistics_rx_non_phy:
+ * each of the chains a/b/c, from struct stats_rx_non_phy:
*
* beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB)
*
@@ -3387,7 +3387,7 @@ struct il_rx_pkt {
struct il_rem_sta_resp rem_sta;
struct il_sleep_notification sleep_notif;
struct il_spectrum_resp spectrum;
- struct il_notif_statistics stats;
+ struct il_notif_stats stats;
struct il_compressed_ba_resp compressed_ba;
struct il_missed_beacon_notif missed_beacon;
__le32 status;
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index 8feb2dd..475bcac 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -1187,23 +1187,23 @@ void il_send_bt_config(struct il_priv *il)
}
EXPORT_SYMBOL(il_send_bt_config);

-int il_send_statistics_request(struct il_priv *il, u8 flags, bool clear)
+int il_send_stats_request(struct il_priv *il, u8 flags, bool clear)
{
- struct il_statistics_cmd statistics_cmd = {
+ struct il_stats_cmd stats_cmd = {
.configuration_flags =
clear ? IL_STATS_CONF_CLEAR_STATS : 0,
};

if (flags & CMD_ASYNC)
return il_send_cmd_pdu_async(il, REPLY_STATISTICS_CMD,
- sizeof(struct il_statistics_cmd),
- &statistics_cmd, NULL);
+ sizeof(struct il_stats_cmd),
+ &stats_cmd, NULL);
else
return il_send_cmd_pdu(il, REPLY_STATISTICS_CMD,
- sizeof(struct il_statistics_cmd),
- &statistics_cmd);
+ sizeof(struct il_stats_cmd),
+ &stats_cmd);
}
-EXPORT_SYMBOL(il_send_statistics_request);
+EXPORT_SYMBOL(il_send_stats_request);

void il_rx_pm_sleep_notif(struct il_priv *il,
struct il_rx_buf *rxb)
@@ -1217,7 +1217,7 @@ void il_rx_pm_sleep_notif(struct il_priv *il,
}
EXPORT_SYMBOL(il_rx_pm_sleep_notif);

-void il_rx_pm_debug_statistics_notif(struct il_priv *il,
+void il_rx_pm_debug_stats_notif(struct il_priv *il,
struct il_rx_buf *rxb)
{
struct il_rx_pkt *pkt = rxb_addr(rxb);
@@ -1227,7 +1227,7 @@ void il_rx_pm_debug_statistics_notif(struct il_priv *il,
il_get_cmd_string(pkt->hdr.cmd));
il_print_hex_dump(il, IL_DL_RADIO, pkt->u.raw, len);
}
-EXPORT_SYMBOL(il_rx_pm_debug_statistics_notif);
+EXPORT_SYMBOL(il_rx_pm_debug_stats_notif);

void il_rx_reply_error(struct il_priv *il,
struct il_rx_buf *rxb)
@@ -1614,7 +1614,7 @@ void il_clear_traffic_stats(struct il_priv *il)
* if CONFIG_IWLEGACY_DEBUGFS defined,
* il_update_stats function will
* record all the MGMT, CTRL and DATA pkt for both TX and Rx pass
- * Use debugFs to display the rx/rx_statistics
+ * Use debugFs to display the rx/rx_stats
* if CONFIG_IWLEGACY_DEBUGFS not being defined, then no MGMT and CTRL
* information will be recorded, but DATA pkt still will be recorded
* for the reason of il_led.c need to control the led blinking based on
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.h b/drivers/net/wireless/iwlegacy/iwl-core.h
index bc2ae06..8333761 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.h
+++ b/drivers/net/wireless/iwlegacy/iwl-core.h
@@ -371,7 +371,7 @@ static inline void il_update_stats(struct il_priv *il, bool is_tx,
* **************************************************/
void il_rx_pm_sleep_notif(struct il_priv *il,
struct il_rx_buf *rxb);
-void il_rx_pm_debug_statistics_notif(struct il_priv *il,
+void il_rx_pm_debug_stats_notif(struct il_priv *il,
struct il_rx_buf *rxb);
void il_rx_reply_error(struct il_priv *il,
struct il_rx_buf *rxb);
@@ -390,7 +390,7 @@ void il_tx_cmd_complete(struct il_priv *il,
/* Handlers */
void il_rx_spectrum_measure_notif(struct il_priv *il,
struct il_rx_buf *rxb);
-void il_recover_from_statistics(struct il_priv *il,
+void il_recover_from_stats(struct il_priv *il,
struct il_rx_pkt *pkt);
void il_chswitch_done(struct il_priv *il, bool is_success);
void il_rx_csa(struct il_priv *il, struct il_rx_buf *rxb);
@@ -596,7 +596,7 @@ static inline int il_is_ready_rf(struct il_priv *il)
}

extern void il_send_bt_config(struct il_priv *il);
-extern int il_send_statistics_request(struct il_priv *il,
+extern int il_send_stats_request(struct il_priv *il,
u8 flags, bool clear);
void il_apm_stop(struct il_priv *il);
int il_apm_init(struct il_priv *il);
diff --git a/drivers/net/wireless/iwlegacy/iwl-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-debugfs.c
index a4b1f37..e8153b0 100644
--- a/drivers/net/wireless/iwlegacy/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-debugfs.c
@@ -102,7 +102,7 @@ static const struct file_operations il_dbgfs_##name##_ops = { \
.llseek = generic_file_llseek, \
};

-static ssize_t il_dbgfs_tx_statistics_read(struct file *file,
+static ssize_t il_dbgfs_tx_stats_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos) {

@@ -142,7 +142,7 @@ static ssize_t il_dbgfs_tx_statistics_read(struct file *file,
}

static ssize_t
-il_dbgfs_clear_traffic_statistics_write(struct file *file,
+il_dbgfs_clear_traffic_stats_write(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
@@ -162,7 +162,7 @@ il_dbgfs_clear_traffic_statistics_write(struct file *file,
return count;
}

-static ssize_t il_dbgfs_rx_statistics_read(struct file *file,
+static ssize_t il_dbgfs_rx_stats_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos) {

@@ -1031,7 +1031,7 @@ static ssize_t il_dbgfs_power_save_status_read(struct file *file,
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
}

-static ssize_t il_dbgfs_clear_ucode_statistics_write(struct file *file,
+static ssize_t il_dbgfs_clear_ucode_stats_write(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
@@ -1047,9 +1047,9 @@ static ssize_t il_dbgfs_clear_ucode_statistics_write(struct file *file,
if (sscanf(buf, "%d", &clear) != 1)
return -EFAULT;

- /* make request to uCode to retrieve statistics information */
+ /* make request to uCode to retrieve stats information */
mutex_lock(&il->mutex);
- il_send_statistics_request(il, CMD_SYNC, true);
+ il_send_stats_request(il, CMD_SYNC, true);
mutex_unlock(&il->mutex);

return count;
@@ -1206,8 +1206,8 @@ static ssize_t il_dbgfs_wd_timeout_write(struct file *file,
return count;
}

-DEBUGFS_READ_FILE_OPS(rx_statistics);
-DEBUGFS_READ_FILE_OPS(tx_statistics);
+DEBUGFS_READ_FILE_OPS(rx_stats);
+DEBUGFS_READ_FILE_OPS(tx_stats);
DEBUGFS_READ_WRITE_FILE_OPS(traffic_log);
DEBUGFS_READ_FILE_OPS(rx_queue);
DEBUGFS_READ_FILE_OPS(tx_queue);
@@ -1217,8 +1217,8 @@ DEBUGFS_READ_FILE_OPS(ucode_general_stats);
DEBUGFS_READ_FILE_OPS(sensitivity);
DEBUGFS_READ_FILE_OPS(chain_noise);
DEBUGFS_READ_FILE_OPS(power_save_status);
-DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics);
-DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics);
+DEBUGFS_WRITE_FILE_OPS(clear_ucode_stats);
+DEBUGFS_WRITE_FILE_OPS(clear_traffic_stats);
DEBUGFS_READ_FILE_OPS(fh_reg);
DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon);
DEBUGFS_READ_WRITE_FILE_OPS(force_reset);
@@ -1259,14 +1259,14 @@ int il_dbgfs_register(struct il_priv *il, const char *name)
DEBUGFS_ADD_FILE(interrupt, dir_data, S_IWUSR | S_IRUSR);
DEBUGFS_ADD_FILE(qos, dir_data, S_IRUSR);
DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR);
- DEBUGFS_ADD_FILE(rx_statistics, dir_debug, S_IRUSR);
- DEBUGFS_ADD_FILE(tx_statistics, dir_debug, S_IRUSR);
+ DEBUGFS_ADD_FILE(rx_stats, dir_debug, S_IRUSR);
+ DEBUGFS_ADD_FILE(tx_stats, dir_debug, S_IRUSR);
DEBUGFS_ADD_FILE(traffic_log, dir_debug, S_IWUSR | S_IRUSR);
DEBUGFS_ADD_FILE(rx_queue, dir_debug, S_IRUSR);
DEBUGFS_ADD_FILE(tx_queue, dir_debug, S_IRUSR);
DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR);
- DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR);
- DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR);
+ DEBUGFS_ADD_FILE(clear_ucode_stats, dir_debug, S_IWUSR);
+ DEBUGFS_ADD_FILE(clear_traffic_stats, dir_debug, S_IWUSR);
DEBUGFS_ADD_FILE(fh_reg, dir_debug, S_IRUSR);
DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR);
DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR);
diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h
index ad72d39..4388538 100644
--- a/drivers/net/wireless/iwlegacy/iwl-dev.h
+++ b/drivers/net/wireless/iwlegacy/iwl-dev.h
@@ -57,7 +57,7 @@ struct il_tx_queue;

/* Default noise level to report when noise measurement is not available.
* This may be because we're:
- * 1) Not associated (4965, no beacon statistics being sent to driver)
+ * 1) Not associated (4965, no beacon stats being sent to driver)
* 2) Scanning (noise measurement does not apply to associated channel)
* 3) Receiving CCK (3945 delivers noise info only for OFDM frames)
* Use default noise value of -127 ... this is below the range of measurable
@@ -801,8 +801,8 @@ enum {
MEASUREMENT_ACTIVE = (1 << 1),
};

-/* interrupt statistics */
-struct isr_statistics {
+/* interrupt stats */
+struct isr_stats {
u32 hw;
u32 sw;
u32 err_code;
@@ -817,7 +817,7 @@ struct isr_statistics {
u32 unhandled;
};

-/* management statistics */
+/* management stats */
enum il_mgmt_stats {
MANAGEMENT_ASSOC_REQ = 0,
MANAGEMENT_ASSOC_RESP,
@@ -833,7 +833,7 @@ enum il_mgmt_stats {
MANAGEMENT_ACTION,
MANAGEMENT_MAX,
};
-/* control statistics */
+/* control stats */
enum il_ctrl_stats {
CONTROL_BACK_REQ = 0,
CONTROL_BACK,
@@ -1087,7 +1087,7 @@ struct il_priv {
struct traffic_stats rx_stats;

/* counts interrupts */
- struct isr_statistics isr_stats;
+ struct isr_stats isr_stats;

struct il_power_mgr power_data;

@@ -1131,15 +1131,15 @@ struct il_priv {
struct delayed_work thermal_periodic;
struct delayed_work rfkill_poll;

- struct il3945_notif_statistics statistics;
+ struct il3945_notif_stats stats;
#ifdef CONFIG_IWLEGACY_DEBUGFS
- struct il3945_notif_statistics accum_statistics;
- struct il3945_notif_statistics delta_statistics;
- struct il3945_notif_statistics max_delta;
+ struct il3945_notif_stats accum_stats;
+ struct il3945_notif_stats delta_stats;
+ struct il3945_notif_stats max_delta;
#endif

u32 sta_supp_rates;
- int last_rx_rssi; /* From Rx packet statistics */
+ int last_rx_rssi; /* From Rx packet stats */

/* Rx'd packet timing information */
u32 last_beacon_time;
@@ -1169,11 +1169,11 @@ struct il_priv {
u8 phy_calib_chain_noise_reset_cmd;
u8 phy_calib_chain_noise_gain_cmd;

- struct il_notif_statistics statistics;
+ struct il_notif_stats stats;
#ifdef CONFIG_IWLEGACY_DEBUGFS
- struct il_notif_statistics accum_statistics;
- struct il_notif_statistics delta_statistics;
- struct il_notif_statistics max_delta;
+ struct il_notif_stats accum_stats;
+ struct il_notif_stats delta_stats;
+ struct il_notif_stats max_delta;
#endif

} _4965;
@@ -1229,7 +1229,7 @@ struct il_priv {
u32 disable_chain_noise_cal;
u32 disable_tx_power_cal;
struct work_struct run_time_calib_work;
- struct timer_list statistics_periodic;
+ struct timer_list stats_periodic;
struct timer_list watchdog;
bool hw_ready;

diff --git a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
index f24b6b8..19fa92d 100644
--- a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
+++ b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
@@ -335,7 +335,7 @@ struct il_scale_tbl_info {
};

struct il_traffic_load {
- unsigned long time_stamp; /* age of the oldest statistics */
+ unsigned long time_stamp; /* age of the oldest stats */
u32 packet_count[TID_QUEUE_MAX_SIZE]; /* packet count in this time
* slice */
u32 total; /* total num of packets during the
diff --git a/drivers/net/wireless/iwlegacy/iwl-scan.c b/drivers/net/wireless/iwlegacy/iwl-scan.c
index dfc1431..71b2fac 100644
--- a/drivers/net/wireless/iwlegacy/iwl-scan.c
+++ b/drivers/net/wireless/iwlegacy/iwl-scan.c
@@ -229,7 +229,7 @@ static void il_rx_scan_results_notif(struct il_priv *il,
notif->band ? "bg" : "a",
le32_to_cpu(notif->tsf_high),
le32_to_cpu(notif->tsf_low),
- le32_to_cpu(notif->statistics[0]),
+ le32_to_cpu(notif->stats[0]),
le32_to_cpu(notif->tsf_low) - il->scan_start_tsf);
#endif
}
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index 446bdb5..c602570 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -862,16 +862,16 @@ static void il3945_setup_rx_handlers(struct il_priv *il)
il_rx_spectrum_measure_notif;
il->rx_handlers[PM_SLEEP_NOTIFICATION] = il_rx_pm_sleep_notif;
il->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] =
- il_rx_pm_debug_statistics_notif;
+ il_rx_pm_debug_stats_notif;
il->rx_handlers[BEACON_NOTIFICATION] = il3945_rx_beacon_notif;

/*
* The same handler is used for both the REPLY to a discrete
- * statistics request from the host as well as for the periodic
- * statistics notifications (after received beacons) from the uCode.
+ * stats request from the host as well as for the periodic
+ * stats notifications (after received beacons) from the uCode.
*/
- il->rx_handlers[REPLY_STATISTICS_CMD] = il3945_reply_statistics;
- il->rx_handlers[STATISTICS_NOTIFICATION] = il3945_hw_rx_statistics;
+ il->rx_handlers[REPLY_STATISTICS_CMD] = il3945_reply_stats;
+ il->rx_handlers[STATISTICS_NOTIFICATION] = il3945_hw_rx_stats;

il_setup_rx_scan_handlers(il);
il->rx_handlers[CARD_STATE_NOTIFICATION] = il3945_rx_card_state_notif;
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
index 81613ed..736c2f5 100644
--- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
@@ -464,16 +464,16 @@ static void il4965_rx_reply_alive(struct il_priv *il,
}

/**
- * il4965_bg_statistics_periodic - Timer callback to queue statistics
+ * il4965_bg_stats_periodic - Timer callback to queue stats
*
- * This callback is provided in order to send a statistics request.
+ * This callback is provided in order to send a stats request.
*
* This timer function is continually reset to execute within
* REG_RECALIB_PERIOD seconds since the last STATISTICS_NOTIFICATION
- * was received. We need to ensure we receive the statistics in order
+ * was received. We need to ensure we receive the stats in order
* to update the temperature used for calibrating the TXPOWER.
*/
-static void il4965_bg_statistics_periodic(unsigned long data)
+static void il4965_bg_stats_periodic(unsigned long data)
{
struct il_priv *il = (struct il_priv *)data;

@@ -484,7 +484,7 @@ static void il4965_bg_statistics_periodic(unsigned long data)
if (!il_is_ready_rf(il))
return;

- il_send_statistics_request(il, CMD_ASYNC, false);
+ il_send_stats_request(il, CMD_ASYNC, false);
}

static void il4965_rx_beacon_notif(struct il_priv *il,
@@ -596,16 +596,16 @@ static void il4965_setup_rx_handlers(struct il_priv *il)
il_rx_spectrum_measure_notif;
il->rx_handlers[PM_SLEEP_NOTIFICATION] = il_rx_pm_sleep_notif;
il->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] =
- il_rx_pm_debug_statistics_notif;
+ il_rx_pm_debug_stats_notif;
il->rx_handlers[BEACON_NOTIFICATION] = il4965_rx_beacon_notif;

/*
* The same handler is used for both the REPLY to a discrete
- * statistics request from the host as well as for the periodic
- * statistics notifications (after received beacons) from the uCode.
+ * stats request from the host as well as for the periodic
+ * stats notifications (after received beacons) from the uCode.
*/
- il->rx_handlers[REPLY_STATISTICS_CMD] = il4965_reply_statistics;
- il->rx_handlers[STATISTICS_NOTIFICATION] = il4965_rx_statistics;
+ il->rx_handlers[REPLY_STATISTICS_CMD] = il4965_reply_stats;
+ il->rx_handlers[STATISTICS_NOTIFICATION] = il4965_rx_stats;

il_setup_rx_scan_handlers(il);

@@ -2105,9 +2105,9 @@ static void il4965_bg_run_time_calib_work(struct work_struct *work)

if (il->start_calib) {
il4965_chain_noise_calibration(il,
- (void *)&il->_4965.statistics);
+ (void *)&il->_4965.stats);
il4965_sensitivity_calibration(il,
- (void *)&il->_4965.statistics);
+ (void *)&il->_4965.stats);
}

mutex_unlock(&il->mutex);
@@ -2647,7 +2647,7 @@ static void il4965_bg_txpower_work(struct work_struct *work)
mutex_lock(&il->mutex);

/* If a scan happened to start before we got here
- * then just return; the statistics notification will
+ * then just return; the stats notification will
* kick off another scheduled work to compensate for
* any temperature delta we missed here. */
if (test_bit(STATUS_EXIT_PENDING, &il->status) ||
@@ -2682,9 +2682,9 @@ static void il4965_setup_deferred_work(struct il_priv *il)

INIT_WORK(&il->txpower_work, il4965_bg_txpower_work);

- init_timer(&il->statistics_periodic);
- il->statistics_periodic.data = (unsigned long)il;
- il->statistics_periodic.function = il4965_bg_statistics_periodic;
+ init_timer(&il->stats_periodic);
+ il->stats_periodic.data = (unsigned long)il;
+ il->stats_periodic.function = il4965_bg_stats_periodic;

init_timer(&il->watchdog);
il->watchdog.data = (unsigned long)il;
@@ -2703,7 +2703,7 @@ static void il4965_cancel_deferred_work(struct il_priv *il)

il_cancel_scan_deferred_work(il);

- del_timer_sync(&il->statistics_periodic);
+ del_timer_sync(&il->stats_periodic);
}

static void il4965_init_hw_rates(struct il_priv *il,
--
1.7.1


2011-11-18 08:23:07

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 65/77] iwlegacy: merge iwl-debug.h into common.h

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/3945.h | 1 -
drivers/net/wireless/iwlegacy/4965.h | 2 -
drivers/net/wireless/iwlegacy/Kconfig | 2 +-
drivers/net/wireless/iwlegacy/common.c | 1 -
drivers/net/wireless/iwlegacy/common.h | 191 +++++++++++++++++++++++++----
drivers/net/wireless/iwlegacy/debug.c | 2 -
drivers/net/wireless/iwlegacy/iwl-debug.h | 175 --------------------------
7 files changed, 165 insertions(+), 209 deletions(-)
delete mode 100644 drivers/net/wireless/iwlegacy/iwl-debug.h

diff --git a/drivers/net/wireless/iwlegacy/3945.h b/drivers/net/wireless/iwlegacy/3945.h
index ed367bb..1a2430b 100644
--- a/drivers/net/wireless/iwlegacy/3945.h
+++ b/drivers/net/wireless/iwlegacy/3945.h
@@ -35,7 +35,6 @@
extern const struct pci_device_id il3945_hw_card_ids[];

#include "common.h"
-#include "iwl-debug.h"

/* Highest firmware API version supported */
#define IL3945_UCODE_API_MAX 2
diff --git a/drivers/net/wireless/iwlegacy/4965.h b/drivers/net/wireless/iwlegacy/4965.h
index 10d0b13..a4e256b 100644
--- a/drivers/net/wireless/iwlegacy/4965.h
+++ b/drivers/net/wireless/iwlegacy/4965.h
@@ -30,8 +30,6 @@
#ifndef __il_4965_h__
#define __il_4965_h__

-#include "iwl-debug.h"
-
struct il_rx_queue;
struct il_rx_buf;
struct il_rx_pkt;
diff --git a/drivers/net/wireless/iwlegacy/Kconfig b/drivers/net/wireless/iwlegacy/Kconfig
index b4be3b4..05bd375 100644
--- a/drivers/net/wireless/iwlegacy/Kconfig
+++ b/drivers/net/wireless/iwlegacy/Kconfig
@@ -29,7 +29,7 @@ config IWLEGACY_DEBUG
% echo 0x43fff > /sys/class/net/wlan0/device/debug_level

You can find the list of debug mask values in:
- drivers/net/wireless/iwlegacy/iwl-debug.h
+ drivers/net/wireless/iwlegacy/common.h

If this is your first time using this driver, you should say Y here
as the debug information can assist others in helping you resolve
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index 5d5efcb..627ac9b 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -40,7 +40,6 @@
#include <linux/skbuff.h>
#include <net/mac80211.h>

-#include "iwl-debug.h"
#include "common.h"

const char *il_get_cmd_string(u8 cmd)
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h
index be057aa..b1d237f 100644
--- a/drivers/net/wireless/iwlegacy/common.h
+++ b/drivers/net/wireless/iwlegacy/common.h
@@ -37,12 +37,15 @@
#include "commands.h"
#include "csr.h"
#include "prph.h"
-#include "iwl-debug.h"

struct il_host_cmd;
struct il_cmd;
struct il_tx_queue;

+#define IL_ERR(f, a...) dev_err(&il->pci_dev->dev, f, ## a)
+#define IL_WARN(f, a...) dev_warn(&il->pci_dev->dev, f, ## a)
+#define IL_INFO(f, a...) dev_info(&il->pci_dev->dev, f, ## a)
+
#define RX_QUEUE_SIZE 256
#define RX_QUEUE_MASK 255
#define RX_QUEUE_SIZE_LOG 8
@@ -1515,29 +1518,6 @@ static inline void il_txq_ctx_deactivate(struct il_priv *il, int txq_id)
clear_bit(txq_id, &il->txq_ctx_active_msk);
}

-#ifdef CONFIG_IWLEGACY_DEBUG
-/*
- * il_get_debug_level: Return active debug level for device
- *
- * Using sysfs it is possible to set per device debug level. This debug
- * level will be used if set, otherwise the global debug level which can be
- * set via module parameter is used.
- */
-static inline u32 il_get_debug_level(struct il_priv *il)
-{
- if (il->debug_level)
- return il->debug_level;
- else
- return il_debug_level;
-}
-#else
-static inline u32 il_get_debug_level(struct il_priv *il)
-{
- return il_debug_level;
-}
-#endif
-
-
static inline struct ieee80211_hdr *
il_tx_queue_get_hdr(struct il_priv *il,
int txq_id, int idx)
@@ -2736,18 +2716,15 @@ static inline void il_disable_interrupts(struct il_priv *il)
* from uCode or flow handler (Rx/Tx DMA) */
_il_wr(il, CSR_INT, 0xffffffff);
_il_wr(il, CSR_FH_INT_STATUS, 0xffffffff);
- D_ISR("Disabled interrupts\n");
}

static inline void il_enable_rfkill_int(struct il_priv *il)
{
- D_ISR("Enabling rfkill interrupt\n");
_il_wr(il, CSR_INT_MASK, CSR_INT_BIT_RF_KILL);
}

static inline void il_enable_interrupts(struct il_priv *il)
{
- D_ISR("Enabling interrupts\n");
set_bit(S_INT_ENABLED, &il->status);
_il_wr(il, CSR_INT_MASK, il->inta_mask);
}
@@ -3304,4 +3281,164 @@ extern void il3945_rate_control_unregister(void);
extern int il_power_update_mode(struct il_priv *il, bool force);
extern void il_power_initialize(struct il_priv *il);

+extern u32 il_debug_level;
+
+#ifdef CONFIG_IWLEGACY_DEBUG
+/*
+ * il_get_debug_level: Return active debug level for device
+ *
+ * Using sysfs it is possible to set per device debug level. This debug
+ * level will be used if set, otherwise the global debug level which can be
+ * set via module parameter is used.
+ */
+static inline u32 il_get_debug_level(struct il_priv *il)
+{
+ if (il->debug_level)
+ return il->debug_level;
+ else
+ return il_debug_level;
+}
+#else
+static inline u32 il_get_debug_level(struct il_priv *il)
+{
+ return il_debug_level;
+}
+#endif
+
+#define il_print_hex_error(il, p, len) \
+do { \
+ print_hex_dump(KERN_ERR, "iwl data: ", \
+ DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
+} while (0)
+
+#ifdef CONFIG_IWLEGACY_DEBUG
+#define IL_DBG(level, fmt, args...) \
+do { \
+ if (il_get_debug_level(il) & level) \
+ dev_printk(KERN_ERR, &il->hw->wiphy->dev, \
+ "%c %s " fmt, in_interrupt() ? 'I' : 'U', \
+ __func__ , ## args); \
+} while (0)
+
+#define il_print_hex_dump(il, level, p, len) \
+do { \
+ if (il_get_debug_level(il) & level) \
+ print_hex_dump(KERN_DEBUG, "iwl data: ", \
+ DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
+} while (0)
+
+#else
+#define IL_DBG(level, fmt, args...)
+static inline void il_print_hex_dump(struct il_priv *il, int level,
+ const void *p, u32 len)
+{}
+#endif /* CONFIG_IWLEGACY_DEBUG */
+
+#ifdef CONFIG_IWLEGACY_DEBUGFS
+int il_dbgfs_register(struct il_priv *il, const char *name);
+void il_dbgfs_unregister(struct il_priv *il);
+#else
+static inline int
+il_dbgfs_register(struct il_priv *il, const char *name)
+{
+ return 0;
+}
+static inline void il_dbgfs_unregister(struct il_priv *il)
+{
+}
+#endif /* CONFIG_IWLEGACY_DEBUGFS */
+
+/*
+ * To use the debug system:
+ *
+ * If you are defining a new debug classification, simply add it to the #define
+ * list here in the form of
+ *
+ * #define IL_DL_xxxx VALUE
+ *
+ * where xxxx should be the name of the classification (for example, WEP).
+ *
+ * You then need to either add a IL_xxxx_DEBUG() macro definition for your
+ * classification, or use IL_DBG(IL_DL_xxxx, ...) whenever you want
+ * to send output to that classification.
+ *
+ * The active debug levels can be accessed via files
+ *
+ * /sys/module/iwl4965/parameters/debug
+ * /sys/module/iwl3945/parameters/debug
+ * /sys/class/net/wlan0/device/debug_level
+ *
+ * when CONFIG_IWLEGACY_DEBUG=y.
+ */
+
+/* 0x0000000F - 0x00000001 */
+#define IL_DL_INFO (1 << 0)
+#define IL_DL_MAC80211 (1 << 1)
+#define IL_DL_HCMD (1 << 2)
+#define IL_DL_STATE (1 << 3)
+/* 0x000000F0 - 0x00000010 */
+#define IL_DL_MACDUMP (1 << 4)
+#define IL_DL_HCMD_DUMP (1 << 5)
+#define IL_DL_EEPROM (1 << 6)
+#define IL_DL_RADIO (1 << 7)
+/* 0x00000F00 - 0x00000100 */
+#define IL_DL_POWER (1 << 8)
+#define IL_DL_TEMP (1 << 9)
+#define IL_DL_NOTIF (1 << 10)
+#define IL_DL_SCAN (1 << 11)
+/* 0x0000F000 - 0x00001000 */
+#define IL_DL_ASSOC (1 << 12)
+#define IL_DL_DROP (1 << 13)
+#define IL_DL_TXPOWER (1 << 14)
+#define IL_DL_AP (1 << 15)
+/* 0x000F0000 - 0x00010000 */
+#define IL_DL_FW (1 << 16)
+#define IL_DL_RF_KILL (1 << 17)
+#define IL_DL_FW_ERRORS (1 << 18)
+#define IL_DL_LED (1 << 19)
+/* 0x00F00000 - 0x00100000 */
+#define IL_DL_RATE (1 << 20)
+#define IL_DL_CALIB (1 << 21)
+#define IL_DL_WEP (1 << 22)
+#define IL_DL_TX (1 << 23)
+/* 0x0F000000 - 0x01000000 */
+#define IL_DL_RX (1 << 24)
+#define IL_DL_ISR (1 << 25)
+#define IL_DL_HT (1 << 26)
+/* 0xF0000000 - 0x10000000 */
+#define IL_DL_11H (1 << 28)
+#define IL_DL_STATS (1 << 29)
+#define IL_DL_TX_REPLY (1 << 30)
+#define IL_DL_QOS (1 << 31)
+
+#define D_INFO(f, a...) IL_DBG(IL_DL_INFO, f, ## a)
+#define D_MAC80211(f, a...) IL_DBG(IL_DL_MAC80211, f, ## a)
+#define D_MACDUMP(f, a...) IL_DBG(IL_DL_MACDUMP, f, ## a)
+#define D_TEMP(f, a...) IL_DBG(IL_DL_TEMP, f, ## a)
+#define D_SCAN(f, a...) IL_DBG(IL_DL_SCAN, f, ## a)
+#define D_RX(f, a...) IL_DBG(IL_DL_RX, f, ## a)
+#define D_TX(f, a...) IL_DBG(IL_DL_TX, f, ## a)
+#define D_ISR(f, a...) IL_DBG(IL_DL_ISR, f, ## a)
+#define D_LED(f, a...) IL_DBG(IL_DL_LED, f, ## a)
+#define D_WEP(f, a...) IL_DBG(IL_DL_WEP, f, ## a)
+#define D_HC(f, a...) IL_DBG(IL_DL_HCMD, f, ## a)
+#define D_HC_DUMP(f, a...) IL_DBG(IL_DL_HCMD_DUMP, f, ## a)
+#define D_EEPROM(f, a...) IL_DBG(IL_DL_EEPROM, f, ## a)
+#define D_CALIB(f, a...) IL_DBG(IL_DL_CALIB, f, ## a)
+#define D_FW(f, a...) IL_DBG(IL_DL_FW, f, ## a)
+#define D_RF_KILL(f, a...) IL_DBG(IL_DL_RF_KILL, f, ## a)
+#define D_DROP(f, a...) IL_DBG(IL_DL_DROP, f, ## a)
+#define D_AP(f, a...) IL_DBG(IL_DL_AP, f, ## a)
+#define D_TXPOWER(f, a...) IL_DBG(IL_DL_TXPOWER, f, ## a)
+#define D_RATE(f, a...) IL_DBG(IL_DL_RATE, f, ## a)
+#define D_NOTIF(f, a...) IL_DBG(IL_DL_NOTIF, f, ## a)
+#define D_ASSOC(f, a...) IL_DBG(IL_DL_ASSOC, f, ## a)
+#define D_HT(f, a...) IL_DBG(IL_DL_HT, f, ## a)
+#define D_STATS(f, a...) IL_DBG(IL_DL_STATS, f, ## a)
+#define D_TX_REPLY(f, a...) IL_DBG(IL_DL_TX_REPLY, f, ## a)
+#define D_QOS(f, a...) IL_DBG(IL_DL_QOS, f, ## a)
+#define D_RADIO(f, a...) IL_DBG(IL_DL_RADIO, f, ## a)
+#define D_POWER(f, a...) IL_DBG(IL_DL_POWER, f, ## a)
+#define D_11H(f, a...) IL_DBG(IL_DL_11H, f, ## a)
+
#endif /* __il_core_h__ */
diff --git a/drivers/net/wireless/iwlegacy/debug.c b/drivers/net/wireless/iwlegacy/debug.c
index 62292a6..4e2b6c8 100644
--- a/drivers/net/wireless/iwlegacy/debug.c
+++ b/drivers/net/wireless/iwlegacy/debug.c
@@ -28,8 +28,6 @@
#include <linux/ieee80211.h>
#include <net/mac80211.h>

-
-#include "iwl-debug.h"
#include "common.h"

/* create and remove of files */
diff --git a/drivers/net/wireless/iwlegacy/iwl-debug.h b/drivers/net/wireless/iwlegacy/iwl-debug.h
deleted file mode 100644
index c58003a..0000000
--- a/drivers/net/wireless/iwlegacy/iwl-debug.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved.
- *
- * Portions of this file are derived from the ipw3945 project.
- *
- * 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 __il_debug_h__
-#define __il_debug_h__
-
-struct il_priv;
-extern u32 il_debug_level;
-
-#define IL_ERR(f, a...) dev_err(&il->pci_dev->dev, f, ## a)
-#define IL_WARN(f, a...) dev_warn(&il->pci_dev->dev, f, ## a)
-#define IL_INFO(f, a...) dev_info(&il->pci_dev->dev, f, ## a)
-
-#define il_print_hex_error(il, p, len) \
-do { \
- print_hex_dump(KERN_ERR, "iwl data: ", \
- DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
-} while (0)
-
-#ifdef CONFIG_IWLEGACY_DEBUG
-#define IL_DBG(level, fmt, args...) \
-do { \
- if (il_get_debug_level(il) & level) \
- dev_printk(KERN_ERR, &il->hw->wiphy->dev, \
- "%c %s " fmt, in_interrupt() ? 'I' : 'U', \
- __func__ , ## args); \
-} while (0)
-
-#define il_print_hex_dump(il, level, p, len) \
-do { \
- if (il_get_debug_level(il) & level) \
- print_hex_dump(KERN_DEBUG, "iwl data: ", \
- DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
-} while (0)
-
-#else
-#define IL_DBG(level, fmt, args...)
-static inline void il_print_hex_dump(struct il_priv *il, int level,
- const void *p, u32 len)
-{}
-#endif /* CONFIG_IWLEGACY_DEBUG */
-
-#ifdef CONFIG_IWLEGACY_DEBUGFS
-int il_dbgfs_register(struct il_priv *il, const char *name);
-void il_dbgfs_unregister(struct il_priv *il);
-#else
-static inline int
-il_dbgfs_register(struct il_priv *il, const char *name)
-{
- return 0;
-}
-static inline void il_dbgfs_unregister(struct il_priv *il)
-{
-}
-#endif /* CONFIG_IWLEGACY_DEBUGFS */
-
-/*
- * To use the debug system:
- *
- * If you are defining a new debug classification, simply add it to the #define
- * list here in the form of
- *
- * #define IL_DL_xxxx VALUE
- *
- * where xxxx should be the name of the classification (for example, WEP).
- *
- * You then need to either add a IL_xxxx_DEBUG() macro definition for your
- * classification, or use IL_DBG(IL_DL_xxxx, ...) whenever you want
- * to send output to that classification.
- *
- * The active debug levels can be accessed via files
- *
- * /sys/module/iwl4965/parameters/debug
- * /sys/module/iwl3945/parameters/debug
- * /sys/class/net/wlan0/device/debug_level
- *
- * when CONFIG_IWLEGACY_DEBUG=y.
- */
-
-/* 0x0000000F - 0x00000001 */
-#define IL_DL_INFO (1 << 0)
-#define IL_DL_MAC80211 (1 << 1)
-#define IL_DL_HCMD (1 << 2)
-#define IL_DL_STATE (1 << 3)
-/* 0x000000F0 - 0x00000010 */
-#define IL_DL_MACDUMP (1 << 4)
-#define IL_DL_HCMD_DUMP (1 << 5)
-#define IL_DL_EEPROM (1 << 6)
-#define IL_DL_RADIO (1 << 7)
-/* 0x00000F00 - 0x00000100 */
-#define IL_DL_POWER (1 << 8)
-#define IL_DL_TEMP (1 << 9)
-#define IL_DL_NOTIF (1 << 10)
-#define IL_DL_SCAN (1 << 11)
-/* 0x0000F000 - 0x00001000 */
-#define IL_DL_ASSOC (1 << 12)
-#define IL_DL_DROP (1 << 13)
-#define IL_DL_TXPOWER (1 << 14)
-#define IL_DL_AP (1 << 15)
-/* 0x000F0000 - 0x00010000 */
-#define IL_DL_FW (1 << 16)
-#define IL_DL_RF_KILL (1 << 17)
-#define IL_DL_FW_ERRORS (1 << 18)
-#define IL_DL_LED (1 << 19)
-/* 0x00F00000 - 0x00100000 */
-#define IL_DL_RATE (1 << 20)
-#define IL_DL_CALIB (1 << 21)
-#define IL_DL_WEP (1 << 22)
-#define IL_DL_TX (1 << 23)
-/* 0x0F000000 - 0x01000000 */
-#define IL_DL_RX (1 << 24)
-#define IL_DL_ISR (1 << 25)
-#define IL_DL_HT (1 << 26)
-/* 0xF0000000 - 0x10000000 */
-#define IL_DL_11H (1 << 28)
-#define IL_DL_STATS (1 << 29)
-#define IL_DL_TX_REPLY (1 << 30)
-#define IL_DL_QOS (1 << 31)
-
-#define D_INFO(f, a...) IL_DBG(IL_DL_INFO, f, ## a)
-#define D_MAC80211(f, a...) IL_DBG(IL_DL_MAC80211, f, ## a)
-#define D_MACDUMP(f, a...) IL_DBG(IL_DL_MACDUMP, f, ## a)
-#define D_TEMP(f, a...) IL_DBG(IL_DL_TEMP, f, ## a)
-#define D_SCAN(f, a...) IL_DBG(IL_DL_SCAN, f, ## a)
-#define D_RX(f, a...) IL_DBG(IL_DL_RX, f, ## a)
-#define D_TX(f, a...) IL_DBG(IL_DL_TX, f, ## a)
-#define D_ISR(f, a...) IL_DBG(IL_DL_ISR, f, ## a)
-#define D_LED(f, a...) IL_DBG(IL_DL_LED, f, ## a)
-#define D_WEP(f, a...) IL_DBG(IL_DL_WEP, f, ## a)
-#define D_HC(f, a...) IL_DBG(IL_DL_HCMD, f, ## a)
-#define D_HC_DUMP(f, a...) IL_DBG(IL_DL_HCMD_DUMP, f, ## a)
-#define D_EEPROM(f, a...) IL_DBG(IL_DL_EEPROM, f, ## a)
-#define D_CALIB(f, a...) IL_DBG(IL_DL_CALIB, f, ## a)
-#define D_FW(f, a...) IL_DBG(IL_DL_FW, f, ## a)
-#define D_RF_KILL(f, a...) IL_DBG(IL_DL_RF_KILL, f, ## a)
-#define D_DROP(f, a...) IL_DBG(IL_DL_DROP, f, ## a)
-#define D_AP(f, a...) IL_DBG(IL_DL_AP, f, ## a)
-#define D_TXPOWER(f, a...) IL_DBG(IL_DL_TXPOWER, f, ## a)
-#define D_RATE(f, a...) IL_DBG(IL_DL_RATE, f, ## a)
-#define D_NOTIF(f, a...) IL_DBG(IL_DL_NOTIF, f, ## a)
-#define D_ASSOC(f, a...) IL_DBG(IL_DL_ASSOC, f, ## a)
-#define D_HT(f, a...) IL_DBG(IL_DL_HT, f, ## a)
-#define D_STATS(f, a...) IL_DBG(IL_DL_STATS, f, ## a)
-#define D_TX_REPLY(f, a...) IL_DBG(IL_DL_TX_REPLY, f, ## a)
-#define D_QOS(f, a...) IL_DBG(IL_DL_QOS, f, ## a)
-#define D_RADIO(f, a...) IL_DBG(IL_DL_RADIO, f, ## a)
-#define D_POWER(f, a...) IL_DBG(IL_DL_POWER, f, ## a)
-#define D_11H(f, a...) IL_DBG(IL_DL_11H, f, ## a)
-
-#endif
--
1.7.1


2011-11-18 08:21:48

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 28/77] iwlegacy: rename base 4965 and 3945 file names

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/3945-mac.c | 4007 ++++++++++++++++++++++++++
drivers/net/wireless/iwlegacy/3945.c | 2740 ++++++++++++++++++
drivers/net/wireless/iwlegacy/4965-mac.c | 3245 +++++++++++++++++++++
drivers/net/wireless/iwlegacy/4965.c | 2183 ++++++++++++++
drivers/net/wireless/iwlegacy/Makefile | 4 +-
drivers/net/wireless/iwlegacy/iwl-3945.c | 2740 ------------------
drivers/net/wireless/iwlegacy/iwl-4965.c | 2183 --------------
drivers/net/wireless/iwlegacy/iwl3945-base.c | 4007 --------------------------
drivers/net/wireless/iwlegacy/iwl4965-base.c | 3245 ---------------------
9 files changed, 12177 insertions(+), 12177 deletions(-)
create mode 100644 drivers/net/wireless/iwlegacy/3945-mac.c
create mode 100644 drivers/net/wireless/iwlegacy/3945.c
create mode 100644 drivers/net/wireless/iwlegacy/4965-mac.c
create mode 100644 drivers/net/wireless/iwlegacy/4965.c
delete mode 100644 drivers/net/wireless/iwlegacy/iwl-3945.c
delete mode 100644 drivers/net/wireless/iwlegacy/iwl-4965.c
delete mode 100644 drivers/net/wireless/iwlegacy/iwl3945-base.c
delete mode 100644 drivers/net/wireless/iwlegacy/iwl4965-base.c

683K patch can be downloaded from:
http://people.redhat.com/sgruszka/iwlegacy-2011-11-16/0028-iwlegacy-rename-base-4965-and-3945-file-names.patch

2011-11-18 08:22:42

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 52/77] iwlegacy: move IL_MASK

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/4965-mac.c | 2 ++
drivers/net/wireless/iwlegacy/iwl-helpers.h | 3 ---
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index 2bab0fc..dbe5bf2 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -4944,6 +4944,8 @@ static const s8 default_queue_to_tx_fifo[] = {
IL_TX_FIFO_UNUSED,
};

+#define IL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo))))
+
static int il4965_alive_notify(struct il_priv *il)
{
u32 a;
diff --git a/drivers/net/wireless/iwlegacy/iwl-helpers.h b/drivers/net/wireless/iwlegacy/iwl-helpers.h
index eb5a287..2db83fc 100644
--- a/drivers/net/wireless/iwlegacy/iwl-helpers.h
+++ b/drivers/net/wireless/iwlegacy/iwl-helpers.h
@@ -35,9 +35,6 @@

#include "iwl-io.h"

-#define IL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo))))
-
-
/**
* il_queue_inc_wrap - increment queue idx, wrap back to beginning
* @idx -- current idx
--
1.7.1


2011-11-18 08:22:39

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 50/77] iwlegacy: rename iwl-commands.h to commands.h

On the way remove also not needed iwl-fh.h include.

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/3945-mac.c | 3 +-
drivers/net/wireless/iwlegacy/3945-rs.c | 2 +-
drivers/net/wireless/iwlegacy/3945.c | 3 +-
drivers/net/wireless/iwlegacy/3945.h | 1 -
drivers/net/wireless/iwlegacy/commands.h | 3393 +++++++++++++++++++++++++
drivers/net/wireless/iwlegacy/iwl-commands.h | 3398 --------------------------
drivers/net/wireless/iwlegacy/iwl-dev.h | 3 +-
drivers/net/wireless/iwlegacy/iwl-power.h | 2 +-
8 files changed, 3398 insertions(+), 3407 deletions(-)
create mode 100644 drivers/net/wireless/iwlegacy/commands.h
delete mode 100644 drivers/net/wireless/iwlegacy/iwl-commands.h

diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
index e33ebca..ae60410 100644
--- a/drivers/net/wireless/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
@@ -51,8 +51,7 @@

#define DRV_NAME "iwl3945"

-#include "iwl-fh.h"
-#include "iwl-commands.h"
+#include "commands.h"
#include "iwl-sta.h"
#include "3945.h"
#include "iwl-core.h"
diff --git a/drivers/net/wireless/iwlegacy/3945-rs.c b/drivers/net/wireless/iwlegacy/3945-rs.c
index 0d2beba..4aa0432 100644
--- a/drivers/net/wireless/iwlegacy/3945-rs.c
+++ b/drivers/net/wireless/iwlegacy/3945-rs.c
@@ -36,7 +36,7 @@

#include <linux/workqueue.h>

-#include "iwl-commands.h"
+#include "commands.h"
#include "3945.h"
#include "iwl-sta.h"

diff --git a/drivers/net/wireless/iwlegacy/3945.c b/drivers/net/wireless/iwlegacy/3945.c
index 83fe531..ff8818b 100644
--- a/drivers/net/wireless/iwlegacy/3945.c
+++ b/drivers/net/wireless/iwlegacy/3945.c
@@ -39,8 +39,7 @@
#include <asm/unaligned.h>
#include <net/mac80211.h>

-#include "iwl-fh.h"
-#include "iwl-commands.h"
+#include "commands.h"
#include "iwl-sta.h"
#include "iwl-eeprom.h"
#include "iwl-core.h"
diff --git a/drivers/net/wireless/iwlegacy/3945.h b/drivers/net/wireless/iwlegacy/3945.h
index 9854cf1..7559a5e 100644
--- a/drivers/net/wireless/iwlegacy/3945.h
+++ b/drivers/net/wireless/iwlegacy/3945.h
@@ -36,7 +36,6 @@ extern const struct pci_device_id il3945_hw_card_ids[];

#include "iwl-csr.h"
#include "iwl-prph.h"
-#include "iwl-fh.h"
#include "iwl-debug.h"
#include "iwl-power.h"
#include "iwl-dev.h"
diff --git a/drivers/net/wireless/iwlegacy/commands.h b/drivers/net/wireless/iwlegacy/commands.h
new file mode 100644
index 0000000..82cf472
--- /dev/null
+++ b/drivers/net/wireless/iwlegacy/commands.h
@@ -0,0 +1,3393 @@
+/******************************************************************************
+ *
+ * This file is provided under a dual BSD/GPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
+ * USA
+ *
+ * The full GNU General Public License is included in this distribution
+ * in the file called LICENSE.GPL.
+ *
+ * Contact Information:
+ * Intel Linux Wireless <[email protected]>
+ * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *****************************************************************************/
+
+#ifndef __il_commands_h__
+#define __il_commands_h__
+
+struct il_priv;
+
+/* uCode version contains 4 values: Major/Minor/API/Serial */
+#define IL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24)
+#define IL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16)
+#define IL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8)
+#define IL_UCODE_SERIAL(ver) ((ver) & 0x000000FF)
+
+
+/* Tx rates */
+#define IL_CCK_RATES 4
+#define IL_OFDM_RATES 8
+#define IL_MAX_RATES (IL_CCK_RATES + IL_OFDM_RATES)
+
+enum {
+ N_ALIVE = 0x1,
+ N_ERROR = 0x2,
+
+ /* RXON and QOS commands */
+ C_RXON = 0x10,
+ C_RXON_ASSOC = 0x11,
+ C_QOS_PARAM = 0x13,
+ C_RXON_TIMING = 0x14,
+
+ /* Multi-Station support */
+ C_ADD_STA = 0x18,
+ C_REM_STA = 0x19,
+
+ /* Security */
+ C_WEPKEY = 0x20,
+
+ /* RX, TX, LEDs */
+ N_3945_RX = 0x1b, /* 3945 only */
+ C_TX = 0x1c,
+ C_RATE_SCALE = 0x47, /* 3945 only */
+ C_LEDS = 0x48,
+ C_TX_LINK_QUALITY_CMD = 0x4e, /* for 4965 */
+
+ /* 802.11h related */
+ C_CHANNEL_SWITCH = 0x72,
+ N_CHANNEL_SWITCH = 0x73,
+ C_SPECTRUM_MEASUREMENT = 0x74,
+ N_SPECTRUM_MEASUREMENT = 0x75,
+
+ /* Power Management */
+ C_POWER_TBL = 0x77,
+ N_PM_SLEEP = 0x7A,
+ N_PM_DEBUG_STATS = 0x7B,
+
+ /* Scan commands and notifications */
+ C_SCAN = 0x80,
+ C_SCAN_ABORT = 0x81,
+ N_SCAN_START = 0x82,
+ N_SCAN_RESULTS = 0x83,
+ N_SCAN_COMPLETE = 0x84,
+
+ /* IBSS/AP commands */
+ N_BEACON = 0x90,
+ C_TX_BEACON= 0x91,
+
+ /* Miscellaneous commands */
+ C_TX_PWR_TBL = 0x97,
+
+ /* Bluetooth device coexistence config command */
+ C_BT_CONFIG = 0x9b,
+
+ /* Statistics */
+ C_STATS = 0x9c,
+ N_STATS = 0x9d,
+
+ /* RF-KILL commands and notifications */
+ N_CARD_STATE = 0xa1,
+
+ /* Missed beacons notification */
+ N_MISSED_BEACONS = 0xa2,
+
+ C_CT_KILL_CONFIG = 0xa4,
+ C_SENSITIVITY = 0xa8,
+ C_PHY_CALIBRATION = 0xb0,
+ N_RX_PHY = 0xc0,
+ N_RX_MPDU = 0xc1,
+ N_RX = 0xc3,
+ N_COMPRESSED_BA = 0xc5,
+
+ IL_CN_MAX = 0xff
+};
+
+/******************************************************************************
+ * (0)
+ * Commonly used structures and definitions:
+ * Command header, rate_n_flags, txpower
+ *
+ *****************************************************************************/
+
+/* il_cmd_header flags value */
+#define IL_CMD_FAILED_MSK 0x40
+
+#define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f)
+#define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8)
+#define SEQ_TO_IDX(s) ((s) & 0xff)
+#define IDX_TO_SEQ(i) ((i) & 0xff)
+#define SEQ_HUGE_FRAME cpu_to_le16(0x4000)
+#define SEQ_RX_FRAME cpu_to_le16(0x8000)
+
+/**
+ * struct il_cmd_header
+ *
+ * This header format appears in the beginning of each command sent from the
+ * driver, and each response/notification received from uCode.
+ */
+struct il_cmd_header {
+ u8 cmd; /* Command ID: C_RXON, etc. */
+ u8 flags; /* 0:5 reserved, 6 abort, 7 internal */
+ /*
+ * The driver sets up the sequence number to values of its choosing.
+ * uCode does not use this value, but passes it back to the driver
+ * when sending the response to each driver-originated command, so
+ * the driver can match the response to the command. Since the values
+ * don't get used by uCode, the driver may set up an arbitrary format.
+ *
+ * There is one exception: uCode sets bit 15 when it originates
+ * the response/notification, i.e. when the response/notification
+ * is not a direct response to a command sent by the driver. For
+ * example, uCode issues N_3945_RX when it sends a received frame
+ * to the driver; it is not a direct response to any driver command.
+ *
+ * The Linux driver uses the following format:
+ *
+ * 0:7 tfd idx - position within TX queue
+ * 8:12 TX queue id
+ * 13 reserved
+ * 14 huge - driver sets this to indicate command is in the
+ * 'huge' storage at the end of the command buffers
+ * 15 unsolicited RX or uCode-originated notification
+ */
+ __le16 sequence;
+
+ /* command or response/notification data follows immediately */
+ u8 data[0];
+} __packed;
+
+
+/**
+ * struct il3945_tx_power
+ *
+ * Used in C_TX_PWR_TBL, C_SCAN, C_CHANNEL_SWITCH
+ *
+ * Each entry contains two values:
+ * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained
+ * linear value that multiplies the output of the digital signal processor,
+ * before being sent to the analog radio.
+ * 2) Radio gain. This sets the analog gain of the radio Tx path.
+ * It is a coarser setting, and behaves in a logarithmic (dB) fashion.
+ *
+ * Driver obtains values from struct il3945_tx_power power_gain_table[][].
+ */
+struct il3945_tx_power {
+ u8 tx_gain; /* gain for analog radio */
+ u8 dsp_atten; /* gain for DSP */
+} __packed;
+
+/**
+ * struct il3945_power_per_rate
+ *
+ * Used in C_TX_PWR_TBL, C_CHANNEL_SWITCH
+ */
+struct il3945_power_per_rate {
+ u8 rate; /* plcp */
+ struct il3945_tx_power tpc;
+ u8 reserved;
+} __packed;
+
+/**
+ * iwl4965 rate_n_flags bit fields
+ *
+ * rate_n_flags format is used in following iwl4965 commands:
+ * N_RX (response only)
+ * N_RX_MPDU (response only)
+ * C_TX (both command and response)
+ * C_TX_LINK_QUALITY_CMD
+ *
+ * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"):
+ * 2-0: 0) 6 Mbps
+ * 1) 12 Mbps
+ * 2) 18 Mbps
+ * 3) 24 Mbps
+ * 4) 36 Mbps
+ * 5) 48 Mbps
+ * 6) 54 Mbps
+ * 7) 60 Mbps
+ *
+ * 4-3: 0) Single stream (SISO)
+ * 1) Dual stream (MIMO)
+ * 2) Triple stream (MIMO)
+ *
+ * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data
+ *
+ * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"):
+ * 3-0: 0xD) 6 Mbps
+ * 0xF) 9 Mbps
+ * 0x5) 12 Mbps
+ * 0x7) 18 Mbps
+ * 0x9) 24 Mbps
+ * 0xB) 36 Mbps
+ * 0x1) 48 Mbps
+ * 0x3) 54 Mbps
+ *
+ * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"):
+ * 6-0: 10) 1 Mbps
+ * 20) 2 Mbps
+ * 55) 5.5 Mbps
+ * 110) 11 Mbps
+ */
+#define RATE_MCS_CODE_MSK 0x7
+#define RATE_MCS_SPATIAL_POS 3
+#define RATE_MCS_SPATIAL_MSK 0x18
+#define RATE_MCS_HT_DUP_POS 5
+#define RATE_MCS_HT_DUP_MSK 0x20
+
+/* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */
+#define RATE_MCS_FLAGS_POS 8
+#define RATE_MCS_HT_POS 8
+#define RATE_MCS_HT_MSK 0x100
+
+/* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */
+#define RATE_MCS_CCK_POS 9
+#define RATE_MCS_CCK_MSK 0x200
+
+/* Bit 10: (1) Use Green Field preamble */
+#define RATE_MCS_GF_POS 10
+#define RATE_MCS_GF_MSK 0x400
+
+/* Bit 11: (1) Use 40Mhz HT40 chnl width, (0) use 20 MHz legacy chnl width */
+#define RATE_MCS_HT40_POS 11
+#define RATE_MCS_HT40_MSK 0x800
+
+/* Bit 12: (1) Duplicate data on both 20MHz chnls. HT40 (bit 11) must be set. */
+#define RATE_MCS_DUP_POS 12
+#define RATE_MCS_DUP_MSK 0x1000
+
+/* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */
+#define RATE_MCS_SGI_POS 13
+#define RATE_MCS_SGI_MSK 0x2000
+
+/**
+ * rate_n_flags Tx antenna masks
+ * 4965 has 2 transmitters
+ * bit14:16
+ */
+#define RATE_MCS_ANT_POS 14
+#define RATE_MCS_ANT_A_MSK 0x04000
+#define RATE_MCS_ANT_B_MSK 0x08000
+#define RATE_MCS_ANT_C_MSK 0x10000
+#define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK)
+#define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK)
+#define RATE_ANT_NUM 3
+
+#define POWER_TBL_NUM_ENTRIES 33
+#define POWER_TBL_NUM_HT_OFDM_ENTRIES 32
+#define POWER_TBL_CCK_ENTRY 32
+
+#define IL_PWR_NUM_HT_OFDM_ENTRIES 24
+#define IL_PWR_CCK_ENTRIES 2
+
+/**
+ * union il4965_tx_power_dual_stream
+ *
+ * Host format used for C_TX_PWR_TBL, C_CHANNEL_SWITCH
+ * Use __le32 version (struct tx_power_dual_stream) when building command.
+ *
+ * Driver provides radio gain and DSP attenuation settings to device in pairs,
+ * one value for each transmitter chain. The first value is for transmitter A,
+ * second for transmitter B.
+ *
+ * For SISO bit rates, both values in a pair should be identical.
+ * For MIMO rates, one value may be different from the other,
+ * in order to balance the Tx output between the two transmitters.
+ *
+ * See more details in doc for TXPOWER in 4965.h.
+ */
+union il4965_tx_power_dual_stream {
+ struct {
+ u8 radio_tx_gain[2];
+ u8 dsp_predis_atten[2];
+ } s;
+ u32 dw;
+};
+
+/**
+ * struct tx_power_dual_stream
+ *
+ * Table entries in C_TX_PWR_TBL, C_CHANNEL_SWITCH
+ *
+ * Same format as il_tx_power_dual_stream, but __le32
+ */
+struct tx_power_dual_stream {
+ __le32 dw;
+} __packed;
+
+/**
+ * struct il4965_tx_power_db
+ *
+ * Entire table within C_TX_PWR_TBL, C_CHANNEL_SWITCH
+ */
+struct il4965_tx_power_db {
+ struct tx_power_dual_stream power_tbl[POWER_TBL_NUM_ENTRIES];
+} __packed;
+
+/******************************************************************************
+ * (0a)
+ * Alive and Error Commands & Responses:
+ *
+ *****************************************************************************/
+
+#define UCODE_VALID_OK cpu_to_le32(0x1)
+#define INITIALIZE_SUBTYPE (9)
+
+/*
+ * ("Initialize") N_ALIVE = 0x1 (response only, not a command)
+ *
+ * uCode issues this "initialize alive" notification once the initialization
+ * uCode image has completed its work, and is ready to load the runtime image.
+ * This is the *first* "alive" notification that the driver will receive after
+ * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
+ *
+ * See comments documenting "BSM" (bootstrap state machine).
+ *
+ * For 4965, this notification contains important calibration data for
+ * calculating txpower settings:
+ *
+ * 1) Power supply voltage indication. The voltage sensor outputs higher
+ * values for lower voltage, and vice verse.
+ *
+ * 2) Temperature measurement parameters, for each of two channel widths
+ * (20 MHz and 40 MHz) supported by the radios. Temperature sensing
+ * is done via one of the receiver chains, and channel width influences
+ * the results.
+ *
+ * 3) Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation,
+ * for each of 5 frequency ranges.
+ */
+struct il_init_alive_resp {
+ u8 ucode_minor;
+ u8 ucode_major;
+ __le16 reserved1;
+ u8 sw_rev[8];
+ u8 ver_type;
+ u8 ver_subtype; /* "9" for initialize alive */
+ __le16 reserved2;
+ __le32 log_event_table_ptr;
+ __le32 error_event_table_ptr;
+ __le32 timestamp;
+ __le32 is_valid;
+
+ /* calibration values from "initialize" uCode */
+ __le32 voltage; /* signed, higher value is lower voltage */
+ __le32 therm_r1[2]; /* signed, 1st for normal, 2nd for HT40 */
+ __le32 therm_r2[2]; /* signed */
+ __le32 therm_r3[2]; /* signed */
+ __le32 therm_r4[2]; /* signed */
+ __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups,
+ * 2 Tx chains */
+} __packed;
+
+
+/**
+ * N_ALIVE = 0x1 (response only, not a command)
+ *
+ * uCode issues this "alive" notification once the runtime image is ready
+ * to receive commands from the driver. This is the *second* "alive"
+ * notification that the driver will receive after rebooting uCode;
+ * this "alive" is indicated by subtype field != 9.
+ *
+ * See comments documenting "BSM" (bootstrap state machine).
+ *
+ * This response includes two pointers to structures within the device's
+ * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
+ *
+ * 1) log_event_table_ptr indicates base of the event log. This traces
+ * a 256-entry history of uCode execution within a circular buffer.
+ * Its header format is:
+ *
+ * __le32 log_size; log capacity (in number of entries)
+ * __le32 type; (1) timestamp with each entry, (0) no timestamp
+ * __le32 wraps; # times uCode has wrapped to top of circular buffer
+ * __le32 write_idx; next circular buffer entry that uCode would fill
+ *
+ * The header is followed by the circular buffer of log entries. Entries
+ * with timestamps have the following format:
+ *
+ * __le32 event_id; range 0 - 1500
+ * __le32 timestamp; low 32 bits of TSF (of network, if associated)
+ * __le32 data; event_id-specific data value
+ *
+ * Entries without timestamps contain only event_id and data.
+ *
+ *
+ * 2) error_event_table_ptr indicates base of the error log. This contains
+ * information about any uCode error that occurs. For 4965, the format
+ * of the error log is:
+ *
+ * __le32 valid; (nonzero) valid, (0) log is empty
+ * __le32 error_id; type of error
+ * __le32 pc; program counter
+ * __le32 blink1; branch link
+ * __le32 blink2; branch link
+ * __le32 ilink1; interrupt link
+ * __le32 ilink2; interrupt link
+ * __le32 data1; error-specific data
+ * __le32 data2; error-specific data
+ * __le32 line; source code line of error
+ * __le32 bcon_time; beacon timer
+ * __le32 tsf_low; network timestamp function timer
+ * __le32 tsf_hi; network timestamp function timer
+ * __le32 gp1; GP1 timer register
+ * __le32 gp2; GP2 timer register
+ * __le32 gp3; GP3 timer register
+ * __le32 ucode_ver; uCode version
+ * __le32 hw_ver; HW Silicon version
+ * __le32 brd_ver; HW board version
+ * __le32 log_pc; log program counter
+ * __le32 frame_ptr; frame pointer
+ * __le32 stack_ptr; stack pointer
+ * __le32 hcmd; last host command
+ * __le32 isr0; isr status register LMPM_NIC_ISR0: rxtx_flag
+ * __le32 isr1; isr status register LMPM_NIC_ISR1: host_flag
+ * __le32 isr2; isr status register LMPM_NIC_ISR2: enc_flag
+ * __le32 isr3; isr status register LMPM_NIC_ISR3: time_flag
+ * __le32 isr4; isr status register LMPM_NIC_ISR4: wico interrupt
+ * __le32 isr_pref; isr status register LMPM_NIC_PREF_STAT
+ * __le32 wait_event; wait event() caller address
+ * __le32 l2p_control; L2pControlField
+ * __le32 l2p_duration; L2pDurationField
+ * __le32 l2p_mhvalid; L2pMhValidBits
+ * __le32 l2p_addr_match; L2pAddrMatchStat
+ * __le32 lmpm_pmg_sel; indicate which clocks are turned on (LMPM_PMG_SEL)
+ * __le32 u_timestamp; indicate when the date and time of the compilation
+ * __le32 reserved;
+ *
+ * The Linux driver can print both logs to the system log when a uCode error
+ * occurs.
+ */
+struct il_alive_resp {
+ u8 ucode_minor;
+ u8 ucode_major;
+ __le16 reserved1;
+ u8 sw_rev[8];
+ u8 ver_type;
+ u8 ver_subtype; /* not "9" for runtime alive */
+ __le16 reserved2;
+ __le32 log_event_table_ptr; /* SRAM address for event log */
+ __le32 error_event_table_ptr; /* SRAM address for error log */
+ __le32 timestamp;
+ __le32 is_valid;
+} __packed;
+
+/*
+ * N_ERROR = 0x2 (response only, not a command)
+ */
+struct il_error_resp {
+ __le32 error_type;
+ u8 cmd_id;
+ u8 reserved1;
+ __le16 bad_cmd_seq_num;
+ __le32 error_info;
+ __le64 timestamp;
+} __packed;
+
+/******************************************************************************
+ * (1)
+ * RXON Commands & Responses:
+ *
+ *****************************************************************************/
+
+/*
+ * Rx config defines & structure
+ */
+/* rx_config device types */
+enum {
+ RXON_DEV_TYPE_AP = 1,
+ RXON_DEV_TYPE_ESS = 3,
+ RXON_DEV_TYPE_IBSS = 4,
+ RXON_DEV_TYPE_SNIFFER = 6,
+};
+
+
+#define RXON_RX_CHAIN_DRIVER_FORCE_MSK cpu_to_le16(0x1 << 0)
+#define RXON_RX_CHAIN_DRIVER_FORCE_POS (0)
+#define RXON_RX_CHAIN_VALID_MSK cpu_to_le16(0x7 << 1)
+#define RXON_RX_CHAIN_VALID_POS (1)
+#define RXON_RX_CHAIN_FORCE_SEL_MSK cpu_to_le16(0x7 << 4)
+#define RXON_RX_CHAIN_FORCE_SEL_POS (4)
+#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK cpu_to_le16(0x7 << 7)
+#define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
+#define RXON_RX_CHAIN_CNT_MSK cpu_to_le16(0x3 << 10)
+#define RXON_RX_CHAIN_CNT_POS (10)
+#define RXON_RX_CHAIN_MIMO_CNT_MSK cpu_to_le16(0x3 << 12)
+#define RXON_RX_CHAIN_MIMO_CNT_POS (12)
+#define RXON_RX_CHAIN_MIMO_FORCE_MSK cpu_to_le16(0x1 << 14)
+#define RXON_RX_CHAIN_MIMO_FORCE_POS (14)
+
+/* rx_config flags */
+/* band & modulation selection */
+#define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0)
+#define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1)
+/* auto detection enable */
+#define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2)
+/* TGg protection when tx */
+#define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3)
+/* cck short slot & preamble */
+#define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4)
+#define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5)
+/* antenna selection */
+#define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7)
+#define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00)
+#define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
+#define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
+/* radar detection enable */
+#define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12)
+#define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13)
+/* rx response to host with 8-byte TSF
+* (according to ON_AIR deassertion) */
+#define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15)
+
+
+/* HT flags */
+#define RXON_FLG_CTRL_CHANNEL_LOC_POS (22)
+#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK cpu_to_le32(0x1 << 22)
+
+#define RXON_FLG_HT_OPERATING_MODE_POS (23)
+
+#define RXON_FLG_HT_PROT_MSK cpu_to_le32(0x1 << 23)
+#define RXON_FLG_HT40_PROT_MSK cpu_to_le32(0x2 << 23)
+
+#define RXON_FLG_CHANNEL_MODE_POS (25)
+#define RXON_FLG_CHANNEL_MODE_MSK cpu_to_le32(0x3 << 25)
+
+/* channel mode */
+enum {
+ CHANNEL_MODE_LEGACY = 0,
+ CHANNEL_MODE_PURE_40 = 1,
+ CHANNEL_MODE_MIXED = 2,
+ CHANNEL_MODE_RESERVED = 3,
+};
+#define RXON_FLG_CHANNEL_MODE_LEGACY \
+ cpu_to_le32(CHANNEL_MODE_LEGACY << RXON_FLG_CHANNEL_MODE_POS)
+#define RXON_FLG_CHANNEL_MODE_PURE_40 \
+ cpu_to_le32(CHANNEL_MODE_PURE_40 << RXON_FLG_CHANNEL_MODE_POS)
+#define RXON_FLG_CHANNEL_MODE_MIXED \
+ cpu_to_le32(CHANNEL_MODE_MIXED << RXON_FLG_CHANNEL_MODE_POS)
+
+/* CTS to self (if spec allows) flag */
+#define RXON_FLG_SELF_CTS_EN cpu_to_le32(0x1<<30)
+
+/* rx_config filter flags */
+/* accept all data frames */
+#define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0)
+/* pass control & management to host */
+#define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1)
+/* accept multi-cast */
+#define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2)
+/* don't decrypt uni-cast frames */
+#define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3)
+/* don't decrypt multi-cast frames */
+#define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4)
+/* STA is associated */
+#define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5)
+/* transfer to host non bssid beacons in associated state */
+#define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6)
+
+/**
+ * C_RXON = 0x10 (command, has simple generic response)
+ *
+ * RXON tunes the radio tuner to a service channel, and sets up a number
+ * of parameters that are used primarily for Rx, but also for Tx operations.
+ *
+ * NOTE: When tuning to a new channel, driver must set the
+ * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent
+ * info within the device, including the station tables, tx retry
+ * rate tables, and txpower tables. Driver must build a new station
+ * table and txpower table before transmitting anything on the RXON
+ * channel.
+ *
+ * NOTE: All RXONs wipe clean the internal txpower table. Driver must
+ * issue a new C_TX_PWR_TBL after each C_RXON (0x10),
+ * regardless of whether RXON_FILTER_ASSOC_MSK is set.
+ */
+
+struct il3945_rxon_cmd {
+ u8 node_addr[6];
+ __le16 reserved1;
+ u8 bssid_addr[6];
+ __le16 reserved2;
+ u8 wlap_bssid_addr[6];
+ __le16 reserved3;
+ u8 dev_type;
+ u8 air_propagation;
+ __le16 reserved4;
+ u8 ofdm_basic_rates;
+ u8 cck_basic_rates;
+ __le16 assoc_id;
+ __le32 flags;
+ __le32 filter_flags;
+ __le16 channel;
+ __le16 reserved5;
+} __packed;
+
+struct il4965_rxon_cmd {
+ u8 node_addr[6];
+ __le16 reserved1;
+ u8 bssid_addr[6];
+ __le16 reserved2;
+ u8 wlap_bssid_addr[6];
+ __le16 reserved3;
+ u8 dev_type;
+ u8 air_propagation;
+ __le16 rx_chain;
+ u8 ofdm_basic_rates;
+ u8 cck_basic_rates;
+ __le16 assoc_id;
+ __le32 flags;
+ __le32 filter_flags;
+ __le16 channel;
+ u8 ofdm_ht_single_stream_basic_rates;
+ u8 ofdm_ht_dual_stream_basic_rates;
+} __packed;
+
+/* Create a common rxon cmd which will be typecast into the 3945 or 4965
+ * specific rxon cmd, depending on where it is called from.
+ */
+struct il_rxon_cmd {
+ u8 node_addr[6];
+ __le16 reserved1;
+ u8 bssid_addr[6];
+ __le16 reserved2;
+ u8 wlap_bssid_addr[6];
+ __le16 reserved3;
+ u8 dev_type;
+ u8 air_propagation;
+ __le16 rx_chain;
+ u8 ofdm_basic_rates;
+ u8 cck_basic_rates;
+ __le16 assoc_id;
+ __le32 flags;
+ __le32 filter_flags;
+ __le16 channel;
+ u8 ofdm_ht_single_stream_basic_rates;
+ u8 ofdm_ht_dual_stream_basic_rates;
+ u8 reserved4;
+ u8 reserved5;
+} __packed;
+
+
+/*
+ * C_RXON_ASSOC = 0x11 (command, has simple generic response)
+ */
+struct il3945_rxon_assoc_cmd {
+ __le32 flags;
+ __le32 filter_flags;
+ u8 ofdm_basic_rates;
+ u8 cck_basic_rates;
+ __le16 reserved;
+} __packed;
+
+struct il4965_rxon_assoc_cmd {
+ __le32 flags;
+ __le32 filter_flags;
+ u8 ofdm_basic_rates;
+ u8 cck_basic_rates;
+ u8 ofdm_ht_single_stream_basic_rates;
+ u8 ofdm_ht_dual_stream_basic_rates;
+ __le16 rx_chain_select_flags;
+ __le16 reserved;
+} __packed;
+
+#define IL_CONN_MAX_LISTEN_INTERVAL 10
+#define IL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */
+#define IL39_MAX_UCODE_BEACON_INTERVAL 1 /* 1024 */
+
+/*
+ * C_RXON_TIMING = 0x14 (command, has simple generic response)
+ */
+struct il_rxon_time_cmd {
+ __le64 timestamp;
+ __le16 beacon_interval;
+ __le16 atim_win;
+ __le32 beacon_init_val;
+ __le16 listen_interval;
+ u8 dtim_period;
+ u8 delta_cp_bss_tbtts;
+} __packed;
+
+/*
+ * C_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
+ */
+struct il3945_channel_switch_cmd {
+ u8 band;
+ u8 expect_beacon;
+ __le16 channel;
+ __le32 rxon_flags;
+ __le32 rxon_filter_flags;
+ __le32 switch_time;
+ struct il3945_power_per_rate power[IL_MAX_RATES];
+} __packed;
+
+struct il4965_channel_switch_cmd {
+ u8 band;
+ u8 expect_beacon;
+ __le16 channel;
+ __le32 rxon_flags;
+ __le32 rxon_filter_flags;
+ __le32 switch_time;
+ struct il4965_tx_power_db tx_power;
+} __packed;
+
+/*
+ * N_CHANNEL_SWITCH = 0x73 (notification only, not a command)
+ */
+struct il_csa_notification {
+ __le16 band;
+ __le16 channel;
+ __le32 status; /* 0 - OK, 1 - fail */
+} __packed;
+
+/******************************************************************************
+ * (2)
+ * Quality-of-Service (QOS) Commands & Responses:
+ *
+ *****************************************************************************/
+
+/**
+ * struct il_ac_qos -- QOS timing params for C_QOS_PARAM
+ * One for each of 4 EDCA access categories in struct il_qosparam_cmd
+ *
+ * @cw_min: Contention win, start value in numbers of slots.
+ * Should be a power-of-2, minus 1. Device's default is 0x0f.
+ * @cw_max: Contention win, max value in numbers of slots.
+ * Should be a power-of-2, minus 1. Device's default is 0x3f.
+ * @aifsn: Number of slots in Arbitration Interframe Space (before
+ * performing random backoff timing prior to Tx). Device default 1.
+ * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0.
+ *
+ * Device will automatically increase contention win by (2*CW) + 1 for each
+ * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW
+ * value, to cap the CW value.
+ */
+struct il_ac_qos {
+ __le16 cw_min;
+ __le16 cw_max;
+ u8 aifsn;
+ u8 reserved1;
+ __le16 edca_txop;
+} __packed;
+
+/* QoS flags defines */
+#define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01)
+#define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02)
+#define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10)
+
+/* Number of Access Categories (AC) (EDCA), queues 0..3 */
+#define AC_NUM 4
+
+/*
+ * C_QOS_PARAM = 0x13 (command, has simple generic response)
+ *
+ * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs
+ * 0: Background, 1: Best Effort, 2: Video, 3: Voice.
+ */
+struct il_qosparam_cmd {
+ __le32 qos_flags;
+ struct il_ac_qos ac[AC_NUM];
+} __packed;
+
+/******************************************************************************
+ * (3)
+ * Add/Modify Stations Commands & Responses:
+ *
+ *****************************************************************************/
+/*
+ * Multi station support
+ */
+
+/* Special, dedicated locations within device's station table */
+#define IL_AP_ID 0
+#define IL_STA_ID 2
+#define IL3945_BROADCAST_ID 24
+#define IL3945_STATION_COUNT 25
+#define IL4965_BROADCAST_ID 31
+#define IL4965_STATION_COUNT 32
+
+#define IL_STATION_COUNT 32 /* MAX(3945,4965)*/
+#define IL_INVALID_STATION 255
+
+#define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2)
+#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8)
+#define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17)
+#define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18)
+#define STA_FLG_MAX_AGG_SIZE_POS (19)
+#define STA_FLG_MAX_AGG_SIZE_MSK cpu_to_le32(3 << 19)
+#define STA_FLG_HT40_EN_MSK cpu_to_le32(1 << 21)
+#define STA_FLG_MIMO_DIS_MSK cpu_to_le32(1 << 22)
+#define STA_FLG_AGG_MPDU_DENSITY_POS (23)
+#define STA_FLG_AGG_MPDU_DENSITY_MSK cpu_to_le32(7 << 23)
+
+/* Use in mode field. 1: modify existing entry, 0: add new station entry */
+#define STA_CONTROL_MODIFY_MSK 0x01
+
+/* key flags __le16*/
+#define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007)
+#define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000)
+#define STA_KEY_FLG_WEP cpu_to_le16(0x0001)
+#define STA_KEY_FLG_CCMP cpu_to_le16(0x0002)
+#define STA_KEY_FLG_TKIP cpu_to_le16(0x0003)
+
+#define STA_KEY_FLG_KEYID_POS 8
+#define STA_KEY_FLG_INVALID cpu_to_le16(0x0800)
+/* wep key is either from global key (0) or from station info array (1) */
+#define STA_KEY_FLG_MAP_KEY_MSK cpu_to_le16(0x0008)
+
+/* wep key in STA: 5-bytes (0) or 13-bytes (1) */
+#define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000)
+#define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000)
+#define STA_KEY_MAX_NUM 8
+
+/* Flags indicate whether to modify vs. don't change various station params */
+#define STA_MODIFY_KEY_MASK 0x01
+#define STA_MODIFY_TID_DISABLE_TX 0x02
+#define STA_MODIFY_TX_RATE_MSK 0x04
+#define STA_MODIFY_ADDBA_TID_MSK 0x08
+#define STA_MODIFY_DELBA_TID_MSK 0x10
+#define STA_MODIFY_SLEEP_TX_COUNT_MSK 0x20
+
+/* Receiver address (actually, Rx station's idx into station table),
+ * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */
+#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
+
+struct il4965_keyinfo {
+ __le16 key_flags;
+ u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
+ u8 reserved1;
+ __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
+ u8 key_offset;
+ u8 reserved2;
+ u8 key[16]; /* 16-byte unicast decryption key */
+} __packed;
+
+/**
+ * struct sta_id_modify
+ * @addr[ETH_ALEN]: station's MAC address
+ * @sta_id: idx of station in uCode's station table
+ * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change
+ *
+ * Driver selects unused table idx when adding new station,
+ * or the idx to a pre-existing station entry when modifying that station.
+ * Some idxes have special purposes (IL_AP_ID, idx 0, is for AP).
+ *
+ * modify_mask flags select which parameters to modify vs. leave alone.
+ */
+struct sta_id_modify {
+ u8 addr[ETH_ALEN];
+ __le16 reserved1;
+ u8 sta_id;
+ u8 modify_mask;
+ __le16 reserved2;
+} __packed;
+
+/*
+ * C_ADD_STA = 0x18 (command)
+ *
+ * The device contains an internal table of per-station information,
+ * with info on security keys, aggregation parameters, and Tx rates for
+ * initial Tx attempt and any retries (4965 devices uses
+ * C_TX_LINK_QUALITY_CMD,
+ * 3945 uses C_RATE_SCALE to set up rate tables).
+ *
+ * C_ADD_STA sets up the table entry for one station, either creating
+ * a new entry, or modifying a pre-existing one.
+ *
+ * NOTE: RXON command (without "associated" bit set) wipes the station table
+ * clean. Moving into RF_KILL state does this also. Driver must set up
+ * new station table before transmitting anything on the RXON channel
+ * (except active scans or active measurements; those commands carry
+ * their own txpower/rate setup data).
+ *
+ * When getting started on a new channel, driver must set up the
+ * IL_BROADCAST_ID entry (last entry in the table). For a client
+ * station in a BSS, once an AP is selected, driver sets up the AP STA
+ * in the IL_AP_ID entry (1st entry in the table). BROADCAST and AP
+ * are all that are needed for a BSS client station. If the device is
+ * used as AP, or in an IBSS network, driver must set up station table
+ * entries for all STAs in network, starting with idx IL_STA_ID.
+ */
+
+struct il3945_addsta_cmd {
+ u8 mode; /* 1: modify existing, 0: add new station */
+ u8 reserved[3];
+ struct sta_id_modify sta;
+ struct il4965_keyinfo key;
+ __le32 station_flags; /* STA_FLG_* */
+ __le32 station_flags_msk; /* STA_FLG_* */
+
+ /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
+ * corresponding to bit (e.g. bit 5 controls TID 5).
+ * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
+ __le16 tid_disable_tx;
+
+ __le16 rate_n_flags;
+
+ /* TID for which to add block-ack support.
+ * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
+ u8 add_immediate_ba_tid;
+
+ /* TID for which to remove block-ack support.
+ * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
+ u8 remove_immediate_ba_tid;
+
+ /* Starting Sequence Number for added block-ack support.
+ * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
+ __le16 add_immediate_ba_ssn;
+} __packed;
+
+struct il4965_addsta_cmd {
+ u8 mode; /* 1: modify existing, 0: add new station */
+ u8 reserved[3];
+ struct sta_id_modify sta;
+ struct il4965_keyinfo key;
+ __le32 station_flags; /* STA_FLG_* */
+ __le32 station_flags_msk; /* STA_FLG_* */
+
+ /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
+ * corresponding to bit (e.g. bit 5 controls TID 5).
+ * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
+ __le16 tid_disable_tx;
+
+ __le16 reserved1;
+
+ /* TID for which to add block-ack support.
+ * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
+ u8 add_immediate_ba_tid;
+
+ /* TID for which to remove block-ack support.
+ * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
+ u8 remove_immediate_ba_tid;
+
+ /* Starting Sequence Number for added block-ack support.
+ * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
+ __le16 add_immediate_ba_ssn;
+
+ /*
+ * Number of packets OK to transmit to station even though
+ * it is asleep -- used to synchronise PS-poll and u-APSD
+ * responses while ucode keeps track of STA sleep state.
+ */
+ __le16 sleep_tx_count;
+
+ __le16 reserved2;
+} __packed;
+
+/* Wrapper struct for 3945 and 4965 addsta_cmd structures */
+struct il_addsta_cmd {
+ u8 mode; /* 1: modify existing, 0: add new station */
+ u8 reserved[3];
+ struct sta_id_modify sta;
+ struct il4965_keyinfo key;
+ __le32 station_flags; /* STA_FLG_* */
+ __le32 station_flags_msk; /* STA_FLG_* */
+
+ /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
+ * corresponding to bit (e.g. bit 5 controls TID 5).
+ * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
+ __le16 tid_disable_tx;
+
+ __le16 rate_n_flags; /* 3945 only */
+
+ /* TID for which to add block-ack support.
+ * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
+ u8 add_immediate_ba_tid;
+
+ /* TID for which to remove block-ack support.
+ * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
+ u8 remove_immediate_ba_tid;
+
+ /* Starting Sequence Number for added block-ack support.
+ * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
+ __le16 add_immediate_ba_ssn;
+
+ /*
+ * Number of packets OK to transmit to station even though
+ * it is asleep -- used to synchronise PS-poll and u-APSD
+ * responses while ucode keeps track of STA sleep state.
+ */
+ __le16 sleep_tx_count;
+
+ __le16 reserved2;
+} __packed;
+
+
+#define ADD_STA_SUCCESS_MSK 0x1
+#define ADD_STA_NO_ROOM_IN_TBL 0x2
+#define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4
+#define ADD_STA_MODIFY_NON_EXIST_STA 0x8
+/*
+ * C_ADD_STA = 0x18 (response)
+ */
+struct il_add_sta_resp {
+ u8 status; /* ADD_STA_* */
+} __packed;
+
+#define REM_STA_SUCCESS_MSK 0x1
+/*
+ * C_REM_STA = 0x19 (response)
+ */
+struct il_rem_sta_resp {
+ u8 status;
+} __packed;
+
+/*
+ * C_REM_STA = 0x19 (command)
+ */
+struct il_rem_sta_cmd {
+ u8 num_sta; /* number of removed stations */
+ u8 reserved[3];
+ u8 addr[ETH_ALEN]; /* MAC addr of the first station */
+ u8 reserved2[2];
+} __packed;
+
+#define IL_TX_FIFO_BK_MSK cpu_to_le32(BIT(0))
+#define IL_TX_FIFO_BE_MSK cpu_to_le32(BIT(1))
+#define IL_TX_FIFO_VI_MSK cpu_to_le32(BIT(2))
+#define IL_TX_FIFO_VO_MSK cpu_to_le32(BIT(3))
+#define IL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00)
+
+#define IL_DROP_SINGLE 0
+#define IL_DROP_SELECTED 1
+#define IL_DROP_ALL 2
+
+/*
+ * REPLY_WEP_KEY = 0x20
+ */
+struct il_wep_key {
+ u8 key_idx;
+ u8 key_offset;
+ u8 reserved1[2];
+ u8 key_size;
+ u8 reserved2[3];
+ u8 key[16];
+} __packed;
+
+struct il_wep_cmd {
+ u8 num_keys;
+ u8 global_key_type;
+ u8 flags;
+ u8 reserved;
+ struct il_wep_key key[0];
+} __packed;
+
+#define WEP_KEY_WEP_TYPE 1
+#define WEP_KEYS_MAX 4
+#define WEP_INVALID_OFFSET 0xff
+#define WEP_KEY_LEN_64 5
+#define WEP_KEY_LEN_128 13
+
+/******************************************************************************
+ * (4)
+ * Rx Responses:
+ *
+ *****************************************************************************/
+
+#define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0)
+#define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1)
+
+#define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0)
+#define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1)
+#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2)
+#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3)
+#define RX_RES_PHY_FLAGS_ANTENNA_MSK 0xf0
+#define RX_RES_PHY_FLAGS_ANTENNA_POS 4
+
+#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
+#define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
+#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
+#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
+#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
+#define RX_RES_STATUS_SEC_TYPE_ERR (0x7 << 8)
+
+#define RX_RES_STATUS_STATION_FOUND (1<<6)
+#define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7)
+
+#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
+#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
+#define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
+#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
+#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
+
+#define RX_MPDU_RES_STATUS_ICV_OK (0x20)
+#define RX_MPDU_RES_STATUS_MIC_OK (0x40)
+#define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7)
+#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800)
+
+
+struct il3945_rx_frame_stats {
+ u8 phy_count;
+ u8 id;
+ u8 rssi;
+ u8 agc;
+ __le16 sig_avg;
+ __le16 noise_diff;
+ u8 payload[0];
+} __packed;
+
+struct il3945_rx_frame_hdr {
+ __le16 channel;
+ __le16 phy_flags;
+ u8 reserved1;
+ u8 rate;
+ __le16 len;
+ u8 payload[0];
+} __packed;
+
+struct il3945_rx_frame_end {
+ __le32 status;
+ __le64 timestamp;
+ __le32 beacon_timestamp;
+} __packed;
+
+/*
+ * N_3945_RX = 0x1b (response only, not a command)
+ *
+ * NOTE: DO NOT dereference from casts to this structure
+ * It is provided only for calculating minimum data set size.
+ * The actual offsets of the hdr and end are dynamic based on
+ * stats.phy_count
+ */
+struct il3945_rx_frame {
+ struct il3945_rx_frame_stats stats;
+ struct il3945_rx_frame_hdr hdr;
+ struct il3945_rx_frame_end end;
+} __packed;
+
+#define IL39_RX_FRAME_SIZE (4 + sizeof(struct il3945_rx_frame))
+
+/* Fixed (non-configurable) rx data from phy */
+
+#define IL49_RX_RES_PHY_CNT 14
+#define IL49_RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
+#define IL49_RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
+#define IL49_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
+#define IL49_AGC_DB_POS (7)
+struct il4965_rx_non_cfg_phy {
+ __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
+ __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
+ u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
+ u8 pad[0];
+} __packed;
+
+
+/*
+ * N_RX = 0xc3 (response only, not a command)
+ * Used only for legacy (non 11n) frames.
+ */
+struct il_rx_phy_res {
+ u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
+ u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
+ u8 stat_id; /* configurable DSP phy data set ID */
+ u8 reserved1;
+ __le64 timestamp; /* TSF at on air rise */
+ __le32 beacon_time_stamp; /* beacon at on-air rise */
+ __le16 phy_flags; /* general phy flags: band, modulation, ... */
+ __le16 channel; /* channel number */
+ u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */
+ __le32 rate_n_flags; /* RATE_MCS_* */
+ __le16 byte_count; /* frame's byte-count */
+ __le16 frame_time; /* frame's time on the air */
+} __packed;
+
+struct il_rx_mpdu_res_start {
+ __le16 byte_count;
+ __le16 reserved;
+} __packed;
+
+
+/******************************************************************************
+ * (5)
+ * Tx Commands & Responses:
+ *
+ * Driver must place each C_TX command into one of the prioritized Tx
+ * queues in host DRAM, shared between driver and device (see comments for
+ * SCD registers and Tx/Rx Queues). When the device's Tx scheduler and uCode
+ * are preparing to transmit, the device pulls the Tx command over the PCI
+ * bus via one of the device's Tx DMA channels, to fill an internal FIFO
+ * from which data will be transmitted.
+ *
+ * uCode handles all timing and protocol related to control frames
+ * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler
+ * handle reception of block-acks; uCode updates the host driver via
+ * N_COMPRESSED_BA.
+ *
+ * uCode handles retrying Tx when an ACK is expected but not received.
+ * This includes trying lower data rates than the one requested in the Tx
+ * command, as set up by the C_RATE_SCALE (for 3945) or
+ * C_TX_LINK_QUALITY_CMD (4965).
+ *
+ * Driver sets up transmit power for various rates via C_TX_PWR_TBL.
+ * This command must be executed after every RXON command, before Tx can occur.
+ *****************************************************************************/
+
+/* C_TX Tx flags field */
+
+/*
+ * 1: Use Request-To-Send protocol before this frame.
+ * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK.
+ */
+#define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1)
+
+/*
+ * 1: Transmit Clear-To-Send to self before this frame.
+ * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
+ * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK.
+ */
+#define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2)
+
+/* 1: Expect ACK from receiving station
+ * 0: Don't expect ACK (MAC header's duration field s/b 0)
+ * Set this for unicast frames, but not broadcast/multicast. */
+#define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3)
+
+/* For 4965 devices:
+ * 1: Use rate scale table (see C_TX_LINK_QUALITY_CMD).
+ * Tx command's initial_rate_idx indicates first rate to try;
+ * uCode walks through table for additional Tx attempts.
+ * 0: Use Tx rate/MCS from Tx command's rate_n_flags field.
+ * This rate will be used for all Tx attempts; it will not be scaled. */
+#define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4)
+
+/* 1: Expect immediate block-ack.
+ * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */
+#define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6)
+
+/*
+ * 1: Frame requires full Tx-Op protection.
+ * Set this if either RTS or CTS Tx Flag gets set.
+ */
+#define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7)
+
+/* Tx antenna selection field; used only for 3945, reserved (0) for 4965 devices.
+ * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */
+#define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00)
+#define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
+#define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
+
+/* 1: uCode overrides sequence control field in MAC header.
+ * 0: Driver provides sequence control field in MAC header.
+ * Set this for management frames, non-QOS data frames, non-unicast frames,
+ * and also in Tx command embedded in C_SCAN for active scans. */
+#define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13)
+
+/* 1: This frame is non-last MPDU; more fragments are coming.
+ * 0: Last fragment, or not using fragmentation. */
+#define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14)
+
+/* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame.
+ * 0: No TSF required in outgoing frame.
+ * Set this for transmitting beacons and probe responses. */
+#define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16)
+
+/* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword
+ * alignment of frame's payload data field.
+ * 0: No pad
+ * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4
+ * field (but not both). Driver must align frame data (i.e. data following
+ * MAC header) to DWORD boundary. */
+#define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20)
+
+/* accelerate aggregation support
+ * 0 - no CCMP encryption; 1 - CCMP encryption */
+#define TX_CMD_FLG_AGG_CCMP_MSK cpu_to_le32(1 << 22)
+
+/* HCCA-AP - disable duration overwriting. */
+#define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25)
+
+
+/*
+ * TX command security control
+ */
+#define TX_CMD_SEC_WEP 0x01
+#define TX_CMD_SEC_CCM 0x02
+#define TX_CMD_SEC_TKIP 0x03
+#define TX_CMD_SEC_MSK 0x03
+#define TX_CMD_SEC_SHIFT 6
+#define TX_CMD_SEC_KEY128 0x08
+
+/*
+ * security overhead sizes
+ */
+#define WEP_IV_LEN 4
+#define WEP_ICV_LEN 4
+#define CCMP_MIC_LEN 8
+#define TKIP_ICV_LEN 4
+
+/*
+ * C_TX = 0x1c (command)
+ */
+
+struct il3945_tx_cmd {
+ /*
+ * MPDU byte count:
+ * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
+ * + 8 byte IV for CCM or TKIP (not used for WEP)
+ * + Data payload
+ * + 8-byte MIC (not used for CCM/WEP)
+ * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
+ * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
+ * Range: 14-2342 bytes.
+ */
+ __le16 len;
+
+ /*
+ * MPDU or MSDU byte count for next frame.
+ * Used for fragmentation and bursting, but not 11n aggregation.
+ * Same as "len", but for next frame. Set to 0 if not applicable.
+ */
+ __le16 next_frame_len;
+
+ __le32 tx_flags; /* TX_CMD_FLG_* */
+
+ u8 rate;
+
+ /* Index of recipient station in uCode's station table */
+ u8 sta_id;
+ u8 tid_tspec;
+ u8 sec_ctl;
+ u8 key[16];
+ union {
+ u8 byte[8];
+ __le16 word[4];
+ __le32 dw[2];
+ } tkip_mic;
+ __le32 next_frame_info;
+ union {
+ __le32 life_time;
+ __le32 attempt;
+ } stop_time;
+ u8 supp_rates[2];
+ u8 rts_retry_limit; /*byte 50 */
+ u8 data_retry_limit; /*byte 51 */
+ union {
+ __le16 pm_frame_timeout;
+ __le16 attempt_duration;
+ } timeout;
+
+ /*
+ * Duration of EDCA burst Tx Opportunity, in 32-usec units.
+ * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
+ */
+ __le16 driver_txop;
+
+ /*
+ * MAC header goes here, followed by 2 bytes padding if MAC header
+ * length is 26 or 30 bytes, followed by payload data
+ */
+ u8 payload[0];
+ struct ieee80211_hdr hdr[0];
+} __packed;
+
+/*
+ * C_TX = 0x1c (response)
+ */
+struct il3945_tx_resp {
+ u8 failure_rts;
+ u8 failure_frame;
+ u8 bt_kill_count;
+ u8 rate;
+ __le32 wireless_media_time;
+ __le32 status; /* TX status */
+} __packed;
+
+
+/*
+ * 4965 uCode updates these Tx attempt count values in host DRAM.
+ * Used for managing Tx retries when expecting block-acks.
+ * Driver should set these fields to 0.
+ */
+struct il_dram_scratch {
+ u8 try_cnt; /* Tx attempts */
+ u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */
+ __le16 reserved;
+} __packed;
+
+struct il_tx_cmd {
+ /*
+ * MPDU byte count:
+ * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
+ * + 8 byte IV for CCM or TKIP (not used for WEP)
+ * + Data payload
+ * + 8-byte MIC (not used for CCM/WEP)
+ * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
+ * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
+ * Range: 14-2342 bytes.
+ */
+ __le16 len;
+
+ /*
+ * MPDU or MSDU byte count for next frame.
+ * Used for fragmentation and bursting, but not 11n aggregation.
+ * Same as "len", but for next frame. Set to 0 if not applicable.
+ */
+ __le16 next_frame_len;
+
+ __le32 tx_flags; /* TX_CMD_FLG_* */
+
+ /* uCode may modify this field of the Tx command (in host DRAM!).
+ * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */
+ struct il_dram_scratch scratch;
+
+ /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */
+ __le32 rate_n_flags; /* RATE_MCS_* */
+
+ /* Index of destination station in uCode's station table */
+ u8 sta_id;
+
+ /* Type of security encryption: CCM or TKIP */
+ u8 sec_ctl; /* TX_CMD_SEC_* */
+
+ /*
+ * Index into rate table (see C_TX_LINK_QUALITY_CMD) for initial
+ * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set. Normally "0" for
+ * data frames, this field may be used to selectively reduce initial
+ * rate (via non-0 value) for special frames (e.g. management), while
+ * still supporting rate scaling for all frames.
+ */
+ u8 initial_rate_idx;
+ u8 reserved;
+ u8 key[16];
+ __le16 next_frame_flags;
+ __le16 reserved2;
+ union {
+ __le32 life_time;
+ __le32 attempt;
+ } stop_time;
+
+ /* Host DRAM physical address pointer to "scratch" in this command.
+ * Must be dword aligned. "0" in dram_lsb_ptr disables usage. */
+ __le32 dram_lsb_ptr;
+ u8 dram_msb_ptr;
+
+ u8 rts_retry_limit; /*byte 50 */
+ u8 data_retry_limit; /*byte 51 */
+ u8 tid_tspec;
+ union {
+ __le16 pm_frame_timeout;
+ __le16 attempt_duration;
+ } timeout;
+
+ /*
+ * Duration of EDCA burst Tx Opportunity, in 32-usec units.
+ * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
+ */
+ __le16 driver_txop;
+
+ /*
+ * MAC header goes here, followed by 2 bytes padding if MAC header
+ * length is 26 or 30 bytes, followed by payload data
+ */
+ u8 payload[0];
+ struct ieee80211_hdr hdr[0];
+} __packed;
+
+/* TX command response is sent after *3945* transmission attempts.
+ *
+ * NOTES:
+ *
+ * TX_STATUS_FAIL_NEXT_FRAG
+ *
+ * If the fragment flag in the MAC header for the frame being transmitted
+ * is set and there is insufficient time to transmit the next frame, the
+ * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
+ *
+ * TX_STATUS_FIFO_UNDERRUN
+ *
+ * Indicates the host did not provide bytes to the FIFO fast enough while
+ * a TX was in progress.
+ *
+ * TX_STATUS_FAIL_MGMNT_ABORT
+ *
+ * This status is only possible if the ABORT ON MGMT RX parameter was
+ * set to true with the TX command.
+ *
+ * If the MSB of the status parameter is set then an abort sequence is
+ * required. This sequence consists of the host activating the TX Abort
+ * control line, and then waiting for the TX Abort command response. This
+ * indicates that a the device is no longer in a transmit state, and that the
+ * command FIFO has been cleared. The host must then deactivate the TX Abort
+ * control line. Receiving is still allowed in this case.
+ */
+enum {
+ TX_3945_STATUS_SUCCESS = 0x01,
+ TX_3945_STATUS_DIRECT_DONE = 0x02,
+ TX_3945_STATUS_FAIL_SHORT_LIMIT = 0x82,
+ TX_3945_STATUS_FAIL_LONG_LIMIT = 0x83,
+ TX_3945_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
+ TX_3945_STATUS_FAIL_MGMNT_ABORT = 0x85,
+ TX_3945_STATUS_FAIL_NEXT_FRAG = 0x86,
+ TX_3945_STATUS_FAIL_LIFE_EXPIRE = 0x87,
+ TX_3945_STATUS_FAIL_DEST_PS = 0x88,
+ TX_3945_STATUS_FAIL_ABORTED = 0x89,
+ TX_3945_STATUS_FAIL_BT_RETRY = 0x8a,
+ TX_3945_STATUS_FAIL_STA_INVALID = 0x8b,
+ TX_3945_STATUS_FAIL_FRAG_DROPPED = 0x8c,
+ TX_3945_STATUS_FAIL_TID_DISABLE = 0x8d,
+ TX_3945_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
+ TX_3945_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
+ TX_3945_STATUS_FAIL_TX_LOCKED = 0x90,
+ TX_3945_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
+};
+
+/*
+ * TX command response is sent after *4965* transmission attempts.
+ *
+ * both postpone and abort status are expected behavior from uCode. there is
+ * no special operation required from driver; except for RFKILL_FLUSH,
+ * which required tx flush host command to flush all the tx frames in queues
+ */
+enum {
+ TX_STATUS_SUCCESS = 0x01,
+ TX_STATUS_DIRECT_DONE = 0x02,
+ /* postpone TX */
+ TX_STATUS_POSTPONE_DELAY = 0x40,
+ TX_STATUS_POSTPONE_FEW_BYTES = 0x41,
+ TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43,
+ TX_STATUS_POSTPONE_CALC_TTAK = 0x44,
+ /* abort TX */
+ TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81,
+ TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
+ TX_STATUS_FAIL_LONG_LIMIT = 0x83,
+ TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
+ TX_STATUS_FAIL_DRAIN_FLOW = 0x85,
+ TX_STATUS_FAIL_RFKILL_FLUSH = 0x86,
+ TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
+ TX_STATUS_FAIL_DEST_PS = 0x88,
+ TX_STATUS_FAIL_HOST_ABORTED = 0x89,
+ TX_STATUS_FAIL_BT_RETRY = 0x8a,
+ TX_STATUS_FAIL_STA_INVALID = 0x8b,
+ TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
+ TX_STATUS_FAIL_TID_DISABLE = 0x8d,
+ TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e,
+ TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
+ TX_STATUS_FAIL_PASSIVE_NO_RX = 0x90,
+ TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
+};
+
+#define TX_PACKET_MODE_REGULAR 0x0000
+#define TX_PACKET_MODE_BURST_SEQ 0x0100
+#define TX_PACKET_MODE_BURST_FIRST 0x0200
+
+enum {
+ TX_POWER_PA_NOT_ACTIVE = 0x0,
+};
+
+enum {
+ TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */
+ TX_STATUS_DELAY_MSK = 0x00000040,
+ TX_STATUS_ABORT_MSK = 0x00000080,
+ TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */
+ TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */
+ TX_RESERVED = 0x00780000, /* bits 19:22 */
+ TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */
+ TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */
+};
+
+/* *******************************
+ * TX aggregation status
+ ******************************* */
+
+enum {
+ AGG_TX_STATE_TRANSMITTED = 0x00,
+ AGG_TX_STATE_UNDERRUN_MSK = 0x01,
+ AGG_TX_STATE_FEW_BYTES_MSK = 0x04,
+ AGG_TX_STATE_ABORT_MSK = 0x08,
+ AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10,
+ AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20,
+ AGG_TX_STATE_SCD_QUERY_MSK = 0x80,
+ AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100,
+ AGG_TX_STATE_RESPONSE_MSK = 0x1ff,
+ AGG_TX_STATE_DUMP_TX_MSK = 0x200,
+ AGG_TX_STATE_DELAY_TX_MSK = 0x400
+};
+
+#define AGG_TX_STATUS_MSK 0x00000fff /* bits 0:11 */
+#define AGG_TX_TRY_MSK 0x0000f000 /* bits 12:15 */
+
+#define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL_MSK | \
+ AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK)
+
+/* # tx attempts for first frame in aggregation */
+#define AGG_TX_STATE_TRY_CNT_POS 12
+#define AGG_TX_STATE_TRY_CNT_MSK 0xf000
+
+/* Command ID and sequence number of Tx command for this frame */
+#define AGG_TX_STATE_SEQ_NUM_POS 16
+#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
+
+/*
+ * C_TX = 0x1c (response)
+ *
+ * This response may be in one of two slightly different formats, indicated
+ * by the frame_count field:
+ *
+ * 1) No aggregation (frame_count == 1). This reports Tx results for
+ * a single frame. Multiple attempts, at various bit rates, may have
+ * been made for this frame.
+ *
+ * 2) Aggregation (frame_count > 1). This reports Tx results for
+ * 2 or more frames that used block-acknowledge. All frames were
+ * transmitted at same rate. Rate scaling may have been used if first
+ * frame in this new agg block failed in previous agg block(s).
+ *
+ * Note that, for aggregation, ACK (block-ack) status is not delivered here;
+ * block-ack has not been received by the time the 4965 device records
+ * this status.
+ * This status relates to reasons the tx might have been blocked or aborted
+ * within the sending station (this 4965 device), rather than whether it was
+ * received successfully by the destination station.
+ */
+struct agg_tx_status {
+ __le16 status;
+ __le16 sequence;
+} __packed;
+
+struct il4965_tx_resp {
+ u8 frame_count; /* 1 no aggregation, >1 aggregation */
+ u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */
+ u8 failure_rts; /* # failures due to unsuccessful RTS */
+ u8 failure_frame; /* # failures due to no ACK (unused for agg) */
+
+ /* For non-agg: Rate at which frame was successful.
+ * For agg: Rate at which all frames were transmitted. */
+ __le32 rate_n_flags; /* RATE_MCS_* */
+
+ /* For non-agg: RTS + CTS + frame tx attempts time + ACK.
+ * For agg: RTS + CTS + aggregation tx time + block-ack time. */
+ __le16 wireless_media_time; /* uSecs */
+
+ __le16 reserved;
+ __le32 pa_power1; /* RF power amplifier measurement (not used) */
+ __le32 pa_power2;
+
+ /*
+ * For non-agg: frame status TX_STATUS_*
+ * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status
+ * fields follow this one, up to frame_count.
+ * Bit fields:
+ * 11- 0: AGG_TX_STATE_* status code
+ * 15-12: Retry count for 1st frame in aggregation (retries
+ * occur if tx failed for this frame when it was a
+ * member of a previous aggregation block). If rate
+ * scaling is used, retry count indicates the rate
+ * table entry used for all frames in the new agg.
+ * 31-16: Sequence # for this frame's Tx cmd (not SSN!)
+ */
+ union {
+ __le32 status;
+ struct agg_tx_status agg_status[0]; /* for each agg frame */
+ } u;
+} __packed;
+
+/*
+ * N_COMPRESSED_BA = 0xc5 (response only, not a command)
+ *
+ * Reports Block-Acknowledge from recipient station
+ */
+struct il_compressed_ba_resp {
+ __le32 sta_addr_lo32;
+ __le16 sta_addr_hi16;
+ __le16 reserved;
+
+ /* Index of recipient (BA-sending) station in uCode's station table */
+ u8 sta_id;
+ u8 tid;
+ __le16 seq_ctl;
+ __le64 bitmap;
+ __le16 scd_flow;
+ __le16 scd_ssn;
+} __packed;
+
+/*
+ * C_TX_PWR_TBL = 0x97 (command, has simple generic response)
+ *
+ * See details under "TXPOWER" in 4965.h.
+ */
+
+struct il3945_txpowertable_cmd {
+ u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
+ u8 reserved;
+ __le16 channel;
+ struct il3945_power_per_rate power[IL_MAX_RATES];
+} __packed;
+
+struct il4965_txpowertable_cmd {
+ u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
+ u8 reserved;
+ __le16 channel;
+ struct il4965_tx_power_db tx_power;
+} __packed;
+
+
+/**
+ * struct il3945_rate_scaling_cmd - Rate Scaling Command & Response
+ *
+ * C_RATE_SCALE = 0x47 (command, has simple generic response)
+ *
+ * NOTE: The table of rates passed to the uCode via the
+ * RATE_SCALE command sets up the corresponding order of
+ * rates used for all related commands, including rate
+ * masks, etc.
+ *
+ * For example, if you set 9MB (PLCP 0x0f) as the first
+ * rate in the rate table, the bit mask for that rate
+ * when passed through ofdm_basic_rates on the C_RXON
+ * command would be bit 0 (1 << 0)
+ */
+struct il3945_rate_scaling_info {
+ __le16 rate_n_flags;
+ u8 try_cnt;
+ u8 next_rate_idx;
+} __packed;
+
+struct il3945_rate_scaling_cmd {
+ u8 table_id;
+ u8 reserved[3];
+ struct il3945_rate_scaling_info table[IL_MAX_RATES];
+} __packed;
+
+
+/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
+#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0)
+
+/* # of EDCA prioritized tx fifos */
+#define LINK_QUAL_AC_NUM AC_NUM
+
+/* # entries in rate scale table to support Tx retries */
+#define LINK_QUAL_MAX_RETRY_NUM 16
+
+/* Tx antenna selection values */
+#define LINK_QUAL_ANT_A_MSK (1 << 0)
+#define LINK_QUAL_ANT_B_MSK (1 << 1)
+#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK)
+
+
+/**
+ * struct il_link_qual_general_params
+ *
+ * Used in C_TX_LINK_QUALITY_CMD
+ */
+struct il_link_qual_general_params {
+ u8 flags;
+
+ /* No entries at or above this (driver chosen) idx contain MIMO */
+ u8 mimo_delimiter;
+
+ /* Best single antenna to use for single stream (legacy, SISO). */
+ u8 single_stream_ant_msk; /* LINK_QUAL_ANT_* */
+
+ /* Best antennas to use for MIMO (unused for 4965, assumes both). */
+ u8 dual_stream_ant_msk; /* LINK_QUAL_ANT_* */
+
+ /*
+ * If driver needs to use different initial rates for different
+ * EDCA QOS access categories (as implemented by tx fifos 0-3),
+ * this table will set that up, by indicating the idxes in the
+ * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start.
+ * Otherwise, driver should set all entries to 0.
+ *
+ * Entry usage:
+ * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice
+ * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3.
+ */
+ u8 start_rate_idx[LINK_QUAL_AC_NUM];
+} __packed;
+
+#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */
+#define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000)
+#define LINK_QUAL_AGG_TIME_LIMIT_MIN (100)
+
+#define LINK_QUAL_AGG_DISABLE_START_DEF (3)
+#define LINK_QUAL_AGG_DISABLE_START_MAX (255)
+#define LINK_QUAL_AGG_DISABLE_START_MIN (0)
+
+#define LINK_QUAL_AGG_FRAME_LIMIT_DEF (31)
+#define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63)
+#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0)
+
+/**
+ * struct il_link_qual_agg_params
+ *
+ * Used in C_TX_LINK_QUALITY_CMD
+ */
+struct il_link_qual_agg_params {
+
+ /*
+ *Maximum number of uSec in aggregation.
+ * default set to 4000 (4 milliseconds) if not configured in .cfg
+ */
+ __le16 agg_time_limit;
+
+ /*
+ * Number of Tx retries allowed for a frame, before that frame will
+ * no longer be considered for the start of an aggregation sequence
+ * (scheduler will then try to tx it as single frame).
+ * Driver should set this to 3.
+ */
+ u8 agg_dis_start_th;
+
+ /*
+ * Maximum number of frames in aggregation.
+ * 0 = no limit (default). 1 = no aggregation.
+ * Other values = max # frames in aggregation.
+ */
+ u8 agg_frame_cnt_limit;
+
+ __le32 reserved;
+} __packed;
+
+/*
+ * C_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
+ *
+ * For 4965 devices only; 3945 uses C_RATE_SCALE.
+ *
+ * Each station in the 4965 device's internal station table has its own table
+ * of 16
+ * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when
+ * an ACK is not received. This command replaces the entire table for
+ * one station.
+ *
+ * NOTE: Station must already be in 4965 device's station table.
+ * Use C_ADD_STA.
+ *
+ * The rate scaling procedures described below work well. Of course, other
+ * procedures are possible, and may work better for particular environments.
+ *
+ *
+ * FILLING THE RATE TBL
+ *
+ * Given a particular initial rate and mode, as determined by the rate
+ * scaling algorithm described below, the Linux driver uses the following
+ * formula to fill the rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table in the
+ * Link Quality command:
+ *
+ *
+ * 1) If using High-throughput (HT) (SISO or MIMO) initial rate:
+ * a) Use this same initial rate for first 3 entries.
+ * b) Find next lower available rate using same mode (SISO or MIMO),
+ * use for next 3 entries. If no lower rate available, switch to
+ * legacy mode (no HT40 channel, no MIMO, no short guard interval).
+ * c) If using MIMO, set command's mimo_delimiter to number of entries
+ * using MIMO (3 or 6).
+ * d) After trying 2 HT rates, switch to legacy mode (no HT40 channel,
+ * no MIMO, no short guard interval), at the next lower bit rate
+ * (e.g. if second HT bit rate was 54, try 48 legacy), and follow
+ * legacy procedure for remaining table entries.
+ *
+ * 2) If using legacy initial rate:
+ * a) Use the initial rate for only one entry.
+ * b) For each following entry, reduce the rate to next lower available
+ * rate, until reaching the lowest available rate.
+ * c) When reducing rate, also switch antenna selection.
+ * d) Once lowest available rate is reached, repeat this rate until
+ * rate table is filled (16 entries), switching antenna each entry.
+ *
+ *
+ * ACCUMULATING HISTORY
+ *
+ * The rate scaling algorithm for 4965 devices, as implemented in Linux driver,
+ * uses two sets of frame Tx success history: One for the current/active
+ * modulation mode, and one for a speculative/search mode that is being
+ * attempted. If the speculative mode turns out to be more effective (i.e.
+ * actual transfer rate is better), then the driver continues to use the
+ * speculative mode as the new current active mode.
+ *
+ * Each history set contains, separately for each possible rate, data for a
+ * sliding win of the 62 most recent tx attempts at that rate. The data
+ * includes a shifting bitmap of success(1)/failure(0), and sums of successful
+ * and attempted frames, from which the driver can additionally calculate a
+ * success ratio (success / attempted) and number of failures
+ * (attempted - success), and control the size of the win (attempted).
+ * The driver uses the bit map to remove successes from the success sum, as
+ * the oldest tx attempts fall out of the win.
+ *
+ * When the 4965 device makes multiple tx attempts for a given frame, each
+ * attempt might be at a different rate, and have different modulation
+ * characteristics (e.g. antenna, fat channel, short guard interval), as set
+ * up in the rate scaling table in the Link Quality command. The driver must
+ * determine which rate table entry was used for each tx attempt, to determine
+ * which rate-specific history to update, and record only those attempts that
+ * match the modulation characteristics of the history set.
+ *
+ * When using block-ack (aggregation), all frames are transmitted at the same
+ * rate, since there is no per-attempt acknowledgment from the destination
+ * station. The Tx response struct il_tx_resp indicates the Tx rate in
+ * rate_n_flags field. After receiving a block-ack, the driver can update
+ * history for the entire block all at once.
+ *
+ *
+ * FINDING BEST STARTING RATE:
+ *
+ * When working with a selected initial modulation mode (see below), the
+ * driver attempts to find a best initial rate. The initial rate is the
+ * first entry in the Link Quality command's rate table.
+ *
+ * 1) Calculate actual throughput (success ratio * expected throughput, see
+ * table below) for current initial rate. Do this only if enough frames
+ * have been attempted to make the value meaningful: at least 6 failed
+ * tx attempts, or at least 8 successes. If not enough, don't try rate
+ * scaling yet.
+ *
+ * 2) Find available rates adjacent to current initial rate. Available means:
+ * a) supported by hardware &&
+ * b) supported by association &&
+ * c) within any constraints selected by user
+ *
+ * 3) Gather measured throughputs for adjacent rates. These might not have
+ * enough history to calculate a throughput. That's okay, we might try
+ * using one of them anyway!
+ *
+ * 4) Try decreasing rate if, for current rate:
+ * a) success ratio is < 15% ||
+ * b) lower adjacent rate has better measured throughput ||
+ * c) higher adjacent rate has worse throughput, and lower is unmeasured
+ *
+ * As a sanity check, if decrease was determined above, leave rate
+ * unchanged if:
+ * a) lower rate unavailable
+ * b) success ratio at current rate > 85% (very good)
+ * c) current measured throughput is better than expected throughput
+ * of lower rate (under perfect 100% tx conditions, see table below)
+ *
+ * 5) Try increasing rate if, for current rate:
+ * a) success ratio is < 15% ||
+ * b) both adjacent rates' throughputs are unmeasured (try it!) ||
+ * b) higher adjacent rate has better measured throughput ||
+ * c) lower adjacent rate has worse throughput, and higher is unmeasured
+ *
+ * As a sanity check, if increase was determined above, leave rate
+ * unchanged if:
+ * a) success ratio at current rate < 70%. This is not particularly
+ * good performance; higher rate is sure to have poorer success.
+ *
+ * 6) Re-evaluate the rate after each tx frame. If working with block-
+ * acknowledge, history and stats may be calculated for the entire
+ * block (including prior history that fits within the history wins),
+ * before re-evaluation.
+ *
+ * FINDING BEST STARTING MODULATION MODE:
+ *
+ * After working with a modulation mode for a "while" (and doing rate scaling),
+ * the driver searches for a new initial mode in an attempt to improve
+ * throughput. The "while" is measured by numbers of attempted frames:
+ *
+ * For legacy mode, search for new mode after:
+ * 480 successful frames, or 160 failed frames
+ * For high-throughput modes (SISO or MIMO), search for new mode after:
+ * 4500 successful frames, or 400 failed frames
+ *
+ * Mode switch possibilities are (3 for each mode):
+ *
+ * For legacy:
+ * Change antenna, try SISO (if HT association), try MIMO (if HT association)
+ * For SISO:
+ * Change antenna, try MIMO, try shortened guard interval (SGI)
+ * For MIMO:
+ * Try SISO antenna A, SISO antenna B, try shortened guard interval (SGI)
+ *
+ * When trying a new mode, use the same bit rate as the old/current mode when
+ * trying antenna switches and shortened guard interval. When switching to
+ * SISO from MIMO or legacy, or to MIMO from SISO or legacy, use a rate
+ * for which the expected throughput (under perfect conditions) is about the
+ * same or slightly better than the actual measured throughput delivered by
+ * the old/current mode.
+ *
+ * Actual throughput can be estimated by multiplying the expected throughput
+ * by the success ratio (successful / attempted tx frames). Frame size is
+ * not considered in this calculation; it assumes that frame size will average
+ * out to be fairly consistent over several samples. The following are
+ * metric values for expected throughput assuming 100% success ratio.
+ * Only G band has support for CCK rates:
+ *
+ * RATE: 1 2 5 11 6 9 12 18 24 36 48 54 60
+ *
+ * G: 7 13 35 58 40 57 72 98 121 154 177 186 186
+ * A: 0 0 0 0 40 57 72 98 121 154 177 186 186
+ * SISO 20MHz: 0 0 0 0 42 42 76 102 124 159 183 193 202
+ * SGI SISO 20MHz: 0 0 0 0 46 46 82 110 132 168 192 202 211
+ * MIMO 20MHz: 0 0 0 0 74 74 123 155 179 214 236 244 251
+ * SGI MIMO 20MHz: 0 0 0 0 81 81 131 164 188 222 243 251 257
+ * SISO 40MHz: 0 0 0 0 77 77 127 160 184 220 242 250 257
+ * SGI SISO 40MHz: 0 0 0 0 83 83 135 169 193 229 250 257 264
+ * MIMO 40MHz: 0 0 0 0 123 123 182 214 235 264 279 285 289
+ * SGI MIMO 40MHz: 0 0 0 0 131 131 191 222 242 270 284 289 293
+ *
+ * After the new mode has been tried for a short while (minimum of 6 failed
+ * frames or 8 successful frames), compare success ratio and actual throughput
+ * estimate of the new mode with the old. If either is better with the new
+ * mode, continue to use the new mode.
+ *
+ * Continue comparing modes until all 3 possibilities have been tried.
+ * If moving from legacy to HT, try all 3 possibilities from the new HT
+ * mode. After trying all 3, a best mode is found. Continue to use this mode
+ * for the longer "while" described above (e.g. 480 successful frames for
+ * legacy), and then repeat the search process.
+ *
+ */
+struct il_link_quality_cmd {
+
+ /* Index of destination/recipient station in uCode's station table */
+ u8 sta_id;
+ u8 reserved1;
+ __le16 control; /* not used */
+ struct il_link_qual_general_params general_params;
+ struct il_link_qual_agg_params agg_params;
+
+ /*
+ * Rate info; when using rate-scaling, Tx command's initial_rate_idx
+ * specifies 1st Tx rate attempted, via idx into this table.
+ * 4965 devices works its way through table when retrying Tx.
+ */
+ struct {
+ __le32 rate_n_flags; /* RATE_MCS_*, RATE_* */
+ } rs_table[LINK_QUAL_MAX_RETRY_NUM];
+ __le32 reserved2;
+} __packed;
+
+/*
+ * BT configuration enable flags:
+ * bit 0 - 1: BT channel announcement enabled
+ * 0: disable
+ * bit 1 - 1: priority of BT device enabled
+ * 0: disable
+ */
+#define BT_COEX_DISABLE (0x0)
+#define BT_ENABLE_CHANNEL_ANNOUNCE BIT(0)
+#define BT_ENABLE_PRIORITY BIT(1)
+
+#define BT_COEX_ENABLE (BT_ENABLE_CHANNEL_ANNOUNCE | BT_ENABLE_PRIORITY)
+
+#define BT_LEAD_TIME_DEF (0x1E)
+
+#define BT_MAX_KILL_DEF (0x5)
+
+/*
+ * C_BT_CONFIG = 0x9b (command, has simple generic response)
+ *
+ * 3945 and 4965 devices support hardware handshake with Bluetooth device on
+ * same platform. Bluetooth device alerts wireless device when it will Tx;
+ * wireless device can delay or kill its own Tx to accommodate.
+ */
+struct il_bt_cmd {
+ u8 flags;
+ u8 lead_time;
+ u8 max_kill;
+ u8 reserved;
+ __le32 kill_ack_mask;
+ __le32 kill_cts_mask;
+} __packed;
+
+
+/******************************************************************************
+ * (6)
+ * Spectrum Management (802.11h) Commands, Responses, Notifications:
+ *
+ *****************************************************************************/
+
+/*
+ * Spectrum Management
+ */
+#define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
+ RXON_FILTER_CTL2HOST_MSK | \
+ RXON_FILTER_ACCEPT_GRP_MSK | \
+ RXON_FILTER_DIS_DECRYPT_MSK | \
+ RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
+ RXON_FILTER_ASSOC_MSK | \
+ RXON_FILTER_BCON_AWARE_MSK)
+
+struct il_measure_channel {
+ __le32 duration; /* measurement duration in extended beacon
+ * format */
+ u8 channel; /* channel to measure */
+ u8 type; /* see enum il_measure_type */
+ __le16 reserved;
+} __packed;
+
+/*
+ * C_SPECTRUM_MEASUREMENT = 0x74 (command)
+ */
+struct il_spectrum_cmd {
+ __le16 len; /* number of bytes starting from token */
+ u8 token; /* token id */
+ u8 id; /* measurement id -- 0 or 1 */
+ u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */
+ u8 periodic; /* 1 = periodic */
+ __le16 path_loss_timeout;
+ __le32 start_time; /* start time in extended beacon format */
+ __le32 reserved2;
+ __le32 flags; /* rxon flags */
+ __le32 filter_flags; /* rxon filter flags */
+ __le16 channel_count; /* minimum 1, maximum 10 */
+ __le16 reserved3;
+ struct il_measure_channel channels[10];
+} __packed;
+
+/*
+ * C_SPECTRUM_MEASUREMENT = 0x74 (response)
+ */
+struct il_spectrum_resp {
+ u8 token;
+ u8 id; /* id of the prior command replaced, or 0xff */
+ __le16 status; /* 0 - command will be handled
+ * 1 - cannot handle (conflicts with another
+ * measurement) */
+} __packed;
+
+enum il_measurement_state {
+ IL_MEASUREMENT_START = 0,
+ IL_MEASUREMENT_STOP = 1,
+};
+
+enum il_measurement_status {
+ IL_MEASUREMENT_OK = 0,
+ IL_MEASUREMENT_CONCURRENT = 1,
+ IL_MEASUREMENT_CSA_CONFLICT = 2,
+ IL_MEASUREMENT_TGH_CONFLICT = 3,
+ /* 4-5 reserved */
+ IL_MEASUREMENT_STOPPED = 6,
+ IL_MEASUREMENT_TIMEOUT = 7,
+ IL_MEASUREMENT_PERIODIC_FAILED = 8,
+};
+
+#define NUM_ELEMENTS_IN_HISTOGRAM 8
+
+struct il_measurement_histogram {
+ __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
+ __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
+} __packed;
+
+/* clear channel availability counters */
+struct il_measurement_cca_counters {
+ __le32 ofdm;
+ __le32 cck;
+} __packed;
+
+enum il_measure_type {
+ IL_MEASURE_BASIC = (1 << 0),
+ IL_MEASURE_CHANNEL_LOAD = (1 << 1),
+ IL_MEASURE_HISTOGRAM_RPI = (1 << 2),
+ IL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
+ IL_MEASURE_FRAME = (1 << 4),
+ /* bits 5:6 are reserved */
+ IL_MEASURE_IDLE = (1 << 7),
+};
+
+/*
+ * N_SPECTRUM_MEASUREMENT = 0x75 (notification only, not a command)
+ */
+struct il_spectrum_notification {
+ u8 id; /* measurement id -- 0 or 1 */
+ u8 token;
+ u8 channel_idx; /* idx in measurement channel list */
+ u8 state; /* 0 - start, 1 - stop */
+ __le32 start_time; /* lower 32-bits of TSF */
+ u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
+ u8 channel;
+ u8 type; /* see enum il_measurement_type */
+ u8 reserved1;
+ /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
+ * valid if applicable for measurement type requested. */
+ __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */
+ __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */
+ __le32 cca_time; /* channel load time in usecs */
+ u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
+ * unidentified */
+ u8 reserved2[3];
+ struct il_measurement_histogram histogram;
+ __le32 stop_time; /* lower 32-bits of TSF */
+ __le32 status; /* see il_measurement_status */
+} __packed;
+
+/******************************************************************************
+ * (7)
+ * Power Management Commands, Responses, Notifications:
+ *
+ *****************************************************************************/
+
+/**
+ * struct il_powertable_cmd - Power Table Command
+ * @flags: See below:
+ *
+ * C_POWER_TBL = 0x77 (command, has simple generic response)
+ *
+ * PM allow:
+ * bit 0 - '0' Driver not allow power management
+ * '1' Driver allow PM (use rest of parameters)
+ *
+ * uCode send sleep notifications:
+ * bit 1 - '0' Don't send sleep notification
+ * '1' send sleep notification (SEND_PM_NOTIFICATION)
+ *
+ * Sleep over DTIM
+ * bit 2 - '0' PM have to walk up every DTIM
+ * '1' PM could sleep over DTIM till listen Interval.
+ *
+ * PCI power managed
+ * bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1)
+ * '1' !(PCI_CFG_LINK_CTRL & 0x1)
+ *
+ * Fast PD
+ * bit 4 - '1' Put radio to sleep when receiving frame for others
+ *
+ * Force sleep Modes
+ * bit 31/30- '00' use both mac/xtal sleeps
+ * '01' force Mac sleep
+ * '10' force xtal sleep
+ * '11' Illegal set
+ *
+ * NOTE: if sleep_interval[SLEEP_INTRVL_TBL_SIZE-1] > DTIM period then
+ * ucode assume sleep over DTIM is allowed and we don't need to wake up
+ * for every DTIM.
+ */
+#define IL_POWER_VEC_SIZE 5
+
+#define IL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0))
+#define IL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3))
+
+struct il3945_powertable_cmd {
+ __le16 flags;
+ u8 reserved[2];
+ __le32 rx_data_timeout;
+ __le32 tx_data_timeout;
+ __le32 sleep_interval[IL_POWER_VEC_SIZE];
+} __packed;
+
+struct il_powertable_cmd {
+ __le16 flags;
+ u8 keep_alive_seconds; /* 3945 reserved */
+ u8 debug_flags; /* 3945 reserved */
+ __le32 rx_data_timeout;
+ __le32 tx_data_timeout;
+ __le32 sleep_interval[IL_POWER_VEC_SIZE];
+ __le32 keep_alive_beacons;
+} __packed;
+
+/*
+ * N_PM_SLEEP = 0x7A (notification only, not a command)
+ * all devices identical.
+ */
+struct il_sleep_notification {
+ u8 pm_sleep_mode;
+ u8 pm_wakeup_src;
+ __le16 reserved;
+ __le32 sleep_time;
+ __le32 tsf_low;
+ __le32 bcon_timer;
+} __packed;
+
+/* Sleep states. all devices identical. */
+enum {
+ IL_PM_NO_SLEEP = 0,
+ IL_PM_SLP_MAC = 1,
+ IL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
+ IL_PM_SLP_FULL_MAC_CARD_STATE = 3,
+ IL_PM_SLP_PHY = 4,
+ IL_PM_SLP_REPENT = 5,
+ IL_PM_WAKEUP_BY_TIMER = 6,
+ IL_PM_WAKEUP_BY_DRIVER = 7,
+ IL_PM_WAKEUP_BY_RFKILL = 8,
+ /* 3 reserved */
+ IL_PM_NUM_OF_MODES = 12,
+};
+
+/*
+ * N_CARD_STATE = 0xa1 (notification only, not a command)
+ */
+struct il_card_state_notif {
+ __le32 flags;
+} __packed;
+
+#define HW_CARD_DISABLED 0x01
+#define SW_CARD_DISABLED 0x02
+#define CT_CARD_DISABLED 0x04
+#define RXON_CARD_DISABLED 0x10
+
+struct il_ct_kill_config {
+ __le32 reserved;
+ __le32 critical_temperature_M;
+ __le32 critical_temperature_R;
+} __packed;
+
+/******************************************************************************
+ * (8)
+ * Scan Commands, Responses, Notifications:
+ *
+ *****************************************************************************/
+
+#define SCAN_CHANNEL_TYPE_PASSIVE cpu_to_le32(0)
+#define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1)
+
+/**
+ * struct il_scan_channel - entry in C_SCAN channel table
+ *
+ * One for each channel in the scan list.
+ * Each channel can independently select:
+ * 1) SSID for directed active scans
+ * 2) Txpower setting (for rate specified within Tx command)
+ * 3) How long to stay on-channel (behavior may be modified by quiet_time,
+ * quiet_plcp_th, good_CRC_th)
+ *
+ * To avoid uCode errors, make sure the following are true (see comments
+ * under struct il_scan_cmd about max_out_time and quiet_time):
+ * 1) If using passive_dwell (i.e. passive_dwell != 0):
+ * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
+ * 2) quiet_time <= active_dwell
+ * 3) If restricting off-channel time (i.e. max_out_time !=0):
+ * passive_dwell < max_out_time
+ * active_dwell < max_out_time
+ */
+struct il3945_scan_channel {
+ /*
+ * type is defined as:
+ * 0:0 1 = active, 0 = passive
+ * 1:4 SSID direct bit map; if a bit is set, then corresponding
+ * SSID IE is transmitted in probe request.
+ * 5:7 reserved
+ */
+ u8 type;
+ u8 channel; /* band is selected by il3945_scan_cmd "flags" field */
+ struct il3945_tx_power tpc;
+ __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
+ __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
+} __packed;
+
+/* set number of direct probes u8 type */
+#define IL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1))))
+
+struct il_scan_channel {
+ /*
+ * type is defined as:
+ * 0:0 1 = active, 0 = passive
+ * 1:20 SSID direct bit map; if a bit is set, then corresponding
+ * SSID IE is transmitted in probe request.
+ * 21:31 reserved
+ */
+ __le32 type;
+ __le16 channel; /* band is selected by il_scan_cmd "flags" field */
+ u8 tx_gain; /* gain for analog radio */
+ u8 dsp_atten; /* gain for DSP */
+ __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
+ __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
+} __packed;
+
+/* set number of direct probes __le32 type */
+#define IL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1))))
+
+/**
+ * struct il_ssid_ie - directed scan network information element
+ *
+ * Up to 20 of these may appear in C_SCAN (Note: Only 4 are in
+ * 3945 SCAN api), selected by "type" bit field in struct il_scan_channel;
+ * each channel may select different ssids from among the 20 (4) entries.
+ * SSID IEs get transmitted in reverse order of entry.
+ */
+struct il_ssid_ie {
+ u8 id;
+ u8 len;
+ u8 ssid[32];
+} __packed;
+
+#define PROBE_OPTION_MAX_3945 4
+#define PROBE_OPTION_MAX 20
+#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF)
+#define IL_GOOD_CRC_TH_DISABLED 0
+#define IL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
+#define IL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff)
+#define IL_MAX_SCAN_SIZE 1024
+#define IL_MAX_CMD_SIZE 4096
+
+/*
+ * C_SCAN = 0x80 (command)
+ *
+ * The hardware scan command is very powerful; the driver can set it up to
+ * maintain (relatively) normal network traffic while doing a scan in the
+ * background. The max_out_time and suspend_time control the ratio of how
+ * long the device stays on an associated network channel ("service channel")
+ * vs. how long it's away from the service channel, i.e. tuned to other channels
+ * for scanning.
+ *
+ * max_out_time is the max time off-channel (in usec), and suspend_time
+ * is how long (in "extended beacon" format) that the scan is "suspended"
+ * after returning to the service channel. That is, suspend_time is the
+ * time that we stay on the service channel, doing normal work, between
+ * scan segments. The driver may set these parameters differently to support
+ * scanning when associated vs. not associated, and light vs. heavy traffic
+ * loads when associated.
+ *
+ * After receiving this command, the device's scan engine does the following;
+ *
+ * 1) Sends SCAN_START notification to driver
+ * 2) Checks to see if it has time to do scan for one channel
+ * 3) Sends NULL packet, with power-save (PS) bit set to 1,
+ * to tell AP that we're going off-channel
+ * 4) Tunes to first channel in scan list, does active or passive scan
+ * 5) Sends SCAN_RESULT notification to driver
+ * 6) Checks to see if it has time to do scan on *next* channel in list
+ * 7) Repeats 4-6 until it no longer has time to scan the next channel
+ * before max_out_time expires
+ * 8) Returns to service channel
+ * 9) Sends NULL packet with PS=0 to tell AP that we're back
+ * 10) Stays on service channel until suspend_time expires
+ * 11) Repeats entire process 2-10 until list is complete
+ * 12) Sends SCAN_COMPLETE notification
+ *
+ * For fast, efficient scans, the scan command also has support for staying on
+ * a channel for just a short time, if doing active scanning and getting no
+ * responses to the transmitted probe request. This time is controlled by
+ * quiet_time, and the number of received packets below which a channel is
+ * considered "quiet" is controlled by quiet_plcp_threshold.
+ *
+ * For active scanning on channels that have regulatory restrictions against
+ * blindly transmitting, the scan can listen before transmitting, to make sure
+ * that there is already legitimate activity on the channel. If enough
+ * packets are cleanly received on the channel (controlled by good_CRC_th,
+ * typical value 1), the scan engine starts transmitting probe requests.
+ *
+ * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
+ *
+ * To avoid uCode errors, see timing restrictions described under
+ * struct il_scan_channel.
+ */
+
+struct il3945_scan_cmd {
+ __le16 len;
+ u8 reserved0;
+ u8 channel_count; /* # channels in channel list */
+ __le16 quiet_time; /* dwell only this # millisecs on quiet channel
+ * (only for active scan) */
+ __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
+ __le16 good_CRC_th; /* passive -> active promotion threshold */
+ __le16 reserved1;
+ __le32 max_out_time; /* max usec to be away from associated (service)
+ * channel */
+ __le32 suspend_time; /* pause scan this long (in "extended beacon
+ * format") when returning to service channel:
+ * 3945; 31:24 # beacons, 19:0 additional usec,
+ * 4965; 31:22 # beacons, 21:0 additional usec.
+ */
+ __le32 flags; /* RXON_FLG_* */
+ __le32 filter_flags; /* RXON_FILTER_* */
+
+ /* For active scans (set to all-0s for passive scans).
+ * Does not include payload. Must specify Tx rate; no rate scaling. */
+ struct il3945_tx_cmd tx_cmd;
+
+ /* For directed active scans (set to all-0s otherwise) */
+ struct il_ssid_ie direct_scan[PROBE_OPTION_MAX_3945];
+
+ /*
+ * Probe request frame, followed by channel list.
+ *
+ * Size of probe request frame is specified by byte count in tx_cmd.
+ * Channel list follows immediately after probe request frame.
+ * Number of channels in list is specified by channel_count.
+ * Each channel in list is of type:
+ *
+ * struct il3945_scan_channel channels[0];
+ *
+ * NOTE: Only one band of channels can be scanned per pass. You
+ * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
+ * for one scan to complete (i.e. receive N_SCAN_COMPLETE)
+ * before requesting another scan.
+ */
+ u8 data[0];
+} __packed;
+
+struct il_scan_cmd {
+ __le16 len;
+ u8 reserved0;
+ u8 channel_count; /* # channels in channel list */
+ __le16 quiet_time; /* dwell only this # millisecs on quiet channel
+ * (only for active scan) */
+ __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
+ __le16 good_CRC_th; /* passive -> active promotion threshold */
+ __le16 rx_chain; /* RXON_RX_CHAIN_* */
+ __le32 max_out_time; /* max usec to be away from associated (service)
+ * channel */
+ __le32 suspend_time; /* pause scan this long (in "extended beacon
+ * format") when returning to service chnl:
+ * 3945; 31:24 # beacons, 19:0 additional usec,
+ * 4965; 31:22 # beacons, 21:0 additional usec.
+ */
+ __le32 flags; /* RXON_FLG_* */
+ __le32 filter_flags; /* RXON_FILTER_* */
+
+ /* For active scans (set to all-0s for passive scans).
+ * Does not include payload. Must specify Tx rate; no rate scaling. */
+ struct il_tx_cmd tx_cmd;
+
+ /* For directed active scans (set to all-0s otherwise) */
+ struct il_ssid_ie direct_scan[PROBE_OPTION_MAX];
+
+ /*
+ * Probe request frame, followed by channel list.
+ *
+ * Size of probe request frame is specified by byte count in tx_cmd.
+ * Channel list follows immediately after probe request frame.
+ * Number of channels in list is specified by channel_count.
+ * Each channel in list is of type:
+ *
+ * struct il_scan_channel channels[0];
+ *
+ * NOTE: Only one band of channels can be scanned per pass. You
+ * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
+ * for one scan to complete (i.e. receive N_SCAN_COMPLETE)
+ * before requesting another scan.
+ */
+ u8 data[0];
+} __packed;
+
+/* Can abort will notify by complete notification with abort status. */
+#define CAN_ABORT_STATUS cpu_to_le32(0x1)
+/* complete notification statuses */
+#define ABORT_STATUS 0x2
+
+/*
+ * C_SCAN = 0x80 (response)
+ */
+struct il_scanreq_notification {
+ __le32 status; /* 1: okay, 2: cannot fulfill request */
+} __packed;
+
+/*
+ * N_SCAN_START = 0x82 (notification only, not a command)
+ */
+struct il_scanstart_notification {
+ __le32 tsf_low;
+ __le32 tsf_high;
+ __le32 beacon_timer;
+ u8 channel;
+ u8 band;
+ u8 reserved[2];
+ __le32 status;
+} __packed;
+
+#define SCAN_OWNER_STATUS 0x1
+#define MEASURE_OWNER_STATUS 0x2
+
+#define IL_PROBE_STATUS_OK 0
+#define IL_PROBE_STATUS_TX_FAILED BIT(0)
+/* error statuses combined with TX_FAILED */
+#define IL_PROBE_STATUS_FAIL_TTL BIT(1)
+#define IL_PROBE_STATUS_FAIL_BT BIT(2)
+
+#define NUMBER_OF_STATS 1 /* first __le32 is good CRC */
+/*
+ * N_SCAN_RESULTS = 0x83 (notification only, not a command)
+ */
+struct il_scanresults_notification {
+ u8 channel;
+ u8 band;
+ u8 probe_status;
+ u8 num_probe_not_sent; /* not enough time to send */
+ __le32 tsf_low;
+ __le32 tsf_high;
+ __le32 stats[NUMBER_OF_STATS];
+} __packed;
+
+/*
+ * N_SCAN_COMPLETE = 0x84 (notification only, not a command)
+ */
+struct il_scancomplete_notification {
+ u8 scanned_channels;
+ u8 status;
+ u8 last_channel;
+ __le32 tsf_low;
+ __le32 tsf_high;
+} __packed;
+
+
+/******************************************************************************
+ * (9)
+ * IBSS/AP Commands and Notifications:
+ *
+ *****************************************************************************/
+
+enum il_ibss_manager {
+ IL_NOT_IBSS_MANAGER = 0,
+ IL_IBSS_MANAGER = 1,
+};
+
+/*
+ * N_BEACON = 0x90 (notification only, not a command)
+ */
+
+struct il3945_beacon_notif {
+ struct il3945_tx_resp beacon_notify_hdr;
+ __le32 low_tsf;
+ __le32 high_tsf;
+ __le32 ibss_mgr_status;
+} __packed;
+
+struct il4965_beacon_notif {
+ struct il4965_tx_resp beacon_notify_hdr;
+ __le32 low_tsf;
+ __le32 high_tsf;
+ __le32 ibss_mgr_status;
+} __packed;
+
+/*
+ * C_TX_BEACON= 0x91 (command, has simple generic response)
+ */
+
+struct il3945_tx_beacon_cmd {
+ struct il3945_tx_cmd tx;
+ __le16 tim_idx;
+ u8 tim_size;
+ u8 reserved1;
+ struct ieee80211_hdr frame[0]; /* beacon frame */
+} __packed;
+
+struct il_tx_beacon_cmd {
+ struct il_tx_cmd tx;
+ __le16 tim_idx;
+ u8 tim_size;
+ u8 reserved1;
+ struct ieee80211_hdr frame[0]; /* beacon frame */
+} __packed;
+
+/******************************************************************************
+ * (10)
+ * Statistics Commands and Notifications:
+ *
+ *****************************************************************************/
+
+#define IL_TEMP_CONVERT 260
+
+#define SUP_RATE_11A_MAX_NUM_CHANNELS 8
+#define SUP_RATE_11B_MAX_NUM_CHANNELS 4
+#define SUP_RATE_11G_MAX_NUM_CHANNELS 12
+
+/* Used for passing to driver number of successes and failures per rate */
+struct rate_histogram {
+ union {
+ __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
+ __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
+ __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
+ } success;
+ union {
+ __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
+ __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
+ __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
+ } failed;
+} __packed;
+
+/* stats command response */
+
+struct iwl39_stats_rx_phy {
+ __le32 ina_cnt;
+ __le32 fina_cnt;
+ __le32 plcp_err;
+ __le32 crc32_err;
+ __le32 overrun_err;
+ __le32 early_overrun_err;
+ __le32 crc32_good;
+ __le32 false_alarm_cnt;
+ __le32 fina_sync_err_cnt;
+ __le32 sfd_timeout;
+ __le32 fina_timeout;
+ __le32 unresponded_rts;
+ __le32 rxe_frame_limit_overrun;
+ __le32 sent_ack_cnt;
+ __le32 sent_cts_cnt;
+} __packed;
+
+struct iwl39_stats_rx_non_phy {
+ __le32 bogus_cts; /* CTS received when not expecting CTS */
+ __le32 bogus_ack; /* ACK received when not expecting ACK */
+ __le32 non_bssid_frames; /* number of frames with BSSID that
+ * doesn't belong to the STA BSSID */
+ __le32 filtered_frames; /* count frames that were dumped in the
+ * filtering process */
+ __le32 non_channel_beacons; /* beacons with our bss id but not on
+ * our serving channel */
+} __packed;
+
+struct iwl39_stats_rx {
+ struct iwl39_stats_rx_phy ofdm;
+ struct iwl39_stats_rx_phy cck;
+ struct iwl39_stats_rx_non_phy general;
+} __packed;
+
+struct iwl39_stats_tx {
+ __le32 preamble_cnt;
+ __le32 rx_detected_cnt;
+ __le32 bt_prio_defer_cnt;
+ __le32 bt_prio_kill_cnt;
+ __le32 few_bytes_cnt;
+ __le32 cts_timeout;
+ __le32 ack_timeout;
+ __le32 expected_ack_cnt;
+ __le32 actual_ack_cnt;
+} __packed;
+
+struct stats_dbg {
+ __le32 burst_check;
+ __le32 burst_count;
+ __le32 wait_for_silence_timeout_cnt;
+ __le32 reserved[3];
+} __packed;
+
+struct iwl39_stats_div {
+ __le32 tx_on_a;
+ __le32 tx_on_b;
+ __le32 exec_time;
+ __le32 probe_time;
+} __packed;
+
+struct iwl39_stats_general {
+ __le32 temperature;
+ struct stats_dbg dbg;
+ __le32 sleep_time;
+ __le32 slots_out;
+ __le32 slots_idle;
+ __le32 ttl_timestamp;
+ struct iwl39_stats_div div;
+} __packed;
+
+struct stats_rx_phy {
+ __le32 ina_cnt;
+ __le32 fina_cnt;
+ __le32 plcp_err;
+ __le32 crc32_err;
+ __le32 overrun_err;
+ __le32 early_overrun_err;
+ __le32 crc32_good;
+ __le32 false_alarm_cnt;
+ __le32 fina_sync_err_cnt;
+ __le32 sfd_timeout;
+ __le32 fina_timeout;
+ __le32 unresponded_rts;
+ __le32 rxe_frame_limit_overrun;
+ __le32 sent_ack_cnt;
+ __le32 sent_cts_cnt;
+ __le32 sent_ba_rsp_cnt;
+ __le32 dsp_self_kill;
+ __le32 mh_format_err;
+ __le32 re_acq_main_rssi_sum;
+ __le32 reserved3;
+} __packed;
+
+struct stats_rx_ht_phy {
+ __le32 plcp_err;
+ __le32 overrun_err;
+ __le32 early_overrun_err;
+ __le32 crc32_good;
+ __le32 crc32_err;
+ __le32 mh_format_err;
+ __le32 agg_crc32_good;
+ __le32 agg_mpdu_cnt;
+ __le32 agg_cnt;
+ __le32 unsupport_mcs;
+} __packed;
+
+#define INTERFERENCE_DATA_AVAILABLE cpu_to_le32(1)
+
+struct stats_rx_non_phy {
+ __le32 bogus_cts; /* CTS received when not expecting CTS */
+ __le32 bogus_ack; /* ACK received when not expecting ACK */
+ __le32 non_bssid_frames; /* number of frames with BSSID that
+ * doesn't belong to the STA BSSID */
+ __le32 filtered_frames; /* count frames that were dumped in the
+ * filtering process */
+ __le32 non_channel_beacons; /* beacons with our bss id but not on
+ * our serving channel */
+ __le32 channel_beacons; /* beacons with our bss id and in our
+ * serving channel */
+ __le32 num_missed_bcon; /* number of missed beacons */
+ __le32 adc_rx_saturation_time; /* count in 0.8us units the time the
+ * ADC was in saturation */
+ __le32 ina_detection_search_time;/* total time (in 0.8us) searched
+ * for INA */
+ __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */
+ __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */
+ __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */
+ __le32 interference_data_flag; /* flag for interference data
+ * availability. 1 when data is
+ * available. */
+ __le32 channel_load; /* counts RX Enable time in uSec */
+ __le32 dsp_false_alarms; /* DSP false alarm (both OFDM
+ * and CCK) counter */
+ __le32 beacon_rssi_a;
+ __le32 beacon_rssi_b;
+ __le32 beacon_rssi_c;
+ __le32 beacon_energy_a;
+ __le32 beacon_energy_b;
+ __le32 beacon_energy_c;
+} __packed;
+
+struct stats_rx {
+ struct stats_rx_phy ofdm;
+ struct stats_rx_phy cck;
+ struct stats_rx_non_phy general;
+ struct stats_rx_ht_phy ofdm_ht;
+} __packed;
+
+/**
+ * struct stats_tx_power - current tx power
+ *
+ * @ant_a: current tx power on chain a in 1/2 dB step
+ * @ant_b: current tx power on chain b in 1/2 dB step
+ * @ant_c: current tx power on chain c in 1/2 dB step
+ */
+struct stats_tx_power {
+ u8 ant_a;
+ u8 ant_b;
+ u8 ant_c;
+ u8 reserved;
+} __packed;
+
+struct stats_tx_non_phy_agg {
+ __le32 ba_timeout;
+ __le32 ba_reschedule_frames;
+ __le32 scd_query_agg_frame_cnt;
+ __le32 scd_query_no_agg;
+ __le32 scd_query_agg;
+ __le32 scd_query_mismatch;
+ __le32 frame_not_ready;
+ __le32 underrun;
+ __le32 bt_prio_kill;
+ __le32 rx_ba_rsp_cnt;
+} __packed;
+
+struct stats_tx {
+ __le32 preamble_cnt;
+ __le32 rx_detected_cnt;
+ __le32 bt_prio_defer_cnt;
+ __le32 bt_prio_kill_cnt;
+ __le32 few_bytes_cnt;
+ __le32 cts_timeout;
+ __le32 ack_timeout;
+ __le32 expected_ack_cnt;
+ __le32 actual_ack_cnt;
+ __le32 dump_msdu_cnt;
+ __le32 burst_abort_next_frame_mismatch_cnt;
+ __le32 burst_abort_missing_next_frame_cnt;
+ __le32 cts_timeout_collision;
+ __le32 ack_or_ba_timeout_collision;
+ struct stats_tx_non_phy_agg agg;
+
+ __le32 reserved1;
+} __packed;
+
+
+struct stats_div {
+ __le32 tx_on_a;
+ __le32 tx_on_b;
+ __le32 exec_time;
+ __le32 probe_time;
+ __le32 reserved1;
+ __le32 reserved2;
+} __packed;
+
+struct stats_general_common {
+ __le32 temperature; /* radio temperature */
+ struct stats_dbg dbg;
+ __le32 sleep_time;
+ __le32 slots_out;
+ __le32 slots_idle;
+ __le32 ttl_timestamp;
+ struct stats_div div;
+ __le32 rx_enable_counter;
+ /*
+ * num_of_sos_states:
+ * count the number of times we have to re-tune
+ * in order to get out of bad PHY status
+ */
+ __le32 num_of_sos_states;
+} __packed;
+
+struct stats_general {
+ struct stats_general_common common;
+ __le32 reserved2;
+ __le32 reserved3;
+} __packed;
+
+#define UCODE_STATS_CLEAR_MSK (0x1 << 0)
+#define UCODE_STATS_FREQUENCY_MSK (0x1 << 1)
+#define UCODE_STATS_NARROW_BAND_MSK (0x1 << 2)
+
+/*
+ * C_STATS = 0x9c,
+ * all devices identical.
+ *
+ * This command triggers an immediate response containing uCode stats.
+ * The response is in the same format as N_STATS 0x9d, below.
+ *
+ * If the CLEAR_STATS configuration flag is set, uCode will clear its
+ * internal copy of the stats (counters) after issuing the response.
+ * This flag does not affect N_STATSs after beacons (see below).
+ *
+ * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
+ * N_STATSs after received beacons (see below). This flag
+ * does not affect the response to the C_STATS 0x9c itself.
+ */
+#define IL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */
+#define IL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */
+struct il_stats_cmd {
+ __le32 configuration_flags; /* IL_STATS_CONF_* */
+} __packed;
+
+/*
+ * N_STATS = 0x9d (notification only, not a command)
+ *
+ * By default, uCode issues this notification after receiving a beacon
+ * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
+ * C_STATS 0x9c, above.
+ *
+ * Statistics counters continue to increment beacon after beacon, but are
+ * cleared when changing channels or when driver issues C_STATS
+ * 0x9c with CLEAR_STATS bit set (see above).
+ *
+ * uCode also issues this notification during scans. uCode clears stats
+ * appropriately so that each notification contains stats for only the
+ * one channel that has just been scanned.
+ */
+#define STATS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2)
+#define STATS_REPLY_FLG_HT40_MODE_MSK cpu_to_le32(0x8)
+
+struct il3945_notif_stats {
+ __le32 flag;
+ struct iwl39_stats_rx rx;
+ struct iwl39_stats_tx tx;
+ struct iwl39_stats_general general;
+} __packed;
+
+struct il_notif_stats {
+ __le32 flag;
+ struct stats_rx rx;
+ struct stats_tx tx;
+ struct stats_general general;
+} __packed;
+
+/*
+ * N_MISSED_BEACONS = 0xa2 (notification only, not a command)
+ *
+ * uCode send N_MISSED_BEACONS to driver when detect beacon missed
+ * in regardless of how many missed beacons, which mean when driver receive the
+ * notification, inside the command, it can find all the beacons information
+ * which include number of total missed beacons, number of consecutive missed
+ * beacons, number of beacons received and number of beacons expected to
+ * receive.
+ *
+ * If uCode detected consecutive_missed_beacons > 5, it will reset the radio
+ * in order to bring the radio/PHY back to working state; which has no relation
+ * to when driver will perform sensitivity calibration.
+ *
+ * Driver should set it own missed_beacon_threshold to decide when to perform
+ * sensitivity calibration based on number of consecutive missed beacons in
+ * order to improve overall performance, especially in noisy environment.
+ *
+ */
+
+#define IL_MISSED_BEACON_THRESHOLD_MIN (1)
+#define IL_MISSED_BEACON_THRESHOLD_DEF (5)
+#define IL_MISSED_BEACON_THRESHOLD_MAX IL_MISSED_BEACON_THRESHOLD_DEF
+
+struct il_missed_beacon_notif {
+ __le32 consecutive_missed_beacons;
+ __le32 total_missed_becons;
+ __le32 num_expected_beacons;
+ __le32 num_recvd_beacons;
+} __packed;
+
+
+/******************************************************************************
+ * (11)
+ * Rx Calibration Commands:
+ *
+ * With the uCode used for open source drivers, most Tx calibration (except
+ * for Tx Power) and most Rx calibration is done by uCode during the
+ * "initialize" phase of uCode boot. Driver must calibrate only:
+ *
+ * 1) Tx power (depends on temperature), described elsewhere
+ * 2) Receiver gain balance (optimize MIMO, and detect disconnected antennas)
+ * 3) Receiver sensitivity (to optimize signal detection)
+ *
+ *****************************************************************************/
+
+/**
+ * C_SENSITIVITY = 0xa8 (command, has simple generic response)
+ *
+ * This command sets up the Rx signal detector for a sensitivity level that
+ * is high enough to lock onto all signals within the associated network,
+ * but low enough to ignore signals that are below a certain threshold, so as
+ * not to have too many "false alarms". False alarms are signals that the
+ * Rx DSP tries to lock onto, but then discards after determining that they
+ * are noise.
+ *
+ * The optimum number of false alarms is between 5 and 50 per 200 TUs
+ * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e.
+ * time listening, not transmitting). Driver must adjust sensitivity so that
+ * the ratio of actual false alarms to actual Rx time falls within this range.
+ *
+ * While associated, uCode delivers N_STATSs after each
+ * received beacon. These provide information to the driver to analyze the
+ * sensitivity. Don't analyze stats that come in from scanning, or any
+ * other non-associated-network source. Pertinent stats include:
+ *
+ * From "general" stats (struct stats_rx_non_phy):
+ *
+ * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level)
+ * Measure of energy of desired signal. Used for establishing a level
+ * below which the device does not detect signals.
+ *
+ * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB)
+ * Measure of background noise in silent period after beacon.
+ *
+ * channel_load
+ * uSecs of actual Rx time during beacon period (varies according to
+ * how much time was spent transmitting).
+ *
+ * From "cck" and "ofdm" stats (struct stats_rx_phy), separately:
+ *
+ * false_alarm_cnt
+ * Signal locks abandoned early (before phy-level header).
+ *
+ * plcp_err
+ * Signal locks abandoned late (during phy-level header).
+ *
+ * NOTE: Both false_alarm_cnt and plcp_err increment monotonically from
+ * beacon to beacon, i.e. each value is an accumulation of all errors
+ * before and including the latest beacon. Values will wrap around to 0
+ * after counting up to 2^32 - 1. Driver must differentiate vs.
+ * previous beacon's values to determine # false alarms in the current
+ * beacon period.
+ *
+ * Total number of false alarms = false_alarms + plcp_errs
+ *
+ * For OFDM, adjust the following table entries in struct il_sensitivity_cmd
+ * (notice that the start points for OFDM are at or close to settings for
+ * maximum sensitivity):
+ *
+ * START / MIN / MAX
+ * HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX 90 / 85 / 120
+ * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX 170 / 170 / 210
+ * HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX 105 / 105 / 140
+ * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX 220 / 220 / 270
+ *
+ * If actual rate of OFDM false alarms (+ plcp_errors) is too high
+ * (greater than 50 for each 204.8 msecs listening), reduce sensitivity
+ * by *adding* 1 to all 4 of the table entries above, up to the max for
+ * each entry. Conversely, if false alarm rate is too low (less than 5
+ * for each 204.8 msecs listening), *subtract* 1 from each entry to
+ * increase sensitivity.
+ *
+ * For CCK sensitivity, keep track of the following:
+ *
+ * 1). 20-beacon history of maximum background noise, indicated by
+ * (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the
+ * 3 receivers. For any given beacon, the "silence reference" is
+ * the maximum of last 60 samples (20 beacons * 3 receivers).
+ *
+ * 2). 10-beacon history of strongest signal level, as indicated
+ * by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers,
+ * i.e. the strength of the signal through the best receiver at the
+ * moment. These measurements are "upside down", with lower values
+ * for stronger signals, so max energy will be *minimum* value.
+ *
+ * Then for any given beacon, the driver must determine the *weakest*
+ * of the strongest signals; this is the minimum level that needs to be
+ * successfully detected, when using the best receiver at the moment.
+ * "Max cck energy" is the maximum (higher value means lower energy!)
+ * of the last 10 minima. Once this is determined, driver must add
+ * a little margin by adding "6" to it.
+ *
+ * 3). Number of consecutive beacon periods with too few false alarms.
+ * Reset this to 0 at the first beacon period that falls within the
+ * "good" range (5 to 50 false alarms per 204.8 milliseconds rx).
+ *
+ * Then, adjust the following CCK table entries in struct il_sensitivity_cmd
+ * (notice that the start points for CCK are at maximum sensitivity):
+ *
+ * START / MIN / MAX
+ * HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX 125 / 125 / 200
+ * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX 200 / 200 / 400
+ * HD_MIN_ENERGY_CCK_DET_IDX 100 / 0 / 100
+ *
+ * If actual rate of CCK false alarms (+ plcp_errors) is too high
+ * (greater than 50 for each 204.8 msecs listening), method for reducing
+ * sensitivity is:
+ *
+ * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX,
+ * up to max 400.
+ *
+ * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX is < 160,
+ * sensitivity has been reduced a significant amount; bring it up to
+ * a moderate 161. Otherwise, *add* 3, up to max 200.
+ *
+ * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX is > 160,
+ * sensitivity has been reduced only a moderate or small amount;
+ * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_IDX,
+ * down to min 0. Otherwise (if gain has been significantly reduced),
+ * don't change the HD_MIN_ENERGY_CCK_DET_IDX value.
+ *
+ * b) Save a snapshot of the "silence reference".
+ *
+ * If actual rate of CCK false alarms (+ plcp_errors) is too low
+ * (less than 5 for each 204.8 msecs listening), method for increasing
+ * sensitivity is used only if:
+ *
+ * 1a) Previous beacon did not have too many false alarms
+ * 1b) AND difference between previous "silence reference" and current
+ * "silence reference" (prev - current) is 2 or more,
+ * OR 2) 100 or more consecutive beacon periods have had rate of
+ * less than 5 false alarms per 204.8 milliseconds rx time.
+ *
+ * Method for increasing sensitivity:
+ *
+ * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX,
+ * down to min 125.
+ *
+ * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX,
+ * down to min 200.
+ *
+ * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_IDX, up to max 100.
+ *
+ * If actual rate of CCK false alarms (+ plcp_errors) is within good range
+ * (between 5 and 50 for each 204.8 msecs listening):
+ *
+ * 1) Save a snapshot of the silence reference.
+ *
+ * 2) If previous beacon had too many CCK false alarms (+ plcp_errors),
+ * give some extra margin to energy threshold by *subtracting* 8
+ * from value in HD_MIN_ENERGY_CCK_DET_IDX.
+ *
+ * For all cases (too few, too many, good range), make sure that the CCK
+ * detection threshold (energy) is below the energy level for robust
+ * detection over the past 10 beacon periods, the "Max cck energy".
+ * Lower values mean higher energy; this means making sure that the value
+ * in HD_MIN_ENERGY_CCK_DET_IDX is at or *above* "Max cck energy".
+ *
+ */
+
+/*
+ * Table entries in C_SENSITIVITY (struct il_sensitivity_cmd)
+ */
+#define HD_TBL_SIZE (11) /* number of entries */
+#define HD_MIN_ENERGY_CCK_DET_IDX (0) /* table idxes */
+#define HD_MIN_ENERGY_OFDM_DET_IDX (1)
+#define HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX (2)
+#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX (3)
+#define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX (4)
+#define HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX (5)
+#define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX (6)
+#define HD_BARKER_CORR_TH_ADD_MIN_IDX (7)
+#define HD_BARKER_CORR_TH_ADD_MIN_MRC_IDX (8)
+#define HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX (9)
+#define HD_OFDM_ENERGY_TH_IN_IDX (10)
+
+/* Control field in struct il_sensitivity_cmd */
+#define C_SENSITIVITY_CONTROL_DEFAULT_TBL cpu_to_le16(0)
+#define C_SENSITIVITY_CONTROL_WORK_TBL cpu_to_le16(1)
+
+/**
+ * struct il_sensitivity_cmd
+ * @control: (1) updates working table, (0) updates default table
+ * @table: energy threshold values, use HD_* as idx into table
+ *
+ * Always use "1" in "control" to update uCode's working table and DSP.
+ */
+struct il_sensitivity_cmd {
+ __le16 control; /* always use "1" */
+ __le16 table[HD_TBL_SIZE]; /* use HD_* as idx */
+} __packed;
+
+
+/**
+ * C_PHY_CALIBRATION = 0xb0 (command, has simple generic response)
+ *
+ * This command sets the relative gains of 4965 device's 3 radio receiver chains.
+ *
+ * After the first association, driver should accumulate signal and noise
+ * stats from the N_STATSs that follow the first 20
+ * beacons from the associated network (don't collect stats that come
+ * in from scanning, or any other non-network source).
+ *
+ * DISCONNECTED ANTENNA:
+ *
+ * Driver should determine which antennas are actually connected, by comparing
+ * average beacon signal levels for the 3 Rx chains. Accumulate (add) the
+ * following values over 20 beacons, one accumulator for each of the chains
+ * a/b/c, from struct stats_rx_non_phy:
+ *
+ * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB)
+ *
+ * Find the strongest signal from among a/b/c. Compare the other two to the
+ * strongest. If any signal is more than 15 dB (times 20, unless you
+ * divide the accumulated values by 20) below the strongest, the driver
+ * considers that antenna to be disconnected, and should not try to use that
+ * antenna/chain for Rx or Tx. If both A and B seem to be disconnected,
+ * driver should declare the stronger one as connected, and attempt to use it
+ * (A and B are the only 2 Tx chains!).
+ *
+ *
+ * RX BALANCE:
+ *
+ * Driver should balance the 3 receivers (but just the ones that are connected
+ * to antennas, see above) for gain, by comparing the average signal levels
+ * detected during the silence after each beacon (background noise).
+ * Accumulate (add) the following values over 20 beacons, one accumulator for
+ * each of the chains a/b/c, from struct stats_rx_non_phy:
+ *
+ * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB)
+ *
+ * Find the weakest background noise level from among a/b/c. This Rx chain
+ * will be the reference, with 0 gain adjustment. Attenuate other channels by
+ * finding noise difference:
+ *
+ * (accum_noise[i] - accum_noise[reference]) / 30
+ *
+ * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB.
+ * For use in diff_gain_[abc] fields of struct il_calibration_cmd, the
+ * driver should limit the difference results to a range of 0-3 (0-4.5 dB),
+ * and set bit 2 to indicate "reduce gain". The value for the reference
+ * (weakest) chain should be "0".
+ *
+ * diff_gain_[abc] bit fields:
+ * 2: (1) reduce gain, (0) increase gain
+ * 1-0: amount of gain, units of 1.5 dB
+ */
+
+/* Phy calibration command for series */
+/* The default calibrate table size if not specified by firmware */
+#define IL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE 18
+enum {
+ IL_PHY_CALIBRATE_DIFF_GAIN_CMD = 7,
+ IL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 19,
+};
+
+#define IL_MAX_PHY_CALIBRATE_TBL_SIZE (253)
+
+struct il_calib_hdr {
+ u8 op_code;
+ u8 first_group;
+ u8 groups_num;
+ u8 data_valid;
+} __packed;
+
+/* IL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */
+struct il_calib_diff_gain_cmd {
+ struct il_calib_hdr hdr;
+ s8 diff_gain_a; /* see above */
+ s8 diff_gain_b;
+ s8 diff_gain_c;
+ u8 reserved1;
+} __packed;
+
+/******************************************************************************
+ * (12)
+ * Miscellaneous Commands:
+ *
+ *****************************************************************************/
+
+/*
+ * LEDs Command & Response
+ * C_LEDS = 0x48 (command, has simple generic response)
+ *
+ * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
+ * this command turns it on or off, or sets up a periodic blinking cycle.
+ */
+struct il_led_cmd {
+ __le32 interval; /* "interval" in uSec */
+ u8 id; /* 1: Activity, 2: Link, 3: Tech */
+ u8 off; /* # intervals off while blinking;
+ * "0", with >0 "on" value, turns LED on */
+ u8 on; /* # intervals on while blinking;
+ * "0", regardless of "off", turns LED off */
+ u8 reserved;
+} __packed;
+
+
+/******************************************************************************
+ * (13)
+ * Union of all expected notifications/responses:
+ *
+ *****************************************************************************/
+
+struct il_rx_pkt {
+ /*
+ * The first 4 bytes of the RX frame header contain both the RX frame
+ * size and some flags.
+ * Bit fields:
+ * 31: flag flush RB request
+ * 30: flag ignore TC (terminal counter) request
+ * 29: flag fast IRQ request
+ * 28-14: Reserved
+ * 13-00: RX frame size
+ */
+ __le32 len_n_flags;
+ struct il_cmd_header hdr;
+ union {
+ struct il3945_rx_frame rx_frame;
+ struct il3945_tx_resp tx_resp;
+ struct il3945_beacon_notif beacon_status;
+
+ struct il_alive_resp alive_frame;
+ struct il_spectrum_notification spectrum_notif;
+ struct il_csa_notification csa_notif;
+ struct il_error_resp err_resp;
+ struct il_card_state_notif card_state_notif;
+ struct il_add_sta_resp add_sta;
+ struct il_rem_sta_resp rem_sta;
+ struct il_sleep_notification sleep_notif;
+ struct il_spectrum_resp spectrum;
+ struct il_notif_stats stats;
+ struct il_compressed_ba_resp compressed_ba;
+ struct il_missed_beacon_notif missed_beacon;
+ __le32 status;
+ u8 raw[0];
+ } u;
+} __packed;
+
+#endif /* __il_commands_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-commands.h b/drivers/net/wireless/iwlegacy/iwl-commands.h
deleted file mode 100644
index 8df4d25..0000000
--- a/drivers/net/wireless/iwlegacy/iwl-commands.h
+++ /dev/null
@@ -1,3398 +0,0 @@
-/******************************************************************************
- *
- * This file is provided under a dual BSD/GPLv2 license. When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
- * USA
- *
- * The full GNU General Public License is included in this distribution
- * in the file called LICENSE.GPL.
- *
- * Contact Information:
- * Intel Linux Wireless <[email protected]>
- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
- *
- * BSD LICENSE
- *
- * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *****************************************************************************/
-/*
- * Please use this file (iwl-commands.h) only for uCode API definitions.
- * Please use iwl-xxxx-hw.h for hardware-related definitions.
- * Please use iwl-dev.h for driver implementation definitions.
- */
-
-#ifndef __il_commands_h__
-#define __il_commands_h__
-
-struct il_priv;
-
-/* uCode version contains 4 values: Major/Minor/API/Serial */
-#define IL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24)
-#define IL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16)
-#define IL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8)
-#define IL_UCODE_SERIAL(ver) ((ver) & 0x000000FF)
-
-
-/* Tx rates */
-#define IL_CCK_RATES 4
-#define IL_OFDM_RATES 8
-#define IL_MAX_RATES (IL_CCK_RATES + IL_OFDM_RATES)
-
-enum {
- N_ALIVE = 0x1,
- N_ERROR = 0x2,
-
- /* RXON and QOS commands */
- C_RXON = 0x10,
- C_RXON_ASSOC = 0x11,
- C_QOS_PARAM = 0x13,
- C_RXON_TIMING = 0x14,
-
- /* Multi-Station support */
- C_ADD_STA = 0x18,
- C_REM_STA = 0x19,
-
- /* Security */
- C_WEPKEY = 0x20,
-
- /* RX, TX, LEDs */
- N_3945_RX = 0x1b, /* 3945 only */
- C_TX = 0x1c,
- C_RATE_SCALE = 0x47, /* 3945 only */
- C_LEDS = 0x48,
- C_TX_LINK_QUALITY_CMD = 0x4e, /* for 4965 */
-
- /* 802.11h related */
- C_CHANNEL_SWITCH = 0x72,
- N_CHANNEL_SWITCH = 0x73,
- C_SPECTRUM_MEASUREMENT = 0x74,
- N_SPECTRUM_MEASUREMENT = 0x75,
-
- /* Power Management */
- C_POWER_TBL = 0x77,
- N_PM_SLEEP = 0x7A,
- N_PM_DEBUG_STATS = 0x7B,
-
- /* Scan commands and notifications */
- C_SCAN = 0x80,
- C_SCAN_ABORT = 0x81,
- N_SCAN_START = 0x82,
- N_SCAN_RESULTS = 0x83,
- N_SCAN_COMPLETE = 0x84,
-
- /* IBSS/AP commands */
- N_BEACON = 0x90,
- C_TX_BEACON= 0x91,
-
- /* Miscellaneous commands */
- C_TX_PWR_TBL = 0x97,
-
- /* Bluetooth device coexistence config command */
- C_BT_CONFIG = 0x9b,
-
- /* Statistics */
- C_STATS = 0x9c,
- N_STATS = 0x9d,
-
- /* RF-KILL commands and notifications */
- N_CARD_STATE = 0xa1,
-
- /* Missed beacons notification */
- N_MISSED_BEACONS = 0xa2,
-
- C_CT_KILL_CONFIG = 0xa4,
- C_SENSITIVITY = 0xa8,
- C_PHY_CALIBRATION = 0xb0,
- N_RX_PHY = 0xc0,
- N_RX_MPDU = 0xc1,
- N_RX = 0xc3,
- N_COMPRESSED_BA = 0xc5,
-
- IL_CN_MAX = 0xff
-};
-
-/******************************************************************************
- * (0)
- * Commonly used structures and definitions:
- * Command header, rate_n_flags, txpower
- *
- *****************************************************************************/
-
-/* il_cmd_header flags value */
-#define IL_CMD_FAILED_MSK 0x40
-
-#define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f)
-#define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8)
-#define SEQ_TO_IDX(s) ((s) & 0xff)
-#define IDX_TO_SEQ(i) ((i) & 0xff)
-#define SEQ_HUGE_FRAME cpu_to_le16(0x4000)
-#define SEQ_RX_FRAME cpu_to_le16(0x8000)
-
-/**
- * struct il_cmd_header
- *
- * This header format appears in the beginning of each command sent from the
- * driver, and each response/notification received from uCode.
- */
-struct il_cmd_header {
- u8 cmd; /* Command ID: C_RXON, etc. */
- u8 flags; /* 0:5 reserved, 6 abort, 7 internal */
- /*
- * The driver sets up the sequence number to values of its choosing.
- * uCode does not use this value, but passes it back to the driver
- * when sending the response to each driver-originated command, so
- * the driver can match the response to the command. Since the values
- * don't get used by uCode, the driver may set up an arbitrary format.
- *
- * There is one exception: uCode sets bit 15 when it originates
- * the response/notification, i.e. when the response/notification
- * is not a direct response to a command sent by the driver. For
- * example, uCode issues N_3945_RX when it sends a received frame
- * to the driver; it is not a direct response to any driver command.
- *
- * The Linux driver uses the following format:
- *
- * 0:7 tfd idx - position within TX queue
- * 8:12 TX queue id
- * 13 reserved
- * 14 huge - driver sets this to indicate command is in the
- * 'huge' storage at the end of the command buffers
- * 15 unsolicited RX or uCode-originated notification
- */
- __le16 sequence;
-
- /* command or response/notification data follows immediately */
- u8 data[0];
-} __packed;
-
-
-/**
- * struct il3945_tx_power
- *
- * Used in C_TX_PWR_TBL, C_SCAN, C_CHANNEL_SWITCH
- *
- * Each entry contains two values:
- * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained
- * linear value that multiplies the output of the digital signal processor,
- * before being sent to the analog radio.
- * 2) Radio gain. This sets the analog gain of the radio Tx path.
- * It is a coarser setting, and behaves in a logarithmic (dB) fashion.
- *
- * Driver obtains values from struct il3945_tx_power power_gain_table[][].
- */
-struct il3945_tx_power {
- u8 tx_gain; /* gain for analog radio */
- u8 dsp_atten; /* gain for DSP */
-} __packed;
-
-/**
- * struct il3945_power_per_rate
- *
- * Used in C_TX_PWR_TBL, C_CHANNEL_SWITCH
- */
-struct il3945_power_per_rate {
- u8 rate; /* plcp */
- struct il3945_tx_power tpc;
- u8 reserved;
-} __packed;
-
-/**
- * iwl4965 rate_n_flags bit fields
- *
- * rate_n_flags format is used in following iwl4965 commands:
- * N_RX (response only)
- * N_RX_MPDU (response only)
- * C_TX (both command and response)
- * C_TX_LINK_QUALITY_CMD
- *
- * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"):
- * 2-0: 0) 6 Mbps
- * 1) 12 Mbps
- * 2) 18 Mbps
- * 3) 24 Mbps
- * 4) 36 Mbps
- * 5) 48 Mbps
- * 6) 54 Mbps
- * 7) 60 Mbps
- *
- * 4-3: 0) Single stream (SISO)
- * 1) Dual stream (MIMO)
- * 2) Triple stream (MIMO)
- *
- * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data
- *
- * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"):
- * 3-0: 0xD) 6 Mbps
- * 0xF) 9 Mbps
- * 0x5) 12 Mbps
- * 0x7) 18 Mbps
- * 0x9) 24 Mbps
- * 0xB) 36 Mbps
- * 0x1) 48 Mbps
- * 0x3) 54 Mbps
- *
- * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"):
- * 6-0: 10) 1 Mbps
- * 20) 2 Mbps
- * 55) 5.5 Mbps
- * 110) 11 Mbps
- */
-#define RATE_MCS_CODE_MSK 0x7
-#define RATE_MCS_SPATIAL_POS 3
-#define RATE_MCS_SPATIAL_MSK 0x18
-#define RATE_MCS_HT_DUP_POS 5
-#define RATE_MCS_HT_DUP_MSK 0x20
-
-/* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */
-#define RATE_MCS_FLAGS_POS 8
-#define RATE_MCS_HT_POS 8
-#define RATE_MCS_HT_MSK 0x100
-
-/* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */
-#define RATE_MCS_CCK_POS 9
-#define RATE_MCS_CCK_MSK 0x200
-
-/* Bit 10: (1) Use Green Field preamble */
-#define RATE_MCS_GF_POS 10
-#define RATE_MCS_GF_MSK 0x400
-
-/* Bit 11: (1) Use 40Mhz HT40 chnl width, (0) use 20 MHz legacy chnl width */
-#define RATE_MCS_HT40_POS 11
-#define RATE_MCS_HT40_MSK 0x800
-
-/* Bit 12: (1) Duplicate data on both 20MHz chnls. HT40 (bit 11) must be set. */
-#define RATE_MCS_DUP_POS 12
-#define RATE_MCS_DUP_MSK 0x1000
-
-/* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */
-#define RATE_MCS_SGI_POS 13
-#define RATE_MCS_SGI_MSK 0x2000
-
-/**
- * rate_n_flags Tx antenna masks
- * 4965 has 2 transmitters
- * bit14:16
- */
-#define RATE_MCS_ANT_POS 14
-#define RATE_MCS_ANT_A_MSK 0x04000
-#define RATE_MCS_ANT_B_MSK 0x08000
-#define RATE_MCS_ANT_C_MSK 0x10000
-#define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK)
-#define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK)
-#define RATE_ANT_NUM 3
-
-#define POWER_TBL_NUM_ENTRIES 33
-#define POWER_TBL_NUM_HT_OFDM_ENTRIES 32
-#define POWER_TBL_CCK_ENTRY 32
-
-#define IL_PWR_NUM_HT_OFDM_ENTRIES 24
-#define IL_PWR_CCK_ENTRIES 2
-
-/**
- * union il4965_tx_power_dual_stream
- *
- * Host format used for C_TX_PWR_TBL, C_CHANNEL_SWITCH
- * Use __le32 version (struct tx_power_dual_stream) when building command.
- *
- * Driver provides radio gain and DSP attenuation settings to device in pairs,
- * one value for each transmitter chain. The first value is for transmitter A,
- * second for transmitter B.
- *
- * For SISO bit rates, both values in a pair should be identical.
- * For MIMO rates, one value may be different from the other,
- * in order to balance the Tx output between the two transmitters.
- *
- * See more details in doc for TXPOWER in 4965.h.
- */
-union il4965_tx_power_dual_stream {
- struct {
- u8 radio_tx_gain[2];
- u8 dsp_predis_atten[2];
- } s;
- u32 dw;
-};
-
-/**
- * struct tx_power_dual_stream
- *
- * Table entries in C_TX_PWR_TBL, C_CHANNEL_SWITCH
- *
- * Same format as il_tx_power_dual_stream, but __le32
- */
-struct tx_power_dual_stream {
- __le32 dw;
-} __packed;
-
-/**
- * struct il4965_tx_power_db
- *
- * Entire table within C_TX_PWR_TBL, C_CHANNEL_SWITCH
- */
-struct il4965_tx_power_db {
- struct tx_power_dual_stream power_tbl[POWER_TBL_NUM_ENTRIES];
-} __packed;
-
-/******************************************************************************
- * (0a)
- * Alive and Error Commands & Responses:
- *
- *****************************************************************************/
-
-#define UCODE_VALID_OK cpu_to_le32(0x1)
-#define INITIALIZE_SUBTYPE (9)
-
-/*
- * ("Initialize") N_ALIVE = 0x1 (response only, not a command)
- *
- * uCode issues this "initialize alive" notification once the initialization
- * uCode image has completed its work, and is ready to load the runtime image.
- * This is the *first* "alive" notification that the driver will receive after
- * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
- *
- * See comments documenting "BSM" (bootstrap state machine).
- *
- * For 4965, this notification contains important calibration data for
- * calculating txpower settings:
- *
- * 1) Power supply voltage indication. The voltage sensor outputs higher
- * values for lower voltage, and vice verse.
- *
- * 2) Temperature measurement parameters, for each of two channel widths
- * (20 MHz and 40 MHz) supported by the radios. Temperature sensing
- * is done via one of the receiver chains, and channel width influences
- * the results.
- *
- * 3) Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation,
- * for each of 5 frequency ranges.
- */
-struct il_init_alive_resp {
- u8 ucode_minor;
- u8 ucode_major;
- __le16 reserved1;
- u8 sw_rev[8];
- u8 ver_type;
- u8 ver_subtype; /* "9" for initialize alive */
- __le16 reserved2;
- __le32 log_event_table_ptr;
- __le32 error_event_table_ptr;
- __le32 timestamp;
- __le32 is_valid;
-
- /* calibration values from "initialize" uCode */
- __le32 voltage; /* signed, higher value is lower voltage */
- __le32 therm_r1[2]; /* signed, 1st for normal, 2nd for HT40 */
- __le32 therm_r2[2]; /* signed */
- __le32 therm_r3[2]; /* signed */
- __le32 therm_r4[2]; /* signed */
- __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups,
- * 2 Tx chains */
-} __packed;
-
-
-/**
- * N_ALIVE = 0x1 (response only, not a command)
- *
- * uCode issues this "alive" notification once the runtime image is ready
- * to receive commands from the driver. This is the *second* "alive"
- * notification that the driver will receive after rebooting uCode;
- * this "alive" is indicated by subtype field != 9.
- *
- * See comments documenting "BSM" (bootstrap state machine).
- *
- * This response includes two pointers to structures within the device's
- * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
- *
- * 1) log_event_table_ptr indicates base of the event log. This traces
- * a 256-entry history of uCode execution within a circular buffer.
- * Its header format is:
- *
- * __le32 log_size; log capacity (in number of entries)
- * __le32 type; (1) timestamp with each entry, (0) no timestamp
- * __le32 wraps; # times uCode has wrapped to top of circular buffer
- * __le32 write_idx; next circular buffer entry that uCode would fill
- *
- * The header is followed by the circular buffer of log entries. Entries
- * with timestamps have the following format:
- *
- * __le32 event_id; range 0 - 1500
- * __le32 timestamp; low 32 bits of TSF (of network, if associated)
- * __le32 data; event_id-specific data value
- *
- * Entries without timestamps contain only event_id and data.
- *
- *
- * 2) error_event_table_ptr indicates base of the error log. This contains
- * information about any uCode error that occurs. For 4965, the format
- * of the error log is:
- *
- * __le32 valid; (nonzero) valid, (0) log is empty
- * __le32 error_id; type of error
- * __le32 pc; program counter
- * __le32 blink1; branch link
- * __le32 blink2; branch link
- * __le32 ilink1; interrupt link
- * __le32 ilink2; interrupt link
- * __le32 data1; error-specific data
- * __le32 data2; error-specific data
- * __le32 line; source code line of error
- * __le32 bcon_time; beacon timer
- * __le32 tsf_low; network timestamp function timer
- * __le32 tsf_hi; network timestamp function timer
- * __le32 gp1; GP1 timer register
- * __le32 gp2; GP2 timer register
- * __le32 gp3; GP3 timer register
- * __le32 ucode_ver; uCode version
- * __le32 hw_ver; HW Silicon version
- * __le32 brd_ver; HW board version
- * __le32 log_pc; log program counter
- * __le32 frame_ptr; frame pointer
- * __le32 stack_ptr; stack pointer
- * __le32 hcmd; last host command
- * __le32 isr0; isr status register LMPM_NIC_ISR0: rxtx_flag
- * __le32 isr1; isr status register LMPM_NIC_ISR1: host_flag
- * __le32 isr2; isr status register LMPM_NIC_ISR2: enc_flag
- * __le32 isr3; isr status register LMPM_NIC_ISR3: time_flag
- * __le32 isr4; isr status register LMPM_NIC_ISR4: wico interrupt
- * __le32 isr_pref; isr status register LMPM_NIC_PREF_STAT
- * __le32 wait_event; wait event() caller address
- * __le32 l2p_control; L2pControlField
- * __le32 l2p_duration; L2pDurationField
- * __le32 l2p_mhvalid; L2pMhValidBits
- * __le32 l2p_addr_match; L2pAddrMatchStat
- * __le32 lmpm_pmg_sel; indicate which clocks are turned on (LMPM_PMG_SEL)
- * __le32 u_timestamp; indicate when the date and time of the compilation
- * __le32 reserved;
- *
- * The Linux driver can print both logs to the system log when a uCode error
- * occurs.
- */
-struct il_alive_resp {
- u8 ucode_minor;
- u8 ucode_major;
- __le16 reserved1;
- u8 sw_rev[8];
- u8 ver_type;
- u8 ver_subtype; /* not "9" for runtime alive */
- __le16 reserved2;
- __le32 log_event_table_ptr; /* SRAM address for event log */
- __le32 error_event_table_ptr; /* SRAM address for error log */
- __le32 timestamp;
- __le32 is_valid;
-} __packed;
-
-/*
- * N_ERROR = 0x2 (response only, not a command)
- */
-struct il_error_resp {
- __le32 error_type;
- u8 cmd_id;
- u8 reserved1;
- __le16 bad_cmd_seq_num;
- __le32 error_info;
- __le64 timestamp;
-} __packed;
-
-/******************************************************************************
- * (1)
- * RXON Commands & Responses:
- *
- *****************************************************************************/
-
-/*
- * Rx config defines & structure
- */
-/* rx_config device types */
-enum {
- RXON_DEV_TYPE_AP = 1,
- RXON_DEV_TYPE_ESS = 3,
- RXON_DEV_TYPE_IBSS = 4,
- RXON_DEV_TYPE_SNIFFER = 6,
-};
-
-
-#define RXON_RX_CHAIN_DRIVER_FORCE_MSK cpu_to_le16(0x1 << 0)
-#define RXON_RX_CHAIN_DRIVER_FORCE_POS (0)
-#define RXON_RX_CHAIN_VALID_MSK cpu_to_le16(0x7 << 1)
-#define RXON_RX_CHAIN_VALID_POS (1)
-#define RXON_RX_CHAIN_FORCE_SEL_MSK cpu_to_le16(0x7 << 4)
-#define RXON_RX_CHAIN_FORCE_SEL_POS (4)
-#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK cpu_to_le16(0x7 << 7)
-#define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
-#define RXON_RX_CHAIN_CNT_MSK cpu_to_le16(0x3 << 10)
-#define RXON_RX_CHAIN_CNT_POS (10)
-#define RXON_RX_CHAIN_MIMO_CNT_MSK cpu_to_le16(0x3 << 12)
-#define RXON_RX_CHAIN_MIMO_CNT_POS (12)
-#define RXON_RX_CHAIN_MIMO_FORCE_MSK cpu_to_le16(0x1 << 14)
-#define RXON_RX_CHAIN_MIMO_FORCE_POS (14)
-
-/* rx_config flags */
-/* band & modulation selection */
-#define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0)
-#define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1)
-/* auto detection enable */
-#define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2)
-/* TGg protection when tx */
-#define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3)
-/* cck short slot & preamble */
-#define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4)
-#define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5)
-/* antenna selection */
-#define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7)
-#define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00)
-#define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
-#define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
-/* radar detection enable */
-#define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12)
-#define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13)
-/* rx response to host with 8-byte TSF
-* (according to ON_AIR deassertion) */
-#define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15)
-
-
-/* HT flags */
-#define RXON_FLG_CTRL_CHANNEL_LOC_POS (22)
-#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK cpu_to_le32(0x1 << 22)
-
-#define RXON_FLG_HT_OPERATING_MODE_POS (23)
-
-#define RXON_FLG_HT_PROT_MSK cpu_to_le32(0x1 << 23)
-#define RXON_FLG_HT40_PROT_MSK cpu_to_le32(0x2 << 23)
-
-#define RXON_FLG_CHANNEL_MODE_POS (25)
-#define RXON_FLG_CHANNEL_MODE_MSK cpu_to_le32(0x3 << 25)
-
-/* channel mode */
-enum {
- CHANNEL_MODE_LEGACY = 0,
- CHANNEL_MODE_PURE_40 = 1,
- CHANNEL_MODE_MIXED = 2,
- CHANNEL_MODE_RESERVED = 3,
-};
-#define RXON_FLG_CHANNEL_MODE_LEGACY \
- cpu_to_le32(CHANNEL_MODE_LEGACY << RXON_FLG_CHANNEL_MODE_POS)
-#define RXON_FLG_CHANNEL_MODE_PURE_40 \
- cpu_to_le32(CHANNEL_MODE_PURE_40 << RXON_FLG_CHANNEL_MODE_POS)
-#define RXON_FLG_CHANNEL_MODE_MIXED \
- cpu_to_le32(CHANNEL_MODE_MIXED << RXON_FLG_CHANNEL_MODE_POS)
-
-/* CTS to self (if spec allows) flag */
-#define RXON_FLG_SELF_CTS_EN cpu_to_le32(0x1<<30)
-
-/* rx_config filter flags */
-/* accept all data frames */
-#define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0)
-/* pass control & management to host */
-#define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1)
-/* accept multi-cast */
-#define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2)
-/* don't decrypt uni-cast frames */
-#define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3)
-/* don't decrypt multi-cast frames */
-#define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4)
-/* STA is associated */
-#define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5)
-/* transfer to host non bssid beacons in associated state */
-#define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6)
-
-/**
- * C_RXON = 0x10 (command, has simple generic response)
- *
- * RXON tunes the radio tuner to a service channel, and sets up a number
- * of parameters that are used primarily for Rx, but also for Tx operations.
- *
- * NOTE: When tuning to a new channel, driver must set the
- * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent
- * info within the device, including the station tables, tx retry
- * rate tables, and txpower tables. Driver must build a new station
- * table and txpower table before transmitting anything on the RXON
- * channel.
- *
- * NOTE: All RXONs wipe clean the internal txpower table. Driver must
- * issue a new C_TX_PWR_TBL after each C_RXON (0x10),
- * regardless of whether RXON_FILTER_ASSOC_MSK is set.
- */
-
-struct il3945_rxon_cmd {
- u8 node_addr[6];
- __le16 reserved1;
- u8 bssid_addr[6];
- __le16 reserved2;
- u8 wlap_bssid_addr[6];
- __le16 reserved3;
- u8 dev_type;
- u8 air_propagation;
- __le16 reserved4;
- u8 ofdm_basic_rates;
- u8 cck_basic_rates;
- __le16 assoc_id;
- __le32 flags;
- __le32 filter_flags;
- __le16 channel;
- __le16 reserved5;
-} __packed;
-
-struct il4965_rxon_cmd {
- u8 node_addr[6];
- __le16 reserved1;
- u8 bssid_addr[6];
- __le16 reserved2;
- u8 wlap_bssid_addr[6];
- __le16 reserved3;
- u8 dev_type;
- u8 air_propagation;
- __le16 rx_chain;
- u8 ofdm_basic_rates;
- u8 cck_basic_rates;
- __le16 assoc_id;
- __le32 flags;
- __le32 filter_flags;
- __le16 channel;
- u8 ofdm_ht_single_stream_basic_rates;
- u8 ofdm_ht_dual_stream_basic_rates;
-} __packed;
-
-/* Create a common rxon cmd which will be typecast into the 3945 or 4965
- * specific rxon cmd, depending on where it is called from.
- */
-struct il_rxon_cmd {
- u8 node_addr[6];
- __le16 reserved1;
- u8 bssid_addr[6];
- __le16 reserved2;
- u8 wlap_bssid_addr[6];
- __le16 reserved3;
- u8 dev_type;
- u8 air_propagation;
- __le16 rx_chain;
- u8 ofdm_basic_rates;
- u8 cck_basic_rates;
- __le16 assoc_id;
- __le32 flags;
- __le32 filter_flags;
- __le16 channel;
- u8 ofdm_ht_single_stream_basic_rates;
- u8 ofdm_ht_dual_stream_basic_rates;
- u8 reserved4;
- u8 reserved5;
-} __packed;
-
-
-/*
- * C_RXON_ASSOC = 0x11 (command, has simple generic response)
- */
-struct il3945_rxon_assoc_cmd {
- __le32 flags;
- __le32 filter_flags;
- u8 ofdm_basic_rates;
- u8 cck_basic_rates;
- __le16 reserved;
-} __packed;
-
-struct il4965_rxon_assoc_cmd {
- __le32 flags;
- __le32 filter_flags;
- u8 ofdm_basic_rates;
- u8 cck_basic_rates;
- u8 ofdm_ht_single_stream_basic_rates;
- u8 ofdm_ht_dual_stream_basic_rates;
- __le16 rx_chain_select_flags;
- __le16 reserved;
-} __packed;
-
-#define IL_CONN_MAX_LISTEN_INTERVAL 10
-#define IL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */
-#define IL39_MAX_UCODE_BEACON_INTERVAL 1 /* 1024 */
-
-/*
- * C_RXON_TIMING = 0x14 (command, has simple generic response)
- */
-struct il_rxon_time_cmd {
- __le64 timestamp;
- __le16 beacon_interval;
- __le16 atim_win;
- __le32 beacon_init_val;
- __le16 listen_interval;
- u8 dtim_period;
- u8 delta_cp_bss_tbtts;
-} __packed;
-
-/*
- * C_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
- */
-struct il3945_channel_switch_cmd {
- u8 band;
- u8 expect_beacon;
- __le16 channel;
- __le32 rxon_flags;
- __le32 rxon_filter_flags;
- __le32 switch_time;
- struct il3945_power_per_rate power[IL_MAX_RATES];
-} __packed;
-
-struct il4965_channel_switch_cmd {
- u8 band;
- u8 expect_beacon;
- __le16 channel;
- __le32 rxon_flags;
- __le32 rxon_filter_flags;
- __le32 switch_time;
- struct il4965_tx_power_db tx_power;
-} __packed;
-
-/*
- * N_CHANNEL_SWITCH = 0x73 (notification only, not a command)
- */
-struct il_csa_notification {
- __le16 band;
- __le16 channel;
- __le32 status; /* 0 - OK, 1 - fail */
-} __packed;
-
-/******************************************************************************
- * (2)
- * Quality-of-Service (QOS) Commands & Responses:
- *
- *****************************************************************************/
-
-/**
- * struct il_ac_qos -- QOS timing params for C_QOS_PARAM
- * One for each of 4 EDCA access categories in struct il_qosparam_cmd
- *
- * @cw_min: Contention win, start value in numbers of slots.
- * Should be a power-of-2, minus 1. Device's default is 0x0f.
- * @cw_max: Contention win, max value in numbers of slots.
- * Should be a power-of-2, minus 1. Device's default is 0x3f.
- * @aifsn: Number of slots in Arbitration Interframe Space (before
- * performing random backoff timing prior to Tx). Device default 1.
- * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0.
- *
- * Device will automatically increase contention win by (2*CW) + 1 for each
- * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW
- * value, to cap the CW value.
- */
-struct il_ac_qos {
- __le16 cw_min;
- __le16 cw_max;
- u8 aifsn;
- u8 reserved1;
- __le16 edca_txop;
-} __packed;
-
-/* QoS flags defines */
-#define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01)
-#define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02)
-#define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10)
-
-/* Number of Access Categories (AC) (EDCA), queues 0..3 */
-#define AC_NUM 4
-
-/*
- * C_QOS_PARAM = 0x13 (command, has simple generic response)
- *
- * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs
- * 0: Background, 1: Best Effort, 2: Video, 3: Voice.
- */
-struct il_qosparam_cmd {
- __le32 qos_flags;
- struct il_ac_qos ac[AC_NUM];
-} __packed;
-
-/******************************************************************************
- * (3)
- * Add/Modify Stations Commands & Responses:
- *
- *****************************************************************************/
-/*
- * Multi station support
- */
-
-/* Special, dedicated locations within device's station table */
-#define IL_AP_ID 0
-#define IL_STA_ID 2
-#define IL3945_BROADCAST_ID 24
-#define IL3945_STATION_COUNT 25
-#define IL4965_BROADCAST_ID 31
-#define IL4965_STATION_COUNT 32
-
-#define IL_STATION_COUNT 32 /* MAX(3945,4965)*/
-#define IL_INVALID_STATION 255
-
-#define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2)
-#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8)
-#define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17)
-#define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18)
-#define STA_FLG_MAX_AGG_SIZE_POS (19)
-#define STA_FLG_MAX_AGG_SIZE_MSK cpu_to_le32(3 << 19)
-#define STA_FLG_HT40_EN_MSK cpu_to_le32(1 << 21)
-#define STA_FLG_MIMO_DIS_MSK cpu_to_le32(1 << 22)
-#define STA_FLG_AGG_MPDU_DENSITY_POS (23)
-#define STA_FLG_AGG_MPDU_DENSITY_MSK cpu_to_le32(7 << 23)
-
-/* Use in mode field. 1: modify existing entry, 0: add new station entry */
-#define STA_CONTROL_MODIFY_MSK 0x01
-
-/* key flags __le16*/
-#define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007)
-#define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000)
-#define STA_KEY_FLG_WEP cpu_to_le16(0x0001)
-#define STA_KEY_FLG_CCMP cpu_to_le16(0x0002)
-#define STA_KEY_FLG_TKIP cpu_to_le16(0x0003)
-
-#define STA_KEY_FLG_KEYID_POS 8
-#define STA_KEY_FLG_INVALID cpu_to_le16(0x0800)
-/* wep key is either from global key (0) or from station info array (1) */
-#define STA_KEY_FLG_MAP_KEY_MSK cpu_to_le16(0x0008)
-
-/* wep key in STA: 5-bytes (0) or 13-bytes (1) */
-#define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000)
-#define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000)
-#define STA_KEY_MAX_NUM 8
-
-/* Flags indicate whether to modify vs. don't change various station params */
-#define STA_MODIFY_KEY_MASK 0x01
-#define STA_MODIFY_TID_DISABLE_TX 0x02
-#define STA_MODIFY_TX_RATE_MSK 0x04
-#define STA_MODIFY_ADDBA_TID_MSK 0x08
-#define STA_MODIFY_DELBA_TID_MSK 0x10
-#define STA_MODIFY_SLEEP_TX_COUNT_MSK 0x20
-
-/* Receiver address (actually, Rx station's idx into station table),
- * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */
-#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
-
-struct il4965_keyinfo {
- __le16 key_flags;
- u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
- u8 reserved1;
- __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
- u8 key_offset;
- u8 reserved2;
- u8 key[16]; /* 16-byte unicast decryption key */
-} __packed;
-
-/**
- * struct sta_id_modify
- * @addr[ETH_ALEN]: station's MAC address
- * @sta_id: idx of station in uCode's station table
- * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change
- *
- * Driver selects unused table idx when adding new station,
- * or the idx to a pre-existing station entry when modifying that station.
- * Some idxes have special purposes (IL_AP_ID, idx 0, is for AP).
- *
- * modify_mask flags select which parameters to modify vs. leave alone.
- */
-struct sta_id_modify {
- u8 addr[ETH_ALEN];
- __le16 reserved1;
- u8 sta_id;
- u8 modify_mask;
- __le16 reserved2;
-} __packed;
-
-/*
- * C_ADD_STA = 0x18 (command)
- *
- * The device contains an internal table of per-station information,
- * with info on security keys, aggregation parameters, and Tx rates for
- * initial Tx attempt and any retries (4965 devices uses
- * C_TX_LINK_QUALITY_CMD,
- * 3945 uses C_RATE_SCALE to set up rate tables).
- *
- * C_ADD_STA sets up the table entry for one station, either creating
- * a new entry, or modifying a pre-existing one.
- *
- * NOTE: RXON command (without "associated" bit set) wipes the station table
- * clean. Moving into RF_KILL state does this also. Driver must set up
- * new station table before transmitting anything on the RXON channel
- * (except active scans or active measurements; those commands carry
- * their own txpower/rate setup data).
- *
- * When getting started on a new channel, driver must set up the
- * IL_BROADCAST_ID entry (last entry in the table). For a client
- * station in a BSS, once an AP is selected, driver sets up the AP STA
- * in the IL_AP_ID entry (1st entry in the table). BROADCAST and AP
- * are all that are needed for a BSS client station. If the device is
- * used as AP, or in an IBSS network, driver must set up station table
- * entries for all STAs in network, starting with idx IL_STA_ID.
- */
-
-struct il3945_addsta_cmd {
- u8 mode; /* 1: modify existing, 0: add new station */
- u8 reserved[3];
- struct sta_id_modify sta;
- struct il4965_keyinfo key;
- __le32 station_flags; /* STA_FLG_* */
- __le32 station_flags_msk; /* STA_FLG_* */
-
- /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
- * corresponding to bit (e.g. bit 5 controls TID 5).
- * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
- __le16 tid_disable_tx;
-
- __le16 rate_n_flags;
-
- /* TID for which to add block-ack support.
- * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
- u8 add_immediate_ba_tid;
-
- /* TID for which to remove block-ack support.
- * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
- u8 remove_immediate_ba_tid;
-
- /* Starting Sequence Number for added block-ack support.
- * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
- __le16 add_immediate_ba_ssn;
-} __packed;
-
-struct il4965_addsta_cmd {
- u8 mode; /* 1: modify existing, 0: add new station */
- u8 reserved[3];
- struct sta_id_modify sta;
- struct il4965_keyinfo key;
- __le32 station_flags; /* STA_FLG_* */
- __le32 station_flags_msk; /* STA_FLG_* */
-
- /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
- * corresponding to bit (e.g. bit 5 controls TID 5).
- * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
- __le16 tid_disable_tx;
-
- __le16 reserved1;
-
- /* TID for which to add block-ack support.
- * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
- u8 add_immediate_ba_tid;
-
- /* TID for which to remove block-ack support.
- * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
- u8 remove_immediate_ba_tid;
-
- /* Starting Sequence Number for added block-ack support.
- * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
- __le16 add_immediate_ba_ssn;
-
- /*
- * Number of packets OK to transmit to station even though
- * it is asleep -- used to synchronise PS-poll and u-APSD
- * responses while ucode keeps track of STA sleep state.
- */
- __le16 sleep_tx_count;
-
- __le16 reserved2;
-} __packed;
-
-/* Wrapper struct for 3945 and 4965 addsta_cmd structures */
-struct il_addsta_cmd {
- u8 mode; /* 1: modify existing, 0: add new station */
- u8 reserved[3];
- struct sta_id_modify sta;
- struct il4965_keyinfo key;
- __le32 station_flags; /* STA_FLG_* */
- __le32 station_flags_msk; /* STA_FLG_* */
-
- /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
- * corresponding to bit (e.g. bit 5 controls TID 5).
- * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
- __le16 tid_disable_tx;
-
- __le16 rate_n_flags; /* 3945 only */
-
- /* TID for which to add block-ack support.
- * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
- u8 add_immediate_ba_tid;
-
- /* TID for which to remove block-ack support.
- * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
- u8 remove_immediate_ba_tid;
-
- /* Starting Sequence Number for added block-ack support.
- * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
- __le16 add_immediate_ba_ssn;
-
- /*
- * Number of packets OK to transmit to station even though
- * it is asleep -- used to synchronise PS-poll and u-APSD
- * responses while ucode keeps track of STA sleep state.
- */
- __le16 sleep_tx_count;
-
- __le16 reserved2;
-} __packed;
-
-
-#define ADD_STA_SUCCESS_MSK 0x1
-#define ADD_STA_NO_ROOM_IN_TBL 0x2
-#define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4
-#define ADD_STA_MODIFY_NON_EXIST_STA 0x8
-/*
- * C_ADD_STA = 0x18 (response)
- */
-struct il_add_sta_resp {
- u8 status; /* ADD_STA_* */
-} __packed;
-
-#define REM_STA_SUCCESS_MSK 0x1
-/*
- * C_REM_STA = 0x19 (response)
- */
-struct il_rem_sta_resp {
- u8 status;
-} __packed;
-
-/*
- * C_REM_STA = 0x19 (command)
- */
-struct il_rem_sta_cmd {
- u8 num_sta; /* number of removed stations */
- u8 reserved[3];
- u8 addr[ETH_ALEN]; /* MAC addr of the first station */
- u8 reserved2[2];
-} __packed;
-
-#define IL_TX_FIFO_BK_MSK cpu_to_le32(BIT(0))
-#define IL_TX_FIFO_BE_MSK cpu_to_le32(BIT(1))
-#define IL_TX_FIFO_VI_MSK cpu_to_le32(BIT(2))
-#define IL_TX_FIFO_VO_MSK cpu_to_le32(BIT(3))
-#define IL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00)
-
-#define IL_DROP_SINGLE 0
-#define IL_DROP_SELECTED 1
-#define IL_DROP_ALL 2
-
-/*
- * REPLY_WEP_KEY = 0x20
- */
-struct il_wep_key {
- u8 key_idx;
- u8 key_offset;
- u8 reserved1[2];
- u8 key_size;
- u8 reserved2[3];
- u8 key[16];
-} __packed;
-
-struct il_wep_cmd {
- u8 num_keys;
- u8 global_key_type;
- u8 flags;
- u8 reserved;
- struct il_wep_key key[0];
-} __packed;
-
-#define WEP_KEY_WEP_TYPE 1
-#define WEP_KEYS_MAX 4
-#define WEP_INVALID_OFFSET 0xff
-#define WEP_KEY_LEN_64 5
-#define WEP_KEY_LEN_128 13
-
-/******************************************************************************
- * (4)
- * Rx Responses:
- *
- *****************************************************************************/
-
-#define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0)
-#define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1)
-
-#define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0)
-#define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1)
-#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2)
-#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3)
-#define RX_RES_PHY_FLAGS_ANTENNA_MSK 0xf0
-#define RX_RES_PHY_FLAGS_ANTENNA_POS 4
-
-#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
-#define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
-#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
-#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
-#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
-#define RX_RES_STATUS_SEC_TYPE_ERR (0x7 << 8)
-
-#define RX_RES_STATUS_STATION_FOUND (1<<6)
-#define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7)
-
-#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
-#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
-#define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
-#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
-#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
-
-#define RX_MPDU_RES_STATUS_ICV_OK (0x20)
-#define RX_MPDU_RES_STATUS_MIC_OK (0x40)
-#define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7)
-#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800)
-
-
-struct il3945_rx_frame_stats {
- u8 phy_count;
- u8 id;
- u8 rssi;
- u8 agc;
- __le16 sig_avg;
- __le16 noise_diff;
- u8 payload[0];
-} __packed;
-
-struct il3945_rx_frame_hdr {
- __le16 channel;
- __le16 phy_flags;
- u8 reserved1;
- u8 rate;
- __le16 len;
- u8 payload[0];
-} __packed;
-
-struct il3945_rx_frame_end {
- __le32 status;
- __le64 timestamp;
- __le32 beacon_timestamp;
-} __packed;
-
-/*
- * N_3945_RX = 0x1b (response only, not a command)
- *
- * NOTE: DO NOT dereference from casts to this structure
- * It is provided only for calculating minimum data set size.
- * The actual offsets of the hdr and end are dynamic based on
- * stats.phy_count
- */
-struct il3945_rx_frame {
- struct il3945_rx_frame_stats stats;
- struct il3945_rx_frame_hdr hdr;
- struct il3945_rx_frame_end end;
-} __packed;
-
-#define IL39_RX_FRAME_SIZE (4 + sizeof(struct il3945_rx_frame))
-
-/* Fixed (non-configurable) rx data from phy */
-
-#define IL49_RX_RES_PHY_CNT 14
-#define IL49_RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
-#define IL49_RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
-#define IL49_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
-#define IL49_AGC_DB_POS (7)
-struct il4965_rx_non_cfg_phy {
- __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
- __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
- u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
- u8 pad[0];
-} __packed;
-
-
-/*
- * N_RX = 0xc3 (response only, not a command)
- * Used only for legacy (non 11n) frames.
- */
-struct il_rx_phy_res {
- u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
- u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
- u8 stat_id; /* configurable DSP phy data set ID */
- u8 reserved1;
- __le64 timestamp; /* TSF at on air rise */
- __le32 beacon_time_stamp; /* beacon at on-air rise */
- __le16 phy_flags; /* general phy flags: band, modulation, ... */
- __le16 channel; /* channel number */
- u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */
- __le32 rate_n_flags; /* RATE_MCS_* */
- __le16 byte_count; /* frame's byte-count */
- __le16 frame_time; /* frame's time on the air */
-} __packed;
-
-struct il_rx_mpdu_res_start {
- __le16 byte_count;
- __le16 reserved;
-} __packed;
-
-
-/******************************************************************************
- * (5)
- * Tx Commands & Responses:
- *
- * Driver must place each C_TX command into one of the prioritized Tx
- * queues in host DRAM, shared between driver and device (see comments for
- * SCD registers and Tx/Rx Queues). When the device's Tx scheduler and uCode
- * are preparing to transmit, the device pulls the Tx command over the PCI
- * bus via one of the device's Tx DMA channels, to fill an internal FIFO
- * from which data will be transmitted.
- *
- * uCode handles all timing and protocol related to control frames
- * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler
- * handle reception of block-acks; uCode updates the host driver via
- * N_COMPRESSED_BA.
- *
- * uCode handles retrying Tx when an ACK is expected but not received.
- * This includes trying lower data rates than the one requested in the Tx
- * command, as set up by the C_RATE_SCALE (for 3945) or
- * C_TX_LINK_QUALITY_CMD (4965).
- *
- * Driver sets up transmit power for various rates via C_TX_PWR_TBL.
- * This command must be executed after every RXON command, before Tx can occur.
- *****************************************************************************/
-
-/* C_TX Tx flags field */
-
-/*
- * 1: Use Request-To-Send protocol before this frame.
- * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK.
- */
-#define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1)
-
-/*
- * 1: Transmit Clear-To-Send to self before this frame.
- * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
- * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK.
- */
-#define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2)
-
-/* 1: Expect ACK from receiving station
- * 0: Don't expect ACK (MAC header's duration field s/b 0)
- * Set this for unicast frames, but not broadcast/multicast. */
-#define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3)
-
-/* For 4965 devices:
- * 1: Use rate scale table (see C_TX_LINK_QUALITY_CMD).
- * Tx command's initial_rate_idx indicates first rate to try;
- * uCode walks through table for additional Tx attempts.
- * 0: Use Tx rate/MCS from Tx command's rate_n_flags field.
- * This rate will be used for all Tx attempts; it will not be scaled. */
-#define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4)
-
-/* 1: Expect immediate block-ack.
- * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */
-#define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6)
-
-/*
- * 1: Frame requires full Tx-Op protection.
- * Set this if either RTS or CTS Tx Flag gets set.
- */
-#define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7)
-
-/* Tx antenna selection field; used only for 3945, reserved (0) for 4965 devices.
- * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */
-#define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00)
-#define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
-#define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
-
-/* 1: uCode overrides sequence control field in MAC header.
- * 0: Driver provides sequence control field in MAC header.
- * Set this for management frames, non-QOS data frames, non-unicast frames,
- * and also in Tx command embedded in C_SCAN for active scans. */
-#define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13)
-
-/* 1: This frame is non-last MPDU; more fragments are coming.
- * 0: Last fragment, or not using fragmentation. */
-#define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14)
-
-/* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame.
- * 0: No TSF required in outgoing frame.
- * Set this for transmitting beacons and probe responses. */
-#define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16)
-
-/* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword
- * alignment of frame's payload data field.
- * 0: No pad
- * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4
- * field (but not both). Driver must align frame data (i.e. data following
- * MAC header) to DWORD boundary. */
-#define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20)
-
-/* accelerate aggregation support
- * 0 - no CCMP encryption; 1 - CCMP encryption */
-#define TX_CMD_FLG_AGG_CCMP_MSK cpu_to_le32(1 << 22)
-
-/* HCCA-AP - disable duration overwriting. */
-#define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25)
-
-
-/*
- * TX command security control
- */
-#define TX_CMD_SEC_WEP 0x01
-#define TX_CMD_SEC_CCM 0x02
-#define TX_CMD_SEC_TKIP 0x03
-#define TX_CMD_SEC_MSK 0x03
-#define TX_CMD_SEC_SHIFT 6
-#define TX_CMD_SEC_KEY128 0x08
-
-/*
- * security overhead sizes
- */
-#define WEP_IV_LEN 4
-#define WEP_ICV_LEN 4
-#define CCMP_MIC_LEN 8
-#define TKIP_ICV_LEN 4
-
-/*
- * C_TX = 0x1c (command)
- */
-
-struct il3945_tx_cmd {
- /*
- * MPDU byte count:
- * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
- * + 8 byte IV for CCM or TKIP (not used for WEP)
- * + Data payload
- * + 8-byte MIC (not used for CCM/WEP)
- * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
- * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
- * Range: 14-2342 bytes.
- */
- __le16 len;
-
- /*
- * MPDU or MSDU byte count for next frame.
- * Used for fragmentation and bursting, but not 11n aggregation.
- * Same as "len", but for next frame. Set to 0 if not applicable.
- */
- __le16 next_frame_len;
-
- __le32 tx_flags; /* TX_CMD_FLG_* */
-
- u8 rate;
-
- /* Index of recipient station in uCode's station table */
- u8 sta_id;
- u8 tid_tspec;
- u8 sec_ctl;
- u8 key[16];
- union {
- u8 byte[8];
- __le16 word[4];
- __le32 dw[2];
- } tkip_mic;
- __le32 next_frame_info;
- union {
- __le32 life_time;
- __le32 attempt;
- } stop_time;
- u8 supp_rates[2];
- u8 rts_retry_limit; /*byte 50 */
- u8 data_retry_limit; /*byte 51 */
- union {
- __le16 pm_frame_timeout;
- __le16 attempt_duration;
- } timeout;
-
- /*
- * Duration of EDCA burst Tx Opportunity, in 32-usec units.
- * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
- */
- __le16 driver_txop;
-
- /*
- * MAC header goes here, followed by 2 bytes padding if MAC header
- * length is 26 or 30 bytes, followed by payload data
- */
- u8 payload[0];
- struct ieee80211_hdr hdr[0];
-} __packed;
-
-/*
- * C_TX = 0x1c (response)
- */
-struct il3945_tx_resp {
- u8 failure_rts;
- u8 failure_frame;
- u8 bt_kill_count;
- u8 rate;
- __le32 wireless_media_time;
- __le32 status; /* TX status */
-} __packed;
-
-
-/*
- * 4965 uCode updates these Tx attempt count values in host DRAM.
- * Used for managing Tx retries when expecting block-acks.
- * Driver should set these fields to 0.
- */
-struct il_dram_scratch {
- u8 try_cnt; /* Tx attempts */
- u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */
- __le16 reserved;
-} __packed;
-
-struct il_tx_cmd {
- /*
- * MPDU byte count:
- * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
- * + 8 byte IV for CCM or TKIP (not used for WEP)
- * + Data payload
- * + 8-byte MIC (not used for CCM/WEP)
- * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
- * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
- * Range: 14-2342 bytes.
- */
- __le16 len;
-
- /*
- * MPDU or MSDU byte count for next frame.
- * Used for fragmentation and bursting, but not 11n aggregation.
- * Same as "len", but for next frame. Set to 0 if not applicable.
- */
- __le16 next_frame_len;
-
- __le32 tx_flags; /* TX_CMD_FLG_* */
-
- /* uCode may modify this field of the Tx command (in host DRAM!).
- * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */
- struct il_dram_scratch scratch;
-
- /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */
- __le32 rate_n_flags; /* RATE_MCS_* */
-
- /* Index of destination station in uCode's station table */
- u8 sta_id;
-
- /* Type of security encryption: CCM or TKIP */
- u8 sec_ctl; /* TX_CMD_SEC_* */
-
- /*
- * Index into rate table (see C_TX_LINK_QUALITY_CMD) for initial
- * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set. Normally "0" for
- * data frames, this field may be used to selectively reduce initial
- * rate (via non-0 value) for special frames (e.g. management), while
- * still supporting rate scaling for all frames.
- */
- u8 initial_rate_idx;
- u8 reserved;
- u8 key[16];
- __le16 next_frame_flags;
- __le16 reserved2;
- union {
- __le32 life_time;
- __le32 attempt;
- } stop_time;
-
- /* Host DRAM physical address pointer to "scratch" in this command.
- * Must be dword aligned. "0" in dram_lsb_ptr disables usage. */
- __le32 dram_lsb_ptr;
- u8 dram_msb_ptr;
-
- u8 rts_retry_limit; /*byte 50 */
- u8 data_retry_limit; /*byte 51 */
- u8 tid_tspec;
- union {
- __le16 pm_frame_timeout;
- __le16 attempt_duration;
- } timeout;
-
- /*
- * Duration of EDCA burst Tx Opportunity, in 32-usec units.
- * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
- */
- __le16 driver_txop;
-
- /*
- * MAC header goes here, followed by 2 bytes padding if MAC header
- * length is 26 or 30 bytes, followed by payload data
- */
- u8 payload[0];
- struct ieee80211_hdr hdr[0];
-} __packed;
-
-/* TX command response is sent after *3945* transmission attempts.
- *
- * NOTES:
- *
- * TX_STATUS_FAIL_NEXT_FRAG
- *
- * If the fragment flag in the MAC header for the frame being transmitted
- * is set and there is insufficient time to transmit the next frame, the
- * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
- *
- * TX_STATUS_FIFO_UNDERRUN
- *
- * Indicates the host did not provide bytes to the FIFO fast enough while
- * a TX was in progress.
- *
- * TX_STATUS_FAIL_MGMNT_ABORT
- *
- * This status is only possible if the ABORT ON MGMT RX parameter was
- * set to true with the TX command.
- *
- * If the MSB of the status parameter is set then an abort sequence is
- * required. This sequence consists of the host activating the TX Abort
- * control line, and then waiting for the TX Abort command response. This
- * indicates that a the device is no longer in a transmit state, and that the
- * command FIFO has been cleared. The host must then deactivate the TX Abort
- * control line. Receiving is still allowed in this case.
- */
-enum {
- TX_3945_STATUS_SUCCESS = 0x01,
- TX_3945_STATUS_DIRECT_DONE = 0x02,
- TX_3945_STATUS_FAIL_SHORT_LIMIT = 0x82,
- TX_3945_STATUS_FAIL_LONG_LIMIT = 0x83,
- TX_3945_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
- TX_3945_STATUS_FAIL_MGMNT_ABORT = 0x85,
- TX_3945_STATUS_FAIL_NEXT_FRAG = 0x86,
- TX_3945_STATUS_FAIL_LIFE_EXPIRE = 0x87,
- TX_3945_STATUS_FAIL_DEST_PS = 0x88,
- TX_3945_STATUS_FAIL_ABORTED = 0x89,
- TX_3945_STATUS_FAIL_BT_RETRY = 0x8a,
- TX_3945_STATUS_FAIL_STA_INVALID = 0x8b,
- TX_3945_STATUS_FAIL_FRAG_DROPPED = 0x8c,
- TX_3945_STATUS_FAIL_TID_DISABLE = 0x8d,
- TX_3945_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
- TX_3945_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
- TX_3945_STATUS_FAIL_TX_LOCKED = 0x90,
- TX_3945_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
-};
-
-/*
- * TX command response is sent after *4965* transmission attempts.
- *
- * both postpone and abort status are expected behavior from uCode. there is
- * no special operation required from driver; except for RFKILL_FLUSH,
- * which required tx flush host command to flush all the tx frames in queues
- */
-enum {
- TX_STATUS_SUCCESS = 0x01,
- TX_STATUS_DIRECT_DONE = 0x02,
- /* postpone TX */
- TX_STATUS_POSTPONE_DELAY = 0x40,
- TX_STATUS_POSTPONE_FEW_BYTES = 0x41,
- TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43,
- TX_STATUS_POSTPONE_CALC_TTAK = 0x44,
- /* abort TX */
- TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81,
- TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
- TX_STATUS_FAIL_LONG_LIMIT = 0x83,
- TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
- TX_STATUS_FAIL_DRAIN_FLOW = 0x85,
- TX_STATUS_FAIL_RFKILL_FLUSH = 0x86,
- TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
- TX_STATUS_FAIL_DEST_PS = 0x88,
- TX_STATUS_FAIL_HOST_ABORTED = 0x89,
- TX_STATUS_FAIL_BT_RETRY = 0x8a,
- TX_STATUS_FAIL_STA_INVALID = 0x8b,
- TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
- TX_STATUS_FAIL_TID_DISABLE = 0x8d,
- TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e,
- TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
- TX_STATUS_FAIL_PASSIVE_NO_RX = 0x90,
- TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
-};
-
-#define TX_PACKET_MODE_REGULAR 0x0000
-#define TX_PACKET_MODE_BURST_SEQ 0x0100
-#define TX_PACKET_MODE_BURST_FIRST 0x0200
-
-enum {
- TX_POWER_PA_NOT_ACTIVE = 0x0,
-};
-
-enum {
- TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */
- TX_STATUS_DELAY_MSK = 0x00000040,
- TX_STATUS_ABORT_MSK = 0x00000080,
- TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */
- TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */
- TX_RESERVED = 0x00780000, /* bits 19:22 */
- TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */
- TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */
-};
-
-/* *******************************
- * TX aggregation status
- ******************************* */
-
-enum {
- AGG_TX_STATE_TRANSMITTED = 0x00,
- AGG_TX_STATE_UNDERRUN_MSK = 0x01,
- AGG_TX_STATE_FEW_BYTES_MSK = 0x04,
- AGG_TX_STATE_ABORT_MSK = 0x08,
- AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10,
- AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20,
- AGG_TX_STATE_SCD_QUERY_MSK = 0x80,
- AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100,
- AGG_TX_STATE_RESPONSE_MSK = 0x1ff,
- AGG_TX_STATE_DUMP_TX_MSK = 0x200,
- AGG_TX_STATE_DELAY_TX_MSK = 0x400
-};
-
-#define AGG_TX_STATUS_MSK 0x00000fff /* bits 0:11 */
-#define AGG_TX_TRY_MSK 0x0000f000 /* bits 12:15 */
-
-#define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL_MSK | \
- AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK)
-
-/* # tx attempts for first frame in aggregation */
-#define AGG_TX_STATE_TRY_CNT_POS 12
-#define AGG_TX_STATE_TRY_CNT_MSK 0xf000
-
-/* Command ID and sequence number of Tx command for this frame */
-#define AGG_TX_STATE_SEQ_NUM_POS 16
-#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
-
-/*
- * C_TX = 0x1c (response)
- *
- * This response may be in one of two slightly different formats, indicated
- * by the frame_count field:
- *
- * 1) No aggregation (frame_count == 1). This reports Tx results for
- * a single frame. Multiple attempts, at various bit rates, may have
- * been made for this frame.
- *
- * 2) Aggregation (frame_count > 1). This reports Tx results for
- * 2 or more frames that used block-acknowledge. All frames were
- * transmitted at same rate. Rate scaling may have been used if first
- * frame in this new agg block failed in previous agg block(s).
- *
- * Note that, for aggregation, ACK (block-ack) status is not delivered here;
- * block-ack has not been received by the time the 4965 device records
- * this status.
- * This status relates to reasons the tx might have been blocked or aborted
- * within the sending station (this 4965 device), rather than whether it was
- * received successfully by the destination station.
- */
-struct agg_tx_status {
- __le16 status;
- __le16 sequence;
-} __packed;
-
-struct il4965_tx_resp {
- u8 frame_count; /* 1 no aggregation, >1 aggregation */
- u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */
- u8 failure_rts; /* # failures due to unsuccessful RTS */
- u8 failure_frame; /* # failures due to no ACK (unused for agg) */
-
- /* For non-agg: Rate at which frame was successful.
- * For agg: Rate at which all frames were transmitted. */
- __le32 rate_n_flags; /* RATE_MCS_* */
-
- /* For non-agg: RTS + CTS + frame tx attempts time + ACK.
- * For agg: RTS + CTS + aggregation tx time + block-ack time. */
- __le16 wireless_media_time; /* uSecs */
-
- __le16 reserved;
- __le32 pa_power1; /* RF power amplifier measurement (not used) */
- __le32 pa_power2;
-
- /*
- * For non-agg: frame status TX_STATUS_*
- * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status
- * fields follow this one, up to frame_count.
- * Bit fields:
- * 11- 0: AGG_TX_STATE_* status code
- * 15-12: Retry count for 1st frame in aggregation (retries
- * occur if tx failed for this frame when it was a
- * member of a previous aggregation block). If rate
- * scaling is used, retry count indicates the rate
- * table entry used for all frames in the new agg.
- * 31-16: Sequence # for this frame's Tx cmd (not SSN!)
- */
- union {
- __le32 status;
- struct agg_tx_status agg_status[0]; /* for each agg frame */
- } u;
-} __packed;
-
-/*
- * N_COMPRESSED_BA = 0xc5 (response only, not a command)
- *
- * Reports Block-Acknowledge from recipient station
- */
-struct il_compressed_ba_resp {
- __le32 sta_addr_lo32;
- __le16 sta_addr_hi16;
- __le16 reserved;
-
- /* Index of recipient (BA-sending) station in uCode's station table */
- u8 sta_id;
- u8 tid;
- __le16 seq_ctl;
- __le64 bitmap;
- __le16 scd_flow;
- __le16 scd_ssn;
-} __packed;
-
-/*
- * C_TX_PWR_TBL = 0x97 (command, has simple generic response)
- *
- * See details under "TXPOWER" in 4965.h.
- */
-
-struct il3945_txpowertable_cmd {
- u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
- u8 reserved;
- __le16 channel;
- struct il3945_power_per_rate power[IL_MAX_RATES];
-} __packed;
-
-struct il4965_txpowertable_cmd {
- u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
- u8 reserved;
- __le16 channel;
- struct il4965_tx_power_db tx_power;
-} __packed;
-
-
-/**
- * struct il3945_rate_scaling_cmd - Rate Scaling Command & Response
- *
- * C_RATE_SCALE = 0x47 (command, has simple generic response)
- *
- * NOTE: The table of rates passed to the uCode via the
- * RATE_SCALE command sets up the corresponding order of
- * rates used for all related commands, including rate
- * masks, etc.
- *
- * For example, if you set 9MB (PLCP 0x0f) as the first
- * rate in the rate table, the bit mask for that rate
- * when passed through ofdm_basic_rates on the C_RXON
- * command would be bit 0 (1 << 0)
- */
-struct il3945_rate_scaling_info {
- __le16 rate_n_flags;
- u8 try_cnt;
- u8 next_rate_idx;
-} __packed;
-
-struct il3945_rate_scaling_cmd {
- u8 table_id;
- u8 reserved[3];
- struct il3945_rate_scaling_info table[IL_MAX_RATES];
-} __packed;
-
-
-/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
-#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0)
-
-/* # of EDCA prioritized tx fifos */
-#define LINK_QUAL_AC_NUM AC_NUM
-
-/* # entries in rate scale table to support Tx retries */
-#define LINK_QUAL_MAX_RETRY_NUM 16
-
-/* Tx antenna selection values */
-#define LINK_QUAL_ANT_A_MSK (1 << 0)
-#define LINK_QUAL_ANT_B_MSK (1 << 1)
-#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK)
-
-
-/**
- * struct il_link_qual_general_params
- *
- * Used in C_TX_LINK_QUALITY_CMD
- */
-struct il_link_qual_general_params {
- u8 flags;
-
- /* No entries at or above this (driver chosen) idx contain MIMO */
- u8 mimo_delimiter;
-
- /* Best single antenna to use for single stream (legacy, SISO). */
- u8 single_stream_ant_msk; /* LINK_QUAL_ANT_* */
-
- /* Best antennas to use for MIMO (unused for 4965, assumes both). */
- u8 dual_stream_ant_msk; /* LINK_QUAL_ANT_* */
-
- /*
- * If driver needs to use different initial rates for different
- * EDCA QOS access categories (as implemented by tx fifos 0-3),
- * this table will set that up, by indicating the idxes in the
- * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start.
- * Otherwise, driver should set all entries to 0.
- *
- * Entry usage:
- * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice
- * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3.
- */
- u8 start_rate_idx[LINK_QUAL_AC_NUM];
-} __packed;
-
-#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */
-#define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000)
-#define LINK_QUAL_AGG_TIME_LIMIT_MIN (100)
-
-#define LINK_QUAL_AGG_DISABLE_START_DEF (3)
-#define LINK_QUAL_AGG_DISABLE_START_MAX (255)
-#define LINK_QUAL_AGG_DISABLE_START_MIN (0)
-
-#define LINK_QUAL_AGG_FRAME_LIMIT_DEF (31)
-#define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63)
-#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0)
-
-/**
- * struct il_link_qual_agg_params
- *
- * Used in C_TX_LINK_QUALITY_CMD
- */
-struct il_link_qual_agg_params {
-
- /*
- *Maximum number of uSec in aggregation.
- * default set to 4000 (4 milliseconds) if not configured in .cfg
- */
- __le16 agg_time_limit;
-
- /*
- * Number of Tx retries allowed for a frame, before that frame will
- * no longer be considered for the start of an aggregation sequence
- * (scheduler will then try to tx it as single frame).
- * Driver should set this to 3.
- */
- u8 agg_dis_start_th;
-
- /*
- * Maximum number of frames in aggregation.
- * 0 = no limit (default). 1 = no aggregation.
- * Other values = max # frames in aggregation.
- */
- u8 agg_frame_cnt_limit;
-
- __le32 reserved;
-} __packed;
-
-/*
- * C_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
- *
- * For 4965 devices only; 3945 uses C_RATE_SCALE.
- *
- * Each station in the 4965 device's internal station table has its own table
- * of 16
- * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when
- * an ACK is not received. This command replaces the entire table for
- * one station.
- *
- * NOTE: Station must already be in 4965 device's station table.
- * Use C_ADD_STA.
- *
- * The rate scaling procedures described below work well. Of course, other
- * procedures are possible, and may work better for particular environments.
- *
- *
- * FILLING THE RATE TBL
- *
- * Given a particular initial rate and mode, as determined by the rate
- * scaling algorithm described below, the Linux driver uses the following
- * formula to fill the rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table in the
- * Link Quality command:
- *
- *
- * 1) If using High-throughput (HT) (SISO or MIMO) initial rate:
- * a) Use this same initial rate for first 3 entries.
- * b) Find next lower available rate using same mode (SISO or MIMO),
- * use for next 3 entries. If no lower rate available, switch to
- * legacy mode (no HT40 channel, no MIMO, no short guard interval).
- * c) If using MIMO, set command's mimo_delimiter to number of entries
- * using MIMO (3 or 6).
- * d) After trying 2 HT rates, switch to legacy mode (no HT40 channel,
- * no MIMO, no short guard interval), at the next lower bit rate
- * (e.g. if second HT bit rate was 54, try 48 legacy), and follow
- * legacy procedure for remaining table entries.
- *
- * 2) If using legacy initial rate:
- * a) Use the initial rate for only one entry.
- * b) For each following entry, reduce the rate to next lower available
- * rate, until reaching the lowest available rate.
- * c) When reducing rate, also switch antenna selection.
- * d) Once lowest available rate is reached, repeat this rate until
- * rate table is filled (16 entries), switching antenna each entry.
- *
- *
- * ACCUMULATING HISTORY
- *
- * The rate scaling algorithm for 4965 devices, as implemented in Linux driver,
- * uses two sets of frame Tx success history: One for the current/active
- * modulation mode, and one for a speculative/search mode that is being
- * attempted. If the speculative mode turns out to be more effective (i.e.
- * actual transfer rate is better), then the driver continues to use the
- * speculative mode as the new current active mode.
- *
- * Each history set contains, separately for each possible rate, data for a
- * sliding win of the 62 most recent tx attempts at that rate. The data
- * includes a shifting bitmap of success(1)/failure(0), and sums of successful
- * and attempted frames, from which the driver can additionally calculate a
- * success ratio (success / attempted) and number of failures
- * (attempted - success), and control the size of the win (attempted).
- * The driver uses the bit map to remove successes from the success sum, as
- * the oldest tx attempts fall out of the win.
- *
- * When the 4965 device makes multiple tx attempts for a given frame, each
- * attempt might be at a different rate, and have different modulation
- * characteristics (e.g. antenna, fat channel, short guard interval), as set
- * up in the rate scaling table in the Link Quality command. The driver must
- * determine which rate table entry was used for each tx attempt, to determine
- * which rate-specific history to update, and record only those attempts that
- * match the modulation characteristics of the history set.
- *
- * When using block-ack (aggregation), all frames are transmitted at the same
- * rate, since there is no per-attempt acknowledgment from the destination
- * station. The Tx response struct il_tx_resp indicates the Tx rate in
- * rate_n_flags field. After receiving a block-ack, the driver can update
- * history for the entire block all at once.
- *
- *
- * FINDING BEST STARTING RATE:
- *
- * When working with a selected initial modulation mode (see below), the
- * driver attempts to find a best initial rate. The initial rate is the
- * first entry in the Link Quality command's rate table.
- *
- * 1) Calculate actual throughput (success ratio * expected throughput, see
- * table below) for current initial rate. Do this only if enough frames
- * have been attempted to make the value meaningful: at least 6 failed
- * tx attempts, or at least 8 successes. If not enough, don't try rate
- * scaling yet.
- *
- * 2) Find available rates adjacent to current initial rate. Available means:
- * a) supported by hardware &&
- * b) supported by association &&
- * c) within any constraints selected by user
- *
- * 3) Gather measured throughputs for adjacent rates. These might not have
- * enough history to calculate a throughput. That's okay, we might try
- * using one of them anyway!
- *
- * 4) Try decreasing rate if, for current rate:
- * a) success ratio is < 15% ||
- * b) lower adjacent rate has better measured throughput ||
- * c) higher adjacent rate has worse throughput, and lower is unmeasured
- *
- * As a sanity check, if decrease was determined above, leave rate
- * unchanged if:
- * a) lower rate unavailable
- * b) success ratio at current rate > 85% (very good)
- * c) current measured throughput is better than expected throughput
- * of lower rate (under perfect 100% tx conditions, see table below)
- *
- * 5) Try increasing rate if, for current rate:
- * a) success ratio is < 15% ||
- * b) both adjacent rates' throughputs are unmeasured (try it!) ||
- * b) higher adjacent rate has better measured throughput ||
- * c) lower adjacent rate has worse throughput, and higher is unmeasured
- *
- * As a sanity check, if increase was determined above, leave rate
- * unchanged if:
- * a) success ratio at current rate < 70%. This is not particularly
- * good performance; higher rate is sure to have poorer success.
- *
- * 6) Re-evaluate the rate after each tx frame. If working with block-
- * acknowledge, history and stats may be calculated for the entire
- * block (including prior history that fits within the history wins),
- * before re-evaluation.
- *
- * FINDING BEST STARTING MODULATION MODE:
- *
- * After working with a modulation mode for a "while" (and doing rate scaling),
- * the driver searches for a new initial mode in an attempt to improve
- * throughput. The "while" is measured by numbers of attempted frames:
- *
- * For legacy mode, search for new mode after:
- * 480 successful frames, or 160 failed frames
- * For high-throughput modes (SISO or MIMO), search for new mode after:
- * 4500 successful frames, or 400 failed frames
- *
- * Mode switch possibilities are (3 for each mode):
- *
- * For legacy:
- * Change antenna, try SISO (if HT association), try MIMO (if HT association)
- * For SISO:
- * Change antenna, try MIMO, try shortened guard interval (SGI)
- * For MIMO:
- * Try SISO antenna A, SISO antenna B, try shortened guard interval (SGI)
- *
- * When trying a new mode, use the same bit rate as the old/current mode when
- * trying antenna switches and shortened guard interval. When switching to
- * SISO from MIMO or legacy, or to MIMO from SISO or legacy, use a rate
- * for which the expected throughput (under perfect conditions) is about the
- * same or slightly better than the actual measured throughput delivered by
- * the old/current mode.
- *
- * Actual throughput can be estimated by multiplying the expected throughput
- * by the success ratio (successful / attempted tx frames). Frame size is
- * not considered in this calculation; it assumes that frame size will average
- * out to be fairly consistent over several samples. The following are
- * metric values for expected throughput assuming 100% success ratio.
- * Only G band has support for CCK rates:
- *
- * RATE: 1 2 5 11 6 9 12 18 24 36 48 54 60
- *
- * G: 7 13 35 58 40 57 72 98 121 154 177 186 186
- * A: 0 0 0 0 40 57 72 98 121 154 177 186 186
- * SISO 20MHz: 0 0 0 0 42 42 76 102 124 159 183 193 202
- * SGI SISO 20MHz: 0 0 0 0 46 46 82 110 132 168 192 202 211
- * MIMO 20MHz: 0 0 0 0 74 74 123 155 179 214 236 244 251
- * SGI MIMO 20MHz: 0 0 0 0 81 81 131 164 188 222 243 251 257
- * SISO 40MHz: 0 0 0 0 77 77 127 160 184 220 242 250 257
- * SGI SISO 40MHz: 0 0 0 0 83 83 135 169 193 229 250 257 264
- * MIMO 40MHz: 0 0 0 0 123 123 182 214 235 264 279 285 289
- * SGI MIMO 40MHz: 0 0 0 0 131 131 191 222 242 270 284 289 293
- *
- * After the new mode has been tried for a short while (minimum of 6 failed
- * frames or 8 successful frames), compare success ratio and actual throughput
- * estimate of the new mode with the old. If either is better with the new
- * mode, continue to use the new mode.
- *
- * Continue comparing modes until all 3 possibilities have been tried.
- * If moving from legacy to HT, try all 3 possibilities from the new HT
- * mode. After trying all 3, a best mode is found. Continue to use this mode
- * for the longer "while" described above (e.g. 480 successful frames for
- * legacy), and then repeat the search process.
- *
- */
-struct il_link_quality_cmd {
-
- /* Index of destination/recipient station in uCode's station table */
- u8 sta_id;
- u8 reserved1;
- __le16 control; /* not used */
- struct il_link_qual_general_params general_params;
- struct il_link_qual_agg_params agg_params;
-
- /*
- * Rate info; when using rate-scaling, Tx command's initial_rate_idx
- * specifies 1st Tx rate attempted, via idx into this table.
- * 4965 devices works its way through table when retrying Tx.
- */
- struct {
- __le32 rate_n_flags; /* RATE_MCS_*, RATE_* */
- } rs_table[LINK_QUAL_MAX_RETRY_NUM];
- __le32 reserved2;
-} __packed;
-
-/*
- * BT configuration enable flags:
- * bit 0 - 1: BT channel announcement enabled
- * 0: disable
- * bit 1 - 1: priority of BT device enabled
- * 0: disable
- */
-#define BT_COEX_DISABLE (0x0)
-#define BT_ENABLE_CHANNEL_ANNOUNCE BIT(0)
-#define BT_ENABLE_PRIORITY BIT(1)
-
-#define BT_COEX_ENABLE (BT_ENABLE_CHANNEL_ANNOUNCE | BT_ENABLE_PRIORITY)
-
-#define BT_LEAD_TIME_DEF (0x1E)
-
-#define BT_MAX_KILL_DEF (0x5)
-
-/*
- * C_BT_CONFIG = 0x9b (command, has simple generic response)
- *
- * 3945 and 4965 devices support hardware handshake with Bluetooth device on
- * same platform. Bluetooth device alerts wireless device when it will Tx;
- * wireless device can delay or kill its own Tx to accommodate.
- */
-struct il_bt_cmd {
- u8 flags;
- u8 lead_time;
- u8 max_kill;
- u8 reserved;
- __le32 kill_ack_mask;
- __le32 kill_cts_mask;
-} __packed;
-
-
-/******************************************************************************
- * (6)
- * Spectrum Management (802.11h) Commands, Responses, Notifications:
- *
- *****************************************************************************/
-
-/*
- * Spectrum Management
- */
-#define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
- RXON_FILTER_CTL2HOST_MSK | \
- RXON_FILTER_ACCEPT_GRP_MSK | \
- RXON_FILTER_DIS_DECRYPT_MSK | \
- RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
- RXON_FILTER_ASSOC_MSK | \
- RXON_FILTER_BCON_AWARE_MSK)
-
-struct il_measure_channel {
- __le32 duration; /* measurement duration in extended beacon
- * format */
- u8 channel; /* channel to measure */
- u8 type; /* see enum il_measure_type */
- __le16 reserved;
-} __packed;
-
-/*
- * C_SPECTRUM_MEASUREMENT = 0x74 (command)
- */
-struct il_spectrum_cmd {
- __le16 len; /* number of bytes starting from token */
- u8 token; /* token id */
- u8 id; /* measurement id -- 0 or 1 */
- u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */
- u8 periodic; /* 1 = periodic */
- __le16 path_loss_timeout;
- __le32 start_time; /* start time in extended beacon format */
- __le32 reserved2;
- __le32 flags; /* rxon flags */
- __le32 filter_flags; /* rxon filter flags */
- __le16 channel_count; /* minimum 1, maximum 10 */
- __le16 reserved3;
- struct il_measure_channel channels[10];
-} __packed;
-
-/*
- * C_SPECTRUM_MEASUREMENT = 0x74 (response)
- */
-struct il_spectrum_resp {
- u8 token;
- u8 id; /* id of the prior command replaced, or 0xff */
- __le16 status; /* 0 - command will be handled
- * 1 - cannot handle (conflicts with another
- * measurement) */
-} __packed;
-
-enum il_measurement_state {
- IL_MEASUREMENT_START = 0,
- IL_MEASUREMENT_STOP = 1,
-};
-
-enum il_measurement_status {
- IL_MEASUREMENT_OK = 0,
- IL_MEASUREMENT_CONCURRENT = 1,
- IL_MEASUREMENT_CSA_CONFLICT = 2,
- IL_MEASUREMENT_TGH_CONFLICT = 3,
- /* 4-5 reserved */
- IL_MEASUREMENT_STOPPED = 6,
- IL_MEASUREMENT_TIMEOUT = 7,
- IL_MEASUREMENT_PERIODIC_FAILED = 8,
-};
-
-#define NUM_ELEMENTS_IN_HISTOGRAM 8
-
-struct il_measurement_histogram {
- __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
- __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
-} __packed;
-
-/* clear channel availability counters */
-struct il_measurement_cca_counters {
- __le32 ofdm;
- __le32 cck;
-} __packed;
-
-enum il_measure_type {
- IL_MEASURE_BASIC = (1 << 0),
- IL_MEASURE_CHANNEL_LOAD = (1 << 1),
- IL_MEASURE_HISTOGRAM_RPI = (1 << 2),
- IL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
- IL_MEASURE_FRAME = (1 << 4),
- /* bits 5:6 are reserved */
- IL_MEASURE_IDLE = (1 << 7),
-};
-
-/*
- * N_SPECTRUM_MEASUREMENT = 0x75 (notification only, not a command)
- */
-struct il_spectrum_notification {
- u8 id; /* measurement id -- 0 or 1 */
- u8 token;
- u8 channel_idx; /* idx in measurement channel list */
- u8 state; /* 0 - start, 1 - stop */
- __le32 start_time; /* lower 32-bits of TSF */
- u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
- u8 channel;
- u8 type; /* see enum il_measurement_type */
- u8 reserved1;
- /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
- * valid if applicable for measurement type requested. */
- __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */
- __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */
- __le32 cca_time; /* channel load time in usecs */
- u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
- * unidentified */
- u8 reserved2[3];
- struct il_measurement_histogram histogram;
- __le32 stop_time; /* lower 32-bits of TSF */
- __le32 status; /* see il_measurement_status */
-} __packed;
-
-/******************************************************************************
- * (7)
- * Power Management Commands, Responses, Notifications:
- *
- *****************************************************************************/
-
-/**
- * struct il_powertable_cmd - Power Table Command
- * @flags: See below:
- *
- * C_POWER_TBL = 0x77 (command, has simple generic response)
- *
- * PM allow:
- * bit 0 - '0' Driver not allow power management
- * '1' Driver allow PM (use rest of parameters)
- *
- * uCode send sleep notifications:
- * bit 1 - '0' Don't send sleep notification
- * '1' send sleep notification (SEND_PM_NOTIFICATION)
- *
- * Sleep over DTIM
- * bit 2 - '0' PM have to walk up every DTIM
- * '1' PM could sleep over DTIM till listen Interval.
- *
- * PCI power managed
- * bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1)
- * '1' !(PCI_CFG_LINK_CTRL & 0x1)
- *
- * Fast PD
- * bit 4 - '1' Put radio to sleep when receiving frame for others
- *
- * Force sleep Modes
- * bit 31/30- '00' use both mac/xtal sleeps
- * '01' force Mac sleep
- * '10' force xtal sleep
- * '11' Illegal set
- *
- * NOTE: if sleep_interval[SLEEP_INTRVL_TBL_SIZE-1] > DTIM period then
- * ucode assume sleep over DTIM is allowed and we don't need to wake up
- * for every DTIM.
- */
-#define IL_POWER_VEC_SIZE 5
-
-#define IL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0))
-#define IL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3))
-
-struct il3945_powertable_cmd {
- __le16 flags;
- u8 reserved[2];
- __le32 rx_data_timeout;
- __le32 tx_data_timeout;
- __le32 sleep_interval[IL_POWER_VEC_SIZE];
-} __packed;
-
-struct il_powertable_cmd {
- __le16 flags;
- u8 keep_alive_seconds; /* 3945 reserved */
- u8 debug_flags; /* 3945 reserved */
- __le32 rx_data_timeout;
- __le32 tx_data_timeout;
- __le32 sleep_interval[IL_POWER_VEC_SIZE];
- __le32 keep_alive_beacons;
-} __packed;
-
-/*
- * N_PM_SLEEP = 0x7A (notification only, not a command)
- * all devices identical.
- */
-struct il_sleep_notification {
- u8 pm_sleep_mode;
- u8 pm_wakeup_src;
- __le16 reserved;
- __le32 sleep_time;
- __le32 tsf_low;
- __le32 bcon_timer;
-} __packed;
-
-/* Sleep states. all devices identical. */
-enum {
- IL_PM_NO_SLEEP = 0,
- IL_PM_SLP_MAC = 1,
- IL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
- IL_PM_SLP_FULL_MAC_CARD_STATE = 3,
- IL_PM_SLP_PHY = 4,
- IL_PM_SLP_REPENT = 5,
- IL_PM_WAKEUP_BY_TIMER = 6,
- IL_PM_WAKEUP_BY_DRIVER = 7,
- IL_PM_WAKEUP_BY_RFKILL = 8,
- /* 3 reserved */
- IL_PM_NUM_OF_MODES = 12,
-};
-
-/*
- * N_CARD_STATE = 0xa1 (notification only, not a command)
- */
-struct il_card_state_notif {
- __le32 flags;
-} __packed;
-
-#define HW_CARD_DISABLED 0x01
-#define SW_CARD_DISABLED 0x02
-#define CT_CARD_DISABLED 0x04
-#define RXON_CARD_DISABLED 0x10
-
-struct il_ct_kill_config {
- __le32 reserved;
- __le32 critical_temperature_M;
- __le32 critical_temperature_R;
-} __packed;
-
-/******************************************************************************
- * (8)
- * Scan Commands, Responses, Notifications:
- *
- *****************************************************************************/
-
-#define SCAN_CHANNEL_TYPE_PASSIVE cpu_to_le32(0)
-#define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1)
-
-/**
- * struct il_scan_channel - entry in C_SCAN channel table
- *
- * One for each channel in the scan list.
- * Each channel can independently select:
- * 1) SSID for directed active scans
- * 2) Txpower setting (for rate specified within Tx command)
- * 3) How long to stay on-channel (behavior may be modified by quiet_time,
- * quiet_plcp_th, good_CRC_th)
- *
- * To avoid uCode errors, make sure the following are true (see comments
- * under struct il_scan_cmd about max_out_time and quiet_time):
- * 1) If using passive_dwell (i.e. passive_dwell != 0):
- * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
- * 2) quiet_time <= active_dwell
- * 3) If restricting off-channel time (i.e. max_out_time !=0):
- * passive_dwell < max_out_time
- * active_dwell < max_out_time
- */
-struct il3945_scan_channel {
- /*
- * type is defined as:
- * 0:0 1 = active, 0 = passive
- * 1:4 SSID direct bit map; if a bit is set, then corresponding
- * SSID IE is transmitted in probe request.
- * 5:7 reserved
- */
- u8 type;
- u8 channel; /* band is selected by il3945_scan_cmd "flags" field */
- struct il3945_tx_power tpc;
- __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
- __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
-} __packed;
-
-/* set number of direct probes u8 type */
-#define IL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1))))
-
-struct il_scan_channel {
- /*
- * type is defined as:
- * 0:0 1 = active, 0 = passive
- * 1:20 SSID direct bit map; if a bit is set, then corresponding
- * SSID IE is transmitted in probe request.
- * 21:31 reserved
- */
- __le32 type;
- __le16 channel; /* band is selected by il_scan_cmd "flags" field */
- u8 tx_gain; /* gain for analog radio */
- u8 dsp_atten; /* gain for DSP */
- __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
- __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
-} __packed;
-
-/* set number of direct probes __le32 type */
-#define IL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1))))
-
-/**
- * struct il_ssid_ie - directed scan network information element
- *
- * Up to 20 of these may appear in C_SCAN (Note: Only 4 are in
- * 3945 SCAN api), selected by "type" bit field in struct il_scan_channel;
- * each channel may select different ssids from among the 20 (4) entries.
- * SSID IEs get transmitted in reverse order of entry.
- */
-struct il_ssid_ie {
- u8 id;
- u8 len;
- u8 ssid[32];
-} __packed;
-
-#define PROBE_OPTION_MAX_3945 4
-#define PROBE_OPTION_MAX 20
-#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF)
-#define IL_GOOD_CRC_TH_DISABLED 0
-#define IL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
-#define IL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff)
-#define IL_MAX_SCAN_SIZE 1024
-#define IL_MAX_CMD_SIZE 4096
-
-/*
- * C_SCAN = 0x80 (command)
- *
- * The hardware scan command is very powerful; the driver can set it up to
- * maintain (relatively) normal network traffic while doing a scan in the
- * background. The max_out_time and suspend_time control the ratio of how
- * long the device stays on an associated network channel ("service channel")
- * vs. how long it's away from the service channel, i.e. tuned to other channels
- * for scanning.
- *
- * max_out_time is the max time off-channel (in usec), and suspend_time
- * is how long (in "extended beacon" format) that the scan is "suspended"
- * after returning to the service channel. That is, suspend_time is the
- * time that we stay on the service channel, doing normal work, between
- * scan segments. The driver may set these parameters differently to support
- * scanning when associated vs. not associated, and light vs. heavy traffic
- * loads when associated.
- *
- * After receiving this command, the device's scan engine does the following;
- *
- * 1) Sends SCAN_START notification to driver
- * 2) Checks to see if it has time to do scan for one channel
- * 3) Sends NULL packet, with power-save (PS) bit set to 1,
- * to tell AP that we're going off-channel
- * 4) Tunes to first channel in scan list, does active or passive scan
- * 5) Sends SCAN_RESULT notification to driver
- * 6) Checks to see if it has time to do scan on *next* channel in list
- * 7) Repeats 4-6 until it no longer has time to scan the next channel
- * before max_out_time expires
- * 8) Returns to service channel
- * 9) Sends NULL packet with PS=0 to tell AP that we're back
- * 10) Stays on service channel until suspend_time expires
- * 11) Repeats entire process 2-10 until list is complete
- * 12) Sends SCAN_COMPLETE notification
- *
- * For fast, efficient scans, the scan command also has support for staying on
- * a channel for just a short time, if doing active scanning and getting no
- * responses to the transmitted probe request. This time is controlled by
- * quiet_time, and the number of received packets below which a channel is
- * considered "quiet" is controlled by quiet_plcp_threshold.
- *
- * For active scanning on channels that have regulatory restrictions against
- * blindly transmitting, the scan can listen before transmitting, to make sure
- * that there is already legitimate activity on the channel. If enough
- * packets are cleanly received on the channel (controlled by good_CRC_th,
- * typical value 1), the scan engine starts transmitting probe requests.
- *
- * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
- *
- * To avoid uCode errors, see timing restrictions described under
- * struct il_scan_channel.
- */
-
-struct il3945_scan_cmd {
- __le16 len;
- u8 reserved0;
- u8 channel_count; /* # channels in channel list */
- __le16 quiet_time; /* dwell only this # millisecs on quiet channel
- * (only for active scan) */
- __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
- __le16 good_CRC_th; /* passive -> active promotion threshold */
- __le16 reserved1;
- __le32 max_out_time; /* max usec to be away from associated (service)
- * channel */
- __le32 suspend_time; /* pause scan this long (in "extended beacon
- * format") when returning to service channel:
- * 3945; 31:24 # beacons, 19:0 additional usec,
- * 4965; 31:22 # beacons, 21:0 additional usec.
- */
- __le32 flags; /* RXON_FLG_* */
- __le32 filter_flags; /* RXON_FILTER_* */
-
- /* For active scans (set to all-0s for passive scans).
- * Does not include payload. Must specify Tx rate; no rate scaling. */
- struct il3945_tx_cmd tx_cmd;
-
- /* For directed active scans (set to all-0s otherwise) */
- struct il_ssid_ie direct_scan[PROBE_OPTION_MAX_3945];
-
- /*
- * Probe request frame, followed by channel list.
- *
- * Size of probe request frame is specified by byte count in tx_cmd.
- * Channel list follows immediately after probe request frame.
- * Number of channels in list is specified by channel_count.
- * Each channel in list is of type:
- *
- * struct il3945_scan_channel channels[0];
- *
- * NOTE: Only one band of channels can be scanned per pass. You
- * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
- * for one scan to complete (i.e. receive N_SCAN_COMPLETE)
- * before requesting another scan.
- */
- u8 data[0];
-} __packed;
-
-struct il_scan_cmd {
- __le16 len;
- u8 reserved0;
- u8 channel_count; /* # channels in channel list */
- __le16 quiet_time; /* dwell only this # millisecs on quiet channel
- * (only for active scan) */
- __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
- __le16 good_CRC_th; /* passive -> active promotion threshold */
- __le16 rx_chain; /* RXON_RX_CHAIN_* */
- __le32 max_out_time; /* max usec to be away from associated (service)
- * channel */
- __le32 suspend_time; /* pause scan this long (in "extended beacon
- * format") when returning to service chnl:
- * 3945; 31:24 # beacons, 19:0 additional usec,
- * 4965; 31:22 # beacons, 21:0 additional usec.
- */
- __le32 flags; /* RXON_FLG_* */
- __le32 filter_flags; /* RXON_FILTER_* */
-
- /* For active scans (set to all-0s for passive scans).
- * Does not include payload. Must specify Tx rate; no rate scaling. */
- struct il_tx_cmd tx_cmd;
-
- /* For directed active scans (set to all-0s otherwise) */
- struct il_ssid_ie direct_scan[PROBE_OPTION_MAX];
-
- /*
- * Probe request frame, followed by channel list.
- *
- * Size of probe request frame is specified by byte count in tx_cmd.
- * Channel list follows immediately after probe request frame.
- * Number of channels in list is specified by channel_count.
- * Each channel in list is of type:
- *
- * struct il_scan_channel channels[0];
- *
- * NOTE: Only one band of channels can be scanned per pass. You
- * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
- * for one scan to complete (i.e. receive N_SCAN_COMPLETE)
- * before requesting another scan.
- */
- u8 data[0];
-} __packed;
-
-/* Can abort will notify by complete notification with abort status. */
-#define CAN_ABORT_STATUS cpu_to_le32(0x1)
-/* complete notification statuses */
-#define ABORT_STATUS 0x2
-
-/*
- * C_SCAN = 0x80 (response)
- */
-struct il_scanreq_notification {
- __le32 status; /* 1: okay, 2: cannot fulfill request */
-} __packed;
-
-/*
- * N_SCAN_START = 0x82 (notification only, not a command)
- */
-struct il_scanstart_notification {
- __le32 tsf_low;
- __le32 tsf_high;
- __le32 beacon_timer;
- u8 channel;
- u8 band;
- u8 reserved[2];
- __le32 status;
-} __packed;
-
-#define SCAN_OWNER_STATUS 0x1
-#define MEASURE_OWNER_STATUS 0x2
-
-#define IL_PROBE_STATUS_OK 0
-#define IL_PROBE_STATUS_TX_FAILED BIT(0)
-/* error statuses combined with TX_FAILED */
-#define IL_PROBE_STATUS_FAIL_TTL BIT(1)
-#define IL_PROBE_STATUS_FAIL_BT BIT(2)
-
-#define NUMBER_OF_STATS 1 /* first __le32 is good CRC */
-/*
- * N_SCAN_RESULTS = 0x83 (notification only, not a command)
- */
-struct il_scanresults_notification {
- u8 channel;
- u8 band;
- u8 probe_status;
- u8 num_probe_not_sent; /* not enough time to send */
- __le32 tsf_low;
- __le32 tsf_high;
- __le32 stats[NUMBER_OF_STATS];
-} __packed;
-
-/*
- * N_SCAN_COMPLETE = 0x84 (notification only, not a command)
- */
-struct il_scancomplete_notification {
- u8 scanned_channels;
- u8 status;
- u8 last_channel;
- __le32 tsf_low;
- __le32 tsf_high;
-} __packed;
-
-
-/******************************************************************************
- * (9)
- * IBSS/AP Commands and Notifications:
- *
- *****************************************************************************/
-
-enum il_ibss_manager {
- IL_NOT_IBSS_MANAGER = 0,
- IL_IBSS_MANAGER = 1,
-};
-
-/*
- * N_BEACON = 0x90 (notification only, not a command)
- */
-
-struct il3945_beacon_notif {
- struct il3945_tx_resp beacon_notify_hdr;
- __le32 low_tsf;
- __le32 high_tsf;
- __le32 ibss_mgr_status;
-} __packed;
-
-struct il4965_beacon_notif {
- struct il4965_tx_resp beacon_notify_hdr;
- __le32 low_tsf;
- __le32 high_tsf;
- __le32 ibss_mgr_status;
-} __packed;
-
-/*
- * C_TX_BEACON= 0x91 (command, has simple generic response)
- */
-
-struct il3945_tx_beacon_cmd {
- struct il3945_tx_cmd tx;
- __le16 tim_idx;
- u8 tim_size;
- u8 reserved1;
- struct ieee80211_hdr frame[0]; /* beacon frame */
-} __packed;
-
-struct il_tx_beacon_cmd {
- struct il_tx_cmd tx;
- __le16 tim_idx;
- u8 tim_size;
- u8 reserved1;
- struct ieee80211_hdr frame[0]; /* beacon frame */
-} __packed;
-
-/******************************************************************************
- * (10)
- * Statistics Commands and Notifications:
- *
- *****************************************************************************/
-
-#define IL_TEMP_CONVERT 260
-
-#define SUP_RATE_11A_MAX_NUM_CHANNELS 8
-#define SUP_RATE_11B_MAX_NUM_CHANNELS 4
-#define SUP_RATE_11G_MAX_NUM_CHANNELS 12
-
-/* Used for passing to driver number of successes and failures per rate */
-struct rate_histogram {
- union {
- __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
- __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
- __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
- } success;
- union {
- __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
- __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
- __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
- } failed;
-} __packed;
-
-/* stats command response */
-
-struct iwl39_stats_rx_phy {
- __le32 ina_cnt;
- __le32 fina_cnt;
- __le32 plcp_err;
- __le32 crc32_err;
- __le32 overrun_err;
- __le32 early_overrun_err;
- __le32 crc32_good;
- __le32 false_alarm_cnt;
- __le32 fina_sync_err_cnt;
- __le32 sfd_timeout;
- __le32 fina_timeout;
- __le32 unresponded_rts;
- __le32 rxe_frame_limit_overrun;
- __le32 sent_ack_cnt;
- __le32 sent_cts_cnt;
-} __packed;
-
-struct iwl39_stats_rx_non_phy {
- __le32 bogus_cts; /* CTS received when not expecting CTS */
- __le32 bogus_ack; /* ACK received when not expecting ACK */
- __le32 non_bssid_frames; /* number of frames with BSSID that
- * doesn't belong to the STA BSSID */
- __le32 filtered_frames; /* count frames that were dumped in the
- * filtering process */
- __le32 non_channel_beacons; /* beacons with our bss id but not on
- * our serving channel */
-} __packed;
-
-struct iwl39_stats_rx {
- struct iwl39_stats_rx_phy ofdm;
- struct iwl39_stats_rx_phy cck;
- struct iwl39_stats_rx_non_phy general;
-} __packed;
-
-struct iwl39_stats_tx {
- __le32 preamble_cnt;
- __le32 rx_detected_cnt;
- __le32 bt_prio_defer_cnt;
- __le32 bt_prio_kill_cnt;
- __le32 few_bytes_cnt;
- __le32 cts_timeout;
- __le32 ack_timeout;
- __le32 expected_ack_cnt;
- __le32 actual_ack_cnt;
-} __packed;
-
-struct stats_dbg {
- __le32 burst_check;
- __le32 burst_count;
- __le32 wait_for_silence_timeout_cnt;
- __le32 reserved[3];
-} __packed;
-
-struct iwl39_stats_div {
- __le32 tx_on_a;
- __le32 tx_on_b;
- __le32 exec_time;
- __le32 probe_time;
-} __packed;
-
-struct iwl39_stats_general {
- __le32 temperature;
- struct stats_dbg dbg;
- __le32 sleep_time;
- __le32 slots_out;
- __le32 slots_idle;
- __le32 ttl_timestamp;
- struct iwl39_stats_div div;
-} __packed;
-
-struct stats_rx_phy {
- __le32 ina_cnt;
- __le32 fina_cnt;
- __le32 plcp_err;
- __le32 crc32_err;
- __le32 overrun_err;
- __le32 early_overrun_err;
- __le32 crc32_good;
- __le32 false_alarm_cnt;
- __le32 fina_sync_err_cnt;
- __le32 sfd_timeout;
- __le32 fina_timeout;
- __le32 unresponded_rts;
- __le32 rxe_frame_limit_overrun;
- __le32 sent_ack_cnt;
- __le32 sent_cts_cnt;
- __le32 sent_ba_rsp_cnt;
- __le32 dsp_self_kill;
- __le32 mh_format_err;
- __le32 re_acq_main_rssi_sum;
- __le32 reserved3;
-} __packed;
-
-struct stats_rx_ht_phy {
- __le32 plcp_err;
- __le32 overrun_err;
- __le32 early_overrun_err;
- __le32 crc32_good;
- __le32 crc32_err;
- __le32 mh_format_err;
- __le32 agg_crc32_good;
- __le32 agg_mpdu_cnt;
- __le32 agg_cnt;
- __le32 unsupport_mcs;
-} __packed;
-
-#define INTERFERENCE_DATA_AVAILABLE cpu_to_le32(1)
-
-struct stats_rx_non_phy {
- __le32 bogus_cts; /* CTS received when not expecting CTS */
- __le32 bogus_ack; /* ACK received when not expecting ACK */
- __le32 non_bssid_frames; /* number of frames with BSSID that
- * doesn't belong to the STA BSSID */
- __le32 filtered_frames; /* count frames that were dumped in the
- * filtering process */
- __le32 non_channel_beacons; /* beacons with our bss id but not on
- * our serving channel */
- __le32 channel_beacons; /* beacons with our bss id and in our
- * serving channel */
- __le32 num_missed_bcon; /* number of missed beacons */
- __le32 adc_rx_saturation_time; /* count in 0.8us units the time the
- * ADC was in saturation */
- __le32 ina_detection_search_time;/* total time (in 0.8us) searched
- * for INA */
- __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */
- __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */
- __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */
- __le32 interference_data_flag; /* flag for interference data
- * availability. 1 when data is
- * available. */
- __le32 channel_load; /* counts RX Enable time in uSec */
- __le32 dsp_false_alarms; /* DSP false alarm (both OFDM
- * and CCK) counter */
- __le32 beacon_rssi_a;
- __le32 beacon_rssi_b;
- __le32 beacon_rssi_c;
- __le32 beacon_energy_a;
- __le32 beacon_energy_b;
- __le32 beacon_energy_c;
-} __packed;
-
-struct stats_rx {
- struct stats_rx_phy ofdm;
- struct stats_rx_phy cck;
- struct stats_rx_non_phy general;
- struct stats_rx_ht_phy ofdm_ht;
-} __packed;
-
-/**
- * struct stats_tx_power - current tx power
- *
- * @ant_a: current tx power on chain a in 1/2 dB step
- * @ant_b: current tx power on chain b in 1/2 dB step
- * @ant_c: current tx power on chain c in 1/2 dB step
- */
-struct stats_tx_power {
- u8 ant_a;
- u8 ant_b;
- u8 ant_c;
- u8 reserved;
-} __packed;
-
-struct stats_tx_non_phy_agg {
- __le32 ba_timeout;
- __le32 ba_reschedule_frames;
- __le32 scd_query_agg_frame_cnt;
- __le32 scd_query_no_agg;
- __le32 scd_query_agg;
- __le32 scd_query_mismatch;
- __le32 frame_not_ready;
- __le32 underrun;
- __le32 bt_prio_kill;
- __le32 rx_ba_rsp_cnt;
-} __packed;
-
-struct stats_tx {
- __le32 preamble_cnt;
- __le32 rx_detected_cnt;
- __le32 bt_prio_defer_cnt;
- __le32 bt_prio_kill_cnt;
- __le32 few_bytes_cnt;
- __le32 cts_timeout;
- __le32 ack_timeout;
- __le32 expected_ack_cnt;
- __le32 actual_ack_cnt;
- __le32 dump_msdu_cnt;
- __le32 burst_abort_next_frame_mismatch_cnt;
- __le32 burst_abort_missing_next_frame_cnt;
- __le32 cts_timeout_collision;
- __le32 ack_or_ba_timeout_collision;
- struct stats_tx_non_phy_agg agg;
-
- __le32 reserved1;
-} __packed;
-
-
-struct stats_div {
- __le32 tx_on_a;
- __le32 tx_on_b;
- __le32 exec_time;
- __le32 probe_time;
- __le32 reserved1;
- __le32 reserved2;
-} __packed;
-
-struct stats_general_common {
- __le32 temperature; /* radio temperature */
- struct stats_dbg dbg;
- __le32 sleep_time;
- __le32 slots_out;
- __le32 slots_idle;
- __le32 ttl_timestamp;
- struct stats_div div;
- __le32 rx_enable_counter;
- /*
- * num_of_sos_states:
- * count the number of times we have to re-tune
- * in order to get out of bad PHY status
- */
- __le32 num_of_sos_states;
-} __packed;
-
-struct stats_general {
- struct stats_general_common common;
- __le32 reserved2;
- __le32 reserved3;
-} __packed;
-
-#define UCODE_STATS_CLEAR_MSK (0x1 << 0)
-#define UCODE_STATS_FREQUENCY_MSK (0x1 << 1)
-#define UCODE_STATS_NARROW_BAND_MSK (0x1 << 2)
-
-/*
- * C_STATS = 0x9c,
- * all devices identical.
- *
- * This command triggers an immediate response containing uCode stats.
- * The response is in the same format as N_STATS 0x9d, below.
- *
- * If the CLEAR_STATS configuration flag is set, uCode will clear its
- * internal copy of the stats (counters) after issuing the response.
- * This flag does not affect N_STATSs after beacons (see below).
- *
- * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
- * N_STATSs after received beacons (see below). This flag
- * does not affect the response to the C_STATS 0x9c itself.
- */
-#define IL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */
-#define IL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */
-struct il_stats_cmd {
- __le32 configuration_flags; /* IL_STATS_CONF_* */
-} __packed;
-
-/*
- * N_STATS = 0x9d (notification only, not a command)
- *
- * By default, uCode issues this notification after receiving a beacon
- * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
- * C_STATS 0x9c, above.
- *
- * Statistics counters continue to increment beacon after beacon, but are
- * cleared when changing channels or when driver issues C_STATS
- * 0x9c with CLEAR_STATS bit set (see above).
- *
- * uCode also issues this notification during scans. uCode clears stats
- * appropriately so that each notification contains stats for only the
- * one channel that has just been scanned.
- */
-#define STATS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2)
-#define STATS_REPLY_FLG_HT40_MODE_MSK cpu_to_le32(0x8)
-
-struct il3945_notif_stats {
- __le32 flag;
- struct iwl39_stats_rx rx;
- struct iwl39_stats_tx tx;
- struct iwl39_stats_general general;
-} __packed;
-
-struct il_notif_stats {
- __le32 flag;
- struct stats_rx rx;
- struct stats_tx tx;
- struct stats_general general;
-} __packed;
-
-/*
- * N_MISSED_BEACONS = 0xa2 (notification only, not a command)
- *
- * uCode send N_MISSED_BEACONS to driver when detect beacon missed
- * in regardless of how many missed beacons, which mean when driver receive the
- * notification, inside the command, it can find all the beacons information
- * which include number of total missed beacons, number of consecutive missed
- * beacons, number of beacons received and number of beacons expected to
- * receive.
- *
- * If uCode detected consecutive_missed_beacons > 5, it will reset the radio
- * in order to bring the radio/PHY back to working state; which has no relation
- * to when driver will perform sensitivity calibration.
- *
- * Driver should set it own missed_beacon_threshold to decide when to perform
- * sensitivity calibration based on number of consecutive missed beacons in
- * order to improve overall performance, especially in noisy environment.
- *
- */
-
-#define IL_MISSED_BEACON_THRESHOLD_MIN (1)
-#define IL_MISSED_BEACON_THRESHOLD_DEF (5)
-#define IL_MISSED_BEACON_THRESHOLD_MAX IL_MISSED_BEACON_THRESHOLD_DEF
-
-struct il_missed_beacon_notif {
- __le32 consecutive_missed_beacons;
- __le32 total_missed_becons;
- __le32 num_expected_beacons;
- __le32 num_recvd_beacons;
-} __packed;
-
-
-/******************************************************************************
- * (11)
- * Rx Calibration Commands:
- *
- * With the uCode used for open source drivers, most Tx calibration (except
- * for Tx Power) and most Rx calibration is done by uCode during the
- * "initialize" phase of uCode boot. Driver must calibrate only:
- *
- * 1) Tx power (depends on temperature), described elsewhere
- * 2) Receiver gain balance (optimize MIMO, and detect disconnected antennas)
- * 3) Receiver sensitivity (to optimize signal detection)
- *
- *****************************************************************************/
-
-/**
- * C_SENSITIVITY = 0xa8 (command, has simple generic response)
- *
- * This command sets up the Rx signal detector for a sensitivity level that
- * is high enough to lock onto all signals within the associated network,
- * but low enough to ignore signals that are below a certain threshold, so as
- * not to have too many "false alarms". False alarms are signals that the
- * Rx DSP tries to lock onto, but then discards after determining that they
- * are noise.
- *
- * The optimum number of false alarms is between 5 and 50 per 200 TUs
- * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e.
- * time listening, not transmitting). Driver must adjust sensitivity so that
- * the ratio of actual false alarms to actual Rx time falls within this range.
- *
- * While associated, uCode delivers N_STATSs after each
- * received beacon. These provide information to the driver to analyze the
- * sensitivity. Don't analyze stats that come in from scanning, or any
- * other non-associated-network source. Pertinent stats include:
- *
- * From "general" stats (struct stats_rx_non_phy):
- *
- * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level)
- * Measure of energy of desired signal. Used for establishing a level
- * below which the device does not detect signals.
- *
- * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB)
- * Measure of background noise in silent period after beacon.
- *
- * channel_load
- * uSecs of actual Rx time during beacon period (varies according to
- * how much time was spent transmitting).
- *
- * From "cck" and "ofdm" stats (struct stats_rx_phy), separately:
- *
- * false_alarm_cnt
- * Signal locks abandoned early (before phy-level header).
- *
- * plcp_err
- * Signal locks abandoned late (during phy-level header).
- *
- * NOTE: Both false_alarm_cnt and plcp_err increment monotonically from
- * beacon to beacon, i.e. each value is an accumulation of all errors
- * before and including the latest beacon. Values will wrap around to 0
- * after counting up to 2^32 - 1. Driver must differentiate vs.
- * previous beacon's values to determine # false alarms in the current
- * beacon period.
- *
- * Total number of false alarms = false_alarms + plcp_errs
- *
- * For OFDM, adjust the following table entries in struct il_sensitivity_cmd
- * (notice that the start points for OFDM are at or close to settings for
- * maximum sensitivity):
- *
- * START / MIN / MAX
- * HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX 90 / 85 / 120
- * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX 170 / 170 / 210
- * HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX 105 / 105 / 140
- * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX 220 / 220 / 270
- *
- * If actual rate of OFDM false alarms (+ plcp_errors) is too high
- * (greater than 50 for each 204.8 msecs listening), reduce sensitivity
- * by *adding* 1 to all 4 of the table entries above, up to the max for
- * each entry. Conversely, if false alarm rate is too low (less than 5
- * for each 204.8 msecs listening), *subtract* 1 from each entry to
- * increase sensitivity.
- *
- * For CCK sensitivity, keep track of the following:
- *
- * 1). 20-beacon history of maximum background noise, indicated by
- * (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the
- * 3 receivers. For any given beacon, the "silence reference" is
- * the maximum of last 60 samples (20 beacons * 3 receivers).
- *
- * 2). 10-beacon history of strongest signal level, as indicated
- * by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers,
- * i.e. the strength of the signal through the best receiver at the
- * moment. These measurements are "upside down", with lower values
- * for stronger signals, so max energy will be *minimum* value.
- *
- * Then for any given beacon, the driver must determine the *weakest*
- * of the strongest signals; this is the minimum level that needs to be
- * successfully detected, when using the best receiver at the moment.
- * "Max cck energy" is the maximum (higher value means lower energy!)
- * of the last 10 minima. Once this is determined, driver must add
- * a little margin by adding "6" to it.
- *
- * 3). Number of consecutive beacon periods with too few false alarms.
- * Reset this to 0 at the first beacon period that falls within the
- * "good" range (5 to 50 false alarms per 204.8 milliseconds rx).
- *
- * Then, adjust the following CCK table entries in struct il_sensitivity_cmd
- * (notice that the start points for CCK are at maximum sensitivity):
- *
- * START / MIN / MAX
- * HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX 125 / 125 / 200
- * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX 200 / 200 / 400
- * HD_MIN_ENERGY_CCK_DET_IDX 100 / 0 / 100
- *
- * If actual rate of CCK false alarms (+ plcp_errors) is too high
- * (greater than 50 for each 204.8 msecs listening), method for reducing
- * sensitivity is:
- *
- * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX,
- * up to max 400.
- *
- * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX is < 160,
- * sensitivity has been reduced a significant amount; bring it up to
- * a moderate 161. Otherwise, *add* 3, up to max 200.
- *
- * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX is > 160,
- * sensitivity has been reduced only a moderate or small amount;
- * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_IDX,
- * down to min 0. Otherwise (if gain has been significantly reduced),
- * don't change the HD_MIN_ENERGY_CCK_DET_IDX value.
- *
- * b) Save a snapshot of the "silence reference".
- *
- * If actual rate of CCK false alarms (+ plcp_errors) is too low
- * (less than 5 for each 204.8 msecs listening), method for increasing
- * sensitivity is used only if:
- *
- * 1a) Previous beacon did not have too many false alarms
- * 1b) AND difference between previous "silence reference" and current
- * "silence reference" (prev - current) is 2 or more,
- * OR 2) 100 or more consecutive beacon periods have had rate of
- * less than 5 false alarms per 204.8 milliseconds rx time.
- *
- * Method for increasing sensitivity:
- *
- * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX,
- * down to min 125.
- *
- * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX,
- * down to min 200.
- *
- * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_IDX, up to max 100.
- *
- * If actual rate of CCK false alarms (+ plcp_errors) is within good range
- * (between 5 and 50 for each 204.8 msecs listening):
- *
- * 1) Save a snapshot of the silence reference.
- *
- * 2) If previous beacon had too many CCK false alarms (+ plcp_errors),
- * give some extra margin to energy threshold by *subtracting* 8
- * from value in HD_MIN_ENERGY_CCK_DET_IDX.
- *
- * For all cases (too few, too many, good range), make sure that the CCK
- * detection threshold (energy) is below the energy level for robust
- * detection over the past 10 beacon periods, the "Max cck energy".
- * Lower values mean higher energy; this means making sure that the value
- * in HD_MIN_ENERGY_CCK_DET_IDX is at or *above* "Max cck energy".
- *
- */
-
-/*
- * Table entries in C_SENSITIVITY (struct il_sensitivity_cmd)
- */
-#define HD_TBL_SIZE (11) /* number of entries */
-#define HD_MIN_ENERGY_CCK_DET_IDX (0) /* table idxes */
-#define HD_MIN_ENERGY_OFDM_DET_IDX (1)
-#define HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX (2)
-#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX (3)
-#define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX (4)
-#define HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX (5)
-#define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX (6)
-#define HD_BARKER_CORR_TH_ADD_MIN_IDX (7)
-#define HD_BARKER_CORR_TH_ADD_MIN_MRC_IDX (8)
-#define HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX (9)
-#define HD_OFDM_ENERGY_TH_IN_IDX (10)
-
-/* Control field in struct il_sensitivity_cmd */
-#define C_SENSITIVITY_CONTROL_DEFAULT_TBL cpu_to_le16(0)
-#define C_SENSITIVITY_CONTROL_WORK_TBL cpu_to_le16(1)
-
-/**
- * struct il_sensitivity_cmd
- * @control: (1) updates working table, (0) updates default table
- * @table: energy threshold values, use HD_* as idx into table
- *
- * Always use "1" in "control" to update uCode's working table and DSP.
- */
-struct il_sensitivity_cmd {
- __le16 control; /* always use "1" */
- __le16 table[HD_TBL_SIZE]; /* use HD_* as idx */
-} __packed;
-
-
-/**
- * C_PHY_CALIBRATION = 0xb0 (command, has simple generic response)
- *
- * This command sets the relative gains of 4965 device's 3 radio receiver chains.
- *
- * After the first association, driver should accumulate signal and noise
- * stats from the N_STATSs that follow the first 20
- * beacons from the associated network (don't collect stats that come
- * in from scanning, or any other non-network source).
- *
- * DISCONNECTED ANTENNA:
- *
- * Driver should determine which antennas are actually connected, by comparing
- * average beacon signal levels for the 3 Rx chains. Accumulate (add) the
- * following values over 20 beacons, one accumulator for each of the chains
- * a/b/c, from struct stats_rx_non_phy:
- *
- * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB)
- *
- * Find the strongest signal from among a/b/c. Compare the other two to the
- * strongest. If any signal is more than 15 dB (times 20, unless you
- * divide the accumulated values by 20) below the strongest, the driver
- * considers that antenna to be disconnected, and should not try to use that
- * antenna/chain for Rx or Tx. If both A and B seem to be disconnected,
- * driver should declare the stronger one as connected, and attempt to use it
- * (A and B are the only 2 Tx chains!).
- *
- *
- * RX BALANCE:
- *
- * Driver should balance the 3 receivers (but just the ones that are connected
- * to antennas, see above) for gain, by comparing the average signal levels
- * detected during the silence after each beacon (background noise).
- * Accumulate (add) the following values over 20 beacons, one accumulator for
- * each of the chains a/b/c, from struct stats_rx_non_phy:
- *
- * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB)
- *
- * Find the weakest background noise level from among a/b/c. This Rx chain
- * will be the reference, with 0 gain adjustment. Attenuate other channels by
- * finding noise difference:
- *
- * (accum_noise[i] - accum_noise[reference]) / 30
- *
- * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB.
- * For use in diff_gain_[abc] fields of struct il_calibration_cmd, the
- * driver should limit the difference results to a range of 0-3 (0-4.5 dB),
- * and set bit 2 to indicate "reduce gain". The value for the reference
- * (weakest) chain should be "0".
- *
- * diff_gain_[abc] bit fields:
- * 2: (1) reduce gain, (0) increase gain
- * 1-0: amount of gain, units of 1.5 dB
- */
-
-/* Phy calibration command for series */
-/* The default calibrate table size if not specified by firmware */
-#define IL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE 18
-enum {
- IL_PHY_CALIBRATE_DIFF_GAIN_CMD = 7,
- IL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 19,
-};
-
-#define IL_MAX_PHY_CALIBRATE_TBL_SIZE (253)
-
-struct il_calib_hdr {
- u8 op_code;
- u8 first_group;
- u8 groups_num;
- u8 data_valid;
-} __packed;
-
-/* IL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */
-struct il_calib_diff_gain_cmd {
- struct il_calib_hdr hdr;
- s8 diff_gain_a; /* see above */
- s8 diff_gain_b;
- s8 diff_gain_c;
- u8 reserved1;
-} __packed;
-
-/******************************************************************************
- * (12)
- * Miscellaneous Commands:
- *
- *****************************************************************************/
-
-/*
- * LEDs Command & Response
- * C_LEDS = 0x48 (command, has simple generic response)
- *
- * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
- * this command turns it on or off, or sets up a periodic blinking cycle.
- */
-struct il_led_cmd {
- __le32 interval; /* "interval" in uSec */
- u8 id; /* 1: Activity, 2: Link, 3: Tech */
- u8 off; /* # intervals off while blinking;
- * "0", with >0 "on" value, turns LED on */
- u8 on; /* # intervals on while blinking;
- * "0", regardless of "off", turns LED off */
- u8 reserved;
-} __packed;
-
-
-/******************************************************************************
- * (13)
- * Union of all expected notifications/responses:
- *
- *****************************************************************************/
-
-struct il_rx_pkt {
- /*
- * The first 4 bytes of the RX frame header contain both the RX frame
- * size and some flags.
- * Bit fields:
- * 31: flag flush RB request
- * 30: flag ignore TC (terminal counter) request
- * 29: flag fast IRQ request
- * 28-14: Reserved
- * 13-00: RX frame size
- */
- __le32 len_n_flags;
- struct il_cmd_header hdr;
- union {
- struct il3945_rx_frame rx_frame;
- struct il3945_tx_resp tx_resp;
- struct il3945_beacon_notif beacon_status;
-
- struct il_alive_resp alive_frame;
- struct il_spectrum_notification spectrum_notif;
- struct il_csa_notification csa_notif;
- struct il_error_resp err_resp;
- struct il_card_state_notif card_state_notif;
- struct il_add_sta_resp add_sta;
- struct il_rem_sta_resp rem_sta;
- struct il_sleep_notification sleep_notif;
- struct il_spectrum_resp spectrum;
- struct il_notif_stats stats;
- struct il_compressed_ba_resp compressed_ba;
- struct il_missed_beacon_notif missed_beacon;
- __le32 status;
- u8 raw[0];
- } u;
-} __packed;
-
-#endif /* __il_commands_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h
index 2ebd807..991b455 100644
--- a/drivers/net/wireless/iwlegacy/iwl-dev.h
+++ b/drivers/net/wireless/iwlegacy/iwl-dev.h
@@ -25,7 +25,7 @@
*****************************************************************************/
/*
* Please use this file (iwl-dev.h) for driver implementation definitions.
- * Please use iwl-commands.h for uCode API definitions.
+ * Please use commands.h for uCode API definitions.
* Please use 4965.h for hardware-related definitions.
*/

@@ -42,7 +42,6 @@
#include "iwl-eeprom.h"
#include "iwl-csr.h"
#include "iwl-prph.h"
-#include "iwl-fh.h"
#include "iwl-debug.h"
#include "4965.h"
#include "iwl-led.h"
diff --git a/drivers/net/wireless/iwlegacy/iwl-power.h b/drivers/net/wireless/iwlegacy/iwl-power.h
index e4a0ef2..c0ae3fa 100644
--- a/drivers/net/wireless/iwlegacy/iwl-power.h
+++ b/drivers/net/wireless/iwlegacy/iwl-power.h
@@ -28,7 +28,7 @@
#ifndef __il_power_setting_h__
#define __il_power_setting_h__

-#include "iwl-commands.h"
+#include "commands.h"

enum il_power_level {
IL_POWER_IDX_1,
--
1.7.1


2011-11-18 08:21:08

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 09/77] iwlegacy: remove IL_CRIT

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/iwl-4965-lib.c | 2 +-
drivers/net/wireless/iwlegacy/iwl-debug.h | 1 -
drivers/net/wireless/iwlegacy/iwl3945-base.c | 2 +-
3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
index f4df28d..6503b8f 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
@@ -309,7 +309,7 @@ static void il4965_rx_allocate(struct il_priv *il, gfp_t priority)

if ((rxq->free_count <= RX_LOW_WATERMARK) &&
net_ratelimit())
- IL_CRIT(
+ IL_ERR(
"Failed to alloc_pages with %s. "
"Only %u free buffers remaining.\n",
priority == GFP_ATOMIC ?
diff --git a/drivers/net/wireless/iwlegacy/iwl-debug.h b/drivers/net/wireless/iwlegacy/iwl-debug.h
index 373188d..77467de 100644
--- a/drivers/net/wireless/iwlegacy/iwl-debug.h
+++ b/drivers/net/wireless/iwlegacy/iwl-debug.h
@@ -35,7 +35,6 @@ extern u32 il_debug_level;
#define IL_ERR(f, a...) dev_err(&il->pci_dev->dev, f, ## a)
#define IL_WARN(f, a...) dev_warn(&il->pci_dev->dev, f, ## a)
#define IL_INFO(f, a...) dev_info(&il->pci_dev->dev, f, ## a)
-#define IL_CRIT(f, a...) dev_crit(&il->pci_dev->dev, f, ## a)

#define il_print_hex_error(il, p, len) \
do { \
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index 8a6b193..66aa850 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -1043,7 +1043,7 @@ static void il3945_rx_allocate(struct il_priv *il, gfp_t priority)
D_INFO("Failed to allocate SKB buffer.\n");
if ((rxq->free_count <= RX_LOW_WATERMARK) &&
net_ratelimit())
- IL_CRIT("Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n",
+ IL_ERR("Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n",
priority == GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL",
rxq->free_count);
/* We don't reschedule replenish work here -- we will
--
1.7.1


2011-11-18 08:23:14

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 70/77] iwlegacy: remove unused IL_AC_UNSET define

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/4965.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/4965.c b/drivers/net/wireless/iwlegacy/4965.c
index 6f5e6a1..ac80a00 100644
--- a/drivers/net/wireless/iwlegacy/4965.c
+++ b/drivers/net/wireless/iwlegacy/4965.c
@@ -40,8 +40,6 @@
#include "common.h"
#include "4965.h"

-#define IL_AC_UNSET -1
-
/**
* il_verify_inst_sparse - verify runtime uCode image in card vs. host,
* using sample data 100 bytes apart. If these sample points are good,
--
1.7.1


2011-11-18 08:23:22

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 73/77] iwlegacy: 4965-rs: remove unnecessary null check for sta and lq_sta

From: Greg Dietsche <[email protected]>

both sta and lq_sta are guaranteed to be not null in the calling
function so we don't need to check them here.

Signed-off-by: Greg Dietsche <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/4965-rs.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/4965-rs.c b/drivers/net/wireless/iwlegacy/4965-rs.c
index b0946a1..2ec808e 100644
--- a/drivers/net/wireless/iwlegacy/4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/4965-rs.c
@@ -1793,9 +1793,6 @@ il4965_rs_rate_scale_perform(struct il_priv *il, struct sk_buff *skb,
(info->flags & IEEE80211_TX_CTL_NO_ACK))
return;

- if (!sta || !lq_sta)
- return;
-
lq_sta->supp_rates = sta->supp_rates[lq_sta->band];

tid = il4965_rs_tl_add_packet(lq_sta, hdr);
--
1.7.1


2011-11-18 08:21:01

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 06/77] iwlegacy: remove DEBUG_LIMIT

Even if messages are generating fast we want to see all of them
when debugging.

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/iwl-3945.c | 4 ++--
drivers/net/wireless/iwlegacy/iwl-4965-lib.c | 4 ++--
drivers/net/wireless/iwlegacy/iwl-4965-rs.c | 4 ++--
drivers/net/wireless/iwlegacy/iwl-4965.c | 2 +-
drivers/net/wireless/iwlegacy/iwl-debug.h | 22 +---------------------
5 files changed, 8 insertions(+), 28 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.c b/drivers/net/wireless/iwlegacy/iwl-3945.c
index c9b5dcf..628adf5 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945.c
@@ -477,7 +477,7 @@ static void il3945_pass_packet_to_mac80211(struct il_priv *il,

/* We only process data packets if the interface is open */
if (unlikely(!il->is_open)) {
- IL_DEBUG_DROP_LIMIT(il,
+ IL_DEBUG_DROP(il,
"Dropping packet while interface is not open.\n");
return;
}
@@ -563,7 +563,7 @@ static void il3945_rx_reply_rx(struct il_priv *il,

network_packet = il3945_is_network_packet(il, header);

- IL_DEBUG_STATS_LIMIT(il, "[%c] %d RSSI:%d Signal:%u, Rate:%u\n",
+ IL_DEBUG_STATS(il, "[%c] %d RSSI:%d Signal:%u, Rate:%u\n",
network_packet ? '*' : ' ',
le16_to_cpu(rx_hdr->channel),
rx_status.signal, rx_status.signal,
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
index 647399e..1564629 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
@@ -537,7 +537,7 @@ static void il4965_pass_packet_to_mac80211(struct il_priv *il,

/* We only process data packets if the interface is open */
if (unlikely(!il->is_open)) {
- IL_DEBUG_DROP_LIMIT(il,
+ IL_DEBUG_DROP(il,
"Dropping packet while interface is not open.\n");
return;
}
@@ -647,7 +647,7 @@ void il4965_rx_reply_rx(struct il_priv *il,
rx_status.signal = il4965_calc_rssi(il, phy_res);

il_dbg_log_rx_data_frame(il, len, header);
- IL_DEBUG_STATS_LIMIT(il, "Rssi %d, TSF %llu\n",
+ IL_DEBUG_STATS(il, "Rssi %d, TSF %llu\n",
rx_status.signal, (unsigned long long)rx_status.mactime);

/*
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
index 60ff0cd..782ec77 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
@@ -817,7 +817,7 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
struct il_station_priv *sta_priv = (void *)sta->drv_priv;
struct il_rxon_context *ctx = sta_priv->common.ctx;

- IL_DEBUG_RATE_LIMIT(il,
+ IL_DEBUG_RATE(il,
"get frame ack response, update rate scale window\n");

/* Treat uninitialized rate scaling data same as non-existing. */
@@ -2251,7 +2251,7 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
struct il_lq_sta *lq_sta = il_sta;
int rate_idx;

- IL_DEBUG_RATE_LIMIT(il, "rate scale calculate new rate for skb\n");
+ IL_DEBUG_RATE(il, "rate scale calculate new rate for skb\n");

/* Get max rate if user set max rate */
if (lq_sta) {
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c
index d3c8183..01fa6c8 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.c
@@ -1737,7 +1737,7 @@ static u8 il4965_find_station(struct il_priv *il, const u8 *addr)
goto out;
}

- IL_DEBUG_ASSOC_LIMIT(il, "can not find STA %pM total %d\n",
+ IL_DEBUG_ASSOC(il, "can not find STA %pM total %d\n",
addr, il->num_stations);

out:
diff --git a/drivers/net/wireless/iwlegacy/iwl-debug.h b/drivers/net/wireless/iwlegacy/iwl-debug.h
index a825051..c6dcbf3 100644
--- a/drivers/net/wireless/iwlegacy/iwl-debug.h
+++ b/drivers/net/wireless/iwlegacy/iwl-debug.h
@@ -52,14 +52,6 @@ do { \
__func__ , ## args); \
} while (0)

-#define IL_DEBUG_LIMIT(__priv, level, fmt, args...) \
-do { \
- if ((il_get_debug_level(__priv) & (level)) && net_ratelimit()) \
- dev_printk(KERN_ERR, &(__priv->hw->wiphy->dev), \
- "%c %s " fmt, in_interrupt() ? 'I' : 'U', \
- __func__ , ## args); \
-} while (0)
-
#define il_print_hex_dump(il, level, p, len) \
do { \
if (il_get_debug_level(il) & level) \
@@ -69,7 +61,6 @@ do { \

#else
#define IL_DEBUG(__priv, level, fmt, args...)
-#define IL_DEBUG_LIMIT(__priv, level, fmt, args...)
static inline void il_print_hex_dump(struct il_priv *il, int level,
const void *p, u32 len)
{}
@@ -169,25 +160,14 @@ static inline void il_dbgfs_unregister(struct il_priv *il)
#define IL_DEBUG_FW(p, f, a...) IL_DEBUG(p, IL_DL_FW, f, ## a)
#define IL_DEBUG_RF_KILL(p, f, a...) IL_DEBUG(p, IL_DL_RF_KILL, f, ## a)
#define IL_DEBUG_DROP(p, f, a...) IL_DEBUG(p, IL_DL_DROP, f, ## a)
-#define IL_DEBUG_DROP_LIMIT(p, f, a...) \
- IL_DEBUG_LIMIT(p, IL_DL_DROP, f, ## a)
#define IL_DEBUG_AP(p, f, a...) IL_DEBUG(p, IL_DL_AP, f, ## a)
#define IL_DEBUG_TXPOWER(p, f, a...) IL_DEBUG(p, IL_DL_TXPOWER, f, ## a)
#define IL_DEBUG_RATE(p, f, a...) IL_DEBUG(p, IL_DL_RATE, f, ## a)
-#define IL_DEBUG_RATE_LIMIT(p, f, a...) \
- IL_DEBUG_LIMIT(p, IL_DL_RATE, f, ## a)
#define IL_DEBUG_NOTIF(p, f, a...) IL_DEBUG(p, IL_DL_NOTIF, f, ## a)
-#define IL_DEBUG_ASSOC(p, f, a...) \
- IL_DEBUG(p, IL_DL_ASSOC | IL_DL_INFO, f, ## a)
-#define IL_DEBUG_ASSOC_LIMIT(p, f, a...) \
- IL_DEBUG_LIMIT(p, IL_DL_ASSOC | IL_DL_INFO, f, ## a)
+#define IL_DEBUG_ASSOC(p, f, a...) IL_DEBUG(p, IL_DL_ASSOC, f, ## a)
#define IL_DEBUG_HT(p, f, a...) IL_DEBUG(p, IL_DL_HT, f, ## a)
#define IL_DEBUG_STATS(p, f, a...) IL_DEBUG(p, IL_DL_STATS, f, ## a)
-#define IL_DEBUG_STATS_LIMIT(p, f, a...) \
- IL_DEBUG_LIMIT(p, IL_DL_STATS, f, ## a)
#define IL_DEBUG_TX_REPLY(p, f, a...) IL_DEBUG(p, IL_DL_TX_REPLY, f, ## a)
-#define IL_DEBUG_TX_REPLY_LIMIT(p, f, a...) \
- IL_DEBUG_LIMIT(p, IL_DL_TX_REPLY, f, ## a)
#define IL_DEBUG_QOS(p, f, a...) IL_DEBUG(p, IL_DL_QOS, f, ## a)
#define IL_DEBUG_RADIO(p, f, a...) IL_DEBUG(p, IL_DL_RADIO, f, ## a)
#define IL_DEBUG_POWER(p, f, a...) IL_DEBUG(p, IL_DL_POWER, f, ## a)
--
1.7.1


2011-11-21 07:44:14

by Stanislaw Gruszka

[permalink] [raw]
Subject: Re: [PATCH 43/77] iwlegacy: rename REPLY_ to N_ or C_

On Fri, Nov 18, 2011 at 06:03:06PM -0500, Pavel Roskin wrote:
> The explanation for the change is missing.
I believe topic + patch contents are self explanatory.

Stanislaw

2011-11-18 08:21:22

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 16/77] iwlegacy: remove not needed parentheses

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/iwl-3945-hw.h | 4 +-
drivers/net/wireless/iwlegacy/iwl-3945-rs.c | 40 ++++----
drivers/net/wireless/iwlegacy/iwl-3945.c | 25 +++---
drivers/net/wireless/iwlegacy/iwl-4965-calib.c | 27 +++---
drivers/net/wireless/iwlegacy/iwl-4965-hw.h | 8 +-
drivers/net/wireless/iwlegacy/iwl-4965-lib.c | 6 +-
drivers/net/wireless/iwlegacy/iwl-4965-rs.c | 125 +++++++++++-------------
drivers/net/wireless/iwlegacy/iwl-4965-tx.c | 19 ++--
drivers/net/wireless/iwlegacy/iwl-4965.c | 44 ++++----
drivers/net/wireless/iwlegacy/iwl-4965.h | 4 +-
drivers/net/wireless/iwlegacy/iwl-core.c | 18 ++--
drivers/net/wireless/iwlegacy/iwl-io.h | 2 +-
drivers/net/wireless/iwlegacy/iwl-legacy-rs.h | 2 +-
drivers/net/wireless/iwlegacy/iwl-scan.c | 2 +-
drivers/net/wireless/iwlegacy/iwl-sta.c | 2 +-
drivers/net/wireless/iwlegacy/iwl-tx.c | 2 +-
drivers/net/wireless/iwlegacy/iwl3945-base.c | 20 ++--
17 files changed, 168 insertions(+), 182 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
index ad05093..67650ff 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
@@ -264,8 +264,8 @@ struct il3945_eeprom {

static inline int il3945_hw_valid_rtc_data_addr(u32 addr)
{
- return (addr >= IWL39_RTC_DATA_LOWER_BOUND) &&
- (addr < IWL39_RTC_DATA_UPPER_BOUND);
+ return (addr >= IWL39_RTC_DATA_LOWER_BOUND &&
+ addr < IWL39_RTC_DATA_UPPER_BOUND);
}

/* Base physical address of il3945_shared is provided to FH_TSSR_CBB_BASE
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
index d05da7a..afa6be8 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
@@ -104,7 +104,7 @@ static u8 il3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band)
u32 table_size = 0;
struct il3945_tpt_entry *tpt_table = NULL;

- if ((rssi < IL_MIN_RSSI_VAL) || (rssi > IL_MAX_RSSI_VAL))
+ if (rssi < IL_MIN_RSSI_VAL || rssi > IL_MAX_RSSI_VAL)
rssi = IL_MIN_RSSI_VAL;

switch (band) {
@@ -123,7 +123,7 @@ static u8 il3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band)
break;
}

- while ((index < table_size) && (rssi < tpt_table[index].min_rssi))
+ while (index < table_size && rssi < tpt_table[index].min_rssi)
index++;

index = min(index, (table_size - 1));
@@ -315,8 +315,8 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
fail_count = window->counter - window->success_counter;

/* Calculate average throughput, if we have enough history. */
- if ((fail_count >= IL_RATE_MIN_FAILURE_TH) ||
- (window->success_counter >= IL_RATE_MIN_SUCCESS_TH))
+ if (fail_count >= IL_RATE_MIN_FAILURE_TH ||
+ window->success_counter >= IL_RATE_MIN_SUCCESS_TH)
window->average_tpt = ((window->success_ratio *
rs_sta->expected_tpt[index] + 64) / 128);
else
@@ -461,7 +461,7 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
retries = IL_RATE_RETRY_TH;

first_index = sband->bitrates[info->status.rates[0].idx].hw_value;
- if ((first_index < 0) || (first_index >= IL_RATE_COUNT_3945)) {
+ if (first_index < 0 || first_index >= IL_RATE_COUNT_3945) {
D_RATE("leave: Rate out of bounds: %d\n", first_index);
return;
}
@@ -663,9 +663,9 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,

/* get user max rate if set */
max_rate_idx = txrc->max_rate_idx;
- if ((sband->band == IEEE80211_BAND_5GHZ) && (max_rate_idx != -1))
+ if (sband->band == IEEE80211_BAND_5GHZ && max_rate_idx != -1)
max_rate_idx += IL_FIRST_OFDM_RATE;
- if ((max_rate_idx < 0) || (max_rate_idx >= IL_RATE_COUNT))
+ if (max_rate_idx < 0 || max_rate_idx >= IL_RATE_COUNT)
max_rate_idx = -1;

index = min(rs_sta->last_txrate_idx & 0xffff, IL_RATE_COUNT_3945 - 1);
@@ -686,7 +686,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
}

/* force user max rate if set by user */
- if ((max_rate_idx != -1) && (max_rate_idx < index)) {
+ if (max_rate_idx != -1 && max_rate_idx < index) {
if (rate_mask & (1 << max_rate_idx))
index = max_rate_idx;
}
@@ -695,8 +695,8 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,

fail_count = window->counter - window->success_counter;

- if (((fail_count < IL_RATE_MIN_FAILURE_TH) &&
- (window->success_counter < IL_RATE_MIN_SUCCESS_TH))) {
+ if (fail_count < IL_RATE_MIN_FAILURE_TH &&
+ window->success_counter < IL_RATE_MIN_SUCCESS_TH) {
spin_unlock_irqrestore(&rs_sta->lock, flags);

D_RATE("Invalid average_tpt on rate %d: "
@@ -721,7 +721,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
high = (high_low >> 8) & 0xff;

/* If user set max rate, dont allow higher than user constrain */
- if ((max_rate_idx != -1) && (max_rate_idx < high))
+ if (max_rate_idx != -1 && max_rate_idx < high)
high = IL_RATE_INVALID;

/* Collect Measured throughputs of adjacent rates */
@@ -736,13 +736,13 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
scale_action = 0;

/* Low success ratio , need to drop the rate */
- if ((window->success_ratio < IL_RATE_DECREASE_TH) || !current_tpt) {
+ if (window->success_ratio < IL_RATE_DECREASE_TH || !current_tpt) {
D_RATE("decrease rate because of low success_ratio\n");
scale_action = -1;
/* No throughput measured yet for adjacent rates,
* try increase */
- } else if ((low_tpt == IL_INVALID_VALUE) &&
- (high_tpt == IL_INVALID_VALUE)) {
+ } else if (low_tpt == IL_INVALID_VALUE &&
+ high_tpt == IL_INVALID_VALUE) {

if (high != IL_RATE_INVALID && window->success_ratio >= IL_RATE_INCREASE_TH)
scale_action = 1;
@@ -752,9 +752,9 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
/* Both adjacent throughputs are measured, but neither one has
* better throughput; we're using the best rate, don't change
* it! */
- } else if ((low_tpt != IL_INVALID_VALUE) &&
- (high_tpt != IL_INVALID_VALUE) &&
- (low_tpt < current_tpt) && (high_tpt < current_tpt)) {
+ } else if (low_tpt != IL_INVALID_VALUE &&
+ high_tpt != IL_INVALID_VALUE &&
+ low_tpt < current_tpt && high_tpt < current_tpt) {

D_RATE("No action -- low [%d] & high [%d] < "
"current_tpt [%d]\n",
@@ -790,9 +790,9 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,

/* Sanity check; asked for decrease, but success rate or throughput
* has been good at old rate. Don't change it. */
- if ((scale_action == -1) && (low != IL_RATE_INVALID) &&
- ((window->success_ratio > IL_RATE_HIGH_TH) ||
- (current_tpt > (100 * rs_sta->expected_tpt[low]))))
+ if (scale_action == -1 && low != IL_RATE_INVALID &&
+ (window->success_ratio > IL_RATE_HIGH_TH ||
+ current_tpt > 100 * rs_sta->expected_tpt[low]))
scale_action = 0;

switch (scale_action) {
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.c b/drivers/net/wireless/iwlegacy/iwl-3945.c
index cdea5b0..fb69b74 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945.c
@@ -173,7 +173,7 @@ void il3945_disable_events(struct il_priv *il)
disable_ptr = il_read_targ_mem(il, base + (4 * sizeof(u32)));
array_size = il_read_targ_mem(il, base + (5 * sizeof(u32)));

- if (IL_EVT_DISABLE && (array_size == IL_EVT_DISABLE_SIZE)) {
+ if (IL_EVT_DISABLE && array_size == IL_EVT_DISABLE_SIZE) {
D_INFO("Disabling selected uCode log events at 0x%x\n",
disable_ptr);
for (i = 0; i < IL_EVT_DISABLE_SIZE; i++)
@@ -293,9 +293,8 @@ static void il3945_tx_queue_reclaim(struct il_priv *il,
il->cfg->ops->lib->txq_free_tfd(il, txq);
}

- if (il_queue_space(q) > q->low_mark && (txq_id >= 0) &&
- (txq_id != IWL39_CMD_QUEUE_NUM) &&
- il->mac80211_registered)
+ if (il_queue_space(q) > q->low_mark && txq_id >= 0 &&
+ txq_id != IWL39_CMD_QUEUE_NUM && il->mac80211_registered)
il_wake_queue(il, txq);
}

@@ -316,7 +315,7 @@ static void il3945_rx_reply_tx(struct il_priv *il,
int rate_idx;
int fail;

- if ((index >= txq->q.n_bd) || (il_queue_used(&txq->q, index) == 0)) {
+ if (index >= txq->q.n_bd || il_queue_used(&txq->q, index) == 0) {
IL_ERR("Read index for DMA queue txq_id (%d) index %d "
"is out of range [0-%d] %d %d\n", txq_id,
index, txq->q.n_bd, txq->q.write_ptr,
@@ -544,8 +543,8 @@ static void il3945_rx_reply_rx(struct il_priv *il,
return;
}

- if (!(rx_end->status & RX_RES_STATUS_NO_CRC32_ERROR)
- || !(rx_end->status & RX_RES_STATUS_NO_RXE_OVERFLOW)) {
+ if (!(rx_end->status & RX_RES_STATUS_NO_CRC32_ERROR) ||
+ !(rx_end->status & RX_RES_STATUS_NO_RXE_OVERFLOW)) {
D_RX("Bad CRC or FIFO: 0x%08X.\n", rx_end->status);
return;
}
@@ -599,7 +598,7 @@ int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il,

count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags));

- if ((count >= NUM_TFD_CHUNKS) || (count < 0)) {
+ if (count >= NUM_TFD_CHUNKS || count < 0) {
IL_ERR("Error can not send more than %d chunks\n",
NUM_TFD_CHUNKS);
return -EINVAL;
@@ -1053,7 +1052,7 @@ static int il3945_hw_reg_adjust_power_by_temp(int new_reading, int old_reading)
*/
static inline int il3945_hw_reg_temp_out_of_range(int temperature)
{
- return ((temperature < -260) || (temperature > 25)) ? 1 : 0;
+ return (temperature < -260 || temperature > 25) ? 1 : 0;
}

int il3945_hw_get_temperature(struct il_priv *il)
@@ -1666,10 +1665,10 @@ static int il3945_send_rxon_assoc(struct il_priv *il,
const struct il_rxon_cmd *rxon1 = &ctx->staging;
const struct il_rxon_cmd *rxon2 = &ctx->active;

- if ((rxon1->flags == rxon2->flags) &&
- (rxon1->filter_flags == rxon2->filter_flags) &&
- (rxon1->cck_basic_rates == rxon2->cck_basic_rates) &&
- (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) {
+ if (rxon1->flags == rxon2->flags &&
+ rxon1->filter_flags == rxon2->filter_flags &&
+ rxon1->cck_basic_rates == rxon2->cck_basic_rates &&
+ rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates) {
D_INFO("Using current RXON_ASSOC. Not resending.\n");
return 0;
}
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-calib.c b/drivers/net/wireless/iwlegacy/iwl-4965-calib.c
index 7f85834..c055a15 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-calib.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-calib.c
@@ -198,8 +198,8 @@ static int il4965_sens_energy_cck(struct il_priv *il,
data->num_in_cck_no_fa);

/* If we got too many false alarms this time, reduce sensitivity */
- if ((false_alarms > max_false_alarms) &&
- (data->auto_corr_cck > AUTO_CORR_MAX_TH_CCK)) {
+ if (false_alarms > max_false_alarms &&
+ data->auto_corr_cck > AUTO_CORR_MAX_TH_CCK) {
D_CALIB("norm FA %u > max FA %u\n",
false_alarms, max_false_alarms);
D_CALIB("... reducing sensitivity\n");
@@ -230,9 +230,9 @@ static int il4965_sens_energy_cck(struct il_priv *il,
* from a previous beacon with too many, or healthy # FAs
* OR 2) We've seen a lot of beacons (100) with too few
* false alarms */
- if ((data->nrg_prev_state != IL_FA_TOO_MANY) &&
- ((data->nrg_auto_corr_silence_diff > NRG_DIFF) ||
- (data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA))) {
+ if (data->nrg_prev_state != IL_FA_TOO_MANY &&
+ (data->nrg_auto_corr_silence_diff > NRG_DIFF ||
+ data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA)) {

D_CALIB("... increasing sensitivity\n");
/* Increase nrg value to increase sensitivity */
@@ -289,9 +289,9 @@ static int il4965_sens_energy_cck(struct il_priv *il,
val = data->auto_corr_cck_mrc + AUTO_CORR_STEP_CCK;
data->auto_corr_cck_mrc =
min((u32)ranges->auto_corr_max_cck_mrc, val);
- } else if ((false_alarms < min_false_alarms) &&
- ((data->nrg_auto_corr_silence_diff > NRG_DIFF) ||
- (data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA))) {
+ } else if (false_alarms < min_false_alarms &&
+ (data->nrg_auto_corr_silence_diff > NRG_DIFF ||
+ data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA)) {

/* Decrease auto_corr values to increase sensitivity */
val = data->auto_corr_cck - AUTO_CORR_STEP_CCK;
@@ -747,9 +747,8 @@ static void il4965_gain_computation(struct il_priv *il,
for (i = default_chain; i < NUM_RX_CHAINS; i++) {
s32 delta_g = 0;

- if (!(data->disconn_array[i]) &&
- (data->delta_gain_code[i] ==
- CHAIN_NOISE_DELTA_GAIN_INIT_VAL)) {
+ if (!data->disconn_array[i] &&
+ data->delta_gain_code[i] == CHAIN_NOISE_DELTA_GAIN_INIT_VAL) {
delta_g = average_noise[i] - min_average_noise;
data->delta_gain_code[i] = (u8)((delta_g * 10) / 15);
data->delta_gain_code[i] =
@@ -860,7 +859,7 @@ void il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp)

/* Make sure we accumulate data for just the associated channel
* (even if scanning). */
- if ((rxon_chnum != stat_chnum) || (rxon_band24 != stat_band24)) {
+ if (rxon_chnum != stat_chnum || rxon_band24 != stat_band24) {
D_CALIB("Stats not from chan=%d, band24=%d\n",
rxon_chnum, rxon_band24);
spin_unlock_irqrestore(&il->lock, flags);
@@ -920,8 +919,8 @@ void il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp)
il->cfg->base_params->chain_noise_num_beacons;

for (i = 0; i < NUM_RX_CHAINS; i++) {
- if (!(data->disconn_array[i]) &&
- (average_noise[i] <= min_average_noise)) {
+ if (!data->disconn_array[i] &&
+ average_noise[i] <= min_average_noise) {
/* This means that chain i is active and has
* lower noise values so far: */
min_average_noise = average_noise[i];
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
index b6b7fe2..b21c004 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
@@ -102,8 +102,8 @@

static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
{
- return (addr >= IWL49_RTC_DATA_LOWER_BOUND) &&
- (addr < IWL49_RTC_DATA_UPPER_BOUND);
+ return (addr >= IWL49_RTC_DATA_LOWER_BOUND &&
+ addr < IWL49_RTC_DATA_UPPER_BOUND);
}

/********************* START TEMPERATURE *************************************/
@@ -147,8 +147,8 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
#define IL_TX_POWER_TEMPERATURE_MAX (410)

#define IL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(t) \
- (((t) < IL_TX_POWER_TEMPERATURE_MIN) || \
- ((t) > IL_TX_POWER_TEMPERATURE_MAX))
+ ((t) < IL_TX_POWER_TEMPERATURE_MIN || \
+ (t) > IL_TX_POWER_TEMPERATURE_MAX)

/********************* END TEMPERATURE ***************************************/

diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
index 8fafd20..8bb2b62 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
@@ -234,7 +234,7 @@ void il4965_rx_queue_restock(struct il_priv *il)
unsigned long flags;

spin_lock_irqsave(&rxq->lock, flags);
- while ((il_rx_queue_space(rxq) > 0) && (rxq->free_count)) {
+ while (il_rx_queue_space(rxq) > 0 && rxq->free_count) {
/* The overwritten rxb must be a used one */
rxb = rxq->queue[rxq->write];
BUG_ON(rxb && rxb->page);
@@ -307,7 +307,7 @@ static void il4965_rx_allocate(struct il_priv *il, gfp_t priority)
"order: %d\n",
il->hw_params.rx_page_order);

- if ((rxq->free_count <= RX_LOW_WATERMARK) &&
+ if (rxq->free_count <= RX_LOW_WATERMARK &&
net_ratelimit())
IL_ERR(
"Failed to alloc_pages with %s. "
@@ -1106,7 +1106,7 @@ void il4965_set_rxon_chain(struct il_priv *il, struct il_rxon_context *ctx)

ctx->staging.rx_chain = cpu_to_le16(rx_chain);

- if (!is_single && (active_rx_cnt >= IL_NUM_RX_CHAINS_SINGLE) && is_cam)
+ if (!is_single && active_rx_cnt >= IL_NUM_RX_CHAINS_SINGLE && is_cam)
ctx->staging.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK;
else
ctx->staging.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK;
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
index 93bb31d..c2f4230 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
@@ -127,7 +127,7 @@ static int il4965_hwrate_to_plcp_idx(u32 rate_n_flags)
/* skip 9M not supported in ht*/
if (idx >= IL_RATE_9M_INDEX)
idx += 1;
- if ((idx >= IL_FIRST_OFDM_RATE) && (idx <= IL_LAST_OFDM_RATE))
+ if (idx >= IL_FIRST_OFDM_RATE && idx <= IL_LAST_OFDM_RATE)
return idx;

/* legacy rate format, search for match in table */
@@ -251,8 +251,7 @@ il4965_rs_tl_rm_old_stats(struct il_traffic_load *tl, u32 curr_time)
/* The oldest age we want to keep */
u32 oldest_time = curr_time - TID_MAX_TIME_DIFF;

- while (tl->queue_count &&
- (tl->time_stamp < oldest_time)) {
+ while (tl->queue_count && tl->time_stamp < oldest_time) {
tl->total -= tl->packet_count[tl->head];
tl->packet_count[tl->head] = 0;
tl->time_stamp += TID_QUEUE_CELL_SPACING;
@@ -477,8 +476,8 @@ static int il4965_rs_collect_tx_data(struct il_scale_tbl_info *tbl,
fail_count = window->counter - window->success_counter;

/* Calculate average throughput, if we have enough history. */
- if ((fail_count >= IL_RATE_MIN_FAILURE_TH) ||
- (window->success_counter >= IL_RATE_MIN_SUCCESS_TH))
+ if (fail_count >= IL_RATE_MIN_FAILURE_TH ||
+ window->success_counter >= IL_RATE_MIN_SUCCESS_TH)
window->average_tpt = (window->success_ratio * tpt + 64) / 128;
else
window->average_tpt = IL_INVALID_VALUE;
@@ -619,7 +618,7 @@ static int il4965_rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags,

new_ant_type = ant_toggle_lookup[tbl->ant_type];

- while ((new_ant_type != tbl->ant_type) &&
+ while (new_ant_type != tbl->ant_type &&
!il4965_rs_is_valid_ant(valid_ant, new_ant_type))
new_ant_type = ant_toggle_lookup[new_ant_type];

@@ -790,8 +789,8 @@ out:
static bool il4965_table_type_matches(struct il_scale_tbl_info *a,
struct il_scale_tbl_info *b)
{
- return (a->lq_type == b->lq_type) && (a->ant_type == b->ant_type) &&
- (a->is_SGI == b->is_SGI);
+ return (a->lq_type == b->lq_type && a->ant_type == b->ant_type &&
+ a->is_SGI == b->is_SGI);
}

/*
@@ -830,7 +829,7 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
}

if (!ieee80211_is_data(hdr->frame_control) ||
- info->flags & IEEE80211_TX_CTL_NO_ACK)
+ (info->flags & IEEE80211_TX_CTL_NO_ACK))
return;

/* This packet was aggregated but doesn't carry status info */
@@ -867,19 +866,14 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
mac_index += IL_FIRST_OFDM_RATE;
}
/* Here we actually compare this rate to the latest LQ command */
- if ((mac_index < 0) ||
- (tbl_type.is_SGI !=
- !!(mac_flags & IEEE80211_TX_RC_SHORT_GI)) ||
- (tbl_type.is_ht40 !=
- !!(mac_flags & IEEE80211_TX_RC_40_MHZ_WIDTH)) ||
- (tbl_type.is_dup !=
- !!(mac_flags & IEEE80211_TX_RC_DUP_DATA)) ||
- (tbl_type.ant_type != info->antenna_sel_tx) ||
- (!!(tx_rate & RATE_MCS_HT_MSK) !=
- !!(mac_flags & IEEE80211_TX_RC_MCS)) ||
- (!!(tx_rate & RATE_MCS_GF_MSK) !=
- !!(mac_flags & IEEE80211_TX_RC_GREEN_FIELD)) ||
- (rs_index != mac_index)) {
+ if (mac_index < 0 ||
+ tbl_type.is_SGI != !!(mac_flags & IEEE80211_TX_RC_SHORT_GI) ||
+ tbl_type.is_ht40 != !!(mac_flags & IEEE80211_TX_RC_40_MHZ_WIDTH) ||
+ tbl_type.is_dup != !!(mac_flags & IEEE80211_TX_RC_DUP_DATA) ||
+ tbl_type.ant_type != info->antenna_sel_tx ||
+ !!(tx_rate & RATE_MCS_HT_MSK) != !!(mac_flags & IEEE80211_TX_RC_MCS) ||
+ !!(tx_rate & RATE_MCS_GF_MSK) != !!(mac_flags & IEEE80211_TX_RC_GREEN_FIELD) ||
+ rs_index != mac_index) {
D_RATE(
"initial rate %d does not match %d (0x%x)\n",
mac_index, rs_index, tx_rate);
@@ -1119,12 +1113,12 @@ static s32 il4965_rs_get_best_rate(struct il_priv *il,
* conditions) at candidate rate is above expected
* "active" throughput (under perfect conditions).
*/
- if ((((100 * tpt_tbl[rate]) > lq_sta->last_tpt) &&
- ((active_sr > IL_RATE_DECREASE_TH) &&
- (active_sr <= IL_RATE_HIGH_TH) &&
- (tpt_tbl[rate] <= active_tpt))) ||
- ((active_sr >= IL_RATE_SCALE_SWITCH) &&
- (tpt_tbl[rate] > active_tpt))) {
+ if ((100 * tpt_tbl[rate] > lq_sta->last_tpt &&
+ (active_sr > IL_RATE_DECREASE_TH &&
+ active_sr <= IL_RATE_HIGH_TH &&
+ tpt_tbl[rate] <= active_tpt)) ||
+ (active_sr >= IL_RATE_SCALE_SWITCH &&
+ tpt_tbl[rate] > active_tpt)) {

/* (2nd or later pass)
* If we've already tried to raise the rate, and are
@@ -1213,7 +1207,7 @@ static int il4965_rs_switch_to_mimo2(struct il_priv *il,

D_RATE("LQ: MIMO2 best rate %d mask %X\n",
rate, rate_mask);
- if ((rate == IL_RATE_INVALID) || !((1 << rate) & rate_mask)) {
+ if (rate == IL_RATE_INVALID || !((1 << rate) & rate_mask)) {
D_RATE(
"Can't switch with index %d rate mask %x\n",
rate, rate_mask);
@@ -1265,7 +1259,7 @@ static int il4965_rs_switch_to_siso(struct il_priv *il,
rate = il4965_rs_get_best_rate(il, lq_sta, tbl, rate_mask, index);

D_RATE("LQ: get best rate %d mask %X\n", rate, rate_mask);
- if ((rate == IL_RATE_INVALID) || !((1 << rate) & rate_mask)) {
+ if (rate == IL_RATE_INVALID || !((1 << rate) & rate_mask)) {
D_RATE(
"can not switch with index %d rate mask %x\n",
rate, rate_mask);
@@ -1680,10 +1674,10 @@ il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search)
* stats in active history.
*/
if (force_search ||
- (lq_sta->total_failed > lq_sta->max_failure_limit) ||
- (lq_sta->total_success > lq_sta->max_success_limit) ||
- ((!lq_sta->search_better_tbl) && (lq_sta->flush_timer)
- && (flush_interval_passed))) {
+ lq_sta->total_failed > lq_sta->max_failure_limit ||
+ lq_sta->total_success > lq_sta->max_success_limit ||
+ (!lq_sta->search_better_tbl && lq_sta->flush_timer &&
+ flush_interval_passed)) {
D_RATE("LQ: stay is expired %d %d %d\n:",
lq_sta->total_failed,
lq_sta->total_success,
@@ -1788,7 +1782,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
/* Send management frames and NO_ACK data using lowest rate. */
/* TODO: this could probably be improved.. */
if (!ieee80211_is_data(hdr->frame_control) ||
- info->flags & IEEE80211_TX_CTL_NO_ACK)
+ (info->flags & IEEE80211_TX_CTL_NO_ACK))
return;

if (!sta || !lq_sta)
@@ -1797,7 +1791,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
lq_sta->supp_rates = sta->supp_rates[lq_sta->band];

tid = il4965_rs_tl_add_packet(lq_sta, hdr);
- if ((tid != MAX_TID_COUNT) && (lq_sta->tx_agg_tid_en & (1 << tid))) {
+ if (tid != MAX_TID_COUNT && (lq_sta->tx_agg_tid_en & (1 << tid))) {
tid_data = &il->stations[lq_sta->lq.sta_id].tid[tid];
if (tid_data->agg.state == IL_AGG_OFF)
lq_sta->is_agg = 0;
@@ -1872,8 +1866,8 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
}

/* force user max rate if set by user */
- if ((lq_sta->max_rate_idx != -1) &&
- (lq_sta->max_rate_idx < index)) {
+ if (lq_sta->max_rate_idx != -1 &&
+ lq_sta->max_rate_idx < index) {
index = lq_sta->max_rate_idx;
update_lq = 1;
window = &(tbl->win[index]);
@@ -1890,8 +1884,8 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
* in current association (use new rate found above).
*/
fail_count = window->counter - window->success_counter;
- if ((fail_count < IL_RATE_MIN_FAILURE_TH) &&
- (window->success_counter < IL_RATE_MIN_SUCCESS_TH)) {
+ if (fail_count < IL_RATE_MIN_FAILURE_TH &&
+ window->success_counter < IL_RATE_MIN_SUCCESS_TH) {
D_RATE("LQ: still below TH. succ=%d total=%d "
"for index %d\n",
window->success_counter, window->counter, index);
@@ -1975,8 +1969,8 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
high = (high_low >> 8) & 0xff;

/* If user set max rate, dont allow higher than user constrain */
- if ((lq_sta->max_rate_idx != -1) &&
- (lq_sta->max_rate_idx < high))
+ if (lq_sta->max_rate_idx != -1 &&
+ lq_sta->max_rate_idx < high)
high = IL_RATE_INVALID;

sr = window->success_ratio;
@@ -1991,14 +1985,14 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
scale_action = 0;

/* Too many failures, decrease rate */
- if ((sr <= IL_RATE_DECREASE_TH) || (current_tpt == 0)) {
+ if (sr <= IL_RATE_DECREASE_TH || current_tpt == 0) {
D_RATE(
"decrease rate because of low success_ratio\n");
scale_action = -1;

/* No throughput measured yet for adjacent rates; try increase. */
- } else if ((low_tpt == IL_INVALID_VALUE) &&
- (high_tpt == IL_INVALID_VALUE)) {
+ } else if (low_tpt == IL_INVALID_VALUE &&
+ high_tpt == IL_INVALID_VALUE) {

if (high != IL_RATE_INVALID && sr >= IL_RATE_INCREASE_TH)
scale_action = 1;
@@ -2008,10 +2002,8 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,

/* Both adjacent throughputs are measured, but neither one has better
* throughput; we're using the best rate, don't change it! */
- else if ((low_tpt != IL_INVALID_VALUE) &&
- (high_tpt != IL_INVALID_VALUE) &&
- (low_tpt < current_tpt) &&
- (high_tpt < current_tpt))
+ else if (low_tpt != IL_INVALID_VALUE && high_tpt != IL_INVALID_VALUE &&
+ low_tpt < current_tpt && high_tpt < current_tpt)
scale_action = 0;

/* At least one adjacent rate's throughput is measured,
@@ -2021,7 +2013,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
if (high_tpt != IL_INVALID_VALUE) {
/* Higher rate has better throughput */
if (high_tpt > current_tpt &&
- sr >= IL_RATE_INCREASE_TH) {
+ sr >= IL_RATE_INCREASE_TH) {
scale_action = 1;
} else {
scale_action = 0;
@@ -2042,9 +2034,8 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,

/* Sanity check; asked for decrease, but success rate or throughput
* has been good at old rate. Don't change it. */
- if ((scale_action == -1) && (low != IL_RATE_INVALID) &&
- ((sr > IL_RATE_HIGH_TH) ||
- (current_tpt > (100 * tbl->expected_tpt[low]))))
+ if (scale_action == -1 && low != IL_RATE_INVALID &&
+ (sr > IL_RATE_HIGH_TH || current_tpt > 100 * tbl->expected_tpt[low]))
scale_action = 0;

switch (scale_action) {
@@ -2090,8 +2081,8 @@ lq_update:
* 2) Not just finishing up a search
* 3) Allowing a new search
*/
- if (!update_lq && !done_search &&
- !lq_sta->stay_in_tbl && window->counter) {
+ if (!update_lq && !done_search && !lq_sta->stay_in_tbl &&
+ window->counter) {
/* Save current throughput to compare with "search" throughput*/
lq_sta->last_tpt = current_tpt;

@@ -2146,10 +2137,10 @@ lq_update:
* have been tried and compared, stay in this best modulation
* mode for a while before next round of mode comparisons. */
if (lq_sta->enable_counter &&
- (lq_sta->action_counter >= tbl1->max_search)) {
- if ((lq_sta->last_tpt > IL_AGG_TPT_THREHOLD) &&
+ lq_sta->action_counter >= tbl1->max_search) {
+ if (lq_sta->last_tpt > IL_AGG_TPT_THREHOLD &&
(lq_sta->tx_agg_tid_en & (1 << tid)) &&
- (tid != MAX_TID_COUNT)) {
+ tid != MAX_TID_COUNT) {
tid_data =
&il->stations[lq_sta->lq.sta_id].tid[tid];
if (tid_data->agg.state == IL_AGG_OFF) {
@@ -2217,7 +2208,7 @@ static void il4965_rs_initialize_lq(struct il_priv *il,

tbl = &(lq_sta->lq_info[active_tbl]);

- if ((i < 0) || (i >= IL_RATE_COUNT))
+ if (i < 0 || i >= IL_RATE_COUNT)
i = 0;

rate = il_rates[i].plcp;
@@ -2256,11 +2247,11 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
/* Get max rate if user set max rate */
if (lq_sta) {
lq_sta->max_rate_idx = txrc->max_rate_idx;
- if ((sband->band == IEEE80211_BAND_5GHZ) &&
- (lq_sta->max_rate_idx != -1))
+ if (sband->band == IEEE80211_BAND_5GHZ &&
+ lq_sta->max_rate_idx != -1)
lq_sta->max_rate_idx += IL_FIRST_OFDM_RATE;
- if ((lq_sta->max_rate_idx < 0) ||
- (lq_sta->max_rate_idx >= IL_RATE_COUNT))
+ if (lq_sta->max_rate_idx < 0 ||
+ lq_sta->max_rate_idx >= IL_RATE_COUNT)
lq_sta->max_rate_idx = -1;
}

@@ -2301,9 +2292,9 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
IEEE80211_TX_RC_GREEN_FIELD;
} else {
/* Check for invalid rates */
- if ((rate_idx < 0) || (rate_idx >= IL_RATE_COUNT_LEGACY) ||
- ((sband->band == IEEE80211_BAND_5GHZ) &&
- (rate_idx < IL_FIRST_OFDM_RATE)))
+ if (rate_idx < 0 || rate_idx >= IL_RATE_COUNT_LEGACY ||
+ (sband->band == IEEE80211_BAND_5GHZ &&
+ rate_idx < IL_FIRST_OFDM_RATE))
rate_idx = rate_lowest_index(sband, sta);
/* On valid 5 GHz rate, adjust index */
else if (sband->band == IEEE80211_BAND_5GHZ)
@@ -2475,7 +2466,7 @@ static void il4965_rs_fill_link_cmd(struct il_priv *il,
/* Repeat initial/next rate.
* For legacy IL_NUMBER_TRY == 1, this loop will not execute.
* For HT IL_HT_NUMBER_TRY == 3, this executes twice. */
- while (repeat_rate > 0 && (index < LINK_QUAL_MAX_RETRY_NUM)) {
+ while (repeat_rate > 0 && index < LINK_QUAL_MAX_RETRY_NUM) {
if (is_legacy(tbl_type.lq_type)) {
if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE)
ant_toggle_cnt++;
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
index f86a3b9..a32a4f3 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
@@ -195,8 +195,8 @@ static void il4965_tx_cmd_build_rate(struct il_priv *il,
* index is invalid.
*/
rate_idx = info->control.rates[0].idx;
- if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS ||
- (rate_idx < 0) || (rate_idx > IL_RATE_COUNT_LEGACY))
+ if ((info->control.rates[0].flags & IEEE80211_TX_RC_MCS) ||
+ rate_idx < 0 || rate_idx > IL_RATE_COUNT_LEGACY)
rate_idx = rate_lowest_index(&il->bands[info->band],
info->control.sta);
/* For 5 GHZ band, remap mac80211 rate indices into driver indices */
@@ -208,7 +208,7 @@ static void il4965_tx_cmd_build_rate(struct il_priv *il,
rate_flags = 0;

/* Set CCK flag as needed */
- if ((rate_idx >= IL_FIRST_CCK_RATE) && (rate_idx <= IL_LAST_CCK_RATE))
+ if (rate_idx >= IL_FIRST_CCK_RATE && rate_idx <= IL_LAST_CCK_RATE)
rate_flags |= RATE_MCS_CCK_MSK;

/* Set up antennas */
@@ -535,8 +535,7 @@ int il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)
if (sta_priv && sta_priv->client && !is_agg)
atomic_inc(&sta_priv->pending_frames);

- if ((il_queue_space(q) < q->high_mark) &&
- il->mac80211_registered) {
+ if (il_queue_space(q) < q->high_mark && il->mac80211_registered) {
if (wait_write_ptr) {
spin_lock_irqsave(&il->lock, flags);
txq->need_update = 1;
@@ -1050,8 +1049,8 @@ int il4965_txq_check_empty(struct il_priv *il,
case IL_EMPTYING_HW_QUEUE_DELBA:
/* We are reclaiming the last packet of the */
/* aggregated HW queue */
- if ((txq_id == tid_data->agg.txq_id) &&
- (q->read_ptr == q->write_ptr)) {
+ if (txq_id == tid_data->agg.txq_id &&
+ q->read_ptr == q->write_ptr) {
u16 ssn = SEQ_TO_SN(tid_data->seq_number);
int tx_fifo = il4965_get_fifo_from_tid(ctx, tid);
D_HT(
@@ -1114,7 +1113,7 @@ int il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int index)
int nfreed = 0;
struct ieee80211_hdr *hdr;

- if ((index >= q->n_bd) || (il_queue_used(q, index) == 0)) {
+ if (index >= q->n_bd || il_queue_used(q, index) == 0) {
IL_ERR("Read index for DMA queue txq id (%d), index %d, "
"is out of range [0-%d] %d %d.\n", txq_id,
index, q->n_bd, q->write_ptr, q->read_ptr);
@@ -1321,9 +1320,9 @@ void il4965_rx_reply_compressed_ba(struct il_priv *il,
int freed = il4965_tx_queue_reclaim(il, scd_flow, index);
il4965_free_tfds_in_queue(il, sta_id, tid, freed);

- if ((il_queue_space(&txq->q) > txq->q.low_mark) &&
+ if (il_queue_space(&txq->q) > txq->q.low_mark &&
il->mac80211_registered &&
- (agg->state != IL_EMPTYING_HW_QUEUE_DELBA))
+ agg->state != IL_EMPTYING_HW_QUEUE_DELBA)
il_wake_queue(il, txq);

il4965_txq_check_empty(il, sta_id, tid, scd_flow);
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c
index a745032..3706e47 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.c
@@ -284,8 +284,8 @@ static bool iw4965_is_ht40_channel(__le32 rxon_flags)
{
int chan_mod = le32_to_cpu(rxon_flags & RXON_FLG_CHANNEL_MODE_MSK)
>> RXON_FLG_CHANNEL_MODE_POS;
- return ((chan_mod == CHANNEL_MODE_PURE_40) ||
- (chan_mod == CHANNEL_MODE_MIXED));
+ return (chan_mod == CHANNEL_MODE_PURE_40 ||
+ chan_mod == CHANNEL_MODE_MIXED);
}

static void il4965_nic_config(struct il_priv *il)
@@ -323,7 +323,7 @@ static void il4965_chain_noise_reset(struct il_priv *il)
{
struct il_chain_noise_data *data = &(il->chain_noise_data);

- if ((data->state == IL_CHAIN_NOISE_ALIVE) &&
+ if (data->state == IL_CHAIN_NOISE_ALIVE &&
il_is_any_associated(il)) {
struct il_calib_diff_gain_cmd cmd;

@@ -458,8 +458,8 @@ static s32 il4965_get_voltage_compensation(s32 eeprom_voltage,
{
s32 comp = 0;

- if ((TX_POWER_IL_ILLEGAL_VOLTAGE == eeprom_voltage) ||
- (TX_POWER_IL_ILLEGAL_VOLTAGE == current_voltage))
+ if (TX_POWER_IL_ILLEGAL_VOLTAGE == eeprom_voltage ||
+ TX_POWER_IL_ILLEGAL_VOLTAGE == current_voltage)
return 0;

il4965_math_div_round(current_voltage - eeprom_voltage,
@@ -506,8 +506,8 @@ static u32 il4965_get_sub_band(const struct il_priv *il, u32 channel)
if (il->calib_info->band_info[b].ch_from == 0)
continue;

- if ((channel >= il->calib_info->band_info[b].ch_from)
- && (channel <= il->calib_info->band_info[b].ch_to))
+ if (channel >= il->calib_info->band_info[b].ch_from &&
+ channel <= il->calib_info->band_info[b].ch_to)
break;
}

@@ -1158,15 +1158,15 @@ static int il4965_send_rxon_assoc(struct il_priv *il,
const struct il_rxon_cmd *rxon1 = &ctx->staging;
const struct il_rxon_cmd *rxon2 = &ctx->active;

- if ((rxon1->flags == rxon2->flags) &&
- (rxon1->filter_flags == rxon2->filter_flags) &&
- (rxon1->cck_basic_rates == rxon2->cck_basic_rates) &&
- (rxon1->ofdm_ht_single_stream_basic_rates ==
- rxon2->ofdm_ht_single_stream_basic_rates) &&
- (rxon1->ofdm_ht_dual_stream_basic_rates ==
- rxon2->ofdm_ht_dual_stream_basic_rates) &&
- (rxon1->rx_chain == rxon2->rx_chain) &&
- (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) {
+ if (rxon1->flags == rxon2->flags &&
+ rxon1->filter_flags == rxon2->filter_flags &&
+ rxon1->cck_basic_rates == rxon2->cck_basic_rates &&
+ rxon1->ofdm_ht_single_stream_basic_rates ==
+ rxon2->ofdm_ht_single_stream_basic_rates &&
+ rxon1->ofdm_ht_dual_stream_basic_rates ==
+ rxon2->ofdm_ht_dual_stream_basic_rates &&
+ rxon1->rx_chain == rxon2->rx_chain &&
+ rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates) {
D_INFO("Using current RXON_ASSOC. Not resending.\n");
return 0;
}
@@ -1216,7 +1216,7 @@ static int il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
* abort any previous channel switch if still in process
*/
if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status) &&
- (il->switch_channel != ctx->staging.channel)) {
+ il->switch_channel != ctx->staging.channel) {
D_11H("abort channel switch on %d\n",
le16_to_cpu(il->switch_channel));
il_chswitch_done(il, false);
@@ -1366,7 +1366,7 @@ static int il4965_hw_channel_switch(struct il_priv *il,
* calculate the ucode channel switch time
* adding TSF as one of the factor for when to switch
*/
- if ((il->ucode_beacon_time > tsf_low) && beacon_interval) {
+ if (il->ucode_beacon_time > tsf_low && beacon_interval) {
if (switch_count > ((il->ucode_beacon_time - tsf_low) /
beacon_interval)) {
switch_count -= (il->ucode_beacon_time -
@@ -1789,7 +1789,7 @@ static void il4965_rx_reply_tx(struct il_priv *il,
u8 *qc = NULL;
unsigned long flags;

- if ((index >= txq->q.n_bd) || (il_queue_used(&txq->q, index) == 0)) {
+ if (index >= txq->q.n_bd || il_queue_used(&txq->q, index) == 0) {
IL_ERR("Read index for DMA queue txq_id (%d) index %d "
"is out of range [0-%d] %d %d\n", txq_id,
index, txq->q.n_bd, txq->q.write_ptr,
@@ -1838,8 +1838,8 @@ static void il4965_rx_reply_tx(struct il_priv *il,
tid, freed);

if (il->mac80211_registered &&
- (il_queue_space(&txq->q) > txq->q.low_mark)
- && (agg->state != IL_EMPTYING_HW_QUEUE_DELBA))
+ il_queue_space(&txq->q) > txq->q.low_mark &&
+ agg->state != IL_EMPTYING_HW_QUEUE_DELBA)
il_wake_queue(il, txq);
}
} else {
@@ -1863,7 +1863,7 @@ static void il4965_rx_reply_tx(struct il_priv *il,
D_TX_REPLY("Station not known\n");

if (il->mac80211_registered &&
- (il_queue_space(&txq->q) > txq->q.low_mark))
+ il_queue_space(&txq->q) > txq->q.low_mark)
il_wake_queue(il, txq);
}
if (qc && likely(sta_id != IL_INVALID_STATION))
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.h b/drivers/net/wireless/iwlegacy/iwl-4965.h
index ea2a98e..56bfdb0 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.h
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.h
@@ -163,8 +163,8 @@ static inline u32 il4965_tx_status_to_mac80211(u32 status)
static inline bool il4965_is_tx_success(u32 status)
{
status &= TX_STATUS_MSK;
- return (status == TX_STATUS_SUCCESS) ||
- (status == TX_STATUS_DIRECT_DONE);
+ return (status == TX_STATUS_SUCCESS ||
+ status == TX_STATUS_DIRECT_DONE);
}

u8 il4965_toggle_tx_ant(struct il_priv *il, u8 ant_idx, u8 valid);
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index ed44159..acbd5a8 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -251,8 +251,8 @@ int il_init_geos(struct il_priv *il)
il->tx_power_user_lmt = max_tx_power;
il->tx_power_next = max_tx_power;

- if ((il->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
- il->cfg->sku & IL_SKU_A) {
+ if (il->bands[IEEE80211_BAND_5GHZ].n_channels == 0 &&
+ (il->cfg->sku & IL_SKU_A)) {
IL_INFO("Incorrectly detected BG card as ABG. "
"Please send your PCI ID 0x%04X:0x%04X to maintainer.\n",
il->pci_dev->device,
@@ -708,8 +708,7 @@ il_set_rxon_channel(struct il_priv *il, struct ieee80211_channel *ch,
enum ieee80211_band band = ch->band;
u16 channel = ch->hw_value;

- if ((le16_to_cpu(ctx->staging.channel) == channel) &&
- (il->band == band))
+ if (le16_to_cpu(ctx->staging.channel) == channel && il->band == band)
return 0;

ctx->staging.channel = cpu_to_le16(channel);
@@ -2306,8 +2305,8 @@ static void il_ht_conf(struct il_priv *il,
>> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT;
maxstreams += 1;

- if ((ht_cap->mcs.rx_mask[1] == 0) &&
- (ht_cap->mcs.rx_mask[2] == 0))
+ if (ht_cap->mcs.rx_mask[1] == 0 &&
+ ht_cap->mcs.rx_mask[2] == 0)
ht_conf->single_chain_sufficient = true;
if (maxstreams <= 1)
ht_conf->single_chain_sufficient = true;
@@ -2467,7 +2466,7 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw,
* mac80211 decides to do both changes at once because
* it will invoke post_associate.
*/
- if (vif->type == NL80211_IFTYPE_ADHOC && changes & BSS_CHANGED_BEACON)
+ if (vif->type == NL80211_IFTYPE_ADHOC && (changes & BSS_CHANGED_BEACON))
il_beacon_update(hw, vif);

if (changes & BSS_CHANGED_ERP_PREAMBLE) {
@@ -2482,8 +2481,7 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw,
if (changes & BSS_CHANGED_ERP_CTS_PROT) {
D_MAC80211(
"ERP_CTS %d\n", bss_conf->use_cts_prot);
- if (bss_conf->use_cts_prot &&
- (il->band != IEEE80211_BAND_5GHZ))
+ if (bss_conf->use_cts_prot && il->band != IEEE80211_BAND_5GHZ)
ctx->staging.flags |= RXON_FLG_TGG_PROTECT_MSK;
else
ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK;
@@ -2596,7 +2594,7 @@ irqreturn_t il_isr(int irq, void *data)
goto none;
}

- if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) {
+ if (inta == 0xFFFFFFFF || (inta & 0xFFFFFFF0) == 0xa5a5a5a0) {
/* Hardware disappeared. It might have already raised
* an interrupt */
IL_WARN("HARDWARE GONE?? INTA == 0x%08x\n", inta);
diff --git a/drivers/net/wireless/iwlegacy/iwl-io.h b/drivers/net/wireless/iwlegacy/iwl-io.h
index 8cb924d..9d33da8 100644
--- a/drivers/net/wireless/iwlegacy/iwl-io.h
+++ b/drivers/net/wireless/iwlegacy/iwl-io.h
@@ -176,7 +176,7 @@ static inline void il_write_reg_buf(struct il_priv *il,
{
u32 count = sizeof(u32);

- if ((il != NULL) && (values != NULL)) {
+ if (il != NULL && values != NULL) {
for (; 0 < len; len -= count, reg += count, values++)
il_wr(il, reg, *values);
}
diff --git a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
index 744829a..5da7d41 100644
--- a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
+++ b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
@@ -279,7 +279,7 @@ enum il_table_type {
LQ_MAX,
};

-#define is_legacy(tbl) (((tbl) == LQ_G) || ((tbl) == LQ_A))
+#define is_legacy(tbl) ((tbl) == LQ_G || (tbl) == LQ_A)
#define is_siso(tbl) ((tbl) == LQ_SISO)
#define is_mimo2(tbl) ((tbl) == LQ_MIMO2)
#define is_mimo(tbl) (is_mimo2(tbl))
diff --git a/drivers/net/wireless/iwlegacy/iwl-scan.c b/drivers/net/wireless/iwlegacy/iwl-scan.c
index 3687104..e352a18 100644
--- a/drivers/net/wireless/iwlegacy/iwl-scan.c
+++ b/drivers/net/wireless/iwlegacy/iwl-scan.c
@@ -307,7 +307,7 @@ u16 il_get_passive_dwell_time(struct il_priv *il,
if (!il_is_associated_ctx(ctx))
continue;
value = ctx->vif ? ctx->vif->bss_conf.beacon_int : 0;
- if ((value > IL_PASSIVE_DWELL_BASE) || !value)
+ if (value > IL_PASSIVE_DWELL_BASE || !value)
value = IL_PASSIVE_DWELL_BASE;
value = (value * 98) / 100 - IL_CHANNEL_TUNE_TIME * 2;
passive = min(value, passive);
diff --git a/drivers/net/wireless/iwlegacy/iwl-sta.c b/drivers/net/wireless/iwlegacy/iwl-sta.c
index 42033d2..cca467c 100644
--- a/drivers/net/wireless/iwlegacy/iwl-sta.c
+++ b/drivers/net/wireless/iwlegacy/iwl-sta.c
@@ -595,7 +595,7 @@ il_restore_stations(struct il_priv *il, struct il_rxon_context *ctx)
if (ctx->ctxid != il->stations[i].ctxid)
continue;
if ((il->stations[i].used & IL_STA_DRIVER_ACTIVE) &&
- !(il->stations[i].used & IL_STA_UCODE_ACTIVE)) {
+ !(il->stations[i].used & IL_STA_UCODE_ACTIVE)) {
D_ASSOC("Restoring sta %pM\n",
il->stations[i].sta.sta.addr);
il->stations[i].sta.mode = 0;
diff --git a/drivers/net/wireless/iwlegacy/iwl-tx.c b/drivers/net/wireless/iwlegacy/iwl-tx.c
index fa23c98..0d3515d 100644
--- a/drivers/net/wireless/iwlegacy/iwl-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-tx.c
@@ -565,7 +565,7 @@ static void il_hcmd_queue_reclaim(struct il_priv *il, int txq_id,
struct il_queue *q = &txq->q;
int nfreed = 0;

- if ((idx >= q->n_bd) || (il_queue_used(q, idx) == 0)) {
+ if (idx >= q->n_bd || il_queue_used(q, idx) == 0) {
IL_ERR("Read index for DMA queue txq id (%d), index %d, "
"is out of range [0-%d] %d %d.\n", txq_id,
idx, q->n_bd, q->write_ptr, q->read_ptr);
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index 5037216..ec9a93c 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -646,7 +646,7 @@ static int il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)
il_txq_update_write_ptr(il, txq);
spin_unlock_irqrestore(&il->lock, flags);

- if ((il_queue_space(q) < q->high_mark)
+ if (il_queue_space(q) < q->high_mark
&& il->mac80211_registered) {
if (wait_write_ptr) {
spin_lock_irqsave(&il->lock, flags);
@@ -974,7 +974,7 @@ static void il3945_rx_queue_restock(struct il_priv *il)

spin_lock_irqsave(&rxq->lock, flags);
write = rxq->write & ~0x7;
- while ((il_rx_queue_space(rxq) > 0) && (rxq->free_count)) {
+ while (il_rx_queue_space(rxq) > 0 && rxq->free_count) {
/* Get next free Rx buffer, remove from free list */
element = rxq->rx_free.next;
rxb = list_entry(element, struct il_rx_mem_buffer, list);
@@ -995,8 +995,8 @@ static void il3945_rx_queue_restock(struct il_priv *il)

/* If we've added more space for the firmware to place data, tell it.
* Increment device's write pointer in multiples of 8. */
- if ((rxq->write_actual != (rxq->write & ~0x7))
- || (abs(rxq->write - rxq->read) > 7)) {
+ if (rxq->write_actual != (rxq->write & ~0x7) ||
+ abs(rxq->write - rxq->read) > 7) {
spin_lock_irqsave(&rxq->lock, flags);
rxq->need_update = 1;
spin_unlock_irqrestore(&rxq->lock, flags);
@@ -1041,7 +1041,7 @@ static void il3945_rx_allocate(struct il_priv *il, gfp_t priority)
if (!page) {
if (net_ratelimit())
D_INFO("Failed to allocate SKB buffer.\n");
- if ((rxq->free_count <= RX_LOW_WATERMARK) &&
+ if (rxq->free_count <= RX_LOW_WATERMARK &&
net_ratelimit())
IL_ERR("Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n",
priority == GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL",
@@ -1254,8 +1254,8 @@ static void il3945_rx_handle(struct il_priv *il)
* Ucode should set SEQ_RX_FRAME bit if ucode-originated,
* but apparently a few don't get set; catch them here. */
reclaim = !(pkt->hdr.sequence & SEQ_RX_FRAME) &&
- (pkt->hdr.cmd != STATISTICS_NOTIFICATION) &&
- (pkt->hdr.cmd != REPLY_TX);
+ pkt->hdr.cmd != STATISTICS_NOTIFICATION &&
+ pkt->hdr.cmd != REPLY_TX;

/* Based on type of command response or notification,
* handle those that need handling via function in
@@ -1659,7 +1659,7 @@ static void il3945_init_hw_rates(struct il_priv *il,
rates[i].hw_value = i; /* Rate scaling will work on indexes */
rates[i].hw_value_short = i;
rates[i].flags = 0;
- if ((i > IWL39_LAST_OFDM_RATE) || (i < IL_FIRST_OFDM_RATE)) {
+ if (i > IWL39_LAST_OFDM_RATE || i < IL_FIRST_OFDM_RATE) {
/*
* If CCK != 1M then set short preamble rate flag.
*/
@@ -3294,7 +3294,7 @@ static ssize_t il3945_show_measurement(struct device *d,
il->measurement_status = 0;
spin_unlock_irqrestore(&il->lock, flags);

- while (size && (PAGE_SIZE - len)) {
+ while (size && PAGE_SIZE - len) {
hex_dump_to_buffer(data + ofs, size, 16, 1, buf + len,
PAGE_SIZE - len, 1);
len = strlen(buf);
@@ -3406,7 +3406,7 @@ static ssize_t il3945_store_antenna(struct device *d,
return count;
}

- if ((ant >= 0) && (ant <= 2)) {
+ if (ant >= 0 && ant <= 2) {
D_INFO("Setting antenna select to %d.\n", ant);
il3945_mod_params.antenna = (enum il3945_antenna)ant;
} else
--
1.7.1


2011-11-18 08:22:21

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 41/77] iwlegacy: s/STATUS_/S_/

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/3945-mac.c | 98 ++++++++++----------
drivers/net/wireless/iwlegacy/3945.c | 10 +-
drivers/net/wireless/iwlegacy/4965-mac.c | 134 +++++++++++++-------------
drivers/net/wireless/iwlegacy/4965.c | 18 ++--
drivers/net/wireless/iwlegacy/iwl-core.c | 40 ++++----
drivers/net/wireless/iwlegacy/iwl-core.h | 50 +++++-----
drivers/net/wireless/iwlegacy/iwl-debugfs.c | 66 +++++++-------
drivers/net/wireless/iwlegacy/iwl-hcmd.c | 14 ++--
drivers/net/wireless/iwlegacy/iwl-helpers.h | 4 +-
drivers/net/wireless/iwlegacy/iwl-led.c | 2 +-
drivers/net/wireless/iwlegacy/iwl-power.c | 6 +-
drivers/net/wireless/iwlegacy/iwl-rx.c | 2 +-
drivers/net/wireless/iwlegacy/iwl-scan.c | 42 ++++----
drivers/net/wireless/iwlegacy/iwl-tx.c | 4 +-
14 files changed, 245 insertions(+), 245 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
index 17edbdf..f69211e 100644
--- a/drivers/net/wireless/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
@@ -827,17 +827,17 @@ static void il3945_rx_card_state_notif(struct il_priv *il,
CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);

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


il_scan_cancel(il);

- if ((test_bit(STATUS_RF_KILL_HW, &status) !=
- test_bit(STATUS_RF_KILL_HW, &il->status)))
+ if ((test_bit(S_RF_KILL_HW, &status) !=
+ test_bit(S_RF_KILL_HW, &il->status)))
wiphy_rfkill_set_hw_state(il->hw->wiphy,
- test_bit(STATUS_RF_KILL_HW, &il->status));
+ test_bit(S_RF_KILL_HW, &il->status));
else
wake_up(&il->wait_command_queue);
}
@@ -1537,7 +1537,7 @@ static void il3945_irq_tasklet(struct il_priv *il)

/* Re-enable all interrupts */
/* only Re-enable if disabled by irq */
- if (test_bit(STATUS_INT_ENABLED, &il->status))
+ if (test_bit(S_INT_ENABLED, &il->status))
il_enable_interrupts(il);

#ifdef CONFIG_IWLEGACY_DEBUG
@@ -2213,7 +2213,7 @@ static void il3945_alive_start(struct il_priv *il)
D_INFO("RFKILL status: 0x%x\n", rfkill);

if (rfkill & 0x1) {
- clear_bit(STATUS_RF_KILL_HW, &il->status);
+ clear_bit(S_RF_KILL_HW, &il->status);
/* if RFKILL is not on, then wait for thermal
* sensor in adapter to kick in */
while (il3945_hw_get_temperature(il) == 0) {
@@ -2225,10 +2225,10 @@ static void il3945_alive_start(struct il_priv *il)
D_INFO("Thermal calibration took %dus\n",
thermal_spin * 10);
} else
- set_bit(STATUS_RF_KILL_HW, &il->status);
+ set_bit(S_RF_KILL_HW, &il->status);

/* After the ALIVE response, we can send commands to 3945 uCode */
- set_bit(STATUS_ALIVE, &il->status);
+ set_bit(S_ALIVE, &il->status);

/* Enable watchdog to monitor the driver tx queues */
il_setup_watchdog(il);
@@ -2256,7 +2256,7 @@ static void il3945_alive_start(struct il_priv *il)
/* Configure Bluetooth device coexistence support */
il_send_bt_config(il);

- set_bit(STATUS_READY, &il->status);
+ set_bit(S_READY, &il->status);

/* Configure the adapter for unassociated operation */
il3945_commit_rxon(il, ctx);
@@ -2283,9 +2283,9 @@ static void __il3945_down(struct il_priv *il)

il_scan_cancel_timeout(il, 200);

- exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &il->status);
+ exit_pending = test_and_set_bit(S_EXIT_PENDING, &il->status);

- /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set
+ /* Stop TX queues watchdog. We need to have S_EXIT_PENDING bit set
* to prevent rearm timer */
del_timer_sync(&il->watchdog);

@@ -2300,7 +2300,7 @@ static void __il3945_down(struct il_priv *il)
/* Wipe out the EXIT_PENDING status bit if we are not actually
* exiting the module */
if (!exit_pending)
- clear_bit(STATUS_EXIT_PENDING, &il->status);
+ clear_bit(S_EXIT_PENDING, &il->status);

/* stop and reset the on-board processor */
_il_wr(il, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
@@ -2317,25 +2317,25 @@ static void __il3945_down(struct il_priv *il)
/* If we have not previously called il3945_init() then
* clear all bits but the RF Kill bits and return */
if (!il_is_init(il)) {
- il->status = test_bit(STATUS_RF_KILL_HW, &il->status) <<
- STATUS_RF_KILL_HW |
- test_bit(STATUS_GEO_CONFIGURED, &il->status) <<
- STATUS_GEO_CONFIGURED |
- test_bit(STATUS_EXIT_PENDING, &il->status) <<
- STATUS_EXIT_PENDING;
+ il->status = test_bit(S_RF_KILL_HW, &il->status) <<
+ S_RF_KILL_HW |
+ test_bit(S_GEO_CONFIGURED, &il->status) <<
+ S_GEO_CONFIGURED |
+ test_bit(S_EXIT_PENDING, &il->status) <<
+ S_EXIT_PENDING;
goto exit;
}

/* ...otherwise clear out all the status bits but the RF Kill
* bit and continue taking the NIC down. */
- il->status &= test_bit(STATUS_RF_KILL_HW, &il->status) <<
- STATUS_RF_KILL_HW |
- test_bit(STATUS_GEO_CONFIGURED, &il->status) <<
- STATUS_GEO_CONFIGURED |
- test_bit(STATUS_FW_ERROR, &il->status) <<
- STATUS_FW_ERROR |
- test_bit(STATUS_EXIT_PENDING, &il->status) <<
- STATUS_EXIT_PENDING;
+ il->status &= test_bit(S_RF_KILL_HW, &il->status) <<
+ S_RF_KILL_HW |
+ test_bit(S_GEO_CONFIGURED, &il->status) <<
+ S_GEO_CONFIGURED |
+ test_bit(S_FW_ERROR, &il->status) <<
+ S_FW_ERROR |
+ test_bit(S_EXIT_PENDING, &il->status) <<
+ S_EXIT_PENDING;

il3945_hw_txq_ctx_stop(il);
il3945_hw_rxq_stop(il);
@@ -2400,7 +2400,7 @@ static int __il3945_up(struct il_priv *il)
if (rc)
return rc;

- if (test_bit(STATUS_EXIT_PENDING, &il->status)) {
+ if (test_bit(S_EXIT_PENDING, &il->status)) {
IL_WARN("Exit pending; will not bring the NIC up\n");
return -EIO;
}
@@ -2413,9 +2413,9 @@ static int __il3945_up(struct il_priv *il)
/* If platform's RF_KILL switch is NOT set to KILL */
if (_il_rd(il, CSR_GP_CNTRL) &
CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
- clear_bit(STATUS_RF_KILL_HW, &il->status);
+ clear_bit(S_RF_KILL_HW, &il->status);
else {
- set_bit(STATUS_RF_KILL_HW, &il->status);
+ set_bit(S_RF_KILL_HW, &il->status);
IL_WARN("Radio disabled by HW RF Kill switch\n");
return -ENODEV;
}
@@ -2448,7 +2448,7 @@ static int __il3945_up(struct il_priv *il)
il->ucode_data.len);

/* We return success when we resume from suspend and rf_kill is on. */
- if (test_bit(STATUS_RF_KILL_HW, &il->status))
+ if (test_bit(S_RF_KILL_HW, &il->status))
return 0;

for (i = 0; i < MAX_HW_RESTARTS; i++) {
@@ -2472,9 +2472,9 @@ static int __il3945_up(struct il_priv *il)
return 0;
}

- set_bit(STATUS_EXIT_PENDING, &il->status);
+ set_bit(S_EXIT_PENDING, &il->status);
__il3945_down(il);
- clear_bit(STATUS_EXIT_PENDING, &il->status);
+ clear_bit(S_EXIT_PENDING, &il->status);

/* tried to restart and config the device for as long as our
* patience could withstand */
@@ -2495,7 +2495,7 @@ static void il3945_bg_init_alive_start(struct work_struct *data)
container_of(data, struct il_priv, init_alive_start.work);

mutex_lock(&il->mutex);
- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
goto out;

il3945_init_alive_start(il);
@@ -2509,7 +2509,7 @@ static void il3945_bg_alive_start(struct work_struct *data)
container_of(data, struct il_priv, alive_start.work);

mutex_lock(&il->mutex);
- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
goto out;

il3945_alive_start(il);
@@ -2527,15 +2527,15 @@ static void il3945_rfkill_poll(struct work_struct *data)
{
struct il_priv *il =
container_of(data, struct il_priv, _3945.rfkill_poll.work);
- bool old_rfkill = test_bit(STATUS_RF_KILL_HW, &il->status);
+ bool old_rfkill = test_bit(S_RF_KILL_HW, &il->status);
bool new_rfkill = !(_il_rd(il, CSR_GP_CNTRL)
& CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW);

if (new_rfkill != old_rfkill) {
if (new_rfkill)
- set_bit(STATUS_RF_KILL_HW, &il->status);
+ set_bit(S_RF_KILL_HW, &il->status);
else
- clear_bit(STATUS_RF_KILL_HW, &il->status);
+ clear_bit(S_RF_KILL_HW, &il->status);

wiphy_rfkill_set_hw_state(il->hw->wiphy, new_rfkill);

@@ -2682,10 +2682,10 @@ int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
cmd.data = scan;
scan->len = cpu_to_le16(cmd.len);

- set_bit(STATUS_SCAN_HW, &il->status);
+ set_bit(S_SCAN_HW, &il->status);
ret = il_send_cmd_sync(il, &cmd);
if (ret)
- clear_bit(STATUS_SCAN_HW, &il->status);
+ clear_bit(S_SCAN_HW, &il->status);
return ret;
}

@@ -2705,10 +2705,10 @@ static void il3945_bg_restart(struct work_struct *data)
{
struct il_priv *il = container_of(data, struct il_priv, restart);

- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
return;

- if (test_and_clear_bit(STATUS_FW_ERROR, &il->status)) {
+ if (test_and_clear_bit(S_FW_ERROR, &il->status)) {
mutex_lock(&il->mutex);
il->ctx.vif = NULL;
il->is_open = 0;
@@ -2719,7 +2719,7 @@ static void il3945_bg_restart(struct work_struct *data)
il3945_down(il);

mutex_lock(&il->mutex);
- if (test_bit(STATUS_EXIT_PENDING, &il->status)) {
+ if (test_bit(S_EXIT_PENDING, &il->status)) {
mutex_unlock(&il->mutex);
return;
}
@@ -2735,7 +2735,7 @@ static void il3945_bg_rx_replenish(struct work_struct *data)
container_of(data, struct il_priv, rx_replenish);

mutex_lock(&il->mutex);
- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
goto out;

il3945_rx_replenish(il);
@@ -2755,7 +2755,7 @@ void il3945_post_associate(struct il_priv *il)
D_ASSOC("Associated as %d to: %pM\n",
ctx->vif->bss_conf.aid, ctx->active.bssid_addr);

- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
return;

il_scan_cancel_timeout(il, 200);
@@ -2847,10 +2847,10 @@ static int il3945_mac_start(struct ieee80211_hw *hw)
/* Wait for START_ALIVE from ucode. Otherwise callbacks from
* mac80211 will not be run successfully. */
ret = wait_event_timeout(il->wait_command_queue,
- test_bit(STATUS_READY, &il->status),
+ test_bit(S_READY, &il->status),
UCODE_READY_TIMEOUT);
if (!ret) {
- if (!test_bit(STATUS_READY, &il->status)) {
+ if (!test_bit(S_READY, &il->status)) {
IL_ERR(
"Wait for START_ALIVE timeout after %dms.\n",
jiffies_to_msecs(UCODE_READY_TIMEOUT));
@@ -2918,7 +2918,7 @@ void il3945_config_ap(struct il_priv *il)
struct ieee80211_vif *vif = ctx->vif;
int rc = 0;

- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
return;

/* The following should be done only at AP bring up */
@@ -3870,7 +3870,7 @@ static void __devexit il3945_pci_remove(struct pci_dev *pdev)

il_dbgfs_unregister(il);

- set_bit(STATUS_EXIT_PENDING, &il->status);
+ set_bit(S_EXIT_PENDING, &il->status);

il_leds_exit(il);

diff --git a/drivers/net/wireless/iwlegacy/3945.c b/drivers/net/wireless/iwlegacy/3945.c
index 17615c3..8ebd576 100644
--- a/drivers/net/wireless/iwlegacy/3945.c
+++ b/drivers/net/wireless/iwlegacy/3945.c
@@ -1008,7 +1008,7 @@ int il3945_hw_nic_init(struct il_priv *il)
if (rc)
return rc;

- set_bit(STATUS_INIT, &il->status);
+ set_bit(S_INIT, &il->status);

return 0;
}
@@ -1394,7 +1394,7 @@ static int il3945_send_tx_power(struct il_priv *il)
};
u16 chan;

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

@@ -1571,7 +1571,7 @@ static int il3945_hw_reg_comp_txpower_temp(struct il_priv *il)
int temperature = il->temperature;

if (il->disable_tx_power_cal ||
- test_bit(STATUS_SCANNING, &il->status)) {
+ test_bit(S_SCANNING, &il->status)) {
/* do not perform tx power calibration */
return 0;
}
@@ -1726,7 +1726,7 @@ int il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
int rc = 0;
bool new_assoc = !!(staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK);

- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
return -EINVAL;

if (!il_is_alive(il))
@@ -1885,7 +1885,7 @@ static void il3945_bg_reg_txpower_periodic(struct work_struct *work)
struct il_priv *il = container_of(work, struct il_priv,
_3945.thermal_periodic.work);

- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
return;

mutex_lock(&il->mutex);
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index ee084a8..c4198bd 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -90,7 +90,7 @@ void il4965_check_abort_status(struct il_priv *il,
{
if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) {
IL_ERR("Tx flush command to flush out all frames\n");
- if (!test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (!test_bit(S_EXIT_PENDING, &il->status))
queue_work(il->workqueue, &il->tx_flush);
}
}
@@ -246,7 +246,7 @@ int il4965_hw_nic_init(struct il_priv *il)
} else
il4965_txq_ctx_reset(il);

- set_bit(STATUS_INIT, &il->status);
+ set_bit(S_INIT, &il->status);

return 0;
}
@@ -966,7 +966,7 @@ int il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
scan->tx_cmd.rate_n_flags = il4965_hw_set_rate_n_flags(rate, rate_flags);

/* In power save mode use one chain, otherwise use all chains */
- if (test_bit(STATUS_POWER_PMI, &il->status)) {
+ if (test_bit(S_POWER_PMI, &il->status)) {
/* rx_ant has been set to all valid chains previously */
active_chains = rx_ant &
((u8)(il->chain_noise_data.active_chains));
@@ -1010,11 +1010,11 @@ int il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
cmd.data = scan;
scan->len = cpu_to_le16(cmd.len);

- set_bit(STATUS_SCAN_HW, &il->status);
+ set_bit(S_SCAN_HW, &il->status);

ret = il_send_cmd_sync(il, &cmd);
if (ret)
- clear_bit(STATUS_SCAN_HW, &il->status);
+ clear_bit(S_SCAN_HW, &il->status);

return ret;
}
@@ -1120,7 +1120,7 @@ static u8 il4965_count_chain_bitmap(u32 chain_bitmap)
void il4965_set_rxon_chain(struct il_priv *il, struct il_rxon_context *ctx)
{
bool is_single = il4965_is_single_rx_stream(il);
- bool is_cam = !test_bit(STATUS_POWER_PMI, &il->status);
+ bool is_cam = !test_bit(S_POWER_PMI, &il->status);
u8 idle_rx_cnt, active_rx_cnt, valid_rx_cnt;
u32 active_chains;
u16 rx_chain;
@@ -1258,7 +1258,7 @@ void il4965_rx_missed_beacon_notif(struct il_priv *il,
le32_to_cpu(missed_beacon->total_missed_becons),
le32_to_cpu(missed_beacon->num_recvd_beacons),
le32_to_cpu(missed_beacon->num_expected_beacons));
- if (!test_bit(STATUS_SCANNING, &il->status))
+ if (!test_bit(S_SCANNING, &il->status))
il4965_init_sensitivity(il);
}
}
@@ -1378,7 +1378,7 @@ void il4965_rx_stats(struct il_priv *il,
memcpy(&il->_4965.stats, &pkt->u.stats,
sizeof(il->_4965.stats));

- set_bit(STATUS_STATISTICS, &il->status);
+ set_bit(S_STATISTICS, &il->status);

/* Reschedule the stats timer to occur in
* REG_RECALIB_PERIOD seconds to ensure we get a
@@ -1387,7 +1387,7 @@ void il4965_rx_stats(struct il_priv *il,
mod_timer(&il->stats_periodic, jiffies +
msecs_to_jiffies(REG_RECALIB_PERIOD * 1000));

- if (unlikely(!test_bit(STATUS_SCANNING, &il->status)) &&
+ if (unlikely(!test_bit(S_SCANNING, &il->status)) &&
(pkt->hdr.cmd == STATISTICS_NOTIFICATION)) {
il4965_rx_calc_noise(il);
queue_work(il->workqueue, &il->run_time_calib_work);
@@ -3809,7 +3809,7 @@ static void il4965_bg_stats_periodic(unsigned long data)
{
struct il_priv *il = (struct il_priv *)data;

- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
return;

/* dont send host command if rf-kill is on */
@@ -3895,17 +3895,17 @@ static void il4965_rx_card_state_notif(struct il_priv *il,
il4965_perform_ct_kill_task(il);

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

if (!(flags & RXON_CARD_DISABLED))
il_scan_cancel(il);

- if ((test_bit(STATUS_RF_KILL_HW, &status) !=
- test_bit(STATUS_RF_KILL_HW, &il->status)))
+ if ((test_bit(S_RF_KILL_HW, &status) !=
+ test_bit(S_RF_KILL_HW, &il->status)))
wiphy_rfkill_set_hw_state(il->hw->wiphy,
- test_bit(STATUS_RF_KILL_HW, &il->status));
+ test_bit(S_RF_KILL_HW, &il->status));
else
wake_up(&il->wait_command_queue);
}
@@ -4199,11 +4199,11 @@ static void il4965_irq_tasklet(struct il_priv *il)
* is killed. Hence update the killswitch state here. The
* rfkill handler will care about restarting if needed.
*/
- if (!test_bit(STATUS_ALIVE, &il->status)) {
+ if (!test_bit(S_ALIVE, &il->status)) {
if (hw_rf_kill)
- set_bit(STATUS_RF_KILL_HW, &il->status);
+ set_bit(S_RF_KILL_HW, &il->status);
else
- clear_bit(STATUS_RF_KILL_HW, &il->status);
+ clear_bit(S_RF_KILL_HW, &il->status);
wiphy_rfkill_set_hw_state(il->hw->wiphy, hw_rf_kill);
}

@@ -4272,7 +4272,7 @@ static void il4965_irq_tasklet(struct il_priv *il)

/* Re-enable all interrupts */
/* only Re-enable if disabled by irq */
- if (test_bit(STATUS_INT_ENABLED, &il->status))
+ if (test_bit(S_INT_ENABLED, &il->status))
il_enable_interrupts(il);
/* Re-enable RF_KILL if it occurred */
else if (handled & CSR_INT_BIT_RF_KILL)
@@ -5079,7 +5079,7 @@ static void il4965_alive_start(struct il_priv *il)


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

/* Enable watchdog to monitor the driver tx queues */
il_setup_watchdog(il);
@@ -5110,7 +5110,7 @@ static void il4965_alive_start(struct il_priv *il)

il4965_reset_run_time_calib(il);

- set_bit(STATUS_READY, &il->status);
+ set_bit(S_READY, &il->status);

/* Configure the adapter for unassociated operation */
il_commit_rxon(il, ctx);
@@ -5141,9 +5141,9 @@ static void __il4965_down(struct il_priv *il)

il_scan_cancel_timeout(il, 200);

- exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &il->status);
+ exit_pending = test_and_set_bit(S_EXIT_PENDING, &il->status);

- /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set
+ /* Stop TX queues watchdog. We need to have S_EXIT_PENDING bit set
* to prevent rearm timer */
del_timer_sync(&il->watchdog);

@@ -5157,7 +5157,7 @@ static void __il4965_down(struct il_priv *il)
/* Wipe out the EXIT_PENDING status bit if we are not actually
* exiting the module */
if (!exit_pending)
- clear_bit(STATUS_EXIT_PENDING, &il->status);
+ clear_bit(S_EXIT_PENDING, &il->status);

/* stop and reset the on-board processor */
_il_wr(il, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
@@ -5174,25 +5174,25 @@ static void __il4965_down(struct il_priv *il)
/* If we have not previously called il_init() then
* clear all bits but the RF Kill bit and return */
if (!il_is_init(il)) {
- il->status = test_bit(STATUS_RF_KILL_HW, &il->status) <<
- STATUS_RF_KILL_HW |
- test_bit(STATUS_GEO_CONFIGURED, &il->status) <<
- STATUS_GEO_CONFIGURED |
- test_bit(STATUS_EXIT_PENDING, &il->status) <<
- STATUS_EXIT_PENDING;
+ il->status = test_bit(S_RF_KILL_HW, &il->status) <<
+ S_RF_KILL_HW |
+ test_bit(S_GEO_CONFIGURED, &il->status) <<
+ S_GEO_CONFIGURED |
+ test_bit(S_EXIT_PENDING, &il->status) <<
+ S_EXIT_PENDING;
goto exit;
}

/* ...otherwise clear out all the status bits but the RF Kill
* bit and continue taking the NIC down. */
- il->status &= test_bit(STATUS_RF_KILL_HW, &il->status) <<
- STATUS_RF_KILL_HW |
- test_bit(STATUS_GEO_CONFIGURED, &il->status) <<
- STATUS_GEO_CONFIGURED |
- test_bit(STATUS_FW_ERROR, &il->status) <<
- STATUS_FW_ERROR |
- test_bit(STATUS_EXIT_PENDING, &il->status) <<
- STATUS_EXIT_PENDING;
+ il->status &= test_bit(S_RF_KILL_HW, &il->status) <<
+ S_RF_KILL_HW |
+ test_bit(S_GEO_CONFIGURED, &il->status) <<
+ S_GEO_CONFIGURED |
+ test_bit(S_FW_ERROR, &il->status) <<
+ S_FW_ERROR |
+ test_bit(S_EXIT_PENDING, &il->status) <<
+ S_EXIT_PENDING;

il4965_txq_ctx_stop(il);
il4965_rxq_stop(il);
@@ -5283,7 +5283,7 @@ static int __il4965_up(struct il_priv *il)
int i;
int ret;

- if (test_bit(STATUS_EXIT_PENDING, &il->status)) {
+ if (test_bit(S_EXIT_PENDING, &il->status)) {
IL_WARN("Exit pending; will not bring the NIC up\n");
return -EIO;
}
@@ -5309,9 +5309,9 @@ static int __il4965_up(struct il_priv *il)
/* If platform's RF_KILL switch is NOT set to KILL */
if (_il_rd(il,
CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
- clear_bit(STATUS_RF_KILL_HW, &il->status);
+ clear_bit(S_RF_KILL_HW, &il->status);
else
- set_bit(STATUS_RF_KILL_HW, &il->status);
+ set_bit(S_RF_KILL_HW, &il->status);

if (il_is_rfkill(il)) {
wiphy_rfkill_set_hw_state(il->hw->wiphy, true);
@@ -5372,9 +5372,9 @@ static int __il4965_up(struct il_priv *il)
return 0;
}

- set_bit(STATUS_EXIT_PENDING, &il->status);
+ set_bit(S_EXIT_PENDING, &il->status);
__il4965_down(il);
- clear_bit(STATUS_EXIT_PENDING, &il->status);
+ clear_bit(S_EXIT_PENDING, &il->status);

/* tried to restart and config the device for as long as our
* patience could withstand */
@@ -5395,7 +5395,7 @@ static void il4965_bg_init_alive_start(struct work_struct *data)
container_of(data, struct il_priv, init_alive_start.work);

mutex_lock(&il->mutex);
- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
goto out;

il->cfg->ops->lib->init_alive_start(il);
@@ -5409,7 +5409,7 @@ static void il4965_bg_alive_start(struct work_struct *data)
container_of(data, struct il_priv, alive_start.work);

mutex_lock(&il->mutex);
- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
goto out;

il4965_alive_start(il);
@@ -5424,8 +5424,8 @@ static void il4965_bg_run_time_calib_work(struct work_struct *work)

mutex_lock(&il->mutex);

- if (test_bit(STATUS_EXIT_PENDING, &il->status) ||
- test_bit(STATUS_SCANNING, &il->status)) {
+ if (test_bit(S_EXIT_PENDING, &il->status) ||
+ test_bit(S_SCANNING, &il->status)) {
mutex_unlock(&il->mutex);
return;
}
@@ -5444,10 +5444,10 @@ static void il4965_bg_restart(struct work_struct *data)
{
struct il_priv *il = container_of(data, struct il_priv, restart);

- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
return;

- if (test_and_clear_bit(STATUS_FW_ERROR, &il->status)) {
+ if (test_and_clear_bit(S_FW_ERROR, &il->status)) {
mutex_lock(&il->mutex);
il->ctx.vif = NULL;
il->is_open = 0;
@@ -5461,7 +5461,7 @@ static void il4965_bg_restart(struct work_struct *data)
il4965_down(il);

mutex_lock(&il->mutex);
- if (test_bit(STATUS_EXIT_PENDING, &il->status)) {
+ if (test_bit(S_EXIT_PENDING, &il->status)) {
mutex_unlock(&il->mutex);
return;
}
@@ -5476,7 +5476,7 @@ static void il4965_bg_rx_replenish(struct work_struct *data)
struct il_priv *il =
container_of(data, struct il_priv, rx_replenish);

- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
return;

mutex_lock(&il->mutex);
@@ -5582,10 +5582,10 @@ int il4965_mac_start(struct ieee80211_hw *hw)
/* Wait for START_ALIVE from Run Time ucode. Otherwise callbacks from
* mac80211 will not be run successfully. */
ret = wait_event_timeout(il->wait_command_queue,
- test_bit(STATUS_READY, &il->status),
+ test_bit(S_READY, &il->status),
UCODE_READY_TIMEOUT);
if (!ret) {
- if (!test_bit(STATUS_READY, &il->status)) {
+ if (!test_bit(S_READY, &il->status)) {
IL_ERR("START_ALIVE timeout after %dms.\n",
jiffies_to_msecs(UCODE_READY_TIMEOUT));
return -ETIMEDOUT;
@@ -5751,7 +5751,7 @@ int il4965_mac_ampdu_action(struct ieee80211_hw *hw,
case IEEE80211_AMPDU_RX_STOP:
D_HT("stop Rx\n");
ret = il4965_sta_rx_agg_stop(il, sta, tid);
- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
ret = 0;
break;
case IEEE80211_AMPDU_TX_START:
@@ -5761,7 +5761,7 @@ int il4965_mac_ampdu_action(struct ieee80211_hw *hw,
case IEEE80211_AMPDU_TX_STOP:
D_HT("stop Tx\n");
ret = il4965_tx_agg_stop(il, vif, sta, tid);
- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
ret = 0;
break;
case IEEE80211_AMPDU_TX_OPERATIONAL:
@@ -5833,9 +5833,9 @@ void il4965_mac_channel_switch(struct ieee80211_hw *hw,
if (il_is_rfkill(il))
goto out;

- if (test_bit(STATUS_EXIT_PENDING, &il->status) ||
- test_bit(STATUS_SCANNING, &il->status) ||
- test_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status) ||
+ test_bit(S_SCANNING, &il->status) ||
+ test_bit(S_CHANNEL_SWITCH_PENDING, &il->status))
goto out;

if (!il_is_associated_ctx(ctx))
@@ -5891,10 +5891,10 @@ void il4965_mac_channel_switch(struct ieee80211_hw *hw,
* at this point, staging_rxon has the
* configuration for channel switch
*/
- set_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status);
+ set_bit(S_CHANNEL_SWITCH_PENDING, &il->status);
il->switch_channel = cpu_to_le16(ch);
if (il->cfg->ops->lib->set_channel_switch(il, ch_switch)) {
- clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status);
+ clear_bit(S_CHANNEL_SWITCH_PENDING, &il->status);
il->switch_channel = 0;
ieee80211_chswitch_done(ctx->vif, false);
}
@@ -5968,8 +5968,8 @@ static void il4965_bg_txpower_work(struct work_struct *work)
* then just return; the stats notification will
* kick off another scheduled work to compensate for
* any temperature delta we missed here. */
- if (test_bit(STATUS_EXIT_PENDING, &il->status) ||
- test_bit(STATUS_SCANNING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status) ||
+ test_bit(S_SCANNING, &il->status))
goto out;

/* Regardless of if we are associated, we must reconfigure the
@@ -6376,12 +6376,12 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* If platform's RF_KILL switch is NOT set to KILL */
if (_il_rd(il, CSR_GP_CNTRL) &
CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
- clear_bit(STATUS_RF_KILL_HW, &il->status);
+ clear_bit(S_RF_KILL_HW, &il->status);
else
- set_bit(STATUS_RF_KILL_HW, &il->status);
+ set_bit(S_RF_KILL_HW, &il->status);

wiphy_rfkill_set_hw_state(il->hw->wiphy,
- test_bit(STATUS_RF_KILL_HW, &il->status));
+ test_bit(S_RF_KILL_HW, &il->status));

il_power_initialize(il);

@@ -6433,9 +6433,9 @@ static void __devexit il4965_pci_remove(struct pci_dev *pdev)

/* ieee80211_unregister_hw call wil cause il_mac_stop to
* to be called and il4965_down since we are removing the device
- * we need to set STATUS_EXIT_PENDING bit.
+ * we need to set S_EXIT_PENDING bit.
*/
- set_bit(STATUS_EXIT_PENDING, &il->status);
+ set_bit(S_EXIT_PENDING, &il->status);

il_leds_exit(il);

diff --git a/drivers/net/wireless/iwlegacy/4965.c b/drivers/net/wireless/iwlegacy/4965.c
index 8199e63..1efe824 100644
--- a/drivers/net/wireless/iwlegacy/4965.c
+++ b/drivers/net/wireless/iwlegacy/4965.c
@@ -1349,7 +1349,7 @@ static int il4965_send_tx_power(struct il_priv *il)
u8 ctrl_chan_high = 0;
struct il_rxon_context *ctx = &il->ctx;

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

@@ -1441,7 +1441,7 @@ static int il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
* receive commit_rxon request
* abort any previous channel switch if still in process
*/
- if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status) &&
+ if (test_bit(S_CHANNEL_SWITCH_PENDING, &il->status) &&
il->switch_channel != ctx->staging.channel) {
D_11H("abort channel switch on %d\n",
le16_to_cpu(il->switch_channel));
@@ -1673,7 +1673,7 @@ static int il4965_hw_get_temperature(struct il_priv *il)
s32 R1, R2, R3;
u32 R4;

- if (test_bit(STATUS_TEMPERATURE, &il->status) &&
+ if (test_bit(S_TEMPERATURE, &il->status) &&
(il->_4965.stats.flag &
STATISTICS_REPLY_FLG_HT40_MODE_MSK)) {
D_TEMP("Running HT40 temperature calibration\n");
@@ -1696,7 +1696,7 @@ static int il4965_hw_get_temperature(struct il_priv *il)
* with an updated temperature, use R4 provided to us in the
* "initialize" ALIVE response.
*/
- if (!test_bit(STATUS_TEMPERATURE, &il->status))
+ if (!test_bit(S_TEMPERATURE, &il->status))
vt = sign_extend32(R4, 23);
else
vt = sign_extend32(le32_to_cpu(il->_4965.stats.
@@ -1737,7 +1737,7 @@ static int il4965_is_temp_calib_needed(struct il_priv *il)
{
int temp_diff;

- if (!test_bit(STATUS_STATISTICS, &il->status)) {
+ if (!test_bit(S_STATISTICS, &il->status)) {
D_TEMP("Temperature not updated -- no stats.\n");
return 0;
}
@@ -1784,10 +1784,10 @@ static void il4965_temperature_calib(struct il_priv *il)
}

il->temperature = temp;
- set_bit(STATUS_TEMPERATURE, &il->status);
+ set_bit(S_TEMPERATURE, &il->status);

if (!il->disable_tx_power_cal &&
- unlikely(!test_bit(STATUS_SCANNING, &il->status)) &&
+ unlikely(!test_bit(S_SCANNING, &il->status)) &&
il4965_is_temp_calib_needed(il))
queue_work(il->workqueue, &il->txpower_work);
}
@@ -2179,7 +2179,7 @@ static void il4965_post_associate(struct il_priv *il)
if (!vif || !il->is_open)
return;

- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
return;

il_scan_cancel_timeout(il, 200);
@@ -2254,7 +2254,7 @@ static void il4965_config_ap(struct il_priv *il)

lockdep_assert_held(&il->mutex);

- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
return;

/* The following should be done only at AP bring up */
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index bd222f5..ba7ee4b 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -165,7 +165,7 @@ int il_init_geos(struct il_priv *il)
if (il->bands[IEEE80211_BAND_2GHZ].n_bitrates ||
il->bands[IEEE80211_BAND_5GHZ].n_bitrates) {
D_INFO("Geography modes already initialized.\n");
- set_bit(STATUS_GEO_CONFIGURED, &il->status);
+ set_bit(S_GEO_CONFIGURED, &il->status);
return 0;
}

@@ -264,7 +264,7 @@ int il_init_geos(struct il_priv *il)
il->bands[IEEE80211_BAND_2GHZ].n_channels,
il->bands[IEEE80211_BAND_5GHZ].n_channels);

- set_bit(STATUS_GEO_CONFIGURED, &il->status);
+ set_bit(S_GEO_CONFIGURED, &il->status);

return 0;
}
@@ -277,7 +277,7 @@ void il_free_geos(struct il_priv *il)
{
kfree(il->ieee_channels);
kfree(il->ieee_rates);
- clear_bit(STATUS_GEO_CONFIGURED, &il->status);
+ clear_bit(S_GEO_CONFIGURED, &il->status);
}
EXPORT_SYMBOL(il_free_geos);

@@ -839,10 +839,10 @@ void il_chswitch_done(struct il_priv *il, bool is_success)
{
struct il_rxon_context *ctx = &il->ctx;

- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
return;

- if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status))
+ if (test_and_clear_bit(S_CHANNEL_SWITCH_PENDING, &il->status))
ieee80211_chswitch_done(ctx->vif, is_success);
}
EXPORT_SYMBOL(il_chswitch_done);
@@ -855,7 +855,7 @@ void il_rx_csa(struct il_priv *il, struct il_rx_buf *rxb)
struct il_rxon_context *ctx = &il->ctx;
struct il_rxon_cmd *rxon = (void *)&ctx->active;

- if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status))
+ if (!test_bit(S_CHANNEL_SWITCH_PENDING, &il->status))
return;

if (!le32_to_cpu(csa->status) && csa->channel == il->switch_channel) {
@@ -903,10 +903,10 @@ EXPORT_SYMBOL(il_print_rx_config_cmd);
void il_irq_handle_error(struct il_priv *il)
{
/* Set the FW error flag -- cleared on il_down */
- set_bit(STATUS_FW_ERROR, &il->status);
+ set_bit(S_FW_ERROR, &il->status);

/* Cancel currently queued command. */
- clear_bit(STATUS_HCMD_ACTIVE, &il->status);
+ clear_bit(S_HCMD_ACTIVE, &il->status);

IL_ERR("Loaded firmware version: %s\n",
il->hw->wiphy->fw_version);
@@ -924,9 +924,9 @@ void il_irq_handle_error(struct il_priv *il)

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

- if (!test_bit(STATUS_EXIT_PENDING, &il->status)) {
+ if (!test_bit(S_EXIT_PENDING, &il->status)) {
IL_DBG(IL_DL_FW_ERRORS,
"Restarting adapter due to uCode error.\n");

@@ -1127,7 +1127,7 @@ int il_set_tx_power(struct il_priv *il, s8 tx_power, bool force)
il->tx_power_next = tx_power;

/* do not set tx power when scanning or channel changing */
- defer = test_bit(STATUS_SCANNING, &il->status) ||
+ defer = test_bit(S_SCANNING, &il->status) ||
memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging));
if (defer && !force) {
D_INFO("Deferring tx power set\n");
@@ -1678,7 +1678,7 @@ int il_force_reset(struct il_priv *il, bool external)
{
struct il_force_reset *force_reset;

- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
return -EINVAL;

force_reset = &il->force_reset;
@@ -1713,13 +1713,13 @@ int il_force_reset(struct il_priv *il, bool external)
IL_ERR("On demand firmware reload\n");

/* Set the FW error flag -- cleared on il_down */
- set_bit(STATUS_FW_ERROR, &il->status);
+ set_bit(S_FW_ERROR, &il->status);
wake_up(&il->wait_command_queue);
/*
* Keep the restart process from trying to send host
* commands by clearing the INIT status bit
*/
- clear_bit(STATUS_READY, &il->status);
+ clear_bit(S_READY, &il->status);
queue_work(il->workqueue, &il->restart);

return 0;
@@ -1826,7 +1826,7 @@ void il_bg_watchdog(unsigned long data)
int cnt;
unsigned long timeout;

- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
return;

timeout = il->cfg->base_params->wd_timeout;
@@ -1960,9 +1960,9 @@ int il_pci_resume(struct device *device)
hw_rfkill = true;

if (hw_rfkill)
- set_bit(STATUS_RF_KILL_HW, &il->status);
+ set_bit(S_RF_KILL_HW, &il->status);
else
- clear_bit(STATUS_RF_KILL_HW, &il->status);
+ clear_bit(S_RF_KILL_HW, &il->status);

wiphy_rfkill_set_hw_state(il->hw->wiphy, hw_rfkill);

@@ -1985,7 +1985,7 @@ EXPORT_SYMBOL(il_pm_ops);
static void
il_update_qos(struct il_priv *il, struct il_rxon_context *ctx)
{
- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
return;

if (!ctx->is_active)
@@ -2034,7 +2034,7 @@ int il_mac_config(struct ieee80211_hw *hw, u32 changed)
D_MAC80211("enter to channel %d changed 0x%X\n",
channel->hw_value, changed);

- if (unlikely(test_bit(STATUS_SCANNING, &il->status))) {
+ if (unlikely(test_bit(S_SCANNING, &il->status))) {
scan_active = 1;
D_MAC80211("scan active\n");
}
@@ -2566,7 +2566,7 @@ unplugged:
none:
/* re-enable interrupts here since we don't have anything to service. */
/* only Re-enable if disabled by irq */
- if (test_bit(STATUS_INT_ENABLED, &il->status))
+ if (test_bit(S_INT_ENABLED, &il->status))
il_enable_interrupts(il);
spin_unlock_irqrestore(&il->lock, flags);
return IRQ_NONE;
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.h b/drivers/net/wireless/iwlegacy/iwl-core.h
index 8333761..5b2883f 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.h
+++ b/drivers/net/wireless/iwlegacy/iwl-core.h
@@ -533,47 +533,47 @@ void il_free_geos(struct il_priv *il);

/*************** DRIVER STATUS FUNCTIONS *****/

-#define STATUS_HCMD_ACTIVE 0 /* host command in progress */
-/* 1 is unused (used to be STATUS_HCMD_SYNC_ACTIVE) */
-#define STATUS_INT_ENABLED 2
-#define STATUS_RF_KILL_HW 3
-#define STATUS_CT_KILL 4
-#define STATUS_INIT 5
-#define STATUS_ALIVE 6
-#define STATUS_READY 7
-#define STATUS_TEMPERATURE 8
-#define STATUS_GEO_CONFIGURED 9
-#define STATUS_EXIT_PENDING 10
-#define STATUS_STATISTICS 12
-#define STATUS_SCANNING 13
-#define STATUS_SCAN_ABORTING 14
-#define STATUS_SCAN_HW 15
-#define STATUS_POWER_PMI 16
-#define STATUS_FW_ERROR 17
-#define STATUS_CHANNEL_SWITCH_PENDING 18
+#define S_HCMD_ACTIVE 0 /* host command in progress */
+/* 1 is unused (used to be S_HCMD_SYNC_ACTIVE) */
+#define S_INT_ENABLED 2
+#define S_RF_KILL_HW 3
+#define S_CT_KILL 4
+#define S_INIT 5
+#define S_ALIVE 6
+#define S_READY 7
+#define S_TEMPERATURE 8
+#define S_GEO_CONFIGURED 9
+#define S_EXIT_PENDING 10
+#define S_STATISTICS 12
+#define S_SCANNING 13
+#define S_SCAN_ABORTING 14
+#define S_SCAN_HW 15
+#define S_POWER_PMI 16
+#define S_FW_ERROR 17
+#define S_CHANNEL_SWITCH_PENDING 18

static inline int il_is_ready(struct il_priv *il)
{
/* The adapter is 'ready' if READY and GEO_CONFIGURED bits are
* set but EXIT_PENDING is not */
- return test_bit(STATUS_READY, &il->status) &&
- test_bit(STATUS_GEO_CONFIGURED, &il->status) &&
- !test_bit(STATUS_EXIT_PENDING, &il->status);
+ return test_bit(S_READY, &il->status) &&
+ test_bit(S_GEO_CONFIGURED, &il->status) &&
+ !test_bit(S_EXIT_PENDING, &il->status);
}

static inline int il_is_alive(struct il_priv *il)
{
- return test_bit(STATUS_ALIVE, &il->status);
+ return test_bit(S_ALIVE, &il->status);
}

static inline int il_is_init(struct il_priv *il)
{
- return test_bit(STATUS_INIT, &il->status);
+ return test_bit(S_INIT, &il->status);
}

static inline int il_is_rfkill_hw(struct il_priv *il)
{
- return test_bit(STATUS_RF_KILL_HW, &il->status);
+ return test_bit(S_RF_KILL_HW, &il->status);
}

static inline int il_is_rfkill(struct il_priv *il)
@@ -583,7 +583,7 @@ static inline int il_is_rfkill(struct il_priv *il)

static inline int il_is_ctkill(struct il_priv *il)
{
- return test_bit(STATUS_CT_KILL, &il->status);
+ return test_bit(S_CT_KILL, &il->status);
}

static inline int il_is_ready_rf(struct il_priv *il)
diff --git a/drivers/net/wireless/iwlegacy/iwl-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-debugfs.c
index 8448db7..114922b 100644
--- a/drivers/net/wireless/iwlegacy/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-debugfs.c
@@ -402,7 +402,7 @@ il_dbgfs_channels_read(struct file *file, char __user *user_buf,
char *buf;
ssize_t ret;

- if (!test_bit(STATUS_GEO_CONFIGURED, &il->status))
+ if (!test_bit(S_GEO_CONFIGURED, &il->status))
return -EAGAIN;

buf = kzalloc(bufsz, GFP_KERNEL);
@@ -471,38 +471,38 @@ static ssize_t il_dbgfs_status_read(struct file *file,
int pos = 0;
const size_t bufsz = sizeof(buf);

- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n",
- test_bit(STATUS_HCMD_ACTIVE, &il->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INT_ENABLED:\t %d\n",
- test_bit(STATUS_INT_ENABLED, &il->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n",
- test_bit(STATUS_RF_KILL_HW, &il->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_CT_KILL:\t\t %d\n",
- test_bit(STATUS_CT_KILL, &il->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INIT:\t\t %d\n",
- test_bit(STATUS_INIT, &il->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n",
- test_bit(STATUS_ALIVE, &il->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n",
- test_bit(STATUS_READY, &il->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_TEMPERATURE:\t %d\n",
- test_bit(STATUS_TEMPERATURE, &il->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_GEO_CONFIGURED:\t %d\n",
- test_bit(STATUS_GEO_CONFIGURED, &il->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n",
- test_bit(STATUS_EXIT_PENDING, &il->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n",
- test_bit(STATUS_STATISTICS, &il->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCANNING:\t %d\n",
- test_bit(STATUS_SCANNING, &il->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_ABORTING:\t %d\n",
- test_bit(STATUS_SCAN_ABORTING, &il->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_HW:\t\t %d\n",
- test_bit(STATUS_SCAN_HW, &il->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_POWER_PMI:\t %d\n",
- test_bit(STATUS_POWER_PMI, &il->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_FW_ERROR:\t %d\n",
- test_bit(STATUS_FW_ERROR, &il->status));
+ pos += scnprintf(buf + pos, bufsz - pos, "S_HCMD_ACTIVE:\t %d\n",
+ test_bit(S_HCMD_ACTIVE, &il->status));
+ pos += scnprintf(buf + pos, bufsz - pos, "S_INT_ENABLED:\t %d\n",
+ test_bit(S_INT_ENABLED, &il->status));
+ pos += scnprintf(buf + pos, bufsz - pos, "S_RF_KILL_HW:\t %d\n",
+ test_bit(S_RF_KILL_HW, &il->status));
+ pos += scnprintf(buf + pos, bufsz - pos, "S_CT_KILL:\t\t %d\n",
+ test_bit(S_CT_KILL, &il->status));
+ pos += scnprintf(buf + pos, bufsz - pos, "S_INIT:\t\t %d\n",
+ test_bit(S_INIT, &il->status));
+ pos += scnprintf(buf + pos, bufsz - pos, "S_ALIVE:\t\t %d\n",
+ test_bit(S_ALIVE, &il->status));
+ pos += scnprintf(buf + pos, bufsz - pos, "S_READY:\t\t %d\n",
+ test_bit(S_READY, &il->status));
+ pos += scnprintf(buf + pos, bufsz - pos, "S_TEMPERATURE:\t %d\n",
+ test_bit(S_TEMPERATURE, &il->status));
+ pos += scnprintf(buf + pos, bufsz - pos, "S_GEO_CONFIGURED:\t %d\n",
+ test_bit(S_GEO_CONFIGURED, &il->status));
+ pos += scnprintf(buf + pos, bufsz - pos, "S_EXIT_PENDING:\t %d\n",
+ test_bit(S_EXIT_PENDING, &il->status));
+ pos += scnprintf(buf + pos, bufsz - pos, "S_STATISTICS:\t %d\n",
+ test_bit(S_STATISTICS, &il->status));
+ pos += scnprintf(buf + pos, bufsz - pos, "S_SCANNING:\t %d\n",
+ test_bit(S_SCANNING, &il->status));
+ pos += scnprintf(buf + pos, bufsz - pos, "S_SCAN_ABORTING:\t %d\n",
+ test_bit(S_SCAN_ABORTING, &il->status));
+ pos += scnprintf(buf + pos, bufsz - pos, "S_SCAN_HW:\t\t %d\n",
+ test_bit(S_SCAN_HW, &il->status));
+ pos += scnprintf(buf + pos, bufsz - pos, "S_POWER_PMI:\t %d\n",
+ test_bit(S_POWER_PMI, &il->status));
+ pos += scnprintf(buf + pos, bufsz - pos, "S_FW_ERROR:\t %d\n",
+ test_bit(S_FW_ERROR, &il->status));
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
}

diff --git a/drivers/net/wireless/iwlegacy/iwl-hcmd.c b/drivers/net/wireless/iwlegacy/iwl-hcmd.c
index 0b11f2f..4762a0e 100644
--- a/drivers/net/wireless/iwlegacy/iwl-hcmd.c
+++ b/drivers/net/wireless/iwlegacy/iwl-hcmd.c
@@ -128,7 +128,7 @@ il_send_cmd_async(struct il_priv *il, struct il_host_cmd *cmd)
if (!cmd->callback)
cmd->callback = il_generic_cmd_callback;

- if (test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (test_bit(S_EXIT_PENDING, &il->status))
return -EBUSY;

ret = il_enqueue_hcmd(il, cmd);
@@ -155,7 +155,7 @@ int il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd)
D_INFO("Attempting to send sync command %s\n",
il_get_cmd_string(cmd->id));

- set_bit(STATUS_HCMD_ACTIVE, &il->status);
+ set_bit(S_HCMD_ACTIVE, &il->status);
D_INFO("Setting HCMD_ACTIVE for command %s\n",
il_get_cmd_string(cmd->id));

@@ -168,16 +168,16 @@ int il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd)
}

ret = wait_event_timeout(il->wait_command_queue,
- !test_bit(STATUS_HCMD_ACTIVE, &il->status),
+ !test_bit(S_HCMD_ACTIVE, &il->status),
HOST_COMPLETE_TIMEOUT);
if (!ret) {
- if (test_bit(STATUS_HCMD_ACTIVE, &il->status)) {
+ if (test_bit(S_HCMD_ACTIVE, &il->status)) {
IL_ERR(
"Error sending %s: time out after %dms.\n",
il_get_cmd_string(cmd->id),
jiffies_to_msecs(HOST_COMPLETE_TIMEOUT));

- clear_bit(STATUS_HCMD_ACTIVE, &il->status);
+ clear_bit(S_HCMD_ACTIVE, &il->status);
D_INFO(
"Clearing HCMD_ACTIVE for command %s\n",
il_get_cmd_string(cmd->id));
@@ -186,13 +186,13 @@ int il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd)
}
}

- if (test_bit(STATUS_RF_KILL_HW, &il->status)) {
+ if (test_bit(S_RF_KILL_HW, &il->status)) {
IL_ERR("Command %s aborted: RF KILL Switch\n",
il_get_cmd_string(cmd->id));
ret = -ECANCELED;
goto fail;
}
- if (test_bit(STATUS_FW_ERROR, &il->status)) {
+ if (test_bit(S_FW_ERROR, &il->status)) {
IL_ERR("Command %s failed: FW Error\n",
il_get_cmd_string(cmd->id));
ret = -EIO;
diff --git a/drivers/net/wireless/iwlegacy/iwl-helpers.h b/drivers/net/wireless/iwlegacy/iwl-helpers.h
index 5fcb23e..0e64003 100644
--- a/drivers/net/wireless/iwlegacy/iwl-helpers.h
+++ b/drivers/net/wireless/iwlegacy/iwl-helpers.h
@@ -146,7 +146,7 @@ static inline void il_stop_queue(struct il_priv *il,

static inline void il_disable_interrupts(struct il_priv *il)
{
- clear_bit(STATUS_INT_ENABLED, &il->status);
+ clear_bit(S_INT_ENABLED, &il->status);

/* disable interrupts from uCode/NIC to host */
_il_wr(il, CSR_INT_MASK, 0x00000000);
@@ -167,7 +167,7 @@ static inline void il_enable_rfkill_int(struct il_priv *il)
static inline void il_enable_interrupts(struct il_priv *il)
{
D_ISR("Enabling interrupts\n");
- set_bit(STATUS_INT_ENABLED, &il->status);
+ set_bit(S_INT_ENABLED, &il->status);
_il_wr(il, CSR_INT_MASK, il->inta_mask);
}

diff --git a/drivers/net/wireless/iwlegacy/iwl-led.c b/drivers/net/wireless/iwlegacy/iwl-led.c
index 3652cdc..a840c2e 100644
--- a/drivers/net/wireless/iwlegacy/iwl-led.c
+++ b/drivers/net/wireless/iwlegacy/iwl-led.c
@@ -107,7 +107,7 @@ static int il_led_cmd(struct il_priv *il,
};
int ret;

- if (!test_bit(STATUS_READY, &il->status))
+ if (!test_bit(S_READY, &il->status))
return -EBUSY;

if (il->blink_on == on && il->blink_off == off)
diff --git a/drivers/net/wireless/iwlegacy/iwl-power.c b/drivers/net/wireless/iwlegacy/iwl-power.c
index 051623a..c66a0f7 100644
--- a/drivers/net/wireless/iwlegacy/iwl-power.c
+++ b/drivers/net/wireless/iwlegacy/iwl-power.c
@@ -113,18 +113,18 @@ il_power_set_mode(struct il_priv *il, struct il_powertable_cmd *cmd,

/* scan complete use sleep_power_next, need to be updated */
memcpy(&il->power_data.sleep_cmd_next, cmd, sizeof(*cmd));
- if (test_bit(STATUS_SCANNING, &il->status) && !force) {
+ if (test_bit(S_SCANNING, &il->status) && !force) {
D_INFO("Defer power set mode while scanning\n");
return 0;
}

if (cmd->flags & IL_POWER_DRIVER_ALLOW_SLEEP_MSK)
- set_bit(STATUS_POWER_PMI, &il->status);
+ set_bit(S_POWER_PMI, &il->status);

ret = il_set_power(il, cmd);
if (!ret) {
if (!(cmd->flags & IL_POWER_DRIVER_ALLOW_SLEEP_MSK))
- clear_bit(STATUS_POWER_PMI, &il->status);
+ clear_bit(S_POWER_PMI, &il->status);

if (il->cfg->ops->lib->update_chain_flags && update_chains)
il->cfg->ops->lib->update_chain_flags(il);
diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c
index 58d19c1..76f2361 100644
--- a/drivers/net/wireless/iwlegacy/iwl-rx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-rx.c
@@ -137,7 +137,7 @@ il_rx_queue_update_write_ptr(struct il_priv *il,
goto exit_unlock;

/* If power-saving is in use, make sure device is awake */
- if (test_bit(STATUS_POWER_PMI, &il->status)) {
+ if (test_bit(S_POWER_PMI, &il->status)) {
reg = _il_rd(il, CSR_UCODE_DRV_GP1);

if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
diff --git a/drivers/net/wireless/iwlegacy/iwl-scan.c b/drivers/net/wireless/iwlegacy/iwl-scan.c
index 18226d1..6d20f2b 100644
--- a/drivers/net/wireless/iwlegacy/iwl-scan.c
+++ b/drivers/net/wireless/iwlegacy/iwl-scan.c
@@ -66,11 +66,11 @@ static int il_send_scan_abort(struct il_priv *il)
/* Exit instantly with error when device is not ready
* to receive scan abort command or it does not perform
* hardware scan currently */
- if (!test_bit(STATUS_READY, &il->status) ||
- !test_bit(STATUS_GEO_CONFIGURED, &il->status) ||
- !test_bit(STATUS_SCAN_HW, &il->status) ||
- test_bit(STATUS_FW_ERROR, &il->status) ||
- test_bit(STATUS_EXIT_PENDING, &il->status))
+ if (!test_bit(S_READY, &il->status) ||
+ !test_bit(S_GEO_CONFIGURED, &il->status) ||
+ !test_bit(S_SCAN_HW, &il->status) ||
+ test_bit(S_FW_ERROR, &il->status) ||
+ test_bit(S_EXIT_PENDING, &il->status))
return -EIO;

ret = il_send_cmd_sync(il, &cmd);
@@ -109,15 +109,15 @@ void il_force_scan_end(struct il_priv *il)
{
lockdep_assert_held(&il->mutex);

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

D_SCAN("Forcing scan end\n");
- clear_bit(STATUS_SCANNING, &il->status);
- clear_bit(STATUS_SCAN_HW, &il->status);
- clear_bit(STATUS_SCAN_ABORTING, &il->status);
+ clear_bit(S_SCANNING, &il->status);
+ clear_bit(S_SCAN_HW, &il->status);
+ clear_bit(S_SCAN_ABORTING, &il->status);
il_complete_scan(il, true);
}

@@ -127,12 +127,12 @@ static void il_do_scan_abort(struct il_priv *il)

lockdep_assert_held(&il->mutex);

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

- if (test_and_set_bit(STATUS_SCAN_ABORTING, &il->status)) {
+ if (test_and_set_bit(S_SCAN_ABORTING, &il->status)) {
D_SCAN("Scan abort in progress\n");
return;
}
@@ -172,12 +172,12 @@ int il_scan_cancel_timeout(struct il_priv *il, unsigned long ms)
il_do_scan_abort(il);

while (time_before_eq(jiffies, timeout)) {
- if (!test_bit(STATUS_SCAN_HW, &il->status))
+ if (!test_bit(S_SCAN_HW, &il->status))
break;
msleep(20);
}

- return test_bit(STATUS_SCAN_HW, &il->status);
+ return test_bit(S_SCAN_HW, &il->status);
}
EXPORT_SYMBOL(il_scan_cancel_timeout);

@@ -251,7 +251,7 @@ static void il_rx_scan_complete_notif(struct il_priv *il,
scan_notif->tsf_high, scan_notif->status);

/* The HW is no longer scanning */
- clear_bit(STATUS_SCAN_HW, &il->status);
+ clear_bit(S_SCAN_HW, &il->status);

D_SCAN("Scan on %sGHz took %dms\n",
(il->scan_band == IEEE80211_BAND_2GHZ) ? "2.4" : "5.2",
@@ -341,25 +341,25 @@ static int il_scan_initiate(struct il_priv *il,
return -EIO;
}

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

- if (test_bit(STATUS_SCAN_ABORTING, &il->status)) {
+ if (test_bit(S_SCAN_ABORTING, &il->status)) {
D_SCAN("Scan request while abort pending.\n");
return -EBUSY;
}

D_SCAN("Starting scan...\n");

- set_bit(STATUS_SCANNING, &il->status);
+ set_bit(S_SCANNING, &il->status);
il->scan_start = jiffies;

ret = il->cfg->ops->utils->request_scan(il, vif);
if (ret) {
- clear_bit(STATUS_SCANNING, &il->status);
+ clear_bit(S_SCANNING, &il->status);
return ret;
}

@@ -383,7 +383,7 @@ int il_mac_hw_scan(struct ieee80211_hw *hw,

mutex_lock(&il->mutex);

- if (test_bit(STATUS_SCANNING, &il->status)) {
+ if (test_bit(S_SCANNING, &il->status)) {
D_SCAN("Scan already in progress.\n");
ret = -EAGAIN;
goto out_unlock;
@@ -494,11 +494,11 @@ static void il_bg_scan_completed(struct work_struct *work)

mutex_lock(&il->mutex);

- aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &il->status);
+ aborted = test_and_clear_bit(S_SCAN_ABORTING, &il->status);
if (aborted)
D_SCAN("Aborted scan completed.\n");

- if (!test_and_clear_bit(STATUS_SCANNING, &il->status)) {
+ if (!test_and_clear_bit(S_SCANNING, &il->status)) {
D_SCAN("Scan already completed.\n");
goto out_settings;
}
diff --git a/drivers/net/wireless/iwlegacy/iwl-tx.c b/drivers/net/wireless/iwlegacy/iwl-tx.c
index e46e588..3f97d09 100644
--- a/drivers/net/wireless/iwlegacy/iwl-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-tx.c
@@ -51,7 +51,7 @@ il_txq_update_write_ptr(struct il_priv *il, struct il_tx_queue *txq)
return;

/* if we're trying to save power */
- if (test_bit(STATUS_POWER_PMI, &il->status)) {
+ if (test_bit(S_POWER_PMI, &il->status)) {
/* wake up nic if it's powered down ...
* uCode will wake up, and interrupt us again, so next
* time we'll skip this part. */
@@ -641,7 +641,7 @@ il_tx_cmd_complete(struct il_priv *il, struct il_rx_buf *rxb)
il_hcmd_queue_reclaim(il, txq_id, idx, cmd_idx);

if (!(meta->flags & CMD_ASYNC)) {
- clear_bit(STATUS_HCMD_ACTIVE, &il->status);
+ clear_bit(S_HCMD_ACTIVE, &il->status);
D_INFO("Clearing HCMD_ACTIVE for command %s\n",
il_get_cmd_string(cmd->hdr.cmd));
wake_up(&il->wait_command_queue);
--
1.7.1


2011-11-18 08:23:14

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 69/77] iwlegacy: change IL_ERR to D_HT in iwl4965_rs_tl_turn_on_agg_for_tid

From: Greg Dietsche <[email protected]>

This message should be a debug message and not an error.

Signed-off-by: Greg Dietsche <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/4965-rs.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/4965-rs.c b/drivers/net/wireless/iwlegacy/4965-rs.c
index 4bc5a18..93c3a4d 100644
--- a/drivers/net/wireless/iwlegacy/4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/4965-rs.c
@@ -371,10 +371,10 @@ il4965_rs_tl_turn_on_agg_for_tid(struct il_priv *il, struct il_lq_sta *lq_data,
IL_ERR("Fail start Tx agg on tid: %d\n", tid);
ieee80211_stop_tx_ba_session(sta, tid);
}
- } else {
- IL_ERR("Aggregation not enabled for tid %d "
- "because load = %u\n", tid, load);
- }
+ } else
+ D_HT("Aggregation not enabled for tid %d because load = %u\n",
+ tid, load);
+
return ret;
}

--
1.7.1


2011-11-18 08:22:22

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 42/77] iwlegacy: s/STATISTICS/STATS/

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/3945-debug.c | 6 ++--
drivers/net/wireless/iwlegacy/3945-mac.c | 6 ++--
drivers/net/wireless/iwlegacy/3945.c | 2 +-
drivers/net/wireless/iwlegacy/4965-calib.c | 2 +-
drivers/net/wireless/iwlegacy/4965-debug.c | 6 ++--
drivers/net/wireless/iwlegacy/4965-mac.c | 18 ++++++------
drivers/net/wireless/iwlegacy/4965.c | 4 +-
drivers/net/wireless/iwlegacy/4965.h | 4 +-
drivers/net/wireless/iwlegacy/iwl-commands.h | 38 +++++++++++++-------------
drivers/net/wireless/iwlegacy/iwl-core.c | 4 +-
drivers/net/wireless/iwlegacy/iwl-core.h | 2 +-
drivers/net/wireless/iwlegacy/iwl-debugfs.c | 4 +-
drivers/net/wireless/iwlegacy/iwl-hcmd.c | 4 +-
13 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/3945-debug.c b/drivers/net/wireless/iwlegacy/3945-debug.c
index 9c837c3..fc2d651 100644
--- a/drivers/net/wireless/iwlegacy/3945-debug.c
+++ b/drivers/net/wireless/iwlegacy/3945-debug.c
@@ -37,16 +37,16 @@ static int il3945_stats_flag(struct il_priv *il, char *buf, int bufsz)
p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n",
le32_to_cpu(il->_3945.stats.flag));
if (le32_to_cpu(il->_3945.stats.flag) &
- UCODE_STATISTICS_CLEAR_MSK)
+ UCODE_STATS_CLEAR_MSK)
p += scnprintf(buf + p, bufsz - p,
"\tStatistics have been cleared\n");
p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n",
(le32_to_cpu(il->_3945.stats.flag) &
- UCODE_STATISTICS_FREQUENCY_MSK)
+ UCODE_STATS_FREQUENCY_MSK)
? "2.4 GHz" : "5.2 GHz");
p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n",
(le32_to_cpu(il->_3945.stats.flag) &
- UCODE_STATISTICS_NARROW_BAND_MSK)
+ UCODE_STATS_NARROW_BAND_MSK)
? "enabled" : "disabled");
return p;
}
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
index f69211e..2ff8075 100644
--- a/drivers/net/wireless/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
@@ -869,8 +869,8 @@ static void il3945_setup_rx_handlers(struct il_priv *il)
* stats request from the host as well as for the periodic
* stats notifications (after received beacons) from the uCode.
*/
- il->rx_handlers[REPLY_STATISTICS_CMD] = il3945_reply_stats;
- il->rx_handlers[STATISTICS_NOTIFICATION] = il3945_hw_rx_stats;
+ il->rx_handlers[REPLY_STATS_CMD] = il3945_reply_stats;
+ il->rx_handlers[STATS_NOTIFICATION] = il3945_hw_rx_stats;

il_setup_rx_scan_handlers(il);
il->rx_handlers[CARD_STATE_NOTIFICATION] = il3945_rx_card_state_notif;
@@ -1253,7 +1253,7 @@ static void il3945_rx_handle(struct il_priv *il)
* Ucode should set SEQ_RX_FRAME bit if ucode-originated,
* but apparently a few don't get set; catch them here. */
reclaim = !(pkt->hdr.sequence & SEQ_RX_FRAME) &&
- pkt->hdr.cmd != STATISTICS_NOTIFICATION &&
+ pkt->hdr.cmd != STATS_NOTIFICATION &&
pkt->hdr.cmd != REPLY_TX;

/* Based on type of command response or notification,
diff --git a/drivers/net/wireless/iwlegacy/3945.c b/drivers/net/wireless/iwlegacy/3945.c
index 8ebd576..82534a2 100644
--- a/drivers/net/wireless/iwlegacy/3945.c
+++ b/drivers/net/wireless/iwlegacy/3945.c
@@ -432,7 +432,7 @@ void il3945_reply_stats(struct il_priv *il,
struct il_rx_pkt *pkt = rxb_addr(rxb);
__le32 *flag = (__le32 *)&pkt->u.raw;

- if (le32_to_cpu(*flag) & UCODE_STATISTICS_CLEAR_MSK) {
+ if (le32_to_cpu(*flag) & UCODE_STATS_CLEAR_MSK) {
#ifdef CONFIG_IWLEGACY_DEBUGFS
memset(&il->_3945.accum_stats, 0,
sizeof(struct il3945_notif_stats));
diff --git a/drivers/net/wireless/iwlegacy/4965-calib.c b/drivers/net/wireless/iwlegacy/4965-calib.c
index 1d0502e..cd61050 100644
--- a/drivers/net/wireless/iwlegacy/4965-calib.c
+++ b/drivers/net/wireless/iwlegacy/4965-calib.c
@@ -853,7 +853,7 @@ void il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp)

stat_band24 = !!(((struct il_notif_stats *)
stat_resp)->flag &
- STATISTICS_REPLY_FLG_BAND_24G_MSK);
+ STATS_REPLY_FLG_BAND_24G_MSK);
stat_chnum = le32_to_cpu(((struct il_notif_stats *)
stat_resp)->flag) >> 16;

diff --git a/drivers/net/wireless/iwlegacy/4965-debug.c b/drivers/net/wireless/iwlegacy/4965-debug.c
index 825d0aa..ad9c6d0 100644
--- a/drivers/net/wireless/iwlegacy/4965-debug.c
+++ b/drivers/net/wireless/iwlegacy/4965-debug.c
@@ -42,14 +42,14 @@ static int il4965_stats_flag(struct il_priv *il, char *buf, int bufsz)
flag = le32_to_cpu(il->_4965.stats.flag);

p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", flag);
- if (flag & UCODE_STATISTICS_CLEAR_MSK)
+ if (flag & UCODE_STATS_CLEAR_MSK)
p += scnprintf(buf + p, bufsz - p,
"\tStatistics have been cleared\n");
p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n",
- (flag & UCODE_STATISTICS_FREQUENCY_MSK)
+ (flag & UCODE_STATS_FREQUENCY_MSK)
? "2.4 GHz" : "5.2 GHz");
p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n",
- (flag & UCODE_STATISTICS_NARROW_BAND_MSK)
+ (flag & UCODE_STATS_NARROW_BAND_MSK)
? "enabled" : "disabled");

return p;
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index c4198bd..c3f8137 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -1367,9 +1367,9 @@ void il4965_rx_stats(struct il_priv *il,
change = ((il->_4965.stats.general.common.temperature !=
pkt->u.stats.general.common.temperature) ||
((il->_4965.stats.flag &
- STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
+ STATS_REPLY_FLG_HT40_MODE_MSK) !=
(pkt->u.stats.flag &
- STATISTICS_REPLY_FLG_HT40_MODE_MSK)));
+ STATS_REPLY_FLG_HT40_MODE_MSK)));
#ifdef CONFIG_IWLEGACY_DEBUGFS
il4965_accumulative_stats(il, (__le32 *)&pkt->u.stats);
#endif
@@ -1378,7 +1378,7 @@ void il4965_rx_stats(struct il_priv *il,
memcpy(&il->_4965.stats, &pkt->u.stats,
sizeof(il->_4965.stats));

- set_bit(S_STATISTICS, &il->status);
+ set_bit(S_STATS, &il->status);

/* Reschedule the stats timer to occur in
* REG_RECALIB_PERIOD seconds to ensure we get a
@@ -1388,7 +1388,7 @@ void il4965_rx_stats(struct il_priv *il,
msecs_to_jiffies(REG_RECALIB_PERIOD * 1000));

if (unlikely(!test_bit(S_SCANNING, &il->status)) &&
- (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) {
+ (pkt->hdr.cmd == STATS_NOTIFICATION)) {
il4965_rx_calc_noise(il);
queue_work(il->workqueue, &il->run_time_calib_work);
}
@@ -1401,7 +1401,7 @@ void il4965_reply_stats(struct il_priv *il,
{
struct il_rx_pkt *pkt = rxb_addr(rxb);

- if (le32_to_cpu(pkt->u.stats.flag) & UCODE_STATISTICS_CLEAR_MSK) {
+ if (le32_to_cpu(pkt->u.stats.flag) & UCODE_STATS_CLEAR_MSK) {
#ifdef CONFIG_IWLEGACY_DEBUGFS
memset(&il->_4965.accum_stats, 0,
sizeof(struct il_notif_stats));
@@ -3801,7 +3801,7 @@ static void il4965_rx_reply_alive(struct il_priv *il,
* This callback is provided in order to send a stats request.
*
* This timer function is continually reset to execute within
- * REG_RECALIB_PERIOD seconds since the last STATISTICS_NOTIFICATION
+ * REG_RECALIB_PERIOD seconds since the last STATS_NOTIFICATION
* was received. We need to ensure we receive the stats in order
* to update the temperature used for calibrating the TXPOWER.
*/
@@ -3936,8 +3936,8 @@ static void il4965_setup_rx_handlers(struct il_priv *il)
* stats request from the host as well as for the periodic
* stats notifications (after received beacons) from the uCode.
*/
- il->rx_handlers[REPLY_STATISTICS_CMD] = il4965_reply_stats;
- il->rx_handlers[STATISTICS_NOTIFICATION] = il4965_rx_stats;
+ il->rx_handlers[REPLY_STATS_CMD] = il4965_reply_stats;
+ il->rx_handlers[STATS_NOTIFICATION] = il4965_rx_stats;

il_setup_rx_scan_handlers(il);

@@ -4023,7 +4023,7 @@ void il4965_rx_handle(struct il_priv *il)
(pkt->hdr.cmd != REPLY_RX) &&
(pkt->hdr.cmd != REPLY_RX_MPDU_CMD) &&
(pkt->hdr.cmd != REPLY_COMPRESSED_BA) &&
- (pkt->hdr.cmd != STATISTICS_NOTIFICATION) &&
+ (pkt->hdr.cmd != STATS_NOTIFICATION) &&
(pkt->hdr.cmd != REPLY_TX);

/* Based on type of command response or notification,
diff --git a/drivers/net/wireless/iwlegacy/4965.c b/drivers/net/wireless/iwlegacy/4965.c
index 1efe824..361a1ca 100644
--- a/drivers/net/wireless/iwlegacy/4965.c
+++ b/drivers/net/wireless/iwlegacy/4965.c
@@ -1675,7 +1675,7 @@ static int il4965_hw_get_temperature(struct il_priv *il)

if (test_bit(S_TEMPERATURE, &il->status) &&
(il->_4965.stats.flag &
- STATISTICS_REPLY_FLG_HT40_MODE_MSK)) {
+ STATS_REPLY_FLG_HT40_MODE_MSK)) {
D_TEMP("Running HT40 temperature calibration\n");
R1 = (s32)le32_to_cpu(il->card_alive_init.therm_r1[1]);
R2 = (s32)le32_to_cpu(il->card_alive_init.therm_r2[1]);
@@ -1737,7 +1737,7 @@ static int il4965_is_temp_calib_needed(struct il_priv *il)
{
int temp_diff;

- if (!test_bit(S_STATISTICS, &il->status)) {
+ if (!test_bit(S_STATS, &il->status)) {
D_TEMP("Temperature not updated -- no stats.\n");
return 0;
}
diff --git a/drivers/net/wireless/iwlegacy/4965.h b/drivers/net/wireless/iwlegacy/4965.h
index b1a01c9..85c3a49 100644
--- a/drivers/net/wireless/iwlegacy/4965.h
+++ b/drivers/net/wireless/iwlegacy/4965.h
@@ -278,8 +278,8 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
* uCode provides all 4 values to the driver via the "initialize alive"
* notification (see struct il4965_init_alive_resp). After the runtime uCode
* image loads, uCode updates the R4 value via stats notifications
- * (see STATISTICS_NOTIFICATION), which occur after each received beacon
- * when associated, or can be requested via REPLY_STATISTICS_CMD.
+ * (see STATS_NOTIFICATION), which occur after each received beacon
+ * when associated, or can be requested via REPLY_STATS_CMD.
*
* NOTE: uCode provides the R4 value as a 23-bit signed value. Driver
* must sign-extend to 32 bits before applying formula below.
diff --git a/drivers/net/wireless/iwlegacy/iwl-commands.h b/drivers/net/wireless/iwlegacy/iwl-commands.h
index 55822da..1a6ca36 100644
--- a/drivers/net/wireless/iwlegacy/iwl-commands.h
+++ b/drivers/net/wireless/iwlegacy/iwl-commands.h
@@ -136,8 +136,8 @@ enum {
REPLY_BT_CONFIG = 0x9b,

/* Statistics */
- REPLY_STATISTICS_CMD = 0x9c,
- STATISTICS_NOTIFICATION = 0x9d,
+ REPLY_STATS_CMD = 0x9c,
+ STATS_NOTIFICATION = 0x9d,

/* RF-KILL commands and notifications */
CARD_STATE_NOTIFICATION = 0xa1,
@@ -2626,7 +2626,7 @@ struct il_scanstart_notification {
#define IL_PROBE_STATUS_FAIL_TTL BIT(1)
#define IL_PROBE_STATUS_FAIL_BT BIT(2)

-#define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
+#define NUMBER_OF_STATS 1 /* first __le32 is good CRC */
/*
* SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
*/
@@ -2637,7 +2637,7 @@ struct il_scanresults_notification {
u8 num_probe_not_sent; /* not enough time to send */
__le32 tsf_low;
__le32 tsf_high;
- __le32 stats[NUMBER_OF_STATISTICS];
+ __le32 stats[NUMBER_OF_STATS];
} __packed;

/*
@@ -2958,24 +2958,24 @@ struct stats_general {
__le32 reserved3;
} __packed;

-#define UCODE_STATISTICS_CLEAR_MSK (0x1 << 0)
-#define UCODE_STATISTICS_FREQUENCY_MSK (0x1 << 1)
-#define UCODE_STATISTICS_NARROW_BAND_MSK (0x1 << 2)
+#define UCODE_STATS_CLEAR_MSK (0x1 << 0)
+#define UCODE_STATS_FREQUENCY_MSK (0x1 << 1)
+#define UCODE_STATS_NARROW_BAND_MSK (0x1 << 2)

/*
- * REPLY_STATISTICS_CMD = 0x9c,
+ * REPLY_STATS_CMD = 0x9c,
* all devices identical.
*
* This command triggers an immediate response containing uCode stats.
- * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
+ * The response is in the same format as STATS_NOTIFICATION 0x9d, below.
*
* If the CLEAR_STATS configuration flag is set, uCode will clear its
* internal copy of the stats (counters) after issuing the response.
- * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
+ * This flag does not affect STATS_NOTIFICATIONs after beacons (see below).
*
* If the DISABLE_NOTIF configuration flag is set, uCode will not issue
- * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag
- * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
+ * STATS_NOTIFICATIONs after received beacons (see below). This flag
+ * does not affect the response to the REPLY_STATS_CMD 0x9c itself.
*/
#define IL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */
#define IL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */
@@ -2984,22 +2984,22 @@ struct il_stats_cmd {
} __packed;

/*
- * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
+ * STATS_NOTIFICATION = 0x9d (notification only, not a command)
*
* By default, uCode issues this notification after receiving a beacon
* while associated. To disable this behavior, set DISABLE_NOTIF flag in the
- * REPLY_STATISTICS_CMD 0x9c, above.
+ * REPLY_STATS_CMD 0x9c, above.
*
* Statistics counters continue to increment beacon after beacon, but are
- * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
+ * cleared when changing channels or when driver issues REPLY_STATS_CMD
* 0x9c with CLEAR_STATS bit set