diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 34445b45f8..c5ecd315a6 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -996,6 +996,7 @@ enum udp_qos_upgrade { /** * struct wlan_hdd_link_info - Data structure to store the link specific info + * @adapter: Reverse pointer to HDD adapter * @vdev_id: Unique value to identify VDEV. Equal to WLAN_UMAC_VDEV_ID_MAX * for invalid VDEVs. * @vdev_lock: Lock to protect VDEV pointer access. @@ -1022,6 +1023,7 @@ enum udp_qos_upgrade { * @is_mlo_vdev_active: is the mlo vdev currently active */ struct wlan_hdd_link_info { + struct hdd_adapter *adapter; uint8_t vdev_id; qdf_spinlock_t vdev_lock; struct wlan_objmgr_vdev *vdev; @@ -2591,6 +2593,14 @@ void hdd_validate_next_adapter(struct hdd_adapter **curr, __hdd_is_link_idx_valid(link_idx); \ __hdd_adapter_next_link_idx(link_idx)) +static inline uint8_t +hdd_adapter_get_index_of_link_info(struct wlan_hdd_link_info *link_info) +{ + unsigned long offset = link_info - link_info->adapter->deflink; + + return (offset / sizeof(struct wlan_hdd_link_info)); +} + /** * wlan_hdd_get_adapter_from_objmgr() - Fetch adapter from objmgr * @vdev: the vdev whose corresponding adapter has to be fetched diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index a844a4b38c..ca12c7b0ea 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -7925,6 +7925,18 @@ wlan_hdd_set_ml_cap_for_sap_intf(struct hdd_adapter_create_param *create_params, } #endif +static void hdd_adapter_init_link_info(struct hdd_adapter *adapter) +{ + uint8_t link_idx; + struct wlan_hdd_link_info *link_info; + + /* Assign the adapter back pointer in all link_info structs */ + hdd_adapter_for_each_link_entry(adapter, link_idx) { + link_info = &adapter->link_info[link_idx]; + link_info->adapter = adapter; + } +} + /** * hdd_open_adapter() - open and setup the hdd adapter * @hdd_ctx: global hdd context @@ -8150,6 +8162,8 @@ struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx, return NULL; } + hdd_adapter_init_link_info(adapter); + ucfg_psoc_mlme_get_11be_capab(hdd_ctx->psoc, &eht_capab); if (params->is_ml_adapter && eht_capab) { hdd_adapter_set_ml_adapter(adapter);