1
From 3b382faf0a779f376beac577bb015bd0d6d12581 Mon Sep 17 00:00:00 2001
2
From: Alberto Milone <alberto.milone@canonical.com>
3
Date: Tue, 8 Jan 2013 12:41:52 +0100
4
Subject: [PATCH 1/1] Add support for Linux 3.8
6
struct cfg80211_bss has changed, therefore we need to access
7
the equivalents of the now gone struct members information_elements
8
and len_information_elements. In order to do so, we need to
9
access struct cfg80211_bss_ies through its pointer using
10
rcu_dereference(), after calling rcu_read_lock().
12
src/include/bcmutils.h | 4 +++
13
src/wl/sys/wl_cfg80211.c | 61 ++++++++++++++++++++++++++++++++++++++++++++--
14
src/wl/sys/wl_linux.c | 4 +++
15
3 files changed, 67 insertions(+), 2 deletions(-)
17
diff --git a/src/include/bcmutils.h b/src/include/bcmutils.h
18
index f806b5e..3633328 100644
19
--- a/src/include/bcmutils.h
20
+++ b/src/include/bcmutils.h
21
@@ -214,7 +214,11 @@ typedef struct bcm_tlv {
22
extern int bcm_format_flags(const bcm_bit_desc_t *bd, uint32 flags, char* buf, int len);
23
extern int bcm_format_hex(char *str, const void *bytes, int len);
25
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
26
extern bcm_tlv_t *BCMROMFN(bcm_parse_tlvs)(void *buf, int buflen, uint key);
28
+extern bcm_tlv_t *BCMROMFN(bcm_parse_tlvs)(const void *buf, int buflen, uint key);
33
diff --git a/src/wl/sys/wl_cfg80211.c b/src/wl/sys/wl_cfg80211.c
34
index 796e3a9..1de1317 100644
35
--- a/src/wl/sys/wl_cfg80211.c
36
+++ b/src/wl/sys/wl_cfg80211.c
37
@@ -61,14 +61,25 @@ static int wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
38
static s32 wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_code);
40
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
41
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
42
static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy,
43
enum nl80211_tx_power_setting type, s32 dbm);
45
+static int wl_cfg80211_set_tx_power(struct wiphy *wiphy,
46
+ struct wireless_dev *wdev,
47
+ enum nl80211_tx_power_setting type, int dbm);
50
static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy,
51
enum tx_power_setting type, s32 dbm);
54
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
55
static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm);
57
+static int wl_cfg80211_get_tx_power(struct wiphy *wiphy,
58
+ struct wireless_dev *wdev, int *dbm);
61
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
62
static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy,
63
@@ -702,7 +713,11 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
65
memset(&join_params.params.bssid, 0, ETHER_ADDR_LEN);
67
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
68
wl_ch_to_chanspec(params->channel, &join_params, &join_params_size);
70
+ wl_ch_to_chanspec(params->chandef.chan, &join_params, &join_params_size);
73
err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size);
75
@@ -1057,9 +1072,15 @@ wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_c
78
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
79
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
81
wl_cfg80211_set_tx_power(struct wiphy *wiphy, enum nl80211_tx_power_setting type, s32 dbm)
84
+wl_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
85
+ enum nl80211_tx_power_setting type, int dbm)
88
#define NL80211_TX_POWER_AUTOMATIC TX_POWER_AUTOMATIC
89
#define NL80211_TX_POWER_LIMITED TX_POWER_LIMITED
90
#define NL80211_TX_POWER_FIXED TX_POWER_FIXED
91
@@ -1110,24 +1131,41 @@ wl_cfg80211_set_tx_power(struct wiphy *wiphy, enum tx_power_setting type, s32 db
93
wl->conf->tx_power = dbm;
95
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
102
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
103
static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm)
105
+static int wl_cfg80211_get_tx_power(struct wiphy *wiphy,
106
+ struct wireless_dev *wdev, int *dbm)
109
struct wl_cfg80211_priv *wl = wiphy_to_wl(wiphy);
110
struct net_device *ndev = wl_to_ndev(wl);
113
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
119
err = wl_dev_intvar_get(ndev, "qtxpower", &txpwrdbm);
121
WL_ERR(("error (%d)\n", err));
124
result = (u8) (txpwrdbm & ~WL_TXPWR_OVERRIDE);
126
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
127
*dbm = (s32) bcm_qdbm_to_mw(result);
129
+ *dbm = (int) bcm_qdbm_to_mw(result);
134
@@ -1957,9 +1995,14 @@ static s32 wl_update_bss_info(struct wl_cfg80211_priv *wl)
135
struct wlc_ssid *ssid;
140
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
145
+ const struct cfg80211_bss_ies *ies;
148
ssid = &wl->profile->ssid;
149
bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
150
@@ -1988,8 +2031,22 @@ static s32 wl_update_bss_info(struct wl_cfg80211_priv *wl)
151
ie_len = bi->ie_length;
153
WL_DBG(("Found the AP in the list - BSSID %pM\n", bss->bssid));
154
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
155
ie = bss->information_elements;
156
ie_len = bss->len_information_elements;
159
+ ies = (const struct cfg80211_bss_ies*)rcu_dereference(bss->ies);
161
+ /* This should never happen */
164
+ goto update_bss_info_out;
167
+ ie_len = (size_t)(ies->len);
170
cfg80211_put_bss(bss);
173
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
174
index f64496b..db54455 100644
175
--- a/src/wl/sys/wl_linux.c
176
+++ b/src/wl/sys/wl_linux.c
177
@@ -735,7 +735,11 @@ wl_remove(struct pci_dev *pdev)
178
pci_set_drvdata(pdev, NULL);
181
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
182
static struct pci_driver wl_pci_driver = {
184
+static struct pci_driver wl_pci_driver __refdata = {