From patchwork Fri Feb 6 06:35:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashok Raj Nagarajan X-Patchwork-Id: 5788821 X-Patchwork-Delegate: johannes@sipsolutions.net 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 956859F336 for ; Fri, 6 Feb 2015 06:36:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C3BD5201BB for ; Fri, 6 Feb 2015 06:36:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ACCEF201B4 for ; Fri, 6 Feb 2015 06:36:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750788AbbBFGgK (ORCPT ); Fri, 6 Feb 2015 01:36:10 -0500 Received: from sabertooth02.qualcomm.com ([65.197.215.38]:30066 "EHLO sabertooth02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750739AbbBFGgJ (ORCPT ); Fri, 6 Feb 2015 01:36:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1423204569; x=1454740569; h=from:to:cc:subject:date:message-id:mime-version; bh=2n9t8W1U1UV9p4aRxiMGy2lFWDagESmyzUzlBfAzGRw=; b=XfnBa7hg6L907zHgOVsqck/9KQ0btrfW2D1rN/wimffKYRXneKr6CSW6 h+tib2CVTQVPXl5x5K9Vz63lgkYjuMuQ9jYydQNpCyykj6aIXQpXOvXlp UWZnS4PwLBqJ5UJrPGF4KbkNjMz3bZzH2ZSs9phwyIAEKZILwdAYLQ5sB o=; X-IronPort-AV: E=McAfee;i="5600,1067,7703"; a="83587291" Received: from ironmsg04-r.qualcomm.com ([172.30.46.18]) by sabertooth02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 05 Feb 2015 22:36:07 -0800 X-IronPort-AV: E=Sophos;i="5.09,527,1418112000"; d="scan'208";a="899700541" Received: from nasanexm02h.na.qualcomm.com ([129.46.53.248]) by Ironmsg04-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 05 Feb 2015 22:36:08 -0800 Received: from aphydexm01f.ap.qualcomm.com (10.252.127.15) by nasanexm02h.na.qualcomm.com (129.46.53.248) with Microsoft SMTP Server (TLS) id 15.0.995.29; Thu, 5 Feb 2015 22:36:06 -0800 Received: from qcmail1.qualcomm.com (10.80.80.8) by aphydexm01f.ap.qualcomm.com (10.252.127.15) with Microsoft SMTP Server (TLS) id 15.0.995.29; Thu, 5 Feb 2015 22:35:57 -0800 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Fri, 06 Feb 2015 12:05:48 +0530 From: Ashok Raj Nagarajan To: CC: , , , Ashok Raj Nagarajan Subject: [PATCH] cfg80211: add debugfs VHT80 allow map Date: Fri, 6 Feb 2015 12:05:46 +0530 Message-ID: <1423204546-22872-1-git-send-email-arnagara@qti.qualcomm.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01D.na.qualcomm.com (10.85.0.84) To aphydexm01f.ap.qualcomm.com (10.252.127.15) 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 Here is a output of this debugfs entry root@OpenWrt:/# cat /sys/kernel/debug/ieee80211/phy0/vht80allow_map 2412 VHT80 N 2417 VHT80 N 2422 VHT80 N 2427 VHT80 N 2432 VHT80 N 2437 VHT80 N 2442 VHT80 N 2447 VHT80 N 2452 VHT80 N 2457 VHT80 N 2462 VHT80 N 2467 Disabled 2472 Disabled 2484 Disabled 5180 VHT80 Y 5200 VHT80 Y 5220 VHT80 Y 5240 VHT80 Y 5260 VHT80 Y 5280 VHT80 Y 5300 VHT80 Y 5320 VHT80 Y 5500 VHT80 Y 5520 VHT80 Y 5540 VHT80 Y 5560 VHT80 Y 5580 VHT80 Y 5600 Disabled 5620 Disabled 5640 Disabled 5660 VHT80 Y 5680 VHT80 Y 5700 VHT80 Y 5745 VHT80 Y 5765 VHT80 Y 5785 VHT80 Y 5805 VHT80 Y 5825 VHT80 Y Signed-off-by: Ashok Raj Nagarajan --- net/wireless/debugfs.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c index 4541577..0349dcd 100644 --- a/net/wireless/debugfs.c +++ b/net/wireless/debugfs.c @@ -102,6 +102,66 @@ static const struct file_operations ht40allow_map_ops = { .llseek = default_llseek, }; +static int vht80_print_chan(struct ieee80211_channel *chan, + char *buf, int buf_size, int offset) +{ + if (WARN_ON(offset > buf_size)) + return 0; + + if (chan->flags & IEEE80211_CHAN_DISABLED) + return scnprintf(buf + offset, + buf_size - offset, + "%d Disabled\n", + chan->center_freq); + + return scnprintf(buf + offset, + buf_size - offset, + "%d VHT80 %c\n", + chan->center_freq, + (chan->flags & IEEE80211_CHAN_NO_80MHZ) ? + 'N' : 'Y'); +} + +static ssize_t vht80allow_map_read(struct file *file, + char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct wiphy *wiphy = file->private_data; + char *buf; + unsigned int offset = 0, buf_size = PAGE_SIZE, i, r; + enum ieee80211_band band; + struct ieee80211_supported_band *sband; + + buf = kzalloc(buf_size, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + rtnl_lock(); + + for (band = 0; band < IEEE80211_NUM_BANDS; band++) { + sband = wiphy->bands[band]; + if (!sband) + continue; + for (i = 0; i < sband->n_channels; i++) + offset += vht80_print_chan(&sband->channels[i], + buf, buf_size, offset); + } + + rtnl_unlock(); + + r = simple_read_from_buffer(user_buf, count, ppos, buf, offset); + + kfree(buf); + + return r; +} + +static const struct file_operations vht80allow_map_ops = { + .read = vht80allow_map_read, + .open = simple_open, + .llseek = default_llseek, +}; + #define DEBUGFS_ADD(name) \ debugfs_create_file(#name, S_IRUGO, phyd, &rdev->wiphy, &name## _ops); @@ -114,4 +174,5 @@ void cfg80211_debugfs_rdev_add(struct cfg80211_registered_device *rdev) DEBUGFS_ADD(short_retry_limit); DEBUGFS_ADD(long_retry_limit); DEBUGFS_ADD(ht40allow_map); + DEBUGFS_ADD(vht80allow_map); }