* [RFC] bcm43xx-mac80211: Hack to turn automatic pctl off
@ 2007-08-06 21:12 Larry Finger
0 siblings, 0 replies; 7+ messages in thread
From: Larry Finger @ 2007-08-06 21:12 UTC (permalink / raw)
To: Michael Buesch; +Cc: Bcm43xx-dev, linux-wireless
For testing purposes, this patch adds a file named "power_level" to the
debugfs for bcm43xx-mac80211. If this file is read, it returns the current
setting for the "Desired power level". Writing a number between 5 and 18
will set that value as the new value for the desired power setting.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
Michael,
The error before is fixed in this version.
Larry
Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_debugfs.c
===================================================================
--- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_debugfs.c
+++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_debugfs.c
@@ -151,6 +151,74 @@ out_unlock_bb:
return res;
}
+static ssize_t power_read_file(struct file *file, char __user *userbuf,
+ size_t count, loff_t *ppos)
+{
+ struct bcm43xx_wldev *dev = file->private_data;
+ const size_t len = ARRAY_SIZE(big_buffer);
+ char *buf = big_buffer;
+ size_t pos = 0;
+ ssize_t res;
+ unsigned long flags;
+
+ mutex_lock(&big_buffer_mutex);
+ mutex_lock(&dev->wl->mutex);
+ spin_lock_irqsave(&dev->wl->irq_lock, flags);
+ if (bcm43xx_status(dev) < BCM43xx_STAT_STARTED) {
+ fappend("Board not initialized.\n");
+ goto out;
+ }
+ fappend("%d dBm\n",dev->phy.power_level);
+
+out:
+ spin_unlock_irqrestore(&dev->wl->irq_lock, flags);
+ mutex_unlock(&dev->wl->mutex);
+ res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
+ mutex_unlock(&big_buffer_mutex);
+
+ return res;
+}
+
+static ssize_t power_write_file(struct file *file, const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct bcm43xx_wldev *dev = file->private_data;
+ char *buf = big_buffer;
+ ssize_t buf_size;
+ ssize_t res;
+ unsigned long flags;
+ int power;
+
+ mutex_lock(&big_buffer_mutex);
+ buf_size = min(count, ARRAY_SIZE(big_buffer) - 1);
+ if (copy_from_user(buf, user_buf, buf_size)) {
+ res = -EFAULT;
+ goto out_unlock_bb;
+ }
+ mutex_lock(&dev->wl->mutex);
+ spin_lock_irqsave(&dev->wl->irq_lock, flags);
+ if (bcm43xx_status(dev) < BCM43xx_STAT_STARTED) {
+ bcmerr(dev->wl, "debugfs: Board not initialized.\n");
+ res = -EFAULT;
+ goto out_unlock;
+ }
+ if ((sscanf(buf, "%d", &power) != 1) || (power > 18 || power < 5)) {
+ bcmerr(dev->wl, "debugfs: Invalid values for power level\n");
+ res = -EINVAL;
+ goto out_unlock;
+ }
+ dev->phy.power_level = power;
+ res = buf_size;
+
+out_unlock:
+ spin_unlock_irqrestore(&dev->wl->irq_lock, flags);
+ mutex_unlock(&dev->wl->mutex);
+out_unlock_bb:
+ mutex_unlock(&big_buffer_mutex);
+
+ return res;
+}
+
static ssize_t txstat_read_file(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
@@ -405,6 +473,12 @@ static struct file_operations restart_fo
.open = open_file_generic,
};
+static struct file_operations power_fops = {
+ .read = power_read_file,
+ .write = power_write_file,
+ .open = open_file_generic,
+};
+
int bcm43xx_debug(struct bcm43xx_wldev *dev, enum bcm43xx_dyndbg feature)
{
@@ -495,6 +569,11 @@ void bcm43xx_debugfs_add_device(struct b
if (IS_ERR(e->dentry_restart))
e->dentry_restart = NULL;
+ e->dentry_power = debugfs_create_file("power_level", 0600, e->subdir,
+ dev, &power_fops);
+ if (IS_ERR(e->dentry_power))
+ e->dentry_power = NULL;
+
bcm43xx_add_dynamic_debug(dev);
}
@@ -512,6 +591,7 @@ void bcm43xx_debugfs_remove_device(struc
debugfs_remove(e->dentry_txstat);
debugfs_remove(e->dentry_restart);
debugfs_remove(e->dentry_txpower_g);
+ debugfs_remove(e->dentry_power);
debugfs_remove(e->subdir);
kfree(e->txstatlog.log);
kfree(e);
Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_debugfs.h
===================================================================
--- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_debugfs.h
+++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_debugfs.h
@@ -35,6 +35,7 @@ struct bcm43xx_dfsentry {
struct dentry *dentry_txstat;
struct dentry *dentry_txpower_g;
struct dentry *dentry_restart;
+ struct dentry *dentry_power;
struct bcm43xx_wldev *dev;
Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_main.c
===================================================================
--- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_main.c
+++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_main.c
@@ -2763,7 +2763,8 @@ static int bcm43xx_dev_config(struct iee
/* Adjust the desired TX power level. */
if (conf->power_level != 0) {
- if (conf->power_level != phy->power_level) {
+ if (conf->power_level != phy->power_level &&
+ phy->power_level == 0) {
phy->power_level = conf->power_level;
bcm43xx_phy_xmitpower(dev);
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [RFC] bcm43xx-mac80211: Hack to turn automatic pctl off
@ 2007-08-06 21:29 Larry Finger
2007-08-06 21:35 ` Michael Buesch
0 siblings, 1 reply; 7+ messages in thread
From: Larry Finger @ 2007-08-06 21:29 UTC (permalink / raw)
To: Michael Buesch; +Cc: Bcm43xx-dev, linux-wireless
Michael,
I sent the wrong message under this subject before.
This hack disabled hardware power control. With this installed and the
desired power set to 10 dBm using the previous patch, I get much, much
better performance from bcm43xx-mac80211 on my BCM4311. I have not yet
tested it on the BCM4306 or the BCM4318.
The new iperf readings for transmit/receive with the computer about 2 m
from the AP are as follows:
Bit Rate xmit/receive (Mbs)
1M 1.11/8.70
2M 1.44/11.0
5.5M 4.15/13.3
6M 4.76/17.4
9M 6.55/18.2
11M 6.54/14.3
18M 10.7/18.5
24M 12.8/19.5
36M 16.1/19.7
48M 18.0/19.5
54M 18.6/19.0
These numbers are comparable with what I'm getting with the PHY port from
softmac. I don't understand the dip in received rate at 11M, but it is real.
On Richard Jonsson's 4311, he isn't able to measure the transfer rate at
11M.
With these settings, the rate adjustment proces bumps the rate to 54M
automatically.
Larry
Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.c
===================================================================
--- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.c
+++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.c
@@ -471,6 +471,7 @@ void bcm43xx_phy_early_init(struct bcm43
struct bcm43xx_phy *phy = &dev->phy;
struct bcm43xx_txpower_lo_control *lo = phy->lo_control;
+ phy->hw_pctl_off = 1;
default_baseband_attenuation(dev, &phy->bbatt);
default_radio_attenuation(dev, &phy->rfatt);
phy->tx_control = (default_tx_control(dev) << 4);
Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.h
===================================================================
--- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.h
+++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.h
@@ -219,8 +219,9 @@ void bcm43xx_gphy_dc_lt_init(struct bcm4
/* Returns the boolean whether the board has HardwarePowerControl */
#define has_hardware_pctl(phy) \
+ (!((phy)->hw_pctl_off) && \
(((phy)->type == BCM43xx_PHYTYPE_A && (phy)->rev >= 5) || \
- ((phy)->type == BCM43xx_PHYTYPE_G && (phy)->rev >= 6))
+ ((phy)->type == BCM43xx_PHYTYPE_G && (phy)->rev >= 6)))
/* Returns the boolean whether "TX Magnification" is enabled. */
#define has_tx_magnification(phy) \
(((phy)->rev >= 2) && \
Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx.h
===================================================================
--- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx.h
+++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx.h
@@ -534,6 +534,7 @@ struct bcm43xx_phy {
struct bcm43xx_bbatt bbatt;
struct bcm43xx_rfatt rfatt;
u8 tx_control; /* BCM43xx_TXCTL_XXX */
+ bool hw_pctl_off;
#ifdef CONFIG_BCM43XX_MAC80211_DEBUG
bool manual_txpower_control; /* Manual TX-power control enabled? */
#endif
---
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC] bcm43xx-mac80211: Hack to turn automatic pctl off
2007-08-06 21:29 [RFC] bcm43xx-mac80211: Hack to turn automatic pctl off Larry Finger
@ 2007-08-06 21:35 ` Michael Buesch
2007-08-06 21:56 ` Michael Buesch
0 siblings, 1 reply; 7+ messages in thread
From: Michael Buesch @ 2007-08-06 21:35 UTC (permalink / raw)
To: bcm43xx-dev; +Cc: Larry Finger, linux-wireless
On Monday 06 August 2007 23:29:04 Larry Finger wrote:
> Michael,
>
> I sent the wrong message under this subject before.
>
> This hack disabled hardware power control. With this installed and the
> desired power set to 10 dBm using the previous patch, I get much, much
> better performance from bcm43xx-mac80211 on my BCM4311. I have not yet
> tested it on the BCM4306 or the BCM4318.
>
> The new iperf readings for transmit/receive with the computer about 2 m
> from the AP are as follows:
>
> Bit Rate xmit/receive (Mbs)
>
> 1M 1.11/8.70
> 2M 1.44/11.0
> 5.5M 4.15/13.3
> 6M 4.76/17.4
> 9M 6.55/18.2
> 11M 6.54/14.3
> 18M 10.7/18.5
> 24M 12.8/19.5
> 36M 16.1/19.7
> 48M 18.0/19.5
> 54M 18.6/19.0
>
> These numbers are comparable with what I'm getting with the PHY port from
> softmac. I don't understand the dip in received rate at 11M, but it is real.
> On Richard Jonsson's 4311, he isn't able to measure the transfer rate at
> 11M.
>
> With these settings, the rate adjustment proces bumps the rate to 54M
> automatically.
>
> Larry
>
>
>
> Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.c
> ===================================================================
> --- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.c
> +++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.c
> @@ -471,6 +471,7 @@ void bcm43xx_phy_early_init(struct bcm43
> struct bcm43xx_phy *phy = &dev->phy;
> struct bcm43xx_txpower_lo_control *lo = phy->lo_control;
>
> + phy->hw_pctl_off = 1;
> default_baseband_attenuation(dev, &phy->bbatt);
> default_radio_attenuation(dev, &phy->rfatt);
> phy->tx_control = (default_tx_control(dev) << 4);
> Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.h
> ===================================================================
> --- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.h
> +++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.h
> @@ -219,8 +219,9 @@ void bcm43xx_gphy_dc_lt_init(struct bcm4
>
> /* Returns the boolean whether the board has HardwarePowerControl */
> #define has_hardware_pctl(phy) \
> + (!((phy)->hw_pctl_off) && \
> (((phy)->type == BCM43xx_PHYTYPE_A && (phy)->rev >= 5) || \
> - ((phy)->type == BCM43xx_PHYTYPE_G && (phy)->rev >= 6))
> + ((phy)->type == BCM43xx_PHYTYPE_G && (phy)->rev >= 6)))
> /* Returns the boolean whether "TX Magnification" is enabled. */
> #define has_tx_magnification(phy) \
> (((phy)->rev >= 2) && \
> Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx.h
> ===================================================================
> --- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx.h
> +++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx.h
> @@ -534,6 +534,7 @@ struct bcm43xx_phy {
> struct bcm43xx_bbatt bbatt;
> struct bcm43xx_rfatt rfatt;
> u8 tx_control; /* BCM43xx_TXCTL_XXX */
> + bool hw_pctl_off;
> #ifdef CONFIG_BCM43XX_MAC80211_DEBUG
> bool manual_txpower_control; /* Manual TX-power control enabled? */
> #endif
>
> ---
> _______________________________________________
> Bcm43xx-dev mailing list
> Bcm43xx-dev@lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/bcm43xx-dev
>
>
I am currently doing a patch for this.
--
Greetings Michael.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC] bcm43xx-mac80211: Hack to turn automatic pctl off
2007-08-06 21:35 ` Michael Buesch
@ 2007-08-06 21:56 ` Michael Buesch
2007-08-06 23:25 ` Larry Finger
2007-08-07 4:48 ` Larry Finger
0 siblings, 2 replies; 7+ messages in thread
From: Michael Buesch @ 2007-08-06 21:56 UTC (permalink / raw)
To: bcm43xx-dev; +Cc: Larry Finger, linux-wireless
On Monday 06 August 2007 23:35:48 Michael Buesch wrote:
> On Monday 06 August 2007 23:29:04 Larry Finger wrote:
> > Michael,
> >
> > I sent the wrong message under this subject before.
> >
> > This hack disabled hardware power control. With this installed and the
> > desired power set to 10 dBm using the previous patch, I get much, much
> > better performance from bcm43xx-mac80211 on my BCM4311. I have not yet
> > tested it on the BCM4306 or the BCM4318.
> >
> > The new iperf readings for transmit/receive with the computer about 2 m
> > from the AP are as follows:
> >
> > Bit Rate xmit/receive (Mbs)
> >
> > 1M 1.11/8.70
> > 2M 1.44/11.0
> > 5.5M 4.15/13.3
> > 6M 4.76/17.4
> > 9M 6.55/18.2
> > 11M 6.54/14.3
> > 18M 10.7/18.5
> > 24M 12.8/19.5
> > 36M 16.1/19.7
> > 48M 18.0/19.5
> > 54M 18.6/19.0
> >
> > These numbers are comparable with what I'm getting with the PHY port from
> > softmac. I don't understand the dip in received rate at 11M, but it is real.
> > On Richard Jonsson's 4311, he isn't able to measure the transfer rate at
> > 11M.
> >
> > With these settings, the rate adjustment proces bumps the rate to 54M
> > automatically.
> >
> > Larry
> >
> >
> >
> > Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.c
> > ===================================================================
> > --- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.c
> > +++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.c
> > @@ -471,6 +471,7 @@ void bcm43xx_phy_early_init(struct bcm43
> > struct bcm43xx_phy *phy = &dev->phy;
> > struct bcm43xx_txpower_lo_control *lo = phy->lo_control;
> >
> > + phy->hw_pctl_off = 1;
> > default_baseband_attenuation(dev, &phy->bbatt);
> > default_radio_attenuation(dev, &phy->rfatt);
> > phy->tx_control = (default_tx_control(dev) << 4);
> > Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.h
> > ===================================================================
> > --- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.h
> > +++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.h
> > @@ -219,8 +219,9 @@ void bcm43xx_gphy_dc_lt_init(struct bcm4
> >
> > /* Returns the boolean whether the board has HardwarePowerControl */
> > #define has_hardware_pctl(phy) \
> > + (!((phy)->hw_pctl_off) && \
> > (((phy)->type == BCM43xx_PHYTYPE_A && (phy)->rev >= 5) || \
> > - ((phy)->type == BCM43xx_PHYTYPE_G && (phy)->rev >= 6))
> > + ((phy)->type == BCM43xx_PHYTYPE_G && (phy)->rev >= 6)))
> > /* Returns the boolean whether "TX Magnification" is enabled. */
> > #define has_tx_magnification(phy) \
> > (((phy)->rev >= 2) && \
> > Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx.h
> > ===================================================================
> > --- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx.h
> > +++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx.h
> > @@ -534,6 +534,7 @@ struct bcm43xx_phy {
> > struct bcm43xx_bbatt bbatt;
> > struct bcm43xx_rfatt rfatt;
> > u8 tx_control; /* BCM43xx_TXCTL_XXX */
> > + bool hw_pctl_off;
> > #ifdef CONFIG_BCM43XX_MAC80211_DEBUG
> > bool manual_txpower_control; /* Manual TX-power control enabled? */
> > #endif
> >
> > ---
> > _______________________________________________
> > Bcm43xx-dev mailing list
> > Bcm43xx-dev@lists.berlios.de
> > https://lists.berlios.de/mailman/listinfo/bcm43xx-dev
> >
> >
>
> I am currently doing a patch for this.
>
That's it
http://bu3sch.de/patches/wireless-dev/20070806-1186437386/patches/bcm43xx-mac80211-hwpctl-optional.patch
--
Greetings Michael.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC] bcm43xx-mac80211: Hack to turn automatic pctl off
2007-08-06 21:56 ` Michael Buesch
@ 2007-08-06 23:25 ` Larry Finger
2007-08-07 4:48 ` Larry Finger
1 sibling, 0 replies; 7+ messages in thread
From: Larry Finger @ 2007-08-06 23:25 UTC (permalink / raw)
To: Michael Buesch; +Cc: bcm43xx-dev, linux-wireless
Michael Buesch wrote:
> On Monday 06 August 2007 23:35:48 Michael Buesch wrote:
>>
>> I am currently doing a patch for this.
>>
>
> That's it
> http://bu3sch.de/patches/wireless-dev/20070806-1186437386/patches/bcm43xx-mac80211-hwpctl-optional.patch
>
It looks good. I'll test it later tonight.
I see where the ioctl to set txpower needs to be. It has not yet been coded, but I'll do that soon.
Larry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC] bcm43xx-mac80211: Hack to turn automatic pctl off
2007-08-06 21:56 ` Michael Buesch
2007-08-06 23:25 ` Larry Finger
@ 2007-08-07 4:48 ` Larry Finger
2007-08-07 9:51 ` Johannes Berg
1 sibling, 1 reply; 7+ messages in thread
From: Larry Finger @ 2007-08-07 4:48 UTC (permalink / raw)
To: Michael Buesch; +Cc: bcm43xx-dev, linux-wireless, John Linville
Michael Buesch wrote:
>
> That's it
> http://bu3sch.de/patches/wireless-dev/20070806-1186437386/patches/bcm43xx-mac80211-hwpctl-optional.patch
>
This patch makes my BCM4311 positively hum even with the power set at the default 18.5 dBm. I get
the same performance as was seen using the PHY code ported from softmac. Congratulations - you found
the secret. Of course, the system will probably be even better when hardware power control is
working, but we can now afford to wait until the reverse engineers have time.
I still have not tested with the BCM4318 and the BCM4306.
Larry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC] bcm43xx-mac80211: Hack to turn automatic pctl off
2007-08-07 4:48 ` Larry Finger
@ 2007-08-07 9:51 ` Johannes Berg
0 siblings, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2007-08-07 9:51 UTC (permalink / raw)
To: Larry Finger; +Cc: Michael Buesch, linux-wireless, bcm43xx-dev
[-- Attachment #1: Type: text/plain, Size: 635 bytes --]
On Mon, 2007-08-06 at 23:48 -0500, Larry Finger wrote:
> Michael Buesch wrote:
> >
> > That's it
> > http://bu3sch.de/patches/wireless-dev/20070806-1186437386/patches/bcm43xx-mac80211-hwpctl-optional.patch
> >
>
> This patch makes my BCM4311 positively hum even with the power set at the default 18.5 dBm. I get
> the same performance as was seen using the PHY code ported from softmac. Congratulations - you found
> the secret. Of course, the system will probably be even better when hardware power control is
> working, but we can now afford to wait until the reverse engineers have time.
Cool stuff!
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-08-07 9:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-06 21:29 [RFC] bcm43xx-mac80211: Hack to turn automatic pctl off Larry Finger
2007-08-06 21:35 ` Michael Buesch
2007-08-06 21:56 ` Michael Buesch
2007-08-06 23:25 ` Larry Finger
2007-08-07 4:48 ` Larry Finger
2007-08-07 9:51 ` Johannes Berg
-- strict thread matches above, loose matches on Subject: below --
2007-08-06 21:12 Larry Finger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).