From patchwork Tue Dec 23 07:47:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Kondratiev X-Patchwork-Id: 5531071 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 651CB9F30B for ; Tue, 23 Dec 2014 07:48:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 729E52010C for ; Tue, 23 Dec 2014 07:48:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 514FD20138 for ; Tue, 23 Dec 2014 07:48:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755219AbaLWHse (ORCPT ); Tue, 23 Dec 2014 02:48:34 -0500 Received: from wolverine02.qualcomm.com ([199.106.114.251]:21144 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755167AbaLWHsd (ORCPT ); Tue, 23 Dec 2014 02:48:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1419320913; x=1450856913; h=from:cc:to:subject:date:message-id:in-reply-to: references; bh=zqgSMKFkjodHESpLYjvqtLe8GCaThy2JmKQ63zpem7o=; b=R68MLRelg7ecIcaQI7lYoFtLM5jm1IvRrP3V1uAumeWuXt9qN2tYFe6h +jOFB03Ko//Q8eFTBBV12IeNSEMDp8G53rgCK/jDupRO3v6Nuf279iQ1P Aw5r1YZKyKwegeEyNRYORkl7qe4BMcfbgTUIdLzHWx1M7A8AwbarN7Jou c=; X-IronPort-AV: E=McAfee;i="5600,1067,7660"; a="186726552" Received: from ironmsg03-r.qualcomm.com ([172.30.46.17]) by wolverine02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 Dec 2014 23:48:21 -0800 From: Vladimir Kondratiev Cc: Vladimir Kondratiev , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com X-IronPort-AV: E=Sophos;i="5.07,630,1413270000"; d="scan'208";a="817199491" Received: from lx-wigig-72.mea.qualcomm.com ([10.18.164.37]) by Ironmsg03-R.qualcomm.com with ESMTP; 22 Dec 2014 23:48:20 -0800 To: Kalle Valo Subject: [PATCH 14/22] wil6210: rework debugfs for BACK Date: Tue, 23 Dec 2014 09:47:16 +0200 Message-Id: <1419320844-23989-15-git-send-email-qca_vkondrat@qca.qualcomm.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1419320844-23989-1-git-send-email-qca_vkondrat@qca.qualcomm.com> References: <1419320844-23989-1-git-send-email-qca_vkondrat@qca.qualcomm.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Enable more flexible control over block ack: - allow addba for any Tx vring - allow to specify block ack timeout - allow to delba for Tx or Rx side of any agreement; with reason Renamed "addba" entry to "back"; it prints short help when read; write: - "add " to trigger ADDBA If missing, defaults to 0 - "del_tx " to trigger DELBA for Tx side - "del_rx " to trigger DELBA for Rx side If missing, set to "STA_LEAVING" (36) Signed-off-by: Vladimir Kondratiev --- drivers/net/wireless/ath/wil6210/debugfs.c | 71 +++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 17 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index 338a811..a36a753 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -564,17 +564,19 @@ static const struct file_operations fops_rxon = { .open = simple_open, }; -/* block ack for vring 0 - * write 0 to it to trigger DELBA - * write positive agg_wsize to trigger ADDBA +/* block ack control, write: + * - "add " to trigger ADDBA + * - "del_tx " to trigger DELBA for Tx side + * - "del_rx " to trigger DELBA for Rx side */ -static ssize_t wil_write_addba(struct file *file, const char __user *buf, - size_t len, loff_t *ppos) +static ssize_t wil_write_back(struct file *file, const char __user *buf, + size_t len, loff_t *ppos) { struct wil6210_priv *wil = file->private_data; int rc; - uint agg_wsize; char *kbuf = kmalloc(len + 1, GFP_KERNEL); + char cmd[8]; + int p1, p2, p3; if (!kbuf) return -ENOMEM; @@ -586,25 +588,60 @@ static ssize_t wil_write_addba(struct file *file, const char __user *buf, } kbuf[len] = '\0'; - rc = kstrtouint(kbuf, 0, &agg_wsize); + rc = sscanf(kbuf, "%8s %d %d %d", cmd, &p1, &p2, &p3); kfree(kbuf); - if (rc) + if (rc < 0) return rc; - - if (!wil->vring_tx[0].va) + if (rc < 2) return -EINVAL; - if (agg_wsize > 0) - wmi_addba(wil, 0, agg_wsize, 0); - else - wmi_delba_tx(wil, 0, 0); + if (0 == strcmp(cmd, "add")) { + if (rc < 3) { + wil_err(wil, "BACK: add require at least 2 params\n"); + return -EINVAL; + } + if (rc < 4) + p3 = 0; + wmi_addba(wil, p1, p2, p3); + } else if (0 == strcmp(cmd, "del_tx")) { + if (rc < 3) + p2 = WLAN_REASON_QSTA_LEAVE_QBSS; + wmi_delba_tx(wil, p1, p2); + } else if (0 == strcmp(cmd, "del_rx")) { + if (rc < 3) { + wil_err(wil, + "BACK: del_rx require at least 2 params\n"); + return -EINVAL; + } + if (rc < 4) + p3 = WLAN_REASON_QSTA_LEAVE_QBSS; + wmi_delba_rx(wil, mk_cidxtid(p1, p2), p3); + } else { + wil_err(wil, "BACK: Unrecognized command \"%s\"\n", cmd); + return -EINVAL; + } return len; } -static const struct file_operations fops_addba = { - .write = wil_write_addba, +static ssize_t wil_read_back(struct file *file, char __user *user_buf, + size_t count, loff_t *ppos) +{ + static const char text[] = "block ack control, write:\n" + " - \"add \" to trigger ADDBA\n" + "If missing, defaults to 0\n" + " - \"del_tx \" to trigger DELBA for Tx side\n" + " - \"del_rx \" to trigger DELBA for Rx side\n" + "If missing, set to \"STA_LEAVING\" (36)\n"; + + return simple_read_from_buffer(user_buf, count, ppos, text, + sizeof(text)); +} + +static const struct file_operations fops_back = { + .read = wil_read_back, + .write = wil_write_back, .open = simple_open, }; @@ -1268,7 +1305,7 @@ static const struct { {"rxon", S_IWUSR, &fops_rxon}, {"tx_mgmt", S_IWUSR, &fops_txmgmt}, {"wmi_send", S_IWUSR, &fops_wmi}, - {"addba", S_IWUSR, &fops_addba}, + {"back", S_IRUGO | S_IWUSR, &fops_back}, {"temp", S_IRUGO, &fops_temp}, {"freq", S_IRUGO, &fops_freq}, {"link", S_IRUGO, &fops_link},