Jelajahi Sumber

qcacld-3.0: Add support for mapping link bssid for get_station

Currently driver ignores the bssid parameter in STA mode for
NL80211_CMD_GET_STATION command. Add support for mapping link
bssid with corresponing adapter to fetch the stats.

Change-Id: I99a87d1946cafedd707961962c415d1f179efb91
CRs-Fixed: 3181024
Aditya Kodukula 3 tahun lalu
induk
melakukan
41cbecf667

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

@@ -1654,7 +1654,7 @@ struct dhcp_server {
  *
  * @Min: 0
  * @Max: 5000
- * Default: 200
+ * Default: 400
  *
  * This ini is used as duration in milliseconds for which cached station stats
  * are valid. Driver sends the cached information as response, if it gets the
@@ -1671,7 +1671,7 @@ struct dhcp_server {
 			"sta_stats_cache_expiry_time", \
 			0, \
 			5000, \
-			200, \
+			400, \
 			CFG_VALUE_OR_DEFAULT, \
 			"Station stats cache expiry")
 

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

@@ -542,6 +542,7 @@ typedef enum {
 	NET_DEV_HOLD_BUS_BW_MGR = 59,
 	NET_DEV_HOLD_START_PRE_CAC_TRANS = 60,
 	NET_DEV_HOLD_IS_ANY_STA_CONNECTED = 61,
+	NET_DEV_HOLD_GET_ADAPTER_BY_BSSID = 62,
 
 	/* Keep it at the end */
 	NET_DEV_HOLD_ID_MAX

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

@@ -6457,6 +6457,7 @@ static char *net_dev_ref_debug_string_from_id(wlan_net_dev_ref_dbgid dbgid)
 		"NET_DEV_HOLD_DISPLAY_TXRX_STATS",
 		"NET_DEV_HOLD_START_PRE_CAC_TRANS",
 		"NET_DEV_HOLD_IS_ANY_STA_CONNECTED",
+		"NET_DEV_HOLD_GET_ADAPTER_BY_BSSID",
 		"NET_DEV_HOLD_ID_MAX"};
 	int32_t num_dbg_strings = QDF_ARRAY_SIZE(strings);
 

+ 29 - 0
core/hdd/src/wlan_hdd_stats.c

@@ -6163,6 +6163,30 @@ static int wlan_hdd_get_sta_stats(struct wiphy *wiphy,
 	return 0;
 }
 
+static
+struct hdd_adapter *hdd_get_adapter_by_bssid(struct hdd_context *hdd_ctx,
+					     const uint8_t *bssid)
+{
+	struct hdd_adapter *adapter, *next_adapter = NULL;
+	struct hdd_station_ctx *sta_ctx;
+	wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_ADAPTER_BY_BSSID;
+
+	hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
+					   dbgid) {
+		sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+		if (qdf_is_macaddr_equal(&sta_ctx->conn_info.bssid,
+					 (struct qdf_mac_addr *)bssid)) {
+			hdd_adapter_dev_put_debug(adapter, dbgid);
+			if (next_adapter)
+				hdd_adapter_dev_put_debug(next_adapter,
+							  dbgid);
+			return adapter;
+		}
+		hdd_adapter_dev_put_debug(adapter, dbgid);
+	}
+	return NULL;
+}
+
 /**
  * __wlan_hdd_cfg80211_get_station() - get station statistics
  * @wiphy: Pointer to wiphy
@@ -6222,6 +6246,11 @@ static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy,
 		}
 		return wlan_hdd_get_sap_stats(adapter, sinfo);
 	} else {
+		adapter = hdd_get_adapter_by_bssid(hdd_ctx, mac);
+		if (!adapter) {
+			adapter = WLAN_HDD_GET_PRIV_PTR(dev);
+			hdd_err_rl("the bssid is invalid");
+		}
 		return wlan_hdd_get_sta_stats(wiphy, adapter, mac, sinfo);
 	}
 }