On Tue, Oct 23, 2012 at 11:18:57AM -0700, [email protected] wrote:
> From: Marco Porsch <[email protected]>
> 
> This commit adds the dot11MeshAwakeWindowDuration value to the mesh config.
> The awake window is a duration in TU describing how long the STA will stay
> awake after transmitting its beacon in PS mode.
> The value can be changed during mesh operation.
> 
> Signed-off-by: Marco Porsch <[email protected]>
> ---
>  include/linux/nl80211.h       |    3 +++
>  include/net/cfg80211.h        |    3 +++
>  net/mac80211/cfg.c            |    7 +++++++
>  net/mac80211/debugfs_netdev.c |    3 +++
>  net/wireless/mesh.c           |    2 ++
>  net/wireless/nl80211.c        |    8 +++++++-
>  6 files changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
> index 7750017..7fda16a 100644
> --- a/include/linux/nl80211.h
> +++ b/include/linux/nl80211.h
> @@ -2333,6 +2333,8 @@ enum nl80211_mesh_power_mode {
>   *
>   * @NL80211_MESHCONF_POWER_MODE: default link-specific power save mode
>   *
> + * @NL80211_MESHCONF_AWAKE_WINDOW: awake window duration (in TUs)
> + *
>   * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
>   */
>  enum nl80211_meshconf_params {
> @@ -2366,6 +2368,7 @@ enum nl80211_meshconf_params {
>       NL80211_MESHCONF_BEACON_INTERVAL,
>       NL80211_MESHCONF_DTIM_PERIOD,
>       NL80211_MESHCONF_POWER_MODE,
> +     NL80211_MESHCONF_AWAKE_WINDOW,
>  
>       /* keep last */
>       __NL80211_MESHCONF_ATTR_AFTER_LAST,
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index f31e868..1ce104b 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -897,6 +897,8 @@ struct bss_parameters {
>   * @dtim_period: DTIM period to use
>   * @power_mode: The default mesh power save mode which will be the initial
>   *   setting for new peer links.
> + * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain 
> awake
> + *   after transmitting its beacon.
>   */
>  struct mesh_config {
>       u16 dot11MeshRetryTimeout;
> @@ -928,6 +930,7 @@ struct mesh_config {
>       u16 beacon_interval;
>       u8 dtim_period;
>       enum nl80211_mesh_power_mode power_mode;
> +     u16 dot11MeshAwakeWindowDuration;
>  };
>  
>  /**
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index a80ea23..fabd16b 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -1676,6 +1676,13 @@ static int ieee80211_update_mesh_config(struct wiphy 
> *wiphy,
>               conf->power_mode = nconf->power_mode;
>               ieee80211_local_ps_update(sdata);
>       }
> +     if (_chg_mesh_attr(NL80211_MESHCONF_AWAKE_WINDOW, mask)) {
> +             conf->dot11MeshAwakeWindowDuration =
> +                     nconf->dot11MeshAwakeWindowDuration;
> +             ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON);

I guess later this will actually do something? You usually want to add
the user API after the feature is implemented.

> +             set_bit(MESH_WORK_PS_UPDATE, &ifmsh->wrkq_flags);
> +             ieee80211_queue_work(&sdata->local->hw, &sdata->work);
> +     }
>       return 0;
>  }
>  
> diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
> index 3328348..2e9edcd 100644
> --- a/net/mac80211/debugfs_netdev.c
> +++ b/net/mac80211/debugfs_netdev.c
> @@ -522,6 +522,8 @@ IEEE80211_IF_FILE(beacon_interval,
>                 u.mesh.mshcfg.beacon_interval, DEC);
>  IEEE80211_IF_FILE(dtim_period,
>                 u.mesh.mshcfg.dtim_period, DEC);
> +IEEE80211_IF_FILE(dot11MeshAwakeWindowDuration,
> +               u.mesh.mshcfg.dot11MeshAwakeWindowDuration, DEC);
>  #endif
>  
>  #define DEBUGFS_ADD_MODE(name, mode) \
> @@ -629,6 +631,7 @@ static void add_mesh_config(struct ieee80211_sub_if_data 
> *sdata)
>       MESHPARAMS_ADD(peer_inactivity_limit);
>       MESHPARAMS_ADD(beacon_interval);
>       MESHPARAMS_ADD(dtim_period);
> +     MESHPARAMS_ADD(dot11MeshAwakeWindowDuration);
>  #undef MESHPARAMS_ADD
>  }
>  #endif
> diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
> index 5a16513..67c68fd 100644
> --- a/net/wireless/mesh.c
> +++ b/net/wireless/mesh.c
> @@ -46,6 +46,7 @@
>  
>  #define MESH_DEFAULT_BEACON_INTERVAL 1000    /* in 1024 us units (=TUs) */
>  #define MESH_DEFAULT_DTIM_PERIOD     4
> +#define MESH_DEFAULT_AWAKE_WINDOW    10      /* in 1024 us units (=TUs) */
>  
>  const struct mesh_config default_mesh_config = {
>       .dot11MeshRetryTimeout = MESH_RET_T,
> @@ -76,6 +77,7 @@ const struct mesh_config default_mesh_config = {
>       .beacon_interval = MESH_DEFAULT_BEACON_INTERVAL,
>       .dtim_period = MESH_DEFAULT_DTIM_PERIOD,
>       .power_mode = NL80211_MESH_POWER_ACTIVE,
> +     .dot11MeshAwakeWindowDuration = MESH_DEFAULT_AWAKE_WINDOW,
>  };
>  
>  const struct mesh_setup default_mesh_setup = {
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index f26bc5f..1590ede 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -3764,7 +3764,9 @@ static int nl80211_get_mesh_config(struct sk_buff *skb,
>           nla_put_u8(msg, NL80211_MESHCONF_DTIM_PERIOD,
>                      cur_params.dtim_period) ||
>           nla_put_u8(msg, NL80211_MESHCONF_POWER_MODE,
> -                    cur_params.power_mode))
> +                    cur_params.power_mode) ||
> +         nla_put_u16(msg, NL80211_MESHCONF_AWAKE_WINDOW,
> +                     cur_params.dot11MeshAwakeWindowDuration))
>               goto nla_put_failure;
>       nla_nest_end(msg, pinfoattr);
>       genlmsg_end(msg, hdr);
> @@ -3807,6 +3809,7 @@ static const struct nla_policy 
> nl80211_meshconf_params_policy[NL80211_MESHCONF_A
>       [NL80211_MESHCONF_BEACON_INTERVAL] = { .type = NLA_U16 },
>       [NL80211_MESHCONF_DTIM_PERIOD] = { .type = NLA_U8 },
>       [NL80211_MESHCONF_POWER_MODE] = { .type = NLA_U8 },
> +     [NL80211_MESHCONF_AWAKE_WINDOW] = { .type = NLA_U16 },
>  };
>  
>  static const struct nla_policy
> @@ -3938,6 +3941,9 @@ do {\
>       FILL_IN_MESH_PARAM_IF_SET(tb, cfg, power_mode,
>                                 mask, NL80211_MESHCONF_POWER_MODE,
>                                 nla_get_u8);
> +     FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshAwakeWindowDuration,
> +                               mask, NL80211_MESHCONF_AWAKE_WINDOW,
> +                               nla_get_u16);
>       if (mask_out)
>               *mask_out = mask;
>  
> -- 
> 1.7.9.5
> 
_______________________________________________
Devel mailing list
[email protected]
http://lists.open80211s.org/cgi-bin/mailman/listinfo/devel

Reply via email to