From: Luciano Coelho <luciano.coelho@nokia.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org,
Juuso Oikarinen <juuso.oikarinen@nokia.com>
Subject: [PATCH 15/24] wl1271: Fix ad-hoc mode handling
Date: Fri, 26 Mar 2010 12:53:24 +0200 [thread overview]
Message-ID: <1269600813-32145-16-git-send-email-luciano.coelho@nokia.com> (raw)
In-Reply-To: <1269600813-32145-1-git-send-email-luciano.coelho@nokia.com>
From: Juuso Oikarinen <juuso.oikarinen@nokia.com>
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>
---
drivers/net/wireless/wl12xx/wl1271.h | 2 +
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 c939680..37ad5cd 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -55,6 +55,7 @@ enum {
DEBUG_ACX = BIT(13),
DEBUG_SDIO = BIT(14),
DEBUG_FILTERS = BIT(15),
+ DEBUG_ADHOC = BIT(16),
DEBUG_ALL = ~0,
};
@@ -389,6 +390,7 @@ struct wl1271 {
u8 bssid[ETH_ALEN];
u8 mac_addr[ETH_ALEN];
u8 bss_type;
+ u8 set_bss_type;
u8 ssid[IW_ESSID_MAX_SIZE + 1];
u8 ssid_len;
int channel;
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 00e856c..49f37b0 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,
switch (vif->type) {
case NL80211_IFTYPE_STATION:
wl->bss_type = BSS_TYPE_STA_BSS;
+ wl->set_bss_type = BSS_TYPE_STA_BSS;
break;
case NL80211_IFTYPE_ADHOC:
wl->bss_type = BSS_TYPE_IBSS;
+ wl->set_bss_type = BSS_TYPE_STA_BSS;
break;
default:
ret = -EOPNOTSUPP;
@@ -1065,6 +1067,7 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw,
memset(wl->ssid, 0, IW_ESSID_MAX_SIZE + 1);
wl->ssid_len = 0;
wl->bss_type = MAX_BSS_TYPE;
+ wl->set_bss_type = MAX_BSS_TYPE;
wl->band = IEEE80211_BAND_2GHZ;
wl->rx_counter = 0;
@@ -1137,10 +1140,7 @@ static int wl1271_join_channel(struct wl1271 *wl, int channel)
/* pass through frames from all BSS */
wl1271_configure_filters(wl, FIF_OTHER_BSS);
- /* the dummy join is performed always with STATION BSS type to allow
- also ad-hoc mode to listen to the surroundings without sending any
- beacons yet. */
- ret = wl1271_cmd_join(wl, BSS_TYPE_STA_BSS);
+ ret = wl1271_cmd_join(wl, wl->set_bss_type);
if (ret < 0)
goto out;
@@ -1211,7 +1211,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
test_bit(WL1271_FLAG_JOINED, &wl->flags)) {
wl->channel = channel;
/* 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)
wl1271_warning("cmd join to update channel failed %d",
ret);
@@ -1575,13 +1575,12 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
if (ret < 0)
goto out;
- if (wl->bss_type == BSS_TYPE_IBSS) {
- /* FIXME: This implements rudimentary ad-hoc support -
- 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. */
+ if ((changed && BSS_CHANGED_BEACON) &&
+ (wl->bss_type == BSS_TYPE_IBSS)) {
struct sk_buff *beacon = ieee80211_beacon_get(hw, vif);
+ wl1271_debug(DEBUG_ADHOC, "ad-hoc beacon updated");
+
if (beacon) {
struct ieee80211_hdr *hdr;
@@ -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) &&
/*
* 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,
}
if (do_join) {
- ret = wl1271_cmd_join(wl, wl->bss_type);
+ ret = wl1271_cmd_join(wl, wl->set_bss_type);
if (ret < 0) {
wl1271_warning("cmd join failed %d", ret);
goto out_sleep;
--
1.6.3.3
next prev parent reply other threads:[~2010-03-26 10:54 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
2010-03-26 10:53 ` [PATCH 01/24] wl1271: fix wl1271_spi driver name Luciano Coelho
2010-03-26 10:53 ` [PATCH 02/24] wl1271: Clean up RX rate reporting Luciano Coelho
2010-03-26 10:53 ` [PATCH 03/24] wl1271: Add TX " Luciano Coelho
2010-03-26 10:53 ` [PATCH 04/24] wl1271: Fix memory leaks in SPI initialization Luciano Coelho
2010-03-26 10:53 ` [PATCH 05/24] wl1271: Fix memory leak in scan command handling Luciano Coelho
2010-03-26 10:53 ` [PATCH 06/24] wl1271: Configure clock-request drive mode to open-drain Luciano Coelho
2010-03-26 10:53 ` [PATCH 07/24] wl1271: Warnings caused by wrong format specifiers fixed Luciano Coelho
2010-03-26 10:53 ` [PATCH 08/24] wl1271: Fix memory leak in cmd_data_path Luciano Coelho
2010-03-26 10:53 ` [PATCH 09/24] wl1271: Update busyword checking mechanism Luciano Coelho
2010-03-26 10:53 ` [PATCH 10/24] wl1271: Remove device MAC-address randomization Luciano Coelho
2010-03-26 10:53 ` [PATCH 11/24] wl1271: wait for join command complete event Luciano Coelho
2010-03-26 10:53 ` [PATCH 12/24] wl1271: wait for disconnect " Luciano Coelho
2010-03-26 10:53 ` [PATCH 13/24] wl1271: remove deprecated usage of RX status noise Luciano Coelho
2010-03-26 10:53 ` [PATCH 14/24] wl1271: Disable connection monitoring while not associated Luciano Coelho
2010-03-26 10:53 ` Luciano Coelho [this message]
2010-03-26 10:53 ` [PATCH 16/24] wl1271: Update beacon interval properly for ad-hoc Luciano Coelho
2010-03-26 10:53 ` [PATCH 17/24] wl1271: Removed checking of PSM from handling BSS_LOST_EVENT Luciano Coelho
2010-03-26 10:53 ` [PATCH 18/24] wl1271: Fix memory leak in firmware crash scenario Luciano Coelho
2010-03-26 10:53 ` [PATCH 19/24] wl1271: Configure probe-request template when associated Luciano Coelho
2010-03-26 10:53 ` [PATCH 20/24] wl1271: Disconnect if PSM entry fails Luciano Coelho
2010-03-26 10:53 ` [PATCH 21/24] wl1271: Configure HW connection monitor Luciano Coelho
2010-03-26 10:53 ` [PATCH 22/24] wl1271: Add keep-alive frame template support Luciano Coelho
2010-03-26 10:53 ` [PATCH 23/24] wl1271: Enable hardware keep alive messages Luciano Coelho
2010-03-26 10:53 ` [PATCH 24/24] wl1271: Fix msleep() delay while waiting for completion Luciano Coelho
2010-03-26 13:02 ` [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 John W. Linville
2010-03-26 13:13 ` Luciano Coelho
2010-03-26 13:26 ` John W. Linville
2010-03-26 13:37 ` Luciano Coelho
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1269600813-32145-16-git-send-email-luciano.coelho@nokia.com \
--to=luciano.coelho@nokia.com \
--cc=juuso.oikarinen@nokia.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).