diff options
author | Kalle Valo <kalle.valo@nokia.com> | 2010-01-05 13:16:32 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-01-12 13:51:25 -0500 |
commit | f7f70579340dba1e551c0e52349fde0370592174 (patch) | |
tree | df112e7fbf171ca29cf7316518d02ae017d6b59c | |
parent | d8cd189e9b1e050629f545e76b21a321f62c29bf (diff) |
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>
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1251_main.c | 58 |
1 files changed, 16 insertions, 42 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c index 4e373f3dbc43..6cce86462fac 100644 --- a/drivers/net/wireless/wl12xx/wl1251_main.c +++ b/drivers/net/wireless/wl12xx/wl1251_main.c | |||
@@ -563,45 +563,6 @@ static void wl1251_op_remove_interface(struct ieee80211_hw *hw, | |||
563 | mutex_unlock(&wl->mutex); | 563 | mutex_unlock(&wl->mutex); |
564 | } | 564 | } |
565 | 565 | ||
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 | |||
605 | static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed) | 566 | static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed) |
606 | { | 567 | { |
607 | struct wl1251 *wl = hw->priv; | 568 | struct wl1251 *wl = hw->priv; |
@@ -1101,7 +1062,7 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1101 | { | 1062 | { |
1102 | enum wl1251_cmd_ps_mode mode; | 1063 | enum wl1251_cmd_ps_mode mode; |
1103 | struct wl1251 *wl = hw->priv; | 1064 | struct wl1251 *wl = hw->priv; |
1104 | struct sk_buff *beacon; | 1065 | struct sk_buff *beacon, *skb; |
1105 | int ret; | 1066 | int ret; |
1106 | 1067 | ||
1107 | wl1251_debug(DEBUG_MAC80211, "mac80211 bss info changed"); | 1068 | wl1251_debug(DEBUG_MAC80211, "mac80211 bss info changed"); |
@@ -1115,7 +1076,13 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1115 | if (changed & BSS_CHANGED_BSSID) { | 1076 | if (changed & BSS_CHANGED_BSSID) { |
1116 | memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN); | 1077 | memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN); |
1117 | 1078 | ||
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); | ||
1119 | if (ret < 0) | 1086 | if (ret < 0) |
1120 | goto out; | 1087 | goto out; |
1121 | 1088 | ||
@@ -1136,7 +1103,14 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1136 | wl->dtim_period); | 1103 | wl->dtim_period); |
1137 | wl->aid = bss_conf->aid; | 1104 | wl->aid = bss_conf->aid; |
1138 | 1105 | ||
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); | ||
1140 | if (ret < 0) | 1114 | if (ret < 0) |
1141 | goto out_sleep; | 1115 | goto out_sleep; |
1142 | 1116 | ||