* [PATCH 0/4] wcn36xx: Add spectrum survey reporting
@ 2022-01-07 15:33 Bryan O'Donoghue
2022-01-07 15:33 ` [PATCH 1/4] wcn36xx: Implement get_snr() Bryan O'Donoghue
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Bryan O'Donoghue @ 2022-01-07 15:33 UTC (permalink / raw)
To: kvalo, linux-wireless, wcn36xx, linux-arm-msm
Cc: loic.poulain, benl, bryan.odonoghue
This series enables get_survey() on wcn36xx. Tested with wcn3620 and
wcn3680b.
wcn36xx reports RSSI and SNR in the buffer descriptor of each delivered
frame wcn36xx -> host. Thus far we have only extracted RSSI but, extracting
the SNR lets us also report the noise-floor.
Adding in some background tracking of the current tuned channel lets us
flag which channel is currently in use when running "iw wlan0 survey dump"
For both wcn3620 and wcn3680b I have verified both the STA and AP's view of
RSSI and noise.
Example wcn3620:
AP Asus RT-AX88U
SSID: "linaro-test"
noise: -78 dBm Channel: 8
BSSID: 04:D4:C4:AA:BB:CC
MAC RSSI
02:00:16:qq:xx:yy -35dBm
STA
root@linaro-developer:~# iw wlan0 link
Connected to 04:d4:c4:aa:bb:cc (on wlan0)
SSID: linaro-test
freq: 2447
RX: 768377 bytes (4250 packets)
TX: 8136 bytes (97 packets)
signal: -37 dBm
root@linaro-developer:~# iw wlan0 survey dump
Survey data from wlan0
frequency: 2412 MHz
Survey data from wlan0
frequency: 2417 MHz
noise: -12 dBm
Survey data from wlan0
frequency: 2422 MHz
noise: -82 dBm
Survey data from wlan0
frequency: 2427 MHz
noise: -76 dBm
Survey data from wlan0
frequency: 2432 MHz
noise: -78 dBm
Survey data from wlan0
frequency: 2437 MHz
noise: -100 dBm
Survey data from wlan0
frequency: 2442 MHz
noise: -41 dBm
Survey data from wlan0
frequency: 2447 MHz [in use]
noise: -75 dBm
Example wcn3680b:
AP Asus RT-AX88U:
SSID: "linaro-test"
noise: -80 dBm Channel: 60/160
BSSID: 04:D4:C4:DD:EE:FF
MAC RSSI
E2:C0:10:YY:XX:QQ -31dBm
STA:
root@linaro-developer:~# iw wlan0 link
Connected to 04:d4:c4:dd:ee:ff (on wlan0)
SSID: linaro-test
freq: 5300
RX: 5999294 bytes (32764 packets)
TX: 35443 bytes (493 packets)
signal: -27 dBm
rx bitrate: 433.3 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 1
tx bitrate: 6.0 MBit/s
bss flags: short-slot-time
dtim period: 3
beacon int: 100
root@linaro-developer:~# iw wlan0 survey dump
Survey data from wlan0
frequency: 2412 MHz
noise: -63 dBm
Survey data from wlan0
frequency: 2417 MHz
noise: -57 dBm
Survey data from wlan0
frequency: 2422 MHz
noise: -74 dBm
Survey data from wlan0
frequency: 2427 MHz
noise: -90 dBm
Survey data from wlan0
frequency: 2432 MHz
noise: -72 dBm
Survey data from wlan0
frequency: 2437 MHz
noise: -33 dBm
Survey data from wlan0
frequency: 2442 MHz
noise: -72 dBm
Survey data from wlan0
frequency: 2447 MHz
noise: -68 dBm
Survey data from wlan0
frequency: 2452 MHz
noise: -33 dBm
Survey data from wlan0
frequency: 2457 MHz
noise: -33 dBm
Survey data from wlan0
frequency: 2462 MHz
noise: -36 dBm
Survey data from wlan0
frequency: 2467 MHz
noise: -68 dBm
Survey data from wlan0
frequency: 2472 MHz
noise: -34 dBm
Survey data from wlan0
frequency: 5180 MHz
noise: -63 dBm
Survey data from wlan0
frequency: 5200 MHz
noise: -57 dBm
Survey data from wlan0
frequency: 5220 MHz
noise: -74 dBm
Survey data from wlan0
frequency: 5240 MHz
noise: -90 dBm
Survey data from wlan0
frequency: 5260 MHz
noise: -72 dBm
Survey data from wlan0
frequency: 5280 MHz
noise: -33 dBm
Survey data from wlan0
frequency: 5300 MHz [in use]
noise: -72 dBm
Bryan O'Donoghue (4):
wcn36xx: Implement get_snr()
wcn36xx: Track the band and channel we are tuned to
wcn36xx: Track SNR and RSSI for each RX frame
wcn36xx: Add SNR reporting via get_survey()
drivers/net/wireless/ath/wcn36xx/main.c | 81 ++++++++++++++++++++++
drivers/net/wireless/ath/wcn36xx/txrx.c | 37 ++++++++++
drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 13 ++++
3 files changed, 131 insertions(+)
--
2.33.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/4] wcn36xx: Implement get_snr()
2022-01-07 15:33 [PATCH 0/4] wcn36xx: Add spectrum survey reporting Bryan O'Donoghue
@ 2022-01-07 15:33 ` Bryan O'Donoghue
2022-01-07 15:33 ` [PATCH 2/4] wcn36xx: Track the band and channel we are tuned to Bryan O'Donoghue
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Bryan O'Donoghue @ 2022-01-07 15:33 UTC (permalink / raw)
To: kvalo, linux-wireless, wcn36xx, linux-arm-msm
Cc: loic.poulain, benl, bryan.odonoghue
The wcn36xx BD phy descriptor returns both Received Signal Strength
Information (RSSI) and Signal To Noise Ratio (SNR) with each delivered BD.
The macro to extract this data is a simple-one liner, easily imported from
downstream. This data will be useful to us when implementing
mac80211-ops->get_survey().
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
drivers/net/wireless/ath/wcn36xx/txrx.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.c b/drivers/net/wireless/ath/wcn36xx/txrx.c
index ed4e8f201f510..a3eb476c2cbc4 100644
--- a/drivers/net/wireless/ath/wcn36xx/txrx.c
+++ b/drivers/net/wireless/ath/wcn36xx/txrx.c
@@ -23,6 +23,11 @@ static inline int get_rssi0(struct wcn36xx_rx_bd *bd)
return 100 - ((bd->phy_stat0 >> 24) & 0xff);
}
+static inline int get_snr(struct wcn36xx_rx_bd *bd)
+{
+ return ((bd->phy_stat1 >> 24) & 0xff);
+}
+
struct wcn36xx_rate {
u16 bitrate;
u16 mcs_or_legacy_index;
--
2.33.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] wcn36xx: Track the band and channel we are tuned to
2022-01-07 15:33 [PATCH 0/4] wcn36xx: Add spectrum survey reporting Bryan O'Donoghue
2022-01-07 15:33 ` [PATCH 1/4] wcn36xx: Implement get_snr() Bryan O'Donoghue
@ 2022-01-07 15:33 ` Bryan O'Donoghue
2022-01-07 15:33 ` [PATCH 3/4] wcn36xx: Track SNR and RSSI for each RX frame Bryan O'Donoghue
2022-01-07 15:33 ` [PATCH 4/4] wcn36xx: Add SNR reporting via get_survey() Bryan O'Donoghue
3 siblings, 0 replies; 8+ messages in thread
From: Bryan O'Donoghue @ 2022-01-07 15:33 UTC (permalink / raw)
To: kvalo, linux-wireless, wcn36xx, linux-arm-msm
Cc: loic.poulain, benl, bryan.odonoghue
Track the band and channel we are currently tuned to by way of pointers to
the standard structures that describe them both embedded within the driver.
Tracking of the pair makes it much easier when implementing
ieee80211_ops->get_survey to return quickly captured metrics for the
currently tuned channel.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
drivers/net/wireless/ath/wcn36xx/main.c | 27 ++++++++++++++++++++++
drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 3 +++
2 files changed, 30 insertions(+)
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index ec355807f5817..d2b99f6112f6b 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -392,11 +392,38 @@ static void wcn36xx_change_opchannel(struct wcn36xx *wcn, int ch)
{
struct ieee80211_vif *vif = NULL;
struct wcn36xx_vif *tmp;
+ struct ieee80211_supported_band *band;
+ struct ieee80211_channel *channel;
+ int i, j;
+
+ for (i = 0; i < ARRAY_SIZE(wcn->hw->wiphy->bands); i++) {
+ band = wcn->hw->wiphy->bands[i];
+ if (!band)
+ break;
+ for (j = 0; j < band->n_channels; j++) {
+ if (HW_VALUE_CHANNEL(band->channels[j].hw_value) == ch) {
+ channel = &band->channels[j];
+ break;
+ }
+ }
+ if (channel)
+ break;
+ }
+
+ if (!channel) {
+ wcn36xx_err("Cannot tune to channel %d\n", ch);
+ return;
+ }
+
+ wcn->band = band;
+ wcn->channel = channel;
list_for_each_entry(tmp, &wcn->vif_list, list) {
vif = wcn36xx_priv_to_vif(tmp);
wcn36xx_smd_switch_channel(wcn, vif, ch);
}
+
+ return;
}
static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index fbd0558c2c196..dd2570e468084 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -281,6 +281,9 @@ struct wcn36xx {
/* Debug file system entry */
struct wcn36xx_dfs_entry dfs;
#endif /* CONFIG_WCN36XX_DEBUGFS */
+
+ struct ieee80211_supported_band *band;
+ struct ieee80211_channel *channel;
};
static inline bool wcn36xx_is_fw_version(struct wcn36xx *wcn,
--
2.33.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] wcn36xx: Track SNR and RSSI for each RX frame
2022-01-07 15:33 [PATCH 0/4] wcn36xx: Add spectrum survey reporting Bryan O'Donoghue
2022-01-07 15:33 ` [PATCH 1/4] wcn36xx: Implement get_snr() Bryan O'Donoghue
2022-01-07 15:33 ` [PATCH 2/4] wcn36xx: Track the band and channel we are tuned to Bryan O'Donoghue
@ 2022-01-07 15:33 ` Bryan O'Donoghue
2022-01-08 8:41 ` kernel test robot
2022-01-07 15:33 ` [PATCH 4/4] wcn36xx: Add SNR reporting via get_survey() Bryan O'Donoghue
3 siblings, 1 reply; 8+ messages in thread
From: Bryan O'Donoghue @ 2022-01-07 15:33 UTC (permalink / raw)
To: kvalo, linux-wireless, wcn36xx, linux-arm-msm
Cc: loic.poulain, benl, bryan.odonoghue
The BDs for each RX frame contain both the RSSI and SNR for the received
frame. If we track and store this information it can be useful to us in
get_survey() and potentially elsewhere.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
drivers/net/wireless/ath/wcn36xx/main.c | 12 ++++++++
drivers/net/wireless/ath/wcn36xx/txrx.c | 32 ++++++++++++++++++++++
drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 10 +++++++
3 files changed, 54 insertions(+)
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index d2b99f6112f6b..d130ebb965146 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -331,6 +331,7 @@ static int wcn36xx_start(struct ieee80211_hw *hw)
INIT_LIST_HEAD(&wcn->vif_list);
spin_lock_init(&wcn->dxe_lock);
+ spin_lock_init(&wcn->survey_lock);
return 0;
@@ -394,6 +395,7 @@ static void wcn36xx_change_opchannel(struct wcn36xx *wcn, int ch)
struct wcn36xx_vif *tmp;
struct ieee80211_supported_band *band;
struct ieee80211_channel *channel;
+ unsigned long flags;
int i, j;
for (i = 0; i < ARRAY_SIZE(wcn->hw->wiphy->bands); i++) {
@@ -415,8 +417,10 @@ static void wcn36xx_change_opchannel(struct wcn36xx *wcn, int ch)
return;
}
+ spin_lock_irqsave(&wcn->survey_lock, flags);
wcn->band = band;
wcn->channel = channel;
+ spin_unlock_irqrestore(&wcn->survey_lock, flags);
list_for_each_entry(tmp, &wcn->vif_list, list) {
vif = wcn36xx_priv_to_vif(tmp);
@@ -1562,6 +1566,7 @@ static int wcn36xx_probe(struct platform_device *pdev)
void *wcnss;
int ret;
const u8 *addr;
+ int n_channels;
wcn36xx_dbg(WCN36XX_DBG_MAC, "platform probe\n");
@@ -1589,6 +1594,13 @@ static int wcn36xx_probe(struct platform_device *pdev)
goto out_wq;
}
+ n_channels = wcn_band_2ghz.n_channels + wcn_band_5ghz.n_channels;
+ wcn->chan_survey = devm_kmalloc(wcn->dev, n_channels, GFP_KERNEL);
+ if (!wcn->chan_survey) {
+ ret -= ENOMEM;
+ goto out_wq;
+ }
+
ret = dma_set_mask_and_coherent(wcn->dev, DMA_BIT_MASK(32));
if (ret < 0) {
wcn36xx_err("failed to set DMA mask: %d\n", ret);
diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.c b/drivers/net/wireless/ath/wcn36xx/txrx.c
index a3eb476c2cbc4..0425781bc2fe1 100644
--- a/drivers/net/wireless/ath/wcn36xx/txrx.c
+++ b/drivers/net/wireless/ath/wcn36xx/txrx.c
@@ -271,6 +271,34 @@ static void __skb_queue_purge_irq(struct sk_buff_head *list)
dev_kfree_skb_irq(skb);
}
+static void wcn36xx_update_survey(struct wcn36xx *wcn, int rssi, int snr,
+ int band, int freq)
+{
+ static struct ieee80211_channel *channel;
+ struct ieee80211_supported_band *sband;
+ int idx;
+ int i;
+
+ idx = 0;
+ if (band == NL80211_BAND_5GHZ)
+ idx = wcn->hw->wiphy->bands[NL80211_BAND_2GHZ]->n_channels;
+
+ sband = wcn->hw->wiphy->bands[band];
+ channel = sband->channels;
+
+ for (i = 0; i < sband->n_channels; i++, channel++) {
+ if (channel->center_freq == freq) {
+ idx += i;
+ break;
+ }
+ }
+
+ spin_lock(&wcn->survey_lock);
+ wcn->chan_survey[idx].rssi = rssi;
+ wcn->chan_survey[idx].snr = snr;
+ spin_unlock(&wcn->survey_lock);
+}
+
int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)
{
struct ieee80211_rx_status status;
@@ -343,11 +371,15 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)
status.band = NL80211_BAND_2GHZ;
status.freq = ieee80211_channel_to_frequency(hwch, status.band);
}
+
} else {
status.band = WCN36XX_BAND(wcn);
status.freq = WCN36XX_CENTER_FREQ(wcn);
}
+ wcn36xx_update_survey(wcn, status.signal, get_snr(bd),
+ status.band, status.freq);
+
if (bd->rate_id < ARRAY_SIZE(wcn36xx_rate_table)) {
rate = &wcn36xx_rate_table[bd->rate_id];
status.encoding = rate->encoding;
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index dd2570e468084..81eaa74601d0f 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -194,7 +194,14 @@ struct wcn36xx_sta {
enum wcn36xx_ampdu_state ampdu_state[16];
int non_agg_frame_ct;
};
+
struct wcn36xx_dxe_ch;
+
+struct wcn36xx_chan_survey {
+ s8 rssi;
+ u8 snr;
+};
+
struct wcn36xx {
struct ieee80211_hw *hw;
struct device *dev;
@@ -284,6 +291,9 @@ struct wcn36xx {
struct ieee80211_supported_band *band;
struct ieee80211_channel *channel;
+
+ spinlock_t survey_lock; /* protects chan_survey */
+ struct wcn36xx_chan_survey *chan_survey;
};
static inline bool wcn36xx_is_fw_version(struct wcn36xx *wcn,
--
2.33.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] wcn36xx: Add SNR reporting via get_survey()
2022-01-07 15:33 [PATCH 0/4] wcn36xx: Add spectrum survey reporting Bryan O'Donoghue
` (2 preceding siblings ...)
2022-01-07 15:33 ` [PATCH 3/4] wcn36xx: Track SNR and RSSI for each RX frame Bryan O'Donoghue
@ 2022-01-07 15:33 ` Bryan O'Donoghue
2022-01-07 19:28 ` kernel test robot
3 siblings, 1 reply; 8+ messages in thread
From: Bryan O'Donoghue @ 2022-01-07 15:33 UTC (permalink / raw)
To: kvalo, linux-wireless, wcn36xx, linux-arm-msm
Cc: loic.poulain, benl, bryan.odonoghue
Add support for get_survey() reporting. Current channel and noise-floor are
reported, other parameters such as scan, busy, TX and RX time are not
immediately available.
Noise is a useful metric to report, so bring it out now.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
drivers/net/wireless/ath/wcn36xx/main.c | 42 +++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index d130ebb965146..bcef590be60dc 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -1357,6 +1357,47 @@ static void wcn36xx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
}
}
+int wcn36xx_get_survey(struct ieee80211_hw *hw, int idx,
+ struct survey_info *survey)
+{
+ struct wcn36xx *wcn = hw->priv;
+ struct ieee80211_supported_band *sband;
+ struct wcn36xx_chan_survey *chan_survey;
+ unsigned long flags;
+
+ sband = wcn->hw->wiphy->bands[NL80211_BAND_2GHZ];
+ if (idx >= sband->n_channels) {
+ idx -= sband->n_channels;
+ sband = wcn->hw->wiphy->bands[NL80211_BAND_5GHZ];
+ }
+
+ if (!sband || idx >= sband->n_channels)
+ return -ENOENT;
+
+ spin_lock_irqsave(&wcn->survey_lock, flags);
+
+ chan_survey = &wcn->chan_survey[idx];
+ survey->channel = &sband->channels[idx];
+ survey->noise = chan_survey->rssi - chan_survey->snr;
+ survey->filled = 0;
+
+ if (chan_survey->rssi > -100 && chan_survey->rssi < 0)
+ survey->filled |= SURVEY_INFO_NOISE_DBM;
+
+ if (survey->channel == wcn->channel)
+ survey->filled |= SURVEY_INFO_IN_USE;
+
+ spin_unlock_irqrestore(&wcn->survey_lock, flags);
+
+ wcn36xx_dbg(WCN36XX_DBG_MAC,
+ "ch %d rssi %d snr %d noise %d filled %x freq %d\n",
+ HW_VALUE_CHANNEL(survey->channel->hw_value),
+ chan_survey->rssi, chan_survey->snr, survey->noise,
+ survey->filled, survey->channel->center_freq);
+
+ return 0;
+}
+
static const struct ieee80211_ops wcn36xx_ops = {
.start = wcn36xx_start,
.stop = wcn36xx_stop,
@@ -1385,6 +1426,7 @@ static const struct ieee80211_ops wcn36xx_ops = {
.ipv6_addr_change = wcn36xx_ipv6_addr_change,
#endif
.flush = wcn36xx_flush,
+ .get_survey = wcn36xx_get_survey,
CFG80211_TESTMODE_CMD(wcn36xx_tm_cmd)
};
--
2.33.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 4/4] wcn36xx: Add SNR reporting via get_survey()
2022-01-07 15:33 ` [PATCH 4/4] wcn36xx: Add SNR reporting via get_survey() Bryan O'Donoghue
@ 2022-01-07 19:28 ` kernel test robot
0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2022-01-07 19:28 UTC (permalink / raw)
To: Bryan O'Donoghue, kvalo, linux-wireless, wcn36xx, linux-arm-msm
Cc: kbuild-all, loic.poulain, benl, bryan.odonoghue
Hi Bryan,
I love your patch! Perhaps something to improve:
[auto build test WARNING on kvalo-wireless-drivers-next/master]
[also build test WARNING on kvalo-ath/ath-next next-20220107]
[cannot apply to kvalo-wireless-drivers/master v5.16-rc8]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Bryan-O-Donoghue/wcn36xx-Add-spectrum-survey-reporting/20220107-233226
base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: powerpc-allyesconfig (https://download.01.org/0day-ci/archive/20220108/202201080336.Ut3ffMZu-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/81c9665c3b1b0b2167717fbd52c32b5ea0f215af
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Bryan-O-Donoghue/wcn36xx-Add-spectrum-survey-reporting/20220107-233226
git checkout 81c9665c3b1b0b2167717fbd52c32b5ea0f215af
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/net/wireless/ath/wcn36xx/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/net/wireless/ath/wcn36xx/main.c:1360:5: warning: no previous prototype for 'wcn36xx_get_survey' [-Wmissing-prototypes]
1360 | int wcn36xx_get_survey(struct ieee80211_hw *hw, int idx,
| ^~~~~~~~~~~~~~~~~~
vim +/wcn36xx_get_survey +1360 drivers/net/wireless/ath/wcn36xx/main.c
1359
> 1360 int wcn36xx_get_survey(struct ieee80211_hw *hw, int idx,
1361 struct survey_info *survey)
1362 {
1363 struct wcn36xx *wcn = hw->priv;
1364 struct ieee80211_supported_band *sband;
1365 struct wcn36xx_chan_survey *chan_survey;
1366 unsigned long flags;
1367
1368 sband = wcn->hw->wiphy->bands[NL80211_BAND_2GHZ];
1369 if (idx >= sband->n_channels) {
1370 idx -= sband->n_channels;
1371 sband = wcn->hw->wiphy->bands[NL80211_BAND_5GHZ];
1372 }
1373
1374 if (!sband || idx >= sband->n_channels)
1375 return -ENOENT;
1376
1377 spin_lock_irqsave(&wcn->survey_lock, flags);
1378
1379 chan_survey = &wcn->chan_survey[idx];
1380 survey->channel = &sband->channels[idx];
1381 survey->noise = chan_survey->rssi - chan_survey->snr;
1382 survey->filled = 0;
1383
1384 if (chan_survey->rssi > -100 && chan_survey->rssi < 0)
1385 survey->filled |= SURVEY_INFO_NOISE_DBM;
1386
1387 if (survey->channel == wcn->channel)
1388 survey->filled |= SURVEY_INFO_IN_USE;
1389
1390 spin_unlock_irqrestore(&wcn->survey_lock, flags);
1391
1392 wcn36xx_dbg(WCN36XX_DBG_MAC,
1393 "ch %d rssi %d snr %d noise %d filled %x freq %d\n",
1394 HW_VALUE_CHANNEL(survey->channel->hw_value),
1395 chan_survey->rssi, chan_survey->snr, survey->noise,
1396 survey->filled, survey->channel->center_freq);
1397
1398 return 0;
1399 }
1400
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/4] wcn36xx: Track SNR and RSSI for each RX frame
2022-01-07 15:33 ` [PATCH 3/4] wcn36xx: Track SNR and RSSI for each RX frame Bryan O'Donoghue
@ 2022-01-08 8:41 ` kernel test robot
2022-01-08 15:48 ` Bryan O'Donoghue
0 siblings, 1 reply; 8+ messages in thread
From: kernel test robot @ 2022-01-08 8:41 UTC (permalink / raw)
To: Bryan O'Donoghue, kvalo, linux-wireless, wcn36xx, linux-arm-msm
Cc: llvm, kbuild-all, loic.poulain, benl, bryan.odonoghue
Hi Bryan,
I love your patch! Perhaps something to improve:
[auto build test WARNING on kvalo-wireless-drivers-next/master]
[also build test WARNING on kvalo-ath/ath-next next-20220107]
[cannot apply to kvalo-wireless-drivers/master v5.16-rc8]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Bryan-O-Donoghue/wcn36xx-Add-spectrum-survey-reporting/20220107-233226
base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: riscv-randconfig-r042-20220107 (https://download.01.org/0day-ci/archive/20220108/202201081611.NwbnsnbW-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project f3a344d2125fa37e59bae1b0874442c650a19607)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/7fa379bc4e1728cf4e30f1f9de93bea0f520e37b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Bryan-O-Donoghue/wcn36xx-Add-spectrum-survey-reporting/20220107-233226
git checkout 7fa379bc4e1728cf4e30f1f9de93bea0f520e37b
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/net/wireless/ath/wcn36xx/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from drivers/net/wireless/ath/wcn36xx/main.c:22:
In file included from include/linux/of_address.h:7:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:136:
include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:36:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/net/wireless/ath/wcn36xx/main.c:22:
In file included from include/linux/of_address.h:7:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:136:
include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/net/wireless/ath/wcn36xx/main.c:22:
In file included from include/linux/of_address.h:7:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:136:
include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:1024:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
~~~~~~~~~~ ^
>> drivers/net/wireless/ath/wcn36xx/main.c:1600:3: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
ret -= ENOMEM;
^~~
drivers/net/wireless/ath/wcn36xx/main.c:1567:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
8 warnings generated.
vim +/ret +1600 drivers/net/wireless/ath/wcn36xx/main.c
1561
1562 static int wcn36xx_probe(struct platform_device *pdev)
1563 {
1564 struct ieee80211_hw *hw;
1565 struct wcn36xx *wcn;
1566 void *wcnss;
1567 int ret;
1568 const u8 *addr;
1569 int n_channels;
1570
1571 wcn36xx_dbg(WCN36XX_DBG_MAC, "platform probe\n");
1572
1573 wcnss = dev_get_drvdata(pdev->dev.parent);
1574
1575 hw = ieee80211_alloc_hw(sizeof(struct wcn36xx), &wcn36xx_ops);
1576 if (!hw) {
1577 wcn36xx_err("failed to alloc hw\n");
1578 ret = -ENOMEM;
1579 goto out_err;
1580 }
1581 platform_set_drvdata(pdev, hw);
1582 wcn = hw->priv;
1583 wcn->hw = hw;
1584 wcn->dev = &pdev->dev;
1585 wcn->first_boot = true;
1586 mutex_init(&wcn->conf_mutex);
1587 mutex_init(&wcn->hal_mutex);
1588 mutex_init(&wcn->scan_lock);
1589 __skb_queue_head_init(&wcn->amsdu);
1590
1591 wcn->hal_buf = devm_kmalloc(wcn->dev, WCN36XX_HAL_BUF_SIZE, GFP_KERNEL);
1592 if (!wcn->hal_buf) {
1593 ret = -ENOMEM;
1594 goto out_wq;
1595 }
1596
1597 n_channels = wcn_band_2ghz.n_channels + wcn_band_5ghz.n_channels;
1598 wcn->chan_survey = devm_kmalloc(wcn->dev, n_channels, GFP_KERNEL);
1599 if (!wcn->chan_survey) {
> 1600 ret -= ENOMEM;
1601 goto out_wq;
1602 }
1603
1604 ret = dma_set_mask_and_coherent(wcn->dev, DMA_BIT_MASK(32));
1605 if (ret < 0) {
1606 wcn36xx_err("failed to set DMA mask: %d\n", ret);
1607 goto out_wq;
1608 }
1609
1610 wcn->nv_file = WLAN_NV_FILE;
1611 ret = of_property_read_string(wcn->dev->parent->of_node, "firmware-name", &wcn->nv_file);
1612 if (ret < 0 && ret != -EINVAL) {
1613 wcn36xx_err("failed to read \"firmware-name\" property: %d\n", ret);
1614 goto out_wq;
1615 }
1616
1617 wcn->smd_channel = qcom_wcnss_open_channel(wcnss, "WLAN_CTRL", wcn36xx_smd_rsp_process, hw);
1618 if (IS_ERR(wcn->smd_channel)) {
1619 wcn36xx_err("failed to open WLAN_CTRL channel\n");
1620 ret = PTR_ERR(wcn->smd_channel);
1621 goto out_wq;
1622 }
1623
1624 addr = of_get_property(pdev->dev.of_node, "local-mac-address", &ret);
1625 if (addr && ret != ETH_ALEN) {
1626 wcn36xx_err("invalid local-mac-address\n");
1627 ret = -EINVAL;
1628 goto out_destroy_ept;
1629 } else if (addr) {
1630 wcn36xx_info("mac address: %pM\n", addr);
1631 SET_IEEE80211_PERM_ADDR(wcn->hw, addr);
1632 }
1633
1634 ret = wcn36xx_platform_get_resources(wcn, pdev);
1635 if (ret)
1636 goto out_destroy_ept;
1637
1638 wcn36xx_init_ieee80211(wcn);
1639 ret = ieee80211_register_hw(wcn->hw);
1640 if (ret)
1641 goto out_unmap;
1642
1643 return 0;
1644
1645 out_unmap:
1646 iounmap(wcn->ccu_base);
1647 iounmap(wcn->dxe_base);
1648 out_destroy_ept:
1649 rpmsg_destroy_ept(wcn->smd_channel);
1650 out_wq:
1651 ieee80211_free_hw(hw);
1652 out_err:
1653 return ret;
1654 }
1655
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/4] wcn36xx: Track SNR and RSSI for each RX frame
2022-01-08 8:41 ` kernel test robot
@ 2022-01-08 15:48 ` Bryan O'Donoghue
0 siblings, 0 replies; 8+ messages in thread
From: Bryan O'Donoghue @ 2022-01-08 15:48 UTC (permalink / raw)
To: kernel test robot, kvalo, linux-wireless, wcn36xx, linux-arm-msm
Cc: llvm, kbuild-all, loic.poulain, benl
On 08/01/2022 08:41, kernel test robot wrote:
> ret -= ENOMEM;
nice catch
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-01-08 15:46 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-07 15:33 [PATCH 0/4] wcn36xx: Add spectrum survey reporting Bryan O'Donoghue
2022-01-07 15:33 ` [PATCH 1/4] wcn36xx: Implement get_snr() Bryan O'Donoghue
2022-01-07 15:33 ` [PATCH 2/4] wcn36xx: Track the band and channel we are tuned to Bryan O'Donoghue
2022-01-07 15:33 ` [PATCH 3/4] wcn36xx: Track SNR and RSSI for each RX frame Bryan O'Donoghue
2022-01-08 8:41 ` kernel test robot
2022-01-08 15:48 ` Bryan O'Donoghue
2022-01-07 15:33 ` [PATCH 4/4] wcn36xx: Add SNR reporting via get_survey() Bryan O'Donoghue
2022-01-07 19:28 ` kernel test robot
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).