Browse Source

qcacld-3.0: Define WLAN_HDD_DEFLINK_IDX and active links

Define WLAN_HDD_DEFLINK_IDX macro which points to default
index in link info array.

Introduce a bitmap to hold the status of links in the array
which are active/opened. This bitmap will be used to check
whether the link info at a particular array index is active
or not.

Change-Id: Ibe9f6694e74ea0f566c586444f4e17d1fd433e66
CRs-Fixed: 3448606
Vinod Kumar Pirla 2 years ago
parent
commit
2d9edb96c7
3 changed files with 8 additions and 2 deletions
  1. 4 0
      core/hdd/inc/wlan_hdd_main.h
  2. 2 1
      core/hdd/src/wlan_hdd_hostapd.c
  3. 2 1
      core/hdd/src/wlan_hdd_main.c

+ 4 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -992,6 +992,8 @@ enum udp_qos_upgrade {
 	UDP_QOS_UPGRADE_MAX
 };
 
+#define WLAN_HDD_DEFLINK_IDX	0
+
 /**
  * struct wlan_hdd_link_info - Data structure to store the link specific info
  * @vdev_id: Unique value to identify VDEV. Equal to WLAN_UMAC_VDEV_ID_MAX
@@ -1071,6 +1073,7 @@ struct wlan_hdd_tx_power {
  * @mac_addr: Current MAC Address for the adapter
  * @mld_addr: MLD address for adapter
  * @event_flags: a bitmap of hdd_adapter_flags
+ * @active_links: a bitmap of active links in @link_info array
  * @hdd_stats: HDD statistics
  * @estimated_linkspeed: estimated link speed
  * @qdf_monitor_mode_vdev_up_event: QDF event for monitor mode vdev up
@@ -1200,6 +1203,7 @@ struct hdd_adapter {
 	struct qdf_mac_addr mac_addr;
 	struct qdf_mac_addr mld_addr;
 	unsigned long event_flags;
+	unsigned long active_links;
 
 	struct hdd_stats hdd_stats;
 

+ 2 - 1
core/hdd/src/wlan_hdd_hostapd.c

@@ -4387,10 +4387,11 @@ struct hdd_adapter *hdd_wlan_create_ap_dev(struct hdd_context *hdd_ctx,
 	/* Initialize the adapter context to zeros. */
 	qdf_mem_zero(adapter, sizeof(struct hdd_adapter));
 	adapter->dev = dev;
-	adapter->deflink = &adapter->link_info[0];
+	adapter->deflink = &adapter->link_info[WLAN_HDD_DEFLINK_IDX];
 	adapter->hdd_ctx = hdd_ctx;
 	adapter->magic = WLAN_HDD_ADAPTER_MAGIC;
 	adapter->deflink->vdev_id = WLAN_UMAC_VDEV_ID_MAX;
+	qdf_atomic_set_bit(WLAN_HDD_DEFLINK_IDX, &adapter->active_links);
 
 	hdd_debug("dev = %pK, adapter = %pK, concurrency_mode=0x%x",
 		dev, adapter,

+ 2 - 1
core/hdd/src/wlan_hdd_main.c

@@ -6352,10 +6352,11 @@ hdd_alloc_station_adapter(struct hdd_context *hdd_ctx, tSirMacAddr mac_addr,
 
 	qdf_mem_zero(adapter, sizeof(*adapter));
 	adapter->dev = dev;
-	adapter->deflink = &adapter->link_info[0];
+	adapter->deflink = &adapter->link_info[WLAN_HDD_DEFLINK_IDX];
 	adapter->hdd_ctx = hdd_ctx;
 	adapter->magic = WLAN_HDD_ADAPTER_MAGIC;
 	adapter->deflink->vdev_id = WLAN_UMAC_VDEV_ID_MAX;
+	qdf_atomic_set_bit(WLAN_HDD_DEFLINK_IDX, &adapter->active_links);
 
 	qdf_status = hdd_monitor_mode_qdf_create_event(adapter, session_type);
 	if (QDF_IS_STATUS_ERROR(qdf_status)) {