浏览代码

qcacmn: Track PN failures with relevant stats

When validating MMIE, if PN error is found, track it using relevant
statistics. Defined WMI_HOST_RXERR_PN to flag such PN errors.

Change-Id: Icb1fe9a653f67611539b5cb463adfceadedae38e
Pooventhiran G 3 年之前
父节点
当前提交
886ce189d0

+ 2 - 0
dp/inc/cdp_txrx_mon_struct.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -111,6 +112,7 @@ struct cdp_mon_status {
 #define IEEE80211_RX_DECRYPT_ERROR  0x04
 /* holes in flags here between, ATH_RX_XXXX to IEEE80211_RX_XXX */
 #define IEEE80211_RX_KEYMISS        0x200
+#define IEEE80211_RX_PN_ERROR       0x400
 	int rs_rssi;       /* RSSI (noise floor ajusted) */
 	int rs_abs_rssi;   /* absolute RSSI */
 	int rs_datarate;   /* data rate received */

+ 4 - 0
umac/cmn_services/crypto/src/wlan_crypto_global_api.c

@@ -30,6 +30,7 @@
 #include <wlan_objmgr_vdev_obj.h>
 #include <wlan_objmgr_peer_obj.h>
 #include <wlan_utility.h>
+#include <wlan_cp_stats_utils_api.h>
 
 #include "wlan_crypto_global_def.h"
 #include "wlan_crypto_global_api.h"
@@ -2395,12 +2396,15 @@ bool wlan_crypto_is_mmie_valid(struct wlan_objmgr_vdev *vdev,
 	if (qdf_mem_cmp(ipn, key->keyrsc, 6) <= 0) {
 		uint8_t *su = (uint8_t *)key->keyrsc;
 		uint8_t *end = ipn + 6;
+		struct wlan_objmgr_peer *peer = wlan_vdev_get_selfpeer(vdev);
 
 		crypto_err("replay error :");
 		while (ipn < end) {
 			crypto_err("expected pn = %x received pn = %x",
 				   *ipn++, *su++);
 		}
+		wlan_cp_stats_vdev_ucast_rx_pnerr(vdev);
+		wlan_cp_stats_peer_rx_pnerr(peer);
 		return false;
 	}
 

+ 2 - 0
umac/cmn_services/mgmt_txrx/dispatcher/inc/wlan_mgmt_txrx_utils_api.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -767,6 +768,7 @@ enum mgmt_frame_type {
  *          WMI_HOST_RXERR_DECRYPT = 0x08
  *          WMI_HOST_RXERR_MIC = 0x10
  *          WMI_HOST_RXERR_KEY_CACHE_MISS = 0x20
+ *          WMI_HOST_RXERR_PN = 0x80
  * @flags: information about the management frame e.g. can give a
  *         scan source for a scan result mgmt frame
  * @rssi: combined RSSI, i.e. the sum of the snr + noise floor (dBm units)

+ 7 - 0
umac/cp_stats/core/src/wlan_cp_stats_defs.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2018-2019, 2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -90,12 +91,16 @@ struct pdev_cp_stats {
  * @vdev_stats: pointer to ic/mc specific stats
  * @vdev_comp_priv_obj[]: component's private object pointers
  * @vdev_cp_stats_lock:	lock to protect object
+ * @ucast_rx_pnerr_stats_inc: callback function to update rx PN error stats
  */
 struct vdev_cp_stats {
 	struct wlan_objmgr_vdev *vdev_obj;
 	vdev_ext_cp_stats_t *vdev_stats;
 	void *vdev_comp_priv_obj[WLAN_CP_STATS_MAX_COMPONENTS];
 	qdf_spinlock_t vdev_cp_stats_lock;
+	void (*ucast_rx_pnerr_stats_inc)(
+			struct wlan_objmgr_vdev *vdev,
+			uint64_t val);
 };
 
 /**
@@ -104,12 +109,14 @@ struct vdev_cp_stats {
  * @peer_stats: pointer to ic/mc specific stats
  * @peer_comp_priv_obj[]: component's private object pointers
  * @peer_cp_stats_lock:	lock to protect object
+ * @rx_pnerr_stats_inc: callback function to update rx PN error stats
  */
 struct peer_cp_stats {
 	struct wlan_objmgr_peer *peer_obj;
 	peer_ext_cp_stats_t *peer_stats;
 	void *peer_comp_priv_obj[WLAN_CP_STATS_MAX_COMPONENTS];
 	qdf_spinlock_t peer_cp_stats_lock;
+	void (*rx_pnerr_stats_inc)(struct wlan_objmgr_peer *peer, uint32_t val);
 };
 
 /**

+ 28 - 0
umac/cp_stats/dispatcher/inc/wlan_cp_stats_utils_api.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2018,2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -146,5 +147,32 @@ QDF_STATUS wlan_cp_stats_comp_obj_cfg(
 		void *cmn_obj,
 		void *data);
 
+/**
+ * wlan_cp_stats_vdev_ucast_rx_pnerr() - public API to umac for updating
+ * vdev rx_pnerr stats
+ * @vdev: pointer to vdev
+ *
+ * Return: None
+ */
+void wlan_cp_stats_vdev_ucast_rx_pnerr(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * wlan_cp_stats_peer_rx_pnerr() - public API to umac for updating
+ * peer rx_pnerr stats
+ * @peer: pointer to peer
+ *
+ * Return: None
+ */
+void wlan_cp_stats_peer_rx_pnerr(struct wlan_objmgr_peer *peer);
+
+#else /* QCA_SUPPORT_CP_STATS */
+static inline
+void wlan_cp_stats_vdev_ucast_rx_pnerr(struct wlan_objmgr_vdev *vdev)
+{}
+
+static inline
+void wlan_cp_stats_peer_rx_pnerr(struct wlan_objmgr_peer *peer)
+{}
+
 #endif /* QCA_SUPPORT_CP_STATS */
 #endif /* __WLAN_CP_STATS_UTILS_API_H__ */

+ 17 - 0
umac/cp_stats/dispatcher/src/wlan_cp_stats_utils_api.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -349,3 +350,19 @@ wlan_cp_stats_comp_obj_cfg(enum wlan_objmgr_obj_type obj_type,
 
 	return status;
 }
+
+void wlan_cp_stats_vdev_ucast_rx_pnerr(struct wlan_objmgr_vdev *vdev)
+{
+	struct vdev_cp_stats *vdev_cs = wlan_cp_stats_get_vdev_stats_obj(vdev);
+
+	if (vdev_cs && vdev_cs->ucast_rx_pnerr_stats_inc)
+		vdev_cs->ucast_rx_pnerr_stats_inc(vdev, 1);
+}
+
+void wlan_cp_stats_peer_rx_pnerr(struct wlan_objmgr_peer *peer)
+{
+	struct peer_cp_stats *peer_cs = wlan_cp_stats_get_peer_stats_obj(peer);
+
+	if (peer_cs && peer_cs->rx_pnerr_stats_inc)
+		peer_cs->rx_pnerr_stats_inc(peer, 1);
+}

+ 1 - 0
wmi/inc/wmi_unified_param.h

@@ -6367,6 +6367,7 @@ enum wmi_host_ap_ps_peer_param {
 #define WMI_HOST_RXERR_DECRYPT	0x08 /* non-Michael decrypt error */
 #define WMI_HOST_RXERR_MIC	0x10 /* Michael MIC decrypt error */
 #define WMI_HOST_RXERR_KEY_CACHE_MISS 0x20 /* No/incorrect key matter in h/w */
+#define WMI_HOST_RXERR_PN	0x80 /* invalid PN in frame */
 
 enum wmi_host_sta_ps_param_rx_wake_policy {
 	/* Wake up when ever there is an  RX activity on the VDEV. In this mode