Skip to contentSkip to conversation

printk %pV compatibility in b43 and ath for compat-wireless

DISCUSSION Nick Leverton 2 participants 3 messages Dec 27, 2010 – Dec 29, 2010 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

Hi,

I'm using compat-wireless with Debian 2.6.32 (kernel for forthcoming Debian 6.0 release). It mostly works well but one thing that has crept in recently is the use of new printk features such as %pV which old kernels don't support. I noticed this whilst trying the new b43 n-phy code (for which much thanks to everyone involved), as I get kernel messages printed of the following form:

Dec 23 21:10:46 nickl kernel: [688182.007780] Broadcom 43xx driver loaded [ 
Features: PMNLS, Firmware-ID: FW13 ]
Dec 23 21:10:50 nickl kernel: [688186.100195] b43-phy0: f535bb54
Dec 23 21:10:50 nickl kernel: [688186.198711] ADDRCONF(NETDEV_UP): wlan0: link 
is not ready
Dec 23 21:11:09 nickl kernel: [688205.048054] b43-phy0: f4a3bb54
Dec 23 21:11:09 nickl kernel: [688205.145589] ADDRCONF(NETDEV_UP): wlan0: link 
is not ready
Dec 23 21:11:20 nickl kernel: [688216.484744] ADDRCONF(NETDEV_CHANGE): wlan0: 
link becomes ready
Dec 23 21:11:31 nickl kernel: [688225.667842] b43-phy0 ERROR: f56a5f34
Dec 23 21:12:14 nickl kernel: [688235.585265] b43-phy0 ERROR: f56a5f34
Dec 23 21:12:50 nickl kernel: [688270.140937] b43-phy0 ERROR: f56a5f34
Dec 23 21:13:11 nickl kernel: [688306.427195] b43-phy0 ERROR: f56a5f34
Dec 23 21:14:05 nickl kernel: [688327.492370] b43-phy0 ERROR: f56a5f34
Dec 23 21:16:23 nickl kernel: [688381.712250] b43-phy0 ERROR: f56a5f34
Dec 23 21:22:59 nickl kernel: [688518.942314] b43-phy0 ERROR: f56a5f34
Dec 23 21:23:00 nickl kernel: [688529.935161] b43-phy0 ERROR: f56a5f34

As of 20101223, the following code uses %pV, some of which can be seen above:

./drivers/net/wireless/b43/main.c:      printk(KERN_INFO "b43-%s: %pV",
./drivers/net/wireless/b43/main.c:      printk(KERN_ERR "b43-%s ERROR: %pV",
./drivers/net/wireless/b43/main.c:      printk(KERN_WARNING "b43-%s 

warning: %pV",
./drivers/net/wireless/b43/main.c: printk(KERN_DEBUG "b43-%s debug: %pV",
./drivers/net/wireless/ath/main.c: rtn = printk("%sath: %pV", level,
&vaf);
./drivers/net/wireless/b43legacy/main.c:
printk(KERN_INFO "b43legacy-%s: %pV",
./drivers/net/wireless/b43legacy/main.c: printk(KERN_ERR "b43legacy-%s
ERROR: %pV",
./drivers/net/wireless/b43legacy/main.c:
printk(KERN_WARNING "b43legacy-%s warning: %pV",
./drivers/net/wireless/b43legacy/main.c: printk(KERN_DEBUG "b43legacy-%s
debug: %pV",

It would be useful to know the error message behind the vararg !

I tried applying the patches which introduced %pV to kernel.org, but 2.6.32 is too old. Could this be fixed either in the compat b43 driver or in a compat back-feature, please ?

Thankyou

Nick

#1 lore raw
Quoted 45 lines · Nick Leverton

Hi,

I'm using compat-wireless with Debian 2.6.32 (kernel for forthcoming Debian 6.0 release). It mostly works well but one thing that has crept in recently is the use of new printk features such as %pV which old kernels don't support. I noticed this whilst trying the new b43 n-phy code (for which much thanks to everyone involved), as I get kernel messages printed of the following form:

Dec 23 21:10:46 nickl kernel: [688182.007780] Broadcom 43xx driver loaded [ 
Features: PMNLS, Firmware-ID: FW13 ]
Dec 23 21:10:50 nickl kernel: [688186.100195] b43-phy0: f535bb54
Dec 23 21:10:50 nickl kernel: [688186.198711] ADDRCONF(NETDEV_UP): wlan0: link 
is not ready
Dec 23 21:11:09 nickl kernel: [688205.048054] b43-phy0: f4a3bb54
Dec 23 21:11:09 nickl kernel: [688205.145589] ADDRCONF(NETDEV_UP): wlan0: link 
is not ready
Dec 23 21:11:20 nickl kernel: [688216.484744] ADDRCONF(NETDEV_CHANGE): wlan0: 
link becomes ready
Dec 23 21:11:31 nickl kernel: [688225.667842] b43-phy0 ERROR: f56a5f34
Dec 23 21:12:14 nickl kernel: [688235.585265] b43-phy0 ERROR: f56a5f34
Dec 23 21:12:50 nickl kernel: [688270.140937] b43-phy0 ERROR: f56a5f34
Dec 23 21:13:11 nickl kernel: [688306.427195] b43-phy0 ERROR: f56a5f34
Dec 23 21:14:05 nickl kernel: [688327.492370] b43-phy0 ERROR: f56a5f34
Dec 23 21:16:23 nickl kernel: [688381.712250] b43-phy0 ERROR: f56a5f34
Dec 23 21:22:59 nickl kernel: [688518.942314] b43-phy0 ERROR: f56a5f34
Dec 23 21:23:00 nickl kernel: [688529.935161] b43-phy0 ERROR: f56a5f34

As of 20101223, the following code uses %pV, some of which can be seen above:

./drivers/net/wireless/b43/main.c:      printk(KERN_INFO "b43-%s: %pV",
./drivers/net/wireless/b43/main.c:      printk(KERN_ERR "b43-%s ERROR: %pV",
./drivers/net/wireless/b43/main.c:      printk(KERN_WARNING "b43-%s 

warning: %pV",
./drivers/net/wireless/b43/main.c: printk(KERN_DEBUG "b43-%s debug: %pV",
./drivers/net/wireless/ath/main.c: rtn = printk("%sath: %pV", level,
&vaf);
./drivers/net/wireless/b43legacy/main.c:
printk(KERN_INFO "b43legacy-%s: %pV",
./drivers/net/wireless/b43legacy/main.c: printk(KERN_ERR "b43legacy-%s
ERROR: %pV",
./drivers/net/wireless/b43legacy/main.c:
printk(KERN_WARNING "b43legacy-%s warning: %pV",
./drivers/net/wireless/b43legacy/main.c: printk(KERN_DEBUG "b43legacy-%s
debug: %pV",

Quoted 5 lines

It would be useful to know the error message behind the vararg !

I tried applying the patches which introduced %pV to kernel.org, but 2.6.32 is too old. Could this be fixed either in the compat b43 driver or in a compat back-feature, please ?

These changes were in commit #5b736d42.

I cannot fix them in compat-wireless, but I think I know the origin of those errors. At present, b43 is not setting up the transmit header correctly for N PHYs. Whenever, the rate-setting mechanism tries an OFDM rate, one of these errors will occur. We are working on modifications to the driver to fix this. Until we get that done, issue an 'iwconfig wlan0 rate 11M' to lock the interface at 11 Mb/s.

The attached patch can be reverse-applied to fix the driver.

Larry

commit 5b736d42bc51fe893fd7d4ceac34c727d23135e1

Author: Joe Perches <[email protected]>
Date:   Tue Nov 9 16:35:18 2010 -0800

drivers/net/wireless/b43/main.c: Use printf extension %pV

Using %pV reduces the number of printk calls and eliminates any possible message interleaving from other printk calls.

drivers/net/wireless/b43/main.c +36 -12
index a118652..fa48803 100644
@@ -322,59 +322,83 @@ static int b43_ratelimit(struct b43_wl *wl)
 
 void b43info(struct b43_wl *wl, const char *fmt, ...)
 {
+	struct va_format vaf;
 	va_list args;
 
 	if (b43_modparam_verbose < B43_VERBOSITY_INFO)
 		return;
 	if (!b43_ratelimit(wl))
 		return;
+
 	va_start(args, fmt);
-	printk(KERN_INFO "b43-%s: ",
-	       (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan");
-	vprintk(fmt, args);
+
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	printk(KERN_INFO "b43-%s: %pV",
+	       (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf);
+
 	va_end(args);
 }
 
 void b43err(struct b43_wl *wl, const char *fmt, ...)
 {
+	struct va_format vaf;
 	va_list args;
 
 	if (b43_modparam_verbose < B43_VERBOSITY_ERROR)
 		return;
 	if (!b43_ratelimit(wl))
 		return;
+
 	va_start(args, fmt);
-	printk(KERN_ERR "b43-%s ERROR: ",
-	       (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan");
-	vprintk(fmt, args);
+
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	printk(KERN_ERR "b43-%s ERROR: %pV",
+	       (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf);
+
 	va_end(args);
 }
 
 void b43warn(struct b43_wl *wl, const char *fmt, ...)
 {
+	struct va_format vaf;
 	va_list args;
 
 	if (b43_modparam_verbose < B43_VERBOSITY_WARN)
 		return;
 	if (!b43_ratelimit(wl))
 		return;
+
 	va_start(args, fmt);
-	printk(KERN_WARNING "b43-%s warning: ",
-	       (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan");
-	vprintk(fmt, args);
+
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	printk(KERN_WARNING "b43-%s warning: %pV",
+	       (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf);
+
 	va_end(args);
 }
 
 void b43dbg(struct b43_wl *wl, const char *fmt, ...)
 {
+	struct va_format vaf;
 	va_list args;
 
 	if (b43_modparam_verbose < B43_VERBOSITY_DEBUG)
 		return;
+
 	va_start(args, fmt);
-	printk(KERN_DEBUG "b43-%s debug: ",
-	       (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan");
-	vprintk(fmt, args);
+
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	printk(KERN_DEBUG "b43-%s debug: %pV",
+	       (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf);
+
 	va_end(args);
 }
 
#2 lore raw

In article <[email protected]>,

Quoted 12 lines · Larry Finger

-=-=-=-=-=-

Quoted 6 lines · Nick Leverton
Dec 23 21:10:46 nickl kernel: [688182.007780] Broadcom 43xx driver loaded [ 
Features: PMNLS, Firmware-ID: FW13 ]
Dec 23 21:10:50 nickl kernel: [688186.100195] b43-phy0: f535bb54
Dec 23 21:11:09 nickl kernel: [688205.048054] b43-phy0: f4a3bb54
Dec 23 21:11:31 nickl kernel: [688225.667842] b43-phy0 ERROR: f56a5f34

These changes were in commit #5b736d42.

Quoted 8 lines

I cannot fix them in compat-wireless, but I think I know the origin of those errors. At present, b43 is not setting up the transmit header correctly for N PHYs. Whenever, the rate-setting mechanism tries an OFDM rate, one of these errors will occur. We are working on modifications to the driver to fix this. Until we get that done, issue an 'iwconfig wlan0 rate 11M' to lock the interface at 11 Mb/s.

The attached patch can be reverse-applied to fix the driver.

That's super, thankyou - fixed the message format, rate-limit then stops the error reports and and also improved the stability ! I'll see if it can keep an SSH session up overnight, but it's looking very good so far. This is a 14e4:4328 device in a 32bit Dell Latitude.

Now reporting (must get around to adding DEBUG to the driver):

Dec 29 00:00:36 nickl kernel: [1127991.569823] b43-pci-bridge 0000:0c:00.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
Dec 29 00:00:36 nickl kernel: [1127991.637758] ssb: Sonics Silicon Backplane found on PCI device 0000:0c:00.0
Dec 29 00:00:36 nickl kernel: [1127991.662341] b43-phy0: Broadcom 4321 WLAN found (core revision 12)
Dec 29 00:00:36 nickl kernel: [1127991.732169] Registered led device: b43-phy0::tx
Dec 29 00:00:36 nickl kernel: [1127991.732213] Registered led device: b43-phy0::rx
Dec 29 00:00:36 nickl kernel: [1127991.732255] Registered led device: b43-phy0::radio
Dec 29 00:00:36 nickl kernel: [1127991.732292] Broadcom 43xx driver loaded [ Features: PMNLS, Firmware-ID: FW13 ]
Dec 29 00:00:41 nickl kernel: [1127996.256626] b43-phy0: Loading firmware version 478.104 (2008-07-01 00:50:23)
Dec 29 00:00:41 nickl kernel: [1127996.353560] ADDRCONF(NETDEV_UP): wlan0: link is not ready
Dec 29 00:00:52 nickl kernel: [1128007.749755] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Dec 29 00:01:01 nickl kernel: [1128016.857337] b43-phy0 ERROR: PHY transmission error
Dec 29 00:02:08 nickl kernel: [1128083.486959] device wlan0 entered promiscuous mode
Dec 29 00:02:14 nickl kernel: [1128089.096688] b43-phy0 ERROR: PHY transmission error
Dec 29 00:02:26 nickl kernel: [1128101.280579] b43-phy0 ERROR: PHY transmission error

Nick

Signature · 3 lines
Serendipity: http://www.leverton.org/blosxom (last update 29th March 2010)
        "The Internet, a sort of ersatz counterfeit of real life"
                -- Janet Street-Porter, BBC2, 19th March 1996