Skip to contentSkip to conversation

bcm43xx: init routine rewrite (bugfix)

PATCH In review Michael Buesch 2 participants 3 messages Jul 1, 2006 – Jul 7, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcm43xx: init routine rewrite (bugfix)

Hi,

This patch is a rewrite of the bcm43xx init routine. It is supposed to fix several issues:
* up-down-up.. sequence stale-data issue
(This may fix dhclient issues)
* Fix init vs IRQ race.
* Fix init for cards with multiple cores (APHY) (untested)
* Fix controller restart breakage.
* Make used wireless core (phymode) selectable at runtime.
* Well, few others. Don't remember :)

--

drivers/net/wireless/bcm43xx/bcm43xx.h +25 -25
Index: wireless-2.6/drivers/net/wireless/bcm43xx/bcm43xx.h
===================================================================
@@ -502,6 +502,12 @@
 	 * This lock is only used by bcm43xx_phy_{un}lock()
 	 */
 	spinlock_t lock;
+
+	/* Firmware. */
+	const struct firmware *ucode;
+	const struct firmware *pcm;
+	const struct firmware *initvals0;
+	const struct firmware *initvals1;
 };
 
 
@@ -591,12 +597,14 @@
 	u8 available:1,
 	   enabled:1,
 	   initialized:1;
-	/** core_id ID number */
-	u16 id;
 	/** core_rev revision number */
 	u8 rev;
 	/** Index number for _switch_core() */
 	u8 index;
+	/** core_id ID number */
+	u16 id;
+	/** Core-specific data. */
+	void *priv;
 };
 
 /* Additional information for each 80211 core. */
@@ -645,7 +653,10 @@
 	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))
+#define bcm43xx_set_status(bcm, stat)	do {			\
+		atomic_set(&(bcm)->init_status, (stat));	\
+		smp_wmb();					\
+					} while (0)
 
 struct bcm43xx_private {
 	struct ieee80211_device *ieee;
@@ -706,10 +717,6 @@
 	struct bcm43xx_coreinfo core_80211[ BCM43xx_MAX_80211_CORES ];
 	/* Additional information, specific to the 80211 cores. */
 	struct bcm43xx_coreinfo_80211 core_80211_ext[ BCM43xx_MAX_80211_CORES ];
-	/* Index of the current 80211 core. If current_core is not
-	 * an 80211 core, this is -1.
-	 */
-	int current_80211_core_idx;
 	/* Number of available 80211 cores. */
 	int nr_80211_available;
 
@@ -744,12 +751,6 @@
 	struct bcm43xx_key key[54];
 	u8 default_key_idx;
 
-	/* Firmware. */
-	const struct firmware *ucode;
-	const struct firmware *pcm;
-	const struct firmware *initvals0;
-	const struct firmware *initvals1;
-
 	/* Debugging stuff follows. */
 #ifdef CONFIG_BCM43XX_DEBUG
 	struct bcm43xx_dfsentry *dfsentry;
@@ -857,34 +858,33 @@
  * any of these functions.
  */
 static inline
+struct bcm43xx_coreinfo_80211 *
+bcm43xx_current_80211_priv(struct bcm43xx_private *bcm)
+{
+	assert(bcm->current_core->id == BCM43xx_COREID_80211);
+	return bcm->current_core->priv;
+}
+static inline
 struct bcm43xx_pio * bcm43xx_current_pio(struct bcm43xx_private *bcm)
 {
 	assert(bcm43xx_using_pio(bcm));
-	assert(bcm->current_80211_core_idx >= 0);
-	assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES);
-	return &(bcm->core_80211_ext[bcm->current_80211_core_idx].pio);
+	return &(bcm43xx_current_80211_priv(bcm)->pio);
 }
 static inline
 struct bcm43xx_dma * bcm43xx_current_dma(struct bcm43xx_private *bcm)
 {
 	assert(!bcm43xx_using_pio(bcm));
-	assert(bcm->current_80211_core_idx >= 0);
-	assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES);
-	return &(bcm->core_80211_ext[bcm->current_80211_core_idx].dma);
+	return &(bcm43xx_current_80211_priv(bcm)->dma);
 }
 static inline
 struct bcm43xx_phyinfo * bcm43xx_current_phy(struct bcm43xx_private *bcm)
 {
-	assert(bcm->current_80211_core_idx >= 0);
-	assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES);
-	return &(bcm->core_80211_ext[bcm->current_80211_core_idx].phy);
+	return &(bcm43xx_current_80211_priv(bcm)->phy);
 }
 static inline
 struct bcm43xx_radioinfo * bcm43xx_current_radio(struct bcm43xx_private *bcm)
 {
-	assert(bcm->current_80211_core_idx >= 0);
-	assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES);
-	return &(bcm->core_80211_ext[bcm->current_80211_core_idx].radio);
+	return &(bcm43xx_current_80211_priv(bcm)->radio);
 }
 
 
drivers/net/wireless/bcm43xx/bcm43xx_main.c +354 -238

903 lines not on this page · raw message

drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c +44 -0

68 lines not on this page · raw message

drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h +1 -0
Index: wireless-2.6/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
===================================================================
@@ -20,6 +20,7 @@
 	struct dentry *dentry_spromdump;
 	struct dentry *dentry_tsf;
 	struct dentry *dentry_txstat;
+	struct dentry *dentry_restart;
 
 	struct bcm43xx_private *bcm;
 
drivers/net/wireless/bcm43xx/bcm43xx_main.h +3 -0
Index: wireless-2.6/drivers/net/wireless/bcm43xx/bcm43xx_main.h
===================================================================
@@ -133,6 +133,9 @@
 
 int bcm43xx_switch_core(struct bcm43xx_private *bcm, struct bcm43xx_coreinfo *new_core);
 
+int bcm43xx_select_wireless_core(struct bcm43xx_private *bcm,
+				 int phytype);
+
 void bcm43xx_wireless_core_reset(struct bcm43xx_private *bcm, int connect_phy);
 
 void bcm43xx_mac_suspend(struct bcm43xx_private *bcm);
drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c +70 -0

91 lines not on this page · raw message

Signature · 1 line
Greetings Michael.
#1 lore raw
Quoted 12 lines · Michael Buesch

Hi,

This patch is a rewrite of the bcm43xx init routine. It is supposed to fix several issues:
* up-down-up.. sequence stale-data issue
(This may fix dhclient issues)
* Fix init vs IRQ race.
* Fix init for cards with multiple cores (APHY) (untested)
* Fix controller restart breakage.
* Make used wireless core (phymode) selectable at runtime.
* Well, few others. Don't remember :)

Since your subject includes "RFT", I'm NOT going to apply this. Please correct me if your desire is otherwise.

Thanks,

John

Signature · 2 lines
John W. Linville
[email protected]
#2 lore raw
Quoted 14 lines · you
Quoted 12 lines · Michael Buesch

Hi,

This patch is a rewrite of the bcm43xx init routine. It is supposed to fix several issues:
* up-down-up.. sequence stale-data issue
(This may fix dhclient issues)
* Fix init vs IRQ race.
* Fix init for cards with multiple cores (APHY) (untested)
* Fix controller restart breakage.
* Make used wireless core (phymode) selectable at runtime.
* Well, few others. Don't remember :)

Quoted 2 lines

Since your subject includes "RFT", I'm NOT going to apply this. Please correct me if your desire is otherwise.

Yes, that's right. Please don't apply this, yet.
I will resend it soon in a submittable mail.

As a general rule, don't apply any patches from me to any trees that have RFT in Subject.

Signature · 1 line
Greetings Michael.