Skip to contentSkip to conversation

Throughput regression in b43 caused by spurious avoidance implementation

DISCUSSION Stefan Brüns 2 participants 4 messages Sep 24, 2012 – Apr 26, 2013

lore
Share & tools
lore
#0 lore raw

Hi everyone,

as I have been plagued by the performance regression in b43 between linux 3.2 and 3.3, I have bisected it:

git bisect good 49d55cef5b1925a5c1efb6aaddaa40fc7c693335 is the first bad commit commit 49d55cef5b1925a5c1efb6aaddaa40fc7c693335

Author: Rafał Miłecki <[email protected]>
Date:   Sun Dec 11 13:16:51 2011 +0100

b43: N-PHY: implement spurious tone avoidance

:040000 040000 f6177f4c33e1d382a430ad83db1e4b3f9dd66dfd
1b161ac9a16a481f259606edda5039c2be5147f4 M drivers

lspci -v{n,}:
08:00.0 0280: 14e4:432b (rev 01)
Subsystem: 1028:000d
Flags: bus master, fast devsel, latency 0, IRQ 17 Memory at f0600000 (64-bit, non-prefetchable) [size=16K]
Capabilities: [40] Power Management version 3
Capabilities: [58] Vendor Specific Information: Len=78 <?>
Capabilities: [e8] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [d0] Express Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Capabilities: [13c] Virtual Channel
Capabilities: [160] Device Serial Number 7e-d8-e5-xx-xx-xx-xx
Capabilities: [16c] Power Budgeting <?>
Kernel driver in use: b43-pci-bridge

08:00.0 Network controller: Broadcom Corporation BCM4322 802.11a/b/g/n Wireless LAN Controller (rev 01)
Subsystem: Dell Wireless 1510 Wireless-N WLAN Mini-Card

Used channel is channel 13, 2.472GHz, AP is AVM 7112, "G-only" mode.

Regards,

Stefan

Signature · 2 lines
Stefan Brüns  /  Bergstraße 21  /  52062 Aachen
phone: +49 241 53809034     mobile: +49 151 50412019
#1 lore raw

2012/9/24 Stefan Brüns <[email protected]>:

Quoted 34 lines

Hi everyone,

as I have been plagued by the performance regression in b43 between linux 3.2 and 3.3, I have bisected it:

git bisect good 49d55cef5b1925a5c1efb6aaddaa40fc7c693335 is the first bad commit commit 49d55cef5b1925a5c1efb6aaddaa40fc7c693335

Author: Rafał Miłecki <[email protected]>
Date:   Sun Dec 11 13:16:51 2011 +0100

b43: N-PHY: implement spurious tone avoidance

:040000 040000 f6177f4c33e1d382a430ad83db1e4b3f9dd66dfd
1b161ac9a16a481f259606edda5039c2be5147f4 M drivers

lspci -v{n,}:
08:00.0 0280: 14e4:432b (rev 01)
Subsystem: 1028:000d
Flags: bus master, fast devsel, latency 0, IRQ 17 Memory at f0600000 (64-bit, non-prefetchable) [size=16K]
Capabilities: [40] Power Management version 3
Capabilities: [58] Vendor Specific Information: Len=78 <?>
Capabilities: [e8] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [d0] Express Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Capabilities: [13c] Virtual Channel
Capabilities: [160] Device Serial Number 7e-d8-e5-xx-xx-xx-xx
Capabilities: [16c] Power Budgeting <?>
Kernel driver in use: b43-pci-bridge

Quoted 5 lines

08:00.0 Network controller: Broadcom Corporation BCM4322 802.11a/b/g/n Wireless LAN Controller (rev 01)
Subsystem: Dell Wireless 1510 Wireless-N WLAN Mini-Card

Used channel is channel 13, 2.472GHz, AP is AVM 7112, "G-only" mode.

I'll take a look at this, unfortunately I'm leaving on Friday (for a week), not sure if I'll find time before that...

Signature · 1 line
Rafał
#2 lore raw

Hi Rafal, hi list,

had a look at it myself, the culprit is the missing setting operations in case CONFIG_B43_SSB is used.

The attached patch fixes the problem in my case, chip_id 0x4322, bus=SSB, channel=6/13.

Regards,

Stefan

phy_n.c renamed from phy_n.c_orig +37 -0
@@ -4518,10 +4518,20 @@
 	b43_phy_write(dev, B43_NPHY_BW6, e->phy_bw6);
 }
 
+/* copied verbatim from ssb/driver_chipcommon_pmu.c */
+static void ssb_chipco_pll_write(struct ssb_chipcommon *cc,
+                                 u32 offset, u32 value)
+{
+        chipco_write32(cc, SSB_CHIPCO_PLLCTL_ADDR, offset);
+        chipco_write32(cc, SSB_CHIPCO_PLLCTL_DATA, value);
+}
+
+
 /* http://bcm-v4.sipsolutions.net/802.11/PmuSpurAvoid */
 static void b43_nphy_pmu_spur_avoid(struct b43_wldev *dev, bool avoid)
 {
 	struct bcma_drv_cc __maybe_unused *cc;
+	struct ssb_chipcommon __maybe_unused *ssb_cc;
 	u32 __maybe_unused pmu_ctl;
 
 	switch (dev->dev->bus_type) {
@@ -4583,6 +4593,28 @@
 #ifdef CONFIG_B43_SSB
 	case B43_BUS_SSB:
 		/* FIXME */
+		b43info(dev->wl, "Spur avoid: bus type=%i (SSB, experimental)"
+			"chip_id=%i/0x%x avoid=%i\n", dev->dev->bus_type,
+			dev->dev->chip_id, dev->dev->chip_id, avoid);
+		ssb_cc = &dev->dev->sdev->bus->chipco;
+		if (dev->dev->chip_id == 0x4322 ||
+			   dev->dev->chip_id == 0x4340 ||
+			   dev->dev->chip_id == 0x4341) {
+			ssb_chipco_pll_write(ssb_cc, 0x0, 0x11100070);
+			ssb_chipco_pll_write(ssb_cc, 0x1, 0x1014140a);
+			ssb_chipco_pll_write(ssb_cc, 0x5, 0x88888854);
+			if (avoid)
+				ssb_chipco_pll_write(ssb_cc, 0x2, 0x05201828);
+			else
+				ssb_chipco_pll_write(ssb_cc, 0x2, 0x05001828);
+			/* guessed by comparing {bcma,ssb}_driver_chipcommon.h */
+			#define SSB_CHIPCO_PMU_CTL_PLL_UPD 0x400;
+			pmu_ctl = SSB_CHIPCO_PMU_CTL_PLL_UPD;
+		} else {
+			b43err(dev->wl, "unsupported!\n");
+			return;
+		}
+		chipco_set32(ssb_cc, SSB_CHIPCO_PMU_CTL, pmu_ctl);
 		break;
 #endif
 	}
@@ -4635,6 +4667,11 @@
 
 	b43_nphy_tx_lp_fbw(dev);
 
+	b43info(dev->wl, "phy.rev=%i phy.n->spavoid=%i(%s) ch=%i\n",
+	    dev->phy.rev, dev->phy.n->spur_avoid, 
+	    (dev->phy.n->spur_avoid == B43_SPUR_AVOID_AUTO)?"auto":"?",
+	    ch);
+
 	if (dev->phy.rev >= 3 &&
 	    dev->phy.n->spur_avoid != B43_SPUR_AVOID_DISABLE) {
 		bool avoid = false;
#3 lore raw
In reply to Stefan Brüns

2012/9/24 Stefan Brüns <[email protected]>:

Quoted 8 lines

Hi everyone,

as I have been plagued by the performance regression in b43 between linux 3.2 and 3.3, I have bisected it:

git bisect good 49d55cef5b1925a5c1efb6aaddaa40fc7c693335 is the first bad commit commit 49d55cef5b1925a5c1efb6aaddaa40fc7c693335

Quoted 7 lines
Author: Rafał Miłecki <[email protected]>
Date:   Sun Dec 11 13:16:51 2011 +0100

b43: N-PHY: implement spurious tone avoidance

Hi Stefan,

I'm not sure if you're still interested in this, as half a year has passed since your report :( Anyway we've managed to resolve most problems with BCM4322.

I took me 3 attempts to debug this issue and the last one that succeed took me few days. I was quite tricky to debug & bisect everything, as there were 4 regressions in b43 driver and I couldn't really distinct them at the beginning.

After all there were 3 patches applied to the kernel that you may be interested in:

1) b43: N-PHY: increase initial value of "mind" in RSSI calibration It has been applied in 3.4.39 and 3.8.6 stables

2) b43: N-PHY: use more bits for offset in RSSI calibration It has been applied in 3.4.39 and 3.8.6 stables

3) ssb: implement spurious tone avoidance
It has been applied in 3.4.42 and 3.8.9 stables

Unfortunately there is one more regression I've bisected but didn't manage to fix yet. It's related to the scanning on channel 13. It was reported in:

1) Scanning regression since "cfg80211: use DS or HT operation IEs to determine BSS channel"
http://www.spinics.net/lists/linux-wireless/msg105359.html
http://marc.info/?t=136431795000003&r=1&w=4

2) [No subject]
http://lists.infradead.org/pipermail/b43-dev/2013-April/003041.html

Signature · 1 line
Rafał