public inbox for ath12k@lists.infradead.org
 help / color / mirror / Atom feed
From: Kang Yang <quic_kangyang@quicinc.com>
To: <ath12k@lists.infradead.org>, Johannes Berg <johannes@sipsolutions.net>
Cc: <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH 2/2] wifi: ath12k: dynamically update puncturing bitmap
Date: Mon, 18 Mar 2024 16:56:35 +0800	[thread overview]
Message-ID: <bc8c8fe4-dc72-4657-925b-eefbaacdedc9@quicinc.com> (raw)
In-Reply-To: <20240312045947.576231-3-quic_kangyang@quicinc.com>



On 3/12/2024 12:59 PM, Kang Yang wrote:
> Every time EHT Operation element changed, mac80211 will parse it and
> extract the valid puncturing bitmap according to the bandwidth.
> 
> So update bandwidth and puncturing bitmap once they changed. Then
> send them to the firmware by WMI event.
> 
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
> 
> Signed-off-by: Kang Yang <quic_kangyang@quicinc.com>
> ---
>   drivers/net/wireless/ath/ath12k/mac.c | 58 +++++++++++++++++++++++++++
>   drivers/net/wireless/ath/ath12k/wmi.h | 16 ++++++++
>   2 files changed, 74 insertions(+)
> 
> diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
> index 52a5fb8b03e9..94ebc14e7f35 100644
> --- a/drivers/net/wireless/ath/ath12k/mac.c
> +++ b/drivers/net/wireless/ath/ath12k/mac.c
> @@ -6502,6 +6502,54 @@ ath12k_mac_change_chanctx_fill_iter(void *data, u8 *mac,
>   	arg->next_vif++;
>   }
>   
> +static u32 ath12k_mac_nlwidth_to_wmiwidth(enum nl80211_chan_width width)
> +{
> +	switch (width) {
> +	case NL80211_CHAN_WIDTH_20:
> +		return WMI_CHAN_WIDTH_20;
> +	case NL80211_CHAN_WIDTH_40:
> +		return WMI_CHAN_WIDTH_40;
> +	case NL80211_CHAN_WIDTH_80:
> +		return WMI_CHAN_WIDTH_80;
> +	case NL80211_CHAN_WIDTH_160:
> +		return WMI_CHAN_WIDTH_160;
> +	case NL80211_CHAN_WIDTH_80P80:
> +		return WMI_CHAN_WIDTH_80P80;
> +	case NL80211_CHAN_WIDTH_5:
> +		return WMI_CHAN_WIDTH_5;
> +	case NL80211_CHAN_WIDTH_10:
> +		return WMI_CHAN_WIDTH_10;
> +	case NL80211_CHAN_WIDTH_320:
> +		return WMI_CHAN_WIDTH_320;
> +	default:
> +		WARN_ON(1);
> +		return WMI_CHAN_WIDTH_20;
> +	}
> +}
> +
> +static int ath12k_mac_update_peer_puncturing_width(struct ath12k *ar,
> +						   struct ath12k_vif *arvif,
> +						   struct cfg80211_chan_def def)
> +{
> +	u32 param_id, param_value;
> +	int ret;



I found i should add a check to avoid duplicate setting for WIN AP, will 
do it in v2.





> +
> +	param_id = WMI_PEER_CHWIDTH_PUNCTURE_20MHZ_BITMAP;
> +	param_value = ath12k_mac_nlwidth_to_wmiwidth(def.width) |
> +		u32_encode_bits((~def.punctured),
> +				WMI_PEER_PUNCTURE_BITMAP);
> +
> +	ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
> +		   "Set puncturing bitmap %02x and width %d for vdev: %d\n",
> +		   def.punctured, def.width, arvif->vdev_id);
> +
> +	ret = ath12k_wmi_set_peer_param(ar, arvif->bssid,
> +					arvif->vdev_id, param_id,
> +					param_value);
> +
> +	return ret;
> +}
> +
>   static void
>   ath12k_mac_update_vif_chan(struct ath12k *ar,
>   			   struct ieee80211_vif_chanctx_switch *vifs,
> @@ -6594,6 +6642,16 @@ ath12k_mac_update_vif_chan(struct ath12k *ar,
>   				    arvif->vdev_id, ret);
>   			continue;
>   		}
> +
> +		ret = ath12k_mac_update_peer_puncturing_width(arvif->ar, arvif,
> +							      vifs[i].new_ctx->def);
> +		if (ret) {
> +			ath12k_warn(ar->ab,
> +				    "failed to update puncturing bitmap %02x and width %d: %d\n",
> +				    vifs[i].new_ctx->def.punctured,
> +				    vifs[i].new_ctx->def.width, ret);
> +			continue;
> +		}
>   	}
>   
>   	/* Restart the internal monitor vdev on new channel */
> diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
> index 103462feb935..d0599a6dce4d 100644
> --- a/drivers/net/wireless/ath/ath12k/wmi.h
> +++ b/drivers/net/wireless/ath/ath12k/wmi.h
> @@ -2199,8 +2199,11 @@ enum wmi_peer_param {
>   	WMI_PEER_SET_MAX_TX_RATE = 17,
>   	WMI_PEER_SET_MIN_TX_RATE = 18,
>   	WMI_PEER_SET_DEFAULT_ROUTING = 19,
> +	WMI_PEER_CHWIDTH_PUNCTURE_20MHZ_BITMAP = 39,
>   };
>   
> +#define WMI_PEER_PUNCTURE_BITMAP		GENMASK(23, 8)
> +
>   enum wmi_slot_time {
>   	WMI_VDEV_SLOT_TIME_LONG = 1,
>   	WMI_VDEV_SLOT_TIME_SHORT = 2,
> @@ -2604,6 +2607,19 @@ struct ath12k_wmi_soc_hal_reg_caps_params {
>   	__le32 num_phy;
>   } __packed;
>   
> +enum wmi_channel_width {
> +	WMI_CHAN_WIDTH_20 = 0,
> +	WMI_CHAN_WIDTH_40 = 1,
> +	WMI_CHAN_WIDTH_80 = 2,
> +	WMI_CHAN_WIDTH_160 = 3,
> +	WMI_CHAN_WIDTH_80P80 = 4,
> +	WMI_CHAN_WIDTH_5 = 5,
> +	WMI_CHAN_WIDTH_10 = 6,
> +	WMI_CHAN_WIDTH_165 = 7,
> +	WMI_CHAN_WIDTH_160P160 = 8,
> +	WMI_CHAN_WIDTH_320 = 9,
> +};
> +
>   #define WMI_MAX_EHTCAP_MAC_SIZE  2
>   #define WMI_MAX_EHTCAP_PHY_SIZE  3
>   #define WMI_MAX_EHTCAP_RATE_SET  3


      reply	other threads:[~2024-03-18  8:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12  4:59 [PATCH 0/2] wifi: ath12k: dynamically update puncturing bitmap Kang Yang
2024-03-12  4:59 ` [PATCH 1/2] wifi: mac80211: supplement parsing of " Kang Yang
2024-03-12  8:16   ` Johannes Berg
2024-03-12  8:45     ` Kang Yang
2024-03-12  9:22     ` Kang Yang
2024-03-12 10:17       ` Johannes Berg
2024-03-14  3:21     ` Kang Yang
2024-03-14  8:03       ` Johannes Berg
2024-03-12  4:59 ` [PATCH 2/2] wifi: ath12k: dynamically update " Kang Yang
2024-03-18  8:56   ` Kang Yang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bc8c8fe4-dc72-4657-925b-eefbaacdedc9@quicinc.com \
    --to=quic_kangyang@quicinc.com \
    --cc=ath12k@lists.infradead.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox