2007-11-16 18:34:52

by Miguel Botón

[permalink] [raw]
Subject: [PATCH 1/2] mac80211: add power management support

This patch adds power management support in mac80211.

This allows us to enable power management through the "iwconfig <device=
> power <off/on>" command.
The code is based on "mac80211-10.0.0" but it is a little bit modified.

Signed-off-by: Miguel Bot=C3=B3n <[email protected]>

diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_io=
ctl.c
index 6caa3ec..f5eebec 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -674,6 +687,51 @@ static int ieee80211_ioctl_giwtxpower(struct net_d=
evice *dev,
return 0;
}
=20
+static int ieee80211_ioctl_siwpower(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *extra)
+{
+ struct ieee80211_local *local =3D wdev_priv(dev->ieee80211_ptr);
+ struct ieee80211_conf *conf =3D &local->hw.conf;
+
+ if (wrqu->power.disabled) {
+ conf->power_management_enable =3D 0;
+ if (ieee80211_hw_config(local))
+ return -EINVAL;
+ return 0;
+ }
+
+ switch (wrqu->power.flags & IW_POWER_MODE) {
+ case IW_POWER_ON: /* If not specified */
+ case IW_POWER_MODE: /* If set all mask */
+ case IW_POWER_ALL_R: /* If explicitely state all */
+ break;
+ default: /* Otherwise we don't support it */
+ return -EINVAL;
+ }
+
+ conf->power_management_enable =3D 1;
+
+ if (ieee80211_hw_config(local))
+ return -EINVAL;
+
+ return 0;
+}
+
+static int ieee80211_ioctl_giwpower(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *extra)
+{
+ struct ieee80211_local *local =3D wdev_priv(dev->ieee80211_ptr);
+ struct ieee80211_conf *conf =3D &local->hw.conf;
+
+ wrqu->power.disabled =3D !conf->power_management_enable;
+
+ return 0;
+}
+
static int ieee80211_ioctl_siwrts(struct net_device *dev,
struct iw_request_info *info,
struct iw_param *rts, char *extra)
@@ -1111,8 +1166,8 @@ static const iw_handler ieee80211_handler[] =3D
(iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */
(iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */
(iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */
- (iw_handler) NULL, /* SIOCSIWPOWER */
- (iw_handler) NULL, /* SIOCGIWPOWER */
+ (iw_handler) ieee80211_ioctl_siwpower, /* SIOCSIWPOWER */
+ (iw_handler) ieee80211_ioctl_giwpower, /* SIOCGIWPOWER */
(iw_handler) NULL, /* -- hole -- */
(iw_handler) NULL, /* -- hole -- */
(iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */


--=20
Miguel Bot=C3=B3n


2007-11-16 18:53:28

by Miguel Botón

[permalink] [raw]
Subject: Re: [PATCH 1/2] mac80211: add power management support

Ok, the previous patch had a little error.

--

This patch adds power management support in mac80211.

This allows us to enable power management through the "iwconfig <device=
> power=20
<off/on>" command.
The code is based on "mac80211-10.0.0" but it is a little bit modified.

Signed-off-by: Miguel Bot=C3=B3n <[email protected]>

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 5fcc4c1..c82b6fa 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -452,6 +452,8 @@ struct ieee80211_conf {
u8 antenna_max;
u8 antenna_sel_tx;
u8 antenna_sel_rx;
+
+ u8 power_management_enable; /* flag to enable/disable power manag=
ement=20
*/
};
=20
/**
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_io=
ctl.c
index 6caa3ec..f5eebec 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -674,6 +687,51 @@ static int ieee80211_ioctl_giwtxpower(struct net_d=
evice=20
*dev,
return 0;
}
=20
+static int ieee80211_ioctl_siwpower(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *extra)
+{
+ struct ieee80211_local *local =3D wdev_priv(dev->ieee80211_ptr);
+ struct ieee80211_conf *conf =3D &local->hw.conf;
+
+ if (wrqu->power.disabled) {
+ conf->power_management_enable =3D 0;
+ if (ieee80211_hw_config(local))
+ return -EINVAL;
+ return 0;
+ }
+
+ switch (wrqu->power.flags & IW_POWER_MODE) {
+ case IW_POWER_ON: /* If not specified */
+ case IW_POWER_MODE: /* If set all mask */
+ case IW_POWER_ALL_R: /* If explicitely state all */
+ break;
+ default: /* Otherwise we don't support it */
+ return -EINVAL;
+ }
+
+ conf->power_management_enable =3D 1;
+
+ if (ieee80211_hw_config(local))
+ return -EINVAL;
+
+ return 0;
+}
+
+static int ieee80211_ioctl_giwpower(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *extra)
+{
+ struct ieee80211_local *local =3D wdev_priv(dev->ieee80211_ptr);
+ struct ieee80211_conf *conf =3D &local->hw.conf;
+
+ wrqu->power.disabled =3D !conf->power_management_enable;
+
+ return 0;
+}
+
static int ieee80211_ioctl_siwrts(struct net_device *dev,
struct iw_request_info *info,
struct iw_param *rts, char *extra)
@@ -1111,8 +1166,8 @@ static const iw_handler ieee80211_handler[] =3D
(iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */
(iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */
(iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */
- (iw_handler) NULL, /* SIOCSIWPOWER */
- (iw_handler) NULL, /* SIOCGIWPOWER */
+ (iw_handler) ieee80211_ioctl_siwpower, /* SIOCSIWPOWER */
+ (iw_handler) ieee80211_ioctl_giwpower, /* SIOCGIWPOWER */
(iw_handler) NULL, /* -- hole -- */
(iw_handler) NULL, /* -- hole -- */
(iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */

--=20
Miguel Bot=C3=B3n

2007-11-16 19:02:04

by Miguel Botón

[permalink] [raw]
Subject: Re: [PATCH 1/2] mac80211: add power management support

Today is not a good day for me... I sent the previous patch with wordwr=
ap enabled.
This one is the correct.

--

This patch adds power management support in mac80211.

This allows us to enable power management through the "iwconfig <device=
> power <off/on>" command.
The code is based on "mac80211-10.0.0" but it is a little bit modified.

Signed-off-by: Miguel Bot=C3=B3n <[email protected]>

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 5fcc4c1..c82b6fa 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -452,6 +452,8 @@ struct ieee80211_conf {
u8 antenna_max;
u8 antenna_sel_tx;
u8 antenna_sel_rx;
+
+ u8 power_management_enable; /* flag to enable/disable power manag=
ement */
};
=20
/**
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_io=
ctl.c
index 6caa3ec..f5eebec 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -674,6 +687,51 @@ static int ieee80211_ioctl_giwtxpower(struct net_d=
evice *dev,
return 0;
}
=20
+static int ieee80211_ioctl_siwpower(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *extra)
+{
+ struct ieee80211_local *local =3D wdev_priv(dev->ieee80211_ptr);
+ struct ieee80211_conf *conf =3D &local->hw.conf;
+
+ if (wrqu->power.disabled) {
+ conf->power_management_enable =3D 0;
+ if (ieee80211_hw_config(local))
+ return -EINVAL;
+ return 0;
+ }
+
+ switch (wrqu->power.flags & IW_POWER_MODE) {
+ case IW_POWER_ON: /* If not specified */
+ case IW_POWER_MODE: /* If set all mask */
+ case IW_POWER_ALL_R: /* If explicitely state all */
+ break;
+ default: /* Otherwise we don't support it */
+ return -EINVAL;
+ }
+
+ conf->power_management_enable =3D 1;
+
+ if (ieee80211_hw_config(local))
+ return -EINVAL;
+
+ return 0;
+}
+
+static int ieee80211_ioctl_giwpower(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *extra)
+{
+ struct ieee80211_local *local =3D wdev_priv(dev->ieee80211_ptr);
+ struct ieee80211_conf *conf =3D &local->hw.conf;
+
+ wrqu->power.disabled =3D !conf->power_management_enable;
+
+ return 0;
+}
+
static int ieee80211_ioctl_siwrts(struct net_device *dev,
struct iw_request_info *info,
struct iw_param *rts, char *extra)
@@ -1111,8 +1166,8 @@ static const iw_handler ieee80211_handler[] =3D
(iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */
(iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */
(iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */
- (iw_handler) NULL, /* SIOCSIWPOWER */
- (iw_handler) NULL, /* SIOCGIWPOWER */
+ (iw_handler) ieee80211_ioctl_siwpower, /* SIOCSIWPOWER */
+ (iw_handler) ieee80211_ioctl_giwpower, /* SIOCGIWPOWER */
(iw_handler) NULL, /* -- hole -- */
(iw_handler) NULL, /* -- hole -- */
(iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */


--=20
Miguel Bot=C3=B3n

2007-11-16 21:11:44

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 1/2] mac80211: add power management support



> + if (ieee80211_hw_config(local))
> + return -EINVAL;

-EINVAL seems not right. Doesn't that already return an error code?

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2008-06-26 18:16:58

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH 1/2] mac80211: add power management support

On Thu, Jun 26, 2008 at 07:40:58PM +0200, Samuel Ortiz wrote:
> Hi John,
>=20
> On Fri, Nov 16, 2007 at 07:53:26PM +0100, Miguel Bot=F3n wrote:
> > Ok, the previous patch had a little error.
> >=20
> > --
> >=20
> > This patch adds power management support in mac80211.
> Sorry for being late to the game, but would a similar patch against y=
our
> -next-2.6 tree be considered for inclusion ?

It seems like a reasonable start to me. Anyone else have comments?

John
--=20
John W. Linville
[email protected]

2008-06-26 18:24:30

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 1/2] mac80211: add power management support

On Thu, 2008-06-26 at 13:55 -0400, John W. Linville wrote:
> On Thu, Jun 26, 2008 at 07:40:58PM +0200, Samuel Ortiz wrote:
> > Hi John,
> >
> > On Fri, Nov 16, 2007 at 07:53:26PM +0100, Miguel Botón wrote:
> > > Ok, the previous patch had a little error.
> > >
> > > --
> > >
> > > This patch adds power management support in mac80211.
> > Sorry for being late to the game, but would a similar patch against your
> > -next-2.6 tree be considered for inclusion ?
>
> It seems like a reasonable start to me. Anyone else have comments?

I had one about it returning -EINVAL for all errors that was never
addressed afaict.

johannes


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2008-06-26 22:16:53

by Samuel Ortiz

[permalink] [raw]
Subject: Re: [PATCH 1/2] mac80211: add power management support


Hi Thomas=0D
=0D
On Fri, 27 Jun 2008 00:51:57 +0300, "Tomas Winkler" <[email protected]>=0D
wrote:=0D
> On Thu, Jun 26, 2008 at 9:23 PM, Johannes Berg=0D
> <[email protected]> wrote:=0D
>> On Thu, 2008-06-26 at 13:55 -0400, John W. Linville wrote:=0D
>>> On Thu, Jun 26, 2008 at 07:40:58PM +0200, Samuel Ortiz wrote:=0D
>>> > Hi John,=0D
>>> >=0D
>>> > On Fri, Nov 16, 2007 at 07:53:26PM +0100, Miguel Bot=C3=B3n wrote=
:=0D
>>> > > Ok, the previous patch had a little error.=0D
>>> > >=0D
>>> > > --=0D
>>> > >=0D
>>> > > This patch adds power management support in mac80211.=0D
>>> > Sorry for being late to the game, but would a similar patch again=
st=0D
> your=0D
>>> > -next-2.6 tree be considered for inclusion ?=0D
>>>=0D
>>> It seems like a reasonable start to me. Anyone else have comments?=
=0D
>>=0D
>> I had one about it returning -EINVAL for all errors that was never=0D
>> addressed afaict.=0D
> =0D
> Didn't Yi submitted this one like year ago and rejected?=0D
I searched through the mailing list, but couldnt find anything else=0D
than this patch.=0D
=0D
=0D
> This is why we have currently implemented in iwlwif sysfs.=0D
> =0D
> /sys/class/net/wlanX/devices/power_level=0D
> there are defined 6 power levels=0D
> 0 - CAM mode (Continuous Aware Mode)=0D
> 6 - AUTO=0D
> 1 to 5 levels that specifies power save aggressiveness empirically=0D
> developed.=0D
> AUTO - depends on system power source/level=0D
> system power level is AC or BATTERY - currently we do not have=0D
> anything that tells us whether we run on battery or ac.=0D
> Other factor is association state.=0D
> =0D
> This can be expressed as=0D
> iwconfig power saving 1..5=0D
> iwconfig power off - > CAM mode=0D
> iwconfig power auto - this is unfortunately not defined by iwconfig=0D
> =0D
> If this acceptable we can submit the patch=0D
Are you talking about the wext patch, or the sysfs one ?=0D
I'd definitely be happy to have a look at the wext one.=0D
=0D
Cheers,=0D
Samuel.

2008-06-27 04:14:56

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 1/2] mac80211: add power management support

Tomas Winkler <[email protected]> writes:

> This is why we have currently implemented in iwlwif sysfs.
>
> /sys/class/net/wlanX/devices/power_level
> there are defined 6 power levels
> 0 - CAM mode (Continuous Aware Mode)
> 6 - AUTO
> 1 to 5 levels that specifies power save aggressiveness empirically developed.
> AUTO - depends on system power source/level
> system power level is AC or BATTERY - currently we do not have
> anything that tells us whether we run on battery or ac.
> Other factor is association state.
>
> This can be expressed as
> iwconfig power saving 1..5
> iwconfig power off - > CAM mode
> iwconfig power auto - this is unfortunately not defined by iwconfig
>
> If this acceptable we can submit the patch

Sounds good to me, at least. It would be nice to have PSM support to
mac80211.

--
Kalle Valo

2008-06-26 17:39:30

by Samuel Ortiz

[permalink] [raw]
Subject: Re: [PATCH 1/2] mac80211: add power management support

Hi John,

On Fri, Nov 16, 2007 at 07:53:26PM +0100, Miguel Bot=F3n wrote:
> Ok, the previous patch had a little error.
>=20
> --
>=20
> This patch adds power management support in mac80211.
Sorry for being late to the game, but would a similar patch against you=
r
-next-2.6 tree be considered for inclusion ?

Cheers,
Samuel.


> This allows us to enable power management through the "iwconfig <devi=
ce> power=20
> <off/on>" command.
> The code is based on "mac80211-10.0.0" but it is a little bit modifie=
d.
>=20
> Signed-off-by: Miguel Bot=F3n <[email protected]>
>=20
> diff --git a/include/net/mac80211.h b/include/net/mac80211.h
> index 5fcc4c1..c82b6fa 100644
> --- a/include/net/mac80211.h
> +++ b/include/net/mac80211.h
> @@ -452,6 +452,8 @@ struct ieee80211_conf {
> u8 antenna_max;
> u8 antenna_sel_tx;
> u8 antenna_sel_rx;
> +
> + u8 power_management_enable; /* flag to enable/disable power man=
agement=20
> */
> };
> =20
> /**
> diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_=
ioctl.c
> index 6caa3ec..f5eebec 100644
> --- a/net/mac80211/ieee80211_ioctl.c
> +++ b/net/mac80211/ieee80211_ioctl.c
> @@ -674,6 +687,51 @@ static int ieee80211_ioctl_giwtxpower(struct net=
_device=20
> *dev,
> return 0;
> }
> =20
> +static int ieee80211_ioctl_siwpower(struct net_device *dev,
> + struct iw_request_info *info,
> + union iwreq_data *wrqu,
> + char *extra)
> +{
> + struct ieee80211_local *local =3D wdev_priv(dev->ieee80211_ptr);
> + struct ieee80211_conf *conf =3D &local->hw.conf;
> +
> + if (wrqu->power.disabled) {
> + conf->power_management_enable =3D 0;
> + if (ieee80211_hw_config(local))
> + return -EINVAL;
> + return 0;
> + }
> +
> + switch (wrqu->power.flags & IW_POWER_MODE) {
> + case IW_POWER_ON: /* If not specified */
> + case IW_POWER_MODE: /* If set all mask */
> + case IW_POWER_ALL_R: /* If explicitely state all */
> + break;
> + default: /* Otherwise we don't support it */
> + return -EINVAL;
> + }
> +
> + conf->power_management_enable =3D 1;
> +
> + if (ieee80211_hw_config(local))
> + return -EINVAL;
> +
> + return 0;
> +}
> +
> +static int ieee80211_ioctl_giwpower(struct net_device *dev,
> + struct iw_request_info *info,
> + union iwreq_data *wrqu,
> + char *extra)
> +{
> + struct ieee80211_local *local =3D wdev_priv(dev->ieee80211_ptr);
> + struct ieee80211_conf *conf =3D &local->hw.conf;
> +
> + wrqu->power.disabled =3D !conf->power_management_enable;
> +
> + return 0;
> +}
> +
> static int ieee80211_ioctl_siwrts(struct net_device *dev,
> struct iw_request_info *info,
> struct iw_param *rts, char *extra)
> @@ -1111,8 +1166,8 @@ static const iw_handler ieee80211_handler[] =3D
> (iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */
> (iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */
> (iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */
> - (iw_handler) NULL, /* SIOCSIWPOWER */
> - (iw_handler) NULL, /* SIOCGIWPOWER */
> + (iw_handler) ieee80211_ioctl_siwpower, /* SIOCSIWPOWER */
> + (iw_handler) ieee80211_ioctl_giwpower, /* SIOCGIWPOWER */
> (iw_handler) NULL, /* -- hole -- */
> (iw_handler) NULL, /* -- hole -- */
> (iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */
>=20
> --=20
> Miguel Bot=F3n
> -
> To unsubscribe from this list: send the line "unsubscribe linux-wirel=
ess" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2008-06-26 21:51:58

by Tomas Winkler

[permalink] [raw]
Subject: Re: [PATCH 1/2] mac80211: add power management support

On Thu, Jun 26, 2008 at 9:23 PM, Johannes Berg
<[email protected]> wrote:
> On Thu, 2008-06-26 at 13:55 -0400, John W. Linville wrote:
>> On Thu, Jun 26, 2008 at 07:40:58PM +0200, Samuel Ortiz wrote:
>> > Hi John,
>> >
>> > On Fri, Nov 16, 2007 at 07:53:26PM +0100, Miguel Bot=F3n wrote:
>> > > Ok, the previous patch had a little error.
>> > >
>> > > --
>> > >
>> > > This patch adds power management support in mac80211.
>> > Sorry for being late to the game, but would a similar patch agains=
t your
>> > -next-2.6 tree be considered for inclusion ?
>>
>> It seems like a reasonable start to me. Anyone else have comments?
>
> I had one about it returning -EINVAL for all errors that was never
> addressed afaict.

Didn't Yi submitted this one like year ago and rejected?

This is why we have currently implemented in iwlwif sysfs.

/sys/class/net/wlanX/devices/power_level
there are defined 6 power levels
0 - CAM mode (Continuous Aware Mode)
6 - AUTO
1 to 5 levels that specifies power save aggressiveness empirically dev=
eloped.
AUTO - depends on system power source/level
system power level is AC or BATTERY - currently we do not have
anything that tells us whether we run on battery or ac.
Other factor is association state.

This can be expressed as
iwconfig power saving 1..5
iwconfig power off - > CAM mode
iwconfig power auto - this is unfortunately not defined by iwconfig

If this acceptable we can submit the patch

Thanks
Tomas

2008-07-04 08:48:05

by Samuel Ortiz

[permalink] [raw]
Subject: [PATCH] mac80211: power management wext hooks (was [PATCH 1/2] mac80211: add power management support)

Hi John,

On Thu, Jun 26, 2008 at 01:55:07PM -0400, John W. Linville wrote:
> > > This patch adds power management support in mac80211.
> > Sorry for being late to the game, but would a similar patch against your
> > -next-2.6 tree be considered for inclusion ?
>
> It seems like a reasonable start to me. Anyone else have comments?
Here is my version then, against your wireless-next tree:

This patch implements the power management routines wireless extensions
for mac80211.
For now we only support switching PS mode between on and off.

Signed-off-by: Samuel Ortiz <[email protected]>
---
include/net/mac80211.h | 2 ++
net/mac80211/wext.c | 43 +++++++++++++++++++++++++++++++++++++++++--
2 files changed, 43 insertions(+), 2 deletions(-)

Index: wireless-next-2.6/net/mac80211/wext.c
===================================================================
--- wireless-next-2.6.orig/net/mac80211/wext.c 2008-07-04 10:05:46.000000000 +0200
+++ wireless-next-2.6/net/mac80211/wext.c 2008-07-04 10:42:03.000000000 +0200
@@ -1000,6 +1000,45 @@ static int ieee80211_ioctl_giwencode(str
return 0;
}

+static int ieee80211_ioctl_siwpower(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra)
+{
+ struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+ struct ieee80211_conf *conf = &local->hw.conf;
+
+ if (wrq->disabled) {
+ conf->flags &= ~IEEE80211_CONF_PS;
+ return ieee80211_hw_config(local);
+ }
+
+ switch (wrq->flags & IW_POWER_MODE) {
+ case IW_POWER_ON: /* If not specified */
+ case IW_POWER_MODE: /* If set all mask */
+ case IW_POWER_ALL_R: /* If explicitely state all */
+ conf->flags |= IEEE80211_CONF_PS;
+ break;
+ default: /* Otherwise we don't support it */
+ return -EINVAL;
+ }
+
+ return ieee80211_hw_config(local);
+}
+
+static int ieee80211_ioctl_giwpower(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *extra)
+{
+ struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+ struct ieee80211_conf *conf = &local->hw.conf;
+
+ wrqu->power.disabled = !(conf->flags & IEEE80211_CONF_PS);
+
+ return 0;
+}
+
static int ieee80211_ioctl_siwauth(struct net_device *dev,
struct iw_request_info *info,
struct iw_param *data, char *extra)
@@ -1202,8 +1241,8 @@ static const iw_handler ieee80211_handle
(iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */
(iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */
(iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */
- (iw_handler) NULL, /* SIOCSIWPOWER */
- (iw_handler) NULL, /* SIOCGIWPOWER */
+ (iw_handler) ieee80211_ioctl_siwpower, /* SIOCSIWPOWER */
+ (iw_handler) ieee80211_ioctl_giwpower, /* SIOCGIWPOWER */
(iw_handler) NULL, /* -- hole -- */
(iw_handler) NULL, /* -- hole -- */
(iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */
Index: wireless-next-2.6/include/net/mac80211.h
===================================================================
--- wireless-next-2.6.orig/include/net/mac80211.h 2008-07-04 10:05:45.000000000 +0200
+++ wireless-next-2.6/include/net/mac80211.h 2008-07-04 10:42:03.000000000 +0200
@@ -396,11 +396,13 @@ struct ieee80211_rx_status {
* @IEEE80211_CONF_SHORT_SLOT_TIME: use 802.11g short slot time
* @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported)
* @IEEE80211_CONF_SUPPORT_HT_MODE: use 802.11n HT capabilities (if supported)
+ * @IEEE80211_CONF_PS: Enable 802.11 power save mode
*/
enum ieee80211_conf_flags {
IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0),
IEEE80211_CONF_RADIOTAP = (1<<1),
IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2),
+ IEEE80211_CONF_PS = (1<<3),
};

/**