summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.org5
-rw-r--r--nongnu/packages/linux.scm67
-rw-r--r--nongnu/packages/patches/broadcom-sta-debian-fix-kernel-warnings.patch161
-rw-r--r--nongnu/packages/patches/broadcom-sta-fix_mac_profile_discrepancy.patch16
-rw-r--r--nongnu/packages/patches/broadcom-sta-gcc.patch11
-rw-r--r--nongnu/packages/patches/broadcom-sta-license.patch13
-rw-r--r--nongnu/packages/patches/broadcom-sta-linux-4.11.patch52
-rw-r--r--nongnu/packages/patches/broadcom-sta-linux-4.12.patch68
-rw-r--r--nongnu/packages/patches/broadcom-sta-linux-4.15.patch47
-rw-r--r--nongnu/packages/patches/broadcom-sta-linux-4.7.patch109
-rw-r--r--nongnu/packages/patches/broadcom-sta-linux-4.8.patch64
-rw-r--r--nongnu/packages/patches/broadcom-sta-linux-5.1.patch32
-rw-r--r--nongnu/packages/patches/broadcom-sta-linux-5.10.patch211
-rw-r--r--nongnu/packages/patches/broadcom-sta-linux-5.6.patch87
-rw-r--r--nongnu/packages/patches/broadcom-sta-linux-5.9.patch12
-rw-r--r--nongnu/packages/patches/broadcom-sta-null-pointer-fix.patch27
-rw-r--r--nongnu/packages/patches/broadcom-sta-rdtscl.patch22
17 files changed, 41 insertions, 963 deletions
diff --git a/README.org b/README.org
index dc13104..e98e84a 100644
--- a/README.org
+++ b/README.org
@@ -177,14 +177,13 @@ is exactly equivalent to:
177 177
178Some Broadcom wireless hardware requires a proprietary kernel module in 178Some Broadcom wireless hardware requires a proprietary kernel module in
179addition to firmware. To use such hardware you will also need to add a service 179addition to firmware. To use such hardware you will also need to add a service
180to load that module on boot, blacklist conflicting kernel modules, and while not 180to load that module on boot and blacklist conflicting kernel modules:
181required, it is recommended to stay with Linux LTS releases:
182 181
183#+BEGIN_SRC scheme 182#+BEGIN_SRC scheme
184 (use-modules (nongnu packages linux)) 183 (use-modules (nongnu packages linux))
185 184
186 (operating-system 185 (operating-system
187 (kernel linux-lts) 186 (kernel linux)
188 ;; Blacklist conflicting kernel modules. 187 ;; Blacklist conflicting kernel modules.
189 (kernel-arguments '("modprobe.blacklist=b43,b43legacy,ssb,bcm43xx,brcm80211,brcmfmac,brcmsmac,bcma")) 188 (kernel-arguments '("modprobe.blacklist=b43,b43legacy,ssb,bcm43xx,brcm80211,brcmfmac,brcmsmac,bcma"))
190 (kernel-loadable-modules (list broadcom-sta)) 189 (kernel-loadable-modules (list broadcom-sta))
diff --git a/nongnu/packages/linux.scm b/nongnu/packages/linux.scm
index ba16623..48514dd 100644
--- a/nongnu/packages/linux.scm
+++ b/nongnu/packages/linux.scm
@@ -18,6 +18,7 @@
18;;; Copyright © 2022 Remco van 't Veer <remco@remworks.net> 18;;; Copyright © 2022 Remco van 't Veer <remco@remworks.net>
19;;; Copyright © 2022 Simen Endsjø <simendsjo@gmail.com> 19;;; Copyright © 2022 Simen Endsjø <simendsjo@gmail.com>
20;;; Copyright © 2022 Leo Famulari <leo@famulari.name> 20;;; Copyright © 2022 Leo Famulari <leo@famulari.name>
21;;; Copyright © 2023 Krzysztof Baranowski <pharcosyle@gmail.com>
21;;; Copyright © 2023 Morgan Smith <Morgan.J.Smith@outlook.com> 22;;; Copyright © 2023 Morgan Smith <Morgan.J.Smith@outlook.com>
22;;; Copyright © 2023 Jelle Licht <jlicht@fsfe.org> 23;;; Copyright © 2023 Jelle Licht <jlicht@fsfe.org>
23 24
@@ -728,6 +729,18 @@ giving you trouble, you can try this module.")
728 729
729(define broadcom-sta-version "6.30.223.271") 730(define broadcom-sta-version "6.30.223.271")
730 731
732(define (broadcom-sta-patch name commit hash)
733 (origin
734 (method url-fetch)
735 (uri (string-append "https://raw.githubusercontent.com/NixOS/nixpkgs/"
736 commit
737 "/pkgs/os-specific/linux/broadcom-sta/"
738 name
739 ".patch"))
740 (sha256
741 (base32
742 hash))))
743
731(define broadcom-sta-x86_64-source 744(define broadcom-sta-x86_64-source
732 (origin 745 (origin
733 (method url-fetch/tarbomb) 746 (method url-fetch/tarbomb)
@@ -736,29 +749,30 @@ giving you trouble, you can try this module.")
736 (string-replace-substring broadcom-sta-version "." "_") 749 (string-replace-substring broadcom-sta-version "." "_")
737 ".tar.gz")) 750 ".tar.gz"))
738 (patches 751 (patches
739 (parameterize 752 ;; Keep these in sync with the list at
740 ((%patch-path 753 ;; https://github.com/NixOS/nixpkgs/tree/master/pkgs/os-specific/linux/broadcom-sta.
741 (map (lambda (directory) 754 ;; Nixpkgs is good about keeping broadcom patches up to date so updating
742 (string-append directory "/nongnu/packages/patches")) 755 ;; for a new kernel release should be as simple as chaging the commit to
743 %load-path))) 756 ;; the newest available and adding any new patches.
744 ;; https://github.com/NixOS/nixpkgs/tree/master/pkgs/os-specific/linux/broadcom-sta 757 (let ((commit "355042e2ff5933b245e804c5eaff4ec3f340e71b"))
745 ;; https://git.archlinux.org/svntogit/community.git/tree/trunk?h=packages/broadcom-wl-dkms 758 (list
746 (search-patches "broadcom-sta-gcc.patch" 759 (broadcom-sta-patch "i686-build-failure" commit "1522w2gb698svlkb2b4lijbd740agvs2ibpz4g0jlv8v31cybkf4")
747 "broadcom-sta-license.patch" 760 (broadcom-sta-patch "license" commit "0rwlhafcmpp97cknqwv8gwf8sbxgqavgci1ywfkdxiylh4mhcvhr")
748 "broadcom-sta-null-pointer-fix.patch" 761 (broadcom-sta-patch "linux-4.7" commit "1nn1p6j77s9zfpxy5gl6qg1kha45pc7ww0yfkn5dmhazi288wamf")
749 "broadcom-sta-rdtscl.patch" 762 (broadcom-sta-patch "linux-4.8" commit "0bjx4ayi30jbdm3sh38p52d6dnb3c44mqzqi8g51hhbn1kghkmq9")
750 "broadcom-sta-linux-4.7.patch" 763 (broadcom-sta-patch "linux-4.11" commit "1s3n87v9cn3qicd5v4wzj20psl4gcn1ghz0fnsq60n05rriicywp")
751 "broadcom-sta-linux-4.8.patch" 764 (broadcom-sta-patch "linux-4.12" commit "1kj7sfnw9hxjxzqm48565vniq7fkhapaqadfpw6l9bcnpf53xld3")
752 "broadcom-sta-debian-fix-kernel-warnings.patch" 765 (broadcom-sta-patch "linux-4.15" commit "0bvk7nrvqa066dpn6vvb6x00yrxa37iqv87135kay9mllmkjd70b")
753 "broadcom-sta-linux-4.11.patch" 766 (broadcom-sta-patch "linux-5.1" commit "1kykpzhs19dwww6grav3qxsd28kn8y84i4b4csx2y5m2j629ncn0")
754 "broadcom-sta-linux-4.12.patch" 767 (broadcom-sta-patch "linux-5.6" commit "0v1jkaf60jgjkrjfcmx1gin4b65cdv39glqy7l3cswkmzb60lz4l")
755 "broadcom-sta-linux-4.15.patch" 768 (broadcom-sta-patch "linux-5.9" commit "1sgmbaahydk4j3i1jf8q1fz3a210fmakrpz0w1n9v3dcn23ladah")
756 "broadcom-sta-fix_mac_profile_discrepancy.patch" 769 (broadcom-sta-patch "linux-5.17" commit "1qsllvykhs3nvjwv8d6bgsm2sc9a1lxf8yqf6fa99p60ggd253ps")
757 "broadcom-sta-linux-5.1.patch" 770 (broadcom-sta-patch "linux-5.18" commit "1img0a0vqnkmq4c21aywq2ajyigzcfhbbpg1hw9nx7cbj9hf6d0l")
758 ;; source: https://github.com/NixOS/nixpkgs/commit/8ce65087c333097ab714d23800b69fc471ec48ca 771 (broadcom-sta-patch "linux-6.0" commit "0rv74j5giafzl19f01yvfa5rgvsdvcimxzhks2fp44wpnxq241nb")
759 "broadcom-sta-linux-5.6.patch" 772 (broadcom-sta-patch "linux-6.1" commit "1pvx1h7iimcbfqdc13n1980ngxk9q6iyip8svn293x4h7jn472kf")
760 "broadcom-sta-linux-5.9.patch" 773 (broadcom-sta-patch "pedantic-fix" commit "1kxmw1iyxnfwad75h981sak5qk16p81xy1f2qxss2d0v97vkfkl5")
761 "broadcom-sta-linux-5.10.patch"))) 774 (broadcom-sta-patch "null-pointer-fix" commit "15c2vxgf7v5wy4s8w9jk7irf3fxxghy05gxmav1ss73a2azajdx7")
775 (broadcom-sta-patch "gcc" commit "0jcqk2vapyy2pbsjv9n8b3qp6vqz17d6s07cr04cx7075q7yhz5h"))))
762 (sha256 776 (sha256
763 (base32 777 (base32
764 "1gj485qqr190idilacpxwgqyw21il03zph2rddizgj7fbd6pfyaz")))) 778 "1gj485qqr190idilacpxwgqyw21il03zph2rddizgj7fbd6pfyaz"))))
@@ -784,7 +798,7 @@ giving you trouble, you can try this module.")
784 (_ broadcom-sta-i686-source))) 798 (_ broadcom-sta-i686-source)))
785 (build-system linux-module-build-system) 799 (build-system linux-module-build-system)
786 (arguments 800 (arguments
787 `(#:linux ,linux-lts 801 `(#:linux ,linux
788 #:tests? #f)) 802 #:tests? #f))
789 (supported-systems '("i686-linux" "x86_64-linux")) 803 (supported-systems '("i686-linux" "x86_64-linux"))
790 (home-page "https://www.broadcom.com/support/802.11") 804 (home-page "https://www.broadcom.com/support/802.11")
@@ -805,10 +819,7 @@ Linux device driver for the following chipsets:
805@item BCM4331 819@item BCM4331
806@item BCM4352 820@item BCM4352
807@item BCM4360 821@item BCM4360
808@end itemize 822@end itemize")
809
810It is recommended that anyone who uses this package stays with Linux LTS
811releases.")
812 (license (nonfree "https://www.broadcom.com/support/802.11")))) 823 (license (nonfree "https://www.broadcom.com/support/802.11"))))
813 824
814(define-public broadcom-bt-firmware 825(define-public broadcom-bt-firmware
diff --git a/nongnu/packages/patches/broadcom-sta-debian-fix-kernel-warnings.patch b/nongnu/packages/patches/broadcom-sta-debian-fix-kernel-warnings.patch
deleted file mode 100644
index e9bf66a..0000000
--- a/nongnu/packages/patches/broadcom-sta-debian-fix-kernel-warnings.patch
+++ /dev/null
@@ -1,161 +0,0 @@
1--- a/src/wl/sys/wl_cfg80211_hybrid.c
2+++ b/src/wl/sys/wl_cfg80211_hybrid.c
3@@ -1968,7 +1968,7 @@
4
5 if (dtoh32(bi->length) > WL_BSS_INFO_MAX) {
6 WL_DBG(("Beacon is larger than buffer. Discarding\n"));
7- return err;
8+ return -E2BIG;
9 }
10 notif_bss_info = kzalloc(sizeof(*notif_bss_info) + sizeof(*mgmt) - sizeof(u8) +
11 WL_BSS_INFO_MAX, GFP_KERNEL);
12@@ -1992,9 +1992,15 @@
13 beacon_proberesp->capab_info = cpu_to_le16(bi->capability);
14 wl_rst_ie(wl);
15
16- wl_mrg_ie(wl, ((u8 *) bi) + bi->ie_offset, bi->ie_length);
17- wl_cp_ie(wl, beacon_proberesp->variable, WL_BSS_INFO_MAX -
18+ err = wl_mrg_ie(wl, ((u8 *) bi) + bi->ie_offset, bi->ie_length);
19+ if (err)
20+ goto inform_single_bss_out;
21+
22+ err = wl_cp_ie(wl, beacon_proberesp->variable, WL_BSS_INFO_MAX -
23 offsetof(struct wl_cfg80211_bss_info, frame_buf));
24+ if (err)
25+ goto inform_single_bss_out;
26+
27 notif_bss_info->frame_len = offsetof(struct ieee80211_mgmt, u.beacon.variable) +
28 wl_get_ielen(wl);
29 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
30@@ -2006,14 +2012,14 @@
31 #endif
32 if (freq == 0) {
33 WL_ERR(("Invalid channel, fail to chcnage channel to freq\n"));
34- kfree(notif_bss_info);
35- return -EINVAL;
36+ err = -EINVAL;
37+ goto inform_single_bss_out;
38 }
39 channel = ieee80211_get_channel(wiphy, freq);
40 if (unlikely(!channel)) {
41 WL_ERR(("ieee80211_get_channel error\n"));
42- kfree(notif_bss_info);
43- return -EINVAL;
44+ err = -EINVAL;
45+ goto inform_single_bss_out;
46 }
47
48 WL_DBG(("SSID : \"%s\", rssi %d, channel %d, capability : 0x04%x, bssid %pM\n",
49@@ -2021,28 +2027,37 @@
50 mgmt->u.beacon.capab_info, &bi->BSSID));
51
52 signal = notif_bss_info->rssi * 100;
53- cbss = cfg80211_inform_bss_frame(wiphy, channel, mgmt,
54- le16_to_cpu(notif_bss_info->frame_len), signal, GFP_KERNEL);
55- if (unlikely(!cbss)) {
56- WL_ERR(("cfg80211_inform_bss_frame error\n"));
57- kfree(notif_bss_info);
58- return -EINVAL;
59- }
60
61- notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
62- notify_ielen = le32_to_cpu(bi->ie_length);
63+ if (!wl->scan_request) {
64+ cbss = cfg80211_inform_bss_frame(wiphy, channel, mgmt,
65+ le16_to_cpu(notif_bss_info->frame_len), signal, GFP_KERNEL);
66+ if (unlikely(!cbss)) {
67+ WL_ERR(("cfg80211_inform_bss_frame error\n"));
68+ err = -ENOMEM;
69+ goto inform_single_bss_out;
70+ }
71+ } else {
72+ notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
73+ notify_ielen = le32_to_cpu(bi->ie_length);
74 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
75- cbss = cfg80211_inform_bss(wiphy, channel, (const u8 *)(bi->BSSID.octet),
76- 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int,
77- (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
78+ cbss = cfg80211_inform_bss(wiphy, channel, (const u8 *)(bi->BSSID.octet),
79+ 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int,
80+ (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
81 #else
82- cbss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, (const u8 *)(bi->BSSID.octet),
83- 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int,
84- (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
85+ cbss = cfg80211_inform_bss(wiphy, channel,
86+ wl->active_scan ?
87+ CFG80211_BSS_FTYPE_PRESP : CFG80211_BSS_FTYPE_BEACON,
88+ (const u8 *)(bi->BSSID.octet), 0,
89+ beacon_proberesp->capab_info,
90+ beacon_proberesp->beacon_int,
91+ (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
92 #endif
93-
94- if (unlikely(!cbss))
95- return -ENOMEM;
96+ if (unlikely(!cbss)) {
97+ WL_ERR(("cfg80211_inform_bss error\n"));
98+ err = -ENOMEM;
99+ goto inform_single_bss_out;
100+ }
101+ }
102
103 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
104 cfg80211_put_bss(wiphy, cbss);
105@@ -2050,6 +2065,7 @@
106 cfg80211_put_bss(cbss);
107 #endif
108
109+inform_single_bss_out:
110 kfree(notif_bss_info);
111
112 return err;
113@@ -2316,6 +2332,9 @@
114 if (err)
115 goto update_bss_info_out;
116
117+ bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
118+ ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
119+
120 ie = ((u8 *)bi) + bi->ie_offset;
121 ie_len = bi->ie_length;
122 } else {
123@@ -2328,11 +2347,18 @@
124 ie_len = bss->len_information_elements;
125 #endif
126 wl->conf->channel = *bss->channel;
127+ }
128+
129+ if (bss) {
130 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
131 cfg80211_put_bss(wiphy, bss);
132 #else
133 cfg80211_put_bss(bss);
134 #endif
135+ } else {
136+ WL_DBG(("Could not update BSS\n"));
137+ err = -EINVAL;
138+ goto update_bss_info_out;
139 }
140
141 tim = bcm_parse_tlvs(ie, ie_len, WLAN_EID_TIM);
142@@ -2360,10 +2386,17 @@
143 struct wl_cfg80211_connect_info *conn_info = wl_to_conn(wl);
144 s32 err = 0;
145
146- wl_get_assoc_ies(wl);
147+ err = wl_get_assoc_ies(wl);
148+ if (err)
149+ return err;
150+
151 memcpy(wl->profile->bssid, &e->addr, ETHER_ADDR_LEN);
152 memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN);
153- wl_update_bss_info(wl);
154+
155+ err = wl_update_bss_info(wl);
156+ if (err)
157+ return err;
158+
159 cfg80211_roamed(ndev,
160 #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
161 &wl->conf->channel,
diff --git a/nongnu/packages/patches/broadcom-sta-fix_mac_profile_discrepancy.patch b/nongnu/packages/patches/broadcom-sta-fix_mac_profile_discrepancy.patch
deleted file mode 100644
index 586bfcc..0000000
--- a/nongnu/packages/patches/broadcom-sta-fix_mac_profile_discrepancy.patch
+++ /dev/null
@@ -1,16 +0,0 @@
1https://bugs.archlinux.org/task/61090
2
3--- a/src/wl/sys/wl_cfg80211_hybrid.c 2015-09-19 00:47:30.000000000 +0200
4+++ b/src/wl/sys/wl_cfg80211_hybrid.c 2018-11-14 14:06:03.313487995 +0100
5@@ -1444,11 +1444,10 @@
6 s32 rate;
7 s32 err = 0;
8
9 if (memcmp(mac, wl->profile->bssid, ETHER_ADDR_LEN)) {
10 WL_ERR(("Wrong Mac address, mac = %pM profile =%pM\n", mac, wl->profile->bssid));
11- return -ENOENT;
12 }
13
14 err = wl_dev_ioctl(dev, WLC_GET_RATE, &rate, sizeof(rate));
15 if (err) {
16 WL_DBG(("Could not get rate (%d)\n", err));
diff --git a/nongnu/packages/patches/broadcom-sta-gcc.patch b/nongnu/packages/patches/broadcom-sta-gcc.patch
deleted file mode 100644
index f93e3f1..0000000
--- a/nongnu/packages/patches/broadcom-sta-gcc.patch
+++ /dev/null
@@ -1,11 +0,0 @@
1--- a/Makefile 2014-06-26 10:42:08.000000000 +0000
2+++ b/Makefile 2014-07-17 22:44:01.662297228 +0000
3@@ -126,6 +126,8 @@
4 EXTRA_CFLAGS += -I$(src)/src/shared/bcmwifi/include
5 #EXTRA_CFLAGS += -DBCMDBG_ASSERT -DBCMDBG_ERR
6
7+EXTRA_CFLAGS += -Wno-date-time
8+
9 EXTRA_LDFLAGS := $(src)/lib/wlc_hybrid.o_shipped
10
11 KBASE ?= /lib/modules/`uname -r`
diff --git a/nongnu/packages/patches/broadcom-sta-license.patch b/nongnu/packages/patches/broadcom-sta-license.patch
deleted file mode 100644
index aebb463..0000000
--- a/nongnu/packages/patches/broadcom-sta-license.patch
+++ /dev/null
@@ -1,13 +0,0 @@
1diff -Naur hybrid-portsrc-x86_32-v5_10_91_9.orig/src/wl/sys/wl_linux.c hybrid-portsrc-x86_32-v5_10_91_9/src/wl/sys/wl_linux.c
2--- hybrid-portsrc-x86_32-v5_10_91_9.orig/src/wl/sys/wl_linux.c 2009-04-23 02:48:59.000000000 +0900
3+++ hybrid-portsrc-x86_32-v5_10_91_9/src/wl/sys/wl_linux.c 2009-05-08 00:48:20.000000000 +0900
4@@ -171,6 +171,8 @@
5 static void wl_free_if(wl_info_t *wl, wl_if_t *wlif);
6 static void wl_get_driver_info(struct net_device *dev, struct ethtool_drvinfo *info);
7
8+MODULE_LICENSE("MIXED/Proprietary");
9+
10 #if defined(WL_CONFIG_RFKILL)
11 #include <linux/rfkill.h>
12 static int wl_init_rfkill(wl_info_t *wl);
13
diff --git a/nongnu/packages/patches/broadcom-sta-linux-4.11.patch b/nongnu/packages/patches/broadcom-sta-linux-4.11.patch
deleted file mode 100644
index a779f8c..0000000
--- a/nongnu/packages/patches/broadcom-sta-linux-4.11.patch
+++ /dev/null
@@ -1,52 +0,0 @@
1diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
2index a9671e2..da36405 100644
3--- a/src/wl/sys/wl_cfg80211_hybrid.c
4+++ b/src/wl/sys/wl_cfg80211_hybrid.c
5@@ -30,6 +30,9 @@
6 #include <linux/kthread.h>
7 #include <linux/netdevice.h>
8 #include <linux/ieee80211.h>
9+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
10+#include <linux/sched/signal.h>
11+#endif
12 #include <net/cfg80211.h>
13 #include <linux/nl80211.h>
14 #include <net/rtnetlink.h>
15diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
16index 489c9f5..f8278ad 100644
17--- a/src/wl/sys/wl_linux.c
18+++ b/src/wl/sys/wl_linux.c
19@@ -117,6 +117,9 @@ int wl_found = 0;
20
21 typedef struct priv_link {
22 wl_if_t *wlif;
23+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
24+ unsigned long last_rx;
25+#endif
26 } priv_link_t;
27
28 #define WL_DEV_IF(dev) ((wl_if_t*)((priv_link_t*)DEV_PRIV(dev))->wlif)
29@@ -2450,6 +2453,9 @@ wl_monitor(wl_info_t *wl, wl_rxsts_t *rxsts, void *p)
30 {
31 struct sk_buff *oskb = (struct sk_buff *)p;
32 struct sk_buff *skb;
33+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
34+ priv_link_t *priv_link;
35+#endif
36 uchar *pdata;
37 uint len;
38
39@@ -2916,7 +2922,13 @@ wl_monitor(wl_info_t *wl, wl_rxsts_t *rxsts, void *p)
40 if (skb == NULL) return;
41
42 skb->dev = wl->monitor_dev;
43+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
44+ priv_link = MALLOC(wl->osh, sizeof(priv_link_t));
45+ priv_link = netdev_priv(skb->dev);
46+ priv_link->last_rx = jiffies;
47+#else
48 skb->dev->last_rx = jiffies;
49+#endif
50 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
51 skb_reset_mac_header(skb);
52 #else
diff --git a/nongnu/packages/patches/broadcom-sta-linux-4.12.patch b/nongnu/packages/patches/broadcom-sta-linux-4.12.patch
deleted file mode 100644
index 8abc73d..0000000
--- a/nongnu/packages/patches/broadcom-sta-linux-4.12.patch
+++ /dev/null
@@ -1,68 +0,0 @@
1diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
2index da36405..d3741eb 100644
3--- a/src/wl/sys/wl_cfg80211_hybrid.c
4+++ b/src/wl/sys/wl_cfg80211_hybrid.c
5@@ -53,7 +53,11 @@ u32 wl_dbg_level = WL_DBG_ERR;
6 #endif
7
8 static s32 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
9+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
10+ enum nl80211_iftype type, struct vif_params *params);
11+#else
12 enum nl80211_iftype type, u32 *flags, struct vif_params *params);
13+#endif
14 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
15 static s32
16 wl_cfg80211_scan(struct wiphy *wiphy,
17@@ -466,7 +470,11 @@ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
18
19 static s32
20 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
21+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
22+ enum nl80211_iftype type,
23+#else
24 enum nl80211_iftype type, u32 *flags,
25+#endif
26 struct vif_params *params)
27 {
28 struct wl_cfg80211_priv *wl = wiphy_to_wl(wiphy);
29@@ -2361,6 +2369,20 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
30 const wl_event_msg_t *e, void *data)
31 {
32 struct wl_cfg80211_connect_info *conn_info = wl_to_conn(wl);
33+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
34+ struct cfg80211_bss *bss;
35+ struct wlc_ssid *ssid;
36+ ssid = &wl->profile->ssid;
37+ bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
38+ ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
39+ struct cfg80211_roam_info roam_info = {
40+ .bss = bss,
41+ .req_ie = conn_info->req_ie,
42+ .req_ie_len = conn_info->req_ie_len,
43+ .resp_ie = conn_info->resp_ie,
44+ .resp_ie_len = conn_info->resp_ie_len,
45+ };
46+#endif
47 s32 err = 0;
48
49 wl_get_assoc_ies(wl);
50@@ -2368,12 +2390,17 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
51 memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN);
52 wl_update_bss_info(wl);
53 cfg80211_roamed(ndev,
54+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
55+ &roam_info,
56+#else
57 #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
58 &wl->conf->channel,
59 #endif
60 (u8 *)&wl->bssid,
61 conn_info->req_ie, conn_info->req_ie_len,
62- conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL);
63+ conn_info->resp_ie, conn_info->resp_ie_len,
64+#endif
65+ GFP_KERNEL);
66 WL_DBG(("Report roaming result\n"));
67
68 set_bit(WL_STATUS_CONNECTED, &wl->status);
diff --git a/nongnu/packages/patches/broadcom-sta-linux-4.15.patch b/nongnu/packages/patches/broadcom-sta-linux-4.15.patch
deleted file mode 100644
index 523fa29..0000000
--- a/nongnu/packages/patches/broadcom-sta-linux-4.15.patch
+++ /dev/null
@@ -1,47 +0,0 @@
1See: https://lkml.org/lkml/2017/11/25/90
2
3diff -urNZ a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
4--- a/src/wl/sys/wl_linux.c 2015-09-18 22:47:30.000000000 +0000
5+++ b/src/wl/sys/wl_linux.c 2018-01-31 22:52:10.859856221 +0000
6@@ -93,7 +93,11 @@
7
8 #include <wlc_wowl.h>
9
10+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
11+static void wl_timer(struct timer_list *tl);
12+#else
13 static void wl_timer(ulong data);
14+#endif
15 static void _wl_timer(wl_timer_t *t);
16 static struct net_device *wl_alloc_linux_if(wl_if_t *wlif);
17
18@@ -2298,9 +2302,15 @@
19 }
20
21 static void
22+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
23+wl_timer(struct timer_list *tl)
24+{
25+ wl_timer_t *t = from_timer(t, tl, timer);
26+#else
27 wl_timer(ulong data)
28 {
29 wl_timer_t *t = (wl_timer_t *)data;
30+#endif
31
32 if (!WL_ALL_PASSIVE_ENAB(t->wl))
33 _wl_timer(t);
34@@ -2352,9 +2362,13 @@
35
36 bzero(t, sizeof(wl_timer_t));
37
38+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
39+ timer_setup(&t->timer, wl_timer, 0);
40+#else
41 init_timer(&t->timer);
42 t->timer.data = (ulong) t;
43 t->timer.function = wl_timer;
44+#endif
45 t->wl = wl;
46 t->fn = fn;
47 t->arg = arg;
diff --git a/nongnu/packages/patches/broadcom-sta-linux-4.7.patch b/nongnu/packages/patches/broadcom-sta-linux-4.7.patch
deleted file mode 100644
index 566680a..0000000
--- a/nongnu/packages/patches/broadcom-sta-linux-4.7.patch
+++ /dev/null
@@ -1,109 +0,0 @@
1Since Linux 4.7, the enum ieee80211_band is no longer used
2
3This shall cause no problem's since both enums ieee80211_band
4and nl80211_band were added in the same commit:
5https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=13ae75b103e07304a34ab40c9136e9f53e06475c
6
7This patch refactors the references of IEEE80211_BAND_* to NL80211_BAND_*
8
9Reference:
10https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=57fbcce37be7c1d2622b56587c10ade00e96afa3
11
12--- a/src/wl/sys/wl_cfg80211_hybrid.c 2016-06-13 11:57:36.159340297 -0500
13+++ b/src/wl/sys/wl_cfg80211_hybrid.c 2016-06-13 11:58:18.442323435 -0500
14@@ -236,7 +236,7 @@
15 #endif
16
17 #define CHAN2G(_channel, _freq, _flags) { \
18- .band = IEEE80211_BAND_2GHZ, \
19+ .band = NL80211_BAND_2GHZ, \
20 .center_freq = (_freq), \
21 .hw_value = (_channel), \
22 .flags = (_flags), \
23@@ -245,7 +245,7 @@
24 }
25
26 #define CHAN5G(_channel, _flags) { \
27- .band = IEEE80211_BAND_5GHZ, \
28+ .band = NL80211_BAND_5GHZ, \
29 .center_freq = 5000 + (5 * (_channel)), \
30 .hw_value = (_channel), \
31 .flags = (_flags), \
32@@ -379,7 +379,7 @@
33 };
34
35 static struct ieee80211_supported_band __wl_band_2ghz = {
36- .band = IEEE80211_BAND_2GHZ,
37+ .band = NL80211_BAND_2GHZ,
38 .channels = __wl_2ghz_channels,
39 .n_channels = ARRAY_SIZE(__wl_2ghz_channels),
40 .bitrates = wl_g_rates,
41@@ -387,7 +387,7 @@
42 };
43
44 static struct ieee80211_supported_band __wl_band_5ghz_a = {
45- .band = IEEE80211_BAND_5GHZ,
46+ .band = NL80211_BAND_5GHZ,
47 .channels = __wl_5ghz_a_channels,
48 .n_channels = ARRAY_SIZE(__wl_5ghz_a_channels),
49 .bitrates = wl_a_rates,
50@@ -395,7 +395,7 @@
51 };
52
53 static struct ieee80211_supported_band __wl_band_5ghz_n = {
54- .band = IEEE80211_BAND_5GHZ,
55+ .band = NL80211_BAND_5GHZ,
56 .channels = __wl_5ghz_n_channels,
57 .n_channels = ARRAY_SIZE(__wl_5ghz_n_channels),
58 .bitrates = wl_a_rates,
59@@ -1876,8 +1876,8 @@
60 wdev->wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
61 #endif
62 wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC);
63- wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz;
64- wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_a;
65+ wdev->wiphy->bands[NL80211_BAND_2GHZ] = &__wl_band_2ghz;
66+ wdev->wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_a;
67 wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
68 wdev->wiphy->cipher_suites = __wl_cipher_suites;
69 wdev->wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
70@@ -2000,7 +2000,7 @@
71 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
72 freq = ieee80211_channel_to_frequency(notif_bss_info->channel,
73 (notif_bss_info->channel <= CH_MAX_2G_CHANNEL) ?
74- IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ);
75+ NL80211_BAND_2GHZ : NL80211_BAND_5GHZ);
76 #else
77 freq = ieee80211_channel_to_frequency(notif_bss_info->channel);
78 #endif
79@@ -2116,7 +2116,7 @@
80 return err;
81 }
82 chan = wf_chspec_ctlchan(chanspec);
83- band = (chan <= CH_MAX_2G_CHANNEL) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
84+ band = (chan <= CH_MAX_2G_CHANNEL) ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
85 freq = ieee80211_channel_to_frequency(chan, band);
86 channel = ieee80211_get_channel(wiphy, freq);
87 cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid, channel, GFP_KERNEL);
88@@ -2250,10 +2250,10 @@
89 join_params->params.chanspec_list[0] =
90 ieee80211_frequency_to_channel(chan->center_freq);
91
92- if (chan->band == IEEE80211_BAND_2GHZ) {
93+ if (chan->band == NL80211_BAND_2GHZ) {
94 chanspec |= WL_CHANSPEC_BAND_2G;
95 }
96- else if (chan->band == IEEE80211_BAND_5GHZ) {
97+ else if (chan->band == NL80211_BAND_5GHZ) {
98 chanspec |= WL_CHANSPEC_BAND_5G;
99 }
100 else {
101@@ -2885,7 +2885,7 @@
102
103 if (phy == 'n' || phy == 'a' || phy == 'v') {
104 wiphy = wl_to_wiphy(wl);
105- wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n;
106+ wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_n;
107 }
108
109 return err;
diff --git a/nongnu/packages/patches/broadcom-sta-linux-4.8.patch b/nongnu/packages/patches/broadcom-sta-linux-4.8.patch
deleted file mode 100644
index 20e8a9a..0000000
--- a/nongnu/packages/patches/broadcom-sta-linux-4.8.patch
+++ /dev/null
@@ -1,64 +0,0 @@
1From d3f93542326a06d920c6eb89b703384290d37b8b Mon Sep 17 00:00:00 2001
2From: Alberto Milone <alberto.milone@canonical.com>
3Date: Fri, 2 Sep 2016 17:35:34 +0200
4Subject: [PATCH 1/1] Add support for Linux 4.8
5
6Orginal author: Krzysztof Kolasa
7---
8 src/wl/sys/wl_cfg80211_hybrid.c | 22 ++++++++++++++++++++++
9 1 file changed, 22 insertions(+)
10
11diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
12index 2fc71fe..ec5e472 100644
13--- a/src/wl/sys/wl_cfg80211_hybrid.c
14+++ b/src/wl/sys/wl_cfg80211_hybrid.c
15@@ -2388,8 +2388,16 @@ wl_bss_connect_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
16 s32 err = 0;
17
18 if (wl->scan_request) {
19+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
20+ struct cfg80211_scan_info info = {
21+ .aborted = true,
22+ };
23+ WL_DBG(("%s: Aborting scan\n", __FUNCTION__));
24+ cfg80211_scan_done(wl->scan_request, &info);
25+#else
26 WL_DBG(("%s: Aborting scan\n", __FUNCTION__));
27 cfg80211_scan_done(wl->scan_request, true);
28+#endif
29 wl->scan_request = NULL;
30 }
31
32@@ -2490,7 +2498,14 @@ wl_notify_scan_status(struct wl_cfg80211_priv *wl, struct net_device *ndev,
33
34 scan_done_out:
35 if (wl->scan_request) {
36+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
37+ struct cfg80211_scan_info info = {
38+ .aborted = false,
39+ };
40+ cfg80211_scan_done(wl->scan_request, &info);
41+#else
42 cfg80211_scan_done(wl->scan_request, false);
43+#endif
44 wl->scan_request = NULL;
45 }
46 rtnl_unlock();
47@@ -2909,7 +2924,14 @@ s32 wl_cfg80211_down(struct net_device *ndev)
48 s32 err = 0;
49
50 if (wl->scan_request) {
51+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
52+ struct cfg80211_scan_info info = {
53+ .aborted = true,
54+ };
55+ cfg80211_scan_done(wl->scan_request, &info);
56+#else
57 cfg80211_scan_done(wl->scan_request, true);
58+#endif
59 wl->scan_request = NULL;
60 }
61
62--
632.7.4
64
diff --git a/nongnu/packages/patches/broadcom-sta-linux-5.1.patch b/nongnu/packages/patches/broadcom-sta-linux-5.1.patch
deleted file mode 100644
index 8f04a73..0000000
--- a/nongnu/packages/patches/broadcom-sta-linux-5.1.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1commit bcb06af629a36eb84f9a35ac599ec7e51e2d39fb
2Author: georgewhewell <georgerw@gmail.com>
3Date: Sat May 18 21:22:37 2019 +0100
4
5 find src -type f -name \'*.c\' -exec sed -i "s/get_ds()/KERNEL_DS/g" {} \;
6
7diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
8index 7b606e0..51c81bc 100644
9--- a/src/wl/sys/wl_cfg80211_hybrid.c
10+++ b/src/wl/sys/wl_cfg80211_hybrid.c
11@@ -450,7 +450,7 @@ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
12 ifr.ifr_data = (caddr_t)&ioc;
13
14 fs = get_fs();
15- set_fs(get_ds());
16+ set_fs(KERNEL_DS);
17 #if defined(WL_USE_NETDEV_OPS)
18 err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
19 #else
20diff --git a/src/wl/sys/wl_iw.c b/src/wl/sys/wl_iw.c
21index c4c610b..9c3c74e 100644
22--- a/src/wl/sys/wl_iw.c
23+++ b/src/wl/sys/wl_iw.c
24@@ -117,7 +117,7 @@ dev_wlc_ioctl(
25 ifr.ifr_data = (caddr_t) &ioc;
26
27 fs = get_fs();
28- set_fs(get_ds());
29+ set_fs(KERNEL_DS);
30 #if defined(WL_USE_NETDEV_OPS)
31 ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
32 #else
diff --git a/nongnu/packages/patches/broadcom-sta-linux-5.10.patch b/nongnu/packages/patches/broadcom-sta-linux-5.10.patch
deleted file mode 100644
index c77fdc5..0000000
--- a/nongnu/packages/patches/broadcom-sta-linux-5.10.patch
+++ /dev/null
@@ -1,211 +0,0 @@
1From f3d652840f8dd959395065a1cf67ca40b04ec69b Mon Sep 17 00:00:00 2001
2From: Joan Bruguera <joanbrugueram@gmail.com>
3Date: Tue, 13 Oct 2020 19:35:55 +0200
4Subject: [PATCH] Get rid of get_fs/set_fs calls in Broadcom WL driver.
5
6Tentative patch for broadcom-wl 6.30.223.271 driver for Linux 5.10 (tested -rc1 up to 5.10.1)
7
8Applies on top of all the patches applied to broadcom-wl-dkms 6.30.223.271-23 on Arch Linux.
9
10NB: Some checks in wlc_ioctl_internal are likely superfluous,
11 but I'm not familiar enough with the driver to remove them with confidence.
12
13See also: https://lwn.net/Articles/722267/
14 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=47058bb54b57962b3958a936ddbc59355e4c5504
15 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5e6e9852d6f76e01b2e6803c74258afa5b432bc5
16
17Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
18---
19 src/wl/sys/wl_cfg80211_hybrid.c | 25 ++-------------------
20 src/wl/sys/wl_iw.c | 25 ++-------------------
21 src/wl/sys/wl_linux.c | 40 ++++++++++++++++++++++++++++-----
22 src/wl/sys/wl_linux.h | 2 ++
23 src/wl/sys/wlc_pub.h | 1 +
24 5 files changed, 42 insertions(+), 51 deletions(-)
25
26diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
27index 73c4b82..2e6df32 100644
28--- a/src/wl/sys/wl_cfg80211_hybrid.c
29+++ b/src/wl/sys/wl_cfg80211_hybrid.c
30@@ -38,6 +38,7 @@
31 #include <wlioctl.h>
32 #include <proto/802.11.h>
33 #include <wl_cfg80211_hybrid.h>
34+#include <wl_linux.h>
35
36 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
37 #include <linux/sched/signal.h>
38@@ -443,30 +444,8 @@ static void key_endian_to_host(struct wl_wsec_key *key)
39 static s32
40 wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
41 {
42- struct ifreq ifr;
43- struct wl_ioctl ioc;
44- mm_segment_t fs;
45- s32 err = 0;
46-
47 BUG_ON(len < sizeof(int));
48-
49- memset(&ioc, 0, sizeof(ioc));
50- ioc.cmd = cmd;
51- ioc.buf = arg;
52- ioc.len = len;
53- strcpy(ifr.ifr_name, dev->name);
54- ifr.ifr_data = (caddr_t)&ioc;
55-
56- fs = get_fs();
57- set_fs(KERNEL_DS);
58-#if defined(WL_USE_NETDEV_OPS)
59- err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
60-#else
61- err = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
62-#endif
63- set_fs(fs);
64-
65- return err;
66+ return wlc_ioctl_internal(dev, cmd, arg, len);
67 }
68
69 static s32
70diff --git a/src/wl/sys/wl_iw.c b/src/wl/sys/wl_iw.c
71index 9c3c74e..e346b15 100644
72--- a/src/wl/sys/wl_iw.c
73+++ b/src/wl/sys/wl_iw.c
74@@ -37,6 +37,7 @@ typedef const struct si_pub si_t;
75
76 #include <wl_dbg.h>
77 #include <wl_iw.h>
78+#include <wl_linux.h>
79
80 extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status,
81 uint32 reason, char* stringBuf, uint buflen);
82@@ -103,29 +104,7 @@ dev_wlc_ioctl(
83 int len
84 )
85 {
86- struct ifreq ifr;
87- wl_ioctl_t ioc;
88- mm_segment_t fs;
89- int ret;
90-
91- memset(&ioc, 0, sizeof(ioc));
92- ioc.cmd = cmd;
93- ioc.buf = arg;
94- ioc.len = len;
95-
96- strcpy(ifr.ifr_name, dev->name);
97- ifr.ifr_data = (caddr_t) &ioc;
98-
99- fs = get_fs();
100- set_fs(KERNEL_DS);
101-#if defined(WL_USE_NETDEV_OPS)
102- ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
103-#else
104- ret = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
105-#endif
106- set_fs(fs);
107-
108- return ret;
109+ return wlc_ioctl_internal(dev, cmd, arg, len);
110 }
111
112 static int
113diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
114index cca7ee1..e491df7 100644
115--- a/src/wl/sys/wl_linux.c
116+++ b/src/wl/sys/wl_linux.c
117@@ -1647,10 +1647,7 @@ wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
118 goto done2;
119 }
120
121- if (get_fs().seg == KERNEL_DS.seg)
122- buf = ioc.buf;
123-
124- else if (ioc.buf) {
125+ if (ioc.buf) {
126 if (!(buf = (void *) MALLOC(wl->osh, MAX(ioc.len, WLC_IOCTL_MAXLEN)))) {
127 bcmerror = BCME_NORESOURCE;
128 goto done2;
129@@ -1671,7 +1668,7 @@ wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
130 WL_UNLOCK(wl);
131
132 done1:
133- if (ioc.buf && (ioc.buf != buf)) {
134+ if (ioc.buf) {
135 if (copy_to_user(ioc.buf, buf, ioc.len))
136 bcmerror = BCME_BADADDR;
137 MFREE(wl->osh, buf, MAX(ioc.len, WLC_IOCTL_MAXLEN));
138@@ -1684,6 +1681,39 @@ done2:
139 return (OSL_ERROR(bcmerror));
140 }
141
142+int
143+wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len)
144+{
145+ wl_info_t *wl;
146+ wl_if_t *wlif;
147+ int bcmerror;
148+
149+ if (!dev)
150+ return -ENETDOWN;
151+
152+ wl = WL_INFO(dev);
153+ wlif = WL_DEV_IF(dev);
154+ if (wlif == NULL || wl == NULL || wl->dev == NULL)
155+ return -ENETDOWN;
156+
157+ bcmerror = 0;
158+
159+ WL_TRACE(("wl%d: wlc_ioctl_internal: cmd 0x%x\n", wl->pub->unit, cmd));
160+
161+ WL_LOCK(wl);
162+ if (!capable(CAP_NET_ADMIN)) {
163+ bcmerror = BCME_EPERM;
164+ } else {
165+ bcmerror = wlc_ioctl(wl->wlc, cmd, buf, len, wlif->wlcif);
166+ }
167+ WL_UNLOCK(wl);
168+
169+ ASSERT(VALID_BCMERROR(bcmerror));
170+ if (bcmerror != 0)
171+ wl->pub->bcmerror = bcmerror;
172+ return (OSL_ERROR(bcmerror));
173+}
174+
175 static struct net_device_stats*
176 wl_get_stats(struct net_device *dev)
177 {
178diff --git a/src/wl/sys/wl_linux.h b/src/wl/sys/wl_linux.h
179index 5b1048e..c8c1f41 100644
180--- a/src/wl/sys/wl_linux.h
181+++ b/src/wl/sys/wl_linux.h
182@@ -22,6 +22,7 @@
183 #define _wl_linux_h_
184
185 #include <wlc_types.h>
186+#include <wlc_pub.h>
187
188 typedef struct wl_timer {
189 struct timer_list timer;
190@@ -187,6 +188,7 @@ extern irqreturn_t wl_isr(int irq, void *dev_id, struct pt_regs *ptregs);
191 extern int __devinit wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
192 extern void wl_free(wl_info_t *wl);
193 extern int wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
194+extern int wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len);
195 extern struct net_device * wl_netdev_get(wl_info_t *wl);
196
197 #endif
198diff --git a/src/wl/sys/wlc_pub.h b/src/wl/sys/wlc_pub.h
199index 53a98b8..2b5a029 100644
200--- a/src/wl/sys/wlc_pub.h
201+++ b/src/wl/sys/wlc_pub.h
202@@ -24,6 +24,7 @@
203
204 #include <wlc_types.h>
205 #include <wlc_utils.h>
206+#include <siutils.h>
207 #include "proto/802.11.h"
208 #include "proto/bcmevent.h"
209
210--
2112.28.0
diff --git a/nongnu/packages/patches/broadcom-sta-linux-5.6.patch b/nongnu/packages/patches/broadcom-sta-linux-5.6.patch
deleted file mode 100644
index df5af79..0000000
--- a/nongnu/packages/patches/broadcom-sta-linux-5.6.patch
+++ /dev/null
@@ -1,87 +0,0 @@
1From dd057e40a167f4febb1a7c77dd32b7d36056952c Mon Sep 17 00:00:00 2001
2From: Herman van Hazendonk <github.com@herrie.org>
3Date: Tue, 31 Mar 2020 17:09:55 +0200
4Subject: [PATCH] Add fixes for 5.6 kernel
5
6Use ioremap instead of ioremap_nocache and proc_ops instead of file_operations on Linux kernel 5.6 and above.
7
8Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
9---
10 src/shared/linux_osl.c | 6 +++++-
11 src/wl/sys/wl_linux.c | 21 ++++++++++++++++++++-
12 2 files changed, 25 insertions(+), 2 deletions(-)
13
14diff --git a/src/shared/linux_osl.c b/src/shared/linux_osl.c
15index 6157d18..dcfc075 100644
16--- a/src/shared/linux_osl.c
17+++ b/src/shared/linux_osl.c
18@@ -942,7 +942,11 @@ osl_getcycles(void)
19 void *
20 osl_reg_map(uint32 pa, uint size)
21 {
22- return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
23+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
24+ return (ioremap((unsigned long)pa, (unsigned long)size));
25+ #else
26+ return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
27+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
28 }
29
30 void
31diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
32index 0d05100..6d9dd0d 100644
33--- a/src/wl/sys/wl_linux.c
34+++ b/src/wl/sys/wl_linux.c
35@@ -582,10 +582,17 @@ wl_attach(uint16 vendor, uint16 device, ulong regs,
36 }
37 wl->bcm_bustype = bustype;
38
39+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
40+ if ((wl->regsva = ioremap(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
41+ WL_ERROR(("wl%d: ioremap() failed\n", unit));
42+ goto fail;
43+ }
44+ #else
45 if ((wl->regsva = ioremap_nocache(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
46 WL_ERROR(("wl%d: ioremap() failed\n", unit));
47 goto fail;
48 }
49+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
50
51 wl->bar1_addr = bar1_addr;
52 wl->bar1_size = bar1_size;
53@@ -772,8 +779,13 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
54 if ((val & 0x0000ff00) != 0)
55 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
56 bar1_size = pci_resource_len(pdev, 2);
57+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
58+ bar1_addr = (uchar *)ioremap(pci_resource_start(pdev, 2),
59+ bar1_size);
60+ #else
61 bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2),
62 bar1_size);
63+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
64 wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), PCI_BUS, pdev,
65 pdev->irq, bar1_addr, bar1_size);
66
67@@ -3335,12 +3347,19 @@ wl_proc_write(struct file *filp, const char __user *buff, size_t length, loff_t
68 }
69
70 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
71+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
72+static const struct proc_ops wl_fops = {
73+ .proc_read = wl_proc_read,
74+ .proc_write = wl_proc_write,
75+};
76+#else
77 static const struct file_operations wl_fops = {
78 .owner = THIS_MODULE,
79 .read = wl_proc_read,
80 .write = wl_proc_write,
81 };
82-#endif
83+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
84+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) */
85
86 static int
87 wl_reg_proc_entry(wl_info_t *wl)
diff --git a/nongnu/packages/patches/broadcom-sta-linux-5.9.patch b/nongnu/packages/patches/broadcom-sta-linux-5.9.patch
deleted file mode 100644
index 56de11d..0000000
--- a/nongnu/packages/patches/broadcom-sta-linux-5.9.patch
+++ /dev/null
@@ -1,12 +0,0 @@
1diff -u -r a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
2--- a/src/wl/sys/wl_linux.c 2020-10-12 21:19:15.256305165 +0000
3+++ b/src/wl/sys/wl_linux.c 2020-10-12 21:20:38.687530895 +0000
4@@ -1643,7 +1643,7 @@
5 goto done2;
6 }
7
8- if (segment_eq(get_fs(), KERNEL_DS))
9+ if (get_fs().seg == KERNEL_DS.seg)
10 buf = ioc.buf;
11
12 else if (ioc.buf) {
diff --git a/nongnu/packages/patches/broadcom-sta-null-pointer-fix.patch b/nongnu/packages/patches/broadcom-sta-null-pointer-fix.patch
deleted file mode 100644
index adef19f..0000000
--- a/nongnu/packages/patches/broadcom-sta-null-pointer-fix.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1Description: Fixing null pointer crash
2
3Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=773713
4Bug-Ubuntu: https://launchpad.net/bugs/1415880
5Last-Update: 2015-08-18
6
7---
8 src/wl/sys/wl_linux.c | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
12index 860b935..295156f 100644
13--- a/src/wl/sys/wl_linux.c
14+++ b/src/wl/sys/wl_linux.c
15@@ -2157,8 +2157,8 @@ wl_start(struct sk_buff *skb, struct net_device *dev)
16 wlif = WL_DEV_IF(dev);
17 wl = WL_INFO(dev);
18
19+ skb->prev = NULL;
20 if (WL_ALL_PASSIVE_ENAB(wl) || (WL_RTR() && WL_CONFIG_SMP())) {
21- skb->prev = NULL;
22
23 TXQ_LOCK(wl);
24
25--
261.9.1
27
diff --git a/nongnu/packages/patches/broadcom-sta-rdtscl.patch b/nongnu/packages/patches/broadcom-sta-rdtscl.patch
deleted file mode 100644
index 1b9862c..0000000
--- a/nongnu/packages/patches/broadcom-sta-rdtscl.patch
+++ /dev/null
@@ -1,22 +0,0 @@
1Since Linux 4.3, rdtscl() is no longer available and native_read_tsc()
2is renamed to rdtsc(). Move the macro contents in-line and call the
3new function. References:
4
5https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=fe47ae6e1a5005b2e82f7eab57b5c3820453293a
6https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=4ea1636b04dbd66536fa387bae2eea463efc705b
7
8diff -ru a/src/shared/linux_osl.c b/src/shared/linux_osl.c
9--- a/src/shared/linux_osl.c 2015-09-19 01:47:15.000000000 +0300
10+++ b/src/shared/linux_osl.c 2015-11-21 15:20:30.585902518 +0200
11@@ -932,7 +932,11 @@
12 uint cycles;
13
14 #if defined(__i386__)
15+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
16+ cycles = (u32)rdtsc();
17+#else
18 rdtscl(cycles);
19+#endif
20 #else
21 cycles = 0;
22 #endif