diff mbox series

[RFC] mt76: add 3dBm for reporting txpower also for 1x1

Message ID 1552484061-4647-1-git-send-email-sgruszka@redhat.com (mailing list archive)
State Rejected
Delegated to: Felix Fietkau
Headers show
Series [RFC] mt76: add 3dBm for reporting txpower also for 1x1 | expand

Commit Message

Stanislaw Gruszka March 13, 2019, 1:34 p.m. UTC
It's not clear for my why we should add 3dBm for 2x2 devices
and not for 1x1. 3dBm looks rater like minimal txpower and
hardware transmit at 3dBm + dev->txpower_cur / 2 .

With the change reported txpower value are closer to regulatory
values, but honestly I have no idea what should be reported.

Perhaps also some better comment should be added.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/mac80211.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Felix Fietkau March 13, 2019, 1:38 p.m. UTC | #1
On 2019-03-13 14:34, Stanislaw Gruszka wrote:
> It's not clear for my why we should add 3dBm for 2x2 devices
> and not for 1x1. 3dBm looks rater like minimal txpower and
> hardware transmit at 3dBm + dev->txpower_cur / 2 .
> 
> With the change reported txpower value are closer to regulatory
> values, but honestly I have no idea what should be reported.
> 
> Perhaps also some better comment should be added.
> 
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
The reason why we add 3dBm is because using two chains to transmit in
the worst case (from regulatory point of view) doubles the transmit
power (= +3dBm). There's no reason to do the same for 1x1.

- Felix
Tom Psyborg March 13, 2019, 2:11 p.m. UTC | #2
On 13/03/2019, Felix Fietkau <nbd@nbd.name> wrote:

> The reason why we add 3dBm is because using two chains to transmit in
> the worst case (from regulatory point of view) doubles the transmit
> power (= +3dBm).

An absurd idea that probably came from some misinformed regulatory
boys. There is no way to have 3dBm higher output power just because an
additional antenna exist. Even with 3x3 case it already proves as
inconsistent since there is no 6dB decrease but 5dB.
If this were to continue it would render 8x8 wifi AP useless.
Felix Fietkau March 13, 2019, 2:21 p.m. UTC | #3
On 2019-03-13 15:11, Tom Psyborg wrote:
> On 13/03/2019, Felix Fietkau <nbd@nbd.name> wrote:
> 
>> The reason why we add 3dBm is because using two chains to transmit in
>> the worst case (from regulatory point of view) doubles the transmit
>> power (= +3dBm).
> 
> An absurd idea that probably came from some misinformed regulatory
> boys. There is no way to have 3dBm higher output power just because an
> additional antenna exist. Even with 3x3 case it already proves as
> inconsistent since there is no 6dB decrease but 5dB.
Why would it be 6dB for 3x3? It's logarithmic:
2x2: 3dB
3x3: ~4.5dB
4x4: ~6dB
8x8: ~9dB

You may not get +3dB actual output, but you do get some boost from the
extra chain.

- Felix
Stanislaw Gruszka March 14, 2019, 1:50 p.m. UTC | #4
On Wed, Mar 13, 2019 at 02:38:01PM +0100, Felix Fietkau wrote:
> On 2019-03-13 14:34, Stanislaw Gruszka wrote:
> > It's not clear for my why we should add 3dBm for 2x2 devices
> > and not for 1x1. 3dBm looks rater like minimal txpower and
> > hardware transmit at 3dBm + dev->txpower_cur / 2 .
> > 
> > With the change reported txpower value are closer to regulatory
> > values, but honestly I have no idea what should be reported.
> > 
> > Perhaps also some better comment should be added.
> > 
> > Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> The reason why we add 3dBm is because using two chains to transmit in
> the worst case (from regulatory point of view) doubles the transmit
> power (= +3dBm). There's no reason to do the same for 1x1.

Do we calculate and show correct txpower for mt76x0 then?

I have mt76x0u 50:3e:aa:a6:5d:32 and iwlmvm 1c:1b:b5:23:cf:58
devices on one laptop at the same location connected to AP.
RSSI values of both stations are quite similar:

Station 50:3e:aa:a6:5d:32 (on wlan0)
        inactive time:  4971 ms
        rx bytes:       11383
        rx packets:     97
        tx bytes:       2764
        tx packets:     17
        tx retries:     3
        tx failed:      1
        signal:         -55 [-65, -55] dBm
        signal avg:     -57 [-65, -57] dBm
        tx bitrate:     65.0 MBit/s MCS 6 short GI
        rx bitrate:     6.0 MBit/s
        authorized:     yes
        authenticated:  yes
        preamble:       long
        WMM/WME:        yes
        MFP:            no
        TDLS peer:      no
Station 1c:1b:b5:23:cf:58 (on wlan0)
        inactive time:  24261 ms
        rx bytes:       11320
        rx packets:     121
        tx bytes:       2274
        tx packets:     11
        tx retries:     0
        tx failed:      1
        signal:         -52 [-60, -52] dBm
        signal avg:     -54 [-59, -55] dBm
        tx bitrate:     6.5 MBit/s MCS 0
        rx bitrate:     6.0 MBit/s
        authorized:     yes
        authenticated:  yes
        preamble:       long
        WMM/WME:        yes
        MFP:            no
        TDLS peer:      no

On laptop txpower showed by iw for mt76x0u is 17 dBm , for iwlmvm
is 22 dBm (this is value from mac80211, iwlwifi does not implement
.get_txpower() callback). 

I do not consider this as big issue though, but can confuse some users.
Apparently confuses me.

Stanislaw
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c
index 851caabbecda..b04652729112 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -733,15 +733,9 @@  int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		     int *dbm)
 {
 	struct mt76_dev *dev = hw->priv;
-	int n_chains = hweight8(dev->antenna_mask);
 
 	*dbm = dev->txpower_cur / 2;
-
-	/* convert from per-chain power to combined
-	 * output on 2x2 devices
-	 */
-	if (n_chains > 1)
-		*dbm += 3;
+	*dbm += 3;
 
 	return 0;
 }