* [PATCH 7/8] hostap: handle interference on current channel
From: Bernhard Schmidt @ 2011-01-17 13:26 UTC (permalink / raw)
To: linux-wireless; +Cc: lrodriguez, nbd, dubowoj, zefir.kurtisi, simon.wunderlich
In-Reply-To: <201101171621.29863.bernhard.schmidt@saxnet.de>
---
src/ap/hostapd.c | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index a065fc9..1024d73 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -993,6 +993,34 @@ void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
wpa_auth_sta_associated(hapd->wpa_auth, sta->wpa_sm);
}
+static void hostapd_radar_flags_cb(struct hostapd_data *hapd)
+{
+ struct hostapd_iface *iface = hapd->iface;
+ u32 flags;
+
+ iface->radar_cac_cb = NULL;
+ iface->radar_flags_cb = NULL;
+ flags = hostapd_hw_get_radar_flags(hapd, iface->conf->channel);
+ if ((flags & HOSTAPD_CHAN_RADAR_CLEAR)) {
+ hostapd_reload_bss(hapd);
+ } else if ((flags & HOSTAPD_CHAN_RADAR_INTERFERENCE)) {
+ int chan = iface->conf->channel;
+ u32 newflags;
+ iface->conf->channel = 0;
+ if (hostapd_select_random_channel(iface))
+ iface->conf->channel = chan;
+ newflags = hostapd_hw_get_radar_flags(hapd,
+ iface->conf->channel);
+ if ((newflags & HOSTAPD_CHAN_RADAR_INTERFERENCE))
+ iface->radar_flags_cb = hostapd_radar_flags_cb;
+ else
+ hostapd_radar_flags_cb(hapd);
+ } else {
+ hostapd_channel_availability_check(hapd);
+ iface->radar_cac_cb = hostapd_radar_flags_cb;
+ }
+}
+
void hostapd_radar_flags_changed(struct hostapd_data *hapd, int freq, u32 flags)
{
struct hostapd_iface *iface = hapd->iface;
@@ -1003,4 +1031,8 @@ void hostapd_radar_flags_changed(struct hostapd_data *hapd, int freq, u32 flags)
iface->radar_flags_cb(hapd);
return;
}
+ if (iface->radar_cac_cb || iface->freq != freq)
+ return;
+ else if ((flags & HOSTAPD_CHAN_RADAR_INTERFERENCE))
+ hostapd_radar_flags_cb(hapd);
}
--
1.5.6.5
^ permalink raw reply related
* [PATCH 8/8] hostap: do not disable radar channels
From: Bernhard Schmidt @ 2011-01-17 13:27 UTC (permalink / raw)
To: linux-wireless; +Cc: lrodriguez, nbd, dubowoj, zefir.kurtisi, simon.wunderlich
In-Reply-To: <201101171621.29863.bernhard.schmidt@saxnet.de>
---
src/ap/hw_features.c | 13 -------------
1 files changed, 0 insertions(+), 13 deletions(-)
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index a7f4eda..81caf63 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -126,19 +126,6 @@ int hostapd_get_hw_features(struct hostapd_iface *iface)
/* set flag for channels we can use in current regulatory
* domain */
for (j = 0; j < feature->num_channels; j++) {
- /*
- * Disable all channels that are marked not to allow
- * IBSS operation or active scanning. In addition,
- * disable all channels that require radar detection,
- * since that (in addition to full DFS) is not yet
- * supported.
- */
- if (feature->channels[j].flag &
- (HOSTAPD_CHAN_NO_IBSS |
- HOSTAPD_CHAN_PASSIVE_SCAN |
- HOSTAPD_CHAN_RADAR))
- feature->channels[j].flag |=
- HOSTAPD_CHAN_DISABLED;
if (feature->channels[j].flag & HOSTAPD_CHAN_DISABLED)
continue;
wpa_printf(MSG_MSGDUMP, "Allowed channel: mode=%d "
--
1.5.6.5
^ permalink raw reply related
* [PATCH 6/8] hostap: request CAC before using a radar channel
From: Bernhard Schmidt @ 2011-01-17 13:23 UTC (permalink / raw)
To: linux-wireless; +Cc: lrodriguez, nbd, dubowoj, zefir.kurtisi, simon.wunderlich
In-Reply-To: <201101171621.29863.bernhard.schmidt@saxnet.de>
---
src/ap/ap_drv_ops.c | 7 ++++
src/ap/ap_drv_ops.h | 1 +
src/ap/drv_callbacks.c | 4 ++
src/ap/hostapd.c | 83 ++++++++++++++++++++++++++++++++++++++++++
src/ap/hostapd.h | 5 +++
src/ap/hw_features.c | 2 +-
src/drivers/driver.h | 9 +++++
src/drivers/driver_nl80211.c | 35 ++++++++++++++++++
8 files changed, 145 insertions(+), 1 deletions(-)
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index 7f9522a..4d260ac 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -429,6 +429,13 @@ int hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq,
return hapd->driver->set_freq(hapd->drv_priv, &data);
}
+int hostapd_radar_cac(struct hostapd_data *hapd, int enable)
+{
+ if (hapd->driver == NULL || hapd->driver->radar_cac == NULL)
+ return -1;
+ return hapd->driver->radar_cac(hapd->drv_priv, enable);
+}
+
int hostapd_set_rts(struct hostapd_data *hapd, int rts)
{
if (hapd->driver == NULL || hapd->driver->set_rts == NULL)
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
index 5bc9d01..3c51422 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -53,6 +53,7 @@ int hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd,
int hostapd_flush(struct hostapd_data *hapd);
int hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq,
int channel, int ht_enabled, int sec_channel_offset);
+int hostapd_radar_cac(struct hostapd_data *hapd, int enable);
int hostapd_set_rts(struct hostapd_data *hapd, int rts);
int hostapd_set_frag(struct hostapd_data *hapd, int frag);
int hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
index c55c42a..1006bc0 100644
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -521,6 +521,10 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
break;
hostapd_event_sta_low_ack(hapd, data->low_ack.addr);
break;
+ case EVENT_RADAR_CAC_DONE:
+ if (hapd->iface->radar_cac_cb)
+ hapd->iface->radar_cac_cb(hapd);
+ break;
case EVENT_RADAR_FLAGS_CHANGED:
hostapd_radar_flags_changed(hapd, data->radar.freq,
data->radar.flags);
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 592a01f..a065fc9 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -695,6 +695,82 @@ static int setup_interface(struct hostapd_iface *iface)
return 0;
}
}
+ return hostapd_setup_radar_complete(iface);
+}
+
+static int hostapd_channel_availability_check(struct hostapd_data *hapd)
+{
+ struct hostapd_iface *iface = hapd->iface;
+
+ iface->freq = hostapd_hw_get_freq(hapd, hapd->iconf->channel);
+ if (hostapd_set_freq(hapd, hapd->iconf->hw_mode, iface->freq,
+ hapd->iconf->channel,
+ hapd->iconf->ieee80211n,
+ hapd->iconf->secondary_channel)) {
+ wpa_printf(MSG_ERROR, "Could not set channel for "
+ "kernel driver");
+ return -1;
+ }
+
+ if (hostapd_radar_cac(hapd, 1))
+ return -1;
+
+ return 0;
+}
+
+static void hostapd_cac_done(struct hostapd_data *hapd)
+{
+ struct hostapd_iface *iface = hapd->iface;
+ u32 flags;
+
+ iface->radar_cac_cb = NULL;
+ iface->radar_flags_cb = NULL;
+ flags = hostapd_hw_get_radar_flags(hapd, iface->conf->channel);
+ if ((flags & HOSTAPD_CHAN_RADAR_CLEAR)) {
+ hostapd_setup_interface_complete(iface, 0);
+ return;
+ }
+ if ((flags & HOSTAPD_CHAN_RADAR_INTERFERENCE)) {
+ int chan = iface->conf->channel;
+ u32 newflags;
+ iface->conf->channel = 0;
+ if (hostapd_select_random_channel(iface))
+ iface->conf->channel = chan;
+ newflags = hostapd_hw_get_radar_flags(hapd,
+ iface->conf->channel);
+ if ((newflags & HOSTAPD_CHAN_RADAR_INTERFERENCE))
+ iface->radar_flags_cb = hostapd_cac_done;
+ else
+ hostapd_cac_done(hapd);
+ } else {
+ if (hostapd_channel_availability_check(hapd))
+ hostapd_setup_interface_complete(iface, 1);
+ iface->radar_cac_cb = hostapd_cac_done;
+ }
+}
+
+int hostapd_setup_radar_complete(struct hostapd_iface *iface)
+{
+ struct hostapd_data *hapd = iface->bss[0];
+ u32 flags;
+
+ flags = hostapd_hw_get_radar_flags(hapd, iface->conf->channel);
+ if ((flags & HOSTAPD_CHAN_RADAR) == 0)
+ return hostapd_setup_interface_complete(iface, 0);
+ if ((flags & HOSTAPD_CHAN_RADAR_INTERFERENCE)) {
+ hapd->iface->radar_flags_cb = hostapd_cac_done;
+ wpa_printf(MSG_DEBUG, "Interface initialization will "
+ "be completed in a callback");
+ return 0;
+ }
+ if ((flags & HOSTAPD_CHAN_RADAR_CLEAR) == 0) {
+ if (hostapd_channel_availability_check(hapd))
+ return hostapd_setup_interface_complete(iface, 1);
+ iface->radar_cac_cb = hostapd_cac_done;
+ wpa_printf(MSG_DEBUG, "Interface initialization will "
+ "be completed in a callback");
+ return 0;
+ }
return hostapd_setup_interface_complete(iface, 0);
}
@@ -919,5 +995,12 @@ void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
void hostapd_radar_flags_changed(struct hostapd_data *hapd, int freq, u32 flags)
{
+ struct hostapd_iface *iface = hapd->iface;
+
hostapd_hw_set_radar_flags(hapd, freq, flags);
+
+ if (iface->radar_flags_cb) {
+ iface->radar_flags_cb(hapd);
+ return;
+ }
}
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index e2e4234..b38a91d 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -215,6 +215,10 @@ struct hostapd_iface {
u16 ht_op_mode;
void (*scan_cb)(struct hostapd_iface *iface);
+ /* Radar handling callbacks */
+ void (*radar_cac_cb)(struct hostapd_data *hapd);
+ void (*radar_flags_cb)(struct hostapd_data *hapd);
+
int (*ctrl_iface_init)(struct hostapd_data *hapd);
void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
@@ -230,6 +234,7 @@ hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
struct hostapd_config *conf,
struct hostapd_bss_config *bss);
int hostapd_setup_interface(struct hostapd_iface *iface);
+int hostapd_setup_radar_complete(struct hostapd_iface *iface);
int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
void hostapd_interface_deinit(struct hostapd_iface *iface);
void hostapd_interface_free(struct hostapd_iface *iface);
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index 04bf210..a7f4eda 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -505,7 +505,7 @@ static void ieee80211n_check_scan(struct hostapd_iface *iface)
iface->conf->ht_capab &= ~HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET;
}
- hostapd_setup_interface_complete(iface, 0);
+ hostapd_setup_radar_complete(iface);
}
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 777f854..0bbf4bd 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1498,6 +1498,14 @@ struct wpa_driver_ops {
int (*set_freq)(void *priv, struct hostapd_freq_params *freq);
/**
+ * radar_cac - Start/stop CAC (AP only)
+ * @priv: Private driver interface data
+ * @enable: Enable/disable CAC (0 = disable, 1 = enable)
+ * Returns 0 on success, -1 on failure
+ */
+ int (*radar_cac)(void *priv, int enable);
+
+ /**
* set_rts - Set RTS threshold
* @priv: Private driver interface data
* @rts: RTS threshold in octets
@@ -2581,6 +2589,7 @@ enum wpa_event_type {
EVENT_P2P_SD_REQUEST,
EVENT_P2P_SD_RESPONSE,
+ EVENT_RADAR_CAC_DONE,
EVENT_RADAR_FLAGS_CHANGED,
};
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index d919a73..b7b7bdb 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1294,6 +1294,9 @@ static void nl80211_radar_event(struct wpa_driver_nl80211_data *drv, u32 cmd,
union wpa_event_data data;
switch (cmd) {
+ case NL80211_CMD_RADAR_CAC_DONE:
+ wpa_supplicant_event(drv->ctx, EVENT_RADAR_CAC_DONE, NULL);
+ break;
case NL80211_CMD_RADAR_FLAGS_CHANGED:
if (!tb[NL80211_FREQUENCY_ATTR_FREQ])
return;
@@ -1424,6 +1427,7 @@ static int process_event(struct nl_msg *msg, void *arg)
case NL80211_CMD_NEW_STATION:
nl80211_new_station_event(drv, tb);
break;
+ case NL80211_CMD_RADAR_CAC_DONE:
case NL80211_CMD_RADAR_FLAGS_CHANGED:
nl80211_radar_event(drv, gnlh->cmd, tb);
break;
@@ -5102,6 +5106,36 @@ static int i802_set_freq(void *priv, struct hostapd_freq_params *freq)
#ifdef HOSTAPD
+static int i802_radar_cac(void *priv, int enable)
+{
+ struct i802_bss *bss = priv;
+ struct wpa_driver_nl80211_data *drv = bss->drv;
+ struct nl_msg *msg;
+ int cmd, ret;
+
+ msg = nlmsg_alloc();
+ if (!msg)
+ return -1;
+
+ if (enable)
+ cmd = NL80211_CMD_RADAR_CAC_START;
+ else
+ cmd = NL80211_CMD_RADAR_CAC_STOP;
+
+ genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0, cmd, 0);
+ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(bss->ifname));
+
+ ret = send_and_recv_msgs(drv, msg, NULL, NULL);
+ if (ret != 0) {
+ wpa_printf(MSG_DEBUG, "nl80211: Failed to start CAC: %d (%s)",
+ ret, strerror(-ret));
+ }
+ return ret;
+
+ nla_put_failure:
+ return -1;
+}
+
static int i802_set_rts(void *priv, int rts)
{
struct i802_bss *bss = priv;
@@ -6424,6 +6458,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.hapd_deinit = i802_deinit,
.get_seqnum = i802_get_seqnum,
.flush = i802_flush,
+ .radar_cac = i802_radar_cac,
.read_sta_data = i802_read_sta_data,
.sta_deauth = i802_sta_deauth,
.sta_disassoc = i802_sta_disassoc,
--
1.5.6.5
^ permalink raw reply related
* WWAN driver for Huawei MU509 chip?
From: Brzezowski, Karen @ 2011-01-17 16:52 UTC (permalink / raw)
To: linux-wireless@vger.kernel.org
Is this the right mailing list for asking for information
on drivers for the Huawei MU509 WCDMA chip?
thanks,
Karen
^ permalink raw reply
* [PATCH] wl12xx: free firmware after booting the chip
From: Eliad Peller @ 2011-01-17 17:17 UTC (permalink / raw)
To: Luciano Coelho; +Cc: linux-wireless
There is no need to save the fw in memory after it has been
uploaded to the chip.
Signed-off-by: Eliad Peller <eliad@wizery.com>
---
drivers/net/wireless/wl12xx/main.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 8a35491..e1944b1 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -691,7 +691,6 @@ static int wl1271_fetch_firmware(struct wl1271 *wl)
goto out;
}
- vfree(wl->fw);
wl->fw_len = fw->size;
wl->fw = vmalloc(wl->fw_len);
@@ -891,7 +890,7 @@ int wl1271_plt_start(struct wl1271 *wl)
wl->state = WL1271_STATE_PLT;
wl1271_notice("firmware booted in PLT mode (%s)",
wl->chip.fw_ver);
- goto out;
+ goto out_free_fw;
irq_disable:
wl1271_disable_interrupts(wl);
@@ -911,6 +910,9 @@ power_off:
wl1271_error("firmware boot in PLT mode failed despite %d retries",
WL1271_BOOT_RETRIES);
+out_free_fw:
+ vfree(wl->fw);
+ wl->fw = NULL;
out:
mutex_unlock(&wl->mutex);
@@ -1126,7 +1128,7 @@ power_off:
if (!booted) {
wl1271_error("firmware boot failed despite %d retries",
WL1271_BOOT_RETRIES);
- goto out;
+ goto out_free_fw;
}
wl->vif = vif;
@@ -1148,6 +1150,9 @@ power_off:
wl1271_debug(DEBUG_MAC80211, "11a is %ssupported",
wl->enable_11a ? "" : "not ");
+out_free_fw:
+ vfree(wl->fw);
+ wl->fw = NULL;
out:
mutex_unlock(&wl->mutex);
@@ -3300,8 +3305,6 @@ int wl1271_free_hw(struct wl1271 *wl)
wl1271_debugfs_exit(wl);
- vfree(wl->fw);
- wl->fw = NULL;
kfree(wl->nvs);
wl->nvs = NULL;
--
1.7.0.4
^ permalink raw reply related
* Re: [PATCH] mac80211: drop non-auth 3-addr data frames when running as a 4-addr station
From: Felix Fietkau @ 2011-01-17 17:40 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linville
In-Reply-To: <1295274050.3726.11.camel@jlt3.sipsolutions.net>
On 2011-01-17 3:20 PM, Johannes Berg wrote:
> On Sat, 2011-01-15 at 14:38 +0100, Felix Fietkau wrote:
>> When running as a 4-addr station against an AP that has the 4-addr VLAN
>> interface and the main 3-addr AP interface bridged together, sometimes
>> frames originating from the station were looping back from the 3-addr AP
>> interface, causing the bridge code to emit warnings about receiving frames
>> with its own source address.
>> I'm not sure why this is happening yet, but I think it's a good idea to
>> drop all frames (except 802.1x/EAP frames) that do not match the configured
>> addressing mode, including 4-address frames sent to a 3-address station.
>> User test reports indicate that the problem goes away with this patch.
>>
>> Signed-off-by: Felix Fietkau<nbd@openwrt.org>
>> ---
>> net/mac80211/rx.c | 8 ++++++--
>> 1 files changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
>> index a6701ed..54e3108 100644
>> --- a/net/mac80211/rx.c
>> +++ b/net/mac80211/rx.c
>> @@ -1561,9 +1561,13 @@ __ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
>> sdata->vif.type == NL80211_IFTYPE_AP_VLAN&& !sdata->u.vlan.sta)
>> return -1;
>>
>> + if (!ieee80211_802_1x_port_control(rx)&&
>
> I think you need a different check there. This just checks the STA is
> authorized.
You're right. I'll fix and resend.
- Felix
^ permalink raw reply
* Re: [PATCH] wl12xx: free firmware after booting the chip
From: Johannes Berg @ 2011-01-17 17:58 UTC (permalink / raw)
To: Eliad Peller; +Cc: Luciano Coelho, linux-wireless
In-Reply-To: <1295284675-30029-1-git-send-email-eliad@wizery.com>
On Mon, 2011-01-17 at 19:17 +0200, Eliad Peller wrote:
> There is no need to save the fw in memory after it has been
> uploaded to the chip.
Are you sure it's not needed for resume? At which point userspace isn't
up so you can't load it.
johannes
^ permalink raw reply
* [PATCH 1/1] mac80211: mesh only parameter mppath maybe unused
From: wey-yi.w.guy @ 2011-01-17 18:08 UTC (permalink / raw)
To: johannes; +Cc: linux-wireless, Wey-Yi Guy
From: Wey-Yi Guy <wey-yi.w.guy@intel.com>
mppath is mesh related parameter and maybe unused
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
---
net/mac80211/tx.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index dc261bb..2378305 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1750,7 +1750,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
__le16 fc;
struct ieee80211_hdr hdr;
struct ieee80211s_hdr mesh_hdr __maybe_unused;
- struct mesh_path *mppath = NULL;
+ struct mesh_path __maybe_unused *mppath = NULL;
const u8 *encaps_data;
int encaps_len, skip_header_bytes;
int nh_pos, h_pos;
--
1.6.0.4
^ permalink raw reply related
* Re: [PATCH] wl12xx: free firmware after booting the chip
From: Eliad Peller @ 2011-01-17 18:11 UTC (permalink / raw)
To: Johannes Berg; +Cc: Luciano Coelho, linux-wireless
In-Reply-To: <1295287108.3726.49.camel@jlt3.sipsolutions.net>
good point!
does loading it on suspend makes sense, or i should abandon this patch?
On Mon, Jan 17, 2011 at 7:58 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Mon, 2011-01-17 at 19:17 +0200, Eliad Peller wrote:
>> There is no need to save the fw in memory after it has been
>> uploaded to the chip.
>
> Are you sure it's not needed for resume? At which point userspace isn't
> up so you can't load it.
>
> johannes
>
>
^ permalink raw reply
* Re: [PATCH] wl12xx: free firmware after booting the chip
From: Johannes Berg @ 2011-01-17 18:13 UTC (permalink / raw)
To: Eliad Peller; +Cc: Luciano Coelho, linux-wireless
In-Reply-To: <AANLkTikhz0p1SCP1Lm2qzR4TYdh3OH+vSzWBshfoG5-e@mail.gmail.com>
On Mon, 2011-01-17 at 20:11 +0200, Eliad Peller wrote:
> good point!
> does loading it on suspend makes sense, or i should abandon this patch?
I wouldn't, you then run into failure modes where it can't be loaded
during suspend either, etc. It's not huge anyway, is it?
johannes
^ permalink raw reply
* Re: [PATCH] wl12xx: free firmware after booting the chip
From: Eliad Peller @ 2011-01-17 19:32 UTC (permalink / raw)
To: Johannes Berg; +Cc: Luciano Coelho, linux-wireless
In-Reply-To: <1295287996.3726.50.camel@jlt3.sipsolutions.net>
it's about 270K...
i guess i'll leave it for now.
thanks!
On Mon, Jan 17, 2011 at 8:13 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Mon, 2011-01-17 at 20:11 +0200, Eliad Peller wrote:
>> good point!
>> does loading it on suspend makes sense, or i should abandon this patch?
>
> I wouldn't, you then run into failure modes where it can't be loaded
> during suspend either, etc. It's not huge anyway, is it?
>
> johannes
>
>
^ permalink raw reply
* [PATCH v4 2/2] ath9k: Add 'misc' file to debugfs, fix queue indexes.
From: greearb @ 2011-01-17 19:54 UTC (permalink / raw)
To: linux-wireless; +Cc: ath9k-devel, Ben Greear
From: Ben Greear <greearb@candelatech.com>
Add a misc file to show hardware op-mode, irq setup,
number of various types of VIFs and more.
Also, previous patches were using the wrong xmit queue
indexes. Change to use the internal ath9k indexes instead
of the mac80211 queue indexes.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
v4: Update to use iterator to gather vif stats. Print
calculated bssid mask as well. (Forgot to refresh patch
last time, so patch didn't actually match description.)
:100644 100644 b0cb792... f0c80ec... M drivers/net/wireless/ath/ath9k/debug.c
drivers/net/wireless/ath/ath9k/debug.c | 137 +++++++++++++++++++++++++++++---
1 files changed, 125 insertions(+), 12 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index b0cb792..f0c80ec 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -595,10 +595,10 @@ static const struct file_operations fops_wiphy = {
do { \
len += snprintf(buf + len, size - len, \
"%s%13u%11u%10u%10u\n", str, \
- (unsigned int)(sc->tx.txq[WME_AC_BE].elem), \
- (unsigned int)(sc->tx.txq[WME_AC_BK].elem), \
- (unsigned int)(sc->tx.txq[WME_AC_VI].elem), \
- (unsigned int)(sc->tx.txq[WME_AC_VO].elem)); \
+ (unsigned int)(sc->tx.txq[ATH_TXQ_AC_BE].elem), \
+ (unsigned int)(sc->tx.txq[ATH_TXQ_AC_BK].elem), \
+ (unsigned int)(sc->tx.txq[ATH_TXQ_AC_VI].elem), \
+ (unsigned int)(sc->tx.txq[ATH_TXQ_AC_VO].elem)); \
if (len >= size) \
goto done; \
} while(0)
@@ -607,10 +607,10 @@ do { \
do { \
len += snprintf(buf + len, size - len, \
"%s%13i%11i%10i%10i\n", str, \
- list_empty(&sc->tx.txq[WME_AC_BE].elem), \
- list_empty(&sc->tx.txq[WME_AC_BK].elem), \
- list_empty(&sc->tx.txq[WME_AC_VI].elem), \
- list_empty(&sc->tx.txq[WME_AC_VO].elem)); \
+ list_empty(&sc->tx.txq[ATH_TXQ_AC_BE].elem), \
+ list_empty(&sc->tx.txq[ATH_TXQ_AC_BK].elem), \
+ list_empty(&sc->tx.txq[ATH_TXQ_AC_VI].elem), \
+ list_empty(&sc->tx.txq[ATH_TXQ_AC_VO].elem)); \
if (len >= size) \
goto done; \
} while (0)
@@ -657,10 +657,10 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
PR("hw-tx-proc-desc: ", txprocdesc);
len += snprintf(buf + len, size - len,
"%s%11p%11p%10p%10p\n", "txq-memory-address:",
- &(sc->tx.txq[WME_AC_BE]),
- &(sc->tx.txq[WME_AC_BK]),
- &(sc->tx.txq[WME_AC_VI]),
- &(sc->tx.txq[WME_AC_VO]));
+ &(sc->tx.txq[ATH_TXQ_AC_BE]),
+ &(sc->tx.txq[ATH_TXQ_AC_BK]),
+ &(sc->tx.txq[ATH_TXQ_AC_VI]),
+ &(sc->tx.txq[ATH_TXQ_AC_VO]));
if (len >= size)
goto done;
@@ -777,6 +777,108 @@ done:
return retval;
}
+static ssize_t read_file_misc(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath_softc *sc = file->private_data;
+ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+ struct ath_hw *ah = sc->sc_ah;
+ struct ieee80211_hw *hw = sc->hw;
+ char *buf;
+ unsigned int len = 0, size = 8000;
+ ssize_t retval = 0;
+ const char *tmp;
+ unsigned int reg;
+ struct ath9k_vif_iter_data iter_data;
+
+ ath9k_calculate_iter_data(hw, NULL, &iter_data);
+
+ buf = kzalloc(size, GFP_KERNEL);
+ if (buf == NULL)
+ return -ENOMEM;
+
+ switch (sc->sc_ah->opmode) {
+ case NL80211_IFTYPE_ADHOC:
+ tmp = "ADHOC";
+ break;
+ case NL80211_IFTYPE_MESH_POINT:
+ tmp = "MESH";
+ break;
+ case NL80211_IFTYPE_AP:
+ tmp = "AP";
+ break;
+ case NL80211_IFTYPE_STATION:
+ tmp = "STATION";
+ break;
+ default:
+ tmp = "???";
+ break;
+ }
+
+ len += snprintf(buf + len, size - len,
+ "curbssid: %pM\n"
+ "OP-Mode: %s(%i)\n"
+ "Beacon-Timer-Register: 0x%x\n",
+ common->curbssid,
+ tmp, (int)(sc->sc_ah->opmode),
+ REG_READ(ah, AR_BEACON_PERIOD));
+
+ reg = REG_READ(ah, AR_TIMER_MODE);
+ len += snprintf(buf + len, size - len, "Timer-Mode-Register: 0x%x (",
+ reg);
+ if (reg & AR_TBTT_TIMER_EN)
+ len += snprintf(buf + len, size - len, "TBTT ");
+ if (reg & AR_DBA_TIMER_EN)
+ len += snprintf(buf + len, size - len, "DBA ");
+ if (reg & AR_SWBA_TIMER_EN)
+ len += snprintf(buf + len, size - len, "SWBA ");
+ if (reg & AR_HCF_TIMER_EN)
+ len += snprintf(buf + len, size - len, "HCF ");
+ if (reg & AR_TIM_TIMER_EN)
+ len += snprintf(buf + len, size - len, "TIM ");
+ if (reg & AR_DTIM_TIMER_EN)
+ len += snprintf(buf + len, size - len, "DTIM ");
+ len += snprintf(buf + len, size - len, ")\n");
+
+ reg = sc->sc_ah->imask;
+ len += snprintf(buf + len, size - len, "imask: 0x%x (", reg);
+ if (reg & ATH9K_INT_SWBA)
+ len += snprintf(buf + len, size - len, "SWBA ");
+ if (reg & ATH9K_INT_BMISS)
+ len += snprintf(buf + len, size - len, "BMISS ");
+ if (reg & ATH9K_INT_CST)
+ len += snprintf(buf + len, size - len, "CST ");
+ if (reg & ATH9K_INT_RX)
+ len += snprintf(buf + len, size - len, "RX ");
+ if (reg & ATH9K_INT_RXHP)
+ len += snprintf(buf + len, size - len, "RXHP ");
+ if (reg & ATH9K_INT_RXLP)
+ len += snprintf(buf + len, size - len, "RXLP ");
+ if (reg & ATH9K_INT_BB_WATCHDOG)
+ len += snprintf(buf + len, size - len, "BB_WATCHDOG ");
+ /* there are other IRQs if one wanted to add them. */
+ len += snprintf(buf + len, size - len, ")\n");
+
+ len += snprintf(buf + len, size - len,
+ "VIF Counts: AP: %i STA: %i MESH: %i WDS: %i"
+ " ADHOC: %i OTHER: %i nvifs: %hi beacon-vifs: %hi\n",
+ iter_data.naps, iter_data.nstations, iter_data.nmeshes,
+ iter_data.nwds, iter_data.nadhocs, iter_data.nothers,
+ sc->nvifs, sc->nbcnvifs);
+
+ len += snprintf(buf + len, size - len,
+ "Calculated-BSSID-Mask: %pM\n",
+ iter_data.mask);
+
+ if (len > size)
+ len = size;
+
+ retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
+ kfree(buf);
+
+ return retval;
+}
+
void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
struct ath_tx_status *ts)
{
@@ -822,6 +924,13 @@ static const struct file_operations fops_stations = {
.llseek = default_llseek,
};
+static const struct file_operations fops_misc = {
+ .read = read_file_misc,
+ .open = ath9k_debugfs_open,
+ .owner = THIS_MODULE,
+ .llseek = default_llseek,
+};
+
static ssize_t read_file_recv(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
@@ -1063,6 +1172,10 @@ int ath9k_init_debug(struct ath_hw *ah)
sc, &fops_stations))
goto err;
+ if (!debugfs_create_file("misc", S_IRUSR, sc->debug.debugfs_phy,
+ sc, &fops_misc))
+ goto err;
+
if (!debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy,
sc, &fops_recv))
goto err;
--
1.7.2.3
^ permalink raw reply related
* Compat-wireless release for 2011-01-17 is baked
From: Compat-wireless cronjob account @ 2011-01-17 20:04 UTC (permalink / raw)
To: linux-wireless
>From git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next
bed36d7..3281fc3 history -> origin/history
+ e8883f8...f6c6cea master -> origin/master (forced update)
6ab8219..8a335bc stable -> origin/stable
* [new tag] next-20110117 -> next-20110117
compat-wireless code metrics
782520 - Total upstream lines of code being pulled
2103 - backport code changes
1843 - backport code additions
260 - backport code deletions
7279 - backport from compat module
9382 - total backport code
1.1989 - % of code consists of backport work
1531 - Crap changes not yet posted
1488 - Crap additions not yet posted
43 - Crap deletions not yet posted
0.1956 - % of crap code
Base tree: linux-next.git
Base tree version: next-20110117
compat-wireless release: compat-wireless-2011-01-06-3-g8db1608-pc
^ permalink raw reply
* Re: [PATCH 2] cfg80211: Extend channel to frequency mapping for 802.11j
From: Brian Prodoehl @ 2011-01-17 20:17 UTC (permalink / raw)
To: Bruno Randolf
Cc: johannes, linville, gwingerde, libertas-dev, dcbw, IvDoorn,
linux-wireless, users
In-Reply-To: <20110117043728.8024.13541.stgit@localhost6.localdomain6>
On Sun, Jan 16, 2011 at 11:37 PM, Bruno Randolf <br1@einfach.org> wrote:
> Extend channel to frequency mapping for 802.11j Japan 4.9GHz band, according to
> IEEE802.11 section 17.3.8.3.2 and Annex J. Because there are now overlapping
> channel numbers in the 2GHz and 5GHz band we can't map from channel to
> frequency without knowing the band. This is no problem as in most contexts we
> know the band. In places where we don't know the band (and WEXT compatibility)
> we assume the 2GHz band for channels below 14.
>
> This patch does not implement all channel to frequency mappings defined in
> 802.11, it's just an extension for 802.11j 20MHz channels. 5MHz and 10MHz
> channels as well as 802.11y channels have been omitted.
>
> The following drivers have been updated to reflect the API changes:
> iwl-3945, iwl-agn, iwmc3200wifi, libertas, mwl8k, rt2x00, wl1251, wl12xx.
> The drivers have been compile-tested only.
>
> Signed-off-by: Bruno Randolf <br1@einfach.org>
>
> ---
>
> v2: Added necessary driver changes first posted by Brian Prodoehl.
> Brian, do you want to add your Signed-off-by?
> ---
> drivers/net/wireless/iwlwifi/iwl-3945.c | 5 ++--
> drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 5 ++--
> drivers/net/wireless/iwlwifi/iwl-core.c | 3 +-
> drivers/net/wireless/iwmc3200wifi/cfg80211.c | 3 +-
> drivers/net/wireless/iwmc3200wifi/rx.c | 7 ++++-
> drivers/net/wireless/libertas/cfg.c | 6 +++-
> drivers/net/wireless/mwl8k.c | 6 +++-
> drivers/net/wireless/rt2x00/rt2x00dev.c | 5 +++-
> drivers/net/wireless/wl1251/rx.c | 3 +-
> drivers/net/wireless/wl12xx/rx.c | 2 +
> include/net/cfg80211.h | 3 +-
> net/mac80211/ibss.c | 3 +-
> net/mac80211/mesh.c | 2 +
> net/mac80211/mlme.c | 8 ++++--
> net/mac80211/scan.c | 3 +-
> net/wireless/reg.c | 6 ++--
> net/wireless/util.c | 36 ++++++++++++++++----------
> net/wireless/wext-compat.c | 5 +++-
> 18 files changed, 71 insertions(+), 40 deletions(-)
>
> diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
> index a9b852b..1d9dcd7 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-3945.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
> @@ -594,10 +594,11 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
>
> rx_status.flag = 0;
> rx_status.mactime = le64_to_cpu(rx_end->timestamp);
> - rx_status.freq =
> - ieee80211_channel_to_frequency(le16_to_cpu(rx_hdr->channel));
> rx_status.band = (rx_hdr->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ?
> IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
> + rx_status.freq =
> + ieee80211_channel_to_frequency(le16_to_cpu(rx_hdr->channel),
> + rx_status.band);
>
> rx_status.rate_idx = iwl3945_hwrate_to_plcp_idx(rx_hdr->rate);
> if (rx_status.band == IEEE80211_BAND_5GHZ)
> diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
> index 3dee87e..a800318 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
> @@ -1157,10 +1157,11 @@ void iwlagn_rx_reply_rx(struct iwl_priv *priv,
>
> /* rx_status carries information about the packet to mac80211 */
> rx_status.mactime = le64_to_cpu(phy_res->timestamp);
> - rx_status.freq =
> - ieee80211_channel_to_frequency(le16_to_cpu(phy_res->channel));
> rx_status.band = (phy_res->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ?
> IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
> + rx_status.freq =
> + ieee80211_channel_to_frequency(le16_to_cpu(phy_res->channel),
> + rx_status.band);
> rx_status.rate_idx =
> iwlagn_hwrate_to_mac80211_idx(rate_n_flags, rx_status.band);
> rx_status.flag = 0;
> diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
> index efbde1f..a8d4a93 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-core.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-core.c
> @@ -227,7 +227,8 @@ int iwlcore_init_geos(struct iwl_priv *priv)
> geo_ch = &sband->channels[sband->n_channels++];
>
> geo_ch->center_freq =
> - ieee80211_channel_to_frequency(ch->channel);
> + ieee80211_channel_to_frequency(ch->channel,
> + sband->band);
> geo_ch->max_power = ch->max_power_avg;
> geo_ch->max_antenna_gain = 0xff;
> geo_ch->hw_value = ch->channel;
> diff --git a/drivers/net/wireless/iwmc3200wifi/cfg80211.c b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
> index 5a49822..ed57e44 100644
> --- a/drivers/net/wireless/iwmc3200wifi/cfg80211.c
> +++ b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
> @@ -287,7 +287,8 @@ int iwm_cfg80211_inform_bss(struct iwm_priv *iwm)
> return -EINVAL;
> }
>
> - freq = ieee80211_channel_to_frequency(umac_bss->channel);
> + freq = ieee80211_channel_to_frequency(umac_bss->channel,
> + band->band);
> channel = ieee80211_get_channel(wiphy, freq);
> signal = umac_bss->rssi * 100;
>
> diff --git a/drivers/net/wireless/iwmc3200wifi/rx.c b/drivers/net/wireless/iwmc3200wifi/rx.c
> index a944893..9a57cf6 100644
> --- a/drivers/net/wireless/iwmc3200wifi/rx.c
> +++ b/drivers/net/wireless/iwmc3200wifi/rx.c
> @@ -543,7 +543,10 @@ static int iwm_mlme_assoc_complete(struct iwm_priv *iwm, u8 *buf,
> switch (le32_to_cpu(complete->status)) {
> case UMAC_ASSOC_COMPLETE_SUCCESS:
> chan = ieee80211_get_channel(wiphy,
> - ieee80211_channel_to_frequency(complete->channel));
> + ieee80211_channel_to_frequency(complete->channel,
> + complete->band == UMAC_BAND_2GHZ ?
> + IEEE80211_BAND_2GHZ :
> + IEEE80211_BAND_5GHZ));
> if (!chan || chan->flags & IEEE80211_CHAN_DISABLED) {
> /* Associated to a unallowed channel, disassociate. */
> __iwm_invalidate_mlme_profile(iwm);
> @@ -841,7 +844,7 @@ static int iwm_mlme_update_bss_table(struct iwm_priv *iwm, u8 *buf,
> goto err;
> }
>
> - freq = ieee80211_channel_to_frequency(umac_bss->channel);
> + freq = ieee80211_channel_to_frequency(umac_bss->channel, band->band);
> channel = ieee80211_get_channel(wiphy, freq);
> signal = umac_bss->rssi * 100;
>
> diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
> index 698a1f7..30ef035 100644
> --- a/drivers/net/wireless/libertas/cfg.c
> +++ b/drivers/net/wireless/libertas/cfg.c
> @@ -607,7 +607,8 @@ static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy,
> /* No channel, no luck */
> if (chan_no != -1) {
> struct wiphy *wiphy = priv->wdev->wiphy;
> - int freq = ieee80211_channel_to_frequency(chan_no);
> + int freq = ieee80211_channel_to_frequency(chan_no,
> + IEEE80211_BAND_2GHZ);
> struct ieee80211_channel *channel =
> ieee80211_get_channel(wiphy, freq);
>
> @@ -1597,7 +1598,8 @@ static int lbs_get_survey(struct wiphy *wiphy, struct net_device *dev,
> lbs_deb_enter(LBS_DEB_CFG80211);
>
> survey->channel = ieee80211_get_channel(wiphy,
> - ieee80211_channel_to_frequency(priv->channel));
> + ieee80211_channel_to_frequency(priv->channel,
> + IEEE80211_BAND_2GHZ));
>
> ret = lbs_get_rssi(priv, &signal, &noise);
> if (ret == 0) {
> diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
> index 809f2bf..b62f7ef 100644
> --- a/drivers/net/wireless/mwl8k.c
> +++ b/drivers/net/wireless/mwl8k.c
> @@ -906,7 +906,8 @@ mwl8k_rxd_8366_ap_process(void *_rxd, struct ieee80211_rx_status *status,
> } else {
> status->band = IEEE80211_BAND_2GHZ;
> }
> - status->freq = ieee80211_channel_to_frequency(rxd->channel);
> + status->freq = ieee80211_channel_to_frequency(rxd->channel,
> + status->band);
>
> *qos = rxd->qos_control;
>
> @@ -1013,7 +1014,8 @@ mwl8k_rxd_sta_process(void *_rxd, struct ieee80211_rx_status *status,
> } else {
> status->band = IEEE80211_BAND_2GHZ;
> }
> - status->freq = ieee80211_channel_to_frequency(rxd->channel);
> + status->freq = ieee80211_channel_to_frequency(rxd->channel,
> + status->band);
>
> *qos = rxd->qos_control;
> if ((rxd->rx_ctrl & MWL8K_STA_RX_CTRL_DECRYPT_ERROR) &&
> diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
> index 9597a03..31b7db0 100644
> --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
> +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
> @@ -649,7 +649,10 @@ static void rt2x00lib_channel(struct ieee80211_channel *entry,
> const int channel, const int tx_power,
> const int value)
> {
> - entry->center_freq = ieee80211_channel_to_frequency(channel);
> + /* XXX: this assumption about the band is wrong for 802.11j */
> + entry->band = channel <= 14 ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
> + entry->center_freq = ieee80211_channel_to_frequency(channel,
> + entry->band);
> entry->hw_value = value;
> entry->max_power = tx_power;
> entry->max_antenna_gain = 0xff;
> diff --git a/drivers/net/wireless/wl1251/rx.c b/drivers/net/wireless/wl1251/rx.c
> index efa5360..86eef45 100644
> --- a/drivers/net/wireless/wl1251/rx.c
> +++ b/drivers/net/wireless/wl1251/rx.c
> @@ -78,7 +78,8 @@ static void wl1251_rx_status(struct wl1251 *wl,
> */
> wl->noise = desc->rssi - desc->snr / 2;
>
> - status->freq = ieee80211_channel_to_frequency(desc->channel);
> + status->freq = ieee80211_channel_to_frequency(desc->channel,
> + status->band);
>
> status->flag |= RX_FLAG_TSFT;
>
> diff --git a/drivers/net/wireless/wl12xx/rx.c b/drivers/net/wireless/wl12xx/rx.c
> index 682304c..ec8d843 100644
> --- a/drivers/net/wireless/wl12xx/rx.c
> +++ b/drivers/net/wireless/wl12xx/rx.c
> @@ -76,7 +76,7 @@ static void wl1271_rx_status(struct wl1271 *wl,
> */
> wl->noise = desc->rssi - (desc->snr >> 1);
>
> - status->freq = ieee80211_channel_to_frequency(desc->channel);
> + status->freq = ieee80211_channel_to_frequency(desc->channel, desc_band);
>
> if (desc->flags & WL1271_RX_DESC_ENCRYPT_MASK) {
> status->flag |= RX_FLAG_IV_STRIPPED | RX_FLAG_MMIC_STRIPPED;
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index 1322695..679a049 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -1790,8 +1790,9 @@ static inline void *wdev_priv(struct wireless_dev *wdev)
> /**
> * ieee80211_channel_to_frequency - convert channel number to frequency
> * @chan: channel number
> + * @band: band, necessary due to channel number overlap
> */
> -extern int ieee80211_channel_to_frequency(int chan);
> +extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band);
>
> /**
> * ieee80211_frequency_to_channel - convert frequency to channel number
> diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
> index 53c7077..775fb63 100644
> --- a/net/mac80211/ibss.c
> +++ b/net/mac80211/ibss.c
> @@ -270,7 +270,8 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
> enum ieee80211_band band = rx_status->band;
>
> if (elems->ds_params && elems->ds_params_len == 1)
> - freq = ieee80211_channel_to_frequency(elems->ds_params[0]);
> + freq = ieee80211_channel_to_frequency(elems->ds_params[0],
> + band);
> else
> freq = rx_status->freq;
>
> diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
> index 2563fd1..2a57cc0 100644
> --- a/net/mac80211/mesh.c
> +++ b/net/mac80211/mesh.c
> @@ -574,7 +574,7 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
> &elems);
>
> if (elems.ds_params && elems.ds_params_len == 1)
> - freq = ieee80211_channel_to_frequency(elems.ds_params[0]);
> + freq = ieee80211_channel_to_frequency(elems.ds_params[0], band);
> else
> freq = rx_status->freq;
>
> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index 45fbb9e..33bd6d4 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -176,7 +176,7 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
>
> /* check that channel matches the right operating channel */
> if (local->hw.conf.channel->center_freq !=
> - ieee80211_channel_to_frequency(hti->control_chan))
> + ieee80211_channel_to_frequency(hti->control_chan, sband->band))
> enable_ht = false;
>
> if (enable_ht) {
> @@ -429,7 +429,8 @@ void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
> container_of((void *)bss, struct cfg80211_bss, priv);
> struct ieee80211_channel *new_ch;
> struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
> - int new_freq = ieee80211_channel_to_frequency(sw_elem->new_ch_num);
> + int new_freq = ieee80211_channel_to_frequency(sw_elem->new_ch_num,
> + cbss->channel->band);
>
> ASSERT_MGD_MTX(ifmgd);
>
> @@ -1519,7 +1520,8 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
> }
>
> if (elems->ds_params && elems->ds_params_len == 1)
> - freq = ieee80211_channel_to_frequency(elems->ds_params[0]);
> + freq = ieee80211_channel_to_frequency(elems->ds_params[0],
> + rx_status->band);
> else
> freq = rx_status->freq;
>
> diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
> index fb274db..1ef73be 100644
> --- a/net/mac80211/scan.c
> +++ b/net/mac80211/scan.c
> @@ -196,7 +196,8 @@ ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
> ieee802_11_parse_elems(elements, skb->len - baselen, &elems);
>
> if (elems.ds_params && elems.ds_params_len == 1)
> - freq = ieee80211_channel_to_frequency(elems.ds_params[0]);
> + freq = ieee80211_channel_to_frequency(elems.ds_params[0],
> + rx_status->band);
> else
> freq = rx_status->freq;
>
> diff --git a/net/wireless/reg.c b/net/wireless/reg.c
> index 37693b6..c565689 100644
> --- a/net/wireless/reg.c
> +++ b/net/wireless/reg.c
> @@ -1801,9 +1801,9 @@ void regulatory_hint_disconnect(void)
>
> static bool freq_is_chan_12_13_14(u16 freq)
> {
> - if (freq == ieee80211_channel_to_frequency(12) ||
> - freq == ieee80211_channel_to_frequency(13) ||
> - freq == ieee80211_channel_to_frequency(14))
> + if (freq == ieee80211_channel_to_frequency(12, IEEE80211_BAND_2GHZ) ||
> + freq == ieee80211_channel_to_frequency(13, IEEE80211_BAND_2GHZ) ||
> + freq == ieee80211_channel_to_frequency(14, IEEE80211_BAND_2GHZ))
> return true;
> return false;
> }
> diff --git a/net/wireless/util.c b/net/wireless/util.c
> index 7620ae2..4ed065d 100644
> --- a/net/wireless/util.c
> +++ b/net/wireless/util.c
> @@ -29,29 +29,37 @@ ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
> }
> EXPORT_SYMBOL(ieee80211_get_response_rate);
>
> -int ieee80211_channel_to_frequency(int chan)
> +int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band)
> {
> - if (chan < 14)
> - return 2407 + chan * 5;
> -
> - if (chan == 14)
> - return 2484;
> -
> - /* FIXME: 802.11j 17.3.8.3.2 */
> - return (chan + 1000) * 5;
> + /* see 802.11 17.3.8.3.2 and Annex J
> + * there are overlapping channel numbers in 5GHz and 2GHz bands */
> + if (band == IEEE80211_BAND_5GHZ) {
> + if (chan >= 182 && chan <= 196)
> + return 4000 + chan * 5;
> + else
> + return 5000 + chan * 5;
> + } else { /* IEEE80211_BAND_2GHZ */
> + if (chan == 14)
> + return 2484;
> + else if (chan < 14)
> + return 2407 + chan * 5;
> + else
> + return 0; /* not supported */
> + }
> }
> EXPORT_SYMBOL(ieee80211_channel_to_frequency);
>
> int ieee80211_frequency_to_channel(int freq)
> {
> + /* see 802.11 17.3.8.3.2 and Annex J */
> if (freq == 2484)
> return 14;
> -
> - if (freq < 2484)
> + else if (freq < 2484)
> return (freq - 2407) / 5;
> -
> - /* FIXME: 802.11j 17.3.8.3.2 */
> - return freq/5 - 1000;
> + else if (freq >= 4910 && freq <= 4980)
> + return (freq - 4000) / 5;
> + else
> + return (freq - 5000) / 5;
> }
> EXPORT_SYMBOL(ieee80211_frequency_to_channel);
>
> diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
> index 3e5dbd4..7f1f4ec 100644
> --- a/net/wireless/wext-compat.c
> +++ b/net/wireless/wext-compat.c
> @@ -267,9 +267,12 @@ int cfg80211_wext_freq(struct wiphy *wiphy, struct iw_freq *freq)
> * -EINVAL for impossible things.
> */
> if (freq->e == 0) {
> + enum ieee80211_band band = IEEE80211_BAND_2GHZ;
> if (freq->m < 0)
> return 0;
> - return ieee80211_channel_to_frequency(freq->m);
> + if (freq->m > 14)
> + band = IEEE80211_BAND_5GHZ;
> + return ieee80211_channel_to_frequency(freq->m, band);
> } else {
> int i, div = 1000000;
> for (i = 0; i < freq->e; i++)
Yeah, looks good. Is it worth noting that none of the drivers
actually support the 802.11j channels yet? Not sure of the format of
follow-up s-o-b's, so here goes...
Signed-off-by: Brian Prodoehl <bprodoehl@gmail.com>
^ permalink raw reply
* Logs spammed by associate / authenticate / CRDA calls
From: Larry Finger @ 2011-01-17 20:18 UTC (permalink / raw)
To: wireless
I have just gotten the mac80211 code for the RTL8192CU devices for integration
into wireless-testing and then to mainline. All seems to be working, but I get a
lot of disassociation./reassociation messages followed by a call to CRDA. The
output from an 'iw event -t -f' command is the following:
1295294459.884470: wlan22 (phy #4): connected to c0:3f:0e:be:2b:45
1295294530.254474: wlan22 (phy #4): unknown event 64
1295294537.006563: wlan22 (phy #4): scan started
1295294538.642236: wlan22 (phy #4): scan finished: 2412 2417 2422 2427 2432 2437
2442 2447 2452 2457 2462 2467 2472, ""
1295294538.738591: wlan22 (phy #4): deauth 00:1f:1f:c8:8e:cb ->
c0:3f:0e:be:2b:45 reason 4: Disassociated due to inactivity [frame: c0 00 00 00
c0 3f 0e be 2b 45 00 1f 1f c8 8e cb c0 3f 0e be 2b 45 00 00 04 00]
1295294538.738858: wlan22 (phy #4): disconnected (local request)
1295294538.779587: phy #0: regulatory domain change: set to world roaming by the
wireless core upon initialization request
1295294538.861421: wlan22 (phy #4): scan started
1295294539.894265: wlan22 (phy #4): scan finished: 2412 2417 2422 2427 2432 2437
2442 2447 2452 2457 2462 2467 2472, "lwfdjf_rad"
1295294539.937094: wlan22 (phy #4): auth c0:3f:0e:be:2b:45 -> 00:1f:1f:c8:8e:cb
status: 0: Successful [frame: b0 00 3a 01 00 1f 1f c8 8e cb c0 3f 0e be 2b 45 c0
3f 0e be 2b 45 a0 52 00 00 02 00 00 00 dd 09 00 10 18 02 02 f0 04 00 00]
1295294539.941963: wlan22: unknown event 19
1295294539.948184: wlan22 (phy #4): assoc c0:3f:0e:be:2b:45 -> 00:1f:1f:c8:8e:cb
status: 0: Successful [frame: 10 00 3a 01 00 1f 1f c8 8e cb c0 3f 0e be 2b 45 c0
3f 0e be 2b 45 b0 52 11 04 00 00 03 c0 01 08 82 84 8b 96 24 30 48 6c 32 04 0c 12
18 60 dd 09 00 10 18 02 02 f0 04 00 00 dd 18 00 50 f2 02 01 01 80 00 03 a4 00 00
27 a4 00 00 42 43 5e 00 62 32 2f 00]
1295294539.948508: wlan22 (phy #4): connected to c0:3f:0e:be:2b:45
1295294637.011546: wlan22 (phy #4): scan started
1295294638.646848: wlan22 (phy #4): scan finished: 2412 2417 2422 2427 2432 2437
2442 2447 2452 2457 2462 2467 2472, ""
1295294638.726666: wlan22 (phy #4): deauth 00:1f:1f:c8:8e:cb ->
c0:3f:0e:be:2b:45 reason 4: Disassociated due to inactivity [frame: c0 00 00 00
c0 3f 0e be 2b 45 00 1f 1f c8 8e cb c0 3f 0e be 2b 45 00 00 04 00]
1295294638.726940: wlan22 (phy #4): disconnected (local request)
1295294638.764810: phy #0: regulatory domain change: set to world roaming by the
wireless core upon initialization request
1295294638.845333: wlan22 (phy #4): scan started
1295294639.862231: wlan22 (phy #4): scan finished: 2412 2417 2422 2427 2432 2437
2442 2447 2452 2457 2462 2467 2472, "lwfdjf_rad"
1295294639.899905: wlan22 (phy #4): auth c0:3f:0e:be:2b:45 -> 00:1f:1f:c8:8e:cb
status: 0: Successful [frame: b0 00 3a 01 00 1f 1f c8 8e cb c0 3f 0e be 2b 45 c0
3f 0e be 2b 45 40 98 00 00 02 00 00 00 dd 09 00 10 18 02 02 f0 04 00 00]
1295294639.902684: wlan22: unknown event 19
1295294639.905854: wlan22 (phy #4): assoc c0:3f:0e:be:2b:45 -> 00:1f:1f:c8:8e:cb
status: 0: Successful [frame: 10 00 3a 01 00 1f 1f c8 8e cb c0 3f 0e be 2b 45 c0
3f 0e be 2b 45 50 98 11 04 00 00 03 c0 01 08 82 84 8b 96 24 30 48 6c 32 04 0c 12
18 60 dd 09 00 10 18 02 02 f0 04 00 00 dd 18 00 50 f2 02 01 01 80 00 03 a4 00 00
27 a4 00 00 42 43 5e 00 62 32 2f 00]
1295294639.906219: wlan22 (phy #4): connected to c0:3f:0e:be:2b:45
The MAC address for the device is 00:1F:1F:C8:8E:CB and that of the AP is
C0:3F:0E:BE:2B:45, thus corresponding with the above output.
Is scanning this often normal? I suspect it is, but I have not looged the events
before.
Although both AP and STA support 802.11n, the connection is 802.11g (max 54
Mbps) using WPA2-PSK.
What triggers the "Disassociated due to inactivity"?
Thanks,
Larry
^ permalink raw reply
* Re: Logs spammed by associate / authenticate / CRDA calls
From: Daniel Halperin @ 2011-01-17 20:26 UTC (permalink / raw)
To: Larry Finger; +Cc: wireless
In-Reply-To: <4D34A421.3070804@lwfinger.net>
On Mon, Jan 17, 2011 at 12:18 PM, Larry Finger
<Larry.Finger@lwfinger.net> wrote:
> The MAC address for the device is 00:1F:1F:C8:8E:CB and that of the AP is
> C0:3F:0E:BE:2B:45, thus corresponding with the above output.
>
> Is scanning this often normal? I suspect it is, but I have not looged the events
> before.
>
> Although both AP and STA support 802.11n, the connection is 802.11g (max 54
> Mbps) using WPA2-PSK.
>
> What triggers the "Disassociated due to inactivity"?
Scanning happens every time you associate/re-associate; disassociation
due to inactivity happens when your device doesn't send packets to the
AP for some period of time. It looks like your AP's (or device's)
timeout is 100s.
Dan
^ permalink raw reply
* Re: BUG in rt2x00lib_txdone() with 2.6.37-rc8
From: Ivo Van Doorn @ 2011-01-17 20:36 UTC (permalink / raw)
To: Ingo Brunberg; +Cc: helmut.schaa, linux-kernel, linux-wireless
In-Reply-To: <m3pqrxr1vl.fsf@ingo.homenetwork>
Hi,
On Sun, Jan 16, 2011 at 3:58 AM, Ingo Brunberg <ingo_brunberg@web.de> wrote:
> Ivo Van Doorn <ivdoorn@gmail.com> writes:
>
>> This could be, would be interesting to know if compat-wireless also shows
>> this problem. Because the queue refactoring code which should have solved
>> these race conditions was added after 2.6.37.
>
> I really would like to give it a try, but compat-wireless-2011-01-15
> crashes right on module loading. Is there a version known to work?
You could try the rt2x00-special package:
http://kernel.org/pub/linux/kernel/people/ivd/compat-rt2x00.tar.bz2
this is compat-wireless + rt2x00 patches from rt2x00.git.
For me it is working without any crashes..
Ivo
^ permalink raw reply
* Re: Logs spammed by associate / authenticate / CRDA calls
From: Ben Greear @ 2011-01-17 22:02 UTC (permalink / raw)
To: Daniel Halperin; +Cc: Larry Finger, wireless
In-Reply-To: <AANLkTin_DESckMrOMK41z3oJtXwmHvL026Mi8ayLeKLA@mail.gmail.com>
On 01/17/2011 12:26 PM, Daniel Halperin wrote:
> On Mon, Jan 17, 2011 at 12:18 PM, Larry Finger
> <Larry.Finger@lwfinger.net> wrote:
>> The MAC address for the device is 00:1F:1F:C8:8E:CB and that of the AP is
>> C0:3F:0E:BE:2B:45, thus corresponding with the above output.
>>
>> Is scanning this often normal? I suspect it is, but I have not looged the events
>> before.
>>
>> Although both AP and STA support 802.11n, the connection is 802.11g (max 54
>> Mbps) using WPA2-PSK.
>>
>> What triggers the "Disassociated due to inactivity"?
>
> Scanning happens every time you associate/re-associate; disassociation
> due to inactivity happens when your device doesn't send packets to the
> AP for some period of time. It looks like your AP's (or device's)
> timeout is 100s.
From what I can tell, this message can also happen if the local
STA thinks it cannot connect to the remote. For instance, if it
doesn't get a TX callback within 500ms for ath5k/ath9k (and perhaps
others).
Thanks,
Ben
>
> Dan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* Re: Logs spammed by associate / authenticate / CRDA calls
From: Larry Finger @ 2011-01-17 22:26 UTC (permalink / raw)
To: Ben Greear; +Cc: Daniel Halperin, wireless
In-Reply-To: <4D34BC83.2030406@candelatech.com>
On 01/17/2011 04:02 PM, Ben Greear wrote:
> On 01/17/2011 12:26 PM, Daniel Halperin wrote:
>> On Mon, Jan 17, 2011 at 12:18 PM, Larry Finger
>>
>> Scanning happens every time you associate/re-associate; disassociation
>> due to inactivity happens when your device doesn't send packets to the
>> AP for some period of time. It looks like your AP's (or device's)
>> timeout is 100s.
>
> From what I can tell, this message can also happen if the local
> STA thinks it cannot connect to the remote. For instance, if it
> doesn't get a TX callback within 500ms for ath5k/ath9k (and perhaps
> others).
Thanks Dan and Ben. It is clearly not an ordinary timeout from inactivity as it
happens even when I'm doing a download. I'll push it back to the Realtek people
to see if they can figure out a cause.
Larry
^ permalink raw reply
* Re: Fwd: [PATCH 06/10] mac80211: add HW flag for disabling auto link-PS in AP mode
From: Arik Nemtsov @ 2011-01-17 22:47 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Luciano Coelho
In-Reply-To: <1295256929.3726.2.camel@jlt3.sipsolutions.net>
On Mon, Jan 17, 2011 at 11:35, Johannes Berg <johannes@sipsolutions.net> wrote:
>
> On Sun, 2011-01-16 at 23:53 +0200, Arik Nemtsov wrote:
>
> > > Also, I'm worried about races between this and RX. All of the RX path
> > > assumes that it is running at the same time. The ap_sta_ps_{start,end}
> > > functions won't be called from the RX path when the flag is set, and
> > > this is dependent on setting the flag, but is there really nothing in
> > > them that could race?
> >
> > They might race if the user is not careful. On a SMP machine a user
> > can call ieee80211_rx() and ap_sta_ps_start() from two different
> > workqueues for example.
> > I can add an explicit mutex, but a documentation warning will suffice here no?
>
> Well, a mutex won't be possible, and we don't do "code path locking"
I meant a spinlock of course (but its not really a good idea)
>
> anyway. I'd appreciate if you could actually see which things would
> potentially race -- I took a brief look into these functions and it
> didn't look like there are actually races except of these two against
> each other maybe?
Upon closer examination, I could find no races in the RX path. A race
of ps_start/stop is possible of course, but I guess we can demand the
calls to be synchronized against each other?
I did notice some concurrency that can happen in the TX path. I think
the same essential race is described in
ieee80211_handle_filtered_frame() between RX and TX paths. Only this
time the PS state is changed manually and not in the RX handler. The
warning in ieee80211_handle_filtered_frame() can be expanded to
include:
"always change PS state of connected stations before TX status events
if ordering can be unknown, for example with different interrupt
status bits."
> > sta_notify is pretty useless when the low level driver calls toggles
> > the PS-mode by itself. How about I simply remove the call to
> > sta_notify in case IEEE80211_HW_AP_LINK_PS is set?
> > If a low level driver needs to do some deferred processing after a
> > PS-mode transition, it can queue a work on its own..
>
> Yes, that's probably a good idea -- but definitely needs to be
> documented in the sta_notify docs. OTOH, mac80211 de-bounces sta_notify
> in a way. Maybe that needs to be done for the function call as well,
> maybe via a return value?
>
I'm afraid I didn't catch your meaning here.
Regards,
Arik
^ permalink raw reply
* Re: [PATCH 2] cfg80211: Extend channel to frequency mapping for 802.11j
From: Bruno Randolf @ 2011-01-18 1:06 UTC (permalink / raw)
To: Brian Prodoehl; +Cc: johannes, linville, gwingerde, dcbw, linux-wireless
In-Reply-To: <AANLkTinx+wFDFnDrxrBS5T=RqvZgRLxFOeeibrLxorde@mail.gmail.com>
On Tue January 18 2011 05:17:31 Brian Prodoehl wrote:
> Yeah, looks good. Is it worth noting that none of the drivers
> actually support the 802.11j channels yet?
I am already using it locally in ath5k. I have it working in 4.9GHz, but i'm
not exactly sure in which cases i can enable the 4.9GHz channels. I will send
patches after the mac80211 part got merged.
> Not sure of the format of
> follow-up s-o-b's, so here goes...
>
> Signed-off-by: Brian Prodoehl <bprodoehl@gmail.com>
Not sure, either, but i hope John will pick it up. Thanks!
bruno
^ permalink raw reply
* Re: [PATCH 2] cfg80211: Extend channel to frequency mapping for 802.11j
From: Brian Prodoehl @ 2011-01-18 2:42 UTC (permalink / raw)
To: Bruno Randolf; +Cc: johannes, linville, gwingerde, dcbw, linux-wireless
In-Reply-To: <201101181006.17322.br1@einfach.org>
On Mon, Jan 17, 2011 at 8:06 PM, Bruno Randolf <br1@einfach.org> wrote:
> On Tue January 18 2011 05:17:31 Brian Prodoehl wrote:
>> Yeah, looks good. Is it worth noting that none of the drivers
>> actually support the 802.11j channels yet?
>
> I am already using it locally in ath5k. I have it working in 4.9GHz, but i'm
> not exactly sure in which cases i can enable the 4.9GHz channels. I will send
> patches after the mac80211 part got merged.
I have it working in ath9k, as well. iw needs the same tweak to
ieee80211_channel_to_frequency. Where do patches to iw get submitted?
>> Not sure of the format of
>> follow-up s-o-b's, so here goes...
>>
>> Signed-off-by: Brian Prodoehl <bprodoehl@gmail.com>
>
> Not sure, either, but i hope John will pick it up. Thanks!
>
> bruno
>
^ permalink raw reply
* Re: [PATCH 2] cfg80211: Extend channel to frequency mapping for 802.11j
From: Bruno Randolf @ 2011-01-18 2:50 UTC (permalink / raw)
To: Brian Prodoehl
Cc: johannes, linville, gwingerde, dcbw, linux-wireless, mcgrof
In-Reply-To: <AANLkTi=SbkiZE0-5bJ+jraMhCMbvyaF=L0HOq5o0LtyJ@mail.gmail.com>
On Tue January 18 2011 11:42:49 Brian Prodoehl wrote:
> On Mon, Jan 17, 2011 at 8:06 PM, Bruno Randolf <br1@einfach.org> wrote:
> > On Tue January 18 2011 05:17:31 Brian Prodoehl wrote:
> >> Yeah, looks good. Is it worth noting that none of the drivers
> >> actually support the 802.11j channels yet?
> >
> > I am already using it locally in ath5k. I have it working in 4.9GHz, but
> > i'm not exactly sure in which cases i can enable the 4.9GHz channels. I
> > will send patches after the mac80211 part got merged.
>
> I have it working in ath9k, as well.
Good to hear. Do you have any information on when we can enable these
frequencies? I'm not sure all cards are calibrated for 4.9GHz. Any info about
this from Atheros, Luis?
> iw needs the same tweak to
> ieee80211_channel_to_frequency. Where do patches to iw get submitted?
I was waiting with positng the iw part until the mac80211 patch is accepted
and merged. It should also posted on this list and cc johannes.
bruno
^ permalink raw reply
* RE: [PATCH] mwifiex: remove duplicated NULL checks
From: Bing Zhao @ 2011-01-18 3:07 UTC (permalink / raw)
To: Julian Calaby
Cc: linux-wireless@vger.kernel.org, John W. Linville, Johannes Berg,
Amitkumar Karwar, Kiran Divekar, Frank Huang
In-Reply-To: <AANLkTi=BMTLa36FXW7nNHKu8=PgPCJC517vsmDDNZcYj@mail.gmail.com>
Hi Julian,
> -----Original Message-----
> From: Julian Calaby [mailto:julian.calaby@gmail.com]
> Sent: Friday, January 14, 2011 6:59 PM
> To: Bing Zhao
> Cc: linux-wireless@vger.kernel.org; John W. Linville; Johannes Berg; Amitkumar Karwar; Kiran Divekar;
> Frank Huang
> Subject: Re: [PATCH] mwifiex: remove duplicated NULL checks
>
> On Sat, Jan 15, 2011 at 06:36, Bing Zhao <bzhao@marvell.com> wrote:
> > From: Amitkumar Karwar <akarwar@marvell.com>
> >
> > Some functions have unnecessory NULL check for an input parameter
> > because the caller to those functions is already checking the parameter
> > for NULL before calling them.
>
> It may be more readable and efficient to eliminate the NULL checks in
> the callers - and adjust the code to inform the callers of the case
> where the pointer passed is null and make the callers to properly
> handle this case.
Thank you very much for your comments.
There are still some cases that the NULL check needs to be done at the first place. For example,
/* the caller function */
enum mwifiex_status mwifiex_prepare_cmd(struct mwifiex_private *priv,
u16 cmd_no, u16 cmd_action, u32 cmd_oid,
void *ioctl_buf, void *data_buf)
......
cmd_node = mwifiex_get_cmd_node(adapter);
if (cmd_node == NULL) {
PRINTM(MERROR, "PREP_CMD: No free cmd node\n");
ret = MWIFIEX_STATUS_FAILURE;
goto done;
}
/*
Here the cmd_node is allocated and the NULL check is preformed
immediately. If the pointer is NULL then the error code is
returned for proper handling.
*/
/*
Now cmd_node is passed to the callee as a parameter
*/
mwifiex_init_cmd_node(priv, cmd_node, cmd_oid, ioctl_buf,
data_buf);
......
}
/* the callee function */
static void mwifiex_init_cmd_node(struct mwifiex_private *priv,
struct cmd_ctrl_node *cmd_node,
u32 cmd_oid, void *ioctl_buf, void *data_buf)
{
ENTER();
- if (cmd_node == NULL) {
- LEAVE();
- return;
- }
-
/*
Here it is redundant to check it again since the cmd_node
has already been validated by the caller.
*/
cmd_node->priv = priv;
cmd_node->cmd_oid = cmd_oid;
cmd_node->ioctl_buf = ioctl_buf;
......
}
>
> This should also make the driver more robust as failures can be passed
> up the stack to places that can deal with them more effectively than
> just printing a message.
I could have misunderstood your point, however. If so, could you please explain a little bit more on how you would make the changes based on above example?
Thanks in advance for your help!
Bing
>
> Thanks,
>
> --
>
> Julian Calaby
>
> Email: julian.calaby@gmail.com
> Profile: http://www.google.com/profiles/julian.calaby/
> .Plan: http://sites.google.com/site/juliancalaby/
^ permalink raw reply
* Re: [PATCH] mwifiex: remove duplicated NULL checks
From: Julian Calaby @ 2011-01-18 3:26 UTC (permalink / raw)
To: Bing Zhao
Cc: linux-wireless@vger.kernel.org, John W. Linville, Johannes Berg,
Amitkumar Karwar, Kiran Divekar, Frank Huang
In-Reply-To: <477F20668A386D41ADCC57781B1F704307F4E1BA0D@SC-VEXCH1.marvell.com>
On Tue, Jan 18, 2011 at 14:07, Bing Zhao <bzhao@marvell.com> wrote:
> Hi Julian,
>
>> -----Original Message-----
>> From: Julian Calaby [mailto:julian.calaby@gmail.com]
>> Sent: Friday, January 14, 2011 6:59 PM
>> To: Bing Zhao
>> Cc: linux-wireless@vger.kernel.org; John W. Linville; Johannes Berg; Amitkumar Karwar; Kiran Divekar;
>> Frank Huang
>> Subject: Re: [PATCH] mwifiex: remove duplicated NULL checks
>>
>> On Sat, Jan 15, 2011 at 06:36, Bing Zhao <bzhao@marvell.com> wrote:
>> > From: Amitkumar Karwar <akarwar@marvell.com>
>> >
>> > Some functions have unnecessory NULL check for an input parameter
>> > because the caller to those functions is already checking the parameter
>> > for NULL before calling them.
>>
>> It may be more readable and efficient to eliminate the NULL checks in
>> the callers - and adjust the code to inform the callers of the case
>> where the pointer passed is null and make the callers to properly
>> handle this case.
>
> Thank you very much for your comments.
>
> There are still some cases that the NULL check needs to be done at the first place. For example,
>
[snip]
In this case, dropping the null check is the right thing to do, given
that you can guarantee that all callers of mwiflex_init_cmd_node()
will check that the pointer isn't null before calling it.
>> This should also make the driver more robust as failures can be passed
>> up the stack to places that can deal with them more effectively than
>> just printing a message.
>
> I could have misunderstood your point, however. If so, could you please explain a little bit more on how you would make the changes based on above example?
I was referring more to that fact that functions that appear to do
things, e.g. mwifiex_init_cmd_node(), don't return anything - hence if
something fails within them, e.g. being passed a null pointer, they
can't notify their caller, e.g. mwifiex_prepare_cmd() that something
has gone wrong.
That said, I haven't looked at the code except through your patches,
so I can't say if this is a scenario that actually could happen, and
whether this added functionality is worthwhile.
Thanks,
--
Julian Calaby
Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox