1 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
2 +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
3 @@ -541,6 +541,15 @@ brcms_ops_bss_info_changed(struct ieee80
4 spin_unlock_bh(&wl->lock);
7 + if (changed & BSS_CHANGED_AP_PROBE_RESP) {
8 + struct sk_buff *probe_resp;
10 + spin_lock_bh(&wl->lock);
11 + probe_resp = ieee80211_proberesp_get(hw, vif);
12 + brcms_c_set_new_probe_resp(wl->wlc, probe_resp);
13 + spin_unlock_bh(&wl->lock);
16 if (changed & BSS_CHANGED_BEACON_ENABLED) {
17 /* Beaconing should be enabled/disabled (beaconing modes) */
18 brcms_err(core, "%s: Beacon enabled: %s\n", __func__,
19 @@ -1039,6 +1048,8 @@ static int ieee_hw_init(struct ieee80211
20 hw->channel_change_time = 7 * 1000;
21 hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
23 + hw->wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD;
25 hw->rate_control_algorithm = "minstrel_ht";
27 hw->sta_data_size = 0;
28 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
29 +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
30 @@ -453,6 +453,8 @@ static void brcms_c_detach_mfree(struct
33 dev_kfree_skb_any(wlc->beacon);
34 + if (wlc->probe_resp)
35 + dev_kfree_skb_any(wlc->probe_resp);
39 @@ -7327,69 +7329,6 @@ brcms_c_mod_prb_rsp_rate_table(struct br
43 -/* Max buffering needed for beacon template/prb resp template is 142 bytes.
45 - * PLCP header is 6 bytes.
46 - * 802.11 A3 header is 24 bytes.
47 - * Max beacon frame body template length is 112 bytes.
48 - * Max probe resp frame body template length is 110 bytes.
50 - * *len on input contains the max length of the packet available.
52 - * The *len value is set to the number of bytes in buf used, and starts
53 - * with the PLCP and included up to, but not including, the 4 byte FCS.
56 -brcms_c_bcn_prb_template(struct brcms_c_info *wlc, u16 type,
58 - struct brcms_bss_cfg *cfg, u16 *buf, int *len)
60 - static const u8 ether_bcast[ETH_ALEN] = {255, 255, 255, 255, 255, 255};
61 - struct cck_phy_hdr *plcp;
62 - struct ieee80211_mgmt *h;
63 - int hdr_len, body_len;
65 - hdr_len = D11_PHY_HDR_LEN + DOT11_MAC_HDR_LEN;
67 - /* calc buffer size provided for frame body */
68 - body_len = *len - hdr_len;
69 - /* return actual size */
70 - *len = hdr_len + body_len;
72 - /* format PHY and MAC headers */
73 - memset(buf, 0, hdr_len);
75 - plcp = (struct cck_phy_hdr *) buf;
78 - * PLCP for Probe Response frames are filled in from
81 - if (type == IEEE80211_STYPE_BEACON)
83 - brcms_c_compute_plcp(wlc, bcn_rspec,
84 - (DOT11_MAC_HDR_LEN + body_len + FCS_LEN),
87 - /* "Regular" and 16 MBSS but not for 4 MBSS */
88 - /* Update the phytxctl for the beacon based on the rspec */
89 - brcms_c_beacon_phytxctl_txant_upd(wlc, bcn_rspec);
91 - h = (struct ieee80211_mgmt *)&plcp[1];
93 - /* fill in 802.11 header */
94 - h->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | type);
96 - /* DUR is 0 for multicast bcn, or filled in by MAC for prb resp */
97 - /* A1 filled in by MAC for prb resp, broadcast for bcn */
98 - if (type == IEEE80211_STYPE_BEACON)
99 - memcpy(&h->da, ðer_bcast, ETH_ALEN);
100 - memcpy(&h->sa, &wlc->pub->cur_etheraddr, ETH_ALEN);
101 - memcpy(&h->bssid, &cfg->BSSID, ETH_ALEN);
103 - /* SEQ filled in by MAC */
106 int brcms_c_get_header_len(void)
109 @@ -7531,6 +7470,20 @@ void brcms_c_set_new_beacon(struct brcms
110 brcms_c_update_beacon(wlc);
113 +void brcms_c_set_new_probe_resp(struct brcms_c_info *wlc,
114 + struct sk_buff *probe_resp)
118 + if (wlc->probe_resp)
119 + dev_kfree_skb_any(wlc->probe_resp);
120 + wlc->probe_resp = probe_resp;
123 + skb_push(wlc->probe_resp, D11_PHY_HDR_LEN);
124 + brcms_c_update_probe_resp(wlc, false);
127 /* Write ssid into shared memory */
129 brcms_c_shm_ssid_upd(struct brcms_c_info *wlc, struct brcms_bss_cfg *cfg)
130 @@ -7550,30 +7503,19 @@ brcms_c_shm_ssid_upd(struct brcms_c_info
132 brcms_c_bss_update_probe_resp(struct brcms_c_info *wlc,
133 struct brcms_bss_cfg *cfg,
134 + struct sk_buff *probe_resp,
138 - int len = BCN_TMPL_LEN;
141 - prb_resp = kmalloc(BCN_TMPL_LEN, GFP_ATOMIC);
146 - * write the probe response to hardware, or save in
147 - * the config structure
150 - /* create the probe response template */
151 - brcms_c_bcn_prb_template(wlc, IEEE80211_STYPE_PROBE_RESP, 0,
152 - cfg, prb_resp, &len);
153 + len = min_t(size_t, probe_resp->len, BCN_TMPL_LEN);
156 brcms_c_suspend_mac_and_wait(wlc);
158 /* write the probe response into the template region */
159 brcms_b_write_template_ram(wlc->hw, T_PRS_TPL_BASE,
160 - (len + 3) & ~3, prb_resp);
161 + (len + 3) & ~3, probe_resp->data);
163 /* write the length of the probe response frame (+PLCP/-FCS) */
164 brcms_b_write_shm(wlc->hw, M_PRB_RESP_FRM_LEN, (u16) len);
165 @@ -7587,13 +7529,11 @@ brcms_c_bss_update_probe_resp(struct brc
166 * PLCP header for the call to brcms_c_mod_prb_rsp_rate_table()
167 * by subtracting the PLCP len and adding the FCS.
169 - len += (-D11_PHY_HDR_LEN + FCS_LEN);
170 - brcms_c_mod_prb_rsp_rate_table(wlc, (u16) len);
171 + brcms_c_mod_prb_rsp_rate_table(wlc,
172 + (u16)len + FCS_LEN - D11_PHY_HDR_LEN);
175 brcms_c_enable_mac(wlc);
180 void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend)
181 @@ -7602,8 +7542,12 @@ void brcms_c_update_probe_resp(struct br
183 /* update AP or IBSS probe responses */
184 if (wlc->pub->up && (bsscfg->type == BRCMS_TYPE_AP ||
185 - bsscfg->type == BRCMS_TYPE_ADHOC))
186 - brcms_c_bss_update_probe_resp(wlc, bsscfg, suspend);
187 + bsscfg->type == BRCMS_TYPE_ADHOC)) {
188 + if (!wlc->probe_resp)
190 + brcms_c_bss_update_probe_resp(wlc, bsscfg, wlc->probe_resp,
195 int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
196 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.h
197 +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.h
198 @@ -567,6 +567,7 @@ struct brcms_c_info {
199 struct sk_buff *beacon;
200 u16 beacon_tim_offset;
201 u16 beacon_dtim_period;
202 + struct sk_buff *probe_resp;
205 /* antsel module specific state */
206 --- a/drivers/net/wireless/brcm80211/brcmsmac/pub.h
207 +++ b/drivers/net/wireless/brcm80211/brcmsmac/pub.h
208 @@ -336,6 +336,8 @@ extern void brcms_c_update_beacon(struct
209 extern void brcms_c_set_new_beacon(struct brcms_c_info *wlc,
210 struct sk_buff *beacon, u16 tim_offset,
212 +extern void brcms_c_set_new_probe_resp(struct brcms_c_info *wlc,
213 + struct sk_buff *probe_resp);
214 extern void brcms_c_set_ssid(struct brcms_c_info *wlc, u8 *ssid,