aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/nl80211.h8
-rw-r--r--include/net/cfg80211.h8
-rw-r--r--net/mac80211/cfg.c8
-rw-r--r--net/mac80211/ieee80211_i.h10
-rw-r--r--net/mac80211/mesh.c2
-rw-r--r--net/mac80211/mesh.h10
-rw-r--r--net/mac80211/mesh_hwmp.c221
-rw-r--r--net/mac80211/mesh_pathtbl.c12
-rw-r--r--net/wireless/nl80211.c6
9 files changed, 144 insertions, 141 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 203adef972cf..7a0bd6ea6f63 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -899,14 +899,14 @@ enum nl80211_sta_info {
899 * 899 *
900 * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active 900 * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active
901 * @NL80211_MPATH_FLAG_RESOLVING: the mesh path discovery process is running 901 * @NL80211_MPATH_FLAG_RESOLVING: the mesh path discovery process is running
902 * @NL80211_MPATH_FLAG_DSN_VALID: the mesh path contains a valid DSN 902 * @NL80211_MPATH_FLAG_SN_VALID: the mesh path contains a valid SN
903 * @NL80211_MPATH_FLAG_FIXED: the mesh path has been manually set 903 * @NL80211_MPATH_FLAG_FIXED: the mesh path has been manually set
904 * @NL80211_MPATH_FLAG_RESOLVED: the mesh path discovery process succeeded 904 * @NL80211_MPATH_FLAG_RESOLVED: the mesh path discovery process succeeded
905 */ 905 */
906enum nl80211_mpath_flags { 906enum nl80211_mpath_flags {
907 NL80211_MPATH_FLAG_ACTIVE = 1<<0, 907 NL80211_MPATH_FLAG_ACTIVE = 1<<0,
908 NL80211_MPATH_FLAG_RESOLVING = 1<<1, 908 NL80211_MPATH_FLAG_RESOLVING = 1<<1,
909 NL80211_MPATH_FLAG_DSN_VALID = 1<<2, 909 NL80211_MPATH_FLAG_SN_VALID = 1<<2,
910 NL80211_MPATH_FLAG_FIXED = 1<<3, 910 NL80211_MPATH_FLAG_FIXED = 1<<3,
911 NL80211_MPATH_FLAG_RESOLVED = 1<<4, 911 NL80211_MPATH_FLAG_RESOLVED = 1<<4,
912}; 912};
@@ -919,7 +919,7 @@ enum nl80211_mpath_flags {
919 * 919 *
920 * @__NL80211_MPATH_INFO_INVALID: attribute number 0 is reserved 920 * @__NL80211_MPATH_INFO_INVALID: attribute number 0 is reserved
921 * @NL80211_ATTR_MPATH_FRAME_QLEN: number of queued frames for this destination 921 * @NL80211_ATTR_MPATH_FRAME_QLEN: number of queued frames for this destination
922 * @NL80211_ATTR_MPATH_DSN: destination sequence number 922 * @NL80211_ATTR_MPATH_SN: destination sequence number
923 * @NL80211_ATTR_MPATH_METRIC: metric (cost) of this mesh path 923 * @NL80211_ATTR_MPATH_METRIC: metric (cost) of this mesh path
924 * @NL80211_ATTR_MPATH_EXPTIME: expiration time for the path, in msec from now 924 * @NL80211_ATTR_MPATH_EXPTIME: expiration time for the path, in msec from now
925 * @NL80211_ATTR_MPATH_FLAGS: mesh path flags, enumerated in 925 * @NL80211_ATTR_MPATH_FLAGS: mesh path flags, enumerated in
@@ -930,7 +930,7 @@ enum nl80211_mpath_flags {
930enum nl80211_mpath_info { 930enum nl80211_mpath_info {
931 __NL80211_MPATH_INFO_INVALID, 931 __NL80211_MPATH_INFO_INVALID,
932 NL80211_MPATH_INFO_FRAME_QLEN, 932 NL80211_MPATH_INFO_FRAME_QLEN,
933 NL80211_MPATH_INFO_DSN, 933 NL80211_MPATH_INFO_SN,
934 NL80211_MPATH_INFO_METRIC, 934 NL80211_MPATH_INFO_METRIC,
935 NL80211_MPATH_INFO_EXPTIME, 935 NL80211_MPATH_INFO_EXPTIME,
936 NL80211_MPATH_INFO_FLAGS, 936 NL80211_MPATH_INFO_FLAGS,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 1ee41e4a92e2..7d0ae9c18286 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -420,7 +420,7 @@ enum monitor_flags {
420 * in during get_station() or dump_station(). 420 * in during get_station() or dump_station().
421 * 421 *
422 * MPATH_INFO_FRAME_QLEN: @frame_qlen filled 422 * MPATH_INFO_FRAME_QLEN: @frame_qlen filled
423 * MPATH_INFO_DSN: @dsn filled 423 * MPATH_INFO_SN: @sn filled
424 * MPATH_INFO_METRIC: @metric filled 424 * MPATH_INFO_METRIC: @metric filled
425 * MPATH_INFO_EXPTIME: @exptime filled 425 * MPATH_INFO_EXPTIME: @exptime filled
426 * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 426 * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
@@ -429,7 +429,7 @@ enum monitor_flags {
429 */ 429 */
430enum mpath_info_flags { 430enum mpath_info_flags {
431 MPATH_INFO_FRAME_QLEN = BIT(0), 431 MPATH_INFO_FRAME_QLEN = BIT(0),
432 MPATH_INFO_DSN = BIT(1), 432 MPATH_INFO_SN = BIT(1),
433 MPATH_INFO_METRIC = BIT(2), 433 MPATH_INFO_METRIC = BIT(2),
434 MPATH_INFO_EXPTIME = BIT(3), 434 MPATH_INFO_EXPTIME = BIT(3),
435 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 435 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
@@ -444,7 +444,7 @@ enum mpath_info_flags {
444 * 444 *
445 * @filled: bitfield of flags from &enum mpath_info_flags 445 * @filled: bitfield of flags from &enum mpath_info_flags
446 * @frame_qlen: number of queued frames for this destination 446 * @frame_qlen: number of queued frames for this destination
447 * @dsn: destination sequence number 447 * @sn: target sequence number
448 * @metric: metric (cost) of this mesh path 448 * @metric: metric (cost) of this mesh path
449 * @exptime: expiration time for the mesh path from now, in msecs 449 * @exptime: expiration time for the mesh path from now, in msecs
450 * @flags: mesh path flags 450 * @flags: mesh path flags
@@ -458,7 +458,7 @@ enum mpath_info_flags {
458struct mpath_info { 458struct mpath_info {
459 u32 filled; 459 u32 filled;
460 u32 frame_qlen; 460 u32 frame_qlen;
461 u32 dsn; 461 u32 sn;
462 u32 metric; 462 u32 metric;
463 u32 exptime; 463 u32 exptime;
464 u32 discovery_timeout; 464 u32 discovery_timeout;
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 576b86f81d1b..81053587e72b 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -935,7 +935,7 @@ static void mpath_set_pinfo(struct mesh_path *mpath, u8 *next_hop,
935 pinfo->generation = mesh_paths_generation; 935 pinfo->generation = mesh_paths_generation;
936 936
937 pinfo->filled = MPATH_INFO_FRAME_QLEN | 937 pinfo->filled = MPATH_INFO_FRAME_QLEN |
938 MPATH_INFO_DSN | 938 MPATH_INFO_SN |
939 MPATH_INFO_METRIC | 939 MPATH_INFO_METRIC |
940 MPATH_INFO_EXPTIME | 940 MPATH_INFO_EXPTIME |
941 MPATH_INFO_DISCOVERY_TIMEOUT | 941 MPATH_INFO_DISCOVERY_TIMEOUT |
@@ -943,7 +943,7 @@ static void mpath_set_pinfo(struct mesh_path *mpath, u8 *next_hop,
943 MPATH_INFO_FLAGS; 943 MPATH_INFO_FLAGS;
944 944
945 pinfo->frame_qlen = mpath->frame_queue.qlen; 945 pinfo->frame_qlen = mpath->frame_queue.qlen;
946 pinfo->dsn = mpath->dsn; 946 pinfo->sn = mpath->sn;
947 pinfo->metric = mpath->metric; 947 pinfo->metric = mpath->metric;
948 if (time_before(jiffies, mpath->exp_time)) 948 if (time_before(jiffies, mpath->exp_time))
949 pinfo->exptime = jiffies_to_msecs(mpath->exp_time - jiffies); 949 pinfo->exptime = jiffies_to_msecs(mpath->exp_time - jiffies);
@@ -955,8 +955,8 @@ static void mpath_set_pinfo(struct mesh_path *mpath, u8 *next_hop,
955 pinfo->flags |= NL80211_MPATH_FLAG_ACTIVE; 955 pinfo->flags |= NL80211_MPATH_FLAG_ACTIVE;
956 if (mpath->flags & MESH_PATH_RESOLVING) 956 if (mpath->flags & MESH_PATH_RESOLVING)
957 pinfo->flags |= NL80211_MPATH_FLAG_RESOLVING; 957 pinfo->flags |= NL80211_MPATH_FLAG_RESOLVING;
958 if (mpath->flags & MESH_PATH_DSN_VALID) 958 if (mpath->flags & MESH_PATH_SN_VALID)
959 pinfo->flags |= NL80211_MPATH_FLAG_DSN_VALID; 959 pinfo->flags |= NL80211_MPATH_FLAG_SN_VALID;
960 if (mpath->flags & MESH_PATH_FIXED) 960 if (mpath->flags & MESH_PATH_FIXED)
961 pinfo->flags |= NL80211_MPATH_FLAG_FIXED; 961 pinfo->flags |= NL80211_MPATH_FLAG_FIXED;
962 if (mpath->flags & MESH_PATH_RESOLVING) 962 if (mpath->flags & MESH_PATH_RESOLVING)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 2a7d3d4067e1..fb54ddb9b27d 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -373,14 +373,14 @@ struct ieee80211_if_mesh {
373 u8 mesh_sp_id; 373 u8 mesh_sp_id;
374 /* Authentication Protocol Identifier */ 374 /* Authentication Protocol Identifier */
375 u8 mesh_auth_id; 375 u8 mesh_auth_id;
376 /* Local mesh Destination Sequence Number */ 376 /* Local mesh Sequence Number */
377 u32 dsn; 377 u32 sn;
378 /* Last used PREQ ID */ 378 /* Last used PREQ ID */
379 u32 preq_id; 379 u32 preq_id;
380 atomic_t mpaths; 380 atomic_t mpaths;
381 /* Timestamp of last DSN update */ 381 /* Timestamp of last SN update */
382 unsigned long last_dsn_update; 382 unsigned long last_sn_update;
383 /* Timestamp of last DSN sent */ 383 /* Timestamp of last SN sent */
384 unsigned long last_preq; 384 unsigned long last_preq;
385 struct mesh_rmc *rmc; 385 struct mesh_rmc *rmc;
386 spinlock_t mesh_preq_queue_lock; 386 spinlock_t mesh_preq_queue_lock;
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 222a31338390..0f3e1147ec4f 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -672,7 +672,7 @@ void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
672 MESH_MIN_DISCOVERY_TIMEOUT; 672 MESH_MIN_DISCOVERY_TIMEOUT;
673 ifmsh->accepting_plinks = true; 673 ifmsh->accepting_plinks = true;
674 ifmsh->preq_id = 0; 674 ifmsh->preq_id = 0;
675 ifmsh->dsn = 0; 675 ifmsh->sn = 0;
676 atomic_set(&ifmsh->mpaths, 0); 676 atomic_set(&ifmsh->mpaths, 0);
677 mesh_rmc_init(sdata); 677 mesh_rmc_init(sdata);
678 ifmsh->last_preq = jiffies; 678 ifmsh->last_preq = jiffies;
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 1d534c702406..ee687add3927 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -26,7 +26,7 @@
26 * 26 *
27 * @MESH_PATH_ACTIVE: the mesh path can be used for forwarding 27 * @MESH_PATH_ACTIVE: the mesh path can be used for forwarding
28 * @MESH_PATH_RESOLVING: the discovery process is running for this mesh path 28 * @MESH_PATH_RESOLVING: the discovery process is running for this mesh path
29 * @MESH_PATH_DSN_VALID: the mesh path contains a valid destination sequence 29 * @MESH_PATH_SN_VALID: the mesh path contains a valid destination sequence
30 * number 30 * number
31 * @MESH_PATH_FIXED: the mesh path has been manually set and should not be 31 * @MESH_PATH_FIXED: the mesh path has been manually set and should not be
32 * modified 32 * modified
@@ -38,7 +38,7 @@
38enum mesh_path_flags { 38enum mesh_path_flags {
39 MESH_PATH_ACTIVE = BIT(0), 39 MESH_PATH_ACTIVE = BIT(0),
40 MESH_PATH_RESOLVING = BIT(1), 40 MESH_PATH_RESOLVING = BIT(1),
41 MESH_PATH_DSN_VALID = BIT(2), 41 MESH_PATH_SN_VALID = BIT(2),
42 MESH_PATH_FIXED = BIT(3), 42 MESH_PATH_FIXED = BIT(3),
43 MESH_PATH_RESOLVED = BIT(4), 43 MESH_PATH_RESOLVED = BIT(4),
44}; 44};
@@ -70,7 +70,7 @@ enum mesh_deferred_task_flags {
70 * @timer: mesh path discovery timer 70 * @timer: mesh path discovery timer
71 * @frame_queue: pending queue for frames sent to this destination while the 71 * @frame_queue: pending queue for frames sent to this destination while the
72 * path is unresolved 72 * path is unresolved
73 * @dsn: destination sequence number of the destination 73 * @sn: target sequence number
74 * @metric: current metric to this destination 74 * @metric: current metric to this destination
75 * @hop_count: hops to destination 75 * @hop_count: hops to destination
76 * @exp_time: in jiffies, when the path will expire or when it expired 76 * @exp_time: in jiffies, when the path will expire or when it expired
@@ -94,7 +94,7 @@ struct mesh_path {
94 struct timer_list timer; 94 struct timer_list timer;
95 struct sk_buff_head frame_queue; 95 struct sk_buff_head frame_queue;
96 struct rcu_head rcu; 96 struct rcu_head rcu;
97 u32 dsn; 97 u32 sn;
98 u32 metric; 98 u32 metric;
99 u8 hop_count; 99 u8 hop_count;
100 unsigned long exp_time; 100 unsigned long exp_time;
@@ -280,7 +280,7 @@ void mesh_mpp_table_grow(void);
280u32 mesh_table_hash(u8 *addr, struct ieee80211_sub_if_data *sdata, 280u32 mesh_table_hash(u8 *addr, struct ieee80211_sub_if_data *sdata,
281 struct mesh_table *tbl); 281 struct mesh_table *tbl);
282/* Mesh paths */ 282/* Mesh paths */
283int mesh_path_error_tx(u8 ttl, u8 *dest, __le32 dest_dsn, __le16 dest_rcode, 283int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn, __le16 target_rcode,
284 u8 *ra, struct ieee80211_sub_if_data *sdata); 284 u8 *ra, struct ieee80211_sub_if_data *sdata);
285void mesh_path_assign_nexthop(struct mesh_path *mpath, struct sta_info *sta); 285void mesh_path_assign_nexthop(struct mesh_path *mpath, struct sta_info *sta);
286void mesh_path_flush_pending(struct mesh_path *mpath); 286void mesh_path_flush_pending(struct mesh_path *mpath);
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 7d36f3a741a5..f03a27dfd616 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -56,33 +56,33 @@ static inline u32 u16_field_get(u8 *preq_elem, int offset, bool ae)
56#define PREQ_IE_TTL(x) (*(x + 2)) 56#define PREQ_IE_TTL(x) (*(x + 2))
57#define PREQ_IE_PREQ_ID(x) u32_field_get(x, 3, 0) 57#define PREQ_IE_PREQ_ID(x) u32_field_get(x, 3, 0)
58#define PREQ_IE_ORIG_ADDR(x) (x + 7) 58#define PREQ_IE_ORIG_ADDR(x) (x + 7)
59#define PREQ_IE_ORIG_DSN(x) u32_field_get(x, 13, 0); 59#define PREQ_IE_ORIG_SN(x) u32_field_get(x, 13, 0);
60#define PREQ_IE_LIFETIME(x) u32_field_get(x, 17, AE_F_SET(x)); 60#define PREQ_IE_LIFETIME(x) u32_field_get(x, 17, AE_F_SET(x));
61#define PREQ_IE_METRIC(x) u32_field_get(x, 21, AE_F_SET(x)); 61#define PREQ_IE_METRIC(x) u32_field_get(x, 21, AE_F_SET(x));
62#define PREQ_IE_DST_F(x) (*(AE_F_SET(x) ? x + 32 : x + 26)) 62#define PREQ_IE_TARGET_F(x) (*(AE_F_SET(x) ? x + 32 : x + 26))
63#define PREQ_IE_DST_ADDR(x) (AE_F_SET(x) ? x + 33 : x + 27) 63#define PREQ_IE_TARGET_ADDR(x) (AE_F_SET(x) ? x + 33 : x + 27)
64#define PREQ_IE_DST_DSN(x) u32_field_get(x, 33, AE_F_SET(x)); 64#define PREQ_IE_TARGET_SN(x) u32_field_get(x, 33, AE_F_SET(x));
65 65
66 66
67#define PREP_IE_FLAGS(x) PREQ_IE_FLAGS(x) 67#define PREP_IE_FLAGS(x) PREQ_IE_FLAGS(x)
68#define PREP_IE_HOPCOUNT(x) PREQ_IE_HOPCOUNT(x) 68#define PREP_IE_HOPCOUNT(x) PREQ_IE_HOPCOUNT(x)
69#define PREP_IE_TTL(x) PREQ_IE_TTL(x) 69#define PREP_IE_TTL(x) PREQ_IE_TTL(x)
70#define PREP_IE_ORIG_ADDR(x) (x + 3) 70#define PREP_IE_ORIG_ADDR(x) (x + 3)
71#define PREP_IE_ORIG_DSN(x) u32_field_get(x, 9, 0); 71#define PREP_IE_ORIG_SN(x) u32_field_get(x, 9, 0);
72#define PREP_IE_LIFETIME(x) u32_field_get(x, 13, AE_F_SET(x)); 72#define PREP_IE_LIFETIME(x) u32_field_get(x, 13, AE_F_SET(x));
73#define PREP_IE_METRIC(x) u32_field_get(x, 17, AE_F_SET(x)); 73#define PREP_IE_METRIC(x) u32_field_get(x, 17, AE_F_SET(x));
74#define PREP_IE_DST_ADDR(x) (AE_F_SET(x) ? x + 27 : x + 21) 74#define PREP_IE_TARGET_ADDR(x) (AE_F_SET(x) ? x + 27 : x + 21)
75#define PREP_IE_DST_DSN(x) u32_field_get(x, 27, AE_F_SET(x)); 75#define PREP_IE_TARGET_SN(x) u32_field_get(x, 27, AE_F_SET(x));
76 76
77#define PERR_IE_TTL(x) (*(x)) 77#define PERR_IE_TTL(x) (*(x))
78#define PERR_IE_DST_FLAGS(x) (*(x + 2)) 78#define PERR_IE_TARGET_FLAGS(x) (*(x + 2))
79#define PERR_IE_DST_ADDR(x) (x + 3) 79#define PERR_IE_TARGET_ADDR(x) (x + 3)
80#define PERR_IE_DST_DSN(x) u32_field_get(x, 9, 0); 80#define PERR_IE_TARGET_SN(x) u32_field_get(x, 9, 0);
81#define PERR_IE_DST_RCODE(x) u16_field_get(x, 13, 0); 81#define PERR_IE_TARGET_RCODE(x) u16_field_get(x, 13, 0);
82 82
83#define MSEC_TO_TU(x) (x*1000/1024) 83#define MSEC_TO_TU(x) (x*1000/1024)
84#define DSN_GT(x, y) ((long) (y) - (long) (x) < 0) 84#define SN_GT(x, y) ((long) (y) - (long) (x) < 0)
85#define DSN_LT(x, y) ((long) (x) - (long) (y) < 0) 85#define SN_LT(x, y) ((long) (x) - (long) (y) < 0)
86 86
87#define net_traversal_jiffies(s) \ 87#define net_traversal_jiffies(s) \
88 msecs_to_jiffies(s->u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime) 88 msecs_to_jiffies(s->u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime)
@@ -102,9 +102,10 @@ enum mpath_frame_type {
102}; 102};
103 103
104static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags, 104static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,
105 u8 *orig_addr, __le32 orig_dsn, u8 dst_flags, u8 *dst, 105 u8 *orig_addr, __le32 orig_sn, u8 target_flags, u8 *target,
106 __le32 dst_dsn, u8 *da, u8 hop_count, u8 ttl, __le32 lifetime, 106 __le32 target_sn, u8 *da, u8 hop_count, u8 ttl,__le32 lifetime,
107 __le32 metric, __le32 preq_id, struct ieee80211_sub_if_data *sdata) 107 __le32 metric, __le32 preq_id,
108 struct ieee80211_sub_if_data *sdata)
108{ 109{
109 struct ieee80211_local *local = sdata->local; 110 struct ieee80211_local *local = sdata->local;
110 struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400); 111 struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400);
@@ -133,13 +134,13 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,
133 134
134 switch (action) { 135 switch (action) {
135 case MPATH_PREQ: 136 case MPATH_PREQ:
136 mhwmp_dbg("sending PREQ to %pM\n", dst); 137 mhwmp_dbg("sending PREQ to %pM\n", target);
137 ie_len = 37; 138 ie_len = 37;
138 pos = skb_put(skb, 2 + ie_len); 139 pos = skb_put(skb, 2 + ie_len);
139 *pos++ = WLAN_EID_PREQ; 140 *pos++ = WLAN_EID_PREQ;
140 break; 141 break;
141 case MPATH_PREP: 142 case MPATH_PREP:
142 mhwmp_dbg("sending PREP to %pM\n", dst); 143 mhwmp_dbg("sending PREP to %pM\n", target);
143 ie_len = 31; 144 ie_len = 31;
144 pos = skb_put(skb, 2 + ie_len); 145 pos = skb_put(skb, 2 + ie_len);
145 *pos++ = WLAN_EID_PREP; 146 *pos++ = WLAN_EID_PREP;
@@ -165,7 +166,7 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,
165 } 166 }
166 memcpy(pos, orig_addr, ETH_ALEN); 167 memcpy(pos, orig_addr, ETH_ALEN);
167 pos += ETH_ALEN; 168 pos += ETH_ALEN;
168 memcpy(pos, &orig_dsn, 4); 169 memcpy(pos, &orig_sn, 4);
169 pos += 4; 170 pos += 4;
170 if (action != MPATH_RANN) { 171 if (action != MPATH_RANN) {
171 memcpy(pos, &lifetime, 4); 172 memcpy(pos, &lifetime, 4);
@@ -176,12 +177,12 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,
176 if (action == MPATH_PREQ) { 177 if (action == MPATH_PREQ) {
177 /* destination count */ 178 /* destination count */
178 *pos++ = 1; 179 *pos++ = 1;
179 *pos++ = dst_flags; 180 *pos++ = target_flags;
180 } 181 }
181 if (action != MPATH_RANN) { 182 if (action != MPATH_RANN) {
182 memcpy(pos, dst, ETH_ALEN); 183 memcpy(pos, target, ETH_ALEN);
183 pos += ETH_ALEN; 184 pos += ETH_ALEN;
184 memcpy(pos, &dst_dsn, 4); 185 memcpy(pos, &target_sn, 4);
185 } 186 }
186 187
187 ieee80211_tx_skb(sdata, skb, 1); 188 ieee80211_tx_skb(sdata, skb, 1);
@@ -191,12 +192,14 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,
191/** 192/**
192 * mesh_send_path error - Sends a PERR mesh management frame 193 * mesh_send_path error - Sends a PERR mesh management frame
193 * 194 *
194 * @dst: broken destination 195 * @target: broken destination
195 * @dst_dsn: dsn of the broken destination 196 * @target_sn: SN of the broken destination
197 * @target_rcode: reason code for this PERR
196 * @ra: node this frame is addressed to 198 * @ra: node this frame is addressed to
197 */ 199 */
198int mesh_path_error_tx(u8 ttl, u8 *dst, __le32 dst_dsn, __le16 dst_rcode, 200int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn,
199 u8 *ra, struct ieee80211_sub_if_data *sdata) 201 __le16 target_rcode, u8 *ra,
202 struct ieee80211_sub_if_data *sdata)
200{ 203{
201 struct ieee80211_local *local = sdata->local; 204 struct ieee80211_local *local = sdata->local;
202 struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400); 205 struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400);
@@ -234,16 +237,16 @@ int mesh_path_error_tx(u8 ttl, u8 *dst, __le32 dst_dsn, __le16 dst_rcode,
234 * bit 2 is set if we have a reason code 237 * bit 2 is set if we have a reason code
235 */ 238 */
236 *pos = 0; 239 *pos = 0;
237 if (!dst_dsn) 240 if (!target_sn)
238 *pos |= MP_F_USN; 241 *pos |= MP_F_USN;
239 if (dst_rcode) 242 if (target_rcode)
240 *pos |= MP_F_RCODE; 243 *pos |= MP_F_RCODE;
241 pos++; 244 pos++;
242 memcpy(pos, dst, ETH_ALEN); 245 memcpy(pos, target, ETH_ALEN);
243 pos += ETH_ALEN; 246 pos += ETH_ALEN;
244 memcpy(pos, &dst_dsn, 4); 247 memcpy(pos, &target_sn, 4);
245 pos += 4; 248 pos += 4;
246 memcpy(pos, &dst_rcode, 2); 249 memcpy(pos, &target_rcode, 2);
247 250
248 ieee80211_tx_skb(sdata, skb, 1); 251 ieee80211_tx_skb(sdata, skb, 1);
249 return 0; 252 return 0;
@@ -324,7 +327,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
324 struct sta_info *sta; 327 struct sta_info *sta;
325 bool fresh_info; 328 bool fresh_info;
326 u8 *orig_addr, *ta; 329 u8 *orig_addr, *ta;
327 u32 orig_dsn, orig_metric; 330 u32 orig_sn, orig_metric;
328 unsigned long orig_lifetime, exp_time; 331 unsigned long orig_lifetime, exp_time;
329 u32 last_hop_metric, new_metric; 332 u32 last_hop_metric, new_metric;
330 bool process = true; 333 bool process = true;
@@ -343,7 +346,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
343 switch (action) { 346 switch (action) {
344 case MPATH_PREQ: 347 case MPATH_PREQ:
345 orig_addr = PREQ_IE_ORIG_ADDR(hwmp_ie); 348 orig_addr = PREQ_IE_ORIG_ADDR(hwmp_ie);
346 orig_dsn = PREQ_IE_ORIG_DSN(hwmp_ie); 349 orig_sn = PREQ_IE_ORIG_SN(hwmp_ie);
347 orig_lifetime = PREQ_IE_LIFETIME(hwmp_ie); 350 orig_lifetime = PREQ_IE_LIFETIME(hwmp_ie);
348 orig_metric = PREQ_IE_METRIC(hwmp_ie); 351 orig_metric = PREQ_IE_METRIC(hwmp_ie);
349 break; 352 break;
@@ -356,7 +359,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
356 * information from both PREQ and PREP frames. 359 * information from both PREQ and PREP frames.
357 */ 360 */
358 orig_addr = PREP_IE_ORIG_ADDR(hwmp_ie); 361 orig_addr = PREP_IE_ORIG_ADDR(hwmp_ie);
359 orig_dsn = PREP_IE_ORIG_DSN(hwmp_ie); 362 orig_sn = PREP_IE_ORIG_SN(hwmp_ie);
360 orig_lifetime = PREP_IE_LIFETIME(hwmp_ie); 363 orig_lifetime = PREP_IE_LIFETIME(hwmp_ie);
361 orig_metric = PREP_IE_METRIC(hwmp_ie); 364 orig_metric = PREP_IE_METRIC(hwmp_ie);
362 break; 365 break;
@@ -382,9 +385,9 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
382 if (mpath->flags & MESH_PATH_FIXED) 385 if (mpath->flags & MESH_PATH_FIXED)
383 fresh_info = false; 386 fresh_info = false;
384 else if ((mpath->flags & MESH_PATH_ACTIVE) && 387 else if ((mpath->flags & MESH_PATH_ACTIVE) &&
385 (mpath->flags & MESH_PATH_DSN_VALID)) { 388 (mpath->flags & MESH_PATH_SN_VALID)) {
386 if (DSN_GT(mpath->dsn, orig_dsn) || 389 if (SN_GT(mpath->sn, orig_sn) ||
387 (mpath->dsn == orig_dsn && 390 (mpath->sn == orig_sn &&
388 action == MPATH_PREQ && 391 action == MPATH_PREQ &&
389 new_metric > mpath->metric)) { 392 new_metric > mpath->metric)) {
390 process = false; 393 process = false;
@@ -403,9 +406,9 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
403 406
404 if (fresh_info) { 407 if (fresh_info) {
405 mesh_path_assign_nexthop(mpath, sta); 408 mesh_path_assign_nexthop(mpath, sta);
406 mpath->flags |= MESH_PATH_DSN_VALID; 409 mpath->flags |= MESH_PATH_SN_VALID;
407 mpath->metric = new_metric; 410 mpath->metric = new_metric;
408 mpath->dsn = orig_dsn; 411 mpath->sn = orig_sn;
409 mpath->exp_time = time_after(mpath->exp_time, exp_time) 412 mpath->exp_time = time_after(mpath->exp_time, exp_time)
410 ? mpath->exp_time : exp_time; 413 ? mpath->exp_time : exp_time;
411 mesh_path_activate(mpath); 414 mesh_path_activate(mpath);
@@ -444,7 +447,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
444 447
445 if (fresh_info) { 448 if (fresh_info) {
446 mesh_path_assign_nexthop(mpath, sta); 449 mesh_path_assign_nexthop(mpath, sta);
447 mpath->flags &= ~MESH_PATH_DSN_VALID; 450 mpath->flags &= ~MESH_PATH_SN_VALID;
448 mpath->metric = last_hop_metric; 451 mpath->metric = last_hop_metric;
449 mpath->exp_time = time_after(mpath->exp_time, exp_time) 452 mpath->exp_time = time_after(mpath->exp_time, exp_time)
450 ? mpath->exp_time : exp_time; 453 ? mpath->exp_time : exp_time;
@@ -466,47 +469,47 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
466{ 469{
467 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 470 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
468 struct mesh_path *mpath; 471 struct mesh_path *mpath;
469 u8 *dst_addr, *orig_addr; 472 u8 *target_addr, *orig_addr;
470 u8 dst_flags, ttl; 473 u8 target_flags, ttl;
471 u32 orig_dsn, dst_dsn, lifetime; 474 u32 orig_sn, target_sn, lifetime;
472 bool reply = false; 475 bool reply = false;
473 bool forward = true; 476 bool forward = true;
474 477
475 /* Update destination DSN, if present */ 478 /* Update target SN, if present */
476 dst_addr = PREQ_IE_DST_ADDR(preq_elem); 479 target_addr = PREQ_IE_TARGET_ADDR(preq_elem);
477 orig_addr = PREQ_IE_ORIG_ADDR(preq_elem); 480 orig_addr = PREQ_IE_ORIG_ADDR(preq_elem);
478 dst_dsn = PREQ_IE_DST_DSN(preq_elem); 481 target_sn = PREQ_IE_TARGET_SN(preq_elem);
479 orig_dsn = PREQ_IE_ORIG_DSN(preq_elem); 482 orig_sn = PREQ_IE_ORIG_SN(preq_elem);
480 dst_flags = PREQ_IE_DST_F(preq_elem); 483 target_flags = PREQ_IE_TARGET_F(preq_elem);
481 484
482 mhwmp_dbg("received PREQ from %pM\n", orig_addr); 485 mhwmp_dbg("received PREQ from %pM\n", orig_addr);
483 486
484 if (memcmp(dst_addr, sdata->dev->dev_addr, ETH_ALEN) == 0) { 487 if (memcmp(target_addr, sdata->dev->dev_addr, ETH_ALEN) == 0) {
485 mhwmp_dbg("PREQ is for us\n"); 488 mhwmp_dbg("PREQ is for us\n");
486 forward = false; 489 forward = false;
487 reply = true; 490 reply = true;
488 metric = 0; 491 metric = 0;
489 if (time_after(jiffies, ifmsh->last_dsn_update + 492 if (time_after(jiffies, ifmsh->last_sn_update +
490 net_traversal_jiffies(sdata)) || 493 net_traversal_jiffies(sdata)) ||
491 time_before(jiffies, ifmsh->last_dsn_update)) { 494 time_before(jiffies, ifmsh->last_sn_update)) {
492 dst_dsn = ++ifmsh->dsn; 495 target_sn = ++ifmsh->sn;
493 ifmsh->last_dsn_update = jiffies; 496 ifmsh->last_sn_update = jiffies;
494 } 497 }
495 } else { 498 } else {
496 rcu_read_lock(); 499 rcu_read_lock();
497 mpath = mesh_path_lookup(dst_addr, sdata); 500 mpath = mesh_path_lookup(target_addr, sdata);
498 if (mpath) { 501 if (mpath) {
499 if ((!(mpath->flags & MESH_PATH_DSN_VALID)) || 502 if ((!(mpath->flags & MESH_PATH_SN_VALID)) ||
500 DSN_LT(mpath->dsn, dst_dsn)) { 503 SN_LT(mpath->sn, target_sn)) {
501 mpath->dsn = dst_dsn; 504 mpath->sn = target_sn;
502 mpath->flags |= MESH_PATH_DSN_VALID; 505 mpath->flags |= MESH_PATH_SN_VALID;
503 } else if ((!(dst_flags & MP_F_DO)) && 506 } else if ((!(target_flags & MP_F_DO)) &&
504 (mpath->flags & MESH_PATH_ACTIVE)) { 507 (mpath->flags & MESH_PATH_ACTIVE)) {
505 reply = true; 508 reply = true;
506 metric = mpath->metric; 509 metric = mpath->metric;
507 dst_dsn = mpath->dsn; 510 target_sn = mpath->sn;
508 if (dst_flags & MP_F_RF) 511 if (target_flags & MP_F_RF)
509 dst_flags |= MP_F_DO; 512 target_flags |= MP_F_DO;
510 else 513 else
511 forward = false; 514 forward = false;
512 } 515 }
@@ -519,9 +522,9 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
519 ttl = ifmsh->mshcfg.dot11MeshTTL; 522 ttl = ifmsh->mshcfg.dot11MeshTTL;
520 if (ttl != 0) { 523 if (ttl != 0) {
521 mhwmp_dbg("replying to the PREQ\n"); 524 mhwmp_dbg("replying to the PREQ\n");
522 mesh_path_sel_frame_tx(MPATH_PREP, 0, dst_addr, 525 mesh_path_sel_frame_tx(MPATH_PREP, 0, target_addr,
523 cpu_to_le32(dst_dsn), 0, orig_addr, 526 cpu_to_le32(target_sn), 0, orig_addr,
524 cpu_to_le32(orig_dsn), mgmt->sa, 0, ttl, 527 cpu_to_le32(orig_sn), mgmt->sa, 0, ttl,
525 cpu_to_le32(lifetime), cpu_to_le32(metric), 528 cpu_to_le32(lifetime), cpu_to_le32(metric),
526 0, sdata); 529 0, sdata);
527 } else 530 } else
@@ -544,8 +547,8 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
544 preq_id = PREQ_IE_PREQ_ID(preq_elem); 547 preq_id = PREQ_IE_PREQ_ID(preq_elem);
545 hopcount = PREQ_IE_HOPCOUNT(preq_elem) + 1; 548 hopcount = PREQ_IE_HOPCOUNT(preq_elem) + 1;
546 mesh_path_sel_frame_tx(MPATH_PREQ, flags, orig_addr, 549 mesh_path_sel_frame_tx(MPATH_PREQ, flags, orig_addr,
547 cpu_to_le32(orig_dsn), dst_flags, dst_addr, 550 cpu_to_le32(orig_sn), target_flags, target_addr,
548 cpu_to_le32(dst_dsn), sdata->dev->broadcast, 551 cpu_to_le32(target_sn), sdata->dev->broadcast,
549 hopcount, ttl, cpu_to_le32(lifetime), 552 hopcount, ttl, cpu_to_le32(lifetime),
550 cpu_to_le32(metric), cpu_to_le32(preq_id), 553 cpu_to_le32(metric), cpu_to_le32(preq_id),
551 sdata); 554 sdata);
@@ -560,10 +563,10 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,
560 u8 *prep_elem, u32 metric) 563 u8 *prep_elem, u32 metric)
561{ 564{
562 struct mesh_path *mpath; 565 struct mesh_path *mpath;
563 u8 *dst_addr, *orig_addr; 566 u8 *target_addr, *orig_addr;
564 u8 ttl, hopcount, flags; 567 u8 ttl, hopcount, flags;
565 u8 next_hop[ETH_ALEN]; 568 u8 next_hop[ETH_ALEN];
566 u32 dst_dsn, orig_dsn, lifetime; 569 u32 target_sn, orig_sn, lifetime;
567 570
568 mhwmp_dbg("received PREP from %pM\n", PREP_IE_ORIG_ADDR(prep_elem)); 571 mhwmp_dbg("received PREP from %pM\n", PREP_IE_ORIG_ADDR(prep_elem));
569 572
@@ -573,8 +576,8 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,
573 * which corresponds with the originator of the PREQ which this PREP 576 * which corresponds with the originator of the PREQ which this PREP
574 * replies 577 * replies
575 */ 578 */
576 dst_addr = PREP_IE_DST_ADDR(prep_elem); 579 target_addr = PREP_IE_TARGET_ADDR(prep_elem);
577 if (memcmp(dst_addr, sdata->dev->dev_addr, ETH_ALEN) == 0) 580 if (memcmp(target_addr, sdata->dev->dev_addr, ETH_ALEN) == 0)
578 /* destination, no forwarding required */ 581 /* destination, no forwarding required */
579 return; 582 return;
580 583
@@ -585,7 +588,7 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,
585 } 588 }
586 589
587 rcu_read_lock(); 590 rcu_read_lock();
588 mpath = mesh_path_lookup(dst_addr, sdata); 591 mpath = mesh_path_lookup(target_addr, sdata);
589 if (mpath) 592 if (mpath)
590 spin_lock_bh(&mpath->state_lock); 593 spin_lock_bh(&mpath->state_lock);
591 else 594 else
@@ -601,13 +604,13 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,
601 lifetime = PREP_IE_LIFETIME(prep_elem); 604 lifetime = PREP_IE_LIFETIME(prep_elem);
602 hopcount = PREP_IE_HOPCOUNT(prep_elem) + 1; 605 hopcount = PREP_IE_HOPCOUNT(prep_elem) + 1;
603 orig_addr = PREP_IE_ORIG_ADDR(prep_elem); 606 orig_addr = PREP_IE_ORIG_ADDR(prep_elem);
604 dst_dsn = PREP_IE_DST_DSN(prep_elem); 607 target_sn = PREP_IE_TARGET_SN(prep_elem);
605 orig_dsn = PREP_IE_ORIG_DSN(prep_elem); 608 orig_sn = PREP_IE_ORIG_SN(prep_elem);
606 609
607 mesh_path_sel_frame_tx(MPATH_PREP, flags, orig_addr, 610 mesh_path_sel_frame_tx(MPATH_PREP, flags, orig_addr,
608 cpu_to_le32(orig_dsn), 0, dst_addr, 611 cpu_to_le32(orig_sn), 0, target_addr,
609 cpu_to_le32(dst_dsn), mpath->next_hop->sta.addr, hopcount, ttl, 612 cpu_to_le32(target_sn), mpath->next_hop->sta.addr, hopcount,
610 cpu_to_le32(lifetime), cpu_to_le32(metric), 613 ttl, cpu_to_le32(lifetime), cpu_to_le32(metric),
611 0, sdata); 614 0, sdata);
612 rcu_read_unlock(); 615 rcu_read_unlock();
613 616
@@ -627,10 +630,10 @@ static void hwmp_perr_frame_process(struct ieee80211_sub_if_data *sdata,
627 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 630 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
628 struct mesh_path *mpath; 631 struct mesh_path *mpath;
629 u8 ttl; 632 u8 ttl;
630 u8 *ta, *dst_addr; 633 u8 *ta, *target_addr;
631 u8 dst_flags; 634 u8 target_flags;
632 u32 dst_dsn; 635 u32 target_sn;
633 u16 dst_rcode; 636 u16 target_rcode;
634 637
635 ta = mgmt->sa; 638 ta = mgmt->sa;
636 ttl = PERR_IE_TTL(perr_elem); 639 ttl = PERR_IE_TTL(perr_elem);
@@ -639,24 +642,24 @@ static void hwmp_perr_frame_process(struct ieee80211_sub_if_data *sdata,
639 return; 642 return;
640 } 643 }
641 ttl--; 644 ttl--;
642 dst_flags = PERR_IE_DST_FLAGS(perr_elem); 645 target_flags = PERR_IE_TARGET_FLAGS(perr_elem);
643 dst_addr = PERR_IE_DST_ADDR(perr_elem); 646 target_addr = PERR_IE_TARGET_ADDR(perr_elem);
644 dst_dsn = PERR_IE_DST_DSN(perr_elem); 647 target_sn = PERR_IE_TARGET_SN(perr_elem);
645 dst_rcode = PERR_IE_DST_RCODE(perr_elem); 648 target_rcode = PERR_IE_TARGET_RCODE(perr_elem);
646 649
647 rcu_read_lock(); 650 rcu_read_lock();
648 mpath = mesh_path_lookup(dst_addr, sdata); 651 mpath = mesh_path_lookup(target_addr, sdata);
649 if (mpath) { 652 if (mpath) {
650 spin_lock_bh(&mpath->state_lock); 653 spin_lock_bh(&mpath->state_lock);
651 if (mpath->flags & MESH_PATH_ACTIVE && 654 if (mpath->flags & MESH_PATH_ACTIVE &&
652 memcmp(ta, mpath->next_hop->sta.addr, ETH_ALEN) == 0 && 655 memcmp(ta, mpath->next_hop->sta.addr, ETH_ALEN) == 0 &&
653 (!(mpath->flags & MESH_PATH_DSN_VALID) || 656 (!(mpath->flags & MESH_PATH_SN_VALID) ||
654 DSN_GT(dst_dsn, mpath->dsn))) { 657 SN_GT(target_sn, mpath->sn))) {
655 mpath->flags &= ~MESH_PATH_ACTIVE; 658 mpath->flags &= ~MESH_PATH_ACTIVE;
656 mpath->dsn = dst_dsn; 659 mpath->sn = target_sn;
657 spin_unlock_bh(&mpath->state_lock); 660 spin_unlock_bh(&mpath->state_lock);
658 mesh_path_error_tx(ttl, dst_addr, cpu_to_le32(dst_dsn), 661 mesh_path_error_tx(ttl, target_addr, cpu_to_le32(target_sn),
659 cpu_to_le16(dst_rcode), 662 cpu_to_le16(target_rcode),
660 sdata->dev->broadcast, sdata); 663 sdata->dev->broadcast, sdata);
661 } else 664 } else
662 spin_unlock_bh(&mpath->state_lock); 665 spin_unlock_bh(&mpath->state_lock);
@@ -673,7 +676,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
673 u8 *ta; 676 u8 *ta;
674 u8 ttl, flags, hopcount; 677 u8 ttl, flags, hopcount;
675 u8 *orig_addr; 678 u8 *orig_addr;
676 u32 orig_dsn, metric; 679 u32 orig_sn, metric;
677 680
678 ta = mgmt->sa; 681 ta = mgmt->sa;
679 ttl = rann->rann_ttl; 682 ttl = rann->rann_ttl;
@@ -684,7 +687,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
684 ttl--; 687 ttl--;
685 flags = rann->rann_flags; 688 flags = rann->rann_flags;
686 orig_addr = rann->rann_addr; 689 orig_addr = rann->rann_addr;
687 orig_dsn = rann->rann_seq; 690 orig_sn = rann->rann_seq;
688 hopcount = rann->rann_hopcount; 691 hopcount = rann->rann_hopcount;
689 hopcount++; 692 hopcount++;
690 metric = rann->rann_metric; 693 metric = rann->rann_metric;
@@ -703,14 +706,14 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
703 mesh_queue_preq(mpath, 706 mesh_queue_preq(mpath,
704 PREQ_Q_F_START | PREQ_Q_F_REFRESH); 707 PREQ_Q_F_START | PREQ_Q_F_REFRESH);
705 } 708 }
706 if (mpath->dsn < orig_dsn) { 709 if (mpath->sn < orig_sn) {
707 mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr, 710 mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr,
708 cpu_to_le32(orig_dsn), 711 cpu_to_le32(orig_sn),
709 0, NULL, 0, sdata->dev->broadcast, 712 0, NULL, 0, sdata->dev->broadcast,
710 hopcount, ttl, 0, 713 hopcount, ttl, 0,
711 cpu_to_le32(metric + mpath->metric), 714 cpu_to_le32(metric + mpath->metric),
712 0, sdata); 715 0, sdata);
713 mpath->dsn = orig_dsn; 716 mpath->sn = orig_sn;
714 } 717 }
715 rcu_read_unlock(); 718 rcu_read_unlock();
716} 719}
@@ -823,7 +826,7 @@ void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata)
823 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 826 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
824 struct mesh_preq_queue *preq_node; 827 struct mesh_preq_queue *preq_node;
825 struct mesh_path *mpath; 828 struct mesh_path *mpath;
826 u8 ttl, dst_flags; 829 u8 ttl, target_flags;
827 u32 lifetime; 830 u32 lifetime;
828 831
829 spin_lock_bh(&ifmsh->mesh_preq_queue_lock); 832 spin_lock_bh(&ifmsh->mesh_preq_queue_lock);
@@ -865,11 +868,11 @@ void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata)
865 868
866 ifmsh->last_preq = jiffies; 869 ifmsh->last_preq = jiffies;
867 870
868 if (time_after(jiffies, ifmsh->last_dsn_update + 871 if (time_after(jiffies, ifmsh->last_sn_update +
869 net_traversal_jiffies(sdata)) || 872 net_traversal_jiffies(sdata)) ||
870 time_before(jiffies, ifmsh->last_dsn_update)) { 873 time_before(jiffies, ifmsh->last_sn_update)) {
871 ++ifmsh->dsn; 874 ++ifmsh->sn;
872 sdata->u.mesh.last_dsn_update = jiffies; 875 sdata->u.mesh.last_sn_update = jiffies;
873 } 876 }
874 lifetime = default_lifetime(sdata); 877 lifetime = default_lifetime(sdata);
875 ttl = sdata->u.mesh.mshcfg.dot11MeshTTL; 878 ttl = sdata->u.mesh.mshcfg.dot11MeshTTL;
@@ -880,14 +883,14 @@ void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata)
880 } 883 }
881 884
882 if (preq_node->flags & PREQ_Q_F_REFRESH) 885 if (preq_node->flags & PREQ_Q_F_REFRESH)
883 dst_flags = MP_F_DO; 886 target_flags = MP_F_DO;
884 else 887 else
885 dst_flags = MP_F_RF; 888 target_flags = MP_F_RF;
886 889
887 spin_unlock_bh(&mpath->state_lock); 890 spin_unlock_bh(&mpath->state_lock);
888 mesh_path_sel_frame_tx(MPATH_PREQ, 0, sdata->dev->dev_addr, 891 mesh_path_sel_frame_tx(MPATH_PREQ, 0, sdata->dev->dev_addr,
889 cpu_to_le32(ifmsh->dsn), dst_flags, mpath->dst, 892 cpu_to_le32(ifmsh->sn), target_flags, mpath->dst,
890 cpu_to_le32(mpath->dsn), sdata->dev->broadcast, 0, 893 cpu_to_le32(mpath->sn), sdata->dev->broadcast, 0,
891 ttl, cpu_to_le32(lifetime), 0, 894 ttl, cpu_to_le32(lifetime), 0,
892 cpu_to_le32(ifmsh->preq_id++), sdata); 895 cpu_to_le32(ifmsh->preq_id++), sdata);
893 mod_timer(&mpath->timer, jiffies + mpath->discovery_timeout); 896 mod_timer(&mpath->timer, jiffies + mpath->discovery_timeout);
@@ -914,15 +917,15 @@ int mesh_nexthop_lookup(struct sk_buff *skb,
914 struct sk_buff *skb_to_free = NULL; 917 struct sk_buff *skb_to_free = NULL;
915 struct mesh_path *mpath; 918 struct mesh_path *mpath;
916 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 919 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
917 u8 *dst_addr = hdr->addr3; 920 u8 *target_addr = hdr->addr3;
918 int err = 0; 921 int err = 0;
919 922
920 rcu_read_lock(); 923 rcu_read_lock();
921 mpath = mesh_path_lookup(dst_addr, sdata); 924 mpath = mesh_path_lookup(target_addr, sdata);
922 925
923 if (!mpath) { 926 if (!mpath) {
924 mesh_path_add(dst_addr, sdata); 927 mesh_path_add(target_addr, sdata);
925 mpath = mesh_path_lookup(dst_addr, sdata); 928 mpath = mesh_path_lookup(target_addr, sdata);
926 if (!mpath) { 929 if (!mpath) {
927 sdata->u.mesh.mshstats.dropped_frames_no_route++; 930 sdata->u.mesh.mshstats.dropped_frames_no_route++;
928 err = -ENOSPC; 931 err = -ENOSPC;
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index 5d541235ca2f..2cebdf52b7bc 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -463,10 +463,10 @@ void mesh_plink_broken(struct sta_info *sta)
463 mpath->flags & MESH_PATH_ACTIVE && 463 mpath->flags & MESH_PATH_ACTIVE &&
464 !(mpath->flags & MESH_PATH_FIXED)) { 464 !(mpath->flags & MESH_PATH_FIXED)) {
465 mpath->flags &= ~MESH_PATH_ACTIVE; 465 mpath->flags &= ~MESH_PATH_ACTIVE;
466 ++mpath->dsn; 466 ++mpath->sn;
467 spin_unlock_bh(&mpath->state_lock); 467 spin_unlock_bh(&mpath->state_lock);
468 mesh_path_error_tx(MESH_TTL, mpath->dst, 468 mesh_path_error_tx(MESH_TTL, mpath->dst,
469 cpu_to_le32(mpath->dsn), 469 cpu_to_le32(mpath->sn),
470 PERR_RCODE_DEST_UNREACH, 470 PERR_RCODE_DEST_UNREACH,
471 sdata->dev->broadcast, sdata); 471 sdata->dev->broadcast, sdata);
472 } else 472 } else
@@ -602,7 +602,7 @@ void mesh_path_discard_frame(struct sk_buff *skb,
602{ 602{
603 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 603 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
604 struct mesh_path *mpath; 604 struct mesh_path *mpath;
605 u32 dsn = 0; 605 u32 sn = 0;
606 606
607 if (memcmp(hdr->addr4, sdata->dev->dev_addr, ETH_ALEN) != 0) { 607 if (memcmp(hdr->addr4, sdata->dev->dev_addr, ETH_ALEN) != 0) {
608 u8 *ra, *da; 608 u8 *ra, *da;
@@ -611,8 +611,8 @@ void mesh_path_discard_frame(struct sk_buff *skb,
611 ra = hdr->addr1; 611 ra = hdr->addr1;
612 mpath = mesh_path_lookup(da, sdata); 612 mpath = mesh_path_lookup(da, sdata);
613 if (mpath) 613 if (mpath)
614 dsn = ++mpath->dsn; 614 sn = ++mpath->sn;
615 mesh_path_error_tx(MESH_TTL, skb->data, cpu_to_le32(dsn), 615 mesh_path_error_tx(MESH_TTL, skb->data, cpu_to_le32(sn),
616 PERR_RCODE_NO_ROUTE, ra, sdata); 616 PERR_RCODE_NO_ROUTE, ra, sdata);
617 } 617 }
618 618
@@ -648,7 +648,7 @@ void mesh_path_fix_nexthop(struct mesh_path *mpath, struct sta_info *next_hop)
648{ 648{
649 spin_lock_bh(&mpath->state_lock); 649 spin_lock_bh(&mpath->state_lock);
650 mesh_path_assign_nexthop(mpath, next_hop); 650 mesh_path_assign_nexthop(mpath, next_hop);
651 mpath->dsn = 0xffff; 651 mpath->sn = 0xffff;
652 mpath->metric = 0; 652 mpath->metric = 0;
653 mpath->hop_count = 0; 653 mpath->hop_count = 0;
654 mpath->exp_time = 0; 654 mpath->exp_time = 0;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 8c8e4eae6a17..7c1999872503 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2116,9 +2116,9 @@ static int nl80211_send_mpath(struct sk_buff *msg, u32 pid, u32 seq,
2116 if (pinfo->filled & MPATH_INFO_FRAME_QLEN) 2116 if (pinfo->filled & MPATH_INFO_FRAME_QLEN)
2117 NLA_PUT_U32(msg, NL80211_MPATH_INFO_FRAME_QLEN, 2117 NLA_PUT_U32(msg, NL80211_MPATH_INFO_FRAME_QLEN,
2118 pinfo->frame_qlen); 2118 pinfo->frame_qlen);
2119 if (pinfo->filled & MPATH_INFO_DSN) 2119 if (pinfo->filled & MPATH_INFO_SN)
2120 NLA_PUT_U32(msg, NL80211_MPATH_INFO_DSN, 2120 NLA_PUT_U32(msg, NL80211_MPATH_INFO_SN,
2121 pinfo->dsn); 2121 pinfo->sn);
2122 if (pinfo->filled & MPATH_INFO_METRIC) 2122 if (pinfo->filled & MPATH_INFO_METRIC)
2123 NLA_PUT_U32(msg, NL80211_MPATH_INFO_METRIC, 2123 NLA_PUT_U32(msg, NL80211_MPATH_INFO_METRIC,
2124 pinfo->metric); 2124 pinfo->metric);