فهرست منبع

qcacld-3.0: Refactor hdd_clear_all_sta()

Function hdd_clear_all_sta() is not as "clean" as it could be so
refactor it.

Change-Id: I6cba74464a8b7d9536f931c16f5100dd8072fcba
CRs-Fixed: 2134919
Jeff Johnson 7 سال پیش
والد
کامیت
e4b24877f9
1فایلهای تغییر یافته به همراه25 افزوده شده و 16 حذف شده
  1. 25 16
      core/hdd/src/wlan_hdd_hostapd.c

+ 25 - 16
core/hdd/src/wlan_hdd_hostapd.c

@@ -660,27 +660,36 @@ static void hdd_hostapd_inactivity_timer_cb(void *context)
 	EXIT();
 }
 
-static void hdd_clear_all_sta(struct hdd_adapter *adapter)
+static void hdd_clear_sta(struct hdd_adapter *adapter, uint8_t sta_id)
 {
-	uint8_t staId = 0;
-	struct tagCsrDelStaParams del_sta_params;
 	struct hdd_ap_ctx *ap_ctx;
+	struct hdd_station_info *sta_info;
+	struct tagCsrDelStaParams del_sta_params;
 
-	hdd_debug("Clearing all the STA entry....");
 	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter);
-	for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) {
-		if (adapter->sta_info[staId].in_use &&
-		    (staId != ap_ctx->broadcast_sta_id)) {
-			wlansap_populate_del_sta_params(
-				&adapter->sta_info[staId].sta_mac.
-				bytes[0], eSIR_MAC_DEAUTH_LEAVING_BSS_REASON,
-				(SIR_MAC_MGMT_DISASSOC >> 4), &del_sta_params);
 
-			/* Disconnect all the stations */
-			hdd_softap_sta_disassoc(adapter,
-						&del_sta_params);
-		}
-	}
+	if (sta_id == ap_ctx->broadcast_sta_id)
+		return;
+
+	sta_info = &adapter->sta_info[sta_id];
+	if (!sta_info->in_use)
+		return;
+
+	wlansap_populate_del_sta_params(sta_info->sta_mac.bytes,
+					eSIR_MAC_DEAUTH_LEAVING_BSS_REASON,
+					(SIR_MAC_MGMT_DISASSOC >> 4),
+					&del_sta_params);
+
+	hdd_softap_sta_disassoc(adapter, &del_sta_params);
+}
+
+static void hdd_clear_all_sta(struct hdd_adapter *adapter)
+{
+	uint8_t sta_id;
+
+	ENTER_DEV(adapter->dev);
+	for (sta_id = 0; sta_id < WLAN_MAX_STA_COUNT; sta_id++)
+		hdd_clear_sta(adapter, sta_id);
 }
 
 static int hdd_stop_bss_link(struct hdd_adapter *adapter,