Skip to content

Instantly share code, notes, and snippets.

@holmosapien
Created January 24, 2017 04:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save holmosapien/5fbd37376aab2f03fb632f7361b8739a to your computer and use it in GitHub Desktop.
Save holmosapien/5fbd37376aab2f03fb632f7361b8739a to your computer and use it in GitHub Desktop.
Patch for the Broadcom STA wireless driver to work with the Linux 4.9 kernel
Driver: https://docs.broadcom.com/docs-and-downloads/docs/linux_sta/hybrid-v35_64-nodebug-pcoem-6_30_223_271.tar.gz
diff -r -c a/src/shared/linux_osl.c b/src/shared/linux_osl.c
*** a/src/shared/linux_osl.c Fri Sep 18 17:47:30 2015
--- b/src/shared/linux_osl.c Mon Jan 23 16:54:36 2017
***************
*** 932,938 ****
--- 932,942 ----
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 -r -c a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
*** a/src/wl/sys/wl_cfg80211_hybrid.c Fri Sep 18 17:47:30 2015
--- b/src/wl/sys/wl_cfg80211_hybrid.c Mon Jan 23 17:00:36 2017
***************
*** 236,242 ****
#endif
#define CHAN2G(_channel, _freq, _flags) { \
! .band = IEEE80211_BAND_2GHZ, \
.center_freq = (_freq), \
.hw_value = (_channel), \
.flags = (_flags), \
--- 236,242 ----
#endif
#define CHAN2G(_channel, _freq, _flags) { \
! .band = NL80211_BAND_2GHZ, \
.center_freq = (_freq), \
.hw_value = (_channel), \
.flags = (_flags), \
***************
*** 245,251 ****
}
#define CHAN5G(_channel, _flags) { \
! .band = IEEE80211_BAND_5GHZ, \
.center_freq = 5000 + (5 * (_channel)), \
.hw_value = (_channel), \
.flags = (_flags), \
--- 245,251 ----
}
#define CHAN5G(_channel, _flags) { \
! .band = NL80211_BAND_5GHZ, \
.center_freq = 5000 + (5 * (_channel)), \
.hw_value = (_channel), \
.flags = (_flags), \
***************
*** 379,385 ****
};
static struct ieee80211_supported_band __wl_band_2ghz = {
! .band = IEEE80211_BAND_2GHZ,
.channels = __wl_2ghz_channels,
.n_channels = ARRAY_SIZE(__wl_2ghz_channels),
.bitrates = wl_g_rates,
--- 379,385 ----
};
static struct ieee80211_supported_band __wl_band_2ghz = {
! .band = NL80211_BAND_2GHZ,
.channels = __wl_2ghz_channels,
.n_channels = ARRAY_SIZE(__wl_2ghz_channels),
.bitrates = wl_g_rates,
***************
*** 387,393 ****
};
static struct ieee80211_supported_band __wl_band_5ghz_a = {
! .band = IEEE80211_BAND_5GHZ,
.channels = __wl_5ghz_a_channels,
.n_channels = ARRAY_SIZE(__wl_5ghz_a_channels),
.bitrates = wl_a_rates,
--- 387,393 ----
};
static struct ieee80211_supported_band __wl_band_5ghz_a = {
! .band = NL80211_BAND_5GHZ,
.channels = __wl_5ghz_a_channels,
.n_channels = ARRAY_SIZE(__wl_5ghz_a_channels),
.bitrates = wl_a_rates,
***************
*** 395,401 ****
};
static struct ieee80211_supported_band __wl_band_5ghz_n = {
! .band = IEEE80211_BAND_5GHZ,
.channels = __wl_5ghz_n_channels,
.n_channels = ARRAY_SIZE(__wl_5ghz_n_channels),
.bitrates = wl_a_rates,
--- 395,401 ----
};
static struct ieee80211_supported_band __wl_band_5ghz_n = {
! .band = NL80211_BAND_5GHZ,
.channels = __wl_5ghz_n_channels,
.n_channels = ARRAY_SIZE(__wl_5ghz_n_channels),
.bitrates = wl_a_rates,
***************
*** 1876,1883 ****
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->signal_type = CFG80211_SIGNAL_TYPE_MBM;
wdev->wiphy->cipher_suites = __wl_cipher_suites;
wdev->wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
--- 1876,1883 ----
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[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,2006 ****
#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);
#else
freq = ieee80211_channel_to_frequency(notif_bss_info->channel);
#endif
--- 2000,2006 ----
#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) ?
! NL80211_BAND_2GHZ : NL80211_BAND_5GHZ);
#else
freq = ieee80211_channel_to_frequency(notif_bss_info->channel);
#endif
***************
*** 2116,2122 ****
return err;
}
chan = wf_chspec_ctlchan(chanspec);
! band = (chan <= CH_MAX_2G_CHANNEL) ? IEEE80211_BAND_2GHZ : IEEE80211_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);
--- 2116,2122 ----
return err;
}
chan = wf_chspec_ctlchan(chanspec);
! 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,2259 ****
join_params->params.chanspec_list[0] =
ieee80211_frequency_to_channel(chan->center_freq);
! if (chan->band == IEEE80211_BAND_2GHZ) {
chanspec |= WL_CHANSPEC_BAND_2G;
}
! else if (chan->band == IEEE80211_BAND_5GHZ) {
chanspec |= WL_CHANSPEC_BAND_5G;
}
else {
--- 2250,2259 ----
join_params->params.chanspec_list[0] =
ieee80211_frequency_to_channel(chan->center_freq);
! if (chan->band == NL80211_BAND_2GHZ) {
chanspec |= WL_CHANSPEC_BAND_2G;
}
! else if (chan->band == NL80211_BAND_5GHZ) {
chanspec |= WL_CHANSPEC_BAND_5G;
}
else {
***************
*** 2386,2393 ****
--- 2386,2401 ----
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,2494 ****
--- 2496,2509 ----
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,2891 ****
if (phy == 'n' || phy == 'a' || phy == 'v') {
wiphy = wl_to_wiphy(wl);
! wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n;
}
return err;
--- 2900,2906 ----
if (phy == 'n' || phy == 'a' || phy == 'v') {
wiphy = wl_to_wiphy(wl);
! wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_n;
}
return err;
***************
*** 2913,2919 ****
--- 2928,2941 ----
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;
}
Only in b/src/wl/sys: wl_cfg80211_hybrid.o
Only in b/src/wl/sys: wl_iw.o
diff -r -c a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
*** a/src/wl/sys/wl_linux.c Fri Sep 18 17:47:30 2015
--- b/src/wl/sys/wl_linux.c Mon Jan 23 16:53:37 2017
***************
*** 2165,2172 ****
wlif = WL_DEV_IF(dev);
wl = WL_INFO(dev);
if (WL_ALL_PASSIVE_ENAB(wl) || (WL_RTR() && WL_CONFIG_SMP())) {
- skb->prev = NULL;
TXQ_LOCK(wl);
--- 2165,2172 ----
wlif = WL_DEV_IF(dev);
wl = WL_INFO(dev);
+ skb->prev = NULL;
if (WL_ALL_PASSIVE_ENAB(wl) || (WL_RTR() && WL_CONFIG_SMP())) {
TXQ_LOCK(wl);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment