Linux wireless drivers development
 help / color / mirror / Atom feed
From: Zhu Yi <yi.zhu@intel.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org,
	Emmanuel Grumbach <emmanuel.grumbach@intel.com>,
	Tomas Winkler <tomas.winkler@intel.com>,
	Zhu Yi <yi.zhu@intel.com>
Subject: [PATCH 03/13] mac80211: pass dtim_period to low level driver
Date: Fri, 18 Jul 2008 13:52:59 +0800	[thread overview]
Message-ID: <1216360389-5352-4-git-send-email-yi.zhu@intel.com> (raw)
In-Reply-To: <1216360389-5352-3-git-send-email-yi.zhu@intel.com>

From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

This patch adds the dtim_period in ieee80211_bss_conf, this allows the low
level driver to know the dtim_period, and to plan power save accordingly.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 include/linux/ieee80211.h  |   13 +++++++++++++
 include/net/mac80211.h     |    4 +++-
 net/mac80211/ieee80211_i.h |    1 +
 net/mac80211/mlme.c        |   11 +++++++++++
 4 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index a1630ba..7f4df7c 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -506,6 +506,19 @@ struct ieee80211_channel_sw_ie {
 	u8 count;
 } __attribute__ ((packed));
 
+/**
+ * struct ieee80211_tim
+ *
+ * This structure refers to "Traffic Indication Map information element"
+ */
+struct ieee80211_tim_ie {
+	u8 dtim_count;
+	u8 dtim_period;
+	u8 bitmap_ctrl;
+	/* variable size: 1 - 251 bytes */
+	u8 virtual_map[0];
+} __attribute__ ((packed));
+
 struct ieee80211_mgmt {
 	__le16 frame_control;
 	__le16 duration;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 24a69f6..e0e4cd9 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -177,9 +177,10 @@ enum ieee80211_bss_change {
  * @aid: association ID number, valid only when @assoc is true
  * @use_cts_prot: use CTS protection
  * @use_short_preamble: use 802.11b short preamble
+ * @dtim_period: num of beacons before the next DTIM, for PSM
  * @timestamp: beacon timestamp
  * @beacon_int: beacon interval
- * @assoc_capability: capabbilities taken from assoc resp
+ * @assoc_capability: capabilities taken from assoc resp
  * @assoc_ht: association in HT mode
  * @ht_conf: ht capabilities
  * @ht_bss_conf: ht extended capabilities
@@ -191,6 +192,7 @@ struct ieee80211_bss_conf {
 	/* erp related data */
 	bool use_cts_prot;
 	bool use_short_preamble;
+	u8 dtim_period;
 	u16 beacon_int;
 	u16 assoc_capability;
 	u64 timestamp;
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 3ac23b8..cc499cc 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -81,6 +81,7 @@ struct ieee80211_sta_bss {
 
 	u8 bssid[ETH_ALEN];
 	u8 ssid[IEEE80211_MAX_SSID_LEN];
+	u8 dtim_period;
 	u16 capability; /* host byte order */
 	enum ieee80211_band band;
 	int freq;
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 8f51375..8925b0e 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -551,6 +551,7 @@ static void ieee80211_set_associated(struct net_device *dev,
 			/* set timing information */
 			sdata->bss_conf.beacon_int = bss->beacon_int;
 			sdata->bss_conf.timestamp = bss->timestamp;
+			sdata->bss_conf.dtim_period = bss->dtim_period;
 
 			changed |= ieee80211_handle_bss_capability(sdata, bss);
 
@@ -2692,6 +2693,16 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
 	bss->beacon_int = le16_to_cpu(mgmt->u.beacon.beacon_int);
 	bss->capability = le16_to_cpu(mgmt->u.beacon.capab_info);
 
+	if (elems->tim) {
+		struct ieee80211_tim_ie *tim_ie =
+			(struct ieee80211_tim_ie *)elems->tim;
+		bss->dtim_period = tim_ie->dtim_period;
+	}
+
+	/* set default value for buggy APs */
+	if (!elems->tim || bss->dtim_period == 0)
+		bss->dtim_period = 1;
+
 	bss->supp_rates_len = 0;
 	if (elems->supp_rates) {
 		clen = IEEE80211_MAX_SUPP_RATES - bss->supp_rates_len;
-- 
1.5.3.6


  reply	other threads:[~2008-07-18  5:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-18  5:52 [PATCH 00/13] iwlwifi driver 07/18 updates Zhu Yi
2008-07-18  5:52 ` [PATCH 01/13] iwlwifi: add power save to 5000 HW Zhu Yi
2008-07-18  5:52   ` [PATCH 02/13] iwlwifi: corrects power_level in sysfs Zhu Yi
2008-07-18  5:52     ` Zhu Yi [this message]
2008-07-18  5:53       ` [PATCH 04/13] mac80211: make listen_interval be limited by low level driver Zhu Yi
2008-07-18  5:53         ` [PATCH 05/13] iwlwifi: use dtim_period from association, and set listen_interval Zhu Yi
2008-07-18  5:53           ` [PATCH 06/13] iwlwifi: move iwl4965_mac_ampdu_action to iwl4965-base.c Zhu Yi
2008-07-18  5:53             ` [PATCH 07/13] iwlwifi: move beacon handling " Zhu Yi
2008-07-18  5:53               ` [PATCH 08/13] iwlwifi: move iwl4965_set_pwr_src " Zhu Yi
2008-07-18  5:53                 ` [PATCH 09/13] iwlwifi: rename iwl-4695-rs to iwl-agn-rs Zhu Yi
2008-07-18  5:53                   ` [PATCH 10/13] iwlwifi: kill iwl4965_fill_rs_info Zhu Yi
2008-07-18  5:53                     ` [PATCH 11/13] iwlwifi: set led register in disassociation Zhu Yi
2008-07-18  5:53                       ` [PATCH 12/13] mac80211: remove unused variable agg_queue Zhu Yi
2008-07-18  5:53                         ` [PATCH 13/13] iwlwifi: bug fix in AGG flow - cast const to ULL Zhu Yi
2008-07-18  8:23           ` [PATCH 05/13] iwlwifi: use dtim_period from association, and set listen_interval Johannes Berg
2008-07-18  8:53             ` Tomas Winkler

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=1216360389-5352-4-git-send-email-yi.zhu@intel.com \
    --to=yi.zhu@intel.com \
    --cc=emmanuel.grumbach@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=tomas.winkler@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox