Commit b4bf3430 authored by Jeff Garzik's avatar Jeff Garzik

/spare/repo/netdev-2.6 branch 'ieee80211'

parents 343b0597 099c5bb1
......@@ -164,7 +164,7 @@ config IPW2100
say M here and read <file:Documentation/modules.txt>. The module
will be called ipw2100.ko.
config IPW2100_PROMISC
config IPW2100_MONITOR
bool "Enable promiscuous mode"
depends on IPW2100
---help---
......
......@@ -867,7 +867,7 @@ static int start_tx (struct sk_buff *skb, struct net_device *dev)
header.duration_id = 0;
header.seq_ctl = 0;
if (priv->wep_is_on)
frame_ctl |= IEEE80211_FCTL_WEP;
frame_ctl |= IEEE80211_FCTL_PROTECTED;
if (priv->operating_mode == IW_MODE_ADHOC) {
memcpy(&header.addr1, skb->data, 6);
memcpy(&header.addr2, dev->dev_addr, 6);
......@@ -1117,7 +1117,7 @@ static void rx_done_irq(struct atmel_private *priv)
/* probe for CRC use here if needed once five packets have arrived with
the same crc status, we assume we know what's happening and stop probing */
if (priv->probe_crc) {
if (!priv->wep_is_on || !(frame_ctl & IEEE80211_FCTL_WEP)) {
if (!priv->wep_is_on || !(frame_ctl & IEEE80211_FCTL_PROTECTED)) {
priv->do_rx_crc = probe_crc(priv, rx_packet_loc, msdu_size);
} else {
priv->do_rx_crc = probe_crc(priv, rx_packet_loc + 24, msdu_size - 24);
......@@ -1132,7 +1132,7 @@ static void rx_done_irq(struct atmel_private *priv)
}
/* don't CRC header when WEP in use */
if (priv->do_rx_crc && (!priv->wep_is_on || !(frame_ctl & IEEE80211_FCTL_WEP))) {
if (priv->do_rx_crc && (!priv->wep_is_on || !(frame_ctl & IEEE80211_FCTL_PROTECTED))) {
crc = crc32_le(0xffffffff, (unsigned char *)&header, 24);
}
msdu_size -= 24; /* header */
......@@ -2677,7 +2677,7 @@ static void send_authentication_request(struct atmel_private *priv, u8 *challeng
auth.alg = cpu_to_le16(C80211_MGMT_AAN_SHAREDKEY);
/* no WEP for authentication frames with TrSeqNo 1 */
if (priv->CurrentAuthentTransactionSeqNum != 1)
header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_WEP);
header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
} else {
auth.alg = cpu_to_le16(C80211_MGMT_AAN_OPENSYSTEM);
}
......
......@@ -106,7 +106,7 @@ that protects the following:
tx_pend_list : Holds used Tx buffers waiting to go into the TBD ring
TAIL modified ipw2100_tx()
HEAD modified by X__ipw2100_tx_send_data()
HEAD modified by ipw2100_tx_send_data()
msg_free_list : Holds pre-allocated Msg (Command) buffers
TAIL modified in __ipw2100_tx_process()
......@@ -114,7 +114,7 @@ that protects the following:
msg_pend_list : Holds used Msg buffers waiting to go into the TBD ring
TAIL modified in ipw2100_hw_send_command()
HEAD modified in X__ipw2100_tx_send_commands()
HEAD modified in ipw2100_tx_send_commands()
The flow of data on the TX side is as follows:
......@@ -207,7 +207,20 @@ MODULE_PARM_DESC(channel, "channel");
MODULE_PARM_DESC(associate, "auto associate when scanning (default on)");
MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])");
u32 ipw2100_debug_level = IPW_DL_NONE;
static u32 ipw2100_debug_level = IPW_DL_NONE;
#ifdef CONFIG_IPW_DEBUG
#define IPW_DEBUG(level, message...) \
do { \
if (ipw2100_debug_level & (level)) { \
printk(KERN_DEBUG "ipw2100: %c %s ", \
in_interrupt() ? 'I' : 'U', __FUNCTION__); \
printk(message); \
} \
} while (0)
#else
#define IPW_DEBUG(level, message...) do {} while (0)
#endif /* CONFIG_IPW_DEBUG */
#ifdef CONFIG_IPW_DEBUG
static const char *command_types[] = {
......@@ -287,14 +300,30 @@ static const char *command_types[] = {
/* Pre-decl until we get the code solid and then we can clean it up */
static void X__ipw2100_tx_send_commands(struct ipw2100_priv *priv);
static void X__ipw2100_tx_send_data(struct ipw2100_priv *priv);
static void ipw2100_tx_send_commands(struct ipw2100_priv *priv);
static void ipw2100_tx_send_data(struct ipw2100_priv *priv);
static int ipw2100_adapter_setup(struct ipw2100_priv *priv);
static void ipw2100_queues_initialize(struct ipw2100_priv *priv);
static void ipw2100_queues_free(struct ipw2100_priv *priv);
static int ipw2100_queues_allocate(struct ipw2100_priv *priv);
static int ipw2100_fw_download(struct ipw2100_priv *priv,
struct ipw2100_fw *fw);
static int ipw2100_get_firmware(struct ipw2100_priv *priv,
struct ipw2100_fw *fw);
static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf,
size_t max);
static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf,
size_t max);
static void ipw2100_release_firmware(struct ipw2100_priv *priv,
struct ipw2100_fw *fw);
static int ipw2100_ucode_download(struct ipw2100_priv *priv,
struct ipw2100_fw *fw);
static void ipw2100_wx_event_work(struct ipw2100_priv *priv);
static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev);
static struct iw_handler_def ipw2100_wx_handler_def;
static inline void read_register(struct net_device *dev, u32 reg, u32 *val)
{
......@@ -473,8 +502,8 @@ static inline int ipw2100_hw_is_adapter_in_system(struct net_device *dev)
== IPW_DATA_DOA_DEBUG_VALUE));
}
int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord,
void *val, u32 *len)
static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord,
void *val, u32 *len)
{
struct ipw2100_ordinals *ordinals = &priv->ordinals;
u32 addr;
......@@ -484,7 +513,7 @@ int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord,
u32 total_length;
if (ordinals->table1_addr == 0) {
IPW_DEBUG_WARNING(DRV_NAME ": attempt to use fw ordinals "
printk(KERN_WARNING DRV_NAME ": attempt to use fw ordinals "
"before they have been loaded.\n");
return -EINVAL;
}
......@@ -493,7 +522,7 @@ int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord,
if (*len < IPW_ORD_TAB_1_ENTRY_SIZE) {
*len = IPW_ORD_TAB_1_ENTRY_SIZE;
IPW_DEBUG_WARNING(DRV_NAME
printk(KERN_WARNING DRV_NAME
": ordinal buffer length too small, need %zd\n",
IPW_ORD_TAB_1_ENTRY_SIZE);
......@@ -546,7 +575,7 @@ int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord,
return 0;
}
IPW_DEBUG_WARNING(DRV_NAME ": ordinal %d neither in table 1 nor "
printk(KERN_WARNING DRV_NAME ": ordinal %d neither in table 1 nor "
"in table 2\n", ord);
return -EINVAL;
......@@ -736,8 +765,8 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv,
list_add_tail(element, &priv->msg_pend_list);
INC_STAT(&priv->msg_pend_stat);
X__ipw2100_tx_send_commands(priv);
X__ipw2100_tx_send_data(priv);
ipw2100_tx_send_commands(priv);
ipw2100_tx_send_data(priv);
spin_unlock_irqrestore(&priv->low_lock, flags);
......@@ -761,7 +790,7 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv,
}
if (priv->fatal_error) {
IPW_DEBUG_WARNING("%s: firmware fatal error\n",
printk(KERN_WARNING DRV_NAME ": %s: firmware fatal error\n",
priv->net_dev->name);
return -EIO;
}
......@@ -999,7 +1028,7 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv)
/* load microcode */
err = ipw2100_ucode_download(priv, &ipw2100_firmware);
if (err) {
IPW_DEBUG_ERROR("%s: Error loading microcode: %d\n",
printk(KERN_ERR DRV_NAME ": %s: Error loading microcode: %d\n",
priv->net_dev->name, err);
goto fail;
}
......@@ -1012,7 +1041,7 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv)
/* s/w reset and clock stabilization (again!!!) */
err = sw_reset_and_clock(priv);
if (err) {
IPW_DEBUG_ERROR("%s: sw_reset_and_clock failed: %d\n",
printk(KERN_ERR DRV_NAME ": %s: sw_reset_and_clock failed: %d\n",
priv->net_dev->name, err);
goto fail;
}
......@@ -1206,7 +1235,7 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv)
* fw & dino ucode
*/
if (ipw2100_download_firmware(priv)) {
IPW_DEBUG_ERROR("%s: Failed to power on the adapter.\n",
printk(KERN_ERR DRV_NAME ": %s: Failed to power on the adapter.\n",
priv->net_dev->name);
return -EIO;
}
......@@ -1266,7 +1295,7 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv)
i ? "SUCCESS" : "FAILED");
if (!i) {
IPW_DEBUG_WARNING("%s: Firmware did not initialize.\n",
printk(KERN_WARNING DRV_NAME ": %s: Firmware did not initialize.\n",
priv->net_dev->name);
return -EIO;
}
......@@ -1462,7 +1491,7 @@ static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv)
err = ipw2100_hw_phy_off(priv);
if (err)
IPW_DEBUG_WARNING("Error disabling radio %d\n", err);
printk(KERN_WARNING DRV_NAME ": Error disabling radio %d\n", err);
/*
* If in D0-standby mode going directly to D3 may cause a
......@@ -1488,7 +1517,7 @@ static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv)
err = ipw2100_hw_send_command(priv, &cmd);
if (err)
IPW_DEBUG_WARNING(
printk(KERN_WARNING DRV_NAME ": "
"%s: Power down command failed: Error %d\n",
priv->net_dev->name, err);
else {
......@@ -1529,7 +1558,7 @@ static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv)
}
if (i == 0)
IPW_DEBUG_WARNING(DRV_NAME
printk(KERN_WARNING DRV_NAME
": %s: Could now power down adapter.\n",
priv->net_dev->name);
......@@ -1569,13 +1598,13 @@ static int ipw2100_disable_adapter(struct ipw2100_priv *priv)
err = ipw2100_hw_send_command(priv, &cmd);
if (err) {
IPW_DEBUG_WARNING("exit - failed to send CARD_DISABLE command\n");
printk(KERN_WARNING DRV_NAME ": exit - failed to send CARD_DISABLE command\n");
goto fail_up;
}
err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_DISABLED);
if (err) {
IPW_DEBUG_WARNING("exit - card failed to change to DISABLED\n");
printk(KERN_WARNING DRV_NAME ": exit - card failed to change to DISABLED\n");
goto fail_up;
}
......@@ -1586,7 +1615,7 @@ fail_up:
return err;
}
int ipw2100_set_scan_options(struct ipw2100_priv *priv)
static int ipw2100_set_scan_options(struct ipw2100_priv *priv)
{
struct host_command cmd = {
.host_command = SET_SCAN_OPTIONS,
......@@ -1618,7 +1647,7 @@ int ipw2100_set_scan_options(struct ipw2100_priv *priv)
return err;
}
int ipw2100_start_scan(struct ipw2100_priv *priv)
static int ipw2100_start_scan(struct ipw2100_priv *priv)
{
struct host_command cmd = {
.host_command = BROADCAST_SCAN,
......@@ -1685,7 +1714,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
(priv->status & STATUS_RESET_PENDING)) {
/* Power cycle the card ... */
if (ipw2100_power_cycle_adapter(priv)) {
IPW_DEBUG_WARNING("%s: Could not cycle adapter.\n",
printk(KERN_WARNING DRV_NAME ": %s: Could not cycle adapter.\n",
priv->net_dev->name);
rc = 1;
goto exit;
......@@ -1695,7 +1724,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
/* Load the firmware, start the clocks, etc. */
if (ipw2100_start_adapter(priv)) {
IPW_DEBUG_ERROR("%s: Failed to start the firmware.\n",
printk(KERN_ERR DRV_NAME ": %s: Failed to start the firmware.\n",
priv->net_dev->name);
rc = 1;
goto exit;
......@@ -1705,7 +1734,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
/* Determine capabilities of this particular HW configuration */
if (ipw2100_get_hw_features(priv)) {
IPW_DEBUG_ERROR("%s: Failed to determine HW features.\n",
printk(KERN_ERR DRV_NAME ": %s: Failed to determine HW features.\n",
priv->net_dev->name);
rc = 1;
goto exit;
......@@ -1713,7 +1742,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
lock = LOCK_NONE;
if (ipw2100_set_ordinal(priv, IPW_ORD_PERS_DB_LOCK, &lock, &ord_len)) {
IPW_DEBUG_ERROR("%s: Failed to clear ordinal lock.\n",
printk(KERN_ERR DRV_NAME ": %s: Failed to clear ordinal lock.\n",
priv->net_dev->name);
rc = 1;
goto exit;
......@@ -1739,7 +1768,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
/* Send all of the commands that must be sent prior to
* HOST_COMPLETE */
if (ipw2100_adapter_setup(priv)) {
IPW_DEBUG_ERROR("%s: Failed to start the card.\n",
printk(KERN_ERR DRV_NAME ": %s: Failed to start the card.\n",
priv->net_dev->name);
rc = 1;
goto exit;
......@@ -1748,7 +1777,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
if (!deferred) {
/* Enable the adapter - sends HOST_COMPLETE */
if (ipw2100_enable_adapter(priv)) {
IPW_DEBUG_ERROR(
printk(KERN_ERR DRV_NAME ": "
"%s: failed in call to enable adapter.\n",
priv->net_dev->name);
ipw2100_hw_stop_adapter(priv);
......@@ -1806,7 +1835,7 @@ static void ipw2100_down(struct ipw2100_priv *priv)
spin_unlock_irqrestore(&priv->low_lock, flags);
if (ipw2100_hw_stop_adapter(priv))
IPW_DEBUG_ERROR("%s: Error stopping adapter.\n",
printk(KERN_ERR DRV_NAME ": %s: Error stopping adapter.\n",
priv->net_dev->name);
/* Do not disable the interrupt until _after_ we disable
......@@ -1833,7 +1862,7 @@ static void ipw2100_down(struct ipw2100_priv *priv)
netif_stop_queue(priv->net_dev);
}
void ipw2100_reset_adapter(struct ipw2100_priv *priv)
static void ipw2100_reset_adapter(struct ipw2100_priv *priv)
{
unsigned long flags;
union iwreq_data wrqu = {
......@@ -1963,8 +1992,8 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)
}
int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid,
int length, int batch_mode)
static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid,
int length, int batch_mode)
{
int ssid_len = min(length, IW_ESSID_MAX_SIZE);
struct host_command cmd = {
......@@ -2095,7 +2124,7 @@ static void isr_indicate_scanning(struct ipw2100_priv *priv, u32 status)
priv->status |= STATUS_SCANNING;
}
const struct ipw2100_status_indicator status_handlers[] = {
static const struct ipw2100_status_indicator status_handlers[] = {
IPW2100_HANDLER(IPW_STATE_INITIALIZED, 0),
IPW2100_HANDLER(IPW_STATE_COUNTRY_FOUND, 0),
IPW2100_HANDLER(IPW_STATE_ASSOCIATED, isr_indicate_associated),
......@@ -2163,7 +2192,7 @@ static void isr_rx_complete_command(
}
#ifdef CONFIG_IPW_DEBUG
const char *frame_types[] = {
static const char *frame_types[] = {
"COMMAND_STATUS_VAL",
"STATUS_CHANGE_VAL",
"P80211_DATA_VAL",
......@@ -2283,7 +2312,7 @@ static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 *in_buf,
*
*/
#ifdef CONFIG_IPW2100_RX_DEBUG
u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH];
static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH];
#endif
static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv,
......@@ -2413,7 +2442,7 @@ static inline void isr_rx(struct ipw2100_priv *priv, int i,
/* We need to allocate a new SKB and attach it to the RDB. */
if (unlikely(ipw2100_alloc_skb(priv, packet))) {
IPW_DEBUG_WARNING(
printk(KERN_WARNING DRV_NAME ": "
"%s: Unable to allocate SKB onto RBD ring - disabling "
"adapter.\n", priv->net_dev->name);
/* TODO: schedule adapter shutdown */
......@@ -2675,7 +2704,7 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
break;
default:
IPW_DEBUG_WARNING("%s: Bad fw_pend_list entry!\n",
printk(KERN_WARNING DRV_NAME ": %s: Bad fw_pend_list entry!\n",
priv->net_dev->name);
return 0;
}
......@@ -2689,7 +2718,7 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
read_register(priv->net_dev, IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX,
&w);
if (w != txq->next)
IPW_DEBUG_WARNING("%s: write index mismatch\n",
printk(KERN_WARNING DRV_NAME ": %s: write index mismatch\n",
priv->net_dev->name);
/*
......@@ -2750,7 +2779,7 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
switch (packet->type) {
case DATA:
if (txq->drv[txq->oldest].status.info.fields.txType != 0)
IPW_DEBUG_WARNING("%s: Queue mismatch. "
printk(KERN_WARNING DRV_NAME ": %s: Queue mismatch. "
"Expecting DATA TBD but pulled "
"something else: ids %d=%d.\n",
priv->net_dev->name, txq->oldest, packet->index);
......@@ -2797,7 +2826,7 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
case COMMAND:
if (txq->drv[txq->oldest].status.info.fields.txType != 1)
IPW_DEBUG_WARNING("%s: Queue mismatch. "
printk(KERN_WARNING DRV_NAME ": %s: Queue mismatch. "
"Expecting COMMAND TBD but pulled "
"something else: ids %d=%d.\n",
priv->net_dev->name, txq->oldest, packet->index);
......@@ -2837,14 +2866,14 @@ static inline void __ipw2100_tx_complete(struct ipw2100_priv *priv)
while (__ipw2100_tx_process(priv) && i < 200) i++;
if (i == 200) {
IPW_DEBUG_WARNING(
printk(KERN_WARNING DRV_NAME ": "
"%s: Driver is running slow (%d iters).\n",
priv->net_dev->name, i);
}
}
static void X__ipw2100_tx_send_commands(struct ipw2100_priv *priv)
static void ipw2100_tx_send_commands(struct ipw2100_priv *priv)
{
struct list_head *element;
struct ipw2100_tx_packet *packet;
......@@ -2912,10 +2941,10 @@ static void X__ipw2100_tx_send_commands(struct ipw2100_priv *priv)
/*
* X__ipw2100_tx_send_data
* ipw2100_tx_send_data
*
*/
static void X__ipw2100_tx_send_data(struct ipw2100_priv *priv)
static void ipw2100_tx_send_data(struct ipw2100_priv *priv)
{
struct list_head *element;
struct ipw2100_tx_packet *packet;
......@@ -3081,7 +3110,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv)
(unsigned long)inta & IPW_INTERRUPT_MASK);
if (inta & IPW2100_INTA_FATAL_ERROR) {
IPW_DEBUG_WARNING(DRV_NAME
printk(KERN_WARNING DRV_NAME
": Fatal interrupt. Scheduling firmware restart.\n");
priv->inta_other++;
write_register(
......@@ -3101,7 +3130,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv)
}
if (inta & IPW2100_INTA_PARITY_ERROR) {
IPW_DEBUG_ERROR("***** PARITY ERROR INTERRUPT !!!! \n");
printk(KERN_ERR DRV_NAME ": ***** PARITY ERROR INTERRUPT !!!! \n");
priv->inta_other++;
write_register(
dev, IPW_REG_INTA,
......@@ -3130,8 +3159,8 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv)
IPW2100_INTA_TX_TRANSFER);
__ipw2100_tx_complete(priv);
X__ipw2100_tx_send_commands(priv);
X__ipw2100_tx_send_data(priv);
ipw2100_tx_send_commands(priv);
ipw2100_tx_send_data(priv);
}
if (inta & IPW2100_INTA_TX_COMPLETE) {
......@@ -3219,7 +3248,7 @@ static irqreturn_t ipw2100_interrupt(int irq, void *data,
if (inta == 0xFFFFFFFF) {
/* Hardware disappeared */
IPW_DEBUG_WARNING("IRQ INTA == 0xFFFFFFFF\n");
printk(KERN_WARNING DRV_NAME ": IRQ INTA == 0xFFFFFFFF\n");
goto none;
}
......@@ -3282,7 +3311,7 @@ static int ipw2100_tx(struct ieee80211_txb *txb, struct net_device *dev)
list_add_tail(element, &priv->tx_pend_list);
INC_STAT(&priv->tx_pend_stat);
X__ipw2100_tx_send_data(priv);
ipw2100_tx_send_data(priv);
spin_unlock_irqrestore(&priv->low_lock, flags);
return 0;
......@@ -3304,7 +3333,7 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv)
IPW_COMMAND_POOL_SIZE * sizeof(struct ipw2100_tx_packet),
GFP_KERNEL);
if (!priv->msg_buffers) {
IPW_DEBUG_ERROR("%s: PCI alloc failed for msg "
printk(KERN_ERR DRV_NAME ": %s: PCI alloc failed for msg "
"buffers.\n", priv->net_dev->name);
return -ENOMEM;
}
......@@ -3315,7 +3344,7 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv)
sizeof(struct ipw2100_cmd_header),
&p);
if (!v) {
IPW_DEBUG_ERROR(
printk(KERN_ERR DRV_NAME ": "
"%s: PCI alloc failed for msg "
"buffers.\n",
priv->net_dev->name);
......@@ -3427,7 +3456,7 @@ static DEVICE_ATTR(capability, S_IRUGO, show_capability, NULL);
#define IPW2100_REG(x) { IPW_ ##x, #x }
const struct {
static const struct {
u32 addr;
const char *name;
} hw_data[] = {
......@@ -3438,7 +3467,7 @@ const struct {
IPW2100_REG(REG_RESET_REG),
};
#define IPW2100_NIC(x, s) { x, #x, s }
const struct {
static const struct {
u32 addr;
const char *name;
size_t size;
......@@ -3448,7 +3477,7 @@ const struct {
IPW2100_NIC(0x210000, 1),
};
#define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d }
const struct {
static const struct {
u8 index;
const char *name;
const char *desc;
......@@ -3813,7 +3842,7 @@ static ssize_t show_stats(struct device *d, struct device_attribute *attr,
static DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL);
int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode)
static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode)
{
int err;
......@@ -3822,7 +3851,7 @@ int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode)
err = ipw2100_disable_adapter(priv);
if (err) {
IPW_DEBUG_ERROR("%s: Could not disable adapter %d\n",
printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n",
priv->net_dev->name, err);
return err;
}
......@@ -4268,7 +4297,7 @@ static int ipw2100_tx_allocate(struct ipw2100_priv *priv)
TX_PENDED_QUEUE_LENGTH * sizeof(struct ipw2100_tx_packet),
GFP_ATOMIC);
if (!priv->tx_buffers) {
IPW_DEBUG_ERROR("%s: alloc failed form tx buffers.\n",
printk(KERN_ERR DRV_NAME ": %s: alloc failed form tx buffers.\n",
priv->net_dev->name);
bd_queue_free(priv, &priv->tx_queue);
return -ENOMEM;
......@@ -4278,7 +4307,7 @@ static int ipw2100_tx_allocate(struct ipw2100_priv *priv)
v = pci_alloc_consistent(
priv->pci_dev, sizeof(struct ipw2100_data_header), &p);
if (!v) {
IPW_DEBUG_ERROR("%s: PCI alloc failed for tx "
printk(KERN_ERR DRV_NAME ": %s: PCI alloc failed for tx "
"buffers.\n", priv->net_dev->name);
err = -ENOMEM;
break;
......@@ -4537,7 +4566,7 @@ static int ipw2100_read_mac_address(struct ipw2100_priv *priv)
*
********************************************************************/
int ipw2100_set_mac_address(struct ipw2100_priv *priv, int batch_mode)
static int ipw2100_set_mac_address(struct ipw2100_priv *priv, int batch_mode)
{
struct host_command cmd = {
.host_command = ADAPTER_ADDRESS,
......@@ -4564,7 +4593,7 @@ int ipw2100_set_mac_address(struct ipw2100_priv *priv, int batch_mode)
return err;
}
int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type,
static int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type,
int batch_mode)
{
struct host_command cmd = {
......@@ -4589,7 +4618,7 @@ int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type,
if (!batch_mode) {
err = ipw2100_disable_adapter(priv);
if (err) {
IPW_DEBUG_ERROR("%s: Could not disable adapter %d\n",
printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n",
priv->net_dev->name, err);
return err;
}
......@@ -4605,7 +4634,8 @@ int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type,
}
int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel, int batch_mode)
static int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel,
int batch_mode)
{
struct host_command cmd = {
.host_command = CHANNEL,
......@@ -4655,7 +4685,7 @@ int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel, int batch_mode)
return 0;
}
int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode)
static int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode)
{
struct host_command cmd = {
.host_command = SYSTEM_CONFIG,
......@@ -4717,7 +4747,8 @@ int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode)
return 0;
}
int ipw2100_set_tx_rates(struct ipw2100_priv *priv, u32 rate, int batch_mode)
static int ipw2100_set_tx_rates(struct ipw2100_priv *priv, u32 rate,
int batch_mode)
{
struct host_command cmd = {
.host_command = BASIC_TX_RATES,
......@@ -4756,8 +4787,8 @@ int ipw2100_set_tx_rates(struct ipw2100_priv *priv, u32 rate, int batch_mode)
return 0;
}
int ipw2100_set_power_mode(struct ipw2100_priv *priv,
int power_level)
static int ipw2100_set_power_mode(struct ipw2100_priv *priv,
int power_level)
{
struct host_command cmd = {
.host_command = POWER_MODE,
......@@ -4794,7 +4825,7 @@ int ipw2100_set_power_mode(struct ipw2100_priv *priv,
}
int ipw2100_set_rts_threshold(struct ipw2100_priv *priv, u32 threshold)
static int ipw2100_set_rts_threshold(struct ipw2100_priv *priv, u32 threshold)
{
struct host_command cmd = {
.host_command = RTS_THRESHOLD,
......@@ -4858,7 +4889,7 @@ int ipw2100_set_fragmentation_threshold(struct ipw2100_priv *priv,
}
#endif
int ipw2100_set_short_retry(struct ipw2100_priv *priv, u32 retry)
static int ipw2100_set_short_retry(struct ipw2100_priv *priv, u32 retry)
{
struct host_command cmd = {
.host_command = SHORT_RETRY_LIMIT,
......@@ -4878,7 +4909,7 @@ int ipw2100_set_short_retry(struct ipw2100_priv *priv, u32 retry)
return 0;
}
int ipw2100_set_long_retry(struct ipw2100_priv *priv, u32 retry)
static int ipw2100_set_long_retry(struct ipw2100_priv *priv, u32 retry)
{
struct host_command cmd = {
.host_command = LONG_RETRY_LIMIT,
......@@ -4899,8 +4930,8 @@ int ipw2100_set_long_retry(struct ipw2100_priv *priv, u32 retry)
}
int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 *bssid,
int batch_mode)
static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 *bssid,
int batch_mode)
{
struct host_command cmd = {
.host_command = MANDATORY_BSSID,
......@@ -5037,11 +5068,11 @@ struct security_info_params {
u8 unicast_using_group;
} __attribute__ ((packed));
int ipw2100_set_security_information(struct ipw2100_priv *priv,
int auth_mode,
int security_level,
int unicast_using_group,
int batch_mode)
static int ipw2100_set_security_information(struct ipw2100_priv *priv,
int auth_mode,
int security_level,
int unicast_using_group,
int batch_mode)
{
struct host_command cmd = {
.host_command = SET_SECURITY_INFORMATION,
......@@ -5103,8 +5134,8 @@ int ipw2100_set_security_information(struct ipw2100_priv *priv,
return err;
}
int ipw2100_set_tx_power(struct ipw2100_priv *priv,
u32 tx_power)
static int ipw2100_set_tx_power(struct ipw2100_priv *priv,
u32 tx_power)
{
struct host_command cmd = {
.host_command = TX_POWER_INDEX,
......@@ -5123,8 +5154,8 @@ int ipw2100_set_tx_power(struct ipw2100_priv *priv,
return 0;
}
int ipw2100_set_ibss_beacon_interval(struct ipw2100_priv *priv,
u32 interval, int batch_mode)
static int ipw2100_set_ibss_beacon_interval(struct ipw2100_priv *priv,
u32 interval, int batch_mode)
{
struct host_command cmd = {
.host_command = BEACON_INTERVAL,
......@@ -5208,7 +5239,7 @@ static int ipw2100_set_wep_flags(struct ipw2100_priv *priv, u32 flags,
if (!batch_mode) {
err = ipw2100_disable_adapter(priv);
if (err) {
IPW_DEBUG_ERROR("%s: Could not disable adapter %d\n",
printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n",
priv->net_dev->name, err);
return err;
}
......@@ -5296,7 +5327,7 @@ static int ipw2100_set_key(struct ipw2100_priv *priv,
err = ipw2100_disable_adapter(priv);
/* FIXME: IPG: shouldn't this prink be in _disable_adapter()? */
if (err) {
IPW_DEBUG_ERROR("%s: Could not disable adapter %d\n",
printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n",
priv->net_dev->name, err);
return err;
}
......@@ -5332,7 +5363,7 @@ static int ipw2100_set_key_index(struct ipw2100_priv *priv,
if (!batch_mode) {
err = ipw2100_disable_adapter(priv);
if (err) {
IPW_DEBUG_ERROR("%s: Could not disable adapter %d\n",
printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n",
priv->net_dev->name, err);
return err;
}
......@@ -5654,8 +5685,10 @@ static int ipw2100_open(struct net_device *dev)
IPW_DEBUG_INFO("dev->open\n");
spin_lock_irqsave(&priv->low_lock, flags);
if (priv->status & STATUS_ASSOCIATED)
if (priv->status & STATUS_ASSOCIATED) {
netif_carrier_on(dev);
netif_start_queue(dev);
}
spin_unlock_irqrestore(&priv->low_lock, flags);
return 0;
......@@ -5880,7 +5913,7 @@ static int ipw2100_wpa_set_param(struct net_device *dev, u8 name, u32 value){
break;
default:
IPW_DEBUG_ERROR("%s: Unknown WPA param: %d\n",
printk(KERN_ERR DRV_NAME ": %s: Unknown WPA param: %d\n",
dev->name, name);
ret = -EOPNOTSUPP;
}
......@@ -5903,7 +5936,7 @@ static int ipw2100_wpa_mlme(struct net_device *dev, int command, int reason){
break;
default:
IPW_DEBUG_ERROR("%s: Unknown MLME request: %d\n",
printk(KERN_ERR DRV_NAME ": %s: Unknown MLME request: %d\n",
dev->name, command);
ret = -EOPNOTSUPP;
}
......@@ -6153,7 +6186,7 @@ static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){
break;
default:
IPW_DEBUG_ERROR("%s: Unknown WPA supplicant request: %d\n",
printk(KERN_ERR DRV_NAME ": %s: Unknown WPA supplicant request: %d\n",
dev->name, param->cmd);
ret = -EOPNOTSUPP;
......@@ -6883,7 +6916,7 @@ module_exit(ipw2100_exit);
#define WEXT_USECHANNELS 1
const long ipw2100_frequencies[] = {
static const long ipw2100_frequencies[] = {
2412, 2417, 2422, 2427,
2432, 2437, 2442, 2447,
2452, 2457, 2462, 2467,
......@@ -6893,7 +6926,7 @@ const long ipw2100_frequencies[] = {
#define FREQ_COUNT (sizeof(ipw2100_frequencies) / \
sizeof(ipw2100_frequencies[0]))
const long ipw2100_rates_11b[] = {
static const long ipw2100_rates_11b[] = {
1000000,
2000000,
5500000,
......@@ -7052,7 +7085,7 @@ static int ipw2100_wx_get_mode(struct net_device *dev,
#define POWER_MODES 5
/* Values are in microsecond */
const s32 timeout_duration[POWER_MODES] = {
static const s32 timeout_duration[POWER_MODES] = {
350000,
250000,
75000,
......@@ -7060,7 +7093,7 @@ const s32 timeout_duration[POWER_MODES] = {
25000,
};
const s32 period_duration[POWER_MODES] = {
static const s32 period_duration[POWER_MODES] = {
400000,
700000,
1000000,
......@@ -8125,7 +8158,7 @@ static iw_handler ipw2100_private_handler[] = {
ipw2100_wx_get_preamble,
};
struct iw_handler_def ipw2100_wx_handler_def =
static struct iw_handler_def ipw2100_wx_handler_def =
{
.standard = ipw2100_wx_handlers,
.num_standard = sizeof(ipw2100_wx_handlers) / sizeof(iw_handler),
......@@ -8141,7 +8174,7 @@ struct iw_handler_def ipw2100_wx_handler_def =
* Called by /proc/net/wireless
* Also called by SIOCGIWSTATS
*/
struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev)
static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev)
{
enum {
POOR = 30,
......@@ -8277,7 +8310,7 @@ struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev)
return (struct iw_statistics *) NULL;
}
void ipw2100_wx_event_work(struct ipw2100_priv *priv)
static void ipw2100_wx_event_work(struct ipw2100_priv *priv)
{
union iwreq_data wrqu;
int len = ETH_ALEN;
......@@ -8375,7 +8408,7 @@ static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw)
(struct ipw2100_fw_header *)fw->fw_entry->data;
if (IPW2100_FW_MAJOR(h->version) != IPW2100_FW_MAJOR_VERSION) {
IPW_DEBUG_WARNING("Firmware image not compatible "
printk(KERN_WARNING DRV_NAME ": Firmware image not compatible "
"(detected version id of %u). "
"See Documentation/networking/README.ipw2100\n",
h->version);
......@@ -8392,7 +8425,8 @@ static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw)
}
int ipw2100_get_firmware(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
static int ipw2100_get_firmware(struct ipw2100_priv *priv,
struct ipw2100_fw *fw)
{
char *fw_name;
int rc;
......@@ -8418,7 +8452,7 @@ int ipw2100_get_firmware(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
rc = request_firmware(&fw->fw_entry, fw_name, &priv->pci_dev->dev);
if (rc < 0) {
IPW_DEBUG_ERROR(
printk(KERN_ERR DRV_NAME ": "
"%s: Firmware '%s' not available or load failed.\n",
priv->net_dev->name, fw_name);
return rc;
......@@ -8431,8 +8465,8 @@ int ipw2100_get_firmware(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
return 0;
}
void ipw2100_release_firmware(struct ipw2100_priv *priv,
struct ipw2100_fw *fw)
static void ipw2100_release_firmware(struct ipw2100_priv *priv,
struct ipw2100_fw *fw)
{
fw->version = 0;
if (fw->fw_entry)
......@@ -8441,7 +8475,8 @@ void ipw2100_release_firmware(struct ipw2100_priv *priv,
}
int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, size_t max)
static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf,
size_t max)
{
char ver[MAX_FW_VERSION_LEN];
u32 len = MAX_FW_VERSION_LEN;
......@@ -8460,7 +8495,8 @@ int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, size_t max)
return tmp;
}
int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, size_t max)
static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf,
size_t max)
{
u32 ver;
u32 len = sizeof(ver);
......@@ -8474,7 +8510,8 @@ int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, size_t max)
/*
* On exit, the firmware will have been freed from the fw list
*/
int ipw2100_fw_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
static int ipw2100_fw_download(struct ipw2100_priv *priv,
struct ipw2100_fw *fw)
{
/* firmware is constructed of N contiguous entries, each entry is
* structured as:
......@@ -8500,7 +8537,7 @@ int ipw2100_fw_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
firmware_data_left -= 2;
if (len > 32) {
IPW_DEBUG_ERROR(
printk(KERN_ERR DRV_NAME ": "
"Invalid firmware run-length of %d bytes\n",
len);
return -EINVAL;
......@@ -8531,7 +8568,8 @@ struct symbol_alive_response {
u8 ucode_valid;
};
int ipw2100_ucode_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
static int ipw2100_ucode_download(struct ipw2100_priv *priv,
struct ipw2100_fw *fw)
{
struct net_device *dev = priv->net_dev;
const unsigned char *microcode_data = fw->uc.data;
......@@ -8610,7 +8648,7 @@ int ipw2100_ucode_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
}
if (i == 10) {
IPW_DEBUG_ERROR("%s: Error initializing Symbol\n",
printk(KERN_ERR DRV_NAME ": %s: Error initializing Symbol\n",
dev->name);
return -EIO;
}
......@@ -8631,7 +8669,7 @@ int ipw2100_ucode_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
}
if (i == 30) {
IPW_DEBUG_ERROR("%s: No response from Symbol - hw not alive\n",
printk(KERN_ERR DRV_NAME ": %s: No response from Symbol - hw not alive\n",
dev->name);
printk_buf(IPW_DL_ERROR, (u8*)&response, sizeof(response));
return -EIO;
......
......@@ -48,22 +48,6 @@ struct ipw2100_priv;
struct ipw2100_tx_packet;
struct ipw2100_rx_packet;
#ifdef CONFIG_IPW_DEBUG
enum { IPW_DEBUG_ENABLED = 1 };
extern u32 ipw2100_debug_level;
#define IPW_DEBUG(level, message...) \
do { \
if (ipw2100_debug_level & (level)) { \
printk(KERN_DEBUG "ipw2100: %c %s ", \
in_interrupt() ? 'I' : 'U', __FUNCTION__); \
printk(message); \
} \
} while (0)
#else
enum { IPW_DEBUG_ENABLED = 0 };
#define IPW_DEBUG(level, message...) do {} while (0)
#endif /* CONFIG_IPW_DEBUG */
#define IPW_DL_UNINIT 0x80000000
#define IPW_DL_NONE 0x00000000
#define IPW_DL_ALL 0x7FFFFFFF
......@@ -1144,10 +1128,6 @@ typedef enum _ORDINAL_TABLE_2 { // NS - means Not Supported by FW
#define WIRELESS_SPY // enable iwspy support
#endif
extern struct iw_handler_def ipw2100_wx_handler_def;
extern struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev);
extern void ipw2100_wx_event_work(struct ipw2100_priv *priv);
#define IPW_HOST_FW_SHARED_AREA0 0x0002f200
#define IPW_HOST_FW_SHARED_AREA0_END 0x0002f510 // 0x310 bytes
......@@ -1182,14 +1162,6 @@ struct ipw2100_fw {
const struct firmware *fw_entry;
};
int ipw2100_get_firmware(struct ipw2100_priv *priv, struct ipw2100_fw *fw);
void ipw2100_release_firmware(struct ipw2100_priv *priv, struct ipw2100_fw *fw);
int ipw2100_fw_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw);
int ipw2100_ucode_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw);
#define MAX_FW_VERSION_LEN 14
int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, size_t max);
int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, size_t max);
#endif /* _IPW2100_H */
......@@ -4485,7 +4485,7 @@ static void ipw_debug_config(struct ipw_priv *priv)
IPW_DEBUG_INFO("RATE MASK: 0x%08X\n", priv->rates_mask);
}
#else
#define ipw_debug_config(x) do {} while (0);
#define ipw_debug_config(x) do {} while (0)
#endif
static inline void ipw_set_fixed_rate(struct ipw_priv *priv,
......@@ -6617,11 +6617,7 @@ static int ipw_setup_deferred_work(struct ipw_priv *priv)
{
int ret = 0;
#ifdef CONFIG_SOFTWARE_SUSPEND2
priv->workqueue = create_workqueue(DRV_NAME, 0);
#else
priv->workqueue = create_workqueue(DRV_NAME);
#endif
init_waitqueue_head(&priv->wait_command_queue);
INIT_WORK(&priv->adhoc_check, ipw_adhoc_check, priv);
......@@ -7242,11 +7238,7 @@ static int ipw_pci_suspend(struct pci_dev *pdev, u32 state)
/* Remove the PRESENT state of the device */
netif_device_detach(dev);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
pci_save_state(pdev, priv->pm_state);
#else
pci_save_state(pdev);
#endif
pci_disable_device(pdev);
pci_set_power_state(pdev, state);
......
......@@ -53,26 +53,6 @@
#include <linux/workqueue.h>
#ifndef IRQ_NONE
typedef void irqreturn_t;
#define IRQ_NONE
#define IRQ_HANDLED
#define IRQ_RETVAL(x)
#endif
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) )
#define __iomem
#endif
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5) )
#define pci_dma_sync_single_for_cpu pci_dma_sync_single
#define pci_dma_sync_single_for_device pci_dma_sync_single
#endif
#ifndef HAVE_FREE_NETDEV
#define free_netdev(x) kfree(x)
#endif
/* Authentication and Association States */
enum connection_manager_assoc_states
{
......@@ -93,8 +73,6 @@ enum connection_manager_assoc_states
};
#define IPW_NORMAL 0
#define IPW_NOWAIT 0
#define IPW_WAIT (1<<0)
#define IPW_QUIET (1<<1)
#define IPW_ROAMING (1<<2)
......@@ -200,7 +178,7 @@ enum connection_manager_assoc_states
/* even if MAC WEP set (allows pre-encrypt) */
#define DCT_FLAG_NO_WEP 0x20
#define IPW_
/* overwrite TSF field */
#define DCT_FLAG_TSF_REQD 0x40
......@@ -533,12 +511,6 @@ struct notif_authenticate {
u16 status;
} __attribute__ ((packed));
struct temperature
{
s32 measured;
s32 active;
} __attribute__ ((packed));
struct notif_calibration {
u8 data[104];
} __attribute__ ((packed));
......
......@@ -47,22 +47,22 @@
#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
__le16 frame_ctl;
__le16 duration_id;
u8 addr1[ETH_ALEN];
u8 addr2[ETH_ALEN];
u8 addr3[ETH_ALEN];
u16 seq_ctl;
__le16 seq_ctl;
u8 addr4[ETH_ALEN];
} __attribute__ ((packed));
struct ieee80211_hdr_3addr {
u16 frame_ctl;
u16 duration_id;
__le16 frame_ctl;
__le16 duration_id;
u8 addr1[ETH_ALEN];
u8 addr2[ETH_ALEN];
u8 addr3[ETH_ALEN];
u16 seq_ctl;
__le16 seq_ctl;
} __attribute__ ((packed));
enum eap_type {
......@@ -88,10 +88,10 @@ static inline const char *eap_get_type(int type)
struct eapol {
u8 snap[6];
u16 ethertype;
__be16 ethertype;
u8 version;
u8 type;
u16 length;
__be16 length;
} __attribute__ ((packed));
#define IEEE80211_1ADDR_LEN 10
......@@ -112,8 +112,8 @@ struct eapol {
#define IEEE80211_FCTL_MOREFRAGS 0x0400
#define IEEE80211_FCTL_RETRY 0x0800
#define IEEE80211_FCTL_PM 0x1000
#define IEEE80211_FCTL_MOREDATA 0x2000
#define IEEE80211_FCTL_WEP 0x4000
#define IEEE80211_FCTL_MOREDATA 0x2000
#define IEEE80211_FCTL_PROTECTED 0x4000
#define IEEE80211_FCTL_ORDER 0x8000
#define IEEE80211_FTYPE_MGMT 0x0000
......@@ -132,6 +132,7 @@ struct eapol {
#define IEEE80211_STYPE_DISASSOC 0x00A0
#define IEEE80211_STYPE_AUTH 0x00B0
#define IEEE80211_STYPE_DEAUTH 0x00C0
#define IEEE80211_STYPE_ACTION 0x00D0
/* control */
#define IEEE80211_STYPE_PSPOLL 0x00A0
......@@ -167,8 +168,19 @@ do { if (ieee80211_debug_level & (level)) \
#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
#endif /* CONFIG_IEEE80211_DEBUG */
/* debug macros not dependent on CONFIG_IEEE80211_DEBUG */
#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
/* escape_essid() is intended to be used in debug (and possibly error)
* messages. It should never be used for passing essid to user space. */
const char *escape_essid(const char *essid, u8 essid_len);
/*
* To use the debug system;
* 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:
......@@ -223,9 +235,9 @@ do { if (ieee80211_debug_level & (level)) \
#include <linux/if_arp.h> /* ARPHRD_ETHER */
#ifndef WIRELESS_SPY
#define WIRELESS_SPY // enable iwspy support
#define WIRELESS_SPY /* enable iwspy support */
#endif
#include <net/iw_handler.h> // new driver API
#include <net/iw_handler.h> /* new driver API */
#ifndef ETH_P_PAE
#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
......@@ -252,6 +264,7 @@ struct ieee80211_snap_hdr {
#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
#define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS)
#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)
#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)
......@@ -272,34 +285,72 @@ struct ieee80211_snap_hdr {
#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
#define WLAN_CAPABILITY_PBCC (1<<6)
#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
#define WLAN_CAPABILITY_OSSS_OFDM (1<<13)
/* Status codes */
#define WLAN_STATUS_SUCCESS 0
#define WLAN_STATUS_UNSPECIFIED_FAILURE 1
#define WLAN_STATUS_CAPS_UNSUPPORTED 10
#define WLAN_STATUS_REASSOC_NO_ASSOC 11
#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
#define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
#define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
#define WLAN_STATUS_CHALLENGE_FAIL 15
#define WLAN_STATUS_AUTH_TIMEOUT 16
#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
#define WLAN_STATUS_ASSOC_DENIED_RATES 18
/* 802.11b */
#define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
#define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
#define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
enum ieee80211_statuscode {
WLAN_STATUS_SUCCESS = 0,
WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
WLAN_STATUS_CAPS_UNSUPPORTED = 10,
WLAN_STATUS_REASSOC_NO_ASSOC = 11,
WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
WLAN_STATUS_CHALLENGE_FAIL = 15,
WLAN_STATUS_AUTH_TIMEOUT = 16,
WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
WLAN_STATUS_ASSOC_DENIED_RATES = 18,
/* 802.11b */
WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
/* 802.11h */
WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
/* 802.11g */
WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
/* 802.11i */
WLAN_STATUS_INVALID_IE = 40,
WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
WLAN_STATUS_INVALID_AKMP = 43,
WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
};
/* Reason codes */
#define WLAN_REASON_UNSPECIFIED 1
#define WLAN_REASON_PREV_AUTH_NOT_VALID 2
#define WLAN_REASON_DEAUTH_LEAVING 3
#define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
#define WLAN_REASON_DISASSOC_AP_BUSY 5
#define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
#define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
#define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
#define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
enum ieee80211_reasoncode {
WLAN_REASON_UNSPECIFIED = 1,
WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
WLAN_REASON_DEAUTH_LEAVING = 3,
WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
WLAN_REASON_DISASSOC_AP_BUSY = 5,
WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
/* 802.11h */
WLAN_REASON_DISASSOC_BAD_POWER = 10,
WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
/* 802.11i */
WLAN_REASON_INVALID_IE = 13,
WLAN_REASON_MIC_FAILURE = 14,
WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
WLAN_REASON_IE_DIFFERENT = 17,
WLAN_REASON_INVALID_GROUP_CIPHER = 18,
WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
WLAN_REASON_INVALID_AKMP = 20,
WLAN_REASON_UNSUPP_RSN_VERSION = 21,
WLAN_REASON_INVALID_RSN_IE_CAP = 22,
WLAN_REASON_IEEE8021X_FAILED = 23,
WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
};
#define IEEE80211_STATMASK_SIGNAL (1<<0)
......@@ -478,17 +529,34 @@ Total: 28-2340 bytes
#define BEACON_PROBE_SSID_ID_POSITION 12
/* Management Frame Information Element Types */
#define MFIE_TYPE_SSID 0
#define MFIE_TYPE_RATES 1
#define MFIE_TYPE_FH_SET 2
#define MFIE_TYPE_DS_SET 3
#define MFIE_TYPE_CF_SET 4
#define MFIE_TYPE_TIM 5
#define MFIE_TYPE_IBSS_SET 6
#define MFIE_TYPE_CHALLENGE 16
#define MFIE_TYPE_RSN 48
#define MFIE_TYPE_RATES_EX 50
#define MFIE_TYPE_GENERIC 221
enum ieee80211_mfie {
MFIE_TYPE_SSID = 0,
MFIE_TYPE_RATES = 1,
MFIE_TYPE_FH_SET = 2,
MFIE_TYPE_DS_SET = 3,
MFIE_TYPE_CF_SET = 4,
MFIE_TYPE_TIM = 5,
MFIE_TYPE_IBSS_SET = 6,
MFIE_TYPE_COUNTRY = 7,
MFIE_TYPE_HOP_PARAMS = 8,
MFIE_TYPE_HOP_TABLE = 9,
MFIE_TYPE_REQUEST = 10,
MFIE_TYPE_CHALLENGE = 16,
MFIE_TYPE_POWER_CONSTRAINT = 32,
MFIE_TYPE_POWER_CAPABILITY = 33,
MFIE_TYPE_TPC_REQUEST = 34,
MFIE_TYPE_TPC_REPORT = 35,
MFIE_TYPE_SUPP_CHANNELS = 36,
MFIE_TYPE_CSA = 37,
MFIE_TYPE_MEASURE_REQUEST = 38,
MFIE_TYPE_MEASURE_REPORT = 39,
MFIE_TYPE_QUIET = 40,
MFIE_TYPE_IBSS_DFS = 41,
MFIE_TYPE_ERP_INFO = 42,
MFIE_TYPE_RSN = 48,
MFIE_TYPE_RATES_EX = 50,
MFIE_TYPE_GENERIC = 221,
};
struct ieee80211_info_element_hdr {
u8 id;
......@@ -520,9 +588,9 @@ struct ieee80211_info_element {
struct ieee80211_authentication {
struct ieee80211_hdr_3addr header;
u16 algorithm;
u16 transaction;
u16 status;
__le16 algorithm;
__le16 transaction;
__le16 status;
struct ieee80211_info_element info_element;
} __attribute__ ((packed));
......@@ -530,23 +598,23 @@ struct ieee80211_authentication {
struct ieee80211_probe_response {
struct ieee80211_hdr_3addr header;
u32 time_stamp[2];
u16 beacon_interval;
u16 capability;
__le16 beacon_interval;
__le16 capability;
struct ieee80211_info_element info_element;
} __attribute__ ((packed));
struct ieee80211_assoc_request_frame {
u16 capability;
u16 listen_interval;
__le16 capability;
__le16 listen_interval;
u8 current_ap[ETH_ALEN];
struct ieee80211_info_element info_element;
} __attribute__ ((packed));
struct ieee80211_assoc_response_frame {
struct ieee80211_hdr_3addr header;
u16 capability;
u16 status;
u16 aid;
__le16 capability;
__le16 status;
__le16 aid;
struct ieee80211_info_element info_element; /* supported rates */
} __attribute__ ((packed));
......@@ -561,7 +629,7 @@ struct ieee80211_txb {
};
/* SWEEP TABLE ENTRIES NUMBER*/
/* SWEEP TABLE ENTRIES NUMBER */
#define MAX_SWEEP_TAB_ENTRIES 42
#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
......@@ -622,8 +690,6 @@ enum ieee80211_state {
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
#define DEFAULT_FTS 2346
#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
#define CFG_IEEE80211_RESERVE_FCS (1<<0)
......@@ -791,8 +857,6 @@ extern struct net_device *alloc_ieee80211(int sizeof_priv);
extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
extern int ieee80211_xmit(struct sk_buff *skb,
struct net_device *dev);
extern void ieee80211_txb_free(struct ieee80211_txb *);
......@@ -805,7 +869,7 @@ extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* iee80211_wx.c */
/* ieee80211_wx.c */
extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
......@@ -827,27 +891,5 @@ extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
return ieee->scans;
}
static inline const char *escape_essid(const char *essid, u8 essid_len) {
static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
const char *s = essid;
char *d = escaped;
if (ieee80211_is_empty_essid(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE);
while (essid_len--) {
if (*s == '\0') {
*d++ = '\\';
*d++ = '0';
s++;
} else {
*d++ = *s++;
}
}
*d = '\0';
return escaped;
}
#endif /* IEEE80211_H */
......@@ -269,5 +269,31 @@ module_exit(ieee80211_exit);
module_init(ieee80211_init);
#endif
const char *escape_essid(const char *essid, u8 essid_len) {
static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
const char *s = essid;
char *d = escaped;
if (ieee80211_is_empty_essid(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE);
while (essid_len--) {
if (*s == '\0') {
*d++ = '\\';
*d++ = '0';
s++;
} else {
*d++ = *s++;
}
}
*d = '\0';
return escaped;
}
EXPORT_SYMBOL(alloc_ieee80211);
EXPORT_SYMBOL(free_ieee80211);
EXPORT_SYMBOL(escape_essid);
......@@ -439,7 +439,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
crypt->ops->decrypt_mpdu == NULL))
crypt = NULL;
if (!crypt && (fc & IEEE80211_FCTL_WEP)) {
if (!crypt && (fc & IEEE80211_FCTL_PROTECTED)) {
/* This seems to be triggered by some (multicast?)
* frames from other than current BSS, so just drop the
* frames silently instead of filling system log with
......@@ -455,7 +455,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
#ifdef NOT_YET
if (type != WLAN_FC_TYPE_DATA) {
if (type == WLAN_FC_TYPE_MGMT && stype == WLAN_FC_STYPE_AUTH &&
fc & IEEE80211_FCTL_WEP && ieee->host_decrypt &&
fc & IEEE80211_FCTL_PROTECTED && ieee->host_decrypt &&
(keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0)
{
printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth "
......@@ -556,7 +556,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) &&
(keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
goto rx_dropped;
......@@ -564,7 +564,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
/* skb: hdr + (possibly fragmented) plaintext payload */
// PR: FIXME: hostap has additional conditions in the "if" below:
// ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
// ieee->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) &&
if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen;
struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
......@@ -620,12 +620,12 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) &&
ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep) {
if (/*ieee->ieee802_1x &&*/
ieee80211_is_eapol_frame(ieee, skb)) {
#ifdef CONFIG_IEEE80211_DEBUG
......@@ -646,7 +646,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
}
#ifdef CONFIG_IEEE80211_DEBUG
if (crypt && !(fc & IEEE80211_FCTL_WEP) &&
if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) &&
ieee80211_is_eapol_frame(ieee, skb)) {
struct eapol *eap = (struct eapol *)(skb->data +
24);
......@@ -655,7 +655,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
}
#endif
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep &&
!ieee80211_is_eapol_frame(ieee, skb)) {
IEEE80211_DEBUG_DROP(
"dropped unencrypted RX data "
......
......@@ -313,7 +313,7 @@ int ieee80211_xmit(struct sk_buff *skb,
if (encrypt)
fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA |
IEEE80211_FCTL_WEP;
IEEE80211_FCTL_PROTECTED;
else
fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment