diff mbox series

[1/1] wifi: iw: Add support to display max number of simultaneous links in phy info

Message ID 20241105064809.2091332-1-quic_mrajraje@quicinc.com (mailing list archive)
State Changes Requested
Delegated to: Johannes Berg
Headers show
Series [1/1] wifi: iw: Add support to display max number of simultaneous links in phy info | expand

Commit Message

Mohan Raj Nov. 5, 2024, 6:48 a.m. UTC
To display the max number of simultaneous links in phy info	

    The maximum number of simultaneous links affiliated to an AP-MLD
    Present as a subfield in MLD capabilities and operations,the
    Capability is extracted through nl80211 specific attribute
    and added as part of phy information.

usage: iw <phy interface>

output:
Wiphy phy00
        wiphy index: 0
        max # scan SSIDs: 16
        max scan IEs length: 83 bytes
        max # sched scan SSIDs: 0
        max # match sets: 0
        Retry short limit: 7
        Retry long limit: 4
        Coverage class: 0 (up to 0m)
        Device supports AP-side u-APSD.
        Available Antennas: TX 0xf RX 0xf
        Configured Antennas: TX 0xf RX 0xf
        Supported interface modes:
                 * managed
                 * AP
                 * AP/VLAN
                 * monitor
                 * mesh point
        Band 1:
                Capabilities: 0x19ef
                        RX LDPC
                        HT20/HT40
                        SM Power Save disabled
                        RX HT20 SGI
                        RX HT40 SGI
                        TX STBC
                        RX STBC 1-stream
                        Max AMSDU length: 7935 bytes
                        DSSS/CCK HT40
				.
				.
				.
				.
				.
				.
				.
				.
				.
              * [ BSS_COLOR ]: BSS coloring support
                * [ RADAR_BACKGROUND ]: Radar background support
                * [ STA_MGMT_RTS_CTS ]: station management RTS CTS support
        MLD Capability: 0x44
                Max Number of Simultaneous Links: 4

        hw_idx 0 channel list:
                1 2 3 4 5 6 7 8 9 10 11 12 13 14
        hw_idx 1 channel list:
                36 40 44 48 52 56 60 64 100 104 108 112 116 120 124 128 
		132 136 140 144 149 153 157 161 165 169 173 177
        hw_idx 2 channel list:
                1 2 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73
                77 81 85 89 93 97 101 105 109 113 117 121 125 129 133 
		137 141 145 149 153 157 161 165 169 173 177 181 185 189
		193 197 201 205 209 213 217 221 225 229 233

Signed-off-by: Mohan Raj <quic_mrajraje@quicinc.com>
---
 info.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

Johannes Berg Nov. 7, 2024, 2:27 p.m. UTC | #1
First, iw patches don't need "wifi:" prefix :)


>         MLD Capability: 0x44
>                 Max Number of Simultaneous Links: 4

I think we should print the other MLD capabilities too?

>         hw_idx 0 channel list:
>                 1 2 3 4 5 6 7 8 9 10 11 12 13 14
>         hw_idx 1 channel list:
>                 36 40 44 48 52 56 60 64 100 104 108 112 116 120 124 128 
> 		132 136 140 144 149 153 157 161 165 169 173 177
>         hw_idx 2 channel list:
>                 1 2 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73
>                 77 81 85 89 93 97 101 105 109 113 117 121 125 129 133 
> 		137 141 145 149 153 157 161 165 169 173 177 181 185 189
> 		193 197 201 205 209 213 217 221 225 229 233

I don't believe this exists upstream, so not sure why you included it in
the example.

>  	if (tb_msg[NL80211_ATTR_MAX_AP_ASSOC_STA])
>  		printf("\tMaximum associated stations in AP mode: %u\n",
>  		       nla_get_u32(tb_msg[NL80211_ATTR_MAX_AP_ASSOC_STA]));
> +	if (tb_msg[NL80211_ATTR_IFTYPE_EXT_CAPA]) {

blank line before that would be nice

> +		int rem_ext = 0;
> +		struct nlattr *tb1[NL80211_ATTR_MAX + 1];
> +		struct nlattr *ext_attr;
> +		__u8 max_simul_links;
> +		__u16 mld_cap;
> +
> +		nla_for_each_nested(ext_attr, tb_msg[NL80211_ATTR_IFTYPE_EXT_CAPA], rem_ext) {
> +			nla_parse(tb1, NL80211_ATTR_MAX, nla_data(ext_attr),
> +				 nla_len(ext_attr), NULL);

there's some bad indentation here and later

> +	}
> +

And here you didn't need an extra blank line.

johannes
diff mbox series

Patch

diff --git a/info.c b/info.c
index c5e863f..0d19d99 100644
--- a/info.c
+++ b/info.c
@@ -884,6 +884,31 @@  broken_combination:
 	if (tb_msg[NL80211_ATTR_MAX_AP_ASSOC_STA])
 		printf("\tMaximum associated stations in AP mode: %u\n",
 		       nla_get_u32(tb_msg[NL80211_ATTR_MAX_AP_ASSOC_STA]));
+	if (tb_msg[NL80211_ATTR_IFTYPE_EXT_CAPA]) {
+		int rem_ext = 0;
+		struct nlattr *tb1[NL80211_ATTR_MAX + 1];
+		struct nlattr *ext_attr;
+		__u8 max_simul_links;
+		__u16 mld_cap;
+
+		nla_for_each_nested(ext_attr, tb_msg[NL80211_ATTR_IFTYPE_EXT_CAPA], rem_ext) {
+			nla_parse(tb1, NL80211_ATTR_MAX, nla_data(ext_attr),
+				 nla_len(ext_attr), NULL);
+			if (tb1[NL80211_ATTR_EML_CAPABILITY] &&
+			   tb1[NL80211_ATTR_MLD_CAPA_AND_OPS]) {
+				mld_cap = nla_get_u16(tb1[NL80211_ATTR_MLD_CAPA_AND_OPS]);
+
+				if (mld_cap != 0) {
+					printf("\tMLD Capability: 0x%x\n",
+					      nla_get_u16(tb1[NL80211_ATTR_MLD_CAPA_AND_OPS]));
+					max_simul_links = mld_cap & 0xf;
+					printf("\t\tMax Number of Simultaneous Links: %d\n",
+					      max_simul_links);
+				}
+			}
+		}
+	}
+
 
 	return NL_SKIP;
 }