|
@@ -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;
|
|
|
+}
|