Procházet zdrojové kódy

qcacld-3.0: Add uplink delay in get_sta_info response

Add uplink delay value into get_sta_info vendor command response.

Change-Id: I7298fa259e0f997b28c8a114e7fd963f311596d6
CRs-Fixed: 2991981
Jia Ding před 3 roky
rodič
revize
840fea013f
1 změnil soubory, kde provedl 58 přidání a 0 odebrání
  1. 58 0
      core/hdd/src/wlan_hdd_station_info.c

+ 58 - 0
core/hdd/src/wlan_hdd_station_info.c

@@ -45,6 +45,10 @@
 #include <cdp_txrx_host_stats.h>
 #include <osif_cm_util.h>
 
+#ifdef WLAN_FEATURE_TSF_UPLINK_DELAY
+#include <cdp_txrx_ctrl.h>
+#endif
+
 /*
  * define short names for the global vendor params
  * used by __wlan_hdd_cfg80211_get_station_cmd()
@@ -2053,6 +2057,52 @@ fail:
 	return -EINVAL;
 }
 
+#ifdef WLAN_FEATURE_TSF_UPLINK_DELAY
+static uint32_t hdd_get_uplink_delay_len(struct hdd_adapter *adapter)
+{
+	if (adapter->device_mode != QDF_STA_MODE)
+		return 0;
+
+	return nla_total_size(sizeof(uint32_t));
+}
+
+static QDF_STATUS hdd_add_uplink_delay(struct hdd_adapter *adapter,
+				       struct sk_buff *skb)
+{
+	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
+	QDF_STATUS status;
+	uint32_t ul_delay;
+
+	if (adapter->device_mode != QDF_STA_MODE)
+		return QDF_STATUS_SUCCESS;
+
+	if (qdf_atomic_read(&adapter->tsf_auto_report)) {
+		status = cdp_get_uplink_delay(soc, adapter->vdev_id, &ul_delay);
+		if (QDF_IS_STATUS_ERROR(status))
+			ul_delay = 0;
+	} else {
+		ul_delay = 0;
+	}
+
+	if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_GET_STA_INFO_UPLINK_DELAY,
+			ul_delay))
+		return QDF_STATUS_E_FAILURE;
+
+	return QDF_STATUS_SUCCESS;
+}
+#else /* !WLAN_FEATURE_TSF_UPLINK_DELAY */
+static inline uint32_t hdd_get_uplink_delay_len(struct hdd_adapter *adapter)
+{
+	return 0;
+}
+
+static inline QDF_STATUS hdd_add_uplink_delay(struct hdd_adapter *adapter,
+					      struct sk_buff *skb)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif /* WLAN_FEATURE_TSF_UPLINK_DELAY */
+
 /**
  * hdd_get_connected_station_info_ex() - get connected peer's info
  * @hdd_ctx: hdd context
@@ -2247,6 +2297,8 @@ static int hdd_get_station_info_ex(struct hdd_context *hdd_ctx,
 	connect_fail_rsn_len = hdd_get_connect_fail_reason_code_len(adapter);
 	nl_buf_len += connect_fail_rsn_len;
 
+	nl_buf_len += hdd_get_uplink_delay_len(adapter);
+
 	if (!nl_buf_len) {
 		hdd_err_rl("Failed to get bcn pmf stats");
 		return -EINVAL;
@@ -2280,6 +2332,12 @@ static int hdd_get_station_info_ex(struct hdd_context *hdd_ctx,
 		}
 	}
 
+	if (QDF_IS_STATUS_ERROR(hdd_add_uplink_delay(adapter, skb))) {
+		hdd_err_rl("hdd_add_uplink_delay fail");
+		kfree_skb(skb);
+		return -EINVAL;
+	}
+
 	ret = cfg80211_vendor_cmd_reply(skb);
 	hdd_reset_roam_params(hdd_ctx->psoc, adapter->vdev_id);
 	return ret;