mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
wifi: ath12k: Add support to parse new WMI event for 6 GHz regulatory
In order to support different power levels of 6 GHz AP and client, new WMI event for regulatory (WMI_REG_CHAN_LIST_CC_EXT_EVENTID) has been added in firmware to provide new parameters required for 6 GHz regulatory rules. Firmware advertises its capability of handling new event in WMI service ready event. Based on that, host needs to set host_service_flags in WMI init command to indicate that host supports processing of this WMI event. Based on advertised host capability, firmware sends event WMI_REG_CHAN_LIST_CC_EXT_EVENTID. This new event contains 2G/5G/6G reg rules with additional power value fields for 6GHz and regd is built accordingly. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0-02903-QCAHKSWPL_SILICONZ-1 Signed-off-by: P Praneesh <quic_ppranees@quicinc.com> Signed-off-by: Ramya Gnanasekar <quic_rgnanase@quicinc.com> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com> Link: https://lore.kernel.org/r/20230502142018.20301-1-quic_rgnanase@quicinc.com
This commit is contained in:
parent
061b0cb932
commit
342527f353
2 changed files with 69 additions and 36 deletions
|
@ -3181,8 +3181,8 @@ ath12k_wmi_copy_resource_config(struct ath12k_wmi_resource_config_params *wmi_cf
|
||||||
wmi_cfg->sched_params = cpu_to_le32(tg_cfg->sched_params);
|
wmi_cfg->sched_params = cpu_to_le32(tg_cfg->sched_params);
|
||||||
wmi_cfg->twt_ap_pdev_count = cpu_to_le32(tg_cfg->twt_ap_pdev_count);
|
wmi_cfg->twt_ap_pdev_count = cpu_to_le32(tg_cfg->twt_ap_pdev_count);
|
||||||
wmi_cfg->twt_ap_sta_count = cpu_to_le32(tg_cfg->twt_ap_sta_count);
|
wmi_cfg->twt_ap_sta_count = cpu_to_le32(tg_cfg->twt_ap_sta_count);
|
||||||
wmi_cfg->host_service_flags =
|
wmi_cfg->host_service_flags = cpu_to_le32(tg_cfg->is_reg_cc_ext_event_supported <<
|
||||||
cpu_to_le32(1 << WMI_RSRC_CFG_HOST_SVC_FLAG_REG_CC_EXT_SUPPORT_BIT);
|
WMI_RSRC_CFG_HOST_SVC_FLAG_REG_CC_EXT_SUPPORT_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ath12k_init_cmd_send(struct ath12k_wmi_pdev *wmi,
|
static int ath12k_init_cmd_send(struct ath12k_wmi_pdev *wmi,
|
||||||
|
@ -3390,6 +3390,10 @@ int ath12k_wmi_cmd_init(struct ath12k_base *ab)
|
||||||
struct ath12k_wmi_base *wmi_sc = &ab->wmi_ab;
|
struct ath12k_wmi_base *wmi_sc = &ab->wmi_ab;
|
||||||
struct ath12k_wmi_init_cmd_arg arg = {};
|
struct ath12k_wmi_init_cmd_arg arg = {};
|
||||||
|
|
||||||
|
if (test_bit(WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT,
|
||||||
|
ab->wmi_ab.svc_map))
|
||||||
|
arg.res_cfg.is_reg_cc_ext_event_supported = true;
|
||||||
|
|
||||||
ab->hw_params->wmi_init(ab, &arg.res_cfg);
|
ab->hw_params->wmi_init(ab, &arg.res_cfg);
|
||||||
|
|
||||||
arg.num_mem_chunks = wmi_sc->num_mem_chunks;
|
arg.num_mem_chunks = wmi_sc->num_mem_chunks;
|
||||||
|
@ -5985,47 +5989,72 @@ static void ath12k_vdev_install_key_compl_event(struct ath12k_base *ab,
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ath12k_service_available_event(struct ath12k_base *ab, struct sk_buff *skb)
|
static int ath12k_wmi_tlv_services_parser(struct ath12k_base *ab,
|
||||||
|
u16 tag, u16 len,
|
||||||
|
const void *ptr,
|
||||||
|
void *data)
|
||||||
{
|
{
|
||||||
const void **tb;
|
|
||||||
const struct wmi_service_available_event *ev;
|
const struct wmi_service_available_event *ev;
|
||||||
int ret;
|
u32 *wmi_ext2_service_bitmap;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
u16 expected_len;
|
||||||
|
|
||||||
tb = ath12k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC);
|
expected_len = WMI_SERVICE_SEGMENT_BM_SIZE32 * sizeof(u32);
|
||||||
if (IS_ERR(tb)) {
|
if (len < expected_len) {
|
||||||
ret = PTR_ERR(tb);
|
ath12k_warn(ab, "invalid length %d for the WMI services available tag 0x%x\n",
|
||||||
ath12k_warn(ab, "failed to parse tlv: %d\n", ret);
|
len, tag);
|
||||||
return;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ev = tb[WMI_TAG_SERVICE_AVAILABLE_EVENT];
|
switch (tag) {
|
||||||
if (!ev) {
|
case WMI_TAG_SERVICE_AVAILABLE_EVENT:
|
||||||
ath12k_warn(ab, "failed to fetch svc available ev");
|
ev = (struct wmi_service_available_event *)ptr;
|
||||||
kfree(tb);
|
for (i = 0, j = WMI_MAX_SERVICE;
|
||||||
return;
|
i < WMI_SERVICE_SEGMENT_BM_SIZE32 && j < WMI_MAX_EXT_SERVICE;
|
||||||
|
i++) {
|
||||||
|
do {
|
||||||
|
if (le32_to_cpu(ev->wmi_service_segment_bitmap[i]) &
|
||||||
|
BIT(j % WMI_AVAIL_SERVICE_BITS_IN_SIZE32))
|
||||||
|
set_bit(j, ab->wmi_ab.svc_map);
|
||||||
|
} while (++j % WMI_AVAIL_SERVICE_BITS_IN_SIZE32);
|
||||||
|
}
|
||||||
|
|
||||||
|
ath12k_dbg(ab, ATH12K_DBG_WMI,
|
||||||
|
"wmi_ext_service_bitmap 0x%x 0x%x 0x%x 0x%x",
|
||||||
|
ev->wmi_service_segment_bitmap[0],
|
||||||
|
ev->wmi_service_segment_bitmap[1],
|
||||||
|
ev->wmi_service_segment_bitmap[2],
|
||||||
|
ev->wmi_service_segment_bitmap[3]);
|
||||||
|
break;
|
||||||
|
case WMI_TAG_ARRAY_UINT32:
|
||||||
|
wmi_ext2_service_bitmap = (u32 *)ptr;
|
||||||
|
for (i = 0, j = WMI_MAX_EXT_SERVICE;
|
||||||
|
i < WMI_SERVICE_SEGMENT_BM_SIZE32 && j < WMI_MAX_EXT2_SERVICE;
|
||||||
|
i++) {
|
||||||
|
do {
|
||||||
|
if (wmi_ext2_service_bitmap[i] &
|
||||||
|
BIT(j % WMI_AVAIL_SERVICE_BITS_IN_SIZE32))
|
||||||
|
set_bit(j, ab->wmi_ab.svc_map);
|
||||||
|
} while (++j % WMI_AVAIL_SERVICE_BITS_IN_SIZE32);
|
||||||
|
}
|
||||||
|
|
||||||
|
ath12k_dbg(ab, ATH12K_DBG_WMI,
|
||||||
|
"wmi_ext2_service_bitmap 0x%04x 0x%04x 0x%04x 0x%04x",
|
||||||
|
wmi_ext2_service_bitmap[0], wmi_ext2_service_bitmap[1],
|
||||||
|
wmi_ext2_service_bitmap[2], wmi_ext2_service_bitmap[3]);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO: Use wmi_service_segment_offset information to get the service
|
static int ath12k_service_available_event(struct ath12k_base *ab, struct sk_buff *skb)
|
||||||
* especially when more services are advertised in multiple service
|
{
|
||||||
* available events.
|
int ret;
|
||||||
*/
|
|
||||||
for (i = 0, j = WMI_MAX_SERVICE;
|
|
||||||
i < WMI_SERVICE_SEGMENT_BM_SIZE32 && j < WMI_MAX_EXT_SERVICE;
|
|
||||||
i++) {
|
|
||||||
do {
|
|
||||||
if (le32_to_cpu(ev->wmi_service_segment_bitmap[i]) &
|
|
||||||
BIT(j % WMI_AVAIL_SERVICE_BITS_IN_SIZE32))
|
|
||||||
set_bit(j, ab->wmi_ab.svc_map);
|
|
||||||
} while (++j % WMI_AVAIL_SERVICE_BITS_IN_SIZE32);
|
|
||||||
}
|
|
||||||
|
|
||||||
ath12k_dbg(ab, ATH12K_DBG_WMI,
|
ret = ath12k_wmi_tlv_iter(ab, skb->data, skb->len,
|
||||||
"wmi_ext_service_bitmap 0:0x%x, 1:0x%x, 2:0x%x, 3:0x%x",
|
ath12k_wmi_tlv_services_parser,
|
||||||
ev->wmi_service_segment_bitmap[0], ev->wmi_service_segment_bitmap[1],
|
NULL);
|
||||||
ev->wmi_service_segment_bitmap[2], ev->wmi_service_segment_bitmap[3]);
|
return ret;
|
||||||
|
|
||||||
kfree(tb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ath12k_peer_assoc_conf_event(struct ath12k_base *ab, struct sk_buff *skb)
|
static void ath12k_peer_assoc_conf_event(struct ath12k_base *ab, struct sk_buff *skb)
|
||||||
|
|
|
@ -2148,7 +2148,10 @@ enum wmi_tlv_service {
|
||||||
WMI_TLV_SERVICE_FREQINFO_IN_METADATA = 219,
|
WMI_TLV_SERVICE_FREQINFO_IN_METADATA = 219,
|
||||||
WMI_TLV_SERVICE_EXT2_MSG = 220,
|
WMI_TLV_SERVICE_EXT2_MSG = 220,
|
||||||
|
|
||||||
WMI_MAX_EXT_SERVICE
|
WMI_MAX_EXT_SERVICE = 256,
|
||||||
|
|
||||||
|
WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT = 281,
|
||||||
|
WMI_MAX_EXT2_SERVICE,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -2333,6 +2336,7 @@ struct ath12k_wmi_resource_config_arg {
|
||||||
u32 sched_params;
|
u32 sched_params;
|
||||||
u32 twt_ap_pdev_count;
|
u32 twt_ap_pdev_count;
|
||||||
u32 twt_ap_sta_count;
|
u32 twt_ap_sta_count;
|
||||||
|
bool is_reg_cc_ext_event_supported;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ath12k_wmi_init_cmd_arg {
|
struct ath12k_wmi_init_cmd_arg {
|
||||||
|
@ -4664,7 +4668,7 @@ struct ath12k_wmi_base {
|
||||||
|
|
||||||
struct completion service_ready;
|
struct completion service_ready;
|
||||||
struct completion unified_ready;
|
struct completion unified_ready;
|
||||||
DECLARE_BITMAP(svc_map, WMI_MAX_EXT_SERVICE);
|
DECLARE_BITMAP(svc_map, WMI_MAX_EXT2_SERVICE);
|
||||||
wait_queue_head_t tx_credits_wq;
|
wait_queue_head_t tx_credits_wq;
|
||||||
const struct wmi_peer_flags_map *peer_flags;
|
const struct wmi_peer_flags_map *peer_flags;
|
||||||
u32 num_mem_chunks;
|
u32 num_mem_chunks;
|
||||||
|
|
Loading…
Add table
Reference in a new issue