Sfoglia il codice sorgente

qcacld-3.0: Introduce adapter back pointer in link info

Introduce a new member in per link data structure to fill
the back pointer to adapter.

Introduce new API to get the index of link info pointer
in the array.

Change-Id: I76c96c5d23fcd587181abdbc5b3fdd3634b7e4ab
CRs-Fixed: 3450353
Vinod Kumar Pirla 2 anni fa
parent
commit
afff5f6dff
2 ha cambiato i file con 24 aggiunte e 0 eliminazioni
  1. 10 0
      core/hdd/inc/wlan_hdd_main.h
  2. 14 0
      core/hdd/src/wlan_hdd_main.c

+ 10 - 0
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

+ 14 - 0
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);