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
This commit is contained in:
Liangwei Dong
2021-12-20 17:44:58 +08:00
committed by Madan Koyyalamudi
parent c823b9667c
commit ea23c5f897
12 changed files with 625 additions and 3 deletions

View File

@@ -0,0 +1,74 @@
/*
* 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: Contains mcc quota event public data structure definations
*/
#ifndef _WLAN_P2P_MCC_QUOTA_PUBLIC_STRUCT_H_
#define _WLAN_P2P_MCC_QUOTA_PUBLIC_STRUCT_H_
#include <qdf_types.h>
struct wlan_objmgr_psoc;
struct wlan_objmgr_vdev;
/*
* Max possible unique home channel numbers that host can receive to
* struct mcc_quota_info from FW event. In real case, for two MACs DBS,
* each MAC has two unique home channels, max home channel can't exceed 4.
*/
#define MAX_MCC_QUOTA_CH_NUM 4
/**
* enum mcc_quota_type - mcc channel quota type
* @QUOTA_TYPE_CLEAR: target exits MCC state and clear mcc quota inforamtion
* @QUOTA_TYPE_FIXED: channel time quota is fixed and will not be changed
* @QUOTA_TYPE_DYNAMIC: channel time quota is dynamic and targe may change
* the quota based on the data activity
* @QUOTA_TYPE_UNKNOWN: unknown type
*/
enum mcc_quota_type {
QUOTA_TYPE_CLEAR,
QUOTA_TYPE_FIXED,
QUOTA_TYPE_DYNAMIC,
QUOTA_TYPE_UNKNOWN = 0xff
};
/**
* struct chan_quota - mcc channel quota
* @chan_mhz: frequency of the channel for which the quota is set
* @channel_time_quota: channel time quota expressed as percentage
*/
struct channel_quota {
uint32_t chan_mhz;
uint32_t channel_time_quota;
};
/**
* struct mcc_quota_info - mcc quota information
* @type: mcc quota type
* @num_chan_quota: number of channel quota in chan_quota
* @chan_quota: channel quota array
*/
struct mcc_quota_info {
enum mcc_quota_type type;
uint32_t num_chan_quota;
struct channel_quota chan_quota[MAX_MCC_QUOTA_CH_NUM];
};
#endif /* _WLAN_P2P_MCC_QUOTA_PUBLIC_STRUCT_H_ */

View File

@@ -0,0 +1,65 @@
/*
* 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: Contains p2p mcc quota event south bound interface definitions
*/
#ifndef _WLAN_P2P_MCC_QUOTA_TGT_API_H_
#define _WLAN_P2P_MCC_QUOTA_TGT_API_H_
#include <qdf_types.h>
struct wlan_objmgr_psoc;
#ifdef WLAN_FEATURE_MCC_QUOTA
/**
* tgt_p2p_register_mcc_quota_ev_handler() - register/unregister mcc quota
* wmi event handler
* @psoc: psoc object
* @reg: true for register, false for unregister
*
* This function will register or unregister mcc quota event handler
* in target if.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS tgt_p2p_register_mcc_quota_ev_handler(struct wlan_objmgr_psoc *psoc,
bool reg);
/**
* tgt_p2p_mcc_quota_event_cb() - mcc quota event callback handler
* @psoc: psoc object
* @event_info: mcc quota event
*
* This function will be called by target if to indicate mcc quota event
* to stack.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS tgt_p2p_mcc_quota_event_cb(struct wlan_objmgr_psoc *psoc,
struct mcc_quota_info *event_info);
#else
static inline
QDF_STATUS tgt_p2p_register_mcc_quota_ev_handler(struct wlan_objmgr_psoc *psoc,
bool reg)
{
return QDF_STATUS_SUCCESS;
}
#endif
#endif /* _WLAN_P2P_MCC_QUOTA_TGT_API_H_ */

View File

@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017-2018, 2020-2021 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,7 @@ struct p2p_ps_config;
struct p2p_lo_start;
struct p2p_lo_event;
struct p2p_protocol_callbacks;
struct mcc_quota_info;
/**
* p2p_rx_callback() - Callback for rx mgmt frame
@@ -86,6 +88,20 @@ typedef void (*p2p_lo_event_callback)(void *user_data,
typedef void (*p2p_event_callback)(void *user_data,
struct p2p_event *p2p_event);
/**
* mcc_quota_event_callback() - Callback for mcc quota
* @psoc: psoc object
* @vdev: vdev object
* @mcc_quota: mcc quota event information
*
* Callback to notify mcc quota event.
*
* Return: None
*/
typedef QDF_STATUS (*mcc_quota_event_callback)(struct wlan_objmgr_psoc *psoc,
struct wlan_objmgr_vdev *vdev,
struct mcc_quota_info *mcc_quota);
/**
* struct p2p_start_param - p2p soc start parameters. Below callbacks
* will be registered by the HDD
@@ -363,6 +379,27 @@ bool ucfg_p2p_check_random_mac(struct wlan_objmgr_psoc *soc, uint32_t vdev_id,
QDF_STATUS ucfg_p2p_register_callbacks(struct wlan_objmgr_psoc *soc,
struct p2p_protocol_callbacks *cb_obj);
#ifdef WLAN_FEATURE_MCC_QUOTA
/**
* ucfg_p2p_register_mcc_quota_event_os_if_cb() - Register OS IF mcc quota
* event callback
* @psoc: soc object
* @cb: os if callback for mcc quota event
*
* Return: QDF_STATUS_SUCCESS for success
*/
QDF_STATUS
ucfg_p2p_register_mcc_quota_event_os_if_cb(struct wlan_objmgr_psoc *psoc,
mcc_quota_event_callback cb);
#else
static inline QDF_STATUS
ucfg_p2p_register_mcc_quota_event_os_if_cb(struct wlan_objmgr_psoc *psoc,
mcc_quota_event_callback cb)
{
return QDF_STATUS_SUCCESS;
}
#endif
/**
* ucfg_p2p_status_scan() - Show P2P connection status when scanning
* @vdev: vdev context