All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <briannorris@chromium.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org,
	David Poole <dpoole@cradlepoint.com>,
	Ben Greear <greearb@candelatech.com>,
	John Crispin <john@phrozen.org>,
	Brian Norris <briannorris@chromium.org>
Subject: [PATCH 4/4] iw: scan: fixup HE caps whitespace
Date: Tue, 17 Nov 2020 19:39:36 -0800	[thread overview]
Message-ID: <20201118033936.3667788-5-briannorris@chromium.org> (raw)
In-Reply-To: <20201118033936.3667788-1-briannorris@chromium.org>

For scans, it's nicer to drop an indentation level, because we don't
have the "interface type" section that we do in the phy-info version.

The NSS print also had an extra level of indentation, and a spare
leading space, which made it a bit inconsistent with other sections.

Signed-off-by: Brian Norris <briannorris@chromium.org>
---
 util.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/util.c b/util.c
index b09bcaf743fc..00f3755b1000 100644
--- a/util.c
+++ b/util.c
@@ -992,21 +992,23 @@ void print_vht_info(__u32 capa, const __u8 *mcs)
 static void __print_he_capa(const __u16 *mac_cap,
 			    const __u16 *phy_cap,
 			    const __u16 *mcs_set, size_t mcs_len,
-			    const __u8 *ppet, int ppet_len)
+			    const __u8 *ppet, int ppet_len,
+			    bool indent)
 {
 	size_t mcs_used;
 	int i;
+	const char *pre = indent ? "\t" : "";
 
 	#define PRINT_HE_CAP(_var, _idx, _bit, _str) \
 	do { \
 		if (_var[_idx] & BIT(_bit)) \
-			printf("\t\t\t\t" _str "\n"); \
+			printf("%s\t\t\t" _str "\n", pre); \
 	} while (0)
 
 	#define PRINT_HE_CAP_MASK(_var, _idx, _shift, _mask, _str) \
 	do { \
 		if ((_var[_idx] >> _shift) & _mask) \
-			printf("\t\t\t\t" _str ": %d\n", (_var[_idx] >> _shift) & _mask); \
+			printf("%s\t\t\t" _str ": %d\n", pre, (_var[_idx] >> _shift) & _mask); \
 	} while (0)
 
 	#define PRINT_HE_MAC_CAP(...) PRINT_HE_CAP(mac_cap, __VA_ARGS__)
@@ -1015,7 +1017,7 @@ static void __print_he_capa(const __u16 *mac_cap,
 	#define PRINT_HE_PHY_CAP0(_idx, _bit, ...) PRINT_HE_CAP(phy_cap, _idx, _bit + 8, __VA_ARGS__)
 	#define PRINT_HE_PHY_CAP_MASK(...) PRINT_HE_CAP_MASK(phy_cap, __VA_ARGS__)
 
-	printf("\t\t\tHE MAC Capabilities (0x");
+	printf("%s\t\tHE MAC Capabilities (0x", pre);
 	for (i = 0; i < 3; i++)
 		printf("%04x", mac_cap[i]);
 	printf("):\n");
@@ -1055,7 +1057,7 @@ static void __print_he_capa(const __u16 *mac_cap,
 	PRINT_HE_MAC_CAP(2, 11, "UL 2x996-Tone RU");
 	PRINT_HE_MAC_CAP(2, 12, "OM Control UL MU Data Disable RX");
 
-	printf("\t\t\tHE PHY Capabilities: (0x");
+	printf("%s\t\tHE PHY Capabilities: (0x", pre);
 	for (i = 0; i < 11; i++)
 		printf("%02x", ((__u8 *)phy_cap)[i + 1]);
 	printf("):\n");
@@ -1140,12 +1142,12 @@ static void __print_he_capa(const __u16 *mac_cap,
 
 		for (j = 0; j < 2; j++) {
 			int k;
-			printf("\t\t\tHE %s MCS and NSS set %s MHz\n", j ? "TX" : "RX", bw[i]);
+			printf("%s\t\tHE %s MCS and NSS set %s MHz\n", pre, j ? "TX" : "RX", bw[i]);
 			for (k = 0; k < 8; k++) {
 				__u16 mcs = mcs_set[(i * 2) + j];
 				mcs >>= k * 2;
 				mcs &= 0x3;
-				printf("\t\t\t\t\t %d streams: ", k + 1);
+				printf("%s\t\t\t%d streams: ", pre, k + 1);
 				if (mcs == 3)
 					printf("not supported\n");
 				else
@@ -1166,7 +1168,7 @@ static void __print_he_capa(const __u16 *mac_cap,
 	}
 
 	if (ppet_len && (phy_cap[3] & BIT(15))) {
-		printf("\t\t\tPPE Threshold ");
+		printf("%s\t\tPPE Threshold ", pre);
 		for (i = 0; i < ppet_len; i++)
 			if (ppet[i])
 				printf("0x%02x ", ppet[i]);
@@ -1245,7 +1247,8 @@ void print_he_info(struct nlattr *nl_iftype)
 		ppet_len = len;
 	}
 
-	__print_he_capa(mac_cap, phy_cap, mcs_set, mcs_len, ppet, ppet_len);
+	__print_he_capa(mac_cap, phy_cap, mcs_set, mcs_len, ppet, ppet_len,
+			true);
 }
 
 void print_he_capability(const uint8_t *ie, int len)
@@ -1263,7 +1266,7 @@ void print_he_capability(const uint8_t *ie, int len)
 	mcs_set = &ie[i];
 	mcs_len = len - i;
 
-	__print_he_capa(mac_cap, phy_cap - 1, mcs_set, mcs_len, NULL, 0);
+	__print_he_capa(mac_cap, phy_cap - 1, mcs_set, mcs_len, NULL, 0, false);
 }
 
 void iw_hexdump(const char *prefix, const __u8 *buf, size_t size)
-- 
2.29.2.299.gdc1121823c-goog


  parent reply	other threads:[~2020-11-18  3:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18  3:39 [PATCH 0/4] iw: add HE capabilities scan parsing Brian Norris
2020-11-18  3:39 ` [PATCH 1/4] iw: scan: add extension tag parsing Brian Norris
2020-11-18  3:39 ` [PATCH 2/4] iw: util: factor out HE capability parser Brian Norris
2020-11-18  3:39 ` [PATCH 3/4] iw: scan: parse HE capabilities Brian Norris
2020-11-18  3:39 ` Brian Norris [this message]
2020-11-19 15:06 ` [PATCH 0/4] iw: add HE capabilities scan parsing David Poole
2020-11-19 19:20   ` Brian Norris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201118033936.3667788-5-briannorris@chromium.org \
    --to=briannorris@chromium.org \
    --cc=dpoole@cradlepoint.com \
    --cc=greearb@candelatech.com \
    --cc=johannes@sipsolutions.net \
    --cc=john@phrozen.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.