Message ID | 20250204-unlink_link_arvif_from_chanctx-v1-7-675bd4cea339@oss.qualcomm.com (mailing list archive) |
---|---|
State | New |
Delegated to: | Jeff Johnson |
Headers | show |
Series | wifi: ath12k: handle change_vif_links() callback | expand |
On 2/4/2025 9:53 AM, Aditya Kumar Singh wrote: > Currently, links in an interface are allocated during channel assignment > via assign_vif_chanctx(). Conversely, links are deleted during channel > unassignment via unassign_vif_chanctx(). However, deleting links during > channel unassignment does not comply with mac80211 link handling. > Therefore, this process should be managed within change_vif_links(). To > maintain symmetry, link addition should also be handled in > change_vif_links(). > > Hence, add changes to allocate link arvif in change_vif_links(). Creating > the link interface on firmware will still be done during channel > assignment. > > And since link will be created but channel might not be assigned, there is > a need now to test is_created flag in ath12k_mac_mlo_get_vdev_args() before > accessing link_conf or else link bring up will fail. > > A subsequent change will handle link removal part. > > Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 > > Signed-off-by: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com> Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 5d80bbb664ea6a710eedd7b57db3523df9c893e6..b9017002f3efb27d917f0aa35a0ecc66af18ec99 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -3576,6 +3576,31 @@ ath12k_mac_op_change_vif_links(struct ieee80211_hw *hw, u16 old_links, u16 new_links, struct ieee80211_bss_conf *ol[IEEE80211_MLD_MAX_NUM_LINKS]) { + struct ath12k_vif *ahvif = ath12k_vif_to_ahvif(vif); + unsigned long to_add = ~old_links & new_links; + struct ath12k_hw *ah = ath12k_hw_to_ah(hw); + struct ath12k_link_vif *arvif; + u8 link_id; + + lockdep_assert_wiphy(hw->wiphy); + + ath12k_generic_dbg(ATH12K_DBG_MAC, + "mac vif link changed for MLD %pM old_links 0x%x new_links 0x%x\n", + vif->addr, old_links, new_links); + + for_each_set_bit(link_id, &to_add, IEEE80211_MLD_MAX_NUM_LINKS) { + arvif = wiphy_dereference(hw->wiphy, ahvif->link[link_id]); + /* mac80211 wants to add link but driver already has the + * link. This should not happen ideally. + */ + if (WARN_ON(arvif)) + return -EINVAL; + + arvif = ath12k_mac_assign_link_vif(ah, vif, link_id); + if (WARN_ON(!arvif)) + return -EINVAL; + } + return 0; } @@ -8765,6 +8790,9 @@ ath12k_mac_mlo_get_vdev_args(struct ath12k_link_vif *arvif, if (arvif == arvif_p) continue; + if (!arvif_p->is_created) + continue; + link_conf = wiphy_dereference(ahvif->ah->hw->wiphy, ahvif->vif->link_conf[arvif_p->link_id]);
Currently, links in an interface are allocated during channel assignment via assign_vif_chanctx(). Conversely, links are deleted during channel unassignment via unassign_vif_chanctx(). However, deleting links during channel unassignment does not comply with mac80211 link handling. Therefore, this process should be managed within change_vif_links(). To maintain symmetry, link addition should also be handled in change_vif_links(). Hence, add changes to allocate link arvif in change_vif_links(). Creating the link interface on firmware will still be done during channel assignment. And since link will be created but channel might not be assigned, there is a need now to test is_created flag in ath12k_mac_mlo_get_vdev_args() before accessing link_conf or else link bring up will fail. A subsequent change will handle link removal part. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com> --- drivers/net/wireless/ath/ath12k/mac.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)