All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath11k: fix target assert during channel switch
@ 2021-11-11 15:20 ` Venkateswara Naralasetty
  0 siblings, 0 replies; 5+ messages in thread
From: Venkateswara Naralasetty @ 2021-11-11 15:20 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Venkateswara Naralasetty

Currently the updated bandwidth for the peer will be configured
to the firmware after channel switch from the sta_rc_update_wk.
If the updated bandwidth is greater than the configured peer phymode
during the peer assoc may result target assert.

For example, initially AP is in HE40 mode and the peer phymode is
configured as MODE_11AX_HE40 during peer assoc. Now user change the
channel width to HE80 then, the peer bandwidth will be updated as
HE80 to the firmware.

This will trigger target assert due to peer bandwidth is greater than
the peer phymode.

Fix this issue by sending peer assoc command before setting the updated
peer bw to fw.

Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1

Signed-off-by: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>
---
Depends-on: "ath11k: Clear auth flag only for actual association in security mode"

 drivers/net/wireless/ath/ath11k/mac.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index eba8cee..2e2a8ad 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -3826,11 +3826,27 @@ static void ath11k_sta_rc_update_wk(struct work_struct *wk)
 			   ath11k_mac_max_he_nss(he_mcs_mask)));
 
 	if (changed & IEEE80211_RC_BW_CHANGED) {
-		err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id,
-						WMI_PEER_CHWIDTH, bw);
-		if (err)
-			ath11k_warn(ar->ab, "failed to update STA %pM peer bw %d: %d\n",
-				    sta->addr, bw, err);
+		/* Send peer assoc command before set peer bandwidth param to
+		 * avoid the mismatch between the peer phymode and the peer
+		 * bandwidth.
+		 */
+		ath11k_peer_assoc_prepare(ar, arvif->vif, sta, &peer_arg, true);
+
+		peer_arg.is_assoc = false;
+		err = ath11k_wmi_send_peer_assoc_cmd(ar, &peer_arg);
+		if (err) {
+			ath11k_warn(ar->ab, "failed to send peer assoc for STA %pM vdev %i: %d\n",
+				    sta->addr, arvif->vdev_id, err);
+		} else if (wait_for_completion_timeout(&ar->peer_assoc_done, 1 * HZ)) {
+			err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id,
+							WMI_PEER_CHWIDTH, bw);
+			if (err)
+				ath11k_warn(ar->ab, "failed to update STA %pM peer bw %d: %d\n",
+					    sta->addr, bw, err);
+		} else {
+			ath11k_warn(ar->ab, "failed to get peer assoc conf event for %pM vdev %i\n",
+				    sta->addr, arvif->vdev_id);
+		}
 	}
 
 	if (changed & IEEE80211_RC_NSS_CHANGED) {
-- 
2.7.4


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

* [PATCH] ath11k: fix target assert during channel switch
@ 2021-11-11 15:20 ` Venkateswara Naralasetty
  0 siblings, 0 replies; 5+ messages in thread
From: Venkateswara Naralasetty @ 2021-11-11 15:20 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Venkateswara Naralasetty

Currently the updated bandwidth for the peer will be configured
to the firmware after channel switch from the sta_rc_update_wk.
If the updated bandwidth is greater than the configured peer phymode
during the peer assoc may result target assert.

For example, initially AP is in HE40 mode and the peer phymode is
configured as MODE_11AX_HE40 during peer assoc. Now user change the
channel width to HE80 then, the peer bandwidth will be updated as
HE80 to the firmware.

This will trigger target assert due to peer bandwidth is greater than
the peer phymode.

Fix this issue by sending peer assoc command before setting the updated
peer bw to fw.

Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1

Signed-off-by: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>
---
Depends-on: "ath11k: Clear auth flag only for actual association in security mode"

 drivers/net/wireless/ath/ath11k/mac.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index eba8cee..2e2a8ad 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -3826,11 +3826,27 @@ static void ath11k_sta_rc_update_wk(struct work_struct *wk)
 			   ath11k_mac_max_he_nss(he_mcs_mask)));
 
 	if (changed & IEEE80211_RC_BW_CHANGED) {
-		err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id,
-						WMI_PEER_CHWIDTH, bw);
-		if (err)
-			ath11k_warn(ar->ab, "failed to update STA %pM peer bw %d: %d\n",
-				    sta->addr, bw, err);
+		/* Send peer assoc command before set peer bandwidth param to
+		 * avoid the mismatch between the peer phymode and the peer
+		 * bandwidth.
+		 */
+		ath11k_peer_assoc_prepare(ar, arvif->vif, sta, &peer_arg, true);
+
+		peer_arg.is_assoc = false;
+		err = ath11k_wmi_send_peer_assoc_cmd(ar, &peer_arg);
+		if (err) {
+			ath11k_warn(ar->ab, "failed to send peer assoc for STA %pM vdev %i: %d\n",
+				    sta->addr, arvif->vdev_id, err);
+		} else if (wait_for_completion_timeout(&ar->peer_assoc_done, 1 * HZ)) {
+			err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id,
+							WMI_PEER_CHWIDTH, bw);
+			if (err)
+				ath11k_warn(ar->ab, "failed to update STA %pM peer bw %d: %d\n",
+					    sta->addr, bw, err);
+		} else {
+			ath11k_warn(ar->ab, "failed to get peer assoc conf event for %pM vdev %i\n",
+				    sta->addr, arvif->vdev_id);
+		}
 	}
 
 	if (changed & IEEE80211_RC_NSS_CHANGED) {
-- 
2.7.4


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

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

* Re: [PATCH] ath11k: fix target assert during channel switch
  2021-11-11 15:20 ` Venkateswara Naralasetty
  (?)
@ 2021-11-13  6:35 ` kernel test robot
  -1 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-11-13  6:35 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 8156 bytes --]

Hi Venkateswara,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on kvalo-ath/ath-next]
[also build test ERROR on v5.15 next-20211112]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Venkateswara-Naralasetty/ath11k-fix-target-assert-during-channel-switch/20211111-232038
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git ath-next
config: nios2-allyesconfig (attached as .config)
compiler: nios2-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/455bd954ca608d86a679d82b2de7927ebca05888
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Venkateswara-Naralasetty/ath11k-fix-target-assert-during-channel-switch/20211111-232038
        git checkout 455bd954ca608d86a679d82b2de7927ebca05888
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nios2 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/net/wireless/ath/ath11k/mac.c: In function 'ath11k_sta_rc_update_wk':
>> drivers/net/wireless/ath/ath11k/mac.c:3920:25: error: 'struct peer_assoc_params' has no member named 'is_assoc'
    3920 |                 peer_arg.is_assoc = false;
         |                         ^


vim +3920 drivers/net/wireless/ath/ath11k/mac.c

  3865	
  3866	static void ath11k_sta_rc_update_wk(struct work_struct *wk)
  3867	{
  3868		struct ath11k *ar;
  3869		struct ath11k_vif *arvif;
  3870		struct ath11k_sta *arsta;
  3871		struct ieee80211_sta *sta;
  3872		struct cfg80211_chan_def def;
  3873		enum nl80211_band band;
  3874		const u8 *ht_mcs_mask;
  3875		const u16 *vht_mcs_mask;
  3876		const u16 *he_mcs_mask;
  3877		u32 changed, bw, nss, smps;
  3878		int err, num_vht_rates, num_he_rates;
  3879		const struct cfg80211_bitrate_mask *mask;
  3880		struct peer_assoc_params peer_arg;
  3881	
  3882		arsta = container_of(wk, struct ath11k_sta, update_wk);
  3883		sta = container_of((void *)arsta, struct ieee80211_sta, drv_priv);
  3884		arvif = arsta->arvif;
  3885		ar = arvif->ar;
  3886	
  3887		if (WARN_ON(ath11k_mac_vif_chan(arvif->vif, &def)))
  3888			return;
  3889	
  3890		band = def.chan->band;
  3891		ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs;
  3892		vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs;
  3893		he_mcs_mask = arvif->bitrate_mask.control[band].he_mcs;
  3894	
  3895		spin_lock_bh(&ar->data_lock);
  3896	
  3897		changed = arsta->changed;
  3898		arsta->changed = 0;
  3899	
  3900		bw = arsta->bw;
  3901		nss = arsta->nss;
  3902		smps = arsta->smps;
  3903	
  3904		spin_unlock_bh(&ar->data_lock);
  3905	
  3906		mutex_lock(&ar->conf_mutex);
  3907	
  3908		nss = max_t(u32, 1, nss);
  3909		nss = min(nss, max(max(ath11k_mac_max_ht_nss(ht_mcs_mask),
  3910				       ath11k_mac_max_vht_nss(vht_mcs_mask)),
  3911				   ath11k_mac_max_he_nss(he_mcs_mask)));
  3912	
  3913		if (changed & IEEE80211_RC_BW_CHANGED) {
  3914			/* Send peer assoc command before set peer bandwidth param to
  3915			 * avoid the mismatch between the peer phymode and the peer
  3916			 * bandwidth.
  3917			 */
  3918			ath11k_peer_assoc_prepare(ar, arvif->vif, sta, &peer_arg, true);
  3919	
> 3920			peer_arg.is_assoc = false;
  3921			err = ath11k_wmi_send_peer_assoc_cmd(ar, &peer_arg);
  3922			if (err) {
  3923				ath11k_warn(ar->ab, "failed to send peer assoc for STA %pM vdev %i: %d\n",
  3924					    sta->addr, arvif->vdev_id, err);
  3925			} else if (wait_for_completion_timeout(&ar->peer_assoc_done, 1 * HZ)) {
  3926				err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id,
  3927								WMI_PEER_CHWIDTH, bw);
  3928				if (err)
  3929					ath11k_warn(ar->ab, "failed to update STA %pM peer bw %d: %d\n",
  3930						    sta->addr, bw, err);
  3931			} else {
  3932				ath11k_warn(ar->ab, "failed to get peer assoc conf event for %pM vdev %i\n",
  3933					    sta->addr, arvif->vdev_id);
  3934			}
  3935		}
  3936	
  3937		if (changed & IEEE80211_RC_NSS_CHANGED) {
  3938			ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac update sta %pM nss %d\n",
  3939				   sta->addr, nss);
  3940	
  3941			err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id,
  3942							WMI_PEER_NSS, nss);
  3943			if (err)
  3944				ath11k_warn(ar->ab, "failed to update STA %pM nss %d: %d\n",
  3945					    sta->addr, nss, err);
  3946		}
  3947	
  3948		if (changed & IEEE80211_RC_SMPS_CHANGED) {
  3949			ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac update sta %pM smps %d\n",
  3950				   sta->addr, smps);
  3951	
  3952			err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id,
  3953							WMI_PEER_MIMO_PS_STATE, smps);
  3954			if (err)
  3955				ath11k_warn(ar->ab, "failed to update STA %pM smps %d: %d\n",
  3956					    sta->addr, smps, err);
  3957		}
  3958	
  3959		if (changed & IEEE80211_RC_SUPP_RATES_CHANGED) {
  3960			mask = &arvif->bitrate_mask;
  3961			num_vht_rates = ath11k_mac_bitrate_mask_num_vht_rates(ar, band,
  3962									      mask);
  3963			num_he_rates = ath11k_mac_bitrate_mask_num_he_rates(ar, band,
  3964									    mask);
  3965	
  3966			/* Peer_assoc_prepare will reject vht rates in
  3967			 * bitrate_mask if its not available in range format and
  3968			 * sets vht tx_rateset as unsupported. So multiple VHT MCS
  3969			 * setting(eg. MCS 4,5,6) per peer is not supported here.
  3970			 * But, Single rate in VHT mask can be set as per-peer
  3971			 * fixed rate. But even if any HT rates are configured in
  3972			 * the bitrate mask, device will not switch to those rates
  3973			 * when per-peer Fixed rate is set.
  3974			 * TODO: Check RATEMASK_CMDID to support auto rates selection
  3975			 * across HT/VHT and for multiple VHT MCS support.
  3976			 */
  3977			if (sta->vht_cap.vht_supported && num_vht_rates == 1) {
  3978				ath11k_mac_set_peer_vht_fixed_rate(arvif, sta, mask,
  3979								   band);
  3980			} else if (sta->he_cap.has_he && num_he_rates == 1) {
  3981				ath11k_mac_set_peer_he_fixed_rate(arvif, sta, mask,
  3982								  band);
  3983			} else {
  3984				/* If the peer is non-VHT/HE or no fixed VHT/HE rate
  3985				 * is provided in the new bitrate mask we set the
  3986				 * other rates using peer_assoc command. Also clear
  3987				 * the peer fixed rate settings as it has higher proprity
  3988				 * than peer assoc
  3989				 */
  3990				err = ath11k_wmi_set_peer_param(ar, sta->addr,
  3991								arvif->vdev_id,
  3992								WMI_PEER_PARAM_FIXED_RATE,
  3993								WMI_FIXED_RATE_NONE);
  3994				if (err)
  3995					ath11k_warn(ar->ab,
  3996						    "failed to disable peer fixed rate for sta %pM: %d\n",
  3997						    sta->addr, err);
  3998	
  3999				ath11k_peer_assoc_prepare(ar, arvif->vif, sta,
  4000							  &peer_arg, true);
  4001	
  4002				err = ath11k_wmi_send_peer_assoc_cmd(ar, &peer_arg);
  4003				if (err)
  4004					ath11k_warn(ar->ab, "failed to run peer assoc for STA %pM vdev %i: %d\n",
  4005						    sta->addr, arvif->vdev_id, err);
  4006	
  4007				if (!wait_for_completion_timeout(&ar->peer_assoc_done, 1 * HZ))
  4008					ath11k_warn(ar->ab, "failed to get peer assoc conf event for %pM vdev %i\n",
  4009						    sta->addr, arvif->vdev_id);
  4010			}
  4011		}
  4012	
  4013		mutex_unlock(&ar->conf_mutex);
  4014	}
  4015	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 60749 bytes --]

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

* Re: [PATCH] ath11k: fix target assert during channel switch
  2021-11-11 15:20 ` Venkateswara Naralasetty
@ 2021-11-15  9:21   ` Kalle Valo
  -1 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2021-11-15  9:21 UTC (permalink / raw)
  To: Venkateswara Naralasetty; +Cc: ath11k, linux-wireless, Venkateswara Naralasetty

Venkateswara Naralasetty <quic_vnaralas@quicinc.com> wrote:

> Currently the updated bandwidth for the peer will be configured
> to the firmware after channel switch from the sta_rc_update_wk.
> If the updated bandwidth is greater than the configured peer phymode
> during the peer assoc may result firmware assert.
> 
> For example, initially AP is in HE40 mode and the peer phymode is
> configured as MODE_11AX_HE40 during peer assoc. Now user change the
> channel width to HE80 then, the peer bandwidth will be updated as
> HE80 to the firmware.
> 
> This will trigger firmware assert due to peer bandwidth is greater than
> the peer phymode.
> 
> Fix this issue by sending peer assoc command before setting the updated
> peer bandwith to firmware.
> 
> Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

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

f187fe8e3bc6 ath11k: fix firmware crash during channel switch

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/1636644002-25446-1-git-send-email-quic_vnaralas@quicinc.com/

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


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

* Re: [PATCH] ath11k: fix target assert during channel switch
@ 2021-11-15  9:21   ` Kalle Valo
  0 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2021-11-15  9:21 UTC (permalink / raw)
  To: Venkateswara Naralasetty; +Cc: ath11k, linux-wireless, Venkateswara Naralasetty

Venkateswara Naralasetty <quic_vnaralas@quicinc.com> wrote:

> Currently the updated bandwidth for the peer will be configured
> to the firmware after channel switch from the sta_rc_update_wk.
> If the updated bandwidth is greater than the configured peer phymode
> during the peer assoc may result firmware assert.
> 
> For example, initially AP is in HE40 mode and the peer phymode is
> configured as MODE_11AX_HE40 during peer assoc. Now user change the
> channel width to HE80 then, the peer bandwidth will be updated as
> HE80 to the firmware.
> 
> This will trigger firmware assert due to peer bandwidth is greater than
> the peer phymode.
> 
> Fix this issue by sending peer assoc command before setting the updated
> peer bandwith to firmware.
> 
> Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

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

f187fe8e3bc6 ath11k: fix firmware crash during channel switch

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/1636644002-25446-1-git-send-email-quic_vnaralas@quicinc.com/

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


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

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

end of thread, other threads:[~2021-11-15  9:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11 15:20 [PATCH] ath11k: fix target assert during channel switch Venkateswara Naralasetty
2021-11-11 15:20 ` Venkateswara Naralasetty
2021-11-13  6:35 ` kernel test robot
2021-11-15  9:21 ` Kalle Valo
2021-11-15  9:21   ` Kalle Valo

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.