Unify mpp/mesh_path handling for Mac 802.11s
RFC PATCH 1/1 Unify mpp/mesh_path handling for Mac 802.11s
From: Henning Rogge <[email protected]>
This patch is a preparation for exporting the MPP data of the 802.11s implementation via netlink to userspace. It unifies the content of the mesh_paths and mpp_paths tables in mesh_pathtbl.c without changing the behavior of the code.
--- net/mac80211/cfg.c | 6 +- net/mac80211/mesh.c | 3 - net/mac80211/mesh.h | 18 ++-- net/mac80211/mesh_hwmp.c | 30 +++--- net/mac80211/mesh_pathtbl.c | 235 +++++++++++--------------------------------- net/mac80211/rx.c | 4 +- net/mac80211/tx.c | 5 +- 7 files changed, 92 insertions(+), 209 deletions(-)
net/mac80211/cfg.c +3 -3
@@ -1637,7 +1637,7 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,return -ENOENT ; } - mpath =mesh_path_add (sdata, dst); + mpath =mesh_path_add (sdata, dst,NULL );if (IS_ERR (mpath)) {rcu_read_unlock ();return PTR_ERR (mpath);
@@ -1679,7 +1679,7 @@ static int ieee80211_change_mpath(struct wiphy *wiphy,return -ENOENT ; } - mpath =mesh_path_lookup (sdata, dst); + mpath =mesh_path_lookup (sdata, dst, false);if (!mpath) {rcu_read_unlock ();return -ENOENT ;
@@ -1743,7 +1743,7 @@ static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev, sdata =IEEE80211_DEV_TO_SUB_IF (dev);rcu_read_lock (); - mpath =mesh_path_lookup (sdata, dst); + mpath =mesh_path_lookup (sdata, dst, false);if (!mpath) {rcu_read_unlock ();return -ENOENT ;
net/mac80211/mesh.c +0 -3
@@ -1283,9 +1283,6 @@ void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata)if (test_and_clear_bit (MESH_WORK_GROW_MPATH_TABLE , &ifmsh->wrkq_flags))mesh_mpath_table_grow (); -if (test_and_clear_bit (MESH_WORK_GROW_MPP_TABLE , &ifmsh->wrkq_flags)) -mesh_mpp_table_grow (); -if (test_and_clear_bit (MESH_WORK_HOUSEKEEPING , &ifmsh->wrkq_flags))ieee80211_mesh_housekeeping (sdata);
net/mac80211/mesh.h +10 -8
@@ -43,6 +43,7 @@ enum mesh_path_flags {MESH_PATH_FIXED =BIT (3 ),MESH_PATH_RESOLVED =BIT (4 ),MESH_PATH_REQ_QUEUED =BIT (5 ), + MESH_PATH_PROXIED = BIT(6), };/**
@@ -63,7 +64,6 @@ enum mesh_path_flags {enum mesh_deferred_task_flags {MESH_WORK_HOUSEKEEPING ,MESH_WORK_GROW_MPATH_TABLE , -MESH_WORK_GROW_MPP_TABLE ,MESH_WORK_ROOT ,MESH_WORK_DRIFT_ADJUST ,MESH_WORK_MBSS_CHANGED ,
@@ -263,11 +263,7 @@ int mesh_nexthop_resolve(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);void mesh_path_start_discovery (struct ieee80211_sub_if_data *sdata);struct mesh_path *mesh_path_lookup (struct ieee80211_sub_if_data *sdata, -const u8 *dst); -struct mesh_path *mpp_path_lookup (struct ieee80211_sub_if_data *sdata, -const u8 *dst); -int mpp_path_add (struct ieee80211_sub_if_data *sdata, -const u8 *dst,const u8 *mpp); +const u8 *dst,bool is_proxied);struct mesh_path *mesh_path_lookup_by_idx (struct ieee80211_sub_if_data *sdata,int idx);void mesh_path_fix_nexthop (struct mesh_path *mpath,struct sta_info *next_hop);
@@ -275,7 +271,8 @@ void mesh_path_expire(struct ieee80211_sub_if_data *sdata);void mesh_rx_path_sel_frame (struct ieee80211_sub_if_data *sdata,struct ieee80211_mgmt *mgmt,size_t len);struct mesh_path * -mesh_path_add (struct ieee80211_sub_if_data *sdata,const u8 *dst); +mesh_path_add (struct ieee80211_sub_if_data *sdata, +const u8 *dst,const u8 *mpp);int mesh_path_add_gate (struct mesh_path *mpath);int mesh_path_send_to_gates (struct mesh_path *mpath);
@@ -298,7 +295,6 @@ void mesh_sta_cleanup(struct sta_info *sta);/* Private interfaces */ /* Mesh tables */ void mesh_mpath_table_grow (void ); -void mesh_mpp_table_grow (void );/* Mesh paths */ int mesh_path_error_tx(struct ieee80211_sub_if_data *sdata, u8 ttl, const u8 *target, u32 target_sn,
@@ -355,11 +351,17 @@ static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata) return sdata->u.mesh.mesh_pp_id == IEEE80211_PATH_PROTOCOL_HWMP; } +static inline bool is_mesh_path_proxied (const struct mesh_path *mpath) +{ +return !!(mpath->flags &MESH_PATH_PROXIED ); +} +void ieee80211_mesh_notify_scan_completed (struct ieee80211_local *local);void mesh_path_flush_by_iface (struct ieee80211_sub_if_data *sdata);void mesh_sync_adjust_tbtt (struct ieee80211_sub_if_data *sdata);void ieee80211s_stop (void ); +#else static inline void ieee80211_mesh_notify_scan_completed (struct ieee80211_local *local) {}
net/mac80211/mesh_hwmp.c +15 -15
@@ -429,7 +429,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata, process = false; fresh_info = false; }else { - mpath =mesh_path_lookup (sdata, orig_addr); + mpath =mesh_path_lookup (sdata, orig_addr, false);if (mpath) {spin_lock_bh (&mpath->state_lock);if (mpath->flags &MESH_PATH_FIXED )
@@ -444,7 +444,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata, } } }else { - mpath =mesh_path_add (sdata, orig_addr); + mpath =mesh_path_add (sdata, orig_addr,NULL );if (IS_ERR (mpath)) {rcu_read_unlock ();return 0 ;
@@ -476,7 +476,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,else { fresh_info = true; - mpath =mesh_path_lookup (sdata, ta); + mpath =mesh_path_lookup (sdata, ta, false);if (mpath) {spin_lock_bh (&mpath->state_lock); if ((mpath->flags & MESH_PATH_FIXED) ||
@@ -484,7 +484,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata, (last_hop_metric > mpath->metric))) fresh_info = false; }else { - mpath =mesh_path_add (sdata, ta); + mpath =mesh_path_add (sdata, ta,NULL );if (IS_ERR (mpath)) {rcu_read_unlock ();return 0 ;
@@ -550,7 +550,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, }else if (is_broadcast_ether_addr (target_addr) && (target_flags &IEEE80211_PREQ_TO_FLAG )) {rcu_read_lock (); - mpath =mesh_path_lookup (sdata, orig_addr); + mpath =mesh_path_lookup (sdata, orig_addr, false);if (mpath) {if (flags &IEEE80211_PREQ_PROACTIVE_PREP_FLAG ) { reply = true;
@@ -565,7 +565,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,rcu_read_unlock (); }else {rcu_read_lock (); - mpath =mesh_path_lookup (sdata, target_addr); + mpath =mesh_path_lookup (sdata, target_addr, false);if (mpath) {if ((!(mpath->flags &MESH_PATH_SN_VALID )) ||SN_LT (mpath->sn, target_sn)) {
@@ -672,7 +672,7 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata, }rcu_read_lock (); - mpath =mesh_path_lookup (sdata, orig_addr); + mpath =mesh_path_lookup (sdata, orig_addr, false);if (mpath)spin_lock_bh (&mpath->state_lock);else
@@ -728,7 +728,7 @@ static void hwmp_perr_frame_process(struct ieee80211_sub_if_data *sdata, target_rcode =PERR_IE_TARGET_RCODE (perr_elem);rcu_read_lock (); - mpath =mesh_path_lookup (sdata, target_addr); + mpath =mesh_path_lookup (sdata, target_addr, false);if (mpath) {struct sta_info *sta;
@@ -793,9 +793,9 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata, metric_txsta =airtime_link_metric_get (local, sta); - mpath =mesh_path_lookup (sdata, orig_addr); + mpath =mesh_path_lookup (sdata, orig_addr, false);if (!mpath) { - mpath =mesh_path_add (sdata, orig_addr); + mpath =mesh_path_add (sdata, orig_addr,NULL );if (IS_ERR (mpath)) {rcu_read_unlock (); sdata->u.mesh.mshstats.dropped_frames_no_route++;
@@ -994,7 +994,7 @@ void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata)spin_unlock_bh (&ifmsh->mesh_preq_queue_lock);rcu_read_lock (); - mpath =mesh_path_lookup (sdata, preq_node->dst); + mpath =mesh_path_lookup (sdata, preq_node->dst, false);if (!mpath) goto enddiscovery;
@@ -1082,9 +1082,9 @@ int mesh_nexthop_resolve(struct ieee80211_sub_if_data *sdata, goto endlookup;/* no nexthop found, start resolving */ - mpath =mesh_path_lookup (sdata, target_addr); + mpath =mesh_path_lookup (sdata, target_addr, false);if (!mpath) { - mpath =mesh_path_add (sdata, target_addr); + mpath =mesh_path_add (sdata, target_addr,NULL );if (IS_ERR (mpath)) {mesh_path_discard_frame (sdata, skb); err =PTR_ERR (mpath);
@@ -1130,7 +1130,7 @@ int mesh_nexthop_lookup(struct ieee80211_sub_if_data *sdata,int err = -ENOENT ;rcu_read_lock (); - mpath =mesh_path_lookup (sdata, target_addr); + mpath =mesh_path_lookup (sdata, target_addr, false);if (!mpath || !(mpath->flags &MESH_PATH_ACTIVE )) goto endlookup;
@@ -1177,7 +1177,7 @@ void mesh_path_timer(unsigned long data)spin_unlock_bh (&mpath->state_lock);mesh_queue_preq (mpath,0 ); }else { - mpath->flags =0 ; + mpath->flags &= ~MESH_PATH_PROXIED ; mpath->exp_time = jiffies;spin_unlock_bh (&mpath->state_lock);if (!mpath->is_gate &&mesh_gate_num (sdata) >0 ) {
net/mac80211/mesh_pathtbl.c +59 -176
409 lines not on this page · raw message
net/mac80211/rx.c +2 -2
@@ -2103,9 +2103,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) }rcu_read_lock (); - mppath =mpp_path_lookup (sdata, proxied_addr); + mppath =mesh_path_lookup (sdata, proxied_addr, true);if (!mppath) { -mpp_path_add (sdata, proxied_addr, mpp_addr); +mesh_path_add (sdata, proxied_addr, mpp_addr); }else {spin_lock_bh (&mppath->state_lock);if (!ether_addr_equal (mppath->mpp, mpp_addr))
net/mac80211/tx.c +3 -2
@@ -1887,7 +1887,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,struct sta_info *next_hop;bool mpp_lookup = true; - mpath =mesh_path_lookup (sdata, skb->data); + mpath =mesh_path_lookup (sdata, skb->data, false);if (mpath) { mpp_lookup = false; next_hop =rcu_dereference (mpath->next_hop);
@@ -1898,7 +1898,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, }if (mpp_lookup) - mppath =mpp_path_lookup (sdata, skb->data); + mppath =mesh_path_lookup (sdata, + skb->data, true);if (mppath && mpath)mesh_path_del (mpath->sdata, mpath->dst);
Signature · 1 line
1.9.0
Johannes Berg
maintainerQuoted 6 lines · Henning Rogge
From: Henning Rogge <[email protected]>
This patch is a preparation for exporting the MPP data of the 802.11s implementation via netlink to userspace. It unifies the content of the
mesh_pathsandmpp_pathstables inmesh_pathtbl.cwithout changing the behavior of the code.
Code removal always *seems* good, but I can't really say much about this :-)
Quoted 3 lines
void
ieee80211s_stop(void);
+
#else
This I'd rather avoid though.
johannes
Ups...
I thought I had found all this "stupid whitespace mistakes, I will remove them in the next version of the patch... but I wanted a comment if this is a good direction to go before we discuss how to change the netlink interface to export the data of the former mpp_paths table.
Henning Rogge
Quoted 19 lines · Johannes Berg
Quoted 6 lines · Henning Rogge
From: Henning Rogge <[email protected]>
This patch is a preparation for exporting the MPP data of the 802.11s implementation via netlink to userspace. It unifies the content of the
mesh_pathsandmpp_pathstables inmesh_pathtbl.cwithout changing the behavior of the code.Code removal always *seems* good, but I can't really say much about this :-)
Quoted 3 lines
void
ieee80211s_stop(void);
+
#elseThis I'd rather avoid though.
johannes
Johannes Berg
maintainerQuoted 4 lines · Henning Rogge
Ups...
I thought I had found all this "stupid whitespace mistakes, I will remove them in the next version of the patch...
:)
Quoted 3 lines
but I wanted a comment
if this is a good direction to go before we discuss how to change the netlink interface to export the data of the formermpp_pathstable.
No idea, really. However, I'm not sure why the two are related? The netlink API could just iterate two tables as well.
johannes
Quoted 8 lines · Henning Rogge
From: Henning Rogge <[email protected]>
This patch is a preparation for exporting the MPP data of the 802.11s implementation via netlink to userspace. It unifies the content of the
mesh_pathsandmpp_pathstables inmesh_pathtbl.cwithout changing the behavior of the code.Signed-off-by Henning Rogge <[email protected]>
I think I fall on the side of your earlier assessment that they hold different things and should stay in different tables, even though there are 200 lines of identical code here. Maybe some bits could be shared without sharing the data and changing the API?
net/mac80211/mesh_pathtbl.c static void mesh_path_move_to_queue(struct mesh_path *gate_mpath, · line 328
Quoted 7 lines
net/mac80211/mesh_pathtbl.c +5
-2-static struct mesh_path *mpath_lookup (struct mesh_table *tbl,const u8 *dst, -struct ieee80211_sub_if_data *sdata) +/** +* mesh_path_lookup - look up a path in the mesh path table +* @sdata: local subif +* @dst: hardware address (ETH_ALEN length) of destination +* @is_proxied: true to lookup mpp entries, false otherwise
Also, I don't like adding random boolean variables to water down what this function does. It means when looking at the caller you have to go back to the definition to see just what is going on here.
We do mpp_path_lookup exactly twice so it seems weird to have to change all of the mpath_lookup callers too.
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
I first had planned to just throw them together... but it didn't worked out and I assume that there is some time where you can have two entries with the same destination, one of them a normal path (request), the other one the mapped destination.
Henning Rogge
Quoted 32 lines · Bob Copeland
Quoted 8 lines · Henning Rogge
From: Henning Rogge <[email protected]>
This patch is a preparation for exporting the MPP data of the 802.11s implementation via netlink to userspace. It unifies the content of the
mesh_pathsandmpp_pathstables inmesh_pathtbl.cwithout changing the behavior of the code.Signed-off-by Henning Rogge <[email protected]>I think I fall on the side of your earlier assessment that they hold different things and should stay in different tables, even though there are 200 lines of identical code here. Maybe some bits could be shared without sharing the data and changing the API?
net/mac80211/mesh_pathtbl.c static void mesh_path_move_to_queue(struct mesh_path *gate_mpath, · line 328
Quoted 7 lines
net/mac80211/mesh_pathtbl.c +5
-2-static struct mesh_path *mpath_lookup (struct mesh_table *tbl,const u8 *dst, -struct ieee80211_sub_if_data *sdata) +/** +* mesh_path_lookup - look up a path in the mesh path table +* @sdata: local subif +* @dst: hardware address (ETH_ALEN length) of destination +* @is_proxied: true to lookup mpp entries, false otherwise Also, I don't like adding random boolean variables to water down what this function does. It means when looking at the caller you have to go back to the definition to see just what is going on here.
We do
mpp_path_lookupexactly twice so it seems weird to have to change all of thempath_lookupcallers too.--
Bob Copeland %% www.bobcopeland.com
Ya, there is a possibility that a mesh node is leaving its MBSS and joining another new MBSS just behind its original MBSS or vice versa.
By the way, I just wondering whether it would be much faster in path resolving towards destination behind MBSS if we keep two tables separately. In typical case, assuming with one or two mesh gates providing the internet connectivity, we will have large mesh path table but smaller mpp path table.
---
Chun-Yeow
Quoted 40 lines · Henning Rogge
I first had planned to just throw them together... but it didn't worked out and I assume that there is some time where you can have two entries with the same destination, one of them a normal path (request), the other one the mapped destination.
Henning Rogge
Quoted 32 lines · Bob Copeland
Quoted 8 lines · Henning Rogge
From: Henning Rogge <[email protected]>
This patch is a preparation for exporting the MPP data of the 802.11s implementation via netlink to userspace. It unifies the content of the
mesh_pathsandmpp_pathstables inmesh_pathtbl.cwithout changing the behavior of the code.Signed-off-by Henning Rogge <[email protected]>I think I fall on the side of your earlier assessment that they hold different things and should stay in different tables, even though there are 200 lines of identical code here. Maybe some bits could be shared without sharing the data and changing the API?
net/mac80211/mesh_pathtbl.c static void mesh_path_move_to_queue(struct mesh_path *gate_mpath, · line 328
Quoted 7 lines
net/mac80211/mesh_pathtbl.c +5
-2-static struct mesh_path *mpath_lookup (struct mesh_table *tbl,const u8 *dst, -struct ieee80211_sub_if_data *sdata) +/** +* mesh_path_lookup - look up a path in the mesh path table +* @sdata: local subif +* @dst: hardware address (ETH_ALEN length) of destination +* @is_proxied: true to lookup mpp entries, false otherwise Also, I don't like adding random boolean variables to water down what this function does. It means when looking at the caller you have to go back to the definition to see just what is going on here.
We do
mpp_path_lookupexactly twice so it seems weird to have to change all of thempath_lookupcallers too.--
Bob Copeland %% www.bobcopeland.com
Hi,
I will have another look at the codebase next week, there was a lot of similar code for both tables that could be simplified without throwing them together.
The feeling I get here is that four new nl80211 commands (set/get/del/dump mpp_paths) are the right way to export these values?
Henning Rogge
Quoted 53 lines · Yeoh Chun-Yeow
Ya, there is a possibility that a mesh node is leaving its MBSS and joining another new MBSS just behind its original MBSS or vice versa.
By the way, I just wondering whether it would be much faster in path resolving towards destination behind MBSS if we keep two tables separately. In typical case, assuming with one or two mesh gates providing the internet connectivity, we will have large mesh path table but smaller mpp path table.
---
Chun-YeowQuoted 40 lines · Henning Rogge
I first had planned to just throw them together... but it didn't worked out and I assume that there is some time where you can have two entries with the same destination, one of them a normal path (request), the other one the mapped destination.
Henning Rogge
Quoted 32 lines · Bob Copeland
Quoted 8 lines · Henning Rogge
From: Henning Rogge <[email protected]>
This patch is a preparation for exporting the MPP data of the 802.11s implementation via netlink to userspace. It unifies the content of the
mesh_pathsandmpp_pathstables inmesh_pathtbl.cwithout changing the behavior of the code.Signed-off-by Henning Rogge <[email protected]>I think I fall on the side of your earlier assessment that they hold different things and should stay in different tables, even though there are 200 lines of identical code here. Maybe some bits could be shared without sharing the data and changing the API?
net/mac80211/mesh_pathtbl.c static void mesh_path_move_to_queue(struct mesh_path *gate_mpath, · line 328
Quoted 7 lines
net/mac80211/mesh_pathtbl.c +5
-2-static struct mesh_path *mpath_lookup (struct mesh_table *tbl,const u8 *dst, -struct ieee80211_sub_if_data *sdata) +/** +* mesh_path_lookup - look up a path in the mesh path table +* @sdata: local subif +* @dst: hardware address (ETH_ALEN length) of destination +* @is_proxied: true to lookup mpp entries, false otherwise Also, I don't like adding random boolean variables to water down what this function does. It means when looking at the caller you have to go back to the definition to see just what is going on here.
We do
mpp_path_lookupexactly twice so it seems weird to have to change all of thempath_lookupcallers too.--
Bob Copeland %% www.bobcopeland.com
Quoted 8 lines · Henning Rogge
Hi,
I will have another look at the codebase next week, there was a lot of similar code for both tables that could be simplified without throwing them together.
The feeling I get here is that four new nl80211 commands (set/get/del/dump
mpp_paths) are the right way to export these values?
That approach would be fine by me. Thanks for working on this!
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
For disable HWMP, in additional to disable frame forwarding and set mesh TTL to 1, you can force specific mpath using "iw mesh0 mpath set <MACx> next_hop <MACx>". In this case, you will disable the path refresh.
----
Chun-Yeow
Quoted 14 lines · Bob Copeland
Quoted 8 lines · Henning Rogge
Hi,
I will have another look at the codebase next week, there was a lot of similar code for both tables that could be simplified without throwing them together.
The feeling I get here is that four new nl80211 commands (set/get/del/dump
mpp_paths) are the right way to export these values?That approach would be fine by me. Thanks for working on this!
--
Bob Copeland %% www.bobcopeland.com
Hi,
I think this would require to know the mac addresses of the remote nodes... but maybe I will look into changing the timeout value.
Henning Rogge
Quoted 23 lines · Yeoh Chun-Yeow
For disable HWMP, in additional to disable frame forwarding and set mesh TTL to 1, you can force specific mpath using "iw mesh0 mpath set <MACx>
next_hop<MACx>". In this case, you will disable the path refresh.----
Chun-YeowQuoted 14 lines · Bob Copeland
Quoted 8 lines · Henning Rogge
Hi,
I will have another look at the codebase next week, there was a lot of similar code for both tables that could be simplified without throwing them together.
The feeling I get here is that four new nl80211 commands (set/get/del/dump
mpp_paths) are the right way to export these values?That approach would be fine by me. Thanks for working on this!
--
Bob Copeland %% www.bobcopeland.com
Yes, mpath set is only valid after peering. So you will have the MAC address then.
----
Chun-Yeow
Quoted 31 lines · Henning Rogge
Hi,
I think this would require to know the mac addresses of the remote nodes... but maybe I will look into changing the timeout value.
Henning Rogge
Quoted 23 lines · Yeoh Chun-Yeow
For disable HWMP, in additional to disable frame forwarding and set mesh TTL to 1, you can force specific mpath using "iw mesh0 mpath set <MACx>
next_hop<MACx>". In this case, you will disable the path refresh.----
Chun-YeowQuoted 14 lines · Bob Copeland
Quoted 8 lines · Henning Rogge
Hi,
I will have another look at the codebase next week, there was a lot of similar code for both tables that could be simplified without throwing them together.
The feeling I get here is that four new nl80211 commands (set/get/del/dump
mpp_paths) are the right way to export these values?That approach would be fine by me. Thanks for working on this!
--
Bob Copeland %% www.bobcopeland.com