qcacld-3.0: Process MCC quota target event

Add and Register target if API to process MCC
quota wmi event. Deliver the event to existing
interfaces.

Change-Id: Ib044a336af2f5093dffbb053e65a52a174b85154
CRs-Fixed: 3101870
这个提交包含在:
Liangwei Dong
2021-12-20 17:44:58 +08:00
提交者 Madan Koyyalamudi
父节点 c823b9667c
当前提交 ea23c5f897
修改 12 个文件,包含 625 行新增3 行删除

查看文件

@@ -0,0 +1,43 @@
/*
* 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: offload lmac interface APIs for P2P MCC quota event processing
*/
#ifndef _TARGET_IF_P2P_MCC_QUOTA_H_
#define _TARGET_IF_P2P_MCC_QUOTA_H_
struct wlan_lmac_if_tx_ops;
#ifdef WLAN_FEATURE_MCC_QUOTA
/**
* target_if_mcc_quota_register_tx_ops() - Register mcc quota TX OPS
* @tx_ops: lmac if transmit ops
*
* Return: None
*/
void
target_if_mcc_quota_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops);
#else
static inline void
target_if_mcc_quota_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
{
}
#endif
#endif /* _TARGET_IF_P2P_MCC_QUOTA_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
@@ -24,6 +25,7 @@
#include <wlan_p2p_public_struct.h>
#include "target_if.h"
#include "target_if_p2p.h"
#include "target_if_p2p_mcc_quota.h"
#include "init_deinit_lmac.h"
static inline struct wlan_lmac_if_p2p_rx_ops *
@@ -474,6 +476,8 @@ void target_if_p2p_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
target_if_p2p_register_macaddr_rx_filter_evt_handler;
p2p_tx_ops->set_mac_addr_rx_filter_cmd =
target_if_p2p_set_mac_addr_rx_filter_cmd;
target_if_mcc_quota_register_tx_ops(tx_ops);
/* register P2P listen offload callbacks */
target_if_p2p_lo_register_tx_ops(p2p_tx_ops);
}

查看文件

@@ -0,0 +1,143 @@
/*
* 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: offload lmac interface APIs implementation for P2P mcc quota event
* processing
*/
#include <wmi_unified_api.h>
#include "wlan_p2p_mcc_quota_public_struct.h"
#include "target_if.h"
#include "target_if_p2p_mcc_quota.h"
/**
* target_if_mcc_quota_event_handler() - WMI callback for mcc_quota
* @scn: pointer to scn
* @event_buf: event buffer
* @len: buffer length
*
* This function gets called from WMI when triggered WMI event
* WMI_RESMGR_CHAN_TIME_QUOTA_CHANGED_EVENTID
*
* Return: 0 - success, others - failure
*/
static int target_if_mcc_quota_event_handler(ol_scn_t scn, uint8_t *data,
uint32_t datalen)
{
struct wlan_objmgr_psoc *psoc;
struct wmi_unified *wmi_handle;
struct mcc_quota_info *event_info;
struct wlan_lmac_if_rx_ops *rx_ops;
struct wlan_lmac_if_p2p_rx_ops *p2p_rx_ops;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
target_if_debug("scn:%pK, data:%pK, datalen:%d", scn, data, datalen);
if (!scn || !data) {
target_if_err("scn: 0x%pK, data: 0x%pK", scn, data);
return -EINVAL;
}
psoc = target_if_get_psoc_from_scn_hdl(scn);
if (!psoc) {
target_if_err("null psoc");
return -EINVAL;
}
wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
target_if_err("null wmi handle");
return -EINVAL;
}
event_info = qdf_mem_malloc(sizeof(*event_info));
if (!event_info)
return -ENOMEM;
if (wmi_extract_mcc_quota_ev_param(wmi_handle, data,
event_info)) {
target_if_err("failed to extract mcc quota event");
qdf_mem_free(event_info);
return -EINVAL;
}
rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
if (!rx_ops) {
target_if_err("failed to get soc rx ops");
qdf_mem_free(event_info);
return -EINVAL;
}
p2p_rx_ops = &rx_ops->p2p;
if (p2p_rx_ops->mcc_quota_ev_handler) {
status = p2p_rx_ops->mcc_quota_ev_handler(psoc, event_info);
if (QDF_IS_STATUS_ERROR(status))
target_if_debug("quota event handler, status:%d",
status);
} else {
target_if_debug("no valid mcc quota event handler");
}
qdf_mem_free(event_info);
return qdf_status_to_os_return(status);
}
/**
* target_if_register_mcc_quota_event_handler() - Register or unregister
* mcc quota wmi event handler
* @psoc: psoc object
* @reg: register or unregister flag
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
static QDF_STATUS
target_if_register_mcc_quota_event_handler(struct wlan_objmgr_psoc *psoc,
bool reg)
{
QDF_STATUS status;
wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
target_if_err("Invalid wmi handle");
return QDF_STATUS_E_INVAL;
}
if (reg) {
status = wmi_unified_register_event_handler(wmi_handle,
wmi_resmgr_chan_time_quota_changed_eventid,
target_if_mcc_quota_event_handler,
WMI_RX_SERIALIZER_CTX);
target_if_debug("wmi register mcc_quota event handle, status:%d",
status);
} else {
status = wmi_unified_unregister_event_handler(wmi_handle,
wmi_resmgr_chan_time_quota_changed_eventid);
target_if_debug("wmi unregister mcc_quota event handle, status:%d",
status);
}
return status;
}
void target_if_mcc_quota_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
{
struct wlan_lmac_if_p2p_tx_ops *p2p_tx_ops = &tx_ops->p2p;
p2p_tx_ops->reg_mcc_quota_ev_handler =
target_if_register_mcc_quota_event_handler;
}