@@ -272,7 +272,6 @@ struct ath12k_link_vif {
u32 punct_bitmap;
u8 link_id;
struct ath12k_vif *ahvif;
- struct ath12k_vif_cache *cache;
struct ath12k_rekey_data rekey_data;
};
@@ -306,6 +305,7 @@ struct ath12k_vif {
struct ath12k_link_vif deflink;
struct ath12k_link_vif __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
+ struct ath12k_vif_cache *cache[IEEE80211_MLD_MAX_NUM_LINKS];
/* indicates bitmap of link vif created in FW */
u16 links_map;
};
@@ -3455,18 +3455,19 @@ static void ath12k_mac_bss_info_changed(struct ath12k *ar,
}
}
-static struct ath12k_vif_cache *ath12k_arvif_get_cache(struct ath12k_link_vif *arvif)
+static struct ath12k_vif_cache *ath12k_ahvif_get_link_cache(struct ath12k_vif *ahvif,
+ u8 link_id)
{
- if (!arvif->cache)
- arvif->cache = kzalloc(sizeof(*arvif->cache), GFP_KERNEL);
+ if (!ahvif->cache[link_id])
+ ahvif->cache[link_id] = kzalloc(sizeof(*ahvif->cache[0]), GFP_KERNEL);
- return arvif->cache;
+ return ahvif->cache[link_id];
}
-static void ath12k_arvif_put_cache(struct ath12k_link_vif *arvif)
+static void ath12k_ahvif_put_link_cache(struct ath12k_vif *ahvif, u8 link_id)
{
- kfree(arvif->cache);
- arvif->cache = NULL;
+ kfree(ahvif->cache[link_id]);
+ ahvif->cache[link_id] = NULL;
}
static void ath12k_mac_op_bss_info_changed(struct ieee80211_hw *hw,
@@ -3493,15 +3494,14 @@ static void ath12k_mac_op_bss_info_changed(struct ieee80211_hw *hw,
if (!ar) {
/* TODO Once link vif is fetched based on link id from
- * info, avoid using the deflink above and cache the link
- * configs in ahvif per link.
+ * info, avoid using ATH12K_DEFAULT_LINK_ID.
*/
- cache = ath12k_arvif_get_cache(arvif);
+ cache = ath12k_ahvif_get_link_cache(ahvif, ATH12K_DEFAULT_LINK_ID);
if (!cache) {
mutex_unlock(&ah->conf_mutex);
return;
}
- arvif->cache->bss_conf_changed |= changed;
+ cache->bss_conf_changed |= changed;
mutex_unlock(&ah->conf_mutex);
return;
}
@@ -4172,7 +4172,7 @@ static int ath12k_mac_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
return -EINVAL;
}
- cache = ath12k_arvif_get_cache(arvif);
+ cache = ath12k_ahvif_get_link_cache(ahvif, ATH12K_DEFAULT_LINK_ID);
if (!cache) {
mutex_unlock(&ah->conf_mutex);
return -ENOSPC;
@@ -5103,7 +5103,7 @@ static int ath12k_mac_op_conf_tx(struct ieee80211_hw *hw,
ar = ath12k_get_ar_by_vif(hw, vif);
if (!ar) {
/* cache the info and apply after vdev is created */
- cache = ath12k_arvif_get_cache(arvif);
+ cache = ath12k_ahvif_get_link_cache(ahvif, ATH12K_DEFAULT_LINK_ID);
if (!cache) {
mutex_unlock(&ah->conf_mutex);
return -ENOSPC;
@@ -6819,10 +6819,11 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
return ret;
}
-static void ath12k_mac_vif_cache_flush(struct ath12k *ar, struct ath12k_link_vif *arvif)
+static void ath12k_mac_vif_cache_flush(struct ath12k *ar, struct ath12k_link_vif *arvif)
{
- struct ieee80211_vif *vif = ath12k_ahvif_to_vif(arvif->ahvif);
- struct ath12k_vif_cache *cache = arvif->cache;
+ struct ath12k_vif *ahvif = arvif->ahvif;
+ struct ieee80211_vif *vif = ath12k_ahvif_to_vif(ahvif);
+ struct ath12k_vif_cache *cache = ahvif->cache[arvif->link_id];
struct ath12k_base *ab = ar->ab;
int ret;
@@ -6853,7 +6854,7 @@ static void ath12k_mac_vif_cache_flush(struct ath12k *ar, struct ath12k_link_vi
ath12k_warn(ab, "unable to apply set key param to vdev %d ret %d\n",
arvif->vdev_id, ret);
}
- ath12k_arvif_put_cache(arvif);
+ ath12k_ahvif_put_link_cache(ahvif, arvif->link_id);
}
static struct ath12k *ath12k_mac_assign_vif_to_vdev(struct ieee80211_hw *hw,
@@ -7059,7 +7060,7 @@ static int ath12k_mac_vdev_delete(struct ath12k *ar, struct ath12k_link_vif *arv
spin_unlock_bh(&ar->data_lock);
ath12k_peer_cleanup(ar, arvif->vdev_id);
- ath12k_arvif_put_cache(arvif);
+ ath12k_ahvif_put_link_cache(ahvif, arvif->link_id);
idr_for_each(&ar->txmgmt_idr,
ath12k_mac_vif_txmgmt_idr_remove, vif);
@@ -7099,7 +7100,7 @@ static void ath12k_mac_op_remove_interface(struct ieee80211_hw *hw,
/* if we cached some config but never received assign chanctx,
* free the allocated cache.
*/
- ath12k_arvif_put_cache(arvif);
+ ath12k_ahvif_put_link_cache(ahvif, ATH12K_DEFAULT_LINK_ID);
mutex_unlock(&ah->conf_mutex);
return;
}