Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4357b0a1 authored by Jia Ding's avatar Jia Ding Committed by Madan Koyyalamudi
Browse files

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
parent eeafb2e0
Loading
Loading
Loading
Loading
+59 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-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
@@ -45,6 +46,10 @@
#include <cdp_txrx_host_stats.h>
#include "wlan_hdd_stats.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()
@@ -2099,6 +2104,52 @@ static int hdd_add_peer_stats(struct sk_buff *skb,
	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
@@ -2290,6 +2341,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;
@@ -2323,6 +2376,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;