brcmfmac: add debugfs entry for reading firmware capabilities
PATCH 1/1 brcmfmac: add debugfs entry for reading firmware capabilities
From: Rafał Miłecki <[email protected]>
This allows reading all capabilities as reported by a firmware. They are printed using native (raw) names, just like developers like it the most. It's how firmware reports support for various features, e.g. supported modes, supported standards, power saving details, max BSS-es.
Access to all that info is useful for trying new firmwares, comparing them and debugging features AKA bugs.
--- .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +36 -0
@@ -165,6 +165,41 @@ static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp) } } +/** +* brcmf_cap_read() - expose firmware capabilities to debugfs. +* +* @seq: sequence for debugfs entry. +* @data: raw data pointer. +*/ +static int brcmf_cap_read (struct seq_file *seq,void *data) +{ +struct brcmf_bus *bus_if =dev_get_drvdata (seq->private); +struct brcmf_if *ifp =brcmf_get_ifp (bus_if->drvr,0 ); +char caps[MAX_CAPS_BUFFER_SIZE +1 ] = { }; +char *tmp; +int err; + + err =brcmf_fil_iovar_data_get (ifp,"cap" , caps,sizeof (caps)); +if (err) { +brcmf_err ("could not get firmware cap (%d)\n" , err); +return err; + } + +/* Put every capability in a new line */ +for (tmp = caps; *tmp; tmp++) { +if (*tmp ==' ' ) + *tmp ='\n' ; + } + +/* Usually there is a space at the end of capabilities string */ +seq_printf (seq,"%s" , caps); +/* So make sure we don't print two line breaks */ +if (tmp > caps && *(tmp -1 ) !='\n' ) +seq_printf (seq,"\n" ); + +return 0 ; +} +void brcmf_feat_attach (struct brcmf_pub *drvr) {struct brcmf_if *ifp =brcmf_get_ifp (drvr,0 );
@@ -233,6 +268,7 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)void brcmf_feat_debugfs_create (struct brcmf_pub *drvr) {brcmf_debugfs_add_entry (drvr,"features" , brcmf_feat_debugfs_read); +brcmf_debugfs_add_entry (drvr,"cap" , brcmf_cap_read); }bool brcmf_feat_is_enabled (struct brcmf_if *ifp,enum brcmf_feat_id id)
Signature · 1 line
2.13.6
Quoted 9 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This allows reading all capabilities as reported by a firmware. They are printed using native (raw) names, just like developers like it the most. It's how firmware reports support for various features, e.g. supported modes, supported standards, power saving details, max BSS-es.
Access to all that info is useful for trying new firmwares, comparing them and debugging features AKA bugs.
What are you implying :-p ? Some comments below.
Quoted 10 lines
Signed-off-by Rafał Miłecki <[email protected]>--- .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+)drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +0
-0
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp) · line 169
Quoted 5 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +2
-0@@ -165,6 +165,41 @@ static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp) } } +/** +* brcmf_cap_read() - expose firmware capabilities to debugfs.
Please stick to naming convention brcmf_<module>_foo(), ie. brcmf_feat_cap_read().
Quoted 37 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +33
-0+* +* @seq: sequence for debugfs entry. +* @data: raw data pointer. +*/ +static int brcmf_cap_read (struct seq_file *seq,void *data) +{ +struct brcmf_bus *bus_if =dev_get_drvdata (seq->private); +struct brcmf_if *ifp =brcmf_get_ifp (bus_if->drvr,0 ); +char caps[MAX_CAPS_BUFFER_SIZE +1 ] = { }; +char *tmp; +int err; + + err =brcmf_fil_iovar_data_get (ifp,"cap" , caps,sizeof (caps)); +if (err) { +brcmf_err ("could not get firmware cap (%d)\n" , err); +return err; + } + +/* Put every capability in a new line */ +for (tmp = caps; *tmp; tmp++) { +if (*tmp ==' ' ) + *tmp ='\n' ; + } + +/* Usually there is a space at the end of capabilities string */ +seq_printf (seq,"%s" , caps); +/* So make sure we don't print two line breaks */ +if (tmp > caps && *(tmp -1 ) !='\n' ) +seq_printf (seq,"\n" ); + +return 0 ; +} +void brcmf_feat_attach (struct brcmf_pub *drvr) {struct brcmf_if *ifp =brcmf_get_ifp (drvr,0 );
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c void brcmf_feat_attach(struct brcmf_pub *drvr) · line 271
Quoted 4 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +1
-0@@ -233,6 +268,7 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)void brcmf_feat_debugfs_create (struct brcmf_pub *drvr) {brcmf_debugfs_add_entry (drvr,"features" , brcmf_feat_debugfs_read); +brcmf_debugfs_add_entry (drvr,"cap" , brcmf_cap_read);
Prefer to name the debugfs entry "fwcap".
Quoted 8 lines · Arend van Spriel
Quoted 7 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This allows reading all capabilities as reported by a firmware. They are printed using native (raw) names, just like developers like it the most. It's how firmware reports support for various features, e.g. supported modes, supported standards, power saving details, max BSS-es.
Quoted 4 lines
Quoted 2 lines
Access to all that info is useful for trying new firmwares, comparing them and debugging features AKA bugs.
What are you implying :-p ? Some comments below.
;) For real I was trying to figure out supported modes. It appears e.g. many/most firmwares support up to 8 MBSS ("mbss8") while brcmfmac allows up to 4 only.
Quoted 16 lines
Reviewed-by Arend van Spriel <[email protected]>Quoted 15 lines
Signed-off-by Rafał Miłecki <[email protected]>--- .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+)drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +0
-0@@ -165,6 +165,41 @@ static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp) } }
Quoted 5 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp) · line 169
Quoted 2 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +2
-0+/** +* brcmf_cap_read() - expose firmware capabilities to debugfs. Please stick to naming convention brcmf_<module>_foo(), ie.
brcmf_feat_cap_read().
Will do, thanks! I missed that naming convention because of brcmf_debugfs_fws_stats_read() / brcmf_debugfs_sdio_count_read() which slightly confused me. I see your point now!
Quoted 35 lines
Quoted 35 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +33
-0+* +* @seq: sequence for debugfs entry. +* @data: raw data pointer. +*/ +static int brcmf_cap_read (struct seq_file *seq,void *data) +{ +struct brcmf_bus *bus_if =dev_get_drvdata (seq->private); +struct brcmf_if *ifp =brcmf_get_ifp (bus_if->drvr,0 ); +char caps[MAX_CAPS_BUFFER_SIZE +1 ] = { }; +char *tmp; +int err; + + err =brcmf_fil_iovar_data_get (ifp,"cap" , caps,sizeof (caps)); +if (err) { +brcmf_err ("could not get firmware cap (%d)\n" , err); +return err; + } + +/* Put every capability in a new line */ +for (tmp = caps; *tmp; tmp++) { +if (*tmp ==' ' ) + *tmp ='\n' ; + } + +/* Usually there is a space at the end of capabilities string */ +seq_printf (seq,"%s" , caps); +/* So make sure we don't print two line breaks */ +if (tmp > caps && *(tmp -1 ) !='\n' ) +seq_printf (seq,"\n" ); + +return 0 ; +} +void brcmf_feat_attach (struct brcmf_pub *drvr) {
Quoted 8 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c void brcmf_feat_attach(struct brcmf_pub *drvr) · line 271
Quoted 6 lines
struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +1
-0@@ -233,6 +268,7 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)void brcmf_feat_debugfs_create (struct brcmf_pub *drvr) {brcmf_debugfs_add_entry (drvr,"features" , brcmf_feat_debugfs_read); +brcmf_debugfs_add_entry (drvr,"cap" , brcmf_cap_read);Prefer to name the debugfs entry "fwcap".
Sure.
Arend van Spriel
maintainerQuoted 9 lines · Rafał Miłecki
Quoted 5 lines
Quoted 2 lines
+/**
+ *brcmf_cap_read()- expose firmware capabilities to debugfs.Please stick to naming convention brcmf_<module>_foo(), ie.
brcmf_feat_cap_read().Will do, thanks! I missed that naming convention because of
brcmf_debugfs_fws_stats_read()/brcmf_debugfs_sdio_count_read()which slightly confused me. I see your point now!
Yeah. Sorry for the confusion. There is always room to improve.
Gr. AvS
PATCH v2 1/1 brcmfmac: add debugfs entry for reading firmware capabilities
In reply to Rafał MiłeckiFrom: Rafał Miłecki <[email protected]>
This allows reading all capabilities as reported by a firmware. They are printed using native (raw) names, just like developers like it the most. It's how firmware reports support for various features, e.g. supported modes, supported standards, power saving details, max BSS-es.
Access to all that info is useful for trying new firmwares, comparing them and debugging features AKA bugs.
---
V2: Use "fwcap" as debugfs entry
Rename function to the brcmf_feat_fwcap_debugfs_read()
--- .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +36 -0
@@ -165,6 +165,41 @@ static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp) } } +/** +* brcmf_feat_fwcap_debugfs_read() - expose firmware capabilities to debugfs. +* +* @seq: sequence for debugfs entry. +* @data: raw data pointer. +*/ +static int brcmf_feat_fwcap_debugfs_read (struct seq_file *seq,void *data) +{ +struct brcmf_bus *bus_if =dev_get_drvdata (seq->private); +struct brcmf_if *ifp =brcmf_get_ifp (bus_if->drvr,0 ); +char caps[MAX_CAPS_BUFFER_SIZE +1 ] = { }; +char *tmp; +int err; + + err =brcmf_fil_iovar_data_get (ifp,"cap" , caps,sizeof (caps)); +if (err) { +brcmf_err ("could not get firmware cap (%d)\n" , err); +return err; + } + +/* Put every capability in a new line */ +for (tmp = caps; *tmp; tmp++) { +if (*tmp ==' ' ) + *tmp ='\n' ; + } + +/* Usually there is a space at the end of capabilities string */ +seq_printf (seq,"%s" , caps); +/* So make sure we don't print two line breaks */ +if (tmp > caps && *(tmp -1 ) !='\n' ) +seq_printf (seq,"\n" ); + +return 0 ; +} +void brcmf_feat_attach (struct brcmf_pub *drvr) {struct brcmf_if *ifp =brcmf_get_ifp (drvr,0 );
@@ -233,6 +268,7 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)void brcmf_feat_debugfs_create (struct brcmf_pub *drvr) {brcmf_debugfs_add_entry (drvr,"features" , brcmf_feat_debugfs_read); +brcmf_debugfs_add_entry (drvr,"fwcap" , brcmf_feat_fwcap_debugfs_read); }bool brcmf_feat_is_enabled (struct brcmf_if *ifp,enum brcmf_feat_id id)
Signature · 1 line
2.13.6
Quoted 7 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This allows reading all capabilities as reported by a firmware. They are printed using native (raw) names, just like developers like it the most. It's how firmware reports support for various features, e.g. supported modes, supported standards, power saving details, max BSS-es.
Quoted 5 lines
Access to all that info is useful for trying new firmwares, comparing them and debugging features AKA bugs.
Signed-off-by Rafał Miłecki <[email protected]>Reviewed-by Arend van Spriel <[email protected]>
Patch applied to wireless-drivers-next.git, thanks.
88001968245c brcmfmac: add debugfs entry for reading firmware capabilities
Signature · 3 lines
https://patchwork.kernel.org/patch/10396811/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches