Skip to contentSkip to conversation

wifi: brcmfmac: few fixes and per-vendor event handling

PATCH In review Arend van Spriel 3 participants 8 messages Jan 6, 2024 – Jan 19, 2024

Subsystems (2)
lore
Share & tools
lore

Arend van Spriel

author maintainer
#0 lore raw

v2 cover wifi: brcmfmac: few fixes and per-vendor event handling

This series modifies a patch from Hector about unnecessary error messages and fixing an invalid list delete operation when loading vendor-specific module fails. Main reason for the series is to provide a way to deal with vendor differences in firmware event handling code.

This series applies to the main branch of the wireless-next repository and depends on the series "wifi: brcmfmac: per-vendor changes and SAE offload support" [1]

[1] https://patchwork.kernel.org/project/linux-wireless/list/?series=814040

Arend van Spriel (2):
wifi: brcmfmac: avoid invalid list operation when vendor attach fails
wifi: brcmfmac: allow per-vendor event handling

Hector Martin (1):
wifi: brcmfmac: Demote vendor-specific attach/detach messages to info

 .../broadcom/brcm80211/brcmfmac/bca/core.c    |  28 ++--
 .../broadcom/brcm80211/brcmfmac/common.c      |  18 +-
 .../broadcom/brcm80211/brcmfmac/core.c        |  10 +-
 .../broadcom/brcm80211/brcmfmac/core.h        |   2 +-
 .../broadcom/brcm80211/brcmfmac/cyw/core.c    |  28 ++--
 .../broadcom/brcm80211/brcmfmac/fweh.c        | 154 +++++++++++++-----
 .../broadcom/brcm80211/brcmfmac/fweh.h        |  60 +++++--
 .../broadcom/brcm80211/brcmfmac/fwvid.c       |  13 +-
 .../broadcom/brcm80211/brcmfmac/fwvid.h       |  35 ++--
 .../broadcom/brcm80211/brcmfmac/wcc/core.c    |  30 ++--
 10 files changed, 249 insertions(+), 129 deletions(-)

base-commit: 3aca362a4c1411ec11ff04f81b6cdf2359fee962
prerequisite-patch-id: 07d7f285f968a81572bc924e3530ebf95cb712d8
prerequisite-patch-id: 93c3909d52ce4af68f02283dee0d05566e2c4431
prerequisite-patch-id: 3e66331245f31c0ef6b29890be6c466ced5feaec
prerequisite-patch-id: eea6e0bc55f8908a9c17cfc6ca009b40122a4677

Signature · 1 line
2.32.0
author maintainer
#1 lore raw

PATCH v2 1/3 wifi: brcmfmac: Demote vendor-specific attach/detach messages to info

From: Hector Martin <[email protected]>

People are getting spooked by brcmfmac errors on their boot console. There's no reason for these messages to be errors.

Fixes d6a5c562214f ("wifi: brcmfmac: add support for vendor-specific firmware api")
[[email protected]: remove attach/detach vendor callbacks]
---
 .../broadcom/brcm80211/brcmfmac/bca/core.c    | 13 ----------
 .../broadcom/brcm80211/brcmfmac/cyw/core.c    | 13 ----------
 .../broadcom/brcm80211/brcmfmac/fwvid.c       |  7 +++--
 .../broadcom/brcm80211/brcmfmac/fwvid.h       | 26 ++-----------------
 .../broadcom/brcm80211/brcmfmac/wcc/core.c    | 15 +----------
 5 files changed, 6 insertions(+), 68 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/core.c +0 -13
index a5d9ac5e6763..a963c242975a 100644
@@ -11,17 +11,6 @@
 
 #include "vops.h"
 
-static int brcmf_bca_attach(struct brcmf_pub *drvr)
-{
-	pr_err("%s: executing\n", __func__);
-	return 0;
-}
-
-static void brcmf_bca_detach(struct brcmf_pub *drvr)
-{
-	pr_err("%s: executing\n", __func__);
-}
-
 static void brcmf_bca_feat_attach(struct brcmf_if *ifp)
 {
 	/* SAE support not confirmed so disabling for now */
@@ -29,7 +18,5 @@ static void brcmf_bca_feat_attach(struct brcmf_if *ifp)
 }
 
 const struct brcmf_fwvid_ops brcmf_bca_ops = {
-	.attach = brcmf_bca_attach,
-	.detach = brcmf_bca_detach,
 	.feat_attach = brcmf_bca_feat_attach,
 };
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c +0 -13
index 24670497f1a4..bec5748310b9 100644
@@ -11,17 +11,6 @@
 
 #include "vops.h"
 
-static int brcmf_cyw_attach(struct brcmf_pub *drvr)
-{
-	pr_err("%s: executing\n", __func__);
-	return 0;
-}
-
-static void brcmf_cyw_detach(struct brcmf_pub *drvr)
-{
-	pr_err("%s: executing\n", __func__);
-}
-
 static int brcmf_cyw_set_sae_pwd(struct brcmf_if *ifp,
 				 struct cfg80211_crypto_settings *crypto)
 {
@@ -49,7 +38,5 @@ static int brcmf_cyw_set_sae_pwd(struct brcmf_if *ifp,
 }
 
 const struct brcmf_fwvid_ops brcmf_cyw_ops = {
-	.attach = brcmf_cyw_attach,
-	.detach = brcmf_cyw_detach,
 	.set_sae_password = brcmf_cyw_set_sae_pwd,
 };
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c +3 -4
index 86eafdb40541..f633e2bbd891 100644
@@ -89,8 +89,7 @@ int brcmf_fwvid_register_vendor(enum brcmf_fwvendor fwvid, struct module *vmod,
 	if (fwvid >= BRCMF_FWVENDOR_NUM)
 		return -ERANGE;
 
-	if (WARN_ON(!vmod) || WARN_ON(!vops) ||
-	    WARN_ON(!vops->attach) || WARN_ON(!vops->detach))
+	if (WARN_ON(!vmod) || WARN_ON(!vops))
 		return -EINVAL;
 
 	if (WARN_ON(fwvid_list[fwvid].vmod))
@@ -150,7 +149,7 @@ static inline int brcmf_fwvid_request_module(enum brcmf_fwvendor fwvid)
 }
 #endif
 
-int brcmf_fwvid_attach_ops(struct brcmf_pub *drvr)
+int brcmf_fwvid_attach(struct brcmf_pub *drvr)
 {
 	enum brcmf_fwvendor fwvid = drvr->bus_if->fwvid;
 	int ret;
@@ -175,7 +174,7 @@ int brcmf_fwvid_attach_ops(struct brcmf_pub *drvr)
 	return ret;
 }
 
-void brcmf_fwvid_detach_ops(struct brcmf_pub *drvr)
+void brcmf_fwvid_detach(struct brcmf_pub *drvr)
 {
 	enum brcmf_fwvendor fwvid = drvr->bus_if->fwvid;
 
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.h +2 -24
index d9fc76b46db9..dac22534d033 100644
@@ -12,8 +12,6 @@ struct brcmf_pub;
 struct brcmf_if;
 
 struct brcmf_fwvid_ops {
-	int (*attach)(struct brcmf_pub *drvr);
-	void (*detach)(struct brcmf_pub *drvr);
 	void (*feat_attach)(struct brcmf_if *ifp);
 	int (*set_sae_password)(struct brcmf_if *ifp, struct cfg80211_crypto_settings *crypto);
 };
@@ -24,30 +22,10 @@ int brcmf_fwvid_register_vendor(enum brcmf_fwvendor fwvid, struct module *mod,
 int brcmf_fwvid_unregister_vendor(enum brcmf_fwvendor fwvid, struct module *mod);
 
 /* core driver functions */
-int brcmf_fwvid_attach_ops(struct brcmf_pub *drvr);
-void brcmf_fwvid_detach_ops(struct brcmf_pub *drvr);
+int brcmf_fwvid_attach(struct brcmf_pub *drvr);
+void brcmf_fwvid_detach(struct brcmf_pub *drvr);
 const char *brcmf_fwvid_vendor_name(struct brcmf_pub *drvr);
 
-static inline int brcmf_fwvid_attach(struct brcmf_pub *drvr)
-{
-	int ret;
-
-	ret = brcmf_fwvid_attach_ops(drvr);
-	if (ret)
-		return ret;
-
-	return drvr->vops->attach(drvr);
-}
-
-static inline void brcmf_fwvid_detach(struct brcmf_pub *drvr)
-{
-	if (!drvr->vops)
-		return;
-
-	drvr->vops->detach(drvr);
-	brcmf_fwvid_detach_ops(drvr);
-}
-
 static inline void brcmf_fwvid_feat_attach(struct brcmf_if *ifp)
 {
 	const struct brcmf_fwvid_ops *vops = ifp->drvr->vops;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/core.c +1 -14
index 2d8f80bd7382..fd593b93ad40 100644
@@ -7,21 +7,10 @@
 #include <core.h>
 #include <bus.h>
 #include <fwvid.h>
-#include <fwil.h>
+#include <cfg80211.h>
 
 #include "vops.h"
 
-static int brcmf_wcc_attach(struct brcmf_pub *drvr)
-{
-	pr_debug("%s: executing\n", __func__);
-	return 0;
-}
-
-static void brcmf_wcc_detach(struct brcmf_pub *drvr)
-{
-	pr_debug("%s: executing\n", __func__);
-}
-
 static int brcmf_wcc_set_sae_pwd(struct brcmf_if *ifp,
 				 struct cfg80211_crypto_settings *crypto)
 {
@@ -30,7 +19,5 @@ static int brcmf_wcc_set_sae_pwd(struct brcmf_if *ifp,
 }
 
 const struct brcmf_fwvid_ops brcmf_wcc_ops = {
-	.attach = brcmf_wcc_attach,
-	.detach = brcmf_wcc_detach,
 	.set_sae_password = brcmf_wcc_set_sae_pwd,
 };
Signature · 1 line
2.32.0
maintainer
#2 lore raw

Re: [PATCH V2 1/3] wifi: brcmfmac: Demote vendor-specific attach/detach messages to info

Quoted 194 lines · Arend van Spriel

From: Hector Martin <[email protected]>

People are getting spooked by brcmfmac errors on their boot console. There's no reason for these messages to be errors.

Fixes d6a5c562214f ("wifi: brcmfmac: add support for vendor-specific firmware api")
[[email protected]: remove attach/detach vendor callbacks]
---
 .../broadcom/brcm80211/brcmfmac/bca/core.c    | 13 ----------
 .../broadcom/brcm80211/brcmfmac/cyw/core.c    | 13 ----------
 .../broadcom/brcm80211/brcmfmac/fwvid.c       |  7 +++--
 .../broadcom/brcm80211/brcmfmac/fwvid.h       | 26 ++-----------------
 .../broadcom/brcm80211/brcmfmac/wcc/core.c    | 15 +----------
 5 files changed, 6 insertions(+), 68 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/core.c +0 -13
index a5d9ac5e6763..a963c242975a 100644
@@ -11,17 +11,6 @@
 
 #include "vops.h"
 
-static int brcmf_bca_attach(struct brcmf_pub *drvr)
-{
-	pr_err("%s: executing\n", __func__);
-	return 0;
-}
-
-static void brcmf_bca_detach(struct brcmf_pub *drvr)
-{
-	pr_err("%s: executing\n", __func__);
-}
-
 static void brcmf_bca_feat_attach(struct brcmf_if *ifp)
 {
 	/* SAE support not confirmed so disabling for now */
@@ -29,7 +18,5 @@ static void brcmf_bca_feat_attach(struct brcmf_if *ifp)
 }
 
 const struct brcmf_fwvid_ops brcmf_bca_ops = {
-	.attach = brcmf_bca_attach,
-	.detach = brcmf_bca_detach,
 	.feat_attach = brcmf_bca_feat_attach,
 };
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c +0 -13
index 24670497f1a4..bec5748310b9 100644
@@ -11,17 +11,6 @@
 
 #include "vops.h"
 
-static int brcmf_cyw_attach(struct brcmf_pub *drvr)
-{
-	pr_err("%s: executing\n", __func__);
-	return 0;
-}
-
-static void brcmf_cyw_detach(struct brcmf_pub *drvr)
-{
-	pr_err("%s: executing\n", __func__);
-}
-
 static int brcmf_cyw_set_sae_pwd(struct brcmf_if *ifp,
 				 struct cfg80211_crypto_settings *crypto)
 {
@@ -49,7 +38,5 @@ static int brcmf_cyw_set_sae_pwd(struct brcmf_if *ifp,
 }
 
 const struct brcmf_fwvid_ops brcmf_cyw_ops = {
-	.attach = brcmf_cyw_attach,
-	.detach = brcmf_cyw_detach,
 	.set_sae_password = brcmf_cyw_set_sae_pwd,
 };
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c +3 -4
index 86eafdb40541..f633e2bbd891 100644
@@ -89,8 +89,7 @@ int brcmf_fwvid_register_vendor(enum brcmf_fwvendor fwvid, struct module *vmod,
 	if (fwvid >= BRCMF_FWVENDOR_NUM)
 		return -ERANGE;
 
-	if (WARN_ON(!vmod) || WARN_ON(!vops) ||
-	    WARN_ON(!vops->attach) || WARN_ON(!vops->detach))
+	if (WARN_ON(!vmod) || WARN_ON(!vops))
 		return -EINVAL;
 
 	if (WARN_ON(fwvid_list[fwvid].vmod))
@@ -150,7 +149,7 @@ static inline int brcmf_fwvid_request_module(enum brcmf_fwvendor fwvid)
 }
 #endif
 
-int brcmf_fwvid_attach_ops(struct brcmf_pub *drvr)
+int brcmf_fwvid_attach(struct brcmf_pub *drvr)
 {
 	enum brcmf_fwvendor fwvid = drvr->bus_if->fwvid;
 	int ret;
@@ -175,7 +174,7 @@ int brcmf_fwvid_attach_ops(struct brcmf_pub *drvr)
 	return ret;
 }
 
-void brcmf_fwvid_detach_ops(struct brcmf_pub *drvr)
+void brcmf_fwvid_detach(struct brcmf_pub *drvr)
 {
 	enum brcmf_fwvendor fwvid = drvr->bus_if->fwvid;
 
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.h +2 -24
index d9fc76b46db9..dac22534d033 100644
@@ -12,8 +12,6 @@ struct brcmf_pub;
 struct brcmf_if;
 
 struct brcmf_fwvid_ops {
-	int (*attach)(struct brcmf_pub *drvr);
-	void (*detach)(struct brcmf_pub *drvr);
 	void (*feat_attach)(struct brcmf_if *ifp);
 	int (*set_sae_password)(struct brcmf_if *ifp, struct cfg80211_crypto_settings *crypto);
 };
@@ -24,30 +22,10 @@ int brcmf_fwvid_register_vendor(enum brcmf_fwvendor fwvid, struct module *mod,
 int brcmf_fwvid_unregister_vendor(enum brcmf_fwvendor fwvid, struct module *mod);
 
 /* core driver functions */
-int brcmf_fwvid_attach_ops(struct brcmf_pub *drvr);
-void brcmf_fwvid_detach_ops(struct brcmf_pub *drvr);
+int brcmf_fwvid_attach(struct brcmf_pub *drvr);
+void brcmf_fwvid_detach(struct brcmf_pub *drvr);
 const char *brcmf_fwvid_vendor_name(struct brcmf_pub *drvr);
 
-static inline int brcmf_fwvid_attach(struct brcmf_pub *drvr)
-{
-	int ret;
-
-	ret = brcmf_fwvid_attach_ops(drvr);
-	if (ret)
-		return ret;
-
-	return drvr->vops->attach(drvr);
-}
-
-static inline void brcmf_fwvid_detach(struct brcmf_pub *drvr)
-{
-	if (!drvr->vops)
-		return;
-
-	drvr->vops->detach(drvr);
-	brcmf_fwvid_detach_ops(drvr);
-}
-
 static inline void brcmf_fwvid_feat_attach(struct brcmf_if *ifp)
 {
 	const struct brcmf_fwvid_ops *vops = ifp->drvr->vops;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/core.c +1 -14
index 2d8f80bd7382..fd593b93ad40 100644
@@ -7,21 +7,10 @@
 #include <core.h>
 #include <bus.h>
 #include <fwvid.h>
-#include <fwil.h>
+#include <cfg80211.h>
 
 #include "vops.h"
 
-static int brcmf_wcc_attach(struct brcmf_pub *drvr)
-{
-	pr_debug("%s: executing\n", __func__);
-	return 0;
-}
-
-static void brcmf_wcc_detach(struct brcmf_pub *drvr)
-{
-	pr_debug("%s: executing\n", __func__);
-}
-
 static int brcmf_wcc_set_sae_pwd(struct brcmf_if *ifp,
 				 struct cfg80211_crypto_settings *crypto)
 {
@@ -30,7 +19,5 @@ static int brcmf_wcc_set_sae_pwd(struct brcmf_if *ifp,
 }
 
 const struct brcmf_fwvid_ops brcmf_wcc_ops = {
-	.attach = brcmf_wcc_attach,
-	.detach = brcmf_wcc_detach,
 	.set_sae_password = brcmf_wcc_set_sae_pwd,
 };
Signature · 1 line
2.32.0

<formletter>

This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

maintainer
#3 lore raw

Re: [PATCH V2 1/3] wifi: brcmfmac: Demote vendor-specific attach/detach messages to info

Quoted 199 lines · Greg KH
Quoted 194 lines · Arend van Spriel

From: Hector Martin <[email protected]>

People are getting spooked by brcmfmac errors on their boot console. There's no reason for these messages to be errors.

Fixes d6a5c562214f ("wifi: brcmfmac: add support for vendor-specific firmware api")
[[email protected]: remove attach/detach vendor callbacks]
---
 .../broadcom/brcm80211/brcmfmac/bca/core.c    | 13 ----------
 .../broadcom/brcm80211/brcmfmac/cyw/core.c    | 13 ----------
 .../broadcom/brcm80211/brcmfmac/fwvid.c       |  7 +++--
 .../broadcom/brcm80211/brcmfmac/fwvid.h       | 26 ++-----------------
 .../broadcom/brcm80211/brcmfmac/wcc/core.c    | 15 +----------
 5 files changed, 6 insertions(+), 68 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/core.c +0 -13
index a5d9ac5e6763..a963c242975a 100644
@@ -11,17 +11,6 @@
 
 #include "vops.h"
 
-static int brcmf_bca_attach(struct brcmf_pub *drvr)
-{
-	pr_err("%s: executing\n", __func__);
-	return 0;
-}
-
-static void brcmf_bca_detach(struct brcmf_pub *drvr)
-{
-	pr_err("%s: executing\n", __func__);
-}
-
 static void brcmf_bca_feat_attach(struct brcmf_if *ifp)
 {
 	/* SAE support not confirmed so disabling for now */
@@ -29,7 +18,5 @@ static void brcmf_bca_feat_attach(struct brcmf_if *ifp)
 }
 
 const struct brcmf_fwvid_ops brcmf_bca_ops = {
-	.attach = brcmf_bca_attach,
-	.detach = brcmf_bca_detach,
 	.feat_attach = brcmf_bca_feat_attach,
 };
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c +0 -13
index 24670497f1a4..bec5748310b9 100644
@@ -11,17 +11,6 @@
 
 #include "vops.h"
 
-static int brcmf_cyw_attach(struct brcmf_pub *drvr)
-{
-	pr_err("%s: executing\n", __func__);
-	return 0;
-}
-
-static void brcmf_cyw_detach(struct brcmf_pub *drvr)
-{
-	pr_err("%s: executing\n", __func__);
-}
-
 static int brcmf_cyw_set_sae_pwd(struct brcmf_if *ifp,
 				 struct cfg80211_crypto_settings *crypto)
 {
@@ -49,7 +38,5 @@ static int brcmf_cyw_set_sae_pwd(struct brcmf_if *ifp,
 }
 
 const struct brcmf_fwvid_ops brcmf_cyw_ops = {
-	.attach = brcmf_cyw_attach,
-	.detach = brcmf_cyw_detach,
 	.set_sae_password = brcmf_cyw_set_sae_pwd,
 };
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c +3 -4
index 86eafdb40541..f633e2bbd891 100644
@@ -89,8 +89,7 @@ int brcmf_fwvid_register_vendor(enum brcmf_fwvendor fwvid, struct module *vmod,
 	if (fwvid >= BRCMF_FWVENDOR_NUM)
 		return -ERANGE;
 
-	if (WARN_ON(!vmod) || WARN_ON(!vops) ||
-	    WARN_ON(!vops->attach) || WARN_ON(!vops->detach))
+	if (WARN_ON(!vmod) || WARN_ON(!vops))
 		return -EINVAL;
 
 	if (WARN_ON(fwvid_list[fwvid].vmod))
@@ -150,7 +149,7 @@ static inline int brcmf_fwvid_request_module(enum brcmf_fwvendor fwvid)
 }
 #endif
 
-int brcmf_fwvid_attach_ops(struct brcmf_pub *drvr)
+int brcmf_fwvid_attach(struct brcmf_pub *drvr)
 {
 	enum brcmf_fwvendor fwvid = drvr->bus_if->fwvid;
 	int ret;
@@ -175,7 +174,7 @@ int brcmf_fwvid_attach_ops(struct brcmf_pub *drvr)
 	return ret;
 }
 
-void brcmf_fwvid_detach_ops(struct brcmf_pub *drvr)
+void brcmf_fwvid_detach(struct brcmf_pub *drvr)
 {
 	enum brcmf_fwvendor fwvid = drvr->bus_if->fwvid;
 
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.h +2 -24
index d9fc76b46db9..dac22534d033 100644
@@ -12,8 +12,6 @@ struct brcmf_pub;
 struct brcmf_if;
 
 struct brcmf_fwvid_ops {
-	int (*attach)(struct brcmf_pub *drvr);
-	void (*detach)(struct brcmf_pub *drvr);
 	void (*feat_attach)(struct brcmf_if *ifp);
 	int (*set_sae_password)(struct brcmf_if *ifp, struct cfg80211_crypto_settings *crypto);
 };
@@ -24,30 +22,10 @@ int brcmf_fwvid_register_vendor(enum brcmf_fwvendor fwvid, struct module *mod,
 int brcmf_fwvid_unregister_vendor(enum brcmf_fwvendor fwvid, struct module *mod);
 
 /* core driver functions */
-int brcmf_fwvid_attach_ops(struct brcmf_pub *drvr);
-void brcmf_fwvid_detach_ops(struct brcmf_pub *drvr);
+int brcmf_fwvid_attach(struct brcmf_pub *drvr);
+void brcmf_fwvid_detach(struct brcmf_pub *drvr);
 const char *brcmf_fwvid_vendor_name(struct brcmf_pub *drvr);
 
-static inline int brcmf_fwvid_attach(struct brcmf_pub *drvr)
-{
-	int ret;
-
-	ret = brcmf_fwvid_attach_ops(drvr);
-	if (ret)
-		return ret;
-
-	return drvr->vops->attach(drvr);
-}
-
-static inline void brcmf_fwvid_detach(struct brcmf_pub *drvr)
-{
-	if (!drvr->vops)
-		return;
-
-	drvr->vops->detach(drvr);
-	brcmf_fwvid_detach_ops(drvr);
-}
-
 static inline void brcmf_fwvid_feat_attach(struct brcmf_if *ifp)
 {
 	const struct brcmf_fwvid_ops *vops = ifp->drvr->vops;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/core.c +1 -14
index 2d8f80bd7382..fd593b93ad40 100644
@@ -7,21 +7,10 @@
 #include <core.h>
 #include <bus.h>
 #include <fwvid.h>
-#include <fwil.h>
+#include <cfg80211.h>
 
 #include "vops.h"
 
-static int brcmf_wcc_attach(struct brcmf_pub *drvr)
-{
-	pr_debug("%s: executing\n", __func__);
-	return 0;
-}
-
-static void brcmf_wcc_detach(struct brcmf_pub *drvr)
-{
-	pr_debug("%s: executing\n", __func__);
-}
-
 static int brcmf_wcc_set_sae_pwd(struct brcmf_if *ifp,
 				 struct cfg80211_crypto_settings *crypto)
 {
@@ -30,7 +19,5 @@ static int brcmf_wcc_set_sae_pwd(struct brcmf_if *ifp,
 }
 
 const struct brcmf_fwvid_ops brcmf_wcc_ops = {
-	.attach = brcmf_wcc_attach,
-	.detach = brcmf_wcc_detach,
 	.set_sae_password = brcmf_wcc_set_sae_pwd,
 };
Signature · 1 line
2.32.0

<formletter>

Quoted 6 lines

This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

Sorry, bot is wrong here, this is fine.

author maintainer
#4 lore raw

Re: [PATCH V2 1/3] wifi: brcmfmac: Demote vendor-specific attach/detach messages to info

Quoted 8 lines · Greg KH
Quoted 7 lines · Greg KH
Quoted 6 lines · Arend van Spriel

From: Hector Martin <[email protected]>

People are getting spooked by brcmfmac errors on their boot console. There's no reason for these messages to be errors.

Hi Greg

So I assume the bot stumbled over the appended comment here. Is it still helpful or is it redundant with the Fixes: tag in place.

Regards,
Arend

Quoted 202 lines
Quoted 194 lines
Quoted 189 lines
Fixes d6a5c562214f ("wifi: brcmfmac: add support for vendor-specific firmware api")
[[email protected]: remove attach/detach vendor callbacks]

---

.../broadcom/brcm80211/brcmfmac/bca/core.c    | 13 ----------
.../broadcom/brcm80211/brcmfmac/cyw/core.c    | 13 ----------
.../broadcom/brcm80211/brcmfmac/fwvid.c       |  7 +++--
.../broadcom/brcm80211/brcmfmac/fwvid.h       | 26 ++-----------------
.../broadcom/brcm80211/brcmfmac/wcc/core.c    | 15 +----------
5 files changed, 6 insertions(+), 68 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/core.c +0 -13
index a5d9ac5e6763..a963c242975a 100644
@@ -11,17 +11,6 @@
 
 #include "vops.h"
 
-static int brcmf_bca_attach(struct brcmf_pub *drvr)
-{
- pr_err("%s: executing\n", __func__);
- return 0;
-}
-
-static void brcmf_bca_detach(struct brcmf_pub *drvr)
-{
- pr_err("%s: executing\n", __func__);
-}
-
 static void brcmf_bca_feat_attach(struct brcmf_if *ifp)
 {
 /* SAE support not confirmed so disabling for now */
@@ -29,7 +18,5 @@ static void brcmf_bca_feat_attach(struct brcmf_if *ifp)
 }
 
 const struct brcmf_fwvid_ops brcmf_bca_ops = {
- .attach = brcmf_bca_attach,
- .detach = brcmf_bca_detach,
 .feat_attach = brcmf_bca_feat_attach,
 };
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c +0 -13
index 24670497f1a4..bec5748310b9 100644
@@ -11,17 +11,6 @@
 
 #include "vops.h"
 
-static int brcmf_cyw_attach(struct brcmf_pub *drvr)
-{
- pr_err("%s: executing\n", __func__);
- return 0;
-}
-
-static void brcmf_cyw_detach(struct brcmf_pub *drvr)
-{
- pr_err("%s: executing\n", __func__);
-}
-
 static int brcmf_cyw_set_sae_pwd(struct brcmf_if *ifp,
 struct cfg80211_crypto_settings *crypto)
 {
@@ -49,7 +38,5 @@ static int brcmf_cyw_set_sae_pwd(struct brcmf_if *ifp,
 }
 
 const struct brcmf_fwvid_ops brcmf_cyw_ops = {
- .attach = brcmf_cyw_attach,
- .detach = brcmf_cyw_detach,
 .set_sae_password = brcmf_cyw_set_sae_pwd,
 };
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c +1 -2
index 86eafdb40541..f633e2bbd891 100644
@@ -89,8 +89,7 @@ int brcmf_fwvid_register_vendor(enum brcmf_fwvendor 
 fwvid, struct module *vmod,
 if (fwvid >= BRCMF_FWVENDOR_NUM)
 return -ERANGE;
 
- if (WARN_ON(!vmod) || WARN_ON(!vops) ||
-    WARN_ON(!vops->attach) || WARN_ON(!vops->detach))
+ if (WARN_ON(!vmod) || WARN_ON(!vops))
 return -EINVAL;
 

if (WARN_ON(fwvid_list[fwvid].vmod))

drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c +1 -1
@@ -150,7 +149,7 @@ static inline int brcmf_fwvid_request_module(enum 
 brcmf_fwvendor fwvid)
 }
 #endif
 
-int brcmf_fwvid_attach_ops(struct brcmf_pub *drvr)
+int brcmf_fwvid_attach(struct brcmf_pub *drvr)
 {
 enum brcmf_fwvendor fwvid = drvr->bus_if->fwvid;

int ret;

drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c +1 -1
@@ -175,7 +174,7 @@ int brcmf_fwvid_attach_ops(struct brcmf_pub *drvr)
 return ret;
 }
 
-void brcmf_fwvid_detach_ops(struct brcmf_pub *drvr)
+void brcmf_fwvid_detach(struct brcmf_pub *drvr)
 {
 enum brcmf_fwvendor fwvid = drvr->bus_if->fwvid;
 
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.h +2 -24
index d9fc76b46db9..dac22534d033 100644
@@ -12,8 +12,6 @@ struct brcmf_pub;
 struct brcmf_if;
 
 struct brcmf_fwvid_ops {
- int (*attach)(struct brcmf_pub *drvr);
- void (*detach)(struct brcmf_pub *drvr);
 void (*feat_attach)(struct brcmf_if *ifp);
 int (*set_sae_password)(struct brcmf_if *ifp, struct cfg80211_crypto_settings *crypto);
 };
@@ -24,30 +22,10 @@ int brcmf_fwvid_register_vendor(enum brcmf_fwvendor 
 fwvid, struct module *mod,
 int brcmf_fwvid_unregister_vendor(enum brcmf_fwvendor fwvid, struct module *mod);
 
 /* core driver functions */
-int brcmf_fwvid_attach_ops(struct brcmf_pub *drvr);
-void brcmf_fwvid_detach_ops(struct brcmf_pub *drvr);
+int brcmf_fwvid_attach(struct brcmf_pub *drvr);
+void brcmf_fwvid_detach(struct brcmf_pub *drvr);
 const char *brcmf_fwvid_vendor_name(struct brcmf_pub *drvr);
 
-static inline int brcmf_fwvid_attach(struct brcmf_pub *drvr)
-{
- int ret;
-
- ret = brcmf_fwvid_attach_ops(drvr);
- if (ret)
- return ret;
-
- return drvr->vops->attach(drvr);
-}
-
-static inline void brcmf_fwvid_detach(struct brcmf_pub *drvr)
-{
- if (!drvr->vops)
- return;
-
- drvr->vops->detach(drvr);
- brcmf_fwvid_detach_ops(drvr);
-}
-
 static inline void brcmf_fwvid_feat_attach(struct brcmf_if *ifp)
 {

const struct brcmf_fwvid_ops *vops = ifp->drvr->vops;

drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/core.c +1 -15
index 2d8f80bd7382..fd593b93ad40 100644
@@ -7,21 +7,10 @@
 #include <core.h>
 #include <bus.h>
 #include <fwvid.h>
-#include <fwil.h>
+#include <cfg80211.h>
 
 #include "vops.h"
 
-static int brcmf_wcc_attach(struct brcmf_pub *drvr)
-{
- pr_debug("%s: executing\n", __func__);
- return 0;
-}
-
-static void brcmf_wcc_detach(struct brcmf_pub *drvr)
-{
- pr_debug("%s: executing\n", __func__);
-}
-
 static int brcmf_wcc_set_sae_pwd(struct brcmf_if *ifp,
 struct cfg80211_crypto_settings *crypto)
 {
@@ -30,7 +19,5 @@ static int brcmf_wcc_set_sae_pwd(struct brcmf_if *ifp,
 }
 
 const struct brcmf_fwvid_ops brcmf_wcc_ops = {
- .attach = brcmf_wcc_attach,
- .detach = brcmf_wcc_detach,
 .set_sae_password = brcmf_wcc_set_sae_pwd,
 };
--
Quoted 1 line

2.32.0

<formletter>

Quoted 6 lines

This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

Sorry, bot is wrong here, this is fine.

#5 lore raw

Re: [PATCH V2 1/3] wifi: brcmfmac: Demote vendor-specific attach/detach messages to info

In reply to Arend van Spriel
Quoted 10 lines · Arend van Spriel

From: Hector Martin <[email protected]>

People are getting spooked by brcmfmac errors on their boot console. There's no reason for these messages to be errors.

Fixes d6a5c562214f ("wifi: brcmfmac: add support for vendor-specific firmware api")
[[email protected]: remove attach/detach vendor callbacks]

3 patches applied to wireless-next.git, thanks.

85da8f71aaa7 wifi: brcmfmac: Demote vendor-specific attach/detach messages to info b822015a1f57 wifi: brcmfmac: avoid invalid list operation when vendor attach fails edec42821911 wifi: brcmfmac: allow per-vendor event handling

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
author maintainer
#6 lore raw

PATCH v2 2/3 wifi: brcmfmac: avoid invalid list operation when vendor attach fails

In reply to Arend van Spriel

When the brcmf_fwvid_attach() fails the driver instance is not added to the vendor list. Hence we should not try to delete it from that list when the brcmf_fwvid_detach() function is called in cleanup path.

Fixes d6a5c562214f ("wifi: brcmfmac: add support for vendor-specific firmware api")
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c +4 -3
index f633e2bbd891..b427782554b5 100644
@@ -186,9 +186,10 @@ void brcmf_fwvid_detach(struct brcmf_pub *drvr)
 
 	mutex_lock(&fwvid_list_lock);
 
-	drvr->vops = NULL;
-	list_del(&drvr->bus_if->list);
-
+	if (drvr->vops) {
+		drvr->vops = NULL;
+		list_del(&drvr->bus_if->list);
+	}
 	mutex_unlock(&fwvid_list_lock);
 }
 
Signature · 1 line
2.32.0
author maintainer
#7 lore raw

PATCH v2 3/3 wifi: brcmfmac: allow per-vendor event handling

In reply to Arend van Spriel

The firmware interface also defines events generated by firmware on the device. As the get/set primitives the events are likely to diverge between the vendors so this commit adds support for per-vendor handling. The number of events may differ so we let the vendor-specific code allocate the struct brcmf_fweh_info which contains array of event handlers. The existing event enumeration will be used by the higher layers and thus are common definitions. The vendor-specific code can provide a mapping table for converting the common definition to the vendor-specific firmware event definition and vice-versa.

---
changelog:
V2: remove testing hack in debug.c

---
 .../broadcom/brcm80211/brcmfmac/bca/core.c    |  17 ++
 .../broadcom/brcm80211/brcmfmac/common.c      |  18 +-
 .../broadcom/brcm80211/brcmfmac/core.c        |  10 +-
 .../broadcom/brcm80211/brcmfmac/core.h        |   2 +-
 .../broadcom/brcm80211/brcmfmac/cyw/core.c    |  17 ++
 .../broadcom/brcm80211/brcmfmac/fweh.c        | 154 +++++++++++++-----
 .../broadcom/brcm80211/brcmfmac/fweh.h        |  60 +++++--
 .../broadcom/brcm80211/brcmfmac/fwvid.c       |   3 +-
 .../broadcom/brcm80211/brcmfmac/fwvid.h       |   9 +
 .../broadcom/brcm80211/brcmfmac/wcc/core.c    |  17 ++
 10 files changed, 244 insertions(+), 63 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/core.c +17 -0
index a963c242975a..f471c962104a 100644
@@ -11,12 +11,29 @@
 
 #include "vops.h"
 
+#define BRCMF_BCA_E_LAST		212
+
 static void brcmf_bca_feat_attach(struct brcmf_if *ifp)
 {
 	/* SAE support not confirmed so disabling for now */
 	ifp->drvr->feat_flags &= ~BIT(BRCMF_FEAT_SAE);
 }
 
+static int brcmf_bca_alloc_fweh_info(struct brcmf_pub *drvr)
+{
+	struct brcmf_fweh_info *fweh;
+
+	fweh = kzalloc(struct_size(fweh, evt_handler, BRCMF_BCA_E_LAST),
+		       GFP_KERNEL);
+	if (!fweh)
+		return -ENOMEM;
+
+	fweh->num_event_codes = BRCMF_BCA_E_LAST;
+	drvr->fweh = fweh;
+	return 0;
+}
+
 const struct brcmf_fwvid_ops brcmf_bca_ops = {
 	.feat_attach = brcmf_bca_feat_attach,
+	.alloc_fweh_info = brcmf_bca_alloc_fweh_info,
 };
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +12 -6
index b6d458e022fa..b24faae35873 100644
@@ -266,7 +266,7 @@ static int brcmf_c_process_cal_blob(struct brcmf_if *ifp)
 int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
 {
 	struct brcmf_pub *drvr = ifp->drvr;
-	s8 eventmask[BRCMF_EVENTING_MASK_LEN];
+	struct brcmf_fweh_info *fweh = drvr->fweh;
 	u8 buf[BRCMF_DCMD_SMLEN];
 	struct brcmf_bus *bus;
 	struct brcmf_rev_info_le revinfo;
@@ -413,15 +413,21 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
 	brcmf_c_set_joinpref_default(ifp);
 
 	/* Setup event_msgs, enable E_IF */
-	err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask,
-				       BRCMF_EVENTING_MASK_LEN);
+	err = brcmf_fil_iovar_data_get(ifp, "event_msgs", fweh->event_mask,
+				       fweh->event_mask_len);
 	if (err) {
 		bphy_err(drvr, "Get event_msgs error (%d)\n", err);
 		goto done;
 	}
-	setbit(eventmask, BRCMF_E_IF);
-	err = brcmf_fil_iovar_data_set(ifp, "event_msgs", eventmask,
-				       BRCMF_EVENTING_MASK_LEN);
+	/*
+	 * BRCMF_E_IF can safely be used to set the appropriate bit
+	 * in the event_mask as the firmware event code is guaranteed
+	 * to match the value of BRCMF_E_IF because it is old cruft
+	 * that all vendors have.
+	 */
+	setbit(fweh->event_mask, BRCMF_E_IF);
+	err = brcmf_fil_iovar_data_set(ifp, "event_msgs", fweh->event_mask,
+				       fweh->event_mask_len);
 	if (err) {
 		bphy_err(drvr, "Set event_msgs error (%d)\n", err);
 		goto done;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +7 -3
index a92f78026cfd..bf91b1e1368f 100644
@@ -1348,13 +1348,17 @@ int brcmf_attach(struct device *dev)
 		goto fail;
 	}
 
+	/* attach firmware event handler */
+	ret = brcmf_fweh_attach(drvr);
+	if (ret != 0) {
+		bphy_err(drvr, "brcmf_fweh_attach failed\n");
+		goto fail;
+	}
+
 	/* Attach to events important for core code */
 	brcmf_fweh_register(drvr, BRCMF_E_PSM_WATCHDOG,
 			    brcmf_psm_watchdog_notify);
 
-	/* attach firmware event handler */
-	brcmf_fweh_attach(drvr);
-
 	ret = brcmf_bus_started(drvr, drvr->ops);
 	if (ret != 0) {
 		bphy_err(drvr, "dongle is not responding: err=%d\n", ret);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +1 -1
index e4f911dd414b..ea76b8d33401 100644
@@ -122,7 +122,7 @@ struct brcmf_pub {
 	struct mutex proto_block;
 	unsigned char proto_buf[BRCMF_DCMD_MAXLEN];
 
-	struct brcmf_fweh_info fweh;
+	struct brcmf_fweh_info *fweh;
 
 	struct brcmf_ampdu_rx_reorder
 		*reorder_flows[BRCMF_AMPDU_RX_REORDER_MAXFLOWS];
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c +17 -0
index bec5748310b9..9a4837881486 100644
@@ -11,6 +11,8 @@
 
 #include "vops.h"
 
+#define BRCMF_CYW_E_LAST		197
+
 static int brcmf_cyw_set_sae_pwd(struct brcmf_if *ifp,
 				 struct cfg80211_crypto_settings *crypto)
 {
@@ -37,6 +39,21 @@ static int brcmf_cyw_set_sae_pwd(struct brcmf_if *ifp,
 	return err;
 }
 
+static int brcmf_cyw_alloc_fweh_info(struct brcmf_pub *drvr)
+{
+	struct brcmf_fweh_info *fweh;
+
+	fweh = kzalloc(struct_size(fweh, evt_handler, BRCMF_CYW_E_LAST),
+		       GFP_KERNEL);
+	if (!fweh)
+		return -ENOMEM;
+
+	fweh->num_event_codes = BRCMF_CYW_E_LAST;
+	drvr->fweh = fweh;
+	return 0;
+}
+
 const struct brcmf_fwvid_ops brcmf_cyw_ops = {
 	.set_sae_password = brcmf_cyw_set_sae_pwd,
+	.alloc_fweh_info = brcmf_cyw_alloc_fweh_info,
 };
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +114 -40

304 lines not on this page · raw message

drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h +48 -12

97 lines not on this page · raw message

drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c +2 -1
index b427782554b5..41eafcda77f7 100644
@@ -89,7 +89,8 @@ int brcmf_fwvid_register_vendor(enum brcmf_fwvendor fwvid, struct module *vmod,
 	if (fwvid >= BRCMF_FWVENDOR_NUM)
 		return -ERANGE;
 
-	if (WARN_ON(!vmod) || WARN_ON(!vops))
+	if (WARN_ON(!vmod) || WARN_ON(!vops) ||
+	    WARN_ON(!vops->alloc_fweh_info))
 		return -EINVAL;
 
 	if (WARN_ON(fwvid_list[fwvid].vmod))
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.h +9 -0
index dac22534d033..e6ac9fc341bc 100644
@@ -14,6 +14,7 @@ struct brcmf_if;
 struct brcmf_fwvid_ops {
 	void (*feat_attach)(struct brcmf_if *ifp);
 	int (*set_sae_password)(struct brcmf_if *ifp, struct cfg80211_crypto_settings *crypto);
+	int (*alloc_fweh_info)(struct brcmf_pub *drvr);
 };
 
 /* exported functions */
@@ -47,4 +48,12 @@ static inline int brcmf_fwvid_set_sae_password(struct brcmf_if *ifp,
 	return vops->set_sae_password(ifp, crypto);
 }
 
+static inline int brcmf_fwvid_alloc_fweh_info(struct brcmf_pub *drvr)
+{
+	if (!drvr->vops)
+		return -EIO;
+
+	return drvr->vops->alloc_fweh_info(drvr);
+}
+
 #endif /* FWVID_H_ */
drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/core.c +17 -0
index fd593b93ad40..05d7c2a4fba5 100644
@@ -11,6 +11,8 @@
 
 #include "vops.h"
 
+#define BRCMF_WCC_E_LAST		213
+
 static int brcmf_wcc_set_sae_pwd(struct brcmf_if *ifp,
 				 struct cfg80211_crypto_settings *crypto)
 {
@@ -18,6 +20,21 @@ static int brcmf_wcc_set_sae_pwd(struct brcmf_if *ifp,
 			      BRCMF_WSEC_PASSPHRASE);
 }
 
+static int brcmf_wcc_alloc_fweh_info(struct brcmf_pub *drvr)
+{
+	struct brcmf_fweh_info *fweh;
+
+	fweh = kzalloc(struct_size(fweh, evt_handler, BRCMF_WCC_E_LAST),
+		       GFP_KERNEL);
+	if (!fweh)
+		return -ENOMEM;
+
+	fweh->num_event_codes = BRCMF_WCC_E_LAST;
+	drvr->fweh = fweh;
+	return 0;
+}
+
 const struct brcmf_fwvid_ops brcmf_wcc_ops = {
 	.set_sae_password = brcmf_wcc_set_sae_pwd,
+	.alloc_fweh_info = brcmf_wcc_alloc_fweh_info,
 };
Signature · 1 line
2.32.0