From patchwork Thu May 14 09:14:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 6403591 Return-Path: X-Original-To: patchwork-ath10k@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 43AFDBEEE1 for ; Thu, 14 May 2015 09:15:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3CF00203DA for ; Thu, 14 May 2015 09:15:47 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3E772201EC for ; Thu, 14 May 2015 09:15:46 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YspEs-00029K-Ud; Thu, 14 May 2015 09:15:34 +0000 Received: from wolverine02.qualcomm.com ([199.106.114.251]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YspEo-0001DR-A0 for ath10k@lists.infradead.org; Thu, 14 May 2015 09:15:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1431594930; x=1463130930; h=from:to:cc:subject:date:message-id:mime-version; bh=dcZLd3obxkx5gvXYqbsSzvApzdo4Bx0zn0X2STlf4vw=; b=Xf8eTNhrv1OZkb6XVR5mFzg6Q6cvGrwx5C23+ymY9suQwwYEgVsVTnDa yfArVNbm6yS3stiS/neBzpGL29R0i4jeiPWhH+oN4kNgZ4ylfDfCDTzVS gusQbHDexrNJOOUdS1AMRSo4lGmfG7XIUWwcjpc+6v8iqGa0mP4A+n337 k=; X-IronPort-AV: E=McAfee;i="5700,7163,7800"; a="210580961" Received: from ironmsg03-r.qualcomm.com ([172.30.46.17]) by wolverine02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 14 May 2015 02:15:06 -0700 X-IronPort-AV: E=Sophos;i="5.13,426,1427785200"; d="scan'208";a="917172960" Received: from nasanexm02a.na.qualcomm.com ([10.85.0.41]) by Ironmsg03-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 14 May 2015 02:15:04 -0700 Received: from aphydexm01b.ap.qualcomm.com (10.252.127.11) by nasanexm02a.na.qualcomm.com (10.85.0.41) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Thu, 14 May 2015 02:15:02 -0700 Received: from qcmail1.qualcomm.com (10.80.80.8) by aphydexm01b.ap.qualcomm.com (10.252.127.11) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Thu, 14 May 2015 14:44:54 +0530 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Thu, 14 May 2015 14:44:46 +0530 From: Rajkumar Manoharan To: Subject: [PATCH] ath10k: Add debugfs support to configure beacon tx mode Date: Thu, 14 May 2015 14:44:45 +0530 Message-ID: <1431594885-32346-1-git-send-email-rmanohar@qti.qualcomm.com> X-Mailer: git-send-email 2.4.0 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01C.na.qualcomm.com (10.85.0.83) To aphydexm01b.ap.qualcomm.com (10.252.127.11) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150514_021530_472224_2B80BFBC X-CRM114-Status: GOOD ( 14.53 ) X-Spam-Score: -5.1 (-----) Cc: linux-wireless@vger.kernel.org, Rajkumar Manoharan X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, 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 Introduce debugfs entry to select beacon tx mode to staggered or bursted mode. In staggered mode, software beacon alert will be evenly distributed for each beaconing interfaces by (beacon intval / number of vif). In bursted mode, batch of beacons will be sent out as batch at beacon interval. By default, staggered mode is selected. To select bursted mode echo 1 > /sys/kernel/debug/ieee80211/phyX/ath10k/beacon_tx_mode For staggered mode, echo 0 > /sys/kernel/debug/ieee80211/phyX/ath10k/beacon_tx_mode Signed-off-by: Rajkumar Manoharan --- drivers/net/wireless/ath/ath10k/core.h | 1 + drivers/net/wireless/ath/ath10k/debug.c | 60 +++++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/mac.c | 9 ++--- drivers/net/wireless/ath/ath10k/mac.h | 1 + 4 files changed, 67 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 827b3d7..be85b1f 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -394,6 +394,7 @@ struct ath10k_debug { u8 htt_max_ampdu; struct ath10k_fw_crash_data *fw_crash_data; + enum wmi_beacon_gen_mode beacon_tx_mode; }; enum ath10k_state { diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 8fa606a..de63465 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -24,6 +24,7 @@ #include "debug.h" #include "hif.h" #include "wmi-ops.h" +#include "mac.h" /* ms */ #define ATH10K_DEBUG_HTT_STATS_INTERVAL 1000 @@ -1885,6 +1886,7 @@ int ath10k_debug_start(struct ath10k *ar) ath10k_warn(ar, "cal period cfg failed from debug start: %d\n", ret); } + ar->debug.beacon_tx_mode = WMI_BEACON_STAGGERED_MODE; return ret; } @@ -2092,6 +2094,61 @@ static const struct file_operations fops_quiet_period = { .open = simple_open }; +static ssize_t ath10k_write_beacon_tx_mode(struct file *file, + const char __user *ubuf, + size_t count, loff_t *ppos) +{ + struct ath10k *ar = file->private_data; + u32 beacon_tx_mode; + int ret; + + if (kstrtouint_from_user(ubuf, count, 0, &beacon_tx_mode)) + return -EINVAL; + + if (beacon_tx_mode > WMI_BEACON_BURST_MODE) { + ath10k_warn(ar, "Invalid beaconing mode configured: %d\n", + beacon_tx_mode); + return -EINVAL; + } + mutex_lock(&ar->conf_mutex); + ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->beacon_tx_mode, + beacon_tx_mode); + if (ret) { + ath10k_warn(ar, "failed to set beacon tx mode: %d\n", ret); + mutex_unlock(&ar->conf_mutex); + return ret; + } + + ath10k_mac_chan_reconfigure(ar); + ar->debug.beacon_tx_mode = beacon_tx_mode; + mutex_unlock(&ar->conf_mutex); + + return count; +} + +static ssize_t ath10k_read_beacon_tx_mode(struct file *file, char __user *ubuf, + size_t count, loff_t *ppos) +{ + char buf[100]; + struct ath10k *ar = file->private_data; + int len = 0; + + mutex_lock(&ar->conf_mutex); + len = scnprintf(buf + len, sizeof(buf) - len, + "available beaconing modes: 0 - staggered 1 - bursted\n"); + len += scnprintf(buf + len, sizeof(buf) - len, "current mode: %s\n", + (ar->debug.beacon_tx_mode) ? "bursted" : "staggered"); + mutex_unlock(&ar->conf_mutex); + + return simple_read_from_buffer(ubuf, count, ppos, buf, len); +} + +static const struct file_operations fops_beacon_tx_mode = { + .read = ath10k_read_beacon_tx_mode, + .write = ath10k_write_beacon_tx_mode, + .open = simple_open +}; + int ath10k_debug_create(struct ath10k *ar) { ar->debug.fw_crash_data = vzalloc(sizeof(*ar->debug.fw_crash_data)); @@ -2195,6 +2252,9 @@ int ath10k_debug_register(struct ath10k *ar) debugfs_create_file("quiet_period", S_IRUGO | S_IWUSR, ar->debug.debugfs_phy, ar, &fops_quiet_period); + debugfs_create_file("beacon_tx_mode", S_IRUGO | S_IWUSR, + ar->debug.debugfs_phy, ar, &fops_beacon_tx_mode); + return 0; } diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 425dbe2..898b821 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -3969,7 +3969,7 @@ static int ath10k_config_ps(struct ath10k *ar) return ret; } -static void ath10k_mac_chan_reconfigure(struct ath10k *ar) +void ath10k_mac_chan_reconfigure(struct ath10k *ar) { struct ath10k_vif *arvif; struct cfg80211_chan_def def; @@ -4556,12 +4556,13 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw, if (changed & BSS_CHANGED_BEACON) { ath10k_dbg(ar, ATH10K_DBG_MAC, - "vdev %d set beacon tx mode to staggered\n", - arvif->vdev_id); + "vdev %d set beacon tx mode to %s\n", + arvif->vdev_id, + ar->debug.beacon_tx_mode ? "bursted" : "staggered"); pdev_param = ar->wmi.pdev_param->beacon_tx_mode; ret = ath10k_wmi_pdev_set_param(ar, pdev_param, - WMI_BEACON_STAGGERED_MODE); + ar->debug.beacon_tx_mode); if (ret) ath10k_warn(ar, "failed to set beacon mode for vdev %d: %i\n", arvif->vdev_id, ret); diff --git a/drivers/net/wireless/ath/ath10k/mac.h b/drivers/net/wireless/ath/ath10k/mac.h index b291f06..a765ae8 100644 --- a/drivers/net/wireless/ath/ath10k/mac.h +++ b/drivers/net/wireless/ath/ath10k/mac.h @@ -74,6 +74,7 @@ void ath10k_mac_tx_lock(struct ath10k *ar, int reason); void ath10k_mac_tx_unlock(struct ath10k *ar, int reason); void ath10k_mac_vif_tx_lock(struct ath10k_vif *arvif, int reason); void ath10k_mac_vif_tx_unlock(struct ath10k_vif *arvif, int reason); +void ath10k_mac_chan_reconfigure(struct ath10k *ar); static inline struct ath10k_vif *ath10k_vif_to_arvif(struct ieee80211_vif *vif) {