From: Samuel Ortiz <samuel@sortiz.org>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: "Miguel Botón" <mboton.lkml@gmail.com>,
linux-wireless@vger.kernel.org, yi.zhu@intel.com
Subject: [PATCH] mac80211: power management wext hooks (was [PATCH 1/2] mac80211: add power management support)
Date: Fri, 4 Jul 2008 10:49:31 +0200 [thread overview]
Message-ID: <20080704084930.GA3061@sortiz.org> (raw)
In-Reply-To: <20080626175507.GA23142@tuxdriver.com>
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),
};
/**
prev parent reply other threads:[~2008-07-04 8:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-16 18:29 [PATCH 1/2] mac80211: add power management support Miguel Botón
2007-11-16 18:29 ` Miguel Botón
2007-11-16 18:53 ` Miguel Botón
2007-11-16 18:53 ` Miguel Botón
2007-11-16 19:02 ` 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 ` Samuel Ortiz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080704084930.GA3061@sortiz.org \
--to=samuel@sortiz.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=mboton.lkml@gmail.com \
--cc=yi.zhu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.