orinoco: initiate cfg80211 conversion
cover orinoco: initiate cfg80211 conversion
Compared to the last RFC, this series:
* addresses Marcels comments, using a switch instead of an if (2,3,4)
* fixes scanning problems for older firmware (21)
* depends on cfg80211 rather than selecting it (in line with "cfg80211:
fix Kconfig for users of cfg80211") (14).
* updates change_vif argument from ifindex to net_device (in line with "cfg80211: pass netdev to change_virtual_intf") (20)
Patches 1-5 modify cfg80211, mostly so it can advertise (the more restrictive) orinoco capabilities correctly.
Patches 6-13 refactor the orinoco internal interfaces and initialisation to make the switch to cfg80211 easier. The main thrust is to avoid using net_device in the device drivers allowing us to register the net_device later.
Patch 14 starts the cfg80211 conversion, before patches 15-19 cleanup the fallout from the conversion.
Patches 20 though 23 convert a few of the WE handlers to cfg80211 handlers.
This series is intended for the wireless-testing tree.
---
David Kilroy (23):
cfg80211: add wrapper function to get wiphy from priv pointer
cfg80211: Advertise ciphers via WE according to driver capability
cfg80211: allow drivers that can't scan for specific ssids
cfg80211: set WE encoding size based on available ciphers
cfg80211: infer WPA and WPA2 support from TKIP and CCMP
orinoco: Move firmware capability determination into hw.c
orinoco: Move card reading code into hw.c
orinoco: Move FID allocation to hw.c
orinoco: use dev_err in early initialisation routines
orinoco: firmware helpers should use dev_err and friends
orinoco: Replace net_device with orinoco_private in driver interfaces
orinoco: initialise independently of netdev
orinoco: Change set_tkip to use orinoco_private instead of hermes_t
orinoco: initiate cfg80211 conversion
orinoco: make firmware download less verbose
orinoco: move netdev interface creation to main driver
airport: store irq in card private structure
orinoco: Handle suspend/restore in core driver
orinoco: provide generic commit function
orinoco: convert mode setting to cfg80211
orinoco: convert scanning to cfg80211
orinoco: convert giwrange to cfg80211
orinoco: remove WE nickname support
drivers/net/wireless/orinoco/Kconfig | 1 + drivers/net/wireless/orinoco/Makefile | 2 +- drivers/net/wireless/orinoco/airport.c | 98 +-- drivers/net/wireless/orinoco/cfg.c | 162 ++++ drivers/net/wireless/orinoco/cfg.h | 15 + drivers/net/wireless/orinoco/fw.c | 41 +- drivers/net/wireless/orinoco/hermes.h | 2 +- drivers/net/wireless/orinoco/hermes_dld.c | 50 +- drivers/net/wireless/orinoco/hw.c | 668 +++++++++++++++- drivers/net/wireless/orinoco/hw.h | 11 +- drivers/net/wireless/orinoco/main.c | 1133 +++++++++---------------- drivers/net/wireless/orinoco/main.h | 3 +- drivers/net/wireless/orinoco/orinoco.h | 49 +- drivers/net/wireless/orinoco/orinoco_cs.c | 96 +-- drivers/net/wireless/orinoco/orinoco_nortel.c | 38 +- drivers/net/wireless/orinoco/orinoco_pci.c | 38 +- drivers/net/wireless/orinoco/orinoco_pci.h | 57 +-- drivers/net/wireless/orinoco/orinoco_plx.c | 38 +- drivers/net/wireless/orinoco/orinoco_tmd.c | 38 +- drivers/net/wireless/orinoco/scan.c | 285 +++---- drivers/net/wireless/orinoco/scan.h | 21 +- drivers/net/wireless/orinoco/spectrum_cs.c | 96 +-- drivers/net/wireless/orinoco/wext.c | 878 ++------------------ include/net/cfg80211.h | 11 + net/wireless/core.c | 3 - net/wireless/wext-compat.c | 31 +- 26 files changed, 1748 insertions(+), 2117 deletions(-) create mode 100644 drivers/net/wireless/orinoco/cfg.c create mode 100644 drivers/net/wireless/orinoco/cfg.h
PATCH 1/23 cfg80211: add wrapper function to get wiphy from priv pointer
--- include/net/cfg80211.h | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
include/net/cfg80211.h +11 -0
@@ -1059,6 +1059,17 @@ static inline void *wiphy_priv(struct wiphy *wiphy) }/** +* priv_to_wiphy - return the wiphy containing the priv +* +* @priv: a pointer previously returned by wiphy_priv +*/ +static inline struct wiphy *priv_to_wiphy (void *priv) +{ +BUG_ON (!priv); + return container_of(priv, struct wiphy, priv); +} + +/** * set_wiphy_dev - set device pointer for wiphy * * @wiphy: The wiphy whose device to bind
Signature · 1 line
1.6.0.6
PATCH 2/23 cfg80211: Advertise ciphers via WE according to driver capability
In reply to David Kilroy--- net/wireless/wext-compat.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-)
net/wireless/wext-compat.c +13 -2
@@ -204,8 +204,19 @@ int cfg80211_wext_giwrange(struct net_device *dev, range->avg_qual.noise = range->max_qual.noise /2 ; range->avg_qual.updated = range->max_qual.updated; - range->enc_capa =IW_ENC_CAPA_WPA |IW_ENC_CAPA_WPA2 | -IW_ENC_CAPA_CIPHER_TKIP |IW_ENC_CAPA_CIPHER_CCMP ; + range->enc_capa =IW_ENC_CAPA_WPA |IW_ENC_CAPA_WPA2 ; + +for (c =0 ; c < wdev->wiphy->n_cipher_suites; c++) { +switch (wdev->wiphy->cipher_suites[c]) { +case WLAN_CIPHER_SUITE_TKIP : + range->enc_capa |=IW_ENC_CAPA_CIPHER_TKIP ; +break ; + +case WLAN_CIPHER_SUITE_CCMP : + range->enc_capa |=IW_ENC_CAPA_CIPHER_CCMP ; +break ; + } + }for (band =0 ; band <IEEE80211_NUM_BANDS ; band ++) {int i;
Signature · 1 line
1.6.0.6
Re: [PATCH 02/23] cfg80211: Advertise ciphers via WE according to driver capability
Quoted 11 lines · David Kilroy
Signed-off-by David Kilroy <[email protected]>Acked-by Johannes Berg <[email protected]>---
net/wireless/wext-compat.c | 15 +++++++++++++--1 files changed, 13 insertions(+), 2 deletions(-)net/wireless/wext-compat.c +0
-0
net/wireless/wext-compat.c int cfg80211_wext_giwrange(struct net_device *dev, · line 207
Quoted 6 lines
net/wireless/wext-compat.c +1
-2@@ -204,8 +204,19 @@ int cfg80211_wext_giwrange(struct net_device *dev, range->avg_qual.noise = range->max_qual.noise / 2; range->avg_qual.updated = range->max_qual.updated; - range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | - IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; + range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2;
Should this should go into the for loop too, like how patch 5 works?
Quoted 4 lines
net/wireless/wext-compat.c +4
-0+ for (c = 0; c < wdev->wiphy->n_cipher_suites; c++) { + switch (wdev->wiphy->cipher_suites[c]) { + case WLAN_CIPHER_SUITE_TKIP: + range->enc_capa |= IW_ENC_CAPA_CIPHER_TKIP;
net/wireless/wext-compat.c int cfg80211_wext_giwrange(struct net_device *dev, · line 222
Quoted 10 lines
net/wireless/wext-compat.c +7
-0+ break; + + case WLAN_CIPHER_SUITE_CCMP: + range->enc_capa |= IW_ENC_CAPA_CIPHER_CCMP; + break; + } + } for (band = 0; band < IEEE80211_NUM_BANDS; band ++) { int i;
Thanks,
Signature · 4 lines
Julian Calaby Email: [email protected] .Plan: http://sites.google.com/site/juliancalaby/
Re: [PATCH 02/23] cfg80211: Advertise ciphers via WE according to driver capability
Quoted 15 lines · Julian Calaby
Quoted 14 lines · David Kilroy
Signed-off-by David Kilroy <[email protected]>Acked-by Johannes Berg <[email protected]>--- net/wireless/wext-compat.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-)net/wireless/wext-compat.c +0
-0@@ -204,8 +204,19 @@ int cfg80211_wext_giwrange(struct net_device *dev, range->avg_qual.noise = range->max_qual.noise /2 ; range->avg_qual.updated = range->max_qual.updated;
Quoted 5 lines
net/wireless/wext-compat.c int cfg80211_wext_giwrange(struct net_device *dev, · line 207
Quoted 3 lines
net/wireless/wext-compat.c +1
-2- range->enc_capa =IW_ENC_CAPA_WPA |IW_ENC_CAPA_WPA2 | -IW_ENC_CAPA_CIPHER_TKIP |IW_ENC_CAPA_CIPHER_CCMP ; + range->enc_capa =IW_ENC_CAPA_WPA |IW_ENC_CAPA_WPA2 ;Should this should go into the for loop too, like how patch 5 works?
Err... patch 5 moves this line into the for loop. I moved these in separate patches because:
* Indicating available ciphers based on cipher capability is obviously correct.
* Indicating WPA/WPA2 based on cipher capability is not obviously correct - and we might want the drivers to indicate this explicitly.
* The latter patch can be NACK'd without affecting the former, or the rest of the series (well, apart from patch 22).
As it happens, no-one has objected (yet).
Apologies if I've completely misunderstood you.
Thanks,
Dave.
Re: [PATCH 02/23] cfg80211: Advertise ciphers via WE according to driver capability
Quoted 16 lines · Dave
Quoted 15 lines · Julian Calaby
Quoted 14 lines · David Kilroy
Signed-off-by David Kilroy <[email protected]>Acked-by Johannes Berg <[email protected]>---
net/wireless/wext-compat.c | 15 +++++++++++++--1 files changed, 13 insertions(+), 2 deletions(-)net/wireless/wext-compat.c +0
-0@@ -204,8 +204,19 @@ int cfg80211_wext_giwrange(struct net_device *dev, range->avg_qual.noise = range->max_qual.noise / 2; range->avg_qual.updated = range->max_qual.updated;
Quoted 8 lines
Quoted 5 lines
net/wireless/wext-compat.c int cfg80211_wext_giwrange(struct net_device *dev, · line 207
Quoted 3 lines
net/wireless/wext-compat.c +1
-2- range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | - IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; + range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2;Should this should go into the for loop too, like how patch 5 works?
Err... patch 5 moves this line into the for loop. I moved these in separate patches because:
You know, it does. Argh! This is what you get for not reading the patches properly.
Quoted 1 line
As it happens, no-one has objected (yet).
Hmm, yes.
Quoted 1 line
Apologies if I've completely misunderstood you.
No, you haven't.
Sorry for the noise.
Thanks,
Signature · 4 lines
Julian Calaby Email: [email protected] .Plan: http://sites.google.com/site/juliancalaby/
PATCH 3/23 cfg80211: allow drivers that can't scan for specific ssids
In reply to David Kilroy--- net/wireless/core.c | 3 --- net/wireless/wext-compat.c | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-)
net/wireless/core.c +0 -3
@@ -346,9 +346,6 @@ int wiphy_register(struct wiphy *wiphy)int i;u16 ifmodes = wiphy->interface_modes; -if (WARN_ON (wiphy->max_scan_ssids <1 )) -return -EINVAL ; -/* sanity check ifmodes */ WARN_ON (!ifmodes); ifmodes &= ((1 << __NL80211_IFTYPE_AFTER_LAST) -1 ) & ~1 ;
net/wireless/wext-compat.c +2 -1
@@ -247,7 +247,8 @@ int cfg80211_wext_giwrange(struct net_device *dev,IW_EVENT_CAPA_SET (range->event_capa,SIOCGIWAP );IW_EVENT_CAPA_SET (range->event_capa,SIOCGIWSCAN ); - range->scan_capa |=IW_SCAN_CAPA_ESSID ; +if (wdev->wiphy->max_scan_ssids >0 ) + range->scan_capa |=IW_SCAN_CAPA_ESSID ;return 0 ; }
Signature · 1 line
1.6.0.6
PATCH 4/23 cfg80211: set WE encoding size based on available ciphers
In reply to David KilroyOnly set the sizes for WEP40 and WEP104.
--- net/wireless/wext-compat.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-)
net/wireless/wext-compat.c +10 -3
@@ -173,9 +173,6 @@ int cfg80211_wext_giwrange(struct net_device *dev, range->min_frag =256 ; range->max_frag =2346 ; - range->encoding_size[0 ] =5 ; - range->encoding_size[1 ] =13 ; - range->num_encoding_sizes =2 ; range->max_encoding_tokens =4 ; range->max_qual.updated =IW_QUAL_NOISE_INVALID ;
@@ -215,6 +212,16 @@ int cfg80211_wext_giwrange(struct net_device *dev,case WLAN_CIPHER_SUITE_CCMP : range->enc_capa |=IW_ENC_CAPA_CIPHER_CCMP ;break ; + +case WLAN_CIPHER_SUITE_WEP40 : + range->encoding_size[range->num_encoding_sizes++] = +WLAN_KEY_LEN_WEP40 ; +break ; + +case WLAN_CIPHER_SUITE_WEP104 : + range->encoding_size[range->num_encoding_sizes++] = +WLAN_KEY_LEN_WEP104 ; +break ; } }
Signature · 1 line
1.6.0.6
PATCH 5/23 cfg80211: infer WPA and WPA2 support from TKIP and CCMP
In reply to David Kilroy--- net/wireless/wext-compat.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
net/wireless/wext-compat.c +4 -4
@@ -201,16 +201,16 @@ int cfg80211_wext_giwrange(struct net_device *dev, range->avg_qual.noise = range->max_qual.noise /2 ; range->avg_qual.updated = range->max_qual.updated; - range->enc_capa =IW_ENC_CAPA_WPA |IW_ENC_CAPA_WPA2 ; -for (c =0 ; c < wdev->wiphy->n_cipher_suites; c++) {switch (wdev->wiphy->cipher_suites[c]) {case WLAN_CIPHER_SUITE_TKIP : - range->enc_capa |=IW_ENC_CAPA_CIPHER_TKIP ; + range->enc_capa |= (IW_ENC_CAPA_CIPHER_TKIP | +IW_ENC_CAPA_WPA );break ;case WLAN_CIPHER_SUITE_CCMP : - range->enc_capa |=IW_ENC_CAPA_CIPHER_CCMP ; + range->enc_capa |= (IW_ENC_CAPA_CIPHER_CCMP | +IW_ENC_CAPA_WPA2 );break ;case WLAN_CIPHER_SUITE_WEP40 :
Signature · 1 line
1.6.0.6
PATCH 6/23 orinoco: Move firmware capability determination into hw.c
In reply to David KilroyThis is part of refactorring the initialisation code so that we can load the firmware before registerring with netdev.
--- drivers/net/wireless/orinoco/hw.c | 216 ++++++++++++++++++++++++++++++++++ drivers/net/wireless/orinoco/hw.h | 1 + drivers/net/wireless/orinoco/main.c | 218 +---------------------------------- 3 files changed, 219 insertions(+), 216 deletions(-)
drivers/net/wireless/orinoco/hw.c +216 -0
@@ -13,6 +13,8 @@#include "hw.h" +#define SYMBOL_MAX_VER_LEN (14) +/********************************************************************/ /* Data tables */ /********************************************************************/
@@ -36,6 +38,220 @@ static const struct { };#define BITRATE_TABLE_SIZE ARRAY_SIZE(bitrate_table) +/* Firmware version encoding */ +struct comp_id { +u16 id, variant, major, minor; +} __attribute__ ((packed)); + +static inline fwtype_t determine_firmware_type (struct comp_id *nic_id) +{ +if (nic_id->id <0x8000 ) +return FIRMWARE_TYPE_AGERE ; +else if (nic_id->id ==0x8000 && nic_id->major ==0 ) +return FIRMWARE_TYPE_SYMBOL ; +else +return FIRMWARE_TYPE_INTERSIL ; +} + +/* Set priv->firmware type, determine firmware properties */ +int determine_fw_capabilities (struct orinoco_private *priv) +{ +struct net_device *dev = priv->ndev; +hermes_t *hw = &priv->hw; +int err; +struct comp_id nic_id, sta_id; +unsigned int firmver; + char tmp[SYMBOL_MAX_VER_LEN+1] __attribute__((aligned(2))); + +/* Get the hardware version */ + err =HERMES_READ_RECORD (hw,USER_BAP ,HERMES_RID_NICID , &nic_id); +if (err) { +printk (KERN_ERR "%s: Cannot read hardware identity: error %d\n" , + dev->name, err); +return err; + } + +le16_to_cpus (&nic_id.id); +le16_to_cpus (&nic_id.variant); +le16_to_cpus (&nic_id.major); +le16_to_cpus (&nic_id.minor); +printk (KERN_DEBUG "%s: Hardware identity %04x:%04x:%04x:%04x\n" , + dev->name, nic_id.id, nic_id.variant, + nic_id.major, nic_id.minor); + + priv->firmware_type =determine_firmware_type (&nic_id); + +/* Get the firmware version */ + err =HERMES_READ_RECORD (hw,USER_BAP ,HERMES_RID_STAID , &sta_id); +if (err) { +printk (KERN_ERR "%s: Cannot read station identity: error %d\n" , + dev->name, err); +return err; + } + +le16_to_cpus (&sta_id.id); +le16_to_cpus (&sta_id.variant); +le16_to_cpus (&sta_id.major); +le16_to_cpus (&sta_id.minor); +printk (KERN_DEBUG "%s: Station identity %04x:%04x:%04x:%04x\n" , + dev->name, sta_id.id, sta_id.variant, + sta_id.major, sta_id.minor); + +switch (sta_id.id) { +case 0x15 : +printk (KERN_ERR "%s: Primary firmware is active\n" , + dev->name); +return -ENODEV ; +case 0x14b : +printk (KERN_ERR "%s: Tertiary firmware is active\n" , + dev->name); +return -ENODEV ; +case 0x1f :/* Intersil, Agere, Symbol Spectrum24 */ +case 0x21 :/* Symbol Spectrum24 Trilogy */ +break ; +default : +printk (KERN_NOTICE "%s: Unknown station ID, please report\n" , + dev->name); +break ; + } + +/* Default capabilities */ + priv->has_sensitivity =1 ; + priv->has_mwo =0 ; + priv->has_preamble =0 ; + priv->has_port3 =1 ; + priv->has_ibss =1 ; + priv->has_wep =0 ; + priv->has_big_wep =0 ; + priv->has_alt_txcntl =0 ; + priv->has_ext_scan =0 ; + priv->has_wpa =0 ; + priv->do_fw_download =0 ; + +/* Determine capabilities from the firmware version */ +switch (priv->firmware_type) { +case FIRMWARE_TYPE_AGERE : +/* Lucent Wavelan IEEE, Lucent Orinoco, Cabletron RoamAbout, +ELSA, Melco, HP, IBM, Dell 1150, Compaq 110/210 */ +snprintf (priv->fw_name,sizeof (priv->fw_name) -1 , +"Lucent/Agere %d.%02d" , sta_id.major, sta_id.minor); + + firmver = ((unsigned long )sta_id.major <<16 ) | sta_id.minor; + + priv->has_ibss = (firmver >=0x60006 ); + priv->has_wep = (firmver >=0x40020 ); + priv->has_big_wep =1 ;/* FIXME: this is wrong - how do we tell +Gold cards from the others? */ + priv->has_mwo = (firmver >=0x60000 ); + priv->has_pm = (firmver >=0x40020 );/* Don't work in 7.52 ? */ + priv->ibss_port =1 ; + priv->has_hostscan = (firmver >=0x8000a ); + priv->do_fw_download =1 ; + priv->broken_monitor = (firmver >=0x80000 ); + priv->has_alt_txcntl = (firmver >=0x90000 );/* All 9.x ? */ + priv->has_ext_scan = (firmver >=0x90000 );/* All 9.x ? */ + priv->has_wpa = (firmver >=0x9002a ); +/* Tested with Agere firmware : +* 1.16 ; 4.08 ; 4.52 ; 6.04 ; 6.16 ; 7.28 => Jean II +* Tested CableTron firmware : 4.32 => Anton */ +break ; +case FIRMWARE_TYPE_SYMBOL : +/* Symbol , 3Com AirConnect, Intel, Ericsson WLAN */ +/* Intel MAC : 00:02:B3:* */ +/* 3Com MAC : 00:50:DA:* */ +memset (tmp,0 ,sizeof (tmp)); +/* Get the Symbol firmware version */ + err =hermes_read_ltv (hw,USER_BAP , +HERMES_RID_SECONDARYVERSION_SYMBOL , +SYMBOL_MAX_VER_LEN ,NULL , &tmp); +if (err) { +printk (KERN_WARNING +"%s: Error %d reading Symbol firmware info. " +"Wildly guessing capabilities...\n" , + dev->name, err); + firmver =0 ; + tmp[0 ] ='\0' ; + }else { +/* The firmware revision is a string, the format is +* something like : "V2.20-01". +* Quick and dirty parsing... - Jean II +*/ + firmver = ((tmp[1 ] -'0' ) <<16 ) + | ((tmp[3 ] -'0' ) <<12 ) + | ((tmp[4 ] -'0' ) <<8 ) + | ((tmp[6 ] -'0' ) <<4 ) + | (tmp[7 ] -'0' ); + + tmp[SYMBOL_MAX_VER_LEN ] ='\0' ; + } + +snprintf (priv->fw_name,sizeof (priv->fw_name) -1 , +"Symbol %s" , tmp); + + priv->has_ibss = (firmver >=0x20000 ); + priv->has_wep = (firmver >=0x15012 ); + priv->has_big_wep = (firmver >=0x20000 ); + priv->has_pm = (firmver >=0x20000 && firmver <0x22000 ) || + (firmver >=0x29000 && firmver <0x30000 ) || + firmver >=0x31000 ; + priv->has_preamble = (firmver >=0x20000 ); + priv->ibss_port =4 ; + +/* Symbol firmware is found on various cards, but +* there has been no attempt to check firmware +* download on non-spectrum_cs based cards. +* +* Given that the Agere firmware download works +* differently, we should avoid doing a firmware +* download with the Symbol algorithm on non-spectrum +* cards. +* +* For now we can identify a spectrum_cs based card +* because it has a firmware reset function. +*/ + priv->do_fw_download = (priv->stop_fw !=NULL ); + + priv->broken_disableport = (firmver ==0x25013 ) || + (firmver >=0x30000 && firmver <=0x31000 ); + priv->has_hostscan = (firmver >=0x31001 ) || + (firmver >=0x29057 && firmver <0x30000 ); +/* Tested with Intel firmware : 0x20015 => Jean II */ +/* Tested with 3Com firmware : 0x15012 & 0x22001 => Jean II */ +break ; +case FIRMWARE_TYPE_INTERSIL : +/* D-Link, Linksys, Adtron, ZoomAir, and many others... +* Samsung, Compaq 100/200 and Proxim are slightly +* different and less well tested */ +/* D-Link MAC : 00:40:05:* */ +/* Addtron MAC : 00:90:D1:* */ +snprintf (priv->fw_name,sizeof (priv->fw_name) -1 , +"Intersil %d.%d.%d" , sta_id.major, sta_id.minor, + sta_id.variant); + + firmver = ((unsigned long )sta_id.major <<16 ) | + ((unsigned long )sta_id.minor <<8 ) | sta_id.variant; + + priv->has_ibss = (firmver >=0x000700 );/* FIXME */ + priv->has_big_wep = priv->has_wep = (firmver >=0x000800 ); + priv->has_pm = (firmver >=0x000700 ); + priv->has_hostscan = (firmver >=0x010301 ); + +if (firmver >=0x000800 ) + priv->ibss_port =0 ; +else { +printk (KERN_NOTICE "%s: Intersil firmware earlier " +"than v0.8.x - several features not supported\n" , + dev->name); + priv->ibss_port =1 ; + } +break ; + } +printk (KERN_DEBUG "%s: Firmware determined as %s\n" , dev->name, + priv->fw_name); + +return 0 ; +} +int orinoco_get_bitratemode (int bitrate,int automatic) {int ratemode =-1 ;
drivers/net/wireless/orinoco/hw.h +1 -0
@@ -23,6 +23,7 @@struct orinoco_private ;struct dev_addr_list ; +int determine_fw_capabilities (struct orinoco_private *priv);int orinoco_get_bitratemode (int bitrate,int automatic);void orinoco_get_ratemode_cfg (int ratemode,int *bitrate,int *automatic);
drivers/net/wireless/orinoco/main.c +2 -216
242 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 7/23 orinoco: Move card reading code into hw.c
In reply to David KilroyThis is part of refactorring the initialisation code so that we can load the firmware before registerring with netdev.
--- drivers/net/wireless/orinoco/hw.c | 112 +++++++++++++++++++++++++++++++++++ drivers/net/wireless/orinoco/hw.h | 1 + drivers/net/wireless/orinoco/main.c | 102 +------------------------------- 3 files changed, 115 insertions(+), 100 deletions(-)
drivers/net/wireless/orinoco/hw.c +112 -0
@@ -252,6 +252,118 @@ int determine_fw_capabilities(struct orinoco_private *priv)return 0 ; } +/* Read settings from EEPROM into our private structure. +* MAC address gets dropped into callers buffer */ +int orinoco_hw_read_card_settings (struct orinoco_private *priv,u8 *dev_addr) +{ +struct net_device *dev = priv->ndev; +struct hermes_idstring nickbuf; +hermes_t *hw = &priv->hw; +int len; +int err; +u16 reclen; + +/* Get the MAC address */ + err =hermes_read_ltv (hw,USER_BAP ,HERMES_RID_CNFOWNMACADDR , +ETH_ALEN ,NULL , dev_addr); +if (err) { +printk (KERN_WARNING "%s: failed to read MAC address!\n" , + dev->name); + goto out; + } + +printk (KERN_DEBUG "%s: MAC address %pM\n" , + dev->name, dev_addr); + +/* Get the station name */ + err =hermes_read_ltv (hw,USER_BAP ,HERMES_RID_CNFOWNNAME , +sizeof (nickbuf), &reclen, &nickbuf); +if (err) { +printk (KERN_ERR "%s: failed to read station name\n" , + dev->name); + goto out; + } +if (nickbuf.len) + len =min (IW_ESSID_MAX_SIZE , (int )le16_to_cpu (nickbuf.len)); +else + len =min (IW_ESSID_MAX_SIZE ,2 * reclen); +memcpy (priv->nick, &nickbuf.val, len); + priv->nick[len] ='\0' ; + +printk (KERN_DEBUG "%s: Station name \"%s\"\n" , dev->name, priv->nick); + +/* Get allowed channels */ + err =hermes_read_wordrec (hw,USER_BAP ,HERMES_RID_CHANNELLIST , + &priv->channel_mask); +if (err) { +printk (KERN_ERR "%s: failed to read channel list!\n" , + dev->name); + goto out; + } + +/* Get initial AP density */ + err =hermes_read_wordrec (hw,USER_BAP ,HERMES_RID_CNFSYSTEMSCALE , + &priv->ap_density); +if (err || priv->ap_density <1 || priv->ap_density >3 ) + priv->has_sensitivity =0 ; + +/* Get initial RTS threshold */ + err =hermes_read_wordrec (hw,USER_BAP ,HERMES_RID_CNFRTSTHRESHOLD , + &priv->rts_thresh); +if (err) { +printk (KERN_ERR "%s: failed to read RTS threshold!\n" , + dev->name); + goto out; + } + +/* Get initial fragmentation settings */ +if (priv->has_mwo) + err =hermes_read_wordrec (hw,USER_BAP , +HERMES_RID_CNFMWOROBUST_AGERE , + &priv->mwo_robust); +else + err =hermes_read_wordrec (hw,USER_BAP , +HERMES_RID_CNFFRAGMENTATIONTHRESHOLD , + &priv->frag_thresh); +if (err) { +printk (KERN_ERR "%s: failed to read fragmentation settings!\n" , + dev->name); + goto out; + } + +/* Power management setup */ +if (priv->has_pm) { + priv->pm_on =0 ; + priv->pm_mcast =1 ; + err =hermes_read_wordrec (hw,USER_BAP , +HERMES_RID_CNFMAXSLEEPDURATION , + &priv->pm_period); +if (err) { +printk (KERN_ERR "%s: failed to read power management " +"period!\n" , dev->name); + goto out; + } + err =hermes_read_wordrec (hw,USER_BAP , +HERMES_RID_CNFPMHOLDOVERDURATION , + &priv->pm_timeout); +if (err) { +printk (KERN_ERR "%s: failed to read power management " +"timeout!\n" , dev->name); + goto out; + } + } + +/* Preamble setup */ +if (priv->has_preamble) { + err =hermes_read_wordrec (hw,USER_BAP , +HERMES_RID_CNFPREAMBLE_SYMBOL , + &priv->preamble); + } + +out: +return err; +} +int orinoco_get_bitratemode (int bitrate,int automatic) {int ratemode =-1 ;
drivers/net/wireless/orinoco/hw.h +1 -0
@@ -24,6 +24,7 @@ struct orinoco_private;struct dev_addr_list ;int determine_fw_capabilities (struct orinoco_private *priv); +int orinoco_hw_read_card_settings (struct orinoco_private *priv,u8 *dev_addr);int orinoco_get_bitratemode (int bitrate,int automatic);void orinoco_get_ratemode_cfg (int ratemode,int *bitrate,int *automatic);
drivers/net/wireless/orinoco/main.c +2 -100
121 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 8/23 orinoco: Move FID allocation to hw.c
In reply to David KilroyThis is part of refactorring the initialisation code so that we can load the firmware before registerring with netdev.
--- drivers/net/wireless/orinoco/hw.c | 23 +++++++++++++++++++++++ drivers/net/wireless/orinoco/hw.h | 1 + drivers/net/wireless/orinoco/main.c | 25 ++----------------------- 3 files changed, 26 insertions(+), 23 deletions(-)
drivers/net/wireless/orinoco/hw.c +23 -0
@@ -15,6 +15,9 @@#define SYMBOL_MAX_VER_LEN (14) +/* Symbol firmware has a bug allocating buffers larger than this */ +#define TX_NICBUF_SIZE_BUG 1585 +/********************************************************************/ /* Data tables */ /********************************************************************/
@@ -364,6 +367,26 @@ out:return err; } +int orinoco_hw_allocate_fid (struct orinoco_private *priv) +{ +struct net_device *dev = priv->ndev; +struct hermes *hw = &priv->hw; +int err; + + err =hermes_allocate (hw, priv->nicbuf_size, &priv->txfid); +if (err == -EIO && priv->nicbuf_size >TX_NICBUF_SIZE_BUG ) { +/* Try workaround for old Symbol firmware bug */ + priv->nicbuf_size =TX_NICBUF_SIZE_BUG ; + err =hermes_allocate (hw, priv->nicbuf_size, &priv->txfid); + +printk (KERN_WARNING "%s: firmware ALLOC bug detected " +"(old Symbol firmware?). Work around %s\n" , + dev->name, err ?"failed!" :"ok." ); + } + +return err; +} +int orinoco_get_bitratemode (int bitrate,int automatic) {int ratemode =-1 ;
drivers/net/wireless/orinoco/hw.h +1 -0
@@ -25,6 +25,7 @@ struct dev_addr_list;int determine_fw_capabilities (struct orinoco_private *priv);int orinoco_hw_read_card_settings (struct orinoco_private *priv,u8 *dev_addr); +int orinoco_hw_allocate_fid (struct orinoco_private *priv);int orinoco_get_bitratemode (int bitrate,int automatic);void orinoco_get_ratemode_cfg (int ratemode,int *bitrate,int *automatic);
drivers/net/wireless/orinoco/main.c +2 -23
@@ -147,7 +147,6 @@ static const u8 encaps_hdr[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00};* how many events the * device could * legitimately generate */ -#define TX_NICBUF_SIZE_BUG 1585/* Bug in Symbol firmware */ #define DUMMY_FID 0xFFFF
@@ -1574,26 +1573,6 @@ int __orinoco_down(struct net_device *dev) }EXPORT_SYMBOL (__orinoco_down); -static int orinoco_allocate_fid (struct net_device *dev) -{ -struct orinoco_private *priv =netdev_priv (dev); -struct hermes *hw = &priv->hw; -int err; - - err =hermes_allocate (hw, priv->nicbuf_size, &priv->txfid); -if (err == -EIO && priv->nicbuf_size >TX_NICBUF_SIZE_BUG ) { -/* Try workaround for old Symbol firmware bug */ - priv->nicbuf_size =TX_NICBUF_SIZE_BUG ; - err =hermes_allocate (hw, priv->nicbuf_size, &priv->txfid); - -printk (KERN_WARNING "%s: firmware ALLOC bug detected " -"(old Symbol firmware?). Work around %s\n" , - dev->name, err ?"failed!" :"ok." ); - } - -return err; -} -int orinoco_reinit_firmware (struct net_device *dev) {struct orinoco_private *priv =netdev_priv (dev);
@@ -1607,7 +1586,7 @@ int orinoco_reinit_firmware(struct net_device *dev) priv->do_fw_download =0 ; }if (!err) - err =orinoco_allocate_fid (dev); + err =orinoco_hw_allocate_fid (priv);return err; }
@@ -2167,7 +2146,7 @@ static int orinoco_init(struct net_device *dev)if (err) goto out; - err =orinoco_allocate_fid (dev); + err =orinoco_hw_allocate_fid (priv);if (err) {printk (KERN_ERR "%s: failed to allocate NIC buffer!\n" , dev->name);
Signature · 1 line
1.6.0.6
PATCH 9/23 orinoco: use dev_err in early initialisation routines
In reply to David KilroyThis allows us to use determine_fw_capabilities, orinoco_hw_read_card_setting and orinoco_hw_allocate_fid prior to netdev registration.
Since dev_dbg only prints if DEBUG is defined (or dynamic debug is enabled), move a couple of the more useful prints up to info.
--- drivers/net/wireless/orinoco/hw.c | 92 +++++++++++++++++-------------------- 1 files changed, 42 insertions(+), 50 deletions(-)
drivers/net/wireless/orinoco/hw.c +42 -50
@@ -3,6 +3,7 @@* See copyright notice in main.c */ #include <linux/kernel.h> +#include <linux/device.h> #include <linux/if_arp.h> #include <linux/ieee80211.h> #include <linux/wireless.h>
@@ -56,10 +57,13 @@ static inline fwtype_t determine_firmware_type(struct comp_id *nic_id)return FIRMWARE_TYPE_INTERSIL ; } -/* Set priv->firmware type, determine firmware properties */ +/* Set priv->firmware type, determine firmware properties +* This function can be called before we have registerred with netdev, +* so all errors go out with dev_* rather than printk +*/ int determine_fw_capabilities (struct orinoco_private *priv) { -struct net_device *dev = priv->ndev; +struct device *dev = priv->dev;hermes_t *hw = &priv->hw;int err;struct comp_id nic_id, sta_id;
@@ -69,8 +73,8 @@ int determine_fw_capabilities(struct orinoco_private *priv)/* Get the hardware version */ err =HERMES_READ_RECORD (hw,USER_BAP ,HERMES_RID_NICID , &nic_id);if (err) { -printk (KERN_ERR "%s: Cannot read hardware identity: error %d\n" , - dev->name, err); +dev_err (dev,"Cannot read hardware identity: error %d\n" , + err);return err; }
@@ -78,17 +82,16 @@ int determine_fw_capabilities(struct orinoco_private *priv)le16_to_cpus (&nic_id.variant);le16_to_cpus (&nic_id.major);le16_to_cpus (&nic_id.minor); -printk (KERN_DEBUG "%s: Hardware identity %04x:%04x:%04x:%04x\n" , - dev->name, nic_id.id, nic_id.variant, - nic_id.major, nic_id.minor); +dev_info (dev,"Hardware identity %04x:%04x:%04x:%04x\n" , + nic_id.id, nic_id.variant, nic_id.major, nic_id.minor); priv->firmware_type =determine_firmware_type (&nic_id);/* Get the firmware version */ err =HERMES_READ_RECORD (hw,USER_BAP ,HERMES_RID_STAID , &sta_id);if (err) { -printk (KERN_ERR "%s: Cannot read station identity: error %d\n" , - dev->name, err); +dev_err (dev,"Cannot read station identity: error %d\n" , + err);return err; }
@@ -96,25 +99,21 @@ int determine_fw_capabilities(struct orinoco_private *priv)le16_to_cpus (&sta_id.variant);le16_to_cpus (&sta_id.major);le16_to_cpus (&sta_id.minor); -printk (KERN_DEBUG "%s: Station identity %04x:%04x:%04x:%04x\n" , - dev->name, sta_id.id, sta_id.variant, - sta_id.major, sta_id.minor); +dev_info (dev,"Station identity %04x:%04x:%04x:%04x\n" , + sta_id.id, sta_id.variant, sta_id.major, sta_id.minor);switch (sta_id.id) {case 0x15 : -printk (KERN_ERR "%s: Primary firmware is active\n" , - dev->name); +dev_err (dev,"Primary firmware is active\n" );return -ENODEV ;case 0x14b : -printk (KERN_ERR "%s: Tertiary firmware is active\n" , - dev->name); +dev_err (dev,"Tertiary firmware is active\n" );return -ENODEV ;case 0x1f :/* Intersil, Agere, Symbol Spectrum24 */ case 0x21 :/* Symbol Spectrum24 Trilogy */ break ;default : -printk (KERN_NOTICE "%s: Unknown station ID, please report\n" , - dev->name); +dev_notice (dev,"Unknown station ID, please report\n" );break ; }
@@ -168,10 +167,8 @@ int determine_fw_capabilities(struct orinoco_private *priv)HERMES_RID_SECONDARYVERSION_SYMBOL , SYMBOL_MAX_VER_LEN, NULL, &tmp);if (err) { -printk (KERN_WARNING -"%s: Error %d reading Symbol firmware info. " -"Wildly guessing capabilities...\n" , - dev->name, err); +dev_warn (dev,"Error %d reading Symbol firmware info. " +"Wildly guessing capabilities...\n" , err); firmver =0 ; tmp[0 ] ='\0' ; }else {
@@ -242,24 +239,24 @@ int determine_fw_capabilities(struct orinoco_private *priv)if (firmver >=0x000800 ) priv->ibss_port =0 ;else { -printk (KERN_NOTICE "%s: Intersil firmware earlier " -"than v0.8.x - several features not supported\n" , - dev->name); +dev_notice (dev,"Intersil firmware earlier than v0.8.x" +" - several features not supported\n" ); priv->ibss_port =1 ; }break ; } -printk (KERN_DEBUG "%s: Firmware determined as %s\n" , dev->name, - priv->fw_name); +dev_info (dev,"Firmware determined as %s\n" , priv->fw_name);return 0 ; }/* Read settings from EEPROM into our private structure. -* MAC address gets dropped into callers buffer */ +* MAC address gets dropped into callers buffer +* Can be called before netdev registration. +*/ int orinoco_hw_read_card_settings (struct orinoco_private *priv,u8 *dev_addr) { -struct net_device *dev = priv->ndev; +struct device *dev = priv->dev;struct hermes_idstring nickbuf;hermes_t *hw = &priv->hw;int len;
@@ -270,20 +267,17 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr) err =hermes_read_ltv (hw,USER_BAP ,HERMES_RID_CNFOWNMACADDR ,ETH_ALEN ,NULL , dev_addr);if (err) { -printk (KERN_WARNING "%s: failed to read MAC address!\n" , - dev->name); +dev_warn (dev,"Failed to read MAC address!\n" ); goto out; } -printk (KERN_DEBUG "%s: MAC address %pM\n" , - dev->name, dev_addr); +dev_dbg (dev,"MAC address %pM\n" , dev_addr);/* Get the station name */ err =hermes_read_ltv (hw,USER_BAP ,HERMES_RID_CNFOWNNAME ,sizeof (nickbuf), &reclen, &nickbuf);if (err) { -printk (KERN_ERR "%s: failed to read station name\n" , - dev->name); +dev_err (dev,"failed to read station name\n" ); goto out; }if (nickbuf.len)
@@ -293,14 +287,13 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr)memcpy (priv->nick, &nickbuf.val, len); priv->nick[len] ='\0' ; -printk (KERN_DEBUG "%s: Station name \"%s\"\n" , dev->name, priv->nick); +dev_dbg (dev,"Station name \"%s\"\n" , priv->nick);/* Get allowed channels */ err =hermes_read_wordrec (hw,USER_BAP ,HERMES_RID_CHANNELLIST , &priv->channel_mask);if (err) { -printk (KERN_ERR "%s: failed to read channel list!\n" , - dev->name); +dev_err (dev,"Failed to read channel list!\n" ); goto out; }
@@ -314,8 +307,7 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr) err =hermes_read_wordrec (hw,USER_BAP ,HERMES_RID_CNFRTSTHRESHOLD , &priv->rts_thresh);if (err) { -printk (KERN_ERR "%s: failed to read RTS threshold!\n" , - dev->name); +dev_err (dev,"Failed to read RTS threshold!\n" ); goto out; }
@@ -329,8 +321,7 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr)HERMES_RID_CNFFRAGMENTATIONTHRESHOLD , &priv->frag_thresh);if (err) { -printk (KERN_ERR "%s: failed to read fragmentation settings!\n" , - dev->name); +dev_err (dev,"Failed to read fragmentation settings!\n" ); goto out; }
@@ -342,16 +333,16 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr)HERMES_RID_CNFMAXSLEEPDURATION , &priv->pm_period);if (err) { -printk (KERN_ERR "%s: failed to read power management " -"period!\n" , dev->name); +dev_err (dev,"Failed to read power management " +"period!\n" ); goto out; } err =hermes_read_wordrec (hw,USER_BAP ,HERMES_RID_CNFPMHOLDOVERDURATION , &priv->pm_timeout);if (err) { -printk (KERN_ERR "%s: failed to read power management " -"timeout!\n" , dev->name); +dev_err (dev,"Failed to read power management " +"timeout!\n" ); goto out; } }
@@ -367,9 +358,10 @@ out:return err; } +/* Can be called before netdev registration */ int orinoco_hw_allocate_fid (struct orinoco_private *priv) { -struct net_device *dev = priv->ndev; +struct device *dev = priv->dev;struct hermes *hw = &priv->hw;int err;
@@ -379,9 +371,9 @@ int orinoco_hw_allocate_fid(struct orinoco_private *priv) priv->nicbuf_size =TX_NICBUF_SIZE_BUG ; err =hermes_allocate (hw, priv->nicbuf_size, &priv->txfid); -printk (KERN_WARNING "%s: firmware ALLOC bug detected " -"(old Symbol firmware?). Work around %s\n" , - dev->name, err ?"failed!" :"ok." ); +dev_warn (dev,"Firmware ALLOC bug detected " +"(old Symbol firmware?). Work around %s\n" , + err ?"failed!" :"ok." ); }return err;
Signature · 1 line
1.6.0.6
PATCH 10/23 orinoco: firmware helpers should use dev_err and friends
In reply to David KilroyWe should be able to call these routines before we register with netdev, so avoid printks using the netdev name.
--- drivers/net/wireless/orinoco/fw.c | 41 +++++++++++++++--------------------- 1 files changed, 17 insertions(+), 24 deletions(-)
drivers/net/wireless/orinoco/fw.c +17 -24
@@ -4,6 +4,7 @@*/ #include <linux/kernel.h> #include <linux/firmware.h> +#include <linux/device.h> #include "hermes.h" #include "hermes_dld.h"
@@ -99,7 +100,7 @@ orinoco_dl_firmware(struct orinoco_private *priv,const void *end;const char *firmware;const char *fw_err; -struct net_device *dev = priv->ndev; +struct device *dev = priv->dev;int err =0 ; pda =kzalloc (fw->pda_size,GFP_KERNEL );
@@ -111,12 +112,11 @@ orinoco_dl_firmware(struct orinoco_private *priv,else firmware = fw->sta_fw; -printk (KERN_DEBUG "%s: Attempting to download firmware %s\n" , - dev->name, firmware); +dev_dbg (dev,"Attempting to download firmware %s\n" , firmware);/* Read current plug data */ err =hermes_read_pda (hw, pda, fw->pda_addr, fw->pda_size,0 ); -printk (KERN_DEBUG "%s: Read PDA returned %d\n" , dev->name, err); +dev_dbg (dev,"Read PDA returned %d\n" , err);if (err) goto free;
@@ -124,8 +124,7 @@ orinoco_dl_firmware(struct orinoco_private *priv, err =request_firmware (&fw_entry, firmware, priv->dev);if (err) { -printk (KERN_ERR "%s: Cannot find firmware %s\n" , - dev->name, firmware); +dev_err (dev,"Cannot find firmware %s\n" , firmware); err = -ENOENT ; goto free; }
@@ -136,16 +135,15 @@ orinoco_dl_firmware(struct orinoco_private *priv, fw_err =validate_fw (hdr, fw_entry->size);if (fw_err) { -printk (KERN_WARNING "%s: Invalid firmware image detected (%s). " -"Aborting download\n" , - dev->name, fw_err); +dev_warn (dev,"Invalid firmware image detected (%s). " +"Aborting download\n" , fw_err); err = -EINVAL ; goto abort; }/* Enable aux port to allow programming */ err =hermesi_program_init (hw,le32_to_cpu (hdr->entry_point)); -printk (KERN_DEBUG "%s: Program init returned %d\n" , dev->name, err); +dev_dbg (dev,"Program init returned %d\n" , err);if (err !=0 ) goto abort;
@@ -156,7 +154,7 @@ orinoco_dl_firmware(struct orinoco_private *priv, end = fw_entry->data + fw_entry->size; err =hermes_program (hw, first_block, end); -printk (KERN_DEBUG "%s: Program returned %d\n" , dev->name, err); +dev_dbg (dev,"Program returned %d\n" , err);if (err !=0 ) goto abort;
@@ -167,19 +165,18 @@ orinoco_dl_firmware(struct orinoco_private *priv, err =hermes_apply_pda_with_defaults (hw, first_block, end, pda, &pda[fw->pda_size /sizeof (*pda)]); -printk (KERN_DEBUG "%s: Apply PDA returned %d\n" , dev->name, err); +dev_dbg (dev,"Apply PDA returned %d\n" , err);if (err) goto abort;/* Tell card we've finished */ err =hermesi_program_end (hw); -printk (KERN_DEBUG "%s: Program end returned %d\n" , dev->name, err); +dev_dbg (dev,"Program end returned %d\n" , err);if (err !=0 ) goto abort;/* Check if we're running */ -printk (KERN_DEBUG "%s: hermes_present returned %d\n" , - dev->name,hermes_present (hw)); +dev_dbg (dev,"hermes_present returned %d\n" ,hermes_present (hw)); abort:/* If we requested the firmware, release it. */
@@ -282,14 +279,13 @@ static int symbol_dl_firmware(struct orinoco_private *priv, const struct fw_info *fw) { - struct net_device *dev = priv->ndev; + struct device *dev = priv->dev;int ret;const struct firmware *fw_entry;if (!orinoco_cached_fw_get (priv, true)) {if (request_firmware (&fw_entry, fw->pri_fw, priv->dev) !=0 ) { -printk (KERN_ERR "%s: Cannot find firmware: %s\n" , - dev->name, fw->pri_fw); +dev_err (dev,"Cannot find firmware: %s\n" , fw->pri_fw);return -ENOENT ; } }else
@@ -302,15 +298,13 @@ symbol_dl_firmware(struct orinoco_private *priv,if (!orinoco_cached_fw_get (priv, true))release_firmware (fw_entry);if (ret) { -printk (KERN_ERR "%s: Primary firmware download failed\n" , - dev->name); +dev_err (dev,"Primary firmware download failed\n" );return ret; }if (!orinoco_cached_fw_get (priv, false)) {if (request_firmware (&fw_entry, fw->sta_fw, priv->dev) !=0 ) { -printk (KERN_ERR "%s: Cannot find firmware: %s\n" , - dev->name, fw->sta_fw); +dev_err (dev,"Cannot find firmware: %s\n" , fw->sta_fw);return -ENOENT ; } }else
@@ -322,8 +316,7 @@ symbol_dl_firmware(struct orinoco_private *priv,if (!orinoco_cached_fw_get (priv, false))release_firmware (fw_entry);if (ret) { -printk (KERN_ERR "%s: Secondary firmware download failed\n" , - dev->name); +dev_err (dev,"Secondary firmware download failed\n" ); }return ret;
Signature · 1 line
1.6.0.6
PATCH 11/23 orinoco: Replace net_device with orinoco_private in driver interfaces
In reply to David KilroyMove away from using net_device as the main structure in orinoco function calls. Use orinoco_private instead.
This makes more sense when we move to cfg80211, and we get wiphys as well.
--- drivers/net/wireless/orinoco/airport.c | 36 +++++++++++----------- drivers/net/wireless/orinoco/main.c | 31 +++++++++---------- drivers/net/wireless/orinoco/orinoco.h | 10 +++--- drivers/net/wireless/orinoco/orinoco_cs.c | 39 +++++++++++------------- drivers/net/wireless/orinoco/orinoco_nortel.c | 24 +++++++------- drivers/net/wireless/orinoco/orinoco_pci.c | 24 +++++++------- drivers/net/wireless/orinoco/orinoco_pci.h | 18 +++++----- drivers/net/wireless/orinoco/orinoco_plx.c | 24 +++++++------- drivers/net/wireless/orinoco/orinoco_tmd.c | 24 +++++++------- drivers/net/wireless/orinoco/spectrum_cs.c | 41 +++++++++++------------- 10 files changed, 132 insertions(+), 139 deletions(-)
drivers/net/wireless/orinoco/airport.c +18 -18
@@ -34,8 +34,8 @@ struct airport {static int airport_suspend (struct macio_dev *mdev,pm_message_t state) { -struct net_device *dev =dev_get_drvdata (&mdev->ofdev.dev); -struct orinoco_private *priv =netdev_priv (dev); +struct orinoco_private *priv =dev_get_drvdata (&mdev->ofdev.dev); +struct net_device *dev = priv->ndev;unsigned long flags;int err;
@@ -48,7 +48,7 @@ airport_suspend(struct macio_dev *mdev, pm_message_t state)return 0 ; } - err =__orinoco_down (dev); + err =__orinoco_down (priv);if (err)printk (KERN_WARNING "%s: PBOOK_SLEEP_NOW: Error %d downing interface\n" , dev->name, err);
@@ -69,8 +69,8 @@ airport_suspend(struct macio_dev *mdev, pm_message_t state)static int airport_resume (struct macio_dev *mdev) { -struct net_device *dev =dev_get_drvdata (&mdev->ofdev.dev); -struct orinoco_private *priv =netdev_priv (dev); +struct orinoco_private *priv =dev_get_drvdata (&mdev->ofdev.dev); +struct net_device *dev = priv->ndev;unsigned long flags;int err;
@@ -82,7 +82,7 @@ airport_resume(struct macio_dev *mdev)enable_irq (dev->irq); - err =orinoco_reinit_firmware (dev); + err =orinoco_reinit_firmware (priv);if (err) {printk (KERN_ERR "%s: Error %d re-initializing firmware on PBOOK_WAKE\n" , dev->name, err);
@@ -96,7 +96,7 @@ airport_resume(struct macio_dev *mdev) priv->hw_unavailable--;if (priv->open && (!priv->hw_unavailable)) { - err =__orinoco_up (dev); + err =__orinoco_up (priv);if (err)printk (KERN_ERR "%s: Error %d restarting card on PBOOK_WAKE\n" , dev->name, err);
@@ -111,8 +111,8 @@ airport_resume(struct macio_dev *mdev)static int airport_detach (struct macio_dev *mdev) { -struct net_device *dev =dev_get_drvdata (&mdev->ofdev.dev); -struct orinoco_private *priv =netdev_priv (dev); +struct orinoco_private *priv =dev_get_drvdata (&mdev->ofdev.dev); +struct net_device *dev = priv->ndev;struct airport *card = priv->card;if (card->ndev_registered)
@@ -120,7 +120,7 @@ airport_detach(struct macio_dev *mdev) card->ndev_registered =0 ;if (card->irq_requested) -free_irq (dev->irq, dev); +free_irq (dev->irq, priv); card->irq_requested =0 ;if (card->vaddr)
@@ -134,7 +134,7 @@ airport_detach(struct macio_dev *mdev)ssleep (1 );macio_set_drvdata (mdev,NULL ); -free_orinocodev (dev); +free_orinocodev (priv);return 0 ; }
@@ -185,13 +185,13 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match) }/* Allocate space for private device-specific data */ - dev =alloc_orinocodev (sizeof (*card), &mdev->ofdev.dev, - airport_hard_reset,NULL ); -if (!dev) { + priv =alloc_orinocodev (sizeof (*card), &mdev->ofdev.dev, + airport_hard_reset,NULL ); +if (!priv) { printk(KERN_ERR PFX "Cannot allocate network device\n");return -ENODEV ; } - priv =netdev_priv (dev); + dev = priv->ndev; card = priv->card; hw = &priv->hw;
@@ -199,13 +199,13 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match)if (macio_request_resource (mdev,0 ,"airport" )) { printk(KERN_ERR PFX "can't request IO resource !\n"); -free_orinocodev (dev); +free_orinocodev (priv);return -EBUSY ; }SET_NETDEV_DEV (dev, &mdev->ofdev.dev); -macio_set_drvdata (mdev, dev); +macio_set_drvdata (mdev, priv);/* Setup interrupts & base address */ dev->irq =macio_irq (mdev,0 );
@@ -228,7 +228,7 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match)/* Reset it before we get the interrupt */ hermes_init (hw); -if (request_irq (dev->irq, orinoco_interrupt,0 , dev->name, dev)) { +if (request_irq (dev->irq, orinoco_interrupt,0 , dev->name, priv)) { printk(KERN_ERR PFX "Couldn't get IRQ %d\n", dev->irq); goto failed; }
drivers/net/wireless/orinoco/main.c +15 -16
@@ -252,7 +252,7 @@ static int orinoco_open(struct net_device *dev)if (orinoco_lock (priv, &flags) !=0 )return -EBUSY ; - err =__orinoco_up (dev); + err =__orinoco_up (priv);if (!err) priv->open =1 ;
@@ -274,7 +274,7 @@ static int orinoco_stop(struct net_device *dev) priv->open =0 ; - err =__orinoco_down (dev); + err =__orinoco_down (priv);spin_unlock_irq (&priv->lock);
@@ -1511,9 +1511,9 @@ static void __orinoco_ev_infdrop(struct net_device *dev, hermes_t *hw)/* Internal hardware control routines */ /********************************************************************/ -int __orinoco_up (struct net_device *dev) +int __orinoco_up (struct orinoco_private *priv) { -struct orinoco_private *priv =netdev_priv (dev); +struct net_device *dev = priv->ndev;struct hermes *hw = &priv->hw;int err;
@@ -1541,9 +1541,9 @@ int __orinoco_up(struct net_device *dev) }EXPORT_SYMBOL (__orinoco_up); -int __orinoco_down (struct net_device *dev) +int __orinoco_down (struct orinoco_private *priv) { -struct orinoco_private *priv =netdev_priv (dev); +struct net_device *dev = priv->ndev;struct hermes *hw = &priv->hw;int err;
@@ -1573,9 +1573,8 @@ int __orinoco_down(struct net_device *dev) }EXPORT_SYMBOL (__orinoco_down); -int orinoco_reinit_firmware (struct net_device *dev) +int orinoco_reinit_firmware (struct orinoco_private *priv) { -struct orinoco_private *priv =netdev_priv (dev);struct hermes *hw = &priv->hw;int err;
@@ -1887,7 +1886,7 @@ void orinoco_reset(struct work_struct *work) } } - err =orinoco_reinit_firmware (dev); + err =orinoco_reinit_firmware (priv);if (err) {printk (KERN_ERR "%s: orinoco_reset: Error %d re-initializing firmware\n" , dev->name, err);
@@ -1902,7 +1901,7 @@ void orinoco_reset(struct work_struct *work)/* priv->open or priv->hw_unavailable might have changed while * we dropped the lock */ if (priv->open && (!priv->hw_unavailable)) { - err =__orinoco_up (dev); + err =__orinoco_up (priv);if (err) {printk (KERN_ERR "%s: orinoco_reset: Error %d reenabling card\n" , dev->name, err);
@@ -1938,8 +1937,8 @@ static void __orinoco_ev_wterr(struct net_device *dev, hermes_t *hw)irqreturn_t orinoco_interrupt (int irq,void *dev_id) { -struct net_device *dev = dev_id; -struct orinoco_private *priv =netdev_priv (dev); +struct orinoco_private *priv = dev_id; +struct net_device *dev = priv->ndev;hermes_t *hw = &priv->hw;int count =MAX_IRQLOOPS_PER_IRQ ;u16 evstat, events;
@@ -2192,7 +2191,7 @@ static const struct net_device_ops orinoco_netdev_ops = { .ndo_get_stats = orinoco_get_stats, }; -struct net_device +struct orinoco_private *alloc_orinocodev(int sizeof_card, struct device *device, int (*hard_reset)(struct orinoco_private *),
@@ -2255,13 +2254,13 @@ struct net_device/* Register PM notifiers */ orinoco_register_pm_notifier (priv); -return dev; +return priv; }EXPORT_SYMBOL (alloc_orinocodev); -void free_orinocodev (struct net_device *dev) +void free_orinocodev (struct orinoco_private *priv) { -struct orinoco_private *priv =netdev_priv (dev); +struct net_device *dev = priv->ndev;struct orinoco_rx_data *rx_data, *temp;/* If the tasklet is scheduled when we call tasklet_kill it
drivers/net/wireless/orinoco/orinoco.h +5 -5
@@ -182,14 +182,14 @@ extern int orinoco_debug;/* Exported prototypes */ /********************************************************************/ -extern struct net_device *alloc_orinocodev ( +extern struct orinoco_private *alloc_orinocodev (int sizeof_card,struct device *device,int (*hard_reset)(struct orinoco_private *),int (*stop_fw)(struct orinoco_private *,int )); -extern void free_orinocodev (struct net_device *dev); -extern int __orinoco_up (struct net_device *dev); -extern int __orinoco_down (struct net_device *dev); -extern int orinoco_reinit_firmware (struct net_device *dev); +extern void free_orinocodev (struct orinoco_private *priv); +extern int __orinoco_up (struct orinoco_private *priv); +extern int __orinoco_down (struct orinoco_private *priv); +extern int orinoco_reinit_firmware (struct orinoco_private *priv);extern irqreturn_t orinoco_interrupt (int irq,void *dev_id);/********************************************************************/
drivers/net/wireless/orinoco/orinoco_cs.c +18 -21
@@ -106,26 +106,24 @@ orinoco_cs_hard_reset(struct orinoco_private *priv)static int orinoco_cs_probe (struct pcmcia_device *link) { -struct net_device *dev;struct orinoco_private *priv;struct orinoco_pccard *card; - dev =alloc_orinocodev (sizeof (*card), &handle_to_dev (link), - orinoco_cs_hard_reset,NULL ); -if (!dev) + priv =alloc_orinocodev (sizeof (*card), &handle_to_dev (link), + orinoco_cs_hard_reset,NULL ); +if (!priv)return -ENOMEM ; - priv =netdev_priv (dev); card = priv->card;/* Link both structures together */ card->p_dev = link; - link->priv = dev; + link->priv = priv;/* Interrupt setup */ link->irq.Attributes =IRQ_TYPE_DYNAMIC_SHARING |IRQ_HANDLE_PRESENT ; link->irq.IRQInfo1 =IRQ_LEVEL_ID ; link->irq.Handler = orinoco_interrupt; - link->irq.Instance = dev; + link->irq.Instance = priv;/* General socket configuration defaults can go here. In this * client, we assume very little, and rely on the CIS for
@@ -146,14 +144,14 @@ orinoco_cs_probe(struct pcmcia_device *link)*/ static void orinoco_cs_detach (struct pcmcia_device *link) { -struct net_device *dev = link->priv; +struct orinoco_private *priv = link->priv;if (link->dev_node) -unregister_netdev (dev); +unregister_netdev (priv->ndev);orinoco_cs_release (link); -free_orinocodev (dev); +free_orinocodev (priv); }/* orinoco_cs_detach */ /*
@@ -239,9 +237,9 @@ next_entry:static int orinoco_cs_config (struct pcmcia_device *link) { -struct net_device *dev = link->priv; -struct orinoco_private *priv =netdev_priv (dev); +struct orinoco_private *priv = link->priv;struct orinoco_pccard *card = priv->card; +struct net_device *dev = priv->ndev;hermes_t *hw = &priv->hw;int last_fn, last_ret;void __iomem *mem;
@@ -336,8 +334,7 @@ orinoco_cs_config(struct pcmcia_device *link)static void orinoco_cs_release (struct pcmcia_device *link) { -struct net_device *dev = link->priv; -struct orinoco_private *priv =netdev_priv (dev); +struct orinoco_private *priv = link->priv;unsigned long flags;/* We're committed to taking the device away now, so mark the
@@ -353,9 +350,9 @@ orinoco_cs_release(struct pcmcia_device *link)static int orinoco_cs_suspend (struct pcmcia_device *link) { -struct net_device *dev = link->priv; -struct orinoco_private *priv =netdev_priv (dev); +struct orinoco_private *priv = link->priv;struct orinoco_pccard *card = priv->card; +struct net_device *dev = priv->ndev;int err =0 ;unsigned long flags;
@@ -365,7 +362,7 @@ static int orinoco_cs_suspend(struct pcmcia_device *link)if (!test_bit (0 , &card->hard_reset_in_progress)) {spin_lock_irqsave (&priv->lock, flags); - err =__orinoco_down (dev); + err =__orinoco_down (priv);if (err)printk (KERN_WARNING "%s: Error %d downing interface\n" , dev->name, err);
@@ -381,14 +378,14 @@ static int orinoco_cs_suspend(struct pcmcia_device *link)static int orinoco_cs_resume (struct pcmcia_device *link) { -struct net_device *dev = link->priv; -struct orinoco_private *priv =netdev_priv (dev); +struct orinoco_private *priv = link->priv;struct orinoco_pccard *card = priv->card; +struct net_device *dev = priv->ndev;int err =0 ;unsigned long flags;if (!test_bit (0 , &card->hard_reset_in_progress)) { - err =orinoco_reinit_firmware (dev); + err =orinoco_reinit_firmware (priv);if (err) {printk (KERN_ERR "%s: Error %d re-initializing firmware\n" , dev->name, err);
@@ -401,7 +398,7 @@ static int orinoco_cs_resume(struct pcmcia_device *link) priv->hw_unavailable--;if (priv->open && !priv->hw_unavailable) { - err =__orinoco_up (dev); + err =__orinoco_up (priv);if (err)printk (KERN_ERR "%s: Error %d restarting card\n" , dev->name, err);
drivers/net/wireless/orinoco/orinoco_nortel.c +12 -12
@@ -181,15 +181,15 @@ static int orinoco_nortel_init_one(struct pci_dev *pdev, }/* Allocate network device */ - dev =alloc_orinocodev (sizeof (*card), &pdev->dev, - orinoco_nortel_cor_reset,NULL ); -if (!dev) { + priv =alloc_orinocodev (sizeof (*card), &pdev->dev, + orinoco_nortel_cor_reset,NULL ); +if (!priv) { printk(KERN_ERR PFX "Cannot allocate network device\n"); err = -ENOMEM ; goto fail_alloc; } - priv =netdev_priv (dev); + dev = priv->ndev; card = priv->card; card->bridge_io = bridge_io; card->attr_io = attr_io;
@@ -198,7 +198,7 @@ static int orinoco_nortel_init_one(struct pci_dev *pdev,hermes_struct_init (&priv->hw, hermes_io,HERMES_16BIT_REGSPACING ); err =request_irq (pdev->irq, orinoco_interrupt,IRQF_SHARED , - dev->name, dev); + dev->name, priv);if (err) { printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); err = -EBUSY ;
@@ -223,18 +223,18 @@ static int orinoco_nortel_init_one(struct pci_dev *pdev, goto fail; } -pci_set_drvdata (pdev, dev); +pci_set_drvdata (pdev, priv);printk (KERN_DEBUG "%s: " DRIVER_NAME " at %s\n" , dev->name,pci_name (pdev));return 0 ; fail: -free_irq (pdev->irq, dev); +free_irq (pdev->irq, priv); fail_irq:pci_set_drvdata (pdev,NULL ); -free_orinocodev (dev); +free_orinocodev (priv); fail_alloc:pci_iounmap (pdev, hermes_io);
@@ -256,17 +256,17 @@ static int orinoco_nortel_init_one(struct pci_dev *pdev, static void __devexit orinoco_nortel_remove_one(struct pci_dev *pdev) { -struct net_device *dev =pci_get_drvdata (pdev); -struct orinoco_private *priv =netdev_priv (dev); +struct orinoco_private *priv =pci_get_drvdata (pdev); +struct net_device *dev = priv->ndev;struct orinoco_pci_card *card = priv->card;/* Clear LEDs */ iowrite16 (0 , card->bridge_io +10 );unregister_netdev (dev); -free_irq (pdev->irq, dev); +free_irq (pdev->irq, priv);pci_set_drvdata (pdev,NULL ); -free_orinocodev (dev); +free_orinocodev (priv);pci_iounmap (pdev, priv->hw.iobase);pci_iounmap (pdev, card->attr_io);pci_iounmap (pdev, card->bridge_io);
drivers/net/wireless/orinoco/orinoco_pci.c +12 -12
@@ -139,22 +139,22 @@ static int orinoco_pci_init_one(struct pci_dev *pdev, }/* Allocate network device */ - dev =alloc_orinocodev (sizeof (*card), &pdev->dev, - orinoco_pci_cor_reset,NULL ); -if (!dev) { + priv =alloc_orinocodev (sizeof (*card), &pdev->dev, + orinoco_pci_cor_reset,NULL ); +if (!priv) { printk(KERN_ERR PFX "Cannot allocate network device\n"); err = -ENOMEM ; goto fail_alloc; } - priv =netdev_priv (dev); + dev = priv->ndev; card = priv->card;SET_NETDEV_DEV (dev, &pdev->dev);hermes_struct_init (&priv->hw, hermes_io,HERMES_32BIT_REGSPACING ); err =request_irq (pdev->irq, orinoco_interrupt,IRQF_SHARED , - dev->name, dev); + dev->name, priv);if (err) { printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); err = -EBUSY ;
@@ -173,18 +173,18 @@ static int orinoco_pci_init_one(struct pci_dev *pdev, goto fail; } -pci_set_drvdata (pdev, dev); +pci_set_drvdata (pdev, priv);printk (KERN_DEBUG "%s: " DRIVER_NAME " at %s\n" , dev->name,pci_name (pdev));return 0 ; fail: -free_irq (pdev->irq, dev); +free_irq (pdev->irq, priv); fail_irq:pci_set_drvdata (pdev,NULL ); -free_orinocodev (dev); +free_orinocodev (priv); fail_alloc:pci_iounmap (pdev, hermes_io);
@@ -200,13 +200,13 @@ static int orinoco_pci_init_one(struct pci_dev *pdev, static void __devexit orinoco_pci_remove_one(struct pci_dev *pdev) { -struct net_device *dev =pci_get_drvdata (pdev); -struct orinoco_private *priv =netdev_priv (dev); +struct orinoco_private *priv =pci_get_drvdata (pdev); +struct net_device *dev = priv->ndev;unregister_netdev (dev); -free_irq (pdev->irq, dev); +free_irq (pdev->irq, priv);pci_set_drvdata (pdev,NULL ); -free_orinocodev (dev); +free_orinocodev (priv);pci_iounmap (pdev, priv->hw.iobase);pci_release_regions (pdev);pci_disable_device (pdev);
drivers/net/wireless/orinoco/orinoco_pci.h +9 -9
@@ -21,8 +21,8 @@ struct orinoco_pci_card {#ifdef CONFIG_PM static int orinoco_pci_suspend (struct pci_dev *pdev,pm_message_t state) { -struct net_device *dev =pci_get_drvdata (pdev); -struct orinoco_private *priv =netdev_priv (dev); +struct orinoco_private *priv =pci_get_drvdata (pdev); +struct net_device *dev = priv->ndev;unsigned long flags;int err;
@@ -33,7 +33,7 @@ static int orinoco_pci_suspend(struct pci_dev *pdev, pm_message_t state)return err; } - err =__orinoco_down (dev); + err =__orinoco_down (priv);if (err)printk (KERN_WARNING "%s: error %d bringing interface down " "for suspend\n" , dev->name, err);
@@ -44,7 +44,7 @@ static int orinoco_pci_suspend(struct pci_dev *pdev, pm_message_t state)orinoco_unlock (priv, &flags); -free_irq (pdev->irq, dev); +free_irq (pdev->irq, priv);pci_save_state (pdev);pci_disable_device (pdev);pci_set_power_state (pdev, PCI_D3hot);
@@ -54,8 +54,8 @@ static int orinoco_pci_suspend(struct pci_dev *pdev, pm_message_t state)static int orinoco_pci_resume (struct pci_dev *pdev) { -struct net_device *dev =pci_get_drvdata (pdev); -struct orinoco_private *priv =netdev_priv (dev); +struct orinoco_private *priv =pci_get_drvdata (pdev); +struct net_device *dev = priv->ndev;unsigned long flags;int err;
@@ -69,7 +69,7 @@ static int orinoco_pci_resume(struct pci_dev *pdev)pci_restore_state (pdev); err =request_irq (pdev->irq, orinoco_interrupt,IRQF_SHARED , - dev->name, dev); + dev->name, priv);if (err) {printk (KERN_ERR "%s: cannot re-allocate IRQ on resume\n" , dev->name);
@@ -77,7 +77,7 @@ static int orinoco_pci_resume(struct pci_dev *pdev)return -EBUSY ; } - err =orinoco_reinit_firmware (dev); + err =orinoco_reinit_firmware (priv);if (err) {printk (KERN_ERR "%s: error %d re-initializing firmware " "on resume\n" , dev->name, err);
@@ -91,7 +91,7 @@ static int orinoco_pci_resume(struct pci_dev *pdev) priv->hw_unavailable--;if (priv->open && (!priv->hw_unavailable)) { - err =__orinoco_up (dev); + err =__orinoco_up (priv);if (err)printk (KERN_ERR "%s: Error %d restarting card on resume\n" , dev->name, err);
drivers/net/wireless/orinoco/orinoco_plx.c +12 -12
@@ -220,15 +220,15 @@ static int orinoco_plx_init_one(struct pci_dev *pdev, }/* Allocate network device */ - dev =alloc_orinocodev (sizeof (*card), &pdev->dev, - orinoco_plx_cor_reset,NULL ); -if (!dev) { + priv =alloc_orinocodev (sizeof (*card), &pdev->dev, + orinoco_plx_cor_reset,NULL ); +if (!priv) { printk(KERN_ERR PFX "Cannot allocate network device\n"); err = -ENOMEM ; goto fail_alloc; } - priv =netdev_priv (dev); + dev = priv->ndev; card = priv->card; card->bridge_io = bridge_io; card->attr_io = attr_io;
@@ -237,7 +237,7 @@ static int orinoco_plx_init_one(struct pci_dev *pdev,hermes_struct_init (&priv->hw, hermes_io,HERMES_16BIT_REGSPACING ); err =request_irq (pdev->irq, orinoco_interrupt,IRQF_SHARED , - dev->name, dev); + dev->name, priv);if (err) { printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); err = -EBUSY ;
@@ -262,18 +262,18 @@ static int orinoco_plx_init_one(struct pci_dev *pdev, goto fail; } -pci_set_drvdata (pdev, dev); +pci_set_drvdata (pdev, priv);printk (KERN_DEBUG "%s: " DRIVER_NAME " at %s\n" , dev->name,pci_name (pdev));return 0 ; fail: -free_irq (pdev->irq, dev); +free_irq (pdev->irq, priv); fail_irq:pci_set_drvdata (pdev,NULL ); -free_orinocodev (dev); +free_orinocodev (priv); fail_alloc:pci_iounmap (pdev, hermes_io);
@@ -295,14 +295,14 @@ static int orinoco_plx_init_one(struct pci_dev *pdev, static void __devexit orinoco_plx_remove_one(struct pci_dev *pdev) { -struct net_device *dev =pci_get_drvdata (pdev); -struct orinoco_private *priv =netdev_priv (dev); +struct orinoco_private *priv =pci_get_drvdata (pdev); +struct net_device *dev = priv->ndev;struct orinoco_pci_card *card = priv->card;unregister_netdev (dev); -free_irq (pdev->irq, dev); +free_irq (pdev->irq, priv);pci_set_drvdata (pdev,NULL ); -free_orinocodev (dev); +free_orinocodev (priv);pci_iounmap (pdev, priv->hw.iobase);pci_iounmap (pdev, card->attr_io);pci_iounmap (pdev, card->bridge_io);
drivers/net/wireless/orinoco/orinoco_tmd.c +12 -12
@@ -124,15 +124,15 @@ static int orinoco_tmd_init_one(struct pci_dev *pdev, }/* Allocate network device */ - dev =alloc_orinocodev (sizeof (*card), &pdev->dev, - orinoco_tmd_cor_reset,NULL ); -if (!dev) { + priv =alloc_orinocodev (sizeof (*card), &pdev->dev, + orinoco_tmd_cor_reset,NULL ); +if (!priv) { printk(KERN_ERR PFX "Cannot allocate network device\n"); err = -ENOMEM ; goto fail_alloc; } - priv =netdev_priv (dev); + dev = priv->ndev; card = priv->card; card->bridge_io = bridge_io;SET_NETDEV_DEV (dev, &pdev->dev);
@@ -140,7 +140,7 @@ static int orinoco_tmd_init_one(struct pci_dev *pdev,hermes_struct_init (&priv->hw, hermes_io,HERMES_16BIT_REGSPACING ); err =request_irq (pdev->irq, orinoco_interrupt,IRQF_SHARED , - dev->name, dev); + dev->name, priv);if (err) { printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); err = -EBUSY ;
@@ -159,18 +159,18 @@ static int orinoco_tmd_init_one(struct pci_dev *pdev, goto fail; } -pci_set_drvdata (pdev, dev); +pci_set_drvdata (pdev, priv);printk (KERN_DEBUG "%s: " DRIVER_NAME " at %s\n" , dev->name,pci_name (pdev));return 0 ; fail: -free_irq (pdev->irq, dev); +free_irq (pdev->irq, priv); fail_irq:pci_set_drvdata (pdev,NULL ); -free_orinocodev (dev); +free_orinocodev (priv); fail_alloc:pci_iounmap (pdev, hermes_io);
@@ -189,14 +189,14 @@ static int orinoco_tmd_init_one(struct pci_dev *pdev, static void __devexit orinoco_tmd_remove_one(struct pci_dev *pdev) { -struct net_device *dev =pci_get_drvdata (pdev); -struct orinoco_private *priv =netdev_priv (dev); +struct orinoco_private *priv =pci_get_drvdata (pdev); +struct net_device *dev = priv->ndev;struct orinoco_pci_card *card = priv->card;unregister_netdev (dev); -free_irq (pdev->irq, dev); +free_irq (pdev->irq, priv);pci_set_drvdata (pdev,NULL ); -free_orinocodev (dev); +free_orinocodev (priv);pci_iounmap (pdev, priv->hw.iobase);pci_iounmap (pdev, card->bridge_io);pci_release_regions (pdev);
drivers/net/wireless/orinoco/spectrum_cs.c +19 -22
111 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 12/23 orinoco: initialise independently of netdev
In reply to David KilroyInitialise the orinoco driver before registerring with netdev, which will help when we get to cfg80211...
--- drivers/net/wireless/orinoco/airport.c | 6 +++ drivers/net/wireless/orinoco/main.c | 44 +++++++++++------------- drivers/net/wireless/orinoco/orinoco.h | 1 + drivers/net/wireless/orinoco/orinoco_cs.c | 6 +++ drivers/net/wireless/orinoco/orinoco_nortel.c | 6 +++ drivers/net/wireless/orinoco/orinoco_pci.c | 6 +++ drivers/net/wireless/orinoco/orinoco_plx.c | 6 +++ drivers/net/wireless/orinoco/orinoco_tmd.c | 6 +++ drivers/net/wireless/orinoco/spectrum_cs.c | 6 +++ 9 files changed, 63 insertions(+), 24 deletions(-)
drivers/net/wireless/orinoco/airport.c +6 -0
@@ -234,6 +234,12 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match) } card->irq_requested =1 ; +/* Initialise the main driver */ +if (orinoco_init (priv) !=0 ) { + printk(KERN_ERR PFX "orinoco_init() failed\n"); + goto failed; + } +/* Tell the stack we exist */ if (register_netdev (dev) !=0 ) { printk(KERN_ERR PFX "register_netdev() failed\n");
drivers/net/wireless/orinoco/main.c +20 -24
105 lines not on this page · raw message
drivers/net/wireless/orinoco/orinoco.h +1 -0
@@ -187,6 +187,7 @@ extern struct orinoco_private *alloc_orinocodev(int (*hard_reset)(struct orinoco_private *), int (*stop_fw)(struct orinoco_private *, int));extern void free_orinocodev (struct orinoco_private *priv); +extern int orinoco_init (struct orinoco_private *priv);extern int __orinoco_up (struct orinoco_private *priv);extern int __orinoco_down (struct orinoco_private *priv);extern int orinoco_reinit_firmware (struct orinoco_private *priv);
drivers/net/wireless/orinoco/orinoco_cs.c +6 -0
@@ -297,6 +297,12 @@ orinoco_cs_config(struct pcmcia_device *link) dev->irq = link->irq.AssignedIRQ; card->node.major = card->node.minor =0 ; +/* Initialise the main driver */ +if (orinoco_init (priv) !=0 ) { + printk(KERN_ERR PFX "orinoco_init() failed\n"); + goto failed; + } +SET_NETDEV_DEV (dev, &handle_to_dev (link));/* Tell the stack we exist */ if (register_netdev (dev) !=0 ) {
drivers/net/wireless/orinoco/orinoco_nortel.c +6 -0
@@ -217,6 +217,12 @@ static int orinoco_nortel_init_one(struct pci_dev *pdev, goto fail; } + err =orinoco_init (priv); +if (err) { + printk(KERN_ERR PFX "orinoco_init() failed\n"); + goto fail; + } + err =register_netdev (dev);if (err) { printk(KERN_ERR PFX "Cannot register network device\n");
drivers/net/wireless/orinoco/orinoco_pci.c +6 -0
@@ -167,6 +167,12 @@ static int orinoco_pci_init_one(struct pci_dev *pdev, goto fail; } + err =orinoco_init (priv); +if (err) { + printk(KERN_ERR PFX "orinoco_init() failed\n"); + goto fail; + } + err =register_netdev (dev);if (err) { printk(KERN_ERR PFX "Cannot register network device\n");
drivers/net/wireless/orinoco/orinoco_plx.c +6 -0
@@ -256,6 +256,12 @@ static int orinoco_plx_init_one(struct pci_dev *pdev, goto fail; } + err =orinoco_init (priv); +if (err) { + printk(KERN_ERR PFX "orinoco_init() failed\n"); + goto fail; + } + err =register_netdev (dev);if (err) { printk(KERN_ERR PFX "Cannot register network device\n");
drivers/net/wireless/orinoco/orinoco_tmd.c +6 -0
@@ -153,6 +153,12 @@ static int orinoco_tmd_init_one(struct pci_dev *pdev, goto fail; } + err =orinoco_init (priv); +if (err) { + printk(KERN_ERR PFX "orinoco_init() failed\n"); + goto fail; + } + err =register_netdev (dev);if (err) { printk(KERN_ERR PFX "Cannot register network device\n");
drivers/net/wireless/orinoco/spectrum_cs.c +6 -0
@@ -368,6 +368,12 @@ spectrum_cs_config(struct pcmcia_device *link)if (spectrum_cs_hard_reset (priv) !=0 ) goto failed; +/* Initialise the main driver */ +if (orinoco_init (priv) !=0 ) { + printk(KERN_ERR PFX "orinoco_init() failed\n"); + goto failed; + } +SET_NETDEV_DEV (dev, &handle_to_dev (link));/* Tell the stack we exist */ if (register_netdev (dev) !=0 ) {
Signature · 1 line
1.6.0.6
PATCH 13/23 orinoco: Change set_tkip to use orinoco_private instead of hermes_t
In reply to David Kilroyhw.h does not include hermes.h, and none of the other functions requires types from that file. Also hermes_t is a (discouraged) typedef so we can't add a forward declaration. Therefore change this function to use orinoco_private.
--- drivers/net/wireless/orinoco/hw.c | 5 +++-- drivers/net/wireless/orinoco/hw.h | 4 ++-- drivers/net/wireless/orinoco/wext.c | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/orinoco/hw.c +3 -2
@@ -677,8 +677,8 @@ int __orinoco_hw_setup_enc(struct orinoco_private *priv)* rsc must be 8 bytes * tsc must be 8 bytes or NULL */ -int __orinoco_hw_set_tkip_key (hermes_t *hw,int key_idx,int set_tx, -u8 *key,u8 *rsc,u8 *tsc) +int __orinoco_hw_set_tkip_key (struct orinoco_private *priv,int key_idx, +int set_tx,u8 *key,u8 *rsc,u8 *tsc) {struct {__le16 idx;
@@ -688,6 +688,7 @@ int __orinoco_hw_set_tkip_key(hermes_t *hw, int key_idx, int set_tx,u8 rx_mic[MIC_KEYLEN ];u8 tsc[IW_ENCODE_SEQ_MAX_SIZE ]; } __attribute__ ((packed)) buf; +hermes_t *hw = &priv->hw;int ret;int err;int k;
drivers/net/wireless/orinoco/hw.h +2 -2
@@ -35,8 +35,8 @@ int orinoco_hw_get_act_bitrate(struct orinoco_private *priv, int *bitrate);int __orinoco_hw_set_wap (struct orinoco_private *priv);int __orinoco_hw_setup_wepkeys (struct orinoco_private *priv);int __orinoco_hw_setup_enc (struct orinoco_private *priv); -int __orinoco_hw_set_tkip_key (hermes_t *hw,int key_idx,int set_tx, -u8 *key,u8 *rsc,u8 *tsc); +int __orinoco_hw_set_tkip_key (struct orinoco_private *priv,int key_idx, +int set_tx,u8 *key,u8 *rsc,u8 *tsc);int orinoco_clear_tkip_key (struct orinoco_private *priv,int key_idx); int __orinoco_hw_set_multicast_list(struct orinoco_private *priv, struct dev_addr_list *mc_list,
drivers/net/wireless/orinoco/wext.c +1 -2
@@ -1079,7 +1079,6 @@ static int orinoco_ioctl_set_encodeext(struct net_device *dev,case IW_ENCODE_ALG_TKIP : { -hermes_t *hw = &priv->hw;u8 *tkip_iv =NULL ; if (!priv->has_wpa ||
@@ -1094,7 +1093,7 @@ static int orinoco_ioctl_set_encodeext(struct net_device *dev,if (ext->ext_flags &IW_ENCODE_EXT_RX_SEQ_VALID ) tkip_iv = &ext->rx_seq[0 ]; - err =__orinoco_hw_set_tkip_key (hw, idx, + err =__orinoco_hw_set_tkip_key (priv, idx, ext->ext_flags &IW_ENCODE_EXT_SET_TX_KEY , (u8 *) &priv->tkip_key[idx], tkip_iv,NULL );
Signature · 1 line
1.6.0.6
PATCH 14/23 orinoco: initiate cfg80211 conversion
In reply to David KilroyInitialise and register a wiphy.
Store the orinoco_private structure in the new wiphy, and use the net_device private area to store the wireless_dev. This results in a change to the way we navigate from a net_device to the driver private orinoco_private, which we encapsulate in the inline function ndev_priv. Most of the remaining calls to netdev_priv are thus replaced by ndev_priv.
We can immediately rely on cfg80211 to handle SIOCGIWNAME, so orinoco_ioctl_getname is removed.
--- drivers/net/wireless/orinoco/Kconfig | 1 + drivers/net/wireless/orinoco/Makefile | 2 +- drivers/net/wireless/orinoco/cfg.c | 98 ++++++++++++++++++++++++++++ drivers/net/wireless/orinoco/cfg.h | 15 ++++ drivers/net/wireless/orinoco/main.c | 108 ++++++++++++++++++++++++------- drivers/net/wireless/orinoco/orinoco.h | 11 +++ drivers/net/wireless/orinoco/wext.c | 110 +++++++++++++------------------ 7 files changed, 256 insertions(+), 89 deletions(-) create mode 100644 drivers/net/wireless/orinoco/cfg.c create mode 100644 drivers/net/wireless/orinoco/cfg.h
drivers/net/wireless/orinoco/Kconfig +1 -0
@@ -1,6 +1,7 @@ config HERMES tristate "Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)" depends on (PPC_PMAC || PCI || PCMCIA) && WLAN_80211 + depends on CFG80211 select WIRELESS_EXT select FW_LOADER select CRYPTO
drivers/net/wireless/orinoco/Makefile +1 -1
@@ -1,7 +1,7 @@ # # Makefile for the orinoco wireless device drivers. # -orinoco-objs := main.o fw.o hw.o mic.o scan.o wext.o hermes_dld.o hermes.o +orinoco-objs := main.o fw.o hw.o mic.o scan.o wext.o hermes_dld.o hermes.o cfg.o obj-$(CONFIG_HERMES) += orinoco.o obj-$(CONFIG_PCMCIA_HERMES) += orinoco_cs.o
drivers/net/wireless/orinoco/cfg.c new file +98 -0
98 lines not on this page · raw message
drivers/net/wireless/orinoco/cfg.h new file +15 -0
@@ -0,0 +1,15 @@ +/* cfg80211 support. +* +* See copyright notice in main.c +*/ +#ifndef ORINOCO_CFG_H +#define ORINOCO_CFG_H + +#include <net/cfg80211.h> + +extern const struct cfg80211_ops orinoco_cfg_ops; + +void orinoco_wiphy_init (struct wiphy *wiphy); +int orinoco_wiphy_register (struct wiphy *wiphy); + +#endif /* ORINOCO_CFG_H */
drivers/net/wireless/orinoco/main.c +84 -24
290 lines not on this page · raw message
drivers/net/wireless/orinoco/orinoco.h +11 -0
@@ -14,6 +14,7 @@#include <linux/netdevice.h> #include <linux/wireless.h> #include <net/iw_handler.h> +#include <net/cfg80211.h> #include "hermes.h"
@@ -67,6 +68,10 @@ struct orinoco_private {int (*hard_reset)(struct orinoco_private *);int (*stop_fw)(struct orinoco_private *,int ); +struct ieee80211_supported_band band; +struct ieee80211_channel channels[14 ]; +u32 cipher_suites[3 ]; +/* Synchronisation stuff */ spinlock_t lock;int hw_unavailable;
@@ -216,4 +221,10 @@ static inline void orinoco_unlock(struct orinoco_private *priv, spin_unlock_irqrestore(&priv->lock, *flags); } +/*** Navigate from net_device to orinoco_private ***/ +static inline struct orinoco_private *ndev_priv (struct net_device *dev) +{ +struct wireless_dev *wdev =netdev_priv (dev); +return wdev_priv (wdev); +}#endif /* _ORINOCO_H */
drivers/net/wireless/orinoco/wext.c +46 -64
391 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 15/23 orinoco: make firmware download less verbose
In reply to David KilroyThe firmware download code has been in a couple of releases, without any significant issues reported in this code.
Convert to use pr_debug, so the messages can be recoverred by defining DEBUG.
--- drivers/net/wireless/orinoco/hermes_dld.c | 50 +++++++++++++--------------- 1 files changed, 23 insertions(+), 27 deletions(-)
drivers/net/wireless/orinoco/hermes_dld.c +23 -27
@@ -309,7 +309,7 @@ int hermes_read_pda(hermes_t *hw,/* Open auxiliary port */ ret =hermes_aux_control (hw,1 ); - printk(KERN_DEBUG PFX "AUX enable returned %d\n", ret); +pr_debug (PFX "AUX enable returned %d\n" , ret);if (ret)return ret;
@@ -319,12 +319,12 @@ int hermes_read_pda(hermes_t *hw,/* Close aux port */ ret =hermes_aux_control (hw,0 ); - printk(KERN_DEBUG PFX "AUX disable returned %d\n", ret); +pr_debug (PFX "AUX disable returned %d\n" , ret);/* Check PDA length */ pda_size =le16_to_cpu (pda[0 ]); - printk(KERN_DEBUG PFX "Actual PDA length %d, Max allowed %d\n", - pda_size, pda_len); +pr_debug (PFX "Actual PDA length %d, Max allowed %d\n" , + pda_size, pda_len);if (pda_size > pda_len)return -EINVAL ;
@@ -422,20 +422,19 @@ int hermesi_program_init(hermes_t *hw, u32 offset)return err; err =hermes_aux_control (hw,1 ); - printk(KERN_DEBUG PFX "AUX enable returned %d\n", err); +pr_debug (PFX "AUX enable returned %d\n" , err);if (err)return err; - printk(KERN_DEBUG PFX "Enabling volatile, EP 0x%08x\n", offset); + pr_debug(KERN_DEBUG PFX "Enabling volatile, EP 0x%08x\n", offset); err =hermes_doicmd_wait (hw,HERMES_PROGRAM_ENABLE_VOLATILE , offset &0xFFFFu , offset >>16 ,0 ,NULL ); - printk(KERN_DEBUG PFX "PROGRAM_ENABLE returned %d\n", - err); +pr_debug (PFX "PROGRAM_ENABLE returned %d\n" , err);return err; }
@@ -454,16 +453,16 @@ int hermesi_program_end(hermes_t *hw) rc =hermes_docmd_wait (hw,HERMES_PROGRAM_DISABLE ,0 , &resp); - printk(KERN_DEBUG PFX "PROGRAM_DISABLE returned %d, " -"r0 0x%04x, r1 0x%04x, r2 0x%04x\n" , - rc, resp.resp0, resp.resp1, resp.resp2); +pr_debug (PFX "PROGRAM_DISABLE returned %d, " +"r0 0x%04x, r1 0x%04x, r2 0x%04x\n" , + rc, resp.resp0, resp.resp1, resp.resp2);if ((rc ==0 ) && ((resp.status &HERMES_STATUS_CMDCODE ) !=HERMES_CMD_DOWNLD )) rc = -EIO ; err =hermes_aux_control (hw,0 ); - printk(KERN_DEBUG PFX "AUX disable returned %d\n", err); +pr_debug (PFX "AUX disable returned %d\n" , err);/* Acknowledge any outstanding command */ hermes_write_regn (hw,EVACK ,0xFFFF );
@@ -496,9 +495,8 @@ int hermes_program(hermes_t *hw, const char *first_block, const void *end)while ((blkaddr !=BLOCK_END ) && (((void *) blk + blklen) <= end)) { - printk(KERN_DEBUG PFX -"Programming block of length %d to address 0x%08x\n" , - blklen, blkaddr); +pr_debug (PFX "Programming block of length %d " +"to address 0x%08x\n" , blklen, blkaddr);#if !LIMIT_PROGRAM_SIZE /* wl_lkm driver splits this into writes of 2000 bytes */
@@ -510,10 +508,9 @@ int hermes_program(hermes_t *hw, const char *first_block, const void *end) addr = blkaddr;while (addr < (blkaddr + blklen)) { - printk(KERN_DEBUG PFX -"Programming subblock of length %d " -"to address 0x%08x. Data @ %p\n" , - len, addr, &blk->data[addr - blkaddr]); +pr_debug (PFX "Programming subblock of length %d " +"to address 0x%08x. Data @ %p\n" , + len, addr, &blk->data[addr - blkaddr]);hermes_aux_setaddr (hw, addr); hermes_write_bytes(hw, HERMES_AUXDATA,
@@ -643,8 +640,8 @@ int hermes_apply_pda_with_defaults(hermes_t *hw, pdi =hermes_find_pdi (first_pdi, record_id, pda_end);if (pdi) - printk(KERN_DEBUG PFX "Found record 0x%04x at %p\n", - record_id, pdi); +pr_debug (PFX "Found record 0x%04x at %p\n" , + record_id, pdi);switch (record_id) {case 0x110 :/* Modem REFDAC values */
@@ -654,9 +651,9 @@ int hermes_apply_pda_with_defaults(hermes_t *hw, default_pdi =NULL ;if (outdoor_pdi) { pdi = outdoor_pdi; - printk(KERN_DEBUG PFX -"Using outdoor record 0x%04x at %p\n" , - record_id + 1, pdi); +pr_debug (PFX +"Using outdoor record 0x%04x at %p\n" , + record_id +1 , pdi); }break ;case 0x5 :/* HWIF Compatiblity */
@@ -684,9 +681,8 @@ int hermes_apply_pda_with_defaults(hermes_t *hw,if (!pdi && default_pdi) {/* Use default */ pdi = default_pdi; - printk(KERN_DEBUG PFX -"Using default record 0x%04x at %p\n" , - record_id, pdi); +pr_debug (PFX "Using default record 0x%04x at %p\n" , + record_id, pdi); }if (pdi) {
Signature · 1 line
1.6.0.6
PATCH 16/23 orinoco: move netdev interface creation to main driver
In reply to David KilroyWith the move to cfg80211 it's nice to keep the hardware operations distinct from the interface, even though we can only support a single interface.
This also means the driver resembles other cfg80211 drivers.
--- drivers/net/wireless/orinoco/airport.c | 23 ++--- drivers/net/wireless/orinoco/main.c | 111 +++++++++++++++++------- drivers/net/wireless/orinoco/orinoco.h | 4 + drivers/net/wireless/orinoco/orinoco_cs.c | 21 ++---- drivers/net/wireless/orinoco/orinoco_nortel.c | 14 +-- drivers/net/wireless/orinoco/orinoco_pci.c | 14 +-- drivers/net/wireless/orinoco/orinoco_plx.c | 14 +-- drivers/net/wireless/orinoco/orinoco_tmd.c | 14 +-- drivers/net/wireless/orinoco/spectrum_cs.c | 22 ++---- 9 files changed, 119 insertions(+), 118 deletions(-)
drivers/net/wireless/orinoco/airport.c +9 -14
@@ -116,7 +116,7 @@ airport_detach(struct macio_dev *mdev)struct airport *card = priv->card;if (card->ndev_registered) -unregister_netdev (dev); +orinoco_if_del (priv); card->ndev_registered =0 ;if (card->irq_requested)
@@ -174,9 +174,9 @@ static int airport_attach(struct macio_dev *mdev, const struct of_device_id *match) { struct orinoco_private *priv; -struct net_device *dev;struct airport *card;unsigned long phys_addr; +unsigned int irq;hermes_t *hw;if (macio_resource_count (mdev) <1 ||macio_irq_count (mdev) <1 ) {
@@ -191,27 +191,23 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match) printk(KERN_ERR PFX "Cannot allocate network device\n");return -ENODEV ; } - dev = priv->ndev; card = priv->card; hw = &priv->hw; card->mdev = mdev; -if (macio_request_resource (mdev,0 ,"airport" )) { +if (macio_request_resource (mdev,0 ,DRIVER_NAME )) { printk(KERN_ERR PFX "can't request IO resource !\n");free_orinocodev (priv);return -EBUSY ; } -SET_NETDEV_DEV (dev, &mdev->ofdev.dev); -macio_set_drvdata (mdev, priv);/* Setup interrupts & base address */ - dev->irq =macio_irq (mdev,0 ); + irq =macio_irq (mdev,0 ); phys_addr =macio_resource_start (mdev,0 );/* Physical address */ printk(KERN_DEBUG PFX "Physical address %lx\n", phys_addr); - dev->base_addr = phys_addr; card->vaddr =ioremap (phys_addr,AIRPORT_IO_LEN );if (!card->vaddr) { printk(KERN_ERR PFX "ioremap() failed\n");
@@ -228,8 +224,8 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match)/* Reset it before we get the interrupt */ hermes_init (hw); -if (request_irq (dev->irq, orinoco_interrupt,0 , dev->name, priv)) { - printk(KERN_ERR PFX "Couldn't get IRQ %d\n", dev->irq); +if (request_irq (irq, orinoco_interrupt,0 ,DRIVER_NAME , priv)) { + printk(KERN_ERR PFX "Couldn't get IRQ %d\n", irq); goto failed; } card->irq_requested =1 ;
@@ -240,12 +236,11 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match) goto failed; } -/* Tell the stack we exist */ -if (register_netdev (dev) !=0 ) { - printk(KERN_ERR PFX "register_netdev() failed\n"); +/* Register an interface with the stack */ +if (orinoco_if_add (priv, phys_addr, irq) !=0 ) { + printk(KERN_ERR PFX "orinoco_if_add() failed\n"); goto failed; } - printk(KERN_DEBUG PFX "Card registered for interface %s\n", dev->name); card->ndev_registered =1 ;return 0 ; failed:
drivers/net/wireless/orinoco/main.c +78 -33
170 lines not on this page · raw message
drivers/net/wireless/orinoco/orinoco.h +4 -0
@@ -193,6 +193,10 @@ extern struct orinoco_private *alloc_orinocodev( int (*stop_fw)(struct orinoco_private *, int));extern void free_orinocodev (struct orinoco_private *priv);extern int orinoco_init (struct orinoco_private *priv); +extern int orinoco_if_add (struct orinoco_private *priv, +unsigned long base_addr, +unsigned int irq); +extern void orinoco_if_del (struct orinoco_private *priv);extern int __orinoco_up (struct orinoco_private *priv);extern int __orinoco_down (struct orinoco_private *priv);extern int orinoco_reinit_firmware (struct orinoco_private *priv);
drivers/net/wireless/orinoco/orinoco_cs.c +6 -15
@@ -147,7 +147,7 @@ static void orinoco_cs_detach(struct pcmcia_device *link)struct orinoco_private *priv = link->priv;if (link->dev_node) -unregister_netdev (priv->ndev); +orinoco_if_del (priv);orinoco_cs_release (link);
@@ -239,7 +239,6 @@ orinoco_cs_config(struct pcmcia_device *link) {struct orinoco_private *priv = link->priv;struct orinoco_pccard *card = priv->card; -struct net_device *dev = priv->ndev;hermes_t *hw = &priv->hw;int last_fn, last_ret;void __iomem *mem;
@@ -293,8 +292,6 @@ orinoco_cs_config(struct pcmcia_device *link) pcmcia_request_configuration(link, &link->conf));/* Ok, we have the configuration, prepare to register the netdev */ - dev->base_addr = link->io.BasePort1; - dev->irq = link->irq.AssignedIRQ; card->node.major = card->node.minor =0 ;/* Initialise the main driver */
@@ -303,25 +300,19 @@ orinoco_cs_config(struct pcmcia_device *link) goto failed; } -SET_NETDEV_DEV (dev, &handle_to_dev (link)); -/* Tell the stack we exist */ -if (register_netdev (dev) !=0 ) { - printk(KERN_ERR PFX "register_netdev() failed\n"); +/* Register an interface with the stack */ +if (orinoco_if_add (priv, link->io.BasePort1, + link->irq.AssignedIRQ) !=0 ) { + printk(KERN_ERR PFX "orinoco_if_add() failed\n"); goto failed; }/* At this point, the dev_node_t structure(s) needs to be * initialized and arranged in a linked list at link->dev_node. */ -strcpy (card->node.dev_name, dev->name); +strcpy (card->node.dev_name, priv->ndev->name); link->dev_node = &card->node;/* link->dev_node being non-NULL is also * used to indicate that the * net_device has been registered */ - -/* Finally, report what we've done */ -printk (KERN_DEBUG "%s: " DRIVER_NAME " at %s, irq %d, io " -"0x%04x-0x%04x\n" , dev->name,dev_name (dev->dev.parent), - link->irq.AssignedIRQ, link->io.BasePort1, - link->io.BasePort1 + link->io.NumPorts1 -1 );return 0 ; cs_failed:
drivers/net/wireless/orinoco/orinoco_nortel.c +4 -10
@@ -144,7 +144,6 @@ static int orinoco_nortel_init_one(struct pci_dev *pdev,int err;struct orinoco_private *priv;struct orinoco_pci_card *card; -struct net_device *dev;void __iomem *hermes_io, *bridge_io, *attr_io; err =pci_enable_device (pdev);
@@ -189,16 +188,14 @@ static int orinoco_nortel_init_one(struct pci_dev *pdev, goto fail_alloc; } - dev = priv->ndev; card = priv->card; card->bridge_io = bridge_io; card->attr_io = attr_io; -SET_NETDEV_DEV (dev, &pdev->dev);hermes_struct_init (&priv->hw, hermes_io,HERMES_16BIT_REGSPACING ); err =request_irq (pdev->irq, orinoco_interrupt,IRQF_SHARED , - dev->name, priv); +DRIVER_NAME , priv);if (err) { printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); err = -EBUSY ;
@@ -223,15 +220,13 @@ static int orinoco_nortel_init_one(struct pci_dev *pdev, goto fail; } - err =register_netdev (dev); + err =orinoco_if_add (priv,0 ,0 );if (err) { - printk(KERN_ERR PFX "Cannot register network device\n"); + printk(KERN_ERR PFX "orinoco_if_add() failed\n"); goto fail; }pci_set_drvdata (pdev, priv); -printk (KERN_DEBUG "%s: " DRIVER_NAME " at %s\n" , dev->name, -pci_name (pdev));return 0 ;
@@ -263,13 +258,12 @@ static int orinoco_nortel_init_one(struct pci_dev *pdev, static void __devexit orinoco_nortel_remove_one(struct pci_dev *pdev) {struct orinoco_private *priv =pci_get_drvdata (pdev); -struct net_device *dev = priv->ndev;struct orinoco_pci_card *card = priv->card;/* Clear LEDs */ iowrite16 (0 , card->bridge_io +10 ); -unregister_netdev (dev); +orinoco_if_del (priv);free_irq (pdev->irq, priv);pci_set_drvdata (pdev,NULL );free_orinocodev (priv);
drivers/net/wireless/orinoco/orinoco_pci.c +4 -10
@@ -116,7 +116,6 @@ static int orinoco_pci_init_one(struct pci_dev *pdev,int err;struct orinoco_private *priv;struct orinoco_pci_card *card; -struct net_device *dev;void __iomem *hermes_io; err =pci_enable_device (pdev);
@@ -147,14 +146,12 @@ static int orinoco_pci_init_one(struct pci_dev *pdev, goto fail_alloc; } - dev = priv->ndev; card = priv->card; -SET_NETDEV_DEV (dev, &pdev->dev);hermes_struct_init (&priv->hw, hermes_io,HERMES_32BIT_REGSPACING ); err =request_irq (pdev->irq, orinoco_interrupt,IRQF_SHARED , - dev->name, priv); +DRIVER_NAME , priv);if (err) { printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); err = -EBUSY ;
@@ -173,15 +170,13 @@ static int orinoco_pci_init_one(struct pci_dev *pdev, goto fail; } - err =register_netdev (dev); + err =orinoco_if_add (priv,0 ,0 );if (err) { - printk(KERN_ERR PFX "Cannot register network device\n"); + printk(KERN_ERR PFX "orinoco_if_add() failed\n"); goto fail; }pci_set_drvdata (pdev, priv); -printk (KERN_DEBUG "%s: " DRIVER_NAME " at %s\n" , dev->name, -pci_name (pdev));return 0 ;
@@ -207,9 +202,8 @@ static int orinoco_pci_init_one(struct pci_dev *pdev, static void __devexit orinoco_pci_remove_one(struct pci_dev *pdev) {struct orinoco_private *priv =pci_get_drvdata (pdev); -struct net_device *dev = priv->ndev; -unregister_netdev (dev); +orinoco_if_del (priv);free_irq (pdev->irq, priv);pci_set_drvdata (pdev,NULL );free_orinocodev (priv);
drivers/net/wireless/orinoco/orinoco_plx.c +4 -10
@@ -183,7 +183,6 @@ static int orinoco_plx_init_one(struct pci_dev *pdev,int err;struct orinoco_private *priv;struct orinoco_pci_card *card; -struct net_device *dev;void __iomem *hermes_io, *attr_io, *bridge_io; err =pci_enable_device (pdev);
@@ -228,16 +227,14 @@ static int orinoco_plx_init_one(struct pci_dev *pdev, goto fail_alloc; } - dev = priv->ndev; card = priv->card; card->bridge_io = bridge_io; card->attr_io = attr_io; -SET_NETDEV_DEV (dev, &pdev->dev);hermes_struct_init (&priv->hw, hermes_io,HERMES_16BIT_REGSPACING ); err =request_irq (pdev->irq, orinoco_interrupt,IRQF_SHARED , - dev->name, priv); +DRIVER_NAME , priv);if (err) { printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); err = -EBUSY ;
@@ -262,15 +259,13 @@ static int orinoco_plx_init_one(struct pci_dev *pdev, goto fail; } - err =register_netdev (dev); + err =orinoco_if_add (priv,0 ,0 );if (err) { - printk(KERN_ERR PFX "Cannot register network device\n"); + printk(KERN_ERR PFX "orinoco_if_add() failed\n"); goto fail; }pci_set_drvdata (pdev, priv); -printk (KERN_DEBUG "%s: " DRIVER_NAME " at %s\n" , dev->name, -pci_name (pdev));return 0 ;
@@ -302,10 +297,9 @@ static int orinoco_plx_init_one(struct pci_dev *pdev, static void __devexit orinoco_plx_remove_one(struct pci_dev *pdev) {struct orinoco_private *priv =pci_get_drvdata (pdev); -struct net_device *dev = priv->ndev;struct orinoco_pci_card *card = priv->card; -unregister_netdev (dev); +orinoco_if_del (priv);free_irq (pdev->irq, priv);pci_set_drvdata (pdev,NULL );free_orinocodev (priv);
drivers/net/wireless/orinoco/orinoco_tmd.c +4 -10
@@ -94,7 +94,6 @@ static int orinoco_tmd_init_one(struct pci_dev *pdev,int err;struct orinoco_private *priv;struct orinoco_pci_card *card; -struct net_device *dev;void __iomem *hermes_io, *bridge_io; err =pci_enable_device (pdev);
@@ -132,15 +131,13 @@ static int orinoco_tmd_init_one(struct pci_dev *pdev, goto fail_alloc; } - dev = priv->ndev; card = priv->card; card->bridge_io = bridge_io; -SET_NETDEV_DEV (dev, &pdev->dev);hermes_struct_init (&priv->hw, hermes_io,HERMES_16BIT_REGSPACING ); err =request_irq (pdev->irq, orinoco_interrupt,IRQF_SHARED , - dev->name, priv); +DRIVER_NAME , priv);if (err) { printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); err = -EBUSY ;
@@ -159,15 +156,13 @@ static int orinoco_tmd_init_one(struct pci_dev *pdev, goto fail; } - err =register_netdev (dev); + err =orinoco_if_add (priv,0 ,0 );if (err) { - printk(KERN_ERR PFX "Cannot register network device\n"); + printk(KERN_ERR PFX "orinoco_if_add() failed\n"); goto fail; }pci_set_drvdata (pdev, priv); -printk (KERN_DEBUG "%s: " DRIVER_NAME " at %s\n" , dev->name, -pci_name (pdev));return 0 ;
@@ -196,10 +191,9 @@ static int orinoco_tmd_init_one(struct pci_dev *pdev, static void __devexit orinoco_tmd_remove_one(struct pci_dev *pdev) {struct orinoco_private *priv =pci_get_drvdata (pdev); -struct net_device *dev = priv->ndev;struct orinoco_pci_card *card = priv->card; -unregister_netdev (dev); +orinoco_if_del (priv);free_irq (pdev->irq, priv);pci_set_drvdata (pdev,NULL );free_orinocodev (priv);
drivers/net/wireless/orinoco/spectrum_cs.c +6 -16
@@ -220,7 +220,7 @@ static void spectrum_cs_detach(struct pcmcia_device *link)struct orinoco_private *priv = link->priv;if (link->dev_node) -unregister_netdev (priv->ndev); +orinoco_if_del (priv);spectrum_cs_release (link);
@@ -306,7 +306,6 @@ spectrum_cs_config(struct pcmcia_device *link) {struct orinoco_private *priv = link->priv;struct orinoco_pccard *card = priv->card; -struct net_device *dev = priv->ndev;hermes_t *hw = &priv->hw;int last_fn, last_ret;void __iomem *mem;
@@ -360,8 +359,6 @@ spectrum_cs_config(struct pcmcia_device *link) pcmcia_request_configuration(link, &link->conf));/* Ok, we have the configuration, prepare to register the netdev */ - dev->base_addr = link->io.BasePort1; - dev->irq = link->irq.AssignedIRQ; card->node.major = card->node.minor =0 ;/* Reset card */
@@ -374,26 +371,19 @@ spectrum_cs_config(struct pcmcia_device *link) goto failed; } -SET_NETDEV_DEV (dev, &handle_to_dev (link)); -/* Tell the stack we exist */ -if (register_netdev (dev) !=0 ) { - printk(KERN_ERR PFX "register_netdev() failed\n"); +/* Register an interface with the stack */ +if (orinoco_if_add (priv, link->io.BasePort1, + link->irq.AssignedIRQ) !=0 ) { + printk(KERN_ERR PFX "orinoco_if_add() failed\n"); goto failed; }/* At this point, the dev_node_t structure(s) needs to be * initialized and arranged in a linked list at link->dev_node. */ -strcpy (card->node.dev_name, dev->name); +strcpy (card->node.dev_name, priv->ndev->name); link->dev_node = &card->node;/* link->dev_node being non-NULL is also * used to indicate that the * net_device has been registered */ - -/* Finally, report what we've done */ -printk (KERN_DEBUG "%s: " DRIVER_NAME " at %s, irq %d, io " -"0x%04x-0x%04x\n" , dev->name,dev_name (dev->dev.parent), - link->irq.AssignedIRQ, link->io.BasePort1, - link->io.BasePort1 + link->io.NumPorts1 -1 ); -return 0 ; cs_failed:
Signature · 1 line
1.6.0.6
PATCH 17/23 airport: store irq in card private structure
In reply to David Kilroy... instead of relying on the net_device fields.
--- drivers/net/wireless/orinoco/airport.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-)
drivers/net/wireless/orinoco/airport.c +12 -12
@@ -27,6 +27,7 @@struct airport {struct macio_dev *mdev;void __iomem *vaddr; +unsigned int irq;int irq_requested;int ndev_registered; };
@@ -36,6 +37,7 @@ airport_suspend(struct macio_dev *mdev, pm_message_t state) {struct orinoco_private *priv =dev_get_drvdata (&mdev->ofdev.dev);struct net_device *dev = priv->ndev; +struct airport *card = priv->card;unsigned long flags;int err;
@@ -59,7 +61,7 @@ airport_suspend(struct macio_dev *mdev, pm_message_t state)orinoco_unlock (priv, &flags); -disable_irq (dev->irq); +disable_irq (card->irq);pmac_call_feature (PMAC_FTR_AIRPORT_ENABLE ,macio_get_of_node (mdev),0 ,0 );
@@ -71,6 +73,7 @@ airport_resume(struct macio_dev *mdev) {struct orinoco_private *priv =dev_get_drvdata (&mdev->ofdev.dev);struct net_device *dev = priv->ndev; +struct airport *card = priv->card;unsigned long flags;int err;
@@ -80,7 +83,7 @@ airport_resume(struct macio_dev *mdev) macio_get_of_node(mdev), 0, 1);msleep (200 ); -enable_irq (dev->irq); +enable_irq (card->irq); err =orinoco_reinit_firmware (priv);if (err) {
@@ -112,7 +115,6 @@ static int airport_detach(struct macio_dev *mdev) {struct orinoco_private *priv =dev_get_drvdata (&mdev->ofdev.dev); -struct net_device *dev = priv->ndev;struct airport *card = priv->card;if (card->ndev_registered)
@@ -120,7 +122,7 @@ airport_detach(struct macio_dev *mdev) card->ndev_registered =0 ;if (card->irq_requested) -free_irq (dev->irq, priv); +free_irq (card->irq, priv); card->irq_requested =0 ;if (card->vaddr)
@@ -146,7 +148,6 @@ static int airport_hard_reset(struct orinoco_private *priv)* re-initialize properly, it falls in a screaming heap * shortly afterwards. */ #if 0 -struct net_device *dev = priv->ndev;struct airport *card = priv->card;/* Vitally important. If we don't do this it seems we get an
@@ -154,7 +155,7 @@ static int airport_hard_reset(struct orinoco_private *priv)* hw_unavailable is already set it doesn't get ACKed, we get * into an interrupt loop and the PMU decides to turn us * off. */ -disable_irq (dev->irq); +disable_irq (card->irq);pmac_call_feature (PMAC_FTR_AIRPORT_ENABLE ,macio_get_of_node (card->mdev),0 ,0 );
@@ -163,7 +164,7 @@ static int airport_hard_reset(struct orinoco_private *priv) macio_get_of_node(card->mdev), 0, 1);ssleep (1 ); -enable_irq (dev->irq); +enable_irq (card->irq);ssleep (1 );#endif
@@ -176,7 +177,6 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match)struct orinoco_private *priv;struct airport *card;unsigned long phys_addr; -unsigned int irq;hermes_t *hw;if (macio_resource_count (mdev) <1 ||macio_irq_count (mdev) <1 ) {
@@ -205,7 +205,7 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match)macio_set_drvdata (mdev, priv);/* Setup interrupts & base address */ - irq =macio_irq (mdev,0 ); + card->irq =macio_irq (mdev,0 ); phys_addr =macio_resource_start (mdev,0 );/* Physical address */ printk(KERN_DEBUG PFX "Physical address %lx\n", phys_addr); card->vaddr =ioremap (phys_addr,AIRPORT_IO_LEN );
@@ -224,8 +224,8 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match)/* Reset it before we get the interrupt */ hermes_init (hw); -if (request_irq (irq, orinoco_interrupt,0 ,DRIVER_NAME , priv)) { - printk(KERN_ERR PFX "Couldn't get IRQ %d\n", irq); +if (request_irq (card->irq, orinoco_interrupt,0 ,DRIVER_NAME , priv)) { + printk(KERN_ERR PFX "Couldn't get IRQ %d\n", card->irq); goto failed; } card->irq_requested =1 ;
@@ -237,7 +237,7 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match) }/* Register an interface with the stack */ -if (orinoco_if_add (priv, phys_addr, irq) !=0 ) { +if (orinoco_if_add (priv, phys_addr, card->irq) !=0 ) { printk(KERN_ERR PFX "orinoco_if_add() failed\n"); goto failed; }
Signature · 1 line
1.6.0.6
PATCH 18/23 orinoco: Handle suspend/restore in core driver
In reply to David KilroyEach device does almost exactly the same things on suspend and resume when upping and downing the interface. So move this logic into a common routine.
--- drivers/net/wireless/orinoco/airport.c | 33 +-------------- drivers/net/wireless/orinoco/main.c | 61 +++++++++++++++++++++++++--- drivers/net/wireless/orinoco/orinoco.h | 5 +- drivers/net/wireless/orinoco/orinoco_cs.c | 44 ++------------------ drivers/net/wireless/orinoco/orinoco_pci.h | 47 +-------------------- drivers/net/wireless/orinoco/spectrum_cs.c | 41 +----------------- 6 files changed, 70 insertions(+), 161 deletions(-)
drivers/net/wireless/orinoco/airport.c +3 -30
@@ -50,15 +50,7 @@ airport_suspend(struct macio_dev *mdev, pm_message_t state)return 0 ; } - err =__orinoco_down (priv); -if (err) -printk (KERN_WARNING "%s: PBOOK_SLEEP_NOW: Error %d downing interface\n" , - dev->name, err); - -netif_device_detach (dev); - - priv->hw_unavailable++; - +orinoco_down (priv);orinoco_unlock (priv, &flags);disable_irq (card->irq);
@@ -85,30 +77,11 @@ airport_resume(struct macio_dev *mdev)enable_irq (card->irq); - err =orinoco_reinit_firmware (priv); -if (err) { -printk (KERN_ERR "%s: Error %d re-initializing firmware on PBOOK_WAKE\n" , - dev->name, err); -return 0 ; - } -spin_lock_irqsave (&priv->lock, flags); - -netif_device_attach (dev); - - priv->hw_unavailable--; - -if (priv->open && (!priv->hw_unavailable)) { - err =__orinoco_up (priv); -if (err) -printk (KERN_ERR "%s: Error %d restarting card on PBOOK_WAKE\n" , - dev->name, err); - } - - + err =orinoco_up (priv);spin_unlock_irqrestore (&priv->lock, flags); -return 0 ; +return err; } static int
drivers/net/wireless/orinoco/main.c +55 -6
99 lines not on this page · raw message
drivers/net/wireless/orinoco/orinoco.h +2 -3
@@ -197,9 +197,8 @@ extern int orinoco_if_add(struct orinoco_private *priv,unsigned long base_addr, unsigned int irq);extern void orinoco_if_del (struct orinoco_private *priv); -extern int __orinoco_up (struct orinoco_private *priv); -extern int __orinoco_down (struct orinoco_private *priv); -extern int orinoco_reinit_firmware (struct orinoco_private *priv); +extern int orinoco_up (struct orinoco_private *priv); +extern void orinoco_down (struct orinoco_private *priv);extern irqreturn_t orinoco_interrupt (int irq,void *dev_id);/********************************************************************/
drivers/net/wireless/orinoco/orinoco_cs.c +4 -40
62 lines not on this page · raw message
drivers/net/wireless/orinoco/orinoco_pci.h +3 -44
67 lines not on this page · raw message
drivers/net/wireless/orinoco/spectrum_cs.c +3 -38
57 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 19/23 orinoco: provide generic commit function
In reply to David KilroyThis allows changes to be commited from cfg80211 functions.
--- drivers/net/wireless/orinoco/hw.c | 227 ++++++++++++++++++++++++++ drivers/net/wireless/orinoco/hw.h | 1 + drivers/net/wireless/orinoco/main.c | 297 ++++++++--------------------------- drivers/net/wireless/orinoco/main.h | 3 +- drivers/net/wireless/orinoco/wext.c | 35 +---- 5 files changed, 294 insertions(+), 269 deletions(-)
drivers/net/wireless/orinoco/hw.c +227 -0
@@ -406,6 +406,233 @@ void orinoco_get_ratemode_cfg(int ratemode, int *bitrate, int *automatic) *automatic = bitrate_table[ratemode].automatic; } +int orinoco_hw_program_rids (struct orinoco_private *priv) +{ +struct net_device *dev = priv->ndev; +hermes_t *hw = &priv->hw; +int err; +struct hermes_idstring idbuf; + +/* Set the MAC address */ + err =hermes_write_ltv (hw,USER_BAP ,HERMES_RID_CNFOWNMACADDR , +HERMES_BYTES_TO_RECLEN (ETH_ALEN ), dev->dev_addr); +if (err) { +printk (KERN_ERR "%s: Error %d setting MAC address\n" , + dev->name, err); +return err; + } + +/* Set up the link mode */ + err =hermes_write_wordrec (hw,USER_BAP ,HERMES_RID_CNFPORTTYPE , + priv->port_type); +if (err) { +printk (KERN_ERR "%s: Error %d setting port type\n" , + dev->name, err); +return err; + } +/* Set the channel/frequency */ +if (priv->channel !=0 && priv->iw_mode !=IW_MODE_INFRA ) { + err =hermes_write_wordrec (hw,USER_BAP , +HERMES_RID_CNFOWNCHANNEL , + priv->channel); +if (err) { +printk (KERN_ERR "%s: Error %d setting channel %d\n" , + dev->name, err, priv->channel); +return err; + } + } + +if (priv->has_ibss) { +u16 createibss; + +if ((strlen (priv->desired_essid) ==0 ) && (priv->createibss)) { +printk (KERN_WARNING "%s: This firmware requires an " +"ESSID in IBSS-Ad-Hoc mode.\n" , dev->name); +/* With wvlan_cs, in this case, we would crash. +* hopefully, this driver will behave better... +* Jean II */ + createibss =0 ; + }else { + createibss = priv->createibss; + } + + err =hermes_write_wordrec (hw,USER_BAP , +HERMES_RID_CNFCREATEIBSS , + createibss); +if (err) { +printk (KERN_ERR "%s: Error %d setting CREATEIBSS\n" , + dev->name, err); +return err; + } + } + +/* Set the desired BSSID */ + err =__orinoco_hw_set_wap (priv); +if (err) { +printk (KERN_ERR "%s: Error %d setting AP address\n" , + dev->name, err); +return err; + } + +/* Set the desired ESSID */ + idbuf.len =cpu_to_le16 (strlen (priv->desired_essid)); +memcpy (&idbuf.val, priv->desired_essid,sizeof (idbuf.val)); +/* WinXP wants partner to configure OWNSSID even in IBSS mode. (jimc) */ + err =hermes_write_ltv (hw,USER_BAP ,HERMES_RID_CNFOWNSSID , +HERMES_BYTES_TO_RECLEN (strlen (priv->desired_essid)+2 ), + &idbuf); +if (err) { +printk (KERN_ERR "%s: Error %d setting OWNSSID\n" , + dev->name, err); +return err; + } + err =hermes_write_ltv (hw,USER_BAP ,HERMES_RID_CNFDESIREDSSID , +HERMES_BYTES_TO_RECLEN (strlen (priv->desired_essid)+2 ), + &idbuf); +if (err) { +printk (KERN_ERR "%s: Error %d setting DESIREDSSID\n" , + dev->name, err); +return err; + } + +/* Set the station name */ + idbuf.len =cpu_to_le16 (strlen (priv->nick)); +memcpy (&idbuf.val, priv->nick,sizeof (idbuf.val)); + err =hermes_write_ltv (hw,USER_BAP ,HERMES_RID_CNFOWNNAME , +HERMES_BYTES_TO_RECLEN (strlen (priv->nick)+2 ), + &idbuf); +if (err) { +printk (KERN_ERR "%s: Error %d setting nickname\n" , + dev->name, err); +return err; + } + +/* Set AP density */ +if (priv->has_sensitivity) { + err =hermes_write_wordrec (hw,USER_BAP , +HERMES_RID_CNFSYSTEMSCALE , + priv->ap_density); +if (err) { +printk (KERN_WARNING "%s: Error %d setting SYSTEMSCALE. " +"Disabling sensitivity control\n" , + dev->name, err); + + priv->has_sensitivity =0 ; + } + } + +/* Set RTS threshold */ + err =hermes_write_wordrec (hw,USER_BAP ,HERMES_RID_CNFRTSTHRESHOLD , + priv->rts_thresh); +if (err) { +printk (KERN_ERR "%s: Error %d setting RTS threshold\n" , + dev->name, err); +return err; + } + +/* Set fragmentation threshold or MWO robustness */ +if (priv->has_mwo) + err =hermes_write_wordrec (hw,USER_BAP , +HERMES_RID_CNFMWOROBUST_AGERE , + priv->mwo_robust); +else + err =hermes_write_wordrec (hw,USER_BAP , +HERMES_RID_CNFFRAGMENTATIONTHRESHOLD , + priv->frag_thresh); +if (err) { +printk (KERN_ERR "%s: Error %d setting fragmentation\n" , + dev->name, err); +return err; + } + +/* Set bitrate */ + err =__orinoco_hw_set_bitrate (priv); +if (err) { +printk (KERN_ERR "%s: Error %d setting bitrate\n" , + dev->name, err); +return err; + } + +/* Set power management */ +if (priv->has_pm) { + err =hermes_write_wordrec (hw,USER_BAP , +HERMES_RID_CNFPMENABLED , + priv->pm_on); +if (err) { +printk (KERN_ERR "%s: Error %d setting up PM\n" , + dev->name, err); +return err; + } + + err =hermes_write_wordrec (hw,USER_BAP , +HERMES_RID_CNFMULTICASTRECEIVE , + priv->pm_mcast); +if (err) { +printk (KERN_ERR "%s: Error %d setting up PM\n" , + dev->name, err); +return err; + } + err =hermes_write_wordrec (hw,USER_BAP , +HERMES_RID_CNFMAXSLEEPDURATION , + priv->pm_period); +if (err) { +printk (KERN_ERR "%s: Error %d setting up PM\n" , + dev->name, err); +return err; + } + err =hermes_write_wordrec (hw,USER_BAP , +HERMES_RID_CNFPMHOLDOVERDURATION , + priv->pm_timeout); +if (err) { +printk (KERN_ERR "%s: Error %d setting up PM\n" , + dev->name, err); +return err; + } + } + +/* Set preamble - only for Symbol so far... */ +if (priv->has_preamble) { + err =hermes_write_wordrec (hw,USER_BAP , +HERMES_RID_CNFPREAMBLE_SYMBOL , + priv->preamble); +if (err) { +printk (KERN_ERR "%s: Error %d setting preamble\n" , + dev->name, err); +return err; + } + } + +/* Set up encryption */ +if (priv->has_wep || priv->has_wpa) { + err =__orinoco_hw_setup_enc (priv); +if (err) { +printk (KERN_ERR "%s: Error %d activating encryption\n" , + dev->name, err); +return err; + } + } + +if (priv->iw_mode ==IW_MODE_MONITOR ) { +/* Enable monitor mode */ + dev->type =ARPHRD_IEEE80211 ; + err =hermes_docmd_wait (hw,HERMES_CMD_TEST | +HERMES_TEST_MONITOR ,0 ,NULL ); + }else { +/* Disable monitor mode */ + dev->type =ARPHRD_ETHER ; + err =hermes_docmd_wait (hw,HERMES_CMD_TEST | +HERMES_TEST_STOP ,0 ,NULL ); + } +if (err) +return err; + +/* Reset promiscuity / multicast*/ + priv->promiscuous =0 ; + priv->mc_count =0 ; + +return 0 ; +} +/* Get tsc from the firmware */ int orinoco_hw_get_tkip_iv (struct orinoco_private *priv,int key,u8 *tsc) {
drivers/net/wireless/orinoco/hw.h +1 -0
@@ -29,6 +29,7 @@ int orinoco_hw_allocate_fid(struct orinoco_private *priv);int orinoco_get_bitratemode (int bitrate,int automatic);void orinoco_get_ratemode_cfg (int ratemode,int *bitrate,int *automatic); +int orinoco_hw_program_rids (struct orinoco_private *priv);int orinoco_hw_get_tkip_iv (struct orinoco_private *priv,int key,u8 *tsc);int __orinoco_hw_set_bitrate (struct orinoco_private *priv);int orinoco_hw_get_act_bitrate (struct orinoco_private *priv,int *bitrate);
drivers/net/wireless/orinoco/main.c +64 -233
329 lines not on this page · raw message
drivers/net/wireless/orinoco/main.h +1 -2
@@ -29,10 +29,9 @@ struct net_device;struct work_struct ;void set_port_type (struct orinoco_private *priv); -int __orinoco_program_rids (struct net_device *dev); +int orinoco_commit (struct orinoco_private *priv);void orinoco_reset (struct work_struct *work); -/* Information element helpers - find a home for these... */ static inline u8 *orinoco_get_ie (u8 *data,size_t len,enum ieee80211_eid eid)
drivers/net/wireless/orinoco/wext.c +1 -34
@@ -2163,49 +2163,16 @@ static int orinoco_ioctl_commit(struct net_device *dev, char *extra) {struct orinoco_private *priv =ndev_priv (dev); -struct hermes *hw = &priv->hw;unsigned long flags;int err =0 ;if (!priv->open)return 0 ; -if (priv->broken_disableport) { -orinoco_reset (&priv->reset_work); -return 0 ; - } -if (orinoco_lock (priv, &flags) !=0 )return err; - err =hermes_disable_port (hw,0 ); -if (err) { -printk (KERN_WARNING "%s: Unable to disable port " -"while reconfiguring card\n" , dev->name); - priv->broken_disableport =1 ; - goto out; - } - - err =__orinoco_program_rids (dev); -if (err) { -printk (KERN_WARNING "%s: Unable to reconfigure card\n" , - dev->name); - goto out; - } - - err =hermes_enable_port (hw,0 ); -if (err) { -printk (KERN_WARNING "%s: Unable to enable port while reconfiguring card\n" , - dev->name); - goto out; - } - - out: -if (err) { -printk (KERN_WARNING "%s: Resetting instead...\n" , dev->name); -schedule_work (&priv->reset_work); - err =0 ; - } + err =orinoco_commit (priv);orinoco_unlock (priv, &flags);return err;
Signature · 1 line
1.6.0.6
PATCH 20/23 orinoco: convert mode setting to cfg80211
In reply to David Kilroy--- drivers/net/wireless/orinoco/cfg.c | 46 +++++++++++++++++++- drivers/net/wireless/orinoco/hw.c | 12 +++-- drivers/net/wireless/orinoco/main.c | 15 +++--- drivers/net/wireless/orinoco/orinoco.h | 2 +- drivers/net/wireless/orinoco/wext.c | 75 +++---------------------------- 5 files changed, 70 insertions(+), 80 deletions(-)
drivers/net/wireless/orinoco/cfg.c +45 -1
@@ -93,6 +93,50 @@ int orinoco_wiphy_register(struct wiphy *wiphy)return wiphy_register (wiphy); } -const struct cfg80211_ops orinoco_cfg_ops = { +static int orinoco_change_vif (struct wiphy *wiphy,struct net_device *dev, +enum nl80211_iftype type,u32 *flags, +struct vif_params *params) +{ +struct orinoco_private *priv =wiphy_priv (wiphy); +int err =0 ; +unsigned long lock; + +if (orinoco_lock (priv, &lock) !=0 ) +return -EBUSY ; + +switch (type) { +case NL80211_IFTYPE_ADHOC : +if (!priv->has_ibss && !priv->has_port3) + err = -EINVAL ; +break ; + +case NL80211_IFTYPE_STATION : +break ; + +case NL80211_IFTYPE_MONITOR : +if (priv->broken_monitor && !force_monitor) { +printk (KERN_WARNING "%s: Monitor mode support is " +"buggy in this firmware, not enabling\n" , +wiphy_name (wiphy)); + err = -EINVAL ; + } +break ; + +default : + err = -EINVAL ; + } +if (!err) { + priv->iw_mode = type; +set_port_type (priv); + err =orinoco_commit (priv); + } + +orinoco_unlock (priv, &lock); + +return err; +} + +const struct cfg80211_ops orinoco_cfg_ops = { + .change_virtual_intf = orinoco_change_vif, };
drivers/net/wireless/orinoco/hw.c +8 -4
@@ -7,7 +7,7 @@#include <linux/if_arp.h> #include <linux/ieee80211.h> #include <linux/wireless.h> - +#include <net/cfg80211.h> #include "hermes.h" #include "hermes_rid.h" #include "orinoco.h"
@@ -409,6 +409,7 @@ void orinoco_get_ratemode_cfg(int ratemode, int *bitrate, int *automatic)int orinoco_hw_program_rids (struct orinoco_private *priv) {struct net_device *dev = priv->ndev; +struct wireless_dev *wdev =netdev_priv (dev);hermes_t *hw = &priv->hw;int err;struct hermes_idstring idbuf;
@@ -431,7 +432,7 @@ int orinoco_hw_program_rids(struct orinoco_private *priv)return err; }/* Set the channel/frequency */ -if (priv->channel !=0 && priv->iw_mode !=IW_MODE_INFRA ) { +if (priv->channel !=0 && priv->iw_mode !=NL80211_IFTYPE_STATION ) { err =hermes_write_wordrec (hw,USER_BAP ,HERMES_RID_CNFOWNCHANNEL , priv->channel);
@@ -612,7 +613,7 @@ int orinoco_hw_program_rids(struct orinoco_private *priv) } } -if (priv->iw_mode ==IW_MODE_MONITOR ) { +if (priv->iw_mode ==NL80211_IFTYPE_MONITOR ) {/* Enable monitor mode */ dev->type =ARPHRD_IEEE80211 ; err = hermes_docmd_wait(hw, HERMES_CMD_TEST |
@@ -630,6 +631,9 @@ int orinoco_hw_program_rids(struct orinoco_private *priv) priv->promiscuous =0 ; priv->mc_count =0 ; +/* Record mode change */ + wdev->iftype = priv->iw_mode; +return 0 ; }
@@ -884,7 +888,7 @@ int __orinoco_hw_setup_enc(struct orinoco_private *priv) }else master_wep_flag =0 ; -if (priv->iw_mode ==IW_MODE_MONITOR ) +if (priv->iw_mode ==NL80211_IFTYPE_MONITOR ) master_wep_flag |=HERMES_WEP_HOST_DECRYPT ;/* Master WEP setting : on/off */
drivers/net/wireless/orinoco/main.c +8 -7
@@ -222,11 +222,11 @@ static int __orinoco_commit(struct orinoco_private *priv);void set_port_type (struct orinoco_private *priv) {switch (priv->iw_mode) { -case IW_MODE_INFRA : +case NL80211_IFTYPE_STATION : priv->port_type =1 ; priv->createibss =0 ;break ; -case IW_MODE_ADHOC : +case NL80211_IFTYPE_ADHOC :if (priv->prefer_port3) { priv->port_type =3 ; priv->createibss =0 ;
@@ -235,7 +235,7 @@ void set_port_type(struct orinoco_private *priv) priv->createibss =1 ; }break ; -case IW_MODE_MONITOR : +case NL80211_IFTYPE_MONITOR : priv->port_type =3 ; priv->createibss =0 ;break ;
@@ -359,7 +359,8 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)return NETDEV_TX_BUSY ; } -if (!netif_carrier_ok (dev) || (priv->iw_mode ==IW_MODE_MONITOR )) { +if (!netif_carrier_ok (dev) || + (priv->iw_mode ==NL80211_IFTYPE_MONITOR )) {/* Oops, the firmware hasn't established a connection, silently drop the packet (this seems to be the safest approach). */
@@ -820,7 +821,7 @@ static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw) }/* Handle frames in monitor mode */ -if (priv->iw_mode ==IW_MODE_MONITOR ) { +if (priv->iw_mode ==NL80211_IFTYPE_MONITOR ) {orinoco_rx_monitor (dev, rxfid, desc); goto out; }
@@ -1331,7 +1332,7 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw)u16 newstatus;int connected; -if (priv->iw_mode ==IW_MODE_MONITOR ) +if (priv->iw_mode ==NL80211_IFTYPE_MONITOR )break ;if (len !=sizeof (linkstatus)) {
@@ -1981,7 +1982,7 @@ int orinoco_init(struct orinoco_private *priv) }/* Set up the default configuration */ - priv->iw_mode =IW_MODE_INFRA ; + priv->iw_mode =NL80211_IFTYPE_STATION ;/* By default use IEEE/IBSS ad-hoc mode if we have it */ priv->prefer_port3 = priv->has_port3 && (!priv->has_ibss);set_port_type (priv);
drivers/net/wireless/orinoco/orinoco.h +1 -1
@@ -121,7 +121,7 @@ struct orinoco_private { unsigned int broken_monitor:1;/* Configuration paramaters */ -u32 iw_mode; +enum nl80211_iftype iw_mode;int prefer_port3;u16 encode_alg, wep_restrict, tx_key;struct orinoco_key keys[ORINOCO_MAX_KEYS ];
drivers/net/wireless/orinoco/wext.c +8 -67
123 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 21/23 orinoco: convert scanning to cfg80211
In reply to David KilroyThis removes the custom scan cache used by orinoco.
We also have to avoid calling cfg80211_scan_done from the hard interrupt, so we offload the entirety of scan processing to a workqueue.
This may behave strangely if you start scanning just prior to suspending...
--- drivers/net/wireless/orinoco/cfg.c | 20 ++ drivers/net/wireless/orinoco/hermes.h | 2 +- drivers/net/wireless/orinoco/hw.c | 85 ++++++ drivers/net/wireless/orinoco/hw.h | 3 + drivers/net/wireless/orinoco/main.c | 167 +++++++---- drivers/net/wireless/orinoco/orinoco.h | 22 +-- drivers/net/wireless/orinoco/scan.c | 285 +++++++++--------- drivers/net/wireless/orinoco/scan.h | 21 +- drivers/net/wireless/orinoco/wext.c | 517 +------------------------------- 9 files changed, 378 insertions(+), 744 deletions(-)
drivers/net/wireless/orinoco/cfg.c +20 -0
@@ -137,6 +137,26 @@ static int orinoco_change_vif(struct wiphy *wiphy, struct net_device *dev,return err; } +static int orinoco_scan (struct wiphy *wiphy,struct net_device *dev, +struct cfg80211_scan_request *request) +{ +struct orinoco_private *priv =wiphy_priv (wiphy); +int err; + +if (!request) +return -EINVAL ; + +if (priv->scan_request && priv->scan_request != request) +return -EBUSY ; + + priv->scan_request = request; + + err =orinoco_hw_trigger_scan (priv, request->ssids); + +return err; +} +const struct cfg80211_ops orinoco_cfg_ops = { .change_virtual_intf = orinoco_change_vif, + .scan = orinoco_scan, };
drivers/net/wireless/orinoco/hermes.h +1 -1
@@ -342,7 +342,7 @@ struct agere_ext_scan_info {__le64 timestamp;__le16 beacon_interval;__le16 capabilities; -u8 data[316 ]; +u8 data[0 ]; } __attribute__ ((packed));#define HERMES_LINKSTATUS_NOT_CONNECTED (0x0000)
drivers/net/wireless/orinoco/hw.c +85 -0
88 lines not on this page · raw message
drivers/net/wireless/orinoco/hw.h +3 -0
@@ -7,6 +7,7 @@#include <linux/types.h> #include <linux/wireless.h> +#include <net/cfg80211.h> /* Hardware BAPs */ #define USER_BAP 0
@@ -47,5 +48,7 @@ int orinoco_hw_get_essid(struct orinoco_private *priv, int *active,int orinoco_hw_get_freq (struct orinoco_private *priv);int orinoco_hw_get_bitratelist (struct orinoco_private *priv,int *numrates,s32 *rates,int max); +int orinoco_hw_trigger_scan (struct orinoco_private *priv, +const struct cfg80211_ssid *ssid);#endif /* _ORINOCO_HW_H_ */
drivers/net/wireless/orinoco/main.c +116 -51
294 lines not on this page · raw message
drivers/net/wireless/orinoco/orinoco.h +4 -18
@@ -48,18 +48,6 @@ typedef enum {FIRMWARE_TYPE_SYMBOL } fwtype_t; -struct bss_element { -union hermes_scan_info bss; -unsigned long last_scanned; -struct list_head list; -}; - -struct xbss_element { -struct agere_ext_scan_info bss; -unsigned long last_scanned; -struct list_head list; -}; -struct firmware ;struct orinoco_private {
@@ -145,12 +133,10 @@ struct orinoco_private {int promiscuous, mc_count;/* Scanning support */ -struct list_head bss_list; -struct list_head bss_free_list; -void *bss_xbss_data; - -int scan_inprogress;/* Scan pending... */ -u32 scan_mode;/* Type of scan done */ +struct cfg80211_scan_request *scan_request; +struct work_struct process_scan; +struct list_head scan_list; +spinlock_t scan_lock;/* protects the scan list */ /* WPA support */ u8 *wpa_ie;
drivers/net/wireless/orinoco/scan.c +141 -144
355 lines not on this page · raw message
drivers/net/wireless/orinoco/scan.h +6 -15
@@ -9,21 +9,12 @@struct orinoco_private ;struct agere_ext_scan_info ; -/* Setup and free memory for scan results */ -int orinoco_bss_data_allocate (struct orinoco_private *priv); -void orinoco_bss_data_free (struct orinoco_private *priv); -void orinoco_bss_data_init (struct orinoco_private *priv); -/* Add scan results */ -void orinoco_add_ext_scan_result (struct orinoco_private *priv, -struct agere_ext_scan_info *atom); -int orinoco_process_scan_results (struct orinoco_private *dev, -unsigned char *buf, -int len); - -/* Clear scan results */ -void orinoco_clear_scan_results (struct orinoco_private *priv, -unsigned long scan_age); - +void orinoco_add_extscan_result (struct orinoco_private *priv, +struct agere_ext_scan_info *atom, +size_t len); +void orinoco_add_hostscan_results (struct orinoco_private *dev, +unsigned char *buf, +size_t len);#endif /* _ORINOCO_SCAN_H_ */
drivers/net/wireless/orinoco/wext.c +2 -515
529 lines not on this page · raw message
Signature · 1 line
1.6.0.6
Re: [PATCH 21/23] orinoco: convert scanning to cfg80211
Quoted 9 lines · David Kilroy
This removes the custom scan cache used by orinoco.
We also have to avoid calling
cfg80211_scan_donefrom the hard interrupt, so we offload the entirety of scan processing to a workqueue.This may behave strangely if you start scanning just prior to suspending...
Signed-off-by David Kilroy <[email protected]>
Hmmm...please do try to compile test patches before posting! :-)
John
---
Quoted 1 line
From
81aab523c06da0e025a7c9b2669058fd16597d18Mon Sep 17 00:00:00 2001
From: John W. Linville <[email protected]>
Date: Fri, 19 Jun 2009 13:33:50 -0400
Subject: [PATCH] fixups for "orinoco: convert scanning to cfg80211"
--- drivers/net/wireless/orinoco/main.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/wireless/orinoco/main.c +8 -8
@@ -1283,9 +1283,9 @@ static void qbuf_scan(struct orinoco_private *priv, void *buf, sd->len = len; sd->type = type; -spin_lock_irqsave (priv->scan_lock, flags); +spin_lock_irqsave (&priv->scan_lock, flags);list_add_tail (&sd->list, &priv->scan_list); -spin_unlock_irqrestore (priv->scan_lock, flags); +spin_unlock_irqrestore (&priv->scan_lock, flags);schedule_work (&priv->process_scan); }
@@ -1298,9 +1298,9 @@ static void qabort_scan(struct orinoco_private *priv) sd =kmalloc (sizeof (*sd),GFP_ATOMIC ); sd->len =-1 ;/* Abort */ -spin_lock_irqsave (priv->scan_lock, flags); +spin_lock_irqsave (&priv->scan_lock, flags);list_add_tail (&sd->list, &priv->scan_list); -spin_unlock_irqrestore (priv->scan_lock, flags); +spin_unlock_irqrestore (&priv->scan_lock, flags);schedule_work (&priv->process_scan); }
@@ -1315,9 +1315,9 @@ static void orinoco_process_scan_results(struct work_struct *work)int len;int type; -spin_lock_irqsave (priv->scan_lock, flags); +spin_lock_irqsave (&priv->scan_lock, flags);list_for_each_entry_safe (sd, temp, &priv->scan_list, list) { -spin_unlock_irqrestore (priv->scan_lock, flags); +spin_unlock_irqrestore (&priv->scan_lock, flags); buf = sd->buf; len = sd->len;
@@ -1339,9 +1339,9 @@ static void orinoco_process_scan_results(struct work_struct *work) priv->scan_request =NULL ; } -spin_lock_irqsave (priv->scan_lock, flags); +spin_lock_irqsave (&priv->scan_lock, flags); } -spin_unlock_irqrestore (priv->scan_lock, flags); +spin_unlock_irqrestore (&priv->scan_lock, flags); }static void __orinoco_ev_info (struct net_device *dev,hermes_t *hw)
Signature · 5 lines
1.6.0.6 -- John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.
Re: [PATCH 21/23] orinoco: convert scanning to cfg80211
Quoted 6 lines · John W. Linville
Quoted 5 lines · David Kilroy
This removes the custom scan cache used by orinoco.
We also have to avoid calling
cfg80211_scan_donefrom the hard interrupt, so we offload the entirety of scan processing to a workqueue.
Quoted 8 lines
Quoted 4 lines
This may behave strangely if you start scanning just prior to suspending...
Signed-off-by David Kilroy <[email protected]>Hmmm...please do try to compile test patches before posting! :-)
John
Compile? I'm running it! (and sparse didn't complain either)
I'll go have a look see what's special on my end. I'm guessing no SMP or something.
Would you like the series/patch reposted including this fix?
Thanks,
Dave.
Re: [PATCH 21/23] orinoco: convert scanning to cfg80211
Quoted 12 lines · Dave
Quoted 11 lines · John W. Linville
Quoted 9 lines · David Kilroy
This removes the custom scan cache used by orinoco.
We also have to avoid calling
cfg80211_scan_donefrom the hard interrupt, so we offload the entirety of scan processing to a workqueue.This may behave strangely if you start scanning just prior to suspending...
Signed-off-by David Kilroy <[email protected]>
Quoted 8 lines
Quoted 3 lines
Hmmm...please do try to compile test patches before posting! :-)
John
Compile? I'm running it! (and sparse didn't complain either)
I'll go have a look see what's special on my end. I'm guessing no SMP or something.
Haha...yeah, that's probably it...
Quoted 1 line
Would you like the series/patch reposted including this fix?
No, I've got it fixed.
John
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.
Re: [PATCH 21/23] orinoco: convert scanning to cfg80211
Quoted 6 lines · John W. Linville
Quoted 5 lines · Dave
Quoted 1 line · John W. Linville
Hmmm...please do try to compile test patches before posting! :-)
Compile? I'm running it! (and sparse didn't complain either)
Quoted 8 lines
Quoted 2 lines
I'll go have a look see what's special on my end. I'm guessing no SMP or something.
Haha...yeah, that's probably it...
Quoted 1 line
Would you like the series/patch reposted including this fix?
No, I've got it fixed.
Thanks.
It looks like I can enable DEBUG_SPINLOCKS to highlight this - but it's expensive to keep turning that on and off.
Alternatively I could submit a patch to either add typechecks to spinlock_api_up.h or convert the #defines to inlines.
Sounds a bit too controversial for me, so I'll just try to be vigilant for now.
Regards,
Dave.
PATCH 22/23 orinoco: convert giwrange to cfg80211
In reply to David Kilroy--- drivers/net/wireless/orinoco/wext.c | 115 +---------------------------------- 1 files changed, 1 insertions(+), 114 deletions(-)
drivers/net/wireless/orinoco/wext.c +1 -114
@@ -172,119 +172,6 @@ static int orinoco_ioctl_getwap(struct net_device *dev,return err; } -static int orinoco_ioctl_getiwrange (struct net_device *dev, -struct iw_request_info *info, -struct iw_point *rrq, -char *extra) -{ -struct orinoco_private *priv =ndev_priv (dev); -int err =0 ; -struct iw_range *range = (struct iw_range *) extra; -int numrates; -int i, k; - - rrq->length =sizeof (struct iw_range ); -memset (range,0 ,sizeof (struct iw_range )); - - range->we_version_compiled =WIRELESS_EXT ; - range->we_version_source =22 ; - -/* Set available channels/frequencies */ - range->num_channels =NUM_CHANNELS ; - k =0 ; -for (i =0 ; i <NUM_CHANNELS ; i++) { -if (priv->channel_mask & (1 << i)) { - range->freq[k].i = i +1 ; - range->freq[k].m = (ieee80211_dsss_chan_to_freq (i +1 ) * -100000 ); - range->freq[k].e =1 ; - k++; - } - -if (k >=IW_MAX_FREQUENCIES ) -break ; - } - range->num_frequency = k; - range->sensitivity =3 ; - -if (priv->has_wep) { - range->max_encoding_tokens =ORINOCO_MAX_KEYS ; - range->encoding_size[0 ] =SMALL_KEY_SIZE ; - range->num_encoding_sizes =1 ; - -if (priv->has_big_wep) { - range->encoding_size[1 ] =LARGE_KEY_SIZE ; - range->num_encoding_sizes =2 ; - } - } - -if (priv->has_wpa) - range->enc_capa =IW_ENC_CAPA_WPA |IW_ENC_CAPA_CIPHER_TKIP ; - -if ((priv->iw_mode ==NL80211_IFTYPE_ADHOC ) && (!SPY_NUMBER (priv))) { -/* Quality stats meaningless in ad-hoc mode */ - }else { - range->max_qual.qual =0x8b -0x2f ; - range->max_qual.level =0x2f -0x95 -1 ; - range->max_qual.noise =0x2f -0x95 -1 ; -/* Need to get better values */ - range->avg_qual.qual =0x24 ; - range->avg_qual.level =0xC2 ; - range->avg_qual.noise =0x9E ; - } - - err =orinoco_hw_get_bitratelist (priv, &numrates, - range->bitrate,IW_MAX_BITRATES ); -if (err) -return err; - range->num_bitrates = numrates; - -/* Set an indication of the max TCP throughput in bit/s that we can -* expect using this interface. May be use for QoS stuff... -* Jean II */ -if (numrates >2 ) - range->throughput =5 *1000 *1000 ;/* ~5 Mb/s */ -else - range->throughput =1.5 *1000 *1000 ;/* ~1.5 Mb/s */ - - range->min_rts =0 ; - range->max_rts =2347 ; - range->min_frag =256 ; - range->max_frag =2346 ; - - range->min_pmp =0 ; - range->max_pmp =65535000 ; - range->min_pmt =0 ; - range->max_pmt =65535 *1000 ;/* ??? */ - range->pmp_flags =IW_POWER_PERIOD ; - range->pmt_flags =IW_POWER_TIMEOUT ; - range->pm_capa = (IW_POWER_PERIOD |IW_POWER_TIMEOUT | -IW_POWER_UNICAST_R ); - - range->retry_capa =IW_RETRY_LIMIT |IW_RETRY_LIFETIME ; - range->retry_flags =IW_RETRY_LIMIT ; - range->r_time_flags =IW_RETRY_LIFETIME ; - range->min_retry =0 ; - range->max_retry =65535 ;/* ??? */ - range->min_r_time =0 ; - range->max_r_time =65535 *1000 ;/* ??? */ - -if (priv->firmware_type ==FIRMWARE_TYPE_AGERE ) - range->scan_capa =IW_SCAN_CAPA_ESSID ; -else - range->scan_capa =IW_SCAN_CAPA_NONE ; - -/* Event capability (kernel) */ -IW_EVENT_CAPA_SET_KERNEL (range->event_capa); -/* Event capability (driver) */ -IW_EVENT_CAPA_SET (range->event_capa,SIOCGIWTHRSPY ); -IW_EVENT_CAPA_SET (range->event_capa,SIOCGIWAP ); -IW_EVENT_CAPA_SET (range->event_capa,SIOCGIWSCAN ); -IW_EVENT_CAPA_SET (range->event_capa,IWEVTXDROP ); - -return 0 ; -} - static int orinoco_ioctl_setiwencode(struct net_device *dev, struct iw_request_info *info, struct iw_point *erq,
@@ -1641,7 +1528,7 @@ static const iw_handler orinoco_handler[] = {STD_IW_HANDLER (SIOCGIWMODE , cfg80211_wext_giwmode),STD_IW_HANDLER (SIOCSIWSENS , orinoco_ioctl_setsens),STD_IW_HANDLER (SIOCGIWSENS , orinoco_ioctl_getsens), -STD_IW_HANDLER (SIOCGIWRANGE , orinoco_ioctl_getiwrange), +STD_IW_HANDLER (SIOCGIWRANGE , cfg80211_wext_giwrange),STD_IW_HANDLER (SIOCSIWSPY , iw_handler_set_spy),STD_IW_HANDLER (SIOCGIWSPY , iw_handler_get_spy), STD_IW_HANDLER(SIOCSIWTHRSPY, iw_handler_set_thrspy),
Signature · 1 line
1.6.0.6
PATCH 23/23 orinoco: remove WE nickname support
In reply to David Kilroy--- drivers/net/wireless/orinoco/wext.c | 43 ----------------------------------- 1 files changed, 0 insertions(+), 43 deletions(-)
drivers/net/wireless/orinoco/wext.c +0 -43
@@ -372,47 +372,6 @@ static int orinoco_ioctl_getessid(struct net_device *dev,return 0 ; } -static int orinoco_ioctl_setnick (struct net_device *dev, -struct iw_request_info *info, -struct iw_point *nrq, -char *nickbuf) -{ -struct orinoco_private *priv =ndev_priv (dev); -unsigned long flags; - -if (nrq->length >IW_ESSID_MAX_SIZE ) -return -E2BIG ; - -if (orinoco_lock (priv, &flags) !=0 ) -return -EBUSY ; - -memset (priv->nick,0 ,sizeof (priv->nick)); -memcpy (priv->nick, nickbuf, nrq->length); - -orinoco_unlock (priv, &flags); - -return -EINPROGRESS ;/* Call commit handler */ -} - -static int orinoco_ioctl_getnick (struct net_device *dev, -struct iw_request_info *info, -struct iw_point *nrq, -char *nickbuf) -{ -struct orinoco_private *priv =ndev_priv (dev); -unsigned long flags; - -if (orinoco_lock (priv, &flags) !=0 ) -return -EBUSY ; - -memcpy (nickbuf, priv->nick,IW_ESSID_MAX_SIZE ); -orinoco_unlock (priv, &flags); - - nrq->length =strlen (priv->nick); - -return 0 ; -} - static int orinoco_ioctl_setfreq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *frq,
@@ -1539,8 +1498,6 @@ static const iw_handler orinoco_handler[] = {STD_IW_HANDLER (SIOCGIWSCAN , cfg80211_wext_giwscan),STD_IW_HANDLER (SIOCSIWESSID , orinoco_ioctl_setessid),STD_IW_HANDLER (SIOCGIWESSID , orinoco_ioctl_getessid), -STD_IW_HANDLER (SIOCSIWNICKN , orinoco_ioctl_setnick), -STD_IW_HANDLER (SIOCGIWNICKN , orinoco_ioctl_getnick),STD_IW_HANDLER (SIOCSIWRATE , orinoco_ioctl_setrate),STD_IW_HANDLER (SIOCGIWRATE , orinoco_ioctl_getrate), STD_IW_HANDLER(SIOCSIWRTS, orinoco_ioctl_setrts),
Signature · 1 line
1.6.0.6
Johannes Berg
maintainerQuoted 22 lines
drivers/net/wireless/orinoco/Kconfig | 1 + drivers/net/wireless/orinoco/Makefile | 2 +- drivers/net/wireless/orinoco/airport.c | 98 +-- drivers/net/wireless/orinoco/cfg.c | 162 ++++ drivers/net/wireless/orinoco/cfg.h | 15 + drivers/net/wireless/orinoco/fw.c | 41 +- drivers/net/wireless/orinoco/hermes.h | 2 +- drivers/net/wireless/orinoco/hermes_dld.c | 50 +- drivers/net/wireless/orinoco/hw.c | 668 +++++++++++++++- drivers/net/wireless/orinoco/hw.h | 11 +- drivers/net/wireless/orinoco/main.c | 1133 +++++++++---------------- drivers/net/wireless/orinoco/main.h | 3 +- drivers/net/wireless/orinoco/orinoco.h | 49 +- drivers/net/wireless/orinoco/orinoco_cs.c | 96 +-- drivers/net/wireless/orinoco/orinoco_nortel.c | 38 +- drivers/net/wireless/orinoco/orinoco_pci.c | 38 +- drivers/net/wireless/orinoco/orinoco_pci.h | 57 +-- drivers/net/wireless/orinoco/orinoco_plx.c | 38 +- drivers/net/wireless/orinoco/orinoco_tmd.c | 38 +- drivers/net/wireless/orinoco/scan.c | 285 +++---- drivers/net/wireless/orinoco/scan.h | 21 +-
Quoted 8 lines
drivers/net/wireless/orinoco/spectrum_cs.c | 96 +-- drivers/net/wireless/orinoco/wext.c | 878 ++------------------ include/net/cfg80211.h | 11 + net/wireless/core.c | 3 - net/wireless/wext-compat.c | 31 +- 26 files changed, 1748 insertions(+), 2117 deletions(-) create mode 100644 drivers/net/wireless/orinoco/cfg.c create mode 100644 drivers/net/wireless/orinoco/cfg.h
Amazing. Very cool!
johannes