Sfoglia il codice sorgente

qcacld-3.0: Refactor HDD callers as per changes to cdp_clear_peer

Currently, the cdp API cdp_clear_peer takes as input the sta_id. As a
part of cleaning up the usage of sta_id, replace it by peer mac address.

Change-Id: I4f8bee21ae42d8c9929da8fe2fcfa534778647ed
CRs-Fixed: 2503139
Sourav Mohapatra 5 anni fa
parent
commit
ffbd027f6b

+ 27 - 3
core/hdd/inc/wlan_hdd_assoc.h

@@ -342,10 +342,24 @@ int hdd_set_csr_auth_type(struct hdd_adapter *adapter,
 QDF_STATUS hdd_roam_register_tdlssta(struct hdd_adapter *adapter,
 				     const uint8_t *peerMac, uint16_t staId,
 				     uint8_t qos);
+/**
+ * hdd_roam_deregister_tdlssta() - deregister new TDLS station
+ * @adapter: pointer to adapter
+ * @peer_mac: peer mac address
+ *
+ * Return: QDF_STATUS enumeration
+ */
+QDF_STATUS hdd_roam_deregister_tdlssta(struct hdd_adapter *adapter,
+				       struct qdf_mac_addr *peer_mac);
+
+#else
+inline QDF_STATUS hdd_roam_deregister_tdlssta(struct hdd_adapter *adapter,
+					      struct qdf_mac_addr *peer_mac)
+{
+	return QDF_STATUS_SUCCESS;
+}
 #endif
 
-QDF_STATUS hdd_roam_deregister_tdlssta(struct hdd_adapter *adapter,
-				       uint8_t staId);
 
 /**
  * hdd_perform_roam_set_key_complete() - perform set key complete
@@ -401,7 +415,17 @@ QDF_STATUS hdd_roam_register_sta(struct hdd_adapter *adapter,
 bool hdd_save_peer(struct hdd_station_ctx *sta_ctx, uint8_t sta_id,
 		   struct qdf_mac_addr *peer_mac_addr);
 void hdd_delete_peer(struct hdd_station_ctx *sta_ctx, uint8_t sta_id);
-QDF_STATUS hdd_roam_deregister_sta(struct hdd_adapter *adapter, uint8_t sta_id);
+
+/**
+ * hdd_roam_deregister_sta() - deregister station
+ * @adapter: pointer to adapter
+ * @sta_id: station identifier
+ * @mac_addr: peer mac address
+ *
+ * Return: QDF_STATUS enumeration
+ */
+QDF_STATUS hdd_roam_deregister_sta(struct hdd_adapter *adapter,
+				   struct qdf_mac_addr mac_addr);
 
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 QDF_STATUS

+ 3 - 1
core/hdd/inc/wlan_hdd_softap_tx_rx.h

@@ -126,11 +126,13 @@ QDF_STATUS hdd_softap_rx_packet_cbk(void *adapter_context, qdf_nbuf_t rx_buf);
  * hdd_softap_deregister_sta() - Deregister a STA with the Data Path
  * @adapter: pointer to adapter context
  * @sta_id: Station ID to deregister
+ * @mac_addr: Peer mac address
  *
  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
  */
 QDF_STATUS hdd_softap_deregister_sta(struct hdd_adapter *adapter,
-				     uint8_t sta_id);
+				     uint8_t sta_id,
+				     struct qdf_mac_addr mac_addr);
 
 /**
  * hdd_softap_register_sta() - Register a SoftAP STA

+ 2 - 2
core/hdd/inc/wlan_hdd_tdls.h

@@ -164,7 +164,7 @@ QDF_STATUS hdd_tdls_register_peer(void *userdata, uint32_t vdev_id,
 				  uint8_t qos);
 
 QDF_STATUS hdd_tdls_deregister_peer(void *userdata, uint32_t vdev_id,
-				    uint8_t sta_id);
+				    struct qdf_mac_addr *peer_mac);
 
 /**
  * hdd_init_tdls_config() - initialize tdls config
@@ -201,7 +201,7 @@ QDF_STATUS hdd_tdls_register_peer(void *userdata, uint32_t vdev_id,
 
 static inline
 QDF_STATUS hdd_tdls_deregister_peer(void *userdata, uint32_t vdev_id,
-				    uint8_t sta_id)
+				    struct qdf_mac_addr *peer_mac)
 {
 	return QDF_STATUS_SUCCESS;
 }

+ 18 - 33
core/hdd/src/wlan_hdd_assoc.c

@@ -1612,23 +1612,19 @@ static void hdd_clear_roam_profile_ie(struct hdd_adapter *adapter)
 	hdd_exit();
 }
 
-/**
- * hdd_roam_deregister_sta() - deregister station
- * @adapter: pointer to adapter
- * @sta_id: station identifier
- *
- * Return: QDF_STATUS enumeration
- */
-QDF_STATUS hdd_roam_deregister_sta(struct hdd_adapter *adapter, uint8_t sta_id)
+QDF_STATUS hdd_roam_deregister_sta(struct hdd_adapter *adapter,
+				   struct qdf_mac_addr mac_addr)
 {
 	QDF_STATUS qdf_status;
 
 	qdf_status = cdp_clear_peer(cds_get_context(QDF_MODULE_ID_SOC),
 			(struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX),
-			sta_id);
+			mac_addr);
 	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-		hdd_err("cdp_clear_peer() failed for sta_id %d. Status(%d) [0x%08X]",
-			sta_id, qdf_status, qdf_status);
+		hdd_err("cdp_clear_peer() failed for sta mac: "
+			QDF_MAC_ADDR_STR ". Status(%d) [0x%08X]",
+			QDF_MAC_ADDR_ARRAY(mac_addr.bytes),
+			qdf_status, qdf_status);
 	}
 
 	return qdf_status;
@@ -1832,7 +1828,8 @@ static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *adapter,
 		uint8_t i;
 
 		sta_id = sta_ctx->broadcast_sta_id;
-		vstatus = hdd_roam_deregister_sta(adapter, sta_id);
+		vstatus = hdd_roam_deregister_sta(adapter,
+						  sta_ctx->conn_info.bssid);
 		if (!QDF_IS_STATUS_SUCCESS(vstatus)) {
 			hdd_err("hdd_roam_deregister_sta() failed for staID %d Status: %d [0x%x]",
 					sta_id, status, status);
@@ -1849,7 +1846,9 @@ static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *adapter,
 				continue;
 			sta_id = sta_ctx->conn_info.sta_id[i];
 			hdd_debug("Deregister StaID %d", sta_id);
-			vstatus = hdd_roam_deregister_sta(adapter, sta_id);
+			vstatus = hdd_roam_deregister_sta(
+					adapter,
+					sta_ctx->conn_info.peer_macaddr[i]);
 			if (!QDF_IS_STATUS_SUCCESS(vstatus)) {
 				hdd_err("hdd_roam_deregister_sta() failed to for staID %d Status: %d [0x%x]",
 					sta_id, status, status);
@@ -4023,7 +4022,7 @@ roam_roam_connect_status_update_handler(struct hdd_adapter *adapter,
 			 QDF_MAC_ADDR_ARRAY(sta_ctx->conn_info.bssid.bytes),
 			 roam_info->staId);
 
-		hdd_roam_deregister_sta(adapter, roam_info->staId);
+		hdd_roam_deregister_sta(adapter, roam_info->peerMac);
 
 		if (roam_info->staId < HDD_MAX_ADAPTERS)
 			hdd_ctx->sta_to_adapter[roam_info->staId] = NULL;
@@ -4115,32 +4114,17 @@ QDF_STATUS hdd_roam_register_tdlssta(struct hdd_adapter *adapter,
 	return qdf_status;
 }
 
-/**
- * hdd_roam_deregister_tdlssta() - deregister new TDLS station
- * @adapter: pointer to adapter
- * @sta_id: station identifier
- *
- * Return: QDF_STATUS enumeration
- */
 QDF_STATUS hdd_roam_deregister_tdlssta(struct hdd_adapter *adapter,
-				       uint8_t sta_id)
+				       struct qdf_mac_addr *peer_mac)
 {
 	QDF_STATUS qdf_status;
 
 	qdf_status = cdp_clear_peer(cds_get_context(QDF_MODULE_ID_SOC),
 			(struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX),
-			sta_id);
+			*peer_mac);
 
 	return qdf_status;
 }
-
-#else
-
-inline QDF_STATUS hdd_roam_deregister_tdlssta(struct hdd_adapter *adapter,
-					      uint8_t sta_id)
-{
-	return QDF_STATUS_SUCCESS;
-}
 #endif
 
 #ifdef WLAN_FEATURE_11W
@@ -4768,8 +4752,9 @@ hdd_sme_roam_callback(void *context, struct csr_roam_info *roam_info,
 		wlan_hdd_netif_queue_control(adapter,
 				WLAN_STOP_ALL_NETIF_QUEUE,
 				WLAN_CONTROL_PATH);
-		status = hdd_roam_deregister_sta(adapter,
-					sta_ctx->conn_info.sta_id[0]);
+		status = hdd_roam_deregister_sta(
+					adapter,
+					sta_ctx->conn_info.peer_macaddr[0]);
 		if (!QDF_IS_STATUS_SUCCESS(status))
 			qdf_ret_status = QDF_STATUS_E_FAILURE;
 		sta_ctx->ft_carrier_on = true;

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

@@ -2362,7 +2362,9 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 						  WMA_DHCP_STOP_IND);
 			stainfo->dhcp_nego_status = DHCP_NEGO_STOP;
 		}
-		hdd_softap_deregister_sta(adapter, sta_id);
+		/* STA id will be removed as a part of Phase 2 cleanup */
+		hdd_softap_deregister_sta(adapter, sta_id,
+					  disassoc_comp->staMac);
 
 		ap_ctx->ap_active = false;
 		spin_lock_bh(&adapter->sta_info_lock);

+ 10 - 5
core/hdd/src/wlan_hdd_main.c

@@ -6044,7 +6044,7 @@ QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx,
 		sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
 		cdp_clear_peer(cds_get_context(QDF_MODULE_ID_SOC),
 			       cds_get_context(QDF_MODULE_ID_TXRX),
-			       sta_ctx->conn_info.sta_id[0]);
+			       sta_ctx->conn_info.peer_macaddr[0]);
 		hdd_deregister_hl_netdev_fc_timer(adapter);
 		hdd_deregister_tx_flow_control(adapter);
 		hdd_vdev_destroy(adapter);
@@ -6261,13 +6261,18 @@ QDF_STATUS hdd_reset_all_adapters(struct hdd_context *hdd_ctx)
 
 		} else if (adapter->device_mode == QDF_P2P_GO_MODE) {
 			clear_bit(SOFTAP_BSS_STARTED, &adapter->event_flags);
-			for (sta_id = 0; sta_id < WLAN_MAX_STA_COUNT; sta_id++) {
-				if (adapter->sta_info[sta_id].in_use) {
+			for (sta_id = 0; sta_id < WLAN_MAX_STA_COUNT;
+			     sta_id++) {
+				struct hdd_station_info sta =
+					adapter->sta_info[sta_id];
+				if (sta.in_use) {
 					hdd_debug("[SSR] deregister STA with ID %d",
 						  sta_id);
+					/* STA id will be removed */
 					hdd_softap_deregister_sta(adapter,
-								  sta_id);
-					adapter->sta_info[sta_id].in_use = 0;
+								  sta_id,
+								  sta.sta_mac);
+					sta.in_use = 0;
 				}
 			}
 		}

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

@@ -779,7 +779,7 @@ void hdd_ndi_drv_ndi_delete_rsp_handler(uint8_t vdev_id)
 	sta_id = sta_ctx->broadcast_sta_id;
 	if (sta_id < HDD_MAX_ADAPTERS) {
 		hdd_ctx->sta_to_adapter[sta_id] = NULL;
-		hdd_roam_deregister_sta(adapter, sta_id);
+		hdd_roam_deregister_sta(adapter, sta_ctx->requested_bssid);
 		hdd_delete_peer(sta_ctx, sta_id);
 		sta_ctx->broadcast_sta_id = HDD_WLAN_INVALID_STA_ID;
 	}
@@ -904,7 +904,7 @@ void hdd_ndp_peer_departed_handler(uint8_t vdev_id, uint16_t sta_id,
 		return;
 	}
 
-	hdd_roam_deregister_sta(adapter, sta_id);
+	hdd_roam_deregister_sta(adapter, *peer_mac_addr);
 	hdd_delete_peer(sta_ctx, sta_id);
 	hdd_ctx->sta_to_adapter[sta_id] = NULL;
 

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

@@ -995,7 +995,8 @@ QDF_STATUS hdd_softap_rx_packet_cbk(void *adapter_context, qdf_nbuf_t rx_buf)
 }
 
 QDF_STATUS hdd_softap_deregister_sta(struct hdd_adapter *adapter,
-				     uint8_t sta_id)
+				     uint8_t sta_id,
+				     struct qdf_mac_addr mac_addr)
 {
 	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
 	struct hdd_context *hdd_ctx;
@@ -1023,7 +1024,7 @@ QDF_STATUS hdd_softap_deregister_sta(struct hdd_adapter *adapter,
 	 */
 	qdf_status = cdp_clear_peer(cds_get_context(QDF_MODULE_ID_SOC),
 			(struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX),
-			sta_id);
+			mac_addr);
 	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
 		hdd_err("cdp_clear_peer failed for staID %d, Status=%d [0x%08X]",
 			sta_id, qdf_status, qdf_status);
@@ -1084,7 +1085,8 @@ QDF_STATUS hdd_softap_register_sta(struct hdd_adapter *adapter,
 	 */
 	if (adapter->sta_info[sta_id].in_use) {
 		hdd_info("clean up old entry for STA %d", sta_id);
-		hdd_softap_deregister_sta(adapter, sta_id);
+		hdd_softap_deregister_sta(adapter, sta_id,
+					  adapter->sta_info[sta_id].sta_mac);
 	}
 
 	/* Get the Station ID from the one saved during the association. */
@@ -1228,7 +1230,9 @@ static QDF_STATUS hdd_softap_deregister_bc_sta(struct hdd_adapter *adapter)
 	struct hdd_ap_ctx *ap_ctx;
 
 	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter);
-	return hdd_softap_deregister_sta(adapter, ap_ctx->broadcast_sta_id);
+
+	return hdd_softap_deregister_sta(adapter, ap_ctx->broadcast_sta_id,
+					 adapter->mac_addr);
 }
 
 QDF_STATUS hdd_softap_stop_bss(struct hdd_adapter *adapter)
@@ -1258,7 +1262,9 @@ QDF_STATUS hdd_softap_stop_bss(struct hdd_adapter *adapter)
 	for (sta_id = 0; sta_id < WLAN_MAX_STA_COUNT; sta_id++) {
 		/* This excludes BC sta as it is already deregistered */
 		if (adapter->sta_info[sta_id].in_use) {
-			status = hdd_softap_deregister_sta(adapter, sta_id);
+			status = hdd_softap_deregister_sta(
+					adapter, sta_id,
+					adapter->sta_info[sta_id].sta_mac);
 			if (!QDF_IS_STATUS_SUCCESS(status)) {
 				hdd_err("Failed to deregister sta Id %d",
 					sta_id);

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

@@ -856,7 +856,7 @@ QDF_STATUS hdd_tdls_register_peer(void *userdata, uint32_t vdev_id,
 }
 
 QDF_STATUS hdd_tdls_deregister_peer(void *userdata, uint32_t vdev_id,
-				    uint8_t sta_id)
+				    struct qdf_mac_addr *peer_mac)
 {
 	struct hdd_adapter *adapter;
 	struct hdd_context *hddctx;
@@ -872,7 +872,7 @@ QDF_STATUS hdd_tdls_deregister_peer(void *userdata, uint32_t vdev_id,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	return hdd_roam_deregister_tdlssta(adapter, sta_id);
+	return hdd_roam_deregister_tdlssta(adapter, peer_mac);
 }
 
 void hdd_init_tdls_config(struct tdls_start_params *tdls_cfg)