From bryan.odonoghue at linaro.org  Wed Sep  1 04:56:38 2021
From: bryan.odonoghue at linaro.org (Bryan O'Donoghue)
Date: Wed, 1 Sep 2021 12:56:38 +0100
Subject: [PATCH] wcn36xx: handle connection loss indication
In-Reply-To: <CAMZdPi_frOfwf+9nfiUw2NJhfuSVgcPj3=Hx2g0d8UsaZza5MA@mail.gmail.com>
References: <20210901030542.17257-1-benl@squareup.com>
 <CAMZdPi_frOfwf+9nfiUw2NJhfuSVgcPj3=Hx2g0d8UsaZza5MA@mail.gmail.com>
Message-ID: <b6157d1f-b548-13c0-3683-2d8c35964d1d@linaro.org>

On 01/09/2021 07:40, Loic Poulain wrote:
> iw wlan0 set power_save off

I do this on wcn3680b and get no loss of signal

If I do this though

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index 03966072f34c..ba613fbb728d 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -2345,6 +2345,8 @@ int wcn36xx_smd_feature_caps_exchange(struct 
wcn36xx *wcn)
                 set_feat_caps(msg_body.feat_caps, DOT11AC);
                 set_feat_caps(msg_body.feat_caps, 
ANTENNA_DIVERSITY_SELECTION);
         }
+       set_feat_caps(msg_body.feat_caps, IBSS_HEARTBEAT_OFFLOAD);
+       set_feat_caps(msg_body.feat_caps, WLANACTIVE_OFFLOAD);

         PREPARE_HAL_BUF(wcn->hal_buf, msg_body);

@@ -2589,7 +2591,7 @@ static int wcn36xx_smd_missed_beacon_ind(struct 
wcn36xx *wcn,
         struct wcn36xx_hal_missed_beacon_ind_msg *rsp = buf;
         struct ieee80211_vif *vif = NULL;
         struct wcn36xx_vif *tmp;
-
+wcn36xx_info("%s/%d\n", __func__, __LINE__);
         /* Old FW does not have bss index */
         if (wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) {
                 list_for_each_entry(tmp, &wcn->vif_list, list) {
@@ -2608,7 +2610,7 @@ static int wcn36xx_smd_missed_beacon_ind(struct 
wcn36xx *wcn,

         list_for_each_entry(tmp, &wcn->vif_list, list) {
                 if (tmp->bss_index == rsp->bss_index) {
-                       wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed 
bss_index %d\n",
+                       wcn36xx_info("beacon missed bss_index %d\n",
                                     rsp->bss_index);
                         vif = wcn36xx_priv_to_vif(tmp);
                         ieee80211_connection_loss(vif);


bingo

root at linaro-developer:~# iw wlan0 set power_save off 
 


# pulls plug on AP

root at linaro-developer:~# [   83.290987] wcn36xx: 
wcn36xx_smd_missed_beacon_ind/2594
[   83.291070] wcn36xx: beacon missed bss_index 0
[   83.295403] wlan0: Connection to AP e2:63:da:9c:a4:bd lost

I'm not sure if both flags are required but, this is the behavior we want



From benl at squareup.com  Wed Sep  1 11:02:32 2021
From: benl at squareup.com (Benjamin Li)
Date: Wed, 1 Sep 2021 11:02:32 -0700
Subject: [PATCH] wcn36xx: handle connection loss indication
In-Reply-To: <b6157d1f-b548-13c0-3683-2d8c35964d1d@linaro.org>
References: <20210901030542.17257-1-benl@squareup.com>
 <CAMZdPi_frOfwf+9nfiUw2NJhfuSVgcPj3=Hx2g0d8UsaZza5MA@mail.gmail.com>
 <b6157d1f-b548-13c0-3683-2d8c35964d1d@linaro.org>
Message-ID: <168f96a5-58ec-fea9-c0d3-61f925bd1129@squareup.com>

Thanks for the investigation!

As discussed offline, I will send v2 with Fixes: removed, and Bryan will test and submit a separate patch to add the additional feat_caps for the power_save off case.

Depending on DB410c testing, these feat_caps may need to be gated for WCN3680 only, in which case Loic's patch to re-enable CONNECTION_MONITOR (but gated for WCN3660/3620) would still be needed.

Ben

On 9/1/21 4:56 AM, Bryan O'Donoghue wrote:
> On 01/09/2021 07:40, Loic Poulain wrote:
>> iw wlan0 set power_save off
> 
> I do this on wcn3680b and get no loss of signal
> 
> If I do this though
> 
> diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
> index 03966072f34c..ba613fbb728d 100644
> --- a/drivers/net/wireless/ath/wcn36xx/smd.c
> +++ b/drivers/net/wireless/ath/wcn36xx/smd.c
> @@ -2345,6 +2345,8 @@ int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn)
> ??????????????? set_feat_caps(msg_body.feat_caps, DOT11AC);
> ??????????????? set_feat_caps(msg_body.feat_caps, ANTENNA_DIVERSITY_SELECTION);
> ??????? }
> +?????? set_feat_caps(msg_body.feat_caps, IBSS_HEARTBEAT_OFFLOAD);
> +?????? set_feat_caps(msg_body.feat_caps, WLANACTIVE_OFFLOAD);
> 
> ??????? PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> 
> @@ -2589,7 +2591,7 @@ static int wcn36xx_smd_missed_beacon_ind(struct wcn36xx *wcn,
> ??????? struct wcn36xx_hal_missed_beacon_ind_msg *rsp = buf;
> ??????? struct ieee80211_vif *vif = NULL;
> ??????? struct wcn36xx_vif *tmp;
> -
> +wcn36xx_info("%s/%d\n", __func__, __LINE__);
> ??????? /* Old FW does not have bss index */
> ??????? if (wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) {
> ??????????????? list_for_each_entry(tmp, &wcn->vif_list, list) {
> @@ -2608,7 +2610,7 @@ static int wcn36xx_smd_missed_beacon_ind(struct wcn36xx *wcn,
> 
> ??????? list_for_each_entry(tmp, &wcn->vif_list, list) {
> ??????????????? if (tmp->bss_index == rsp->bss_index) {
> -?????????????????????? wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n",
> +?????????????????????? wcn36xx_info("beacon missed bss_index %d\n",
> ??????????????????????????????????? rsp->bss_index);
> ??????????????????????? vif = wcn36xx_priv_to_vif(tmp);
> ??????????????????????? ieee80211_connection_loss(vif);
> 
> 
> bingo
> 
> root at linaro-developer:~# iw wlan0 set power_save off
> 
> 
> # pulls plug on AP
> 
> root at linaro-developer:~# [?? 83.290987] wcn36xx: wcn36xx_smd_missed_beacon_ind/2594
> [?? 83.291070] wcn36xx: beacon missed bss_index 0
> [?? 83.295403] wlan0: Connection to AP e2:63:da:9c:a4:bd lost
> 
> I'm not sure if both flags are required but, this is the behavior we want
> 


From benl at squareup.com  Wed Sep  1 11:06:05 2021
From: benl at squareup.com (Benjamin Li)
Date: Wed,  1 Sep 2021 11:06:05 -0700
Subject: [PATCH v2] wcn36xx: handle connection loss indication
Message-ID: <20210901180606.11686-1-benl@squareup.com>

Firmware sends delete_sta_context_ind when it detects the AP has gone
away in STA mode. Right now the handler for that indication only handles
AP mode; fix it to also handle STA mode.

Cc: stable at vger.kernel.org
Signed-off-by: Benjamin Li <benl at squareup.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
Reviewed-by: Loic Poulain <loic.poulain at linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/smd.c | 44 +++++++++++++++++++-------
 1 file changed, 33 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
index 57fa857b290b..f6bea896abe8 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -2623,30 +2623,52 @@ static int wcn36xx_smd_delete_sta_context_ind(struct wcn36xx *wcn,
 					      size_t len)
 {
 	struct wcn36xx_hal_delete_sta_context_ind_msg *rsp = buf;
-	struct wcn36xx_vif *tmp;
+	struct wcn36xx_vif *vif_priv;
+	struct ieee80211_vif *vif;
+	struct ieee80211_bss_conf *bss_conf;
 	struct ieee80211_sta *sta;
+	bool found = false;
 
 	if (len != sizeof(*rsp)) {
 		wcn36xx_warn("Corrupted delete sta indication\n");
 		return -EIO;
 	}
 
-	wcn36xx_dbg(WCN36XX_DBG_HAL, "delete station indication %pM index %d\n",
-		    rsp->addr2, rsp->sta_id);
+	wcn36xx_dbg(WCN36XX_DBG_HAL,
+		    "delete station indication %pM index %d reason %d\n",
+		    rsp->addr2, rsp->sta_id, rsp->reason_code);
 
-	list_for_each_entry(tmp, &wcn->vif_list, list) {
+	list_for_each_entry(vif_priv, &wcn->vif_list, list) {
 		rcu_read_lock();
-		sta = ieee80211_find_sta(wcn36xx_priv_to_vif(tmp), rsp->addr2);
-		if (sta)
-			ieee80211_report_low_ack(sta, 0);
+		vif = wcn36xx_priv_to_vif(vif_priv);
+
+		if (vif->type == NL80211_IFTYPE_STATION) {
+			/* We could call ieee80211_find_sta too, but checking
+			 * bss_conf is clearer.
+			 */
+			bss_conf = &vif->bss_conf;
+			if (vif_priv->sta_assoc &&
+			    !memcmp(bss_conf->bssid, rsp->addr2, ETH_ALEN)) {
+				found = true;
+				wcn36xx_dbg(WCN36XX_DBG_HAL,
+					    "connection loss bss_index %d\n",
+					    vif_priv->bss_index);
+				ieee80211_connection_loss(vif);
+			}
+		} else {
+			sta = ieee80211_find_sta(vif, rsp->addr2);
+			if (sta) {
+				found = true;
+				ieee80211_report_low_ack(sta, 0);
+			}
+		}
+
 		rcu_read_unlock();
-		if (sta)
+		if (found)
 			return 0;
 	}
 
-	wcn36xx_warn("STA with addr %pM and index %d not found\n",
-		     rsp->addr2,
-		     rsp->sta_id);
+	wcn36xx_warn("BSS or STA with addr %pM not found\n", rsp->addr2);
 	return -ENOENT;
 }
 
-- 
2.17.1



From kvalo at codeaurora.org  Thu Sep  2 09:37:03 2021
From: kvalo at codeaurora.org (Kalle Valo)
Date: Thu, 02 Sep 2021 19:37:03 +0300
Subject: [PATCH v2] wcn36xx: handle connection loss indication
In-Reply-To: <20210901180606.11686-1-benl@squareup.com> (Benjamin Li's message
 of "Wed, 1 Sep 2021 11:06:05 -0700")
References: <20210901180606.11686-1-benl@squareup.com>
Message-ID: <8735qn2ats.fsf@codeaurora.org>

Benjamin Li <benl at squareup.com> writes:

> Firmware sends delete_sta_context_ind when it detects the AP has gone
> away in STA mode. Right now the handler for that indication only handles
> AP mode; fix it to also handle STA mode.
>
> Cc: stable at vger.kernel.org
> Signed-off-by: Benjamin Li <benl at squareup.com>
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
> Reviewed-by: Loic Poulain <loic.poulain at linaro.org>

How well is this tested? I'm pondering should I queue this to v5.15 or
v5.16, at the moment I'm leaning towards v5.16.

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

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


From benl at squareup.com  Thu Sep  2 11:37:12 2021
From: benl at squareup.com (Benjamin Li)
Date: Thu, 2 Sep 2021 11:37:12 -0700
Subject: [PATCH v2] wcn36xx: handle connection loss indication
In-Reply-To: <8735qn2ats.fsf@codeaurora.org>
References: <20210901180606.11686-1-benl@squareup.com>
 <8735qn2ats.fsf@codeaurora.org>
Message-ID: <3a587de2-f605-fd17-4d70-878b13354b39@squareup.com>

On 9/2/21 9:37 AM, Kalle Valo wrote:
> Benjamin Li <benl at squareup.com> writes:
> 
>> Firmware sends delete_sta_context_ind when it detects the AP has gone
>> away in STA mode. Right now the handler for that indication only handles
>> AP mode; fix it to also handle STA mode.
>>
>> Cc: stable at vger.kernel.org
>> Signed-off-by: Benjamin Li <benl at squareup.com>
>> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
>> Reviewed-by: Loic Poulain <loic.poulain at linaro.org>
> 
> How well is this tested? I'm pondering should I queue this to v5.15 or
> v5.16, at the moment I'm leaning towards v5.16.
>
It was an issue reported during internal testing, and the patch has not
yet had soak time with our quality team/field devices. v5.16 sounds fine.

Ben


From bryan.odonoghue at linaro.org  Wed Sep  8 06:30:18 2021
From: bryan.odonoghue at linaro.org (Bryan O'Donoghue)
Date: Wed,  8 Sep 2021 14:30:18 +0100
Subject: [PATCH 1/2] wcn36xx: Fix Antenna Diversity Switching
In-Reply-To: <20210908133019.2408092-1-bryan.odonoghue@linaro.org>
References: <20210908133019.2408092-1-bryan.odonoghue@linaro.org>
Message-ID: <20210908133019.2408092-2-bryan.odonoghue@linaro.org>

We have been tracking a strange bug with Antenna Diversity Switching (ADS)
on wcn3680b for a while.

ADS is configured like this:
   A. Via a firmware configuration table baked into the firmware binary.
       1. Defines if ADS is enabled.
       2. Defines which GPIOs are connected to which antenna enable pin.
       3. Defines which antenna/GPIO is primary and which is secondary.

   B. WCN36XX_CFG_VAL(ANTENNA_DIVERSITY, N)
      N is a bitmask of available antenna.

      Setting N to 3 indicates a bitmask of enabled antenna (1 | 2).

      Obviously then we can set N to 1 or N to 2 to fix to a particular
      antenna and disable antenna diversity.

   C. WCN36XX_CFG_VAL(ASD_PROBE_INTERVAL, XX)
      XX is the number of beacons between each antenna RSSI check.
      Setting this value to 50 means, every 50 received beacons, run the
      ADS algorithm.

   D. WCN36XX_CFG_VAL(ASD_TRIGGER_THRESHOLD, YY)
      YY is a two's complement integer which specifies the RSSI decibel
      threshold below which ADS will run.
      We default to -60db here, meaning a measured RSSI <= -60db will
      trigger an ADS probe.

   E. WCN36XX_CFG_VAL(ASD_RTT_RSSI_HYST_THRESHOLD, Z)
      Z is a hysteresis value, indicating a delta which the RSSI must
      exceed for the antenna switch to be valid.

      For example if HYST_THRESHOLD == 3 AntennaId1-RSSI == -60db and
      AntennaId-2-RSSI == -58db then firmware will not switch antenna.
      The threshold needs to be -57db or better to satisfy the criteria.

ADS works like this:

    A. Every XX beacons the firmware switches to or remains on the primary
       antenna.

    B. The firmware then sends a Request-To-Send (RTS) packet to the AP.

    C. The firmware waits for a Clear-To-Send (CTS) response from the AP.

    D. The firmware then notes the received RSSI on the CTS packet.

    E. The firmware then repeats steps A-D on the secondary antenna.

    F. Subsequently if the measured RSSI on the primary or secondary
       antenna is better than ASD_TRIGGER_THRESHOLD +
       ASD_RTT_RSSI_HYST_THRESHOLD then that antenna becomes the active
       antenna.

    G. If RSSI rises past ASD_TRIGGER_THRESHOLD then ADS doesn't run at
       all even if there is a substantially better RSSI on the other
       antenna.

What we have been observing is that the RTS packet is being sent but the
MAC address is a byte-swapped version of the target MAC. The ADS/RTS MAC is
corrupted only when the link is encrypted, if the AP is open the RTS MAC is
correct. Similarly if we configure the firmware to an RTS/CTS sequence for
regular data - the transmitted RTS MAC is correctly formatted.

Internally the wcn36xx firmware uses the indexes in the SMD commands to
populate and extract data from specific entries in an STA lookup table. The
AP's MAC appears a number of times in different indexes within this lookup
table, so the MAC address extracted for the data-transmit RTS and the MAC
address extracted for the ADS/RTS packet are not the same STA table index.

Our analysis indicates the relevant firmware STA table index is
"bssSelfStaIdx".

There is an STA populate function responsible for formatting the MAC
address of the bssSelfStaIdx including byte-swapping the MAC address.

Its clear then that the required STA populate command did not run for
bssSelfStaIdx.

So taking a look at the sequence of SMD commands sent to the firmware we
see the following downstream when moving from an unencrypted to encrypted
BSS setup.

- WLAN_HAL_CONFIG_BSS_REQ
- WLAN_HAL_CONFIG_STA_REQ
- WLAN_HAL_SET_STAKEY_REQ

Upstream in wcn36xx we have

- WLAN_HAL_CONFIG_BSS_REQ
- WLAN_HAL_SET_STAKEY_REQ

The solution then is to add the missing WLAN_HAL_CONFIG_STA_REQ between
WLAN_HAL_CONFIG_BSS_REQ and WLAN_HAL_SET_STAKEY_REQ.

No surprise WLAN_HAL_CONFIG_STA_REQ is the routine responsible for
populating the STA lookup table in the firmware and once done the MAC sent
by the ADS routine is in the correct byte-order.

This bug is apparent with ADS but it is also the case that any other
firmware routine that depends on the "bssSelfStaIdx" would retrieve
malformed data on an encrypted link.

Fixes: 3e977c5c523d ("wcn36xx: Define wcn3680 specific firmware parameters")
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index 2ccf7a8924a0..60cf0516e1bc 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -567,12 +567,14 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 		if (IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags) {
 			sta_priv->is_data_encrypted = true;
 			/* Reconfigure bss with encrypt_type */
-			if (NL80211_IFTYPE_STATION == vif->type)
+			if (NL80211_IFTYPE_STATION == vif->type) {
 				wcn36xx_smd_config_bss(wcn,
 						       vif,
 						       sta,
 						       sta->addr,
 						       true);
+				wcn36xx_smd_config_sta(wcn, vif, sta);
+			}
 
 			wcn36xx_smd_set_stakey(wcn,
 				vif_priv->encrypt_type,
-- 
2.33.0



From bryan.odonoghue at linaro.org  Wed Sep  8 06:30:17 2021
From: bryan.odonoghue at linaro.org (Bryan O'Donoghue)
Date: Wed,  8 Sep 2021 14:30:17 +0100
Subject: [PATCH 0/2] wcn36xx: Two one line fixes for Antenna Diveristy
 Switching
Message-ID: <20210908133019.2408092-1-bryan.odonoghue@linaro.org>

Here are two one liners.

The first fixes a fairly major bug that is apparent with Antenna Diveristy
Switching (ADS) but, is not limited to ADS. The bug is a basic firmware
table corruption problem, which just happens to manifest itself clearly
with the ADS logic.

The second fix is a fairly trivial one-liner which prevents us from sending
negative, two's complement integers to the firmware via the SMD backdoor
"dump" command.

Bryan O'Donoghue (2):
  wcn36xx: Fix Antenna Diversity Switching
  wcn36xx: Add ability for wcn36xx_smd_dump_cmd_req to pass two's
    complement

 drivers/net/wireless/ath/wcn36xx/debug.c | 2 +-
 drivers/net/wireless/ath/wcn36xx/main.c  | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

-- 
2.33.0



From bryan.odonoghue at linaro.org  Wed Sep  8 06:30:19 2021
From: bryan.odonoghue at linaro.org (Bryan O'Donoghue)
Date: Wed,  8 Sep 2021 14:30:19 +0100
Subject: [PATCH 2/2] wcn36xx: Add ability for wcn36xx_smd_dump_cmd_req to pass
 two's complement
In-Reply-To: <20210908133019.2408092-1-bryan.odonoghue@linaro.org>
References: <20210908133019.2408092-1-bryan.odonoghue@linaro.org>
Message-ID: <20210908133019.2408092-3-bryan.odonoghue@linaro.org>

Qcom documents suggest passing of negative values to the dump command.
Currently we convert from string to u32 not s32, so we cannot pass a two's
complement value to the firmware in this way.

There is in fact only one parameter which takes a two's complement value
<tigger threshold> in the antenna diversity switch command.

Downstream:
iwpriv wlan0 dump 71 3 <schedule period> <trigger threshold> <hysteresis>

Upstream:
echo "71 3 50 -60 3" > /sys/kernel/debug/ieee80211/phy0/wcn36xx/dump

Meaning enable Antenna Diveristy Switching every 50 beacons if the signal
quality is -60db or worse and a hysteresis of 3 db or better to switch from
one antenna to another.

Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware")
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/debug.c b/drivers/net/wireless/ath/wcn36xx/debug.c
index 389b5e7129a6..6af306ae41ad 100644
--- a/drivers/net/wireless/ath/wcn36xx/debug.c
+++ b/drivers/net/wireless/ath/wcn36xx/debug.c
@@ -120,7 +120,7 @@ static ssize_t write_file_dump(struct file *file,
 		if (begin == NULL)
 			break;
 
-		if (kstrtou32(begin, 0, &arg[i]) != 0)
+		if (kstrtos32(begin, 0, &arg[i]) != 0)
 			break;
 	}
 
-- 
2.33.0



From johannes at sipsolutions.net  Wed Sep  8 06:33:55 2021
From: johannes at sipsolutions.net (Johannes Berg)
Date: Wed, 08 Sep 2021 15:33:55 +0200
Subject: [PATCH 2/2] wcn36xx: Add ability for wcn36xx_smd_dump_cmd_req
 to pass two's complement
In-Reply-To: <20210908133019.2408092-3-bryan.odonoghue@linaro.org>
References: <20210908133019.2408092-1-bryan.odonoghue@linaro.org>
 <20210908133019.2408092-3-bryan.odonoghue@linaro.org>
Message-ID: <19691c5bc144eb525530974813812a86937a0a91.camel@sipsolutions.net>

On Wed, 2021-09-08 at 14:30 +0100, Bryan O'Donoghue wrote:
> 
> iwpriv wlan0 dump 71 3 <schedule period> <trigger threshold> <hysteresis>

Ouch. The last millenium called and wants its technology back ;-)

johannes



From bryan.odonoghue at linaro.org  Wed Sep  8 06:52:24 2021
From: bryan.odonoghue at linaro.org (Bryan O'Donoghue)
Date: Wed, 8 Sep 2021 14:52:24 +0100
Subject: [PATCH 2/2] wcn36xx: Add ability for wcn36xx_smd_dump_cmd_req to
 pass two's complement
In-Reply-To: <19691c5bc144eb525530974813812a86937a0a91.camel@sipsolutions.net>
References: <20210908133019.2408092-1-bryan.odonoghue@linaro.org>
 <20210908133019.2408092-3-bryan.odonoghue@linaro.org>
 <19691c5bc144eb525530974813812a86937a0a91.camel@sipsolutions.net>
Message-ID: <b98ac262-a1df-4576-eee6-2bb5f175e7fe@linaro.org>

On 08/09/2021 14:33, Johannes Berg wrote:
> On Wed, 2021-09-08 at 14:30 +0100, Bryan O'Donoghue wrote:
>>
>> iwpriv wlan0 dump 71 3 <schedule period> <trigger threshold> <hysteresis>
> 
> Ouch. The last millenium called and wants its technology back ;-)
> 
> johannes
> 

ah we're all about recycling the technology since #climatechange

:)


From benl at squareup.com  Wed Sep  8 17:13:44 2021
From: benl at squareup.com (Benjamin Li)
Date: Wed, 8 Sep 2021 17:13:44 -0700
Subject: [PATCH 1/2] wcn36xx: Fix Antenna Diversity Switching
In-Reply-To: <20210908133019.2408092-2-bryan.odonoghue@linaro.org>
References: <20210908133019.2408092-1-bryan.odonoghue@linaro.org>
 <20210908133019.2408092-2-bryan.odonoghue@linaro.org>
Message-ID: <8d991c9d-083a-2ad0-0ce3-d214639dfbdd@squareup.com>

On 9/8/21 6:30 AM, Bryan O'Donoghue wrote:
> We have been tracking a strange bug with Antenna Diversity Switching (ADS)
> on wcn3680b for a while.
> 
> ADS is configured like this:
>    A. Via a firmware configuration table baked into the firmware binary.

in the NV, not the firmware binary

>        1. Defines if ADS is enabled.
>        2. Defines which GPIOs are connected to which antenna enable pin.
>        3. Defines which antenna/GPIO is primary and which is secondary.
> 
>    B. WCN36XX_CFG_VAL(ANTENNA_DIVERSITY, N)
>       N is a bitmask of available antenna.
> 
>       Setting N to 3 indicates a bitmask of enabled antenna (1 | 2).
> 
>       Obviously then we can set N to 1 or N to 2 to fix to a particular
>       antenna and disable antenna diversity.
> 
>    C. WCN36XX_CFG_VAL(ASD_PROBE_INTERVAL, XX)
>       XX is the number of beacons between each antenna RSSI check.
>       Setting this value to 50 means, every 50 received beacons, run the
>       ADS algorithm.
> 
>    D. WCN36XX_CFG_VAL(ASD_TRIGGER_THRESHOLD, YY)
>       YY is a two's complement integer which specifies the RSSI decibel
>       threshold below which ADS will run.
>       We default to -60db here, meaning a measured RSSI <= -60db will
>       trigger an ADS probe.
> 
>    E. WCN36XX_CFG_VAL(ASD_RTT_RSSI_HYST_THRESHOLD, Z)
>       Z is a hysteresis value, indicating a delta which the RSSI must
>       exceed for the antenna switch to be valid.
> 
>       For example if HYST_THRESHOLD == 3 AntennaId1-RSSI == -60db and
>       AntennaId-2-RSSI == -58db then firmware will not switch antenna.
>       The threshold needs to be -57db or better to satisfy the criteria.

Maybe also worth mentioning there's a feat_cap for
ANTENNA_DIVERSITY_SELECTION, although from what we saw FW doesn't actually
check it.

> 
> ADS works like this:
> 
>     A. Every XX beacons the firmware switches to or remains on the primary
>        antenna.
> 
>     B. The firmware then sends a Request-To-Send (RTS) packet to the AP.
> 
>     C. The firmware waits for a Clear-To-Send (CTS) response from the AP.
> 
>     D. The firmware then notes the received RSSI on the CTS packet.
> 
>     E. The firmware then repeats steps A-D on the secondary antenna.
> 
>     F. Subsequently if the measured RSSI on the primary or secondary
>        antenna is better than ASD_TRIGGER_THRESHOLD +

better than the active antenna's RSSI +

>        ASD_RTT_RSSI_HYST_THRESHOLD then that antenna becomes the active
>        antenna.
> 
>     G. If RSSI rises past ASD_TRIGGER_THRESHOLD then ADS doesn't run at
>        all even if there is a substantially better RSSI on the other
>        antenna.
> 
> What we have been observing is that the RTS packet is being sent but the
> MAC address is a byte-swapped version of the target MAC. The ADS/RTS MAC is
> corrupted only when the link is encrypted, if the AP is open the RTS MAC is
> correct. Similarly if we configure the firmware to an RTS/CTS sequence for
> regular data - the transmitted RTS MAC is correctly formatted.
> 
> Internally the wcn36xx firmware uses the indexes in the SMD commands to
> populate and extract data from specific entries in an STA lookup table. The
> AP's MAC appears a number of times in different indexes within this lookup
> table, so the MAC address extracted for the data-transmit RTS and the MAC
> address extracted for the ADS/RTS packet are not the same STA table index.
> 
> Our analysis indicates the relevant firmware STA table index is
> "bssSelfStaIdx".
> 
> There is an STA populate function responsible for formatting the MAC
> address of the bssSelfStaIdx including byte-swapping the MAC address.
> 
> Its clear then that the required STA populate command did not run for
> bssSelfStaIdx.
> 
> So taking a look at the sequence of SMD commands sent to the firmware we
> see the following downstream when moving from an unencrypted to encrypted
> BSS setup.
> 
> - WLAN_HAL_CONFIG_BSS_REQ
> - WLAN_HAL_CONFIG_STA_REQ
> - WLAN_HAL_SET_STAKEY_REQ
> 
> Upstream in wcn36xx we have
> 
> - WLAN_HAL_CONFIG_BSS_REQ
> - WLAN_HAL_SET_STAKEY_REQ
> 
> The solution then is to add the missing WLAN_HAL_CONFIG_STA_REQ between
> WLAN_HAL_CONFIG_BSS_REQ and WLAN_HAL_SET_STAKEY_REQ.
> 
> No surprise WLAN_HAL_CONFIG_STA_REQ is the routine responsible for
> populating the STA lookup table in the firmware and once done the MAC sent
> by the ADS routine is in the correct byte-order.
> 
> This bug is apparent with ADS but it is also the case that any other
> firmware routine that depends on the "bssSelfStaIdx" would retrieve
> malformed data on an encrypted link.
> 
> Fixes: 3e977c5c523d ("wcn36xx: Define wcn3680 specific firmware parameters")
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
> ---
>  drivers/net/wireless/ath/wcn36xx/main.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
> index 2ccf7a8924a0..60cf0516e1bc 100644
> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -567,12 +567,14 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
>  		if (IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags) {
>  			sta_priv->is_data_encrypted = true;
>  			/* Reconfigure bss with encrypt_type */
> -			if (NL80211_IFTYPE_STATION == vif->type)
> +			if (NL80211_IFTYPE_STATION == vif->type) {
>  				wcn36xx_smd_config_bss(wcn,
>  						       vif,
>  						       sta,
>  						       sta->addr,
>  						       true);
> +				wcn36xx_smd_config_sta(wcn, vif, sta);
> +			}
>  
>  			wcn36xx_smd_set_stakey(wcn,
>  				vif_priv->encrypt_type,
> 
Nice write-up!

Tested-by: Benjamin Li <benl at squareup.com>
on Square Terminal (2018) with FW-side workaround reverted


From sashal at kernel.org  Thu Sep  9 04:41:00 2021
From: sashal at kernel.org (Sasha Levin)
Date: Thu,  9 Sep 2021 07:41:00 -0400
Subject: [PATCH AUTOSEL 5.14 246/252] wcn36xx: Fix missing frame timestamp for
 beacon/probe-resp
In-Reply-To: <20210909114106.141462-1-sashal@kernel.org>
References: <20210909114106.141462-1-sashal@kernel.org>
Message-ID: <20210909114106.141462-246-sashal@kernel.org>

From: Loic Poulain <loic.poulain at linaro.org>

[ Upstream commit 8678fd31f2d3eb14f2b8b39c9bc266f16fa24b22 ]

When receiving a beacon or probe response, we should update the
boottime_ns field which is the timestamp the frame was received at.
(cf mac80211.h)

This fixes a scanning issue with Android since it relies on this
timestamp to determine when the AP has been seen for the last time
(via the nl80211 BSS_LAST_SEEN_BOOTTIME parameter).

Signed-off-by: Loic Poulain <loic.poulain at linaro.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
Signed-off-by: Kalle Valo <kvalo at codeaurora.org>
Link: https://lore.kernel.org/r/1629992768-23785-1-git-send-email-loic.poulain at linaro.org
Signed-off-by: Sasha Levin <sashal at kernel.org>
---
 drivers/net/wireless/ath/wcn36xx/txrx.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.c b/drivers/net/wireless/ath/wcn36xx/txrx.c
index 1b831157ede1..cab196bb38cd 100644
--- a/drivers/net/wireless/ath/wcn36xx/txrx.c
+++ b/drivers/net/wireless/ath/wcn36xx/txrx.c
@@ -287,6 +287,10 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)
 		status.rate_idx = 0;
 	}
 
+	if (ieee80211_is_beacon(hdr->frame_control) ||
+	    ieee80211_is_probe_resp(hdr->frame_control))
+		status.boottime_ns = ktime_get_boottime_ns();
+
 	memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));
 
 	if (ieee80211_is_beacon(hdr->frame_control)) {
-- 
2.30.2



From sashal at kernel.org  Thu Sep  9 04:46:29 2021
From: sashal at kernel.org (Sasha Levin)
Date: Thu,  9 Sep 2021 07:46:29 -0400
Subject: [PATCH AUTOSEL 5.13 213/219] wcn36xx: Fix missing frame timestamp for
 beacon/probe-resp
In-Reply-To: <20210909114635.143983-1-sashal@kernel.org>
References: <20210909114635.143983-1-sashal@kernel.org>
Message-ID: <20210909114635.143983-213-sashal@kernel.org>

From: Loic Poulain <loic.poulain at linaro.org>

[ Upstream commit 8678fd31f2d3eb14f2b8b39c9bc266f16fa24b22 ]

When receiving a beacon or probe response, we should update the
boottime_ns field which is the timestamp the frame was received at.
(cf mac80211.h)

This fixes a scanning issue with Android since it relies on this
timestamp to determine when the AP has been seen for the last time
(via the nl80211 BSS_LAST_SEEN_BOOTTIME parameter).

Signed-off-by: Loic Poulain <loic.poulain at linaro.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
Signed-off-by: Kalle Valo <kvalo at codeaurora.org>
Link: https://lore.kernel.org/r/1629992768-23785-1-git-send-email-loic.poulain at linaro.org
Signed-off-by: Sasha Levin <sashal at kernel.org>
---
 drivers/net/wireless/ath/wcn36xx/txrx.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.c b/drivers/net/wireless/ath/wcn36xx/txrx.c
index 1b831157ede1..cab196bb38cd 100644
--- a/drivers/net/wireless/ath/wcn36xx/txrx.c
+++ b/drivers/net/wireless/ath/wcn36xx/txrx.c
@@ -287,6 +287,10 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)
 		status.rate_idx = 0;
 	}
 
+	if (ieee80211_is_beacon(hdr->frame_control) ||
+	    ieee80211_is_probe_resp(hdr->frame_control))
+		status.boottime_ns = ktime_get_boottime_ns();
+
 	memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));
 
 	if (ieee80211_is_beacon(hdr->frame_control)) {
-- 
2.30.2



From sashal at kernel.org  Thu Sep  9 04:51:12 2021
From: sashal at kernel.org (Sasha Levin)
Date: Thu,  9 Sep 2021 07:51:12 -0400
Subject: [PATCH AUTOSEL 5.10 170/176] wcn36xx: Fix missing frame timestamp for
 beacon/probe-resp
In-Reply-To: <20210909115118.146181-1-sashal@kernel.org>
References: <20210909115118.146181-1-sashal@kernel.org>
Message-ID: <20210909115118.146181-170-sashal@kernel.org>

From: Loic Poulain <loic.poulain at linaro.org>

[ Upstream commit 8678fd31f2d3eb14f2b8b39c9bc266f16fa24b22 ]

When receiving a beacon or probe response, we should update the
boottime_ns field which is the timestamp the frame was received at.
(cf mac80211.h)

This fixes a scanning issue with Android since it relies on this
timestamp to determine when the AP has been seen for the last time
(via the nl80211 BSS_LAST_SEEN_BOOTTIME parameter).

Signed-off-by: Loic Poulain <loic.poulain at linaro.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
Signed-off-by: Kalle Valo <kvalo at codeaurora.org>
Link: https://lore.kernel.org/r/1629992768-23785-1-git-send-email-loic.poulain at linaro.org
Signed-off-by: Sasha Levin <sashal at kernel.org>
---
 drivers/net/wireless/ath/wcn36xx/txrx.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.c b/drivers/net/wireless/ath/wcn36xx/txrx.c
index 1b831157ede1..cab196bb38cd 100644
--- a/drivers/net/wireless/ath/wcn36xx/txrx.c
+++ b/drivers/net/wireless/ath/wcn36xx/txrx.c
@@ -287,6 +287,10 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)
 		status.rate_idx = 0;
 	}
 
+	if (ieee80211_is_beacon(hdr->frame_control) ||
+	    ieee80211_is_probe_resp(hdr->frame_control))
+		status.boottime_ns = ktime_get_boottime_ns();
+
 	memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));
 
 	if (ieee80211_is_beacon(hdr->frame_control)) {
-- 
2.30.2



From bryan.odonoghue at linaro.org  Thu Sep  9 07:44:26 2021
From: bryan.odonoghue at linaro.org (Bryan O'Donoghue)
Date: Thu,  9 Sep 2021 15:44:26 +0100
Subject: [PATCH v2 0/2] wcn36xx: Two one line fixes for Antenna Diveristy
 Switching
Message-ID: <20210909144428.2564650-1-bryan.odonoghue@linaro.org>

V2:
Ammends the commit log of the first patch
  - Clarifies NV is the location of antenna GPIO settings
  - Adds some text about feature bit ANTENNA_DIVERSITY_SELECTION
  - Tidies up language around "measured antenna"
  - Adds Tested-by: Benjamin Li <benl at squareup.com>

V1:
Here are two one liners.

The first fixes a fairly major bug that is apparent with Antenna Diveristy
Switching (ADS) but, is not limited to ADS. The bug is a basic firmware
table corruption problem, which just happens to manifest itself clearly
with the ADS logic.

The second fix is a fairly trivial one-liner which prevents us from sending
negative, two's complement integers to the firmware via the SMD backdoor
"dump" command.

Bryan O'Donoghue (2):
  wcn36xx: Fix Antenna Diversity Switching
  wcn36xx: Add ability for wcn36xx_smd_dump_cmd_req to pass two's
    complement

 drivers/net/wireless/ath/wcn36xx/debug.c | 2 +-
 drivers/net/wireless/ath/wcn36xx/main.c  | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

-- 
2.33.0



From bryan.odonoghue at linaro.org  Thu Sep  9 07:44:27 2021
From: bryan.odonoghue at linaro.org (Bryan O'Donoghue)
Date: Thu,  9 Sep 2021 15:44:27 +0100
Subject: [PATCH v2 1/2] wcn36xx: Fix Antenna Diversity Switching
In-Reply-To: <20210909144428.2564650-1-bryan.odonoghue@linaro.org>
References: <20210909144428.2564650-1-bryan.odonoghue@linaro.org>
Message-ID: <20210909144428.2564650-2-bryan.odonoghue@linaro.org>

We have been tracking a strange bug with Antenna Diversity Switching (ADS)
on wcn3680b for a while.

ADS is configured like this:
   A. Via a firmware configuration table baked into the NV area.
       1. Defines if ADS is enabled.
       2. Defines which GPIOs are connected to which antenna enable pin.
       3. Defines which antenna/GPIO is primary and which is secondary.

   B. WCN36XX_CFG_VAL(ANTENNA_DIVERSITY, N)
      N is a bitmask of available antenna.

      Setting N to 3 indicates a bitmask of enabled antenna (1 | 2).

      Obviously then we can set N to 1 or N to 2 to fix to a particular
      antenna and disable antenna diversity.

   C. WCN36XX_CFG_VAL(ASD_PROBE_INTERVAL, XX)
      XX is the number of beacons between each antenna RSSI check.
      Setting this value to 50 means, every 50 received beacons, run the
      ADS algorithm.

   D. WCN36XX_CFG_VAL(ASD_TRIGGER_THRESHOLD, YY)
      YY is a two's complement integer which specifies the RSSI decibel
      threshold below which ADS will run.
      We default to -60db here, meaning a measured RSSI <= -60db will
      trigger an ADS probe.

   E. WCN36XX_CFG_VAL(ASD_RTT_RSSI_HYST_THRESHOLD, Z)
      Z is a hysteresis value, indicating a delta which the RSSI must
      exceed for the antenna switch to be valid.

      For example if HYST_THRESHOLD == 3 AntennaId1-RSSI == -60db and
      AntennaId-2-RSSI == -58db then firmware will not switch antenna.
      The threshold needs to be -57db or better to satisfy the criteria.

   F. A firmware feature bit also exists ANTENNA_DIVERSITY_SELECTION.
      This feature bit is used by the firmware to report if
      ANTENNA_DIVERSITY_SELECTION is supported. The host is not required to
      toggle this bit to enable or disable ADS.

ADS works like this:

    A. Every XX beacons the firmware switches to or remains on the primary
       antenna.

    B. The firmware then sends a Request-To-Send (RTS) packet to the AP.

    C. The firmware waits for a Clear-To-Send (CTS) response from the AP.

    D. The firmware then notes the received RSSI on the CTS packet.

    E. The firmware then repeats steps A-D on the secondary antenna.

    F. Subsequently if the RSSI on the measured antenna is better than
       ASD_TRIGGER_THRESHOLD + the active antenna's RSSI then the
       measured antenna becomes the active antenna.

    G. If RSSI rises past ASD_TRIGGER_THRESHOLD then ADS doesn't run at
       all even if there is a substantially better RSSI on the alternative
       antenna.

What we have been observing is that the RTS packet is being sent but the
MAC address is a byte-swapped version of the target MAC. The ADS/RTS MAC is
corrupted only when the link is encrypted, if the AP is open the RTS MAC is
correct. Similarly if we configure the firmware to an RTS/CTS sequence for
regular data - the transmitted RTS MAC is correctly formatted.

Internally the wcn36xx firmware uses the indexes in the SMD commands to
populate and extract data from specific entries in an STA lookup table. The
AP's MAC appears a number of times in different indexes within this lookup
table, so the MAC address extracted for the data-transmit RTS and the MAC
address extracted for the ADS/RTS packet are not the same STA table index.

Our analysis indicates the relevant firmware STA table index is
"bssSelfStaIdx".

There is an STA populate function responsible for formatting the MAC
address of the bssSelfStaIdx including byte-swapping the MAC address.

Its clear then that the required STA populate command did not run for
bssSelfStaIdx.

So taking a look at the sequence of SMD commands sent to the firmware we
see the following downstream when moving from an unencrypted to encrypted
BSS setup.

- WLAN_HAL_CONFIG_BSS_REQ
- WLAN_HAL_CONFIG_STA_REQ
- WLAN_HAL_SET_STAKEY_REQ

Upstream in wcn36xx we have

- WLAN_HAL_CONFIG_BSS_REQ
- WLAN_HAL_SET_STAKEY_REQ

The solution then is to add the missing WLAN_HAL_CONFIG_STA_REQ between
WLAN_HAL_CONFIG_BSS_REQ and WLAN_HAL_SET_STAKEY_REQ.

No surprise WLAN_HAL_CONFIG_STA_REQ is the routine responsible for
populating the STA lookup table in the firmware and once done the MAC sent
by the ADS routine is in the correct byte-order.

This bug is apparent with ADS but it is also the case that any other
firmware routine that depends on the "bssSelfStaIdx" would retrieve
malformed data on an encrypted link.

Fixes: 3e977c5c523d ("wcn36xx: Define wcn3680 specific firmware parameters")
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
Tested-by: Benjamin Li <benl at squareup.com>
---
 drivers/net/wireless/ath/wcn36xx/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index 9e4fa55d8118..65b4e618d61e 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -580,12 +580,14 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 		if (IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags) {
 			sta_priv->is_data_encrypted = true;
 			/* Reconfigure bss with encrypt_type */
-			if (NL80211_IFTYPE_STATION == vif->type)
+			if (NL80211_IFTYPE_STATION == vif->type) {
 				wcn36xx_smd_config_bss(wcn,
 						       vif,
 						       sta,
 						       sta->addr,
 						       true);
+				wcn36xx_smd_config_sta(wcn, vif, sta);
+			}
 
 			wcn36xx_smd_set_stakey(wcn,
 				vif_priv->encrypt_type,
-- 
2.33.0



From bryan.odonoghue at linaro.org  Thu Sep  9 07:44:28 2021
From: bryan.odonoghue at linaro.org (Bryan O'Donoghue)
Date: Thu,  9 Sep 2021 15:44:28 +0100
Subject: [PATCH v2 2/2] wcn36xx: Add ability for wcn36xx_smd_dump_cmd_req to
 pass two's complement
In-Reply-To: <20210909144428.2564650-1-bryan.odonoghue@linaro.org>
References: <20210909144428.2564650-1-bryan.odonoghue@linaro.org>
Message-ID: <20210909144428.2564650-3-bryan.odonoghue@linaro.org>

Qcom documents suggest passing of negative values to the dump command,
however currently we convert from string to u32 not s32, so we cannot pass
a two's complement value to the firmware in this way.

There is in fact only one parameter which takes a two's complement value
<tigger threshold> in the antenna diversity switch command.

Downstream:
iwpriv wlan0 dump 71 3 <schedule period> <trigger threshold> <hysteresis value>

Upstream:
echo "71 3 <schedule period> <trigger threshold> <hysteresis value>" > /sys/kernel/debug/ieee80211/phy0/wcn36xx/dump

Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware")
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/debug.c b/drivers/net/wireless/ath/wcn36xx/debug.c
index 389b5e7129a6..6af306ae41ad 100644
--- a/drivers/net/wireless/ath/wcn36xx/debug.c
+++ b/drivers/net/wireless/ath/wcn36xx/debug.c
@@ -120,7 +120,7 @@ static ssize_t write_file_dump(struct file *file,
 		if (begin == NULL)
 			break;
 
-		if (kstrtou32(begin, 0, &arg[i]) != 0)
+		if (kstrtos32(begin, 0, &arg[i]) != 0)
 			break;
 	}
 
-- 
2.33.0



From loic.poulain at linaro.org  Thu Sep  9 08:39:16 2021
From: loic.poulain at linaro.org (Loic Poulain)
Date: Thu, 9 Sep 2021 17:39:16 +0200
Subject: [PATCH v2 1/2] wcn36xx: Fix Antenna Diversity Switching
In-Reply-To: <20210909144428.2564650-2-bryan.odonoghue@linaro.org>
References: <20210909144428.2564650-1-bryan.odonoghue@linaro.org>
 <20210909144428.2564650-2-bryan.odonoghue@linaro.org>
Message-ID: <CAMZdPi9EQNp5GqOKnfZr-05Fp7CuuzM2u4vvx_2AS_0M_Fm6qw@mail.gmail.com>

On Thu, 9 Sept 2021 at 16:42, Bryan O'Donoghue
<bryan.odonoghue at linaro.org> wrote:
>
> We have been tracking a strange bug with Antenna Diversity Switching (ADS)
> on wcn3680b for a while.
>
> ADS is configured like this:
>    A. Via a firmware configuration table baked into the NV area.
>        1. Defines if ADS is enabled.
>        2. Defines which GPIOs are connected to which antenna enable pin.
>        3. Defines which antenna/GPIO is primary and which is secondary.
>
>    B. WCN36XX_CFG_VAL(ANTENNA_DIVERSITY, N)
>       N is a bitmask of available antenna.
>
>       Setting N to 3 indicates a bitmask of enabled antenna (1 | 2).
>
>       Obviously then we can set N to 1 or N to 2 to fix to a particular
>       antenna and disable antenna diversity.
>
>    C. WCN36XX_CFG_VAL(ASD_PROBE_INTERVAL, XX)
>       XX is the number of beacons between each antenna RSSI check.
>       Setting this value to 50 means, every 50 received beacons, run the
>       ADS algorithm.
>
>    D. WCN36XX_CFG_VAL(ASD_TRIGGER_THRESHOLD, YY)
>       YY is a two's complement integer which specifies the RSSI decibel
>       threshold below which ADS will run.
>       We default to -60db here, meaning a measured RSSI <= -60db will
>       trigger an ADS probe.
>
>    E. WCN36XX_CFG_VAL(ASD_RTT_RSSI_HYST_THRESHOLD, Z)
>       Z is a hysteresis value, indicating a delta which the RSSI must
>       exceed for the antenna switch to be valid.
>
>       For example if HYST_THRESHOLD == 3 AntennaId1-RSSI == -60db and
>       AntennaId-2-RSSI == -58db then firmware will not switch antenna.
>       The threshold needs to be -57db or better to satisfy the criteria.
>
>    F. A firmware feature bit also exists ANTENNA_DIVERSITY_SELECTION.
>       This feature bit is used by the firmware to report if
>       ANTENNA_DIVERSITY_SELECTION is supported. The host is not required to
>       toggle this bit to enable or disable ADS.
>
> ADS works like this:
>
>     A. Every XX beacons the firmware switches to or remains on the primary
>        antenna.
>
>     B. The firmware then sends a Request-To-Send (RTS) packet to the AP.
>
>     C. The firmware waits for a Clear-To-Send (CTS) response from the AP.
>
>     D. The firmware then notes the received RSSI on the CTS packet.
>
>     E. The firmware then repeats steps A-D on the secondary antenna.
>
>     F. Subsequently if the RSSI on the measured antenna is better than
>        ASD_TRIGGER_THRESHOLD + the active antenna's RSSI then the
>        measured antenna becomes the active antenna.
>
>     G. If RSSI rises past ASD_TRIGGER_THRESHOLD then ADS doesn't run at
>        all even if there is a substantially better RSSI on the alternative
>        antenna.
>
> What we have been observing is that the RTS packet is being sent but the
> MAC address is a byte-swapped version of the target MAC. The ADS/RTS MAC is
> corrupted only when the link is encrypted, if the AP is open the RTS MAC is
> correct. Similarly if we configure the firmware to an RTS/CTS sequence for
> regular data - the transmitted RTS MAC is correctly formatted.
>
> Internally the wcn36xx firmware uses the indexes in the SMD commands to
> populate and extract data from specific entries in an STA lookup table. The
> AP's MAC appears a number of times in different indexes within this lookup
> table, so the MAC address extracted for the data-transmit RTS and the MAC
> address extracted for the ADS/RTS packet are not the same STA table index.
>
> Our analysis indicates the relevant firmware STA table index is
> "bssSelfStaIdx".
>
> There is an STA populate function responsible for formatting the MAC
> address of the bssSelfStaIdx including byte-swapping the MAC address.
>
> Its clear then that the required STA populate command did not run for
> bssSelfStaIdx.
>
> So taking a look at the sequence of SMD commands sent to the firmware we
> see the following downstream when moving from an unencrypted to encrypted
> BSS setup.
>
> - WLAN_HAL_CONFIG_BSS_REQ
> - WLAN_HAL_CONFIG_STA_REQ
> - WLAN_HAL_SET_STAKEY_REQ
>
> Upstream in wcn36xx we have
>
> - WLAN_HAL_CONFIG_BSS_REQ
> - WLAN_HAL_SET_STAKEY_REQ
>
> The solution then is to add the missing WLAN_HAL_CONFIG_STA_REQ between
> WLAN_HAL_CONFIG_BSS_REQ and WLAN_HAL_SET_STAKEY_REQ.
>
> No surprise WLAN_HAL_CONFIG_STA_REQ is the routine responsible for
> populating the STA lookup table in the firmware and once done the MAC sent
> by the ADS routine is in the correct byte-order.
>
> This bug is apparent with ADS but it is also the case that any other
> firmware routine that depends on the "bssSelfStaIdx" would retrieve
> malformed data on an encrypted link.
>
> Fixes: 3e977c5c523d ("wcn36xx: Define wcn3680 specific firmware parameters")
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
> Tested-by: Benjamin Li <benl at squareup.com>

Reviewed-by: Loic Poulain <loic.poulain at linaro.org>


From loic.poulain at linaro.org  Thu Sep  9 08:39:54 2021
From: loic.poulain at linaro.org (Loic Poulain)
Date: Thu, 9 Sep 2021 17:39:54 +0200
Subject: [PATCH v2 2/2] wcn36xx: Add ability for wcn36xx_smd_dump_cmd_req
 to pass two's complement
In-Reply-To: <20210909144428.2564650-3-bryan.odonoghue@linaro.org>
References: <20210909144428.2564650-1-bryan.odonoghue@linaro.org>
 <20210909144428.2564650-3-bryan.odonoghue@linaro.org>
Message-ID: <CAMZdPi9+yH05edfPKHHJd=34X3YF1es2hZH+2=H+=tTWD9xfLQ@mail.gmail.com>

On Thu, 9 Sept 2021 at 16:42, Bryan O'Donoghue
<bryan.odonoghue at linaro.org> wrote:
>
> Qcom documents suggest passing of negative values to the dump command,
> however currently we convert from string to u32 not s32, so we cannot pass
> a two's complement value to the firmware in this way.
>
> There is in fact only one parameter which takes a two's complement value
> <tigger threshold> in the antenna diversity switch command.
>
> Downstream:
> iwpriv wlan0 dump 71 3 <schedule period> <trigger threshold> <hysteresis value>
>
> Upstream:
> echo "71 3 <schedule period> <trigger threshold> <hysteresis value>" > /sys/kernel/debug/ieee80211/phy0/wcn36xx/dump
>
> Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware")
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>

Reviewed-by: Loic Poulain <loic.poulain at linaro.org>


From bryan.odonoghue at linaro.org  Thu Sep  9 08:33:20 2021
From: bryan.odonoghue at linaro.org (Bryan O'Donoghue)
Date: Thu,  9 Sep 2021 16:33:20 +0100
Subject: [PATCH] wcn36xx: Implement Idle Mode Power Save
Message-ID: <20210909153320.2624649-1-bryan.odonoghue@linaro.org>

Idle Mode Power Save (IMPS) is a power saving mechanism which when called
by wcn36xx will cause the radio hardware to enter power collapse.

This particular call maps nicely to a simple conjunction/disjunction around
IEEE80211_CONF_CHANGE_IDLE and IEEE80211_CONF_IDLE.

Here we enter idle when we are not associated with an AP. The kernel will
incrementally toggle idle on/off in the process of trying to establish a
connection, thus saving power until we are connected to the AP again, at
which point we give way to BMPS if power_save is on.

We've validated that with IMPS an apq8039 device which has the wcn36xx
module loaded but, has not authenticated with an AP will get to VMIN on
suspend and will not without IMPS.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
Tested-by: Benjamin Li <benl at squareup.com>
---
 drivers/net/wireless/ath/wcn36xx/hal.h  |  6 +--
 drivers/net/wireless/ath/wcn36xx/main.c |  7 ++++
 drivers/net/wireless/ath/wcn36xx/smd.c  | 55 +++++++++++++++++++++++++
 drivers/net/wireless/ath/wcn36xx/smd.h  |  3 ++
 4 files changed, 68 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h
index 455143c4164e..5f1f2480459a 100644
--- a/drivers/net/wireless/ath/wcn36xx/hal.h
+++ b/drivers/net/wireless/ath/wcn36xx/hal.h
@@ -3384,11 +3384,11 @@ struct tl_hal_flush_ac_rsp_msg {
 
 struct wcn36xx_hal_enter_imps_req_msg {
 	struct wcn36xx_hal_msg_header header;
-};
+} __packed;
 
-struct wcn36xx_hal_exit_imps_req {
+struct wcn36xx_hal_exit_imps_req_msg {
 	struct wcn36xx_hal_msg_header header;
-};
+} __packed;
 
 struct wcn36xx_hal_enter_bmps_req_msg {
 	struct wcn36xx_hal_msg_header header;
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index 2561ae9cde65..412c629705a6 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -443,6 +443,13 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
 	if (changed & IEEE80211_CONF_CHANGE_PS)
 		wcn36xx_change_ps(wcn, hw->conf.flags & IEEE80211_CONF_PS);
 
+	if (changed & IEEE80211_CONF_CHANGE_IDLE) {
+		if (hw->conf.flags & IEEE80211_CONF_IDLE)
+			wcn36xx_smd_enter_imps(wcn);
+		else
+			wcn36xx_smd_exit_imps(wcn);
+	}
+
 	mutex_unlock(&wcn->conf_mutex);
 
 	return 0;
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
index 57fa857b290b..599cb220b150 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -2184,6 +2184,59 @@ int wcn36xx_smd_exit_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif)
 	return ret;
 }
 
+int wcn36xx_smd_enter_imps(struct wcn36xx *wcn)
+{
+	struct wcn36xx_hal_enter_imps_req_msg msg_body;
+	int ret;
+
+	mutex_lock(&wcn->hal_mutex);
+	INIT_HAL_MSG(msg_body, WCN36XX_HAL_ENTER_IMPS_REQ);
+
+	PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+	ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+	if (ret) {
+		wcn36xx_err("Sending hal_enter_imps failed\n");
+		goto out;
+	}
+	ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+	if (ret) {
+		wcn36xx_err("hal_enter_imps response failed err=%d\n", ret);
+		goto out;
+	}
+
+	wcn36xx_dbg(WCN36XX_DBG_HAL, "Entered idle mode\n");
+out:
+	mutex_unlock(&wcn->hal_mutex);
+	return ret;
+}
+
+int wcn36xx_smd_exit_imps(struct wcn36xx *wcn)
+{
+	struct wcn36xx_hal_exit_imps_req_msg msg_body;
+	int ret;
+
+	mutex_lock(&wcn->hal_mutex);
+	INIT_HAL_MSG(msg_body, WCN36XX_HAL_EXIT_IMPS_REQ);
+
+	PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+	ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+	if (ret) {
+		wcn36xx_err("Sending hal_exit_imps failed\n");
+		goto out;
+	}
+	ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+	if (ret) {
+		wcn36xx_err("hal_exit_imps response failed err=%d\n", ret);
+		goto out;
+	}
+	wcn36xx_dbg(WCN36XX_DBG_HAL, "Exited idle mode\n");
+out:
+	mutex_unlock(&wcn->hal_mutex);
+	return ret;
+}
+
 int wcn36xx_smd_set_power_params(struct wcn36xx *wcn, bool ignore_dtim)
 {
 	struct wcn36xx_hal_set_power_params_req_msg msg_body;
@@ -3060,6 +3113,8 @@ int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev,
 	case WCN36XX_HAL_GTK_OFFLOAD_RSP:
 	case WCN36XX_HAL_GTK_OFFLOAD_GETINFO_RSP:
 	case WCN36XX_HAL_HOST_RESUME_RSP:
+	case WCN36XX_HAL_ENTER_IMPS_RSP:
+	case WCN36XX_HAL_EXIT_IMPS_RSP:
 		memcpy(wcn->hal_buf, buf, len);
 		wcn->hal_rsp_len = len;
 		complete(&wcn->hal_rsp_compl);
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h
index 75d1a6d663bb..dbca0bd1b6ae 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.h
+++ b/drivers/net/wireless/ath/wcn36xx/smd.h
@@ -165,4 +165,7 @@ int wcn36xx_smd_wlan_host_suspend_ind(struct wcn36xx *wcn);
 
 int wcn36xx_smd_host_resume(struct wcn36xx *wcn);
 
+int wcn36xx_smd_enter_imps(struct wcn36xx *wcn);
+int wcn36xx_smd_exit_imps(struct wcn36xx *wcn);
+
 #endif	/* _SMD_H_ */
-- 
2.33.0



From 9sporst9 at gmail.com  Thu Sep  9 22:32:36 2021
From: 9sporst9 at gmail.com (Ms. Kim)
Date: Fri, 10 Sep 2021 12:32:36 +0700
Subject: my future investment ventures in your country
Message-ID: <mailman.7.1631252055.1069.wcn36xx@lists.infradead.org>

my future investment ventures in your country
My name is Ms. Kim , A Thai citizen in Asian Continent but currently
residing in abroad, I trust this email meets you in good health, I just got
your contact today during a research about your country and I will say that
I foresee success of my future investment ventures in your country. I want
to invest in your country and I would like you to assist me in my investment
with moral and physical advises. Please do reply me as soon as possible so
we can discuss more.

I look forward to hear from you soon
9sporst9 at gmail.com


From kvalo at codeaurora.org  Tue Sep 21 06:31:55 2021
From: kvalo at codeaurora.org (Kalle Valo)
Date: Tue, 21 Sep 2021 13:31:55 +0000 (UTC)
Subject: [PATCH v2] wcn36xx: handle connection loss indication
In-Reply-To: <20210901180606.11686-1-benl@squareup.com>
References: <20210901180606.11686-1-benl@squareup.com>
Message-ID: <20210921133155.87AECC4338F@smtp.codeaurora.org>

Benjamin Li <benl at squareup.com> wrote:

> Firmware sends delete_sta_context_ind when it detects the AP has gone
> away in STA mode. Right now the handler for that indication only handles
> AP mode; fix it to also handle STA mode.
> 
> Cc: stable at vger.kernel.org
> Signed-off-by: Benjamin Li <benl at squareup.com>
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
> Reviewed-by: Loic Poulain <loic.poulain at linaro.org>
> Signed-off-by: Kalle Valo <kvalo at codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

d6dbce453b19 wcn36xx: handle connection loss indication

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20210901180606.11686-1-benl at squareup.com/

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



From kvalo at codeaurora.org  Tue Sep 21 06:33:53 2021
From: kvalo at codeaurora.org (Kalle Valo)
Date: Tue, 21 Sep 2021 13:33:53 +0000 (UTC)
Subject: [PATCH v2 1/2] wcn36xx: Fix Antenna Diversity Switching
In-Reply-To: <20210909144428.2564650-2-bryan.odonoghue@linaro.org>
References: <20210909144428.2564650-2-bryan.odonoghue@linaro.org>
Message-ID: <20210921133353.77636C43460@smtp.codeaurora.org>

Bryan O'Donoghue <bryan.odonoghue at linaro.org> wrote:

> We have been tracking a strange bug with Antenna Diversity Switching (ADS)
> on wcn3680b for a while.
> 
> ADS is configured like this:
>    A. Via a firmware configuration table baked into the NV area.
>        1. Defines if ADS is enabled.
>        2. Defines which GPIOs are connected to which antenna enable pin.
>        3. Defines which antenna/GPIO is primary and which is secondary.
> 
>    B. WCN36XX_CFG_VAL(ANTENNA_DIVERSITY, N)
>       N is a bitmask of available antenna.
> 
>       Setting N to 3 indicates a bitmask of enabled antenna (1 | 2).
> 
>       Obviously then we can set N to 1 or N to 2 to fix to a particular
>       antenna and disable antenna diversity.
> 
>    C. WCN36XX_CFG_VAL(ASD_PROBE_INTERVAL, XX)
>       XX is the number of beacons between each antenna RSSI check.
>       Setting this value to 50 means, every 50 received beacons, run the
>       ADS algorithm.
> 
>    D. WCN36XX_CFG_VAL(ASD_TRIGGER_THRESHOLD, YY)
>       YY is a two's complement integer which specifies the RSSI decibel
>       threshold below which ADS will run.
>       We default to -60db here, meaning a measured RSSI <= -60db will
>       trigger an ADS probe.
> 
>    E. WCN36XX_CFG_VAL(ASD_RTT_RSSI_HYST_THRESHOLD, Z)
>       Z is a hysteresis value, indicating a delta which the RSSI must
>       exceed for the antenna switch to be valid.
> 
>       For example if HYST_THRESHOLD == 3 AntennaId1-RSSI == -60db and
>       AntennaId-2-RSSI == -58db then firmware will not switch antenna.
>       The threshold needs to be -57db or better to satisfy the criteria.
> 
>    F. A firmware feature bit also exists ANTENNA_DIVERSITY_SELECTION.
>       This feature bit is used by the firmware to report if
>       ANTENNA_DIVERSITY_SELECTION is supported. The host is not required to
>       toggle this bit to enable or disable ADS.
> 
> ADS works like this:
> 
>     A. Every XX beacons the firmware switches to or remains on the primary
>        antenna.
> 
>     B. The firmware then sends a Request-To-Send (RTS) packet to the AP.
> 
>     C. The firmware waits for a Clear-To-Send (CTS) response from the AP.
> 
>     D. The firmware then notes the received RSSI on the CTS packet.
> 
>     E. The firmware then repeats steps A-D on the secondary antenna.
> 
>     F. Subsequently if the RSSI on the measured antenna is better than
>        ASD_TRIGGER_THRESHOLD + the active antenna's RSSI then the
>        measured antenna becomes the active antenna.
> 
>     G. If RSSI rises past ASD_TRIGGER_THRESHOLD then ADS doesn't run at
>        all even if there is a substantially better RSSI on the alternative
>        antenna.
> 
> What we have been observing is that the RTS packet is being sent but the
> MAC address is a byte-swapped version of the target MAC. The ADS/RTS MAC is
> corrupted only when the link is encrypted, if the AP is open the RTS MAC is
> correct. Similarly if we configure the firmware to an RTS/CTS sequence for
> regular data - the transmitted RTS MAC is correctly formatted.
> 
> Internally the wcn36xx firmware uses the indexes in the SMD commands to
> populate and extract data from specific entries in an STA lookup table. The
> AP's MAC appears a number of times in different indexes within this lookup
> table, so the MAC address extracted for the data-transmit RTS and the MAC
> address extracted for the ADS/RTS packet are not the same STA table index.
> 
> Our analysis indicates the relevant firmware STA table index is
> "bssSelfStaIdx".
> 
> There is an STA populate function responsible for formatting the MAC
> address of the bssSelfStaIdx including byte-swapping the MAC address.
> 
> Its clear then that the required STA populate command did not run for
> bssSelfStaIdx.
> 
> So taking a look at the sequence of SMD commands sent to the firmware we
> see the following downstream when moving from an unencrypted to encrypted
> BSS setup.
> 
> - WLAN_HAL_CONFIG_BSS_REQ
> - WLAN_HAL_CONFIG_STA_REQ
> - WLAN_HAL_SET_STAKEY_REQ
> 
> Upstream in wcn36xx we have
> 
> - WLAN_HAL_CONFIG_BSS_REQ
> - WLAN_HAL_SET_STAKEY_REQ
> 
> The solution then is to add the missing WLAN_HAL_CONFIG_STA_REQ between
> WLAN_HAL_CONFIG_BSS_REQ and WLAN_HAL_SET_STAKEY_REQ.
> 
> No surprise WLAN_HAL_CONFIG_STA_REQ is the routine responsible for
> populating the STA lookup table in the firmware and once done the MAC sent
> by the ADS routine is in the correct byte-order.
> 
> This bug is apparent with ADS but it is also the case that any other
> firmware routine that depends on the "bssSelfStaIdx" would retrieve
> malformed data on an encrypted link.
> 
> Fixes: 3e977c5c523d ("wcn36xx: Define wcn3680 specific firmware parameters")
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
> Tested-by: Benjamin Li <benl at squareup.com>
> Reviewed-by: Loic Poulain <loic.poulain at linaro.org>
> Signed-off-by: Kalle Valo <kvalo at codeaurora.org>

2 patches applied to ath-next branch of ath.git, thanks.

701668d3bfa0 wcn36xx: Fix Antenna Diversity Switching
c0c2eb20c79e wcn36xx: Add ability for wcn36xx_smd_dump_cmd_req to pass two's complement

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20210909144428.2564650-2-bryan.odonoghue at linaro.org/

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



From kvalo at codeaurora.org  Tue Sep 21 06:34:44 2021
From: kvalo at codeaurora.org (Kalle Valo)
Date: Tue, 21 Sep 2021 13:34:44 +0000 (UTC)
Subject: [PATCH] wcn36xx: Implement Idle Mode Power Save
In-Reply-To: <20210909153320.2624649-1-bryan.odonoghue@linaro.org>
References: <20210909153320.2624649-1-bryan.odonoghue@linaro.org>
Message-ID: <20210921133444.6B234C4360C@smtp.codeaurora.org>

Bryan O'Donoghue <bryan.odonoghue at linaro.org> wrote:

> Idle Mode Power Save (IMPS) is a power saving mechanism which when called
> by wcn36xx will cause the radio hardware to enter power collapse.
> 
> This particular call maps nicely to a simple conjunction/disjunction around
> IEEE80211_CONF_CHANGE_IDLE and IEEE80211_CONF_IDLE.
> 
> Here we enter idle when we are not associated with an AP. The kernel will
> incrementally toggle idle on/off in the process of trying to establish a
> connection, thus saving power until we are connected to the AP again, at
> which point we give way to BMPS if power_save is on.
> 
> We've validated that with IMPS an apq8039 device which has the wcn36xx
> module loaded but, has not authenticated with an AP will get to VMIN on
> suspend and will not without IMPS.
> 
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
> Tested-by: Benjamin Li <benl at squareup.com>
> Signed-off-by: Kalle Valo <kvalo at codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

0e159d2c0834 wcn36xx: Implement Idle Mode Power Save

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20210909153320.2624649-1-bryan.odonoghue at linaro.org/

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



From flannery0123.ep07 at nctu.edu.tw  Mon Sep 27 12:34:28 2021
From: flannery0123.ep07 at nctu.edu.tw (Mr. James Khumalo)
Date: Mon, 27 Sep 2021 21:34:28 +0200
Subject: IMPORTANT,
Message-ID: <20210927195322.3602E4AE89@d2-forwarder.nctu.edu.tw>

Good Day,
 
I know this email might come to you as a surprise as first coming from one you haven?t met with before.
I am Mr. James Khumalo, the bank manager with ABSA bank of South Africa,  and a personal banker of Dr.Mohamed Farouk Ibrahim, an Egyptian who happened to be a medical contractor attached to the overthrown Afghan government by the Taliban government.   
Dr.Mohamed Farouk Ibrahim deposits some sum of money with our bank but passed away with his family while trying to escape from Kandahar.
The said sum can be used for an investment if you are interested.  Details relating to the funds are in my position and will present you as the Next-of-Kin because there was none, and I shall furnish you with more detail once your response.

Regards,
Mr. James Khumalo
Tel: 27-632696383
South Africa


