mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-19 10:23:03 +00:00
643 lines
18 KiB
Diff
643 lines
18 KiB
Diff
From bb865d8d08eb703ec016a503bf8a4cf8e8e8070b Mon Sep 17 00:00:00 2001
|
|
From: John Crispin <john@phrozen.org>
|
|
Date: Tue, 1 Oct 2019 16:48:51 -0700
|
|
Subject: [PATCH 1/5] [PATCH V3] ath11k: add TWT support
|
|
|
|
Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
|
|
Signed-off-by: John Crispin <john@phrozen.org>
|
|
---
|
|
drivers/net/wireless/ath/ath11k/mac.c | 12 +++++
|
|
drivers/net/wireless/ath/ath11k/wmi.c | 91 +++++++++++++++++++++++++++++++++++
|
|
drivers/net/wireless/ath/ath11k/wmi.h | 71 +++++++++++++++++++++++++++
|
|
3 files changed, 174 insertions(+)
|
|
|
|
--- a/drivers/net/wireless/ath/ath11k/mac.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/mac.c
|
|
@@ -2538,6 +2538,8 @@ static void ath11k_mac_op_bss_info_chang
|
|
ath11k_wmi_send_twt_enable_cmd(ar, ar->pdev->pdev_id);
|
|
else
|
|
ath11k_wmi_send_twt_disable_cmd(ar, ar->pdev->pdev_id);
|
|
+ if (vif->type == NL80211_IFTYPE_AP)
|
|
+ ath11k_debugfs_twt(arvif, info->twt_requester);
|
|
}
|
|
|
|
if (changed & BSS_CHANGED_HE_OBSS_PD)
|
|
@@ -5240,6 +5242,10 @@ err_vdev_del:
|
|
|
|
/* TODO: recal traffic pause state based on the available vdevs */
|
|
|
|
+ /* Remove TWT related files and directory */
|
|
+ debugfs_remove_recursive(arvif->debugfs_twt);
|
|
+ arvif->debugfs_twt = NULL;
|
|
+
|
|
mutex_unlock(&ar->conf_mutex);
|
|
}
|
|
|
|
--- a/drivers/net/wireless/ath/ath11k/wmi.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
|
|
@@ -129,6 +129,8 @@ static const struct wmi_tlv_policy wmi_t
|
|
.min_len = sizeof(struct wmi_probe_resp_tx_status_event) },
|
|
[WMI_TAG_VDEV_DELETE_RESP_EVENT] = {
|
|
.min_len = sizeof(struct wmi_vdev_delete_resp_event) },
|
|
+ [WMI_TAG_TWT_ADD_DIALOG_COMPLETE_EVENT]
|
|
+ = { .min_len = sizeof(struct wmi_twt_add_dialog_event) },
|
|
};
|
|
|
|
#define PRIMAP(_hw_mode_) \
|
|
@@ -2726,7 +2728,162 @@ int ath11k_wmi_delba_send(struct ath11k
|
|
return ret;
|
|
}
|
|
|
|
-int ath11k_wmi_addba_set_resp(struct ath11k *ar, u32 vdev_id, const u8 *mac,
|
|
+int
|
|
+ath11k_wmi_send_twt_add_dialog_cmd(struct ath11k *ar,
|
|
+ struct wmi_twt_add_dialog_params *params)
|
|
+{
|
|
+ struct ath11k_pdev_wmi *wmi = ar->wmi;
|
|
+ struct ath11k_base *ab = wmi->wmi_ab->ab;
|
|
+ struct wmi_twt_add_dialog_params_cmd *cmd;
|
|
+ struct sk_buff *skb;
|
|
+ int ret, len;
|
|
+
|
|
+ len = sizeof(*cmd);
|
|
+
|
|
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
|
|
+ if (!skb)
|
|
+ return -ENOMEM;
|
|
+
|
|
+ cmd = (void *)skb->data;
|
|
+ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG,
|
|
+ WMI_TAG_TWT_ADD_DIALOG_CMD) |
|
|
+ FIELD_PREP(WMI_TLV_LEN, len - TLV_HDR_SIZE);
|
|
+
|
|
+ cmd->vdev_id = params->vdev_id;
|
|
+ ether_addr_copy(cmd->peer_macaddr.addr, params->peer_macaddr);
|
|
+ cmd->dialog_id = params->dialog_id;
|
|
+ cmd->wake_intvl_us = params->wake_intvl_us;
|
|
+ cmd->wake_intvl_mantis = params->wake_intvl_mantis;
|
|
+ cmd->wake_dura_us = params->wake_dura_us;
|
|
+ cmd->sp_offset_us = params->sp_offset_us;
|
|
+ cmd->flags = params->twt_cmd;
|
|
+ if (params->flag_bcast)
|
|
+ cmd->flags |= WMI_TWT_ADD_DIALOG_FLAG_BCAST;
|
|
+ if (params->flag_trigger)
|
|
+ cmd->flags |= WMI_TWT_ADD_DIALOG_FLAG_TRIGGER;
|
|
+ if (params->flag_flow_type)
|
|
+ cmd->flags |= WMI_TWT_ADD_DIALOG_FLAG_FLOW_TYPE;
|
|
+ if (params->flag_protection)
|
|
+ cmd->flags |= WMI_TWT_ADD_DIALOG_FLAG_PROTECTION;
|
|
+
|
|
+ ret = ath11k_wmi_cmd_send(wmi, skb,
|
|
+ WMI_TWT_ADD_DIALOG_CMDID);
|
|
+
|
|
+ if (ret) {
|
|
+ ath11k_warn(ab, "Failed to send WMI_TWT_ADD_DIALOG_CMDID");
|
|
+ dev_kfree_skb(skb);
|
|
+ }
|
|
+ return ret;
|
|
+}
|
|
+
|
|
+int
|
|
+ath11k_wmi_send_twt_del_dialog_cmd(struct ath11k *ar,
|
|
+ struct wmi_twt_del_dialog_params *params)
|
|
+{
|
|
+ struct ath11k_pdev_wmi *wmi = ar->wmi;
|
|
+ struct ath11k_base *ab = wmi->wmi_ab->ab;
|
|
+ struct wmi_twt_del_dialog_params_cmd *cmd;
|
|
+ struct sk_buff *skb;
|
|
+ int ret, len;
|
|
+
|
|
+ len = sizeof(*cmd);
|
|
+
|
|
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
|
|
+ if (!skb)
|
|
+ return -ENOMEM;
|
|
+
|
|
+ cmd = (void *)skb->data;
|
|
+ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG,
|
|
+ WMI_TAG_TWT_DEL_DIALOG_CMD) |
|
|
+ FIELD_PREP(WMI_TLV_LEN, len - TLV_HDR_SIZE);
|
|
+
|
|
+ cmd->vdev_id = params->vdev_id;
|
|
+ ether_addr_copy(cmd->peer_macaddr.addr, params->peer_macaddr);
|
|
+ cmd->dialog_id = params->dialog_id;
|
|
+
|
|
+ ret = ath11k_wmi_cmd_send(wmi, skb,
|
|
+ WMI_TWT_DEL_DIALOG_CMDID);
|
|
+ if (ret) {
|
|
+ ath11k_warn(ab, "Failed to send WMI_TWT_DEL_DIALOG_CMDID");
|
|
+ dev_kfree_skb(skb);
|
|
+ }
|
|
+ return ret;
|
|
+}
|
|
+
|
|
+int
|
|
+ath11k_wmi_send_twt_pause_dialog_cmd(struct ath11k *ar,
|
|
+ struct wmi_twt_pause_dialog_params *params)
|
|
+{
|
|
+ struct ath11k_pdev_wmi *wmi = ar->wmi;
|
|
+ struct ath11k_base *ab = wmi->wmi_ab->ab;
|
|
+ struct wmi_twt_pause_dialog_params_cmd *cmd;
|
|
+ struct sk_buff *skb;
|
|
+ int ret, len;
|
|
+
|
|
+ len = sizeof(*cmd);
|
|
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
|
|
+ if (!skb)
|
|
+ return -ENOMEM;
|
|
+
|
|
+ cmd = (void *)skb->data;
|
|
+ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG,
|
|
+ WMI_TAG_TWT_PAUSE_DIALOG_CMD) |
|
|
+ FIELD_PREP(WMI_TLV_LEN, len - TLV_HDR_SIZE);
|
|
+
|
|
+ cmd->vdev_id = params->vdev_id;
|
|
+ ether_addr_copy(cmd->peer_macaddr.addr, params->peer_macaddr);
|
|
+ cmd->dialog_id = params->dialog_id;
|
|
+
|
|
+ ret = ath11k_wmi_cmd_send(wmi, skb,
|
|
+ WMI_TWT_PAUSE_DIALOG_CMDID);
|
|
+ if (ret) {
|
|
+ ath11k_warn(ab, "Failed to send WMI_TWT_PAUSE_DIALOG_CMDID");
|
|
+ dev_kfree_skb(skb);
|
|
+ }
|
|
+ return ret;
|
|
+}
|
|
+
|
|
+int
|
|
+ath11k_wmi_send_twt_resume_dialog_cmd(struct ath11k *ar,
|
|
+ struct wmi_twt_resume_dialog_params *params)
|
|
+{
|
|
+ struct ath11k_pdev_wmi *wmi = ar->wmi;
|
|
+ struct ath11k_base *ab = wmi->wmi_ab->ab;
|
|
+ struct wmi_twt_resume_dialog_params_cmd *cmd;
|
|
+ struct sk_buff *skb;
|
|
+ int ret, len;
|
|
+
|
|
+ len = sizeof(*cmd);
|
|
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
|
|
+ if (!skb)
|
|
+ return -ENOMEM;
|
|
+
|
|
+ cmd = (void *)skb->data;
|
|
+ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG,
|
|
+ WMI_TAG_TWT_RESUME_DIALOG_CMD) |
|
|
+ FIELD_PREP(WMI_TLV_LEN, len - TLV_HDR_SIZE);
|
|
+
|
|
+ cmd->vdev_id = params->vdev_id;
|
|
+ ether_addr_copy(cmd->peer_macaddr.addr, params->peer_macaddr);
|
|
+ cmd->dialog_id = params->dialog_id;
|
|
+ cmd->sp_offset_us = params->sp_offset_us;
|
|
+ cmd->next_twt_size = params->next_twt_size;
|
|
+ ath11k_dbg(ar->ab, ATH11K_DBG_WMI, "%s:%s[%d]%x %x %x %x %x\n",
|
|
+ __FILE__, __func__, __LINE__, cmd->peer_macaddr.word0,
|
|
+ cmd->peer_macaddr.word1, cmd->dialog_id,
|
|
+ params->sp_offset_us, params->next_twt_size);
|
|
+
|
|
+ ret = ath11k_wmi_cmd_send(wmi, skb,
|
|
+ WMI_TWT_RESUME_DIALOG_CMDID);
|
|
+ if (ret) {
|
|
+ ath11k_warn(ab, "Failed to send WMI_TWT_RESUME_DIALOG_CMDID");
|
|
+ dev_kfree_skb(skb);
|
|
+ }
|
|
+ return ret;
|
|
+}
|
|
+
|
|
+int
|
|
+ath11k_wmi_addba_set_resp(struct ath11k *ar, u32 vdev_id, const u8 *mac,
|
|
u32 tid, u32 status)
|
|
{
|
|
struct ath11k_pdev_wmi *wmi = ar->wmi;
|
|
@@ -7182,6 +7339,37 @@ static void ath11k_wmi_event_wow_wakeup_
|
|
complete(&ab->wow.wakeup_completed);
|
|
}
|
|
|
|
+static void ath11k_wmi_twt_add_dialog_event(struct ath11k_base *ab, struct sk_buff *skb)
|
|
+{
|
|
+ const char *status[] = {
|
|
+ "OK", "TWT_NOT_ENABLED", "USED_DIALOG_ID", "INVALID_PARAM",
|
|
+ "NOT_READY", "NO_RESOURCE", "NO_ACK", "NO_RESPONSE",
|
|
+ "DENIED", "UNKNOWN_ERROR"
|
|
+ };
|
|
+ const void **tb;
|
|
+ const struct wmi_twt_add_dialog_event *ev;
|
|
+ int ret;
|
|
+
|
|
+ tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC);
|
|
+ if (IS_ERR(tb)) {
|
|
+ ret = PTR_ERR(tb);
|
|
+ ath11k_warn(ab, "failed to parse tlv: %d\n", ret);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ ev = tb[WMI_TAG_TWT_ADD_DIALOG_COMPLETE_EVENT];
|
|
+ if (!ev) {
|
|
+ ath11k_warn(ab, "failed to fetch twt add dialog ev");
|
|
+ goto exit;
|
|
+ }
|
|
+
|
|
+ ath11k_info(ab, "TWT Add Dialog Event - Status: %s, DialogId: %d, VdevId: %d\n",
|
|
+ status[ev->status], ev->vdev_id, ev->dialog_id);
|
|
+
|
|
+exit:
|
|
+ kfree(tb);
|
|
+}
|
|
+
|
|
static void ath11k_wmi_tlv_op_rx(struct ath11k_base *ab, struct sk_buff *skb)
|
|
{
|
|
struct wmi_cmd_hdr *cmd_hdr;
|
|
@@ -7277,11 +7465,17 @@ static void ath11k_wmi_tlv_op_rx(struct
|
|
case WMI_PDEV_UTF_EVENTID:
|
|
ath11k_tm_event_wmi(ab, id, skb);
|
|
break;
|
|
+ case WMI_TWT_ADD_DIALOG_EVENTID:
|
|
+ ath11k_wmi_twt_add_dialog_event(ab, skb);
|
|
+ break;
|
|
/* add Unsupported events here */
|
|
case WMI_TBTTOFFSET_EXT_UPDATE_EVENTID:
|
|
case WMI_PEER_OPER_MODE_CHANGE_EVENTID:
|
|
case WMI_TWT_ENABLE_EVENTID:
|
|
case WMI_TWT_DISABLE_EVENTID:
|
|
+ case WMI_TWT_DEL_DIALOG_EVENTID:
|
|
+ case WMI_TWT_PAUSE_DIALOG_EVENTID:
|
|
+ case WMI_TWT_RESUME_DIALOG_EVENTID:
|
|
case WMI_PDEV_DMA_RING_CFG_RSP_EVENTID:
|
|
ath11k_dbg(ab, ATH11K_DBG_WMI,
|
|
"ignoring unsupported event 0x%x\n", id);
|
|
--- a/drivers/net/wireless/ath/ath11k/wmi.h
|
|
+++ b/drivers/net/wireless/ath/ath11k/wmi.h
|
|
@@ -4894,6 +4894,112 @@ struct wmi_twt_disable_params_cmd {
|
|
u32 pdev_id;
|
|
} __packed;
|
|
|
|
+enum WMI_HOST_TWT_COMMAND {
|
|
+ WMI_HOST_TWT_COMMAND_REQUEST_TWT = 0,
|
|
+ WMI_HOST_TWT_COMMAND_SUGGEST_TWT,
|
|
+ WMI_HOST_TWT_COMMAND_DEMAND_TWT,
|
|
+ WMI_HOST_TWT_COMMAND_TWT_GROUPING,
|
|
+ WMI_HOST_TWT_COMMAND_ACCEPT_TWT,
|
|
+ WMI_HOST_TWT_COMMAND_ALTERNATE_TWT,
|
|
+ WMI_HOST_TWT_COMMAND_DICTATE_TWT,
|
|
+ WMI_HOST_TWT_COMMAND_REJECT_TWT,
|
|
+};
|
|
+
|
|
+#define WMI_TWT_ADD_DIALOG_FLAG_BCAST BIT(8)
|
|
+#define WMI_TWT_ADD_DIALOG_FLAG_TRIGGER BIT(9)
|
|
+#define WMI_TWT_ADD_DIALOG_FLAG_FLOW_TYPE BIT(10)
|
|
+#define WMI_TWT_ADD_DIALOG_FLAG_PROTECTION BIT(11)
|
|
+
|
|
+struct wmi_twt_add_dialog_params_cmd {
|
|
+ u32 tlv_header;
|
|
+ u32 vdev_id;
|
|
+ struct wmi_mac_addr peer_macaddr;
|
|
+ u32 dialog_id;
|
|
+ u32 wake_intvl_us;
|
|
+ u32 wake_intvl_mantis;
|
|
+ u32 wake_dura_us;
|
|
+ u32 sp_offset_us;
|
|
+ u32 flags;
|
|
+};
|
|
+
|
|
+struct wmi_twt_add_dialog_params {
|
|
+ u32 vdev_id;
|
|
+ u8 peer_macaddr[ETH_ALEN];
|
|
+ u32 dialog_id;
|
|
+ u32 wake_intvl_us;
|
|
+ u32 wake_intvl_mantis;
|
|
+ u32 wake_dura_us;
|
|
+ u32 sp_offset_us;
|
|
+ u8 twt_cmd;
|
|
+ u8 flag_bcast;
|
|
+ u8 flag_trigger;
|
|
+ u8 flag_flow_type;
|
|
+ u8 flag_protection;
|
|
+};
|
|
+
|
|
+enum wmi_twt_add_dialog_status {
|
|
+ WMI_ADD_TWT_STATUS_OK, /* adding TWT dialog successfully completed */
|
|
+ WMI_ADD_TWT_STATUS_TWT_NOT_ENABLED, /* TWT not enabled */
|
|
+ WMI_ADD_TWT_STATUS_USED_DIALOG_ID, /* TWT dialog ID is already used */
|
|
+ WMI_ADD_TWT_STATUS_INVALID_PARAM, /* invalid parameters */
|
|
+ WMI_ADD_TWT_STATUS_NOT_READY, /* FW not ready */
|
|
+ WMI_ADD_TWT_STATUS_NO_RESOURCE, /* FW resource exhausted */
|
|
+ WMI_ADD_TWT_STATUS_NO_ACK, /* peer AP/STA did not ACK the request/response frame */
|
|
+ WMI_ADD_TWT_STATUS_NO_RESPONSE, /* peer AP did not send the response frame */
|
|
+ WMI_ADD_TWT_STATUS_DENIED, /* AP did not accept the request */
|
|
+ WMI_ADD_TWT_STATUS_UNKNOWN_ERROR, /* adding TWT dialog failed with an unknown reason */
|
|
+};
|
|
+
|
|
+struct wmi_twt_add_dialog_event {
|
|
+ u32 vdev_id;
|
|
+ struct wmi_mac_addr peer_macaddr;
|
|
+ u32 dialog_id;
|
|
+ u32 status;
|
|
+};
|
|
+
|
|
+struct wmi_twt_del_dialog_params {
|
|
+ u32 vdev_id;
|
|
+ u8 peer_macaddr[ETH_ALEN];
|
|
+ u32 dialog_id;
|
|
+};
|
|
+
|
|
+struct wmi_twt_del_dialog_params_cmd {
|
|
+ u32 tlv_header;
|
|
+ u32 vdev_id;
|
|
+ struct wmi_mac_addr peer_macaddr;
|
|
+ u32 dialog_id;
|
|
+};
|
|
+
|
|
+struct wmi_twt_pause_dialog_params {
|
|
+ u32 vdev_id;
|
|
+ u8 peer_macaddr[ETH_ALEN];
|
|
+ u32 dialog_id;
|
|
+};
|
|
+
|
|
+struct wmi_twt_pause_dialog_params_cmd {
|
|
+ u32 tlv_header;
|
|
+ u32 vdev_id;
|
|
+ struct wmi_mac_addr peer_macaddr;
|
|
+ u32 dialog_id;
|
|
+};
|
|
+
|
|
+struct wmi_twt_resume_dialog_params {
|
|
+ u32 vdev_id;
|
|
+ u8 peer_macaddr[ETH_ALEN];
|
|
+ u32 dialog_id;
|
|
+ u32 sp_offset_us;
|
|
+ u32 next_twt_size;
|
|
+};
|
|
+
|
|
+struct wmi_twt_resume_dialog_params_cmd {
|
|
+ u32 tlv_header;
|
|
+ u32 vdev_id;
|
|
+ struct wmi_mac_addr peer_macaddr;
|
|
+ u32 dialog_id;
|
|
+ u32 sp_offset_us;
|
|
+ u32 next_twt_size;
|
|
+};
|
|
+
|
|
struct wmi_obss_spatial_reuse_params_cmd {
|
|
u32 tlv_header;
|
|
u32 pdev_id;
|
|
@@ -5444,6 +5550,14 @@ void ath11k_wmi_fw_stats_fill(struct ath
|
|
int ath11k_wmi_simulate_radar(struct ath11k *ar);
|
|
int ath11k_wmi_send_twt_enable_cmd(struct ath11k *ar, u32 pdev_id);
|
|
int ath11k_wmi_send_twt_disable_cmd(struct ath11k *ar, u32 pdev_id);
|
|
+int ath11k_wmi_send_twt_add_dialog_cmd(struct ath11k *ar,
|
|
+ struct wmi_twt_add_dialog_params *params);
|
|
+int ath11k_wmi_send_twt_del_dialog_cmd(struct ath11k *ar,
|
|
+ struct wmi_twt_del_dialog_params *params);
|
|
+int ath11k_wmi_send_twt_pause_dialog_cmd(struct ath11k *ar,
|
|
+ struct wmi_twt_pause_dialog_params *params);
|
|
+int ath11k_wmi_send_twt_resume_dialog_cmd(struct ath11k *ar,
|
|
+ struct wmi_twt_resume_dialog_params *params);
|
|
int ath11k_wmi_send_obss_spr_cmd(struct ath11k *ar, u32 vdev_id,
|
|
struct ieee80211_he_obss_pd *he_obss_pd);
|
|
int ath11k_wmi_pdev_set_srg_bss_color_bitmap(struct ath11k *ar, u32 *bitmap);
|
|
--- a/drivers/net/wireless/ath/ath11k/core.h
|
|
+++ b/drivers/net/wireless/ath/ath11k/core.h
|
|
@@ -244,6 +244,7 @@ struct ath11k_vif {
|
|
bool rsnie_present;
|
|
bool wpaie_present;
|
|
struct ieee80211_chanctx_conf chanctx;
|
|
+ struct dentry *debugfs_twt;
|
|
};
|
|
|
|
struct ath11k_vif_iter {
|
|
--- a/drivers/net/wireless/ath/ath11k/debugfs.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/debugfs.c
|
|
@@ -51,6 +51,203 @@ static const char *htt_bp_lmac_ring[HTT_
|
|
"MONITOR_DEST_RING",
|
|
};
|
|
|
|
+#ifdef CPTCFG_MAC80211_DEBUGFS
|
|
+static ssize_t ath11k_write_twt_add_dialog(struct file *file,
|
|
+ const char __user *ubuf,
|
|
+ size_t count, loff_t *ppos)
|
|
+{
|
|
+ struct ath11k_vif *arvif = file->private_data;
|
|
+ struct wmi_twt_add_dialog_params params = { 0 };
|
|
+ u8 buf[128] = {0};
|
|
+ int ret;
|
|
+
|
|
+ ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count);
|
|
+ if (ret < 0) {
|
|
+ return ret;
|
|
+ }
|
|
+ buf[ret] = '\0';
|
|
+ ret = sscanf(buf, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx %u %u %u %u %u %hhu %hhu %hhu %hhu %hhu",
|
|
+ ¶ms.peer_macaddr[0],
|
|
+ ¶ms.peer_macaddr[1],
|
|
+ ¶ms.peer_macaddr[2],
|
|
+ ¶ms.peer_macaddr[3],
|
|
+ ¶ms.peer_macaddr[4],
|
|
+ ¶ms.peer_macaddr[5],
|
|
+ ¶ms.dialog_id,
|
|
+ ¶ms.wake_intvl_us,
|
|
+ ¶ms.wake_intvl_mantis,
|
|
+ ¶ms.wake_dura_us,
|
|
+ ¶ms.sp_offset_us,
|
|
+ ¶ms.twt_cmd,
|
|
+ ¶ms.flag_bcast,
|
|
+ ¶ms.flag_trigger,
|
|
+ ¶ms.flag_flow_type,
|
|
+ ¶ms.flag_protection);
|
|
+ if (ret != 16)
|
|
+ return -EINVAL;
|
|
+
|
|
+ params.vdev_id = arvif->vdev_id;
|
|
+
|
|
+ ret = ath11k_wmi_send_twt_add_dialog_cmd(arvif->ar, ¶ms);
|
|
+
|
|
+ return ret ? ret : count;
|
|
+}
|
|
+
|
|
+static ssize_t ath11k_write_twt_del_dialog(struct file *file,
|
|
+ const char __user *ubuf,
|
|
+ size_t count, loff_t *ppos)
|
|
+{
|
|
+ struct ath11k_vif *arvif = file->private_data;
|
|
+ struct wmi_twt_del_dialog_params params = { 0 };
|
|
+ u8 buf[64] = {0};
|
|
+ int ret;
|
|
+
|
|
+ ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count);
|
|
+ if (ret < 0) {
|
|
+ return ret;
|
|
+ }
|
|
+ buf[ret] = '\0';
|
|
+ ret = sscanf(buf, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx %u",
|
|
+ ¶ms.peer_macaddr[0],
|
|
+ ¶ms.peer_macaddr[1],
|
|
+ ¶ms.peer_macaddr[2],
|
|
+ ¶ms.peer_macaddr[3],
|
|
+ ¶ms.peer_macaddr[4],
|
|
+ ¶ms.peer_macaddr[5],
|
|
+ ¶ms.dialog_id);
|
|
+ if (ret != 7)
|
|
+ return -EINVAL;
|
|
+
|
|
+ params.vdev_id = arvif->vdev_id;
|
|
+
|
|
+ ret = ath11k_wmi_send_twt_del_dialog_cmd(arvif->ar, ¶ms);
|
|
+
|
|
+ return ret ? ret : count;
|
|
+}
|
|
+
|
|
+static ssize_t ath11k_write_twt_pause_dialog(struct file *file,
|
|
+ const char __user *ubuf,
|
|
+ size_t count, loff_t *ppos)
|
|
+{
|
|
+ struct ath11k_vif *arvif = file->private_data;
|
|
+ struct wmi_twt_pause_dialog_params params = { 0 };
|
|
+ u8 buf[64] = {0};
|
|
+ int ret;
|
|
+
|
|
+ ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count);
|
|
+ if (ret < 0) {
|
|
+ return ret;
|
|
+ }
|
|
+ buf[ret] = '\0';
|
|
+ ret = sscanf(buf, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx %u",
|
|
+ ¶ms.peer_macaddr[0],
|
|
+ ¶ms.peer_macaddr[1],
|
|
+ ¶ms.peer_macaddr[2],
|
|
+ ¶ms.peer_macaddr[3],
|
|
+ ¶ms.peer_macaddr[4],
|
|
+ ¶ms.peer_macaddr[5],
|
|
+ ¶ms.dialog_id);
|
|
+ if (ret != 7)
|
|
+ return -EINVAL;
|
|
+
|
|
+ params.vdev_id = arvif->vdev_id;
|
|
+
|
|
+ ret = ath11k_wmi_send_twt_pause_dialog_cmd(arvif->ar, ¶ms);
|
|
+
|
|
+ return ret ? ret : count;
|
|
+}
|
|
+
|
|
+
|
|
+static ssize_t ath11k_write_twt_resume_dialog(struct file *file,
|
|
+ const char __user *ubuf,
|
|
+ size_t count, loff_t *ppos)
|
|
+{
|
|
+ struct ath11k_vif *arvif = file->private_data;
|
|
+ struct wmi_twt_resume_dialog_params params = { 0 };
|
|
+ u8 buf[64] = {0};
|
|
+ int ret;
|
|
+
|
|
+ ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count);
|
|
+ if (ret < 0) {
|
|
+ return ret;
|
|
+ }
|
|
+ buf[ret] = '\0';
|
|
+ ret = sscanf(buf, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx %u %u %u",
|
|
+ ¶ms.peer_macaddr[0],
|
|
+ ¶ms.peer_macaddr[1],
|
|
+ ¶ms.peer_macaddr[2],
|
|
+ ¶ms.peer_macaddr[3],
|
|
+ ¶ms.peer_macaddr[4],
|
|
+ ¶ms.peer_macaddr[5],
|
|
+ ¶ms.dialog_id,
|
|
+ ¶ms.sp_offset_us,
|
|
+ ¶ms.next_twt_size);
|
|
+ if (ret != 9)
|
|
+ return -EINVAL;
|
|
+
|
|
+ params.vdev_id = arvif->vdev_id;
|
|
+
|
|
+ ret = ath11k_wmi_send_twt_resume_dialog_cmd(arvif->ar, ¶ms);
|
|
+
|
|
+ return ret ? ret : count;
|
|
+}
|
|
+
|
|
+static const struct file_operations ath11k_fops_twt_add_dialog = {
|
|
+ .write = ath11k_write_twt_add_dialog,
|
|
+ .open = simple_open
|
|
+};
|
|
+
|
|
+static const struct file_operations ath11k_fops_twt_del_dialog = {
|
|
+ .write = ath11k_write_twt_del_dialog,
|
|
+ .open = simple_open
|
|
+};
|
|
+
|
|
+static const struct file_operations ath11k_fops_twt_pause_dialog = {
|
|
+ .write = ath11k_write_twt_pause_dialog,
|
|
+ .open = simple_open
|
|
+};
|
|
+
|
|
+static const struct file_operations ath11k_fops_twt_resume_dialog = {
|
|
+ .write = ath11k_write_twt_resume_dialog,
|
|
+ .open = simple_open
|
|
+};
|
|
+
|
|
+void ath11k_debugfs_twt(struct ath11k_vif *arvif, bool enable)
|
|
+{
|
|
+ if (!enable && arvif->debugfs_twt) {
|
|
+ debugfs_remove_recursive(arvif->debugfs_twt);
|
|
+ arvif->debugfs_twt = NULL;
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ if (arvif->debugfs_twt)
|
|
+ return;
|
|
+
|
|
+ arvif->debugfs_twt = debugfs_create_dir("twt", arvif->vif->debugfs_dir);
|
|
+ if (IS_ERR_OR_NULL(arvif->debugfs_twt)) {
|
|
+ ath11k_warn(arvif->ar->ab, "failed to create twt debugfs: %p\n", arvif->debugfs_twt);
|
|
+ arvif->debugfs_twt = NULL;
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ debugfs_create_file("add_dialog", 0200,
|
|
+ arvif->debugfs_twt, arvif,
|
|
+ &ath11k_fops_twt_add_dialog);
|
|
+
|
|
+ debugfs_create_file("del_dialog", 0200,
|
|
+ arvif->debugfs_twt, arvif,
|
|
+ &ath11k_fops_twt_del_dialog);
|
|
+
|
|
+ debugfs_create_file("pause_dialog", 0200,
|
|
+ arvif->debugfs_twt, arvif,
|
|
+ &ath11k_fops_twt_pause_dialog);
|
|
+
|
|
+ debugfs_create_file("resume_dialog", 0200,
|
|
+ arvif->debugfs_twt, arvif,
|
|
+ &ath11k_fops_twt_resume_dialog);
|
|
+}
|
|
+#endif
|
|
+
|
|
static void ath11k_fw_stats_pdevs_free(struct list_head *head)
|
|
{
|
|
struct ath11k_fw_stats_pdev *i, *tmp;
|
|
--- a/drivers/net/wireless/ath/ath11k/debugfs.h
|
|
+++ b/drivers/net/wireless/ath/ath11k/debugfs.h
|
|
@@ -103,6 +103,15 @@ enum ath11k_dbg_aggr_mode {
|
|
ATH11K_DBG_AGGR_MODE_MAX,
|
|
};
|
|
|
|
+#ifdef CPTCFG_MAC80211_DEBUGFS
|
|
+void ath11k_debugfs_twt(struct ath11k_vif *arvif, bool enable);
|
|
+#else
|
|
+static inline void ath11k_debugfs_twt(struct ath11k_vif *arvif, bool enable)
|
|
+{
|
|
+
|
|
+}
|
|
+#endif
|
|
+
|
|
#ifdef CPTCFG_ATH11K_DEBUGFS
|
|
int ath11k_debugfs_soc_create(struct ath11k_base *ab);
|
|
void ath11k_debugfs_soc_destroy(struct ath11k_base *ab);
|
|
--- a/net/wireless/nl80211.c
|
|
+++ b/net/wireless/nl80211.c
|
|
@@ -5475,7 +5475,8 @@ static int nl80211_start_ap(struct sk_bu
|
|
return PTR_ERR(params.acl);
|
|
}
|
|
|
|
- params.twt_responder =
|
|
+ if (info->attrs[NL80211_ATTR_TWT_RESPONDER])
|
|
+ params.twt_responder =
|
|
nla_get_flag(info->attrs[NL80211_ATTR_TWT_RESPONDER]);
|
|
|
|
if (info->attrs[NL80211_ATTR_HE_OBSS_PD]) {
|