1 --- a/Makefile 2011-10-22 18:55:54.000000000 +0200
2 +++ b/Makefile 2013-07-05 19:45:48.017337088 +0200
4 ifneq ($(KERNELRELEASE),)
6 LINUXVER_GOODFOR_CFG80211:=$(strip $(shell \
7 - if [ "$(VERSION)" -ge "2" -a "$(PATCHLEVEL)" -ge "6" -a "$(SUBLEVEL)" -ge "32" ]; then \
8 + if [ "$(VERSION)" -ge "3" -o "$(VERSION)" -ge "2" -a "$(PATCHLEVEL)" -ge "6" -a "$(SUBLEVEL)" -ge "32" ]; then \
15 LINUXVER_WEXT_ONLY:=$(strip $(shell \
16 - if [ "$(VERSION)" -ge "2" -a "$(PATCHLEVEL)" -ge "6" -a "$(SUBLEVEL)" -ge "17" ]; then \
17 + if [ "$(VERSION)" -ge "3" -o "$(VERSION)" -ge "2" -a "$(PATCHLEVEL)" -ge "6" -a "$(SUBLEVEL)" -ge "17" ]; then \
21 --- a/src/include/bcmutils.h 2011-10-22 18:55:54.000000000 +0200
22 +++ b/src/include/bcmutils.h 2013-07-05 19:45:48.017337088 +0200
24 extern void prhex(const char *msg, uchar *buf, uint len);
26 extern bcm_tlv_t *BCMROMFN(bcm_next_tlv)(bcm_tlv_t *elt, int *buflen);
27 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
28 extern bcm_tlv_t *BCMROMFN(bcm_parse_tlvs)(void *buf, int buflen, uint key);
30 +extern bcm_tlv_t *BCMROMFN(bcm_parse_tlvs)(const void *buf, int buflen, uint key);
32 extern bcm_tlv_t *BCMROMFN(bcm_parse_ordered_tlvs)(void *buf, int buflen, uint key);
34 extern const char *bcmerrorstr(int bcmerror);
35 --- a/src/wl/sys/wl_cfg80211.c 2011-10-22 18:55:54.000000000 +0200
36 +++ b/src/wl/sys/wl_cfg80211.c 2013-07-05 19:58:00.993999187 +0200
38 enum nl80211_iftype type, u32 *flags, struct vif_params *params);
39 static s32 __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
40 struct cfg80211_scan_request *request, struct cfg80211_ssid *this_ssid);
41 -static s32 wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
42 - struct cfg80211_scan_request *request);
43 +static s32 wl_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request);
44 static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed);
45 static s32 wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
46 struct cfg80211_ibss_params *params);
48 struct cfg80211_connect_params *sme);
49 static s32 wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_code);
51 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
52 -static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy,
53 - enum nl80211_tx_power_setting type, s32 dbm);
55 -static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy,
56 - enum tx_power_setting type, s32 dbm);
58 +static int wl_cfg80211_set_tx_power(struct wiphy *wiphy,
59 + struct wireless_dev *wdev,
60 + enum nl80211_tx_power_setting type, int dbm);
62 -static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm);
63 +static int wl_cfg80211_get_tx_power(struct wiphy *wiphy,
64 + struct wireless_dev *wdev, int *dbm);
66 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
67 static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy,
72 -wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
73 - struct cfg80211_scan_request *request)
74 +wl_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
77 + struct wl_priv *wl = wiphy_to_wl(wiphy);
78 + struct net_device *ndev = wl_to_ndev(wl);
81 err = __wl_cfg80211_scan(wiphy, ndev, request, NULL);
84 memset(&join_params.params.bssid, 0, ETHER_ADDR_LEN);
86 - wl_ch_to_chanspec(params->channel, &join_params, &join_params_size);
87 + wl_ch_to_chanspec(params->chandef.chan, &join_params, &join_params_size);
89 err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size);
91 @@ -1099,16 +1096,10 @@
95 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
97 -wl_cfg80211_set_tx_power(struct wiphy *wiphy, enum nl80211_tx_power_setting type, s32 dbm)
99 -#define NL80211_TX_POWER_AUTOMATIC TX_POWER_AUTOMATIC
100 -#define NL80211_TX_POWER_LIMITED TX_POWER_LIMITED
101 -#define NL80211_TX_POWER_FIXED TX_POWER_FIXED
103 -wl_cfg80211_set_tx_power(struct wiphy *wiphy, enum tx_power_setting type, s32 dbm)
106 +wl_cfg80211_set_tx_power(struct wiphy *wiphy,
107 + struct wireless_dev *wdev,
108 + enum nl80211_tx_power_setting type, int dbm)
111 struct wl_priv *wl = wiphy_to_wl(wiphy);
112 @@ -1155,16 +1146,17 @@
114 wl->conf->tx_power = dbm;
120 -static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm)
121 +static int wl_cfg80211_get_tx_power(struct wiphy *wiphy,
122 + struct wireless_dev *wdev, int *dbm)
124 struct wl_priv *wl = wiphy_to_wl(wiphy);
125 struct net_device *ndev = wl_to_ndev(wl);
132 err = wl_dev_intvar_get(ndev, "qtxpower", &txpwrdbm);
133 @@ -1173,8 +1165,7 @@
136 result = (u8) (txpwrdbm & ~WL_TXPWR_OVERRIDE);
137 - *dbm = (s32) bcm_qdbm_to_mw(result);
139 + *dbm = (int) bcm_qdbm_to_mw(result);
143 @@ -1466,7 +1457,10 @@
145 err = wl_dev_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t));
147 - WL_ERR(("Could not get rssi (%d)\n", err));
148 + if (err != -EINVAL) {
149 + // Don't fill syslog with EINVAL error
150 + WL_ERR(("Could not get rssi (%d)\n", err));
154 rssi = dtoh32(scb_val.val);
155 @@ -1811,7 +1805,7 @@
156 notif_bss_info->frame_len = offsetof(struct ieee80211_mgmt, u.beacon.variable) +
158 freq = ieee80211_channel_to_frequency(notif_bss_info->channel
159 -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
160 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
161 ,(notif_bss_info->channel <= CH_MAX_2G_CHANNEL) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ
164 @@ -2042,9 +2036,10 @@
173 + const struct cfg80211_bss_ies *ies;
175 ssid = &wl->profile->ssid;
176 bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
177 @@ -2074,10 +2069,16 @@
178 beacon_interval = cpu_to_le16(bi->beacon_period);
180 WL_DBG(("Found the AP in the list - BSSID %pM\n", bss->bssid));
181 - ie = bss->information_elements;
182 - ie_len = bss->len_information_elements;
183 + ies = (const struct cfg80211_bss_ies*)rcu_dereference(bss->ies);
185 + /* This should never happen */
187 + goto update_bss_info_out;
190 + ie_len = (size_t)(ies->len);
191 beacon_interval = bss->beacon_interval;
192 - cfg80211_put_bss(bss);
193 + cfg80211_put_bss(wl_to_wiphy(wl), bss);
196 tim = bcm_parse_tlvs(ie, ie_len, WLAN_EID_TIM);
197 --- a/src/wl/sys/wl_iw.h 2011-10-22 18:55:54.000000000 +0200
198 +++ b/src/wl/sys/wl_iw.h 2013-07-05 19:45:48.020670421 +0200
202 #include <linux/wireless.h>
203 +#include <linux/semaphore.h>
205 #include <typedefs.h>
206 #include <proto/ethernet.h>
207 --- a/src/wl/sys/wl_linux.c 2011-10-22 18:55:54.000000000 +0200
208 +++ b/src/wl/sys/wl_linux.c 2013-07-05 19:52:29.540667919 +0200
210 pci_set_drvdata(pdev, NULL);
213 -static struct pci_driver wl_pci_driver = {
214 +static struct pci_driver wl_pci_driver __refdata = {
218 @@ -1579,11 +1578,7 @@
222 - if (!capable(CAP_NET_ADMIN)) {
223 - bcmerror = BCME_EPERM;
225 - bcmerror = wlc_ioctl(wl->wlc, ioc.cmd, buf, ioc.len, wlif->wlcif);
227 + bcmerror = wlc_ioctl(wl->wlc, ioc.cmd, buf, ioc.len, wlif->wlcif);
231 @@ -2960,7 +2955,7 @@
233 wl_tkip_printstats(wl_info_t *wl, bool group_key)
235 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
236 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
239 if (wl->tkipmodops) {
240 @@ -3120,6 +3115,7 @@
244 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
245 wl_proc_read(char *buffer, char **start, off_t offset, int length, int *eof, void *data)
247 wl_info_t * wl = (wl_info_t *)data;
248 @@ -3120,19 +3115,86 @@
253 +wl_proc_read(struct seq_file *seq, void *offset)
255 + wl_info_t * wl = (wl_info_t *)seq->private;
256 + int bcmerror, to_user;
259 + bcmerror = wlc_ioctl(wl->wlc, WLC_GET_MONITOR, &to_user, sizeof(int), NULL);
262 + seq_printf(seq, "%d\n", to_user);
266 +static ssize_t wl_proc_write(struct file *file, const char __user *buff,
267 + size_t length, loff_t *ppos)
269 + struct seq_file *seq = file->private_data;
270 + wl_info_t * wl = (wl_info_t *)seq->private;
271 + int bcmerror, from_user = 0;
274 + WL_ERROR(("%s: Invalid data length\n", __FUNCTION__));
278 + if (copy_from_user(&from_user, buff, 1)) {
279 + WL_ERROR(("%s: copy from user failed\n", __FUNCTION__));
283 + if (from_user >= 0x30)
287 + bcmerror = wlc_ioctl(wl->wlc, WLC_SET_MONITOR, &from_user, sizeof(int), NULL);
290 + if (bcmerror < 0) {
291 + WL_ERROR(("%s: SET_MONITOR failed with %d\n", __FUNCTION__, bcmerror));
298 +static int wl_proc_open(struct inode *inode, struct file *file)
300 + return single_open(file, wl_proc_read, PDE_DATA(inode));
303 +static const struct file_operations wl_proc_fops = {
304 + .owner = THIS_MODULE,
305 + .open = wl_proc_open,
307 + .write = wl_proc_write,
308 + .llseek = seq_lseek,
309 + .release = single_release,
314 wl_reg_proc_entry(wl_info_t *wl)
317 sprintf(tmp, "%s%d", HYBRID_PROC, wl->pub->unit);
318 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
319 if ((wl->proc_entry = create_proc_entry(tmp, 0644, NULL)) == NULL) {
321 + wl->proc_entry = proc_create_data(tmp, 0644, NULL, &wl_proc_fops, wl);
322 + if (!wl->proc_entry) {
324 WL_ERROR(("%s: create_proc_entry %s failed\n", __FUNCTION__, tmp));
328 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
329 wl->proc_entry->read_proc = wl_proc_read;
330 wl->proc_entry->write_proc = wl_proc_write;
331 wl->proc_entry->data = wl;