mac80211: Support beacon configuration via nl80211 for mesh interfaces
Subsystems (2)
PATCH 1/1 mac80211: Support beacon configuration via nl80211 for mesh interfaces
This patch adds the capability to the mesh stack to receive vendor specific information elements from userspace. When a vendor specific IE is set via nl80211, the mesh stack will configure the mesh beacon to advertise that a vendor specific path selection and metric is in use. This is accordance with the Extensible Path Selection Framework specified in version 7.0 of the 802.11s draft.
--- net/mac80211/cfg.c | 23 +++++++++++++++----- net/mac80211/ieee80211_i.h | 1 + net/mac80211/main.c | 7 ++++++ net/mac80211/mesh.c | 49 ++++++++++++++++++++++++++++++++++++++++++- net/mac80211/mesh.h | 24 +++++++++++++++++++++ net/mac80211/tx.c | 39 +++++++++++++--------------------- net/wireless/nl80211.c | 2 + 7 files changed, 113 insertions(+), 32 deletions(-)
net/mac80211/cfg.c +17 -6
@@ -438,7 +438,9 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,int size;int err = -EINVAL ; - old = sdata->u.ap.beacon; + + old =ieee80211_vif_is_mesh (&sdata->vif) ? + sdata->u.mesh.beacon : sdata->u.ap.beacon;/* head must not be zero-length */ if (params->head && !params->head_len)
@@ -514,7 +516,10 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata, sdata->vif.bss_conf.dtim_period = new->dtim_period; -rcu_assign_pointer (sdata->u.ap.beacon, new); +if (ieee80211_vif_is_mesh (&sdata->vif)) +rcu_assign_pointer (sdata->u.mesh.beacon, new); +else +rcu_assign_pointer (sdata->u.ap.beacon, new);synchronize_rcu ();
@@ -533,7 +538,8 @@ static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, sdata =IEEE80211_DEV_TO_SUB_IF (dev); - old = sdata->u.ap.beacon; + old =ieee80211_vif_is_mesh (&sdata->vif) ? + sdata->u.mesh.beacon : sdata->u.ap.beacon;if (old)return -EALREADY ;
@@ -549,7 +555,8 @@ static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev, sdata =IEEE80211_DEV_TO_SUB_IF (dev); - old = sdata->u.ap.beacon; + old =ieee80211_vif_is_mesh (&sdata->vif) ? + sdata->u.mesh.beacon : sdata->u.ap.beacon;if (!old)return -ENOENT ;
@@ -564,12 +571,16 @@ static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) sdata =IEEE80211_DEV_TO_SUB_IF (dev); - old = sdata->u.ap.beacon; + old =ieee80211_vif_is_mesh (&sdata->vif) ? + sdata->u.mesh.beacon : sdata->u.ap.beacon;if (!old)return -ENOENT ; -rcu_assign_pointer (sdata->u.ap.beacon,NULL ); +if (ieee80211_vif_is_mesh (&sdata->vif)) +rcu_assign_pointer (sdata->u.mesh.beacon,NULL ); +else +rcu_assign_pointer (sdata->u.ap.beacon,NULL );synchronize_rcu ();kfree (old);
net/mac80211/ieee80211_i.h +1 -0
@@ -454,6 +454,7 @@ struct ieee80211_if_mesh {unsigned long wrkq_flags; +struct beacon_data *beacon;u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN ];size_t mesh_id_len;/* Active Path Selection Protocol Identifier */
net/mac80211/main.c +7 -0
@@ -208,6 +208,13 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, sdata->vif.bss_conf.bssid =NULL ; else if (ieee80211_vif_is_mesh(&sdata->vif)) { sdata->vif.bss_conf.bssid = zero; +if (sdata->u.mesh.beacon && sdata->u.mesh.beacon->tail_len) { + sdata->u.mesh.mesh_pp_id =MESH_PATH_PROTOCOL_VENDOR ; + sdata->u.mesh.mesh_pm_id =MESH_PATH_METRIC_VENDOR ; + }else { + sdata->u.mesh.mesh_pp_id =MESH_PATH_PROTOCOL_HWMP ; + sdata->u.mesh.mesh_pm_id =MESH_PATH_METRIC_AIRTIME ; + } } else {WARN_ON (1 );return ;
net/mac80211/mesh.c +47 -2
84 lines not on this page · raw message
net/mac80211/mesh.h +24 -0
@@ -44,6 +44,30 @@ enum mesh_path_flags { };/** +* enum - mesh path selection protocol identifier +* +* @MESH_PATH_PROTOCOL_HWMP: the default path selection protocol +* @MESH_PATH_PROTOCOL_VENDOR: a vendor specific protocol that will be +* specified in a vendor specific information element +*/ +enum { +MESH_PATH_PROTOCOL_HWMP =0 , +MESH_PATH_PROTOCOL_VENDOR =255 , +}; + +/** +* enum - mesh path selection metric identifier +* +* @MESH_PATH_METRIC_AIRTIME: the default path selection metric +* @MESH_PATH_METRIC_VENDOR: a vendor specific metric that will be +* specified in a vendor specific information element +*/ +enum { +MESH_PATH_METRIC_AIRTIME =0 , +MESH_PATH_METRIC_VENDOR =255 , +}; + +/** * enum mesh_deferred_task_flags - mac80211 mesh deferred tasks * *
net/mac80211/tx.c +15 -24
@@ -2266,32 +2266,23 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, hdr->frame_control =cpu_to_le16 (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_BEACON ); }else if (ieee80211_vif_is_mesh (&sdata->vif)) { -struct ieee80211_mgmt *mgmt; -u8 *pos; +struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; -/* headroom, head length, tail length and maximum TIM length */ - skb =dev_alloc_skb (local->tx_headroom +400 ); -if (!skb) - goto out; + beacon =rcu_dereference (ifmsh->beacon); +if (ifmsh && beacon) { +/* headroom, head length, mesh_ies and tail length */ + skb =dev_alloc_skb (local->tx_headroom +400 ); +if (!skb) + goto out; -skb_reserve (skb, local->hw.extra_tx_headroom); - mgmt = (struct ieee80211_mgmt *) -skb_put (skb,24 +sizeof (mgmt->u.beacon)); -memset (mgmt,0 ,24 +sizeof (mgmt->u.beacon)); - mgmt->frame_control = -cpu_to_le16 (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_BEACON ); -memset (mgmt->da,0xff ,ETH_ALEN ); -memcpy (mgmt->sa, sdata->vif.addr,ETH_ALEN ); -memcpy (mgmt->bssid, sdata->vif.addr,ETH_ALEN ); - mgmt->u.beacon.beacon_int = -cpu_to_le16 (sdata->vif.bss_conf.beacon_int); - mgmt->u.beacon.capab_info =0x0 ;/* 0x0 for MPs */ - - pos =skb_put (skb,2 ); - *pos++ =WLAN_EID_SSID ; - *pos++ =0x0 ; - -mesh_mgmt_ies_add (skb, sdata); +skb_reserve (skb, local->hw.extra_tx_headroom); +memcpy (skb_put (skb, beacon->head_len), beacon->head, + beacon->head_len); +mesh_mgmt_ies_add (skb, sdata); +if (beacon->tail && beacon->tail_len) +memcpy (skb_put (skb, beacon->tail_len), + beacon->tail, beacon->tail_len); + } }else {WARN_ON (1 ); goto out;
net/wireless/nl80211.c +2 -0
@@ -1709,6 +1709,7 @@ static int nl80211_addset_beacon(struct sk_buff *skb, struct genl_info *info)return -EINVAL ;if (dev->ieee80211_ptr->iftype !=NL80211_IFTYPE_AP && + dev->ieee80211_ptr->iftype !=NL80211_IFTYPE_MESH_POINT && dev->ieee80211_ptr->iftype !=NL80211_IFTYPE_P2P_GO )return -EOPNOTSUPP ;
@@ -1776,6 +1777,7 @@ static int nl80211_del_beacon(struct sk_buff *skb, struct genl_info *info)return -EOPNOTSUPP ;if (dev->ieee80211_ptr->iftype !=NL80211_IFTYPE_AP && + dev->ieee80211_ptr->iftype !=NL80211_IFTYPE_MESH_POINT && dev->ieee80211_ptr->iftype !=NL80211_IFTYPE_P2P_GO )return -EOPNOTSUPP ;
Signature · 1 line
1.7.1
Johannes Berg
maintainerQuoted 8 lines · Javier Cardona
This patch adds the capability to the mesh stack to receive vendor specific information elements from userspace. When a vendor specific IE is set via nl80211, the mesh stack will configure the mesh beacon to advertise that a vendor specific path selection and metric is in use. This is accordance with the Extensible Path Selection Framework specified in version 7.0 of the 802.11s draft.
net/wireless/nl80211.c static int nl80211_addset_beacon(struct sk_buff *skb, struct genl_info *info) · line 1714
Quoted 6 lines
net/wireless/nl80211.c +1
-0@@ -1709,6 +1709,7 @@ static int nl80211_addset_beacon(struct sk_buff *skb, struct genl_info *info)return -EINVAL ;if (dev->ieee80211_ptr->iftype !=NL80211_IFTYPE_AP && + dev->ieee80211_ptr->iftype !=NL80211_IFTYPE_MESH_POINT && dev->ieee80211_ptr->iftype !=NL80211_IFTYPE_P2P_GO )return -EOPNOTSUPP ;
I'm not convinced that letting userspace set the *entire* beacon is the right way to do it? Wouldn't it make more sense to allow it to specify vendor-specific IEs (like IBSS), and the fact that vendor selection protocol is used? It seems to me that somebody may want to have vendor IEs while using the default protocols?
johannes
Johannes,
Quoted 11 lines · Johannes Berg
Quoted 10 lines · Javier Cardona
This patch adds the capability to the mesh stack to receive vendor specific information elements from userspace. When a vendor specific IE is set via nl80211, the mesh stack will configure the mesh beacon to advertise that a vendor specific path selection and metric is in use. This is accordance with the Extensible Path Selection Framework specified in version 7.0 of the 802.11s draft.
net/wireless/nl80211.c +0
-0@@ -1709,6 +1709,7 @@ static int nl80211_addset_beacon(struct sk_buff *skb, struct genl_info *info) return -EINVAL;
Quoted 10 lines
Quoted 4 lines
if (
dev->ieee80211_ptr->iftype!=NL80211_IFTYPE_AP&&
+dev->ieee80211_ptr->iftype!=NL80211_IFTYPE_MESH_POINT&&dev->ieee80211_ptr->iftype!=NL80211_IFTYPE_P2P_GO) return-EOPNOTSUPP;I'm not convinced that letting userspace set the *entire* beacon is the right way to do it? Wouldn't it make more sense to allow it to specify vendor-specific IEs (like IBSS), and the fact that vendor selection protocol is used? It seems to me that somebody may want to have vendor IEs while using the default protocols?
Yes, agreed. We'll investigate a way to provide a protocol switch (maybe a new NL80211_CMD_SET_MESH_PARAMS) + a vendor specific IE (NL80211_CMD_SET_MGMT_EXTRA_IE would have been ideal, but I see it's gone).
Thanks!
Javier
Signature · 3 lines
Javier Cardona cozybit Inc. http://www.cozybit.com
Johannes Berg
maintainerQuoted 10 lines · Javier Cardona
Quoted 5 lines
I'm not convinced that letting userspace set the *entire* beacon is the right way to do it? Wouldn't it make more sense to allow it to specify vendor-specific IEs (like IBSS), and the fact that vendor selection protocol is used? It seems to me that somebody may want to have vendor IEs while using the default protocols?
Yes, agreed. We'll investigate a way to provide a protocol switch (maybe a new
NL80211_CMD_SET_MESH_PARAMS) + a vendor specific IE (NL80211_CMD_SET_MGMT_EXTRA_IEwould have been ideal, but I see it's gone).
If we had a 'start mesh' command, like 'join IBSS', then it'd be natural to have just more attributes in it. Maybe it's time to start thinking about that again, although backward compatibility could be interesting.
johannes
Johannes Berg
maintainerQuoted 3 lines · Johannes Berg
If we had a 'start mesh' command, like 'join IBSS', then it'd be natural to have just more attributes in it. Maybe it's time to start thinking about that again, although backward compatibility could be interesting.
Ok I started looking at this ...
I have a feeling I asked this before, but can't remember -- is it necessary to be able to change the mesh config on the fly, while the mesh is active?
johannes
Johannes,
Quoted 11 lines · Johannes Berg
Quoted 3 lines · Johannes Berg
If we had a 'start mesh' command, like 'join IBSS', then it'd be natural to have just more attributes in it. Maybe it's time to start thinking about that again, although backward compatibility could be interesting.
Ok I started looking at this ...
I have a feeling I asked this before, but can't remember -- is it necessary to be able to change the mesh config on the fly, while the mesh is active?
It is convenient to be able to change things like the ttl or the auto peering without having to bring down the interface. People might also want to tune from userspace the different mesh timeouts in response to changes in operating conditions (e.g. mesh density).
But right now the only parameter that needs the mesh to be active isplink_action: one can only block or manually initiate peering after a beacon has been received from a suitable neighbor.
Javier
Signature · 3 lines
Javier Cardona cozybit Inc. http://www.cozybit.com
Johannes Berg
maintainerQuoted 4 lines · Javier Cardona
It is convenient to be able to change things like the ttl or the auto peering without having to bring down the interface. People might also want to tune from userspace the different mesh timeouts in response to changes in operating conditions (e.g. mesh density).
Makes sense.
Quoted 3 lines
But right now the only parameter that needs the mesh to be active is
plink_action: one can only block or manually initiate peering after a beacon has been received from a suitable neighbor.
It looks like one can modify the mesh ID on the fly right now -- that I'm going to remove, the other things can stay for all I care :-)
johannes
Johannes Berg
maintainer[PATCH/RFC] mac80211: use configured mesh TTL
In reply to Javier CardonaFrom: Johannes Berg <[email protected]>
It seems the configured mesh TTL should be used,
not the default value.
--- net/mac80211/mesh_pathtbl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/mac80211/mesh_pathtbl.c +4 -3
@@ -467,8 +467,8 @@ void mesh_plink_broken(struct sta_info * mpath->flags &= ~MESH_PATH_ACTIVE ; ++mpath->sn;spin_unlock_bh (&mpath->state_lock); -mesh_path_error_tx (MESH_TTL , mpath->dst, -cpu_to_le32 (mpath->sn), +mesh_path_error_tx (sdata->u.mesh.mshcfg.dot11MeshTTL, + mpath->dst,cpu_to_le32 (mpath->sn),cpu_to_le16 (PERR_RCODE_DEST_UNREACH ), bcast, sdata); }else
@@ -614,7 +614,8 @@ void mesh_path_discard_frame(struct sk_b mpath =mesh_path_lookup (da, sdata);if (mpath) sn = ++mpath->sn; -mesh_path_error_tx (MESH_TTL , skb->data,cpu_to_le32 (sn), +mesh_path_error_tx (sdata->u.mesh.mshcfg.dot11MeshTTL, skb->data, +cpu_to_le32 (sn),cpu_to_le16 (PERR_RCODE_NO_ROUTE ), ra, sdata); }
Johannes Berg
maintainerPATCH v2 1/1 mac80211: use configured mesh TTL
From: Johannes Berg <[email protected]>
It seems the configured mesh TTL should be used,
not the default value.
--- net/mac80211/mesh_hwmp.c | 5 +++-- net/mac80211/mesh_pathtbl.c | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-)
net/mac80211/mesh_pathtbl.c +4 -3
@@ -467,8 +467,8 @@ void mesh_plink_broken(struct sta_info * mpath->flags &= ~MESH_PATH_ACTIVE ; ++mpath->sn;spin_unlock_bh (&mpath->state_lock); -mesh_path_error_tx (MESH_TTL , mpath->dst, -cpu_to_le32 (mpath->sn), +mesh_path_error_tx (sdata->u.mesh.mshcfg.dot11MeshTTL, + mpath->dst,cpu_to_le32 (mpath->sn),cpu_to_le16 (PERR_RCODE_DEST_UNREACH ), bcast, sdata); }else
@@ -614,7 +614,8 @@ void mesh_path_discard_frame(struct sk_b mpath =mesh_path_lookup (da, sdata);if (mpath) sn = ++mpath->sn; -mesh_path_error_tx (MESH_TTL , skb->data,cpu_to_le32 (sn), +mesh_path_error_tx (sdata->u.mesh.mshcfg.dot11MeshTTL, skb->data, +cpu_to_le32 (sn),cpu_to_le16 (PERR_RCODE_NO_ROUTE ), ra, sdata); }
net/mac80211/mesh_hwmp.c +3 -2
@@ -232,7 +232,7 @@ int mesh_path_error_tx(u8 ttl, u8 *targe *pos++ =WLAN_EID_PERR ; *pos++ = ie_len;/* ttl */ - *pos++ =MESH_TTL ; + *pos++ = ttl;/* number of destinations */ *pos++ =1 ;/*
@@ -1013,5 +1013,6 @@ mesh_path_tx_root_frame(struct ieee80211mesh_path_sel_frame_tx (MPATH_RANN ,0 , sdata->vif.addr,cpu_to_le32 (++ifmsh->sn),0 ,NULL ,0 , broadcast_addr, -0 ,MESH_TTL ,0 ,0 ,0 , sdata); +0 , sdata->u.mesh.mshcfg.dot11MeshTTL, +0 ,0 ,0 , sdata); }
Re: [PATCH/RFC] mac80211: use configured mesh TTL
In reply to Johannes BergJohannes,
Quoted 4 lines · Johannes Berg
From: Johannes Berg <[email protected]>
It seems the configured mesh TTL should be used,
not the default value.
Path selection frames use a different TTL, which was recently renamed from 'TTL' to 'Element TTL' in the 11s draft:
element time to live (Element TTL): An integer number that is used to limit the number of hops an
HWMP element may be processed and propagated. Note that this Element TTL is different from the
Mesh TTL in the Mesh Control (see 7.1.3.6.3 (Mesh Control field)).
So no, I would not change this.
Javier
Quoted 31 lines
Signed-off-by Johannes Berg <[email protected]>---
net/mac80211/mesh_pathtbl.c | 7 ++++---1 file changed, 4 insertions(+), 3 deletions(-)net/mac80211/mesh_pathtbl.c 2010-12-01 21:27:42.000000000 +0100 renamed from net/mac80211/mesh_pathtbl.c 2010-12-01 21:26:47.000000000 +0100 +4
-3@@ -467,8 +467,8 @@ void mesh_plink_broken(struct sta_info * mpath->flags &= ~MESH_PATH_ACTIVE; ++mpath->sn; spin_unlock_bh(&mpath->state_lock); - mesh_path_error_tx(MESH_TTL, mpath->dst, - cpu_to_le32(mpath->sn), + mesh_path_error_tx(sdata->u.mesh.mshcfg.dot11MeshTTL, + mpath->dst, cpu_to_le32(mpath->sn), cpu_to_le16(PERR_RCODE_DEST_UNREACH), bcast, sdata); } else@@ -614,7 +614,8 @@ void mesh_path_discard_frame(struct sk_b mpath = mesh_path_lookup(da, sdata); if (mpath) sn = ++mpath->sn; - mesh_path_error_tx(MESH_TTL, skb->data, cpu_to_le32(sn), + mesh_path_error_tx(sdata->u.mesh.mshcfg.dot11MeshTTL, skb->data, + cpu_to_le32(sn), cpu_to_le16(PERR_RCODE_NO_ROUTE), ra, sdata); }
Signature · 3 lines
Javier Cardona cozybit Inc. http://www.cozybit.com
Johannes Berg
maintainerRe: [PATCH/RFC] mac80211: use configured mesh TTL
Quoted 10 lines · Javier Cardona
Path selection frames use a different TTL, which was recently renamed from 'TTL' to 'Element TTL' in the 11s draft:
element time to live (Element TTL): An integer number that is used to limit the number of hops an
HWMP element may be processed and propagated. Note that this Element TTL is different from the
Mesh TTL in the Mesh Control (see 7.1.3.6.3 (Mesh Control field)).So no, I would not change this.
Ok, can you look at v2 though please -- does this hold for all four places, or is the one in mesh_path_error_tx really a bug?
Should we rename the constant then, to indicate the difference? Maybe something like MESH_DEFAULT_ELEMENT_TTL even if that's a bit verbose?
johannes