diff options
author | simon@thekelleys.org.uk <simon@thekelleys.org.uk> | 2005-10-30 10:50:15 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-11-11 08:12:17 -0500 |
commit | b16a228d05a95b27d77d07a91688382f68ece8a7 (patch) | |
tree | a76708ef80110839f6f8cc88da292962548d51f5 /drivers/net/wireless/atmel.c | |
parent | 741b2252a5e14d6c60a913c77a6099abe73a854a (diff) |
[PATCH] Atmel wireless update
* 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>
Diffstat (limited to 'drivers/net/wireless/atmel.c')
-rw-r--r-- | drivers/net/wireless/atmel.c | 88 |
1 files changed, 43 insertions, 45 deletions
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 587869d86eee..dbc991a5afc9 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -72,7 +72,7 @@ | |||
72 | #include "atmel.h" | 72 | #include "atmel.h" |
73 | 73 | ||
74 | #define DRIVER_MAJOR 0 | 74 | #define DRIVER_MAJOR 0 |
75 | #define DRIVER_MINOR 96 | 75 | #define DRIVER_MINOR 98 |
76 | 76 | ||
77 | MODULE_AUTHOR("Simon Kelley"); | 77 | MODULE_AUTHOR("Simon Kelley"); |
78 | MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); | 78 | MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); |
@@ -1504,7 +1504,7 @@ static int atmel_read_proc(char *page, char **start, off_t off, | |||
1504 | return len; | 1504 | return len; |
1505 | } | 1505 | } |
1506 | 1506 | ||
1507 | struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWType fw_type, | 1507 | struct net_device *init_atmel_card( unsigned short irq, unsigned long port, const AtmelFWType fw_type, |
1508 | struct device *sys_dev, int (*card_present)(void *), void *card) | 1508 | struct device *sys_dev, int (*card_present)(void *), void *card) |
1509 | { | 1509 | { |
1510 | struct net_device *dev; | 1510 | struct net_device *dev; |
@@ -1605,8 +1605,8 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT | |||
1605 | goto err_out_free; | 1605 | goto err_out_free; |
1606 | } | 1606 | } |
1607 | 1607 | ||
1608 | if (priv->bus_type == BUS_TYPE_PCI && | 1608 | if (!request_region(dev->base_addr, 32, |
1609 | !request_region( dev->base_addr, 64, dev->name )) { | 1609 | priv->bus_type == BUS_TYPE_PCCARD ? "atmel_cs" : "atmel_pci")) { |
1610 | goto err_out_irq; | 1610 | goto err_out_irq; |
1611 | } | 1611 | } |
1612 | 1612 | ||
@@ -1622,15 +1622,16 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT | |||
1622 | 1622 | ||
1623 | create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv); | 1623 | create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv); |
1624 | 1624 | ||
1625 | printk(KERN_INFO "%s: Atmel at76c50x wireless. Version %d.%d simon@thekelleys.org.uk\n", | 1625 | printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", |
1626 | dev->name, DRIVER_MAJOR, DRIVER_MINOR); | 1626 | dev->name, DRIVER_MAJOR, DRIVER_MINOR, |
1627 | dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], | ||
1628 | dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] ); | ||
1627 | 1629 | ||
1628 | SET_MODULE_OWNER(dev); | 1630 | SET_MODULE_OWNER(dev); |
1629 | return dev; | 1631 | return dev; |
1630 | 1632 | ||
1631 | err_out_res: | 1633 | err_out_res: |
1632 | if (priv->bus_type == BUS_TYPE_PCI) | 1634 | release_region( dev->base_addr, 32); |
1633 | release_region( dev->base_addr, 64 ); | ||
1634 | err_out_irq: | 1635 | err_out_irq: |
1635 | free_irq(dev->irq, dev); | 1636 | free_irq(dev->irq, dev); |
1636 | err_out_free: | 1637 | err_out_free: |
@@ -1640,7 +1641,7 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT | |||
1640 | 1641 | ||
1641 | EXPORT_SYMBOL(init_atmel_card); | 1642 | EXPORT_SYMBOL(init_atmel_card); |
1642 | 1643 | ||
1643 | void stop_atmel_card(struct net_device *dev, int freeres) | 1644 | void stop_atmel_card(struct net_device *dev) |
1644 | { | 1645 | { |
1645 | struct atmel_private *priv = netdev_priv(dev); | 1646 | struct atmel_private *priv = netdev_priv(dev); |
1646 | 1647 | ||
@@ -1655,10 +1656,7 @@ void stop_atmel_card(struct net_device *dev, int freeres) | |||
1655 | free_irq(dev->irq, dev); | 1656 | free_irq(dev->irq, dev); |
1656 | if (priv->firmware) | 1657 | if (priv->firmware) |
1657 | kfree(priv->firmware); | 1658 | kfree(priv->firmware); |
1658 | if (freeres) { | 1659 | release_region(dev->base_addr, 32); |
1659 | /* PCMCIA frees this stuff, so only for PCI */ | ||
1660 | release_region(dev->base_addr, 64); | ||
1661 | } | ||
1662 | free_netdev(dev); | 1660 | free_netdev(dev); |
1663 | } | 1661 | } |
1664 | 1662 | ||
@@ -1811,9 +1809,9 @@ static int atmel_set_encode(struct net_device *dev, | |||
1811 | } | 1809 | } |
1812 | if(dwrq->flags & IW_ENCODE_RESTRICTED) | 1810 | if(dwrq->flags & IW_ENCODE_RESTRICTED) |
1813 | priv->exclude_unencrypted = 1; | 1811 | priv->exclude_unencrypted = 1; |
1814 | if(dwrq->flags & IW_ENCODE_OPEN) | 1812 | if(dwrq->flags & IW_ENCODE_OPEN) |
1815 | priv->exclude_unencrypted = 0; | 1813 | priv->exclude_unencrypted = 0; |
1816 | 1814 | ||
1817 | return -EINPROGRESS; /* Call commit handler */ | 1815 | return -EINPROGRESS; /* Call commit handler */ |
1818 | } | 1816 | } |
1819 | 1817 | ||
@@ -1828,11 +1826,12 @@ static int atmel_get_encode(struct net_device *dev, | |||
1828 | 1826 | ||
1829 | if (!priv->wep_is_on) | 1827 | if (!priv->wep_is_on) |
1830 | dwrq->flags = IW_ENCODE_DISABLED; | 1828 | dwrq->flags = IW_ENCODE_DISABLED; |
1831 | else if (priv->exclude_unencrypted) | 1829 | else { |
1832 | dwrq->flags = IW_ENCODE_RESTRICTED; | 1830 | if (priv->exclude_unencrypted) |
1833 | else | 1831 | dwrq->flags = IW_ENCODE_RESTRICTED; |
1834 | dwrq->flags = IW_ENCODE_OPEN; | 1832 | else |
1835 | 1833 | dwrq->flags = IW_ENCODE_OPEN; | |
1834 | } | ||
1836 | /* Which key do we want ? -1 -> tx index */ | 1835 | /* Which key do we want ? -1 -> tx index */ |
1837 | if (index < 0 || index >= 4) | 1836 | if (index < 0 || index >= 4) |
1838 | index = priv->default_key; | 1837 | index = priv->default_key; |
@@ -2647,8 +2646,8 @@ static void handle_beacon_probe(struct atmel_private *priv, u16 capability, u8 c | |||
2647 | } | 2646 | } |
2648 | } | 2647 | } |
2649 | 2648 | ||
2650 | 2649 | ||
2651 | static void send_authentication_request(struct atmel_private *priv, u8 *challenge, int challenge_len) | 2650 | static void send_authentication_request(struct atmel_private *priv, u16 system, u8 *challenge, int challenge_len) |
2652 | { | 2651 | { |
2653 | struct ieee80211_hdr header; | 2652 | struct ieee80211_hdr header; |
2654 | struct auth_body auth; | 2653 | struct auth_body auth; |
@@ -2660,14 +2659,11 @@ static void send_authentication_request(struct atmel_private *priv, u8 *challeng | |||
2660 | memcpy(header.addr2, priv->dev->dev_addr, 6); | 2659 | memcpy(header.addr2, priv->dev->dev_addr, 6); |
2661 | memcpy(header.addr3, priv->CurrentBSSID, 6); | 2660 | memcpy(header.addr3, priv->CurrentBSSID, 6); |
2662 | 2661 | ||
2663 | if (priv->wep_is_on) { | 2662 | if (priv->wep_is_on && priv->CurrentAuthentTransactionSeqNum != 1) |
2664 | auth.alg = cpu_to_le16(C80211_MGMT_AAN_SHAREDKEY); | ||
2665 | /* no WEP for authentication frames with TrSeqNo 1 */ | 2663 | /* no WEP for authentication frames with TrSeqNo 1 */ |
2666 | if (priv->CurrentAuthentTransactionSeqNum != 1) | 2664 | header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); |
2667 | header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); | 2665 | |
2668 | } else { | 2666 | auth.alg = cpu_to_le16(system); |
2669 | auth.alg = cpu_to_le16(C80211_MGMT_AAN_OPENSYSTEM); | ||
2670 | } | ||
2671 | 2667 | ||
2672 | auth.status = 0; | 2668 | auth.status = 0; |
2673 | auth.trans_seq = cpu_to_le16(priv->CurrentAuthentTransactionSeqNum); | 2669 | auth.trans_seq = cpu_to_le16(priv->CurrentAuthentTransactionSeqNum); |
@@ -2836,6 +2832,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
2836 | struct auth_body *auth = (struct auth_body *)priv->rx_buf; | 2832 | struct auth_body *auth = (struct auth_body *)priv->rx_buf; |
2837 | u16 status = le16_to_cpu(auth->status); | 2833 | u16 status = le16_to_cpu(auth->status); |
2838 | u16 trans_seq_no = le16_to_cpu(auth->trans_seq); | 2834 | u16 trans_seq_no = le16_to_cpu(auth->trans_seq); |
2835 | u16 system = le16_to_cpu(auth->alg); | ||
2839 | 2836 | ||
2840 | if (status == C80211_MGMT_SC_Success && !priv->wep_is_on) { | 2837 | if (status == C80211_MGMT_SC_Success && !priv->wep_is_on) { |
2841 | /* no WEP */ | 2838 | /* no WEP */ |
@@ -2857,7 +2854,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
2857 | 2854 | ||
2858 | if (trans_seq_no == 0x0002 && | 2855 | if (trans_seq_no == 0x0002 && |
2859 | auth->el_id == C80211_MGMT_ElementID_ChallengeText) { | 2856 | auth->el_id == C80211_MGMT_ElementID_ChallengeText) { |
2860 | send_authentication_request(priv, auth->chall_text, auth->chall_text_len); | 2857 | send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); |
2861 | return; | 2858 | return; |
2862 | } | 2859 | } |
2863 | 2860 | ||
@@ -2874,14 +2871,20 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
2874 | } | 2871 | } |
2875 | } | 2872 | } |
2876 | 2873 | ||
2877 | if (status == C80211_MGMT_SC_AuthAlgNotSupported && priv->connect_to_any_BSS) { | 2874 | if (status == C80211_MGMT_SC_AuthAlgNotSupported) { |
2878 | int bss_index; | 2875 | /* Do opensystem first, then try sharedkey */ |
2879 | 2876 | if (system == C80211_MGMT_AAN_OPENSYSTEM) { | |
2880 | priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80; | 2877 | priv->CurrentAuthentTransactionSeqNum = 0x001; |
2881 | 2878 | send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); | |
2882 | if ((bss_index = retrieve_bss(priv)) != -1) { | 2879 | } else if (priv->connect_to_any_BSS) { |
2883 | atmel_join_bss(priv, bss_index); | 2880 | int bss_index; |
2884 | return; | 2881 | |
2882 | priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80; | ||
2883 | |||
2884 | if ((bss_index = retrieve_bss(priv)) != -1) { | ||
2885 | atmel_join_bss(priv, bss_index); | ||
2886 | return; | ||
2887 | } | ||
2885 | } | 2888 | } |
2886 | } | 2889 | } |
2887 | 2890 | ||
@@ -3207,7 +3210,7 @@ static void atmel_management_timer(u_long a) | |||
3207 | priv->AuthenticationRequestRetryCnt++; | 3210 | priv->AuthenticationRequestRetryCnt++; |
3208 | priv->CurrentAuthentTransactionSeqNum = 0x0001; | 3211 | priv->CurrentAuthentTransactionSeqNum = 0x0001; |
3209 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); | 3212 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); |
3210 | send_authentication_request(priv, NULL, 0); | 3213 | send_authentication_request(priv, C80211_MGMT_AAN_OPENSYSTEM, NULL, 0); |
3211 | } | 3214 | } |
3212 | 3215 | ||
3213 | break; | 3216 | break; |
@@ -3314,7 +3317,7 @@ static void atmel_command_irq(struct atmel_private *priv) | |||
3314 | 3317 | ||
3315 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); | 3318 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); |
3316 | priv->CurrentAuthentTransactionSeqNum = 0x0001; | 3319 | priv->CurrentAuthentTransactionSeqNum = 0x0001; |
3317 | send_authentication_request(priv, NULL, 0); | 3320 | send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); |
3318 | } | 3321 | } |
3319 | return; | 3322 | return; |
3320 | } | 3323 | } |
@@ -3484,11 +3487,6 @@ static int probe_atmel_card(struct net_device *dev) | |||
3484 | printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name); | 3487 | printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name); |
3485 | memcpy(dev->dev_addr, default_mac, 6); | 3488 | memcpy(dev->dev_addr, default_mac, 6); |
3486 | } | 3489 | } |
3487 | printk(KERN_INFO "%s: MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", | ||
3488 | dev->name, | ||
3489 | dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], | ||
3490 | dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] ); | ||
3491 | |||
3492 | } | 3490 | } |
3493 | 3491 | ||
3494 | return rc; | 3492 | return rc; |