mac80211: fix use of skb->cb for mesh forwarding
PATCH v2 1/1 mac80211: fix use of skb->cb for mesh forwarding
Now we deal with mesh forwarding before the 802.11->802.3 conversion, thus eliminating a few unnecessary steps. The next hop lookup is called from ieee80211_master_start_xmit() instead of subif_start_xmit(). Until the next hop is found, RA in the frame will be all zeroes for frames originating from the device. For forwarded frames, RA will contain the TA of the received frame, which will be necessary to send a path error if a next hop is not found.
Signed-off-by Luis Carlos Cobo <[email protected]>
--- net/mac80211/mesh.h | 7 +-- net/mac80211/mesh_hwmp.c | 19 ++++--- net/mac80211/mesh_pathtbl.c | 11 ++--- net/mac80211/rx.c | 118 +++++++++++++++++++++++++------------------ net/mac80211/tx.c | 45 +++++++++-------- 5 files changed, 110 insertions(+), 90 deletions(-)
net/mac80211/mesh.h +3 -4
@@ -212,10 +212,11 @@ int mesh_rmc_init(struct net_device *dev);void ieee80211s_init (void );void ieee80211s_stop (void );void ieee80211_mesh_init_sdata (struct ieee80211_sub_if_data *sdata); +ieee80211_rx_result debug_noinline +ieee80211_rx_h_mesh_fwding (struct ieee80211_rx_data *rx);/* Mesh paths */ -int mesh_nexthop_lookup (u8 *next_hop,struct sk_buff *skb, -struct net_device *dev); +int mesh_nexthop_lookup (struct sk_buff *skb,struct net_device *dev);void mesh_path_start_discovery (struct net_device *dev);struct mesh_path *mesh_path_lookup (u8 *dst,struct net_device *dev);struct mesh_path *mesh_path_lookup_by_idx (int idx,struct net_device *dev);
@@ -286,6 +287,4 @@ static inline void mesh_path_activate(struct mesh_path *mpath)#define mesh_allocated 0#endif -#define MESH_PREQ (skb) (skb->cb + 30) -#endif /* IEEE80211S_H */
net/mac80211/mesh_hwmp.c +10 -9
@@ -758,29 +758,30 @@ enddiscovery:/** * ieee80211s_lookup_nexthop - put the appropriate next hop on a mesh frame * -* @next_hop: output argument for next hop address -* @skb: frame to be sent +* @skb: 802.11 frame to be sent * @dev: network device the frame will be sent through +* @fwd_frame: true if this frame was originally from a different host * * Returns: 0 if the next hop was found. Nonzero otherwise. If no next hop is * found, the function will start a path discovery and queue the frame so it is * sent when the path is resolved. This means the caller must not free the skb * in this case. */ -int mesh_nexthop_lookup (u8 *next_hop,struct sk_buff *skb, -struct net_device *dev) +int mesh_nexthop_lookup (struct sk_buff *skb,struct net_device *dev) {struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev);struct sk_buff *skb_to_free =NULL ;struct mesh_path *mpath; +struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; +u8 *dst_addr = hdr->addr3;int err =0 ;rcu_read_lock (); - mpath =mesh_path_lookup (skb->data, dev); + mpath =mesh_path_lookup (dst_addr, dev);if (!mpath) { -mesh_path_add (skb->data, dev); - mpath =mesh_path_lookup (skb->data, dev); +mesh_path_add (dst_addr, dev); + mpath =mesh_path_lookup (dst_addr, dev);if (!mpath) {dev_kfree_skb (skb); sdata->u.sta.mshstats.dropped_frames_no_route++;
@@ -792,13 +793,13 @@ int mesh_nexthop_lookup(u8 *next_hop, struct sk_buff *skb,if (mpath->flags &MESH_PATH_ACTIVE ) {if (time_after (jiffies, mpath->exp_time -msecs_to_jiffies (sdata->u.sta.mshcfg.path_refresh_time)) - && skb->pkt_type !=PACKET_OTHERHOST + && !memcmp (dev->dev_addr, hdr->addr4,ETH_ALEN ) && !(mpath->flags &MESH_PATH_RESOLVING ) && !(mpath->flags &MESH_PATH_FIXED )) {mesh_queue_preq (mpath,PREQ_Q_F_START |PREQ_Q_F_REFRESH ); } -memcpy (next_hop, mpath->next_hop->addr, +memcpy (hdr->addr1, mpath->next_hop->addr,ETH_ALEN ); }else {if (!(mpath->flags &MESH_PATH_RESOLVING )) {
net/mac80211/mesh_pathtbl.c +4 -7
@@ -388,18 +388,15 @@ void mesh_path_tx_pending(struct mesh_path *mpath)void mesh_path_discard_frame (struct sk_buff *skb,struct net_device *dev) {struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev); +struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;struct mesh_path *mpath;u32 dsn =0 ; -if (skb->pkt_type ==PACKET_OTHERHOST ) { -struct ieee80211s_hdr *prev_meshhdr; -int mshhdrlen; +if (memcmp (hdr->addr4, dev->dev_addr,ETH_ALEN ) !=0 ) {u8 *ra, *da; - prev_meshhdr = ((struct ieee80211s_hdr *)skb->cb); - mshhdrlen =ieee80211_get_mesh_hdrlen (prev_meshhdr); - da = skb->data; - ra =MESH_PREQ (skb); + da = hdr->addr3; + ra = hdr->addr2; mpath =mesh_path_lookup (da, dev);if (mpath) dsn = ++mpath->dsn;
net/mac80211/rx.c +69 -49
149 lines not on this page · raw message
net/mac80211/tx.c +24 -21
73 lines not on this page · raw message
Signature · 1 line
1.5.4.3