qcacld-3.0: TWT cfg params initialization

Initialize TWT psoc cfg params with the cfg.ini values.

Change-Id: I326239d4f3f146113871fb3700fa82260988d697
CRs-Fixed: 3085507
This commit is contained in:
Srinivas Girigowda
2021-11-15 18:59:28 -08:00
committed by Madan Koyyalamudi
parent 840a791d8c
commit 0737e8caec
13 changed files with 466 additions and 14 deletions

View File

@@ -1,6 +1,7 @@
/*
* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2021-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
@@ -40,12 +41,6 @@
/* Max TWT sessions supported */
#define TWT_PSOC_MAX_SESSIONS TWT_PEER_MAX_SESSIONS
/* Valid dialog_id 0 to (0xFF - 1) */
#define TWT_MAX_DIALOG_ID (0xFF - 1)
/* dialog_id used to get all peer's twt session parameters */
#define TWT_GET_ALL_PEER_PARAMS_DIALOG_ID (0xFF)
/**
* ucfg_twt_get_peer_session_params() - Retrieves peer twt session parameters
* corresponding to a peer by using mac_addr and dialog id

View File

@@ -1253,6 +1253,7 @@ static void mlme_init_he_cap_in_cfg(struct wlan_objmgr_psoc *psoc,
}
#endif
#ifdef WLAN_SUPPORT_TWT
static void mlme_init_twt_cfg(struct wlan_objmgr_psoc *psoc,
struct wlan_mlme_cfg_twt *twt_cfg)
{
@@ -1264,6 +1265,12 @@ static void mlme_init_twt_cfg(struct wlan_objmgr_psoc *psoc,
twt_cfg->is_bcast_requestor_enabled = CFG_TWT_GET_BCAST_REQ(bcast_conf);
twt_cfg->is_bcast_responder_enabled = CFG_TWT_GET_BCAST_RES(bcast_conf);
}
#else
static void mlme_init_twt_cfg(struct wlan_objmgr_psoc *psoc,
struct wlan_mlme_cfg_twt *twt_cfg)
{
}
#endif
#ifdef WLAN_FEATURE_11BE
static void mlme_init_eht_cap_in_cfg(struct wlan_objmgr_psoc *psoc,

View File

@@ -61,6 +61,7 @@
#include "cfg_mlme_mwc.h"
#include "cfg_mlme_reg.h"
#include "cfg_mlme_eht_caps.h"
#include "cfg_twt.h"
/* Please Maintain Alphabetic Order here */
#define CFG_MLME_ALL \

View File

@@ -1,5 +1,6 @@
/*
* Copyright (c) 2011-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
@@ -22,7 +23,7 @@
#ifndef __CFG_MLME_TWT_H
#define __CFG_MLME_TWT_H
#if defined(WLAN_SUPPORT_TWT) && !defined(WLAN_TWT_CONV_SUPPORTED)
/*
* <ini>
* twt_requestor - twt requestor.
@@ -194,4 +195,5 @@
CFG(CFG_TWT_CONGESTION_TIMEOUT) \
CFG(CFG_BCAST_TWT_REQ_RESP) \
CFG(CFG_ENABLE_TWT_24GHZ)
#endif
#endif /* __CFG_MLME_TWT_H */

View File

@@ -31,7 +31,111 @@
#include <wlan_mlme_main.h>
#include <wlan_mlme_twt_api.h>
#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_FEATURE_11AX)
#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_FEATURE_11AX) && \
defined(WLAN_TWT_CONV_SUPPORTED)
static inline
QDF_STATUS ucfg_mlme_init_twt_context(struct wlan_objmgr_psoc *psoc,
struct qdf_mac_addr *peer_mac,
uint8_t dialog_id)
{
return QDF_STATUS_E_NOSUPPORT;
}
static inline bool
ucfg_mlme_is_twt_enabled(struct wlan_objmgr_psoc *psoc)
{
return QDF_STATUS_E_NOSUPPORT;
}
static inline QDF_STATUS
ucfg_mlme_get_twt_requestor(struct wlan_objmgr_psoc *psoc,
bool *val)
{
*val = false;
return QDF_STATUS_E_NOSUPPORT;
}
static inline QDF_STATUS
ucfg_mlme_set_twt_requestor(struct wlan_objmgr_psoc *psoc,
bool val)
{
return QDF_STATUS_E_NOSUPPORT;
}
static inline QDF_STATUS
ucfg_mlme_get_twt_responder(struct wlan_objmgr_psoc *psoc,
bool *val)
{
*val = false;
return QDF_STATUS_E_NOSUPPORT;
}
static inline QDF_STATUS
ucfg_mlme_set_twt_responder(struct wlan_objmgr_psoc *psoc,
bool val)
{
return QDF_STATUS_E_NOSUPPORT;
}
static inline bool
ucfg_mlme_is_twt_setup_done(struct wlan_objmgr_psoc *psoc,
struct qdf_mac_addr *peer_mac, uint8_t dialog_id)
{
return 0;
}
static inline void
ucfg_mlme_set_twt_setup_done(struct wlan_objmgr_psoc *psoc,
struct qdf_mac_addr *peer_mac,
uint8_t dialog_id, bool is_set)
{}
static inline
void ucfg_mlme_set_twt_session_state(struct wlan_objmgr_psoc *psoc,
struct qdf_mac_addr *peer_mac,
uint8_t dialog_id,
enum wlan_twt_session_state state)
{}
static inline enum wlan_twt_session_state
ucfg_mlme_get_twt_session_state(struct wlan_objmgr_psoc *psoc,
struct qdf_mac_addr *peer_mac,
uint8_t dialog_id)
{
return WLAN_TWT_SETUP_STATE_NOT_ESTABLISHED;
}
static inline QDF_STATUS
ucfg_mlme_set_twt_res_service_cap(struct wlan_objmgr_psoc *psoc, bool val)
{
return QDF_STATUS_E_NOSUPPORT;
}
static inline QDF_STATUS
ucfg_mlme_get_twt_res_service_cap(struct wlan_objmgr_psoc *psoc, bool *val)
{
*val = false;
return QDF_STATUS_E_NOSUPPORT;
}
static inline QDF_STATUS
ucfg_mlme_reset_twt_active_cmd(struct wlan_objmgr_psoc *psoc,
struct qdf_mac_addr *peer_mac,
uint8_t dialog_id)
{
return QDF_STATUS_E_NOSUPPORT;
}
static inline QDF_STATUS
ucfg_mlme_set_twt_command_in_progress(struct wlan_objmgr_psoc *psoc,
struct qdf_mac_addr *peer_mac,
uint8_t dialog_id,
enum wlan_twt_commands cmd)
{
return QDF_STATUS_E_FAILURE;
}
#elif defined(WLAN_SUPPORT_TWT) && defined(WLAN_FEATURE_11AX)
/**
* ucfg_mlme_get_twt_requestor() - Get twt requestor
* @psoc: pointer to psoc object

View File

@@ -25,7 +25,8 @@
#include "cfg_mlme_twt.h"
#include "wlan_mlme_twt_ucfg_api.h"
#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_FEATURE_11AX)
#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_FEATURE_11AX) && \
!defined(WLAN_TWT_CONV_SUPPORTED)
QDF_STATUS
ucfg_mlme_get_twt_requestor(struct wlan_objmgr_psoc *psoc,
bool *val)

View File

@@ -24,23 +24,133 @@
QDF_STATUS wlan_twt_cfg_init(struct wlan_objmgr_psoc *psoc)
{
struct twt_psoc_priv_obj *twt_psoc;
psoc_twt_ext_cfg_params_t *twt_cfg;
uint32_t bcast_conf;
if (!psoc) {
twt_err("null psoc");
return QDF_STATUS_E_FAILURE;
}
twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
WLAN_UMAC_COMP_TWT);
if (!twt_psoc) {
twt_err("null twt psoc priv obj");
return QDF_STATUS_E_FAILURE;
}
twt_cfg = &twt_psoc->cfg_params;
bcast_conf = cfg_get(psoc, CFG_BCAST_TWT_REQ_RESP);
twt_cfg->enable_twt = cfg_get(psoc, CFG_ENABLE_TWT);
twt_cfg->twt_requestor = cfg_get(psoc, CFG_TWT_REQUESTOR);
twt_cfg->twt_responder = cfg_get(psoc, CFG_TWT_RESPONDER);
twt_cfg->twt_congestion_timeout =
cfg_get(psoc, CFG_TWT_CONGESTION_TIMEOUT);
twt_cfg->bcast_requestor_enabled = CFG_TWT_GET_BCAST_REQ(bcast_conf);
twt_cfg->bcast_responder_enabled = CFG_TWT_GET_BCAST_RES(bcast_conf);
twt_cfg->enable_twt_24ghz = cfg_get(psoc, CFG_ENABLE_TWT_24GHZ);
twt_cfg->flex_twt_sched = cfg_default(CFG_HE_FLEX_TWT_SCHED);
twt_cfg->req_flag = false;
twt_cfg->res_flag = false;
twt_debug("req: %d resp: %d", twt_cfg->twt_requestor,
twt_cfg->twt_responder);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS wlan_twt_cfg_deinit(struct wlan_objmgr_psoc *psoc)
{
struct twt_psoc_priv_obj *twt_psoc;
if (!psoc) {
twt_err("null psoc");
return QDF_STATUS_E_FAILURE;
}
twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
WLAN_UMAC_COMP_TWT);
if (!twt_psoc) {
twt_err("null twt psoc priv obj");
return QDF_STATUS_E_FAILURE;
}
qdf_mem_zero(&twt_psoc->cfg_params, sizeof(twt_psoc->cfg_params));
return QDF_STATUS_SUCCESS;
}
QDF_STATUS wlan_twt_cfg_update(struct wlan_objmgr_psoc *psoc)
{
struct twt_psoc_priv_obj *twt_psoc;
psoc_twt_ext_cfg_params_t *twt_cfg;
struct twt_tgt_caps *tgt_caps;
bool enable_twt;
if (!psoc) {
twt_err("null psoc");
return QDF_STATUS_E_FAILURE;
}
twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
WLAN_UMAC_COMP_TWT);
if (!twt_psoc) {
twt_err("null twt psoc priv obj");
return QDF_STATUS_E_FAILURE;
}
twt_cfg = &twt_psoc->cfg_params;
tgt_caps = &twt_psoc->twt_caps;
enable_twt = twt_cfg->enable_twt;
twt_cfg->twt_requestor = QDF_MIN(tgt_caps->twt_requestor,
(enable_twt && twt_cfg->twt_requestor));
twt_cfg->twt_responder = QDF_MIN(tgt_caps->twt_responder,
(enable_twt && twt_cfg->twt_responder));
twt_cfg->bcast_requestor_enabled =
QDF_MIN((tgt_caps->twt_bcast_req_support ||
tgt_caps->legacy_bcast_twt_support),
(enable_twt &&
twt_cfg->bcast_requestor_enabled));
twt_cfg->bcast_responder_enabled =
QDF_MIN((tgt_caps->twt_bcast_res_support ||
tgt_caps->legacy_bcast_twt_support),
(enable_twt &&
twt_cfg->bcast_responder_enabled));
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
wlan_twt_cfg_get_requestor(struct wlan_objmgr_psoc *psoc, bool *val)
{
struct twt_psoc_priv_obj *twt_psoc_obj;
twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
if (!twt_psoc_obj) {
*val = cfg_default(CFG_TWT_REQUESTOR);
return QDF_STATUS_E_INVAL;
}
*val = twt_psoc_obj->cfg_params.twt_requestor;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
wlan_twt_cfg_get_responder(struct wlan_objmgr_psoc *psoc, bool *val)
{
struct twt_psoc_priv_obj *twt_psoc_obj;
twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
if (!twt_psoc_obj) {
*val = cfg_default(CFG_TWT_RESPONDER);
return QDF_STATUS_E_INVAL;
}
*val = twt_psoc_obj->cfg_params.twt_responder;
return QDF_STATUS_SUCCESS;
}
@@ -48,60 +158,158 @@ QDF_STATUS
wlan_twt_cfg_get_congestion_timeout(struct wlan_objmgr_psoc *psoc,
uint32_t *val)
{
struct twt_psoc_priv_obj *twt_psoc_obj;
twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
if (!twt_psoc_obj) {
*val = cfg_default(CFG_TWT_CONGESTION_TIMEOUT);
return QDF_STATUS_E_INVAL;
}
*val = twt_psoc_obj->cfg_params.twt_congestion_timeout;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
wlan_twt_cfg_set_congestion_timeout(struct wlan_objmgr_psoc *psoc, uint32_t val)
{
struct twt_psoc_priv_obj *twt_psoc_obj;
twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
if (!twt_psoc_obj)
return QDF_STATUS_E_INVAL;
twt_psoc_obj->cfg_params.twt_congestion_timeout = val;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
wlan_twt_cfg_get_requestor_flag(struct wlan_objmgr_psoc *psoc, bool *val)
{
struct twt_psoc_priv_obj *twt_psoc_obj;
twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
if (!twt_psoc_obj) {
*val = false;
return QDF_STATUS_E_INVAL;
}
*val = twt_psoc_obj->cfg_params.req_flag;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
wlan_twt_cfg_set_requestor_flag(struct wlan_objmgr_psoc *psoc, bool val)
{
struct twt_psoc_priv_obj *twt_psoc_obj;
twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
if (!twt_psoc_obj)
return QDF_STATUS_E_INVAL;
twt_psoc_obj->cfg_params.req_flag = val;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
wlan_twt_cfg_get_responder_flag(struct wlan_objmgr_psoc *psoc, bool *val)
{
struct twt_psoc_priv_obj *twt_psoc_obj;
twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
if (!twt_psoc_obj)
return QDF_STATUS_E_INVAL;
*val = twt_psoc_obj->cfg_params.res_flag;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
wlan_twt_cfg_set_responder_flag(struct wlan_objmgr_psoc *psoc, bool val)
{
struct twt_psoc_priv_obj *twt_psoc_obj;
twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
if (!twt_psoc_obj)
return QDF_STATUS_E_INVAL;
twt_psoc_obj->cfg_params.res_flag = val;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
wlan_twt_cfg_get_flex_sched(struct wlan_objmgr_psoc *psoc, bool *val)
{
struct twt_psoc_priv_obj *twt_psoc_obj;
twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
if (!twt_psoc_obj) {
*val = cfg_default(CFG_HE_FLEX_TWT_SCHED);
return QDF_STATUS_E_INVAL;
}
*val = twt_psoc_obj->cfg_params.flex_twt_sched;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
wlan_twt_cfg_get_24ghz_enabled(struct wlan_objmgr_psoc *psoc, bool *val)
{
struct twt_psoc_priv_obj *twt_psoc_obj;
twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
if (!twt_psoc_obj) {
*val = cfg_default(CFG_ENABLE_TWT_24GHZ);
return QDF_STATUS_E_INVAL;
}
*val = twt_psoc_obj->cfg_params.enable_twt_24ghz;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
wlan_twt_cfg_get_bcast_requestor(struct wlan_objmgr_psoc *psoc, bool *val)
{
struct twt_psoc_priv_obj *twt_psoc_obj;
twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
if (!twt_psoc_obj) {
uint32_t b_req_res;
b_req_res = cfg_default(CFG_BCAST_TWT_REQ_RESP);
*val = CFG_TWT_GET_BCAST_REQ(b_req_res);
return QDF_STATUS_E_INVAL;
}
*val = twt_psoc_obj->cfg_params.bcast_requestor_enabled;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
wlan_twt_cfg_get_bcast_responder(struct wlan_objmgr_psoc *psoc, bool *val)
{
struct twt_psoc_priv_obj *twt_psoc_obj;
twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
if (!twt_psoc_obj) {
uint32_t b_req_res;
b_req_res = cfg_default(CFG_BCAST_TWT_REQ_RESP);
*val = CFG_TWT_GET_BCAST_RES(b_req_res);
return QDF_STATUS_E_INVAL;
}
*val = twt_psoc_obj->cfg_params.bcast_responder_enabled;
return QDF_STATUS_SUCCESS;
}

View File

@@ -28,6 +28,16 @@
*/
QDF_STATUS wlan_twt_cfg_init(struct wlan_objmgr_psoc *psoc);
/**
* wlan_twt_cfg_deinit() - De-initialize twt config params
* @psoc: Pointer to global psoc
*
* This function de-initializes the twt private cfg params
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_twt_cfg_deinit(struct wlan_objmgr_psoc *psoc);
/**
* wlan_twt_cfg_update() - Update twt config params
* @psoc: Pointer to global psoc

View File

@@ -25,6 +25,11 @@ QDF_STATUS ucfg_twt_psoc_open(struct wlan_objmgr_psoc *psoc)
return wlan_twt_cfg_init(psoc);
}
QDF_STATUS ucfg_twt_psoc_close(struct wlan_objmgr_psoc *psoc)
{
return wlan_twt_cfg_deinit(psoc);
}
QDF_STATUS ucfg_twt_update_psoc_config(struct wlan_objmgr_psoc *psoc)
{
return wlan_twt_cfg_update(psoc);