bcm_sta: add patch to support kernel 3.8

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2013-03-26 22:24:14 +01:00
parent 452ccd8b64
commit 28ff7abd08

View File

@ -0,0 +1,158 @@
From 00da4982e9175921cfb26d1377bf49ece3bb41cb Mon Sep 17 00:00:00 2001
From: Stefan Saraev <stefan@saraev.ca>
Date: Tue, 26 Mar 2013 23:10:17 +0200
Subject: [PATCH] linux 3.8 support
---
x86-32/src/include/bcmutils.h | 5 +++++
x86-32/src/wl/sys/wl_cfg80211.c | 25 ++++++++++++++++++++++++-
x86-64/src/include/bcmutils.h | 4 ++++
x86-64/src/wl/sys/wl_cfg80211.c | 25 ++++++++++++++++++++++++-
4 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/x86-32/src/include/bcmutils.h b/x86-32/src/include/bcmutils.h
index fa6df04..9a8cab4 100644
--- a/x86-32/src/include/bcmutils.h
+++ b/x86-32/src/include/bcmutils.h
@@ -555,7 +555,12 @@ extern void printbig(char *buf);
extern void prhex(const char *msg, uchar *buf, uint len);
extern bcm_tlv_t *BCMROMFN(bcm_next_tlv)(bcm_tlv_t *elt, int *buflen);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
extern bcm_tlv_t *BCMROMFN(bcm_parse_tlvs)(void *buf, int buflen, uint key);
+#else
+extern bcm_tlv_t *BCMROMFN(bcm_parse_tlvs)(const void *buf, int buflen, uint key);
+#endif
+
extern bcm_tlv_t *BCMROMFN(bcm_parse_ordered_tlvs)(void *buf, int buflen, uint key);
extern const char *bcmerrorstr(int bcmerror);
diff --git a/x86-32/src/wl/sys/wl_cfg80211.c b/x86-32/src/wl/sys/wl_cfg80211.c
index 09d04ed..698b004 100644
--- a/x86-32/src/wl/sys/wl_cfg80211.c
+++ b/x86-32/src/wl/sys/wl_cfg80211.c
@@ -744,7 +744,11 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
else
memset(&join_params.params.bssid, 0, ETHER_ADDR_LEN);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
wl_ch_to_chanspec(params->channel, &join_params, &join_params_size);
+#else
+ wl_ch_to_chanspec(params->chandef.chan, &join_params, &join_params_size);
+#endif
err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size);
if (err) {
@@ -2047,9 +2051,14 @@ static s32 wl_update_bss_info(struct wl_priv *wl)
struct bcm_tlv *tim;
u16 beacon_interval;
s32 dtim_period;
+ s32 err = 0;
size_t ie_len;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
u8 *ie;
- s32 err = 0;
+#else
+ const u8 *ie;
+ const struct cfg80211_bss_ies *ies;
+#endif
ssid = &wl->profile->ssid;
bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
@@ -2079,8 +2088,22 @@ static s32 wl_update_bss_info(struct wl_priv *wl)
beacon_interval = cpu_to_le16(bi->beacon_period);
} else {
WL_DBG(("Found the AP in the list - BSSID %pM\n", bss->bssid));
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
ie = bss->information_elements;
ie_len = bss->len_information_elements;
+#else
+ rcu_read_lock();
+ ies = (const struct cfg80211_bss_ies*)rcu_dereference(bss->ies);
+ if (!ies) {
+ /* This should never happen */
+ rcu_read_unlock();
+ err = -EIO;
+ goto update_bss_info_out;
+ }
+ ie = ies->data;
+ ie_len = (size_t)(ies->len);
+ rcu_read_unlock();
+#endif
beacon_interval = bss->beacon_interval;
cfg80211_put_bss(bss);
}
diff --git a/x86-64/src/include/bcmutils.h b/x86-64/src/include/bcmutils.h
index fa6df04..1200bf0 100644
--- a/x86-64/src/include/bcmutils.h
+++ b/x86-64/src/include/bcmutils.h
@@ -555,7 +555,11 @@ extern void printbig(char *buf);
extern void prhex(const char *msg, uchar *buf, uint len);
extern bcm_tlv_t *BCMROMFN(bcm_next_tlv)(bcm_tlv_t *elt, int *buflen);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
extern bcm_tlv_t *BCMROMFN(bcm_parse_tlvs)(void *buf, int buflen, uint key);
+#else
+extern bcm_tlv_t *BCMROMFN(bcm_parse_tlvs)(const void *buf, int buflen, uint key);
+#endif
extern bcm_tlv_t *BCMROMFN(bcm_parse_ordered_tlvs)(void *buf, int buflen, uint key);
extern const char *bcmerrorstr(int bcmerror);
diff --git a/x86-64/src/wl/sys/wl_cfg80211.c b/x86-64/src/wl/sys/wl_cfg80211.c
index 94aac25..244243f 100644
--- a/x86-64/src/wl/sys/wl_cfg80211.c
+++ b/x86-64/src/wl/sys/wl_cfg80211.c
@@ -744,7 +744,11 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
else
memset(&join_params.params.bssid, 0, ETHER_ADDR_LEN);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
wl_ch_to_chanspec(params->channel, &join_params, &join_params_size);
+#else
+ wl_ch_to_chanspec(params->chandef.chan, &join_params, &join_params_size);
+#endif
err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size);
if (err) {
@@ -2047,9 +2051,14 @@ static s32 wl_update_bss_info(struct wl_priv *wl)
struct bcm_tlv *tim;
u16 beacon_interval;
s32 dtim_period;
+ s32 err = 0;
size_t ie_len;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
u8 *ie;
- s32 err = 0;
+#else
+ const u8 *ie;
+ const struct cfg80211_bss_ies *ies;
+#endif
ssid = &wl->profile->ssid;
bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
@@ -2079,8 +2088,22 @@ static s32 wl_update_bss_info(struct wl_priv *wl)
beacon_interval = cpu_to_le16(bi->beacon_period);
} else {
WL_DBG(("Found the AP in the list - BSSID %pM\n", bss->bssid));
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
ie = bss->information_elements;
ie_len = bss->len_information_elements;
+#else
+ rcu_read_lock();
+ ies = (const struct cfg80211_bss_ies*)rcu_dereference(bss->ies);
+ if (!ies) {
+ /* This should never happen */
+ rcu_read_unlock();
+ err = -EIO;
+ goto update_bss_info_out;
+ }
+ ie = ies->data;
+ ie_len = (size_t)(ies->len);
+ rcu_read_unlock();
+#endif
beacon_interval = bss->beacon_interval;
cfg80211_put_bss(bss);
}
--
1.7.2.5