瀏覽代碼

qcacld-3.0: Create per link data structure in hdd_adapter

To support multiple links in single adapter, create a new
structure to hold per link info inside the hdd_adapter.
Create a new member in hdd_adapter to point to link zero
of this array of link info.

Move STA and AP context fields into per link info.

Change-Id: Ia1f01865277c3e08254f44a39ba6675a9fea6c65
CRs-Fixed: 3354572
Deeksha Gupta 2 年之前
父節點
當前提交
9864be8a5a

+ 3 - 1
Kbuild

@@ -4486,8 +4486,10 @@ ccflags-y += -DWLAN_MAX_VDEVS=$(CONFIG_WLAN_MAX_VDEVS)
 
 ifdef CONFIG_WLAN_FEATURE_11BE_MLO
 CONFIG_WLAN_MAX_MLD ?= 2
-ccflags-y += -DWLAN_MAX_MLD=$(CONFIG_WLAN_MAX_MLD)
+else
+CONFIG_WLAN_MAX_MLD ?= 1
 endif
+ccflags-y += -DWLAN_MAX_MLD=$(CONFIG_WLAN_MAX_MLD)
 
 #Maximum pending commands for a vdev is calculated in vdev create handler
 #by WLAN_SER_MAX_PENDING_CMDS/WLAN_SER_MAX_VDEVS. For SAP case, we will need

+ 23 - 12
core/hdd/inc/wlan_hdd_main.h

@@ -992,6 +992,19 @@ enum udp_qos_upgrade {
 	UDP_QOS_UPGRADE_MAX
 };
 
+/**
+ * struct wlan_hdd_link_info - Data structure to store the link specific info
+ * @session: union of @ap and @station specific structs
+ * @session.station: station mode information
+ * @session.ap: ap mode specific information
+ */
+struct wlan_hdd_link_info {
+	union {
+		struct hdd_station_ctx station;
+		struct hdd_ap_ctx ap;
+	} session;
+};
+
 /**
  * struct hdd_adapter - hdd vdev/net_device context
  * @magic: Magic cookie for adapter sanity verification.  Note that this
@@ -1048,9 +1061,6 @@ enum udp_qos_upgrade {
  * @rssi_send:
  * @snr:
  * @sap_stop_bss_work:
- * @session: union of @ap and @station specific structs
- * @session.station: station mode information
- * @session.ap: ap mode specific information
  * @ch_switch_in_progress:
  * @acs_complete_event: acs complete event
  * @tsf: structure containing tsf related information
@@ -1137,6 +1147,8 @@ enum udp_qos_upgrade {
  * @delta_qtime: delta between host qtime and monotonic time
  * @traffic_end_ind_en: traffic end indication feature enable/disable
  * @is_dbam_configured:
+ * @deflink: Default link pointing to the 0th index of the linkinfo array
+ * @link_info: Data structure to hold link specific information
  */
 struct hdd_adapter {
 	uint32_t magic;
@@ -1210,11 +1222,6 @@ struct hdd_adapter {
 
 	struct work_struct  sap_stop_bss_work;
 
-	union {
-		struct hdd_station_ctx station;
-		struct hdd_ap_ctx ap;
-	} session;
-
 	qdf_atomic_t ch_switch_in_progress;
 	qdf_event_t acs_complete_event;
 
@@ -1348,14 +1355,18 @@ struct hdd_adapter {
 #ifdef WLAN_FEATURE_DBAM_CONFIG
 	bool is_dbam_configured;
 #endif
+	struct wlan_hdd_link_info *deflink;
+	struct wlan_hdd_link_info link_info[WLAN_MAX_MLD];
 };
 
-#define WLAN_HDD_GET_STATION_CTX_PTR(adapter) (&(adapter)->session.station)
-#define WLAN_HDD_GET_AP_CTX_PTR(adapter) (&(adapter)->session.ap)
+#define WLAN_HDD_GET_STATION_CTX_PTR(adapter) \
+		(&(adapter)->deflink->session.station)
+#define WLAN_HDD_GET_AP_CTX_PTR(adapter) (&(adapter)->deflink->session.ap)
 #define WLAN_HDD_GET_CTX(adapter) ((adapter)->hdd_ctx)
 #define WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter) \
-				(&(adapter)->session.ap.hostapd_state)
-#define WLAN_HDD_GET_SAP_CTX_PTR(adapter) ((adapter)->session.ap.sap_context)
+				(&(adapter)->deflink->session.ap.hostapd_state)
+#define WLAN_HDD_GET_SAP_CTX_PTR(adapter) \
+			((adapter)->deflink->session.ap.sap_context)
 
 #ifdef WLAN_FEATURE_NAN
 #define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) ((hdd_ctx)->nan_datapath_enabled)

+ 3 - 2
core/hdd/src/wlan_hdd_assoc.c

@@ -2207,8 +2207,9 @@ static void hdd_roam_channel_switch_handler(struct hdd_adapter *adapter,
 	}
 
 	if (!is_sap_go_moved_before_sta)
-		policy_mgr_check_concurrent_intf_and_restart_sap(hdd_ctx->psoc,
-			    !!adapter->session.ap.sap_config.acs_cfg.acs_mode);
+		policy_mgr_check_concurrent_intf_and_restart_sap(
+		   hdd_ctx->psoc,
+		   !!adapter->deflink->session.ap.sap_config.acs_cfg.acs_mode);
 	wlan_twt_concurrency_update(hdd_ctx);
 }
 

+ 42 - 36
core/hdd/src/wlan_hdd_cfg80211.c

@@ -2044,9 +2044,9 @@ int wlan_hdd_sap_cfg_dfs_override(struct hdd_adapter *adapter)
 	if (!con_sap_adapter)
 		return 0;
 
-	sap_config = &adapter->session.ap.sap_config;
-	con_sap_config = &con_sap_adapter->session.ap.sap_config;
-	con_ch_freq = con_sap_adapter->session.ap.operating_chan_freq;
+	sap_config = &adapter->deflink->session.ap.sap_config;
+	con_sap_config = &con_sap_adapter->deflink->session.ap.sap_config;
+	con_ch_freq = con_sap_adapter->deflink->session.ap.operating_chan_freq;
 
 	if (!wlan_reg_is_dfs_for_freq(hdd_ctx->pdev, con_ch_freq))
 		return 0;
@@ -2248,7 +2248,7 @@ int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter)
 	if (0 != status)
 		return status;
 
-	sap_config = &adapter->session.ap.sap_config;
+	sap_config = &adapter->deflink->session.ap.sap_config;
 	if (!sap_config) {
 		hdd_err("SAP config is NULL");
 		return -EINVAL;
@@ -2335,7 +2335,8 @@ int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter)
 	 * so no need to set acs in progress
 	 */
 	if (!sap_config->acs_cfg.skip_acs_scan)
-		qdf_atomic_set(&adapter->session.ap.acs_in_progress, 1);
+		qdf_atomic_set(&adapter->deflink->session.ap.acs_in_progress,
+			       1);
 
 	return 0;
 }
@@ -2396,7 +2397,8 @@ hdd_update_reg_chan_info(struct hdd_adapter *adapter,
 	struct ch_params ch_params = {0};
 	uint8_t bw_offset = 0, chan = 0;
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
-	struct sap_config *sap_config = &adapter->session.ap.sap_config;
+	struct sap_config *sap_config =
+				&adapter->deflink->session.ap.sap_config;
 	mac_handle_t mac_handle;
 	uint8_t sub_20_chan_width = 0;
 	QDF_STATUS status;
@@ -2680,7 +2682,7 @@ static int wlan_hdd_sap_get_valid_channellist(struct hdd_adapter *adapter,
 	QDF_STATUS status;
 	struct wlan_objmgr_pdev *pdev = hdd_ctx->pdev;
 
-	sap_config = &adapter->session.ap.sap_config;
+	sap_config = &adapter->deflink->session.ap.sap_config;
 
 	status = policy_mgr_get_valid_chans(hdd_ctx->psoc,
 					    pcl_freqs,
@@ -2832,7 +2834,7 @@ int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
 	}
 
 	hdd_enter();
-	sap_config = &adapter->session.ap.sap_config;
+	sap_config = &adapter->deflink->session.ap.sap_config;
 	/* When first 2 connections are on the same frequency band,
 	 * then PCL would include only channels from the other
 	 * frequency band on which no connections are active
@@ -2860,7 +2862,8 @@ int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
 		}
 	}
 
-	hdd_get_scan_band(hdd_ctx, &adapter->session.ap.sap_config, &band);
+	hdd_get_scan_band(hdd_ctx, &adapter->deflink->session.ap.sap_config,
+			  &band);
 
 	freq_list = qdf_mem_malloc(sizeof(uint32_t) * NUM_CHANNELS);
 	if (!freq_list)
@@ -2890,7 +2893,7 @@ int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
 	hdd_update_reg_chan_info(adapter, channel_count, freq_list);
 
 	/* Get phymode */
-	phy_mode = adapter->session.ap.sap_config.acs_cfg.hw_mode;
+	phy_mode = adapter->deflink->session.ap.sap_config.acs_cfg.hw_mode;
 
 	len = hdd_get_external_acs_event_len(channel_count);
 	id = QCA_NL80211_VENDOR_SUBCMD_UPDATE_EXTERNAL_ACS_CONFIG;
@@ -3003,7 +3006,7 @@ static int hdd_create_acs_timer(struct hdd_adapter *adapter)
 	struct hdd_external_acs_timer_context *timer_context;
 	QDF_STATUS status;
 
-	if (adapter->session.ap.vendor_acs_timer_initialized)
+	if (adapter->deflink->session.ap.vendor_acs_timer_initialized)
 		return 0;
 
 	hdd_debug("Starting vendor app based ACS");
@@ -3014,14 +3017,15 @@ static int hdd_create_acs_timer(struct hdd_adapter *adapter)
 	timer_context->adapter = adapter;
 
 	set_bit(VENDOR_ACS_RESPONSE_PENDING, &adapter->event_flags);
-	status = qdf_mc_timer_init(&adapter->session.ap.vendor_acs_timer,
+	status = qdf_mc_timer_init(
+		  &adapter->deflink->session.ap.vendor_acs_timer,
 		  QDF_TIMER_TYPE_SW,
 		  hdd_acs_response_timeout_handler, timer_context);
 	if (status != QDF_STATUS_SUCCESS) {
 		hdd_err("Failed to initialize acs response timeout timer");
 		return -EFAULT;
 	}
-	adapter->session.ap.vendor_acs_timer_initialized = true;
+	adapter->deflink->session.ap.vendor_acs_timer_initialized = true;
 	return 0;
 }
 
@@ -3470,7 +3474,7 @@ static bool wlan_hdd_check_is_acs_request_same(struct hdd_adapter *adapter,
 	if (!tb[QCA_WLAN_VENDOR_ATTR_ACS_HW_MODE])
 		return false;
 
-	sap_config = &adapter->session.ap.sap_config;
+	sap_config = &adapter->deflink->session.ap.sap_config;
 
 	hw_mode = nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_ACS_HW_MODE]);
 	if (sap_config->acs_cfg.master_acs_cfg.hw_mode != hw_mode)
@@ -3668,7 +3672,8 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 		return -EINVAL;
 	}
 
-	if (qdf_atomic_read(&adapter->session.ap.acs_in_progress) > 0) {
+	if (qdf_atomic_read(
+		&adapter->deflink->session.ap.acs_in_progress) > 0) {
 		if (wlan_hdd_check_is_acs_request_same(adapter,
 						       data, data_len)) {
 			hdd_debug("Same ACS req as ongoing is received, return success");
@@ -3678,7 +3683,8 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 		hdd_err("ACS rejected as previous ACS req already in progress");
 		return -EINVAL;
 	} else {
-		qdf_atomic_set(&adapter->session.ap.acs_in_progress, 1);
+		qdf_atomic_set(&adapter->deflink->session.ap.acs_in_progress,
+			       1);
 		qdf_event_reset(&adapter->acs_complete_event);
 	}
 
@@ -3698,7 +3704,7 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 		goto out;
 	}
 
-	sap_config = &adapter->session.ap.sap_config;
+	sap_config = &adapter->deflink->session.ap.sap_config;
 
 	/* Check and free if memory is already allocated for acs channel list */
 	wlan_hdd_undo_acs(adapter);
@@ -4015,7 +4021,7 @@ out:
 		if (temp_skbuff)
 			return wlan_cfg80211_vendor_cmd_reply(temp_skbuff);
 	}
-	qdf_atomic_set(&adapter->session.ap.acs_in_progress, 0);
+	qdf_atomic_set(&adapter->deflink->session.ap.acs_in_progress, 0);
 
 	return ret;
 }
@@ -4063,7 +4069,7 @@ static int wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 void wlan_hdd_undo_acs(struct hdd_adapter *adapter)
 {
 	sap_undo_acs(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
-		     &adapter->session.ap.sap_config);
+		     &adapter->deflink->session.ap.sap_config);
 }
 
 /**
@@ -4200,7 +4206,7 @@ void wlan_hdd_cfg80211_acs_ch_select_evt(struct hdd_adapter *adapter)
 	uint32_t len = hdd_get_acs_evt_data_len(sap_cfg);
 	uint16_t puncture_bitmap;
 
-	qdf_atomic_set(&adapter->session.ap.acs_in_progress, 0);
+	qdf_atomic_set(&adapter->deflink->session.ap.acs_in_progress, 0);
 	qdf_event_set(&adapter->acs_complete_event);
 
 	vendor_event = wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
@@ -14510,7 +14516,7 @@ uint8_t hdd_get_sap_operating_band_by_adapter(struct hdd_adapter *adapter)
 	    adapter->device_mode != QDF_P2P_GO_MODE)
 		return BAND_UNKNOWN;
 
-	operating_chan_freq = adapter->session.ap.operating_chan_freq;
+	operating_chan_freq = adapter->deflink->session.ap.operating_chan_freq;
 	if (WLAN_REG_IS_24GHZ_CH_FREQ(operating_chan_freq))
 		sap_operating_band = BAND_2G;
 	else if (WLAN_REG_IS_5GHZ_CH_FREQ(operating_chan_freq) ||
@@ -15687,12 +15693,12 @@ static int hdd_update_acs_channel(struct hdd_adapter *adapter, uint8_t reason,
 	}
 
 	hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter);
-	sap_config = &adapter->session.ap.sap_config;
+	sap_config = &adapter->deflink->session.ap.sap_config;
 
 	if (QDF_TIMER_STATE_RUNNING ==
-	    qdf_mc_timer_get_current_state(&adapter->session.
-					ap.vendor_acs_timer)) {
-		qdf_mc_timer_stop(&adapter->session.ap.vendor_acs_timer);
+	    qdf_mc_timer_get_current_state(&hdd_ap_ctx->vendor_acs_timer)) {
+		qdf_mc_timer_stop(
+			&hdd_ap_ctx->vendor_acs_timer);
 	}
 
 	if (channel_list->pri_chan_freq == 0) {
@@ -20305,6 +20311,7 @@ static int __wlan_hdd_cfg80211_change_bss(struct wiphy *wiphy,
 {
 	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	struct hdd_ap_ctx *ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter);
 	int ret = 0;
 	QDF_STATUS qdf_ret_status;
 	mac_handle_t mac_handle;
@@ -20343,25 +20350,22 @@ static int __wlan_hdd_cfg80211_change_bss(struct wiphy *wiphy,
 	 * want to update this parameter
 	 */
 	if (-1 != params->ap_isolate) {
-		adapter->session.ap.disable_intrabss_fwd =
+		adapter->deflink->session.ap.disable_intrabss_fwd =
 			!!params->ap_isolate;
 
 		mac_handle = hdd_ctx->mac_handle;
 		qdf_ret_status = sme_ap_disable_intra_bss_fwd(mac_handle,
-							      adapter->vdev_id,
-							      adapter->session.
-							      ap.
-							      disable_intrabss_fwd);
+						adapter->vdev_id,
+						ap_ctx->disable_intrabss_fwd);
 		if (!QDF_IS_STATUS_SUCCESS(qdf_ret_status))
 			ret = -EINVAL;
 
 		ucfg_ipa_set_ap_ibss_fwd(hdd_ctx->pdev,
 					 adapter->vdev_id,
-					 adapter->session.ap.
-					 disable_intrabss_fwd);
+					 ap_ctx->disable_intrabss_fwd);
 
 		vdev_param.cdp_vdev_param_ap_brdg_en =
-			!adapter->session.ap.disable_intrabss_fwd;
+			!ap_ctx->disable_intrabss_fwd;
 		cdp_txrx_set_vdev_param(soc, adapter->vdev_id,
 					CDP_ENABLE_AP_BRIDGE,
 					vdev_param);
@@ -20390,7 +20394,8 @@ static int hdd_change_adapter_mode(struct hdd_adapter *adapter,
 	hdd_stop_adapter(hdd_ctx, adapter);
 	hdd_deinit_adapter(hdd_ctx, adapter, true);
 	adapter->device_mode = new_mode;
-	memset(&adapter->session, 0, sizeof(adapter->session));
+	memset(&adapter->deflink->session, 0,
+	       sizeof(adapter->deflink->session));
 	hdd_set_station_ops(netdev);
 
 	hdd_exit();
@@ -20604,7 +20609,8 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy,
 
 			hdd_stop_adapter(hdd_ctx, adapter);
 			hdd_deinit_adapter(hdd_ctx, adapter, true);
-			memset(&adapter->session, 0, sizeof(adapter->session));
+			memset(&adapter->deflink->session, 0,
+			       sizeof(adapter->deflink->session));
 			adapter->device_mode = new_mode;
 
 			status = ucfg_mlme_get_ap_random_bssid_enable(
@@ -24186,7 +24192,7 @@ static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy,
 		   adapter->vdev_id, adapter->device_mode);
 
 	if (QDF_SAP_MODE == adapter->device_mode) {
-		config = &adapter->session.ap.sap_config;
+		config = &adapter->deflink->session.ap.sap_config;
 
 		/* default value */
 		config->num_accept_mac = 0;

+ 13 - 7
core/hdd/src/wlan_hdd_dcs.c

@@ -98,7 +98,7 @@ static QDF_STATUS hdd_dcs_switch_chan_cb(struct wlan_objmgr_vdev *vdev,
 		if (!hdd_cm_is_vdev_associated(adapter))
 			return QDF_STATUS_E_INVAL;
 
-		bssid = &adapter->session.station.conn_info.bssid;
+		bssid = &adapter->deflink->session.station.conn_info.bssid;
 
 		/* disconnect if got invalid freq or width */
 		if (tgt_freq == 0 || tgt_width == CH_WIDTH_INVALID) {
@@ -377,6 +377,7 @@ void hdd_dcs_hostapd_set_chan(struct hdd_context *hdd_ctx,
 			      uint8_t vdev_id,
 			      qdf_freq_t dcs_ch_freq)
 {
+	struct hdd_ap_ctx *ap_ctx;
 	QDF_STATUS status;
 	uint8_t mac_id;
 	uint32_t list[MAX_NUMBER_OF_CONC_CONNECTIONS];
@@ -406,7 +407,8 @@ void hdd_dcs_hostapd_set_chan(struct hdd_context *hdd_ctx,
 			return;
 		}
 
-		if (adapter->session.ap.operating_chan_freq != dcs_ch_freq)
+		if (adapter->deflink->session.ap.operating_chan_freq !=
+		    dcs_ch_freq)
 			wlansap_dcs_set_vdev_starting(
 				WLAN_HDD_GET_SAP_CTX_PTR(adapter), true);
 		else
@@ -421,10 +423,12 @@ void hdd_dcs_hostapd_set_chan(struct hdd_context *hdd_ctx,
 			return;
 		}
 
-		if (adapter->session.ap.operating_chan_freq != dcs_ch_freq) {
+		ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter);
+
+		if (ap_ctx->operating_chan_freq != dcs_ch_freq) {
 			hdd_ctx->acs_policy.acs_chan_freq = AUTO_CHANNEL_SELECT;
 			hdd_debug("dcs triggers old ch:%d new ch:%d",
-				  adapter->session.ap.operating_chan_freq,
+				  ap_ctx->operating_chan_freq,
 				  dcs_ch_freq);
 			wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc,
 						    adapter->vdev_id,
@@ -469,7 +473,8 @@ static void hdd_dcs_hostapd_enable_wlan_interference_mitigation(
 
 	if (wlansap_dcs_is_wlan_interference_mitigation_enabled(
 			WLAN_HDD_GET_SAP_CTX_PTR(adapter)) &&
-	    !WLAN_REG_IS_24GHZ_CH_FREQ(adapter->session.ap.operating_chan_freq))
+	    !WLAN_REG_IS_24GHZ_CH_FREQ(
+		    adapter->deflink->session.ap.operating_chan_freq))
 		ucfg_config_dcs_event_data(hdd_ctx->psoc, mac_id, true);
 }
 
@@ -485,14 +490,15 @@ void hdd_dcs_chan_select_complete(struct hdd_adapter *adapter)
 	}
 
 	dcs_freq = wlansap_dcs_get_freq(WLAN_HDD_GET_SAP_CTX_PTR(adapter));
-	if (dcs_freq && dcs_freq != adapter->session.ap.operating_chan_freq)
+	if (dcs_freq && dcs_freq !=
+	    adapter->deflink->session.ap.operating_chan_freq)
 		hdd_dcs_hostapd_set_chan(hdd_ctx, adapter->vdev_id, dcs_freq);
 	else
 		hdd_dcs_hostapd_enable_wlan_interference_mitigation(
 							hdd_ctx,
 							adapter->vdev_id);
 
-	qdf_atomic_set(&adapter->session.ap.acs_in_progress, 0);
+	qdf_atomic_set(&adapter->deflink->session.ap.acs_in_progress, 0);
 }
 
 void hdd_dcs_clear(struct hdd_adapter *adapter)

+ 1 - 1
core/hdd/src/wlan_hdd_eht.c

@@ -274,7 +274,7 @@ int hdd_set_11be_rate_code(struct hdd_adapter *adapter, uint16_t rate_code)
 	struct sap_config *sap_config = NULL;
 
 	if (adapter->device_mode == QDF_SAP_MODE)
-		sap_config = &adapter->session.ap.sap_config;
+		sap_config = &adapter->deflink->session.ap.sap_config;
 
 	if (!sap_config) {
 		if (!sme_is_feature_supported_by_fw(DOT11BE)) {

+ 3 - 3
core/hdd/src/wlan_hdd_green_ap.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2012-2018, 2020 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -219,6 +219,7 @@ __wlan_hdd_enter_sap_low_pwr_mode(struct wiphy *wiphy,
 	QDF_STATUS status;
 	struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
 	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(wdev->netdev);
+	struct hdd_ap_ctx *ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter);
 	struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_DOZED_AP_MAX + 1];
 	struct sk_buff *skb;
 
@@ -249,8 +250,7 @@ __wlan_hdd_enter_sap_low_pwr_mode(struct wiphy *wiphy,
 		  lp_flags == QCA_WLAN_DOZED_AP_ENABLE ? "ENABLE" : "DISABLE");
 
 	status = ucfg_green_ap_ll_ps(hdd_ctx->pdev, adapter->vdev, lp_flags,
-				     adapter->session.ap.sap_config.beacon_int,
-				     &cookie_id);
+				     ap_ctx->sap_config.beacon_int, &cookie_id);
 	if (status != QDF_STATUS_SUCCESS) {
 		hdd_err("unable to send low latency power save cmd");
 		return -EINVAL;

+ 83 - 76
core/hdd/src/wlan_hdd_hostapd.c

@@ -288,7 +288,7 @@ hdd_hostapd_init_sap_session(struct hdd_adapter *adapter, bool reinit)
 		return NULL;
 	}
 
-	sap_ctx = adapter->session.ap.sap_context;
+	sap_ctx = adapter->deflink->session.ap.sap_context;
 
 	if (!sap_ctx) {
 		hdd_err("can't allocate the sap_ctx");
@@ -299,7 +299,7 @@ hdd_hostapd_init_sap_session(struct hdd_adapter *adapter, bool reinit)
 			       adapter->vdev_id, reinit);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		hdd_err("wlansap_start failed!! status: %d", status);
-		adapter->session.ap.sap_context = NULL;
+		adapter->deflink->session.ap.sap_context = NULL;
 		goto error;
 	}
 	return sap_ctx;
@@ -1991,7 +1991,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 			hdd_ctx->pdev, ap_ctx->operating_chan_freq);
 	wlan_reg_get_cc_and_src(hdd_ctx->psoc, dfs_info.country_code);
 	sta_id = sap_event->sapevt.sapStartBssCompleteEvent.staId;
-	sap_config = &adapter->session.ap.sap_config;
+	sap_config = &adapter->deflink->session.ap.sap_config;
 
 	switch (event_id) {
 	case eSAP_START_BSS_EVENT:
@@ -2309,7 +2309,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 	{
 		int i;
 		struct sap_config *sap_config =
-				&adapter->session.ap.sap_config;
+				&adapter->deflink->session.ap.sap_config;
 
 		hdd_dfs_indicate_radar(hdd_ctx);
 		wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index,
@@ -2862,7 +2862,8 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 			      ap_ctx->sap_config.acs_cfg.pri_ch_freq,
 			      ap_ctx->sap_config.acs_cfg.ch_width);
 
-		if (qdf_atomic_read(&adapter->session.ap.acs_in_progress) &&
+		if (qdf_atomic_read(
+		    &adapter->deflink->session.ap.acs_in_progress) &&
 		    test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
 			hdd_dcs_chan_select_complete(adapter);
 		} else {
@@ -2930,7 +2931,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 		else if (ap_ctx->sap_context->csa_reason == CSA_REASON_DCS)
 			hdd_dcs_hostapd_set_chan(
 				hdd_ctx, adapter->vdev_id,
-				adapter->session.ap.operating_chan_freq);
+				ap_ctx->operating_chan_freq);
 
 		/* Added the sta cnt check as we don't support sta+sap+nan
 		 * today. But this needs to be re-visited when we start
@@ -3692,7 +3693,7 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart(
 	 */
 	if (policy_mgr_is_sap_restart_required_after_sta_disconnect(
 	    psoc, vdev_id, &intf_ch_freq,
-	    !!ap_adapter->session.ap.sap_config.acs_cfg.acs_mode)) {
+	    !!ap_adapter->deflink->session.ap.sap_config.acs_cfg.acs_mode)) {
 		hdd_debug("Move the sap (vdev %d) to user configured channel %u",
 			  vdev_id, intf_ch_freq);
 		goto sap_restart;
@@ -3811,7 +3812,7 @@ wlan_get_sap_acs_band(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
 	 * If acs mode is false, that means acs is disabled and acs band can be
 	 * QCA_ACS_MODE_IEEE80211ANY
 	 */
-	sap_config = &ap_adapter->session.ap.sap_config;
+	sap_config = &ap_adapter->deflink->session.ap.sap_config;
 	if (sap_config->acs_cfg.acs_mode == false) {
 		*acs_band = QCA_ACS_MODE_IEEE80211ANY;
 		return QDF_STATUS_SUCCESS;
@@ -4002,8 +4003,8 @@ void hdd_set_ap_ops(struct net_device *dev)
 bool hdd_sap_create_ctx(struct hdd_adapter *adapter)
 {
 	hdd_debug("creating sap context");
-	adapter->session.ap.sap_context = sap_create_ctx();
-	if (adapter->session.ap.sap_context)
+	adapter->deflink->session.ap.sap_context = sap_create_ctx();
+	if (adapter->deflink->session.ap.sap_context)
 		return true;
 
 	return false;
@@ -4011,11 +4012,11 @@ bool hdd_sap_create_ctx(struct hdd_adapter *adapter)
 
 bool hdd_sap_destroy_ctx(struct hdd_adapter *adapter)
 {
-	struct sap_context *sap_ctx = adapter->session.ap.sap_context;
+	struct sap_context *sap_ctx = adapter->deflink->session.ap.sap_context;
 
-	if (adapter->session.ap.beacon) {
-		qdf_mem_free(adapter->session.ap.beacon);
-		adapter->session.ap.beacon = NULL;
+	if (adapter->deflink->session.ap.beacon) {
+		qdf_mem_free(adapter->deflink->session.ap.beacon);
+		adapter->deflink->session.ap.beacon = NULL;
 	}
 
 	if (!sap_ctx) {
@@ -4028,7 +4029,7 @@ bool hdd_sap_destroy_ctx(struct hdd_adapter *adapter)
 	if (QDF_IS_STATUS_ERROR(sap_destroy_ctx(sap_ctx)))
 		return false;
 
-	adapter->session.ap.sap_context = NULL;
+	adapter->deflink->session.ap.sap_context = NULL;
 
 	return true;
 }
@@ -4088,7 +4089,7 @@ QDF_STATUS hdd_init_ap_mode(struct hdd_adapter *adapter, bool reinit)
 	hdd_enter();
 
 	hdd_debug("SSR in progress: %d", reinit);
-	qdf_atomic_init(&adapter->session.ap.acs_in_progress);
+	qdf_atomic_init(&adapter->deflink->session.ap.acs_in_progress);
 
 	sap_ctx = hdd_hostapd_init_sap_session(adapter, reinit);
 	if (!sap_ctx) {
@@ -4097,10 +4098,10 @@ QDF_STATUS hdd_init_ap_mode(struct hdd_adapter *adapter, bool reinit)
 	}
 
 	if (!reinit) {
-		adapter->session.ap.sap_config.chan_freq =
+		adapter->deflink->session.ap.sap_config.chan_freq =
 					      hdd_ctx->acs_policy.acs_chan_freq;
 		acs_dfs_mode = hdd_ctx->acs_policy.acs_dfs_mode;
-		adapter->session.ap.sap_config.acs_dfs_mode =
+		adapter->deflink->session.ap.sap_config.acs_dfs_mode =
 			wlan_hdd_get_dfs_mode(acs_dfs_mode);
 	}
 
@@ -4185,11 +4186,12 @@ QDF_STATUS hdd_init_ap_mode(struct hdd_adapter *adapter, bool reinit)
 	hdd_set_netdev_flags(adapter);
 
 	if (!reinit) {
-		adapter->session.ap.sap_config.acs_cfg.acs_mode = false;
+		adapter->deflink->session.ap.sap_config.acs_cfg.acs_mode =
+									false;
 		wlansap_dcs_set_vdev_wlan_interference_mitigation(sap_ctx,
 								  false);
 		wlansap_dcs_set_vdev_starting(sap_ctx, false);
-		qdf_mem_zero(&adapter->session.ap.sap_config.acs_cfg,
+		qdf_mem_zero(&adapter->deflink->session.ap.sap_config.acs_cfg,
 			     sizeof(struct sap_acs_cfg));
 	}
 
@@ -4221,7 +4223,7 @@ void hdd_deinit_ap_mode(struct hdd_context *hdd_ctx,
 		hdd_wmm_adapter_close(adapter);
 		clear_bit(WMM_INIT_DONE, &adapter->event_flags);
 	}
-	qdf_atomic_set(&adapter->session.ap.acs_in_progress, 0);
+	qdf_atomic_set(&adapter->deflink->session.ap.acs_in_progress, 0);
 	if (qdf_atomic_read(&adapter->ch_switch_in_progress)) {
 		qdf_atomic_set(&adapter->ch_switch_in_progress, 0);
 		policy_mgr_set_chan_switch_complete_evt(hdd_ctx->psoc);
@@ -4277,6 +4279,7 @@ 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->hdd_ctx = hdd_ctx;
 	adapter->magic = WLAN_HDD_ADAPTER_MAGIC;
 	adapter->vdev_id = WLAN_UMAC_VDEV_ID_MAX;
@@ -4347,7 +4350,7 @@ static bool wlan_hdd_get_sap_obss(struct hdd_adapter *adapter)
 	uint8_t ht_cap_ie[DOT11F_IE_HTCAPS_MAX_LEN];
 	tDot11fIEHTCaps dot11_ht_cap_ie = {0};
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
-	struct hdd_beacon_data *beacon = adapter->session.ap.beacon;
+	struct hdd_beacon_data *beacon = adapter->deflink->session.ap.beacon;
 	mac_handle_t mac_handle;
 
 	mac_handle = hdd_ctx->mac_handle;
@@ -4583,7 +4586,7 @@ static int wlan_hdd_add_extn_ie(struct hdd_adapter *adapter, uint8_t *genie,
 {
 	const uint8_t *ie;
 	uint16_t ielen = 0;
-	struct hdd_beacon_data *beacon = adapter->session.ap.beacon;
+	struct hdd_beacon_data *beacon = adapter->deflink->session.ap.beacon;
 
 	ie = wlan_get_ext_ie_ptr_from_ext_id(oui, oui_size,
 					     beacon->tail,
@@ -4614,7 +4617,7 @@ static void wlan_hdd_add_hostapd_conf_vsie(struct hdd_adapter *adapter,
 					   uint8_t *genie,
 					   uint16_t *total_ielen)
 {
-	struct hdd_beacon_data *beacon = adapter->session.ap.beacon;
+	struct hdd_beacon_data *beacon = adapter->deflink->session.ap.beacon;
 	int left = beacon->tail_len;
 	uint8_t *ptr = beacon->tail;
 	uint8_t elem_id, elem_len;
@@ -4682,7 +4685,7 @@ static void wlan_hdd_add_extra_ie(struct hdd_adapter *adapter,
 				  uint8_t *genie, uint16_t *total_ielen,
 				  uint8_t temp_ie_id)
 {
-	struct hdd_beacon_data *beacon = adapter->session.ap.beacon;
+	struct hdd_beacon_data *beacon = adapter->deflink->session.ap.beacon;
 	int left = beacon->tail_len;
 	uint8_t *ptr = beacon->tail;
 	uint8_t elem_id, elem_len;
@@ -4744,7 +4747,7 @@ wlan_hdd_cfg80211_alloc_new_beacon(struct hdd_adapter *adapter,
 		return -EINVAL;
 	}
 
-	old = adapter->session.ap.beacon;
+	old = adapter->deflink->session.ap.beacon;
 
 	if (!params->head && !old) {
 		hdd_err("session: %d old and new heads points to NULL",
@@ -4820,7 +4823,7 @@ wlan_hdd_cfg80211_alloc_new_beacon(struct hdd_adapter *adapter,
 
 	*out_beacon = beacon;
 
-	adapter->session.ap.beacon = NULL;
+	adapter->deflink->session.ap.beacon = NULL;
 	qdf_mem_free(old);
 
 	return 0;
@@ -4923,8 +4926,8 @@ int wlan_hdd_cfg80211_update_apies(struct hdd_adapter *adapter)
 	uint8_t *proberesp_ies = NULL;
 	mac_handle_t mac_handle;
 
-	config = &adapter->session.ap.sap_config;
-	beacon = adapter->session.ap.beacon;
+	config = &adapter->deflink->session.ap.sap_config;
+	beacon = adapter->deflink->session.ap.beacon;
 	if (!beacon) {
 		hdd_err("Beacon is NULL !");
 		return -EINVAL;
@@ -5068,8 +5071,8 @@ done:
  */
 static void wlan_hdd_set_sap_hwmode(struct hdd_adapter *adapter)
 {
-	struct sap_config *config = &adapter->session.ap.sap_config;
-	struct hdd_beacon_data *beacon = adapter->session.ap.beacon;
+	struct sap_config *config = &adapter->deflink->session.ap.sap_config;
+	struct hdd_beacon_data *beacon = adapter->deflink->session.ap.beacon;
 	struct ieee80211_mgmt *mgmt_frame =
 		(struct ieee80211_mgmt *)beacon->head;
 	u8 checkRatesfor11g = true;
@@ -5148,7 +5151,7 @@ QDF_STATUS wlan_hdd_config_acs(struct hdd_context *hdd_ctx,
 	mac_handle_t mac_handle;
 
 	mac_handle = hdd_ctx->mac_handle;
-	sap_config = &adapter->session.ap.sap_config;
+	sap_config = &adapter->deflink->session.ap.sap_config;
 	ini_config = hdd_ctx->config;
 
 #ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
@@ -5161,7 +5164,7 @@ QDF_STATUS wlan_hdd_config_acs(struct hdd_context *hdd_ctx,
 
 		if (con_sap_adapter)
 			con_sap_config =
-				&con_sap_adapter->session.ap.sap_config;
+			    &con_sap_adapter->deflink->session.ap.sap_config;
 
 		sap_config->acs_cfg.skip_scan_status = eSAP_DO_NEW_ACS_SCAN;
 
@@ -5278,7 +5281,8 @@ QDF_STATUS wlan_hdd_config_acs(struct hdd_context *hdd_ctx,
  */
 static int wlan_hdd_sap_p2p_11ac_overrides(struct hdd_adapter *ap_adapter)
 {
-	struct sap_config *sap_cfg = &ap_adapter->session.ap.sap_config;
+	struct sap_config *sap_cfg =
+			&ap_adapter->deflink->session.ap.sap_config;
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(ap_adapter);
 	uint8_t ch_width;
 	uint8_t sub_20_chan_width;
@@ -5962,9 +5966,9 @@ static QDF_STATUS wlan_hdd_mlo_update(struct hdd_context *hdd_ctx,
 void wlan_hdd_mlo_reset(struct hdd_adapter *adapter)
 {
 	if (wlan_vdev_mlme_is_mlo_ap(adapter->vdev)) {
-		adapter->session.ap.sap_config.mlo_sap = false;
-		adapter->session.ap.sap_config.link_id = 0;
-		adapter->session.ap.sap_config.num_link = 0;
+		adapter->deflink->session.ap.sap_config.mlo_sap = false;
+		adapter->deflink->session.ap.sap_config.link_id = 0;
+		adapter->deflink->session.ap.sap_config.num_link = 0;
 		mlo_ap_vdev_detach(adapter->vdev);
 	}
 }
@@ -6101,7 +6105,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 
 	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
 
-	config = &adapter->session.ap.sap_config;
+	config = &adapter->deflink->session.ap.sap_config;
 	if (!config->chan_freq) {
 		hdd_err("Invalid channel");
 		ret = -EINVAL;
@@ -6132,7 +6136,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 					REASON_OPER_CHANNEL_DISABLED_INDOOR);
 	}
 
-	beacon = adapter->session.ap.beacon;
+	beacon = adapter->deflink->session.ap.beacon;
 
 	/*
 	 * beacon_fixed_len is the fixed length of beacon
@@ -6749,7 +6753,7 @@ error:
 		sme_update_channel_list(mac_handle);
 	}
 	clear_bit(SOFTAP_INIT_DONE, &adapter->event_flags);
-	qdf_atomic_set(&adapter->session.ap.acs_in_progress, 0);
+	qdf_atomic_set(&adapter->deflink->session.ap.acs_in_progress, 0);
 	wlansap_reset_sap_config_add_ie(config, eUPDATE_IE_ALL);
 
 free:
@@ -6773,27 +6777,27 @@ deliver_start_err:
 
 int hdd_destroy_acs_timer(struct hdd_adapter *adapter)
 {
+	struct hdd_ap_ctx *ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter);
 	QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE;
 
-	if (!adapter->session.ap.vendor_acs_timer_initialized)
+	if (!ap_ctx->vendor_acs_timer_initialized)
 		return 0;
 
-	adapter->session.ap.vendor_acs_timer_initialized = false;
+	ap_ctx->vendor_acs_timer_initialized = false;
 
 	clear_bit(VENDOR_ACS_RESPONSE_PENDING, &adapter->event_flags);
 	if (QDF_TIMER_STATE_RUNNING ==
-			adapter->session.ap.vendor_acs_timer.state) {
+			ap_ctx->vendor_acs_timer.state) {
 		qdf_status =
-			qdf_mc_timer_stop(&adapter->session.ap.
-					vendor_acs_timer);
+			qdf_mc_timer_stop(&ap_ctx->vendor_acs_timer);
 		if (!QDF_IS_STATUS_SUCCESS(qdf_status))
 			hdd_err("Failed to stop ACS timer");
 	}
 
-	if (adapter->session.ap.vendor_acs_timer.user_data)
-		qdf_mem_free(adapter->session.ap.vendor_acs_timer.user_data);
+	if (ap_ctx->vendor_acs_timer.user_data)
+		qdf_mem_free(ap_ctx->vendor_acs_timer.user_data);
 
-	qdf_mc_timer_destroy(&adapter->session.ap.vendor_acs_timer);
+	qdf_mc_timer_destroy(&ap_ctx->vendor_acs_timer);
 
 	return 0;
 }
@@ -6871,9 +6875,9 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
 	}
 
 	cds_flush_work(&adapter->sap_stop_bss_work);
-	adapter->session.ap.sap_config.acs_cfg.acs_mode = false;
+	adapter->deflink->session.ap.sap_config.acs_cfg.acs_mode = false;
 	hdd_dcs_clear(adapter);
-	qdf_atomic_set(&adapter->session.ap.acs_in_progress, 0);
+	qdf_atomic_set(&adapter->deflink->session.ap.acs_in_progress, 0);
 	hdd_debug("Disabling queues");
 	wlan_hdd_netif_queue_control(adapter,
 				     WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER,
@@ -6921,9 +6925,9 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
 			hdd_err("Stopping the BSS failed");
 			goto exit;
 		}
-		if (adapter->session.ap.beacon) {
-			qdf_mem_free(adapter->session.ap.beacon);
-			adapter->session.ap.beacon = NULL;
+		if (adapter->deflink->session.ap.beacon) {
+			qdf_mem_free(adapter->deflink->session.ap.beacon);
+			adapter->deflink->session.ap.beacon = NULL;
 		}
 	} else {
 		hdd_debug("SAP already down");
@@ -6969,9 +6973,9 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
 					    FTM_TIME_SYNC_BSS_STOPPED);
 
 exit:
-	if (adapter->session.ap.beacon) {
-		qdf_mem_free(adapter->session.ap.beacon);
-		adapter->session.ap.beacon = NULL;
+	if (adapter->deflink->session.ap.beacon) {
+		qdf_mem_free(adapter->deflink->session.ap.beacon);
+		adapter->deflink->session.ap.beacon = NULL;
 	}
 	if (QDF_IS_STATUS_SUCCESS(status))
 		hdd_place_marker(adapter, "STOP with SUCCESS", NULL);
@@ -7090,18 +7094,19 @@ static void hdd_update_beacon_rate(struct hdd_adapter *adapter,
 		struct wiphy *wiphy,
 		struct cfg80211_ap_settings *params)
 {
+	struct hdd_ap_ctx *ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter);
 	struct cfg80211_bitrate_mask *beacon_rate_mask;
 	enum nl80211_band band;
 
 	band = ieee80211_channel_band(params->chandef.chan);
 	beacon_rate_mask = &params->beacon_rate;
 	if (beacon_rate_mask->control[band].legacy) {
-		adapter->session.ap.sap_config.beacon_tx_rate =
+		ap_ctx->sap_config.beacon_tx_rate =
 			hdd_get_data_rate_from_rate_mask(wiphy, band,
 					beacon_rate_mask);
 		hdd_debug("beacon mask value %u, rate %hu",
 			  params->beacon_rate.control[0].legacy,
-			  adapter->session.ap.sap_config.beacon_tx_rate);
+			  ap_ctx->sap_config.beacon_tx_rate);
 	}
 }
 #else
@@ -7378,7 +7383,7 @@ wlan_hdd_update_twt_responder(struct hdd_adapter *adapter,
 {
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 
-	adapter->session.ap.sap_config.cfg80211_twt_responder =
+	adapter->deflink->session.ap.sap_config.cfg80211_twt_responder =
 							params->twt_responder;
 	wlan_hdd_configure_twt_responder(hdd_ctx, params->twt_responder);
 }
@@ -7587,13 +7592,13 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
 		policy_mgr_init_sap_mandatory_chan(hdd_ctx->psoc,
 						   chandef->chan->center_freq);
 
-	adapter->session.ap.sap_config.ch_params.center_freq_seg0 =
+	adapter->deflink->session.ap.sap_config.ch_params.center_freq_seg0 =
 				cds_freq_to_chan(chandef->center_freq1);
-	adapter->session.ap.sap_config.ch_params.center_freq_seg1 =
+	adapter->deflink->session.ap.sap_config.ch_params.center_freq_seg1 =
 				cds_freq_to_chan(chandef->center_freq2);
-	adapter->session.ap.sap_config.ch_params.mhz_freq_seg0 =
+	adapter->deflink->session.ap.sap_config.ch_params.mhz_freq_seg0 =
 							chandef->center_freq1;
-	adapter->session.ap.sap_config.ch_params.mhz_freq_seg1 =
+	adapter->deflink->session.ap.sap_config.ch_params.mhz_freq_seg1 =
 							chandef->center_freq2;
 
 	status = policy_mgr_is_sap_allowed_on_dfs_freq(
@@ -7635,7 +7640,8 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
 	if (cds_is_sub_20_mhz_enabled()) {
 		enum channel_state ch_state;
 		enum phy_ch_width sub_20_ch_width = CH_WIDTH_INVALID;
-		struct sap_config *sap_cfg = &adapter->session.ap.sap_config;
+		struct sap_config *sap_cfg =
+				&adapter->deflink->session.ap.sap_config;
 		struct ch_params ch_params;
 
 		if (CHANNEL_STATE_DFS ==
@@ -7773,7 +7779,7 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
 		struct sap_config *sap_config =
 			&((WLAN_HDD_GET_AP_CTX_PTR(adapter))->sap_config);
 
-		old = adapter->session.ap.beacon;
+		old = adapter->deflink->session.ap.beacon;
 
 		if (old)
 			return -EALREADY;
@@ -7787,7 +7793,7 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
 			hdd_err("Error!!! Allocating the new beacon");
 			return -EINVAL;
 		}
-		adapter->session.ap.beacon = new;
+		adapter->deflink->session.ap.beacon = new;
 
 		if (chandef->width < NL80211_CHAN_WIDTH_80)
 			channel_type = cfg80211_get_chandef_type(
@@ -7805,18 +7811,18 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
 		/* set authentication type */
 		switch (params->auth_type) {
 		case NL80211_AUTHTYPE_OPEN_SYSTEM:
-			adapter->session.ap.sap_config.authType =
+			adapter->deflink->session.ap.sap_config.authType =
 				eSAP_OPEN_SYSTEM;
 			break;
 		case NL80211_AUTHTYPE_SHARED_KEY:
-			adapter->session.ap.sap_config.authType =
+			adapter->deflink->session.ap.sap_config.authType =
 				eSAP_SHARED_KEY;
 			break;
 		default:
-			adapter->session.ap.sap_config.authType =
+			adapter->deflink->session.ap.sap_config.authType =
 				eSAP_AUTO_SWITCH;
 		}
-		adapter->session.ap.sap_config.ch_width_orig =
+		adapter->deflink->session.ap.sap_config.ch_width_orig =
 					hdd_map_nl_chan_width(chandef->width);
 
 		/*
@@ -7881,9 +7887,9 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
 
 err_start_bss:
 	hdd_place_marker(adapter, "START with FAILURE", NULL);
-	if (adapter->session.ap.beacon)
-		qdf_mem_free(adapter->session.ap.beacon);
-	adapter->session.ap.beacon = NULL;
+	if (adapter->deflink->session.ap.beacon)
+		qdf_mem_free(adapter->deflink->session.ap.beacon);
+	adapter->deflink->session.ap.beacon = NULL;
 
 success:
 	if (QDF_IS_STATUS_SUCCESS(status))
@@ -7963,7 +7969,7 @@ static int __wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy,
 		return -EOPNOTSUPP;
 	}
 
-	old = adapter->session.ap.beacon;
+	old = adapter->deflink->session.ap.beacon;
 
 	if (!old) {
 		hdd_err("session id: %d beacon data points to NULL",
@@ -7978,7 +7984,7 @@ static int __wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy,
 		return -EINVAL;
 	}
 
-	adapter->session.ap.beacon = new;
+	adapter->deflink->session.ap.beacon = new;
 	hdd_debug("update beacon for P2P GO/SAP");
 	status = wlan_hdd_cfg80211_start_bss(adapter, params, NULL,
 					0, 0, false);
@@ -8121,7 +8127,8 @@ bool hdd_sap_is_acs_in_progress(struct wlan_objmgr_vdev *vdev)
 		return in_progress;
 	}
 
-	in_progress = qdf_atomic_read(&adapter->session.ap.acs_in_progress);
+	in_progress = qdf_atomic_read(
+				&adapter->deflink->session.ap.acs_in_progress);
 
 	return in_progress;
 }

+ 3 - 3
core/hdd/src/wlan_hdd_hostapd_wext.c

@@ -635,7 +635,7 @@ static __iw_softap_setparam(struct net_device *dev,
 	{
 		uint8_t preamble = 0, nss = 0, rix = 0;
 		struct sap_config *config =
-			&adapter->session.ap.sap_config;
+			&adapter->deflink->session.ap.sap_config;
 
 		hdd_debug("SET_HT_RATE val %d", set_value);
 
@@ -698,7 +698,7 @@ static __iw_softap_setparam(struct net_device *dev,
 	{
 		uint8_t preamble = 0, nss = 0, rix = 0;
 		struct sap_config *config =
-			&adapter->session.ap.sap_config;
+			&adapter->deflink->session.ap.sap_config;
 
 		if (config->SapHw_mode < eCSR_DOT11_MODE_11ac ||
 		    config->SapHw_mode == eCSR_DOT11_MODE_11ax_ONLY ||
@@ -1009,7 +1009,7 @@ static __iw_softap_setparam(struct net_device *dev,
 		break;
 	case QCASAP_SET_11AX_RATE:
 		ret = hdd_set_11ax_rate(adapter, set_value,
-					&adapter->session.ap.
+					&adapter->deflink->session.ap.
 					sap_config);
 		break;
 	case QCASAP_PARAM_DCM:

+ 1 - 1
core/hdd/src/wlan_hdd_ioctl.c

@@ -6393,7 +6393,7 @@ static void disconnect_sta_and_restart_sap(struct hdd_context *hdd_ctx,
 		if (!hdd_validate_adapter(adapter) &&
 		    adapter->device_mode == QDF_SAP_MODE) {
 			if (check_disable_channels(hdd_ctx,
-				adapter->session.ap.operating_chan_freq))
+			    adapter->deflink->session.ap.operating_chan_freq))
 				policy_mgr_check_sap_restart(hdd_ctx->psoc,
 							     adapter->vdev_id);
 		}

+ 41 - 36
core/hdd/src/wlan_hdd_main.c

@@ -502,9 +502,10 @@ QDF_STATUS hdd_common_roam_callback(struct wlan_objmgr_psoc *psoc,
 		break;
 	case QDF_SAP_MODE:
 	case QDF_P2P_GO_MODE:
-		status = wlansap_roam_callback(adapter->session.ap.sap_context,
-					       roam_info, roam_status,
-					       roam_result);
+		status = wlansap_roam_callback(
+				adapter->deflink->session.ap.sap_context,
+				roam_info, roam_status,
+				roam_result);
 		break;
 	default:
 		hdd_err("Wrong device mode");
@@ -655,11 +656,13 @@ uint32_t hdd_get_adapter_home_channel(struct hdd_adapter *adapter)
 	if ((adapter->device_mode == QDF_SAP_MODE ||
 	     adapter->device_mode == QDF_P2P_GO_MODE) &&
 	    test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
-		home_chan_freq = adapter->session.ap.operating_chan_freq;
+		home_chan_freq =
+			adapter->deflink->session.ap.operating_chan_freq;
 	} else if ((adapter->device_mode == QDF_STA_MODE ||
 		    adapter->device_mode == QDF_P2P_CLIENT_MODE) &&
 		   hdd_cm_is_vdev_associated(adapter)) {
-		home_chan_freq = adapter->session.station.conn_info.chan_freq;
+		home_chan_freq =
+			adapter->deflink->session.station.conn_info.chan_freq;
 	}
 
 	return home_chan_freq;
@@ -679,11 +682,12 @@ enum phy_ch_width hdd_get_adapter_width(struct hdd_adapter *adapter)
 	if ((adapter->device_mode == QDF_SAP_MODE ||
 	     adapter->device_mode == QDF_P2P_GO_MODE) &&
 	    test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
-		width = adapter->session.ap.sap_config.ch_params.ch_width;
+		width =
+		adapter->deflink->session.ap.sap_config.ch_params.ch_width;
 	} else if ((adapter->device_mode == QDF_STA_MODE ||
 		    adapter->device_mode == QDF_P2P_CLIENT_MODE) &&
 		   hdd_cm_is_vdev_associated(adapter)) {
-		width = adapter->session.station.conn_info.ch_width;
+		width = adapter->deflink->session.station.conn_info.ch_width;
 	}
 	return width;
 }
@@ -6016,7 +6020,6 @@ hdd_alloc_station_adapter(struct hdd_context *hdd_ctx, tSirMacAddr mac_addr,
 {
 	struct net_device *dev;
 	struct hdd_adapter *adapter;
-	struct hdd_station_ctx *sta_ctx;
 	QDF_STATUS qdf_status;
 	uint8_t latency_level;
 
@@ -6038,10 +6041,8 @@ hdd_alloc_station_adapter(struct hdd_context *hdd_ctx, tSirMacAddr mac_addr,
 	adapter = netdev_priv(dev);
 
 	qdf_mem_zero(adapter, sizeof(*adapter));
-	sta_ctx = &adapter->session.station;
-	qdf_mem_zero(sta_ctx->conn_info.peer_macaddr,
-		     sizeof(sta_ctx->conn_info.peer_macaddr));
 	adapter->dev = dev;
+	adapter->deflink = &adapter->link_info[0];
 	adapter->hdd_ctx = hdd_ctx;
 	adapter->magic = WLAN_HDD_ADAPTER_MAGIC;
 	adapter->vdev_id = WLAN_UMAC_VDEV_ID_MAX;
@@ -6629,7 +6630,7 @@ hdd_vdev_destroy_procedure:
  */
 QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter)
 {
-	struct hdd_station_ctx *sta_ctx = &adapter->session.station;
+	struct hdd_station_ctx *sta_ctx = &adapter->deflink->session.station;
 	struct hdd_context *hdd_ctx;
 	QDF_STATUS status;
 	int ret_val;
@@ -8247,7 +8248,7 @@ QDF_STATUS hdd_stop_adapter_ext(struct hdd_context *hdd_ctx,
 		if (QDF_IS_STATUS_ERROR(status))
 			hdd_debug("Cannot flush PMKIDCache");
 
-		sap_config = &adapter->session.ap.sap_config;
+		sap_config = &adapter->deflink->session.ap.sap_config;
 		wlansap_reset_sap_config_add_ie(sap_config, eUPDATE_IE_ALL);
 
 		ucfg_ipa_flush(hdd_ctx->pdev);
@@ -8267,7 +8268,8 @@ QDF_STATUS hdd_stop_adapter_ext(struct hdd_context *hdd_ctx,
 		wlansap_cleanup_cac_timer(sap_ctx);
 
 		cds_flush_work(&adapter->sap_stop_bss_work);
-		if (qdf_atomic_read(&adapter->session.ap.acs_in_progress)) {
+		if (qdf_atomic_read(
+			&adapter->deflink->session.ap.acs_in_progress)) {
 			hdd_info("ACS in progress, wait for complete");
 			qdf_wait_for_event_completion(
 				&adapter->acs_complete_event,
@@ -8344,8 +8346,8 @@ QDF_STATUS hdd_stop_adapter_ext(struct hdd_context *hdd_ctx,
 		 */
 		if (!cds_is_driver_recovering()) {
 			clear_bit(SOFTAP_INIT_DONE, &adapter->event_flags);
-			qdf_mem_free(adapter->session.ap.beacon);
-			adapter->session.ap.beacon = NULL;
+			qdf_mem_free(adapter->deflink->session.ap.beacon);
+			adapter->deflink->session.ap.beacon = NULL;
 		}
 
 		/* Clear all the cached sta info */
@@ -8557,7 +8559,8 @@ static void hdd_reset_scan_operation(struct hdd_context *hdd_ctx,
 		wlan_hdd_cleanup_remain_on_channel_ctx(adapter);
 		break;
 	case QDF_SAP_MODE:
-		qdf_atomic_set(&adapter->session.ap.acs_in_progress, 0);
+		qdf_atomic_set(&adapter->deflink->session.ap.acs_in_progress,
+			       0);
 		break;
 	default:
 		break;
@@ -11639,17 +11642,17 @@ int hdd_update_acs_timer_reason(struct hdd_adapter *adapter, uint8_t reason)
 
 	set_bit(VENDOR_ACS_RESPONSE_PENDING, &adapter->event_flags);
 
-	if (QDF_TIMER_STATE_RUNNING ==
-	    qdf_mc_timer_get_current_state(&adapter->session.
-					ap.vendor_acs_timer)) {
-		qdf_mc_timer_stop(&adapter->session.ap.vendor_acs_timer);
+	if (QDF_TIMER_STATE_RUNNING == qdf_mc_timer_get_current_state(
+			&adapter->deflink->session.ap.vendor_acs_timer)) {
+		qdf_mc_timer_stop(
+			&adapter->deflink->session.ap.vendor_acs_timer);
 	}
 	timer_context = (struct hdd_external_acs_timer_context *)
-			adapter->session.ap.vendor_acs_timer.user_data;
+			adapter->deflink->session.ap.vendor_acs_timer.user_data;
 	timer_context->reason = reason;
-	qdf_status =
-		qdf_mc_timer_start(&adapter->session.ap.vendor_acs_timer,
-				   WLAN_VENDOR_ACS_WAIT_TIME);
+	qdf_status = qdf_mc_timer_start(
+				&adapter->deflink->session.ap.vendor_acs_timer,
+				WLAN_VENDOR_ACS_WAIT_TIME);
 	if (qdf_status != QDF_STATUS_SUCCESS) {
 		hdd_err("failed to start external acs timer");
 		return -ENOSPC;
@@ -11723,6 +11726,7 @@ hdd_store_sap_restart_channel(qdf_freq_t restart_chan, qdf_freq_t *restart_chan_
 void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt)
 {
 	struct hdd_adapter *adapter, *next_adapter = NULL;
+	struct hdd_ap_ctx *ap_ctx = NULL;
 	uint32_t i;
 	bool found = false;
 	qdf_freq_t restart_chan_store[SAP_MAX_NUM_SESSION] = {0};
@@ -11737,16 +11741,17 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt)
 
 	hdd_for_each_adapter_dev_held_safe(hdd_ctxt, adapter, next_adapter,
 					   dbgid) {
+		ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter);
 		if (!(adapter->device_mode == QDF_SAP_MODE &&
-		    adapter->session.ap.sap_config.acs_cfg.acs_mode)) {
+		    ap_ctx->sap_config.acs_cfg.acs_mode)) {
 			hdd_debug_rl("skip device mode:%d acs:%d",
 				     adapter->device_mode,
-			adapter->session.ap.sap_config.acs_cfg.acs_mode);
+				     ap_ctx->sap_config.acs_cfg.acs_mode);
 			hdd_adapter_dev_put_debug(adapter, dbgid);
 			continue;
 		}
 
-		ap_chan_freq = adapter->session.ap.operating_chan_freq;
+		ap_chan_freq = adapter->deflink->session.ap.operating_chan_freq;
 
 		found = false;
 		status =
@@ -11760,11 +11765,11 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt)
 		 */
 		if ((policy_mgr_is_sta_sap_scc(
 		    hdd_ctxt->psoc,
-		    adapter->session.ap.operating_chan_freq) &&
+		    adapter->deflink->session.ap.operating_chan_freq) &&
 		    scc_on_lte_coex) ||
 		    policy_mgr_nan_sap_scc_on_unsafe_ch_chk(
 		    hdd_ctxt->psoc,
-		    adapter->session.ap.operating_chan_freq)) {
+		    adapter->deflink->session.ap.operating_chan_freq)) {
 			hdd_debug("SAP allowed in unsafe SCC channel");
 		} else {
 			for (i = 0; i < hdd_ctxt->unsafe_channel_count; i++) {
@@ -13199,7 +13204,7 @@ int hdd_start_ap_adapter(struct hdd_adapter *adapter)
 	 * vdev as while creating the vdev, driver needs to
 	 * register SAP callback and that callback uses sap context
 	 */
-	if (adapter->session.ap.sap_context) {
+	if (adapter->deflink->session.ap.sap_context) {
 		is_ssr = true;
 	} else if (!hdd_sap_create_ctx(adapter)) {
 		hdd_err("sap creation failed");
@@ -16678,7 +16683,7 @@ void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit)
 	hdd_ctx = WLAN_HDD_GET_CTX(ap_adapter);
 	hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(ap_adapter);
 	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(ap_adapter);
-	sap_config = &ap_adapter->session.ap.sap_config;
+	sap_config = &ap_adapter->deflink->session.ap.sap_config;
 
 	mutex_lock(&hdd_ctx->sap_lock);
 	if (test_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags))
@@ -16738,9 +16743,9 @@ end:
 	 */
 	hdd_err("SAP restart after SSR failed! Reload WLAN and try SAP again");
 	/* Free the beacon memory in case of failure in the sap restart */
-	if (ap_adapter->session.ap.beacon) {
-		qdf_mem_free(ap_adapter->session.ap.beacon);
-		ap_adapter->session.ap.beacon = NULL;
+	if (ap_adapter->deflink->session.ap.beacon) {
+		qdf_mem_free(ap_adapter->deflink->session.ap.beacon);
+		ap_adapter->deflink->session.ap.beacon = NULL;
 	}
 }
 
@@ -19434,7 +19439,7 @@ void hdd_check_and_restart_sap_with_non_dfs_acs(void)
 	    test_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags) &&
 	    wlan_reg_is_dfs_for_freq(
 			hdd_ctx->pdev,
-			ap_adapter->session.ap.operating_chan_freq)) {
+			ap_adapter->deflink->session.ap.operating_chan_freq)) {
 		if (policy_mgr_get_dfs_master_dynamic_enabled(
 				hdd_ctx->psoc, ap_adapter->vdev_id))
 			return;

+ 1 - 1
core/hdd/src/wlan_hdd_medium_assess.c

@@ -209,7 +209,7 @@ static int hdd_medium_assess_cca(struct hdd_context *hdd_ctx,
 		goto out;
 	}
 
-	if (qdf_atomic_read(&adapter->session.ap.acs_in_progress)) {
+	if (qdf_atomic_read(&adapter->deflink->session.ap.acs_in_progress)) {
 		hdd_err_rl("ACS is in progress");
 		errno = -EBUSY;
 		goto out;

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

@@ -1878,7 +1878,8 @@ static void wlan_hdd_set_twt_responder(struct hdd_context *hdd_ctx,
 {
 	bool twt_responder;
 
-	twt_responder = adapter->session.ap.sap_config.cfg80211_twt_responder;
+	twt_responder =
+		adapter->deflink->session.ap.sap_config.cfg80211_twt_responder;
 	wlan_hdd_configure_twt_responder(hdd_ctx, twt_responder);
 }
 #else

+ 15 - 15
core/hdd/src/wlan_hdd_pre_cac.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -340,18 +340,18 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
 	 * other active SAP interface. In regular scenarios, these IEs would
 	 * come from the user space entity
 	 */
-	pre_cac_adapter->session.ap.beacon = qdf_mem_malloc(
-			sizeof(*ap_adapter->session.ap.beacon));
-	if (!pre_cac_adapter->session.ap.beacon)
+	pre_cac_adapter->deflink->session.ap.beacon = qdf_mem_malloc(
+			sizeof(*ap_adapter->deflink->session.ap.beacon));
+	if (!pre_cac_adapter->deflink->session.ap.beacon)
 		goto stop_close_pre_cac_adapter;
 
-	qdf_mem_copy(pre_cac_adapter->session.ap.beacon,
-		     ap_adapter->session.ap.beacon,
-		     sizeof(*pre_cac_adapter->session.ap.beacon));
-	pre_cac_adapter->session.ap.sap_config.ch_width_orig =
-			ap_adapter->session.ap.sap_config.ch_width_orig;
-	pre_cac_adapter->session.ap.sap_config.authType =
-			ap_adapter->session.ap.sap_config.authType;
+	qdf_mem_copy(pre_cac_adapter->deflink->session.ap.beacon,
+		     ap_adapter->deflink->session.ap.beacon,
+		     sizeof(*pre_cac_adapter->deflink->session.ap.beacon));
+	pre_cac_adapter->deflink->session.ap.sap_config.ch_width_orig =
+		ap_adapter->deflink->session.ap.sap_config.ch_width_orig;
+	pre_cac_adapter->deflink->session.ap.sap_config.authType =
+			ap_adapter->deflink->session.ap.sap_config.authType;
 
 	/* The original premise is that on moving from 2.4GHz to 5GHz, the SAP
 	 * will continue to operate on the same bandwidth as that of the 2.4GHz
@@ -372,11 +372,11 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
 		hdd_err("error set pre_cac channel %d", pre_cac_chan_freq);
 		goto close_pre_cac_adapter;
 	}
-	pre_cac_adapter->session.ap.sap_config.ch_width_orig =
+	pre_cac_adapter->deflink->session.ap.sap_config.ch_width_orig =
 					hdd_map_nl_chan_width(chandef.width);
 
 	hdd_debug("existing ap phymode:%d pre cac ch_width:%d freq:%d",
-		  ap_adapter->session.ap.sap_config.SapHw_mode,
+		  ap_adapter->deflink->session.ap.sap_config.SapHw_mode,
 		  cac_ch_width, pre_cac_chan_freq);
 	/*
 	 * Doing update after opening and starting pre-cac adapter will make
@@ -430,8 +430,8 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
 
 stop_close_pre_cac_adapter:
 	hdd_stop_adapter(hdd_ctx, pre_cac_adapter);
-	qdf_mem_free(pre_cac_adapter->session.ap.beacon);
-	pre_cac_adapter->session.ap.beacon = NULL;
+	qdf_mem_free(pre_cac_adapter->deflink->session.ap.beacon);
+	pre_cac_adapter->deflink->session.ap.beacon = NULL;
 close_pre_cac_adapter:
 	hdd_close_adapter(hdd_ctx, pre_cac_adapter, false);
 release_intf_addr_and_return_failure:

+ 1 - 1
core/hdd/src/wlan_hdd_regulatory.c

@@ -1800,7 +1800,7 @@ static void hdd_country_change_update_sap(struct hdd_context *hdd_ctx)
 				hdd_info("AP is not started yet");
 				break;
 			}
-			sap_config = &adapter->session.ap.sap_config;
+			sap_config = &adapter->deflink->session.ap.sap_config;
 			reg_phy_mode = csr_convert_to_reg_phy_mode(
 						sap_config->sap_orig_hw_mode,
 						oper_freq);

+ 10 - 11
core/hdd/src/wlan_hdd_scan.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -448,6 +448,7 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
 	int status;
 	struct hdd_scan_info *scan_info = NULL;
 	struct hdd_adapter *con_sap_adapter;
+	struct hdd_ap_ctx *ap_ctx;
 	qdf_freq_t con_dfs_ch_freq;
 	uint8_t curr_vdev_id;
 	enum scan_reject_states curr_reason;
@@ -516,13 +517,11 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
 
 	con_sap_adapter = hdd_get_con_sap_adapter(adapter, true);
 	if (con_sap_adapter) {
-		con_dfs_ch_freq =
-			con_sap_adapter->session.ap.sap_config.chan_freq;
-		con_dfs_ch_width =
-		      con_sap_adapter->session.ap.sap_config.ch_params.ch_width;
+		ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(con_sap_adapter);
+		con_dfs_ch_freq = ap_ctx->sap_config.chan_freq;
+		con_dfs_ch_width = ap_ctx->sap_config.ch_params.ch_width;
 		if (con_dfs_ch_freq == AUTO_CHANNEL_SELECT)
-			con_dfs_ch_freq =
-				con_sap_adapter->session.ap.operating_chan_freq;
+			con_dfs_ch_freq = ap_ctx->operating_chan_freq;
 
 		if (!policy_mgr_is_hw_dbs_capable(hdd_ctx->psoc) &&
 		    !policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan(
@@ -822,10 +821,10 @@ static void hdd_process_vendor_acs_response(struct hdd_adapter *adapter)
 {
 	if (test_bit(VENDOR_ACS_RESPONSE_PENDING, &adapter->event_flags)) {
 		if (QDF_TIMER_STATE_RUNNING ==
-		    qdf_mc_timer_get_current_state(&adapter->session.
-					ap.vendor_acs_timer)) {
-			qdf_mc_timer_stop(&adapter->session.
-					ap.vendor_acs_timer);
+		    qdf_mc_timer_get_current_state(
+			&adapter->deflink->session.ap.vendor_acs_timer)) {
+			qdf_mc_timer_stop(
+				&adapter->deflink->session.ap.vendor_acs_timer);
 		}
 	}
 }

+ 6 - 5
core/hdd/src/wlan_hdd_son.c

@@ -92,7 +92,8 @@ static uint32_t hdd_son_is_acs_in_progress(struct wlan_objmgr_vdev *vdev)
 		return in_progress;
 	}
 
-	in_progress = qdf_atomic_read(&adapter->session.ap.acs_in_progress);
+	in_progress = qdf_atomic_read(
+			&adapter->deflink->session.ap.acs_in_progress);
 
 	return in_progress;
 }
@@ -1929,12 +1930,12 @@ static int hdd_son_start_acs(struct wlan_objmgr_vdev *vdev, uint8_t enable)
 		hdd_err("null hdd_ctx");
 		return -EINVAL;
 	}
-	if (qdf_atomic_read(&adapter->session.ap.acs_in_progress)) {
+	if (qdf_atomic_read(&adapter->deflink->session.ap.acs_in_progress)) {
 		hdd_err("ACS is in-progress");
 		return -EAGAIN;
 	}
 	wlan_hdd_undo_acs(adapter);
-	sap_config = &adapter->session.ap.sap_config;
+	sap_config = &adapter->deflink->session.ap.sap_config;
 	hdd_debug("ACS Config country %s hw_mode %d ACS_BW: %d START_CH: %d END_CH: %d band %d",
 		  hdd_ctx->reg.alpha2, sap_config->acs_cfg.hw_mode,
 		  sap_config->acs_cfg.ch_width,
@@ -1999,7 +2000,7 @@ static int hdd_son_set_acs_channels(struct wlan_objmgr_vdev *vdev,
 		hdd_err("null hdd_ctx");
 		return -EINVAL;
 	}
-	sap_config = &adapter->session.ap.sap_config;
+	sap_config = &adapter->deflink->session.ap.sap_config;
 	/* initialize with default channels */
 	if (hdd_son_init_acs_channels(adapter, hdd_ctx, &sap_config->acs_cfg)
 						       != QDF_STATUS_SUCCESS) {
@@ -2216,7 +2217,7 @@ static int hdd_son_get_acs_report(struct wlan_objmgr_vdev *vdev,
 		goto end;
 	}
 	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
-	acs_cfg = &adapter->session.ap.sap_config.acs_cfg;
+	acs_cfg = &adapter->deflink->session.ap.sap_config.acs_cfg;
 	if (!acs_cfg->freq_list &&
 	    (hdd_son_init_acs_channels(adapter, hdd_ctx,
 				       acs_cfg) != QDF_STATUS_SUCCESS)) {

+ 2 - 2
core/hdd/src/wlan_hdd_stats.c

@@ -918,7 +918,7 @@ bool hdd_get_interface_info(struct hdd_adapter *adapter,
 	if ((adapter->device_mode == QDF_SAP_MODE) ||
 	    (adapter->device_mode == QDF_P2P_GO_MODE)) {
 		if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
-			config = &adapter->session.ap.sap_config;
+			config = &adapter->deflink->session.ap.sap_config;
 
 			qdf_copy_macaddr(&info->bssid,
 					 &config->self_macaddr);
@@ -7579,7 +7579,7 @@ void wlan_hdd_get_peer_rx_rate_stats(struct hdd_adapter *adapter)
 	if (!peer_stats)
 		return;
 
-	peer_mac_addr = adapter->session.station.conn_info.bssid.bytes;
+	peer_mac_addr = adapter->deflink->session.station.conn_info.bssid.bytes;
 
 	status = cdp_host_get_peer_stats(soc,
 					 adapter->vdev_id,

+ 1 - 1
core/hdd/src/wlan_hdd_tx_rx.c

@@ -501,7 +501,7 @@ static void __hdd_hard_start_xmit(struct sk_buff *skb,
 {
 	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
 	struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
-	struct hdd_station_ctx *sta_ctx = &adapter->session.station;
+	struct hdd_station_ctx *sta_ctx = &adapter->deflink->session.station;
 	int cpu = qdf_get_smp_processor_id();
 	bool granted;
 	sme_ac_enum_type ac;

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

@@ -3779,7 +3779,8 @@ static int hdd_we_set_11n_rate(struct hdd_adapter *adapter, int rate_code)
 	QDF_STATUS status;
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	enum wlan_phymode peer_phymode;
-	uint8_t *peer_mac = adapter->session.station.conn_info.bssid.bytes;
+	uint8_t *peer_mac =
+		adapter->deflink->session.station.conn_info.bssid.bytes;
 
 	hdd_debug("Rate code %d", rate_code);