2012-12-05 22:06:25

by Marco Porsch

[permalink] [raw]
Subject: [PATCH] {nl,cfg,mac}80211: set beacon interval and DTIM period on mesh join

Move the default mesh beacon interval and DTIM period to cfg80211 and
make it accessible to nl80211. This enables setting both values when joining
an MBSS.

NOTE: In a mesh with links in PS mode it is not advised to use the default
parameters 1000:4, as these cause excessive buffering delays that exceed
various timeouts (e.g. HWMP path request).

Signed-off-by: Marco Porsch <[email protected]>
---
include/net/cfg80211.h | 4 ++++
net/mac80211/cfg.c | 3 +++
net/mac80211/mesh.c | 1 -
net/mac80211/mesh.h | 2 --
net/wireless/mesh.c | 5 +++++
net/wireless/nl80211.c | 14 ++++++++++++++
6 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index e78db2c..a31e893 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1009,6 +1009,8 @@ struct mesh_config {
* @ie_len: length of vendor information elements
* @is_authenticated: this mesh requires authentication
* @is_secure: this mesh uses security
+ * @dtim_period: DTIM period to use
+ * @beacon_interval: beacon interval to use
* @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
*
* These parameters are fixed when the mesh is created.
@@ -1024,6 +1026,8 @@ struct mesh_setup {
u8 ie_len;
bool is_authenticated;
bool is_secure;
+ u8 dtim_period;
+ u16 beacon_interval;
int mcast_rate[IEEE80211_NUM_BANDS];
};

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 4965aa6..7227477 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1604,6 +1604,9 @@ static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh,
memcpy(sdata->vif.bss_conf.mcast_rate, setup->mcast_rate,
sizeof(setup->mcast_rate));

+ sdata->vif.bss_conf.beacon_int = setup->beacon_interval;
+ sdata->vif.bss_conf.dtim_period = setup->dtim_period;
+
return 0;
}

diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 1bf03f9..a4b332c 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -624,7 +624,6 @@ void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
ieee80211_queue_work(&local->hw, &sdata->work);
sdata->vif.bss_conf.ht_operation_mode =
ifmsh->mshcfg.ht_opmode;
- sdata->vif.bss_conf.beacon_int = MESH_DEFAULT_BEACON_INTERVAL;
sdata->vif.bss_conf.basic_rates =
ieee80211_mandatory_rates(sdata->local,
ieee80211_get_sdata_band(sdata));
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 7c9215f..7f3a78f 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -191,8 +191,6 @@ struct mesh_rmc {
#define IEEE80211_MESH_PEER_INACTIVITY_LIMIT (1800 * HZ)
#define IEEE80211_MESH_HOUSEKEEPING_INTERVAL (60 * HZ)

-#define MESH_DEFAULT_BEACON_INTERVAL 1000 /* in 1024 us units */
-
#define MESH_PATH_EXPIRE (600 * HZ)

/* Default maximum number of plinks per interface */
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
index 3ee5a72..38f3073 100644
--- a/net/wireless/mesh.c
+++ b/net/wireless/mesh.c
@@ -44,6 +44,9 @@

#define MESH_SYNC_NEIGHBOR_OFFSET_MAX 50

+#define MESH_DEFAULT_BEACON_INTERVAL 1000 /* in 1024 us units (=TUs) */
+#define MESH_DEFAULT_DTIM_PERIOD 4
+
const struct mesh_config default_mesh_config = {
.dot11MeshRetryTimeout = MESH_RET_T,
.dot11MeshConfirmTimeout = MESH_CONF_T,
@@ -79,6 +82,8 @@ const struct mesh_setup default_mesh_setup = {
.ie = NULL,
.ie_len = 0,
.is_secure = false,
+ .beacon_interval = MESH_DEFAULT_BEACON_INTERVAL,
+ .dtim_period = MESH_DEFAULT_DTIM_PERIOD,
};

int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d038fa4..00068a4 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6643,6 +6643,20 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE])))
return -EINVAL;

+ if (info->attrs[NL80211_ATTR_BEACON_INTERVAL]) {
+ setup.beacon_interval =
+ nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
+ if (setup.beacon_interval < 10 || setup.beacon_interval > 10000)
+ return -EINVAL;
+ }
+
+ if (info->attrs[NL80211_ATTR_DTIM_PERIOD]) {
+ setup.dtim_period =
+ nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]);
+ if (setup.dtim_period < 1 || setup.dtim_period > 100)
+ return -EINVAL;
+ }
+
if (info->attrs[NL80211_ATTR_MESH_SETUP]) {
/* parse additional setup parameters if given */
err = nl80211_parse_mesh_setup(info, &setup);
--
1.7.9.5



2012-12-05 22:58:03

by Thomas Pedersen

[permalink] [raw]
Subject: Re: [PATCH] {nl, cfg, mac}80211: set beacon interval and DTIM period on mesh join

On Wed, Dec 5, 2012 at 2:06 PM, Marco Porsch
<[email protected]> wrote:
> Move the default mesh beacon interval and DTIM period to cfg80211 and
> make it accessible to nl80211. This enables setting both values when joining
> an MBSS.
>
> NOTE: In a mesh with links in PS mode it is not advised to use the default
> parameters 1000:4, as these cause excessive buffering delays that exceed
> various timeouts (e.g. HWMP path request).

Then make the default parameters reasonable? How is 1000:2?

> Signed-off-by: Marco Porsch <[email protected]>
> ---
> include/net/cfg80211.h | 4 ++++
> net/mac80211/cfg.c | 3 +++
> net/mac80211/mesh.c | 1 -
> net/mac80211/mesh.h | 2 --
> net/wireless/mesh.c | 5 +++++
> net/wireless/nl80211.c | 14 ++++++++++++++
> 6 files changed, 26 insertions(+), 3 deletions(-)
>
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index e78db2c..a31e893 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -1009,6 +1009,8 @@ struct mesh_config {
> * @ie_len: length of vendor information elements
> * @is_authenticated: this mesh requires authentication
> * @is_secure: this mesh uses security
> + * @dtim_period: DTIM period to use
> + * @beacon_interval: beacon interval to use
> * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
> *
> * These parameters are fixed when the mesh is created.
> @@ -1024,6 +1026,8 @@ struct mesh_setup {
> u8 ie_len;
> bool is_authenticated;
> bool is_secure;
> + u8 dtim_period;
> + u16 beacon_interval;
> int mcast_rate[IEEE80211_NUM_BANDS];
> };
>
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index 4965aa6..7227477 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -1604,6 +1604,9 @@ static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh,
> memcpy(sdata->vif.bss_conf.mcast_rate, setup->mcast_rate,
> sizeof(setup->mcast_rate));
>
> + sdata->vif.bss_conf.beacon_int = setup->beacon_interval;
> + sdata->vif.bss_conf.dtim_period = setup->dtim_period;
> +
> return 0;
> }
>
> diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
> index 1bf03f9..a4b332c 100644
> --- a/net/mac80211/mesh.c
> +++ b/net/mac80211/mesh.c
> @@ -624,7 +624,6 @@ void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
> ieee80211_queue_work(&local->hw, &sdata->work);
> sdata->vif.bss_conf.ht_operation_mode =
> ifmsh->mshcfg.ht_opmode;
> - sdata->vif.bss_conf.beacon_int = MESH_DEFAULT_BEACON_INTERVAL;
> sdata->vif.bss_conf.basic_rates =
> ieee80211_mandatory_rates(sdata->local,
> ieee80211_get_sdata_band(sdata));
> diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
> index 7c9215f..7f3a78f 100644
> --- a/net/mac80211/mesh.h
> +++ b/net/mac80211/mesh.h
> @@ -191,8 +191,6 @@ struct mesh_rmc {
> #define IEEE80211_MESH_PEER_INACTIVITY_LIMIT (1800 * HZ)
> #define IEEE80211_MESH_HOUSEKEEPING_INTERVAL (60 * HZ)
>
> -#define MESH_DEFAULT_BEACON_INTERVAL 1000 /* in 1024 us units */
> -
> #define MESH_PATH_EXPIRE (600 * HZ)
>
> /* Default maximum number of plinks per interface */
> diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
> index 3ee5a72..38f3073 100644
> --- a/net/wireless/mesh.c
> +++ b/net/wireless/mesh.c
> @@ -44,6 +44,9 @@
>
> #define MESH_SYNC_NEIGHBOR_OFFSET_MAX 50
>
> +#define MESH_DEFAULT_BEACON_INTERVAL 1000 /* in 1024 us units (=TUs) */
> +#define MESH_DEFAULT_DTIM_PERIOD 4
> +
> const struct mesh_config default_mesh_config = {
> .dot11MeshRetryTimeout = MESH_RET_T,
> .dot11MeshConfirmTimeout = MESH_CONF_T,
> @@ -79,6 +82,8 @@ const struct mesh_setup default_mesh_setup = {
> .ie = NULL,
> .ie_len = 0,
> .is_secure = false,
> + .beacon_interval = MESH_DEFAULT_BEACON_INTERVAL,
> + .dtim_period = MESH_DEFAULT_DTIM_PERIOD,
> };
>
> int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index d038fa4..00068a4 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -6643,6 +6643,20 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
> nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE])))
> return -EINVAL;
>
> + if (info->attrs[NL80211_ATTR_BEACON_INTERVAL]) {
> + setup.beacon_interval =
> + nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
> + if (setup.beacon_interval < 10 || setup.beacon_interval > 10000)
> + return -EINVAL;
> + }
> +
> + if (info->attrs[NL80211_ATTR_DTIM_PERIOD]) {
> + setup.dtim_period =
> + nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]);
> + if (setup.dtim_period < 1 || setup.dtim_period > 100)
> + return -EINVAL;
> + }
> +
> if (info->attrs[NL80211_ATTR_MESH_SETUP]) {
> /* parse additional setup parameters if given */
> err = nl80211_parse_mesh_setup(info, &setup);
> --
> 1.7.9.5
>
> _______________________________________________
> Devel mailing list
> [email protected]
> http://lists.open80211s.org/cgi-bin/mailman/listinfo/devel

2012-12-07 20:12:29

by Marco Porsch

[permalink] [raw]
Subject: [RFC] iw: add beacon interval and DTIM period parameters to mesh join

Set the beacon interval and DTIM period with the mesh join command:
iw <dev> mesh join <meshid> beacon-interval <time in TUs> dtim-period <value>

Signed-off-by: Marco Porsch <[email protected]>
---
mesh.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/mesh.c b/mesh.c
index 4fdad6a..958c2c0 100644
--- a/mesh.c
+++ b/mesh.c
@@ -383,6 +383,7 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
{
struct nlattr *container;
float rate;
+ int bintval, dtim_period;
char *end;

if (argc < 1)
@@ -405,6 +406,32 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
argc--;
}

+ if (argc > 1 && strcmp(argv[0], "beacon-interval") == 0) {
+ argc--;
+ argv++;
+
+ bintval = strtoul(argv[0], &end, 10);
+ if (*end != '\0')
+ return 1;
+
+ NLA_PUT_U32(msg, NL80211_ATTR_BEACON_INTERVAL, bintval);
+ argv++;
+ argc--;
+ }
+
+ if (argc > 1 && strcmp(argv[0], "dtim-period") == 0) {
+ argc--;
+ argv++;
+
+ dtim_period = strtoul(argv[0], &end, 10);
+ if (*end != '\0')
+ return 1;
+
+ NLA_PUT_U32(msg, NL80211_ATTR_DTIM_PERIOD, dtim_period);
+ argv++;
+ argc--;
+ }
+
container = nla_nest_start(msg, NL80211_ATTR_MESH_SETUP);
if (!container)
return -ENOBUFS;
@@ -431,8 +458,9 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
nla_put_failure:
return -ENOBUFS;
}
-COMMAND(mesh, join, "<mesh ID> [mcast-rate <rate in Mbps>] [vendor_sync on|off]"
- " [<param>=<value>]*",
+COMMAND(mesh, join, "<mesh ID> [mcast-rate <rate in Mbps>]"
+ " [beacon-interval <time in TUs>] [dtim-period <value>]"
+ " [vendor_sync on|off] [<param>=<value>]*",
NL80211_CMD_JOIN_MESH, 0, CIB_NETDEV, join_mesh,
"Join a mesh with the given mesh ID with mcast-rate and mesh parameters.");

--
1.7.9.5


2012-12-06 10:49:50

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] {nl, cfg, mac}80211: set beacon interval and DTIM period on mesh join

On Wed, 2012-12-05 at 14:57 -0800, Thomas Pedersen wrote:
> On Wed, Dec 5, 2012 at 2:06 PM, Marco Porsch
> <[email protected]> wrote:
> > Move the default mesh beacon interval and DTIM period to cfg80211 and
> > make it accessible to nl80211. This enables setting both values when joining
> > an MBSS.
> >
> > NOTE: In a mesh with links in PS mode it is not advised to use the default
> > parameters 1000:4, as these cause excessive buffering delays that exceed
> > various timeouts (e.g. HWMP path request).
>
> Then make the default parameters reasonable? How is 1000:2?

That's still ~2 seconds, no?

johannes


2012-12-07 20:26:07

by Thomas Pedersen

[permalink] [raw]
Subject: Re: [PATCH] {nl, cfg, mac}80211: set beacon interval and DTIM period on mesh join

On Thu, Dec 6, 2012 at 2:50 AM, Johannes Berg <[email protected]> wrote:
> On Wed, 2012-12-05 at 14:57 -0800, Thomas Pedersen wrote:
>> On Wed, Dec 5, 2012 at 2:06 PM, Marco Porsch
>> <[email protected]> wrote:
>> > Move the default mesh beacon interval and DTIM period to cfg80211 and
>> > make it accessible to nl80211. This enables setting both values when joining
>> > an MBSS.
>> >
>> > NOTE: In a mesh with links in PS mode it is not advised to use the default
>> > parameters 1000:4, as these cause excessive buffering delays that exceed
>> > various timeouts (e.g. HWMP path request).
>>
>> Then make the default parameters reasonable? How is 1000:2?
>
> That's still ~2 seconds, no?

Yeah I guess those would both be unsuitable for PS anyway, so it's fine as is.

Thomas

2012-12-07 20:46:26

by Marco Porsch

[permalink] [raw]
Subject: Re: [PATCH] {nl, cfg, mac}80211: set beacon interval and DTIM period on mesh join

On 12/07/2012 12:25 PM, Thomas Pedersen wrote:
> On Thu, Dec 6, 2012 at 2:50 AM, Johannes Berg <[email protected]> wrote:
>> On Wed, 2012-12-05 at 14:57 -0800, Thomas Pedersen wrote:
>>> On Wed, Dec 5, 2012 at 2:06 PM, Marco Porsch
>>> <[email protected]> wrote:
>>>> Move the default mesh beacon interval and DTIM period to cfg80211 and
>>>> make it accessible to nl80211. This enables setting both values when joining
>>>> an MBSS.
>>>>
>>>> NOTE: In a mesh with links in PS mode it is not advised to use the default
>>>> parameters 1000:4, as these cause excessive buffering delays that exceed
>>>> various timeouts (e.g. HWMP path request).
>>>
>>> Then make the default parameters reasonable? How is 1000:2?
>>
>> That's still ~2 seconds, no?
>
> Yeah I guess those would both be unsuitable for PS anyway, so it's fine as is.

Snap, I just see carl9170 has a check for beacon interval and DTIM
period [1].

I'll change the DTIM period default value.
To my best knowledge, it does not do any difference out of powersave
mode, and for powersave DTIM period 1 is favourable. Any objections?

--Marco


[1]
/*
* Therefore a hard limit for the broadcast traffic should
* prevent false alarms.
*/
if (vif->type != NL80211_IFTYPE_STATION &&
(bss_conf->beacon_int * bss_conf->dtim_period >=
(CARL9170_QUEUE_STUCK_TIMEOUT / 2))) {
err = -EINVAL;
goto out;
}

(CARL9170_QUEUE_STUCK_TIMEOUT is 5500.)