-
-
Save joanbm/4e7f18febc2c25f5fdf8143a739dccd1 to your computer and use it in GitHub Desktop.
| From 7c805f65d72befd067ad63387aaa94b764d3f70d Mon Sep 17 00:00:00 2001 | |
| From: =?UTF-8?q?Joan=20Bruguera=20Mic=C3=B3?= <[email protected]> | |
| Date: Sat, 28 Jun 2025 22:14:42 +0000 | |
| Subject: [PATCH] Tentative patch for broadcom-wl 6.30.223.271 driver for Linux | |
| 6.17-rc1 | |
| Some function prototype updates, rel. commit "wifi: cfg80211/mac80211: | |
| Add support to get radio index" (Roopni Devanathan, 15 Jun 2025) | |
| --- | |
| src/wl/sys/wl_cfg80211_hybrid.c | 28 ++++++++++++++++++++++++---- | |
| 1 file changed, 24 insertions(+), 4 deletions(-) | |
| diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c | |
| index fa9d75e..205c5dd 100644 | |
| --- a/src/wl/sys/wl_cfg80211_hybrid.c | |
| +++ b/src/wl/sys/wl_cfg80211_hybrid.c | |
| @@ -68,7 +68,11 @@ wl_cfg80211_scan(struct wiphy *wiphy, | |
| static s32 wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, | |
| struct cfg80211_scan_request *request); | |
| #endif | |
| +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0) | |
| +static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, int radio_idx, u32 changed); | |
| +#else | |
| static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed); | |
| +#endif | |
| static s32 wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, | |
| struct cfg80211_ibss_params *params); | |
| static s32 wl_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev); | |
| @@ -87,7 +91,10 @@ static int wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, | |
| struct cfg80211_connect_params *sme); | |
| static s32 wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_code); | |
| -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) | |
| +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0) | |
| +static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, int radio_idx, | |
| + enum nl80211_tx_power_setting type, s32 dbm); | |
| +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) | |
| static s32 | |
| wl_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, | |
| enum nl80211_tx_power_setting type, s32 dbm); | |
| @@ -99,7 +106,10 @@ static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy, | |
| enum tx_power_setting type, s32 dbm); | |
| #endif | |
| -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0) | |
| +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0) | |
| +static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, int radio_idx, | |
| + u32 link_id, s32 *dbm); | |
| +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0) | |
| static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, u32 /*link_id*/, s32 *dbm); | |
| #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) | |
| static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, s32 *dbm); | |
| @@ -659,7 +669,11 @@ static s32 wl_set_retry(struct net_device *dev, u32 retry, bool l) | |
| return err; | |
| } | |
| +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0) | |
| +static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, int radio_idx, u32 changed) | |
| +#else | |
| static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) | |
| +#endif | |
| { | |
| struct wl_cfg80211_priv *wl = wiphy_to_wl(wiphy); | |
| struct net_device *ndev = wl_to_ndev(wl); | |
| @@ -1093,7 +1107,10 @@ wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_c | |
| return err; | |
| } | |
| -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) | |
| +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0) | |
| +static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, int radio_idx, | |
| + enum nl80211_tx_power_setting type, s32 dbm) | |
| +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) | |
| static s32 | |
| wl_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, | |
| enum nl80211_tx_power_setting type, s32 dbm) | |
| @@ -1154,7 +1171,10 @@ wl_cfg80211_set_tx_power(struct wiphy *wiphy, enum tx_power_setting type, s32 db | |
| return err; | |
| } | |
| -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0) | |
| +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0) | |
| +static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, int radio_idx, | |
| + u32 link_id, s32 *dbm) | |
| +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0) | |
| static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, u32 /*link_id*/, s32 *dbm) | |
| #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) | |
| static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, s32 *dbm) | |
| -- | |
| 2.50.1 | |
After the 41-wl-use-timer_container_of-for-kernel-6.16.patch is applied in the debian series of the current package, I can then apply this, which is a small change of dbm to mdm:
diff -Npaur a/amd64/src/wl/sys/wl_cfg80211_hybrid.c b/amd64/src/wl/sys/wl_cfg80211_hybrid.c
--- a/amd64/src/wl/sys/wl_cfg80211_hybrid.c 2025-08-12 20:02:20.856362034 -0400
+++ b/amd64/src/wl/sys/wl_cfg80211_hybrid.c 2025-08-12 20:10:45.134208056 -0400
@@ -67,7 +67,11 @@ wl_cfg80211_scan(struct wiphy *wiphy,
static s32 wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_scan_request *request);
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0)
+static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, int radio_idx, u32 changed);
+#else
static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed);
+#endif
static s32 wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_ibss_params *params);
static s32 wl_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev);
@@ -86,7 +90,10 @@ static int wl_cfg80211_connect(struct wi
struct cfg80211_connect_params *sme);
static s32 wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_code);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0)
+static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, int radio_idx,
+ enum nl80211_tx_power_setting type, s32 dbm);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
static s32
wl_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
enum nl80211_tx_power_setting type, s32 mbm);
@@ -98,7 +105,10 @@ static s32 wl_cfg80211_set_tx_power(stru
enum tx_power_setting type, s32 mbm);
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0)
+static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, int radio_idx,
+ u32 link_id, s32 *dbm);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0)
static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, u32 /*link_id*/, s32 *dbm);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, s32 *dbm);
@@ -664,7 +674,11 @@ static s32 wl_set_retry(struct net_devic
return err;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0)
+static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, int radio_idx, u32 changed)
+#else
static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
+#endif
{
struct wl_cfg80211_priv *wl = wiphy_to_wl(wiphy);
struct net_device *ndev = wl_to_ndev(wl);
@@ -1102,7 +1116,10 @@ wl_cfg80211_disconnect(struct wiphy *wip
return err;
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0)
+static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, int radio_idx,
+ enum nl80211_tx_power_setting type, s32 mbm)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
static s32
wl_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
enum nl80211_tx_power_setting type, s32 mbm)
@@ -1163,7 +1180,10 @@ wl_cfg80211_set_tx_power(struct wiphy *w
return err;
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0)
+static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, int radio_idx,
+ u32 link_id, s32 *dbm)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0)
static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, u32 /*link_id*/, s32 *dbm)
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, s32 *dbm)This fixes the build for me, at least for ubuntu 25.04/plucky.
@satmandu Thanks for the comment & patch for Uubntu! I quickly checked and it looks like Ubuntu's broadcom-sta has an patch (19-wl-Fix-get-set-values-for-tx_power.patch) which Arch's broadcom-wl doesn't, which causes the conflict you're mentioning.
Unfortunately since the driver has been unmaintained for so long, the patch sets have also diverged across distros (and there's little hope of them converging again), so I can't really do much :(
All of the patches I publish are only guaranteed to apply cleanly on Arch as that's what I use.
First off, thanks for doing the lord's work with these, everyone over at Gentoo thanks you.
main point though is this still required? As 6.17.0-rc4 builds fine without the patch.
@immolo Yes, this is still required for 6.17.0-rc5, without this I get the following build errors:
src/wl/sys/wl_cfg80211_hybrid.c:1822:29: error: initialization of 'int (*)(struct wiphy *, int, u32)' {aka 'int (*)(struct wiphy *, int, unsigned int)'} from incompatible pointer type 's32 (*)(struct wiphy *, u32)' {aka 'int (*)(struct wiphy *, unsigned int)'} [-Wincompatible-pointer-types]
1822 | .set_wiphy_params = wl_cfg80211_set_wiphy_params,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/wl/sys/wl_cfg80211_hybrid.c:1826:25: error: initialization of 'int (*)(struct wiphy *, struct wireless_dev *, int, enum nl80211_tx_power_setting, int)' from incompatible pointer type 's32 (*)(struct wiphy *, struct wireless_dev *, enum nl80211_tx_power_setting, s32)' {aka 'int (*)(struct wiphy *, struct wireless_dev *, enum nl80211_tx_power_setting, int)'} [-Wincompatible-pointer-types]
1826 | .set_tx_power = wl_cfg80211_set_tx_power,
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/wl/sys/wl_cfg80211_hybrid.c:1827:25: error: initialization of 'int (*)(struct wiphy *, struct wireless_dev *, int, unsigned int, int *)' from incompatible pointer type 's32 (*)(struct wiphy *, struct wireless_dev *, u32, s32 *)' {aka 'int (*)(struct wiphy *, struct wireless_dev *, unsigned int, int *)'} [-Wincompatible-pointer-types]
1827 | .get_tx_power = wl_cfg80211_get_tx_power,
| ^~~~~~~~~~~~~~~~~~~~~~~~
Possibly you are building with compiler flags that make this a warning instead of an error (but, the built driver may not work correctly).
@joanbm That was it thanks! Irony being it's the only machine in the house not running GCC16......
Hello all
Same case on Debian. With the patch of Satmandu I was able to install 6.17.3-x64v2-xanmod1 kernel and wifi is ok!
broadcom-sta-dkms/unstable,now 6.30.223.271-28 amd64 [installé]
root@debian:/usr/src/broadcom-sta-6.30.223.271/src/wl/sys# patch wl_cfg80211_hybrid.c < /home/guy/Linux/broadcom/broadcom-wl-fix-linux-6.17.patch
patching file wl_cfg80211_hybrid.c
/lib/modules/6.17.3-x64v2-xanmod1/updates/dkms$ ls -alrt
total 8968
drwxr-xr-x 3 root root 4096 17 oct. 16:56 ..
drwxr-xr-x 2 root root 4096 17 oct. 16:56 .
-rw-r--r-- 1 root root 9174381 17 oct. 16:56 wl.ko
...
lspci -nnk | grep -i broad -A2
03:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM4313 802.11bgn Wireless Network Adapter [14e4:4727] (rev 01)
DeviceName: Broadcom 802.11n+BT combo module
Subsystem: Hewlett-Packard Company Device [103c:1483]
Kernel driver in use: wl
uname -a
Linux debian 6.17.3-x64v2-xanmod1 #0~20251016.g8be7ecd SMP PREEMPT_DYNAMIC Thu Oct 16 05:17:56 UTC x86_64 GNU/Linux
Thhanks to all
Applying this to the current debian/ubuntu broadcom-sta package I get this error: