Please pull 'upstream' branch of wireless-2.6
Subsystems (3)
The following changes since commit 76df73ff90e99681a99e457aec4cfe0a240b7982:
John W. Linville:
Merge branch 'from-linus' into upstream
are found in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git upstream
Jiri Slaby:
pci: bcm43xx avoid pci_find_device
Larry Finger:
wireless: Changes to ieee80211.h for user space regulatory daemon
wireless: correct dump of WPA IE
Michael Buesch:
bcm43xx: redesign locking
bcm43xx: preemptible periodic work
Zhu Yi:
ipw2200 locking fix
drivers/net/wireless/bcm43xx/bcm43xx.h | 100 +++++++---- drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c | 33 ++-- drivers/net/wireless/bcm43xx/bcm43xx_leds.c | 4 drivers/net/wireless/bcm43xx/bcm43xx_main.c | 221 ++++++++++++++++-------- drivers/net/wireless/bcm43xx/bcm43xx_phy.c | 9 + drivers/net/wireless/bcm43xx/bcm43xx_pio.c | 44 ++++- drivers/net/wireless/bcm43xx/bcm43xx_pio.h | 13 + drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c | 38 ++-- drivers/net/wireless/bcm43xx/bcm43xx_wx.c | 107 ++++++------ drivers/net/wireless/ipw2200.c | 41 +++- drivers/net/wireless/ipw2200.h | 1 include/net/ieee80211.h | 5 - net/ieee80211/softmac/ieee80211softmac_wx.c | 2 13 files changed, 402 insertions(+), 216 deletions(-)
drivers/net/wireless/bcm43xx/bcm43xx.h +67 -33
@@ -636,6 +636,17 @@ struct bcm43xx_key {u8 algorithm; }; +/* Driver initialization status. */ +enum { + BCM43xx_STAT_UNINIT,/* Uninitialized. */ + BCM43xx_STAT_INITIALIZING,/* init_board() in progress. */ + BCM43xx_STAT_INITIALIZED,/* Fully operational. */ + BCM43xx_STAT_SHUTTINGDOWN,/* free_board() in progress. */ + BCM43xx_STAT_RESTARTING,/* controller_restart() called. */ +}; +#define bcm43xx_status (bcm) atomic_read(&(bcm)->init_status) +#define bcm43xx_set_status (bcm, stat) atomic_set(&(bcm)->init_status, (stat)) +struct bcm43xx_private {struct ieee80211_device *ieee;struct ieee80211softmac_device *softmac;
@@ -646,18 +657,17 @@ struct bcm43xx_private {void __iomem *mmio_addr; -/* Do not use the lock directly. Use the bcm43xx_lock* helper -* functions, to be MMIO-safe. */ -spinlock_t _lock; +/* Locking, see "theory of locking" text below. */ +spinlock_t irq_lock; +struct mutex mutex; -/* Driver status flags. */ - u32 initialized:1, /* init_board() succeed */ - was_initialized:1, /* for PCI suspend/resume. */ - shutting_down:1, /* free_board() in progress */ +/* Driver initialization status BCM43xx_STAT_*** */ +atomic_t init_status; + + u16 was_initialized:1, /* for PCI suspend/resume. */ __using_pio:1, /* Internal, use bcm43xx_using_pio(). */ bad_frames_preempt:1, /* Use "Bad Frames Preemption" (default off) */ reg124_set_0x4:1, /* Some variable to keep track of IRQ stuff. */ - powersaving:1, /* TRUE if we are in PowerSaving mode. FALSE otherwise. */ short_preamble:1, /* TRUE, if short preamble is enabled. */ firmware_norelease:1; /* Do not release the firmware. Used on suspend. */
@@ -721,7 +731,7 @@ #endifstruct tasklet_struct isr_tasklet;/* Periodic tasks */ -struct timer_list periodic_tasks; +struct work_struct periodic_work;unsigned int periodic_state;struct work_struct restart_work;
@@ -746,21 +756,55 @@ #ifdef CONFIG_BCM43XX_DEBUG#endif }; -/* bcm43xx_(un)lock() protect struct bcm43xx_private. -* Note that _NO_ MMIO writes are allowed. If you want to -* write to the device through MMIO in the critical section, use -* the *_mmio lock functions. -* MMIO read-access is allowed, though. -*/ -#define bcm43xx_lock (bcm, flags) spin_lock_irqsave(&(bcm)->_lock, flags) -#define bcm43xx_unlock (bcm, flags) spin_unlock_irqrestore(&(bcm)->_lock, flags) -/* bcm43xx_(un)lock_mmio() protect struct bcm43xx_private and MMIO. -* MMIO write-access to the device is allowed. -* All MMIO writes are flushed on unlock, so it is guaranteed to not -* interfere with other threads writing MMIO registers. + +/* *** THEORY OF LOCKING *** +* +* We have two different locks in the bcm43xx driver. +* => bcm->mutex: General sleeping mutex. Protects struct bcm43xx_private +* and the device registers. +* => bcm->irq_lock: IRQ spinlock. Protects against IRQ handler concurrency. +* +* We have three types of helper function pairs to utilize these locks. +* (Always use the helper functions.) +* 1) bcm43xx_{un}lock_noirq(): +* Takes bcm->mutex. Does _not_ protect against IRQ concurrency, +* so it is almost always unsafe, if device IRQs are enabled. +* So only use this, if device IRQs are masked. +* Locking may sleep. +* You can sleep within the critical section. +* 2) bcm43xx_{un}lock_irqonly(): +* Takes bcm->irq_lock. Does _not_ protect against +* bcm43xx_lock_noirq() critical sections. +* Does only protect against the IRQ handler path and other +* irqonly() critical sections. +* Locking does not sleep. +* You must not sleep within the critical section. +* 3) bcm43xx_{un}lock_irqsafe(): +* This is the cummulative lock and takes both, mutex and irq_lock. +* Protects against noirq() and irqonly() critical sections (and +* the IRQ handler path). +* Locking may sleep. +* You must not sleep within the critical section. */ -#define bcm43xx_lock_mmio (bcm, flags) bcm43xx_lock(bcm, flags) -#define bcm43xx_unlock_mmio (bcm, flags) do { mmiowb(); bcm43xx_unlock(bcm, flags); } while (0) + +/* Lock type 1 */ +#define bcm43xx_lock_noirq (bcm) mutex_lock(&(bcm)->mutex) +#define bcm43xx_unlock_noirq (bcm) mutex_unlock(&(bcm)->mutex) +/* Lock type 2 */ +#define bcm43xx_lock_irqonly (bcm, flags) \ + spin_lock_irqsave(&(bcm)->irq_lock, flags) +#define bcm43xx_unlock_irqonly (bcm, flags) \ + spin_unlock_irqrestore(&(bcm)->irq_lock, flags) +/* Lock type 3 */ +#define bcm43xx_lock_irqsafe (bcm, flags) do { \ + bcm43xx_lock_noirq(bcm); \ + bcm43xx_lock_irqonly(bcm, flags); \ + } while (0) +#define bcm43xx_unlock_irqsafe (bcm, flags) do { \ + bcm43xx_unlock_irqonly(bcm, flags); \ + bcm43xx_unlock_noirq(bcm); \ + } while (0) +static inline struct bcm43xx_private *bcm43xx_priv (struct net_device *dev)
@@ -843,16 +887,6 @@ struct bcm43xx_radioinfo * bcm43xx_currereturn &(bcm->core_80211_ext[bcm->current_80211_core_idx].radio); } -/* Are we running in init_board() context? */ -static inline -int bcm43xx_is_initializing (struct bcm43xx_private *bcm) -{ -if (bcm->initialized) -return 0 ; -if (bcm->shutting_down) -return 0 ; -return 1 ; -}static inline struct bcm43xx_lopair * bcm43xx_get_lopair(struct bcm43xx_phyinfo *phy,
drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c +17 -16
@@ -77,8 +77,8 @@ static ssize_t devinfo_read_file(structdown (&big_buffer_sem); -bcm43xx_lock_mmio (bcm, flags); -if (!bcm->initialized) { +bcm43xx_lock_irqsafe (bcm, flags); +if (bcm43xx_status (bcm) != BCM43xx_STAT_INITIALIZED) {fappend ("Board not initialized.\n" ); goto out; }
@@ -121,7 +121,7 @@ #undef fappend_corefappend ("\n" ); out: -bcm43xx_unlock_mmio (bcm, flags); +bcm43xx_unlock_irqsafe (bcm, flags); res =simple_read_from_buffer (userbuf, count, ppos, buf, pos);up (&big_buffer_sem);return res;
@@ -159,8 +159,8 @@ static ssize_t spromdump_read_file(strucunsigned long flags;down (&big_buffer_sem); -bcm43xx_lock_mmio (bcm, flags); -if (!bcm->initialized) { +bcm43xx_lock_irqsafe (bcm, flags); +if (bcm43xx_status (bcm) != BCM43xx_STAT_INITIALIZED) {fappend ("Board not initialized.\n" ); goto out; }
@@ -169,7 +169,7 @@ static ssize_t spromdump_read_file(strucfappend ("boardflags: 0x%04x\n" , bcm->sprom.boardflags); out: -bcm43xx_unlock_mmio (bcm, flags); +bcm43xx_unlock_irqsafe (bcm, flags); res =simple_read_from_buffer (userbuf, count, ppos, buf, pos);up (&big_buffer_sem);return res;
@@ -188,8 +188,8 @@ static ssize_t tsf_read_file(struct fileu64 tsf;down (&big_buffer_sem); -bcm43xx_lock_mmio (bcm, flags); -if (!bcm->initialized) { +bcm43xx_lock_irqsafe (bcm, flags); +if (bcm43xx_status (bcm) != BCM43xx_STAT_INITIALIZED) {fappend ("Board not initialized.\n" ); goto out; }
@@ -199,7 +199,7 @@ static ssize_t tsf_read_file(struct file (unsigned int)(tsf & 0xFFFFFFFFULL)); out: -bcm43xx_unlock_mmio (bcm, flags); +bcm43xx_unlock_irqsafe (bcm, flags); res =simple_read_from_buffer (userbuf, count, ppos, buf, pos);up (&big_buffer_sem);return res;
@@ -221,8 +221,8 @@ static ssize_t tsf_write_file(struct fil res = -EFAULT ; goto out_up; } -bcm43xx_lock_mmio (bcm, flags); -if (!bcm->initialized) { +bcm43xx_lock_irqsafe (bcm, flags); +if (bcm43xx_status (bcm) != BCM43xx_STAT_INITIALIZED) { printk(KERN_INFO PFX "debugfs: Board not initialized.\n"); res = -EFAULT ; goto out_unlock;
@@ -233,10 +233,11 @@ static ssize_t tsf_write_file(struct fil goto out_unlock; }bcm43xx_tsf_write (bcm, tsf); +mmiowb (); res = buf_size; out_unlock: -bcm43xx_unlock_mmio (bcm, flags); +bcm43xx_unlock_irqsafe (bcm, flags); out_up:up (&big_buffer_sem);return res;
@@ -257,7 +258,7 @@ static ssize_t txstat_read_file(struct fint i, cnt, j =0 ;down (&big_buffer_sem); -bcm43xx_lock (bcm, flags); +bcm43xx_lock_irqsafe (bcm, flags);fappend ("Last %d logged xmitstatus blobs (Latest first):\n\n" , BCM43xx_NR_LOGGED_XMITSTATUS);
@@ -293,14 +294,14 @@ static ssize_t txstat_read_file(struct f i = BCM43xx_NR_LOGGED_XMITSTATUS -1 ; } -bcm43xx_unlock (bcm, flags); +bcm43xx_unlock_irqsafe (bcm, flags); res =simple_read_from_buffer (userbuf, count, ppos, buf, pos); -bcm43xx_lock (bcm, flags); +bcm43xx_lock_irqsafe (bcm, flags);if (*ppos == pos) {/* Done. Drop the copied data. */ e->xmitstatus_printing =0 ; } -bcm43xx_unlock (bcm, flags); +bcm43xx_unlock_irqsafe (bcm, flags);up (&big_buffer_sem);return res; }
drivers/net/wireless/bcm43xx/bcm43xx_leds.c +2 -2
@@ -51,12 +51,12 @@ static void bcm43xx_led_blink(unsigned lstruct bcm43xx_private *bcm = led->bcm;unsigned long flags; -bcm43xx_lock_mmio (bcm, flags); +bcm43xx_lock_irqonly (bcm, flags);if (led->blink_interval) {bcm43xx_led_changestate (led);mod_timer (&led->blink_timer, jiffies + led->blink_interval); } -bcm43xx_unlock_mmio (bcm, flags); +bcm43xx_unlock_irqonly (bcm, flags); } static void bcm43xx_led_blink_start(struct bcm43xx_led *led,
drivers/net/wireless/bcm43xx/bcm43xx_main.c +151 -70
436 lines not on this page · raw message
drivers/net/wireless/bcm43xx/bcm43xx_phy.c +7 -2
@@ -1410,7 +1410,10 @@ static inlineu16 bcm43xx_phy_lo_g_deviation_subval (struct bcm43xx_private *bcm,u16 control) {struct bcm43xx_phyinfo *phy =bcm43xx_current_phy (bcm); +u16 ret; +unsigned long flags; +local_irq_save (flags);if (phy->connected) {bcm43xx_phy_write (bcm,0x15 ,0xE300 ); control <<=8 ;
@@ -1430,8 +1433,10 @@ u16 bcm43xx_phy_lo_g_deviation_subval(stbcm43xx_phy_write (bcm,0x0015 , control |0xFFE0 );udelay (8 ); } + ret =bcm43xx_phy_read (bcm,0x002D ); +local_irq_restore (flags); -return bcm43xx_phy_read (bcm,0x002D ); +return ret; }static u32 bcm43xx_phy_lo_g_singledeviation (struct bcm43xx_private *bcm,u16 control)
@@ -1648,7 +1653,7 @@ void bcm43xx_phy_set_baseband_attenuatiovoid bcm43xx_phy_lo_g_measure (struct bcm43xx_private *bcm) {static const u8 pairorder[10 ] = {3 ,1 ,5 ,7 ,9 ,2 ,0 ,4 ,6 ,8 }; -const int is_initializing =bcm43xx_is_initializing (bcm); +const int is_initializing = (bcm43xx_status (bcm) == BCM43xx_STAT_INITIALIZING);struct bcm43xx_phyinfo *phy =bcm43xx_current_phy (bcm);struct bcm43xx_radioinfo *radio =bcm43xx_current_radio (bcm);u16 h, i, oldi =0 , j;
drivers/net/wireless/bcm43xx/bcm43xx_pio.c +40 -4
67 lines not on this page · raw message
drivers/net/wireless/bcm43xx/bcm43xx_pio.h +13 -0
@@ -54,6 +54,7 @@ struct bcm43xx_pioqueue {u16 mmio_base; u8 tx_suspended:1, + tx_frozen:1, need_workarounds:1; /* Workarounds needed for core.rev < 3 *//* Adjusted size of the device internal TX buffer. */
@@ -108,8 +109,12 @@ void bcm43xx_pio_handle_xmitstatus(struc struct bcm43xx_xmitstatus *status);void bcm43xx_pio_rx (struct bcm43xx_pioqueue *queue); +/* Suspend a TX queue on hardware level. */ void bcm43xx_pio_tx_suspend (struct bcm43xx_pioqueue *queue);void bcm43xx_pio_tx_resume (struct bcm43xx_pioqueue *queue); +/* Suspend (freeze) the TX tasklet (software level). */ +void bcm43xx_pio_freeze_txqueues (struct bcm43xx_private *bcm); +void bcm43xx_pio_thaw_txqueues (struct bcm43xx_private *bcm);#else /* CONFIG_BCM43XX_PIO */
@@ -145,6 +150,14 @@ static inlinevoid bcm43xx_pio_tx_resume (struct bcm43xx_pioqueue *queue) { } +static inline +void bcm43xx_pio_freeze_txqueues (struct bcm43xx_private *bcm) +{ +} +static inline +void bcm43xx_pio_thaw_txqueues (struct bcm43xx_private *bcm) +{ +}#endif /* CONFIG_BCM43XX_PIO */ #endif /* BCM43xx_PIO_H_ */
drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c +16 -22
@@ -120,12 +120,12 @@ static ssize_t bcm43xx_attr_sprom_show(s GFP_KERNEL);if (!sprom)return -ENOMEM ; -bcm43xx_lock_mmio (bcm, flags); -assert (bcm->initialized); +bcm43xx_lock_irqsafe (bcm, flags); err =bcm43xx_sprom_read (bcm, sprom);if (!err) err =sprom2hex (sprom, buf,PAGE_SIZE ); -bcm43xx_unlock_mmio (bcm, flags); +mmiowb (); +bcm43xx_unlock_irqsafe (bcm, flags);kfree (sprom);return err;
@@ -150,10 +150,10 @@ static ssize_t bcm43xx_attr_sprom_store( err =hex2sprom (sprom, buf, count);if (err) goto out_kfree; -bcm43xx_lock_mmio (bcm, flags); -assert (bcm->initialized); +bcm43xx_lock_irqsafe (bcm, flags); err =bcm43xx_sprom_write (bcm, sprom); -bcm43xx_unlock_mmio (bcm, flags); +mmiowb (); +bcm43xx_unlock_irqsafe (bcm, flags); out_kfree:kfree (sprom);
@@ -170,15 +170,13 @@ static ssize_t bcm43xx_attr_interfmode_s char *buf) {struct bcm43xx_private *bcm =dev_to_bcm (dev); -unsigned long flags;int err;ssize_t count =0 ;if (!capable (CAP_NET_ADMIN ))return -EPERM ; -bcm43xx_lock (bcm, flags); -assert (bcm->initialized); +bcm43xx_lock_noirq (bcm);switch (bcm43xx_current_radio (bcm)->interfmode) {case BCM43xx_RADIO_INTERFMODE_NONE:
@@ -195,7 +193,7 @@ static ssize_t bcm43xx_attr_interfmode_s } err =0 ; -bcm43xx_unlock (bcm, flags); +bcm43xx_unlock_noirq (bcm);return err ? err : count;
@@ -231,16 +229,15 @@ static ssize_t bcm43xx_attr_interfmode_sreturn -EINVAL ; } -bcm43xx_lock_mmio (bcm, flags); -assert (bcm->initialized); +bcm43xx_lock_irqsafe (bcm, flags); err =bcm43xx_radio_set_interference_mitigation (bcm, mode);if (err) { printk(KERN_ERR PFX "Interference Mitigation not " "supported by device\n"); } - -bcm43xx_unlock_mmio (bcm, flags); +mmiowb (); +bcm43xx_unlock_irqsafe (bcm, flags);return err ? err : count; }
@@ -254,15 +251,13 @@ static ssize_t bcm43xx_attr_preamble_sho char *buf) {struct bcm43xx_private *bcm =dev_to_bcm (dev); -unsigned long flags;int err;ssize_t count;if (!capable (CAP_NET_ADMIN ))return -EPERM ; -bcm43xx_lock (bcm, flags); -assert (bcm->initialized); +bcm43xx_lock_noirq (bcm);if (bcm->short_preamble) count =snprintf (buf,PAGE_SIZE ,"1 (Short Preamble enabled)\n" );
@@ -270,7 +265,7 @@ static ssize_t bcm43xx_attr_preamble_sho count =snprintf (buf,PAGE_SIZE ,"0 (Short Preamble disabled)\n" ); err =0 ; -bcm43xx_unlock (bcm, flags); +bcm43xx_unlock_noirq (bcm);return err ? err : count; }
@@ -290,13 +285,12 @@ static ssize_t bcm43xx_attr_preamble_sto value =get_boolean (buf, count);if (value <0 )return value; -bcm43xx_lock (bcm, flags); -assert (bcm->initialized); +bcm43xx_lock_irqsafe (bcm, flags); bcm->short_preamble = !!value; err =0 ; -bcm43xx_unlock (bcm, flags); +bcm43xx_unlock_irqsafe (bcm, flags);return err ? err : count; }
@@ -310,7 +304,7 @@ int bcm43xx_sysfs_register(struct bcm43xstruct device *dev = &bcm->pci_dev->dev;int err; -assert (bcm->initialized); +assert (bcm43xx_status (bcm) == BCM43xx_STAT_INITIALIZED); err =device_create_file (dev, &dev_attr_sprom);if (err)
drivers/net/wireless/bcm43xx/bcm43xx_wx.c +52 -55
340 lines not on this page · raw message
drivers/net/wireless/ipw2200.c +32 -9
106 lines not on this page · raw message
drivers/net/wireless/ipw2200.h +1 -0
@@ -1173,6 +1173,7 @@ struct ipw_priv {struct ieee80211_device *ieee;spinlock_t lock; +spinlock_t irq_lock;struct mutex mutex;/* basic pci-network driver stuff */
include/net/ieee80211.h +3 -2
@@ -968,6 +968,7 @@ #define IEEE80211_52GHZ_CHANNELS (IEEE80enum {IEEE80211_CH_PASSIVE_ONLY = (1 <<0 ), +IEEE80211_CH_80211H_RULES = (1 <<1 ),IEEE80211_CH_B_ONLY = (1 <<2 ),IEEE80211_CH_NO_IBSS = (1 <<3 ),IEEE80211_CH_UNIFORM_SPREADING = (1 <<4 ),
@@ -976,10 +977,10 @@ enum { };struct ieee80211_channel { -u32 freq; +u32 freq;/* in MHz */ u8 channel;u8 flags; -u8 max_power; +u8 max_power;/* in dBm */ };struct ieee80211_geo {
net/ieee80211/softmac/ieee80211softmac_wx.c +1 -1
@@ -388,7 +388,7 @@ ieee80211softmac_wx_set_genie(struct netmemcpy (mac->wpa.IE, extra, wrqu->data.length); dprintk(KERN_INFO PFX "generic IE set to ");for (i=0 ;i<wrqu->data.length;i++) -dprintk ("%.2x" , mac->wpa.IE[i]); +dprintk ("%.2x" , (u8 )mac->wpa.IE[i]);dprintk ("\n" ); mac->wpa.IElen = wrqu->data.length; }else {
Signature · 2 lines
John W. Linville [email protected]
Quoted 15 lines · John W. Linville
The following changes since commit
76df73ff90e99681a99e457aec4cfe0a240b7982:
John W. Linville:
Merge branch 'from-linus' into upstreamare found in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.gitupstreamJiri Slaby:
pci: bcm43xx avoidpci_find_deviceLarry Finger:
wireless: Changes toieee80211.hfor user space regulatory daemon
wireless: correct dump of WPA IE
Quoted 6 lines
Michael Buesch:
bcm43xx: redesign locking
bcm43xx: preemptible periodic workZhu Yi:
ipw2200 locking fix
pulled