* [PATCH] iw: Only print EHT info if fields are defined.
@ 2023-05-15 21:15 greearb
0 siblings, 0 replies; only message in thread
From: greearb @ 2023-05-15 21:15 UTC (permalink / raw)
To: linux-wireless; +Cc: Ben Greear
From: Ben Greear <greearb@candelatech.com>
Without this patch, a bunch of blank EHT fields are printed when
iw phy info is run against an /ax phy devices.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
util.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/util.c b/util.c
index 8a2ba10..31b0308 100644
--- a/util.c
+++ b/util.c
@@ -1588,6 +1588,7 @@ void print_eht_info(struct nlattr *nl_iftype, int band)
__u8 ppet[31] = { 0 };
__u16 he_phy_cap[6] = { 0 };
size_t len, mcs_len = 0, ppet_len = 0;
+ bool did_one = false;
nla_parse(tb, NL80211_BAND_IFTYPE_ATTR_MAX,
nla_data(nl_iftype), nla_len(nl_iftype), NULL);
@@ -1595,11 +1596,8 @@ void print_eht_info(struct nlattr *nl_iftype, int band)
if (!tb[NL80211_BAND_IFTYPE_ATTR_IFTYPES])
return;
- printf("\t\tEHT Iftypes: ");
- print_iftype_line(tb[NL80211_BAND_IFTYPE_ATTR_IFTYPES]);
- printf("\n");
-
if (tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MAC]) {
+ did_one = true;
len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MAC]);
if (len > sizeof(mac_cap))
len = sizeof(mac_cap);
@@ -1609,6 +1607,7 @@ void print_eht_info(struct nlattr *nl_iftype, int band)
}
if (tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PHY]) {
+ did_one = true;
len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PHY]);
if (len > sizeof(phy_cap))
@@ -1620,6 +1619,7 @@ void print_eht_info(struct nlattr *nl_iftype, int band)
}
if (tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MCS_SET]) {
+ did_one = true;
len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MCS_SET]);
if (len > sizeof(mcs_set))
len = sizeof(mcs_set);
@@ -1632,6 +1632,7 @@ void print_eht_info(struct nlattr *nl_iftype, int band)
}
if (tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PPE]) {
+ did_one = true;
len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PPE]);
if (len > sizeof(ppet))
len = sizeof(ppet);
@@ -1651,6 +1652,13 @@ void print_eht_info(struct nlattr *nl_iftype, int band)
len);
}
+ if (!did_one)
+ return;
+
+ printf("\t\tEHT Iftypes: ");
+ print_iftype_line(tb[NL80211_BAND_IFTYPE_ATTR_IFTYPES]);
+ printf("\n");
+
__print_eht_capa(band, mac_cap, phy_cap, mcs_set, mcs_len, ppet, ppet_len,
he_phy_cap, true);
}
--
2.40.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-15 21:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-15 21:15 [PATCH] iw: Only print EHT info if fields are defined greearb
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).