2022-09-22 10:51:24

by Ian Lin

[permalink] [raw]
Subject: [PATCH v2 0/5] Fix connect/p2p issue series

Fix several connect and p2p issues.

Changes in v2:
- fix email address mismatch with s-o-b
- remove unnecessary type casting

Brian Henriquez (1):
brcmfmac: correctly remove all p2p vif

Chung-Hsien Hsu (1):
brcmfmac: fix P2P device discovery failure

Prasanna Kerekoppa (1):
brcmfmac: Avoiding Connection delay

Syed Rafiuddeen (1):
brcmfmac: Update SSID of hidden AP while informing its bss to cfg80211
layer

Wataru Gohda (1):
brcmfmac: Fix for when connect request is not success

.../broadcom/brcm80211/brcmfmac/cfg80211.c | 31 +++++++++++++++++--
.../broadcom/brcm80211/brcmfmac/p2p.c | 10 ++++--
2 files changed, 36 insertions(+), 5 deletions(-)

--
2.25.0


2022-09-22 10:51:34

by Ian Lin

[permalink] [raw]
Subject: [PATCH v2 1/5] brcmfmac: correctly remove all p2p vif

From: Brian Henriquez <[email protected]>

When deleting a P2P AGO interface we should make sure that
relevant entry in bss_idx[] array is removed. We were always
removing only 'vif' at P2PAPI_BSSCFG_CONNECTION before,
regardless of the number of created P2P AGO interfaces.
brcmfmac: correctly remove all p2p vif

Signed-off-by: Brian Henriquez <[email protected]>
Signed-off-by: Chi-hsien Lin <[email protected]>
Signed-off-by: Ian Lin <[email protected]>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
index 479041f070f9..b3d706a2e68c 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
@@ -2424,8 +2424,12 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev)
brcmf_remove_interface(vif->ifp, true);

brcmf_cfg80211_arm_vif_event(cfg, NULL);
- if (iftype != NL80211_IFTYPE_P2P_DEVICE)
- p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL;
+ if (iftype != NL80211_IFTYPE_P2P_DEVICE) {
+ if (vif == p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif)
+ p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL;
+ if (vif == p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION2].vif)
+ p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION2].vif = NULL;
+ }

return err;
}
--
2.25.0

2022-09-22 10:51:43

by Ian Lin

[permalink] [raw]
Subject: [PATCH v2 2/5] brcmfmac: Fix for when connect request is not success

From: Wataru Gohda <[email protected]>

Currently brcmfmac is expecting to be set for both
BRCMF_VIF_STATUS_EAP_SUCCESS and BRCMF_VIF_STATUS_EAP status bit based
on dongle event and those bits are cleared to complete connect request
successfully.

But when connect request is finished unsuccessfully, either
BRCMF_VIF_STATUS_EAP_SUCCESS / BRCMF_VIF_STATUS_EAP bits are not
cleared depending on how the connect fail event happens. These status
bits are carried over to following new connect request and this will lead
to generate below kernel warning for some case. Worst case status
mismatch happens between dongle and wpa_supplicant.

WARNING: ../net/wireless/sme.c:756 __cfg80211_connect_result+0x42c/0x4a0 [cfg80211]

The fix is to clear the BRCMF_VIF_STATUS_EAP_SUCCESS /
BRCMF_VIF_STATUS_EAP bits during the link down process and add to call
link down process when link down event received during
BRCMF_VIF_STATUS_CONNECTING as well as BRCMF_VIF_STATUS_CONNECTED
state.

Signed-off-by: Wataru Gohda <[email protected]>
Signed-off-by: Chi-hsien Lin <[email protected]>
Signed-off-by: Ian Lin <[email protected]>
---
.../broadcom/brcm80211/brcmfmac/cfg80211.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 42068145a447..182b61aa346e 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -1417,6 +1417,8 @@ static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason,
locally_generated, GFP_KERNEL);
}
clear_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state);
+ clear_bit(BRCMF_VIF_STATUS_EAP_SUCCESS, &vif->sme_state);
+ clear_bit(BRCMF_VIF_STATUS_ASSOC_SUCCESS, &vif->sme_state);
clear_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status);
brcmf_btcoex_set_mode(vif, BRCMF_BTCOEX_ENABLED, 0);
if (vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_NONE) {
@@ -2269,6 +2271,8 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,

clear_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state);
clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state);
+ clear_bit(BRCMF_VIF_STATUS_EAP_SUCCESS, &ifp->vif->sme_state);
+ clear_bit(BRCMF_VIF_STATUS_ASSOC_SUCCESS, &ifp->vif->sme_state);
cfg80211_disconnected(ndev, reason_code, NULL, 0, true, GFP_KERNEL);

memcpy(&scbval.ea, &profile->bssid, ETH_ALEN);
@@ -6057,6 +6061,10 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg,
&ifp->vif->sme_state);
conn_params.status = WLAN_STATUS_SUCCESS;
} else {
+ clear_bit(BRCMF_VIF_STATUS_EAP_SUCCESS,
+ &ifp->vif->sme_state);
+ clear_bit(BRCMF_VIF_STATUS_ASSOC_SUCCESS,
+ &ifp->vif->sme_state);
conn_params.status = WLAN_STATUS_AUTH_TIMEOUT;
}
conn_params.links[0].bssid = profile->bssid;
@@ -6154,9 +6162,13 @@ brcmf_notify_connect_status(struct brcmf_if *ifp,
} else if (brcmf_is_linkdown(ifp->vif, e)) {
brcmf_dbg(CONN, "Linkdown\n");
if (!brcmf_is_ibssmode(ifp->vif) &&
- test_bit(BRCMF_VIF_STATUS_CONNECTED,
- &ifp->vif->sme_state)) {
- if (memcmp(profile->bssid, e->addr, ETH_ALEN))
+ (test_bit(BRCMF_VIF_STATUS_CONNECTED,
+ &ifp->vif->sme_state) ||
+ test_bit(BRCMF_VIF_STATUS_CONNECTING,
+ &ifp->vif->sme_state))) {
+ if (test_bit(BRCMF_VIF_STATUS_CONNECTED,
+ &ifp->vif->sme_state) &&
+ memcmp(profile->bssid, e->addr, ETH_ALEN))
return err;

brcmf_bss_connect_done(cfg, ndev, e, false);
--
2.25.0

2022-09-22 10:51:45

by Ian Lin

[permalink] [raw]
Subject: [PATCH v2 4/5] brcmfmac: Update SSID of hidden AP while informing its bss to cfg80211 layer

From: Syed Rafiuddeen <[email protected]>

cfg80211 layer on DUT STA is disconnecting ongoing connection attempt after
receiving association response, because cfg80211 layer does not have valid
AP bss information. On association response event, brcmfmac communicates
the AP bss information to cfg80211 layer, but SSID seem to be empty in AP
bss information, and cfg80211 layer prints kernel warning and then
disconnects the ongoing connection attempt.

SSID is empty in SSID IE, but 'bi->SSID' contains a valid SSID, so
updating the SSID for hidden AP while informing its bss information
to cfg80211 layer.

Signed-off-by: Syed Rafiuddeen <[email protected]>
Signed-off-by: Chung-Hsien Hsu <[email protected]>
Signed-off-by: Chi-hsien Lin <[email protected]>
Signed-off-by: Ian Lin <[email protected]>
---
.../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 6c37da42e61b..05961ef293da 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -3003,6 +3003,7 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
u8 *notify_ie;
size_t notify_ielen;
struct cfg80211_inform_bss bss_data = {};
+ const struct brcmf_tlv *ssid = NULL;

if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
bphy_err(drvr, "Bss info is larger than buffer. Discarding\n");
@@ -3032,6 +3033,12 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
notify_ielen = le32_to_cpu(bi->ie_length);
bss_data.signal = (s16)le16_to_cpu(bi->RSSI) * 100;

+ ssid = brcmf_parse_tlvs(notify_ie, notify_ielen, WLAN_EID_SSID);
+ if (ssid && ssid->data[0] == '\0' && ssid->len == bi->SSID_len) {
+ /* Update SSID for hidden AP */
+ memcpy(ssid->data, bi->SSID, bi->SSID_len);
+ }
+
brcmf_dbg(CONN, "bssid: %pM\n", bi->BSSID);
brcmf_dbg(CONN, "Channel: %d(%d)\n", channel, freq);
brcmf_dbg(CONN, "Capability: %X\n", notify_capability);
--
2.25.0

2022-09-22 10:53:08

by Ian Lin

[permalink] [raw]
Subject: [PATCH v2 3/5] brcmfmac: Avoiding Connection delay

From: Prasanna Kerekoppa <[email protected]>

Channel info passed by supplicant is not given to firmware. This causes
delay (about 3seconds) due to full scan. Supplicant already provides the
channel info for the specific SSID. channel_hint carries this channel
info for the connect call back.

Patch has been verified on 43012 and 43455.

Signed-off-by: Prasanna Kerekoppa <[email protected]>
Signed-off-by: Chung-Hsien Hsu <[email protected]>
Signed-off-by: Chi-hsien Lin <[email protected]>
Signed-off-by: Ian Lin <[email protected]>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 182b61aa346e..6c37da42e61b 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -2049,6 +2049,12 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
return -EOPNOTSUPP;
}

+ if (sme->channel_hint)
+ chan = sme->channel_hint;
+
+ if (sme->bssid_hint)
+ sme->bssid = sme->bssid_hint;
+
if (ifp->vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif) {
/* A normal (non P2P) connection request setup. */
ie = NULL;
--
2.25.0

2022-09-22 10:53:09

by Ian Lin

[permalink] [raw]
Subject: [PATCH v2 5/5] brcmfmac: fix P2P device discovery failure

From: Chung-Hsien Hsu <[email protected]>

Commit 2de64ca7c9fa ("brcmfmac: p2p: Deal with set but unused
variables") removed the setting of vif for p2p device discovery in
brcmf_p2p_scan_prep(), causing the discovery failure.

Add back the setting to brcmf_p2p_scan_prep() to fix this.

Fixes: 2de64ca7c9fa ("brcmfmac: p2p: Deal with set but unused variables")
Signed-off-by: Chung-Hsien Hsu <[email protected]>
Signed-off-by: Ian Lin <[email protected]>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
index b3d706a2e68c..068f8fe0e0c4 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
@@ -912,6 +912,8 @@ int brcmf_p2p_scan_prep(struct wiphy *wiphy,
if (err)
return err;

+ vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
+
/* override .run_escan() callback. */
cfg->escan_info.run = brcmf_p2p_run_escan;
}
--
2.25.0

2022-09-22 13:24:32

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2 4/5] brcmfmac: Update SSID of hidden AP while informing its bss to cfg80211 layer

Hi Ian,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on wireless-next/main]
[also build test WARNING on wireless/main linus/master v6.0-rc6 next-20220921]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Ian-Lin/Fix-connect-p2p-issue-series/20220922-184424
base: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
config: m68k-allyesconfig
compiler: m68k-linux-gcc (GCC) 12.1.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/intel-lab-lkp/linux/commit/620f981fff55c74cd1fa86e5b6c177d51344f654
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Ian-Lin/Fix-connect-p2p-issue-series/20220922-184424
git checkout 620f981fff55c74cd1fa86e5b6c177d51344f654
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/net/wireless/broadcom/brcm80211/brcmfmac/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

In file included from include/linux/string.h:20,
from include/linux/bitmap.h:11,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/spinlock.h:62,
from include/linux/wait.h:9,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/highmem.h:5,
from include/linux/bvec.h:10,
from include/linux/skbuff.h:17,
from include/linux/if_ether.h:19,
from include/linux/etherdevice.h:20,
from drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:9:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c: In function 'brcmf_inform_single_bss':
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:3039:28: warning: passing argument 1 of '__builtin_memcpy' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
3039 | memcpy(ssid->data, bi->SSID, bi->SSID_len);
| ~~~~^~~~~~
arch/m68k/include/asm/string.h:72:42: note: in definition of macro 'memcpy'
72 | #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
| ^
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:3039:28: note: expected 'void *' but argument is of type 'const u8 *' {aka 'const unsigned char *'}
3039 | memcpy(ssid->data, bi->SSID, bi->SSID_len);
| ~~~~^~~~~~
arch/m68k/include/asm/string.h:72:42: note: in definition of macro 'memcpy'
72 | #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
| ^


vim +3039 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c

2990
2991 static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
2992 struct brcmf_bss_info_le *bi)
2993 {
2994 struct wiphy *wiphy = cfg_to_wiphy(cfg);
2995 struct brcmf_pub *drvr = cfg->pub;
2996 struct cfg80211_bss *bss;
2997 enum nl80211_band band;
2998 struct brcmu_chan ch;
2999 u16 channel;
3000 u32 freq;
3001 u16 notify_capability;
3002 u16 notify_interval;
3003 u8 *notify_ie;
3004 size_t notify_ielen;
3005 struct cfg80211_inform_bss bss_data = {};
3006 const struct brcmf_tlv *ssid = NULL;
3007
3008 if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
3009 bphy_err(drvr, "Bss info is larger than buffer. Discarding\n");
3010 return -EINVAL;
3011 }
3012
3013 if (!bi->ctl_ch) {
3014 ch.chspec = le16_to_cpu(bi->chanspec);
3015 cfg->d11inf.decchspec(&ch);
3016 bi->ctl_ch = ch.control_ch_num;
3017 }
3018 channel = bi->ctl_ch;
3019
3020 if (channel <= CH_MAX_2G_CHANNEL)
3021 band = NL80211_BAND_2GHZ;
3022 else
3023 band = NL80211_BAND_5GHZ;
3024
3025 freq = ieee80211_channel_to_frequency(channel, band);
3026 bss_data.chan = ieee80211_get_channel(wiphy, freq);
3027 bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20;
3028 bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime());
3029
3030 notify_capability = le16_to_cpu(bi->capability);
3031 notify_interval = le16_to_cpu(bi->beacon_period);
3032 notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
3033 notify_ielen = le32_to_cpu(bi->ie_length);
3034 bss_data.signal = (s16)le16_to_cpu(bi->RSSI) * 100;
3035
3036 ssid = brcmf_parse_tlvs(notify_ie, notify_ielen, WLAN_EID_SSID);
3037 if (ssid && ssid->data[0] == '\0' && ssid->len == bi->SSID_len) {
3038 /* Update SSID for hidden AP */
> 3039 memcpy(ssid->data, bi->SSID, bi->SSID_len);
3040 }
3041
3042 brcmf_dbg(CONN, "bssid: %pM\n", bi->BSSID);
3043 brcmf_dbg(CONN, "Channel: %d(%d)\n", channel, freq);
3044 brcmf_dbg(CONN, "Capability: %X\n", notify_capability);
3045 brcmf_dbg(CONN, "Beacon interval: %d\n", notify_interval);
3046 brcmf_dbg(CONN, "Signal: %d\n", bss_data.signal);
3047
3048 bss = cfg80211_inform_bss_data(wiphy, &bss_data,
3049 CFG80211_BSS_FTYPE_UNKNOWN,
3050 (const u8 *)bi->BSSID,
3051 0, notify_capability,
3052 notify_interval, notify_ie,
3053 notify_ielen, GFP_KERNEL);
3054
3055 if (!bss)
3056 return -ENOMEM;
3057
3058 cfg80211_put_bss(wiphy, bss);
3059
3060 return 0;
3061 }
3062

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (6.20 kB)
config (284.90 kB)
Download all attachments

2022-09-23 11:12:57

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2 4/5] brcmfmac: Update SSID of hidden AP while informing its bss to cfg80211 layer

Hi Ian,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on wireless-next/main]
[also build test WARNING on wireless/main linus/master v6.0-rc6 next-20220921]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Ian-Lin/Fix-connect-p2p-issue-series/20220922-184424
base: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
config: parisc-allyesconfig (https://download.01.org/0day-ci/archive/20220923/[email protected]/config)
compiler: hppa-linux-gcc (GCC) 12.1.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/intel-lab-lkp/linux/commit/620f981fff55c74cd1fa86e5b6c177d51344f654
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Ian-Lin/Fix-connect-p2p-issue-series/20220922-184424
git checkout 620f981fff55c74cd1fa86e5b6c177d51344f654
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=parisc SHELL=/bin/bash drivers/net/wireless/broadcom/brcm80211/brcmfmac/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c: In function 'brcmf_inform_single_bss':
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:3039:28: warning: passing argument 1 of 'memcpy' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
3039 | memcpy(ssid->data, bi->SSID, bi->SSID_len);
| ~~~~^~~~~~
In file included from include/linux/string.h:20,
from include/linux/uuid.h:12,
from include/linux/mod_devicetable.h:13,
from arch/parisc/include/asm/hardware.h:5,
from arch/parisc/include/asm/processor.h:17,
from arch/parisc/include/asm/spinlock.h:7,
from arch/parisc/include/asm/atomic.h:22,
from include/linux/atomic.h:7,
from arch/parisc/include/asm/bitops.h:13,
from include/linux/bitops.h:68,
from include/linux/kernel.h:22,
from drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:8:
arch/parisc/include/asm/string.h:9:22: note: expected 'void *' but argument is of type 'const u8 *' {aka 'const unsigned char *'}
9 | void * memcpy(void * dest,const void *src,size_t count);
| ~~~~~~~^~~~


vim +3039 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c

2990
2991 static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
2992 struct brcmf_bss_info_le *bi)
2993 {
2994 struct wiphy *wiphy = cfg_to_wiphy(cfg);
2995 struct brcmf_pub *drvr = cfg->pub;
2996 struct cfg80211_bss *bss;
2997 enum nl80211_band band;
2998 struct brcmu_chan ch;
2999 u16 channel;
3000 u32 freq;
3001 u16 notify_capability;
3002 u16 notify_interval;
3003 u8 *notify_ie;
3004 size_t notify_ielen;
3005 struct cfg80211_inform_bss bss_data = {};
3006 const struct brcmf_tlv *ssid = NULL;
3007
3008 if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
3009 bphy_err(drvr, "Bss info is larger than buffer. Discarding\n");
3010 return -EINVAL;
3011 }
3012
3013 if (!bi->ctl_ch) {
3014 ch.chspec = le16_to_cpu(bi->chanspec);
3015 cfg->d11inf.decchspec(&ch);
3016 bi->ctl_ch = ch.control_ch_num;
3017 }
3018 channel = bi->ctl_ch;
3019
3020 if (channel <= CH_MAX_2G_CHANNEL)
3021 band = NL80211_BAND_2GHZ;
3022 else
3023 band = NL80211_BAND_5GHZ;
3024
3025 freq = ieee80211_channel_to_frequency(channel, band);
3026 bss_data.chan = ieee80211_get_channel(wiphy, freq);
3027 bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20;
3028 bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime());
3029
3030 notify_capability = le16_to_cpu(bi->capability);
3031 notify_interval = le16_to_cpu(bi->beacon_period);
3032 notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
3033 notify_ielen = le32_to_cpu(bi->ie_length);
3034 bss_data.signal = (s16)le16_to_cpu(bi->RSSI) * 100;
3035
3036 ssid = brcmf_parse_tlvs(notify_ie, notify_ielen, WLAN_EID_SSID);
3037 if (ssid && ssid->data[0] == '\0' && ssid->len == bi->SSID_len) {
3038 /* Update SSID for hidden AP */
> 3039 memcpy(ssid->data, bi->SSID, bi->SSID_len);
3040 }
3041
3042 brcmf_dbg(CONN, "bssid: %pM\n", bi->BSSID);
3043 brcmf_dbg(CONN, "Channel: %d(%d)\n", channel, freq);
3044 brcmf_dbg(CONN, "Capability: %X\n", notify_capability);
3045 brcmf_dbg(CONN, "Beacon interval: %d\n", notify_interval);
3046 brcmf_dbg(CONN, "Signal: %d\n", bss_data.signal);
3047
3048 bss = cfg80211_inform_bss_data(wiphy, &bss_data,
3049 CFG80211_BSS_FTYPE_UNKNOWN,
3050 (const u8 *)bi->BSSID,
3051 0, notify_capability,
3052 notify_interval, notify_ie,
3053 notify_ielen, GFP_KERNEL);
3054
3055 if (!bss)
3056 return -ENOMEM;
3057
3058 cfg80211_put_bss(wiphy, bss);
3059
3060 return 0;
3061 }
3062

--
0-DAY CI Kernel Test Service
https://01.org/lkp

2022-09-26 06:06:16

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2 4/5] brcmfmac: Update SSID of hidden AP while informing its bss to cfg80211 layer

Hi Ian,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on wireless-next/main]
[also build test ERROR on wireless/main linus/master v6.0-rc7 next-20220923]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Ian-Lin/Fix-connect-p2p-issue-series/20220922-184424
base: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
config: mips-cu1000-neo_defconfig
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
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 mips cross compiling tool for clang build
# apt-get install binutils-mipsel-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/620f981fff55c74cd1fa86e5b6c177d51344f654
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Ian-Lin/Fix-connect-p2p-issue-series/20220922-184424
git checkout 620f981fff55c74cd1fa86e5b6c177d51344f654
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/net/wireless/broadcom/brcm80211/brcmfmac/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:3039:10: error: passing 'const u8[1]' (aka 'const unsigned char[1]') to parameter of type 'void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
memcpy(ssid->data, bi->SSID, bi->SSID_len);
^~~~~~~~~~
arch/mips/include/asm/string.h:17:27: note: passing argument to parameter '__to' here
extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
^
1 error generated.


vim +3039 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c

2990
2991 static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
2992 struct brcmf_bss_info_le *bi)
2993 {
2994 struct wiphy *wiphy = cfg_to_wiphy(cfg);
2995 struct brcmf_pub *drvr = cfg->pub;
2996 struct cfg80211_bss *bss;
2997 enum nl80211_band band;
2998 struct brcmu_chan ch;
2999 u16 channel;
3000 u32 freq;
3001 u16 notify_capability;
3002 u16 notify_interval;
3003 u8 *notify_ie;
3004 size_t notify_ielen;
3005 struct cfg80211_inform_bss bss_data = {};
3006 const struct brcmf_tlv *ssid = NULL;
3007
3008 if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
3009 bphy_err(drvr, "Bss info is larger than buffer. Discarding\n");
3010 return -EINVAL;
3011 }
3012
3013 if (!bi->ctl_ch) {
3014 ch.chspec = le16_to_cpu(bi->chanspec);
3015 cfg->d11inf.decchspec(&ch);
3016 bi->ctl_ch = ch.control_ch_num;
3017 }
3018 channel = bi->ctl_ch;
3019
3020 if (channel <= CH_MAX_2G_CHANNEL)
3021 band = NL80211_BAND_2GHZ;
3022 else
3023 band = NL80211_BAND_5GHZ;
3024
3025 freq = ieee80211_channel_to_frequency(channel, band);
3026 bss_data.chan = ieee80211_get_channel(wiphy, freq);
3027 bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20;
3028 bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime());
3029
3030 notify_capability = le16_to_cpu(bi->capability);
3031 notify_interval = le16_to_cpu(bi->beacon_period);
3032 notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
3033 notify_ielen = le32_to_cpu(bi->ie_length);
3034 bss_data.signal = (s16)le16_to_cpu(bi->RSSI) * 100;
3035
3036 ssid = brcmf_parse_tlvs(notify_ie, notify_ielen, WLAN_EID_SSID);
3037 if (ssid && ssid->data[0] == '\0' && ssid->len == bi->SSID_len) {
3038 /* Update SSID for hidden AP */
> 3039 memcpy(ssid->data, bi->SSID, bi->SSID_len);
3040 }
3041
3042 brcmf_dbg(CONN, "bssid: %pM\n", bi->BSSID);
3043 brcmf_dbg(CONN, "Channel: %d(%d)\n", channel, freq);
3044 brcmf_dbg(CONN, "Capability: %X\n", notify_capability);
3045 brcmf_dbg(CONN, "Beacon interval: %d\n", notify_interval);
3046 brcmf_dbg(CONN, "Signal: %d\n", bss_data.signal);
3047
3048 bss = cfg80211_inform_bss_data(wiphy, &bss_data,
3049 CFG80211_BSS_FTYPE_UNKNOWN,
3050 (const u8 *)bi->BSSID,
3051 0, notify_capability,
3052 notify_interval, notify_ie,
3053 notify_ielen, GFP_KERNEL);
3054
3055 if (!bss)
3056 return -ENOMEM;
3057
3058 cfg80211_put_bss(wiphy, bss);
3059
3060 return 0;
3061 }
3062

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (5.04 kB)
config (89.36 kB)
Download all attachments

2022-09-26 10:33:45

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2 4/5] brcmfmac: Update SSID of hidden AP while informing its bss to cfg80211 layer

Hi Ian,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on wireless-next/main]
[also build test WARNING on wireless/main linus/master v6.0-rc7 next-20220923]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Ian-Lin/Fix-connect-p2p-issue-series/20220922-184424
base: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
config: powerpc-randconfig-s053-20220925
compiler: powerpc-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://github.com/intel-lab-lkp/linux/commit/620f981fff55c74cd1fa86e5b6c177d51344f654
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Ian-Lin/Fix-connect-p2p-issue-series/20220922-184424
git checkout 620f981fff55c74cd1fa86e5b6c177d51344f654
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/net/wireless/broadcom/brcm80211/brcmfmac/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

sparse warnings: (new ones prefixed by >>)
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:3039:24: sparse: sparse: incorrect type in argument 1 (different modifiers) @@ expected void * @@ got unsigned char const * @@
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:3039:24: sparse: expected void *
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:3039:24: sparse: got unsigned char const *

vim +3039 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c

2990
2991 static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
2992 struct brcmf_bss_info_le *bi)
2993 {
2994 struct wiphy *wiphy = cfg_to_wiphy(cfg);
2995 struct brcmf_pub *drvr = cfg->pub;
2996 struct cfg80211_bss *bss;
2997 enum nl80211_band band;
2998 struct brcmu_chan ch;
2999 u16 channel;
3000 u32 freq;
3001 u16 notify_capability;
3002 u16 notify_interval;
3003 u8 *notify_ie;
3004 size_t notify_ielen;
3005 struct cfg80211_inform_bss bss_data = {};
3006 const struct brcmf_tlv *ssid = NULL;
3007
3008 if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
3009 bphy_err(drvr, "Bss info is larger than buffer. Discarding\n");
3010 return -EINVAL;
3011 }
3012
3013 if (!bi->ctl_ch) {
3014 ch.chspec = le16_to_cpu(bi->chanspec);
3015 cfg->d11inf.decchspec(&ch);
3016 bi->ctl_ch = ch.control_ch_num;
3017 }
3018 channel = bi->ctl_ch;
3019
3020 if (channel <= CH_MAX_2G_CHANNEL)
3021 band = NL80211_BAND_2GHZ;
3022 else
3023 band = NL80211_BAND_5GHZ;
3024
3025 freq = ieee80211_channel_to_frequency(channel, band);
3026 bss_data.chan = ieee80211_get_channel(wiphy, freq);
3027 bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20;
3028 bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime());
3029
3030 notify_capability = le16_to_cpu(bi->capability);
3031 notify_interval = le16_to_cpu(bi->beacon_period);
3032 notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
3033 notify_ielen = le32_to_cpu(bi->ie_length);
3034 bss_data.signal = (s16)le16_to_cpu(bi->RSSI) * 100;
3035
3036 ssid = brcmf_parse_tlvs(notify_ie, notify_ielen, WLAN_EID_SSID);
3037 if (ssid && ssid->data[0] == '\0' && ssid->len == bi->SSID_len) {
3038 /* Update SSID for hidden AP */
> 3039 memcpy(ssid->data, bi->SSID, bi->SSID_len);
3040 }
3041
3042 brcmf_dbg(CONN, "bssid: %pM\n", bi->BSSID);
3043 brcmf_dbg(CONN, "Channel: %d(%d)\n", channel, freq);
3044 brcmf_dbg(CONN, "Capability: %X\n", notify_capability);
3045 brcmf_dbg(CONN, "Beacon interval: %d\n", notify_interval);
3046 brcmf_dbg(CONN, "Signal: %d\n", bss_data.signal);
3047
3048 bss = cfg80211_inform_bss_data(wiphy, &bss_data,
3049 CFG80211_BSS_FTYPE_UNKNOWN,
3050 (const u8 *)bi->BSSID,
3051 0, notify_capability,
3052 notify_interval, notify_ie,
3053 notify_ielen, GFP_KERNEL);
3054
3055 if (!bss)
3056 return -ENOMEM;
3057
3058 cfg80211_put_bss(wiphy, bss);
3059
3060 return 0;
3061 }
3062

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (4.84 kB)
config (153.91 kB)
Download all attachments