Skip to content

Commit 062ade2

Browse files
Baochen Qiangjeff-t-johnson
authored andcommitted
wifi: ath12k: parse and save hardware mode info from WMI_SERVICE_READY_EXT_EVENTID event for later use
WLAN hardware might support various hardware modes such as DBS (dual band simultaneously), SBS (single band simultaneously) and DBS_OR_SBS etc, see enum wmi_host_hw_mode_config_type. Firmware advertises actual supported modes in WMI_SERVICE_READY_EXT_EVENTID event. For each mode, firmware advertises frequency range each hardware MAC can operate on. In MLO case such information is necessary during vdev activation and link selection (which is done in following patches), so add a new structure ath12k_svc_ext_info to ath12k_wmi_base, then parse and save those information to it for later use. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00284-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Signed-off-by: Baochen Qiang <[email protected]> Reviewed-by: Vasanthakumar Thiagarajan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]>
1 parent 18ae7d0 commit 062ade2

File tree

2 files changed

+98
-2
lines changed

2 files changed

+98
-2
lines changed

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

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4395,6 +4395,7 @@ static int ath12k_wmi_hw_mode_caps_parse(struct ath12k_base *soc,
43954395
static int ath12k_wmi_hw_mode_caps(struct ath12k_base *soc,
43964396
u16 len, const void *ptr, void *data)
43974397
{
4398+
struct ath12k_svc_ext_info *svc_ext_info = &soc->wmi_ab.svc_ext_info;
43984399
struct ath12k_wmi_svc_rdy_ext_parse *svc_rdy_ext = data;
43994400
const struct ath12k_wmi_hw_mode_cap_params *hw_mode_caps;
44004401
enum wmi_host_hw_mode_config_type mode, pref;
@@ -4427,8 +4428,11 @@ static int ath12k_wmi_hw_mode_caps(struct ath12k_base *soc,
44274428
}
44284429
}
44294430

4430-
ath12k_dbg(soc, ATH12K_DBG_WMI, "preferred_hw_mode:%d\n",
4431-
soc->wmi_ab.preferred_hw_mode);
4431+
svc_ext_info->num_hw_modes = svc_rdy_ext->n_hw_mode_caps;
4432+
4433+
ath12k_dbg(soc, ATH12K_DBG_WMI, "num hw modes %u preferred_hw_mode %d\n",
4434+
svc_ext_info->num_hw_modes, soc->wmi_ab.preferred_hw_mode);
4435+
44324436
if (soc->wmi_ab.preferred_hw_mode == WMI_HOST_HW_MODE_MAX)
44334437
return -EINVAL;
44344438

@@ -4658,6 +4662,65 @@ static int ath12k_wmi_dma_ring_caps(struct ath12k_base *ab,
46584662
return ret;
46594663
}
46604664

4665+
static void
4666+
ath12k_wmi_save_mac_phy_info(struct ath12k_base *ab,
4667+
const struct ath12k_wmi_mac_phy_caps_params *mac_phy_cap,
4668+
struct ath12k_svc_ext_mac_phy_info *mac_phy_info)
4669+
{
4670+
mac_phy_info->phy_id = __le32_to_cpu(mac_phy_cap->phy_id);
4671+
mac_phy_info->supported_bands = __le32_to_cpu(mac_phy_cap->supported_bands);
4672+
mac_phy_info->hw_freq_range.low_2ghz_freq =
4673+
__le32_to_cpu(mac_phy_cap->low_2ghz_chan_freq);
4674+
mac_phy_info->hw_freq_range.high_2ghz_freq =
4675+
__le32_to_cpu(mac_phy_cap->high_2ghz_chan_freq);
4676+
mac_phy_info->hw_freq_range.low_5ghz_freq =
4677+
__le32_to_cpu(mac_phy_cap->low_5ghz_chan_freq);
4678+
mac_phy_info->hw_freq_range.high_5ghz_freq =
4679+
__le32_to_cpu(mac_phy_cap->high_5ghz_chan_freq);
4680+
}
4681+
4682+
static void
4683+
ath12k_wmi_save_all_mac_phy_info(struct ath12k_base *ab,
4684+
struct ath12k_wmi_svc_rdy_ext_parse *svc_rdy_ext)
4685+
{
4686+
struct ath12k_svc_ext_info *svc_ext_info = &ab->wmi_ab.svc_ext_info;
4687+
const struct ath12k_wmi_mac_phy_caps_params *mac_phy_cap;
4688+
const struct ath12k_wmi_hw_mode_cap_params *hw_mode_cap;
4689+
struct ath12k_svc_ext_mac_phy_info *mac_phy_info;
4690+
u32 hw_mode_id, phy_bit_map;
4691+
u8 hw_idx;
4692+
4693+
mac_phy_info = &svc_ext_info->mac_phy_info[0];
4694+
mac_phy_cap = svc_rdy_ext->mac_phy_caps;
4695+
4696+
for (hw_idx = 0; hw_idx < svc_ext_info->num_hw_modes; hw_idx++) {
4697+
hw_mode_cap = &svc_rdy_ext->hw_mode_caps[hw_idx];
4698+
hw_mode_id = __le32_to_cpu(hw_mode_cap->hw_mode_id);
4699+
phy_bit_map = __le32_to_cpu(hw_mode_cap->phy_id_map);
4700+
4701+
while (phy_bit_map) {
4702+
ath12k_wmi_save_mac_phy_info(ab, mac_phy_cap, mac_phy_info);
4703+
mac_phy_info->hw_mode_config_type =
4704+
le32_get_bits(hw_mode_cap->hw_mode_config_type,
4705+
WMI_HW_MODE_CAP_CFG_TYPE);
4706+
ath12k_dbg(ab, ATH12K_DBG_WMI,
4707+
"hw_idx %u hw_mode_id %u hw_mode_config_type %u supported_bands %u phy_id %u 2 GHz [%u - %u] 5 GHz [%u - %u]\n",
4708+
hw_idx, hw_mode_id,
4709+
mac_phy_info->hw_mode_config_type,
4710+
mac_phy_info->supported_bands, mac_phy_info->phy_id,
4711+
mac_phy_info->hw_freq_range.low_2ghz_freq,
4712+
mac_phy_info->hw_freq_range.high_2ghz_freq,
4713+
mac_phy_info->hw_freq_range.low_5ghz_freq,
4714+
mac_phy_info->hw_freq_range.high_5ghz_freq);
4715+
4716+
mac_phy_cap++;
4717+
mac_phy_info++;
4718+
4719+
phy_bit_map >>= 1;
4720+
}
4721+
}
4722+
}
4723+
46614724
static int ath12k_wmi_svc_rdy_ext_parse(struct ath12k_base *ab,
46624725
u16 tag, u16 len,
46634726
const void *ptr, void *data)
@@ -4706,6 +4769,8 @@ static int ath12k_wmi_svc_rdy_ext_parse(struct ath12k_base *ab,
47064769
return ret;
47074770
}
47084771

4772+
ath12k_wmi_save_all_mac_phy_info(ab, svc_rdy_ext);
4773+
47094774
svc_rdy_ext->mac_phy_done = true;
47104775
} else if (!svc_rdy_ext->ext_hal_reg_done) {
47114776
ret = ath12k_wmi_ext_hal_reg_caps(ab, len, ptr, svc_rdy_ext);

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2617,6 +2617,8 @@ struct ath12k_wmi_soc_mac_phy_hw_mode_caps_params {
26172617
__le32 num_chainmask_tables;
26182618
} __packed;
26192619

2620+
#define WMI_HW_MODE_CAP_CFG_TYPE GENMASK(27, 0)
2621+
26202622
struct ath12k_wmi_hw_mode_cap_params {
26212623
__le32 tlv_header;
26222624
__le32 hw_mode_id;
@@ -2666,6 +2668,12 @@ struct ath12k_wmi_mac_phy_caps_params {
26662668
__le32 he_cap_info_2g_ext;
26672669
__le32 he_cap_info_5g_ext;
26682670
__le32 he_cap_info_internal;
2671+
__le32 wireless_modes;
2672+
__le32 low_2ghz_chan_freq;
2673+
__le32 high_2ghz_chan_freq;
2674+
__le32 low_5ghz_chan_freq;
2675+
__le32 high_5ghz_chan_freq;
2676+
__le32 nss_ratio;
26692677
} __packed;
26702678

26712679
struct ath12k_wmi_hal_reg_caps_ext_params {
@@ -5049,6 +5057,27 @@ struct ath12k_wmi_pdev {
50495057
u32 rx_decap_mode;
50505058
};
50515059

5060+
struct ath12k_hw_mode_freq_range_arg {
5061+
u32 low_2ghz_freq;
5062+
u32 high_2ghz_freq;
5063+
u32 low_5ghz_freq;
5064+
u32 high_5ghz_freq;
5065+
};
5066+
5067+
struct ath12k_svc_ext_mac_phy_info {
5068+
enum wmi_host_hw_mode_config_type hw_mode_config_type;
5069+
u32 phy_id;
5070+
u32 supported_bands;
5071+
struct ath12k_hw_mode_freq_range_arg hw_freq_range;
5072+
};
5073+
5074+
#define ATH12K_MAX_MAC_PHY_CAP 8
5075+
5076+
struct ath12k_svc_ext_info {
5077+
u32 num_hw_modes;
5078+
struct ath12k_svc_ext_mac_phy_info mac_phy_info[ATH12K_MAX_MAC_PHY_CAP];
5079+
};
5080+
50525081
struct ath12k_wmi_base {
50535082
struct ath12k_base *ab;
50545083
struct ath12k_wmi_pdev wmi[MAX_RADIOS];
@@ -5066,6 +5095,8 @@ struct ath12k_wmi_base {
50665095
enum wmi_host_hw_mode_config_type preferred_hw_mode;
50675096

50685097
struct ath12k_wmi_target_cap_arg *targ_cap;
5098+
5099+
struct ath12k_svc_ext_info svc_ext_info;
50695100
};
50705101

50715102
struct wmi_pdev_set_bios_interface_cmd {

0 commit comments

Comments
 (0)