Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mac80211: mesh process the target only subfield for mesh hwmp

This patch does the following:
- Remove unnecessary flags field used by PERR element
- Use the per target flags defined in <linux/ieee80211.h>
- Process the target only subfield based on case E2 of
IEEE802.11-2012 13.10.9.3

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Chun-Yeow Yeoh and committed by
Johannes Berg
932e628d d51c2ea3

+8 -24
+8 -24
net/mac80211/mesh_hwmp.c
··· 19 19 20 20 #define MAX_PREQ_QUEUE_LEN 64 21 21 22 - /* Destination only */ 23 - #define MP_F_DO 0x1 24 - /* Reply and forward */ 25 - #define MP_F_RF 0x2 26 - /* Unknown Sequence Number */ 27 - #define MP_F_USN 0x01 28 - /* Reason code Present */ 29 - #define MP_F_RCODE 0x02 30 - 31 22 static void mesh_queue_preq(struct mesh_path *, u8); 32 23 33 24 static inline u32 u32_field_get(const u8 *preq_elem, int offset, bool ae) ··· 276 285 *pos++ = ttl; 277 286 /* number of destinations */ 278 287 *pos++ = 1; 279 - /* 280 - * flags bit, bit 1 is unset if we know the sequence number and 281 - * bit 2 is set if we have a reason code 288 + /* Flags field has AE bit only as defined in 289 + * sec 8.4.2.117 IEEE802.11-2012 282 290 */ 283 291 *pos = 0; 284 - if (!target_sn) 285 - *pos |= MP_F_USN; 286 - if (target_rcode) 287 - *pos |= MP_F_RCODE; 288 292 pos++; 289 293 memcpy(pos, target, ETH_ALEN); 290 294 pos += ETH_ALEN; ··· 582 596 SN_LT(mpath->sn, target_sn)) { 583 597 mpath->sn = target_sn; 584 598 mpath->flags |= MESH_PATH_SN_VALID; 585 - } else if ((!(target_flags & MP_F_DO)) && 599 + } else if ((!(target_flags & IEEE80211_PREQ_TO_FLAG)) && 586 600 (mpath->flags & MESH_PATH_ACTIVE)) { 587 601 reply = true; 588 602 target_metric = mpath->metric; 589 603 target_sn = mpath->sn; 590 - if (target_flags & MP_F_RF) 591 - target_flags |= MP_F_DO; 592 - else 593 - forward = false; 604 + /* Case E2 of sec 13.10.9.3 IEEE 802.11-2012*/ 605 + target_flags |= IEEE80211_PREQ_TO_FLAG; 594 606 } 595 607 } 596 608 rcu_read_unlock(); ··· 987 1003 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 988 1004 struct mesh_preq_queue *preq_node; 989 1005 struct mesh_path *mpath; 990 - u8 ttl, target_flags; 1006 + u8 ttl, target_flags = 0; 991 1007 const u8 *da; 992 1008 u32 lifetime; 993 1009 ··· 1046 1062 } 1047 1063 1048 1064 if (preq_node->flags & PREQ_Q_F_REFRESH) 1049 - target_flags = MP_F_DO; 1065 + target_flags |= IEEE80211_PREQ_TO_FLAG; 1050 1066 else 1051 - target_flags = MP_F_RF; 1067 + target_flags &= ~IEEE80211_PREQ_TO_FLAG; 1052 1068 1053 1069 spin_unlock_bh(&mpath->state_lock); 1054 1070 da = (mpath->is_root) ? mpath->rann_snd_addr : broadcast_addr;