mac80211: update brcmsmac ap patches
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 874-brcmsmac-add-support-for-adhoc-mode.patch
1 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
2 +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
3 @@ -359,11 +359,12 @@ brcms_ops_add_interface(struct ieee80211
4 {
5 struct brcms_info *wl = hw->priv;
6
7 - /* Just STA and AP for now */
8 + /* Just STA, AP and ADHOC for now */
9 if (vif->type != NL80211_IFTYPE_STATION &&
10 - vif->type != NL80211_IFTYPE_AP) {
11 + vif->type != NL80211_IFTYPE_AP &&
12 + vif->type != NL80211_IFTYPE_ADHOC) {
13 brcms_err(wl->wlc->hw->d11core,
14 - "%s: Attempt to add type %d, only STA and AP for now\n",
15 + "%s: Attempt to add type %d, only STA, AP and AdHoc for now\n",
16 __func__, vif->type);
17 return -EOPNOTSUPP;
18 }
19 @@ -376,6 +377,8 @@ brcms_ops_add_interface(struct ieee80211
20 else if (vif->type == NL80211_IFTYPE_AP)
21 brcms_c_start_ap(wl->wlc, vif->addr, vif->bss_conf.bssid,
22 vif->bss_conf.ssid, vif->bss_conf.ssid_len);
23 + else if (vif->type == NL80211_IFTYPE_ADHOC)
24 + brcms_c_start_adhoc(wl->wlc, vif->addr);
25 spin_unlock_bh(&wl->lock);
26
27 return 0;
28 @@ -1057,7 +1060,8 @@ static int ieee_hw_init(struct ieee80211
29 /* channel change time is dependent on chip and band */
30 hw->channel_change_time = 7 * 1000;
31 hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
32 - BIT(NL80211_IFTYPE_AP);
33 + BIT(NL80211_IFTYPE_AP) |
34 + BIT(NL80211_IFTYPE_ADHOC);
35
36 /*
37 * deactivate sending probe responses by ucude, because this will
38 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
39 +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
40 @@ -2188,6 +2188,14 @@ void brcms_c_start_ap(struct brcms_c_inf
41 brcms_b_mctrl(wlc->hw, MCTL_AP | MCTL_INFRA, MCTL_AP | MCTL_INFRA);
42 }
43
44 +void brcms_c_start_adhoc(struct brcms_c_info *wlc, u8 *addr)
45 +{
46 + memcpy(wlc->pub->cur_etheraddr, addr, sizeof(wlc->pub->cur_etheraddr));
47 + wlc->bsscfg->type = BRCMS_TYPE_ADHOC;
48 +
49 + brcms_b_mctrl(wlc->hw, MCTL_AP | MCTL_INFRA, 0);
50 +}
51 +
52 /* Initialize GPIOs that are controlled by D11 core */
53 static void brcms_c_gpio_init(struct brcms_c_info *wlc)
54 {
55 @@ -3079,6 +3087,9 @@ static bool brcms_c_ps_allowed(struct br
56 if (wlc->bsscfg->type == BRCMS_TYPE_AP)
57 return false;
58
59 + if (wlc->bsscfg->type == BRCMS_TYPE_ADHOC)
60 + return false;
61 +
62 return true;
63 }
64
65 --- a/drivers/net/wireless/brcm80211/brcmsmac/pub.h
66 +++ b/drivers/net/wireless/brcm80211/brcmsmac/pub.h
67 @@ -334,6 +334,7 @@ extern bool brcms_c_tx_flush_completed(s
68 extern void brcms_c_start_station(struct brcms_c_info *wlc, u8 *addr);
69 extern void brcms_c_start_ap(struct brcms_c_info *wlc, u8 *addr,
70 const u8 *bssid, u8 *ssid, size_t ssid_len);
71 +extern void brcms_c_start_adhoc(struct brcms_c_info *wlc, u8 *addr);
72 extern void brcms_c_update_beacon(struct brcms_c_info *wlc);
73 extern void brcms_c_set_new_beacon(struct brcms_c_info *wlc,
74 struct sk_buff *beacon, u16 tim_offset,