aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>2009-12-11 08:41:04 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-12-28 16:31:35 -0500
commite0d8bbf0d23e6b82f13b29f39593d5d13d923b2b (patch)
treeb912a4a429027641dafd8dc1177d1e455b3f3e5e
parent26a63f6af58144818d4979cce1cbb8e49329f732 (diff)
wl1271: Add rudimentary ad-hoc support
This patch adds rudimentary a-hoc support for the driver. It will allow setting up ad-hoc, and for other devices to scan and join. The beacon and probe response template setting is slightly dirty, and need to be properly implemented with support from mac80211. Also, the SSID is not configured to the firmware - the FW will not be able to respond to probe requests autonomously. Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Reviewed-by: Luciano Coelho <luciano.coelho@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_main.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 0520b38e8e72..d7b1bb3e08a8 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -1139,11 +1139,15 @@ out:
1139 1139
1140static int wl1271_join_channel(struct wl1271 *wl, int channel) 1140static int wl1271_join_channel(struct wl1271 *wl, int channel)
1141{ 1141{
1142 int ret; 1142 int ret = 0;
1143 /* we need to use a dummy BSSID for now */ 1143 /* we need to use a dummy BSSID for now */
1144 static const u8 dummy_bssid[ETH_ALEN] = { 0x0b, 0xad, 0xde, 1144 static const u8 dummy_bssid[ETH_ALEN] = { 0x0b, 0xad, 0xde,
1145 0xad, 0xbe, 0xef }; 1145 0xad, 0xbe, 0xef };
1146 1146
1147 /* the dummy join is not required for ad-hoc */
1148 if (wl->bss_type == BSS_TYPE_IBSS)
1149 goto out;
1150
1147 /* disable mac filter, so we hear everything */ 1151 /* disable mac filter, so we hear everything */
1148 wl->rx_config &= ~CFG_BSSID_FILTER_EN; 1152 wl->rx_config &= ~CFG_BSSID_FILTER_EN;
1149 1153
@@ -1572,6 +1576,42 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
1572 wl->joined = true; 1576 wl->joined = true;
1573 } 1577 }
1574 1578
1579 if (wl->bss_type == BSS_TYPE_IBSS) {
1580 /* FIXME: This implements rudimentary ad-hoc support -
1581 proper templates are on the wish list and notification
1582 on when they change. This patch will update the templates
1583 on every call to this function. Also, the firmware will not
1584 answer to probe-requests as it does not have the proper
1585 SSID set in the JOIN command. The probe-response template
1586 is set nevertheless, as the FW will ASSERT without it */
1587 struct sk_buff *beacon = ieee80211_beacon_get(hw, vif);
1588
1589 if (beacon) {
1590 struct ieee80211_hdr *hdr;
1591 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON,
1592 beacon->data,
1593 beacon->len);
1594
1595 if (ret < 0) {
1596 dev_kfree_skb(beacon);
1597 goto out_sleep;
1598 }
1599
1600 hdr = (struct ieee80211_hdr *) beacon->data;
1601 hdr->frame_control = cpu_to_le16(
1602 IEEE80211_FTYPE_MGMT |
1603 IEEE80211_STYPE_PROBE_RESP);
1604
1605 ret = wl1271_cmd_template_set(wl,
1606 CMD_TEMPL_PROBE_RESPONSE,
1607 beacon->data,
1608 beacon->len);
1609 dev_kfree_skb(beacon);
1610 if (ret < 0)
1611 goto out_sleep;
1612 }
1613 }
1614
1575 if (changed & BSS_CHANGED_ASSOC) { 1615 if (changed & BSS_CHANGED_ASSOC) {
1576 if (bss_conf->assoc) { 1616 if (bss_conf->assoc) {
1577 wl->aid = bss_conf->aid; 1617 wl->aid = bss_conf->aid;
@@ -1857,7 +1897,8 @@ static int wl1271_init_ieee80211(struct wl1271 *wl)
1857 IEEE80211_HW_BEACON_FILTER | 1897 IEEE80211_HW_BEACON_FILTER |
1858 IEEE80211_HW_SUPPORTS_PS; 1898 IEEE80211_HW_SUPPORTS_PS;
1859 1899
1860 wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); 1900 wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
1901 BIT(NL80211_IFTYPE_ADHOC);
1861 wl->hw->wiphy->max_scan_ssids = 1; 1902 wl->hw->wiphy->max_scan_ssids = 1;
1862 wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wl1271_band_2ghz; 1903 wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wl1271_band_2ghz;
1863 1904