* Re: [suspend/resume] Re: userspace notification from module
From: Rafael J. Wysocki @ 2010-01-03 21:29 UTC (permalink / raw)
To: Bartłomiej Zimoń
Cc: Andy Walls, Daniel Borkmann, linux-kernel, pm list, Alan Stern
In-Reply-To: <65e5aef6.33251eb4.4b3fecf4.a2f99@o2.pl>
On Sunday 03 January 2010, Bartłomiej Zimoń wrote:
> Dnia 3 stycznia 2010 0:29 "Rafael J. Wysocki" <rjw@sisk.pl> napisał(a):
> > > Thanks for Your answare.
> > > Some points of my idea:
> > > - don't think everyone want to use pm-utils (didn't say it is bad)
> >
> > That certainly is true, but I think these people won't have a problem setting
> > up their suspend scripts to trigger the notification anyway. :-)
> >
>
> But it means almoust always create dbus interface and send message by script.
Of course you don't need to do that. For example, you can use a UNIX domain
socket for sending the notification from one user space process (a power
manager) to another one (application wanting to be notified) and the
confirmation that's safe to suspend the other way around. Generally, arbitrary
message-passing interface between two processes would be fine IMO.
...
> > To put it in a different way, you apparently want the kernel to notify the user
> > space of an event originating from the user space and my question is why not
> > to set up the user space to generate the notification without relying on the
> > kernel to do that.
>
> Because now kernel know better what is going on.
That's because it's just been told by the user space about that.
Basically, you want something like this to happen:
process A ->(suspend) kernel
kernel ->(suspending) process B
where the kernel won't wait for process B to do whatever it has to do before
suspending. In my opinion it'd be better to do something like this
process A ->(suspending) process B
process B ->(ack) process A
process A ->(suspend) kernel
...
> > At least, that requires some more discussion, so please tell us why you need
> > the kernel to notify the user space about suspend/hibernation. IOW, what's the
> > final purpose of this? [Added some CCs.]
>
> Yes, it is only first step.
> Have created different point of view, not all linux boxes are desktops/laptops.
> What about embedeed solutions?
> Why app must implement all other to know about resume/suspend?
> Why not open file and know this easily?
And why not to open a socket?
Really, what I think you want is a standard way of notifying applications that
suspend or hibernation is going to happen, but you don't need the kernel to
take part in that directly.
Putting things into the kernel is not the only way to avoid overheads IMO.
...
> First of all i want to start discussion about this topic and looks like started :)
>
> So what was in my mind? There are lots of small devices today with linux.
> Lots of them has got unstandardized suspend/resume detection.
OK, so we need a standard here. I can't agree more. However, does that mean
the kernel has to be directly involved in that? If it does, then why exactly?
> It could be too much info exposed from kernel by this module/propose i understand
> for program info about pm_post_resume event could be anought.
>
> We have now 3types of suspend implementation and 1 kernel API inside.
> App typicaly need just 2-3 event types - suspending, resumming, idle.
> I dont want to slow down kernel suspend, block or something, just perform
> some actions in apps - typicaly try to reconnect.
> It could be new kernel standard to easy adept some actions.
>
> Why not pm-utils connect to such module and gather data?
> Then It could work as hal service.
> But hook on kernel like /sbin/init but for suspend and resume, looks like other solution.
> IOW sending event to kernel to perform action and launch userspace once
> more just before pm-event chain ... check return_val, sounds like other
> solution/ other kind of module.
Again, you don't need a kernel module for that. Moreover, using a kernel
module for that is actually inconvenient.
> What about this discusion:
> http://lists.freedesktop.org/archives/devkit-devel/2009-December/000617.html
Well, it would be nice if the desktop people sent CCs of such discussions to
linux-pm. Talking about the kernel without involving people who actually work
on it is not exactly productive IMO.
Rafael
^ permalink raw reply
* Re: Documentation/feature-removal-schedule.txt to be updated soon?
From: Greg KH @ 2010-01-03 21:29 UTC (permalink / raw)
To: Robert P. J. Day; +Cc: Linux Kernel Mailing List
In-Reply-To: <alpine.LFD.2.00.1001030652110.6587@localhost>
On Sun, Jan 03, 2010 at 06:54:10AM -0500, Robert P. J. Day wrote:
>
> as is my wont, i will mutter quietly about the amount of content in
> the file Documentation/feature-removal-schedule.txt referring to stuff
> that should have been removed ages ago (some of it is dated as far
> back as 2005).
>
> is there any plan on bringing that file up to date, and/or deleting
> stuff that's been marked for deletion for years?
Sure, feel free to send patches, and if they are rejected, send a patch
for the feature-removal-schedule.txt file removing the option there.
thanks,
greg k-h
^ permalink raw reply
* Re: [Patch 1/3] tabled: make time2str reentrant
From: Jeff Garzik @ 2010-01-03 21:27 UTC (permalink / raw)
To: Pete Zaitcev; +Cc: Project Hail List
In-Reply-To: <20100103013446.73b6df4a@redhat.com>
On 01/03/2010 03:34 AM, Pete Zaitcev wrote:
> On Sun, 03 Jan 2010 03:27:59 -0500
> Jeff Garzik<jeff@garzik.org> wrote:
>
>>> - sprintf(datestr, "Date: %s", time2str(timestr, time(NULL)));
>>> + sprintf(datestr, "Date: %s", time2str(timestr, 64, time(NULL)));
>>
>> applied 1-3, and then added sizeof() to the above time2str calls... The
>> hardcoded sizes I used for the strings is ugly enough... let's not add
>> additional "naked numbers" on top of that.
>
> I thought wrapping was worse. Sure...
Cosmetically annoying, yes. But hardcoding string length in multiple
locations increases the chances of an actual bug, so...
Jeff
^ permalink raw reply
* [PATCH 8/9] wl1251: use mac80211 provided channel parameters in scanning
From: Kalle Valo @ 2010-01-03 21:08 UTC (permalink / raw)
To: linux-wireless
In-Reply-To: <20100103210552.29287.20384.stgit@tikku>
From: Kalle Valo <kalle.valo@nokia.com>
The number of channels to be used in scan was hard coded in wl1251. The
proper way is to use the channels array provided by mac80211.
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
---
drivers/net/wireless/wl12xx/wl1251_cmd.c | 3 ++-
drivers/net/wireless/wl12xx/wl1251_cmd.h | 5 +++++
drivers/net/wireless/wl12xx/wl1251_main.c | 3 ++-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/wl1251_cmd.c b/drivers/net/wireless/wl12xx/wl1251_cmd.c
index fcbfbd7..0320b47 100644
--- a/drivers/net/wireless/wl12xx/wl1251_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1251_cmd.c
@@ -412,6 +412,7 @@ out:
}
int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len,
+ struct ieee80211_channel *channels[],
unsigned int n_channels, unsigned int n_probes)
{
struct wl1251_cmd_scan *cmd;
@@ -442,7 +443,7 @@ int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len,
memset(&cmd->channels[i].bssid_msb, 0xff, 2);
cmd->channels[i].early_termination = 0;
cmd->channels[i].tx_power_att = 0;
- cmd->channels[i].channel = i + 1;
+ cmd->channels[i].channel = channels[i]->hw_value;
}
cmd->params.ssid_len = ssid_len;
diff --git a/drivers/net/wireless/wl12xx/wl1251_cmd.h b/drivers/net/wireless/wl12xx/wl1251_cmd.h
index 63ae319..4ad67ca 100644
--- a/drivers/net/wireless/wl12xx/wl1251_cmd.h
+++ b/drivers/net/wireless/wl12xx/wl1251_cmd.h
@@ -27,6 +27,8 @@
#include "wl1251.h"
+#include <net/cfg80211.h>
+
struct acx_header;
int wl1251_cmd_send(struct wl1251 *wl, u16 type, void *buf, size_t buf_len);
@@ -44,6 +46,7 @@ int wl1251_cmd_read_memory(struct wl1251 *wl, u32 addr, void *answer,
int wl1251_cmd_template_set(struct wl1251 *wl, u16 cmd_id,
void *buf, size_t buf_len);
int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len,
+ struct ieee80211_channel *channels[],
unsigned int n_channels, unsigned int n_probes);
int wl1251_cmd_trigger_scan_to(struct wl1251 *wl, u32 timeout);
@@ -169,6 +172,8 @@ struct cmd_read_write_memory {
#define WL1251_SCAN_MIN_DURATION 30000
#define WL1251_SCAN_MAX_DURATION 60000
+#define WL1251_SCAN_NUM_PROBES 3
+
struct wl1251_scan_parameters {
u32 rx_config_options;
u32 rx_filter_options;
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c
index 1db9722..4728983 100644
--- a/drivers/net/wireless/wl12xx/wl1251_main.c
+++ b/drivers/net/wireless/wl12xx/wl1251_main.c
@@ -878,7 +878,8 @@ static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
wl->scanning = true;
- ret = wl1251_cmd_scan(wl, ssid, ssid_len, 13, 3);
+ ret = wl1251_cmd_scan(wl, ssid, ssid_len, req->channels,
+ req->n_channels, WL1251_SCAN_NUM_PROBES);
if (ret < 0) {
wl->scanning = false;
goto out_sleep;
^ permalink raw reply related
* [PATCH 1/9] mac80211: add functions to create PS Poll and Nullfunc templates
From: Kalle Valo @ 2010-01-03 21:07 UTC (permalink / raw)
To: linux-wireless
In-Reply-To: <20100103210552.29287.20384.stgit@tikku>
From: Kalle Valo <kalle.valo@nokia.com>
Some hardware, for example wl1251 and wl1271, handle the transmission
of power save related frames in hardware, but the driver is responsible
for creating the templates. It's better to create the templates in mac80211,
that way all drivers can benefit from this.
Add two new functions, ieee80211_pspoll_get() and ieee80211_nullfunc_get()
which drivers need to call to get the frame. Drivers are also responsible
for updating the templates after each association.
Also new struct ieee80211_hdr_3addr is added to ieee80211.h to make it
easy to calculate length of the Nullfunc frame.
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
---
include/linux/ieee80211.h | 9 +++++
include/net/mac80211.h | 30 +++++++++++++++++
net/mac80211/tx.c | 78 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 117 insertions(+), 0 deletions(-)
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index aeea282..602c069 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -130,6 +130,15 @@ struct ieee80211_hdr {
u8 addr4[6];
} __attribute__ ((packed));
+struct ieee80211_hdr_3addr {
+ __le16 frame_control;
+ __le16 duration_id;
+ u8 addr1[6];
+ u8 addr2[6];
+ u8 addr3[6];
+ __le16 seq_ctrl;
+} __attribute__ ((packed));
+
/**
* ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set
* @fc: frame control bytes in little-endian byteorder
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index f073a2a..eda45c3 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1874,6 +1874,36 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
}
/**
+ * ieee80211_pspoll_get - retrieve a PS Poll template
+ * @hw: pointer obtained from ieee80211_alloc_hw().
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+ *
+ * Creates a PS Poll a template which can, for example, uploaded to
+ * hardware. The template must be updated after association so that correct
+ * AID, BSSID and MAC address is used.
+ *
+ * Note: Caller (or hardware) is responsible for setting the
+ * &IEEE80211_FCTL_PM bit.
+ */
+struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif);
+
+/**
+ * ieee80211_nullfunc_get - retrieve a nullfunc template
+ * @hw: pointer obtained from ieee80211_alloc_hw().
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+ *
+ * Creates a Nullfunc template which can, for example, uploaded to
+ * hardware. The template must be updated after association so that correct
+ * BSSID and address is used.
+ *
+ * Note: Caller (or hardware) is responsible for setting the
+ * &IEEE80211_FCTL_PM bit as well as Duration and Sequence Control fields.
+ */
+struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif);
+
+/**
* ieee80211_rts_get - RTS frame generation function
* @hw: pointer obtained from ieee80211_alloc_hw().
* @vif: &struct ieee80211_vif pointer from the add_interface callback.
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 7bba49d..bb8819d 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2190,6 +2190,84 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
}
EXPORT_SYMBOL(ieee80211_beacon_get_tim);
+struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif)
+{
+ struct ieee80211_sub_if_data *sdata;
+ struct ieee80211_if_managed *ifmgd;
+ struct ieee80211_pspoll *pspoll;
+ struct ieee80211_local *local;
+ struct sk_buff *skb;
+
+ if (WARN_ON(vif->type != NL80211_IFTYPE_STATION))
+ return NULL;
+
+ sdata = vif_to_sdata(vif);
+ ifmgd = &sdata->u.mgd;
+ local = sdata->local;
+
+ skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*pspoll));
+ if (!skb) {
+ printk(KERN_DEBUG "%s: failed to allocate buffer for "
+ "pspoll template\n", sdata->name);
+ return NULL;
+ }
+ skb_reserve(skb, local->hw.extra_tx_headroom);
+
+ pspoll = (struct ieee80211_pspoll *) skb_put(skb, sizeof(*pspoll));
+ memset(pspoll, 0, sizeof(*pspoll));
+ pspoll->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL |
+ IEEE80211_STYPE_PSPOLL);
+ pspoll->aid = cpu_to_le16(ifmgd->aid);
+
+ /* aid in PS-Poll has its two MSBs each set to 1 */
+ pspoll->aid |= cpu_to_le16(1 << 15 | 1 << 14);
+
+ memcpy(pspoll->bssid, ifmgd->bssid, ETH_ALEN);
+ memcpy(pspoll->ta, vif->addr, ETH_ALEN);
+
+ return skb;
+}
+EXPORT_SYMBOL(ieee80211_pspoll_get);
+
+struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif)
+{
+ struct ieee80211_hdr_3addr *nullfunc;
+ struct ieee80211_sub_if_data *sdata;
+ struct ieee80211_if_managed *ifmgd;
+ struct ieee80211_local *local;
+ struct sk_buff *skb;
+
+ if (WARN_ON(vif->type != NL80211_IFTYPE_STATION))
+ return NULL;
+
+ sdata = vif_to_sdata(vif);
+ ifmgd = &sdata->u.mgd;
+ local = sdata->local;
+
+ skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*nullfunc));
+ if (!skb) {
+ printk(KERN_DEBUG "%s: failed to allocate buffer for nullfunc "
+ "template\n", sdata->name);
+ return NULL;
+ }
+ skb_reserve(skb, local->hw.extra_tx_headroom);
+
+ nullfunc = (struct ieee80211_hdr_3addr *) skb_put(skb,
+ sizeof(*nullfunc));
+ memset(nullfunc, 0, sizeof(*nullfunc));
+ nullfunc->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA |
+ IEEE80211_STYPE_NULLFUNC |
+ IEEE80211_FCTL_TODS);
+ memcpy(nullfunc->addr1, ifmgd->bssid, ETH_ALEN);
+ memcpy(nullfunc->addr2, vif->addr, ETH_ALEN);
+ memcpy(nullfunc->addr3, ifmgd->bssid, ETH_ALEN);
+
+ return skb;
+}
+EXPORT_SYMBOL(ieee80211_nullfunc_get);
+
void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
const void *frame, size_t frame_len,
const struct ieee80211_tx_info *frame_txctl,
^ permalink raw reply related
* [PATCH 6/9] wl1251: cleanup scanning code
From: Kalle Valo @ 2010-01-03 21:08 UTC (permalink / raw)
To: linux-wireless
In-Reply-To: <20100103210552.29287.20384.stgit@tikku>
From: Kalle Valo <kalle.valo@nokia.com>
The current scanning code wasn't following the preferred style. Move code
related to scan and trigger scan to commans to wl1251_cmd.c. Because
there's now less code in wl1251_hw_scan(), the function can be now
merged with wl1251_op_hw_scan().
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
---
drivers/net/wireless/wl12xx/wl1251_cmd.c | 82 +++++++++++++++++++
drivers/net/wireless/wl12xx/wl1251_cmd.h | 17 +++-
drivers/net/wireless/wl12xx/wl1251_main.c | 125 ++++++-----------------------
3 files changed, 117 insertions(+), 107 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/wl1251_cmd.c b/drivers/net/wireless/wl12xx/wl1251_cmd.c
index 770f260..fcbfbd7 100644
--- a/drivers/net/wireless/wl12xx/wl1251_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1251_cmd.c
@@ -410,3 +410,85 @@ out:
kfree(cmd);
return ret;
}
+
+int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len,
+ unsigned int n_channels, unsigned int n_probes)
+{
+ struct wl1251_cmd_scan *cmd;
+ int i, ret = 0;
+
+ wl1251_debug(DEBUG_CMD, "cmd scan");
+
+ cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+ if (!cmd)
+ return -ENOMEM;
+
+ cmd->params.rx_config_options = cpu_to_le32(CFG_RX_ALL_GOOD);
+ cmd->params.rx_filter_options = cpu_to_le32(CFG_RX_PRSP_EN |
+ CFG_RX_MGMT_EN |
+ CFG_RX_BCN_EN);
+ cmd->params.scan_options = 0;
+ cmd->params.num_channels = n_channels;
+ cmd->params.num_probe_requests = n_probes;
+ cmd->params.tx_rate = cpu_to_le16(1 << 1); /* 2 Mbps */
+ cmd->params.tid_trigger = 0;
+
+ for (i = 0; i < n_channels; i++) {
+ cmd->channels[i].min_duration =
+ cpu_to_le32(WL1251_SCAN_MIN_DURATION);
+ cmd->channels[i].max_duration =
+ cpu_to_le32(WL1251_SCAN_MAX_DURATION);
+ memset(&cmd->channels[i].bssid_lsb, 0xff, 4);
+ memset(&cmd->channels[i].bssid_msb, 0xff, 2);
+ cmd->channels[i].early_termination = 0;
+ cmd->channels[i].tx_power_att = 0;
+ cmd->channels[i].channel = i + 1;
+ }
+
+ cmd->params.ssid_len = ssid_len;
+ if (ssid)
+ memcpy(cmd->params.ssid, ssid, ssid_len);
+
+ ret = wl1251_cmd_send(wl, CMD_SCAN, cmd, sizeof(*cmd));
+ if (ret < 0) {
+ wl1251_error("cmd scan failed: %d", ret);
+ goto out;
+ }
+
+ wl1251_mem_read(wl, wl->cmd_box_addr, cmd, sizeof(*cmd));
+
+ if (cmd->header.status != CMD_STATUS_SUCCESS) {
+ wl1251_error("cmd scan status wasn't success: %d",
+ cmd->header.status);
+ ret = -EIO;
+ goto out;
+ }
+
+out:
+ kfree(cmd);
+ return ret;
+}
+
+int wl1251_cmd_trigger_scan_to(struct wl1251 *wl, u32 timeout)
+{
+ struct wl1251_cmd_trigger_scan_to *cmd;
+ int ret;
+
+ wl1251_debug(DEBUG_CMD, "cmd trigger scan to");
+
+ cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+ if (!cmd)
+ return -ENOMEM;
+
+ cmd->timeout = timeout;
+
+ ret = wl1251_cmd_send(wl, CMD_SCAN, cmd, sizeof(*cmd));
+ if (ret < 0) {
+ wl1251_error("cmd trigger scan to failed: %d", ret);
+ goto out;
+ }
+
+out:
+ kfree(cmd);
+ return ret;
+}
diff --git a/drivers/net/wireless/wl12xx/wl1251_cmd.h b/drivers/net/wireless/wl12xx/wl1251_cmd.h
index dff798a..63ae319 100644
--- a/drivers/net/wireless/wl12xx/wl1251_cmd.h
+++ b/drivers/net/wireless/wl12xx/wl1251_cmd.h
@@ -43,6 +43,9 @@ int wl1251_cmd_read_memory(struct wl1251 *wl, u32 addr, void *answer,
size_t len);
int wl1251_cmd_template_set(struct wl1251 *wl, u16 cmd_id,
void *buf, size_t buf_len);
+int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len,
+ unsigned int n_channels, unsigned int n_probes);
+int wl1251_cmd_trigger_scan_to(struct wl1251 *wl, u32 timeout);
/* unit ms */
#define WL1251_COMMAND_TIMEOUT 2000
@@ -163,8 +166,10 @@ struct cmd_read_write_memory {
#define CMDMBOX_HEADER_LEN 4
#define CMDMBOX_INFO_ELEM_HEADER_LEN 4
+#define WL1251_SCAN_MIN_DURATION 30000
+#define WL1251_SCAN_MAX_DURATION 60000
-struct basic_scan_parameters {
+struct wl1251_scan_parameters {
u32 rx_config_options;
u32 rx_filter_options;
@@ -189,11 +194,11 @@ struct basic_scan_parameters {
u8 tid_trigger;
u8 ssid_len;
- u32 ssid[8];
+ u8 ssid[32];
} __attribute__ ((packed));
-struct basic_scan_channel_parameters {
+struct wl1251_scan_ch_parameters {
u32 min_duration; /* in TU */
u32 max_duration; /* in TU */
u32 bssid_lsb;
@@ -213,11 +218,11 @@ struct basic_scan_channel_parameters {
/* SCAN parameters */
#define SCAN_MAX_NUM_OF_CHANNELS 16
-struct cmd_scan {
+struct wl1251_cmd_scan {
struct wl1251_cmd_header header;
- struct basic_scan_parameters params;
- struct basic_scan_channel_parameters channels[SCAN_MAX_NUM_OF_CHANNELS];
+ struct wl1251_scan_parameters params;
+ struct wl1251_scan_ch_parameters channels[SCAN_MAX_NUM_OF_CHANNELS];
} __attribute__ ((packed));
enum {
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c
index 6cce864..e038707 100644
--- a/drivers/net/wireless/wl12xx/wl1251_main.c
+++ b/drivers/net/wireless/wl12xx/wl1251_main.c
@@ -903,111 +903,13 @@ static int wl1251_build_probe_req(struct wl1251 *wl, u8 *ssid, size_t ssid_len)
size);
}
-static int wl1251_hw_scan(struct wl1251 *wl, u8 *ssid, size_t len,
- u8 active_scan, u8 high_prio, u8 num_channels,
- u8 probe_requests)
-{
- struct wl1251_cmd_trigger_scan_to *trigger = NULL;
- struct cmd_scan *params = NULL;
- int i, ret;
- u16 scan_options = 0;
-
- if (wl->scanning)
- return -EINVAL;
-
- params = kzalloc(sizeof(*params), GFP_KERNEL);
- if (!params)
- return -ENOMEM;
-
- params->params.rx_config_options = cpu_to_le32(CFG_RX_ALL_GOOD);
- params->params.rx_filter_options =
- cpu_to_le32(CFG_RX_PRSP_EN | CFG_RX_MGMT_EN | CFG_RX_BCN_EN);
-
- /* High priority scan */
- if (!active_scan)
- scan_options |= SCAN_PASSIVE;
- if (high_prio)
- scan_options |= SCAN_PRIORITY_HIGH;
- params->params.scan_options = scan_options;
-
- params->params.num_channels = num_channels;
- params->params.num_probe_requests = probe_requests;
- params->params.tx_rate = cpu_to_le16(1 << 1); /* 2 Mbps */
- params->params.tid_trigger = 0;
-
- for (i = 0; i < num_channels; i++) {
- params->channels[i].min_duration = cpu_to_le32(30000);
- params->channels[i].max_duration = cpu_to_le32(60000);
- memset(¶ms->channels[i].bssid_lsb, 0xff, 4);
- memset(¶ms->channels[i].bssid_msb, 0xff, 2);
- params->channels[i].early_termination = 0;
- params->channels[i].tx_power_att = 0;
- params->channels[i].channel = i + 1;
- memset(params->channels[i].pad, 0, 3);
- }
-
- for (i = num_channels; i < SCAN_MAX_NUM_OF_CHANNELS; i++)
- memset(¶ms->channels[i], 0,
- sizeof(struct basic_scan_channel_parameters));
-
- if (len && ssid) {
- params->params.ssid_len = len;
- memcpy(params->params.ssid, ssid, len);
- } else {
- params->params.ssid_len = 0;
- memset(params->params.ssid, 0, 32);
- }
-
- ret = wl1251_build_probe_req(wl, ssid, len);
- if (ret < 0) {
- wl1251_error("PROBE request template failed");
- goto out;
- }
-
- trigger = kzalloc(sizeof(*trigger), GFP_KERNEL);
- if (!trigger)
- goto out;
-
- trigger->timeout = 0;
-
- ret = wl1251_cmd_send(wl, CMD_TRIGGER_SCAN_TO, trigger,
- sizeof(*trigger));
- if (ret < 0) {
- wl1251_error("trigger scan to failed for hw scan");
- goto out;
- }
-
- wl1251_dump(DEBUG_SCAN, "SCAN: ", params, sizeof(*params));
-
- wl->scanning = true;
-
- ret = wl1251_cmd_send(wl, CMD_SCAN, params, sizeof(*params));
- if (ret < 0)
- wl1251_error("SCAN failed");
-
- wl1251_mem_read(wl, wl->cmd_box_addr, params, sizeof(*params));
-
- if (params->header.status != CMD_STATUS_SUCCESS) {
- wl1251_error("TEST command answer error: %d",
- params->header.status);
- wl->scanning = false;
- ret = -EIO;
- goto out;
- }
-
-out:
- kfree(params);
- return ret;
-
-}
-
static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
struct cfg80211_scan_request *req)
{
struct wl1251 *wl = hw->priv;
- int ret;
- u8 *ssid = NULL;
size_t ssid_len = 0;
+ u8 *ssid = NULL;
+ int ret;
wl1251_debug(DEBUG_MAC80211, "mac80211 hw scan");
@@ -1018,12 +920,33 @@ static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
mutex_lock(&wl->mutex);
+ if (wl->scanning) {
+ wl1251_debug(DEBUG_SCAN, "scan already in progress");
+ ret = -EINVAL;
+ goto out;
+ }
+
ret = wl1251_ps_elp_wakeup(wl);
if (ret < 0)
goto out;
- ret = wl1251_hw_scan(hw->priv, ssid, ssid_len, 1, 0, 13, 3);
+ ret = wl1251_build_probe_req(wl, ssid, ssid_len);
+ if (ret < 0)
+ wl1251_error("probe request template build failed");
+
+ ret = wl1251_cmd_trigger_scan_to(wl, 0);
+ if (ret < 0)
+ goto out_sleep;
+
+ wl->scanning = true;
+ ret = wl1251_cmd_scan(wl, ssid, ssid_len, 13, 3);
+ if (ret < 0) {
+ wl->scanning = false;
+ goto out_sleep;
+ }
+
+out_sleep:
wl1251_ps_elp_sleep(wl);
out:
^ permalink raw reply related
* [PATCH 3/9] wl1251: get PS Poll and Nullfunc templates from mac80211
From: Kalle Valo @ 2010-01-03 21:07 UTC (permalink / raw)
To: linux-wireless
In-Reply-To: <20100103210552.29287.20384.stgit@tikku>
From: Kalle Valo <kalle.valo@nokia.com>
Now that mac80211 creates templates for PS Poll and Nullfunc frames, use
them instead of creating our own.
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
---
drivers/net/wireless/wl12xx/wl1251_main.c | 58 ++++++++---------------------
1 files changed, 16 insertions(+), 42 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c
index 4e373f3..6cce864 100644
--- a/drivers/net/wireless/wl12xx/wl1251_main.c
+++ b/drivers/net/wireless/wl12xx/wl1251_main.c
@@ -563,45 +563,6 @@ static void wl1251_op_remove_interface(struct ieee80211_hw *hw,
mutex_unlock(&wl->mutex);
}
-static int wl1251_build_null_data(struct wl1251 *wl)
-{
- struct wl12xx_null_data_template template;
-
- if (!is_zero_ether_addr(wl->bssid)) {
- memcpy(template.header.da, wl->bssid, ETH_ALEN);
- memcpy(template.header.bssid, wl->bssid, ETH_ALEN);
- } else {
- memset(template.header.da, 0xff, ETH_ALEN);
- memset(template.header.bssid, 0xff, ETH_ALEN);
- }
-
- memcpy(template.header.sa, wl->mac_addr, ETH_ALEN);
- template.header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
- IEEE80211_STYPE_NULLFUNC |
- IEEE80211_FCTL_TODS);
-
- return wl1251_cmd_template_set(wl, CMD_NULL_DATA, &template,
- sizeof(template));
-
-}
-
-static int wl1251_build_ps_poll(struct wl1251 *wl, u16 aid)
-{
- struct wl12xx_ps_poll_template template;
-
- memcpy(template.bssid, wl->bssid, ETH_ALEN);
- memcpy(template.ta, wl->mac_addr, ETH_ALEN);
-
- /* aid in PS-Poll has its two MSBs each set to 1 */
- template.aid = cpu_to_le16(1 << 15 | 1 << 14 | aid);
-
- template.fc = cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
-
- return wl1251_cmd_template_set(wl, CMD_PS_POLL, &template,
- sizeof(template));
-
-}
-
static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
{
struct wl1251 *wl = hw->priv;
@@ -1101,7 +1062,7 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
{
enum wl1251_cmd_ps_mode mode;
struct wl1251 *wl = hw->priv;
- struct sk_buff *beacon;
+ struct sk_buff *beacon, *skb;
int ret;
wl1251_debug(DEBUG_MAC80211, "mac80211 bss info changed");
@@ -1115,7 +1076,13 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
if (changed & BSS_CHANGED_BSSID) {
memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN);
- ret = wl1251_build_null_data(wl);
+ skb = ieee80211_nullfunc_get(wl->hw, wl->vif);
+ if (!skb)
+ goto out_sleep;
+
+ ret = wl1251_cmd_template_set(wl, CMD_NULL_DATA,
+ skb->data, skb->len);
+ dev_kfree_skb(skb);
if (ret < 0)
goto out;
@@ -1136,7 +1103,14 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
wl->dtim_period);
wl->aid = bss_conf->aid;
- ret = wl1251_build_ps_poll(wl, wl->aid);
+ skb = ieee80211_pspoll_get(wl->hw, wl->vif);
+ if (!skb)
+ goto out_sleep;
+
+ ret = wl1251_cmd_template_set(wl, CMD_PS_POLL,
+ skb->data,
+ skb->len);
+ dev_kfree_skb(skb);
if (ret < 0)
goto out_sleep;
^ permalink raw reply related
* [PATCH 4/9] mac80211: create Probe Request template
From: Kalle Valo @ 2010-01-03 21:07 UTC (permalink / raw)
To: linux-wireless
In-Reply-To: <20100103210552.29287.20384.stgit@tikku>
From: Kalle Valo <kalle.valo@nokia.com>
Certain type of hardware, for example wl1251 and wl1271, need a template
for the Probe Request. Create a function ieee80211_probereq_get() which
creates the template and drivers send it to hardware.
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
---
include/net/mac80211.h | 17 ++++++++++++++++
net/mac80211/tx.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index eda45c3..02647bb 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1904,6 +1904,23 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
struct ieee80211_vif *vif);
/**
+ * ieee80211_probereq_get - retrieve a Probe Request template
+ * @hw: pointer obtained from ieee80211_alloc_hw().
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+ * @ssid: SSID buffer
+ * @ssid_len: length of SSID
+ * @ie: buffer containing all IEs expect SSID for the template
+ * @ie_len: length of the IE buffer
+ *
+ * Creates a Probe Request template which can, for example, uploaded to
+ * hardware.
+ */
+struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ const u8 *ssid, size_t ssid_len,
+ const u8 *ie, size_t ie_len);
+
+/**
* ieee80211_rts_get - RTS frame generation function
* @hw: pointer obtained from ieee80211_alloc_hw().
* @vif: &struct ieee80211_vif pointer from the add_interface callback.
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index bb8819d..361dbf6 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2268,6 +2268,56 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
}
EXPORT_SYMBOL(ieee80211_nullfunc_get);
+struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ const u8 *ssid, size_t ssid_len,
+ const u8 *ie, size_t ie_len)
+{
+ struct ieee80211_sub_if_data *sdata;
+ struct ieee80211_local *local;
+ struct ieee80211_hdr_3addr *hdr;
+ struct sk_buff *skb;
+ size_t ie_ssid_len;
+ u8 *pos;
+
+ sdata = vif_to_sdata(vif);
+ local = sdata->local;
+ ie_ssid_len = 2 + ssid_len;
+
+ skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*hdr) +
+ ie_ssid_len + ie_len);
+ if (!skb) {
+ printk(KERN_DEBUG "%s: failed to allocate buffer for probe "
+ "request template\n", sdata->name);
+ return NULL;
+ }
+
+ skb_reserve(skb, local->hw.extra_tx_headroom);
+
+ hdr = (struct ieee80211_hdr_3addr *) skb_put(skb, sizeof(*hdr));
+ memset(hdr, 0, sizeof(*hdr));
+ hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
+ IEEE80211_STYPE_PROBE_REQ);
+ memset(hdr->addr1, 0xff, ETH_ALEN);
+ memcpy(hdr->addr2, vif->addr, ETH_ALEN);
+ memset(hdr->addr3, 0xff, ETH_ALEN);
+
+ pos = skb_put(skb, ie_ssid_len);
+ *pos++ = WLAN_EID_SSID;
+ *pos++ = ssid_len;
+ if (ssid)
+ memcpy(pos, ssid, ssid_len);
+ pos += ssid_len;
+
+ if (ie) {
+ pos = skb_put(skb, ie_len);
+ memcpy(pos, ie, ie_len);
+ }
+
+ return skb;
+}
+EXPORT_SYMBOL(ieee80211_probereq_get);
+
void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
const void *frame, size_t frame_len,
const struct ieee80211_tx_info *frame_txctl,
^ permalink raw reply related
* [PATCH 7/9] wl1251: get probe request template from mac80211
From: Kalle Valo @ 2010-01-03 21:08 UTC (permalink / raw)
To: linux-wireless
In-Reply-To: <20100103210552.29287.20384.stgit@tikku>
From: Kalle Valo <kalle.valo@nokia.com>
Instead of creating the template in driver, get it from mac80211 instead.
Thanks to this, three functions can be now removed.
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
---
drivers/net/wireless/wl12xx/wl1251_main.c | 86 ++++-------------------------
1 files changed, 12 insertions(+), 74 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c
index e038707..1db9722 100644
--- a/drivers/net/wireless/wl12xx/wl1251_main.c
+++ b/drivers/net/wireless/wl12xx/wl1251_main.c
@@ -831,82 +831,11 @@ out:
return ret;
}
-static int wl1251_build_basic_rates(char *rates)
-{
- u8 index = 0;
-
- rates[index++] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
- rates[index++] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
- rates[index++] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
- rates[index++] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
-
- return index;
-}
-
-static int wl1251_build_extended_rates(char *rates)
-{
- u8 index = 0;
-
- rates[index++] = IEEE80211_OFDM_RATE_6MB;
- rates[index++] = IEEE80211_OFDM_RATE_9MB;
- rates[index++] = IEEE80211_OFDM_RATE_12MB;
- rates[index++] = IEEE80211_OFDM_RATE_18MB;
- rates[index++] = IEEE80211_OFDM_RATE_24MB;
- rates[index++] = IEEE80211_OFDM_RATE_36MB;
- rates[index++] = IEEE80211_OFDM_RATE_48MB;
- rates[index++] = IEEE80211_OFDM_RATE_54MB;
-
- return index;
-}
-
-
-static int wl1251_build_probe_req(struct wl1251 *wl, u8 *ssid, size_t ssid_len)
-{
- struct wl12xx_probe_req_template template;
- struct wl12xx_ie_rates *rates;
- char *ptr;
- u16 size;
-
- ptr = (char *)&template;
- size = sizeof(struct ieee80211_header);
-
- memset(template.header.da, 0xff, ETH_ALEN);
- memset(template.header.bssid, 0xff, ETH_ALEN);
- memcpy(template.header.sa, wl->mac_addr, ETH_ALEN);
- template.header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
-
- /* IEs */
- /* SSID */
- template.ssid.header.id = WLAN_EID_SSID;
- template.ssid.header.len = ssid_len;
- if (ssid_len && ssid)
- memcpy(template.ssid.ssid, ssid, ssid_len);
- size += sizeof(struct wl12xx_ie_header) + ssid_len;
- ptr += size;
-
- /* Basic Rates */
- rates = (struct wl12xx_ie_rates *)ptr;
- rates->header.id = WLAN_EID_SUPP_RATES;
- rates->header.len = wl1251_build_basic_rates(rates->rates);
- size += sizeof(struct wl12xx_ie_header) + rates->header.len;
- ptr += sizeof(struct wl12xx_ie_header) + rates->header.len;
-
- /* Extended rates */
- rates = (struct wl12xx_ie_rates *)ptr;
- rates->header.id = WLAN_EID_EXT_SUPP_RATES;
- rates->header.len = wl1251_build_extended_rates(rates->rates);
- size += sizeof(struct wl12xx_ie_header) + rates->header.len;
-
- wl1251_dump(DEBUG_SCAN, "PROBE REQ: ", &template, size);
-
- return wl1251_cmd_template_set(wl, CMD_PROBE_REQ, &template,
- size);
-}
-
static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
struct cfg80211_scan_request *req)
{
struct wl1251 *wl = hw->priv;
+ struct sk_buff *skb;
size_t ssid_len = 0;
u8 *ssid = NULL;
int ret;
@@ -930,9 +859,18 @@ static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
if (ret < 0)
goto out;
- ret = wl1251_build_probe_req(wl, ssid, ssid_len);
+ skb = ieee80211_probereq_get(wl->hw, wl->vif, ssid, ssid_len,
+ req->ie, req->ie_len);
+ if (!skb) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ ret = wl1251_cmd_template_set(wl, CMD_PROBE_REQ, skb->data,
+ skb->len);
+ dev_kfree_skb(skb);
if (ret < 0)
- wl1251_error("probe request template build failed");
+ goto out_sleep;
ret = wl1251_cmd_trigger_scan_to(wl, 0);
if (ret < 0)
^ permalink raw reply related
* [PATCH 5/9] mac80211: use Probe Request template when sending a direct scan
From: Kalle Valo @ 2010-01-03 21:07 UTC (permalink / raw)
To: linux-wireless
In-Reply-To: <20100103210552.29287.20384.stgit@tikku>
From: Kalle Valo <kalle.valo@nokia.com>
As mac80211 now has a separate function for creating Probe Request templates,
better to use it when sending direct Probe Requests to an AP. Only the
bssid needs to be updated in the template before sending it.
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
---
net/mac80211/util.c | 40 ++++++++++++++++------------------------
1 files changed, 16 insertions(+), 24 deletions(-)
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 7e38858..9713dcb 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -989,37 +989,29 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
struct ieee80211_local *local = sdata->local;
struct sk_buff *skb;
struct ieee80211_mgmt *mgmt;
- u8 *pos;
-
- skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt) + 200 +
- ie_len);
- if (!skb) {
- printk(KERN_DEBUG "%s: failed to allocate buffer for probe "
- "request\n", sdata->name);
+ size_t buf_len;
+ u8 *buf;
+
+ /* FIXME: come up with a proper value */
+ buf = kmalloc(200 + ie_len, GFP_KERNEL);
+ if (!buf) {
+ printk(KERN_DEBUG "%s: failed to allocate temporary IE "
+ "buffer\n", sdata->name);
return;
}
- skb_reserve(skb, local->hw.extra_tx_headroom);
- mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
- memset(mgmt, 0, 24);
- mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
- IEEE80211_STYPE_PROBE_REQ);
- memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
+ buf_len = ieee80211_build_preq_ies(local, buf, ie, ie_len,
+ local->hw.conf.channel->band);
+
+ skb = ieee80211_probereq_get(&local->hw, &sdata->vif,
+ ssid, ssid_len,
+ buf, buf_len);
+
if (dst) {
+ mgmt = (struct ieee80211_mgmt *) skb->data;
memcpy(mgmt->da, dst, ETH_ALEN);
memcpy(mgmt->bssid, dst, ETH_ALEN);
- } else {
- memset(mgmt->da, 0xff, ETH_ALEN);
- memset(mgmt->bssid, 0xff, ETH_ALEN);
}
- pos = skb_put(skb, 2 + ssid_len);
- *pos++ = WLAN_EID_SSID;
- *pos++ = ssid_len;
- memcpy(pos, ssid, ssid_len);
- pos += ssid_len;
-
- skb_put(skb, ieee80211_build_preq_ies(local, pos, ie, ie_len,
- local->hw.conf.channel->band));
IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
ieee80211_tx_skb(sdata, skb);
^ permalink raw reply related
* [PATCH 9/9] wl1251: fix sleep related error paths in wl1251_op_bss_info_changed()
From: Kalle Valo @ 2010-01-03 21:08 UTC (permalink / raw)
To: linux-wireless
In-Reply-To: <20100103210552.29287.20384.stgit@tikku>
From: Kalle Valo <kalle.valo@nokia.com>
In various cases wl1251_op_bss_info_changed() did not call elp_sleep()
after an error was noticed. Fix it by using correct goto label.
The bug was a theoretical one, in practise it doesn't matter because
if commands start returning errors there will be lots of other problems.
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
---
drivers/net/wireless/wl12xx/wl1251_main.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c
index 4728983..f17ce06 100644
--- a/drivers/net/wireless/wl12xx/wl1251_main.c
+++ b/drivers/net/wireless/wl12xx/wl1251_main.c
@@ -946,7 +946,7 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
skb->data, skb->len);
dev_kfree_skb(skb);
if (ret < 0)
- goto out;
+ goto out_sleep;
if (wl->bss_type != BSS_TYPE_IBSS) {
ret = wl1251_join(wl, wl->bss_type, wl->channel,
@@ -1018,7 +1018,7 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
ret = wl1251_acx_cts_protect(wl, CTSPROTECT_DISABLE);
if (ret < 0) {
wl1251_warning("Set ctsprotect failed %d", ret);
- goto out;
+ goto out_sleep;
}
}
@@ -1029,7 +1029,7 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
if (ret < 0) {
dev_kfree_skb(beacon);
- goto out;
+ goto out_sleep;
}
ret = wl1251_cmd_template_set(wl, CMD_PROBE_RESP, beacon->data,
@@ -1038,13 +1038,13 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
dev_kfree_skb(beacon);
if (ret < 0)
- goto out;
+ goto out_sleep;
ret = wl1251_join(wl, wl->bss_type, wl->beacon_int,
wl->channel, wl->dtim_period);
if (ret < 0)
- goto out;
+ goto out_sleep;
}
out_sleep:
^ permalink raw reply related
* [PATCH 2/9] mac80211: use PS Poll and Nullfunc templates when sending such frames
From: Kalle Valo @ 2010-01-03 21:07 UTC (permalink / raw)
To: linux-wireless
In-Reply-To: <20100103210552.29287.20384.stgit@tikku>
From: Kalle Valo <kalle.valo@nokia.com>
To avoid duplicate code, use ieee80211_[pspoll|nullfunc]_get() to get
templates for PS Poll and Nullfunc frames in mlme.c.
Compile-tested only.
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
---
net/mac80211/mlme.c | 48 +++++++++---------------------------------------
1 files changed, 9 insertions(+), 39 deletions(-)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 72920ee..7f771c0 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -249,30 +249,15 @@ static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
void ieee80211_send_pspoll(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata)
{
- struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
struct ieee80211_pspoll *pspoll;
struct sk_buff *skb;
- u16 fc;
- skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*pspoll));
- if (!skb) {
- printk(KERN_DEBUG "%s: failed to allocate buffer for "
- "pspoll frame\n", sdata->name);
+ skb = ieee80211_pspoll_get(&local->hw, &sdata->vif);
+ if (!skb)
return;
- }
- skb_reserve(skb, local->hw.extra_tx_headroom);
-
- pspoll = (struct ieee80211_pspoll *) skb_put(skb, sizeof(*pspoll));
- memset(pspoll, 0, sizeof(*pspoll));
- fc = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL | IEEE80211_FCTL_PM;
- pspoll->frame_control = cpu_to_le16(fc);
- pspoll->aid = cpu_to_le16(ifmgd->aid);
- /* aid in PS-Poll has its two MSBs each set to 1 */
- pspoll->aid |= cpu_to_le16(1 << 15 | 1 << 14);
-
- memcpy(pspoll->bssid, ifmgd->bssid, ETH_ALEN);
- memcpy(pspoll->ta, sdata->vif.addr, ETH_ALEN);
+ pspoll = (struct ieee80211_pspoll *) skb->data;
+ pspoll->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM);
IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
ieee80211_tx_skb(sdata, skb);
@@ -283,30 +268,15 @@ void ieee80211_send_nullfunc(struct ieee80211_local *local,
int powersave)
{
struct sk_buff *skb;
- struct ieee80211_hdr *nullfunc;
- __le16 fc;
+ struct ieee80211_hdr_3addr *nullfunc;
- if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION))
+ skb = ieee80211_nullfunc_get(&local->hw, &sdata->vif);
+ if (!skb)
return;
- skb = dev_alloc_skb(local->hw.extra_tx_headroom + 24);
- if (!skb) {
- printk(KERN_DEBUG "%s: failed to allocate buffer for nullfunc "
- "frame\n", sdata->name);
- return;
- }
- skb_reserve(skb, local->hw.extra_tx_headroom);
-
- nullfunc = (struct ieee80211_hdr *) skb_put(skb, 24);
- memset(nullfunc, 0, 24);
- fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC |
- IEEE80211_FCTL_TODS);
+ nullfunc = (struct ieee80211_hdr_3addr *) skb->data;
if (powersave)
- fc |= cpu_to_le16(IEEE80211_FCTL_PM);
- nullfunc->frame_control = fc;
- memcpy(nullfunc->addr1, sdata->u.mgd.bssid, ETH_ALEN);
- memcpy(nullfunc->addr2, sdata->vif.addr, ETH_ALEN);
- memcpy(nullfunc->addr3, sdata->u.mgd.bssid, ETH_ALEN);
+ nullfunc->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM);
IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
ieee80211_tx_skb(sdata, skb);
^ permalink raw reply related
* [PATCH 0/9] mac80211: templates for drivers
From: Kalle Valo @ 2010-01-03 21:07 UTC (permalink / raw)
To: linux-wireless
Hello,
there has been talk of creating templates in mac80211 for drivers and
here's what I have been thinking. I have also included wl1251 usage as
an example. Please comment.
---
Kalle Valo (9):
mac80211: add functions to create PS Poll and Nullfunc templates
mac80211: use PS Poll and Nullfunc templates when sending such frames
wl1251: get PS Poll and Nullfunc templates from mac80211
mac80211: create Probe Request template
mac80211: use Probe Request template when sending a direct scan
wl1251: cleanup scanning code
wl1251: get probe request template from mac80211
wl1251: use mac80211 provided channel parameters in scanning
wl1251: fix sleep related error paths in wl1251_op_bss_info_changed()
drivers/net/wireless/wl12xx/wl1251_cmd.c | 83 +++++++++
drivers/net/wireless/wl12xx/wl1251_cmd.h | 22 ++
drivers/net/wireless/wl12xx/wl1251_main.c | 274 ++++++-----------------------
include/linux/ieee80211.h | 9 +
include/net/mac80211.h | 47 +++++
net/mac80211/mlme.c | 48 +----
net/mac80211/tx.c | 128 ++++++++++++++
net/mac80211/util.c | 40 ++--
8 files changed, 363 insertions(+), 288 deletions(-)
^ permalink raw reply
* Re: [patch staging] BCM70010 (crystalhd) Linux Driver
From: Greg KH @ 2010-01-03 17:34 UTC (permalink / raw)
To: jarod; +Cc: Jon Smirl, Manu Abraham, Peter Paul, linux-kernel, davilla,
nsankar
In-Reply-To: <7cdf10991001022051k2c8454c1q5cffb955e901e58a@mail.gmail.com>
On Sat, Jan 02, 2010 at 11:51:23PM -0500, Jarod Wilson wrote:
> > I'm not against this submission, but would it be better to wait until
> > Monday when the Broadcom authors are back as see if they want to
> > submit their own driver? That way changes would end up back in their
> > internal VCS.
>
> Yes, please hold off a bit on this, I've actually been working on this
> driver with Scott and Naren (cc'd) for several months now (which is
> part of why it doesn't look so much like a lot of typical vendor code
> ;), and was planning to handle the submission on Naren and Broadcom's
> behalf. Just didn't expect someone else to hop on it this quickly. Was
> planning to get a git tree up on git.kernel.org over the weekend for
> both the driver and the lib, start prepping patches for review, etc.,
> but family time and home improvement projects have taken precedence
> the past few days (not to mention a few other driver projects that
> sucked up time earlier in the break, *cough* IR).
Ok, I'll ignore the patches from Manu for now, but please, do not create
a git tree, just send me what you have right now, as obviously some
people find it useful. Then, everyone can work on it together in the
main kernel.org tree, like the rest of kernel development is done.
If you have any questions about how to do this, please let me know.
thanks,
greg k-h
^ permalink raw reply
* [PATCH] cld: check parameters for HAIL_LOG
From: Colin McCabe @ 2010-01-03 21:12 UTC (permalink / raw)
To: Project Hail List; +Cc: Pete Zaitcev, Jeff Garzik, Colin McCabe
GCC has a nifty ability to typecheck varargs functions that follow the printf
conventions. This change uses that in HAIL_LOG. If you build with -Wall, gcc
can now give warnings about HAIL_LOG invocations where there are too many or
too few arguments, or arguments of the wrong types.
For non-GCC compilers, don't do anything (yet).
Signed-off-by: Colin McCabe <cmccabe@alumni.cmu.edu>
---
include/hail_log.h | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/include/hail_log.h b/include/hail_log.h
index d6794b4..88074a3 100644
--- a/include/hail_log.h
+++ b/include/hail_log.h
@@ -3,8 +3,15 @@
#include <stdbool.h>
+#ifdef __GNUC__
+#define ATTR_PRINTF(x,y) __attribute__((format(printf, x, y)))
+#else
+#define ATTR_PRINTF(x,y)
+#endif
+
struct hail_log {
- void (*func)(int prio, const char *fmt, ...);
+ void (*func)(int prio, const char *fmt, ...)
+ ATTR_PRINTF(2,3);
bool verbose;
};
--
1.6.2.5
^ permalink raw reply related
* Re: qmake issue
From: Phil Blundell @ 2010-01-03 21:09 UTC (permalink / raw)
To: openembedded-devel
In-Reply-To: <ac9c93b11001030833v6236cb2ew11627fb47a6d7fa8@mail.gmail.com>
On Sun, 2010-01-03 at 17:33 +0100, Frans Meulenbroeks wrote:
> I can imagine a few solutions, but no idea which one is the best and
> how to implement them.
> First option is to hack the generated makefile in a configure_append
> step. While this would solve the issue for me it is not really a
> generic solution.
> Second option is to force removing a package from staging when a new
> version is build
> Third option is to change the class which generates the above command
> to put the -L near the end (after any -L's from the makefile itself.
In the particular case of the myth* libraries, I think they should not
be getting staged in the first place. As far as I know, no other
package uses them for anything.
However, that obviously doesn't solve your qmake problem in the general
case. With a bit of luck some Qt hacker will be able to shed light on
what is really going on there.
p.
^ permalink raw reply
* [U-Boot] [PATCH 2/4] Use LINK_OFF to access global data
From: Wolfgang Denk @ 2010-01-03 21:07 UTC (permalink / raw)
To: u-boot
In-Reply-To: <4B4100F3.8080507@free.fr>
Dear Albert ARIBAUD,
In message <4B4100F3.8080507@free.fr> you wrote:
>
> > This scenario is interesting for a lot of other use cases, for
> > example to load the new version to some free location in RAM, verify
> > that it works, then copy it (eventually by itself) to persistent
> > storage; this is especially useful for systems when your JTAG
> > debugger does not support programming images to NAND or DataFlash or
> > SPI flash or whatever storage device is used to store the image.
>
> There is a way out of this one -- I used it myself -- where you build
> both versions of U-boot, the RAM-located one and the FLASH-located one.
> You load the RAM one, run it, and it loads and flashes the FLASH one.
Of course this works, but this is then _another_ image, which was not
tested yet. This is bad both from the administration point of view
(need of two differently built images), and bad for the nerves (as you
install an untested image).
> >> For NAND-based boards, the NAND bootloader will load U-boot to RAM, and
> >> U-boot will never run from anywhere else but its intended RAM location.
> >
> > Assume you have systems with different RAM size configurations. Being
> > able to load the same image to any address is beneficial then, too.
> > [And the NAND bootstrap code often does not allow for additional code
> > as needed for example for relocation.]
>
> The U1 bootloader might be given the ability to relocate the U2 code.
> that's probably far-fetched, but when linking U2, a map file could be
> generated and a script could produce a relocation table for U1 to use.
> The table could be put in NAND along with the U2 code, so U1 might not
> need to be regenerated for every new U2 build.
Keep in mind that U1 often has to fit in as little memory as 4 KB or
so...
> > If you use a console in U1, you will need to share a LOT of code with
> > U2 - things like printf() and all it's dependencies, most of the
> > str*() and mem*() functions, etc. And especially for such complicted
> > and error prone actions like initializing the RAM you _do_ want to be
> > able to use a console port to print error messages and debug
> > information.
>
> Nothing prevents linking in the same source code in U1 and U2, I think.
> Of course that would make U1 bigger, but you'd need the code in there so
> that's the price to pay -- and it would be a temporary use of RAM, as
> the RAM for U1 could be reused freed when U2 comes into play.
Creating twobig parts (U1 and U2) is bad for the overal flash memory
footprint, and for the boot time. And usually iut doesn;t work at all
on NAND etc.
> But obviously your call for comments also calls for a revision of the
> current design, doesn't it?
Sure.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Things are not as simple as they seem at first. - Edward Thorp
^ permalink raw reply
* [PATCH 1/2] cld: git should ignore cscope temp files
From: Colin McCabe @ 2010-01-03 21:02 UTC (permalink / raw)
To: Project Hail List; +Cc: Pete Zaitcev, Jeff Garzik, Colin McCabe
Signed-off-by: Colin McCabe <cmccabe@alumni.cmu.edu>
---
.gitignore | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index 067bf1a..79a4cd3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,5 +28,9 @@ cldbadm
cld*.tar.gz
cld-config.h*
+# cscope files
+cscope.*
+ncscope.*
+
# ignore Doxygen output directory
gendoc
--
1.6.2.5
^ permalink raw reply related
* Re: [RFC][PATCH 12/12] PM / r8169: Add simplified run-time PM support
From: Rafael J. Wysocki @ 2010-01-03 21:01 UTC (permalink / raw)
To: Pavel Machek
Cc: Linux PCI, LKML, Jesse Barnes, ACPI Devel Maling List,
Francois Romieu, pm list
In-Reply-To: <20100103195544.GC11928@elf.ucw.cz>
On Sunday 03 January 2010, Pavel Machek wrote:
>
> > > On notebooks, you can often use
> > >
> > > pavel@amd:/data/l/linux-msm/arch/arm/mach-msm$ cat
> > > /proc/acpi/battery/BAT0/state
> > > present: yes
> > > capacity state: ok
> > > charging state: charged
> > > present rate: 0 mW
> > > remaining capacity: 71830 mWh
> > > present voltage: 16277 mV
> > >
> > > ...present rate is often usable-enough.
> >
> > Using /proc/acpi/battery/BAT1/state I measured the energy drawn in 10 minutes
> > both with the network adapter in D0 and D3hot. The results were that with the
> > network adapter in D0 the box drew 2476 mWh, while with the network adapter in
> > D3hot it drew 2361 mWh. The difference is 115 mWh, or about 5% on this
> > particular box.
> >
> > This means about 0.1 Wh in 10 minutes, so we can save about 0.6 Wh per hour.
>
> Which means it saves 0.6W :-). Measuring power in Wh/h is "interesting".
You can't save power, you can only save energy. Wh is just an energy unit.
> Ok, that's consistent with my experiments, ethernet transciever was around 1W... Thanks.
No big deal.
Rafael
^ permalink raw reply
* Re: [RFC][PATCH 12/12] PM / r8169: Add simplified run-time PM support
From: Rafael J. Wysocki @ 2010-01-03 21:01 UTC (permalink / raw)
To: Pavel Machek
Cc: pm list, LKML, Linux PCI, ACPI Devel Maling List, Alan Stern,
Jesse Barnes, Matthew Garrett, Oliver Neukum, Shaohua Li,
Bjorn Helgaas, Francois Romieu, Len Brown
In-Reply-To: <20100103195544.GC11928@elf.ucw.cz>
On Sunday 03 January 2010, Pavel Machek wrote:
>
> > > On notebooks, you can often use
> > >
> > > pavel@amd:/data/l/linux-msm/arch/arm/mach-msm$ cat
> > > /proc/acpi/battery/BAT0/state
> > > present: yes
> > > capacity state: ok
> > > charging state: charged
> > > present rate: 0 mW
> > > remaining capacity: 71830 mWh
> > > present voltage: 16277 mV
> > >
> > > ...present rate is often usable-enough.
> >
> > Using /proc/acpi/battery/BAT1/state I measured the energy drawn in 10 minutes
> > both with the network adapter in D0 and D3hot. The results were that with the
> > network adapter in D0 the box drew 2476 mWh, while with the network adapter in
> > D3hot it drew 2361 mWh. The difference is 115 mWh, or about 5% on this
> > particular box.
> >
> > This means about 0.1 Wh in 10 minutes, so we can save about 0.6 Wh per hour.
>
> Which means it saves 0.6W :-). Measuring power in Wh/h is "interesting".
You can't save power, you can only save energy. Wh is just an energy unit.
> Ok, that's consistent with my experiments, ethernet transciever was around 1W... Thanks.
No big deal.
Rafael
^ permalink raw reply
* Re: [patch] off by one bug
From: Mark Brown @ 2010-01-03 20:58 UTC (permalink / raw)
To: Dan Carpenter, Samuel Ortiz, linux-kernel
In-Reply-To: <20100103120817.GA19360@bicker>
On Sun, Jan 03, 2010 at 02:08:17PM +0200, Dan Carpenter wrote:
> If irq == WM8350_NUM_IRQ that would put us past the end of the array.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
but please take a look at the advice in Documentation/SubmittingPatches
about picking a title for your patch, with the one you've got it's not
even clear which subsystem you're talking about never mind which driver.
^ permalink raw reply
* Re: [PATCH 4/4] MTD: include ar7part in the list of partitions parsers
From: David Woodhouse @ 2010-01-03 20:56 UTC (permalink / raw)
To: Florian Fainelli; +Cc: linux-mips, linux-mtd, ralf
In-Reply-To: <201001032117.37459.florian@openwrt.org>
On Sun, 2010-01-03 at 21:17 +0100, Florian Fainelli wrote:
> This patch modifies the physmap-flash driver to include
> the ar7part partition parser in the list of parsers to
> use when a physmap-flash driver is registered. This is
> required for AR7 to create partitions correctly.
Hrm, perhaps we'd do better to allow the probe types to be specified in
the platform physmap_flash_data?
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
^ permalink raw reply
* Echoaudio, suspend/resume question on rawmidi device
From: Giuliano Pochini @ 2010-01-03 20:55 UTC (permalink / raw)
To: Alsa-devel
I have some patches that add PM support to all echoaudio drivers. It seems
to work fine, but it has been tested on two cards only and the rawmidi
device hasn't been tested at all. I can't test it because
suspend-to-anything does not work on my pmac. I want to be sure at least it
cannot deadlock.
* On suspend:
Rawmidi input is interrupt-driven. The driver tells the card to stop
accepting data.
Rawmidi output is timer-driven. The driver uses a timer to check if the
card's output buffer has room for more data to send. Do del_timer_sync()
and wait until all buffered data is sent, which may take 20ms (64 bytes at
31250bps).
* On resume:
Input: Re-enable midi in.
Output: Restart the timer.
Do you see any race condition or weak points in this scheme, especially in
the midi-out part ? Is del_timer_sync() safe ?
--
Giuliano.
^ permalink raw reply
* Re: [PATCH] grep: do not do external grep on skip-worktree entries
From: Junio C Hamano @ 2010-01-03 20:49 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Miles Bader, Nguyen Thai Ngoc Duy, git
In-Reply-To: <alpine.LFD.2.00.1001031124420.3630@localhost.localdomain>
Linus Torvalds <torvalds@linux-foundation.org> writes:
> Which means that if you put /usr/xpg4/bin before other paths in your PATH,
> you'll totally break such systems, because now you get the (inferior)
> tools in xpg4 before the preferred tools in /usr/local. Or - this also
> happens - people end up installing their own versions in $HOME/bin,
> because the system admin is uncaring or incompetent.
The build allows you to define SANE_TOOL_PATH ("the tools found in here
are saner than the ones in /usr/bin or /bin" is what it means) and we
insert it just in front of /usr/bin or /bin in the original PATH (see
git_brokne_path_fix in git-sh-setup.sh).
I would call this the right thing (TM) or the best workaround we could do
under the constraints, depending on the mood.
^ permalink raw reply
* [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable
From: Benjamin Herrenschmidt @ 2010-01-03 20:50 UTC (permalink / raw)
To: Alexander Graf
Cc: Blue Swirl, QEMU Developers, Aurelien Jarno, Michael S. Tsirkin
In-Reply-To: <472F306A-0699-401C-8E6A-8E79B86E4C95@suse.de>
On Sun, 2010-01-03 at 21:27 +0100, Alexander Graf wrote:
> I think if unin_pci is the only user, it'd be better to do it hacky
> inside unin_pci.c. But if there's a chance there's another user, it'd
> be better to make it generic.
>
> Since this is the first time I ever stumbled across type 0 and type 1
> PCI config space addresses, I simply don't know if there are any. Blue
> Swirls comment indicated that there are. Ben also sounded as if it's
> rather common to not use the x86 format. On the other hand, it looks
> like nobody in qemu needed it so far - and we're implementing ARM,
> MIPS and all other sorts of platforms.
>
> So if anyone with knowledge in PCI could shed some light here, please
> do so.
My feeling is that what you're better off doing is to have the qemu core
take an abstract struct to identify a device config space location, that
consists of separate fields for:
- The PCI domain (which is what host bridge it hangs off since bus
numbers are not unique between domains)
- The bus number
- The device number (aka slot ID)
- The function number
Now, you can then provide a "helper" that translate the standard x86
type 0 and type 1 cf8/cfc accesses into the above for most bridges to
use, and uninorth or other non-x86 that use different scheme can do
their own decoding.
The reason you want the above is to be more future proof, ie, you'll
probably want to deal with PCIe extended function numbers for example,
or implement different methods of MMCONFIG etc... and it's better to
disconnect the low level decoding of the config space access from the
internal representation in qemu.
Cheers,
Ben.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.