diff options
author | Juuso Oikarinen <juuso.oikarinen@nokia.com> | 2010-03-26 06:53:24 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-31 14:39:14 -0400 |
commit | 5da11dcde3d2a91688e02f032062fa26877eacb0 (patch) | |
tree | 194f71f76ba3047f1aa97ce4394079230d5f36b9 | |
parent | 6ccbb92ead9379d7de2cc25cd950d15a8d22e0c9 (diff) |
wl1271: Fix ad-hoc mode handling
Fix the driver to better reflect the ad-hoc related configuration from the
mac80211.
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_main.c | 33 |
2 files changed, 24 insertions, 11 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h index c93968092fc1..37ad5cd0b82f 100644 --- a/drivers/net/wireless/wl12xx/wl1271.h +++ b/drivers/net/wireless/wl12xx/wl1271.h | |||
@@ -55,6 +55,7 @@ enum { | |||
55 | DEBUG_ACX = BIT(13), | 55 | DEBUG_ACX = BIT(13), |
56 | DEBUG_SDIO = BIT(14), | 56 | DEBUG_SDIO = BIT(14), |
57 | DEBUG_FILTERS = BIT(15), | 57 | DEBUG_FILTERS = BIT(15), |
58 | DEBUG_ADHOC = BIT(16), | ||
58 | DEBUG_ALL = ~0, | 59 | DEBUG_ALL = ~0, |
59 | }; | 60 | }; |
60 | 61 | ||
@@ -389,6 +390,7 @@ struct wl1271 { | |||
389 | u8 bssid[ETH_ALEN]; | 390 | u8 bssid[ETH_ALEN]; |
390 | u8 mac_addr[ETH_ALEN]; | 391 | u8 mac_addr[ETH_ALEN]; |
391 | u8 bss_type; | 392 | u8 bss_type; |
393 | u8 set_bss_type; | ||
392 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; | 394 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; |
393 | u8 ssid_len; | 395 | u8 ssid_len; |
394 | int channel; | 396 | int channel; |
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index 00e856c4a611..49f37b0183ac 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -958,9 +958,11 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, | |||
958 | switch (vif->type) { | 958 | switch (vif->type) { |
959 | case NL80211_IFTYPE_STATION: | 959 | case NL80211_IFTYPE_STATION: |
960 | wl->bss_type = BSS_TYPE_STA_BSS; | 960 | wl->bss_type = BSS_TYPE_STA_BSS; |
961 | wl->set_bss_type = BSS_TYPE_STA_BSS; | ||
961 | break; | 962 | break; |
962 | case NL80211_IFTYPE_ADHOC: | 963 | case NL80211_IFTYPE_ADHOC: |
963 | wl->bss_type = BSS_TYPE_IBSS; | 964 | wl->bss_type = BSS_TYPE_IBSS; |
965 | wl->set_bss_type = BSS_TYPE_STA_BSS; | ||
964 | break; | 966 | break; |
965 | default: | 967 | default: |
966 | ret = -EOPNOTSUPP; | 968 | ret = -EOPNOTSUPP; |
@@ -1065,6 +1067,7 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw, | |||
1065 | memset(wl->ssid, 0, IW_ESSID_MAX_SIZE + 1); | 1067 | memset(wl->ssid, 0, IW_ESSID_MAX_SIZE + 1); |
1066 | wl->ssid_len = 0; | 1068 | wl->ssid_len = 0; |
1067 | wl->bss_type = MAX_BSS_TYPE; | 1069 | wl->bss_type = MAX_BSS_TYPE; |
1070 | wl->set_bss_type = MAX_BSS_TYPE; | ||
1068 | wl->band = IEEE80211_BAND_2GHZ; | 1071 | wl->band = IEEE80211_BAND_2GHZ; |
1069 | 1072 | ||
1070 | wl->rx_counter = 0; | 1073 | wl->rx_counter = 0; |
@@ -1137,10 +1140,7 @@ static int wl1271_join_channel(struct wl1271 *wl, int channel) | |||
1137 | /* pass through frames from all BSS */ | 1140 | /* pass through frames from all BSS */ |
1138 | wl1271_configure_filters(wl, FIF_OTHER_BSS); | 1141 | wl1271_configure_filters(wl, FIF_OTHER_BSS); |
1139 | 1142 | ||
1140 | /* the dummy join is performed always with STATION BSS type to allow | 1143 | ret = wl1271_cmd_join(wl, wl->set_bss_type); |
1141 | also ad-hoc mode to listen to the surroundings without sending any | ||
1142 | beacons yet. */ | ||
1143 | ret = wl1271_cmd_join(wl, BSS_TYPE_STA_BSS); | ||
1144 | if (ret < 0) | 1144 | if (ret < 0) |
1145 | goto out; | 1145 | goto out; |
1146 | 1146 | ||
@@ -1211,7 +1211,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
1211 | test_bit(WL1271_FLAG_JOINED, &wl->flags)) { | 1211 | test_bit(WL1271_FLAG_JOINED, &wl->flags)) { |
1212 | wl->channel = channel; | 1212 | wl->channel = channel; |
1213 | /* FIXME: maybe use CMD_CHANNEL_SWITCH for this? */ | 1213 | /* FIXME: maybe use CMD_CHANNEL_SWITCH for this? */ |
1214 | ret = wl1271_cmd_join(wl, wl->bss_type); | 1214 | ret = wl1271_cmd_join(wl, wl->set_bss_type); |
1215 | if (ret < 0) | 1215 | if (ret < 0) |
1216 | wl1271_warning("cmd join to update channel failed %d", | 1216 | wl1271_warning("cmd join to update channel failed %d", |
1217 | ret); | 1217 | ret); |
@@ -1575,13 +1575,12 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1575 | if (ret < 0) | 1575 | if (ret < 0) |
1576 | goto out; | 1576 | goto out; |
1577 | 1577 | ||
1578 | if (wl->bss_type == BSS_TYPE_IBSS) { | 1578 | if ((changed && BSS_CHANGED_BEACON) && |
1579 | /* FIXME: This implements rudimentary ad-hoc support - | 1579 | (wl->bss_type == BSS_TYPE_IBSS)) { |
1580 | proper templates are on the wish list and notification | ||
1581 | on when they change. This patch will update the templates | ||
1582 | on every call to this function. */ | ||
1583 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); | 1580 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); |
1584 | 1581 | ||
1582 | wl1271_debug(DEBUG_ADHOC, "ad-hoc beacon updated"); | ||
1583 | |||
1585 | if (beacon) { | 1584 | if (beacon) { |
1586 | struct ieee80211_hdr *hdr; | 1585 | struct ieee80211_hdr *hdr; |
1587 | 1586 | ||
@@ -1613,6 +1612,18 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1613 | } | 1612 | } |
1614 | } | 1613 | } |
1615 | 1614 | ||
1615 | if ((changed & BSS_CHANGED_BEACON_ENABLED) && | ||
1616 | (wl->bss_type == BSS_TYPE_IBSS)) { | ||
1617 | wl1271_debug(DEBUG_ADHOC, "ad-hoc beaconing: %s", | ||
1618 | bss_conf->enable_beacon ? "enabled" : "disabled"); | ||
1619 | |||
1620 | if (bss_conf->enable_beacon) | ||
1621 | wl->set_bss_type = BSS_TYPE_IBSS; | ||
1622 | else | ||
1623 | wl->set_bss_type = BSS_TYPE_STA_BSS; | ||
1624 | do_join = true; | ||
1625 | } | ||
1626 | |||
1616 | if ((changed & BSS_CHANGED_BSSID) && | 1627 | if ((changed & BSS_CHANGED_BSSID) && |
1617 | /* | 1628 | /* |
1618 | * Now we know the correct bssid, so we send a new join command | 1629 | * 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 | } | 1718 | } |
1708 | 1719 | ||
1709 | if (do_join) { | 1720 | if (do_join) { |
1710 | ret = wl1271_cmd_join(wl, wl->bss_type); | 1721 | ret = wl1271_cmd_join(wl, wl->set_bss_type); |
1711 | if (ret < 0) { | 1722 | if (ret < 0) { |
1712 | wl1271_warning("cmd join failed %d", ret); | 1723 | wl1271_warning("cmd join failed %d", ret); |
1713 | goto out_sleep; | 1724 | goto out_sleep; |