Search Linux Wireless

[PATCH 4/4] iw: scan: fixup HE caps whitespace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux