aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/wl1271_main.c
diff options
context:
space:
mode:
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>2010-02-18 06:25:38 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-02-19 15:52:42 -0500
commit30240fc76a57e37a4bb42976ff7162b5e45e6117 (patch)
tree254d0e78384b0eea234bb5c114692c562551d271 /drivers/net/wireless/wl12xx/wl1271_main.c
parentddb01a5b368270f3cc86b606ba6f7ee8795a8a99 (diff)
wl1271: Add SSID configuration for JOIN in ad-hoc
This patch adds code to extract the SSID from the beacon template used for ad-hoc. The mac80211 currently does not provide the SSID, so this is a workaround for that, for now. Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_main.c')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c69
1 files changed, 43 insertions, 26 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 8b46b7069f1..a3742c8052d 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -1549,6 +1549,23 @@ out:
1549 return ret; 1549 return ret;
1550} 1550}
1551 1551
1552static void wl1271_ssid_set(struct wl1271 *wl, struct sk_buff *beacon)
1553{
1554 u8 *ptr = beacon->data +
1555 offsetof(struct ieee80211_mgmt, u.beacon.variable);
1556
1557 /* find the location of the ssid in the beacon */
1558 while (ptr < beacon->data + beacon->len) {
1559 if (ptr[0] == WLAN_EID_SSID) {
1560 wl->ssid_len = ptr[1];
1561 memcpy(wl->ssid, ptr+2, wl->ssid_len);
1562 return;
1563 }
1564 ptr += ptr[1];
1565 }
1566 wl1271_error("ad-hoc beacon template has no SSID!\n");
1567}
1568
1552static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, 1569static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
1553 struct ieee80211_vif *vif, 1570 struct ieee80211_vif *vif,
1554 struct ieee80211_bss_conf *bss_conf, 1571 struct ieee80211_bss_conf *bss_conf,
@@ -1566,40 +1583,17 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
1566 if (ret < 0) 1583 if (ret < 0)
1567 goto out; 1584 goto out;
1568 1585
1569 if ((changed & BSS_CHANGED_BSSID) &&
1570 /*
1571 * Now we know the correct bssid, so we send a new join command
1572 * and enable the BSSID filter
1573 */
1574 memcmp(wl->bssid, bss_conf->bssid, ETH_ALEN)) {
1575 wl->rx_config |= CFG_BSSID_FILTER_EN;
1576 memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN);
1577 ret = wl1271_cmd_build_null_data(wl);
1578 if (ret < 0) {
1579 wl1271_warning("cmd buld null data failed %d",
1580 ret);
1581 goto out_sleep;
1582 }
1583 ret = wl1271_cmd_join(wl);
1584 if (ret < 0) {
1585 wl1271_warning("cmd join failed %d", ret);
1586 goto out_sleep;
1587 }
1588 set_bit(WL1271_FLAG_JOINED, &wl->flags);
1589 }
1590
1591 if (wl->bss_type == BSS_TYPE_IBSS) { 1586 if (wl->bss_type == BSS_TYPE_IBSS) {
1592 /* FIXME: This implements rudimentary ad-hoc support - 1587 /* FIXME: This implements rudimentary ad-hoc support -
1593 proper templates are on the wish list and notification 1588 proper templates are on the wish list and notification
1594 on when they change. This patch will update the templates 1589 on when they change. This patch will update the templates
1595 on every call to this function. Also, the firmware will not 1590 on every call to this function. */
1596 answer to probe-requests as it does not have the proper
1597 SSID set in the JOIN command. The probe-response template
1598 is set nevertheless, as the FW will ASSERT without it */
1599 struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); 1591 struct sk_buff *beacon = ieee80211_beacon_get(hw, vif);
1600 1592
1601 if (beacon) { 1593 if (beacon) {
1602 struct ieee80211_hdr *hdr; 1594 struct ieee80211_hdr *hdr;
1595
1596 wl1271_ssid_set(wl, beacon);
1603 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON, 1597 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON,
1604 beacon->data, 1598 beacon->data,
1605 beacon->len); 1599 beacon->len);
@@ -1624,6 +1618,29 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
1624 } 1618 }
1625 } 1619 }
1626 1620
1621 if ((changed & BSS_CHANGED_BSSID) &&
1622 /*
1623 * Now we know the correct bssid, so we send a new join command
1624 * and enable the BSSID filter
1625 */
1626 memcmp(wl->bssid, bss_conf->bssid, ETH_ALEN)) {
1627 wl->rx_config |= CFG_BSSID_FILTER_EN;
1628 memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN);
1629 ret = wl1271_cmd_build_null_data(wl);
1630 if (ret < 0) {
1631 wl1271_warning("cmd buld null data failed %d",
1632 ret);
1633 goto out_sleep;
1634 }
1635
1636 ret = wl1271_cmd_join(wl);
1637 if (ret < 0) {
1638 wl1271_warning("cmd join failed %d", ret);
1639 goto out_sleep;
1640 }
1641 set_bit(WL1271_FLAG_JOINED, &wl->flags);
1642 }
1643
1627 if (changed & BSS_CHANGED_ASSOC) { 1644 if (changed & BSS_CHANGED_ASSOC) {
1628 if (bss_conf->assoc) { 1645 if (bss_conf->assoc) {
1629 wl->aid = bss_conf->aid; 1646 wl->aid = bss_conf->aid;