iw: scan: add EHT beacon info support
PATCH v4 1/1 iw: scan: add EHT beacon info support
Update and add to the old EHT beacon info implementation to print EHT PHY and MAC capabilities as well as MCS/NSS information for WiFi-7 beacons.
---
v4:
- Change s-o-b to use full name
v3:
- Clean up changes and drop he logic Johannes commented on v2:
- Fix subject
info.c | 2 +- iw.h | 3 +- scan.c | 18 +++++++--- util.c | 105 +++++++++++++++++++++++++++++++-------------------------- 4 files changed, 74 insertions(+), 54 deletions(-)
info.c +1 -1
@@ -391,7 +391,7 @@ static int print_phy_handler(struct nl_msg *msg, void *arg) tb_band[NL80211_BAND_ATTR_IFTYPE_DATA], rem_band) {print_he_info (nl_iftype); -print_eht_info (nl_iftype, last_band); +print_eht_info (nl_iftype); } }if (tb_band[NL80211_BAND_ATTR_FREQS ]) {
iw.h +2 -1
@@ -237,7 +237,8 @@ void print_ht_capability(__u16 cap);void print_vht_info (__u32 capa,const __u8 *mcs);void print_he_capability (const uint8_t *ie,int len);void print_he_info (struct nlattr *nl_iftype); -void print_eht_info (struct nlattr *nl_iftype,int band); +void print_eht_capability (const uint8_t *ie,int len); +void print_eht_info (struct nlattr *nl_iftype);void print_s1g_capability (const uint8_t *caps);char *channel_width_name (enum nl80211_chan_width width);
scan.c +13 -5
@@ -2384,12 +2384,21 @@ static void print_he_capa(const uint8_t type, uint8_t len, const uint8_t *data,print_he_capability (data, len); } +static void print_eht_capa (const uint8_t type,uint8_t len,const uint8_t *data, +const struct print_ies_data *ie_buffer) +{ +printf ("\n" ); +print_eht_capability (data, len); +} +static const struct ie_print ext_printers[] = { [35 ] = {"HE capabilities" , print_he_capa,21 ,54 ,BIT (PRINT_SCAN ), }, + [108 ] = {"EHT capabilties" , print_eht_capa,13 ,30 ,BIT (PRINT_SCAN ), }, };static void print_extension (unsigned char len,unsigned char *ie, -bool unknown,enum print_ie_type ptype) +bool unknown,enum print_ie_type ptype, +const struct print_ies_data *ie_buffer) {unsigned char tag;
@@ -2401,7 +2410,7 @@ static void print_extension(unsigned char len, unsigned char *ie, tag = ie[0 ];if (tag <ARRAY_SIZE (ext_printers) && ext_printers[tag].name && ext_printers[tag].flags &BIT (ptype)) { -print_ie (&ext_printers[tag], tag, len -1 , ie +1 ,NULL ); +print_ie (&ext_printers[tag], tag, len -1 , ie +1 , ie_buffer);return ; }
@@ -2435,7 +2444,7 @@ void print_ies(unsigned char *ie, int ielen, bool unknown, }else if (ie[0 ] ==221 /* vendor */ ) {print_vendor (ie[1 ], ie +2 , unknown, ptype); }else if (ie[0 ] ==255 /* extension */ ) { -print_extension (ie[1 ], ie +2 , unknown, ptype); +print_extension (ie[1 ], ie +2 , unknown, ptype, &ie_buffer); }else if (unknown) {int i;
@@ -2639,8 +2648,7 @@ static int print_bss_handler(struct nl_msg *msg, void *arg) nla_len(ies)))))printf ("\tInformation elements from Probe Response " "frame:\n" ); -print_ies (nla_data (ies),nla_len (ies), - params->unknown, params->type); +print_ies (nla_data (ies),nla_len (ies), params->unknown, params->type); }if (bss[NL80211_BSS_BEACON_IES ] && show--) {printf ("\tInformation elements from Beacon frame:\n" );
util.c +58 -47
168 lines not on this page · raw message
Signature · 1 line
2.45.2
Quoted 17 lines · Dylan Eskew
util.c +3
-13-if (!(he_phy_cap[0 ] & ((BIT (2 ) |BIT (3 ) |BIT (4 )) <<8 ))){ -for (i =0 ; i <4 ; i++) -printf ("%s\t\tEHT bw=20 MHz, max NSS for MCS %s: Rx=%u, Tx=%u\n" , - pre, mcs[i], - mcs_set[i] &0xf , mcs_set[i] >>4 ); - }else { -if (he_phy_cap[0 ] & (BIT (2 ) <<8 )) { -for (i =0 ; i <3 ; i++) -printf ("%s\t\tEHT bw <= 80 MHz, max NSS for MCS %s: Rx=%u, Tx=%u\n" , - pre, mcs[i +1 ], - mcs_set[i] &0xf , mcs_set[i] >>4 ); - } - mcs_set +=3 ; +for (i =0 ; i <3 ; i++) { +char *bw[] = {"<= 80" ,"160" ,"320" }; +char *mcs[] = {"0-9" ,"10-11" ,"12-13" };
util.c static void __print_eht_capa(int band, · line 1636
Quoted 10 lines
util.c +3
-6+int j; -if (he_phy_cap[0 ] & (BIT (3 ) <<8 )) { -for (i =0 ; i <3 ; i++) -printf ("%s\t\tEHT bw=160 MHz, max NSS for MCS %s: Rx=%u, Tx=%u\n" , - pre, mcs[i +1 ], - mcs_set[i] &0xf , mcs_set[i] >>4 ); - } +if ((i *3 +2 ) *sizeof (mcs_set[0 ]) >= mcs_len) +break ;
nit: a bunch of places here have weird indentation suddenly,
Quoted 8 lines
util.c +2
-6- mcs_set +=3 ; -if (band ==NL80211_BAND_6GHZ && (phy_cap[0 ] &BIT (1 ))) { -for (i =0 ; i <3 ; i++) -printf ("%s\t\tEHT bw=320 MHz, max NSS for MCS %s: Rx=%u, Tx=%u\n" , - pre, mcs[i +1 ], - mcs_set[i] &0xf , mcs_set[i] >>4 ); +printf ("%s\t\tEHT MCS and NSS set %s MHz\n" , pre, bw[i]); +for (j =0 ; j <6 ; j++) {
util.c static void __print_eht_capa(int band, · line 1649
Quoted 10 lines
util.c +10
-0+__u8 nss = mcs_set[(i *3 ) + j /2 ]; + nss >>= (j %2 ) *4 ; + nss &=0xF ; + +printf ("%s\t\t\t%s Max NSS that supports MCS %s: " , + pre, j %2 ?"TX" :"RX" , mcs[j /2 ]); +if (nss ==0 ) +printf ("not supported\n" ); +else +printf ("%d streams\n" , nss);
e.g. this especially - are you using 3 spaces for tabs and didn't see it or something?
I'm a bit more concerned though with the changes about the EHT MCS/NSS set. You don't have the HE stuff now, and you're not handling "20 MHz- only non-AP STA" here any more, which seems relevant for local capability printing?
johannes
Quoted 1 line · Johannes Berg
nit: a bunch of places here have weird indentation suddenly,
Apologies. I'll be more diligent moving forward about spacing.
Quoted 1 line
I'm a bit more concerned though with the changes about the EHT MCS/NSS set. You don't have the HE stuff now, and you're not handling "20 MHz- only non-AP STA" here any more, which seems relevant for local capability printing?
Your concerns are well placed. My initial iterations have been naive; I now have a better idea of what's required after looking back at documentation and having a better grasp of the standard generally. Your patience here has been and will continue to be appreciated.
Dylan