Re: [RFC PATCH] libertas: turn radio off when down
On Wed, Nov 21, 2007 at 02:06:19AM -0500, Chris Ball wrote: Hi Dan, Last I knew there were cases where mesh forwarding was _not_ supposed to be on due to the high power drain of the 8388 when the radio was enabled, plus the airplane case. As long as the networking core doesn't close the devices on suspend, this patch shouldn't have side-effects on mesh forwarding. The current setup is: suspend: caused by idleness, radio stays on, unicast wakeups stay on When using salut (so mesh network only) and you don't wakeup on multicast traffic (for the groups your interested in). Then the node will drop off the meshview after a few minutes and activities your in won't receive messages from other nodes (and your kicked out of them after about 5 minutes of suspend)... sleep: caused by lid close or power button, radio stays on, wakeups off I think it's still undecided whether sleep should leave the radio on or not -- we need to take power measurements now that mesh beacons can be disabled and see whether the power consumption is significantly reduced. [1] when doing long suspends, when the resume occurs userspace will need to redo the networking setup anyway, scanning and searching for the school server or default mesh channel, because a long suspend most likely means you changed location and increases the likelihood that the networking situation around you changed as well. Is there a dbus message OHM can pass to NM for this? (If not, maybe you could mention which NM functions perform the full scan/search so that we can wrap them?) And is there a signal passed to the other parts of user space before taking the network interfaces down. In salut's case it would be nice if it would have the chance (is a second or two) to send the necessary bye packets on both MDNS and clique, so you can disconnect gracefully instead of the other nodes needing to wait a few minutes to detect your network has failed. Sjoerd -- In 1750 Issac Newton became discouraged when he fell up a flight of stairs. ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel
Re: [RFC PATCH] libertas: turn radio off when down
On Tue, Nov 20, 2007 at 11:18:07PM -0500, Dan Williams wrote: This should allow NetworkManager to be told to go to sleep, at which point it will mark all devices down, and with this patch should turn off the radio and save power. Good. Comments? Very slight possibility of further factorisation seen, but probably not worth it. Otherwise it seemed to make sense. Is it in a build yet? Acked-by: James Cameron [EMAIL PROTECTED] -- James Cameronmailto:[EMAIL PROTECTED] http://quozl.netrek.org/ ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel
Re: [RFC PATCH] libertas: turn radio off when down
Question. How is this intended to interact with the mesh connectivity intended for the laptops? I'm of the understanding that the mesh being powered and on is more or less a baseline design feature of the XO-as-platform. Or is this an airplane mode feature that's going to get a button-push or other widget activation to activate? I fully support the notion of making it possible to quickly and easily disable the radio, as well as mesh-y bits, saving power and reducing RF in situations where one is either clearly out-of-contact or prohibited from emitting excess RF energy, but I would want it to be: 1) very difficult to do by accident 2) give some indication that the radio is currently off, making it easy to quickly re-enable the radio. What's the plan for UI for this? --elijah On Wed, 21 Nov 2007, James Cameron wrote: Date: Wed, 21 Nov 2007 16:26:57 +1100 From: James Cameron [EMAIL PROTECTED] To: Dan Williams [EMAIL PROTECTED] Cc: Andres Salomon [EMAIL PROTECTED], [EMAIL PROTECTED], Brajesh Dave [EMAIL PROTECTED] Subject: Re: [RFC PATCH] libertas: turn radio off when down On Tue, Nov 20, 2007 at 11:18:07PM -0500, Dan Williams wrote: This should allow NetworkManager to be told to go to sleep, at which point it will mark all devices down, and with this patch should turn off the radio and save power. Good. Comments? Very slight possibility of further factorisation seen, but probably not worth it. Otherwise it seemed to make sense. Is it in a build yet? Acked-by: James Cameron [EMAIL PROTECTED] ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel
RE: [RFC PATCH] libertas: turn radio off when down
Mesh forwarding is always on. Therefore, disabling radio when interface in not up will disable mesh forwarding as well. Have you thought of this? Thanks -Ashish -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Williams Sent: Wednesday, November 21, 2007 9:48 AM To: [EMAIL PROTECTED] Cc: Brajesh Dave; Andres Salomon Subject: [RFC PATCH] libertas: turn radio off when down Backport of a patch to olpc-2.6 I'm going to post to linux-wireless. When both interfaces are down (~IFF_UP), turn off the radio to save power. When either interface is opened (via iwconfig up or otherwise) turn the radio back on unless the radio was explicitly disabled by the user via 'iwconfig txpower off' which also is the previous behavior without this patch. This should allow NetworkManager to be told to go to sleep, at which point it will mark all devices down, and with this patch should turn off the radio and save power. It also cleans up some of the mess that was *_open, the intent for which (unless I'm reading that code wrong) was just to check whether the interface was up or not, since that's what open/close do. Comments? Signed-off-by: Dan Williams [EMAIL PROTECTED] diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index caf0b1c..5a15b56 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -479,6 +479,8 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, return 0; } +#define TURN_ON_RF 0x01 + static int wlan_cmd_802_11_radio_control(wlan_private * priv, struct cmd_ds_command *cmd, int cmd_action) @@ -510,7 +512,7 @@ static int wlan_cmd_802_11_radio_control(wlan_private * priv, break; } - if (adapter-radioon) + if (adapter-radio_on) pradiocontrol-control |= cpu_to_le16(TURN_ON_RF); else pradiocontrol-control = cpu_to_le16(~TURN_ON_RF); @@ -1112,7 +1114,7 @@ int libertas_set_radio_control(wlan_private * priv) CMD_OPTION_WAITFORRSP, 0, NULL); lbs_deb_cmd(RADIO_SET: radio %d, preamble %d\n, -priv-adapter-radioon, priv-adapter-preamble); +priv-adapter-radio_on, priv-adapter-preamble); lbs_deb_leave_args(LBS_DEB_CMD, ret %d, ret); return ret; diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index d391391..433d481 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -991,7 +991,7 @@ int libertas_process_event(wlan_private * priv) } lbs_pr_info(EVENT: MESH_AUTO_STARTED\n); adapter-mesh_connect_status = LIBERTAS_CONNECTED; - if (priv-mesh_open == 1) { + if (priv-mesh_dev-flags IFF_UP) { netif_wake_queue(priv-mesh_dev); netif_carrier_on(priv-mesh_dev); } diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 404ca50..62c3e75 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -100,9 +100,6 @@ struct wlan_mesh_stats { /** Private structure for the MV device */ struct _wlan_private { - int open; - int mesh_open; - int infra_open; int mesh_autostart_enabled; __le16 boot2_version; @@ -339,7 +336,8 @@ struct _wlan_adapter { u16 nextSNRNF; u16 numSNRNF; - u8 radioon; + u8 user_radio_on; + u8 radio_on; u32 preamble; /** data rate stuff */ diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index 00d5675..eb516be 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h @@ -183,10 +183,6 @@ #define CMD_TYPE_SHORT_PREAMBLE 0x0002 #define CMD_TYPE_LONG_PREAMBLE 0x0003 -#define TURN_ON_RF 0x01 -#define RADIO_ON0x01 -#define RADIO_OFF 0x00 - #define SET_AUTO_PREAMBLE 0x05 #define SET_SHORT_PREAMBLE 0x03 #define SET_LONG_PREAMBLE 0x01 diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 2b104d2..f07d5b4 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -11,7 +11,9 @@ #include linux/netdevice.h #include linux/if_arp.h #include linux/kthread.h +#if CONFIG_OLPC #include asm/olpc.h +#endif #include net/iw_handler.h #include net/ieee80211.h @@ -406,8 +408,6 @@ static int libertas_dev_open(struct net_device *dev) lbs_deb_enter(LBS_DEB_NET); - priv-open
Re: [RFC PATCH] libertas: turn radio off when down
On Tue, 2007-11-20 at 23:38 -0600, [EMAIL PROTECTED] wrote: Question. How is this intended to interact with the mesh connectivity intended for the laptops? I'm of the understanding that the mesh being powered and on is more or less a baseline design feature of the XO-as-platform. Yes, though for the first gen machines it's likely that more aggressive power management will be required than was originally thought. However, see my mail to Ashish for more detail. Or is this an airplane mode feature that's going to get a button-push or other widget activation to activate? Mostly for airplane mode, and to turn off the power when the device isn't being used at all. When both interfaces are marked down, you can't pass any traffic through the device anyway. There are cases where mesh forwarding is desirable but the machine is asleep for longer periods of time, in these cases there is no real reason to close the device anyway. Dan I fully support the notion of making it possible to quickly and easily disable the radio, as well as mesh-y bits, saving power and reducing RF in situations where one is either clearly out-of-contact or prohibited from emitting excess RF energy, but I would want it to be: 1) very difficult to do by accident 2) give some indication that the radio is currently off, making it easy to quickly re-enable the radio. What's the plan for UI for this? --elijah On Wed, 21 Nov 2007, James Cameron wrote: Date: Wed, 21 Nov 2007 16:26:57 +1100 From: James Cameron [EMAIL PROTECTED] To: Dan Williams [EMAIL PROTECTED] Cc: Andres Salomon [EMAIL PROTECTED], [EMAIL PROTECTED], Brajesh Dave [EMAIL PROTECTED] Subject: Re: [RFC PATCH] libertas: turn radio off when down On Tue, Nov 20, 2007 at 11:18:07PM -0500, Dan Williams wrote: This should allow NetworkManager to be told to go to sleep, at which point it will mark all devices down, and with this patch should turn off the radio and save power. Good. Comments? Very slight possibility of further factorisation seen, but probably not worth it. Otherwise it seemed to make sense. Is it in a build yet? Acked-by: James Cameron [EMAIL PROTECTED] ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel
RE: [RFC PATCH] libertas: turn radio off when down
On Tue, 2007-11-20 at 21:45 -0800, Ashish Shukla wrote: Mesh forwarding is always on. Therefore, disabling radio when interface in not up will disable mesh forwarding as well. Have you thought of this? Yes, though interactions with suspend/resume need to be investigated here. First, if NM is told to sleep and marks the device down (ohm would be doing this normally via a lid button event or such), that means that either somebody is on an airplane, or the laptop really, really should get turned _all_ the way off without mesh forwarding. If you would like to keep mesh forwarding on, the mesh device shouldn't be brought down [1]. This leads into suspend/resume land. Basically, when the machine suspends, the mesh device should be kept IFF_UP and NM shouldn't be told to sleep, since this will be happening very often on OLPC. I'm not sure if the networking core closes the device on suspend, hopefully not; if it doesn't close the device, then nothing else should be touching it and things will work correctly. Last I knew there were cases where mesh forwarding was _not_ supposed to be on due to the high power drain of the 8388 when the radio was enabled, plus the airplane case. As long as the networking core doesn't close the devices on suspend, this patch shouldn't have side-effects on mesh forwarding. Dan [1] when doing long suspends, when the resume occurs userspace will need to redo the networking setup anyway, scanning and searching for the school server or default mesh channel, because a long suspend most likely means you changed location and increases the likelihood that the networking situation around you changed as well. Thanks -Ashish -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Williams Sent: Wednesday, November 21, 2007 9:48 AM To: [EMAIL PROTECTED] Cc: Brajesh Dave; Andres Salomon Subject: [RFC PATCH] libertas: turn radio off when down Backport of a patch to olpc-2.6 I'm going to post to linux-wireless. When both interfaces are down (~IFF_UP), turn off the radio to save power. When either interface is opened (via iwconfig up or otherwise) turn the radio back on unless the radio was explicitly disabled by the user via 'iwconfig txpower off' which also is the previous behavior without this patch. This should allow NetworkManager to be told to go to sleep, at which point it will mark all devices down, and with this patch should turn off the radio and save power. It also cleans up some of the mess that was *_open, the intent for which (unless I'm reading that code wrong) was just to check whether the interface was up or not, since that's what open/close do. Comments? Signed-off-by: Dan Williams [EMAIL PROTECTED] diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index caf0b1c..5a15b56 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -479,6 +479,8 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, return 0; } +#define TURN_ON_RF 0x01 + static int wlan_cmd_802_11_radio_control(wlan_private * priv, struct cmd_ds_command *cmd, int cmd_action) @@ -510,7 +512,7 @@ static int wlan_cmd_802_11_radio_control(wlan_private * priv, break; } - if (adapter-radioon) + if (adapter-radio_on) pradiocontrol-control |= cpu_to_le16(TURN_ON_RF); else pradiocontrol-control = cpu_to_le16(~TURN_ON_RF); @@ -1112,7 +1114,7 @@ int libertas_set_radio_control(wlan_private * priv) CMD_OPTION_WAITFORRSP, 0, NULL); lbs_deb_cmd(RADIO_SET: radio %d, preamble %d\n, - priv-adapter-radioon, priv-adapter-preamble); + priv-adapter-radio_on, priv-adapter-preamble); lbs_deb_leave_args(LBS_DEB_CMD, ret %d, ret); return ret; diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index d391391..433d481 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -991,7 +991,7 @@ int libertas_process_event(wlan_private * priv) } lbs_pr_info(EVENT: MESH_AUTO_STARTED\n); adapter-mesh_connect_status = LIBERTAS_CONNECTED; - if (priv-mesh_open == 1) { + if (priv-mesh_dev-flags IFF_UP) { netif_wake_queue(priv-mesh_dev); netif_carrier_on(priv-mesh_dev); } diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 404ca50..62c3e75 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -100,9 +100,6 @@ struct wlan_mesh_stats { /** Private structure for the MV device */ struct
Re: [RFC PATCH] libertas: turn radio off when down
Hi Dan, Last I knew there were cases where mesh forwarding was _not_ supposed to be on due to the high power drain of the 8388 when the radio was enabled, plus the airplane case. As long as the networking core doesn't close the devices on suspend, this patch shouldn't have side-effects on mesh forwarding. The current setup is: suspend: caused by idleness, radio stays on, unicast wakeups stay on sleep: caused by lid close or power button, radio stays on, wakeups off I think it's still undecided whether sleep should leave the radio on or not -- we need to take power measurements now that mesh beacons can be disabled and see whether the power consumption is significantly reduced. [1] when doing long suspends, when the resume occurs userspace will need to redo the networking setup anyway, scanning and searching for the school server or default mesh channel, because a long suspend most likely means you changed location and increases the likelihood that the networking situation around you changed as well. Is there a dbus message OHM can pass to NM for this? (If not, maybe you could mention which NM functions perform the full scan/search so that we can wrap them?) Thanks! - Chris. -- Chris Ball [EMAIL PROTECTED] ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel