qcacld-3.0: Add support for QCA_WLAN_TWT_SET_PARAM command
Add support for QCA_WLAN_TWT_SET_PARAM command to configure QCA_WLAN_VENDOR_ATTR_TWT_SET_PARAM_AP_AC_VALUE attribute. This attribute provides access category value for WMI_PDEV_PARAM_TWT_AC_CONFIG. This is used by firmware to configure access category for TWT HW queue in TWT Responder mode(SAP). Change-Id: I5131967ff2061bf6afad7bc5f091a7eb5ee01b8a CRs-Fixed: 3168197
This commit is contained in:

committed by
Madan Koyyalamudi

szülő
ad770886cb
commit
d75a1c786c
@@ -99,6 +99,50 @@ target_if_twt_nudge_req(struct wlan_objmgr_psoc *psoc,
|
||||
return wmi_unified_twt_nudge_dialog_cmd(wmi_handle, req);
|
||||
}
|
||||
|
||||
/**
|
||||
* target_if_twt_convert_ac_value() - map ac setting to the value to be used in FW.
|
||||
* @ac_value: ac value to be mapped.
|
||||
*
|
||||
* Return: enum wmi_traffic_ac
|
||||
*/
|
||||
static inline
|
||||
wmi_traffic_ac target_if_twt_convert_ac_value(enum twt_traffic_ac ac_value)
|
||||
{
|
||||
switch (ac_value) {
|
||||
case TWT_AC_BE:
|
||||
return WMI_AC_BE;
|
||||
case TWT_AC_BK:
|
||||
return WMI_AC_BK;
|
||||
case TWT_AC_VI:
|
||||
return WMI_AC_VI;
|
||||
case TWT_AC_VO:
|
||||
return WMI_AC_VO;
|
||||
case TWT_AC_MAX:
|
||||
return WMI_AC_MAX;
|
||||
}
|
||||
target_if_err("invalid enum: %u", ac_value);
|
||||
return WMI_AC_MAX;
|
||||
}
|
||||
|
||||
QDF_STATUS
|
||||
target_if_twt_ac_param_send(struct wlan_objmgr_psoc *psoc,
|
||||
enum twt_traffic_ac twt_ac, uint8_t mac_id)
|
||||
{
|
||||
struct wmi_unified *wmi_handle;
|
||||
struct pdev_params params = {0};
|
||||
|
||||
wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
|
||||
if (!wmi_handle) {
|
||||
target_if_err("wmi_handle is null");
|
||||
return QDF_STATUS_E_NULL_VALUE;
|
||||
}
|
||||
|
||||
params.param_id = WMI_PDEV_PARAM_TWT_AC_CONFIG;
|
||||
params.param_value = target_if_twt_convert_ac_value(twt_ac);
|
||||
|
||||
return wmi_unified_pdev_param_send(wmi_handle, ¶ms, mac_id);
|
||||
}
|
||||
|
||||
QDF_STATUS
|
||||
target_if_twt_register_ext_tx_ops(struct wlan_lmac_if_twt_tx_ops *twt_tx_ops)
|
||||
{
|
||||
@@ -107,6 +151,7 @@ target_if_twt_register_ext_tx_ops(struct wlan_lmac_if_twt_tx_ops *twt_tx_ops)
|
||||
twt_tx_ops->pause_req = target_if_twt_pause_req;
|
||||
twt_tx_ops->resume_req = target_if_twt_resume_req;
|
||||
twt_tx_ops->nudge_req = target_if_twt_nudge_req;
|
||||
twt_tx_ops->set_ac_param = target_if_twt_ac_param_send;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
@@ -22,11 +22,11 @@
|
||||
#include <wlan_utility.h>
|
||||
#include <wlan_mlme_api.h>
|
||||
#include <wlan_mlme_main.h>
|
||||
#include "wlan_twt_main.h"
|
||||
#include "twt/core/src/wlan_twt_priv.h"
|
||||
#include "twt/core/src/wlan_twt_common.h"
|
||||
#include <wlan_twt_tgt_if_ext_tx_api.h>
|
||||
#include <wlan_serialization_api.h>
|
||||
#include "wlan_twt_main.h"
|
||||
|
||||
/**
|
||||
* wlan_twt_add_session() - Add TWT session entry in the TWT context
|
||||
@@ -1363,6 +1363,18 @@ QDF_STATUS wlan_twt_nudge_req(struct wlan_objmgr_psoc *psoc,
|
||||
return status;
|
||||
}
|
||||
|
||||
QDF_STATUS wlan_twt_ac_pdev_param_send(struct wlan_objmgr_psoc *psoc,
|
||||
enum twt_traffic_ac twt_ac)
|
||||
{
|
||||
QDF_STATUS status;
|
||||
|
||||
status = tgt_twt_ac_pdev_param_send(psoc, twt_ac);
|
||||
if (QDF_IS_STATUS_ERROR(status))
|
||||
twt_err("failed (status=%d)", status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* wlan_twt_sap_teardown_req() - sap TWT teardown request
|
||||
* @psoc: Pointer to psoc object
|
||||
|
@@ -116,6 +116,16 @@ wlan_twt_nudge_req(struct wlan_objmgr_psoc *psoc,
|
||||
struct twt_nudge_dialog_cmd_param *req,
|
||||
void *context);
|
||||
|
||||
/**
|
||||
* wlan_twt_ac_pdev_param_send() - pdev TWT param send
|
||||
* @psoc: Pointer to psoc object
|
||||
* @twt_ac: TWT access category
|
||||
*
|
||||
* Return: QDF Status
|
||||
*/
|
||||
QDF_STATUS wlan_twt_ac_pdev_param_send(struct wlan_objmgr_psoc *psoc,
|
||||
enum twt_traffic_ac twt_ac);
|
||||
|
||||
/**
|
||||
* wlan_twt_is_setup_in_progress() - Get if TWT setup command is in progress
|
||||
* for given dialog id
|
||||
|
@@ -78,4 +78,14 @@ QDF_STATUS
|
||||
tgt_twt_nudge_req_send(struct wlan_objmgr_psoc *psoc,
|
||||
struct twt_nudge_dialog_cmd_param *req);
|
||||
|
||||
/**
|
||||
* tgt_twt_ac_pdev_param_send() - pdev TWT param send
|
||||
* @psoc: Pointer to psoc object
|
||||
* @twt_ac: TWT access category
|
||||
*
|
||||
* Return: QDF Status
|
||||
*/
|
||||
QDF_STATUS
|
||||
tgt_twt_ac_pdev_param_send(struct wlan_objmgr_psoc *psoc,
|
||||
enum twt_traffic_ac twt_ac);
|
||||
#endif
|
||||
|
@@ -126,6 +126,17 @@ QDF_STATUS ucfg_twt_nudge_req(struct wlan_objmgr_psoc *psoc,
|
||||
struct twt_nudge_dialog_cmd_param *params,
|
||||
void *context);
|
||||
|
||||
/**
|
||||
* ucfg_twt_ac_pdev_param_send() - pdev TWT param send
|
||||
* @psoc: Pointer to psoc object
|
||||
* @twt_ac: TWT access category
|
||||
*
|
||||
* Return: QDF Status
|
||||
*/
|
||||
QDF_STATUS
|
||||
ucfg_twt_ac_pdev_param_send(struct wlan_objmgr_psoc *psoc,
|
||||
enum twt_traffic_ac twt_ac);
|
||||
|
||||
/**
|
||||
* ucfg_twt_is_max_sessions_reached() - Check if the maximum number of
|
||||
* TWT sessions reached or not excluding the given dialog_id
|
||||
|
@@ -173,3 +173,27 @@ tgt_twt_nudge_req_send(struct wlan_objmgr_psoc *psoc,
|
||||
return status;
|
||||
}
|
||||
|
||||
QDF_STATUS
|
||||
tgt_twt_ac_pdev_param_send(struct wlan_objmgr_psoc *psoc,
|
||||
enum twt_traffic_ac twt_ac)
|
||||
{
|
||||
struct wlan_lmac_if_twt_tx_ops *tx_ops;
|
||||
QDF_STATUS status;
|
||||
|
||||
if (!psoc) {
|
||||
twt_err("psoc is null");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
tx_ops = wlan_twt_get_tx_ops(psoc);
|
||||
if (!tx_ops || !tx_ops->set_ac_param) {
|
||||
twt_err("set_ac_param is null");
|
||||
status = QDF_STATUS_E_NULL_VALUE;
|
||||
return status;
|
||||
}
|
||||
|
||||
status = tx_ops->set_ac_param(psoc, twt_ac, 0);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@@ -86,6 +86,13 @@ ucfg_twt_nudge_req(struct wlan_objmgr_psoc *psoc,
|
||||
return wlan_twt_nudge_req(psoc, params, context);
|
||||
}
|
||||
|
||||
QDF_STATUS
|
||||
ucfg_twt_ac_pdev_param_send(struct wlan_objmgr_psoc *psoc,
|
||||
enum twt_traffic_ac twt_ac)
|
||||
{
|
||||
return wlan_twt_ac_pdev_param_send(psoc, twt_ac);
|
||||
}
|
||||
|
||||
bool ucfg_twt_is_max_sessions_reached(struct wlan_objmgr_psoc *psoc,
|
||||
struct qdf_mac_addr *peer_mac,
|
||||
uint8_t dialog_id)
|
||||
|
@@ -260,6 +260,9 @@ static int hdd_twt_configure(struct hdd_adapter *adapter,
|
||||
ret = osif_twt_clear_session_traffic_stats(vdev,
|
||||
twt_param_attr);
|
||||
break;
|
||||
case QCA_WLAN_TWT_SET_PARAM:
|
||||
ret = osif_twt_set_param(vdev, twt_param_attr);
|
||||
break;
|
||||
default:
|
||||
hdd_err("Invalid TWT Operation");
|
||||
ret = -EINVAL;
|
||||
@@ -334,10 +337,8 @@ qca_wlan_vendor_twt_nudge_dialog_policy[QCA_WLAN_VENDOR_ATTR_TWT_NUDGE_MAX + 1]
|
||||
};
|
||||
|
||||
static const struct nla_policy
|
||||
qca_wlan_vendor_twt_set_param_policy[
|
||||
QCA_WLAN_VENDOR_ATTR_TWT_SET_PARAM_MAX + 1] = {
|
||||
[QCA_WLAN_VENDOR_ATTR_TWT_SET_PARAM_AP_AC_VALUE] = {
|
||||
.type = NLA_U8 },
|
||||
qca_wlan_vendor_twt_set_param_policy[QCA_WLAN_VENDOR_ATTR_TWT_SET_PARAM_MAX + 1] = {
|
||||
[QCA_WLAN_VENDOR_ATTR_TWT_SET_PARAM_AP_AC_VALUE] = {.type = NLA_U8 },
|
||||
};
|
||||
|
||||
static
|
||||
|
@@ -211,6 +211,16 @@ QDF_STATUS osif_twt_get_stats_response(struct wlan_objmgr_vdev *vdev,
|
||||
int osif_twt_clear_session_traffic_stats(struct wlan_objmgr_vdev *vdev,
|
||||
struct nlattr *twt_param_attr);
|
||||
|
||||
/**
|
||||
* osif_twt_set_param() - pdev TWT param send
|
||||
* @psoc: Pointer to psoc object
|
||||
* @twt_param_attr: nlattr for TWT access category
|
||||
*
|
||||
* Return: QDF Status
|
||||
*/
|
||||
int osif_twt_set_param(struct wlan_objmgr_vdev *vdev,
|
||||
struct nlattr *twt_param_attr);
|
||||
|
||||
#else
|
||||
static inline
|
||||
int osif_twt_setup_req(struct wlan_objmgr_vdev *vdev,
|
||||
@@ -281,6 +291,13 @@ int osif_twt_clear_session_traffic_stats(struct wlan_objmgr_vdev *vdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline
|
||||
int osif_twt_set_param(struct wlan_objmgr_vdev *vdev,
|
||||
struct nlattr *twt_param_attr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* _OSIF_TWT_EXT_REQ_H_ */
|
||||
|
||||
|
@@ -87,6 +87,11 @@ qca_wlan_vendor_twt_nudge_dialog_policy[QCA_WLAN_VENDOR_ATTR_TWT_NUDGE_MAX + 1]
|
||||
[QCA_WLAN_VENDOR_ATTR_TWT_NUDGE_MAC_ADDR] = VENDOR_NLA_POLICY_MAC_ADDR,
|
||||
};
|
||||
|
||||
static const struct nla_policy
|
||||
qca_wlan_vendor_twt_set_param_policy[QCA_WLAN_VENDOR_ATTR_TWT_SET_PARAM_MAX + 1] = {
|
||||
[QCA_WLAN_VENDOR_ATTR_TWT_SET_PARAM_AP_AC_VALUE] = {.type = NLA_U8 },
|
||||
};
|
||||
|
||||
static const struct nla_policy
|
||||
qca_wlan_vendor_twt_stats_dialog_policy[QCA_WLAN_VENDOR_ATTR_TWT_STATS_MAX + 1] = {
|
||||
[QCA_WLAN_VENDOR_ATTR_TWT_STATS_FLOW_ID] = {.type = NLA_U8 },
|
||||
@@ -2261,3 +2266,101 @@ int osif_twt_clear_session_traffic_stats(struct wlan_objmgr_vdev *vdev,
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* osif_twt_convert_ac_value() - map ac setting to the value to be used in FW.
|
||||
* @ac_value: ac value to be mapped.
|
||||
*
|
||||
* Return: enum twt_traffic_ac
|
||||
*/
|
||||
static inline
|
||||
enum twt_traffic_ac osif_twt_convert_ac_value(enum qca_wlan_ac_type ac_value)
|
||||
{
|
||||
switch (ac_value) {
|
||||
case QCA_WLAN_AC_BE:
|
||||
return TWT_AC_BE;
|
||||
case QCA_WLAN_AC_BK:
|
||||
return TWT_AC_BK;
|
||||
case QCA_WLAN_AC_VI:
|
||||
return TWT_AC_VI;
|
||||
case QCA_WLAN_AC_VO:
|
||||
return TWT_AC_VO;
|
||||
case QCA_WLAN_AC_ALL:
|
||||
return TWT_AC_MAX;
|
||||
}
|
||||
osif_err("invalid enum: %u", ac_value);
|
||||
return TWT_AC_MAX;
|
||||
}
|
||||
|
||||
/**
|
||||
* osif_twt_add_ac_config() - pdev TWT param send
|
||||
* @psoc: Pointer to psoc object
|
||||
* @twt_ac: TWT access category
|
||||
*
|
||||
* Return: QDF Status
|
||||
*/
|
||||
static int osif_twt_add_ac_config(struct wlan_objmgr_vdev *vdev,
|
||||
enum qca_wlan_ac_type twt_ac)
|
||||
{
|
||||
bool is_responder_en;
|
||||
int ret = 0;
|
||||
struct wlan_objmgr_psoc *psoc;
|
||||
enum QDF_OPMODE device_mode;
|
||||
|
||||
psoc = wlan_vdev_get_psoc(vdev);
|
||||
if (!psoc)
|
||||
return -EINVAL;
|
||||
|
||||
device_mode = wlan_vdev_mlme_get_opmode(vdev);
|
||||
|
||||
if (twt_ac < QCA_WLAN_AC_BE || twt_ac > QCA_WLAN_AC_VO) {
|
||||
osif_err_rl("Invalid AC parameter. Value: %d", twt_ac);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ucfg_twt_cfg_get_responder(psoc, &is_responder_en);
|
||||
|
||||
if (device_mode == QDF_SAP_MODE && is_responder_en) {
|
||||
ret = ucfg_twt_ac_pdev_param_send(psoc,
|
||||
osif_twt_convert_ac_value(twt_ac));
|
||||
} else {
|
||||
osif_err_rl("Undesired device mode. Mode: %d and responder: %d",
|
||||
device_mode, is_responder_en);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int osif_twt_set_param(struct wlan_objmgr_vdev *vdev,
|
||||
struct nlattr *twt_param_attr)
|
||||
{
|
||||
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TWT_SET_PARAM_MAX + 1];
|
||||
int ret;
|
||||
int cmd_id;
|
||||
enum qca_wlan_ac_type twt_ac;
|
||||
|
||||
ret = wlan_cfg80211_nla_parse_nested
|
||||
(tb,
|
||||
QCA_WLAN_VENDOR_ATTR_TWT_SET_PARAM_MAX,
|
||||
twt_param_attr,
|
||||
qca_wlan_vendor_twt_set_param_policy);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
cmd_id = QCA_WLAN_VENDOR_ATTR_TWT_SET_PARAM_AP_AC_VALUE;
|
||||
|
||||
if (tb[cmd_id]) {
|
||||
twt_ac = nla_get_u8(tb[cmd_id]);
|
||||
osif_debug("TWT_AC_CONFIG_VALUE: %d", twt_ac);
|
||||
ret = osif_twt_add_ac_config(vdev, twt_ac);
|
||||
|
||||
if (ret) {
|
||||
osif_err("Fail to set TWT AC parameter, errno %d",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user