|
@@ -1,5 +1,6 @@
|
|
|
/*
|
|
|
* Copyright (c) 2013-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
|
|
@@ -228,6 +229,101 @@ static QDF_STATUS send_set_mcc_channel_time_quota_cmd_tlv(
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+#ifdef WLAN_FEATURE_MCC_QUOTA
|
|
|
+/**
|
|
|
+ * convert_to_host_quota_type() - convert wmi quota type to host quota type
|
|
|
+ * @quota_type: wmi target quota type
|
|
|
+ *
|
|
|
+ * Return: enum mcc_quota_type
|
|
|
+ */
|
|
|
+static enum mcc_quota_type convert_to_host_quota_type(uint32_t quota_type)
|
|
|
+{
|
|
|
+ switch (quota_type) {
|
|
|
+ case WMI_RESMGR_QUOTA_TYPE_CLEAR:
|
|
|
+ return QUOTA_TYPE_CLEAR;
|
|
|
+ case WMI_RESMGR_QUOTA_TYPE_FIXED:
|
|
|
+ return QUOTA_TYPE_FIXED;
|
|
|
+ case WMI_RESMGR_QUOTA_TYPE_DYNAMIC:
|
|
|
+ return QUOTA_TYPE_DYNAMIC;
|
|
|
+ default:
|
|
|
+ wmi_err("mcc quota unknown quota type %d", quota_type);
|
|
|
+ return QUOTA_TYPE_UNKNOWN;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * extract_mcc_quota_ev_param_tlv() - extract mcc quota information from wmi
|
|
|
+ * event
|
|
|
+ * @wmi_handle: wmi handle
|
|
|
+ * @param evt_buf: pointer to event buffer
|
|
|
+ * @param param: Pointer to hold mcc quota info
|
|
|
+ *
|
|
|
+ * Return: QDF_STATUS_SUCCESS for success or error code
|
|
|
+ */
|
|
|
+static QDF_STATUS
|
|
|
+extract_mcc_quota_ev_param_tlv(wmi_unified_t wmi_handle,
|
|
|
+ void *evt_buf, struct mcc_quota_info *param)
|
|
|
+{
|
|
|
+ WMI_RESMGR_CHAN_TIME_QUOTA_CHANGED_EVENTID_param_tlvs *param_tlvs;
|
|
|
+ wmi_resmgr_chan_time_quota_changed_event_fixed_param *fixed_param;
|
|
|
+ uint8_t i;
|
|
|
+ wmi_resmgr_chan_time_quota_tlv *wmi_mcc_quota_info;
|
|
|
+
|
|
|
+ if (!param) {
|
|
|
+ wmi_err("mcc quota information param is null");
|
|
|
+ return QDF_STATUS_E_INVAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ param_tlvs = evt_buf;
|
|
|
+ if (!param_tlvs || !param_tlvs->fixed_param) {
|
|
|
+ wmi_err("Invalid mcc quota event buffer");
|
|
|
+ return QDF_STATUS_E_INVAL;
|
|
|
+ }
|
|
|
+ fixed_param = param_tlvs->fixed_param;
|
|
|
+
|
|
|
+ wmi_debug("mcc quota type %d, num %d",
|
|
|
+ fixed_param->quota_type, param_tlvs->num_chan_quota);
|
|
|
+
|
|
|
+ param->type = convert_to_host_quota_type(fixed_param->quota_type);
|
|
|
+ if (param->type == QUOTA_TYPE_UNKNOWN)
|
|
|
+ return QDF_STATUS_E_INVAL;
|
|
|
+
|
|
|
+ if (!param_tlvs->chan_quota) {
|
|
|
+ param->num_chan_quota = 0;
|
|
|
+ return QDF_STATUS_SUCCESS;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (param_tlvs->num_chan_quota > MAX_MCC_QUOTA_CH_NUM)
|
|
|
+ wmi_warn("mcc quota num %d unexpected",
|
|
|
+ param_tlvs->num_chan_quota);
|
|
|
+ param->num_chan_quota = qdf_min(param_tlvs->num_chan_quota,
|
|
|
+ (uint32_t)MAX_MCC_QUOTA_CH_NUM);
|
|
|
+ wmi_mcc_quota_info = param_tlvs->chan_quota;
|
|
|
+ for (i = 0; i < param->num_chan_quota; i++) {
|
|
|
+ param->chan_quota[i].chan_mhz =
|
|
|
+ wmi_mcc_quota_info[i].chan_time_quota.chan_mhz;
|
|
|
+ param->chan_quota[i].channel_time_quota =
|
|
|
+ wmi_mcc_quota_info[i].chan_time_quota.channel_time_quota;
|
|
|
+ wmi_debug("mcc quota [%d] chan %d, quota %d",
|
|
|
+ i, param->chan_quota[i].chan_mhz,
|
|
|
+ param->chan_quota[i].channel_time_quota);
|
|
|
+ }
|
|
|
+
|
|
|
+ return QDF_STATUS_SUCCESS;
|
|
|
+}
|
|
|
+
|
|
|
+static void wmi_mcc_quota_evt_attach_tlv(wmi_unified_t wmi_handle)
|
|
|
+{
|
|
|
+ struct wmi_ops *ops = wmi_handle->ops;
|
|
|
+
|
|
|
+ ops->extract_mcc_quota_ev_param = extract_mcc_quota_ev_param_tlv;
|
|
|
+}
|
|
|
+#else
|
|
|
+static inline void wmi_mcc_quota_evt_attach_tlv(wmi_unified_t wmi_handle)
|
|
|
+{
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
void wmi_concurrency_attach_tlv(wmi_unified_t wmi_handle)
|
|
|
{
|
|
|
struct wmi_ops *ops = wmi_handle->ops;
|
|
@@ -238,4 +334,5 @@ void wmi_concurrency_attach_tlv(wmi_unified_t wmi_handle)
|
|
|
send_set_mcc_channel_time_latency_cmd_tlv;
|
|
|
ops->send_set_mcc_channel_time_quota_cmd =
|
|
|
send_set_mcc_channel_time_quota_cmd_tlv;
|
|
|
+ wmi_mcc_quota_evt_attach_tlv(wmi_handle);
|
|
|
}
|