Skip to content

Commit cedcd02

Browse files
UPSTREAM: 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 Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com> Link: https://lore.kernel.org/linux-wireless/20260123064817.364047-2-wei.zhang@oss.qualcomm.com/ Signed-off-by: Wei Zhang <wei.zhang@oss.qualcomm.com>
1 parent a51500f commit cedcd02

2 files changed

Lines changed: 188 additions & 0 deletions

File tree

drivers/net/wireless/ath/ath12k/wmi.c

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ struct wmi_tlv_mgmt_rx_parse {
126126
bool frame_buf_done;
127127
};
128128

129+
struct wmi_pdev_set_obss_bitmap_arg {
130+
u32 tlv_tag;
131+
u32 pdev_id;
132+
u32 cmd_id;
133+
const u32 *bitmap;
134+
const char *label;
135+
};
136+
129137
static const struct ath12k_wmi_tlv_policy ath12k_wmi_tlv_policies[] = {
130138
[WMI_TAG_ARRAY_BYTE] = { .min_len = 0 },
131139
[WMI_TAG_ARRAY_UINT32] = { .min_len = 0 },
@@ -3560,6 +3568,140 @@ ath12k_wmi_send_obss_spr_cmd(struct ath12k *ar, u32 vdev_id,
35603568
return ret;
35613569
}
35623570

3571+
u32 ath12k_wmi_build_obss_pd(const struct ath12k_wmi_obss_pd_arg *arg)
3572+
{
3573+
u32 param_val = 0;
3574+
3575+
param_val |= u32_encode_bits((u8)arg->srg_th, GENMASK(15, 8));
3576+
param_val |= u32_encode_bits((u8)arg->non_srg_th, GENMASK(7, 0));
3577+
3578+
if (arg->srp_support)
3579+
param_val |= ATH12K_OBSS_PD_THRESHOLD_IN_DBM;
3580+
3581+
if (arg->srg_enabled && arg->srp_support)
3582+
param_val |= ATH12K_OBSS_PD_SRG_EN;
3583+
3584+
if (arg->non_srg_enabled)
3585+
param_val |= ATH12K_OBSS_PD_NON_SRG_EN;
3586+
3587+
return param_val;
3588+
}
3589+
3590+
static int ath12k_wmi_pdev_set_obss_bitmap(struct ath12k *ar,
3591+
const struct wmi_pdev_set_obss_bitmap_arg *arg)
3592+
{
3593+
struct wmi_pdev_obss_pd_bitmap_cmd *cmd;
3594+
struct ath12k_wmi_pdev *wmi = ar->wmi;
3595+
const int len = sizeof(*cmd);
3596+
struct sk_buff *skb;
3597+
int ret;
3598+
3599+
skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, len);
3600+
if (!skb)
3601+
return -ENOMEM;
3602+
3603+
cmd = (struct wmi_pdev_obss_pd_bitmap_cmd *)skb->data;
3604+
cmd->tlv_header = ath12k_wmi_tlv_cmd_hdr(arg->tlv_tag, len);
3605+
cmd->pdev_id = cpu_to_le32(arg->pdev_id);
3606+
memcpy(cmd->bitmap, arg->bitmap, sizeof(cmd->bitmap));
3607+
3608+
ath12k_dbg(ar->ab, ATH12K_DBG_WMI,
3609+
"wmi set pdev %u %s %08x %08x\n",
3610+
arg->pdev_id, arg->label, arg->bitmap[0], arg->bitmap[1]);
3611+
3612+
ret = ath12k_wmi_cmd_send(wmi, skb, arg->cmd_id);
3613+
if (ret) {
3614+
ath12k_warn(ar->ab, "failed to send %s: %d\n", arg->label, ret);
3615+
dev_kfree_skb(skb);
3616+
}
3617+
3618+
return ret;
3619+
}
3620+
3621+
int ath12k_wmi_pdev_set_srg_bss_color_bitmap(struct ath12k *ar,
3622+
u32 pdev_id, const u32 *bitmap)
3623+
{
3624+
struct wmi_pdev_set_obss_bitmap_arg arg = {
3625+
.tlv_tag = WMI_TAG_PDEV_SRG_BSS_COLOR_BITMAP_CMD,
3626+
.pdev_id = pdev_id,
3627+
.cmd_id = WMI_PDEV_SET_SRG_BSS_COLOR_BITMAP_CMDID,
3628+
.bitmap = bitmap,
3629+
.label = "SRG bss color bitmap",
3630+
};
3631+
3632+
return ath12k_wmi_pdev_set_obss_bitmap(ar, &arg);
3633+
}
3634+
3635+
int ath12k_wmi_pdev_set_srg_partial_bssid_bitmap(struct ath12k *ar,
3636+
u32 pdev_id, const u32 *bitmap)
3637+
{
3638+
struct wmi_pdev_set_obss_bitmap_arg arg = {
3639+
.tlv_tag = WMI_TAG_PDEV_SRG_PARTIAL_BSSID_BITMAP_CMD,
3640+
.pdev_id = pdev_id,
3641+
.cmd_id = WMI_PDEV_SET_SRG_PARTIAL_BSSID_BITMAP_CMDID,
3642+
.bitmap = bitmap,
3643+
.label = "SRG partial bssid bitmap",
3644+
};
3645+
3646+
return ath12k_wmi_pdev_set_obss_bitmap(ar, &arg);
3647+
}
3648+
3649+
int ath12k_wmi_pdev_srg_obss_color_enable_bitmap(struct ath12k *ar,
3650+
u32 pdev_id, const u32 *bitmap)
3651+
{
3652+
struct wmi_pdev_set_obss_bitmap_arg arg = {
3653+
.tlv_tag = WMI_TAG_PDEV_SRG_OBSS_COLOR_ENABLE_BITMAP_CMD,
3654+
.pdev_id = pdev_id,
3655+
.cmd_id = WMI_PDEV_SET_SRG_OBSS_COLOR_ENABLE_BITMAP_CMDID,
3656+
.bitmap = bitmap,
3657+
.label = "SRG obss color enable bitmap",
3658+
};
3659+
3660+
return ath12k_wmi_pdev_set_obss_bitmap(ar, &arg);
3661+
}
3662+
3663+
int ath12k_wmi_pdev_srg_obss_bssid_enable_bitmap(struct ath12k *ar,
3664+
u32 pdev_id, const u32 *bitmap)
3665+
{
3666+
struct wmi_pdev_set_obss_bitmap_arg arg = {
3667+
.tlv_tag = WMI_TAG_PDEV_SRG_OBSS_BSSID_ENABLE_BITMAP_CMD,
3668+
.pdev_id = pdev_id,
3669+
.cmd_id = WMI_PDEV_SET_SRG_OBSS_BSSID_ENABLE_BITMAP_CMDID,
3670+
.bitmap = bitmap,
3671+
.label = "SRG obss bssid enable bitmap",
3672+
};
3673+
3674+
return ath12k_wmi_pdev_set_obss_bitmap(ar, &arg);
3675+
}
3676+
3677+
int ath12k_wmi_pdev_non_srg_obss_color_enable_bitmap(struct ath12k *ar,
3678+
u32 pdev_id, const u32 *bitmap)
3679+
{
3680+
struct wmi_pdev_set_obss_bitmap_arg arg = {
3681+
.tlv_tag = WMI_TAG_PDEV_NON_SRG_OBSS_COLOR_ENABLE_BITMAP_CMD,
3682+
.pdev_id = pdev_id,
3683+
.cmd_id = WMI_PDEV_SET_NON_SRG_OBSS_COLOR_ENABLE_BITMAP_CMDID,
3684+
.bitmap = bitmap,
3685+
.label = "non SRG obss color enable bitmap",
3686+
};
3687+
3688+
return ath12k_wmi_pdev_set_obss_bitmap(ar, &arg);
3689+
}
3690+
3691+
int ath12k_wmi_pdev_non_srg_obss_bssid_enable_bitmap(struct ath12k *ar,
3692+
u32 pdev_id, const u32 *bitmap)
3693+
{
3694+
struct wmi_pdev_set_obss_bitmap_arg arg = {
3695+
.tlv_tag = WMI_TAG_PDEV_NON_SRG_OBSS_BSSID_ENABLE_BITMAP_CMD,
3696+
.pdev_id = pdev_id,
3697+
.cmd_id = WMI_PDEV_SET_NON_SRG_OBSS_BSSID_ENABLE_BITMAP_CMDID,
3698+
.bitmap = bitmap,
3699+
.label = "non SRG obss bssid enable bitmap",
3700+
};
3701+
3702+
return ath12k_wmi_pdev_set_obss_bitmap(ar, &arg);
3703+
}
3704+
35633705
int ath12k_wmi_obss_color_cfg_cmd(struct ath12k *ar, u32 vdev_id,
35643706
u8 bss_color, u32 period,
35653707
bool enable)

drivers/net/wireless/ath/ath12k/wmi.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,12 @@ enum wmi_tlv_cmd_id {
374374
WMI_PDEV_DMA_RING_CFG_REQ_CMDID,
375375
WMI_PDEV_HE_TB_ACTION_FRM_CMDID,
376376
WMI_PDEV_PKTLOG_FILTER_CMDID,
377+
WMI_PDEV_SET_SRG_BSS_COLOR_BITMAP_CMDID = 0x403b,
378+
WMI_PDEV_SET_SRG_PARTIAL_BSSID_BITMAP_CMDID,
379+
WMI_PDEV_SET_SRG_OBSS_COLOR_ENABLE_BITMAP_CMDID,
380+
WMI_PDEV_SET_SRG_OBSS_BSSID_ENABLE_BITMAP_CMDID,
381+
WMI_PDEV_SET_NON_SRG_OBSS_COLOR_ENABLE_BITMAP_CMDID,
382+
WMI_PDEV_SET_NON_SRG_OBSS_BSSID_ENABLE_BITMAP_CMDID,
377383
WMI_PDEV_SET_BIOS_SAR_TABLE_CMDID = 0x4044,
378384
WMI_PDEV_SET_BIOS_GEO_TABLE_CMDID = 0x4045,
379385
WMI_PDEV_SET_BIOS_INTERFACE_CMDID = 0x404A,
@@ -1076,6 +1082,9 @@ enum wmi_tlv_pdev_param {
10761082
WMI_PDEV_PARAM_RADIO_CHAN_STATS_ENABLE,
10771083
WMI_PDEV_PARAM_RADIO_DIAGNOSIS_ENABLE,
10781084
WMI_PDEV_PARAM_MESH_MCAST_ENABLE,
1085+
WMI_PDEV_PARAM_SET_CMD_OBSS_PD_THRESHOLD = 0xbc,
1086+
WMI_PDEV_PARAM_SET_CMD_OBSS_PD_PER_AC = 0xbe,
1087+
WMI_PDEV_PARAM_ENABLE_SR_PROHIBIT = 0xc6,
10791088
};
10801089

10811090
enum wmi_tlv_vdev_param {
@@ -1987,6 +1996,12 @@ enum wmi_tlv_tag {
19871996
WMI_TAG_SERVICE_READY_EXT2_EVENT = 0x334,
19881997
WMI_TAG_FILS_DISCOVERY_TMPL_CMD = 0x344,
19891998
WMI_TAG_MAC_PHY_CAPABILITIES_EXT = 0x36F,
1999+
WMI_TAG_PDEV_SRG_BSS_COLOR_BITMAP_CMD = 0x37b,
2000+
WMI_TAG_PDEV_SRG_PARTIAL_BSSID_BITMAP_CMD,
2001+
WMI_TAG_PDEV_SRG_OBSS_COLOR_ENABLE_BITMAP_CMD = 0x381,
2002+
WMI_TAG_PDEV_SRG_OBSS_BSSID_ENABLE_BITMAP_CMD,
2003+
WMI_TAG_PDEV_NON_SRG_OBSS_COLOR_ENABLE_BITMAP_CMD,
2004+
WMI_TAG_PDEV_NON_SRG_OBSS_BSSID_ENABLE_BITMAP_CMD,
19902005
WMI_TAG_REGULATORY_RULE_EXT_STRUCT = 0x3A9,
19912006
WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT,
19922007
WMI_TAG_TPC_STATS_GET_CMD = 0x38B,
@@ -4925,6 +4940,12 @@ struct wmi_obss_spatial_reuse_params_cmd {
49254940
__le32 vdev_id;
49264941
} __packed;
49274942

4943+
struct wmi_pdev_obss_pd_bitmap_cmd {
4944+
__le32 tlv_header;
4945+
__le32 pdev_id;
4946+
__le32 bitmap[2];
4947+
} __packed;
4948+
49284949
#define ATH12K_BSS_COLOR_COLLISION_SCAN_PERIOD_MS 200
49294950
#define ATH12K_OBSS_COLOR_COLLISION_DETECTION_DISABLE 0
49304951
#define ATH12K_OBSS_COLOR_COLLISION_DETECTION 1
@@ -6329,6 +6350,18 @@ struct ath12k_wmi_rssi_dbm_conv_info_arg {
63296350
/* each WMI cmd can hold 58 channel entries at most */
63306351
#define ATH12K_WMI_MAX_NUM_CHAN_PER_CMD 58
63316352

6353+
#define ATH12K_OBSS_PD_THRESHOLD_IN_DBM BIT(29)
6354+
#define ATH12K_OBSS_PD_SRG_EN BIT(30)
6355+
#define ATH12K_OBSS_PD_NON_SRG_EN BIT(31)
6356+
6357+
struct ath12k_wmi_obss_pd_arg {
6358+
bool srp_support;
6359+
bool srg_enabled;
6360+
bool non_srg_enabled;
6361+
s8 srg_th;
6362+
s8 non_srg_th;
6363+
};
6364+
63326365
int ath12k_wmi_cmd_send(struct ath12k_wmi_pdev *wmi, struct sk_buff *skb,
63336366
u32 cmd_id);
63346367
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);
64326465
int ath12k_wmi_send_twt_disable_cmd(struct ath12k *ar, u32 pdev_id);
64336466
int ath12k_wmi_send_obss_spr_cmd(struct ath12k *ar, u32 vdev_id,
64346467
struct ieee80211_he_obss_pd *he_obss_pd);
6468+
u32 ath12k_wmi_build_obss_pd(const struct ath12k_wmi_obss_pd_arg *arg);
6469+
int ath12k_wmi_pdev_set_srg_bss_color_bitmap(struct ath12k *ar, u32 pdev_id,
6470+
const u32 *bitmap);
6471+
int ath12k_wmi_pdev_set_srg_partial_bssid_bitmap(struct ath12k *ar, u32 pdev_id,
6472+
const u32 *bitmap);
6473+
int ath12k_wmi_pdev_srg_obss_color_enable_bitmap(struct ath12k *ar, u32 pdev_id,
6474+
const u32 *bitmap);
6475+
int ath12k_wmi_pdev_srg_obss_bssid_enable_bitmap(struct ath12k *ar, u32 pdev_id,
6476+
const u32 *bitmap);
6477+
int ath12k_wmi_pdev_non_srg_obss_color_enable_bitmap(struct ath12k *ar, u32 pdev_id,
6478+
const u32 *bitmap);
6479+
int ath12k_wmi_pdev_non_srg_obss_bssid_enable_bitmap(struct ath12k *ar, u32 pdev_id,
6480+
const u32 *bitmap);
64356481
int ath12k_wmi_obss_color_cfg_cmd(struct ath12k *ar, u32 vdev_id,
64366482
u8 bss_color, u32 period,
64376483
bool enable);

0 commit comments

Comments
 (0)