git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #7710 from cstrahan/broadcom-sta-patches

broadcom-sta: fixes for kernel version >= 3.18

commit398a23d94fa2c253c79fce36e5dc3a47a93e311e authorCharles Strahan <charles.c.strahan@gmail.com> dateTue 5 May 2015, 17:21 (12 years ago) parent825fbc14d3be75
6 files changed+387−56
pkgs/os-specific/linux/broadcom-sta/cfg80211_ibss_joined-channel-parameter.patch−17 pkgs/os-specific/linux/broadcom-sta/cfg80211_inform_bss-3.18.patch−21 pkgs/os-specific/linux/broadcom-sta/default.nix+2−3 pkgs/os-specific/linux/broadcom-sta/gcc.patch+11 pkgs/os-specific/linux/broadcom-sta/linux-recent.patch+374 pkgs/os-specific/linux/broadcom-sta/netdev-3.17.patch−15
pkgs/os-specific/linux/broadcom-sta/cfg80211_ibss_joined-channel-parameter.patchdeleted−17
@@ -1,17 +0,0 @@
1−Add channel parameter to cfg80211_ibss_joined call
2−
3−--- a/src/wl/sys/wl_cfg80211_hybrid.c
4−+++ b/src/wl/sys/wl_cfg80211_hybrid.c
5−@@ -1841,7 +1841,12 @@ wl_notify_connect_status(struct wl_cfg80211_priv *wl, struct net_device *ndev,
6− wl_get_assoc_ies(wl);
7− memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN);
8− wl_update_bss_info(wl);
9−+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)
10− cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid, GFP_KERNEL);
11−+#else
12−+ cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid,
13−+ &wl->conf->channel, GFP_KERNEL);
14−+#endif
15− set_bit(WL_STATUS_CONNECTED, &wl->status);
16− wl->profile->active = true;
17− }
pkgs/os-specific/linux/broadcom-sta/cfg80211_inform_bss-3.18.patchdeleted−21
@@ -1,21 +0,0 @@
1−Found on a random place http://web.archiveorange.com/archive/v/CcRuxYExfvTxfKcBFLah
2−Nicolas Viéville, Oct 27 2014
3−diff -Naur hybrid-v35_64-nodebug-pcoem-6_30_223_248.orig/src/wl/sys/wl_cfg80211_hybrid.c hybrid-v35_64-nodebug-pcoem-6_30_223_248/src/wl/sys/wl_cfg80211_hybrid.c
4−--- hybrid-v35_64-nodebug-pcoem-6_30_223_248.orig/src/wl/sys/wl_cfg80211_hybrid.c 2014-09-10 19:27:13.301316000 +0200
5−+++ hybrid-v35_64-nodebug-pcoem-6_30_223_248/src/wl/sys/wl_cfg80211_hybrid.c 2014-10-27 11:21:58.213536239 +0100
6−@@ -2025,7 +2025,15 @@
7− notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
8− notify_ielen = le32_to_cpu(bi->ie_length);
9−+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
10−+ cbss = cfg80211_inform_bss(wiphy, channel,
11−+ (mgmt_type == IEEE80211_STYPE_PROBE_RESP) ? CFG80211_BSS_FTYPE_PRESP : CFG80211_BSS_FTYPE_BEACON,
12−+ (const u8 *)(bi->BSSID.octet),
13−+ 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int,
14−+ (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
15−+#else
16− cbss = cfg80211_inform_bss(wiphy, channel, (const u8 *)(bi->BSSID.octet),
17− 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int,
18− (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
19−+#endif
20− if (unlikely(!cbss))
21− return -ENOMEM;
pkgs/os-specific/linux/broadcom-sta/default.nix+2−3
@@ -18,9 +18,8 @@ stdenv.mkDerivation {
1818
1919 patches = [
2020 ./license.patch
21− ./cfg80211_ibss_joined-channel-parameter.patch
22− ./netdev-3.17.patch
23− ./cfg80211_inform_bss-3.18.patch
21+ ./linux-recent.patch
22+ ./gcc.patch
2423 ];
2524
2625 makeFlags = "KBASE=${kernel.dev}/lib/modules/${kernel.modDirVersion}";
pkgs/os-specific/linux/broadcom-sta/gcc.patchnew file+11
@@ -0,0 +1,11 @@
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`
pkgs/os-specific/linux/broadcom-sta/linux-recent.patchnew file+374
@@ -0,0 +1,374 @@
1+--- a/src/wl/sys/wl_cfg80211_hybrid.c 2014-06-26 12:42:08.000000000 +0200
2++++ b/src/wl/sys/wl_cfg80211_hybrid.c 2015-04-13 13:20:08.140013177 +0200
3+@@ -63,8 +63,13 @@
4+ static s32 wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
5+ struct cfg80211_ibss_params *params);
6+ static s32 wl_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev);
7++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)
8+ static s32 wl_cfg80211_get_station(struct wiphy *wiphy,
9+ struct net_device *dev, u8 *mac, struct station_info *sinfo);
10++#else
11++static s32 wl_cfg80211_get_station(struct wiphy *wiphy,
12++ struct net_device *dev, const u8 *mac, struct station_info *sinfo);
13++#endif
14+ static s32 wl_cfg80211_set_power_mgmt(struct wiphy *wiphy,
15+ struct net_device *dev, bool enabled, s32 timeout);
16+ static int wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
17+@@ -1387,7 +1392,7 @@
18+ key_endian_to_host(&key);
19+
20+ params.key_len = (u8) min_t(u8, DOT11_MAX_KEY_SIZE, key.len);
21+- memcpy(params.key, key.data, params.key_len);
22++ memcpy((char *)params.key, key.data, params.key_len);
23+
24+ if ((err = wl_dev_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec)))) {
25+ return err;
26+@@ -1421,9 +1426,15 @@
27+ return err;
28+ }
29+
30++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)
31+ static s32
32+ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
33+ u8 *mac, struct station_info *sinfo)
34++#else
35++static s32
36++wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
37++ const u8 *mac, struct station_info *sinfo)
38++#endif
39+ {
40+ struct wl_cfg80211_priv *wl = wiphy_to_wl(wiphy);
41+ scb_val_t scb_val;
42+@@ -1441,7 +1452,11 @@
43+ WL_DBG(("Could not get rate (%d)\n", err));
44+ } else {
45+ rate = dtoh32(rate);
46++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
47+ sinfo->filled |= STATION_INFO_TX_BITRATE;
48++#else
49++ sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
50++#endif
51+ sinfo->txrate.legacy = rate * 5;
52+ WL_DBG(("Rate %d Mbps\n", (rate / 2)));
53+ }
54+@@ -1454,7 +1469,11 @@
55+ return err;
56+ }
57+ rssi = dtoh32(scb_val.val);
58++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
59+ sinfo->filled |= STATION_INFO_SIGNAL;
60++#else
61++ sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
62++#endif
63+ sinfo->signal = rssi;
64+ WL_DBG(("RSSI %d dBm\n", rssi));
65+ }
66+@@ -2010,9 +2029,15 @@
67+
68+ notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
69+ notify_ielen = le32_to_cpu(bi->ie_length);
70++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
71+ cbss = cfg80211_inform_bss(wiphy, channel, (const u8 *)(bi->BSSID.octet),
72+ 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int,
73+ (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
74++#else
75++ cbss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, (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++#endif
79+
80+ if (unlikely(!cbss))
81+ return -ENOMEM;
82+@@ -2071,7 +2096,26 @@
83+ wl_get_assoc_ies(wl);
84+ memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN);
85+ wl_update_bss_info(wl);
86++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
87++ {
88++ struct wl_bss_info *bi;
89++ u16 bss_info_channel;
90++ struct ieee80211_channel *channel;
91++ u32 freq;
92++
93++ bi = (struct wl_bss_info *)(wl->extra_buf + 4);
94++ bss_info_channel = bi->ctl_ch ? bi->ctl_ch : CHSPEC_CHANNEL(bi->chanspec);
95++
96++ freq = ieee80211_channel_to_frequency(bss_info_channel,
97++ (bss_info_channel <= CH_MAX_2G_CHANNEL) ?
98++ IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ);
99++
100++ channel = ieee80211_get_channel(wl_to_wiphy(wl), freq);
101++ cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid, channel, GFP_KERNEL);
102++ }
103++#else
104+ cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid, GFP_KERNEL);
105++#endif
106+ set_bit(WL_STATUS_CONNECTED, &wl->status);
107+ wl->profile->active = true;
108+ }
109+@@ -2629,7 +2673,15 @@
110+
111+ void wl_cfg80211_detach(struct net_device *ndev)
112+ {
113+- struct wl_cfg80211_priv *wl = ndev_to_wl(ndev);
114++ struct wl_cfg80211_priv *wl;
115++ struct wireless_dev *wdev;
116++
117++ wdev = ndev->ieee80211_ptr;
118++ if (wdev == NULL) {
119++ printk(KERN_ERR "[%s()] in ndev=%p: IEEE80211ptr=%p\n", __FUNCTION__, ndev, wdev);
120++ return;
121++ }
122++ wl = ndev_to_wl(ndev);
123+
124+ wl_deinit_cfg80211_priv(wl);
125+ wl_free_wdev(wl);
126+--- a/src/wl/sys/wl_dbg.h 2014-06-26 12:42:08.000000000 +0200
127++++ b/src/wl/sys/wl_dbg.h 2015-04-13 13:19:52.443345832 +0200
128+@@ -55,10 +55,12 @@
129+
130+ #define WL_NONE(args)
131+
132++#define FORCE_TRACE_LEVEL(fmt, ...) do { printk(KERN_ERR fmt, ## __VA_ARGS__); } while (0) /* ## is GCC specific syntax to remove comma when single arg */
133++
134+ #ifdef BCMDBG_ERR
135+ #define WL_ERROR(args) WL_PRINT(args)
136+ #else
137+-#define WL_ERROR(args)
138++#define WL_ERROR(args) FORCE_TRACE_LEVEL args
139+ #endif
140+ #define WL_TRACE(args)
141+ #define WL_APSTA_UPDN(args)
142+--- a/src/wl/sys/wl_linux.c 2014-06-26 12:42:08.000000000 +0200
143++++ b/src/wl/sys/wl_linux.c 2015-04-13 13:19:52.443345832 +0200
144+@@ -878,7 +878,7 @@
145+ static SIMPLE_DEV_PM_OPS(wl_pm_ops, wl_suspend, wl_resume);
146+ #endif
147+
148+-static struct pci_driver wl_pci_driver = {
149++static struct pci_driver wl_pci_driver __refdata = {
150+ .name = "wl",
151+ .probe = wl_pci_probe,
152+ .remove = __devexit_p(wl_remove),
153+@@ -1270,6 +1270,7 @@
154+ MFREE(wl->osh, wlif->dev, sizeof(struct net_device));
155+ #else
156+ free_netdev(wlif->dev);
157++ wlif->dev = NULL;
158+ #endif
159+ }
160+
161+@@ -1307,7 +1308,12 @@
162+ dev->priv = priv_link;
163+ #else
164+
165++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0))
166+ dev = alloc_netdev(sizeof(priv_link_t), intf_name, ether_setup);
167++#else
168++ dev = alloc_netdev(sizeof(priv_link_t), intf_name, NET_NAME_UNKNOWN,
169++ ether_setup);
170++#endif
171+ if (!dev) {
172+ WL_ERROR(("wl%d: %s: alloc_netdev failed\n",
173+ (wl->pub)?wl->pub->unit:wlif->subunit, __FUNCTION__));
174+@@ -1651,11 +1657,7 @@
175+ }
176+
177+ WL_LOCK(wl);
178+- if (!capable(CAP_NET_ADMIN)) {
179+- bcmerror = BCME_EPERM;
180+- } else {
181+- bcmerror = wlc_ioctl(wl->wlc, ioc.cmd, buf, ioc.len, wlif->wlcif);
182+- }
183++ bcmerror = wlc_ioctl(wl->wlc, ioc.cmd, buf, ioc.len, wlif->wlcif);
184+ WL_UNLOCK(wl);
185+
186+ done1:
187+@@ -2157,8 +2159,8 @@
188+ wlif = WL_DEV_IF(dev);
189+ wl = WL_INFO(dev);
190+
191++ skb->prev = NULL;
192+ if (WL_ALL_PASSIVE_ENAB(wl) || (WL_RTR() && WL_CONFIG_SMP())) {
193+- skb->prev = NULL;
194+
195+ TXQ_LOCK(wl);
196+
197+@@ -2455,8 +2457,10 @@
198+ p80211msg_t *phdr;
199+
200+ len = sizeof(p80211msg_t) + oskb->len - D11_PHY_HDR_LEN;
201+- if ((skb = dev_alloc_skb(len)) == NULL)
202++ if ((skb = dev_alloc_skb(len)) == NULL) {
203++ WL_ERROR(("in %s:%d [%s()] dev_alloc_skb() failure!", __FILE__, __LINE__, __FUNCTION__));
204+ return;
205++ }
206+
207+ skb_put(skb, len);
208+ phdr = (p80211msg_t*)skb->data;
209+@@ -2535,8 +2539,10 @@
210+ rtap_len = sizeof(wl_radiotap_ht_brcm_2_t);
211+
212+ len = rtap_len + (oskb->len - D11_PHY_HDR_LEN);
213+- if ((skb = dev_alloc_skb(len)) == NULL)
214++ if ((skb = dev_alloc_skb(len)) == NULL) {
215++ WL_ERROR(("in %s:%d [%s()] dev_alloc_skb() failure!", __FILE__, __LINE__, __FUNCTION__));
216+ return;
217++ }
218+
219+ skb_put(skb, len);
220+
221+@@ -2664,8 +2670,10 @@
222+ len += amsdu_len;
223+ }
224+
225+- if ((skb = dev_alloc_skb(len)) == NULL)
226++ if ((skb = dev_alloc_skb(len)) == NULL) {
227++ WL_ERROR(("in %s:%d [%s()] dev_alloc_skb() failure!", __FILE__, __LINE__, __FUNCTION__));
228+ return;
229++ }
230+
231+ skb_put(skb, len);
232+
233+@@ -2990,7 +2998,7 @@
234+ }
235+
236+ void
237+-wl_set_monitor(wl_info_t *wl, int val)
238++wl_set_monitor(wl_info_t *wl, int val) /* public => is called by wlc_hybrid.o_shipped */
239+ {
240+ const char *devname;
241+ wl_if_t *wlif;
242+@@ -3224,42 +3232,75 @@
243+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
244+ static int
245+ wl_proc_read(char *buffer, char **start, off_t offset, int length, int *eof, void *data)
246++{
247++ wl_info_t * wl = (wl_info_t *)data;
248+ #else
249+ static ssize_t
250+-wl_proc_read(struct file *filp, char __user *buffer, size_t length, loff_t *data)
251+-#endif
252++wl_proc_read(struct file *filp, char __user *buffer, size_t length, loff_t *offp)
253+ {
254+- wl_info_t * wl = (wl_info_t *)data;
255+- int to_user;
256+- int len;
257++ wl_info_t * wl = PDE_DATA(file_inode(filp));
258++#endif
259++ int bcmerror, len;
260++ int to_user = 0;
261++ char tmp[8];
262+
263+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
264+ if (offset > 0) {
265+ *eof = 1;
266+ return 0;
267+ }
268++#else
269++ if (*offp > 0) { /* for example, stop: cat /proc/brcm_monitor0 */
270++ return 0; /* 0 <=> EOF */
271++ }
272+ #endif
273+
274+- if (!length) {
275+- WL_ERROR(("%s: Not enough return buf space\n", __FUNCTION__));
276+- return 0;
277+- }
278+ WL_LOCK(wl);
279+- wlc_ioctl(wl->wlc, WLC_GET_MONITOR, &to_user, sizeof(int), NULL);
280+- len = sprintf(buffer, "%d\n", to_user);
281+- WL_UNLOCK(wl);
282+- return len;
283++ bcmerror = wlc_ioctl(wl->wlc, WLC_GET_MONITOR, &to_user, sizeof(int), NULL);
284++ WL_UNLOCK(wl);
285++
286++ if (bcmerror != BCME_OK) {
287++ WL_ERROR(("%s: GET_MONITOR failed with %d\n", __FUNCTION__, bcmerror));
288++ return -EIO;
289++ }
290++
291++ len = snprintf(tmp, ARRAY_SIZE(tmp), "%d\n", to_user);
292++ tmp[ARRAY_SIZE(tmp) - 1] = '\0';
293++ if (len >= ARRAY_SIZE(tmp)) {
294++ printk(KERN_ERR "%s:%d [%s()] output would be truncated (ret=%d)!", __FILE__, __LINE__, __FUNCTION__, len);
295++ return -ERANGE;
296++ }
297++ else if (len < 0) {
298++ printk(KERN_ERR "%s:%d [%s()] unable to convert value (ret=%d)!", __FILE__, __LINE__, __FUNCTION__, len);
299++ return len;
300++ }
301++ if (length < len) {
302++ printk(KERN_ERR "%s:%d [%s()] user buffer is too small (at least=%d ; user=%d)!", __FILE__, __LINE__, __FUNCTION__, len, (int)length);
303++ return -EMSGSIZE;
304++ }
305++ if (copy_to_user(buffer, tmp, len) != 0) {
306++ printk(KERN_ERR "%s:%d [%s()] unable to copy data!", __FILE__, __LINE__, __FUNCTION__);
307++ return -EFAULT;
308++ }
309++
310++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
311++ *offp += len;
312++#endif
313++
314++ return len;
315+ }
316+
317+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
318+ static int
319+ wl_proc_write(struct file *filp, const char *buff, unsigned long length, void *data)
320++{
321++ wl_info_t * wl = (wl_info_t *)data;
322+ #else
323+ static ssize_t
324+-wl_proc_write(struct file *filp, const char __user *buff, size_t length, loff_t *data)
325+-#endif
326++wl_proc_write(struct file *filp, const char __user *buff, size_t length, loff_t *offp)
327+ {
328+- wl_info_t * wl = (wl_info_t *)data;
329++ wl_info_t * wl = PDE_DATA(file_inode(filp));
330++#endif
331+ int from_user = 0;
332+ int bcmerror;
333+
334+@@ -3270,7 +3311,11 @@
335+ }
336+ if (copy_from_user(&from_user, buff, 1)) {
337+ WL_ERROR(("%s: copy from user failed\n", __FUNCTION__));
338+- return -EIO;
339++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
340++ return -EIO;
341++#else
342++ return -EFAULT;
343++#endif
344+ }
345+
346+ if (from_user >= 0x30)
347+@@ -3280,10 +3325,15 @@
348+ bcmerror = wlc_ioctl(wl->wlc, WLC_SET_MONITOR, &from_user, sizeof(int), NULL);
349+ WL_UNLOCK(wl);
350+
351+- if (bcmerror < 0) {
352++ if (bcmerror != BCME_OK) {
353+ WL_ERROR(("%s: SET_MONITOR failed with %d\n", __FUNCTION__, bcmerror));
354+ return -EIO;
355+ }
356++
357++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) && 0 /* no need to update offset because this file should only trigger action... */
358++ *offp += length;
359++#endif
360++
361+ return length;
362+ }
363+
364+@@ -3304,8 +3354,8 @@
365+ if ((wl->proc_entry = create_proc_entry(tmp, 0644, NULL)) == NULL) {
366+ WL_ERROR(("%s: create_proc_entry %s failed\n", __FUNCTION__, tmp));
367+ #else
368+- if ((wl->proc_entry = proc_create(tmp, 0644, NULL, &wl_fops)) == NULL) {
369+- WL_ERROR(("%s: proc_create %s failed\n", __FUNCTION__, tmp));
370++ if ((wl->proc_entry = proc_create_data(tmp, 0644, NULL, &wl_fops, wl)) == NULL) {
371++ WL_ERROR(("%s: proc_create_data %s failed\n", __FUNCTION__, tmp));
372+ #endif
373+ ASSERT(0);
374+ return -1;
pkgs/os-specific/linux/broadcom-sta/netdev-3.17.patchdeleted−15
@@ -1,15 +0,0 @@
1−diff -Naur a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
2−--- a/src/wl/sys/wl_linux.c 2014-06-26 06:42:08.000000000 -0400
3−+++ b/src/wl/sys/wl_linux.c 2014-10-13 12:00:04.446122588 -0400
4−@@ -1307,7 +1307,11 @@
5− dev->priv = priv_link;
6− #else
7−
8−+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)
9−+ dev = alloc_netdev(sizeof(priv_link_t), intf_name, NET_NAME_UNKNOWN, ether_setup);
10−+#else
11− dev = alloc_netdev(sizeof(priv_link_t), intf_name, ether_setup);
12−+#endif
13− if (!dev) {
14− WL_ERROR(("wl%d: %s: alloc_netdev failed\n",
15− (wl->pub)?wl->pub->unit:wlif->subunit, __FUNCTION__));