qcacld-3.0: User MCC quota setting

Set the MCC quota for a given interface.

Change-Id: I313cdf1673f8fc5f50a049d429c0d88fd213e66f
CRs-Fixed: 3106146
This commit is contained in:
Madhvapathi Sriram
2021-12-09 15:17:22 +05:30
committed by Madan Koyyalamudi
parent ec454ae3e5
commit 79e13b55ab
13 changed files with 675 additions and 23 deletions

View File

@@ -761,7 +761,6 @@ QDF_STATUS wlan_mlme_get_sap_chan_switch_rate_enabled(struct wlan_objmgr_psoc
/**
* wlan_mlme_get_sap_force_11n_for_11ac() - get the sap 11n for 11ac
*
* @psoc: pointer to psoc object
* @value: Value that needs to be set from the caller
*
@@ -772,7 +771,6 @@ QDF_STATUS wlan_mlme_get_sap_force_11n_for_11ac(struct wlan_objmgr_psoc
/**
* wlan_mlme_get_go_force_11n_for_11ac() - get the go 11n for 11ac
*
* @psoc: pointer to psoc object
* @value: Value that needs to be set from the caller
*
@@ -783,7 +781,6 @@ QDF_STATUS wlan_mlme_get_go_force_11n_for_11ac(struct wlan_objmgr_psoc
/**
* wlan_mlme_is_go_11ac_override() - Override 11ac bandwdith for P2P GO
*
* @psoc: pointer to psoc object
* @value: pointer to the value which will be filled for the caller
*
@@ -794,7 +791,6 @@ QDF_STATUS wlan_mlme_is_go_11ac_override(struct wlan_objmgr_psoc *psoc,
/**
* wlan_mlme_is_sap_11ac_override() - Override 11ac bandwdith for SAP
*
* @psoc: pointer to psoc object
* @value: pointer to the value which will be filled for the caller
*
@@ -805,7 +801,6 @@ QDF_STATUS wlan_mlme_is_sap_11ac_override(struct wlan_objmgr_psoc *psoc,
/**
* wlan_mlme_set_go_11ac_override() - set override 11ac bandwdith for P2P GO
*
* @psoc: pointer to psoc object
* @value: pointer to the value which will be filled for the caller
*
@@ -816,7 +811,6 @@ QDF_STATUS wlan_mlme_set_go_11ac_override(struct wlan_objmgr_psoc *psoc,
/**
* wlan_mlme_set_sap_11ac_override() - set override 11ac bandwdith for SAP
*
* @psoc: pointer to psoc object
* @value: pointer to the value which will be filled for the caller
*
@@ -946,7 +940,6 @@ QDF_STATUS wlan_mlme_cfg_get_enable_ul_ofdm(struct wlan_objmgr_psoc *psoc,
/**
* mlme_update_tgt_he_caps_in_cfg() - Update tgt he cap in mlme component
*
* @psoc: pointer to psoc object
* @cfg: pointer to config params from target
*
@@ -962,7 +955,6 @@ QDF_STATUS mlme_update_tgt_he_caps_in_cfg(struct wlan_objmgr_psoc *psoc,
#ifdef WLAN_FEATURE_11BE
/**
* mlme_update_tgt_eht_caps_in_cfg() - Update tgt eht cap in mlme component
*
* @psoc: pointer to psoc object
* @cfg: pointer to config params from target
*
@@ -2262,7 +2254,6 @@ wlan_mlme_is_relaxed_6ghz_conn_policy_enabled(struct wlan_objmgr_psoc *psoc,
/**
* wlan_mlme_get_sta_miracast_mcc_rest_time() - Get STA/MIRACAST MCC rest time
*
* @psoc: pointer to psoc object
* @value: value which needs to filled by API
*
@@ -2276,7 +2267,6 @@ wlan_mlme_get_sta_miracast_mcc_rest_time(struct wlan_objmgr_psoc *psoc,
/**
* wlan_mlme_get_scan_probe_unicast_ra() - Get scan probe unicast RA cfg
*
* @psoc: pointer to psoc object
* @value: value which needs to filled by API
*
@@ -2290,7 +2280,6 @@ wlan_mlme_get_scan_probe_unicast_ra(struct wlan_objmgr_psoc *psoc,
/**
* wlan_mlme_set_scan_probe_unicast_ra() - Set scan probe unicast RA cfg
*
* @psoc: pointer to psoc object
* @value: set value
*
@@ -2304,7 +2293,6 @@ wlan_mlme_set_scan_probe_unicast_ra(struct wlan_objmgr_psoc *psoc,
/**
* wlan_mlme_get_sap_mcc_chnl_avoid() - Check if SAP MCC needs to be avoided
*
* @psoc: pointer to psoc object
* @value: value which needs to filled by API
*
@@ -2318,7 +2306,6 @@ wlan_mlme_get_sap_mcc_chnl_avoid(struct wlan_objmgr_psoc *psoc,
uint8_t *value);
/**
* wlan_mlme_get_mcc_bcast_prob_resp() - Get broadcast probe rsp in MCC
*
* @psoc: pointer to psoc object
* @value: value which needs to filled by API
*
@@ -2333,7 +2320,6 @@ wlan_mlme_get_mcc_bcast_prob_resp(struct wlan_objmgr_psoc *psoc,
uint8_t *value);
/**
* wlan_mlme_get_mcc_rts_cts_prot() - To get RTS-CTS protection in MCC.
*
* @psoc: pointer to psoc object
* @value: value which needs to filled by API
*
@@ -2348,7 +2334,6 @@ wlan_mlme_get_mcc_rts_cts_prot(struct wlan_objmgr_psoc *psoc,
uint8_t *value);
/**
* wlan_mlme_get_mcc_feature() - To find out to enable/disable MCC feature
*
* @psoc: pointer to psoc object
* @value: value which needs to filled by API
*
@@ -3396,7 +3381,6 @@ bool mlme_get_user_ps(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id);
#ifdef WLAN_FEATURE_P2P_P2P_STA
/**
* wlan_mlme_get_p2p_p2p_conc_support() - Get p2p+p2p conc support
*
* @psoc: pointer to psoc object
* @val : value
*
@@ -3421,7 +3405,6 @@ enum phy_ch_width mlme_get_vht_ch_width(void);
/**
* wlan_mlme_get_mgmt_hw_tx_retry_count() - Get mgmt frame hw tx retry count
*
* @psoc: pointer to psoc object
* @frm_type: frame type of the query
*
@@ -3433,7 +3416,6 @@ wlan_mlme_get_mgmt_hw_tx_retry_count(struct wlan_objmgr_psoc *psoc,
/**
* wlan_mlme_get_tx_retry_multiplier() - Get the tx retry multiplier percentage
*
* @psoc: pointer to psoc object
* @tx_retry_multiplier: pointer to hold user config value of
* tx_retry_multiplier
@@ -3469,4 +3451,54 @@ QDF_STATUS
wlan_mlme_update_ratemask_params(struct wlan_objmgr_vdev *vdev,
uint8_t num_ratemask,
struct config_ratemask_params *rate_params);
#ifdef WLAN_FEATURE_MCC_QUOTA
/**
* wlan_mlme_set_user_mcc_quota() - set the user mcc quota in mlme
* @psoc: pointer to psoc object
* @quota: pointer to user set mcc quota object
*
* Return: QDF Status
*/
QDF_STATUS wlan_mlme_set_user_mcc_quota(struct wlan_objmgr_psoc *psoc,
struct wlan_user_mcc_quota *quota);
/**
* wlan_mlme_get_user_mcc_quota() - Get the user mcc quota from mlme
* @psoc: pointer to psoc object
* @quota: pointer to user set mcc quota object
*
* Return: QDF Status
*/
QDF_STATUS wlan_mlme_get_user_mcc_quota(struct wlan_objmgr_psoc *psoc,
struct wlan_user_mcc_quota *quota);
/**
* wlan_mlme_get_user_mcc_duty_cycle_percentage() - Get user mcc duty cycle
* @psoc: pointer to psoc object
*
* Return: MCC duty cycle if MCC exists for the user MCC quota, else 0
*/
uint32_t
wlan_mlme_get_user_mcc_duty_cycle_percentage(struct wlan_objmgr_psoc *psoc);
#else
static inline QDF_STATUS
wlan_mlme_set_user_mcc_quota(struct wlan_objmgr_psoc *psoc,
struct wlan_user_mcc_quota *quota)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS
wlan_mlme_get_user_mcc_quota(struct wlan_objmgr_psoc *psoc,
struct wlan_user_mcc_quota *quota)
{
return QDF_STATUS_E_NOSUPPORT;
}
static inline uint32_t
wlan_mlme_get_user_mcc_duty_cycle_percentage(struct wlan_objmgr_psoc *psoc)
{
return 0;
}
#endif /* WLAN_FEATURE_MCC_QUOTA */
#endif /* _WLAN_MLME_API_H_ */

View File

@@ -1290,6 +1290,18 @@ enum mlme_cfg_frame_type {
#define MAX_MGMT_HW_TX_RETRY_COUNT 127
/**
* struct wlan_user_mcc_quota - User MCC quota configuration
* @op_mode: Mode for which MCC quota needs to be applied
* @quota: User MCC quota value
* @vdev_id: Intended VDEV id for the quota
*/
struct wlan_user_mcc_quota {
enum QDF_OPMODE op_mode;
uint8_t quota;
uint8_t vdev_id;
};
/* struct wlan_mlme_generic - Generic CFG config items
*
* @band_capability: HW Band Capability - Both or 2.4G only or 5G only
@@ -1391,6 +1403,9 @@ struct wlan_mlme_generic {
#ifdef CONFIG_BAND_6GHZ
bool relaxed_6ghz_conn_policy;
#endif
#ifdef WLAN_FEATURE_MCC_QUOTA
struct wlan_user_mcc_quota user_mcc_quota;
#endif
};
/*

View File

@@ -4443,7 +4443,6 @@ bool ucfg_mlme_get_coex_unsafe_chan_reg_disable(
*
* Return: QDF_STATUS
*/
static inline QDF_STATUS
ucfg_set_ratemask_params(struct wlan_objmgr_vdev *vdev,
uint8_t num_ratemask,
@@ -4452,4 +4451,54 @@ ucfg_set_ratemask_params(struct wlan_objmgr_vdev *vdev,
return wlan_mlme_update_ratemask_params(vdev, num_ratemask,
rate_params);
}
/*
* ucfg_mlme_set_user_mcc_quota() - Set the user set mcc quota in mlme
* value
* @psoc: pointer to psoc object
* @quota: pointer to user mcc quota object
*
* Return: QDF Status
*/
static inline
QDF_STATUS ucfg_mlme_set_user_mcc_quota(struct wlan_objmgr_psoc *psoc,
struct wlan_user_mcc_quota *quota)
{
return wlan_mlme_set_user_mcc_quota(psoc, quota);
}
/**
* ucfg_mlme_get_user_mcc_quota() - Get the user set mcc quota from mlme
* value
* @psoc: pointer to psoc object
* @quota: pointer to user mcc quota object
*
* Return: QDF Status
*/
static inline
QDF_STATUS ucfg_mlme_get_user_mcc_quota(struct wlan_objmgr_psoc *psoc,
struct wlan_user_mcc_quota *quota)
{
return wlan_mlme_get_user_mcc_quota(psoc, quota);
}
/**
* ucfg_mlme_get_user_mcc_quota_percentage() - Get user mcc quota percentage
* duty-cycle for a i/f type or mode
* @psoc: pointer to psoc object
*
* MCC duty-cycle value in below format
* ******************************************************
* |bit 31-24 | bit 23-16 | bits 15-8 |bits 7-0 |
* | Unused | Quota for | chan. # for |chan. # for|
* | | 1st chan | 1st chan. |2nd chan. |
* *****************************************************
*
* Return: primary iface MCC duty-cycle value
*/
static inline
uint32_t ucfg_mlme_get_user_mcc_quota_percentage(struct wlan_objmgr_psoc *psoc)
{
return wlan_mlme_get_user_mcc_duty_cycle_percentage(psoc);
}
#endif /* _WLAN_MLME_UCFG_API_H_ */

View File

@@ -5462,3 +5462,133 @@ wlan_mlme_update_ratemask_params(struct wlan_objmgr_vdev *vdev,
}
return QDF_STATUS_SUCCESS;
}
#ifdef WLAN_FEATURE_MCC_QUOTA
#define WLAN_MCC_MIN_QUOTA 10 /* in %age */
#define WLAN_MCC_MAX_QUOTA 90 /* in %age */
QDF_STATUS wlan_mlme_set_user_mcc_quota(struct wlan_objmgr_psoc *psoc,
struct wlan_user_mcc_quota *quota)
{
struct wlan_mlme_psoc_ext_obj *mlme_obj;
if (!quota)
return QDF_STATUS_E_NULL_VALUE;
mlme_obj = mlme_get_psoc_ext_obj(psoc);
if (!mlme_obj)
return QDF_STATUS_E_FAILURE;
if (quota->quota < WLAN_MCC_MIN_QUOTA)
quota->quota = WLAN_MCC_MIN_QUOTA;
else if (quota->quota > WLAN_MCC_MAX_QUOTA)
quota->quota = WLAN_MCC_MAX_QUOTA;
mlme_obj->cfg.gen.user_mcc_quota.quota = quota->quota;
mlme_obj->cfg.gen.user_mcc_quota.op_mode = quota->op_mode;
mlme_obj->cfg.gen.user_mcc_quota.vdev_id = quota->vdev_id;
mlme_debug("quota : %u, op_mode : %d, vdev_id : %u",
quota->quota, quota->op_mode, quota->vdev_id);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS wlan_mlme_get_user_mcc_quota(struct wlan_objmgr_psoc *psoc,
struct wlan_user_mcc_quota *quota)
{
struct wlan_mlme_psoc_ext_obj *mlme_obj;
if (!quota)
return QDF_STATUS_E_NULL_VALUE;
mlme_obj = mlme_get_psoc_ext_obj(psoc);
if (!mlme_obj)
return QDF_STATUS_E_FAILURE;
quota->quota = mlme_obj->cfg.gen.user_mcc_quota.quota;
quota->op_mode = mlme_obj->cfg.gen.user_mcc_quota.op_mode;
quota->vdev_id = mlme_obj->cfg.gen.user_mcc_quota.vdev_id;
return QDF_STATUS_SUCCESS;
}
uint32_t
wlan_mlme_get_user_mcc_duty_cycle_percentage(struct wlan_objmgr_psoc *psoc)
{
uint32_t mcc_freq, ch_freq, quota_value;
struct wlan_user_mcc_quota quota;
uint8_t operating_channel;
int status;
quota.vdev_id = WLAN_UMAC_VDEV_ID_MAX;
quota.quota = 0;
if (QDF_IS_STATUS_ERROR(wlan_mlme_get_user_mcc_quota(psoc, &quota))) {
mlme_debug("Error getting user quota set");
return 0;
}
if (quota.vdev_id == WLAN_UMAC_VDEV_ID_MAX || quota.quota == 0) {
mlme_debug("Invalid quota : vdev %u, quota %u",
quota.vdev_id, quota.quota);
return 0;
}
status = policy_mgr_get_chan_by_session_id(psoc, quota.vdev_id,
&ch_freq);
if (QDF_IS_STATUS_ERROR(status)) {
mlme_debug("Could not get vdev %u chan", quota.vdev_id);
return 0;
}
mcc_freq = policy_mgr_get_mcc_operating_channel(psoc, quota.vdev_id);
if (mcc_freq == INVALID_CHANNEL_ID)
return 0;
operating_channel = wlan_freq_to_chan(ch_freq);
if (!operating_channel) {
mlme_debug("Primary op channel is invalid");
return 0;
}
/*
* The channel numbers for both adapters and the time
* quota for the 1st adapter, i.e., one specified in cmd
* are formatted as a bit vector
* ******************************************************
* |bit 31-24 | bit 23-16 | bits 15-8 |bits 7-0 |
* | Unused | Quota for | chan. # for |chan. # for|
* | | 1st chan | 1st chan. |2nd chan. |
* ******************************************************
*/
mlme_debug("Opmode (%d) vdev (%u) channel %u and quota %u",
quota.op_mode, quota.vdev_id,
operating_channel, quota.quota);
quota_value = quota.quota;
/* Move the time quota for first channel to bits 15-8 */
quota_value = quota_value << 8;
/*
* Store the channel number of 1st channel at bits 7-0
* of the bit vector
*/
quota_value |= operating_channel;
operating_channel = wlan_freq_to_chan(mcc_freq);
if (!operating_channel) {
mlme_debug("Secondary op channel is invalid");
return 0;
}
/*
* Now move the time quota and channel number of the
* 1st adapter to bits 23-16 and bits 15-8 of the bit
* vector, respectively.
*/
quota_value = quota_value << 8;
/*
* Set the channel number for 2nd MCC vdev at bits
* 7-0 of set_value
*/
quota_value |= operating_channel;
mlme_debug("quota value:%x", quota_value);
return quota_value;
}
#endif /* WLAN_FEATURE_MCC_QUOTA */