Skip to content

Commit f7f7057

Browse files
Kalle Valolinvjw
authored andcommitted
wl1251: get PS Poll and Nullfunc templates from mac80211
Now that mac80211 creates templates for PS Poll and Nullfunc frames, use them instead of creating our own. Signed-off-by: Kalle Valo <kalle.valo@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent d8cd189 commit f7f7057

File tree

1 file changed

+16
-42
lines changed

1 file changed

+16
-42
lines changed

drivers/net/wireless/wl12xx/wl1251_main.c

Lines changed: 16 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -563,45 +563,6 @@ static void wl1251_op_remove_interface(struct ieee80211_hw *hw,
563563
mutex_unlock(&wl->mutex);
564564
}
565565

566-
static int wl1251_build_null_data(struct wl1251 *wl)
567-
{
568-
struct wl12xx_null_data_template template;
569-
570-
if (!is_zero_ether_addr(wl->bssid)) {
571-
memcpy(template.header.da, wl->bssid, ETH_ALEN);
572-
memcpy(template.header.bssid, wl->bssid, ETH_ALEN);
573-
} else {
574-
memset(template.header.da, 0xff, ETH_ALEN);
575-
memset(template.header.bssid, 0xff, ETH_ALEN);
576-
}
577-
578-
memcpy(template.header.sa, wl->mac_addr, ETH_ALEN);
579-
template.header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
580-
IEEE80211_STYPE_NULLFUNC |
581-
IEEE80211_FCTL_TODS);
582-
583-
return wl1251_cmd_template_set(wl, CMD_NULL_DATA, &template,
584-
sizeof(template));
585-
586-
}
587-
588-
static int wl1251_build_ps_poll(struct wl1251 *wl, u16 aid)
589-
{
590-
struct wl12xx_ps_poll_template template;
591-
592-
memcpy(template.bssid, wl->bssid, ETH_ALEN);
593-
memcpy(template.ta, wl->mac_addr, ETH_ALEN);
594-
595-
/* aid in PS-Poll has its two MSBs each set to 1 */
596-
template.aid = cpu_to_le16(1 << 15 | 1 << 14 | aid);
597-
598-
template.fc = cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
599-
600-
return wl1251_cmd_template_set(wl, CMD_PS_POLL, &template,
601-
sizeof(template));
602-
603-
}
604-
605566
static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
606567
{
607568
struct wl1251 *wl = hw->priv;
@@ -1101,7 +1062,7 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
11011062
{
11021063
enum wl1251_cmd_ps_mode mode;
11031064
struct wl1251 *wl = hw->priv;
1104-
struct sk_buff *beacon;
1065+
struct sk_buff *beacon, *skb;
11051066
int ret;
11061067

11071068
wl1251_debug(DEBUG_MAC80211, "mac80211 bss info changed");
@@ -1115,7 +1076,13 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
11151076
if (changed & BSS_CHANGED_BSSID) {
11161077
memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN);
11171078

1118-
ret = wl1251_build_null_data(wl);
1079+
skb = ieee80211_nullfunc_get(wl->hw, wl->vif);
1080+
if (!skb)
1081+
goto out_sleep;
1082+
1083+
ret = wl1251_cmd_template_set(wl, CMD_NULL_DATA,
1084+
skb->data, skb->len);
1085+
dev_kfree_skb(skb);
11191086
if (ret < 0)
11201087
goto out;
11211088

@@ -1136,7 +1103,14 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
11361103
wl->dtim_period);
11371104
wl->aid = bss_conf->aid;
11381105

1139-
ret = wl1251_build_ps_poll(wl, wl->aid);
1106+
skb = ieee80211_pspoll_get(wl->hw, wl->vif);
1107+
if (!skb)
1108+
goto out_sleep;
1109+
1110+
ret = wl1251_cmd_template_set(wl, CMD_PS_POLL,
1111+
skb->data,
1112+
skb->len);
1113+
dev_kfree_skb(skb);
11401114
if (ret < 0)
11411115
goto out_sleep;
11421116

0 commit comments

Comments
 (0)