Просмотр исходного кода

qcacld-3.0: Add support to cache peer rssi and mc_bc count

Use updated cp stats component to get peer rssi and tx rate,
rx rate for big data logging as legacy infrastructure is
deprecated.
Additionally add support for RX multicast broadcast packets from FW.

Change-Id: Idcab4a022a4e7e34bd15878f95ad8248ca3aa9dd
CRs-fixed: 2428582
Ashish Kumar Dhanotiya 6 лет назад
Родитель
Сommit
9d9816952c

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

@@ -896,6 +896,13 @@ enum dhcp_nego_status {
  * @capability: Capability information of current station
  * @support_mode: Max supported mode of a station currently
  * connected to sap
+ * @rx_retry_cnt: Number of rx retries received from current station
+ *                Currently this feature is not supported from FW
+ * @rx_mc_bc_cnt: Multicast broadcast packet count received from
+ *                current station
+ * MSB of rx_mc_bc_cnt indicates whether FW supports rx_mc_bc_cnt
+ * feature or not, if first bit is 1 it indicates that FW supports this
+ * feature, if it is 0 it indicates FW doesn't support this feature
  */
 struct hdd_station_info {
 	bool in_use;
@@ -941,6 +948,8 @@ struct hdd_station_info {
 	enum dhcp_nego_status dhcp_nego_status;
 	uint16_t capability;
 	uint8_t support_mode;
+	uint32_t rx_retry_cnt;
+	uint32_t rx_mc_bc_cnt;
 };
 
 /**

+ 2 - 0
core/hdd/src/wlan_hdd_hostapd.c

@@ -2322,6 +2322,8 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 			cache_stainfo->rssi = disassoc_comp->rssi;
 			cache_stainfo->tx_rate = disassoc_comp->tx_rate;
 			cache_stainfo->rx_rate = disassoc_comp->rx_rate;
+			cache_stainfo->rx_mc_bc_cnt =
+						disassoc_comp->rx_mc_bc_cnt;
 			cache_stainfo->reason_code = disassoc_comp->reason_code;
 			cache_stainfo->disassoc_ts = qdf_system_ticks();
 		}

+ 38 - 4
core/hdd/src/wlan_hdd_station_info.c

@@ -97,10 +97,20 @@
 	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_REMOTE_CH_WIDTH
 #define REMOTE_SGI_ENABLE\
 	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_REMOTE_SGI_ENABLE
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))
-	#define REMOTE_PAD\
+#define REMOTE_PAD\
 	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_PAD
-#endif
+#define REMOTE_RX_RETRY_COUNT \
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_REMOTE_RX_RETRY_COUNT
+#define REMOTE_RX_BC_MC_COUNT \
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_REMOTE_RX_BC_MC_COUNT
+
+/*
+ * MSB of rx_mc_bc_cnt indicates whether FW supports rx_mc_bc_cnt
+ * feature or not, if first bit is 1 it indictes that FW supports this
+ * feature, if it is 0 it indicates FW doesn't support this feature
+ */
+#define HDD_STATION_INFO_RX_MC_BC_COUNT (1 << 31)
+
 
 static const struct nla_policy
 hdd_get_station_policy[STATION_MAX + 1] = {
@@ -1016,8 +1026,12 @@ static int hdd_get_cached_station_remote(struct hdd_context *hdd_ctx,
 			(sizeof(stainfo->ch_width) + NLA_HDRLEN) +
 			(sizeof(stainfo->tx_rate) + NLA_HDRLEN) +
 			(sizeof(stainfo->rx_rate) + NLA_HDRLEN) +
-			(sizeof(stainfo->support_mode) + NLA_HDRLEN);
+			(sizeof(stainfo->support_mode) + NLA_HDRLEN) +
 
+			(sizeof(stainfo->rx_mc_bc_cnt) +
+			 NLA_HDRLEN) +
+			(sizeof(stainfo->rx_retry_cnt) +
+			 NLA_HDRLEN);
 	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len);
 	if (!skb) {
 		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
@@ -1058,6 +1072,26 @@ static int hdd_get_cached_station_remote(struct hdd_context *hdd_ctx,
 		goto fail;
 	}
 
+	if (!(stainfo->rx_mc_bc_cnt & HDD_STATION_INFO_RX_MC_BC_COUNT)) {
+		hdd_debug("rx mc bc count is not supported by FW");
+	}
+
+	else if (nla_put_u32(skb, REMOTE_RX_BC_MC_COUNT,
+			     (stainfo->rx_mc_bc_cnt &
+			      (~HDD_STATION_INFO_RX_MC_BC_COUNT)))) {
+		hdd_err("rx mc bc put fail");
+		goto fail;
+	}
+
+	/* Currently rx_retry count is not supported */
+	if (stainfo->rx_retry_cnt) {
+		if (nla_put_u32(skb, REMOTE_RX_RETRY_COUNT,
+				stainfo->rx_retry_cnt)) {
+			hdd_err("rx retry count put fail");
+			goto fail;
+		}
+	}
+
 	qdf_mem_zero(stainfo, sizeof(*stainfo));
 
 	return cfg80211_vendor_cmd_reply(skb);

+ 1 - 0
core/mac/inc/ani_global.h

@@ -801,6 +801,7 @@ struct mac_context {
 	uint32_t peer_rssi;
 	uint32_t peer_txrate;
 	uint32_t peer_rxrate;
+	uint32_t rx_mc_bc_cnt;
 	/* 11k Offload Support */
 	bool is_11k_offload_supported;
 	uint8_t reject_addba_req;

+ 1 - 0
core/sap/inc/sap_api.h

@@ -297,6 +297,7 @@ typedef struct sap_StationDisassocCompleteEvent_s {
 	int rssi;
 	int tx_rate;
 	int rx_rate;
+	uint32_t rx_mc_bc_cnt;
 } tSap_StationDisassocCompleteEvent;
 
 typedef struct sap_StationSetKeyCompleteEvent_s {

+ 1 - 0
core/sap/src/sap_fsm.c

@@ -1712,6 +1712,7 @@ QDF_STATUS sap_signal_hdd_event(struct sap_context *sap_ctx,
 		disassoc_comp->rssi = csr_roaminfo->rssi;
 		disassoc_comp->rx_rate = csr_roaminfo->rx_rate;
 		disassoc_comp->tx_rate = csr_roaminfo->tx_rate;
+		disassoc_comp->rx_mc_bc_cnt = csr_roaminfo->rx_mc_bc_cnt;
 		disassoc_comp->reason_code = csr_roaminfo->disassoc_reason;
 		break;
 

+ 1 - 0
core/sme/inc/csr_api.h

@@ -1179,6 +1179,7 @@ struct csr_roam_info {
 	int tx_rate;
 	int rx_rate;
 	tSirMacCapabilityInfo capability_info;
+	uint32_t rx_mc_bc_cnt;
 #ifdef WLAN_FEATURE_SAE
 	struct sir_sae_info *sae_info;
 #endif

+ 0 - 11
core/sme/inc/sme_api.h

@@ -2121,17 +2121,6 @@ int sme_set_cck_tx_fir_override(mac_handle_t mac_handle, int vdev_id);
 QDF_STATUS sme_set_smps_cfg(uint32_t vdev_id, uint32_t param_id,
 				uint32_t param_val);
 
-/**
- * sme_get_peer_stats() - sme api to post peer info request
- * @mac: mac handle
- * @req: peer info request struct send to wma
- *
- * Return: QDF_STATUS_SUCCESS or non-zero on failure
- */
-
-QDF_STATUS sme_get_peer_stats(struct mac_context *mac,
-			      struct sir_peer_info_req req);
-
 /**
  * sme_get_peer_info() - sme api to get peer info
  * @mac_handle: Opaque handle to the global MAC context

+ 0 - 33
core/sme/src/common/sme_api.c

@@ -7501,39 +7501,6 @@ QDF_STATUS sme_get_link_speed(mac_handle_t mac_handle,
 	return status;
 }
 
-QDF_STATUS sme_get_peer_stats(struct mac_context *mac,
-			      struct sir_peer_info_req req)
-{
-	QDF_STATUS qdf_status;
-	struct scheduler_msg message = {0};
-
-	qdf_status = sme_acquire_global_lock(&mac->sme);
-	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-		sme_debug("Failed to get Lock");
-		return qdf_status;
-	}
-	/* serialize the req through MC thread */
-	message.bodyptr = qdf_mem_malloc(sizeof(req));
-	if (!message.bodyptr) {
-		sme_release_global_lock(&mac->sme);
-		return QDF_STATUS_E_NOMEM;
-	}
-	qdf_mem_copy(message.bodyptr, &req, sizeof(req));
-	message.type = WMA_GET_PEER_INFO;
-	message.reserved = 0;
-	qdf_status = scheduler_post_message(QDF_MODULE_ID_SME,
-					    QDF_MODULE_ID_WMA,
-					    QDF_MODULE_ID_WMA, &message);
-	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Post get peer info msg fail", __func__);
-		qdf_mem_free(message.bodyptr);
-		qdf_status = QDF_STATUS_E_FAILURE;
-	}
-	sme_release_global_lock(&mac->sme);
-	return qdf_status;
-}
-
 QDF_STATUS
 sme_get_peer_info(mac_handle_t mac_handle,
 		  struct sir_peer_info_req req,

+ 47 - 4
core/sme/src/csr/csr_api_roam.c

@@ -49,6 +49,7 @@
 #include <wlan_logging_sock_svc.h>
 #include "wlan_objmgr_psoc_obj.h"
 #include <wlan_scan_ucfg_api.h>
+#include <wlan_cp_stats_mc_ucfg_api.h>
 #include <wlan_tdls_tgt_api.h>
 #include <wlan_cfg80211_scan.h>
 #include <wlan_scan_public_structs.h>
@@ -6467,6 +6468,7 @@ static void csr_roam_process_results_default(struct mac_context *mac_ctx,
 		roam_info->rssi = mac_ctx->peer_rssi;
 		roam_info->tx_rate = mac_ctx->peer_txrate;
 		roam_info->rx_rate = mac_ctx->peer_rxrate;
+		roam_info->rx_mc_bc_cnt = mac_ctx->rx_mc_bc_cnt;
 
 		csr_roam_state_change(mac_ctx, eCSR_ROAMING_STATE_JOINED,
 			session_id);
@@ -9753,6 +9755,7 @@ csr_roam_send_disconnect_done_indication(struct mac_context *mac_ctx,
 		roam_info->tx_rate = mac_ctx->peer_txrate;
 		roam_info->rx_rate = mac_ctx->peer_rxrate;
 		roam_info->disassoc_reason = discon_ind->reason_code;
+		roam_info->rx_mc_bc_cnt = mac_ctx->rx_mc_bc_cnt;
 
 		csr_roam_call_callback(mac_ctx, discon_ind->session_id,
 				       roam_info, 0, eCSR_ROAM_LOSTLINK,
@@ -12842,6 +12845,26 @@ void csr_roam_completion(struct mac_context *mac, uint32_t sessionId,
 	}
 }
 
+static void csr_get_peer_rssi_cb(struct stats_event *ev, void *cookie)
+{
+	struct mac_context *mac = (struct mac_context *)cookie;
+
+	if (!mac)
+		return;
+	if (!ev->peer_stats) {
+		sme_debug("%s no peer stats\n", __func__);
+		return;
+	}
+	mac->peer_rssi = ev->peer_stats->peer_rssi;
+	mac->peer_txrate = ev->peer_stats->tx_rate;
+	mac->peer_rxrate = ev->peer_stats->rx_rate;
+	if (!ev->peer_extended_stats) {
+		sme_debug("%s no peer extended stats\n", __func__);
+		return;
+	}
+	mac->rx_mc_bc_cnt = ev->peer_extended_stats->rx_mc_bc_cnt;
+}
+
 static
 QDF_STATUS csr_roam_lost_link(struct mac_context *mac, uint32_t sessionId,
 			      uint32_t type, tSirSmeRsp *pSirMsg)
@@ -12886,11 +12909,31 @@ QDF_STATUS csr_roam_lost_link(struct mac_context *mac, uint32_t sessionId,
 	}
 
 	if (type == eWNI_SME_DISASSOC_IND || type == eWNI_SME_DEAUTH_IND) {
-		struct	sir_peer_info_req req;
+		struct wlan_objmgr_vdev *vdev;
+		struct request_info info = {0};
 
-		req.sessionid = sessionId;
-		req.peer_macaddr = roam_info->peerMac;
-		sme_get_peer_stats(mac, req);
+		vdev = wlan_objmgr_get_vdev_by_id_from_psoc(
+							mac->psoc,
+							sessionId,
+							WLAN_LEGACY_SME_ID);
+		if (!vdev) {
+			sme_err("Invalid vdev");
+		} else {
+			info.cookie = mac;
+			info.u.get_peer_rssi_cb = csr_get_peer_rssi_cb;
+			info.vdev_id = wlan_vdev_get_id(vdev);
+			info.pdev_id = wlan_objmgr_pdev_get_pdev_id(
+						wlan_vdev_get_pdev(vdev));
+			qdf_mem_copy(info.peer_mac_addr, &roam_info->peerMac,
+				     QDF_MAC_ADDR_SIZE);
+			status = ucfg_mc_cp_stats_send_stats_request(
+							vdev,
+							TYPE_PEER_STATS,
+							&info);
+			if (QDF_IS_STATUS_ERROR(status))
+				sme_err("stats req failed: %d", status);
+			wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_SME_ID);
+		}
 	}
 	csr_roam_call_callback(mac, sessionId, NULL, 0,
 			       eCSR_ROAM_LOSTLINK_DETECTED, result);