* [PATCH 1/2] mac80211: add power management support @ 2007-11-16 18:29 Miguel Botón 2007-11-16 18:53 ` Miguel Botón 0 siblings, 1 reply; 11+ messages in thread From: Miguel Botón @ 2007-11-16 18:29 UTC (permalink / raw) To: Linux Kernel Mailing List; +Cc: linux-wireless, linville, yi.zhu 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 <mboton@gmail.com> 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 - To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] mac80211: add power management support 2007-11-16 18:29 [PATCH 1/2] mac80211: add power management support Miguel Botón @ 2007-11-16 18:53 ` Miguel Botón 2007-11-16 19:02 ` Miguel Botón 2008-06-26 17:40 ` Samuel Ortiz 0 siblings, 2 replies; 11+ messages in thread From: Miguel Botón @ 2007-11-16 18:53 UTC (permalink / raw) To: Linux Kernel Mailing List; +Cc: linux-wireless, linville, yi.zhu 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 <mboton@gmail.com> 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 - To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] mac80211: add power management support 2007-11-16 18:53 ` Miguel Botón @ 2007-11-16 19:02 ` Miguel Botón 2007-11-16 21:13 ` Johannes Berg 2008-06-26 17:40 ` Samuel Ortiz 1 sibling, 1 reply; 11+ messages in thread From: Miguel Botón @ 2007-11-16 19:02 UTC (permalink / raw) To: Linux Kernel Mailing List; +Cc: linux-wireless, linville, yi.zhu 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 <mboton@gmail.com> 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 - To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] mac80211: add power management support 2007-11-16 19:02 ` Miguel Botón @ 2007-11-16 21:13 ` Johannes Berg 0 siblings, 0 replies; 11+ messages in thread From: Johannes Berg @ 2007-11-16 21:13 UTC (permalink / raw) To: Miguel Botón Cc: Linux Kernel Mailing List, linux-wireless, linville, yi.zhu [-- Attachment #1: Type: text/plain, Size: 146 bytes --] > + if (ieee80211_hw_config(local)) > + return -EINVAL; -EINVAL seems not right. Doesn't that already return an error code? johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 828 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] mac80211: add power management support 2007-11-16 18:53 ` Miguel Botón 2007-11-16 19:02 ` Miguel Botón @ 2008-06-26 17:40 ` Samuel Ortiz 2008-06-26 17:55 ` John W. Linville 1 sibling, 1 reply; 11+ messages in thread From: Samuel Ortiz @ 2008-06-26 17:40 UTC (permalink / raw) To: Miguel Botón, linville; +Cc: linux-wireless, yi.zhu 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 <mboton@gmail.com> >=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 majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] mac80211: add power management support 2008-06-26 17:40 ` Samuel Ortiz @ 2008-06-26 17:55 ` John W. Linville 2008-06-26 18:23 ` Johannes Berg 2008-07-04 8:49 ` [PATCH] mac80211: power management wext hooks (was [PATCH 1/2] mac80211: add power management support) Samuel Ortiz 0 siblings, 2 replies; 11+ messages in thread From: John W. Linville @ 2008-06-26 17:55 UTC (permalink / raw) To: Samuel Ortiz; +Cc: Miguel Botón, linux-wireless, yi.zhu 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 linville@tuxdriver.com -- To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] mac80211: add power management support 2008-06-26 17:55 ` John W. Linville @ 2008-06-26 18:23 ` Johannes Berg 2008-06-26 21:51 ` Tomas Winkler 2008-07-04 8:49 ` [PATCH] mac80211: power management wext hooks (was [PATCH 1/2] mac80211: add power management support) Samuel Ortiz 1 sibling, 1 reply; 11+ messages in thread From: Johannes Berg @ 2008-06-26 18:23 UTC (permalink / raw) To: John W. Linville; +Cc: Samuel Ortiz, Miguel Botón, linux-wireless, yi.zhu [-- Attachment #1: Type: text/plain, Size: 654 bytes --] 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 [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] mac80211: add power management support 2008-06-26 18:23 ` Johannes Berg @ 2008-06-26 21:51 ` Tomas Winkler 2008-06-26 22:10 ` samuel 2008-06-27 4:14 ` Kalle Valo 0 siblings, 2 replies; 11+ messages in thread From: Tomas Winkler @ 2008-06-26 21:51 UTC (permalink / raw) To: Johannes Berg Cc: John W. Linville, Samuel Ortiz, Miguel Botón, linux-wireless, yi.zhu On Thu, Jun 26, 2008 at 9:23 PM, Johannes Berg <johannes@sipsolutions.net> 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 -- To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] mac80211: add power management support 2008-06-26 21:51 ` Tomas Winkler @ 2008-06-26 22:10 ` samuel 2008-06-27 4:14 ` Kalle Valo 1 sibling, 0 replies; 11+ messages in thread From: samuel @ 2008-06-26 22:10 UTC (permalink / raw) To: Tomas Winkler Cc: Johannes Berg, John W. Linville, Miguel Botón, linux-wireless, yi.zhu Hi Thomas=0D =0D On Fri, 27 Jun 2008 00:51:57 +0300, "Tomas Winkler" <tomasw@gmail.com>=0D wrote:=0D > On Thu, Jun 26, 2008 at 9:23 PM, Johannes Berg=0D > <johannes@sipsolutions.net> 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. -- To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] mac80211: add power management support 2008-06-26 21:51 ` Tomas Winkler 2008-06-26 22:10 ` samuel @ 2008-06-27 4:14 ` Kalle Valo 1 sibling, 0 replies; 11+ messages in thread From: Kalle Valo @ 2008-06-27 4:14 UTC (permalink / raw) To: Tomas Winkler Cc: Johannes Berg, John W. Linville, Samuel Ortiz, Miguel Botón, linux-wireless, yi.zhu Tomas Winkler <tomasw@gmail.com> 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] mac80211: power management wext hooks (was [PATCH 1/2] mac80211: add power management support) 2008-06-26 17:55 ` John W. Linville 2008-06-26 18:23 ` Johannes Berg @ 2008-07-04 8:49 ` Samuel Ortiz 1 sibling, 0 replies; 11+ messages in thread From: Samuel Ortiz @ 2008-07-04 8:49 UTC (permalink / raw) To: John W. Linville; +Cc: Miguel Botón, linux-wireless, yi.zhu 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 <sameo@openedhand.com> --- 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), }; /** ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2008-07-04 8:48 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-11-16 18:29 [PATCH 1/2] mac80211: add power management support Miguel Botón 2007-11-16 18:53 ` Miguel Botón 2007-11-16 19:02 ` Miguel Botón 2007-11-16 21:13 ` Johannes Berg 2008-06-26 17:40 ` Samuel Ortiz 2008-06-26 17:55 ` John W. Linville 2008-06-26 18:23 ` Johannes Berg 2008-06-26 21:51 ` Tomas Winkler 2008-06-26 22:10 ` samuel 2008-06-27 4:14 ` Kalle Valo 2008-07-04 8:49 ` [PATCH] mac80211: power management wext hooks (was [PATCH 1/2] mac80211: add power management support) Samuel Ortiz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).