Skip to contentSkip to conversation

b43: implement PPR (Power Per Rate) management/API

RFC PATCH New Rafał Miłecki 1 participant 2 messages Jul 14, 2014 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/2 b43: implement PPR (Power Per Rate) management/API

Broadcom hardware supports auto-adjustment of TX power depending on the currently used rate. So far all calculations were handled without any helpers (API) using big arrays and magic offsets.
It seems Broadcom recently decided to clean this up by developing PPR. Their wlc_ppr.h can be found in open parts of the SDK.
As we plan to implement support for rate-based TX power it makes sense to also implement our version of PPR as well.

---
 drivers/net/wireless/b43/Makefile |   1 +
 drivers/net/wireless/b43/b43.h    |   7 ++
 drivers/net/wireless/b43/ppr.c    | 210 ++++++++++++++++++++++++++++++++++++++
 drivers/net/wireless/b43/ppr.h    |  21 ++++
 4 files changed, 239 insertions(+)
 create mode 100644 drivers/net/wireless/b43/ppr.c
 create mode 100644 drivers/net/wireless/b43/ppr.h
drivers/net/wireless/b43/Makefile +1 -0
index 6e00b88..9f7965a 100644
@@ -18,6 +18,7 @@ b43-y				+= xmit.o
 b43-y				+= dma.o
 b43-y				+= pio.o
 b43-y				+= rfkill.o
+b43-y				+= ppr.o
 b43-$(CONFIG_B43_LEDS)		+= leds.o
 b43-$(CONFIG_B43_PCMCIA)	+= pcmcia.o
 b43-$(CONFIG_B43_SDIO)		+= sdio.o
drivers/net/wireless/b43/b43.h +7 -0
index 4113b69..6cfd86d 100644
@@ -791,6 +791,13 @@ struct b43_firmware {
 	bool pcm_request_failed;
 };
 
+enum b43_band {
+	B43_BAND_2G = 0,
+	B43_BAND_5G_LO = 1,
+	B43_BAND_5G_MI = 2,
+	B43_BAND_5G_HI = 3,
+};
+
 /* Device (802.11 core) initialization status. */
 enum {
 	B43_STAT_UNINIT = 0,	/* Uninitialized. */
drivers/net/wireless/b43/ppr.c new file +210 -0

210 lines not on this page · raw message

drivers/net/wireless/b43/ppr.h new file +21 -0
new file mode 100644
index 0000000..5a96c31
@@ -0,0 +1,21 @@
+#ifndef LINUX_B43_PPR_H_
+#define LINUX_B43_PPR_H_
+
+#include <linux/types.h>
+
+struct b43_ppr;
+struct b43_wldev;
+enum b43_band;
+
+struct b43_ppr *b43_ppr_alloc(struct b43_wldev *dev);
+void b43_ppr_clear(struct b43_wldev *dev, struct b43_ppr *ppr);
+
+void b43_ppr_add(struct b43_wldev *dev, struct b43_ppr *ppr, int diff);
+void b43_ppr_apply_max(struct b43_wldev *dev, struct b43_ppr *ppr, u8 max);
+void b43_ppr_apply_min(struct b43_wldev *dev, struct b43_ppr *ppr, u8 min);
+u8 b43_ppr_get_max(struct b43_wldev *dev, struct b43_ppr *ppr);
+
+bool b43_ppr_load_max_from_sprom(struct b43_wldev *dev, struct b43_ppr *ppr,
+				 enum b43_band band);
+
+#endif /* LINUX_B43_PPR_H_ */
Signature · 1 line
1.8.4.5
#1 lore raw

RFC PATCH 2/2 b43: N-PHY: support setting TX power

---
So far it was tested on BCM43228 only. I can say that changing TX power definitely affects performance, but I have to check for regressions.

---
 drivers/net/wireless/b43/b43.h   |  1 +
 drivers/net/wireless/b43/phy_n.c | 81 ++++++++++++++++++++++++++++++++++------
 drivers/net/wireless/b43/phy_n.h |  3 ++
 3 files changed, 73 insertions(+), 12 deletions(-)
drivers/net/wireless/b43/b43.h +1 -0
index 6cfd86d..9b8feb9 100644
@@ -457,6 +457,7 @@ enum {
 #define B43_MACCTL_RADIOLOCK		0x00080000	/* Radio lock */
 #define B43_MACCTL_BEACPROMISC		0x00100000	/* Beacon Promiscuous */
 #define B43_MACCTL_KEEP_BADPLCP		0x00200000	/* Keep frames with bad PLCP */
+#define B43_MACCTL_PHY_LOCK		0x00200000
 #define B43_MACCTL_KEEP_CTL		0x00400000	/* Keep control frames */
 #define B43_MACCTL_KEEP_BAD		0x00800000	/* Keep bad frames (FCS) */
 #define B43_MACCTL_PROMISC		0x01000000	/* Promiscuous mode */
drivers/net/wireless/b43/phy_n.c +69 -12

121 lines not on this page · raw message

drivers/net/wireless/b43/phy_n.h +3 -0
index 7fd5d5f..2f934da 100644
@@ -963,6 +963,9 @@ struct b43_phy_n {
 	struct b43_phy_n_txpwrindex txpwrindex[2];
 	struct b43_phy_n_pwr_ctl_info pwr_ctl_info[2];
 	struct b43_chanspec txiqlocal_chanspec;
+	struct b43_ppr *tx_pwr_max_ppr;
+	u16 tx_pwr_last_recalc_freq;
+	int tx_pwr_last_recalc_limit;
 
 	u8 txrx_chain;
 	u16 tx_rx_cal_phy_saveregs[11];
Signature · 1 line
1.8.4.5