From: Emmanuel Grumbach <[email protected]>
This patch makes mac80211 able to send action frames when toggling
(SM PS) Spacial Multiplexing Power Save mode.
Example:
1.
Low lever driver may close some of RX chains in power save mode
and needs to announce to AP that a RTS frame is need in order to wake all
RX chains, on other hand SM PS can be disabled on CAM mode or if HW is able
to wake all chains without RTS frame.
2.
iwlwifi can call this function when it detects that only
one antenna can effectively receive then MS PS mode is set to STATIC and
AP is asked not to send MIMO rates packets.
Signed-off-by: Emmanuel Grumbach <[email protected]>
Signed-off-by: Tomas Winkler <[email protected]>
---
include/linux/ieee80211.h | 14 +++++++-
include/net/mac80211.h | 10 ++++++
net/mac80211/ht.c | 79 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 102 insertions(+), 1 deletions(-)
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 14126bc..c037b40 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -623,6 +623,10 @@ struct ieee80211_mgmt {
} __attribute__((packed)) addba_resp;
struct{
u8 action_code;
+ u8 ps_ctrl;
+ } __attribute__((packed)) sm_ps;
+ struct{
+ u8 action_code;
__le16 params;
__le16 reason_code;
} __attribute__((packed)) delba;
@@ -759,12 +763,14 @@ struct ieee80211_ht_addt_info {
#define IEEE80211_MIN_AMPDU_BUF 0x8
#define IEEE80211_MAX_AMPDU_BUF 0x40
-
/* Spatial Multiplexing Power Save Modes */
#define WLAN_HT_CAP_SM_PS_STATIC 0
#define WLAN_HT_CAP_SM_PS_DYNAMIC 1
#define WLAN_HT_CAP_SM_PS_INVALID 2
#define WLAN_HT_CAP_SM_PS_DISABLED 3
+/* Spatial Multiplexing control bits */
+#define IEEE80211_SM_PS_ENABLE 0x1
+#define IEEE80211_SM_PS_DYNAMIC 0x2
/* Authentication algorithms */
#define WLAN_AUTH_OPEN 0
@@ -963,6 +969,7 @@ enum ieee80211_category {
WLAN_CATEGORY_SPECTRUM_MGMT = 0,
WLAN_CATEGORY_QOS = 1,
WLAN_CATEGORY_DLS = 2,
+ WLAN_CATEGORY_HT = 7,
WLAN_CATEGORY_BACK = 3,
WLAN_CATEGORY_WMM = 17,
};
@@ -976,6 +983,11 @@ enum ieee80211_spectrum_mgmt_actioncode {
WLAN_ACTION_SPCT_CHL_SWITCH = 4,
};
+/* HT action code */
+enum ieee80211_ht_actioncode {
+ WLAN_ACTION_SM_PS = 1,
+};
+
/* BACK action code */
enum ieee80211_back_actioncode {
WLAN_ACTION_ADDBA_REQ = 0,
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index f5f5b1f..f15e495 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1868,4 +1868,14 @@ rate_lowest_index(struct ieee80211_supported_band *sband,
int ieee80211_rate_control_register(struct rate_control_ops *ops);
void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
+/**
+ * ieee80211_send_sm_ps_update - send SM Power Save Action frame
+ * @hw: pointer as obtained from ieee80211_alloc_hw().
+ * @new_mode: new SM Power Save mode WLAN_HT_CAP_SM_PS_*
+ *
+ * This function must be called by low level driver to inform AP about change
+ * in SM Power Save state.
+ */
+void ieee80211_sm_ps_update(struct ieee80211_hw *hw, u8 new_mode);
+
#endif /* MAC80211_H */
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index dc7d9a3..e468137 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -990,3 +990,82 @@ void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
WLAN_BACK_RECIPIENT);
}
}
+
+static void ieee80211_send_sm_ps(struct ieee80211_sub_if_data *sdata, u8 mode)
+{
+ struct ieee80211_local *local = sdata->local;
+ struct ieee80211_mgmt *mgmt;
+ struct sk_buff *skb;
+ DECLARE_MAC_BUF(mac);
+
+ struct ieee80211_if_sta *ifsta = &sdata->u.sta;
+ struct net_device *dev = sdata->dev;
+
+ /* Implemented for STA only */
+ if (sdata->vif.type != NL80211_IFTYPE_STATION)
+ return;
+
+ skb = dev_alloc_skb(sizeof(*mgmt) +
+ local->hw.extra_tx_headroom);
+
+ if (!skb) {
+ printk(KERN_ERR "%s: failed to allocate buffer "
+ "for SM_PS frame\n", dev->name);
+ return;
+ }
+ skb_reserve(skb, local->hw.extra_tx_headroom);
+ mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
+ memset(mgmt, 0, 24);
+ memcpy(mgmt->da, ifsta->bssid, ETH_ALEN);
+ memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN);
+ memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
+
+ mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
+ IEEE80211_STYPE_ACTION);
+
+ skb_put(skb, 1 + sizeof(mgmt->u.action.u.sm_ps));
+
+ mgmt->u.action.category = WLAN_CATEGORY_HT;
+ mgmt->u.action.u.sm_ps.action_code = WLAN_ACTION_SM_PS;
+
+ switch (mode) {
+
+ case WLAN_HT_CAP_SM_PS_DISABLED:
+ mgmt->u.action.u.sm_ps.ps_ctrl &=
+ ~(IEEE80211_SM_PS_ENABLE |
+ IEEE80211_SM_PS_DYNAMIC);
+ break;
+ case WLAN_HT_CAP_SM_PS_DYNAMIC:
+ mgmt->u.action.u.sm_ps.ps_ctrl |=
+ IEEE80211_SM_PS_ENABLE |
+ IEEE80211_SM_PS_DYNAMIC;
+ break;
+ case WLAN_HT_CAP_SM_PS_STATIC:
+ mgmt->u.action.u.sm_ps.ps_ctrl |=
+ IEEE80211_SM_PS_ENABLE;
+ mgmt->u.action.u.sm_ps.ps_ctrl &=
+ ~IEEE80211_SM_PS_DYNAMIC;
+ break;
+ default:
+ printk(KERN_DEBUG "%s: invalid power save mode\n",
+ dev->name);
+ WARN_ON(1);
+ }
+
+ if (ifsta->flags & IEEE80211_STA_ASSOCIATED)
+ ieee80211_tx_skb(sdata, skb, 0);
+}
+
+void ieee80211_sm_ps_update(struct ieee80211_hw *hw, u8 new_mode)
+{
+ struct ieee80211_sub_if_data *sdata;
+ struct ieee80211_local *local = hw_to_local(hw);
+
+ rcu_read_lock();
+ list_for_each_entry_rcu(sdata, &local->interfaces, list) {
+ ieee80211_send_sm_ps(sdata, new_mode);
+ }
+ rcu_read_unlock();
+}
+EXPORT_SYMBOL(ieee80211_sm_ps_update);
+
--
1.5.4.3
---------------------------------------------------------------------
Intel Israel (74) Limited
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
On Sun, Sep 28, 2008 at 07:14:53PM +0300, Tomas Winkler wrote:
> @@ -963,6 +969,7 @@ enum ieee80211_category {
> WLAN_CATEGORY_SPECTRUM_MGMT = 0,
> WLAN_CATEGORY_QOS = 1,
> WLAN_CATEGORY_DLS = 2,
> + WLAN_CATEGORY_HT = 7,
> WLAN_CATEGORY_BACK = 3,
> WLAN_CATEGORY_WMM = 17,
> };
That would look nicer (to me) if it were in numerical order. :-)
John
--
John W. Linville Linux should be at the core
[email protected] of your literate lifestyle.
On Sun, 2008-09-28 at 19:39 +0300, Tomas Winkler wrote:
> Second example, only low level driver is running calibrations and
> knows if it has all rx chains available. The possibility is
> that not all platforms connect all antennas or physical environment
> between AP and STA cause some of the antennas not affective
> we may propagate rx chain status to mac80211 but if this is not
> opening too much guts. Sometimes it's just hard to keep a clean cut.
That's what I wasn't really aware of. Generally I'd advocate giving
mac80211 lower-level details though and let it figure out the rest, that
makes it easier for the driver save copy/pasting code.
> I have two more patches for these to example of course...
>
> >I don't actually know what that is anyway though, hence the question.
>
> Actually this is one of more understandable part of the spec.
TBH, I've never actually tried to read it, I pick something once a while
but haven't ever really tried to get a complete overview.
> We
> > keep adding API in mac80211 and nobody really knows when to call it.
> > Maybe you should (maybe team up with Atheros for it) write a "HT
> > hardware with mac80211" chapter in the documentation?
>
> Yes we should.
:)
johannes
On Mon, Sep 29, 2008 at 11:14 AM, Luis R. Rodriguez <[email protected]> wrote:
> On Sun, Sep 28, 2008 at 9:14 AM, Tomas Winkler <[email protected]> wrote:
>> From: Emmanuel Grumbach <[email protected]>
>>
>> This patch makes mac80211 able to send action frames when toggling
>> (SM PS) Spacial Multiplexing Power Save mode.
>
> I have no clue what this is as I haven't yet peeked at this section of
> the draft. If we can provide a brief explanation as to what this is
> would be useful to other developers without access to the 11n draft.
> Even it its just enhancing the comment in the code.
On the way
>> Example:
>> 1.
>> Low lever driver may close some of RX chains in power save mode
>> and needs to announce to AP that a RTS frame is need in order to wake all
>> RX chains, on other hand SM PS can be disabled on CAM mode
>
> What's CAM mode?
Continuously Aware Mode (No power save)
>> or if HW is able
>> to wake all chains without RTS frame.
>
> Should we add a HW capability bit for mac80211 drivers to indicate this?
The patch is in internal review and testing, will be published soon.
>
>> 2.
>> iwlwifi can call this function when it detects that only
>> one antenna can effectively receive
>
> When would this happen? Would this happen when any 11n mac80211
> capable driver is going to PS mode and it doesn't have the capability
> of detecting when it needs to to turn on its antennas?
>
>> then MS PS
>
> Did you mean SM PS mode?
Typo, will resend the fix.
>> mode is set to STATIC
>
> Can we elaborate a bit on what this vs Dynamic is in the comments if possible?
We cannot copy the whole spec into code :) On the way.
>
>> +static void ieee80211_send_sm_ps(struct ieee80211_sub_if_data *sdata, u8 mode)
>> +{
>> + struct ieee80211_local *local = sdata->local;
>> + struct ieee80211_mgmt *mgmt;
>> + struct sk_buff *skb;
>> + DECLARE_MAC_BUF(mac);
>> +
>> + struct ieee80211_if_sta *ifsta = &sdata->u.sta;
>> + struct net_device *dev = sdata->dev;
>> +
>> + /* Implemented for STA only */
>> + if (sdata->vif.type != NL80211_IFTYPE_STATION)
>> + return;
>
> <-- snip -->
>
>> + if (ifsta->flags & IEEE80211_STA_ASSOCIATED)
>> + ieee80211_tx_skb(sdata, skb, 0);
>
> You can move this ending branch above to return early so we don't go
> through the entire routine for no good reason. So something like:
>
> if (sdata->vif.type != NL80211_IFTYPE_STATION ||
> ifsta->flags & IEEE80211_STA_ASSOCIATED)
> return;
>
> Luis
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
On Sun, Sep 28, 2008 at 7:19 PM, Johannes Berg
<[email protected]> wrote:
> On Sun, 2008-09-28 at 19:14 +0300, Tomas Winkler wrote:
>> From: Emmanuel Grumbach <[email protected]>
>>
>> This patch makes mac80211 able to send action frames when toggling
>> (SM PS) Spacial Multiplexing Power Save mode.
>>
>> Example:
>> 1.
>> Low lever driver may close some of RX chains in power save mode
>> and needs to announce to AP that a RTS frame is need in order to wake all
>> RX chains, on other hand SM PS can be disabled on CAM mode or if HW is able
>> to wake all chains without RTS frame.
>>
>> 2.
>> iwlwifi can call this function when it detects that only
>> one antenna can effectively receive then MS PS mode is set to STATIC and
>> AP is asked not to send MIMO rates packets.
>
> Why is the driver managing the PS mode to start with?
What PS mode, SM PS mode or traditional PS mode? Please be more
verbose so I don't have to guess what you mean.
Thanks
Tomas
On Sun, 2008-09-28 at 19:24 +0300, Tomas Winkler wrote:
> >> This patch makes mac80211 able to send action frames when toggling
> >> (SM PS) Spacial Multiplexing Power Save mode.
> > Why is the driver managing the PS mode to start with?
>
> What PS mode, SM PS mode or traditional PS mode? Please be more
> verbose so I don't have to guess what you mean.
This was mostly concerned about SM PS mode so that's what I'm asking. I
don't actually know what that is anyway though, hence the question. We
keep adding API in mac80211 and nobody really knows when to call it.
Maybe you should (maybe team up with Atheros for it) write a "HT
hardware with mac80211" chapter in the documentation?
johannes
On Sun, Sep 28, 2008 at 7:26 PM, Johannes Berg
<[email protected]> wrote:
> On Sun, 2008-09-28 at 19:24 +0300, Tomas Winkler wrote:
>
>> >> This patch makes mac80211 able to send action frames when toggling
>> >> (SM PS) Spacial Multiplexing Power Save mode.
>
>> > Why is the driver managing the PS mode to start with?
>>
>> What PS mode, SM PS mode or traditional PS mode? Please be more
>> verbose so I don't have to guess what you mean.
>
> This was mostly concerned about SM PS mode so that's what I'm asking.
Hmm, I hoped that two examples I gave explains that. Now I see I
missed one sentence
in the first example, the movement between PS mode and CAM mode can be
actually controlled
by mac80211 it just need to convey to AP MS PS mode supported by HW.
Bottom line this is dependent on
HW capabilities.
Second example, only low level driver is running calibrations and
knows if it has all rx chains available. The possibility is
that not all platforms connect all antennas or physical environment
between AP and STA cause some of the antennas not affective
we may propagate rx chain status to mac80211 but if this is not
opening too much guts. Sometimes it's just hard to keep a clean cut.
I have two more patches for these to example of course...
>I don't actually know what that is anyway though, hence the question.
Actually this is one of more understandable part of the spec.
We
> keep adding API in mac80211 and nobody really knows when to call it.
> Maybe you should (maybe team up with Atheros for it) write a "HT
> hardware with mac80211" chapter in the documentation?
Yes we should.
Tomas
On Sun, 2008-09-28 at 19:14 +0300, Tomas Winkler wrote:
> From: Emmanuel Grumbach <[email protected]>
>
> This patch makes mac80211 able to send action frames when toggling
> (SM PS) Spacial Multiplexing Power Save mode.
>
> Example:
> 1.
> Low lever driver may close some of RX chains in power save mode
> and needs to announce to AP that a RTS frame is need in order to wake all
> RX chains, on other hand SM PS can be disabled on CAM mode or if HW is able
> to wake all chains without RTS frame.
>
> 2.
> iwlwifi can call this function when it detects that only
> one antenna can effectively receive then MS PS mode is set to STATIC and
> AP is asked not to send MIMO rates packets.
Why is the driver managing the PS mode to start with?
johannes
On Sun, Sep 28, 2008 at 9:14 AM, Tomas Winkler <[email protected]> wrote:
> From: Emmanuel Grumbach <[email protected]>
>
> This patch makes mac80211 able to send action frames when toggling
> (SM PS) Spacial Multiplexing Power Save mode.
I have no clue what this is as I haven't yet peeked at this section of
the draft. If we can provide a brief explanation as to what this is
would be useful to other developers without access to the 11n draft.
Even it its just enhancing the comment in the code.
> Example:
> 1.
> Low lever driver may close some of RX chains in power save mode
> and needs to announce to AP that a RTS frame is need in order to wake all
> RX chains, on other hand SM PS can be disabled on CAM mode
What's CAM mode?
> or if HW is able
> to wake all chains without RTS frame.
Should we add a HW capability bit for mac80211 drivers to indicate this?
> 2.
> iwlwifi can call this function when it detects that only
> one antenna can effectively receive
When would this happen? Would this happen when any 11n mac80211
capable driver is going to PS mode and it doesn't have the capability
of detecting when it needs to to turn on its antennas?
> then MS PS
Did you mean SM PS mode?
> mode is set to STATIC
Can we elaborate a bit on what this vs Dynamic is in the comments if possible?
> +static void ieee80211_send_sm_ps(struct ieee80211_sub_if_data *sdata, u8 mode)
> +{
> + struct ieee80211_local *local = sdata->local;
> + struct ieee80211_mgmt *mgmt;
> + struct sk_buff *skb;
> + DECLARE_MAC_BUF(mac);
> +
> + struct ieee80211_if_sta *ifsta = &sdata->u.sta;
> + struct net_device *dev = sdata->dev;
> +
> + /* Implemented for STA only */
> + if (sdata->vif.type != NL80211_IFTYPE_STATION)
> + return;
<-- snip -->
> + if (ifsta->flags & IEEE80211_STA_ASSOCIATED)
> + ieee80211_tx_skb(sdata, skb, 0);
You can move this ending branch above to return early so we don't go
through the entire routine for no good reason. So something like:
if (sdata->vif.type != NL80211_IFTYPE_STATION ||
ifsta->flags & IEEE80211_STA_ASSOCIATED)
return;
Luis
On Wed, 2008-10-01 at 04:14 -0700, Luis R. Rodriguez wrote:
> On Wed, Oct 01, 2008 at 03:40:08AM -0700, Tomas Winkler wrote:
> >
> > Fresh from Intel
> > http://www.cambridge.org/catalogue/catalogue.asp?isbn=9780521885843
>
> Very cool. Its $70 though. I am hoping we can help move this forward:
>
> http://wireless.kernel.org/en/developers/Documentation/ieee80211/802.11n
I really don't think we should try to explain all this stuff to people,
we're stretched thin in terms of being able to work on things already...
johannes
On Wed, Oct 01, 2008 at 03:40:08AM -0700, Tomas Winkler wrote:
>
> Fresh from Intel
> http://www.cambridge.org/catalogue/catalogue.asp?isbn=9780521885843
Very cool. Its $70 though. I am hoping we can help move this forward:
http://wireless.kernel.org/en/developers/Documentation/ieee80211/802.11n
Luis
On Sun, Sep 28, 2008 at 8:21 PM, Johannes Berg
<[email protected]> wrote:
> On Sun, 2008-09-28 at 19:39 +0300, Tomas Winkler wrote:
>
>> Second example, only low level driver is running calibrations and
>> knows if it has all rx chains available. The possibility is
>> that not all platforms connect all antennas or physical environment
>> between AP and STA cause some of the antennas not affective
>> we may propagate rx chain status to mac80211 but if this is not
>> opening too much guts. Sometimes it's just hard to keep a clean cut.
>
> That's what I wasn't really aware of. Generally I'd advocate giving
> mac80211 lower-level details though and let it figure out the rest, that
> makes it easier for the driver save copy/pasting code.
>
>> I have two more patches for these to example of course...
>>
>> >I don't actually know what that is anyway though, hence the question.
>>
>> Actually this is one of more understandable part of the spec.
>
> TBH, I've never actually tried to read it, I pick something once a while
> but haven't ever really tried to get a complete overview.
>
>> We
>> > keep adding API in mac80211 and nobody really knows when to call it.
>> > Maybe you should (maybe team up with Atheros for it) write a "HT
>> > hardware with mac80211" chapter in the documentation?
>>
>> Yes we should.
Fresh from Intel
http://www.cambridge.org/catalogue/catalogue.asp?isbn=9780521885843
Enjoy.
Tomas
On Wed, Oct 1, 2008 at 11:21 AM, Johannes Berg
<[email protected]> wrote:
> On Wed, 2008-10-01 at 04:14 -0700, Luis R. Rodriguez wrote:
>> On Wed, Oct 01, 2008 at 03:40:08AM -0700, Tomas Winkler wrote:
>> >
>> > Fresh from Intel
>> > http://www.cambridge.org/catalogue/catalogue.asp?isbn=9780521885843
>>
>> Very cool. Its $70 though. I am hoping we can help move this forward:
>>
>> http://wireless.kernel.org/en/developers/Documentation/ieee80211/802.11n
>
> I really don't think we should try to explain all this stuff to people,
> we're stretched thin in terms of being able to work on things already...
I'm aiming at just the basics. Without that all this is voodoo.
Luis
On Wed, 2008-10-01 at 13:40 +0300, Tomas Winkler wrote:
> >> We
> >> > keep adding API in mac80211 and nobody really knows when to call it.
> >> > Maybe you should (maybe team up with Atheros for it) write a "HT
> >> > hardware with mac80211" chapter in the documentation?
> >>
> >> Yes we should.
>
> Fresh from Intel
> http://www.cambridge.org/catalogue/catalogue.asp?isbn=9780521885843
That documents how mac80211 does things? :)
johannes