diff options
author | Luis Carlos Cobo <luisca@cozybit.com> | 2008-08-05 13:34:52 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-07 09:49:04 -0400 |
commit | e32f85f7b917456265d4c30d15f734c4912cfa6a (patch) | |
tree | 14d48a5e3d4b279966f2c15b0a3e5f909bc71d58 /net/mac80211/mesh_hwmp.c | |
parent | eda0c003d1ff14c99d8476b482377ccfaf967b6c (diff) |
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 <luisca@cozybit.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mesh_hwmp.c')
-rw-r--r-- | net/mac80211/mesh_hwmp.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 7fa149e230e6..08aca446ca01 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -758,29 +758,30 @@ enddiscovery: | |||
758 | /** | 758 | /** |
759 | * ieee80211s_lookup_nexthop - put the appropriate next hop on a mesh frame | 759 | * ieee80211s_lookup_nexthop - put the appropriate next hop on a mesh frame |
760 | * | 760 | * |
761 | * @next_hop: output argument for next hop address | 761 | * @skb: 802.11 frame to be sent |
762 | * @skb: frame to be sent | ||
763 | * @dev: network device the frame will be sent through | 762 | * @dev: network device the frame will be sent through |
763 | * @fwd_frame: true if this frame was originally from a different host | ||
764 | * | 764 | * |
765 | * Returns: 0 if the next hop was found. Nonzero otherwise. If no next hop is | 765 | * Returns: 0 if the next hop was found. Nonzero otherwise. If no next hop is |
766 | * found, the function will start a path discovery and queue the frame so it is | 766 | * found, the function will start a path discovery and queue the frame so it is |
767 | * sent when the path is resolved. This means the caller must not free the skb | 767 | * sent when the path is resolved. This means the caller must not free the skb |
768 | * in this case. | 768 | * in this case. |
769 | */ | 769 | */ |
770 | int mesh_nexthop_lookup(u8 *next_hop, struct sk_buff *skb, | 770 | int mesh_nexthop_lookup(struct sk_buff *skb, struct net_device *dev) |
771 | struct net_device *dev) | ||
772 | { | 771 | { |
773 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 772 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
774 | struct sk_buff *skb_to_free = NULL; | 773 | struct sk_buff *skb_to_free = NULL; |
775 | struct mesh_path *mpath; | 774 | struct mesh_path *mpath; |
775 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
776 | u8 *dst_addr = hdr->addr3; | ||
776 | int err = 0; | 777 | int err = 0; |
777 | 778 | ||
778 | rcu_read_lock(); | 779 | rcu_read_lock(); |
779 | mpath = mesh_path_lookup(skb->data, dev); | 780 | mpath = mesh_path_lookup(dst_addr, dev); |
780 | 781 | ||
781 | if (!mpath) { | 782 | if (!mpath) { |
782 | mesh_path_add(skb->data, dev); | 783 | mesh_path_add(dst_addr, dev); |
783 | mpath = mesh_path_lookup(skb->data, dev); | 784 | mpath = mesh_path_lookup(dst_addr, dev); |
784 | if (!mpath) { | 785 | if (!mpath) { |
785 | dev_kfree_skb(skb); | 786 | dev_kfree_skb(skb); |
786 | sdata->u.sta.mshstats.dropped_frames_no_route++; | 787 | sdata->u.sta.mshstats.dropped_frames_no_route++; |
@@ -792,13 +793,13 @@ int mesh_nexthop_lookup(u8 *next_hop, struct sk_buff *skb, | |||
792 | if (mpath->flags & MESH_PATH_ACTIVE) { | 793 | if (mpath->flags & MESH_PATH_ACTIVE) { |
793 | if (time_after(jiffies, mpath->exp_time - | 794 | if (time_after(jiffies, mpath->exp_time - |
794 | msecs_to_jiffies(sdata->u.sta.mshcfg.path_refresh_time)) | 795 | msecs_to_jiffies(sdata->u.sta.mshcfg.path_refresh_time)) |
795 | && skb->pkt_type != PACKET_OTHERHOST | 796 | && !memcmp(dev->dev_addr, hdr->addr4, ETH_ALEN) |
796 | && !(mpath->flags & MESH_PATH_RESOLVING) | 797 | && !(mpath->flags & MESH_PATH_RESOLVING) |
797 | && !(mpath->flags & MESH_PATH_FIXED)) { | 798 | && !(mpath->flags & MESH_PATH_FIXED)) { |
798 | mesh_queue_preq(mpath, | 799 | mesh_queue_preq(mpath, |
799 | PREQ_Q_F_START | PREQ_Q_F_REFRESH); | 800 | PREQ_Q_F_START | PREQ_Q_F_REFRESH); |
800 | } | 801 | } |
801 | memcpy(next_hop, mpath->next_hop->addr, | 802 | memcpy(hdr->addr1, mpath->next_hop->addr, |
802 | ETH_ALEN); | 803 | ETH_ALEN); |
803 | } else { | 804 | } else { |
804 | if (!(mpath->flags & MESH_PATH_RESOLVING)) { | 805 | if (!(mpath->flags & MESH_PATH_RESOLVING)) { |