wlan-ap-Telecominfraproject/feeds/ipq95xx/mac80211/patches/qca/706-ath12k-move-config-caching-to-ahvif.patch
John Crispin 144c5d00f4 ipq95xx/mac80211: update to ATH12.3-CS
Signed-off-by: John Crispin <john@phrozen.org>
2024-02-28 18:56:21 +01:00

243 lines
7.9 KiB
Diff

From e74f3066b2a9c961ca1cfc914623f674dd084838 Mon Sep 17 00:00:00 2001
From: Sriram R <quic_srirrama@quicinc.com>
Date: Fri, 6 Jan 2023 22:24:50 +0530
Subject: [PATCH] ath12k: move config caching to ahvif
Currently the caching of arvif is done whenever the
arvif is not created, which happens during the channel
assignment time. But, the config can be cached since
arvif was preallocated and drv private of vif. But since
the drv priv is now ahvif and arvif is allocated dynamically
during channel assignement, the caching of parameters need
to be done at ahvif level for each link and the config
needs to be flushed to the vdev when arvif is binded to
the corresponding link.
Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
---
drivers/net/wireless/ath/ath12k/core.h | 2 +-
drivers/net/wireless/ath/ath12k/mac.c | 115 +++++++++++++------------
2 files changed, 59 insertions(+), 58 deletions(-)
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -353,7 +353,6 @@ struct ath12k_link_vif {
bool bcca_zero_sent;
bool do_not_send_tmpl;
u32 vht_cap;
- struct ath12k_vif_cache cache;
#ifdef CPTCFG_ATH12K_DEBUGFS
struct dentry *debugfs_twt;
#endif /* CPTCFG_ATH12K_DEBUGFS */
@@ -400,6 +399,7 @@ struct ath12k_vif {
struct ath12k_mgmt_frame_stats mgmt_stats;
u8 num_vdev_created;
u8 num_vdev_started;
+ struct ath12k_vif_cache cache[IEEE80211_MLD_MAX_NUM_LINKS];
};
struct ath12k_vif_iter {
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -4458,18 +4458,12 @@ static void ath12k_mac_op_bss_info_chang
mutex_lock(&ah->conf_mutex);
arvif = ahvif->link[link_id];
- if (arvif == NULL) {
- /* TODO handle link based ahvif caching */
- mutex_unlock(&ah->conf_mutex);
- return;
- }
-
- if (!arvif->is_created) {
+ if (arvif == NULL || !arvif->is_created) {
ath12k_info(NULL,
"bss info parameter changes %llx cached to apply after vdev create on channel assign\n",
changed);
- arvif->cache.bss_conf_changed |= changed;
+ ahvif->cache[link_id].bss_conf_changed |= changed;
mutex_unlock(&ah->conf_mutex);
return;
}
@@ -4581,7 +4575,6 @@ ath12k_mac_assign_link_vif( struct ath12
return NULL;
INIT_LIST_HEAD(&arvif->list);
- INIT_LIST_HEAD(&arvif->cache.key_conf.list);
INIT_WORK(&arvif->update_obss_color_notify_work,
ath12k_update_obss_color_notify_work);
INIT_WORK(&arvif->update_bcn_template_work,
@@ -5280,13 +5273,13 @@ static int ath12k_mac_op_set_key(struct
if (key->link_id >= 0 && key->link_id < IEEE80211_MLD_MAX_NUM_LINKS) {
arvif = ahvif->link[key->link_id];
- if (WARN_ON(!arvif))
- goto out;
+ link_id = key->link_id;
} else {
arvif = &ahvif->deflink;
+ link_id = 0;
}
- if (!arvif->is_created) {
+ if (!arvif || !arvif->is_created) {
key_conf = kzalloc(sizeof(*key_conf), GFP_ATOMIC);
if (!key_conf) {
@@ -5298,7 +5291,8 @@ static int ath12k_mac_op_set_key(struct
key_conf->sta = sta;
key_conf->key = key;
- list_add_tail(&key_conf->list, &arvif->cache.key_conf.list);
+ list_add_tail(&key_conf->list,
+ &ahvif->cache[link_id].key_conf.list);
ath12k_info(NULL, "set key param cached since vif not assign to radio\n");
mutex_unlock(&ah->conf_mutex);
@@ -7090,24 +7084,21 @@ static int ath12k_mac_op_conf_tx(struct
struct ath12k_link_vif *arvif;
int ret;
- mutex_lock(&ah->conf_mutex);
- arvif = &ahvif->deflink;
+ if (link_id >= IEEE80211_MLD_MAX_NUM_LINKS)
+ return -EINVAL;
- /* TODO replace arvif caching to link based ahvif caching */
- if (arvif == NULL) {
- mutex_unlock(&ah->conf_mutex);
- return 0;
- }
+ mutex_lock(&ah->conf_mutex);
+ arvif = ahvif->link[link_id];
/* If the tx config is received before a vdev is assigned to vif
* cache the info to be updated once vdev is created
*/
- if (!arvif->is_created) {
+ if (arvif == NULL || !arvif->is_created) {
ath12k_dbg(NULL, ATH12K_DBG_MAC,
"tx queue params cached since vif is not assigned to radio\n");
- arvif->cache.tx_conf.changed = true;
- arvif->cache.tx_conf.ac = ac;
- arvif->cache.tx_conf.tx_queue_params = *params;
+ ahvif->cache[link_id].tx_conf.changed = true;
+ ahvif->cache[link_id].tx_conf.ac = ac;
+ ahvif->cache[link_id].tx_conf.tx_queue_params = *params;
mutex_unlock(&ah->conf_mutex);
return 0;
}
@@ -9210,7 +9201,8 @@ err:
return ret;
}
-static void ath12k_mac_vif_cache_flush(struct ath12k *ar, struct ieee80211_vif *vif)
+static void ath12k_mac_vif_cache_flush(struct ath12k *ar, struct ieee80211_vif *vif,
+ u8 link_id)
{
struct ath12k_hw *ah = ar->ah;
struct ath12k_vif *ahvif = (void *)vif->drv_priv;
@@ -9218,32 +9210,41 @@ static void ath12k_mac_vif_cache_flush(s
struct ath12k_key_conf *key_conf, *tmp;
struct ath12k_link_sta *arsta = NULL;
struct ath12k_sta *ahsta;
+ struct ath12k_vif_cache *cache;
int ret;
lockdep_assert_held(&ah->conf_mutex);
- /* TODO extend for all link vifs */
- arvif = &ahvif->deflink;
+ arvif = ahvif->link[link_id];
+
+ if (WARN_ON(!arvif))
+ return;
+
+ if (WARN_ON(!arvif->is_created))
+ return;
+
+ cache = &ahvif->cache[link_id];
- if (arvif->cache.tx_conf.changed) {
- ret = ath12k_mac_conf_tx(ar, arvif, arvif->cache.tx_conf.ac,
- &arvif->cache.tx_conf.tx_queue_params);
+ if (cache->tx_conf.changed) {
+ ret = ath12k_mac_conf_tx(ar, arvif, cache->tx_conf.ac,
+ &cache->tx_conf.tx_queue_params);
if (ret)
ath12k_warn(ar->ab,
"unable to apply tx config parameters to vdev %d\n", ret);
- memset(&arvif->cache.tx_conf, 0, sizeof(struct ath12k_tx_conf));
+ memset(&cache->tx_conf, 0, sizeof(struct ath12k_tx_conf));
}
- if (arvif->cache.bss_conf_changed) {
+ if (cache->bss_conf_changed) {
ath12k_mac_bss_info_changed(ar, arvif, &vif->bss_conf,
- arvif->cache.bss_conf_changed);
+ cache->bss_conf_changed);
- arvif->cache.bss_conf_changed = 0;
+ cache->bss_conf_changed = 0;
}
- if (!list_empty(&arvif->cache.key_conf.list)) {
- list_for_each_entry_safe(key_conf, tmp, &arvif->cache.key_conf.list, list) {
+
+ if (!list_empty(&cache->key_conf.list)) {
+ list_for_each_entry_safe(key_conf, tmp, &cache->key_conf.list, list) {
if (key_conf->sta) {
ahsta = (struct ath12k_sta *)key_conf->sta->drv_priv;
arsta = ahsta->link[link_id];
@@ -9313,7 +9314,7 @@ static struct ath12k *ath12k_mac_assign_
/* Apply any parameters for the vdev which were received after
* add_interface, corresponding to this vif
*/
- ath12k_mac_vif_cache_flush(ar, vif);
+ ath12k_mac_vif_cache_flush(ar, vif, arvif->link_id);
unlock:
mutex_unlock(&ar->conf_mutex);
@@ -9346,7 +9347,6 @@ static int ath12k_mac_op_add_interface(s
ahvif->deflink.ahvif = ahvif;
ahvif->deflink.link_id = 0;
INIT_LIST_HEAD(&ahvif->deflink.list);
- INIT_LIST_HEAD(&ahvif->deflink.cache.key_conf.list);
INIT_WORK(&ahvif->deflink.update_obss_color_notify_work,
ath12k_update_obss_color_notify_work);
INIT_WORK(&ahvif->deflink.update_bcn_template_work,
@@ -9359,6 +9359,9 @@ static int ath12k_mac_op_add_interface(s
for (i = 0; i < ARRAY_SIZE(vif->hw_queue); i++)
vif->hw_queue[i] = ATH12K_HW_DEFAULT_QUEUE;
+ for (i = 0; i < IEEE80211_MLD_MAX_NUM_LINKS; i++)
+ INIT_LIST_HEAD(&ahvif->cache[i].key_conf.list);
+
vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD;
mutex_unlock(&ah->conf_mutex);
return 0;
@@ -9396,7 +9399,7 @@ static void ath12k_mac_remove_link_inter
struct ath12k *ar;
struct ath12k_vif *ahvif = arvif->ahvif;
struct ieee80211_vif *vif = ahvif->vif;
- struct ath12k_key_conf *key_conf;
+ struct ath12k_key_conf *key_conf, *tmp;
struct ath12k_base *ab;
int ret;
@@ -9465,8 +9468,10 @@ err_vdev_del:
ath12k_debugfs_remove_interface(arvif);
- if (!list_empty(&arvif->cache.key_conf.list)) {
- list_for_each_entry(key_conf, &arvif->cache.key_conf.list, list) {
+ if (!list_empty(&ahvif->cache[arvif->link_id].key_conf.list)) {
+ list_for_each_entry_safe(key_conf, tmp,
+ &ahvif->cache[arvif->link_id].key_conf.list,
+ list) {
list_del(&key_conf->list);
kfree(key_conf);
}