On Tue, Oct 23, 2012 at 11:18:58AM -0700, [email protected] wrote:
> From: Marco Porsch <[email protected]>
> 
> The awake window value is announced in an IE in beacons if the local STA
> is in light or deep sleep mode towards any peer or non-peer.
> 
> Signed-off-by: Marco Porsch <[email protected]>
> ---
>  net/mac80211/ieee80211_i.h |    1 +
>  net/mac80211/mesh.c        |   23 +++++++++++++++++++++++
>  net/mac80211/mesh.h        |    2 ++
>  net/mac80211/tx.c          |    4 +++-
>  net/mac80211/util.c        |    4 ++++
>  5 files changed, 33 insertions(+), 1 deletion(-)
> 
> diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
> index 4b6fb78..548a144 100644
> --- a/net/mac80211/ieee80211_i.h
> +++ b/net/mac80211/ieee80211_i.h
> @@ -1145,6 +1145,7 @@ struct ieee802_11_elems {
>       struct ieee80211_meshconf_ie *mesh_config;
>       u8 *mesh_id;
>       u8 *peering;
> +     u8 *awake_window;
>       u8 *preq;
>       u8 *prep;
>       u8 *perr;
> diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
> index fbe0e21..71a6387 100644
> --- a/net/mac80211/mesh.c
> +++ b/net/mac80211/mesh.c
> @@ -301,6 +301,29 @@ mesh_add_meshid_ie(struct sk_buff *skb, struct 
> ieee80211_sub_if_data *sdata)
>  }
>  
>  int
> +mesh_add_awake_window_ie(struct sk_buff *skb, struct ieee80211_sub_if_data 
> *sdata)

I know this is the existing style, but a more "mac80211" format would be
(sdata, skb), but then you should proabbly change all of them so it's
better to just leave it alone.

> +{
> +     struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
> +     u8 *pos;
> +
> +     /* see IEEE802.11-2012 13.14.6 */
> +     if (ifmsh->ps_peers_light_sleep == 0 &&
> +         ifmsh->ps_peers_deep_sleep == 0 &&
> +         ifmsh->nonpeer_ps_mode == NL80211_MESH_POWER_ACTIVE)
> +             return 0;
> +
> +     if (skb_tailroom(skb) < 4)
> +             return -ENOMEM;
> +
> +     pos = skb_put(skb, 2 + 2);
> +     *pos++ = WLAN_EID_MESH_AWAKE_WINDOW;
> +     *pos++ = 2;
> +     put_unaligned_le16(ifmsh->mshcfg.dot11MeshAwakeWindowDuration, pos);
> +
> +     return 0;
> +}
> +
> +int
>  mesh_add_vendor_ies(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
>  {
>       struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
> diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
> index cb70522..4a4188f 100644
> --- a/net/mac80211/mesh.h
> +++ b/net/mac80211/mesh.h
> @@ -239,6 +239,8 @@ int mesh_add_meshid_ie(struct sk_buff *skb,
>                      struct ieee80211_sub_if_data *sdata);
>  int mesh_add_rsn_ie(struct sk_buff *skb,
>                   struct ieee80211_sub_if_data *sdata);
> +int mesh_add_awake_window_ie(struct sk_buff *skb,
> +                          struct ieee80211_sub_if_data *sdata);
>  int mesh_add_vendor_ies(struct sk_buff *skb,
>                       struct ieee80211_sub_if_data *sdata);
>  int mesh_add_ds_params_ie(struct sk_buff *skb,
> diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
> index 0aacb26..1a63dbb 100644
> --- a/net/mac80211/tx.c
> +++ b/net/mac80211/tx.c
> @@ -2403,7 +2403,8 @@ struct sk_buff *ieee80211_beacon_get_tim(struct 
> ieee80211_hw *hw,
>                                   2 + sizeof(struct ieee80211_ht_operation) +
>                                   2 + sdata->u.mesh.mesh_id_len +
>                                   2 + sizeof(struct ieee80211_meshconf_ie) +
> -                                 sdata->u.mesh.ie_len);
> +                                 sdata->u.mesh.ie_len +
> +                                 2 + sizeof(__le16)); /* awake window */
>               if (!skb)
>                       goto out;
>  
> @@ -2435,6 +2436,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct 
> ieee80211_hw *hw,
>                   mesh_add_ht_oper_ie(skb, sdata) ||
>                   mesh_add_meshid_ie(skb, sdata) ||
>                   mesh_add_meshconf_ie(skb, sdata) ||
> +                 mesh_add_awake_window_ie(skb, sdata) ||
>                   mesh_add_vendor_ies(skb, sdata)) {
>                       pr_err("o11s: couldn't add ies!\n");
>                       goto out;
> diff --git a/net/mac80211/util.c b/net/mac80211/util.c
> index 22ca350..24fd60c 100644
> --- a/net/mac80211/util.c
> +++ b/net/mac80211/util.c
> @@ -755,6 +755,10 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
>                       elems->peering = pos;
>                       elems->peering_len = elen;
>                       break;
> +             case WLAN_EID_MESH_AWAKE_WINDOW:
> +                     if (elen >= 2)
> +                             elems->awake_window = pos;
> +                     break;
>               case WLAN_EID_PREQ:
>                       elems->preq = pos;
>                       elems->preq_len = elen;
> -- 
> 1.7.9.5
> 
_______________________________________________
Devel mailing list
[email protected]
http://lists.open80211s.org/cgi-bin/mailman/listinfo/devel

Reply via email to