qcacmn: Add MCC Quota event handler

Handle WMI event WMI_RESMGR_CHAN_TIME_QUOTA_CHANGED_EVENTID
and indicate to protocol layer.

Change-Id: Ie842998ed50a52351dd24857c0565c535a2edca1
CRs-Fixed: 3101765
This commit is contained in:
Liangwei Dong
2021-12-13 14:52:30 +08:00
committed by Madan Koyyalamudi
parent 8d0d85c7e4
commit 29ffc29223
8 changed files with 179 additions and 9 deletions

View File

@@ -551,6 +551,7 @@ struct p2p_set_mac_filter;
* @reg_mac_addr_rx_filter_handler: function pointer to register/unregister
* set mac addr status event callback.
* @set_mac_addr_rx_filter_cmd: function pointer to set mac addr rx filter
* @reg_mcc_quota_ev_handler: function to register mcc_quota event handler
*/
struct wlan_lmac_if_p2p_tx_ops {
QDF_STATUS (*set_ps)(struct wlan_objmgr_psoc *psoc,
@@ -576,6 +577,10 @@ struct wlan_lmac_if_p2p_tx_ops {
QDF_STATUS (*set_mac_addr_rx_filter_cmd)(
struct wlan_objmgr_psoc *psoc,
struct p2p_set_mac_filter *param);
#ifdef WLAN_FEATURE_MCC_QUOTA
QDF_STATUS (*reg_mcc_quota_ev_handler)(struct wlan_objmgr_psoc *psoc,
bool reg);
#endif
};
#endif
@@ -1598,6 +1603,7 @@ struct wlan_lmac_if_reg_rx_ops {
struct p2p_noa_info;
struct p2p_lo_event;
struct p2p_set_mac_filter_evt;
struct mcc_quota_info;
/**
* struct wlan_lmac_if_p2p_rx_ops - structure of rx function pointers
@@ -1606,6 +1612,7 @@ struct p2p_set_mac_filter_evt;
* @noa_ev_handler: function pointer to give noa event
* @add_mac_addr_filter_evt_handler: function pointer to process add mac addr
* rx filter event
* @mcc_quota_ev_handler: function pointer to receive mcc quota event
*/
struct wlan_lmac_if_p2p_rx_ops {
#ifdef FEATURE_P2P_LISTEN_OFFLOAD
@@ -1617,7 +1624,10 @@ struct wlan_lmac_if_p2p_rx_ops {
QDF_STATUS (*add_mac_addr_filter_evt_handler)(
struct wlan_objmgr_psoc *psoc,
struct p2p_set_mac_filter_evt *event_info);
#ifdef WLAN_FEATURE_MCC_QUOTA
QDF_STATUS (*mcc_quota_ev_handler)(struct wlan_objmgr_psoc *psoc,
struct mcc_quota_info *event_info);
#endif
};
#endif

View File

@@ -459,24 +459,41 @@ static void wlan_lmac_if_umac_reg_rx_ops_register(
}
#ifdef CONVERGED_P2P_ENABLE
#ifdef FEATURE_P2P_LISTEN_OFFLOAD
static void wlan_lmac_if_umac_rx_ops_register_p2p(
struct wlan_lmac_if_rx_ops *rx_ops)
#ifdef WLAN_FEATURE_MCC_QUOTA
static inline void
wlan_lmac_if_umac_rx_ops_register_p2p_mcc_quota(struct wlan_lmac_if_rx_ops *rx_ops)
{
rx_ops->p2p.lo_ev_handler = tgt_p2p_lo_event_cb;
rx_ops->p2p.noa_ev_handler = tgt_p2p_noa_event_cb;
rx_ops->p2p.add_mac_addr_filter_evt_handler =
tgt_p2p_add_mac_addr_status_event_cb;
rx_ops->p2p.mcc_quota_ev_handler = tgt_p2p_mcc_quota_event_cb;
}
#else
static inline void wlan_lmac_if_umac_rx_ops_register_p2p_mcc_quota(
struct wlan_lmac_if_rx_ops *rx_ops)
{
}
#endif
#ifdef FEATURE_P2P_LISTEN_OFFLOAD
static inline void
wlan_lmac_if_umac_rx_ops_register_p2p_listen_offload(struct wlan_lmac_if_rx_ops *rx_ops)
{
rx_ops->p2p.lo_ev_handler = tgt_p2p_lo_event_cb;
}
#else
static inline void
wlan_lmac_if_umac_rx_ops_register_p2p_listen_offload(struct wlan_lmac_if_rx_ops *rx_ops)
{
}
#endif
static void wlan_lmac_if_umac_rx_ops_register_p2p(
struct wlan_lmac_if_rx_ops *rx_ops)
{
wlan_lmac_if_umac_rx_ops_register_p2p_listen_offload(rx_ops);
rx_ops->p2p.noa_ev_handler = tgt_p2p_noa_event_cb;
rx_ops->p2p.add_mac_addr_filter_evt_handler =
tgt_p2p_add_mac_addr_status_event_cb;
wlan_lmac_if_umac_rx_ops_register_p2p_mcc_quota(rx_ops);
}
#endif
#else
static void wlan_lmac_if_umac_rx_ops_register_p2p(
struct wlan_lmac_if_rx_ops *rx_ops)

View File

@@ -1,5 +1,6 @@
/*
* Copyright (c) 2013-2019 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
@@ -36,6 +37,20 @@ QDF_STATUS wmi_unified_set_mcc_channel_time_quota_cmd(
uint32_t adapter_1_chan_freq,
uint32_t adapter_1_quota, uint32_t adapter_2_chan_freq);
#ifdef WLAN_FEATURE_MCC_QUOTA
/**
* wmi_extract_mcc_quota_ev_param() - extract mcc_quota param from wmi event
* @wmi_handle: wmi handle
* @evt_buf: pointer to event buffer
* @param: Pointer to hold mcc_quota param
*
* Return: QDF_STATUS_SUCCESS on success or error code
*/
QDF_STATUS wmi_extract_mcc_quota_ev_param(wmi_unified_t wmi_handle,
void *evt_buf,
struct mcc_quota_info *param);
#endif
/**
* wmi_unified_set_mcc_channel_time_latency_cmd() - set MCC channel time latency
* @wmi_handle: wmi handle

View File

@@ -4894,6 +4894,9 @@ typedef enum {
#endif
#ifdef WLAN_FEATURE_11BE_MLO
wmi_vdev_quiet_offload_eventid,
#endif
#ifdef WLAN_FEATURE_MCC_QUOTA
wmi_resmgr_chan_time_quota_changed_eventid,
#endif
wmi_events_max,
} wmi_conv_event_id;

View File

@@ -720,6 +720,12 @@ QDF_STATUS (*send_set_mcc_channel_time_latency_cmd)
QDF_STATUS (*send_set_enable_disable_mcc_adaptive_scheduler_cmd)(
wmi_unified_t wmi_handle, uint32_t mcc_adaptive_scheduler,
uint32_t pdev_id);
#ifdef WLAN_FEATURE_MCC_QUOTA
QDF_STATUS (*extract_mcc_quota_ev_param)(wmi_unified_t wmi_handle,
void *evt_buf,
struct mcc_quota_info *param);
#endif
#endif /* WMI_CONCURRENCY_SUPPORT */
QDF_STATUS (*send_p2p_go_set_beacon_ie_cmd)(wmi_unified_t wmi_handle,

View File

@@ -1,5 +1,6 @@
/*
* Copyright (c) 2013-2019 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
@@ -59,3 +60,20 @@ QDF_STATUS wmi_unified_set_mcc_channel_time_quota_cmd(
return QDF_STATUS_E_FAILURE;
}
#ifdef WLAN_FEATURE_MCC_QUOTA
QDF_STATUS wmi_extract_mcc_quota_ev_param(wmi_unified_t wmi_handle,
void *evt_buf,
struct mcc_quota_info *param)
{
if (!wmi_handle) {
wmi_err("wmi handle is null");
return QDF_STATUS_E_INVAL;
}
if (wmi_handle->ops->extract_mcc_quota_ev_param)
return wmi_handle->ops->extract_mcc_quota_ev_param(
wmi_handle, evt_buf, param);
return QDF_STATUS_E_FAILURE;
}
#endif

View File

@@ -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);
}

View File

@@ -17998,6 +17998,10 @@ event_ids[wmi_roam_scan_chan_list_id] =
event_ids[wmi_vdev_quiet_offload_eventid] =
WMI_QUIET_HANDLING_EVENTID;
#endif
#ifdef WLAN_FEATURE_MCC_QUOTA
event_ids[wmi_resmgr_chan_time_quota_changed_eventid] =
WMI_RESMGR_CHAN_TIME_QUOTA_CHANGED_EVENTID;
#endif
}
#ifdef WLAN_FEATURE_LINK_LAYER_STATS