Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions drivers/net/wireless/ath/ath12k/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#define ATH12K_TX_MGMT_NUM_PENDING_MAX 512

#define ATH12K_TX_MGMT_TARGET_MAX_SUPPORT_WMI 64
/* Generic, station, and AP entries in ath12k_iftypes_ext_capa_template. */
#define ATH12K_WIPHY_IFTYPE_EXT_CAPA_MAX 3

/* Pending management packets threshold for dropping probe responses */
#define ATH12K_PRB_RSP_DROP_THRESHOLD ((ATH12K_TX_MGMT_TARGET_MAX_SUPPORT_WMI * 3) / 4)
Expand Down Expand Up @@ -819,6 +821,8 @@ struct ath12k_hw {
struct completion peer_ml_id_done;

u8 num_radio;
struct wiphy_iftype_ext_capab
iftypes_ext_capa[ATH12K_WIPHY_IFTYPE_EXT_CAPA_MAX];

DECLARE_BITMAP(free_ml_peer_id_map, ATH12K_MAX_MLO_PEERS);

Expand Down
168 changes: 168 additions & 0 deletions drivers/net/wireless/ath/ath12k/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1517,6 +1517,164 @@ void ath12k_debugfs_fw_stats_register(struct ath12k *ar)
ath12k_fw_stats_init(ar);
}

static void ath12k_debugfs_set_mlo_max_simultaneous_links(struct ath12k_hw *ah,
u8 max_links)
{
int i;

lockdep_assert_wiphy(ah->hw->wiphy);

for (i = 0; i < ARRAY_SIZE(ah->iftypes_ext_capa); i++) {
enum nl80211_iftype iftype = ah->iftypes_ext_capa[i].iftype;

if (iftype != NL80211_IFTYPE_STATION && iftype != NL80211_IFTYPE_AP)
continue;

ah->iftypes_ext_capa[i].mld_capa_and_ops =
u16_replace_bits(ah->iftypes_ext_capa[i].mld_capa_and_ops,
max_links,
IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS);
}
}

static ssize_t ath12k_write_mlo_max_simultaneous_links(struct file *file,
const char __user *ubuf,
size_t count,
loff_t *ppos)
{
struct ath12k_hw *ah = file->private_data;
struct ath12k *ar;
u8 fw_max_links;
int ret;
u8 val;

ret = kstrtou8_from_user(ubuf, count, 0, &val);
if (ret)
return ret;

/*
* debugfs value uses IEEE 802.11be encoded form (N-1), matching
* MLD Capabilities and Operations per IEEE Std 802.11be-2024
* Table 9-417n:
* 0 means single-link, 1 means dual-link, etc.
*/
guard(wiphy)(ah->hw->wiphy);
ar = ath12k_ah_to_ar(ah, 0);
fw_max_links = u16_get_bits(ar->pdev->cap.mld_cap,
IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS);
if (val > fw_max_links)
return -EINVAL;

ath12k_debugfs_set_mlo_max_simultaneous_links(ah, val);

return count;
}

static ssize_t ath12k_read_mlo_max_simultaneous_links(struct file *file,
char __user *ubuf,
size_t count,
loff_t *ppos)
{
const struct wiphy_iftype_ext_capab *iftype_ext_capa;
struct ath12k_hw *ah = file->private_data;
u8 max_links;
char buf[8];
int len;

scoped_guard(wiphy, ah->hw->wiphy) {
iftype_ext_capa = cfg80211_get_iftype_ext_capa(ah->hw->wiphy,
NL80211_IFTYPE_STATION);
max_links = u16_get_bits(iftype_ext_capa->mld_capa_and_ops,
IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS);
}
len = scnprintf(buf, sizeof(buf), "%u\n", max_links);

return simple_read_from_buffer(ubuf, count, ppos, buf, len);
}

static const struct file_operations fops_mlo_max_simultaneous_links = {
.read = ath12k_read_mlo_max_simultaneous_links,
.write = ath12k_write_mlo_max_simultaneous_links,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};

static void ath12k_debugfs_set_emlsr_support(struct ath12k_hw *ah, bool enable)
{
int i;

lockdep_assert_wiphy(ah->hw->wiphy);

for (i = 0; i < ARRAY_SIZE(ah->iftypes_ext_capa); i++) {
enum nl80211_iftype iftype = ah->iftypes_ext_capa[i].iftype;

if (iftype != NL80211_IFTYPE_STATION && iftype != NL80211_IFTYPE_AP)
continue;

ah->iftypes_ext_capa[i].eml_capabilities =
u16_replace_bits(ah->iftypes_ext_capa[i].eml_capabilities,
enable, IEEE80211_EML_CAP_EMLSR_SUPP);
}
}

static ssize_t ath12k_write_emlsr_support(struct file *file,
const char __user *ubuf,
size_t count, loff_t *ppos)
{
struct ath12k_hw *ah = file->private_data;
struct ath12k *ar;
int ret;
u8 val;
int i;

ret = kstrtou8_from_user(ubuf, count, 0, &val);
if (ret)
return ret;

if (val > 1)
return -EINVAL;

guard(wiphy)(ah->hw->wiphy);
if (val) {
for_each_ar(ah, ar, i) {
if (!(ar->pdev->cap.eml_cap & IEEE80211_EML_CAP_EMLSR_SUPP))
return -EOPNOTSUPP;
}
}
ath12k_debugfs_set_emlsr_support(ah, val);

return count;
}

static ssize_t ath12k_read_emlsr_support(struct file *file, char __user *ubuf,
size_t count, loff_t *ppos)
{
const struct wiphy_iftype_ext_capab *iftype_ext_capa;
struct ath12k_hw *ah = file->private_data;
u8 emlsr_support;
char buf[8];
int len;

scoped_guard(wiphy, ah->hw->wiphy) {
iftype_ext_capa = cfg80211_get_iftype_ext_capa(ah->hw->wiphy,
NL80211_IFTYPE_STATION);
emlsr_support = u16_get_bits(iftype_ext_capa->eml_capabilities,
IEEE80211_EML_CAP_EMLSR_SUPP);
}
len = scnprintf(buf, sizeof(buf), "%u\n", emlsr_support);

return simple_read_from_buffer(ubuf, count, ppos, buf, len);
}

static const struct file_operations fops_emlsr_support = {
.read = ath12k_read_emlsr_support,
.write = ath12k_write_emlsr_support,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};

void ath12k_debugfs_register(struct ath12k *ar)
{
struct ath12k_base *ab = ar->ab;
Expand Down Expand Up @@ -1577,6 +1735,16 @@ void ath12k_debugfs_register(struct ath12k *ar)
debugfs_create_file("ext_rx_stats", 0644,
ar->debug.debugfs_pdev, ar,
&fops_extd_rx_stats);

if (!ab->ag->mlo_capable || IS_ERR_OR_NULL(ar->debug.debugfs_pdev))
return;

debugfs_create_file("mlo_max_simultaneous_links", 0644,
ar->debug.debugfs_pdev, ah,
&fops_mlo_max_simultaneous_links);
debugfs_create_file("eml_capa_present", 0644,
ar->debug.debugfs_pdev, ah,
&fops_emlsr_support);
}

void ath12k_debugfs_unregister(struct ath12k *ar)
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/ath12k/hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ struct ath12k_hw_params {
u32 otp_board_id_register;

bool supports_sta_ps;
bool mlo_max_simul_links_by_num_radios;

const guid_t *acpi_guid;
bool supports_dynamic_smps_6ghz;
Expand Down
57 changes: 50 additions & 7 deletions drivers/net/wireless/ath/ath12k/mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -3541,13 +3541,17 @@ static void ath12k_peer_assoc_h_eht(struct ath12k *ar,
static void ath12k_peer_assoc_h_mlo(struct ath12k_link_sta *arsta,
struct ath12k_wmi_peer_assoc_arg *arg)
{
struct ieee80211_vif *vif = ath12k_ahvif_to_vif(arsta->arvif->ahvif);
struct ieee80211_sta *sta = ath12k_ahsta_to_sta(arsta->ahsta);
const struct wiphy_iftype_ext_capab *iftype_ext_capa;
struct peer_assoc_mlo_params *ml = &arg->ml;
struct ath12k_sta *ahsta = arsta->ahsta;
struct ath12k_link_sta *arsta_p;
struct ath12k_link_vif *arvif;
struct ath12k_hw *ah = arsta->arvif->ar->ah;
unsigned long links;
u8 rec_max_links;
u8 max_links;
u8 link_id;
int i;

Expand Down Expand Up @@ -3585,6 +3589,31 @@ static void ath12k_peer_assoc_h_mlo(struct ath12k_link_sta *arsta,
ml->ieee_link_id = arsta->link_id;
ml->num_partner_links = 0;
ml->eml_cap = sta->eml_cap;

if (vif->type == NL80211_IFTYPE_STATION) {
iftype_ext_capa = cfg80211_get_iftype_ext_capa(ah->hw->wiphy,
vif->type);
/*
* MLD Capabilities and Operations uses N-1 encoding
* (IEEE 802.11be Table 9-417n); firmware peer assoc uses raw N.
*/
max_links = u16_get_bits(iftype_ext_capa->mld_capa_and_ops,
IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS) + 1;
rec_max_links =
u16_get_bits(sta->ext_mld_capa_ops,
IEEE80211_EHT_ML_EXT_MLD_CAPA_OP_RECO_MAX_LINKS_MASK);
/*
* Figure 9-1074t / Table 9-417o define Recommended Max
* Simultaneous Links as raw count L (0 no recommendation,
* 1 reserved).
*/
if (rec_max_links <= 1 || rec_max_links > max_links)
rec_max_links = max_links;

ml->max_num_simultaneous_links = max_links;
ml->recommended_max_num_simultaneous_links = rec_max_links;
}

links = ahsta->links_map;

rcu_read_lock();
Expand Down Expand Up @@ -15132,7 +15161,8 @@ static const u8 ath12k_if_types_ext_capa_ap[] = {
[10] = WLAN_EXT_CAPA11_EMA_SUPPORT,
};

static struct wiphy_iftype_ext_capab ath12k_iftypes_ext_capa[] = {
static const struct wiphy_iftype_ext_capab
ath12k_iftypes_ext_capa_template[ATH12K_WIPHY_IFTYPE_EXT_CAPA_MAX] = {
{
.extended_capabilities = ath12k_if_types_ext_capa,
.extended_capabilities_mask = ath12k_if_types_ext_capa,
Expand Down Expand Up @@ -15373,12 +15403,25 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah)

wiphy->features |= NL80211_FEATURE_TX_POWER_INSERTION;

/* Copy over MLO related capabilities received from
* WMI_SERVICE_READY_EXT2_EVENT if single_chip_mlo_supp is set.
memcpy(ah->iftypes_ext_capa, ath12k_iftypes_ext_capa_template,
sizeof(ah->iftypes_ext_capa));

/*
* Copy over MLO related capabilities received from
* WMI_SERVICE_READY_EXT2_EVENT if mlo_capable is set.
*/
if (ab->ag->mlo_capable) {
ath12k_iftypes_ext_capa[2].eml_capabilities = cap->eml_cap;
ath12k_iftypes_ext_capa[2].mld_capa_and_ops = cap->mld_cap;
for (i = 0; i < ARRAY_SIZE(ah->iftypes_ext_capa); i++) {
enum nl80211_iftype iftype = ah->iftypes_ext_capa[i].iftype;

if (iftype != NL80211_IFTYPE_STATION &&
iftype != NL80211_IFTYPE_AP)
continue;

ah->iftypes_ext_capa[i].eml_capabilities = cap->eml_cap;
ah->iftypes_ext_capa[i].mld_capa_and_ops = cap->mld_cap;
}

wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;

ieee80211_hw_set(hw, MLO_MCAST_MULTI_LINK_TX);
Expand All @@ -15405,8 +15448,8 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah)
wiphy->cipher_suites = cipher_suites;
wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);

wiphy->iftype_ext_capab = ath12k_iftypes_ext_capa;
wiphy->num_iftype_ext_capab = ARRAY_SIZE(ath12k_iftypes_ext_capa);
wiphy->iftype_ext_capab = ah->iftypes_ext_capa;
wiphy->num_iftype_ext_capab = ARRAY_SIZE(ah->iftypes_ext_capa);

wiphy->mbssid_max_interfaces = mbssid_max_interfaces;
wiphy->ema_max_profile_periodicity = TARGET_EMA_MAX_PROFILE_PERIOD;
Expand Down
6 changes: 6 additions & 0 deletions drivers/net/wireless/ath/ath12k/wifi7/hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
.otp_board_id_register = QCN9274_QFPROM_RAW_RFA_PDET_ROW13_LSB,

.supports_sta_ps = false,
.mlo_max_simul_links_by_num_radios = true,

.acpi_guid = NULL,
.supports_dynamic_smps_6ghz = true,
Expand Down Expand Up @@ -517,6 +518,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
.otp_board_id_register = 0,

.supports_sta_ps = true,
.mlo_max_simul_links_by_num_radios = false,

.acpi_guid = &wcn7850_uuid,
.supports_dynamic_smps_6ghz = false,
Expand Down Expand Up @@ -607,6 +609,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
.otp_board_id_register = QCN9274_QFPROM_RAW_RFA_PDET_ROW13_LSB,

.supports_sta_ps = false,
.mlo_max_simul_links_by_num_radios = true,

.acpi_guid = NULL,
.supports_dynamic_smps_6ghz = true,
Expand Down Expand Up @@ -694,6 +697,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
.otp_board_id_register = 0,

.supports_sta_ps = false,
.mlo_max_simul_links_by_num_radios = true,

.acpi_guid = NULL,
.supports_dynamic_smps_6ghz = false,
Expand Down Expand Up @@ -785,6 +789,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
.otp_board_id_register = 0,

.supports_sta_ps = true,
.mlo_max_simul_links_by_num_radios = false,

.acpi_guid = &wcn7850_uuid,
.supports_dynamic_smps_6ghz = false,
Expand Down Expand Up @@ -874,6 +879,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
.otp_board_id_register = 0,

.supports_sta_ps = false,
.mlo_max_simul_links_by_num_radios = true,

.acpi_guid = NULL,
.supports_dynamic_smps_6ghz = false,
Expand Down
Loading
Loading