wifi: ath12k: add WMI support for spatial reuse parameter configuration

Add WMI support for configuring SRG and non-SRG OBSS PD bitmaps at
the pdev level. The new commands allow the host to set BSS color bitmaps,
partial BSSID bitmaps, and the corresponding enable masks used for
SRG/non-SRG OBSS PD processing.

Introduce new WMI command IDs, TLV tags, a service flag
(WMI_TLV_SERVICE_SRG_SRP_SPATIAL_REUSE_SUPPORT), and a bitmap payload
structure required by these commands. These additions are needed to
support HE Spatial Reuse and firmware-managed OBSS PD behavior.

The APIs introduced in this patch will be utilized in an upcoming patch.

Tested-on: WCN7850 hw2.0 PCI WLAN.IOE_HMT.1.1-00011-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1
Tested-on: QCN9274 hw2.0 WLAN.WBE.1.5-01651-QCAHKSWPL_SILICONZ-1

Signed-off-by: Wei Zhang <wei.zhang@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Link: https://patch.msgid.link/20260123064817.364047-2-wei.zhang@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
This commit is contained in:
Wei Zhang 2026-01-22 22:48:16 -08:00 committed by Jeff Johnson
parent adce4fa499
commit 6dbd496a17
2 changed files with 188 additions and 0 deletions

View File

@ -126,6 +126,14 @@ struct wmi_tlv_mgmt_rx_parse {
bool frame_buf_done;
};
struct wmi_pdev_set_obss_bitmap_arg {
u32 tlv_tag;
u32 pdev_id;
u32 cmd_id;
const u32 *bitmap;
const char *label;
};
static const struct ath12k_wmi_tlv_policy ath12k_wmi_tlv_policies[] = {
[WMI_TAG_ARRAY_BYTE] = { .min_len = 0 },
[WMI_TAG_ARRAY_UINT32] = { .min_len = 0 },
@ -3560,6 +3568,140 @@ ath12k_wmi_send_obss_spr_cmd(struct ath12k *ar, u32 vdev_id,
return ret;
}
u32 ath12k_wmi_build_obss_pd(const struct ath12k_wmi_obss_pd_arg *arg)
{
u32 param_val = 0;
param_val |= u32_encode_bits((u8)arg->srg_th, GENMASK(15, 8));
param_val |= u32_encode_bits((u8)arg->non_srg_th, GENMASK(7, 0));
if (arg->srp_support)
param_val |= ATH12K_OBSS_PD_THRESHOLD_IN_DBM;
if (arg->srg_enabled && arg->srp_support)
param_val |= ATH12K_OBSS_PD_SRG_EN;
if (arg->non_srg_enabled)
param_val |= ATH12K_OBSS_PD_NON_SRG_EN;
return param_val;
}
static int ath12k_wmi_pdev_set_obss_bitmap(struct ath12k *ar,
const struct wmi_pdev_set_obss_bitmap_arg *arg)
{
struct wmi_pdev_obss_pd_bitmap_cmd *cmd;
struct ath12k_wmi_pdev *wmi = ar->wmi;
const int len = sizeof(*cmd);
struct sk_buff *skb;
int ret;
skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, len);
if (!skb)
return -ENOMEM;
cmd = (struct wmi_pdev_obss_pd_bitmap_cmd *)skb->data;
cmd->tlv_header = ath12k_wmi_tlv_cmd_hdr(arg->tlv_tag, len);
cmd->pdev_id = cpu_to_le32(arg->pdev_id);
memcpy(cmd->bitmap, arg->bitmap, sizeof(cmd->bitmap));
ath12k_dbg(ar->ab, ATH12K_DBG_WMI,
"wmi set pdev %u %s %08x %08x\n",
arg->pdev_id, arg->label, arg->bitmap[0], arg->bitmap[1]);
ret = ath12k_wmi_cmd_send(wmi, skb, arg->cmd_id);
if (ret) {
ath12k_warn(ar->ab, "failed to send %s: %d\n", arg->label, ret);
dev_kfree_skb(skb);
}
return ret;
}
int ath12k_wmi_pdev_set_srg_bss_color_bitmap(struct ath12k *ar,
u32 pdev_id, const u32 *bitmap)
{
struct wmi_pdev_set_obss_bitmap_arg arg = {
.tlv_tag = WMI_TAG_PDEV_SRG_BSS_COLOR_BITMAP_CMD,
.pdev_id = pdev_id,
.cmd_id = WMI_PDEV_SET_SRG_BSS_COLOR_BITMAP_CMDID,
.bitmap = bitmap,
.label = "SRG bss color bitmap",
};
return ath12k_wmi_pdev_set_obss_bitmap(ar, &arg);
}
int ath12k_wmi_pdev_set_srg_partial_bssid_bitmap(struct ath12k *ar,
u32 pdev_id, const u32 *bitmap)
{
struct wmi_pdev_set_obss_bitmap_arg arg = {
.tlv_tag = WMI_TAG_PDEV_SRG_PARTIAL_BSSID_BITMAP_CMD,
.pdev_id = pdev_id,
.cmd_id = WMI_PDEV_SET_SRG_PARTIAL_BSSID_BITMAP_CMDID,
.bitmap = bitmap,
.label = "SRG partial bssid bitmap",
};
return ath12k_wmi_pdev_set_obss_bitmap(ar, &arg);
}
int ath12k_wmi_pdev_srg_obss_color_enable_bitmap(struct ath12k *ar,
u32 pdev_id, const u32 *bitmap)
{
struct wmi_pdev_set_obss_bitmap_arg arg = {
.tlv_tag = WMI_TAG_PDEV_SRG_OBSS_COLOR_ENABLE_BITMAP_CMD,
.pdev_id = pdev_id,
.cmd_id = WMI_PDEV_SET_SRG_OBSS_COLOR_ENABLE_BITMAP_CMDID,
.bitmap = bitmap,
.label = "SRG obss color enable bitmap",
};
return ath12k_wmi_pdev_set_obss_bitmap(ar, &arg);
}
int ath12k_wmi_pdev_srg_obss_bssid_enable_bitmap(struct ath12k *ar,
u32 pdev_id, const u32 *bitmap)
{
struct wmi_pdev_set_obss_bitmap_arg arg = {
.tlv_tag = WMI_TAG_PDEV_SRG_OBSS_BSSID_ENABLE_BITMAP_CMD,
.pdev_id = pdev_id,
.cmd_id = WMI_PDEV_SET_SRG_OBSS_BSSID_ENABLE_BITMAP_CMDID,
.bitmap = bitmap,
.label = "SRG obss bssid enable bitmap",
};
return ath12k_wmi_pdev_set_obss_bitmap(ar, &arg);
}
int ath12k_wmi_pdev_non_srg_obss_color_enable_bitmap(struct ath12k *ar,
u32 pdev_id, const u32 *bitmap)
{
struct wmi_pdev_set_obss_bitmap_arg arg = {
.tlv_tag = WMI_TAG_PDEV_NON_SRG_OBSS_COLOR_ENABLE_BITMAP_CMD,
.pdev_id = pdev_id,
.cmd_id = WMI_PDEV_SET_NON_SRG_OBSS_COLOR_ENABLE_BITMAP_CMDID,
.bitmap = bitmap,
.label = "non SRG obss color enable bitmap",
};
return ath12k_wmi_pdev_set_obss_bitmap(ar, &arg);
}
int ath12k_wmi_pdev_non_srg_obss_bssid_enable_bitmap(struct ath12k *ar,
u32 pdev_id, const u32 *bitmap)
{
struct wmi_pdev_set_obss_bitmap_arg arg = {
.tlv_tag = WMI_TAG_PDEV_NON_SRG_OBSS_BSSID_ENABLE_BITMAP_CMD,
.pdev_id = pdev_id,
.cmd_id = WMI_PDEV_SET_NON_SRG_OBSS_BSSID_ENABLE_BITMAP_CMDID,
.bitmap = bitmap,
.label = "non SRG obss bssid enable bitmap",
};
return ath12k_wmi_pdev_set_obss_bitmap(ar, &arg);
}
int ath12k_wmi_obss_color_cfg_cmd(struct ath12k *ar, u32 vdev_id,
u8 bss_color, u32 period,
bool enable)

View File

@ -374,6 +374,12 @@ enum wmi_tlv_cmd_id {
WMI_PDEV_DMA_RING_CFG_REQ_CMDID,
WMI_PDEV_HE_TB_ACTION_FRM_CMDID,
WMI_PDEV_PKTLOG_FILTER_CMDID,
WMI_PDEV_SET_SRG_BSS_COLOR_BITMAP_CMDID = 0x403b,
WMI_PDEV_SET_SRG_PARTIAL_BSSID_BITMAP_CMDID,
WMI_PDEV_SET_SRG_OBSS_COLOR_ENABLE_BITMAP_CMDID,
WMI_PDEV_SET_SRG_OBSS_BSSID_ENABLE_BITMAP_CMDID,
WMI_PDEV_SET_NON_SRG_OBSS_COLOR_ENABLE_BITMAP_CMDID,
WMI_PDEV_SET_NON_SRG_OBSS_BSSID_ENABLE_BITMAP_CMDID,
WMI_PDEV_SET_BIOS_SAR_TABLE_CMDID = 0x4044,
WMI_PDEV_SET_BIOS_GEO_TABLE_CMDID = 0x4045,
WMI_PDEV_SET_BIOS_INTERFACE_CMDID = 0x404A,
@ -1076,6 +1082,9 @@ enum wmi_tlv_pdev_param {
WMI_PDEV_PARAM_RADIO_CHAN_STATS_ENABLE,
WMI_PDEV_PARAM_RADIO_DIAGNOSIS_ENABLE,
WMI_PDEV_PARAM_MESH_MCAST_ENABLE,
WMI_PDEV_PARAM_SET_CMD_OBSS_PD_THRESHOLD = 0xbc,
WMI_PDEV_PARAM_SET_CMD_OBSS_PD_PER_AC = 0xbe,
WMI_PDEV_PARAM_ENABLE_SR_PROHIBIT = 0xc6,
};
enum wmi_tlv_vdev_param {
@ -1987,6 +1996,12 @@ enum wmi_tlv_tag {
WMI_TAG_SERVICE_READY_EXT2_EVENT = 0x334,
WMI_TAG_FILS_DISCOVERY_TMPL_CMD = 0x344,
WMI_TAG_MAC_PHY_CAPABILITIES_EXT = 0x36F,
WMI_TAG_PDEV_SRG_BSS_COLOR_BITMAP_CMD = 0x37b,
WMI_TAG_PDEV_SRG_PARTIAL_BSSID_BITMAP_CMD,
WMI_TAG_PDEV_SRG_OBSS_COLOR_ENABLE_BITMAP_CMD = 0x381,
WMI_TAG_PDEV_SRG_OBSS_BSSID_ENABLE_BITMAP_CMD,
WMI_TAG_PDEV_NON_SRG_OBSS_COLOR_ENABLE_BITMAP_CMD,
WMI_TAG_PDEV_NON_SRG_OBSS_BSSID_ENABLE_BITMAP_CMD,
WMI_TAG_REGULATORY_RULE_EXT_STRUCT = 0x3A9,
WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT,
WMI_TAG_TPC_STATS_GET_CMD = 0x38B,
@ -4925,6 +4940,12 @@ struct wmi_obss_spatial_reuse_params_cmd {
__le32 vdev_id;
} __packed;
struct wmi_pdev_obss_pd_bitmap_cmd {
__le32 tlv_header;
__le32 pdev_id;
__le32 bitmap[2];
} __packed;
#define ATH12K_BSS_COLOR_COLLISION_SCAN_PERIOD_MS 200
#define ATH12K_OBSS_COLOR_COLLISION_DETECTION_DISABLE 0
#define ATH12K_OBSS_COLOR_COLLISION_DETECTION 1
@ -6329,6 +6350,18 @@ struct ath12k_wmi_rssi_dbm_conv_info_arg {
/* each WMI cmd can hold 58 channel entries at most */
#define ATH12K_WMI_MAX_NUM_CHAN_PER_CMD 58
#define ATH12K_OBSS_PD_THRESHOLD_IN_DBM BIT(29)
#define ATH12K_OBSS_PD_SRG_EN BIT(30)
#define ATH12K_OBSS_PD_NON_SRG_EN BIT(31)
struct ath12k_wmi_obss_pd_arg {
bool srp_support;
bool srg_enabled;
bool non_srg_enabled;
s8 srg_th;
s8 non_srg_th;
};
int ath12k_wmi_cmd_send(struct ath12k_wmi_pdev *wmi, struct sk_buff *skb,
u32 cmd_id);
struct sk_buff *ath12k_wmi_alloc_skb(struct ath12k_wmi_base *wmi_sc, u32 len);
@ -6432,6 +6465,19 @@ int ath12k_wmi_send_twt_enable_cmd(struct ath12k *ar, u32 pdev_id);
int ath12k_wmi_send_twt_disable_cmd(struct ath12k *ar, u32 pdev_id);
int ath12k_wmi_send_obss_spr_cmd(struct ath12k *ar, u32 vdev_id,
struct ieee80211_he_obss_pd *he_obss_pd);
u32 ath12k_wmi_build_obss_pd(const struct ath12k_wmi_obss_pd_arg *arg);
int ath12k_wmi_pdev_set_srg_bss_color_bitmap(struct ath12k *ar, u32 pdev_id,
const u32 *bitmap);
int ath12k_wmi_pdev_set_srg_partial_bssid_bitmap(struct ath12k *ar, u32 pdev_id,
const u32 *bitmap);
int ath12k_wmi_pdev_srg_obss_color_enable_bitmap(struct ath12k *ar, u32 pdev_id,
const u32 *bitmap);
int ath12k_wmi_pdev_srg_obss_bssid_enable_bitmap(struct ath12k *ar, u32 pdev_id,
const u32 *bitmap);
int ath12k_wmi_pdev_non_srg_obss_color_enable_bitmap(struct ath12k *ar, u32 pdev_id,
const u32 *bitmap);
int ath12k_wmi_pdev_non_srg_obss_bssid_enable_bitmap(struct ath12k *ar, u32 pdev_id,
const u32 *bitmap);
int ath12k_wmi_obss_color_cfg_cmd(struct ath12k *ar, u32 vdev_id,
u8 bss_color, u32 period,
bool enable);