summaryrefslogtreecommitdiff
path: root/sys-kernel/broadcom-sta-dkms/files/broadcom-sta-dkms-6.30.223.271-linux-3.18-to-5.6.patch
blob: daea9aa21cb209959daf0eb1d488717fa7c52104 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
diff -Nur a/Makefile b/Makefile
--- a/Makefile	2015-09-18 23:47:30.000000000 +0100
+++ b/Makefile	2020-05-16 22:29:15.496057938 +0100
@@ -145,11 +145,13 @@
 EXTRA_CFLAGS       += -Wno-date-time
 endif
 
+EXTRA_CFLAGS       += -Wno-date-time
+
 EXTRA_LDFLAGS      := $(src)/lib/wlc_hybrid.o_shipped
 
-KBASE              ?= /lib/modules/`uname -r`
+KBASE              ?= /lib/modules/${KV_FULL}
 KBUILD_DIR         ?= $(KBASE)/build
-MDEST_DIR          ?= $(KBASE)/kernel/drivers/net/wireless
+MDEST_DIR          ?= ${D}$(KBASE)/kernel/drivers/net/wireless
 
 # Cross compile setup.  Tool chain and kernel tree, replace with your own.
 CROSS_TOOLS        = /path/to/tools
diff -Nur a/src/shared/linux_osl.c b/src/shared/linux_osl.c
--- a/src/shared/linux_osl.c	2015-09-18 23:47:30.000000000 +0100
+++ b/src/shared/linux_osl.c	2020-05-16 22:32:09.368936810 +0100
@@ -30,6 +30,7 @@
 #include <pcicfg.h>
 
 #include <linux/fs.h>
+#include <linux/io.h>
 
 #define PCI_CFG_RETRY 		10
 
@@ -932,7 +933,11 @@
 	uint cycles;
 
 #if defined(__i386__)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
+	cycles = (u32)rdtsc();
+#else
 	rdtscl(cycles);
+#endif
 #else
 	cycles = 0;
 #endif 
diff -Nur a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
--- a/src/wl/sys/wl_cfg80211_hybrid.c	2015-09-18 23:47:30.000000000 +0100
+++ b/src/wl/sys/wl_cfg80211_hybrid.c	2020-05-16 22:30:50.397629582 +0100
@@ -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>
@@ -49,8 +52,17 @@
 u32 wl_dbg_level = WL_DBG_ERR;
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
+#define get_ds()	((mm_segment_t) { (-1UL) })
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+static s32 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
+           enum nl80211_iftype type, struct vif_params *params);
+#else
 static s32 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
            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,
@@ -236,7 +248,7 @@
 #endif				
 
 #define CHAN2G(_channel, _freq, _flags) {			\
-	.band			= IEEE80211_BAND_2GHZ,		\
+	.band			= NL80211_BAND_2GHZ,		\
 	.center_freq		= (_freq),			\
 	.hw_value		= (_channel),			\
 	.flags			= (_flags),			\
@@ -245,7 +257,7 @@
 }
 
 #define CHAN5G(_channel, _flags) {				\
-	.band			= IEEE80211_BAND_5GHZ,		\
+	.band			= NL80211_BAND_5GHZ,		\
 	.center_freq		= 5000 + (5 * (_channel)),	\
 	.hw_value		= (_channel),			\
 	.flags			= (_flags),			\
@@ -379,7 +391,7 @@
 };
 
 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 +399,7 @@
 };
 
 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 +407,7 @@
 };
 
 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,
@@ -463,7 +475,11 @@
 
 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);
@@ -1876,8 +1892,8 @@
 	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 +2016,7 @@
 #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 +2132,7 @@
 				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 +2266,10 @@
 		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 {
@@ -2358,12 +2374,26 @@
                     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_roam_info roam_info = {};
+#endif
 	s32 err = 0;
 
 	wl_get_assoc_ies(wl);
 	memcpy(wl->profile->bssid, &e->addr, ETHER_ADDR_LEN);
 	memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN);
 	wl_update_bss_info(wl);
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+	roam_info.channel = &wl->conf->channel,
+	roam_info.bssid = (u8 *)&wl->bssid,
+	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,
+	roam_info.resp_ie_len = conn_info->resp_ie_len,
+
+	cfg80211_roamed(ndev, &roam_info, GFP_KERNEL);
+#else
 	cfg80211_roamed(ndev,
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
 			&wl->conf->channel,	 
@@ -2371,6 +2401,7 @@
 			(u8 *)&wl->bssid,
 			conn_info->req_ie, conn_info->req_ie_len,
 			conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL);
+#endif
 	WL_DBG(("Report roaming result\n"));
 
 	set_bit(WL_STATUS_CONNECTED, &wl->status);
@@ -2386,8 +2417,16 @@
 	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 +2527,14 @@
 
 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();
@@ -2885,7 +2931,7 @@
 
 	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;
@@ -2913,7 +2959,14 @@
 	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;
 	}
 
diff -Nur a/src/wl/sys/wl_iw.h b/src/wl/sys/wl_iw.h
--- a/src/wl/sys/wl_iw.h	2015-09-18 23:47:30.000000000 +0100
+++ b/src/wl/sys/wl_iw.h	2020-05-16 22:26:59.183799085 +0100
@@ -21,6 +21,7 @@
 #ifndef _wl_iw_h_
 #define _wl_iw_h_
 
+#include <linux/semaphore.h>
 #include <linux/wireless.h>
 
 #include <typedefs.h>
diff -Nur a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
--- a/src/wl/sys/wl_linux.c	2015-09-18 23:47:30.000000000 +0100
+++ b/src/wl/sys/wl_linux.c	2020-05-16 22:33:01.099792831 +0100
@@ -92,8 +92,13 @@
 #endif 
 
 #include <wlc_wowl.h>
+#include <linux/io.h>
 
+#ifdef HAVE_TIMER_SETUP
+static void wl_timer(struct timer_list *list);
+#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);
 
@@ -117,6 +122,9 @@
 
 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)
@@ -217,7 +225,7 @@
 #define to_str(s) #s
 #define quote_str(s) to_str(s)
 
-#define BRCM_WLAN_IFNAME eth%d
+#define BRCM_WLAN_IFNAME wlan%d
 
 static char intf_name[IFNAMSIZ] = quote_str(BRCM_WLAN_IFNAME);
 
@@ -2165,8 +2173,8 @@
 	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);
 
@@ -2296,12 +2304,17 @@
 
 	atomic_dec(&t->wl->callbacks);
 }
-
+#ifdef HAVE_TIMER_SETUP
+static void
+wl_timer(struct timer_list *list)
+{
+	wl_timer_t *t = from_timer(t,list,timer);
+#else
 static void
 wl_timer(ulong data)
 {
 	wl_timer_t *t = (wl_timer_t *)data;
-
+#endif
 	if (!WL_ALL_PASSIVE_ENAB(t->wl))
 		_wl_timer(t);
 	else
@@ -2351,10 +2364,13 @@
 	}
 
 	bzero(t, sizeof(wl_timer_t));
-
+#ifdef HAVE_TIMER_SETUP
+	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;
@@ -2449,6 +2465,9 @@
 {
 	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;
 
@@ -2915,7 +2934,13 @@
 	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
@@ -3335,10 +3360,17 @@
 }
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0)
 static const struct file_operations wl_fops = {
 	.owner	= THIS_MODULE,
 	.read	= wl_proc_read,
 	.write	= wl_proc_write,
+#else
+static const struct proc_ops wl_fops = {
+	.proc_owner  = THIS_MODULE,
+	.proc_read   = wl_proc_read,
+	.proc_write  = wl_proc_write,
+#endif
 };
 #endif
 
diff -Nur a/src/wl/sys/wl_linux.h b/src/wl/sys/wl_linux.h
--- a/src/wl/sys/wl_linux.h	2015-09-18 23:47:30.000000000 +0100
+++ b/src/wl/sys/wl_linux.h	2020-05-16 22:30:16.837073884 +0100
@@ -190,3 +190,7 @@
 extern struct net_device * wl_netdev_get(wl_info_t *wl);
 
 #endif 
+
+#if defined(timer_setup) && defined(from_timer)
+#define HAVE_TIMER_SETUP
+#endif