linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211:  add vht cap decode to debugfs.
@ 2016-05-02 21:19 greearb
  2016-05-02 21:23 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: greearb @ 2016-05-02 21:19 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Ben Greear

From: Ben Greear <greearb@candelatech.com>

This makes it a lot easier to understand the capabilities used
by the station:

VHT supported
cap: 0x300819b2
		MAX-MPDU-11454
		RXLDPC
		SHORT-GI-80
		TXSTBC
		RXSTBC_1
		RXSTBC_3
		SU-BEAMFORMER-CAPABLE
		SU-BEAMFORMEE-CAPABLE
		BEAMFORMEE-STS: 0x0
		SOUNDING-DIMENSIONS: 0x0
		MU-BEAMFORMER-CAPABLE
		MPDU-LENGTH-EXPONENT: 0x0
		LINK-ADAPTATION-VHT-MRQ-MFB: 0x0
		RX-ANTENNA-PATTERN
		RX-ANTENNA-PATTERN
RX MCS: fffe
TX MCS: fffe

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 net/mac80211/debugfs_sta.c | 50 ++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 48 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 5d3d2ab..ff9d4dd 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -292,14 +292,60 @@ STA_OPS(ht_capa);
 static ssize_t sta_vht_capa_read(struct file *file, char __user *userbuf,
 				 size_t count, loff_t *ppos)
 {
-	char buf[128], *p = buf;
+	char buf[512], *p = buf;
 	struct sta_info *sta = file->private_data;
 	struct ieee80211_sta_vht_cap *vhtc = &sta->sta.vht_cap;
 
 	p += scnprintf(p, sizeof(buf) + buf - p, "VHT %ssupported\n",
 			vhtc->vht_supported ? "" : "not ");
 	if (vhtc->vht_supported) {
-		p += scnprintf(p, sizeof(buf)+buf-p, "cap: %#.8x\n", vhtc->cap);
+		p += scnprintf(p, sizeof(buf) + buf - p, "cap: %#.8x\n",
+			       vhtc->cap);
+#define PFLAG(a, b)							\
+		do {							\
+			if (vhtc->cap & IEEE80211_VHT_CAP_ ## a)	\
+				p += scnprintf(p, sizeof(buf) + buf - p, \
+					       "\t\t%s\n", b);		\
+		} while (0)
+
+		PFLAG(MAX_MPDU_LENGTH_3895, "MAX-MPDU-3895");
+		PFLAG(MAX_MPDU_LENGTH_7991, "MAX-MPDU-7991");
+		PFLAG(MAX_MPDU_LENGTH_11454, "MAX-MPDU-11454");
+		PFLAG(SUPP_CHAN_WIDTH_160MHZ, "160Mhz");
+		PFLAG(SUPP_CHAN_WIDTH_160_80PLUS80MHZ, "160-80+80Mhz");
+		PFLAG(RXLDPC, "RXLDPC");
+		PFLAG(SHORT_GI_80, "SHORT-GI-80");
+		PFLAG(SHORT_GI_160, "SHORT-GI-160");
+		PFLAG(TXSTBC, "TXSTBC");
+		PFLAG(RXSTBC_1, "RXSTBC_1");
+		PFLAG(RXSTBC_2, "RXSTBC_2");
+		PFLAG(RXSTBC_3, "RXSTBC_3");
+		PFLAG(RXSTBC_4, "RXSTBC_4");
+		PFLAG(SU_BEAMFORMER_CAPABLE, "SU-BEAMFORMER-CAPABLE");
+		PFLAG(SU_BEAMFORMEE_CAPABLE, "SU-BEAMFORMEE-CAPABLE");
+		p += scnprintf(p, sizeof(buf) + buf - p,
+			"\t\tBEAMFORMEE-STS: 0x%x\n",
+			(vhtc->cap & IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK) >>
+			IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT);
+		p += scnprintf(p, sizeof(buf) + buf - p,
+			"\t\tSOUNDING-DIMENSIONS: 0x%x\n",
+			(vhtc->cap & IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK)
+			>> IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT);
+		PFLAG(MU_BEAMFORMER_CAPABLE, "MU-BEAMFORMER-CAPABLE");
+		PFLAG(MU_BEAMFORMEE_CAPABLE, "MU-BEAMFORMEE-CAPABLE");
+		PFLAG(VHT_TXOP_PS, "TXOP-PS");
+		PFLAG(HTC_VHT, "HTC-VHT");
+		p += scnprintf(p, sizeof(buf) + buf - p,
+			"\t\tMPDU-LENGTH-EXPONENT: 0x%x\n",
+			(vhtc->cap & IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK) >>
+			IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT);
+		PFLAG(VHT_LINK_ADAPTATION_VHT_UNSOL_MFB,
+		      "LINK-ADAPTATION-VHT-UNSOL-MFB");
+		p += scnprintf(p, sizeof(buf) + buf - p,
+			"\t\tLINK-ADAPTATION-VHT-MRQ-MFB: 0x%x\n",
+			(vhtc->cap & IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB) >> 26);
+		PFLAG(RX_ANTENNA_PATTERN, "RX-ANTENNA-PATTERN");
+		PFLAG(TX_ANTENNA_PATTERN, "RX-ANTENNA-PATTERN");
 
 		p += scnprintf(p, sizeof(buf)+buf-p, "RX MCS: %.4x\n",
 			       le16_to_cpu(vhtc->vht_mcs.rx_mcs_map));
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mac80211:  add vht cap decode to debugfs.
  2016-05-02 21:19 [PATCH] mac80211: add vht cap decode to debugfs greearb
@ 2016-05-02 21:23 ` Johannes Berg
  2016-05-02 21:27   ` Ben Greear
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2016-05-02 21:23 UTC (permalink / raw)
  To: greearb, linux-wireless


> +			if (vhtc->cap & IEEE80211_VHT_CAP_ ## a)+		
> 		p += scnprintf(p, sizeof(buf) + buf
> - p, \
> +					       "\t\t%s\n", b);	

Why not use #a instead of b?

> +		PFLAG(MAX_MPDU_LENGTH_3895, "MAX-MPDU-3895");


Makes that a bit longer in the printout, but makes the code shorter.

johannes

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mac80211: add vht cap decode to debugfs.
  2016-05-02 21:23 ` Johannes Berg
@ 2016-05-02 21:27   ` Ben Greear
  0 siblings, 0 replies; 3+ messages in thread
From: Ben Greear @ 2016-05-02 21:27 UTC (permalink / raw)
  To: Johannes Berg, linux-wireless

On 05/02/2016 02:23 PM, Johannes Berg wrote:
>
>> +			if (vhtc->cap & IEEE80211_VHT_CAP_ ## a)+		
>> 		p += scnprintf(p, sizeof(buf) + buf
>> - p, \
>> +					       "\t\t%s\n", b);	
>
> Why not use #a instead of b?
>
>> +		PFLAG(MAX_MPDU_LENGTH_3895, "MAX-MPDU-3895");
>
>
> Makes that a bit longer in the printout, but makes the code shorter.

I don't care that much either way, but it seemed nicer to customize the output.

It at least won't change the actual compiled code much...

I'll change it to be as you suggest if you want.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-02 21:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-02 21:19 [PATCH] mac80211: add vht cap decode to debugfs greearb
2016-05-02 21:23 ` Johannes Berg
2016-05-02 21:27   ` Ben Greear

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).