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: I06a14d099c516767fe57ba94acc2a5fb95dc4e17 CRs-Fixed: 3052909
This commit is contained in:

committed by
Madan Koyyalamudi

parent
d73a9a326c
commit
53571fdb88
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
|
||||||
|
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for any
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
@@ -33,6 +34,7 @@
|
|||||||
* @WLAN_TWT_NUDGE: TWT nudge
|
* @WLAN_TWT_NUDGE: TWT nudge
|
||||||
* @WLAN_TWT_STATISTICS: TWT statistics
|
* @WLAN_TWT_STATISTICS: TWT statistics
|
||||||
* @WLAN_TWT_CLEAR_STATISTICS: TWT clear statistics
|
* @WLAN_TWT_CLEAR_STATISTICS: TWT clear statistics
|
||||||
|
* @WLAN_TWT_SET_PARAM: TWT set parameter
|
||||||
* @WLAN_TWT_ANY: Indicates one of the commands is in progress.
|
* @WLAN_TWT_ANY: Indicates one of the commands is in progress.
|
||||||
*/
|
*/
|
||||||
enum wlan_twt_commands {
|
enum wlan_twt_commands {
|
||||||
@@ -44,6 +46,7 @@ enum wlan_twt_commands {
|
|||||||
WLAN_TWT_NUDGE = BIT(4),
|
WLAN_TWT_NUDGE = BIT(4),
|
||||||
WLAN_TWT_STATISTICS = BIT(5),
|
WLAN_TWT_STATISTICS = BIT(5),
|
||||||
WLAN_TWT_CLEAR_STATISTICS = BIT(6),
|
WLAN_TWT_CLEAR_STATISTICS = BIT(6),
|
||||||
|
WLAN_TWT_SET_PARAM = BIT(7),
|
||||||
WLAN_TWT_ANY = 0xFF,
|
WLAN_TWT_ANY = 0xFF,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -111,6 +111,13 @@ 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,
|
[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
|
static
|
||||||
int hdd_send_twt_del_dialog_cmd(struct hdd_context *hdd_ctx,
|
int hdd_send_twt_del_dialog_cmd(struct hdd_context *hdd_ctx,
|
||||||
struct wmi_twt_del_dialog_param *twt_params);
|
struct wmi_twt_del_dialog_param *twt_params);
|
||||||
@@ -1906,6 +1913,86 @@ static int hdd_twt_setup_session(struct hdd_adapter *adapter,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hdd_twt_add_ac_config() - Get TWT AC parameter
|
||||||
|
* value from QCA_WLAN_VENDOR_ATTR_CONFIG_TWT_PARAMS
|
||||||
|
* @adapter: adapter pointer
|
||||||
|
* @twt_ac_param: AC parameter
|
||||||
|
*
|
||||||
|
* Handles QCA_WLAN_VENDOR_ATTR_TWT_SET_PARAM_AP_AC_VALUE
|
||||||
|
*
|
||||||
|
* Return: 0 on success, negative value on failure.
|
||||||
|
*/
|
||||||
|
static int hdd_twt_add_ac_config(struct hdd_adapter *adapter,
|
||||||
|
enum qca_wlan_ac_type twt_ac_param)
|
||||||
|
{
|
||||||
|
bool is_responder_en;
|
||||||
|
int ret = 0;
|
||||||
|
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||||
|
|
||||||
|
if (twt_ac_param < QCA_WLAN_AC_BE || twt_ac_param > QCA_WLAN_AC_VO) {
|
||||||
|
hdd_err_rl("Invalid AC parameter. Value: %d", twt_ac_param);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ucfg_mlme_get_twt_responder(hdd_ctx->psoc, &is_responder_en);
|
||||||
|
|
||||||
|
if (adapter->device_mode == QDF_SAP_MODE && is_responder_en) {
|
||||||
|
ret = sme_cli_set_command(adapter->vdev_id,
|
||||||
|
WMI_PDEV_PARAM_TWT_AC_CONFIG,
|
||||||
|
twt_ac_param, PDEV_CMD);
|
||||||
|
} else {
|
||||||
|
hdd_err_rl("Undesired device mode. Mode: %d and responder: %d",
|
||||||
|
adapter->device_mode, is_responder_en);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hdd_twt_set_param - Process TWT set parameter operation
|
||||||
|
* in the received vendor command and send it to firmware
|
||||||
|
* @adapter: adapter pointer
|
||||||
|
* @twt_param_attr: nl attributes
|
||||||
|
*
|
||||||
|
* Handles QCA_WLAN_TWT_SET_PARAM
|
||||||
|
*
|
||||||
|
* Return: 0 on success, negative value on failure
|
||||||
|
*/
|
||||||
|
static int hdd_twt_set_param(struct hdd_adapter *adapter,
|
||||||
|
struct nlattr *twt_param_attr)
|
||||||
|
{
|
||||||
|
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TWT_SET_PARAM_MAX + 1];
|
||||||
|
int ret;
|
||||||
|
int cmd_id;
|
||||||
|
uint8_t twt_ac_param;
|
||||||
|
|
||||||
|
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_param = nla_get_u8(tb[cmd_id]);
|
||||||
|
hdd_debug("TWT_AC_CONFIG_VALUE: %d", twt_ac_param);
|
||||||
|
ret = hdd_twt_add_ac_config(adapter, twt_ac_param);
|
||||||
|
|
||||||
|
if (ret) {
|
||||||
|
hdd_err("Fail to set TWT AC parameter, errno %d",
|
||||||
|
ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hdd_get_twt_get_stats_event_len() - calculate length of skb
|
* hdd_get_twt_get_stats_event_len() - calculate length of skb
|
||||||
* required for sending twt get statistics command responses.
|
* required for sending twt get statistics command responses.
|
||||||
@@ -3937,6 +4024,9 @@ static int hdd_twt_configure(struct hdd_adapter *adapter,
|
|||||||
ret = hdd_twt_clear_session_traffic_stats(adapter,
|
ret = hdd_twt_clear_session_traffic_stats(adapter,
|
||||||
twt_param_attr);
|
twt_param_attr);
|
||||||
break;
|
break;
|
||||||
|
case QCA_WLAN_TWT_SET_PARAM:
|
||||||
|
ret = hdd_twt_set_param(adapter, twt_param_attr);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
hdd_err("Invalid TWT Operation");
|
hdd_err("Invalid TWT Operation");
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
|
@@ -890,6 +890,30 @@ static inline bool wma_is_tx_chainmask_valid(int value,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wma_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 wma_convert_ac_value(uint32_t ac_value)
|
||||||
|
{
|
||||||
|
switch (ac_value) {
|
||||||
|
case QCA_WLAN_AC_BE:
|
||||||
|
return WMI_AC_BE;
|
||||||
|
case QCA_WLAN_AC_BK:
|
||||||
|
return WMI_AC_BK;
|
||||||
|
case QCA_WLAN_AC_VI:
|
||||||
|
return WMI_AC_VI;
|
||||||
|
case QCA_WLAN_AC_VO:
|
||||||
|
return WMI_AC_VO;
|
||||||
|
case QCA_WLAN_AC_ALL:
|
||||||
|
return WMI_AC_MAX;
|
||||||
|
}
|
||||||
|
wma_err("invalid enum: %u", ac_value);
|
||||||
|
return WMI_AC_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wma_process_cli_set_cmd() - set parameters to fw
|
* wma_process_cli_set_cmd() - set parameters to fw
|
||||||
* @wma: wma handle
|
* @wma: wma handle
|
||||||
@@ -971,6 +995,9 @@ static void wma_process_cli_set_cmd(tp_wma_handle wma,
|
|||||||
}
|
}
|
||||||
pdev_param.param_id = privcmd->param_id;
|
pdev_param.param_id = privcmd->param_id;
|
||||||
pdev_param.param_value = privcmd->param_value;
|
pdev_param.param_value = privcmd->param_value;
|
||||||
|
if (privcmd->param_id == WMI_PDEV_PARAM_TWT_AC_CONFIG)
|
||||||
|
pdev_param.param_value =
|
||||||
|
wma_convert_ac_value(pdev_param.param_value);
|
||||||
ret = wmi_unified_pdev_param_send(wma->wmi_handle,
|
ret = wmi_unified_pdev_param_send(wma->wmi_handle,
|
||||||
&pdev_param,
|
&pdev_param,
|
||||||
privcmd->param_sec_value);
|
privcmd->param_sec_value);
|
||||||
|
Reference in New Issue
Block a user