2015-02-06 06:36:09

by Ashok Raj Nagarajan

[permalink] [raw]
Subject: [PATCH] cfg80211: add debugfs VHT80 allow map

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 <[email protected]>
---
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);
}
--
1.7.9.5



2015-02-09 07:16:13

by Ashok Raj Nagarajan

[permalink] [raw]
Subject: RE: [PATCH] cfg80211: add debugfs VHT80 allow map

Hi Johannes,

I see your point here. I will upload one patch for printing this info from iw.

I will also write another patch for removing HT40 one?

Thanks,
Ashok
________________________________________
From: Johannes Berg <[email protected]>
Sent: Saturday, February 7, 2015 12:41 AM
To: Nagarajan, Ashok Raj
Cc: [email protected]; Manoharan, Rajkumar; Thiagarajan, Vasanthakumar
Subject: Re: [PATCH] cfg80211: add debugfs VHT80 allow map

On Fri, 2015-02-06 at 12:05 +0530, Ashok Raj Nagarajan wrote:
> Here is a output of this debugfs entry
>
> root@OpenWrt:/# cat /sys/kernel/debug/ieee80211/phy0/vht80allow_map
> 2412 VHT80 N

I'm not sure I see much point in this, in fact we could remove the HT40
one?

We expose this data to userspace, so you could change 'iw' to print it
when dumping the list of channels in 'iw list' or similar.

johannes


2015-02-06 19:11:05

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] cfg80211: add debugfs VHT80 allow map

On Fri, 2015-02-06 at 12:05 +0530, Ashok Raj Nagarajan wrote:
> Here is a output of this debugfs entry
>
> root@OpenWrt:/# cat /sys/kernel/debug/ieee80211/phy0/vht80allow_map
> 2412 VHT80 N

I'm not sure I see much point in this, in fact we could remove the HT40
one?

We expose this data to userspace, so you could change 'iw' to print it
when dumping the list of channels in 'iw list' or similar.

johannes


2015-02-09 10:16:54

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] cfg80211: add debugfs VHT80 allow map

[please don't top-post]

On Mon, 2015-02-09 at 07:16 +0000, Nagarajan, Ashok Raj wrote:
> Hi Johannes,
>
> I see your point here. I will upload one patch for printing this info from iw.
>
> I will also write another patch for removing HT40 one?

Sounds fine - any complaints from others?

johannes