Skip to content

Commit

Permalink
[PATCH] Atmel wireless update
Browse files Browse the repository at this point in the history
* Merge PCMCIA card table with new Brodowski PCMCIA id table.
* Add missing entries to PCMCIA id table.
* Other tweaks to conform with Documentation/driver-changes.txt
  (types, call request_region, etc)
* Fix size of requested IO region.
* Reduce printk verbosity.
* Remove EXPERIMENTAL
* tweak to association code - don't force shared key authentication
  when wep in use.

Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
  • Loading branch information
simon@thekelleys.org.uk authored and Jeff Garzik committed Nov 11, 2005
1 parent 741b225 commit b16a228
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 178 deletions.
2 changes: 1 addition & 1 deletion drivers/net/wireless/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ config PCI_HERMES

config ATMEL
tristate "Atmel at76c50x chipset 802.11b support"
depends on NET_RADIO && EXPERIMENTAL
depends on NET_RADIO
select FW_LOADER
select CRC32
---help---
Expand Down
88 changes: 43 additions & 45 deletions drivers/net/wireless/atmel.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
#include "atmel.h"

#define DRIVER_MAJOR 0
#define DRIVER_MINOR 96
#define DRIVER_MINOR 98

MODULE_AUTHOR("Simon Kelley");
MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards.");
Expand Down Expand Up @@ -1504,7 +1504,7 @@ static int atmel_read_proc(char *page, char **start, off_t off,
return len;
}

struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWType fw_type,
struct net_device *init_atmel_card( unsigned short irq, unsigned long port, const AtmelFWType fw_type,
struct device *sys_dev, int (*card_present)(void *), void *card)
{
struct net_device *dev;
Expand Down Expand Up @@ -1605,8 +1605,8 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT
goto err_out_free;
}

if (priv->bus_type == BUS_TYPE_PCI &&
!request_region( dev->base_addr, 64, dev->name )) {
if (!request_region(dev->base_addr, 32,
priv->bus_type == BUS_TYPE_PCCARD ? "atmel_cs" : "atmel_pci")) {
goto err_out_irq;
}

Expand All @@ -1622,15 +1622,16 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT

create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv);

printk(KERN_INFO "%s: Atmel at76c50x wireless. Version %d.%d simon@thekelleys.org.uk\n",
dev->name, DRIVER_MAJOR, DRIVER_MINOR);
printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
dev->name, DRIVER_MAJOR, DRIVER_MINOR,
dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] );

SET_MODULE_OWNER(dev);
return dev;

err_out_res:
if (priv->bus_type == BUS_TYPE_PCI)
release_region( dev->base_addr, 64 );
release_region( dev->base_addr, 32);
err_out_irq:
free_irq(dev->irq, dev);
err_out_free:
Expand All @@ -1640,7 +1641,7 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT

EXPORT_SYMBOL(init_atmel_card);

void stop_atmel_card(struct net_device *dev, int freeres)
void stop_atmel_card(struct net_device *dev)
{
struct atmel_private *priv = netdev_priv(dev);

Expand All @@ -1655,10 +1656,7 @@ void stop_atmel_card(struct net_device *dev, int freeres)
free_irq(dev->irq, dev);
if (priv->firmware)
kfree(priv->firmware);
if (freeres) {
/* PCMCIA frees this stuff, so only for PCI */
release_region(dev->base_addr, 64);
}
release_region(dev->base_addr, 32);
free_netdev(dev);
}

Expand Down Expand Up @@ -1811,9 +1809,9 @@ static int atmel_set_encode(struct net_device *dev,
}
if(dwrq->flags & IW_ENCODE_RESTRICTED)
priv->exclude_unencrypted = 1;
if(dwrq->flags & IW_ENCODE_OPEN)
if(dwrq->flags & IW_ENCODE_OPEN)
priv->exclude_unencrypted = 0;
return -EINPROGRESS; /* Call commit handler */
}

Expand All @@ -1828,11 +1826,12 @@ static int atmel_get_encode(struct net_device *dev,

if (!priv->wep_is_on)
dwrq->flags = IW_ENCODE_DISABLED;
else if (priv->exclude_unencrypted)
dwrq->flags = IW_ENCODE_RESTRICTED;
else
dwrq->flags = IW_ENCODE_OPEN;

else {
if (priv->exclude_unencrypted)
dwrq->flags = IW_ENCODE_RESTRICTED;
else
dwrq->flags = IW_ENCODE_OPEN;
}
/* Which key do we want ? -1 -> tx index */
if (index < 0 || index >= 4)
index = priv->default_key;
Expand Down Expand Up @@ -2647,8 +2646,8 @@ static void handle_beacon_probe(struct atmel_private *priv, u16 capability, u8 c
}
}

static void send_authentication_request(struct atmel_private *priv, u8 *challenge, int challenge_len)

static void send_authentication_request(struct atmel_private *priv, u16 system, u8 *challenge, int challenge_len)
{
struct ieee80211_hdr header;
struct auth_body auth;
Expand All @@ -2660,14 +2659,11 @@ static void send_authentication_request(struct atmel_private *priv, u8 *challeng
memcpy(header.addr2, priv->dev->dev_addr, 6);
memcpy(header.addr3, priv->CurrentBSSID, 6);

if (priv->wep_is_on) {
auth.alg = cpu_to_le16(C80211_MGMT_AAN_SHAREDKEY);
if (priv->wep_is_on && priv->CurrentAuthentTransactionSeqNum != 1)
/* no WEP for authentication frames with TrSeqNo 1 */
if (priv->CurrentAuthentTransactionSeqNum != 1)
header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
} else {
auth.alg = cpu_to_le16(C80211_MGMT_AAN_OPENSYSTEM);
}
header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);

auth.alg = cpu_to_le16(system);

auth.status = 0;
auth.trans_seq = cpu_to_le16(priv->CurrentAuthentTransactionSeqNum);
Expand Down Expand Up @@ -2836,6 +2832,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
struct auth_body *auth = (struct auth_body *)priv->rx_buf;
u16 status = le16_to_cpu(auth->status);
u16 trans_seq_no = le16_to_cpu(auth->trans_seq);
u16 system = le16_to_cpu(auth->alg);

if (status == C80211_MGMT_SC_Success && !priv->wep_is_on) {
/* no WEP */
Expand All @@ -2857,7 +2854,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)

if (trans_seq_no == 0x0002 &&
auth->el_id == C80211_MGMT_ElementID_ChallengeText) {
send_authentication_request(priv, auth->chall_text, auth->chall_text_len);
send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len);
return;
}

Expand All @@ -2874,14 +2871,20 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
}
}

if (status == C80211_MGMT_SC_AuthAlgNotSupported && priv->connect_to_any_BSS) {
int bss_index;

priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80;

if ((bss_index = retrieve_bss(priv)) != -1) {
atmel_join_bss(priv, bss_index);
return;
if (status == C80211_MGMT_SC_AuthAlgNotSupported) {
/* Do opensystem first, then try sharedkey */
if (system == C80211_MGMT_AAN_OPENSYSTEM) {
priv->CurrentAuthentTransactionSeqNum = 0x001;
send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0);
} else if (priv->connect_to_any_BSS) {
int bss_index;

priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80;

if ((bss_index = retrieve_bss(priv)) != -1) {
atmel_join_bss(priv, bss_index);
return;
}
}
}

Expand Down Expand Up @@ -3207,7 +3210,7 @@ static void atmel_management_timer(u_long a)
priv->AuthenticationRequestRetryCnt++;
priv->CurrentAuthentTransactionSeqNum = 0x0001;
mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
send_authentication_request(priv, NULL, 0);
send_authentication_request(priv, C80211_MGMT_AAN_OPENSYSTEM, NULL, 0);
}

break;
Expand Down Expand Up @@ -3314,7 +3317,7 @@ static void atmel_command_irq(struct atmel_private *priv)

mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
priv->CurrentAuthentTransactionSeqNum = 0x0001;
send_authentication_request(priv, NULL, 0);
send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0);
}
return;
}
Expand Down Expand Up @@ -3484,11 +3487,6 @@ static int probe_atmel_card(struct net_device *dev)
printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name);
memcpy(dev->dev_addr, default_mac, 6);
}
printk(KERN_INFO "%s: MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
dev->name,
dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] );

}

return rc;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/wireless/atmel.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ typedef enum {
ATMEL_FW_TYPE_506
} AtmelFWType;

struct net_device *init_atmel_card(unsigned short, int, const AtmelFWType, struct device *,
struct net_device *init_atmel_card(unsigned short, unsigned long, const AtmelFWType, struct device *,
int (*present_func)(void *), void * );
void stop_atmel_card( struct net_device *, int );
void stop_atmel_card( struct net_device *);
int atmel_open( struct net_device * );

#endif
Loading

0 comments on commit b16a228

Please sign in to comment.