Linux-Wireless Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/2] rtw88: report RX signal strength for each antenna
@ 2019-09-12  6:39 yhchuang
  2019-09-12  6:39 ` [PATCH 1/2] rtw88: fix wrong rx power calculation yhchuang
  2019-09-12  6:39 ` [PATCH 2/2] rtw88: report RX power for each antenna yhchuang
  0 siblings, 2 replies; 8+ messages in thread
From: yhchuang @ 2019-09-12  6:39 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, briannorris

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

For some user-space programs such as tcpdump, they can parse
the radiotap headers provided by the wireless device. And the
signal strengths for each antenna are very helpful. They can
tell us if the antennas are placed or connected properly.

Tsang-Shian Lin (1):
  rtw88: fix wrong rx power calculation

Yan-Hsuan Chuang (1):
  rtw88: report RX power for each antenna

 drivers/net/wireless/realtek/rtw88/rtw8822b.c |  1 +
 drivers/net/wireless/realtek/rtw88/rtw8822c.c | 10 +++++-----
 drivers/net/wireless/realtek/rtw88/rx.c       |  5 +++++
 3 files changed, 11 insertions(+), 5 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] rtw88: fix wrong rx power calculation
  2019-09-12  6:39 [PATCH 0/2] rtw88: report RX signal strength for each antenna yhchuang
@ 2019-09-12  6:39 ` yhchuang
  2019-09-12  7:05   ` Chris Chiu
  2019-09-13 15:14   ` Kalle Valo
  2019-09-12  6:39 ` [PATCH 2/2] rtw88: report RX power for each antenna yhchuang
  1 sibling, 2 replies; 8+ messages in thread
From: yhchuang @ 2019-09-12  6:39 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, briannorris

From: Tsang-Shian Lin <thlin@realtek.com>

Fix the wrong RF path for CCK rx power calculation.

Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
Signed-off-by: Tsang-Shian Lin <thlin@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/rtw8822c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
index 207f64c..24b27bc 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
@@ -1620,9 +1620,9 @@ static void query_phy_status_page0(struct rtw_dev *rtwdev, u8 *phy_status,
 	else if (gain_a > u_bnd)
 		rx_power[RF_PATH_A] -= (gain_a - u_bnd) << 1;
 	if (gain_b < l_bnd)
-		rx_power[RF_PATH_A] += (l_bnd - gain_b) << 1;
+		rx_power[RF_PATH_B] += (l_bnd - gain_b) << 1;
 	else if (gain_b > u_bnd)
-		rx_power[RF_PATH_A] -= (gain_b - u_bnd) << 1;
+		rx_power[RF_PATH_B] -= (gain_b - u_bnd) << 1;
 
 	rx_power[RF_PATH_A] -= 110;
 	rx_power[RF_PATH_B] -= 110;
-- 
2.7.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/2] rtw88: report RX power for each antenna
  2019-09-12  6:39 [PATCH 0/2] rtw88: report RX signal strength for each antenna yhchuang
  2019-09-12  6:39 ` [PATCH 1/2] rtw88: fix wrong rx power calculation yhchuang
@ 2019-09-12  6:39 ` yhchuang
  2019-09-12  7:15   ` Chris Chiu
  1 sibling, 1 reply; 8+ messages in thread
From: yhchuang @ 2019-09-12  6:39 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, briannorris

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

Report chains and chain_signal in ieee80211_rx_status.
It is useful for program such as tcpdump to see if the
antennas are well connected/placed.

8822C is able to receive CCK rates with 2 antennas, while
8822B can only use 1 antenna path to receive CCK rates.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/rtw8822b.c | 1 +
 drivers/net/wireless/realtek/rtw88/rtw8822c.c | 6 +++---
 drivers/net/wireless/realtek/rtw88/rx.c       | 5 +++++
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.c b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
index 568033a..0861195 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
@@ -766,6 +766,7 @@ static void query_phy_status_page0(struct rtw_dev *rtwdev, u8 *phy_status,
 	s8 min_rx_power = -120;
 	u8 pwdb = GET_PHY_STAT_P0_PWDB(phy_status);
 
+	/* 8822B uses only 1 antenna to RX CCK rates */
 	pkt_stat->rx_power[RF_PATH_A] = pwdb - 110;
 	pkt_stat->rssi = rtw_phy_rf_power_2_rssi(pkt_stat->rx_power, 1);
 	pkt_stat->bw = RTW_CHANNEL_WIDTH_20;
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
index 24b27bc..75c77ac 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
@@ -1627,9 +1627,9 @@ static void query_phy_status_page0(struct rtw_dev *rtwdev, u8 *phy_status,
 	rx_power[RF_PATH_A] -= 110;
 	rx_power[RF_PATH_B] -= 110;
 
-	pkt_stat->rx_power[RF_PATH_A] = max3(rx_power[RF_PATH_A],
-					     rx_power[RF_PATH_B],
-					     min_rx_power);
+	pkt_stat->rx_power[RF_PATH_A] = rx_power[RF_PATH_A];
+	pkt_stat->rx_power[RF_PATH_B] = rx_power[RF_PATH_B];
+
 	pkt_stat->rssi = rtw_phy_rf_power_2_rssi(pkt_stat->rx_power, 1);
 	pkt_stat->bw = RTW_CHANNEL_WIDTH_20;
 	pkt_stat->signal_power = max(pkt_stat->rx_power[RF_PATH_A],
diff --git a/drivers/net/wireless/realtek/rtw88/rx.c b/drivers/net/wireless/realtek/rtw88/rx.c
index 4d837f0..48b9ed4 100644
--- a/drivers/net/wireless/realtek/rtw88/rx.c
+++ b/drivers/net/wireless/realtek/rtw88/rx.c
@@ -90,6 +90,7 @@ void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev,
 			   u8 *phy_status)
 {
 	struct ieee80211_hw *hw = rtwdev->hw;
+	u8 path;
 
 	memset(rx_status, 0, sizeof(*rx_status));
 	rx_status->freq = hw->conf.chandef.chan->center_freq;
@@ -146,6 +147,10 @@ void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev,
 		rx_status->bw = RATE_INFO_BW_20;
 
 	rx_status->signal = pkt_stat->signal_power;
+	for (path = 0; path < rtwdev->hal.rf_path_num; path++) {
+		rx_status->chains |= BIT(path);
+		rx_status->chain_signal[path] = pkt_stat->rx_power[path];
+	}
 
 	rtw_rx_addr_match(rtwdev, pkt_stat, hdr);
 }
-- 
2.7.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] rtw88: fix wrong rx power calculation
  2019-09-12  6:39 ` [PATCH 1/2] rtw88: fix wrong rx power calculation yhchuang
@ 2019-09-12  7:05   ` Chris Chiu
  2019-09-13 15:14   ` Kalle Valo
  1 sibling, 0 replies; 8+ messages in thread
From: Chris Chiu @ 2019-09-12  7:05 UTC (permalink / raw)
  To: yhchuang; +Cc: Kalle Valo, linux-wireless, briannorris

On Thu, Sep 12, 2019 at 2:39 PM <yhchuang@realtek.com> wrote:
>
> From: Tsang-Shian Lin <thlin@realtek.com>
>
> Fix the wrong RF path for CCK rx power calculation.
>
> Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
> Signed-off-by: Tsang-Shian Lin <thlin@realtek.com>
> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Reviewed-by: Chris Chiu <chiu@endlessm.com>
> ---
>  drivers/net/wireless/realtek/rtw88/rtw8822c.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] rtw88: report RX power for each antenna
  2019-09-12  6:39 ` [PATCH 2/2] rtw88: report RX power for each antenna yhchuang
@ 2019-09-12  7:15   ` Chris Chiu
  2019-09-12  7:43     ` Tony Chuang
  0 siblings, 1 reply; 8+ messages in thread
From: Chris Chiu @ 2019-09-12  7:15 UTC (permalink / raw)
  To: yhchuang; +Cc: Kalle Valo, linux-wireless, briannorris

On Thu, Sep 12, 2019 at 2:39 PM <yhchuang@realtek.com> wrote:
>
> From: Yan-Hsuan Chuang <yhchuang@realtek.com>
>
> Report chains and chain_signal in ieee80211_rx_status.
> It is useful for program such as tcpdump to see if the
> antennas are well connected/placed.
>
> 8822C is able to receive CCK rates with 2 antennas, while
> 8822B can only use 1 antenna path to receive CCK rates.
>
> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
> ---
>  drivers/net/wireless/realtek/rtw88/rtw8822b.c | 1 +
>  drivers/net/wireless/realtek/rtw88/rtw8822c.c | 6 +++---
>  drivers/net/wireless/realtek/rtw88/rx.c       | 5 +++++
>  3 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.c b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
> index 568033a..0861195 100644
> --- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
> @@ -766,6 +766,7 @@ static void query_phy_status_page0(struct rtw_dev *rtwdev, u8 *phy_status,
>         s8 min_rx_power = -120;
>         u8 pwdb = GET_PHY_STAT_P0_PWDB(phy_status);
>
> +       /* 8822B uses only 1 antenna to RX CCK rates */
>         pkt_stat->rx_power[RF_PATH_A] = pwdb - 110;

It only uses PATH_A for receiving CCK rates packets? The comment seems
not clear enough.

Chris

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH 2/2] rtw88: report RX power for each antenna
  2019-09-12  7:15   ` Chris Chiu
@ 2019-09-12  7:43     ` Tony Chuang
  2019-09-12  9:11       ` Chris Chiu
  0 siblings, 1 reply; 8+ messages in thread
From: Tony Chuang @ 2019-09-12  7:43 UTC (permalink / raw)
  To: Chris Chiu; +Cc: Kalle Valo, linux-wireless, briannorris

> From: Chris Chiu 
> 
> On Thu, Sep 12, 2019 at 2:39 PM <yhchuang@realtek.com> wrote:
> >
> > From: Yan-Hsuan Chuang <yhchuang@realtek.com>
> >
> > Report chains and chain_signal in ieee80211_rx_status.
> > It is useful for program such as tcpdump to see if the
> > antennas are well connected/placed.
> >
> > 8822C is able to receive CCK rates with 2 antennas, while
> > 8822B can only use 1 antenna path to receive CCK rates.
> >
> > Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
> > ---
> >  drivers/net/wireless/realtek/rtw88/rtw8822b.c | 1 +
> >  drivers/net/wireless/realtek/rtw88/rtw8822c.c | 6 +++---
> >  drivers/net/wireless/realtek/rtw88/rx.c       | 5 +++++
> >  3 files changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.c
> b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
> > index 568033a..0861195 100644
> > --- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c
> > +++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
> > @@ -766,6 +766,7 @@ static void query_phy_status_page0(struct rtw_dev
> *rtwdev, u8 *phy_status,
> >         s8 min_rx_power = -120;
> >         u8 pwdb = GET_PHY_STAT_P0_PWDB(phy_status);
> >
> > +       /* 8822B uses only 1 antenna to RX CCK rates */
> >         pkt_stat->rx_power[RF_PATH_A] = pwdb - 110;
> 
> It only uses PATH_A for receiving CCK rates packets? The comment seems
> not clear enough.
> 

Yes, it can only use PATH_A, so we don't have PWDB_[A|B] for 8822B.

Yan-Hsuan


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] rtw88: report RX power for each antenna
  2019-09-12  7:43     ` Tony Chuang
@ 2019-09-12  9:11       ` Chris Chiu
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Chiu @ 2019-09-12  9:11 UTC (permalink / raw)
  To: Tony Chuang; +Cc: Kalle Valo, linux-wireless, briannorris

On Thu, Sep 12, 2019 at 3:43 PM Tony Chuang <yhchuang@realtek.com> wrote:

> > >
> > > From: Yan-Hsuan Chuang <yhchuang@realtek.com>
> > >
> > > Report chains and chain_signal in ieee80211_rx_status.
> > > It is useful for program such as tcpdump to see if the
> > > antennas are well connected/placed.
> > >
> > > 8822C is able to receive CCK rates with 2 antennas, while
> > > 8822B can only use 1 antenna path to receive CCK rates.
> > >
> > > Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Reviewed-by: Chris Chiu <chiu@endlessm.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] rtw88: fix wrong rx power calculation
  2019-09-12  6:39 ` [PATCH 1/2] rtw88: fix wrong rx power calculation yhchuang
  2019-09-12  7:05   ` Chris Chiu
@ 2019-09-13 15:14   ` Kalle Valo
  1 sibling, 0 replies; 8+ messages in thread
From: Kalle Valo @ 2019-09-13 15:14 UTC (permalink / raw)
  To: yhchuang; +Cc: linux-wireless, briannorris

<yhchuang@realtek.com> wrote:

> From: Tsang-Shian Lin <thlin@realtek.com>
> 
> Fix the wrong RF path for CCK rx power calculation.
> 
> Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
> Signed-off-by: Tsang-Shian Lin <thlin@realtek.com>
> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
> Reviewed-by: Chris Chiu <chiu@endlessm.com>

2 patches applied to wireless-drivers-next.git, thanks.

e9afa2dc4090 rtw88: fix wrong rx power calculation
98ab76ef6b6d rtw88: report RX power for each antenna

-- 
https://patchwork.kernel.org/patch/11142397/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-12  6:39 [PATCH 0/2] rtw88: report RX signal strength for each antenna yhchuang
2019-09-12  6:39 ` [PATCH 1/2] rtw88: fix wrong rx power calculation yhchuang
2019-09-12  7:05   ` Chris Chiu
2019-09-13 15:14   ` Kalle Valo
2019-09-12  6:39 ` [PATCH 2/2] rtw88: report RX power for each antenna yhchuang
2019-09-12  7:15   ` Chris Chiu
2019-09-12  7:43     ` Tony Chuang
2019-09-12  9:11       ` Chris Chiu

Linux-Wireless Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wireless/0 linux-wireless/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wireless linux-wireless/ https://lore.kernel.org/linux-wireless \
		linux-wireless@vger.kernel.org linux-wireless@archiver.kernel.org
	public-inbox-index linux-wireless


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wireless


AGPL code for this site: git clone https://public-inbox.org/ public-inbox