From patchwork Thu Dec 5 06:28:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 11274231 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F6E313A4 for ; Thu, 5 Dec 2019 06:28:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D9162245C for ; Thu, 5 Dec 2019 06:28:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="m7YvRuAT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D9162245C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=phrozen.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Gy8RHZXTvv9JET+7Dx5mF7k+rLdw0dozyR4M2IOklDw=; b=m7YvRuATevfM5T VYSa6WepbIIA4Rrc9ssPIyymfH4eDnmtqaMt/XxqlSyRSD0Mc1dhP1mAUSlBY84SadCpUJ3vYGxqm mYqHR+uFaQqyMayrunsCRAe+0Il0J8ENyHamz/JtM2Jxu255T9E6J0myE92cZZBHeN055wDvaIsAk onrIbOdUurPsZrFyCLOtj0m4Wjh4B/cuqn77Zu5dNkp1a1JKx23Ctnkzorl8RKNp0wIL9lXY2MZiY 1s2CQv1bXPaoNCPLenNyCCkoKxVot+AEqz3Bp7Pls1x2iKaCaI2rHQ+E0o7YOSkIs8fDhKuN+8xp4 KI0umCNpI5+TtdBIZNPw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ickcf-0000nY-2T; Thu, 05 Dec 2019 06:28:21 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ickcb-0000n4-IY for ath11k@lists.infradead.org; Thu, 05 Dec 2019 06:28:19 +0000 Received: from pd95fd3d5.dip0.t-ipconnect.de ([217.95.211.213] helo=bertha.datto.lan) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1ickcZ-0001iF-PV; Thu, 05 Dec 2019 07:28:15 +0100 From: John Crispin To: Kalle Valo Subject: [PATCH V2] ath11k: add OMI debug support Date: Thu, 5 Dec 2019 07:28:12 +0100 Message-Id: <20191205062812.6208-1-john@phrozen.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191204_222817_781178_2C713D4B X-CRM114-Status: GOOD ( 12.94 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, John Crispin Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org This patch allows us to initiate a OMI transaction for test purposes using a debugfs interface. the xmit_omi file expects 9 parameters. The first two are VHT and HE followed by the 7 A-Control fields from D4.0/9.2.4.6a.2. Signed-off-by: John Crispin --- Changes in V2 * add __packed qualifier drivers/net/wireless/ath/ath11k/debug.h | 10 ++++ drivers/net/wireless/ath/ath11k/debugfs_sta.c | 47 +++++++++++++++++++ drivers/net/wireless/ath/ath11k/wmi.c | 33 ++++++++++++- drivers/net/wireless/ath/ath11k/wmi.h | 10 ++++ 4 files changed, 99 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/debug.h b/drivers/net/wireless/ath/ath11k/debug.h index 805e30c07e14..1535af2eebe5 100644 --- a/drivers/net/wireless/ath/ath11k/debug.h +++ b/drivers/net/wireless/ath/ath11k/debug.h @@ -12,6 +12,16 @@ #define ATH11K_TX_POWER_MAX_VAL 70 #define ATH11K_TX_POWER_MIN_VAL 0 +#define ATH11K_XMIT_OMI_VHT BIT(0) +#define ATH11K_XMIT_OMI_HE BIT(1) +#define ATH11K_XMIT_OMI_RX_NSS GENMASK(4, 2) +#define ATH11K_XMIT_OMI_CHWIDTH GENMASK(6, 5) +#define ATH11K_XMIT_OMI_UL_UM_DIS BIT(7) +#define ATH11K_XMIT_OMI_TX_NSTS GENMASK(10, 8) +#define ATH11K_XMIT_OMI_ER_SU_DISABLE BIT(11) +#define ATH11K_XMIT_OMI_MIMO_RESOUND BIT(12) +#define ATH11K_XMIT_OMI_UL_MU_DATA_DIS BIT(13) + enum ath11k_debug_mask { ATH11K_DBG_AHB = 0x00000001, ATH11K_DBG_WMI = 0x00000002, diff --git a/drivers/net/wireless/ath/ath11k/debugfs_sta.c b/drivers/net/wireless/ath/ath11k/debugfs_sta.c index 3cdc34218a7d..61c40105bd2a 100644 --- a/drivers/net/wireless/ath/ath11k/debugfs_sta.c +++ b/drivers/net/wireless/ath/ath11k/debugfs_sta.c @@ -526,6 +526,52 @@ static const struct file_operations fops_peer_pktlog = { .llseek = default_llseek, }; +static ssize_t ath11k_dbg_sta_write_xmit_omi(struct file *file, + const char __user *ubuf, + size_t count, loff_t *ppos) +{ + struct ieee80211_sta *sta = file->private_data; + struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; + u8 vht, he, rx_nss, chwidth, ul_mu_disable, tx_nsts, er_su_disable; + u8 resound_recommendation, ul_mu_data_disable; + u8 buf[64] = {0}; + u32 val; + 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, "%hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu", + &vht, &he, &rx_nss, &chwidth, &ul_mu_disable, &tx_nsts, + &er_su_disable, &resound_recommendation, + &ul_mu_data_disable); + if (ret != 9) + return -EINVAL; + + val = FIELD_PREP(ATH11K_XMIT_OMI_VHT, vht) | + FIELD_PREP(ATH11K_XMIT_OMI_HE, he) | + FIELD_PREP(ATH11K_XMIT_OMI_RX_NSS, rx_nss) | + FIELD_PREP(ATH11K_XMIT_OMI_CHWIDTH, chwidth) | + FIELD_PREP(ATH11K_XMIT_OMI_UL_UM_DIS, ul_mu_disable) | + FIELD_PREP(ATH11K_XMIT_OMI_TX_NSTS, tx_nsts) | + FIELD_PREP(ATH11K_XMIT_OMI_ER_SU_DISABLE, er_su_disable) | + FIELD_PREP(ATH11K_XMIT_OMI_MIMO_RESOUND, resound_recommendation) | + FIELD_PREP(ATH11K_XMIT_OMI_UL_MU_DATA_DIS, ul_mu_data_disable); + + ret = ath11k_wmi_set_peer_param(arsta->arvif->ar, sta->addr, + arsta->arvif->vdev_id, + WMI_PEER_PARAM_XMIT_OMI, + val); + return ret ? ret : count; +} + +static const struct file_operations fops_write_xmit_omi = { + .write = ath11k_dbg_sta_write_xmit_omi, + .open = simple_open +}; + void ath11k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct dentry *dir) { @@ -543,4 +589,5 @@ void ath11k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif, debugfs_create_file("peer_pktlog", 0644, dir, sta, &fops_peer_pktlog); + debugfs_create_file("xmit_omi", 0644, dir, sta, &fops_write_xmit_omi); } diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 0c1064a0aa39..8cf7220a95f9 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -99,6 +99,8 @@ static const struct wmi_tlv_policy wmi_tlv_policies[] = { = { .min_len = sizeof(struct wmi_pdev_ctl_failsafe_chk_event) }, [WMI_TAG_TWT_ADD_DIALOG_COMPLETE_EVENT] = { .min_len = sizeof(struct wmi_twt_add_dialog_event) }, + [WMI_TAG_PEER_OPER_MODE_CHANGE_EVENT] + = { .min_len = sizeof(struct wmi_peer_oper_mode_change_event) }, }; #define PRIMAP(_hw_mode_) \ @@ -5714,6 +5716,33 @@ static void ath11k_wmi_twt_add_dialog_event(struct ath11k_base *ab, struct sk_bu kfree(tb); } +static void ath11k_wmi_peer_oper_mode_change_event(struct ath11k_base *ab, struct sk_buff *skb) +{ + const void **tb; + const struct wmi_peer_oper_mode_change_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_PEER_OPER_MODE_CHANGE_EVENT]; + if (!ev) { + ath11k_warn(ab, "failed to fetch peer oper mode change ev"); + goto exit; + } + + ath11k_dbg(ab, ATH11K_DBG_WMI, + "OMI Change Event - ind: %ds, rxnss: %d, bw: %d, txnss: %d, disablemu: %d\n", + ev->ind_type, ev->new_rxnss, ev->new_bw, ev->new_txnss, ev->new_disablemu); + +exit: + kfree(tb); +} + static void ath11k_wmi_tlv_op_rx(struct ath11k_base *ab, struct sk_buff *skb) { struct wmi_cmd_hdr *cmd_hdr; @@ -5794,10 +5823,12 @@ static void ath11k_wmi_tlv_op_rx(struct ath11k_base *ab, struct sk_buff *skb) case WMI_TWT_ADD_DIALOG_EVENTID: ath11k_wmi_twt_add_dialog_event(ab, skb); break; + case WMI_PEER_OPER_MODE_CHANGE_EVENTID: + ath11k_wmi_peer_oper_mode_change_event(ab, skb); + break; /* add Unsupported events here */ case WMI_TBTTOFFSET_EXT_UPDATE_EVENTID: case WMI_VDEV_DELETE_RESP_EVENTID: - case WMI_PEER_OPER_MODE_CHANGE_EVENTID: case WMI_TWT_ENABLE_EVENTID: case WMI_TWT_DISABLE_EVENTID: case WMI_TWT_DEL_DIALOG_EVENTID: diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h index 7a1ed73d8b7b..4dbcb9dc0f8d 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h @@ -2004,6 +2004,7 @@ enum { #define WMI_PEER_SET_MAX_TX_RATE 0x11 #define WMI_PEER_SET_MIN_TX_RATE 0x12 #define WMI_PEER_SET_DEFAULT_ROUTING 0x13 +#define WMI_PEER_PARAM_XMIT_OMI 0x1c /* slot time long */ #define WMI_VDEV_SLOT_TIME_LONG 0x1 @@ -4684,6 +4685,15 @@ struct wmi_obss_spatial_reuse_params_cmd { u32 vdev_id; } __packed; +struct wmi_peer_oper_mode_change_event { + struct wmi_mac_addr peer_macaddr; + u32 ind_type; + u32 new_rxnss; + u32 new_bw; + u32 new_txnss; + u32 new_disablemu; +} __packed; + struct target_resource_config { u32 num_vdevs; u32 num_peers;