提交 5da11dcd 编写于 作者: J Juuso Oikarinen 提交者: John W. Linville

wl1271: Fix ad-hoc mode handling

Fix the driver to better reflect the ad-hoc related configuration from the
mac80211.
Signed-off-by: NJuuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: NTeemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: NLuciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 6ccbb92e
...@@ -55,6 +55,7 @@ enum { ...@@ -55,6 +55,7 @@ enum {
DEBUG_ACX = BIT(13), DEBUG_ACX = BIT(13),
DEBUG_SDIO = BIT(14), DEBUG_SDIO = BIT(14),
DEBUG_FILTERS = BIT(15), DEBUG_FILTERS = BIT(15),
DEBUG_ADHOC = BIT(16),
DEBUG_ALL = ~0, DEBUG_ALL = ~0,
}; };
...@@ -389,6 +390,7 @@ struct wl1271 { ...@@ -389,6 +390,7 @@ struct wl1271 {
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
u8 mac_addr[ETH_ALEN]; u8 mac_addr[ETH_ALEN];
u8 bss_type; u8 bss_type;
u8 set_bss_type;
u8 ssid[IW_ESSID_MAX_SIZE + 1]; u8 ssid[IW_ESSID_MAX_SIZE + 1];
u8 ssid_len; u8 ssid_len;
int channel; int channel;
......
...@@ -958,9 +958,11 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, ...@@ -958,9 +958,11 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
switch (vif->type) { switch (vif->type) {
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
wl->bss_type = BSS_TYPE_STA_BSS; wl->bss_type = BSS_TYPE_STA_BSS;
wl->set_bss_type = BSS_TYPE_STA_BSS;
break; break;
case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_ADHOC:
wl->bss_type = BSS_TYPE_IBSS; wl->bss_type = BSS_TYPE_IBSS;
wl->set_bss_type = BSS_TYPE_STA_BSS;
break; break;
default: default:
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;
...@@ -1065,6 +1067,7 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw, ...@@ -1065,6 +1067,7 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw,
memset(wl->ssid, 0, IW_ESSID_MAX_SIZE + 1); memset(wl->ssid, 0, IW_ESSID_MAX_SIZE + 1);
wl->ssid_len = 0; wl->ssid_len = 0;
wl->bss_type = MAX_BSS_TYPE; wl->bss_type = MAX_BSS_TYPE;
wl->set_bss_type = MAX_BSS_TYPE;
wl->band = IEEE80211_BAND_2GHZ; wl->band = IEEE80211_BAND_2GHZ;
wl->rx_counter = 0; wl->rx_counter = 0;
...@@ -1137,10 +1140,7 @@ static int wl1271_join_channel(struct wl1271 *wl, int channel) ...@@ -1137,10 +1140,7 @@ static int wl1271_join_channel(struct wl1271 *wl, int channel)
/* pass through frames from all BSS */ /* pass through frames from all BSS */
wl1271_configure_filters(wl, FIF_OTHER_BSS); wl1271_configure_filters(wl, FIF_OTHER_BSS);
/* the dummy join is performed always with STATION BSS type to allow ret = wl1271_cmd_join(wl, wl->set_bss_type);
also ad-hoc mode to listen to the surroundings without sending any
beacons yet. */
ret = wl1271_cmd_join(wl, BSS_TYPE_STA_BSS);
if (ret < 0) if (ret < 0)
goto out; goto out;
...@@ -1211,7 +1211,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) ...@@ -1211,7 +1211,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
test_bit(WL1271_FLAG_JOINED, &wl->flags)) { test_bit(WL1271_FLAG_JOINED, &wl->flags)) {
wl->channel = channel; wl->channel = channel;
/* FIXME: maybe use CMD_CHANNEL_SWITCH for this? */ /* FIXME: maybe use CMD_CHANNEL_SWITCH for this? */
ret = wl1271_cmd_join(wl, wl->bss_type); ret = wl1271_cmd_join(wl, wl->set_bss_type);
if (ret < 0) if (ret < 0)
wl1271_warning("cmd join to update channel failed %d", wl1271_warning("cmd join to update channel failed %d",
ret); ret);
...@@ -1575,13 +1575,12 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, ...@@ -1575,13 +1575,12 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
if (ret < 0) if (ret < 0)
goto out; goto out;
if (wl->bss_type == BSS_TYPE_IBSS) { if ((changed && BSS_CHANGED_BEACON) &&
/* FIXME: This implements rudimentary ad-hoc support - (wl->bss_type == BSS_TYPE_IBSS)) {
proper templates are on the wish list and notification
on when they change. This patch will update the templates
on every call to this function. */
struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); struct sk_buff *beacon = ieee80211_beacon_get(hw, vif);
wl1271_debug(DEBUG_ADHOC, "ad-hoc beacon updated");
if (beacon) { if (beacon) {
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
...@@ -1613,6 +1612,18 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, ...@@ -1613,6 +1612,18 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
} }
} }
if ((changed & BSS_CHANGED_BEACON_ENABLED) &&
(wl->bss_type == BSS_TYPE_IBSS)) {
wl1271_debug(DEBUG_ADHOC, "ad-hoc beaconing: %s",
bss_conf->enable_beacon ? "enabled" : "disabled");
if (bss_conf->enable_beacon)
wl->set_bss_type = BSS_TYPE_IBSS;
else
wl->set_bss_type = BSS_TYPE_STA_BSS;
do_join = true;
}
if ((changed & BSS_CHANGED_BSSID) && if ((changed & BSS_CHANGED_BSSID) &&
/* /*
* Now we know the correct bssid, so we send a new join command * Now we know the correct bssid, so we send a new join command
...@@ -1707,7 +1718,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, ...@@ -1707,7 +1718,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
} }
if (do_join) { if (do_join) {
ret = wl1271_cmd_join(wl, wl->bss_type); ret = wl1271_cmd_join(wl, wl->set_bss_type);
if (ret < 0) { if (ret < 0) {
wl1271_warning("cmd join failed %d", ret); wl1271_warning("cmd join failed %d", ret);
goto out_sleep; goto out_sleep;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册