Browse Source

qcacld-3.0: Reset HDD sta_ctx link info params after roam

Reset HDD sta_ctx link info parameters after roaming to
reset the values in case of roaming from 3/2 link AP
to 1 link ML AP

Change-Id: I5e8165e50b92eed476d16696c14d4db82192c4ed
CRs-Fixed: 3627330
Pragaspathi Thilagaraj 1 year ago
parent
commit
3b584aa20d

+ 1 - 1
components/wmi/src/wmi_unified_roam_tlv.c

@@ -2278,7 +2278,7 @@ wmi_fill_roam_mlo_info(wmi_unified_t wmi_handle,
 						   link->link_addr.bytes);
 			WMI_MAC_ADDR_TO_CHAR_ARRAY(&setup_links->self_link_addr,
 						   link->self_link_addr.bytes);
-			wmi_debug("link_id: %u vdev_id: %u flags: 0x%x addr:" QDF_MAC_ADDR_FMT "self_addr:" QDF_MAC_ADDR_FMT,
+			wmi_debug("link_id: %u vdev_id: %u flags: 0x%x addr: " QDF_MAC_ADDR_FMT " self_addr:" QDF_MAC_ADDR_FMT,
 				  link->link_id, link->vdev_id,
 				  link->flags,
 				  QDF_MAC_ADDR_REF(link->link_addr.bytes),

+ 3 - 1
core/hdd/src/wlan_hdd_cm_api.h

@@ -257,12 +257,14 @@ __hdd_cm_disconnect_handler_pre_user_update(struct wlan_hdd_link_info *link_info
  * after updating to user space
  * @link_info: Link info pointer in HDD adapter
  * @vdev: vdev ptr
+ * @source: Disconnect source
  *
  * Return: None
  */
 void
 __hdd_cm_disconnect_handler_post_user_update(struct wlan_hdd_link_info *link_info,
-					     struct wlan_objmgr_vdev *vdev);
+					     struct wlan_objmgr_vdev *vdev,
+					     enum wlan_cm_source source);
 
 /**
  * hdd_cm_set_peer_authenticate() - set peer as authenticated

+ 8 - 0
core/hdd/src/wlan_hdd_cm_connect.c

@@ -361,6 +361,8 @@ hdd_cm_set_ieee_link_id(struct wlan_hdd_link_info *link_info, uint8_t link_id)
 	struct hdd_station_ctx *sta_ctx =
 				WLAN_HDD_GET_STATION_CTX_PTR(link_info);
 
+	hdd_debug("old_link_id:%d new_link_id:%d",
+		  sta_ctx->conn_info.ieee_link_id, link_id);
 	sta_ctx->conn_info.ieee_link_id = link_id;
 }
 
@@ -370,6 +372,7 @@ hdd_cm_clear_ieee_link_id(struct wlan_hdd_link_info *link_info)
 	struct hdd_station_ctx *sta_ctx =
 				WLAN_HDD_GET_STATION_CTX_PTR(link_info);
 
+	hdd_debug("clear link id:%d", sta_ctx->conn_info.ieee_link_id);
 	sta_ctx->conn_info.ieee_link_id = WLAN_INVALID_LINK_ID;
 }
 #endif
@@ -1677,6 +1680,11 @@ hdd_cm_connect_success_pre_user_update(struct wlan_objmgr_vdev *vdev,
 			if (is_auth_required)
 				wlan_acquire_peer_key_wakelock(hdd_ctx->pdev,
 							      rsp->bssid.bytes);
+			/*
+			 * In case of roaming from 3 Link or 2 Link to 1 link
+			 * AP, then reset the STA context for other links
+			 */
+			hdd_adapter_reset_station_ctx(adapter);
 		}
 		hdd_debug("is_roam_offload %d, is_roam %d, is_auth_required %d",
 			  is_roam_offload, is_roam, is_auth_required);

+ 11 - 5
core/hdd/src/wlan_hdd_cm_disconnect.c

@@ -167,7 +167,8 @@ __hdd_cm_disconnect_handler_pre_user_update(struct wlan_hdd_link_info *link_info
 
 void
 __hdd_cm_disconnect_handler_post_user_update(struct wlan_hdd_link_info *link_info,
-					     struct wlan_objmgr_vdev *vdev)
+					     struct wlan_objmgr_vdev *vdev,
+					     enum wlan_cm_source source)
 {
 	struct hdd_adapter *adapter = link_info->adapter;
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
@@ -212,11 +213,15 @@ __hdd_cm_disconnect_handler_post_user_update(struct wlan_hdd_link_info *link_inf
 		}
 	}
 
-	if (!is_link_switch) {
+	if (!is_link_switch && source != CM_MLO_ROAM_INTERNAL_DISCONNECT) {
 		/* Clear saved connection information in HDD */
 		hdd_conn_remove_connect_info(sta_ctx);
-		/* Reset the IEEE link ID to invalid when disconnect is not
-		 * due to link switch.
+
+		/*
+		 * Reset the IEEE link ID to invalid when disconnect is not
+		 * due to link switch. This API resets link id for all the
+		 * valid link_info for the given adapter. So avoid this reset
+		 * for Link Switch disconnect/internal disconnect
 		 */
 		hdd_adapter_reset_station_ctx(adapter);
 	}
@@ -578,7 +583,8 @@ hdd_cm_disconnect_complete_post_user_update(struct wlan_objmgr_vdev *vdev,
 	 */
 	hdd_cm_restore_ch_width(vdev, adapter);
 	hdd_cm_set_default_wlm_mode(adapter);
-	__hdd_cm_disconnect_handler_post_user_update(link_info, vdev);
+	__hdd_cm_disconnect_handler_post_user_update(link_info, vdev,
+						     rsp->req.req.source);
 	wlan_twt_concurrency_update(hdd_ctx);
 	hdd_cm_reset_udp_qos_upgrade_config(adapter);
 	ucfg_mlme_set_ml_link_control_mode(hdd_ctx->psoc,

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

@@ -14658,9 +14658,14 @@ static void hdd_restore_info_for_ssr(struct hdd_adapter *adapter)
 void hdd_adapter_reset_station_ctx(struct hdd_adapter *adapter)
 {
 	struct wlan_hdd_link_info *link_info;
+	struct hdd_station_ctx *sta_ctx;
+
+	hdd_adapter_for_each_link_info(adapter, link_info) {
+		sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(link_info);
+		qdf_mem_zero(&sta_ctx->conn_info.bssid, QDF_MAC_ADDR_SIZE);
 
-	hdd_adapter_for_each_link_info(adapter, link_info)
 		hdd_cm_clear_ieee_link_id(link_info);
+	}
 }
 
 int hdd_start_station_adapter(struct hdd_adapter *adapter)