linuxPackages_latest.broadcom_sta: add patches (#337948)

This commit is contained in:
Pol Dellaiera 2024-08-28 22:10:09 +02:00 committed by GitHub
commit 68e7e7347b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 53 additions and 1267 deletions

View File

@ -1,70 +1,91 @@
{ lib, stdenv, fetchurl, kernel }:
{
lib,
stdenv,
fetchurl,
fetchFromGitHub,
kernel,
}:
let
version = "6.30.223.271";
hashes = {
i686-linux = "1kaqa2dw3nb8k23ffvx46g8jj3wdhz8xa6jp1v3wb35cjfr712sg";
x86_64-linux = "1gj485qqr190idilacpxwgqyw21il03zph2rddizgj7fbd6pfyaz";
i686-linux = "sha256-T4twspOsjMXHDlca1dGHjQ8p0TOkb+eGmGjZwZtQWM0=";
x86_64-linux = "sha256-X3l3TVvuyPdja1nA+wegMQju8eP9MkVjiyCFjHFBRL4=";
};
arch = lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") "_64";
tarballVersion = lib.replaceStrings ["."] ["_"] version;
tarballVersion = lib.replaceStrings [ "." ] [ "_" ] version;
tarball = "hybrid-v35${arch}-nodebug-pcoem-${tarballVersion}.tar.gz";
rpmFusionPatches = fetchFromGitHub {
owner = "rpmfusion";
repo = "wl-kmod";
rev = "a04330284bfc38fd91eade6f8b28fa63cfcdc95e";
hash = "sha256-c72Pr/v+nxZPLEeNKbWnSpbH3gqYZaTgzMO9PlYQkf0=";
};
patchset = [
"wl-kmod-001_wext_workaround.patch"
"wl-kmod-002_kernel_3.18_null_pointer.patch"
"wl-kmod-003_gcc_4.9_remove_TIME_DATE_macros.patch"
"wl-kmod-004_kernel_4.3_rdtscl_to_rdtsc.patch"
"wl-kmod-005_kernel_4.7_IEEE80211_BAND_to_NL80211_BAND.patch"
"wl-kmod-006_gcc_6_fix_indentation_warnings.patch"
"wl-kmod-007_kernel_4.8_add_cfg80211_scan_info_struct.patch"
"wl-kmod-008_fix_kernel_warnings.patch"
"wl-kmod-009_kernel_4.11_remove_last_rx_in_net_device_struct.patch"
"wl-kmod-010_kernel_4.12_add_cfg80211_roam_info_struct.patch"
"wl-kmod-011_kernel_4.14_new_kernel_read_function_prototype.patch"
"wl-kmod-012_kernel_4.15_new_timer.patch"
"wl-kmod-013_gcc8_fix_bounds_check_warnings.patch"
"wl-kmod-014_kernel_read_pos_increment_fix.patch"
"wl-kmod-015_kernel_5.1_get_ds_removed.patch"
"wl-kmod-016_fix_unsupported_mesh_point.patch"
"wl-kmod-017_fix_gcc_fallthrough_warning.patch"
"wl-kmod-018_kernel_5.6_adaptations.patch"
"wl-kmod-019_kernel_5.9_segment_eq_removed.patch"
"wl-kmod-020_kernel_5.10_get_set_fs_removed.patch"
"wl-kmod-021_kernel_5.17_adaptation.patch"
"wl-kmod-022_kernel_5.18_adaptation.patch"
"wl-kmod-023_kernel_6.0_adaptation.patch"
"wl-kmod-024_kernel_6.1_adaptation.patch"
"wl-kmod-025_kernel_6.5_adaptation.patch"
"wl-kmod-026_kernel_6.10_fix_empty_body_in_if_warning.patch"
"wl-kmod-027_wpa_supplicant-2.11_add_max_scan_ie_len.patch"
];
in
stdenv.mkDerivation {
name = "broadcom-sta-${version}-${kernel.version}";
src = fetchurl {
url = "https://docs.broadcom.com/docs-and-downloads/docs/linux_sta/${tarball}";
sha256 = hashes.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
hash =
hashes.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
};
hardeningDisable = [ "pic" ];
nativeBuildInputs = kernel.moduleBuildDependencies;
patches = [
./license.patch
./linux-4.7.patch
# source: https://git.archlinux.org/svntogit/community.git/tree/trunk/004-linux48.patch?h=packages/broadcom-wl-dkms
./linux-4.8.patch
# source: https://aur.archlinux.org/cgit/aur.git/tree/linux411.patch?h=broadcom-wl
./linux-4.11.patch
# source: https://aur.archlinux.org/cgit/aur.git/tree/linux412.patch?h=broadcom-wl
./linux-4.12.patch
./linux-4.15.patch
./linux-5.1.patch
# source: https://salsa.debian.org/Herrie82-guest/broadcom-sta/-/commit/247307926e5540ad574a17c062c8da76990d056f
./linux-5.6.patch
# source: https://gist.github.com/joanbm/5c640ac074d27fd1d82c74a5b67a1290
./linux-5.9.patch
# source: https://github.com/archlinux/svntogit-community/blob/33b4bd2b9e30679b03f5d7aa2741911d914dcf94/trunk/012-linux517.patch
./linux-5.17.patch
# source: https://github.com/archlinux/svntogit-community/blob/2e1fd240f9ce06f500feeaa3e4a9675e65e6b967/trunk/013-linux518.patch
./linux-5.18.patch
# source: https://gist.github.com/joanbm/207210d74637870c01ef5a3c262a597d
./linux-6.0.patch
# source: https://gist.github.com/joanbm/94323ea99eff1e1d1c51241b5b651549
./linux-6.1.patch
./pedantic-fix.patch
./null-pointer-fix.patch
./gcc.patch
];
patches = map (patch: "${rpmFusionPatches}/${patch}") patchset;
makeFlags = [ "KBASE=${kernel.dev}/lib/modules/${kernel.modDirVersion}" ];
unpackPhase = ''
runHook preUnpack
sourceRoot=broadcom-sta
mkdir "$sourceRoot"
tar xvf "$src" -C "$sourceRoot"
runHook postUnpack
'';
installPhase = ''
runHook preInstall
binDir="$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
docDir="$out/share/doc/broadcom-sta/"
mkdir -p "$binDir" "$docDir"
cp wl.ko "$binDir"
cp lib/LICENSE.txt "$docDir"
runHook postInstall
'';
meta = {

View File

@ -1,28 +0,0 @@
From 3e28c2a24c3b3b011506bcaa4fee7e8da347c5ff Mon Sep 17 00:00:00 2001
From: Charles Strahan <charles.c.strahan@gmail.com>
Date: Tue, 5 May 2015 15:09:51 -0400
Subject: [PATCH 01/16] linuxPackages.broadcom_sta: since GCC respects
SOURCE_DATE_EPOCH, set in the stdenv, set -Wno-date-time
---
Makefile | 3 ---
1 file changed, 3 deletions(-)
diff --git a/Makefile b/Makefile
index a323a0d..15e85c8 100644
--- a/Makefile
+++ b/Makefile
@@ -140,10 +140,7 @@ wl-objs += src/wl/sys/wl_cfg80211_hybrid.o
EXTRA_CFLAGS += -I$(src)/src/include -I$(src)/src/common/include
EXTRA_CFLAGS += -I$(src)/src/wl/sys -I$(src)/src/wl/phy -I$(src)/src/wl/ppr/include
EXTRA_CFLAGS += -I$(src)/src/shared/bcmwifi/include
-#EXTRA_CFLAGS += -DBCMDBG_ASSERT -DBCMDBG_ERR
-ifeq "$(GE_49)" "1"
EXTRA_CFLAGS += -Wno-date-time
-endif
EXTRA_LDFLAGS := $(src)/lib/wlc_hybrid.o_shipped
--
2.45.1

View File

@ -1,26 +0,0 @@
From 5a964e14474e4482a4d24c015371856560dacabc Mon Sep 17 00:00:00 2001
From: Shea Levy <shea@shealevy.com>
Date: Sat, 4 Jan 2014 20:57:21 -0500
Subject: [PATCH 02/16] linuxPackages.broadcom_sta: apply MIXED/Proprietary
license
---
src/wl/sys/wl_linux.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
index 0d05100..14922c0 100644
--- a/src/wl/sys/wl_linux.c
+++ b/src/wl/sys/wl_linux.c
@@ -148,6 +148,8 @@ static struct wl_if *wl_alloc_if(wl_info_t *wl, int iftype, uint unit, struct wl
static void wl_free_if(wl_info_t *wl, wl_if_t *wlif);
static void wl_get_driver_info(struct net_device *dev, struct ethtool_drvinfo *info);
+MODULE_LICENSE("MIXED/Proprietary");
+
#if defined(WL_CONFIG_RFKILL)
#include <linux/rfkill.h>
static int wl_init_rfkill(wl_info_t *wl);
--
2.45.1

View File

@ -1,65 +0,0 @@
From 5a0301c2d9c65dbb3c5b8990e635d37f071d26c4 Mon Sep 17 00:00:00 2001
From: georgewhewell <georgerw@gmail.com>
Date: Fri, 2 Jun 2017 14:19:04 +0100
Subject: [PATCH 06/16] linuxPackages.broadcom_sta: fix build for kernel 4.11+
---
src/wl/sys/wl_cfg80211_hybrid.c | 3 +++
src/wl/sys/wl_linux.c | 12 ++++++++++++
2 files changed, 15 insertions(+)
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
index 84f0068..9fd8ed1 100644
--- a/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
@@ -30,6 +30,9 @@
#include <linux/kthread.h>
#include <linux/netdevice.h>
#include <linux/ieee80211.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+#include <linux/sched/signal.h>
+#endif
#include <net/cfg80211.h>
#include <linux/nl80211.h>
#include <net/rtnetlink.h>
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
index 65d7a22..18841d9 100644
--- a/src/wl/sys/wl_linux.c
+++ b/src/wl/sys/wl_linux.c
@@ -117,6 +117,9 @@ int wl_found = 0;
typedef struct priv_link {
wl_if_t *wlif;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+ unsigned long last_rx;
+#endif
} priv_link_t;
#define WL_DEV_IF(dev) ((wl_if_t*)((priv_link_t*)DEV_PRIV(dev))->wlif)
@@ -2451,6 +2454,9 @@ wl_monitor(wl_info_t *wl, wl_rxsts_t *rxsts, void *p)
{
struct sk_buff *oskb = (struct sk_buff *)p;
struct sk_buff *skb;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+ priv_link_t *priv_link;
+#endif
uchar *pdata;
uint len;
@@ -2917,7 +2923,13 @@ wl_monitor(wl_info_t *wl, wl_rxsts_t *rxsts, void *p)
if (skb == NULL) return;
skb->dev = wl->monitor_dev;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+ priv_link = MALLOC(wl->osh, sizeof(priv_link_t));
+ priv_link = netdev_priv(skb->dev);
+ priv_link->last_rx = jiffies;
+#else
skb->dev->last_rx = jiffies;
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
skb_reset_mac_header(skb);
#else
--
2.45.1

View File

@ -1,92 +0,0 @@
From 2e9c7bd146fbc3b4a62940140eafb47df16b6cb4 Mon Sep 17 00:00:00 2001
From: aszlig <aszlig@redmoonstudios.org>
Date: Tue, 18 Jul 2017 21:32:13 +0200
Subject: [PATCH 07/16] linuxPackages.broadcom_sta: fix build for kernel 4.12+
The patch is from Arch Linux at:
https://aur.archlinux.org/cgit/aur.git/tree/linux412.patch?h=broadcom-wl
Tested this by building against the following attributes:
* linuxPackages.broadcom_sta
* linuxPackages_latest.broadcom_sta
* pkgsI686Linux.linuxPackages.broadcom_sta
* pkgsI686Linux.linuxPackages_latest.broadcom_sta
I have not tested whether this works at runtime, because I do not possess the hardware.
---
src/wl/sys/wl_cfg80211_hybrid.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
index 9fd8ed1..1893a53 100644
--- a/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
@@ -53,7 +53,11 @@ u32 wl_dbg_level = WL_DBG_ERR;
#endif
static s32 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ enum nl80211_iftype type, struct vif_params *params);
+#else
enum nl80211_iftype type, u32 *flags, struct vif_params *params);
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
static s32
wl_cfg80211_scan(struct wiphy *wiphy,
@@ -466,7 +470,11 @@ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
static s32
wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ enum nl80211_iftype type,
+#else
enum nl80211_iftype type, u32 *flags,
+#endif
struct vif_params *params)
{
struct wl_cfg80211_priv *wl = wiphy_to_wl(wiphy);
@@ -2361,6 +2369,20 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
const wl_event_msg_t *e, void *data)
{
struct wl_cfg80211_connect_info *conn_info = wl_to_conn(wl);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ struct cfg80211_bss *bss;
+ struct wlc_ssid *ssid;
+ ssid = &wl->profile->ssid;
+ bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
+ ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
+ struct cfg80211_roam_info roam_info = {
+ .bss = bss,
+ .req_ie = conn_info->req_ie,
+ .req_ie_len = conn_info->req_ie_len,
+ .resp_ie = conn_info->resp_ie,
+ .resp_ie_len = conn_info->resp_ie_len,
+ };
+#endif
s32 err = 0;
wl_get_assoc_ies(wl);
@@ -2368,12 +2390,17 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN);
wl_update_bss_info(wl);
cfg80211_roamed(ndev,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ &roam_info,
+#else
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
&wl->conf->channel,
#endif
(u8 *)&wl->bssid,
conn_info->req_ie, conn_info->req_ie_len,
- conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL);
+ conn_info->resp_ie, conn_info->resp_ie_len,
+#endif
+ GFP_KERNEL);
WL_DBG(("Report roaming result\n"));
set_bit(WL_STATUS_CONNECTED, &wl->status);
--
2.45.1

View File

@ -1,59 +0,0 @@
From ae88c3c0c91d26ca5e4dc1e498a370747d2c3b03 Mon Sep 17 00:00:00 2001
From: Yegor Timoshenko <yegortimoshenko@riseup.net>
Date: Wed, 31 Jan 2018 22:59:09 +0000
Subject: [PATCH 08/16] linuxPackages.broadcom_sta: fix build for kernel 4.15+
See: https://lkml.org/lkml/2017/11/25/90
---
src/wl/sys/wl_linux.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
index 18841d9..83b8859 100644
--- a/src/wl/sys/wl_linux.c
+++ b/src/wl/sys/wl_linux.c
@@ -93,7 +93,11 @@ struct iw_statistics *wl_get_wireless_stats(struct net_device *dev);
#include <wlc_wowl.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
+static void wl_timer(struct timer_list *tl);
+#else
static void wl_timer(ulong data);
+#endif
static void _wl_timer(wl_timer_t *t);
static struct net_device *wl_alloc_linux_if(wl_if_t *wlif);
@@ -2303,9 +2307,15 @@ wl_timer_task(wl_task_t *task)
}
static void
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
+wl_timer(struct timer_list *tl)
+{
+ wl_timer_t *t = from_timer(t, tl, timer);
+#else
wl_timer(ulong data)
{
wl_timer_t *t = (wl_timer_t *)data;
+#endif
if (!WL_ALL_PASSIVE_ENAB(t->wl))
_wl_timer(t);
@@ -2357,9 +2367,13 @@ wl_init_timer(wl_info_t *wl, void (*fn)(void *arg), void *arg, const char *tname
bzero(t, sizeof(wl_timer_t));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
+ timer_setup(&t->timer, wl_timer, 0);
+#else
init_timer(&t->timer);
t->timer.data = (ulong) t;
t->timer.function = wl_timer;
+#endif
t->wl = wl;
t->fn = fn;
t->arg = arg;
--
2.45.1

View File

@ -1,131 +0,0 @@
From bc408ef546b08443dabbe8fcdfec5e1e48494ed8 Mon Sep 17 00:00:00 2001
From: aszlig <aszlig@redmoonstudios.org>
Date: Mon, 1 Aug 2016 20:45:47 +0200
Subject: [PATCH 04/16] linuxPackages.broadcom_sta: fix build for kernel 4.7+
Patch is from Arch Linux at:
https://aur.archlinux.org/cgit/aur.git/tree/?h=broadcom-wl
I've tested building against 3.18.36, 4.4.16 and 4.7.0.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @phreedom, @vcunat
Since Linux 4.7, the enum ieee80211_band is no longer used
This shall cause no problem's since both enums ieee80211_band
and nl80211_band were added in the same commit:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=13ae75b103e07304a34ab40c9136e9f53e06475c
This patch refactors the references of IEEE80211_BAND_* to NL80211_BAND_*
Reference:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=57fbcce37be7c1d2622b56587c10ade00e96afa3
---
src/wl/sys/wl_cfg80211_hybrid.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
index 7b606e0..3b438ba 100644
--- a/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
@@ -236,7 +236,7 @@ static s8 wl_dbg_estr[][WL_DBG_ESTR_MAX] = {
#endif
#define CHAN2G(_channel, _freq, _flags) { \
- .band = IEEE80211_BAND_2GHZ, \
+ .band = NL80211_BAND_2GHZ, \
.center_freq = (_freq), \
.hw_value = (_channel), \
.flags = (_flags), \
@@ -245,7 +245,7 @@ static s8 wl_dbg_estr[][WL_DBG_ESTR_MAX] = {
}
#define CHAN5G(_channel, _flags) { \
- .band = IEEE80211_BAND_5GHZ, \
+ .band = NL80211_BAND_5GHZ, \
.center_freq = 5000 + (5 * (_channel)), \
.hw_value = (_channel), \
.flags = (_flags), \
@@ -379,7 +379,7 @@ static struct ieee80211_channel __wl_5ghz_n_channels[] = {
};
static struct ieee80211_supported_band __wl_band_2ghz = {
- .band = IEEE80211_BAND_2GHZ,
+ .band = NL80211_BAND_2GHZ,
.channels = __wl_2ghz_channels,
.n_channels = ARRAY_SIZE(__wl_2ghz_channels),
.bitrates = wl_g_rates,
@@ -387,7 +387,7 @@ static struct ieee80211_supported_band __wl_band_2ghz = {
};
static struct ieee80211_supported_band __wl_band_5ghz_a = {
- .band = IEEE80211_BAND_5GHZ,
+ .band = NL80211_BAND_5GHZ,
.channels = __wl_5ghz_a_channels,
.n_channels = ARRAY_SIZE(__wl_5ghz_a_channels),
.bitrates = wl_a_rates,
@@ -395,7 +395,7 @@ static struct ieee80211_supported_band __wl_band_5ghz_a = {
};
static struct ieee80211_supported_band __wl_band_5ghz_n = {
- .band = IEEE80211_BAND_5GHZ,
+ .band = NL80211_BAND_5GHZ,
.channels = __wl_5ghz_n_channels,
.n_channels = ARRAY_SIZE(__wl_5ghz_n_channels),
.bitrates = wl_a_rates,
@@ -1876,8 +1876,8 @@ static s32 wl_alloc_wdev(struct device *dev, struct wireless_dev **rwdev)
wdev->wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
#endif
wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC);
- wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz;
- wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_a;
+ wdev->wiphy->bands[NL80211_BAND_2GHZ] = &__wl_band_2ghz;
+ wdev->wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_a;
wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
wdev->wiphy->cipher_suites = __wl_cipher_suites;
wdev->wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
@@ -2000,7 +2000,7 @@ static s32 wl_inform_single_bss(struct wl_cfg80211_priv *wl, struct wl_bss_info
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
freq = ieee80211_channel_to_frequency(notif_bss_info->channel,
(notif_bss_info->channel <= CH_MAX_2G_CHANNEL) ?
- IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ);
+ NL80211_BAND_2GHZ : NL80211_BAND_5GHZ);
#else
freq = ieee80211_channel_to_frequency(notif_bss_info->channel);
#endif
@@ -2116,7 +2116,7 @@ wl_notify_connect_status(struct wl_cfg80211_priv *wl, struct net_device *ndev,
return err;
}
chan = wf_chspec_ctlchan(chanspec);
- band = (chan <= CH_MAX_2G_CHANNEL) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
+ band = (chan <= CH_MAX_2G_CHANNEL) ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
freq = ieee80211_channel_to_frequency(chan, band);
channel = ieee80211_get_channel(wiphy, freq);
cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid, channel, GFP_KERNEL);
@@ -2250,10 +2250,10 @@ static void wl_ch_to_chanspec(struct ieee80211_channel *chan, struct wl_join_par
join_params->params.chanspec_list[0] =
ieee80211_frequency_to_channel(chan->center_freq);
- if (chan->band == IEEE80211_BAND_2GHZ) {
+ if (chan->band == NL80211_BAND_2GHZ) {
chanspec |= WL_CHANSPEC_BAND_2G;
}
- else if (chan->band == IEEE80211_BAND_5GHZ) {
+ else if (chan->band == NL80211_BAND_5GHZ) {
chanspec |= WL_CHANSPEC_BAND_5G;
}
else {
@@ -2885,7 +2885,7 @@ static s32 wl_update_wiphybands(struct wl_cfg80211_priv *wl)
if (phy == 'n' || phy == 'a' || phy == 'v') {
wiphy = wl_to_wiphy(wl);
- wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n;
+ wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_n;
}
return err;
--
2.45.1

View File

@ -1,66 +0,0 @@
From 8c536235639010135f8dc11a8ec0968f9b200a6e Mon Sep 17 00:00:00 2001
From: Alberto Milone <alberto.milone@canonical.com>
Date: Fri, 2 Sep 2016 17:35:34 +0200
Subject: [PATCH 05/16] linuxPackages.broadcom_sta: fix build for kernel 4.8+
Original author: Krzysztof Kolasa
Source: https://git.archlinux.org/svntogit/community.git/tree/trunk/004-linux48.patch?h=packages/broadcom-wl-dkms
---
src/wl/sys/wl_cfg80211_hybrid.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
index 3b438ba..84f0068 100644
--- a/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
@@ -2386,8 +2386,16 @@ wl_bss_connect_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
s32 err = 0;
if (wl->scan_request) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ struct cfg80211_scan_info info = {
+ .aborted = true,
+ };
+ WL_DBG(("%s: Aborting scan\n", __FUNCTION__));
+ cfg80211_scan_done(wl->scan_request, &info);
+#else
WL_DBG(("%s: Aborting scan\n", __FUNCTION__));
cfg80211_scan_done(wl->scan_request, true);
+#endif
wl->scan_request = NULL;
}
@@ -2488,7 +2496,14 @@ wl_notify_scan_status(struct wl_cfg80211_priv *wl, struct net_device *ndev,
scan_done_out:
if (wl->scan_request) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ struct cfg80211_scan_info info = {
+ .aborted = false,
+ };
+ cfg80211_scan_done(wl->scan_request, &info);
+#else
cfg80211_scan_done(wl->scan_request, false);
+#endif
wl->scan_request = NULL;
}
rtnl_unlock();
@@ -2913,7 +2928,14 @@ s32 wl_cfg80211_down(struct net_device *ndev)
s32 err = 0;
if (wl->scan_request) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ struct cfg80211_scan_info info = {
+ .aborted = true,
+ };
+ cfg80211_scan_done(wl->scan_request, &info);
+#else
cfg80211_scan_done(wl->scan_request, true);
+#endif
wl->scan_request = NULL;
}
--
2.45.1

View File

@ -1,39 +0,0 @@
From 35c712b7ad2b20088a1a4e233f1d22d7f6dc2525 Mon Sep 17 00:00:00 2001
From: georgewhewell <georgerw@gmail.com>
Date: Sat, 18 May 2019 21:36:26 +0100
Subject: [PATCH 09/16] linuxPackages.broadcom_sta: fix build for kernel 5.1+
---
src/wl/sys/wl_cfg80211_hybrid.c | 2 +-
src/wl/sys/wl_iw.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
index 1893a53..4b3298f 100644
--- a/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
@@ -457,7 +457,7 @@ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
ifr.ifr_data = (caddr_t)&ioc;
fs = get_fs();
- set_fs(get_ds());
+ set_fs(KERNEL_DS);
#if defined(WL_USE_NETDEV_OPS)
err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
#else
diff --git a/src/wl/sys/wl_iw.c b/src/wl/sys/wl_iw.c
index c4c610b..9c3c74e 100644
--- a/src/wl/sys/wl_iw.c
+++ b/src/wl/sys/wl_iw.c
@@ -117,7 +117,7 @@ dev_wlc_ioctl(
ifr.ifr_data = (caddr_t) &ioc;
fs = get_fs();
- set_fs(get_ds());
+ set_fs(KERNEL_DS);
#if defined(WL_USE_NETDEV_OPS)
ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
#else
--
2.45.1

View File

@ -1,69 +0,0 @@
From a5e450dcdc7bc4ce06379189c3577f8c7a36fbde Mon Sep 17 00:00:00 2001
From: Joan Bruguera <joanbrugueram@gmail.com>
Date: Wed, 12 Jan 2022 20:49:20 +0100
Subject: [PATCH 12/16] linuxPackages.broadcom_sta: fix build for kernel 5.17+
Tentative fix for broadcom-wl 6.30.223.271 driver for Linux 5.17-rc1
Set netdev->dev_addr through dev_addr_mod + PDE_DATA fix
Since Linux 5.17 netdev->dev_addr is const and must be changed through
dev_addr_mod, otherwise a warning is logged in dmesg and bad things may happen.
NB: The #if is not wrong, dev_addr_mod is defined since Linux 5.15-rc1
Plus a trivial fix for PDE_DATA.
Applies on top of all the patches applied to broadcom-wl-dkms 6.30.223.271-28 on Arch Linux.
See also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=adeef3e32146a8d2a73c399dc6f5d76a449131b1
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=359745d78351c6f5442435f81549f0207ece28aa
---
src/wl/sys/wl_linux.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
index 26ba9fa..25c4706 100644
--- a/src/wl/sys/wl_linux.c
+++ b/src/wl/sys/wl_linux.c
@@ -93,6 +93,10 @@ struct iw_statistics *wl_get_wireless_stats(struct net_device *dev);
#include <wlc_wowl.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0))
+#define PDE_DATA pde_data
+#endif
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
static void wl_timer(struct timer_list *tl);
#else
@@ -646,7 +650,7 @@ wl_attach(uint16 vendor, uint16 device, ulong regs,
WL_ERROR(("wl%d: Error setting MAC ADDRESS\n", unit));
}
#endif
- bcopy(&wl->pub->cur_etheraddr, dev->dev_addr, ETHER_ADDR_LEN);
+ eth_hw_addr_set(dev, wl->pub->cur_etheraddr.octet);
online_cpus = 1;
@@ -1852,7 +1856,7 @@ wl_set_mac_address(struct net_device *dev, void *addr)
WL_LOCK(wl);
- bcopy(sa->sa_data, dev->dev_addr, ETHER_ADDR_LEN);
+ eth_hw_addr_set(dev, sa->sa_data);
err = wlc_iovar_op(wl->wlc, "cur_etheraddr", NULL, 0, sa->sa_data, ETHER_ADDR_LEN,
IOV_SET, (WL_DEV_IF(dev))->wlcif);
WL_UNLOCK(wl);
@@ -3033,7 +3037,7 @@ _wl_add_monitor_if(wl_task_t *task)
else
dev->type = ARPHRD_IEEE80211_RADIOTAP;
- bcopy(wl->dev->dev_addr, dev->dev_addr, ETHER_ADDR_LEN);
+ eth_hw_addr_set(dev, wl->dev->dev_addr);
#if defined(WL_USE_NETDEV_OPS)
dev->netdev_ops = &wl_netdev_monitor_ops;
--
2.45.1

View File

@ -1,84 +0,0 @@
From 6c66b0eaaa3e6ebaa84891298715b71f7b2f0b1c Mon Sep 17 00:00:00 2001
From: X9VoiD <oscar.silvestrexx@gmail.com>
Date: Mon, 13 Jun 2022 17:38:18 +0800
Subject: [PATCH 13/16] linuxPackages.broadcom_sta: fix build for kernel 5.18+
---
src/shared/linux_osl.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/shared/linux_osl.c b/src/shared/linux_osl.c
index dcfc075..5a25b82 100644
--- a/src/shared/linux_osl.c
+++ b/src/shared/linux_osl.c
@@ -599,6 +599,8 @@ osl_dma_alloc_consistent(osl_t *osh, uint size, uint16 align_bits, uint *alloced
va = kmalloc(size, GFP_ATOMIC | __GFP_ZERO);
if (va)
*pap = (ulong)__virt_to_phys(va);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ va = dma_alloc_coherent(&((struct pci_dev *)osh->pdev)->dev, size, (dma_addr_t*)pap, GFP_ATOMIC);
#else
va = pci_alloc_consistent(osh->pdev, size, (dma_addr_t*)pap);
#endif
@@ -612,6 +614,8 @@ osl_dma_free_consistent(osl_t *osh, void *va, uint size, ulong pa)
#ifdef __ARM_ARCH_7A__
kfree(va);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ dma_free_coherent(&((struct pci_dev *)osh->pdev)->dev, size, va, (dma_addr_t)pa);
#else
pci_free_consistent(osh->pdev, size, va, (dma_addr_t)pa);
#endif
@@ -623,7 +627,11 @@ osl_dma_map(osl_t *osh, void *va, uint size, int direction, void *p, hnddma_seg_
int dir;
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ dir = (direction == DMA_TX)? DMA_TO_DEVICE: DMA_FROM_DEVICE;
+#else
dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE;
+#endif
#if defined(__ARM_ARCH_7A__) && defined(BCMDMASGLISTOSL)
if (dmah != NULL) {
@@ -641,7 +649,11 @@ osl_dma_map(osl_t *osh, void *va, uint size, int direction, void *p, hnddma_seg_
ASSERT(totsegs + nsegs <= MAX_DMA_SEGS);
sg->page_link = 0;
sg_set_buf(sg, PKTDATA(osh, skb), PKTLEN(osh, skb));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ dma_map_single(&((struct pci_dev *)osh->pdev)->dev, PKTDATA(osh, skb), PKTLEN(osh, skb), dir);
+#else
pci_map_single(osh->pdev, PKTDATA(osh, skb), PKTLEN(osh, skb), dir);
+#endif
}
totsegs += nsegs;
totlen += PKTLEN(osh, skb);
@@ -656,7 +668,11 @@ osl_dma_map(osl_t *osh, void *va, uint size, int direction, void *p, hnddma_seg_
}
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ return (dma_map_single(&((struct pci_dev *)osh->pdev)->dev, va, size, dir));
+#else
return (pci_map_single(osh->pdev, va, size, dir));
+#endif
}
void BCMFASTPATH
@@ -665,8 +681,13 @@ osl_dma_unmap(osl_t *osh, uint pa, uint size, int direction)
int dir;
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ dir = (direction == DMA_TX)? DMA_TO_DEVICE: DMA_FROM_DEVICE;
+ dma_unmap_single(&((struct pci_dev *)osh->pdev)->dev, (uint32)pa, size, dir);
+#else
dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE;
pci_unmap_single(osh->pdev, (uint32)pa, size, dir);
+#endif
}
#if defined(BCMDBG_ASSERT)
--
2.45.1

View File

@ -1,92 +0,0 @@
From 24decccfadc0d95b973e6dd8d476ddde2f0a4b21 Mon Sep 17 00:00:00 2001
From: Herman van Hazendonk <github.com@herrie.org>
Date: Tue, 31 Mar 2020 17:09:55 +0200
Subject: [PATCH 10/16] linuxPackages.broadcom_sta: fix build for kernel 5.6+
Use ioremap instead of ioremap_nocache and proc_ops instead of file_operations on Linux kernel 5.6 and above.
Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
Source: https://salsa.debian.org/Herrie82-guest/broadcom-sta/-/commit/247307926e5540ad574a17c062c8da76990d056f
---
src/shared/linux_osl.c | 6 +++++-
src/wl/sys/wl_linux.c | 21 ++++++++++++++++++++-
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/src/shared/linux_osl.c b/src/shared/linux_osl.c
index 6157d18..dcfc075 100644
--- a/src/shared/linux_osl.c
+++ b/src/shared/linux_osl.c
@@ -942,7 +942,11 @@ osl_getcycles(void)
void *
osl_reg_map(uint32 pa, uint size)
{
- return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+ return (ioremap((unsigned long)pa, (unsigned long)size));
+ #else
+ return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
}
void
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
index 83b8859..646f1d9 100644
--- a/src/wl/sys/wl_linux.c
+++ b/src/wl/sys/wl_linux.c
@@ -591,10 +591,17 @@ wl_attach(uint16 vendor, uint16 device, ulong regs,
}
wl->bcm_bustype = bustype;
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+ if ((wl->regsva = ioremap(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
+ WL_ERROR(("wl%d: ioremap() failed\n", unit));
+ goto fail;
+ }
+ #else
if ((wl->regsva = ioremap_nocache(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
WL_ERROR(("wl%d: ioremap() failed\n", unit));
goto fail;
}
+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
wl->bar1_addr = bar1_addr;
wl->bar1_size = bar1_size;
@@ -781,8 +788,13 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if ((val & 0x0000ff00) != 0)
pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
bar1_size = pci_resource_len(pdev, 2);
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+ bar1_addr = (uchar *)ioremap(pci_resource_start(pdev, 2),
+ bar1_size);
+ #else
bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2),
bar1_size);
+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), PCI_BUS, pdev,
pdev->irq, bar1_addr, bar1_size);
@@ -3363,12 +3375,19 @@ wl_proc_write(struct file *filp, const char __user *buff, size_t length, loff_t
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+static const struct proc_ops wl_fops = {
+ .proc_read = wl_proc_read,
+ .proc_write = wl_proc_write,
+};
+#else
static const struct file_operations wl_fops = {
.owner = THIS_MODULE,
.read = wl_proc_read,
.write = wl_proc_write,
};
-#endif
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) */
static int
wl_reg_proc_entry(wl_info_t *wl)
--
2.45.1

View File

@ -1,214 +0,0 @@
From 34d611f2dcf7d34db2cb413cc7b4f86f3706fec6 Mon Sep 17 00:00:00 2001
From: Joan Bruguera <joanbrugueram@gmail.com>
Date: Tue, 13 Oct 2020 19:35:55 +0200
Subject: [PATCH 11/16] linuxPackages.broadcom_sta: fix build for kernel 5.9+
Get rid of get_fs/set_fs calls in Broadcom WL driver.
Tentative patch for broadcom-wl 6.30.223.271 driver for Linux 5.10 (tested -rc1 up to 5.10.1)
Applies on top of all the patches applied to broadcom-wl-dkms 6.30.223.271-23 on Arch Linux.
NB: Some checks in wlc_ioctl_internal are likely superfluous,
but I'm not familiar enough with the driver to remove them with confidence.
See also: https://lwn.net/Articles/722267/
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=47058bb54b57962b3958a936ddbc59355e4c5504
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5e6e9852d6f76e01b2e6803c74258afa5b432bc5
Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
---
src/wl/sys/wl_cfg80211_hybrid.c | 26 ++-------------------
src/wl/sys/wl_iw.c | 25 ++-------------------
src/wl/sys/wl_linux.c | 40 ++++++++++++++++++++++++++++-----
src/wl/sys/wl_linux.h | 2 ++
src/wl/sys/wlc_pub.h | 1 +
5 files changed, 42 insertions(+), 52 deletions(-)
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
index 4b3298f..c45ad48 100644
--- a/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
@@ -41,6 +41,7 @@
#include <wlioctl.h>
#include <proto/802.11.h>
#include <wl_cfg80211_hybrid.h>
+#include <wl_linux.h>
#define EVENT_TYPE(e) dtoh32((e)->event_type)
#define EVENT_FLAGS(e) dtoh16((e)->flags)
@@ -442,30 +443,7 @@ static void key_endian_to_host(struct wl_wsec_key *key)
static s32
wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
{
- struct ifreq ifr;
- struct wl_ioctl ioc;
- mm_segment_t fs;
- s32 err = 0;
-
- BUG_ON(len < sizeof(int));
-
- memset(&ioc, 0, sizeof(ioc));
- ioc.cmd = cmd;
- ioc.buf = arg;
- ioc.len = len;
- strcpy(ifr.ifr_name, dev->name);
- ifr.ifr_data = (caddr_t)&ioc;
-
- fs = get_fs();
- set_fs(KERNEL_DS);
-#if defined(WL_USE_NETDEV_OPS)
- err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
-#else
- err = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
-#endif
- set_fs(fs);
-
- return err;
+ return wlc_ioctl_internal(dev, cmd, arg, len);
}
static s32
diff --git a/src/wl/sys/wl_iw.c b/src/wl/sys/wl_iw.c
index 9c3c74e..e346b15 100644
--- a/src/wl/sys/wl_iw.c
+++ b/src/wl/sys/wl_iw.c
@@ -37,6 +37,7 @@ typedef const struct si_pub si_t;
#include <wl_dbg.h>
#include <wl_iw.h>
+#include <wl_linux.h>
extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status,
uint32 reason, char* stringBuf, uint buflen);
@@ -103,29 +104,7 @@ dev_wlc_ioctl(
int len
)
{
- struct ifreq ifr;
- wl_ioctl_t ioc;
- mm_segment_t fs;
- int ret;
-
- memset(&ioc, 0, sizeof(ioc));
- ioc.cmd = cmd;
- ioc.buf = arg;
- ioc.len = len;
-
- strcpy(ifr.ifr_name, dev->name);
- ifr.ifr_data = (caddr_t) &ioc;
-
- fs = get_fs();
- set_fs(KERNEL_DS);
-#if defined(WL_USE_NETDEV_OPS)
- ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
-#else
- ret = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
-#endif
- set_fs(fs);
-
- return ret;
+ return wlc_ioctl_internal(dev, cmd, arg, len);
}
static int
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
index 646f1d9..26ba9fa 100644
--- a/src/wl/sys/wl_linux.c
+++ b/src/wl/sys/wl_linux.c
@@ -1664,10 +1664,7 @@ wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
goto done2;
}
- if (segment_eq(get_fs(), KERNEL_DS))
- buf = ioc.buf;
-
- else if (ioc.buf) {
+ if (ioc.buf) {
if (!(buf = (void *) MALLOC(wl->osh, MAX(ioc.len, WLC_IOCTL_MAXLEN)))) {
bcmerror = BCME_NORESOURCE;
goto done2;
@@ -1688,7 +1685,7 @@ wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
WL_UNLOCK(wl);
done1:
- if (ioc.buf && (ioc.buf != buf)) {
+ if (ioc.buf) {
if (copy_to_user(ioc.buf, buf, ioc.len))
bcmerror = BCME_BADADDR;
MFREE(wl->osh, buf, MAX(ioc.len, WLC_IOCTL_MAXLEN));
@@ -1701,6 +1698,39 @@ done2:
return (OSL_ERROR(bcmerror));
}
+int
+wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len)
+{
+ wl_info_t *wl;
+ wl_if_t *wlif;
+ int bcmerror;
+
+ if (!dev)
+ return -ENETDOWN;
+
+ wl = WL_INFO(dev);
+ wlif = WL_DEV_IF(dev);
+ if (wlif == NULL || wl == NULL || wl->dev == NULL)
+ return -ENETDOWN;
+
+ bcmerror = 0;
+
+ WL_TRACE(("wl%d: wlc_ioctl_internal: cmd 0x%x\n", wl->pub->unit, cmd));
+
+ WL_LOCK(wl);
+ if (!capable(CAP_NET_ADMIN)) {
+ bcmerror = BCME_EPERM;
+ } else {
+ bcmerror = wlc_ioctl(wl->wlc, cmd, buf, len, wlif->wlcif);
+ }
+ WL_UNLOCK(wl);
+
+ ASSERT(VALID_BCMERROR(bcmerror));
+ if (bcmerror != 0)
+ wl->pub->bcmerror = bcmerror;
+ return (OSL_ERROR(bcmerror));
+}
+
static struct net_device_stats*
wl_get_stats(struct net_device *dev)
{
diff --git a/src/wl/sys/wl_linux.h b/src/wl/sys/wl_linux.h
index 5b1048e..c8c1f41 100644
--- a/src/wl/sys/wl_linux.h
+++ b/src/wl/sys/wl_linux.h
@@ -22,6 +22,7 @@
#define _wl_linux_h_
#include <wlc_types.h>
+#include <wlc_pub.h>
typedef struct wl_timer {
struct timer_list timer;
@@ -187,6 +188,7 @@ extern irqreturn_t wl_isr(int irq, void *dev_id, struct pt_regs *ptregs);
extern int __devinit wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
extern void wl_free(wl_info_t *wl);
extern int wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
+extern int wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len);
extern struct net_device * wl_netdev_get(wl_info_t *wl);
#endif
diff --git a/src/wl/sys/wlc_pub.h b/src/wl/sys/wlc_pub.h
index 53a98b8..2b5a029 100644
--- a/src/wl/sys/wlc_pub.h
+++ b/src/wl/sys/wlc_pub.h
@@ -24,6 +24,7 @@
#include <wlc_types.h>
#include <wlc_utils.h>
+#include <siutils.h>
#include "proto/802.11.h"
#include "proto/bcmevent.h"
--
2.45.1

View File

@ -1,34 +0,0 @@
From cec136ba06039aa2e4441771df855894391db298 Mon Sep 17 00:00:00 2001
From: Joan Bruguera <joanbrugueram@gmail.com>
Date: Thu, 30 Jun 2022 02:15:35 +0200
Subject: [PATCH 14/16] linuxPackages.broadcom_sta: fix build for kernel 6.0+
Tentative patch for broadcom-wl 6.30.223.271 driver for Linux 6.0-rc1
Applies on top of all the patches applied to broadcom-wl-dkms 6.30.223.271-33 on Arch Linux.
Source: https://gist.github.com/joanbm/207210d74637870c01ef5a3c262a597d
---
src/wl/sys/wl_cfg80211_hybrid.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
index c45ad48..9ae56a1 100644
--- a/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
@@ -2354,7 +2354,12 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
struct cfg80211_roam_info roam_info = {
+// Rel. commit "cfg80211: Indicate MLO connection info in connect and roam callbacks" (Veerendranath Jakkam, Wed Jun 8)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
.bss = bss,
+#else
+ .links[0].bss = bss,
+#endif
.req_ie = conn_info->req_ie,
.req_ie_len = conn_info->req_ie_len,
.resp_ie = conn_info->resp_ie,
--
2.45.1

View File

@ -1,87 +0,0 @@
From febe94b43294a3155e39e844db4ac4ee81614ad1 Mon Sep 17 00:00:00 2001
From: Joan Bruguera <joanbrugueram@gmail.com>
Date: Mon, 29 Aug 2022 00:06:53 +0200
Subject: [PATCH 16/16] linuxPackages.broadcom_sta: fix build for kernel 6.1+
Tentative patch for broadcom-wl 6.30.223.271 driver for Linux 6.1-rc1
Applies on top of all the patches applied to broadcom-wl-dkms 6.30.223.271-35 on Arch Linux
Source: https://gist.github.com/joanbm/94323ea99eff1e1d1c51241b5b651549
---
src/wl/sys/wl_cfg80211_hybrid.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
index a6b2ca2..333866c 100644
--- a/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
@@ -104,20 +104,25 @@ static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wd
static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm);
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
+#define MAYBE_INT_LINK_ID int link_id,
+#else
+#define MAYBE_INT_LINK_ID
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy,
- struct net_device *dev, u8 key_idx, bool unicast, bool multicast);
+ struct net_device *dev, MAYBE_INT_LINK_ID u8 key_idx, bool unicast, bool multicast);
#else
static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy,
struct net_device *dev, u8 key_idx);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
static s32 wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
- u8 key_idx, bool pairwise, const u8 *mac_addr, struct key_params *params);
+ MAYBE_INT_LINK_ID u8 key_idx, bool pairwise, const u8 *mac_addr, struct key_params *params);
static s32 wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
- u8 key_idx, bool pairwise, const u8 *mac_addr);
+ MAYBE_INT_LINK_ID u8 key_idx, bool pairwise, const u8 *mac_addr);
static s32 wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
- u8 key_idx, bool pairwise, const u8 *mac_addr,
+ MAYBE_INT_LINK_ID u8 key_idx, bool pairwise, const u8 *mac_addr,
void *cookie, void (*callback) (void *cookie, struct key_params *params));
#else
static s32 wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
@@ -1165,7 +1170,7 @@ static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
static s32
wl_cfg80211_config_default_key(struct wiphy *wiphy,
- struct net_device *dev, u8 key_idx, bool unicast, bool multicast)
+ struct net_device *dev, MAYBE_INT_LINK_ID u8 key_idx, bool unicast, bool multicast)
#else
static s32
wl_cfg80211_config_default_key(struct wiphy *wiphy,
@@ -1190,7 +1195,7 @@ wl_cfg80211_config_default_key(struct wiphy *wiphy,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
static s32
wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
- u8 key_idx, bool pairwise, const u8 *mac_addr, struct key_params *params)
+ MAYBE_INT_LINK_ID u8 key_idx, bool pairwise, const u8 *mac_addr, struct key_params *params)
#else
static s32
wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
@@ -1311,7 +1316,7 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
static s32
wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
- u8 key_idx, bool pairwise, const u8 *mac_addr)
+ MAYBE_INT_LINK_ID u8 key_idx, bool pairwise, const u8 *mac_addr)
#else
static s32
wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
@@ -1354,7 +1359,7 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
static s32
wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
- u8 key_idx, bool pairwise, const u8 *mac_addr, void *cookie,
+ MAYBE_INT_LINK_ID u8 key_idx, bool pairwise, const u8 *mac_addr, void *cookie,
void (*callback) (void *cookie, struct key_params * params))
#else
static s32
--
2.45.1

View File

@ -1,34 +0,0 @@
From 507d93e3651d78c1df8bd185b0703872d0c2585b Mon Sep 17 00:00:00 2001
From: aszlig <aszlig@redmoonstudios.org>
Date: Mon, 1 Aug 2016 21:00:02 +0200
Subject: [PATCH 03/16] linuxPackages.broadcom_sta: fix NULL pointer deref
The patch is from the following Gentoo bug:
https://bugs.gentoo.org/show_bug.cgi?id=523326#c24
Built successfully against Linux 3.18.36, 4.4.16 and 4.7.0.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @phreedom, @vcunat
---
src/wl/sys/wl_linux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
index 14922c0..65d7a22 100644
--- a/src/wl/sys/wl_linux.c
+++ b/src/wl/sys/wl_linux.c
@@ -2167,8 +2167,8 @@ wl_start(struct sk_buff *skb, struct net_device *dev)
wlif = WL_DEV_IF(dev);
wl = WL_INFO(dev);
+ skb->prev = NULL;
if (WL_ALL_PASSIVE_ENAB(wl) || (WL_RTR() && WL_CONFIG_SMP())) {
- skb->prev = NULL;
TXQ_LOCK(wl);
--
2.45.1

View File

@ -1,115 +0,0 @@
From 99b1bbc01ea0611e93cb94c2a2532aef96676976 Mon Sep 17 00:00:00 2001
From: X9VoiD <oscar.silvestrexx@gmail.com>
Date: Wed, 19 Oct 2022 00:29:28 +0800
Subject: [PATCH 15/16] linuxPackages.broadcom_sta: fix build issues with
kernel 6.0+
---
src/shared/linux_osl.c | 2 +-
src/wl/sys/wl_cfg80211_hybrid.c | 17 ++++++++---------
src/wl/sys/wl_iw.h | 1 -
src/wl/sys/wl_linux.c | 17 +++++++++--------
4 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/src/shared/linux_osl.c b/src/shared/linux_osl.c
index 5a25b82..18bacb6 100644
--- a/src/shared/linux_osl.c
+++ b/src/shared/linux_osl.c
@@ -1101,7 +1101,7 @@ osl_os_get_image_block(char *buf, int len, void *image)
if (!image)
return 0;
- rdlen = kernel_read(fp, fp->f_pos, buf, len);
+ rdlen = kernel_read(fp, (void *)fp->f_pos, (size_t)len, (loff_t *)buf);
if (rdlen > 0)
fp->f_pos += rdlen;
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
index 9ae56a1..a6b2ca2 100644
--- a/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
@@ -790,6 +790,7 @@ wl_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme)
break;
case NL80211_AUTHTYPE_NETWORK_EAP:
WL_DBG(("network eap\n"));
+ break;
default:
val = 2;
WL_ERR(("invalid auth type (%d)\n", sme->auth_type));
@@ -2347,26 +2348,24 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
const wl_event_msg_t *e, void *data)
{
struct wl_cfg80211_connect_info *conn_info = wl_to_conn(wl);
+ s32 err = 0;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
struct cfg80211_bss *bss;
struct wlc_ssid *ssid;
+ struct cfg80211_roam_info roam_info;
ssid = &wl->profile->ssid;
bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
- struct cfg80211_roam_info roam_info = {
// Rel. commit "cfg80211: Indicate MLO connection info in connect and roam callbacks" (Veerendranath Jakkam, Wed Jun 8)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
- .bss = bss,
+ roam_info.bss = bss;
#else
- .links[0].bss = bss,
+ roam_info.links[0].bss = bss;
#endif
- .req_ie = conn_info->req_ie,
- .req_ie_len = conn_info->req_ie_len,
- .resp_ie = conn_info->resp_ie,
- .resp_ie_len = conn_info->resp_ie_len,
- };
+ roam_info.req_ie = conn_info->req_ie;
+ roam_info.req_ie_len = conn_info->req_ie_len;
+ roam_info.resp_ie = conn_info->resp_ie;
#endif
- s32 err = 0;
wl_get_assoc_ies(wl);
memcpy(wl->profile->bssid, &e->addr, ETHER_ADDR_LEN);
diff --git a/src/wl/sys/wl_iw.h b/src/wl/sys/wl_iw.h
index 3ab084f..471d11f 100644
--- a/src/wl/sys/wl_iw.h
+++ b/src/wl/sys/wl_iw.h
@@ -70,7 +70,6 @@ struct cntry_locales_custom {
#define WL_IW_RSSI_EXCELLENT -57
#define WL_IW_RSSI_INVALID 0
#define MAX_WX_STRING 80
-#define isprint(c) bcm_isprint(c)
#define WL_IW_SET_ACTIVE_SCAN (SIOCIWFIRSTPRIV+1)
#define WL_IW_GET_RSSI (SIOCIWFIRSTPRIV+3)
#define WL_IW_SET_PASSIVE_SCAN (SIOCIWFIRSTPRIV+5)
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
index 25c4706..4c7e238 100644
--- a/src/wl/sys/wl_linux.c
+++ b/src/wl/sys/wl_linux.c
@@ -791,14 +791,15 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_read_config_dword(pdev, 0x40, &val);
if ((val & 0x0000ff00) != 0)
pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
- bar1_size = pci_resource_len(pdev, 2);
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
- bar1_addr = (uchar *)ioremap(pci_resource_start(pdev, 2),
- bar1_size);
- #else
- bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2),
- bar1_size);
- #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
+
+ bar1_size = pci_resource_len(pdev, 2);
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+ bar1_addr = (uchar *)ioremap(pci_resource_start(pdev, 2),
+ bar1_size);
+ #else
+ bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2),
+ bar1_size);
+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), PCI_BUS, pdev,
pdev->irq, bar1_addr, bar1_size);
--
2.45.1