mac80211: brcmsmac: add ap mode support
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 872-brcmsmac-activate-AP-support.patch
1 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
2 +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
3 @@ -360,7 +360,8 @@ brcms_ops_add_interface(struct ieee80211
4 struct brcms_info *wl = hw->priv;
5
6 /* Just STA for now */
7 - if (vif->type != NL80211_IFTYPE_STATION) {
8 + if (vif->type != NL80211_IFTYPE_STATION &&
9 + vif->type != NL80211_IFTYPE_AP) {
10 brcms_err(wl->wlc->hw->d11core,
11 "%s: Attempt to add type %d, only STA for now\n",
12 __func__, vif->type);
13 @@ -372,6 +373,9 @@ brcms_ops_add_interface(struct ieee80211
14 brcms_c_mute(wl->wlc, false);
15 if (vif->type == NL80211_IFTYPE_STATION)
16 brcms_c_start_station(wl->wlc, vif->addr);
17 + else if (vif->type == NL80211_IFTYPE_AP)
18 + brcms_c_start_ap(wl->wlc, vif->addr, vif->bss_conf.bssid,
19 + vif->bss_conf.ssid, vif->bss_conf.ssid_len);
20 spin_unlock_bh(&wl->lock);
21
22 return 0;
23 @@ -1046,7 +1050,8 @@ static int ieee_hw_init(struct ieee80211
24
25 /* channel change time is dependent on chip and band */
26 hw->channel_change_time = 7 * 1000;
27 - hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
28 + hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
29 + BIT(NL80211_IFTYPE_AP);
30
31 hw->wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD;
32
33 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
34 +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
35 @@ -2176,6 +2176,18 @@ void brcms_c_start_station(struct brcms_
36 wlc->bsscfg->type = BRCMS_TYPE_STATION;
37 }
38
39 +void brcms_c_start_ap(struct brcms_c_info *wlc, u8 *addr, const u8 *bssid,
40 + u8 *ssid, size_t ssid_len)
41 +{
42 + brcms_c_set_ssid(wlc, ssid, ssid_len);
43 +
44 + memcpy(wlc->pub->cur_etheraddr, addr, sizeof(wlc->pub->cur_etheraddr));
45 + memcpy(wlc->bsscfg->BSSID, bssid, sizeof(wlc->bsscfg->BSSID));
46 + wlc->bsscfg->type = BRCMS_TYPE_AP;
47 +
48 + brcms_b_mctrl(wlc->hw, MCTL_AP | MCTL_INFRA, MCTL_AP | MCTL_INFRA);
49 +}
50 +
51 /* Initialize GPIOs that are controlled by D11 core */
52 static void brcms_c_gpio_init(struct brcms_c_info *wlc)
53 {
54 @@ -3064,6 +3076,9 @@ static bool brcms_c_ps_allowed(struct br
55 if (wlc->filter_flags & FIF_PROMISC_IN_BSS)
56 return false;
57
58 + if (wlc->bsscfg->type == BRCMS_TYPE_AP)
59 + return false;
60 +
61 return true;
62 }
63
64 --- a/drivers/net/wireless/brcm80211/brcmsmac/pub.h
65 +++ b/drivers/net/wireless/brcm80211/brcmsmac/pub.h
66 @@ -332,6 +332,8 @@ extern bool brcms_c_check_radio_disabled
67 extern void brcms_c_mute(struct brcms_c_info *wlc, bool on);
68 extern bool brcms_c_tx_flush_completed(struct brcms_c_info *wlc);
69 extern void brcms_c_start_station(struct brcms_c_info *wlc, u8 *addr);
70 +extern void brcms_c_start_ap(struct brcms_c_info *wlc, u8 *addr,
71 + const u8 *bssid, u8 *ssid, size_t ssid_len);
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,