Browse Source

qcacld-3.0: Add QCA_WLAN_VENDOR_ATTR_GET_STA_INFO_RX_FRAMES_CRC_FAIL_COUNT

Add QCA_WLAN_VENDOR_ATTR_GET_STA_INFO_RX_FRAMES_CRC_FAIL_COUNT

Change-Id: I0c44109b678c8886869752940d5dc600ad7a4e9e
CRs-Fixed: 2758487
Min Liu 4 years ago
parent
commit
f928593fb2
2 changed files with 38 additions and 2 deletions
  1. 2 0
      core/hdd/src/wlan_hdd_sta_info.h
  2. 36 2
      core/hdd/src/wlan_hdd_station_info.c

+ 2 - 0
core/hdd/src/wlan_hdd_sta_info.h

@@ -219,6 +219,7 @@ char *sta_info_string_from_dbgid(wlan_sta_info_dbgid id);
  * @tx_retry_fw: the number of retried frames from firmware to remote station
  * @tx_retry_exhaust_fw: the number of frames retried but finally failed from
  *                    firmware to remote station
+ * @rx_fcs_count: the number of frames received with fcs error
  * @sta_info: The sta_info node for the station info list maintained in adapter
  * @assoc_req_ies: Assoc request IEs of the peer station
  * @ref_cnt: Reference count to synchronize sta_info access
@@ -279,6 +280,7 @@ struct hdd_station_info {
 	uint32_t tx_total_fw;
 	uint32_t tx_retry_fw;
 	uint32_t tx_retry_exhaust_fw;
+	uint32_t rx_fcs_count;
 	qdf_list_node_t sta_node;
 	struct wlan_ies assoc_req_ies;
 	qdf_atomic_t ref_cnt;

+ 36 - 2
core/hdd/src/wlan_hdd_station_info.c

@@ -1500,7 +1500,8 @@ static int hdd_get_peer_stats(struct hdd_adapter *adapter,
 	struct cdp_peer_stats *peer_stats;
 	struct stats_event *stats;
 	QDF_STATUS status;
-	int ret;
+	bool found = false;
+	int i, ret = 0;
 
 	peer_stats = qdf_mem_malloc(sizeof(*peer_stats));
 	if (!peer_stats)
@@ -1541,7 +1542,33 @@ static int hdd_get_peer_stats(struct hdd_adapter *adapter,
 
 	wlan_cfg80211_mc_cp_stats_free_stats_event(stats);
 
-	return 0;
+	stats = wlan_cfg80211_mc_cp_stats_get_station_stats(adapter->vdev,
+							    &ret);
+	if (ret || !stats || !stats->num_peer_adv_stats) {
+		wlan_cfg80211_mc_cp_stats_free_stats_event(stats);
+		hdd_err("Failed to get peer stats info");
+		return -EINVAL;
+	}
+
+	for (i = 0; i < stats->num_peer_adv_stats; i++) {
+		if (!qdf_mem_cmp(stainfo->sta_mac.bytes,
+				 stats->peer_adv_stats[i].peer_macaddr,
+				 QDF_MAC_ADDR_SIZE)) {
+			stainfo->rx_fcs_count = stats->peer_adv_stats[i].
+								      fcs_count;
+			found = true;
+			break;
+		}
+	}
+
+	if (!found) {
+		hdd_err("Peer not found");
+		ret = -EINVAL;
+	}
+
+	wlan_cfg80211_mc_cp_stats_free_stats_event(stats);
+
+	return ret;
 }
 
 /**
@@ -1622,6 +1649,13 @@ static int hdd_add_peer_stats(struct sk_buff *skb,
 		goto fail;
 	}
 
+	if (nla_put_u32(skb,
+		     QCA_WLAN_VENDOR_ATTR_GET_STA_INFO_RX_FRAMES_CRC_FAIL_COUNT,
+		     stainfo->rx_fcs_count)) {
+		hdd_err("Failed to put rx_fcs_count");
+		goto fail;
+	}
+
 	return 0;
 fail:
 	return -EINVAL;