Skip to contentSkip to conversation

mac80211: fix the problem of unicast forwarding from DS to DS in Mesh

PATCH Superseded Chun-Yeow Yeoh 3 participants 7 messages Feb 18, 2013 – Feb 19, 2013 mac80211

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: fix the problem of unicast forwarding from DS to DS in Mesh

Unicast frame with unknown forwarding information always trigger the path discovery assuming destination is always located inside the MBSS. This patch allows the forwarding to look for mesh gate if path discovery inside the MBSS has failed.

---
 net/mac80211/tx.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
net/mac80211/tx.c +12 -3
index 5b9602b..dce3af3 100644
@@ -1844,9 +1844,18 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
 		}
 
 		if (!is_multicast_ether_addr(skb->data)) {
-			mpath = mesh_path_lookup(sdata, skb->data);
-			if (!mpath)
-				mppath = mpp_path_lookup(sdata, skb->data);
+			struct sta_info *next_hop;
+
+			mpath = mesh_path_lookup(skb->data, sdata);
+			if (mpath)
+				next_hop = rcu_dereference(mpath->next_hop);
+
+			if (!mpath || (mpath && (!next_hop ||
+					!(mpath->flags & MESH_PATH_ACTIVE))))
+				mppath = mpp_path_lookup(skb->data, sdata);
+
+			if (mppath && mpath)
+				mesh_path_del(mpath->dst, mpath->sdata);
 		}
 
 		/*
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 16 lines · Chun-Yeow Yeoh

Unicast frame with unknown forwarding information always trigger the path discovery assuming destination is always located inside the MBSS. This patch allows the forwarding to look for mesh gate if path discovery inside the MBSS has failed.

---
 net/mac80211/tx.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
net/mac80211/tx.c +0 -0
index 5b9602b..dce3af3 100644

net/mac80211/tx.c netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, · line 1849

Quoted 9 lines
net/mac80211/tx.c +3 -3
@@ -1844,9 +1844,18 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
                }
 
                if (!is_multicast_ether_addr(skb->data)) {
-                       mpath = mesh_path_lookup(sdata, skb->data);
-                       if (!mpath)
-                               mppath = mpp_path_lookup(sdata, skb->data);
+                       struct sta_info *next_hop;
+
+                       mpath = mesh_path_lookup(skb->data, sdata);

The API is now mesh_path_lookup(sdata, skb->data) :)

net/mac80211/tx.c netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, · line 1854

Quoted 5 lines
net/mac80211/tx.c +5 -0
+                       if (mpath)
+                               next_hop = rcu_dereference(mpath->next_hop);
+
+                       if (!mpath || (mpath && (!next_hop ||
+                                       !(mpath->flags & MESH_PATH_ACTIVE))))

The mpath could still be resolving?

net/mac80211/tx.c netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, · line 1858

Quoted 4 lines
net/mac80211/tx.c +4 -0
+                               mppath = mpp_path_lookup(skb->data, sdata);
+
+                       if (mppath && mpath)
+                               mesh_path_del(mpath->dst, mpath->sdata);

In general the mpath / mppath path selection code is very similar to the point of duplication. I think these are ripe for a refactoring, where a single mpath could represent an intra-MBSS or mesh gate proxied destination. This is obviously out of scope for your patch, but hopefully some day we can make all this mpath code readable :)

Signature · 1 line
Thomas
maintainer
#2 lore raw
In reply to Chun-Yeow Yeoh
Quoted 16 lines · Chun-Yeow Yeoh

Unicast frame with unknown forwarding information always trigger the path discovery assuming destination is always located inside the MBSS. This patch allows the forwarding to look for mesh gate if path discovery inside the MBSS has failed.

---
 net/mac80211/tx.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
net/mac80211/tx.c +0 -0
index 5b9602b..dce3af3 100644

net/mac80211/tx.c netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, · line 1849

Quoted 9 lines
net/mac80211/tx.c +3 -3
@@ -1844,9 +1844,18 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
 		}
 
 		if (!is_multicast_ether_addr(skb->data)) {
-			mpath = mesh_path_lookup(sdata, skb->data);
-			if (!mpath)
-				mppath = mpp_path_lookup(sdata, skb->data);
+			struct sta_info *next_hop;
+
+			mpath = mesh_path_lookup(skb->data, sdata);

as Thomas said, please rebase on mac80211-next.

net/mac80211/tx.c netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, · line 1854

Quoted 5 lines
net/mac80211/tx.c +5 -0
+			if (mpath)
+				next_hop = rcu_dereference(mpath->next_hop);
+
+			if (!mpath || (mpath && (!next_hop ||
+					!(mpath->flags & MESH_PATH_ACTIVE))))

indentation here is also wrong.

johannes

maintainer
#3 lore raw
In reply to Chun-Yeow Yeoh
Quoted 21 lines · Chun-Yeow Yeoh

Unicast frame with unknown forwarding information always trigger the path discovery assuming destination is always located inside the MBSS. This patch allows the forwarding to look for mesh gate if path discovery inside the MBSS has failed.

---
 net/mac80211/tx.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
net/mac80211/tx.c +0 -2
index 5b9602b..dce3af3 100644
@@ -1844,9 +1844,18 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
 		}
 
 		if (!is_multicast_ether_addr(skb->data)) {
-			mpath = mesh_path_lookup(sdata, skb->data);
-			if (!mpath)

net/mac80211/tx.c netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, · line 1855

Quoted 10 lines
net/mac80211/tx.c +9 -1
-				mppath = mpp_path_lookup(sdata, skb->data);
+			struct sta_info *next_hop;
+
+			mpath = mesh_path_lookup(skb->data, sdata);
+			if (mpath)
+				next_hop = rcu_dereference(mpath->next_hop);
+
+			if (!mpath || (mpath && (!next_hop ||
+					!(mpath->flags & MESH_PATH_ACTIVE))))
+				mppath = mpp_path_lookup(skb->data, sdata);

Heck, even the logic is wrong. Ok actually just weird -- if (!mpath || ! next_hop || ...) would be totally sufficient.

net/mac80211/tx.c netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, · line 1858

Quoted 2 lines
net/mac80211/tx.c +2 -0
+			if (mppath && mpath)
+				mesh_path_del(mpath->dst, mpath->sdata);

You really delete paths because packets are transmitted along them?

johannes

#4 lore raw
Quoted 36 lines · Johannes Berg
Quoted 21 lines · Chun-Yeow Yeoh

Unicast frame with unknown forwarding information always trigger the path discovery assuming destination is always located inside the MBSS. This patch allows the forwarding to look for mesh gate if path discovery inside the MBSS has failed.

---
 net/mac80211/tx.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
net/mac80211/tx.c +0 -2
index 5b9602b..dce3af3 100644
@@ -1844,9 +1844,18 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
              }
 
              if (!is_multicast_ether_addr(skb->data)) {
-                     mpath = mesh_path_lookup(sdata, skb->data);
-                     if (!mpath)

net/mac80211/tx.c netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, · line 1855

Quoted 10 lines
net/mac80211/tx.c +9 -1
-                             mppath = mpp_path_lookup(sdata, skb->data);
+                     struct sta_info *next_hop;
+
+                     mpath = mesh_path_lookup(skb->data, sdata);
+                     if (mpath)
+                             next_hop = rcu_dereference(mpath->next_hop);
+
+                     if (!mpath || (mpath && (!next_hop ||
+                                     !(mpath->flags & MESH_PATH_ACTIVE))))
+                             mppath = mpp_path_lookup(skb->data, sdata);

Heck, even the logic is wrong. Ok actually just weird -- if (!mpath || ! next_hop || ...) would be totally sufficient.

Quoted 4 lines

net/mac80211/tx.c netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, · line 1858

Quoted 2 lines
net/mac80211/tx.c +2 -0
+                     if (mppath && mpath)
+                             mesh_path_del(mpath->dst, mpath->sdata);

You really delete paths because packets are transmitted along them?

I think he's deleting the mpath if an mppath was found (mpath is not valid), but this cleanup will happen in the housekeeping work anyway, so it's not needed here.

Signature · 1 line
Thomas
#5 lore raw
Quoted 3 lines

I think he's deleting the mpath if an mppath was found (mpath is not valid), but this cleanup will happen in the housekeeping work anyway, so it's not needed here.

Unfortunately, the housekeeping takes about 10 minutes to delete the mpath. In that case, if the mesh STA moves in and out from DS to MBSS or vice versa, the connectivity is loss for that duration.

---
Chun-Yeow

#6 lore raw
In reply to Johannes Berg
Quoted 6 lines

net/mac80211/tx.c netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, · line 1855

Quoted 3 lines
net/mac80211/tx.c +3 -0
+                     if (!mpath || (mpath && (!next_hop ||
+                                     !(mpath->flags & MESH_PATH_ACTIVE))))
+                             mppath = mpp_path_lookup(skb->data, sdata);

Heck, even the logic is wrong. Ok actually just weird -- if (!mpath || ! next_hop || ...) would be totally sufficient.

We go to lookup for mppath if mpath is unavailable, or if mpath is available but the next_hop is NULL or the path is inactive.

---
Chun-Yeow