All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Fix connect/p2p issue series
@ 2022-09-14  3:36 Ian Lin
  2022-09-14  3:36 ` [PATCH 1/5] brcmfmac: correctly remove all p2p vif Ian Lin
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Ian Lin @ 2022-09-14  3:36 UTC (permalink / raw)
  To: linux-wireless
  Cc: brcm80211-dev-list, brcm80211-dev-list, franky.lin,
	hante.meuleman, kvalo, Double.Lo, ian.lin

Fix several connect and p2p issues.

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


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

* [PATCH 1/5] brcmfmac: correctly remove all p2p vif
  2022-09-14  3:36 [PATCH 0/5] Fix connect/p2p issue series Ian Lin
@ 2022-09-14  3:36 ` Ian Lin
  2022-09-14  3:36 ` [PATCH 2/5] brcmfmac: Fix for when connect request is not success Ian Lin
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Ian Lin @ 2022-09-14  3:36 UTC (permalink / raw)
  To: linux-wireless
  Cc: brcm80211-dev-list, brcm80211-dev-list, franky.lin,
	hante.meuleman, kvalo, Double.Lo, ian.lin

From: Brian Henriquez <brian.henriquez@cypress.com>

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 <brian.henriquez@cypress.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@infineon.com>
Signed-off-by: Ian Lin <ian.lin@infineon.com>
---
 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


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

* [PATCH 2/5] brcmfmac: Fix for when connect request is not success
  2022-09-14  3:36 [PATCH 0/5] Fix connect/p2p issue series Ian Lin
  2022-09-14  3:36 ` [PATCH 1/5] brcmfmac: correctly remove all p2p vif Ian Lin
@ 2022-09-14  3:36 ` Ian Lin
  2022-09-14  3:36 ` [PATCH 3/5] brcmfmac: Avoiding Connection delay Ian Lin
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Ian Lin @ 2022-09-14  3:36 UTC (permalink / raw)
  To: linux-wireless
  Cc: brcm80211-dev-list, brcm80211-dev-list, franky.lin,
	hante.meuleman, kvalo, Double.Lo, ian.lin

From: Wataru Gohda <wataru.gohda@cypress.com>

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 <wataru.gohda@cypress.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@infineon.com>
Signed-off-by: Ian Lin <ian.lin@infineon.com>
---
 .../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 7c72ea26a7d7..7e9354768cfe 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);
@@ -6063,6 +6067,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;
@@ -6160,9 +6168,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


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

* [PATCH 3/5] brcmfmac: Avoiding Connection delay
  2022-09-14  3:36 [PATCH 0/5] Fix connect/p2p issue series Ian Lin
  2022-09-14  3:36 ` [PATCH 1/5] brcmfmac: correctly remove all p2p vif Ian Lin
  2022-09-14  3:36 ` [PATCH 2/5] brcmfmac: Fix for when connect request is not success Ian Lin
@ 2022-09-14  3:36 ` Ian Lin
  2022-09-14  3:36 ` [PATCH 4/5] brcmfmac: Update SSID of hidden AP while informing its bss to cfg80211 layer Ian Lin
  2022-09-14  3:36 ` [PATCH 5/5] brcmfmac: fix P2P device discovery failure Ian Lin
  4 siblings, 0 replies; 10+ messages in thread
From: Ian Lin @ 2022-09-14  3:36 UTC (permalink / raw)
  To: linux-wireless
  Cc: brcm80211-dev-list, brcm80211-dev-list, franky.lin,
	hante.meuleman, kvalo, Double.Lo, ian.lin

From: Prasanna Kerekoppa <prasanna.kerekoppa@cypress.com>

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 <prasanna.kerekoppa@cypress.com>
Signed-off-by: Chung-Hsien Hsu <chung-hsien.hsu@infineon.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@infineon.com>
Signed-off-by: Ian Lin <ian.lin@infineon.com>
---
 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 7e9354768cfe..eba03a994e95 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


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

* [PATCH 4/5] brcmfmac: Update SSID of hidden AP while informing its bss to cfg80211 layer
  2022-09-14  3:36 [PATCH 0/5] Fix connect/p2p issue series Ian Lin
                   ` (2 preceding siblings ...)
  2022-09-14  3:36 ` [PATCH 3/5] brcmfmac: Avoiding Connection delay Ian Lin
@ 2022-09-14  3:36 ` Ian Lin
  2022-09-22  4:44   ` Kalle Valo
  2022-09-14  3:36 ` [PATCH 5/5] brcmfmac: fix P2P device discovery failure Ian Lin
  4 siblings, 1 reply; 10+ messages in thread
From: Ian Lin @ 2022-09-14  3:36 UTC (permalink / raw)
  To: linux-wireless
  Cc: brcm80211-dev-list, brcm80211-dev-list, franky.lin,
	hante.meuleman, kvalo, Double.Lo, ian.lin

From: Syed Rafiuddeen <syed.rafiuddeen@cypress.com>

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 <syed.rafiuddeen@infineon.com>
Signed-off-by: Chung-Hsien Hsu <chung-hsien.hsu@infineon.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@infineon.com>
Signed-off-by: Ian Lin <ian.lin@infineon.com>
---
 .../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 eba03a994e95..ca5cbbb622d2 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((u8 *)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


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

* [PATCH 5/5] brcmfmac: fix P2P device discovery failure
  2022-09-14  3:36 [PATCH 0/5] Fix connect/p2p issue series Ian Lin
                   ` (3 preceding siblings ...)
  2022-09-14  3:36 ` [PATCH 4/5] brcmfmac: Update SSID of hidden AP while informing its bss to cfg80211 layer Ian Lin
@ 2022-09-14  3:36 ` Ian Lin
  4 siblings, 0 replies; 10+ messages in thread
From: Ian Lin @ 2022-09-14  3:36 UTC (permalink / raw)
  To: linux-wireless
  Cc: brcm80211-dev-list, brcm80211-dev-list, franky.lin,
	hante.meuleman, kvalo, Double.Lo, ian.lin

From: Chung-Hsien Hsu <chung-hsien.hsu@infineon.com>

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 <chung-hsien.hsu@infineon.com>
Signed-off-by: Ian Lin <ian.lin@infineon.com>
---
 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


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

* Re: [PATCH 4/5] brcmfmac: Update SSID of hidden AP while informing its bss to cfg80211 layer
  2022-09-14  3:36 ` [PATCH 4/5] brcmfmac: Update SSID of hidden AP while informing its bss to cfg80211 layer Ian Lin
@ 2022-09-22  4:44   ` Kalle Valo
  2022-09-23  1:52     ` Lin Ian (CSSITB CSS ICW SW WFS / EE)
  0 siblings, 1 reply; 10+ messages in thread
From: Kalle Valo @ 2022-09-22  4:44 UTC (permalink / raw)
  To: Ian Lin
  Cc: linux-wireless, brcm80211-dev-list, brcm80211-dev-list,
	franky.lin, hante.meuleman, Double.Lo

Ian Lin <ian.lin@infineon.com> writes:

> From: Syed Rafiuddeen <syed.rafiuddeen@cypress.com>
>
> 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 <syed.rafiuddeen@infineon.com>

Syed's email address in From does not match with s-o-b.

> @@ -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((u8 *)ssid->data, bi->SSID, bi->SSID_len);
> +	}

memcpy() takes a void pointer so the cast is not needed.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

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

* Re: [PATCH 4/5] brcmfmac: Update SSID of hidden AP while informing its bss to cfg80211 layer
  2022-09-22  4:44   ` Kalle Valo
@ 2022-09-23  1:52     ` Lin Ian (CSSITB CSS ICW SW WFS / EE)
  2022-09-23 15:29       ` Jeff Johnson
  0 siblings, 1 reply; 10+ messages in thread
From: Lin Ian (CSSITB CSS ICW SW WFS / EE) @ 2022-09-23  1:52 UTC (permalink / raw)
  To: Kalle Valo
  Cc: linux-wireless, brcm80211-dev-list, brcm80211-dev-list,
	franky.lin, hante.meuleman, Double.Lo



On 9/22/2022 12:44 PM, Kalle Valo wrote:
> Ian Lin <ian.lin@infineon.com> writes:
>
>> From: Syed Rafiuddeen <syed.rafiuddeen@cypress.com>
>>
>> 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 <syed.rafiuddeen@infineon.com>
> Syed's email address in From does not match with s-o-b.
>
>> @@ -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((u8 *)ssid->data, bi->SSID, bi->SSID_len);
>> +     }
> memcpy() takes a void pointer so the cast is not needed.
There should be a type casting since 'ssid' is a const pointer.
As you saw there will be build warning in PATCH v2 (sorry I didn't 
notice that locally)
I will send PATCH v3 to restore type casting, is that ok?


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

* Re: [PATCH 4/5] brcmfmac: Update SSID of hidden AP while informing its bss to cfg80211 layer
  2022-09-23  1:52     ` Lin Ian (CSSITB CSS ICW SW WFS / EE)
@ 2022-09-23 15:29       ` Jeff Johnson
  2022-09-26  7:54         ` Kalle Valo
  0 siblings, 1 reply; 10+ messages in thread
From: Jeff Johnson @ 2022-09-23 15:29 UTC (permalink / raw)
  To: Lin Ian (CSSITB CSS ICW SW WFS / EE), Kalle Valo
  Cc: linux-wireless, brcm80211-dev-list, brcm80211-dev-list,
	franky.lin, hante.meuleman, Double.Lo

On 9/22/2022 6:52 PM, Lin Ian (CSSITB CSS ICW SW WFS / EE) wrote:
> 
> 
> On 9/22/2022 12:44 PM, Kalle Valo wrote:
>> Ian Lin <ian.lin@infineon.com> writes:
>>
>>> From: Syed Rafiuddeen <syed.rafiuddeen@cypress.com>
>>>
>>> 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 <syed.rafiuddeen@infineon.com>
>> Syed's email address in From does not match with s-o-b.
>>
>>> @@ -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((u8 *)ssid->data, bi->SSID, bi->SSID_len);
>>> +     }
>> memcpy() takes a void pointer so the cast is not needed.
> There should be a type casting since 'ssid' is a const pointer.
> As you saw there will be build warning in PATCH v2 (sorry I didn't 
> notice that locally)
> I will send PATCH v3 to restore type casting, is that ok?
> 

writing through a const pointer seems broken.
Should you instead remove the const qualifier from the declaration?
const struct brcmf_tlv *ssid = NULL;

if the problem is that brcmf_parse_tlvs() itself returns a const 
pointer, then I'd typecast during the assignment instead of the memcpy() 
call.

also note the NULL initializer is unnecessary since it is always 
overwritten by the call to brcmf_parse_tlvs()



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

* Re: [PATCH 4/5] brcmfmac: Update SSID of hidden AP while informing its bss to cfg80211 layer
  2022-09-23 15:29       ` Jeff Johnson
@ 2022-09-26  7:54         ` Kalle Valo
  0 siblings, 0 replies; 10+ messages in thread
From: Kalle Valo @ 2022-09-26  7:54 UTC (permalink / raw)
  To: Jeff Johnson
  Cc: Lin Ian (CSSITB CSS ICW SW WFS / EE),
	linux-wireless, brcm80211-dev-list, brcm80211-dev-list,
	franky.lin, hante.meuleman, Double.Lo

Jeff Johnson <quic_jjohnson@quicinc.com> writes:

>>>> @@ -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((u8 *)ssid->data, bi->SSID, bi->SSID_len);
>>>> +     }
>>> memcpy() takes a void pointer so the cast is not needed.
>>
>> There should be a type casting since 'ssid' is a const pointer.
>> As you saw there will be build warning in PATCH v2 (sorry I didn't
>> notice that locally)
>> I will send PATCH v3 to restore type casting, is that ok?
>>
>
> writing through a const pointer seems broken.

Yeah, this is exactly why I don't like casting. I see so often casts
removing the const and that can lead to another problems.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

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

end of thread, other threads:[~2022-09-26  7:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-14  3:36 [PATCH 0/5] Fix connect/p2p issue series Ian Lin
2022-09-14  3:36 ` [PATCH 1/5] brcmfmac: correctly remove all p2p vif Ian Lin
2022-09-14  3:36 ` [PATCH 2/5] brcmfmac: Fix for when connect request is not success Ian Lin
2022-09-14  3:36 ` [PATCH 3/5] brcmfmac: Avoiding Connection delay Ian Lin
2022-09-14  3:36 ` [PATCH 4/5] brcmfmac: Update SSID of hidden AP while informing its bss to cfg80211 layer Ian Lin
2022-09-22  4:44   ` Kalle Valo
2022-09-23  1:52     ` Lin Ian (CSSITB CSS ICW SW WFS / EE)
2022-09-23 15:29       ` Jeff Johnson
2022-09-26  7:54         ` Kalle Valo
2022-09-14  3:36 ` [PATCH 5/5] brcmfmac: fix P2P device discovery failure Ian Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.