qcacmn: Green AP UMAC componentization

Add APIs, structures for Green AP component.

Change-Id: I4a39470104c89c20eec5440b7ae251a764151fd5
CRs-Fixed: 2166428
This commit is contained in:
Himanshu Agarwal
2018-01-10 14:21:53 +05:30
committed by snandini
parent 73554f9a8c
commit b3c81ac057
22 changed files with 1139 additions and 110 deletions

View File

@@ -68,6 +68,10 @@
#include <wlan_spectral_utils_api.h>
#ifdef WLAN_SUPPORT_GREEN_AP
#include <wlan_green_ap_api.h>
#endif
/**
* DOC: This file provides various init/deinit trigger point for new
* components.
@@ -689,6 +693,28 @@ static QDF_STATUS dispatcher_dbr_psoc_disable(struct wlan_objmgr_psoc *psoc)
}
#endif /* DIRECT_BUF_RX_ENABLE */
#ifdef WLAN_SUPPORT_GREEN_AP
static QDF_STATUS dispatcher_green_ap_init(void)
{
return wlan_green_ap_init();
}
static QDF_STATUS dispatcher_green_ap_deinit(void)
{
return wlan_green_ap_deinit();
}
#else
static QDF_STATUS dispatcher_green_ap_init(void)
{
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS dispatcher_green_ap_deinit(void)
{
return QDF_STATUS_SUCCESS;
}
#endif
QDF_STATUS dispatcher_init(void)
{
if (QDF_STATUS_SUCCESS != wlan_objmgr_global_obj_init())
@@ -745,6 +771,9 @@ QDF_STATUS dispatcher_init(void)
if (QDF_STATUS_SUCCESS != dispatcher_spectral_init())
goto spectral_init_fail;
if (QDF_STATUS_SUCCESS != dispatcher_green_ap_init())
goto green_ap_init_fail;
/*
* scheduler INIT has to be the last as each component's
* initialization has to happen first and then at the end
@@ -756,6 +785,8 @@ QDF_STATUS dispatcher_init(void)
return QDF_STATUS_SUCCESS;
scheduler_init_fail:
dispatcher_green_ap_deinit();
green_ap_init_fail:
dispatcher_spectral_deinit();
spectral_init_fail:
dispatcher_splitmac_deinit();
@@ -801,6 +832,8 @@ QDF_STATUS dispatcher_deinit(void)
{
QDF_BUG(QDF_STATUS_SUCCESS == scheduler_deinit());
QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_green_ap_deinit());
QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_spectral_deinit());
QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_splitmac_deinit());

View File

@@ -324,6 +324,7 @@ typedef void (*qdf_timer_func_t)(void *);
* @QDF_MODULE_ID_CDP: Converged Data Path module ID
* @QDF_MODULE_ID_DIRECT_BUF_RX: Direct Buffer Receive module ID
* @QDF_MODULE_ID_DISA: DISA (encryption test) module ID
* @QDF_MODULE_ID_GREEN_AP: Green AP related logging
* @QDF_MODULE_ID_ANY: anything
* @QDF_MODULE_ID_MAX: Max place holder module ID
*/
@@ -420,6 +421,7 @@ typedef enum {
QDF_MODULE_ID_CDP,
QDF_MODULE_ID_DIRECT_BUF_RX,
QDF_MODULE_ID_DISA,
QDF_MODULE_ID_GREEN_AP,
QDF_MODULE_ID_ANY,
QDF_MODULE_ID_MAX,
} QDF_MODULE_ID;

View File

@@ -2118,6 +2118,7 @@ struct category_name_info g_qdf_category_name[MAX_SUPPORTED_CATEGORY] = {
[QDF_MODULE_ID_ROAM_DEBUG] = {"roam debug"},
[QDF_MODULE_ID_DIRECT_BUF_RX] = {"DIRECT_BUF_RX"},
[QDF_MODULE_ID_DISA] = {"disa"},
[QDF_MODULE_ID_GREEN_AP] = {"GREEN_AP"},
[QDF_MODULE_ID_ANY] = {"ANY"},
};
EXPORT_SYMBOL(g_qdf_category_name);
@@ -2586,6 +2587,7 @@ static void set_default_trace_levels(struct category_info *cinfo)
[QDF_MODULE_ID_NSS] = QDF_TRACE_LEVEL_ERROR,
[QDF_MODULE_ID_ROAM_DEBUG] = QDF_TRACE_LEVEL_ERROR,
[QDF_MODULE_ID_DIRECT_BUF_RX] = QDF_TRACE_LEVEL_ERROR,
[QDF_MODULE_ID_GREEN_AP] = QDF_TRACE_LEVEL_ERROR,
[QDF_MODULE_ID_ANY] = QDF_TRACE_LEVEL_NONE,
};

View File

@@ -58,6 +58,9 @@
#ifdef WLAN_OFFCHAN_TXRX_ENABLE
#include <target_if_offchan_txrx_api.h>
#endif
#ifdef WLAN_SUPPORT_GREEN_AP
#include <target_if_green_ap.h>
#endif
#ifdef DIRECT_BUF_RX_ENABLE
#include <target_if_direct_buf_rx_api.h>
@@ -259,6 +262,20 @@ static void target_if_direct_buf_rx_tx_ops_register(
}
#endif /* DIRECT_BUF_RX_ENABLE */
#ifdef WLAN_SUPPORT_GREEN_AP
static QDF_STATUS target_if_green_ap_tx_ops_register(
struct wlan_lmac_if_tx_ops *tx_ops)
{
return target_if_register_green_ap_tx_ops(tx_ops);
}
#else
static QDF_STATUS target_if_green_ap_tx_ops_register(
struct wlan_lmac_if_tx_ops *tx_ops)
{
return QDF_STATUS_SUCCESS;
}
#endif /* WLAN_SUPPORT_GREEN_AP */
static void target_if_target_tx_ops_register(
struct wlan_lmac_if_tx_ops *tx_ops)
{
@@ -314,6 +331,8 @@ QDF_STATUS target_if_register_umac_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
target_if_offchan_txrx_ops_register(tx_ops);
target_if_green_ap_tx_ops_register(tx_ops);
/* Converged UMAC components to register their TX-ops here */
return QDF_STATUS_SUCCESS;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2018 The Linux Foundation. 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,23 +22,40 @@
#ifndef __TARGET_IF_GREEN_AP_H__
#define __TARGET_IF_GREEN_AP_H__
#include <wlan_objmgr_cmn.h>
#include <wlan_objmgr_pdev_obj.h>
#include <qdf_status.h>
#include <wlan_lmac_if_def.h>
/**
* target_if_green_ap_enable_egap() - Enable egap
* @pdev: pdev pointer
* target_if_register_green_ap_tx_ops() - lmac handler to register
* green ap tx_ops callback functions
* @tx_ops: wlan_lmac_if_tx_ops object
*
* @Return: None
* Return: QDF_STATUS in case of success
*/
void target_if_green_ap_enable_egap(struct wlan_objmgr_pdev *pdev);
QDF_STATUS target_if_register_green_ap_tx_ops(
struct wlan_lmac_if_tx_ops *tx_ops);
/**
* target_if_green_ap_set_ps_on_off() - PS toggle
* target_if_green_ap_enable_egap() - enable enhanced green ap
* @pdev: pdev pointer
* @egap_params: enhanced green ap params
*
* @Return: QDF_STATUS_SUCCESS in case of success
*/
QDF_STATUS target_if_green_ap_enable_egap(
struct wlan_objmgr_pdev *pdev,
struct wlan_green_ap_egap_params *egap_params);
/**
* target_if_green_ap_set_ps_on_off() - Green AP PS toggle
* @pdev: pdev pointer
* @value: Value to send PS on/off to FW
* @pdev_id: pdev id
*
* @Return: None
* @Return: QDF_STATUS_SUCCESS in case of success
*/
void target_if_green_ap_set_ps_on_off(struct wlan_objmgr_pdev *pdev,
uint32_t value);
QDF_STATUS target_if_green_ap_set_ps_on_off(struct wlan_objmgr_pdev *pdev,
bool value, uint8_t pdev_id);
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2018 The Linux Foundation. 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
@@ -21,16 +21,67 @@
*/
#include <target_if_green_ap.h>
#include <wlan_objmgr_pdev_obj.h>
#include <wlan_green_ap_api.h>
#include <../../core/src/wlan_green_ap_main_i.h>
#include <target_if.h>
#include <wmi_unified_api.h>
void target_if_green_ap_enable_egap(struct wlan_objmgr_pdev *pdev)
QDF_STATUS target_if_register_green_ap_tx_ops(
struct wlan_lmac_if_tx_ops *tx_ops)
{
struct wlan_lmac_if_green_ap_tx_ops *green_ap_tx_ops;
if (!tx_ops) {
target_if_err("invalid tx_ops");
return QDF_STATUS_E_FAILURE;
}
green_ap_tx_ops = &tx_ops->green_ap_tx_ops;
green_ap_tx_ops->enable_egap = target_if_green_ap_enable_egap;
green_ap_tx_ops->ps_on_off_send = target_if_green_ap_set_ps_on_off;
return QDF_STATUS_SUCCESS;
}
void target_if_green_ap_set_ps_on_off(struct wlan_objmgr_pdev *pdev,
uint32_t value)
QDF_STATUS target_if_green_ap_enable_egap(
struct wlan_objmgr_pdev *pdev,
struct wlan_green_ap_egap_params *egap_params)
{
struct wlan_pdev_green_ap_ctx *green_ap_ctx;
if (!pdev) {
green_ap_err("pdev context passed is NULL");
return QDF_STATUS_E_INVAL;
}
green_ap_ctx = wlan_objmgr_pdev_get_comp_private_obj(
pdev, WLAN_UMAC_COMP_GREEN_AP);
if (!green_ap_ctx) {
green_ap_err("green ap context obtained is NULL");
return QDF_STATUS_E_FAILURE;
}
qdf_spin_lock_bh(&green_ap_ctx->lock);
if (!wlan_is_egap_enabled(green_ap_ctx)) {
green_ap_info("enhanced green ap support is not present");
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return QDF_STATUS_SUCCESS;
}
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return wmi_unified_egap_conf_params_cmd(GET_WMI_HDL_FROM_PDEV(pdev),
egap_params);
}
QDF_STATUS target_if_green_ap_set_ps_on_off(struct wlan_objmgr_pdev *pdev,
bool value, uint8_t pdev_id)
{
if (!pdev) {
green_ap_err("pdev context passed is NULL");
return QDF_STATUS_E_INVAL;
}
return wmi_unified_green_ap_ps_send(GET_WMI_HDL_FROM_PDEV(pdev),
value, pdev_id);
}

View File

@@ -122,6 +122,7 @@
* @WLAN_UMAC_COMP_OFFCHAN_TXRX: Offchan TxRx
* @WLAN_UMAC_COMP_SPLITMAC: SplitMAC
* @WLAN_UMAC_COMP_DISA: DISA encryption test
* @WLAN_UMAC_COMP_GREEN_AP: Green AP
*
* This id is static.
* On Adding new component, new id has to be assigned
@@ -149,6 +150,7 @@ enum wlan_umac_comp_id {
WLAN_UMAC_COMP_SPECTRAL,
WLAN_UMAC_COMP_SPLITMAC,
WLAN_UMAC_COMP_DISA,
WLAN_UMAC_COMP_GREEN_AP,
WLAN_UMAC_COMP_ID_MAX,
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -970,6 +970,19 @@ QDF_STATUS policy_mgr_get_channel_from_scan_result(
struct wlan_objmgr_psoc *psoc,
void *roam_profile, uint8_t *channel);
/**
* policy_mgr_mode_specific_num_open_sessions() - to get number of open sessions
* for a specific mode
* @psoc: PSOC object information
* @mode: device mode
* @num_sessions: to store num open sessions
*
* Return: QDF_STATUS
*/
QDF_STATUS policy_mgr_mode_specific_num_open_sessions(
struct wlan_objmgr_psoc *psoc, enum QDF_OPMODE mode,
uint8_t *num_sessions);
/**
* policy_mgr_concurrent_open_sessions_running() - Checks for
* concurrent open session

View File

@@ -2053,6 +2053,22 @@ enum policy_mgr_con_mode policy_mgr_convert_device_mode_to_qdf_type(
return mode;
}
QDF_STATUS policy_mgr_mode_specific_num_open_sessions(
struct wlan_objmgr_psoc *psoc, enum QDF_OPMODE mode,
uint8_t *num_sessions)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid context");
return QDF_STATUS_E_FAILURE;
}
*num_sessions = pm_ctx->no_of_open_sessions[mode];
return QDF_STATUS_SUCCESS;
}
/**
* policy_mgr_concurrent_open_sessions_running() - Checks for
* concurrent open session

View File

@@ -539,11 +539,28 @@ struct wlan_lmac_if_offchan_txrx_ops {
};
#endif
#ifdef WLAN_SUPPORT_GREEN_AP
struct wlan_green_ap_egap_params;
/**
* struct wlan_lmac_if_green_ap_tx_ops - structure of tx function
* pointers for green ap component
* @enable_egap: function pointer to send enable egap indication to fw
* @ps_on_off_send: function pointer to send enable/disable green ap ps to fw
*/
struct wlan_lmac_if_green_ap_tx_ops {
QDF_STATUS (*enable_egap)(struct wlan_objmgr_pdev *pdev,
struct wlan_green_ap_egap_params *egap_params);
QDF_STATUS (*ps_on_off_send)(struct wlan_objmgr_pdev *pdev,
bool value, uint8_t pdev_id);
};
#endif
/**
* struct wlan_lmac_if_tx_ops - south bound tx function pointers
* @mgmt_txrx_tx_ops: mgmt txrx tx ops
* @scan: scan tx ops
* @dfs_tx_ops: dfs tx ops.
* @green_ap_tx_ops: green_ap tx_ops
*
* Callback function tabled to be registered with umac.
* umac will use the functional table to send events/frames to lmac/wmi
@@ -599,6 +616,9 @@ struct wlan_lmac_if_tx_ops {
#ifdef DIRECT_BUF_RX_ENABLE
struct wlan_lmac_if_direct_buf_rx_tx_ops dbr_tx_ops;
#endif
#ifdef WLAN_SUPPORT_GREEN_AP
struct wlan_lmac_if_green_ap_tx_ops green_ap_tx_ops;
#endif
};
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2018 The Linux Foundation. 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
@@ -20,25 +20,258 @@
* DOC: This file contains main green ap function definitions
*/
#include <wlan_objmgr_pdev_obj.h>
#include "wlan_green_ap_main_i.h"
void wlan_green_ap_state_mc(struct wlan_objmgr_pdev *pdev,
enum wlan_green_ap_ps_event event)
struct wlan_lmac_if_green_ap_tx_ops *
wlan_psoc_get_green_ap_tx_ops(struct wlan_pdev_green_ap_ctx *green_ap_ctx)
{
struct wlan_objmgr_psoc *psoc;
struct wlan_objmgr_pdev *pdev = green_ap_ctx->pdev;
if (!pdev) {
green_ap_err("pdev context obtained is NULL");
return NULL;
}
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc) {
green_ap_err("pdev context obtained is NULL");
return NULL;
}
return &((psoc->soc_cb.tx_ops.green_ap_tx_ops));
}
void wlan_green_ap_ps_event_state_update(struct wlan_objmgr_pdev *pdev,
enum wlan_green_ap_ps_state state,
enum wlan_green_ap_ps_event event)
bool wlan_is_egap_enabled(struct wlan_pdev_green_ap_ctx *green_ap_ctx)
{
struct wlan_green_ap_egap_params *egap_params;
if (!green_ap_ctx) {
green_ap_err("green ap context passed is NULL");
return QDF_STATUS_E_INVAL;
}
egap_params = &green_ap_ctx->egap_params;
if (egap_params->fw_egap_support &&
egap_params->host_enable_egap &&
egap_params->egap_feature_flags)
return true;
return false;
}
int wlan_green_ap_timer_fn(struct wlan_objmgr_pdev *pdev)
/**
* wlan_green_ap_ps_event_state_update() - Update PS state and event
* @pdev: pdev pointer
* @state: ps state
* @event: ps event
*
* @Return: Success or Failure
*/
static QDF_STATUS wlan_green_ap_ps_event_state_update(
struct wlan_pdev_green_ap_ctx *green_ap_ctx,
enum wlan_green_ap_ps_state state,
enum wlan_green_ap_ps_event event)
{
if (!green_ap_ctx) {
green_ap_err("green ap context obtained is NULL");
return QDF_STATUS_E_FAILURE;
}
return 0;
green_ap_ctx->ps_state = state;
green_ap_ctx->ps_event = event;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS wlan_green_ap_state_mc(struct wlan_pdev_green_ap_ctx *green_ap_ctx,
enum wlan_green_ap_ps_event event)
{
struct wlan_lmac_if_green_ap_tx_ops *green_ap_tx_ops;
uint8_t pdev_id;
if (!green_ap_ctx) {
green_ap_err("green ap context obtained is NULL");
return QDF_STATUS_E_FAILURE;
}
if (!green_ap_ctx->pdev) {
green_ap_err("pdev obtained is NULL");
return QDF_STATUS_E_FAILURE;
}
pdev_id = wlan_objmgr_pdev_get_pdev_id(green_ap_ctx->pdev);
green_ap_tx_ops = wlan_psoc_get_green_ap_tx_ops(green_ap_ctx);
if (!green_ap_tx_ops) {
green_ap_err("green ap tx ops obtained are NULL");
return QDF_STATUS_E_FAILURE;
}
if (!green_ap_tx_ops->ps_on_off_send) {
green_ap_err("tx op for sending enbale/disable green ap is NULL");
return QDF_STATUS_E_FAILURE;
}
qdf_spin_lock_bh(&green_ap_ctx->lock);
/* handle the green ap ps event */
switch (event) {
case WLAN_GREEN_AP_ADD_STA_EVENT:
green_ap_ctx->num_nodes++;
break;
case WLAN_GREEN_AP_DEL_STA_EVENT:
if (green_ap_ctx->num_nodes)
green_ap_ctx->num_nodes--;
break;
case WLAN_GREEN_AP_PS_START_EVENT:
case WLAN_GREEN_AP_PS_STOP_EVENT:
case WLAN_GREEN_AP_PS_ON_EVENT:
case WLAN_GREEN_AP_PS_WAIT_EVENT:
break;
default:
green_ap_err("Invalid event: %d", event);
break;
}
green_ap_debug("Green-AP event: %d, state: %d, num_nodes: %d",
event, green_ap_ctx->ps_state, green_ap_ctx->num_nodes);
/* Confirm that power save is enabled before doing state transitions */
if (!green_ap_ctx->ps_enable) {
green_ap_debug("Green-AP is disabled");
wlan_green_ap_ps_event_state_update(
green_ap_ctx,
WLAN_GREEN_AP_PS_IDLE_STATE,
WLAN_GREEN_AP_PS_WAIT_EVENT);
if (green_ap_tx_ops->ps_on_off_send(green_ap_ctx->pdev,
false, pdev_id))
green_ap_err("failed to set green ap mode");
goto done;
}
/* handle the green ap ps state */
switch (green_ap_ctx->ps_state) {
case WLAN_GREEN_AP_PS_IDLE_STATE:
if (green_ap_ctx->num_nodes) {
/* Active nodes present, Switchoff the power save */
green_ap_info("Transition to OFF from IDLE");
wlan_green_ap_ps_event_state_update(
green_ap_ctx,
WLAN_GREEN_AP_PS_OFF_STATE,
WLAN_GREEN_AP_PS_WAIT_EVENT);
} else {
/* No Active nodes, get into power save */
green_ap_info("Transition to WAIT from IDLE");
wlan_green_ap_ps_event_state_update(
green_ap_ctx,
WLAN_GREEN_AP_PS_WAIT_STATE,
WLAN_GREEN_AP_PS_WAIT_EVENT);
qdf_timer_start(&green_ap_ctx->ps_timer,
green_ap_ctx->ps_trans_time);
}
break;
case WLAN_GREEN_AP_PS_OFF_STATE:
if (!green_ap_ctx->num_nodes) {
green_ap_info("Transition to WAIT from OFF");
wlan_green_ap_ps_event_state_update(
green_ap_ctx,
WLAN_GREEN_AP_PS_WAIT_STATE,
WLAN_GREEN_AP_PS_WAIT_EVENT);
qdf_timer_start(&green_ap_ctx->ps_timer,
green_ap_ctx->ps_trans_time);
}
break;
case WLAN_GREEN_AP_PS_WAIT_STATE:
if (!green_ap_ctx->num_nodes) {
wlan_green_ap_ps_event_state_update(
green_ap_ctx,
WLAN_GREEN_AP_PS_ON_STATE,
WLAN_GREEN_AP_PS_WAIT_EVENT);
green_ap_info("Transition to ON from WAIT");
green_ap_tx_ops->ps_on_off_send(green_ap_ctx->pdev,
true, pdev_id);
if (green_ap_ctx->ps_on_time)
qdf_timer_start(&green_ap_ctx->ps_timer,
green_ap_ctx->ps_on_time);
} else {
green_ap_info("Transition to OFF from WAIT");
qdf_timer_stop(&green_ap_ctx->ps_timer);
wlan_green_ap_ps_event_state_update(
green_ap_ctx,
WLAN_GREEN_AP_PS_OFF_STATE,
WLAN_GREEN_AP_PS_WAIT_EVENT);
}
break;
case WLAN_GREEN_AP_PS_ON_STATE:
if (green_ap_ctx->num_nodes) {
qdf_timer_stop(&green_ap_ctx->ps_timer);
if (green_ap_tx_ops->ps_on_off_send(
green_ap_ctx->pdev, false, pdev_id)) {
green_ap_err("Failed to set Green AP mode");
goto done;
}
green_ap_info("Transition to OFF from ON\n");
wlan_green_ap_ps_event_state_update(
green_ap_ctx,
WLAN_GREEN_AP_PS_OFF_STATE,
WLAN_GREEN_AP_PS_WAIT_EVENT);
} else if ((green_ap_ctx->ps_event ==
WLAN_GREEN_AP_PS_WAIT_EVENT) &&
(green_ap_ctx->ps_on_time)) {
/* ps_on_time timeout, switch to ps wait */
wlan_green_ap_ps_event_state_update(
green_ap_ctx,
WLAN_GREEN_AP_PS_WAIT_STATE,
WLAN_GREEN_AP_PS_ON_EVENT);
if (green_ap_tx_ops->ps_on_off_send(
green_ap_ctx->pdev, false, pdev_id)) {
green_ap_err("Failed to set Green AP mode");
goto done;
}
green_ap_info("Transition to WAIT from ON\n");
qdf_timer_start(&green_ap_ctx->ps_timer,
green_ap_ctx->ps_trans_time);
}
break;
default:
green_ap_err("invalid state %d", green_ap_ctx->ps_state);
wlan_green_ap_ps_event_state_update(
green_ap_ctx,
WLAN_GREEN_AP_PS_OFF_STATE,
WLAN_GREEN_AP_PS_WAIT_EVENT);
break;
}
done:
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return QDF_STATUS_SUCCESS;
}
void wlan_green_ap_timer_fn(void *pdev)
{
struct wlan_pdev_green_ap_ctx *green_ap_ctx;
struct wlan_objmgr_pdev *pdev_ctx = (struct wlan_objmgr_pdev *)pdev;
if (!pdev_ctx) {
green_ap_err("pdev context passed is NULL");
return;
}
green_ap_ctx = wlan_objmgr_pdev_get_comp_private_obj(
pdev_ctx, WLAN_UMAC_COMP_GREEN_AP);
if (!green_ap_ctx) {
green_ap_err("green ap context obtained is NULL");
return;
}
wlan_green_ap_state_mc(green_ap_ctx, green_ap_ctx->ps_event);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2018 The Linux Foundation. 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 +24,34 @@
#ifndef _WLAN_GREEN_AP_MAIN_I_H_
#define _WLAN_GREEN_AP_MAIN_I_H_
#include <wlan_objmgr_cmn.h>
#include <wlan_objmgr_pdev_obj.h>
#include <wlan_green_ap_api.h>
#include <qdf_types.h>
#include <qdf_status.h>
#include <qdf_timer.h>
#define WLAN_GREEN_AP_PS_ON_TIME (0)
#define WLAN_GREEN_AP_PS_TRANS_TIME (20)
#define green_ap_log(level, args...) \
QDF_TRACE(QDF_MODULE_ID_GREEN_AP, level, ## args)
#define green_ap_logfl(level, format, args...) \
green_ap_log(level, FL(format), ## args)
#define green_ap_alert(format, args...) \
green_ap_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args)
#define green_ap_err(format, args...) \
green_ap_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args)
#define green_apwarn(format, args...) \
green_ap_logfl(QDF_TRACE_LEVEL_WARN, format, ## args)
#define green_ap_notice(format, args...) \
green_ap_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
#define green_ap_info(format, args...) \
green_ap_logfl(QDF_TRACE_LEVEL_INFO_HIGH, format, ## args)
#define green_ap_debug(format, args...) \
green_ap_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
/**
* enum wlan_green_ap_ps_state - PS states
* @WLAN_GREEN_AP_PS_IDLE_STATE - Idle
@@ -59,54 +87,61 @@ enum wlan_green_ap_ps_event {
/**
* struct wlan_pdev_green_ap_ctx - green ap context
* @pdev - Pdev pointer
* @green_ap_ps_enable - Enable PS
* @green_ap_ps_on_time - PS on time, once enabled
* @green_ap_ps_trans_time - PS transition time
* @green_ap_num_node - Number of nodes associated to radio
* @ps_enable - Enable PS
* @ps_on_time - PS on time, once enabled
* @ps_trans_time - PS transition time
* @num_nodes - Number of nodes associated to radio
* @ps_state - PS state
* @ps_event - PS event
* @green_ap_ps_timer - Timer
* @green_ap_egap_support - Enhanced green ap support
* @ps_timer - Timer
* @lock: green ap spinlock
* @egap_params - Enhanced green ap params
*/
struct wlan_pdev_green_ap_ctx {
struct wlan_objmgr_pdev *pdev;
uint8_t green_ap_ps_enable;
uint8_t green_ap_ps_on_time;
uint32_t green_ap_ps_trans_time;
uint32_t green_ap_num_nodes;
uint8_t ps_enable;
uint8_t ps_on_time;
uint32_t ps_trans_time;
uint32_t num_nodes;
enum wlan_green_ap_ps_state ps_state;
enum wlan_green_ap_ps_event ps_event;
qdf_timer_t green_ap_ps_timer;
bool green_ap_egap_support;
qdf_timer_t ps_timer;
qdf_spinlock_t lock;
struct wlan_green_ap_egap_params egap_params;
};
/**
* wlan_green_ap_state_mc() - Green ap state machine
* @pdev: pdev pointer
* @event: ps event
* wlan_psoc_get_green_ap_tx_ops() - Obtain green ap tx ops from green ap ctx
* @green_ap_ctx: green ap context
*
* @Return: None
* @Return: green ap tx ops pointer
*/
void wlan_green_ap_state_mc(struct wlan_objmgr_pdev *pdev,
enum wlan_green_ap_ps_event event);
struct wlan_lmac_if_green_ap_tx_ops *
wlan_psoc_get_green_ap_tx_ops(struct wlan_pdev_green_ap_ctx *green_ap_ctx);
/**
* wlan_green_ap_ps_event_state_update() - Update PS state and event
* @pdev: pdev pointer
* @state: ps state
* wlan_is_egap_enabled() - Get Enhance Green AP feature status
* @green_ap_ctx: green ap context
*
* Return: true if firmware, feature_flag and ini are all egap enabled
*/
bool wlan_is_egap_enabled(struct wlan_pdev_green_ap_ctx *green_ap_ctx);
/**
* wlan_green_ap_state_mc() - Green ap state machine
* @green_ap_ctx: green ap context
* @event: ps event
*
* @Return: None
* @Return: Success or Failure
*/
void wlan_green_ap_ps_event_state_update(struct wlan_objmgr_pdev *pdev,
enum wlan_green_ap_ps_state state,
enum wlan_green_ap_ps_event event);
QDF_STATUS wlan_green_ap_state_mc(struct wlan_pdev_green_ap_ctx *green_ap_ctx,
enum wlan_green_ap_ps_event event);
/**
* wlan_green_ap_timer_fn() - Green ap timer callback
* @pdev: pdev pointer
*
* @Return: status
* @Return: None
*/
int wlan_green_ap_timer_fn(struct wlan_objmgr_pdev *pdev);
void wlan_green_ap_timer_fn(void *pdev);
#endif /* _WLAN_GREEN_AP_MAIN_I_H_ */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2018 The Linux Foundation. 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
@@ -23,7 +23,25 @@
#ifndef _WLAN_GREEN_AP_API_H_
#define _WLAN_GREEN_AP_API_H_
#include <wlan_objmgr_cmn.h>
#include <wlan_objmgr_pdev_obj.h>
#include <qdf_status.h>
/**
* struct wlan_green_ap_egap_params - enhance green ap params
* @fw_egap_support: fw enhance green ap support
* @host_enable_egap: HOST enhance green ap support
* @egap_inactivity_time: inactivity time
* @egap_wait_time: wait time
* @egap_feature_flags: feature flags
*/
struct wlan_green_ap_egap_params {
bool fw_egap_support;
bool host_enable_egap;
uint32_t egap_inactivity_time;
uint32_t egap_wait_time;
uint32_t egap_feature_flags;
};
/**
* wlan_green_ap_init() - initialize green ap component
@@ -43,7 +61,7 @@ QDF_STATUS wlan_green_ap_deinit(void);
* wlan_green_ap_start() - Start green ap
* @pdev: pdev pointer
*
* Call this function when the first vdev comes up
* Call this function when the first SAP comes up
*
* Return: Success or Failure
*/
@@ -53,7 +71,7 @@ QDF_STATUS wlan_green_ap_start(struct wlan_objmgr_pdev *pdev);
* wlan_green_ap_stop() - Stop green ap
* @pdev: pdev pointer
*
* Call this function when the last vdev goes down
* Call this function when the last SAP goes down
*
* Return: Success or Failure
*/
@@ -73,10 +91,9 @@ QDF_STATUS wlan_green_ap_add_sta(struct wlan_objmgr_pdev *pdev);
* wlan_green_ap_del_sta() - On disassociation
* @pdev: pdev pointer
*
* Call this function when new node is associated
* Call this function when new node is disassociated
*
* Return: Success or Failure
*/
QDF_STATUS wlan_green_ap_del_sta(struct wlan_objmgr_pdev *pdev);
#endif /* _WLAN_GREEN_AP_API_H_ */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2018 The Linux Foundation. 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
@@ -23,7 +23,97 @@
#ifndef _WLAN_GREEN_AP_UCFG_API_H_
#define _WLAN_GREEN_AP_UCFG_API_H_
#include <wlan_objmgr_cmn.h>
#include <wlan_objmgr_pdev_obj.h>
#include <qdf_status.h>
/**
* struct green_ap_user_cfg - green ap user cfg
* @host_enable_egap: HOST enhance green ap support
* @egap_inactivity_time: inactivity time
* @egap_wait_time: wait time
* @egap_feature_flags: feature flags
*/
struct green_ap_user_cfg {
bool host_enable_egap;
uint32_t egap_inactivity_time;
uint32_t egap_wait_time;
uint32_t egap_feature_flags;
};
/**
* ucfg_green_ap_update_user_config() - Updates user cfg for green ap
* @pdev: pdev pointer
* @green_ap_cfg: pointer to green ap user cfg structure
*
* Return: Success or Failure
*/
QDF_STATUS ucfg_green_ap_update_user_config(
struct wlan_objmgr_pdev *pdev,
struct green_ap_user_cfg *green_ap_cfg);
/**
* ucfg_green_ap_enable_egap() - Enable enhanced green ap
* @pdev: pdev pointer
*
* Return: Success or Failure
*/
QDF_STATUS ucfg_green_ap_enable_egap(struct wlan_objmgr_pdev *pdev);
/**
* ucfg_green_ap_target_config() - Handle Green AP target configuration
* @pdev: pdev pointer
* @fw_egap_support: fw egap support
*
* This API stores the fw enhanced green AP support capability
* in green ap ctx.
*
* Return: Success or Failure
*/
QDF_STATUS ucfg_green_ap_target_config(struct wlan_objmgr_pdev *pdev,
bool fw_egap_support);
/**
* ucfg_green_ap_set_ps_config() - Set ps value
* @pdev: pdev pointer
* @value - value to be set
*
* Return: Success or Failure
*/
QDF_STATUS ucfg_green_ap_set_ps_config(struct wlan_objmgr_pdev *pdev,
uint8_t value);
/**
* ucfg_green_ap_get_ps_config() - Check if ps is enabled or not
* @pdev: pdev pointer
* @ps_enable: pointer to ps enable config value
*
* Return: Success or Failure
*/
QDF_STATUS ucfg_green_ap_get_ps_config(struct wlan_objmgr_pdev *pdev,
uint8_t *ps_enable);
/**
* ucfg_green_ap_set_transition_time() - Set transition time
* @pdev: pdev pointer
* @val: transition time
*
* This API sets custom transition time
*
* Return: Success or Failure
*/
QDF_STATUS ucfg_green_ap_set_transition_time(struct wlan_objmgr_pdev *pdev,
uint32_t val);
/**
* ucfg_green_ap_get_transition_time() - Get transition time
* @pdev: pdev pointer
* @ps_trans_time: pointer to transition time
*
* This API gets transition time
*
* Return: Success or Failure
*/
QDF_STATUS ucfg_green_ap_get_transition_time(struct wlan_objmgr_pdev *pdev,
uint32_t *ps_trans_time);
#endif /* _WLAN_GREEN_AP_UCFG_API_H_ */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2018 The Linux Foundation. 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
@@ -19,48 +19,307 @@
/**
* DOC: This file contains green ap north bound interface definitions
*/
#include <qdf_status.h>
#include <wlan_green_ap_api.h>
#include <../../core/src/wlan_green_ap_main_i.h>
#include <wlan_objmgr_global_obj.h>
/**
* wlan_green_ap_pdev_obj_create_notification() - called from objmgr when pdev
* is created
* @pdev: pdev context
* @arg: argument
*
* This function gets called from object manager when pdev is being created and
* creates green ap context and attach it to objmgr.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
static QDF_STATUS wlan_green_ap_pdev_obj_create_notification(
struct wlan_objmgr_pdev *pdev, void *arg)
{
struct wlan_pdev_green_ap_ctx *green_ap_ctx;
QDF_STATUS status = QDF_STATUS_SUCCESS;
if (!pdev) {
green_ap_err("pdev context passed is NULL");
return QDF_STATUS_E_INVAL;
}
green_ap_ctx = qdf_mem_malloc(sizeof(*green_ap_ctx));
if (!green_ap_ctx) {
green_ap_err("Memory allocation for Green AP context failed!");
return QDF_STATUS_E_NOMEM;
}
green_ap_ctx->ps_state = WLAN_GREEN_AP_PS_IDLE_STATE;
green_ap_ctx->ps_event = WLAN_GREEN_AP_PS_WAIT_EVENT;
green_ap_ctx->num_nodes = 0;
green_ap_ctx->ps_on_time = WLAN_GREEN_AP_PS_ON_TIME * 1000;
green_ap_ctx->ps_trans_time = WLAN_GREEN_AP_PS_TRANS_TIME * 1000;
green_ap_ctx->pdev = pdev;
qdf_timer_init(NULL, &green_ap_ctx->ps_timer,
wlan_green_ap_timer_fn,
pdev, QDF_TIMER_TYPE_WAKE_APPS);
qdf_spinlock_create(&green_ap_ctx->lock);
if (wlan_objmgr_pdev_component_obj_attach(pdev,
WLAN_UMAC_COMP_GREEN_AP,
green_ap_ctx, QDF_STATUS_SUCCESS)
!= QDF_STATUS_SUCCESS) {
green_ap_err("Failed to attach green ap ctx in pdev ctx");
status = QDF_STATUS_E_FAILURE;
goto err_pdev_attach;
}
green_ap_info("Green AP creation successful, green ap ctx: %pK, pdev: %pK",
green_ap_ctx, pdev);
return QDF_STATUS_SUCCESS;
err_pdev_attach:
qdf_spinlock_destroy(&green_ap_ctx->lock);
qdf_timer_free(&green_ap_ctx->ps_timer);
qdf_mem_free(green_ap_ctx);
return status;
}
/**
* wlan_green_ap_pdev_obj_destroy_notification() - called from objmgr when
* pdev is destroyed
* @pdev: pdev context
* @arg: argument
*
* This function gets called from object manager when pdev is being destroyed
* and deletes green ap context and detach it from objmgr.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
static QDF_STATUS wlan_green_ap_pdev_obj_destroy_notification(
struct wlan_objmgr_pdev *pdev, void *arg)
{
struct wlan_pdev_green_ap_ctx *green_ap_ctx;
if (!pdev) {
green_ap_err("pdev context passed is NULL");
return QDF_STATUS_E_INVAL;
}
green_ap_ctx = wlan_objmgr_pdev_get_comp_private_obj(
pdev, WLAN_UMAC_COMP_GREEN_AP);
if (!green_ap_ctx) {
green_ap_err("green ap context is already NULL");
return QDF_STATUS_E_FAILURE;
}
green_ap_info("Deleting green ap pdev obj, green ap ctx: %pK, pdev: %pK",
green_ap_ctx, pdev);
if (wlan_objmgr_pdev_component_obj_detach(pdev,
WLAN_UMAC_COMP_GREEN_AP, green_ap_ctx) !=
QDF_STATUS_SUCCESS) {
green_ap_err("Failed to detach green ap ctx in psoc ctx");
return QDF_STATUS_E_FAILURE;
}
qdf_timer_free(&green_ap_ctx->ps_timer);
qdf_spinlock_destroy(&green_ap_ctx->lock);
qdf_mem_free(green_ap_ctx);
green_ap_info("green ap deletion successful, pdev: %pK", pdev);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS wlan_green_ap_init(void)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
status = wlan_objmgr_register_pdev_create_handler(
WLAN_UMAC_COMP_GREEN_AP,
wlan_green_ap_pdev_obj_create_notification,
NULL);
if (status != QDF_STATUS_SUCCESS) {
green_ap_err("Failed to register green ap obj create handler");
goto err_pdev_create;
}
status = wlan_objmgr_register_pdev_destroy_handler(
WLAN_UMAC_COMP_GREEN_AP,
wlan_green_ap_pdev_obj_destroy_notification,
NULL);
if (status != QDF_STATUS_SUCCESS) {
green_ap_err("Failed to register green ap obj destroy handler");
goto err_pdev_delete;
}
green_ap_info("Successfully registered create and destroy handlers with objmgr");
return QDF_STATUS_SUCCESS;
err_pdev_delete:
wlan_objmgr_unregister_pdev_create_handler(
WLAN_UMAC_COMP_GREEN_AP,
wlan_green_ap_pdev_obj_create_notification,
NULL);
err_pdev_create:
return status;
}
QDF_STATUS wlan_green_ap_deinit(void)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
if (wlan_objmgr_unregister_pdev_create_handler(
WLAN_UMAC_COMP_GREEN_AP,
wlan_green_ap_pdev_obj_create_notification,
NULL)
!= QDF_STATUS_SUCCESS) {
return QDF_STATUS_E_FAILURE;
}
return status;
if (wlan_objmgr_unregister_pdev_destroy_handler(
WLAN_UMAC_COMP_GREEN_AP,
wlan_green_ap_pdev_obj_destroy_notification,
NULL)
!= QDF_STATUS_SUCCESS) {
return QDF_STATUS_E_FAILURE;
}
green_ap_info("Successfully unregistered create and destroy handlers with objmgr");
return QDF_STATUS_SUCCESS;
}
QDF_STATUS wlan_green_ap_start(struct wlan_objmgr_pdev *pdev)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
struct wlan_pdev_green_ap_ctx *green_ap_ctx;
return status;
if (!pdev) {
green_ap_err("pdev context passed is NULL");
return QDF_STATUS_E_INVAL;
}
green_ap_ctx = wlan_objmgr_pdev_get_comp_private_obj(
pdev, WLAN_UMAC_COMP_GREEN_AP);
if (!green_ap_ctx) {
green_ap_err("green ap context obtained is NULL");
return QDF_STATUS_E_FAILURE;
}
green_ap_debug("Green AP start received");
/* Make sure the start function does not get called 2 times */
qdf_spin_lock_bh(&green_ap_ctx->lock);
if (wlan_is_egap_enabled(green_ap_ctx)) {
qdf_spin_unlock_bh(&green_ap_ctx->lock);
green_ap_debug("enhanced green ap support is enabled");
return QDF_STATUS_SUCCESS;
}
if (green_ap_ctx->ps_state == WLAN_GREEN_AP_PS_IDLE_STATE) {
if (green_ap_ctx->ps_enable) {
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return wlan_green_ap_state_mc(green_ap_ctx,
WLAN_GREEN_AP_PS_START_EVENT);
}
}
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return QDF_STATUS_E_ALREADY;
}
QDF_STATUS wlan_green_ap_stop(struct wlan_objmgr_pdev *pdev)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
struct wlan_pdev_green_ap_ctx *green_ap_ctx;
return status;
if (!pdev) {
green_ap_err("pdev context passed is NULL");
return QDF_STATUS_E_INVAL;
}
green_ap_ctx = wlan_objmgr_pdev_get_comp_private_obj(
pdev, WLAN_UMAC_COMP_GREEN_AP);
if (!green_ap_ctx) {
green_ap_err("green ap context obtained is NULL");
return QDF_STATUS_E_FAILURE;
}
green_ap_debug("Green AP stop received");
qdf_spin_lock_bh(&green_ap_ctx->lock);
if (wlan_is_egap_enabled(green_ap_ctx)) {
qdf_spin_unlock_bh(&green_ap_ctx->lock);
green_ap_debug("enhanced green ap support is enabled");
return QDF_STATUS_SUCCESS;
}
/* Delete the timer just to be sure */
qdf_timer_stop(&green_ap_ctx->ps_timer);
/* Disable the power save */
green_ap_ctx->ps_enable = 0;
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return wlan_green_ap_state_mc(green_ap_ctx,
WLAN_GREEN_AP_PS_STOP_EVENT);
}
QDF_STATUS wlan_green_ap_add_sta(struct wlan_objmgr_pdev *pdev)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
struct wlan_pdev_green_ap_ctx *green_ap_ctx;
return status;
if (!pdev) {
green_ap_err("pdev context passed is NULL");
return QDF_STATUS_E_INVAL;
}
green_ap_ctx = wlan_objmgr_pdev_get_comp_private_obj(
pdev, WLAN_UMAC_COMP_GREEN_AP);
if (!green_ap_ctx) {
green_ap_err("green ap context obtained is NULL");
return QDF_STATUS_E_FAILURE;
}
green_ap_debug("Green AP add sta received");
qdf_spin_lock_bh(&green_ap_ctx->lock);
if (wlan_is_egap_enabled(green_ap_ctx)) {
qdf_spin_unlock_bh(&green_ap_ctx->lock);
green_ap_debug("enhanced green ap support is enabled");
return QDF_STATUS_SUCCESS;
}
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return wlan_green_ap_state_mc(green_ap_ctx,
WLAN_GREEN_AP_ADD_STA_EVENT);
}
QDF_STATUS wlan_green_ap_del_sta(struct wlan_objmgr_pdev *pdev)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
struct wlan_pdev_green_ap_ctx *green_ap_ctx;
return status;
if (!pdev) {
green_ap_err("pdev context passed is NULL");
return QDF_STATUS_E_INVAL;
}
green_ap_ctx = wlan_objmgr_pdev_get_comp_private_obj(
pdev, WLAN_UMAC_COMP_GREEN_AP);
if (!green_ap_ctx) {
green_ap_err("green ap context obtained is NULL");
return QDF_STATUS_E_FAILURE;
}
green_ap_debug("Green AP del sta received");
qdf_spin_lock_bh(&green_ap_ctx->lock);
if (wlan_is_egap_enabled(green_ap_ctx)) {
qdf_spin_unlock_bh(&green_ap_ctx->lock);
green_ap_info("enhanced green ap support is enabled");
return QDF_STATUS_SUCCESS;
}
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return wlan_green_ap_state_mc(green_ap_ctx,
WLAN_GREEN_AP_DEL_STA_EVENT);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2018 The Linux Foundation. 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,4 +22,209 @@
#include <qdf_status.h>
#include <wlan_green_ap_ucfg_api.h>
#include <../../core/src/wlan_green_ap_main_i.h>
QDF_STATUS ucfg_green_ap_update_user_config(
struct wlan_objmgr_pdev *pdev,
struct green_ap_user_cfg *green_ap_cfg)
{
struct wlan_pdev_green_ap_ctx *green_ap_ctx;
struct wlan_green_ap_egap_params *egap_params;
if (!pdev) {
green_ap_err("pdev context passed is NULL");
return QDF_STATUS_E_INVAL;
}
green_ap_ctx = wlan_objmgr_pdev_get_comp_private_obj(
pdev, WLAN_UMAC_COMP_GREEN_AP);
if (!green_ap_ctx) {
green_ap_err("green ap context obtained is NULL");
return QDF_STATUS_E_FAILURE;
}
qdf_spin_lock_bh(&green_ap_ctx->lock);
egap_params = &green_ap_ctx->egap_params;
egap_params->host_enable_egap = green_ap_cfg->host_enable_egap;
egap_params->egap_inactivity_time = green_ap_cfg->egap_inactivity_time;
egap_params->egap_wait_time = green_ap_cfg->egap_wait_time;
egap_params->egap_feature_flags = green_ap_cfg->egap_feature_flags;
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS ucfg_green_ap_enable_egap(struct wlan_objmgr_pdev *pdev)
{
struct wlan_pdev_green_ap_ctx *green_ap_ctx;
struct wlan_lmac_if_green_ap_tx_ops *green_ap_tx_ops;
if (!pdev) {
green_ap_err("pdev context passed is NULL");
return QDF_STATUS_E_INVAL;
}
green_ap_ctx = wlan_objmgr_pdev_get_comp_private_obj(
pdev, WLAN_UMAC_COMP_GREEN_AP);
if (!green_ap_ctx) {
green_ap_err("green ap context obtained is NULL");
return QDF_STATUS_E_FAILURE;
}
green_ap_tx_ops = wlan_psoc_get_green_ap_tx_ops(green_ap_ctx);
if (!green_ap_tx_ops) {
green_ap_err("green ap tx ops obtained are NULL");
return QDF_STATUS_E_FAILURE;
}
if (!green_ap_tx_ops->enable_egap) {
green_ap_err("tx op for sending enbale/disable green ap is NULL");
return QDF_STATUS_E_FAILURE;
}
return green_ap_tx_ops->enable_egap(pdev, &green_ap_ctx->egap_params);
}
QDF_STATUS ucfg_green_ap_target_config(struct wlan_objmgr_pdev *pdev,
bool fw_egap_support)
{
struct wlan_pdev_green_ap_ctx *green_ap_ctx;
if (!pdev) {
green_ap_err("pdev context passed is NULL");
return QDF_STATUS_E_INVAL;
}
green_ap_ctx = wlan_objmgr_pdev_get_comp_private_obj(
pdev, WLAN_UMAC_COMP_GREEN_AP);
if (!green_ap_ctx) {
green_ap_err("green ap context obtained is NULL");
return QDF_STATUS_E_FAILURE;
}
qdf_spin_lock_bh(&green_ap_ctx->lock);
green_ap_ctx->egap_params.fw_egap_support = fw_egap_support;
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS ucfg_green_ap_set_ps_config(struct wlan_objmgr_pdev *pdev,
uint8_t value)
{
struct wlan_pdev_green_ap_ctx *green_ap_ctx;
if (!pdev) {
green_ap_err("pdev context passed is NULL");
return QDF_STATUS_E_INVAL;
}
green_ap_ctx = wlan_objmgr_pdev_get_comp_private_obj(
pdev, WLAN_UMAC_COMP_GREEN_AP);
if (!green_ap_ctx) {
green_ap_err("green ap context obtained is NULL");
return QDF_STATUS_E_FAILURE;
}
qdf_spin_lock_bh(&green_ap_ctx->lock);
if (wlan_is_egap_enabled(green_ap_ctx)) {
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return QDF_STATUS_SUCCESS;
}
green_ap_ctx->ps_enable = value;
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS ucfg_green_ap_get_ps_config(struct wlan_objmgr_pdev *pdev,
uint8_t *ps_enable)
{
struct wlan_pdev_green_ap_ctx *green_ap_ctx;
if (!pdev) {
green_ap_err("pdev context passed is NULL");
return QDF_STATUS_E_INVAL;
}
green_ap_ctx = wlan_objmgr_pdev_get_comp_private_obj(
pdev, WLAN_UMAC_COMP_GREEN_AP);
if (!green_ap_ctx) {
green_ap_err("green ap context obtained is NULL");
return QDF_STATUS_E_FAILURE;
}
qdf_spin_lock_bh(&green_ap_ctx->lock);
if (wlan_is_egap_enabled(green_ap_ctx)) {
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return QDF_STATUS_SUCCESS;
}
*ps_enable = green_ap_ctx->ps_enable;
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS ucfg_green_ap_set_transition_time(struct wlan_objmgr_pdev *pdev,
uint32_t val)
{
struct wlan_pdev_green_ap_ctx *green_ap_ctx;
if (!pdev) {
green_ap_err("pdev context passed is NULL");
return QDF_STATUS_E_INVAL;
}
green_ap_ctx = wlan_objmgr_pdev_get_comp_private_obj(
pdev, WLAN_UMAC_COMP_GREEN_AP);
if (!green_ap_ctx) {
green_ap_err("green ap context obtained is NULL");
return QDF_STATUS_E_FAILURE;
}
qdf_spin_lock_bh(&green_ap_ctx->lock);
if (wlan_is_egap_enabled(green_ap_ctx)) {
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return QDF_STATUS_SUCCESS;
}
green_ap_ctx->ps_trans_time = val;
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS ucfg_green_ap_get_transition_time(struct wlan_objmgr_pdev *pdev,
uint32_t *ps_trans_time)
{
struct wlan_pdev_green_ap_ctx *green_ap_ctx;
if (!pdev) {
green_ap_err("pdev context passed is NULL");
return QDF_STATUS_E_INVAL;
}
green_ap_ctx = wlan_objmgr_pdev_get_comp_private_obj(
pdev, WLAN_UMAC_COMP_GREEN_AP);
if (!green_ap_ctx) {
green_ap_err("green ap context obtained is NULL");
return QDF_STATUS_E_FAILURE;
}
qdf_spin_lock_bh(&green_ap_ctx->lock);
if (wlan_is_egap_enabled(green_ap_ctx)) {
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return QDF_STATUS_SUCCESS;
}
*ps_trans_time = green_ap_ctx->ps_trans_time;
qdf_spin_unlock_bh(&green_ap_ctx->lock);
return QDF_STATUS_SUCCESS;
}

View File

@@ -55,6 +55,9 @@
#ifdef WLAN_FEATURE_NAN_CONVERGENCE
#include "nan_public_structs.h"
#endif
#ifdef WLAN_SUPPORT_GREEN_AP
#include "wlan_green_ap_api.h"
#endif
typedef qdf_nbuf_t wmi_buf_t;
#define wmi_buf_data(_buf) qdf_nbuf_data(_buf)
@@ -421,7 +424,7 @@ QDF_STATUS wmi_unified_stats_request_send(void *wmi_hdl,
struct stats_request_params *param);
QDF_STATUS wmi_unified_green_ap_ps_send(void *wmi_hdl,
uint32_t value, uint8_t mac_id);
uint32_t value, uint8_t pdev_id);
#ifdef FEATURE_WLAN_D0WOW
QDF_STATUS wmi_unified_d0wow_enable_send(void *wmi_hdl,
@@ -757,10 +760,11 @@ QDF_STATUS wmi_unified_process_dhcp_ind(void *wmi_hdl,
QDF_STATUS wmi_unified_get_link_speed_cmd(void *wmi_hdl,
wmi_mac_addr peer_macaddr);
#endif
#ifdef WLAN_SUPPORT_GREEN_AP
QDF_STATUS wmi_unified_egap_conf_params_cmd(void *wmi_hdl,
wmi_ap_ps_egap_param_cmd_fixed_param *egap_params);
struct wlan_green_ap_egap_params *egap_params);
#endif
QDF_STATUS wmi_unified_fw_profiling_data_cmd(void *wmi_hdl,

View File

@@ -910,14 +910,6 @@ struct bss_chan_info_request_params {
uint32_t param;
};
/**
* struct green_ap_ps_params - green ap ps cmd parameter
* @value: parameter value
*/
struct green_ap_ps_params {
uint32_t value;
};
/**
* struct wow_cmd_params - wow cmd parameter
* @enable: wow enable or disable flag

View File

@@ -49,6 +49,9 @@
#include <wlan_dfs_public_struct.h>
#endif
#include <qdf_threads.h>
#ifdef WLAN_SUPPORT_GREEN_AP
#include "wlan_green_ap_api.h"
#endif
#ifdef WLAN_FEATURE_NAN_CONVERGENCE
#include "nan_public_structs.h"
@@ -231,8 +234,10 @@ QDF_STATUS (*send_vdev_up_cmd)(wmi_unified_t wmi,
QDF_STATUS (*send_peer_create_cmd)(wmi_unified_t wmi,
struct peer_create_params *param);
#ifdef WLAN_SUPPORT_GREEN_AP
QDF_STATUS (*send_green_ap_ps_cmd)(wmi_unified_t wmi_handle,
uint32_t value, uint8_t mac_id);
uint32_t value, uint8_t pdev_id);
#endif
QDF_STATUS
(*send_pdev_utf_cmd)(wmi_unified_t wmi_handle,
@@ -604,9 +609,6 @@ QDF_STATUS (*send_process_dhcp_ind_cmd)(wmi_unified_t wmi_handle,
QDF_STATUS (*send_get_link_speed_cmd)(wmi_unified_t wmi_handle,
wmi_mac_addr peer_macaddr);
QDF_STATUS (*send_egap_conf_params_cmd)(wmi_unified_t wmi_handle,
wmi_ap_ps_egap_param_cmd_fixed_param *egap_params);
QDF_STATUS (*send_bcn_buf_ll_cmd)(wmi_unified_t wmi_handle,
wmi_bcn_send_from_host_cmd_fixed_param * param);
@@ -622,6 +624,11 @@ QDF_STATUS (*send_pktlog_wmi_send_cmd)(wmi_unified_t wmi_handle,
WMI_CMD_ID cmd_id, uint8_t user_triggered);
#endif
#ifdef WLAN_SUPPORT_GREEN_AP
QDF_STATUS (*send_egap_conf_params_cmd)(wmi_unified_t wmi_handle,
struct wlan_green_ap_egap_params *egap_params);
#endif
QDF_STATUS (*send_fw_profiling_cmd)(wmi_unified_t wmi_handle,
uint32_t cmd, uint32_t value1, uint32_t value2);

View File

@@ -285,33 +285,33 @@ QDF_STATUS wmi_unified_peer_rx_reorder_queue_remove_send(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
#if defined(FEATURE_GREEN_AP) || defined(ATH_SUPPORT_GREEN_AP)
#ifdef WLAN_SUPPORT_GREEN_AP
/**
* wmi_unified_green_ap_ps_send() - enable green ap powersave command
* @wmi_handle: wmi handle
* @value: value
* @mac_id: mac id to have radio context
* @pdev_id: pdev id to have radio context
*
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
QDF_STATUS wmi_unified_green_ap_ps_send(void *wmi_hdl,
uint32_t value, uint8_t mac_id)
uint32_t value, uint8_t pdev_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_green_ap_ps_cmd)
return wmi_handle->ops->send_green_ap_ps_cmd(wmi_handle, value,
mac_id);
pdev_id);
return QDF_STATUS_E_FAILURE;
}
#else
QDF_STATUS wmi_unified_green_ap_ps_send(void *wmi_hdl,
uint32_t value, uint8_t mac_id)
uint32_t value, uint8_t pdev_id)
{
return 0;
return QDF_STATUS_SUCCESS;
}
#endif /* FEATURE_GREEN_AP or ATH_SUPPORT_GREEN_AP*/
#endif /* WLAN_SUPPORT_GREEN_AP */
/**
* wmi_unified_pdev_utf_cmd() - send utf command to fw
@@ -2221,7 +2221,9 @@ QDF_STATUS wmi_unified_get_link_speed_cmd(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
#endif
#ifdef WLAN_SUPPORT_GREEN_AP
/**
* wmi_unified_egap_conf_params_cmd() - send wmi cmd of egap configuration params
* @wmi_handle: wmi handler
@@ -2230,7 +2232,7 @@ QDF_STATUS wmi_unified_get_link_speed_cmd(void *wmi_hdl,
* Return: 0 for success, otherwise appropriate error code
*/
QDF_STATUS wmi_unified_egap_conf_params_cmd(void *wmi_hdl,
wmi_ap_ps_egap_param_cmd_fixed_param *egap_params)
struct wlan_green_ap_egap_params *egap_params)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
@@ -2240,7 +2242,6 @@ QDF_STATUS wmi_unified_egap_conf_params_cmd(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
#endif
/**

View File

@@ -735,16 +735,17 @@ static QDF_STATUS send_peer_update_wds_entry_cmd_non_tlv(wmi_unified_t wmi_handl
WMI_PEER_UPDATE_WDS_ENTRY_CMDID);
}
#ifdef WLAN_SUPPORT_GREEN_AP
/**
* send_green_ap_ps_cmd_non_tlv() - enable green ap powersave command
* @wmi_handle: wmi handle
* @value: value
* @mac_id: mac id to have radio context
* @pdev_id: pdev id to have radio context
*
* Return: 0 for success or error code
*/
static QDF_STATUS send_green_ap_ps_cmd_non_tlv(wmi_unified_t wmi_handle,
uint32_t value, uint8_t mac_id)
uint32_t value, uint8_t pdev_id)
{
wmi_pdev_green_ap_ps_enable_cmd *cmd;
wmi_buf_t buf;
@@ -775,6 +776,7 @@ static QDF_STATUS send_green_ap_ps_cmd_non_tlv(wmi_unified_t wmi_handle,
#endif /* OL_GREEN_AP_DEBUG_CONFIG_INTERACTIONS */
return ret;
}
#endif
/**
* send_pdev_utf_cmd_non_tlv() - send utf command to fw
@@ -8229,7 +8231,9 @@ struct wmi_ops non_tlv_ops = {
.send_vdev_up_cmd = send_vdev_up_cmd_non_tlv,
.send_peer_create_cmd = send_peer_create_cmd_non_tlv,
.send_peer_delete_cmd = send_peer_delete_cmd_non_tlv,
#ifdef WLAN_SUPPORT_GREEN_AP
.send_green_ap_ps_cmd = send_green_ap_ps_cmd_non_tlv,
#endif
.send_pdev_utf_cmd = send_pdev_utf_cmd_non_tlv,
.send_pdev_param_cmd = send_pdev_param_cmd_non_tlv,
.send_suspend_cmd = send_suspend_cmd_non_tlv,

View File

@@ -39,6 +39,9 @@
#include "wlan_pmo_hw_filter_public_struct.h"
#endif
#include <wlan_utility.h>
#ifdef WLAN_SUPPORT_GREEN_AP
#include "wlan_green_ap_api.h"
#endif
#ifdef WLAN_FEATURE_NAN_CONVERGENCE
#include "nan_public_structs.h"
@@ -971,18 +974,17 @@ static QDF_STATUS send_peer_update_wds_entry_cmd_tlv(wmi_unified_t wmi_handle,
WMI_PEER_UPDATE_WDS_ENTRY_CMDID);
}
#ifdef WLAN_SUPPORT_GREEN_AP
/**
* send_green_ap_ps_cmd_tlv() - enable green ap powersave command
* @wmi_handle: wmi handle
* @value: value
* @mac_id: mac id to have radio context
* @pdev_id: pdev id to have radio context
*
* Return: QDF_STATUS_SUCCESS for success or error code
*/
static QDF_STATUS send_green_ap_ps_cmd_tlv(wmi_unified_t wmi_handle,
uint32_t value, uint8_t mac_id)
uint32_t value, uint8_t pdev_id)
{
wmi_pdev_green_ap_ps_enable_cmd_fixed_param *cmd;
wmi_buf_t buf;
@@ -1001,7 +1003,7 @@ static QDF_STATUS send_green_ap_ps_cmd_tlv(wmi_unified_t wmi_handle,
WMITLV_TAG_STRUC_wmi_pdev_green_ap_ps_enable_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN
(wmi_pdev_green_ap_ps_enable_cmd_fixed_param));
cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(mac_id);
cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(pdev_id);
cmd->enable = value;
if (wmi_unified_cmd_send(wmi_handle, buf, len,
@@ -1013,6 +1015,7 @@ static QDF_STATUS send_green_ap_ps_cmd_tlv(wmi_unified_t wmi_handle,
return 0;
}
#endif
/**
* send_pdev_utf_cmd_tlv() - send utf command to fw
@@ -8521,6 +8524,7 @@ static QDF_STATUS send_get_link_speed_cmd_tlv(wmi_unified_t wmi_handle,
return QDF_STATUS_SUCCESS;
}
#ifdef WLAN_SUPPORT_GREEN_AP
/**
* send_egap_conf_params_cmd_tlv() - send wmi cmd of egap configuration params
* @wmi_handle: wmi handler
@@ -8529,7 +8533,7 @@ static QDF_STATUS send_get_link_speed_cmd_tlv(wmi_unified_t wmi_handle,
* Return: 0 for success, otherwise appropriate error code
*/
static QDF_STATUS send_egap_conf_params_cmd_tlv(wmi_unified_t wmi_handle,
wmi_ap_ps_egap_param_cmd_fixed_param *egap_params)
struct wlan_green_ap_egap_params *egap_params)
{
wmi_ap_ps_egap_param_cmd_fixed_param *cmd;
wmi_buf_t buf;
@@ -8546,10 +8550,10 @@ static QDF_STATUS send_egap_conf_params_cmd_tlv(wmi_unified_t wmi_handle,
WMITLV_GET_STRUCT_TLVLEN(
wmi_ap_ps_egap_param_cmd_fixed_param));
cmd->enable = egap_params->enable;
cmd->inactivity_time = egap_params->inactivity_time;
cmd->wait_time = egap_params->wait_time;
cmd->flags = egap_params->flags;
cmd->enable = egap_params->host_enable_egap;
cmd->inactivity_time = egap_params->egap_inactivity_time;
cmd->wait_time = egap_params->egap_wait_time;
cmd->flags = egap_params->egap_feature_flags;
err = wmi_unified_cmd_send(wmi_handle, buf,
sizeof(*cmd), WMI_AP_PS_EGAP_PARAM_CMDID);
if (err) {
@@ -8560,6 +8564,7 @@ static QDF_STATUS send_egap_conf_params_cmd_tlv(wmi_unified_t wmi_handle,
return QDF_STATUS_SUCCESS;
}
#endif
/**
* send_fw_profiling_cmd_tlv() - send FW profiling cmd to WLAN FW
@@ -20837,7 +20842,6 @@ struct wmi_ops tlv_ops = {
.send_peer_add_wds_entry_cmd = send_peer_add_wds_entry_cmd_tlv,
.send_peer_del_wds_entry_cmd = send_peer_del_wds_entry_cmd_tlv,
.send_peer_update_wds_entry_cmd = send_peer_update_wds_entry_cmd_tlv,
.send_green_ap_ps_cmd = send_green_ap_ps_cmd_tlv,
.send_pdev_utf_cmd = send_pdev_utf_cmd_tlv,
.send_pdev_param_cmd = send_pdev_param_cmd_tlv,
.send_suspend_cmd = send_suspend_cmd_tlv,
@@ -20979,13 +20983,16 @@ struct wmi_ops tlv_ops = {
#ifdef CONFIG_MCL
.send_process_dhcp_ind_cmd = send_process_dhcp_ind_cmd_tlv,
.send_get_link_speed_cmd = send_get_link_speed_cmd_tlv,
.send_egap_conf_params_cmd = send_egap_conf_params_cmd_tlv,
.send_bcn_buf_ll_cmd = send_bcn_buf_ll_cmd_tlv,
.send_roam_scan_offload_mode_cmd =
send_roam_scan_offload_mode_cmd_tlv,
.send_pktlog_wmi_send_cmd = send_pktlog_wmi_send_cmd_tlv,
.send_roam_scan_offload_ap_profile_cmd =
send_roam_scan_offload_ap_profile_cmd_tlv,
#endif
#ifdef WLAN_SUPPORT_GREEN_AP
.send_egap_conf_params_cmd = send_egap_conf_params_cmd_tlv,
.send_green_ap_ps_cmd = send_green_ap_ps_cmd_tlv,
#endif
.send_fw_profiling_cmd = send_fw_profiling_cmd_tlv,
.send_csa_offload_enable_cmd = send_csa_offload_enable_cmd_tlv,