Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2454275pxb; Tue, 9 Mar 2021 03:01:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhDrsqZyclvLd73Of/h3rX68eeAnwMpEYTj00Ec/XqTZOv2C6nfxr5G/cawOV3dQ/TUEkh X-Received: by 2002:a05:6402:48c:: with SMTP id k12mr3357329edv.237.1615287668782; Tue, 09 Mar 2021 03:01:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615287668; cv=none; d=google.com; s=arc-20160816; b=TrDjTsle09TC/H5E+tO/nVfK4YGXdprUCakuBnUgxB2RhWGfE/f8EoEOXTtzwrFlYa 1zBWC74mwa8ipFstFjFPvs2uzrJU9rNZZ+MyZ8MCBaS1+5jW1jDTCq3T68I3UvPjzGW/ v1yhnX2ALo55EwfHBmDDMH2Uwg0gwHmanaX4brDthXADEfCx3QkTL1FJtkvhbhwO+Gbj M1WBmDs59ufKMssEosF3MF9gE9MnFtL6TGCN5VJ2JhZiURK3GYLzH2Rg2jXdFJut8suR 67DfU4NEktYGAU0euQAneMmqt1j0hnLl8M8PU1UbWxZFiHYsnzjm8P8HlqWbgjgoTx6P 7VCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dmarc-filter:sender :dkim-signature; bh=EkpYZux4lGjPJ0NFDAaNb4kp+mRV085n5TDuN1w/cWo=; b=jQLNykjHsm0b5cNTXlwqJBTwo1AQZbWdN7TRDYB8/vQUVrK5GLFnXJgXxkIsaxZ7gr sYtBQM94nV9Lw/zFZMpSl8+Q+EzVdOgwOwJHXtGLtziGV4DLofWr/bPLNLzXhwfITqqL lSQE2KlvbyBTdYXvevkWpBm5Wi8z3M2e5y+cEbfgQR9AivbmbG1V+0LK+j80BxPMnls6 pVPjMci7CFST1SKrsfw5SNKvWdTdjRAANqmavkwiYQQH10XVLVMq7L5ezgYmuSmi+9ZU 4aVT86W/6NVe206R6wx6Uphu/Ll26MtczevIOFginDg6qYyPBcupnf4cZFht9iWeZlcZ OI4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=Tz2eWlRx; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g23si9099764ejd.676.2021.03.09.03.00.46; Tue, 09 Mar 2021 03:01:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=Tz2eWlRx; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229875AbhCIK7v (ORCPT + 99 others); Tue, 9 Mar 2021 05:59:51 -0500 Received: from m42-2.mailgun.net ([69.72.42.2]:17399 "EHLO m42-2.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229805AbhCIK7b (ORCPT ); Tue, 9 Mar 2021 05:59:31 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1615287571; h=Content-Type: MIME-Version: Message-ID: In-Reply-To: Date: References: Subject: Cc: To: From: Sender; bh=EkpYZux4lGjPJ0NFDAaNb4kp+mRV085n5TDuN1w/cWo=; b=Tz2eWlRxQF3m9ZuuRL+HC7FzJlXuOL1NSMoPZhb7TTJtpwFLb6Pq6fv8qyyIW69R206FR9vD 28FuxPZ3oXsmxBWcsDQJezNLCIvYfYEUxnDhwmdNCbdzXx6CZyu7/69WTieaz9yxF7Gnm3c3 0IqDWjBtVNUHA/dDnon34IQ+JKg= X-Mailgun-Sending-Ip: 69.72.42.2 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n06.prod.us-west-2.postgun.com with SMTP id 604755112a5e6d1bfa87d380 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 09 Mar 2021 10:59:29 GMT Sender: kvalo=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 625ACC433ED; Tue, 9 Mar 2021 10:59:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from potku.adurom.net (88-114-240-156.elisa-laajakaista.fi [88.114.240.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kvalo) by smtp.codeaurora.org (Postfix) with ESMTPSA id 194E3C433CA; Tue, 9 Mar 2021 10:59:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 194E3C433CA Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=kvalo@codeaurora.org From: Kalle Valo To: Aloka Dixit Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, John Crispin Subject: Re: [PATCH V5 2/2] ath11k: add debugfs for TWT debug calls References: <20210222192651.1782-1-alokad@codeaurora.org> <20210222192651.1782-3-alokad@codeaurora.org> Date: Tue, 09 Mar 2021 12:59:25 +0200 In-Reply-To: <20210222192651.1782-3-alokad@codeaurora.org> (Aloka Dixit's message of "Mon, 22 Feb 2021 11:26:51 -0800") Message-ID: <87o8fszj76.fsf@codeaurora.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Aloka Dixit writes: > From: John Crispin > > New debugfs files to manually add/delete/pause/resume TWT > dialogs for test/debug purposes. > > The debugfs files expect the following parameters > (1) Add dialog > echo ' > <1:Broadcast / > 0:Individual> <1:Triggered / 0:Untriggered> <1:Unannounced / > 0:Announced> <1:Protected / 0:Unprotected>' > > /sys/kernel/debug/ieee80211/phyX/netdev:wlanX/twt/add_dialog > > Example (Non-triggered and un-announced): > echo '00:03:7F:20:13:52 1 102400 100 30720 20480 4 0 0 1 0' > > /sys/kernel/debug/ieee80211/phy0/netdev:wlan0/twt/add_dialog > > (2) Delete dialog > echo ' ' > > /sys/kernel/debug/ieee80211/phyX/netdev:wlanX/twt/del_dialog > > (3) Pause dialog > echo ' ' > > /sys/kernel/debug/ieee80211/phyX/netdev:wlanX/twt/pause_dialog > > (4) Resume dialog > echo ' ' > > /sys/kernel/debug/ieee80211/phyX/netdev:wlanX/twt/resume_dialog > > Example: > echo '00:03:7F:20:13:52 1 2000000 3' > > /sys/kernel/debug/ieee80211/phy0/netdev:wlan0/twt/resume_dialog > > Signed-off-by: John Crispin > Co-developed-by: Aloka Dixit > Signed-off-by: Aloka Dixit [...] > --- a/drivers/net/wireless/ath/ath11k/debug.c > +++ b/drivers/net/wireless/ath/ath11k/debug.c > @@ -104,3 +104,227 @@ void ath11k_dbg_dump(struct ath11k_base *ab, > EXPORT_SYMBOL(ath11k_dbg_dump); > > #endif /* CONFIG_ATH11K_DEBUG */ > + > +#ifdef CONFIG_ATH11K_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; > + > + if (arvif->ar->twt_enabled == 0) { > + ath11k_err(arvif->ar->ab, "TWT support is not enabled\n"); > + return -EOPNOTSUPP; > + } > + > + 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); > + if (ret) > + return ret; > + > + return 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; > + > + if (arvif->ar->twt_enabled == 0) { > + ath11k_err(arvif->ar->ab, "TWT support is not enabled\n"); > + return -EOPNOTSUPP; > + } > + > + 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); > + if (ret) > + return ret; > + > + return 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; > + > + if (arvif->ar->twt_enabled == 0) { > + ath11k_err(arvif->ar->ab, "TWT support is not enabled\n"); > + return -EOPNOTSUPP; > + } > + > + 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); > + if (ret) > + return ret; > + > + return 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; > + > + if (arvif->ar->twt_enabled == 0) { > + ath11k_err(arvif->ar->ab, "TWT support is not enabled\n"); > + return -EOPNOTSUPP; > + } > + > + 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); > + if (ret) > + return ret; > + > + return 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_add_interface(struct ath11k_vif *arvif) > +{ > + if (arvif->vif->type == NL80211_IFTYPE_AP && !arvif->debugfs_twt) { > + 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); > + } > +} > + > +void ath11k_debugfs_remove_interface(struct ath11k_vif *arvif) > +{ > + debugfs_remove_recursive(arvif->debugfs_twt); > + arvif->debugfs_twt = NULL; > +} > + > +#endif /* CONFIG_ATH11K_DEBUGFS */ Shouldn't these functions be in debugfs.c? > diff --git a/drivers/net/wireless/ath/ath11k/debug.h b/drivers/net/wireless/ath/ath11k/debug.h > index 659a275e2eb3..2b41cefb68b5 100644 > --- a/drivers/net/wireless/ath/ath11k/debug.h > +++ b/drivers/net/wireless/ath/ath11k/debug.h > @@ -64,4 +64,17 @@ do { \ > __ath11k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \ > } while (0) > > +#ifdef CONFIG_ATH11K_DEBUGFS > +void ath11k_debugfs_add_interface(struct ath11k_vif *arvif); > +void ath11k_debugfs_remove_interface(struct ath11k_vif *arvif); > +#else /* CONFIG_ATH11K_DEBUGFS */ > +static inline void ath11k_debugfs_add_interface(struct ath11k_vif *arvif) > +{ > +} > + > +static inline void ath11k_debugfs_remove_interface(struct ath11k_vif *arvif) > +{ > +} > +#endif /* CONFIG_ATH11K_DEBUGFS */ And these in debugfs.h? -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches