o11s update to latest draft
Subsystems (2)
v2 cover o11s update to latest draft
Hi again,
Here's take two of the mesh update patch. As I already said, the following patches update the mesh code to latest draft, 3.03. They also include some minor cleanups and improved debugging.
include/linux/ieee80211.h | 17 + include/linux/nl80211.h | 11 - include/net/cfg80211.h | 9 net/mac80211/Kconfig | 13 + net/mac80211/cfg.c | 15 + net/mac80211/debugfs_netdev.c | 2 net/mac80211/ieee80211_i.h | 23 +- net/mac80211/mesh.c | 143 ++++++++----- net/mac80211/mesh.h | 30 +- net/mac80211/mesh_hwmp.c | 454 +++++++++++++++++++++++++++--------------- net/mac80211/mesh_pathtbl.c | 20 + net/mac80211/mesh_plink.c | 56 +++-- net/mac80211/rx.c | 2 net/mac80211/tx.c | 2 net/mac80211/util.c | 6 net/wireless/nl80211.c | 12 - 16 files changed, 541 insertions(+), 274 deletions(-)
Regards,
--
Rui Paulo
PATCH v2 1/20 mac80211: update meshconf IE
This updates the Mesh Configuration IE according to the latest draft (3.03).
Notable changes include the simplified protocol IDs.
--- include/linux/ieee80211.h | 2 +- net/mac80211/ieee80211_i.h | 10 +++--- net/mac80211/mesh.c | 69 ++++++++++++++++++------------------------- 3 files changed, 35 insertions(+), 46 deletions(-)
include/linux/ieee80211.h +1 -1
@@ -115,7 +115,7 @@#define IEEE80211_MAX_SSID_LEN 32#define IEEE80211_MAX_MESH_ID_LEN 32 -#define IEEE80211_MESH_CONFIG_LEN 24 +#define IEEE80211_MESH_CONFIG_LEN 7#define IEEE80211_QOS_CTL_LEN 2#define IEEE80211_QOS_CTL_TID_MASK 0x000F
net/mac80211/ieee80211_i.h +5 -5
@@ -361,15 +361,15 @@ struct ieee80211_if_mesh {u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN ];size_t mesh_id_len;/* Active Path Selection Protocol Identifier */ -u8 mesh_pp_id[4 ]; +u8 mesh_pp_id;/* Active Path Selection Metric Identifier */ -u8 mesh_pm_id[4 ]; +u8 mesh_pm_id;/* Congestion Control Mode Identifier */ -u8 mesh_cc_id[4 ]; +u8 mesh_cc_id;/* Synchronization Protocol Identifier */ -u8 mesh_sp_id[4 ]; +u8 mesh_sp_id;/* Authentication Protocol Identifier */ -u8 mesh_auth_id[4 ]; +u8 mesh_auth_id;/* Local mesh Destination Sequence Number */ u32 dsn;/* Last used PREQ ID */
net/mac80211/mesh.c +29 -40
115 lines not on this page · raw message
Signature · 1 line
1.5.6.5
PATCH v2 2/20 mac80211: set MESH_TTL to 31
In reply to Rui PauloUpdate the mesh time to live field to 31 according to draft 3.03.
--- net/mac80211/mesh.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/mac80211/mesh.h +1 -1
@@ -174,7 +174,7 @@ struct mesh_rmc {#define MESH_CFG_CMP_LEN (IEEE80211_MESH_CONFIG_LEN - 2)/* Default values, timeouts in ms */ -#define MESH_TTL 5 +#define MESH_TTL 31#define MESH_MAX_RETR 3#define MESH_RET_T 100#define MESH_CONF_T 100
Signature · 1 line
1.5.6.5
PATCH v2 3/20 mac80211: implement the meshconf formation info field
In reply to Rui PauloThe Mesh Configuration Formation Info field contains the number of neighbors. This means that the beacon must be updated every time a peer joins or leaves.
--- net/mac80211/mesh.c | 9 ++++++--- net/mac80211/mesh_plink.c | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-)
net/mac80211/mesh.c +6 -3
@@ -223,6 +223,7 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)struct ieee80211_supported_band *sband;u8 *pos;int len, i, rate; +u8 neighbors; sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; len = sband->n_bitrates;
@@ -271,9 +272,11 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)/* Authentication Protocol identifier */ *pos++ = sdata->u.mesh.mesh_auth_id; -/* Mesh Formation Info */ -memset (pos,0x00 ,1 ); - pos +=1 ; +/* Mesh Formation Info - number of neighbors */ + neighbors =atomic_read (&sdata->u.mesh.mshstats.estab_plinks); +/* Number of neighbor mesh STAs or 15 whichever is smaller */ + neighbors = (neighbors >15 ) ?15 : neighbors; + *pos++ = neighbors <<1 ;/* Mesh capability */ sdata->u.mesh.accepting_plinks =mesh_plink_availables (sdata);
net/mac80211/mesh_plink.c +2 -0
@@ -65,6 +65,7 @@ void mesh_plink_inc_estab_count(struct ieee80211_sub_if_data *sdata) {atomic_inc (&sdata->u.mesh.mshstats.estab_plinks);mesh_accept_plinks_update (sdata); +ieee80211_bss_info_change_notify (sdata,BSS_CHANGED_BEACON ); } static inline
@@ -72,6 +73,7 @@ void mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata) {atomic_dec (&sdata->u.mesh.mshstats.estab_plinks);mesh_accept_plinks_update (sdata); +ieee80211_bss_info_change_notify (sdata,BSS_CHANGED_BEACON ); }/**
Signature · 1 line
1.5.6.5
Johannes Berg
maintainerRe: [PATCH v2 03/20] mac80211: implement the meshconf formation info field
Quoted 3 lines · Rui Paulo
The Mesh Configuration Formation Info field contains the number of neighbors. This means that the beacon must be updated every time a peer joins or leaves.
In theory you don't have to update when you have >=15 peers, afaict, but I don't think it matters.
johannes
PATCH v2 4/20 mac80211: fix typo in a comment
In reply to Rui Paulo--- net/mac80211/mesh_plink.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/mac80211/mesh_plink.c +1 -1
@@ -79,7 +79,7 @@ void mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata)/** * mesh_plink_fsm_restart - restart a mesh peer link finite state machine * -* @sta: mes peer link to restart +* @sta: mesh peer link to restart * * Locking: this function must be called holding sta->lock */
Signature · 1 line
1.5.6.5
PATCH v2 5/20 mac80211: update peer link management IE and action frames
In reply to Rui PauloUpdate the length and format of the peer link management action frames.
--- net/mac80211/mesh.c | 2 +- net/mac80211/mesh.h | 2 +- net/mac80211/mesh_plink.c | 32 +++++++++++++++++--------------- net/mac80211/rx.c | 2 +- 4 files changed, 20 insertions(+), 18 deletions(-)
net/mac80211/mesh.c +1 -1
@@ -553,7 +553,7 @@ static void ieee80211_mesh_rx_mgmt_action(struct ieee80211_sub_if_data *sdata, struct ieee80211_rx_status *rx_status) {switch (mgmt->u.action.category) { -case PLINK_CATEGORY : +case MESH_PLINK_CATEGORY :mesh_rx_plink_frame (sdata, mgmt, len, rx_status);break ;case MESH_PATH_SEL_CATEGORY :
net/mac80211/mesh.h +1 -1
@@ -206,7 +206,7 @@ struct mesh_rmc {#define MESH_MAX_MPATHS 1024/* Pending ANA approval */ -#define PLINK_CATEGORY 30 +#define MESH_PLINK_CATEGORY 30#define MESH_PATH_SEL_CATEGORY 32/* Public interfaces */
net/mac80211/mesh_plink.c +17 -15
@@ -18,9 +18,8 @@ #define mpl_dbg(fmt, args...) do { (void)(0); } while (0)#endif -#define PLINK_GET_FRAME_SUBTYPE (p) (p) -#define PLINK_GET_LLID (p) (p + 1) -#define PLINK_GET_PLID (p) (p + 3) +#define PLINK_GET_LLID (p) (p + 4) +#define PLINK_GET_PLID (p) (p + 6)#define mod_plink_timer (s, t) (mod_timer(&s->plink_timer, \ jiffies + HZ * t / 1000))
@@ -154,6 +153,7 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,struct sk_buff *skb =dev_alloc_skb (local->hw.extra_tx_headroom +400 );struct ieee80211_mgmt *mgmt;bool include_plid = false; +static const u8 meshpeeringproto[] = {0x00 ,0x0F ,0xAC ,0x2A };u8 *pos;int ie_len;
@@ -171,7 +171,7 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,memcpy (mgmt->da, da,ETH_ALEN );memcpy (mgmt->sa, sdata->dev->dev_addr,ETH_ALEN );/* BSSID is left zeroed, wildcard value */ - mgmt->u.action.category =PLINK_CATEGORY ; + mgmt->u.action.category =MESH_PLINK_CATEGORY ; mgmt->u.action.u.plink_action.action_code = action;if (action ==PLINK_CLOSE )
@@ -189,18 +189,18 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,/* Add Peer Link Management element */ switch (action) {case PLINK_OPEN : - ie_len =3 ; + ie_len =6 ;break ;case PLINK_CONFIRM : - ie_len =5 ; + ie_len =8 ; include_plid = true;break ;case PLINK_CLOSE :default :if (!plid) - ie_len =5 ; + ie_len =8 ;else { - ie_len =7 ; + ie_len =10 ; include_plid = true; }break ;
@@ -209,7 +209,8 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, pos =skb_put (skb,2 + ie_len); *pos++ =WLAN_EID_PEER_LINK ; *pos++ = ie_len; - *pos++ = action; +memcpy (pos, meshpeeringproto,sizeof (meshpeeringproto)); + pos +=4 ;memcpy (pos, &llid,2 );if (include_plid) { pos +=2 ;
@@ -419,12 +420,13 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_mreturn ; } - ftype = *((u8 *)PLINK_GET_FRAME_SUBTYPE (elems.peer_link)); + ftype = mgmt->u.action.u.plink_action.action_code; ie_len = elems.peer_link_len; -if ((ftype ==PLINK_OPEN && ie_len !=3 ) || - (ftype ==PLINK_CONFIRM && ie_len !=5 ) || - (ftype ==PLINK_CLOSE && ie_len !=5 && ie_len !=7 )) { -mpl_dbg ("Mesh plink: incorrect plink ie length\n" ); +if ((ftype ==PLINK_OPEN && ie_len !=6 ) || + (ftype ==PLINK_CONFIRM && ie_len !=8 ) || + (ftype ==PLINK_CLOSE && ie_len !=8 && ie_len !=10 )) { +mpl_dbg ("Mesh plink: incorrect plink ie length %d %d\n" , + ftype, ie_len);return ; }
@@ -436,7 +438,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m* from the point of view of this host. */ memcpy (&plid,PLINK_GET_LLID (elems.peer_link),2 ); -if (ftype ==PLINK_CONFIRM || (ftype ==PLINK_CLOSE && ie_len ==7 )) +if (ftype ==PLINK_CONFIRM || (ftype ==PLINK_CLOSE && ie_len ==10 ))memcpy (&llid,PLINK_GET_PLID (elems.peer_link),2 );rcu_read_lock ();
net/mac80211/rx.c +1 -1
@@ -507,7 +507,7 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx)if (ieee80211_is_action (hdr->frame_control)) { mgmt = (struct ieee80211_mgmt *)hdr; -if (mgmt->u.action.category !=PLINK_CATEGORY ) +if (mgmt->u.action.category !=MESH_PLINK_CATEGORY )return RX_DROP_MONITOR ;return RX_CONTINUE ; }
Signature · 1 line
1.5.6.5
PATCH v2 6/20 mac80211: update the format of path selection frames
In reply to Rui PauloUpdate the format of path selection frames according to latest draft (3.03).
--- net/mac80211/mesh.h | 1 + net/mac80211/mesh_hwmp.c | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-)
net/mac80211/mesh.h +1 -0
@@ -208,6 +208,7 @@ struct mesh_rmc {/* Pending ANA approval */ #define MESH_PLINK_CATEGORY 30#define MESH_PATH_SEL_CATEGORY 32 +#define MESH_PATH_SEL_ACTION 0/* Public interfaces */ /* Various */
net/mac80211/mesh_hwmp.c +1 -1
@@ -105,7 +105,7 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,memcpy (mgmt->sa, sdata->dev->dev_addr,ETH_ALEN );/* BSSID is left zeroed, wildcard value */ mgmt->u.action.category =MESH_PATH_SEL_CATEGORY ; - mgmt->u.action.u.mesh_action.action_code = action; + mgmt->u.action.u.mesh_action.action_code =MESH_PATH_SEL_ACTION ;switch (action) {case MPATH_PREQ :
Signature · 1 line
1.5.6.5
PATCH v2 7/20 mac80211: add MAC80211_VERBOSE_MHWMP_DEBUG
In reply to Rui PauloAdd MAC80211_VERBOSE_MHWMP_DEBUG, a debugging option for HWMP frame processing.
--- net/mac80211/Kconfig | 13 +++++++++++++ net/mac80211/mesh_hwmp.c | 19 +++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-)
net/mac80211/Kconfig +13 -0
@@ -194,6 +194,19 @@ config MAC80211_VERBOSE_MPL_DEBUG Do not select this option. +config MAC80211_VERBOSE_MHWMP_DEBUG + bool "Verbose mesh HWMP routing debugging" + depends on MAC80211_DEBUG_MENU + depends on MAC80211_MESH + ---help--- + Selecting this option causes mac80211 to print out very + verbose mesh routing (HWMP) debugging messages (when mac80211 + is taking part in a mesh network). + It should not be selected on production systems as those + messages are remotely triggerable. + + Do not select this option. + config MAC80211_DEBUG_COUNTERS bool "Extra statistics for TX/RX debugging" depends on MAC80211_DEBUG_MENU
net/mac80211/mesh_hwmp.c +15 -4
@@ -9,6 +9,12 @@#include "mesh.h" +#ifdef CONFIG_MAC80211_VERBOSE_MHWMP_DEBUG +#define mhwmp_dbg(fmt, args...) printk(KERN_DEBUG "Mesh HWMP: " fmt, ##args) +#else +#define mhwmp_dbg(fmt, args...) do { (void)(0); } while (0) +#endif +#define TEST_FRAME_LEN 8192#define MAX_METRIC 0xffffffff#define ARITH_SHIFT 8
@@ -109,11 +115,13 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,switch (action) {case MPATH_PREQ : +mhwmp_dbg ("sending PREQ\n" ); ie_len =37 ; pos =skb_put (skb,2 + ie_len); *pos++ =WLAN_EID_PREQ ;break ;case MPATH_PREP : +mhwmp_dbg ("sending PREP\n" ); ie_len =31 ; pos =skb_put (skb,2 + ie_len); *pos++ =WLAN_EID_PREP ;
@@ -432,6 +440,8 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, orig_dsn =PREQ_IE_ORIG_DSN (preq_elem); dst_flags =PREQ_IE_DST_F (preq_elem); +mhwmp_dbg ("received PREQ\n" ); +if (memcmp (dst_addr, sdata->dev->dev_addr,ETH_ALEN ) ==0 ) { forward = false; reply = true;
@@ -467,13 +477,14 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,if (reply) { lifetime =PREQ_IE_LIFETIME (preq_elem); ttl = ifmsh->mshcfg.dot11MeshTTL; -if (ttl !=0 ) +if (ttl !=0 ) { +mhwmp_dbg ("replying to the PREQ\n" );mesh_path_sel_frame_tx (MPATH_PREP ,0 , dst_addr,cpu_to_le32 (dst_dsn),0 , orig_addr,cpu_to_le32 (orig_dsn), mgmt->sa,0 , ttl,cpu_to_le32 (lifetime),cpu_to_le32 (metric),0 , sdata); -else + }else ifmsh->mshstats.dropped_frames_ttl++; }
@@ -661,7 +672,7 @@ static void mesh_queue_preq(struct mesh_path *mpath, u8 flags) preq_node =kmalloc (sizeof (struct mesh_preq_queue ),GFP_ATOMIC );if (!preq_node) { -printk (KERN_DEBUG "Mesh HWMP: could not allocate PREQ node\n" ); +mhwmp_dbg ("could not allocate PREQ node\n" );return ; }
@@ -670,7 +681,7 @@ static void mesh_queue_preq(struct mesh_path *mpath, u8 flags)spin_unlock (&ifmsh->mesh_preq_queue_lock);kfree (preq_node);if (printk_ratelimit ()) -printk (KERN_DEBUG "Mesh HWMP: PREQ node queue full\n" ); +mhwmp_dbg ("PREQ node queue full\n" );return ; }
Signature · 1 line
1.5.6.5
PATCH v2 8/20 mac80211: allow processing of more than one HWMP IE
In reply to Rui PauloSince the HWMP IEs are now all optional and the action code is fixed, allow the HWMP code to find and process each IE on the path selection action frames.
--- net/mac80211/mesh_hwmp.c | 47 ++++++++++++++++++++++++--------------------- 1 files changed, 25 insertions(+), 22 deletions(-)
net/mac80211/mesh_hwmp.c +25 -22
@@ -192,7 +192,7 @@ int mesh_path_error_tx(u8 *dst, __le32 dst_dsn, u8 *ra,memcpy (mgmt->sa, sdata->dev->dev_addr,ETH_ALEN );/* BSSID is left zeroed, wildcard value */ mgmt->u.action.category =MESH_PATH_SEL_CATEGORY ; - mgmt->u.action.u.mesh_action.action_code =MPATH_PERR ; + mgmt->u.action.u.mesh_action.action_code =MESH_PATH_SEL_ACTION ; ie_len =12 ; pos =skb_put (skb,2 + ie_len); *pos++ =WLAN_EID_PERR ;
@@ -277,7 +277,7 @@ static u32 airtime_link_metric_get(struct ieee80211_local *local,*/ static u32 hwmp_route_info_get (struct ieee80211_sub_if_data *sdata,struct ieee80211_mgmt *mgmt, -u8 *hwmp_ie) +u8 *hwmp_ie,enum mpath_frame_type action) {struct ieee80211_local *local = sdata->local;struct mesh_path *mpath;
@@ -288,7 +288,6 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,unsigned long orig_lifetime, exp_time;u32 last_hop_metric, new_metric;bool process = true; -u8 action = mgmt->u.action.u.mesh_action.action_code;rcu_read_lock (); sta =sta_info_get (local, mgmt->sa);
@@ -443,6 +442,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,mhwmp_dbg ("received PREQ\n" );if (memcmp (dst_addr, sdata->dev->dev_addr,ETH_ALEN ) ==0 ) { +mhwmp_dbg ("PREQ is for us\n" ); forward = false; reply = true; metric =0 ;
@@ -498,6 +498,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, ifmsh->mshstats.dropped_frames_ttl++;return ; } +mhwmp_dbg ("forwarding the PREQ\n" ); --ttl; flags =PREQ_IE_FLAGS (preq_elem); preq_id =PREQ_IE_PREQ_ID (preq_elem);
@@ -524,6 +525,8 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,u8 next_hop[ETH_ALEN ];u32 dst_dsn, orig_dsn, lifetime; +mhwmp_dbg ("received PREP\n" ); +/* Note that we divert from the draft nomenclature and denominate * destination to what the draft refers to as origininator. So in this * function destnation refers to the final destination of the PREP,
@@ -625,32 +628,32 @@ void mesh_rx_path_sel_frame(struct ieee80211_sub_if_data *sdata,ieee802_11_parse_elems (mgmt->u.action.u.mesh_action.variable, len - baselen, &elems); -switch (mgmt->u.action.u.mesh_action.action_code) { -case MPATH_PREQ : -if (!elems.preq || elems.preq_len !=37 ) +mhwmp_dbg ("RX path selection frame\n" ); +if (elems.preq) { +if (elems.preq_len !=37 )/* Right now we support just 1 destination and no AE */ return ; - last_hop_metric =hwmp_route_info_get (sdata, mgmt, elems.preq); -if (!last_hop_metric) -return ; -hwmp_preq_frame_process (sdata, mgmt, elems.preq, last_hop_metric); -break ; -case MPATH_PREP : -if (!elems.prep || elems.prep_len !=31 ) + last_hop_metric =hwmp_route_info_get (sdata, mgmt, elems.preq, +MPATH_PREQ ); +if (last_hop_metric) +hwmp_preq_frame_process (sdata, mgmt, elems.preq, + last_hop_metric); + } +if (elems.prep) { +if (elems.prep_len !=31 )/* Right now we support no AE */ return ; - last_hop_metric =hwmp_route_info_get (sdata, mgmt, elems.prep); -if (!last_hop_metric) -return ; -hwmp_prep_frame_process (sdata, mgmt, elems.prep, last_hop_metric); -break ; -case MPATH_PERR : -if (!elems.perr || elems.perr_len !=12 ) + last_hop_metric =hwmp_route_info_get (sdata, mgmt, elems.prep, +MPATH_PREP ); +if (last_hop_metric) +hwmp_prep_frame_process (sdata, mgmt, elems.prep, + last_hop_metric); + } +if (elems.perr) { +if (elems.perr_len !=12 )/* Right now we support only one destination per PERR */ return ;hwmp_perr_frame_process (sdata, mgmt, elems.perr); -default : -return ; } }
Signature · 1 line
1.5.6.5
PATCH v2 9/20 mac80211: improve HWMP debugging
In reply to Rui Paulo--- net/mac80211/mesh_hwmp.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-)
net/mac80211/mesh_hwmp.c +5 -6
@@ -115,13 +115,13 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,switch (action) {case MPATH_PREQ : -mhwmp_dbg ("sending PREQ\n" ); +mhwmp_dbg ("sending PREQ to %pM\n" , dst); ie_len =37 ; pos =skb_put (skb,2 + ie_len); *pos++ =WLAN_EID_PREQ ;break ;case MPATH_PREP : -mhwmp_dbg ("sending PREP\n" ); +mhwmp_dbg ("sending PREP to %pM\n" , dst); ie_len =31 ; pos =skb_put (skb,2 + ie_len); *pos++ =WLAN_EID_PREP ;
@@ -439,7 +439,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, orig_dsn =PREQ_IE_ORIG_DSN (preq_elem); dst_flags =PREQ_IE_DST_F (preq_elem); -mhwmp_dbg ("received PREQ\n" ); +mhwmp_dbg ("received PREQ from %pM\n" , orig_addr);if (memcmp (dst_addr, sdata->dev->dev_addr,ETH_ALEN ) ==0 ) {mhwmp_dbg ("PREQ is for us\n" );
@@ -498,7 +498,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, ifmsh->mshstats.dropped_frames_ttl++;return ; } -mhwmp_dbg ("forwarding the PREQ\n" ); +mhwmp_dbg ("forwarding the PREQ from %pM\n" , orig_addr); --ttl; flags =PREQ_IE_FLAGS (preq_elem); preq_id =PREQ_IE_PREQ_ID (preq_elem);
@@ -525,7 +525,7 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,u8 next_hop[ETH_ALEN ];u32 dst_dsn, orig_dsn, lifetime; -mhwmp_dbg ("received PREP\n" ); +mhwmp_dbg ("received PREP from %pM\n" ,PREP_IE_ORIG_ADDR (prep_elem));/* Note that we divert from the draft nomenclature and denominate * destination to what the draft refers to as origininator. So in this
@@ -628,7 +628,6 @@ void mesh_rx_path_sel_frame(struct ieee80211_sub_if_data *sdata,ieee802_11_parse_elems (mgmt->u.action.u.mesh_action.variable, len - baselen, &elems); -mhwmp_dbg ("RX path selection frame\n" );if (elems.preq) {if (elems.preq_len !=37 )/* Right now we support just 1 destination and no AE */
Signature · 1 line
1.5.6.5
PATCH v2 10/20 mac80211: improve peer link management debugging
In reply to Rui PauloPrint the FSM state strings instead of just the numbers.
--- net/mac80211/mesh_plink.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-)
net/mac80211/mesh_plink.c +13 -2
@@ -398,6 +398,17 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_mu8 ie_len;u8 *baseaddr;__le16 plid, llid, reason; +#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG +static const char *mplstates[] = { + [PLINK_LISTEN ] ="LISTEN" , + [PLINK_OPN_SNT ] ="OPN-SNT" , + [PLINK_OPN_RCVD ] ="OPN-RCVD" , + [PLINK_CNF_RCVD ] ="CNF_RCVD" , + [PLINK_ESTAB ] ="ESTAB" , + [PLINK_HOLDING ] ="HOLDING" , + [PLINK_BLOCKED ] ="BLOCKED" + }; +#endif /* need action_code, aux */ if (len <IEEE80211_MIN_ACTION_SIZE +3 )
@@ -536,8 +547,8 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m } } -mpl_dbg ("Mesh plink (peer, state, llid, plid, event): %pM %d %d %d %d\n" , - mgmt->sa, sta->plink_state, +mpl_dbg ("Mesh plink (peer, state, llid, plid, event): %pM %s %d %d %d\n" , + mgmt->sa, mplstates[sta->plink_state],le16_to_cpu (sta->llid),le16_to_cpu (sta->plid), event); reason =0 ;
Signature · 1 line
1.5.6.5
PATCH v2 11/20 mac80211: implement RANN processing and forwarding
In reply to Rui PauloProcess the RANN (Root Annoucement) Frame and try to find the HWMP root station by sending a PREQ.
--- include/linux/ieee80211.h | 15 ++++++++ net/mac80211/ieee80211_i.h | 2 + net/mac80211/mesh_hwmp.c | 79 +++++++++++++++++++++++++++++++++++++++---- net/mac80211/util.c | 6 +++ 4 files changed, 94 insertions(+), 8 deletions(-)
include/linux/ieee80211.h +15 -0
@@ -554,6 +554,20 @@ struct ieee80211_tim_ie {u8 virtual_map[1 ]; } __attribute__ ((packed)); +/** +* struct ieee80211_rann_ie +* +* This structure refers to "Root Announcement information element" +*/ +struct ieee80211_rann_ie { +u8 rann_flags; +u8 rann_hopcount; +u8 rann_ttl; +u8 rann_addr[6 ]; +u32 rann_seq; +u32 rann_metric; +} __attribute__ ((packed)); +#define WLAN_SA_QUERY_TR_ID_LEN 2struct ieee80211_mgmt {
@@ -1070,6 +1084,7 @@ enum ieee80211_eid {WLAN_EID_PREQ =68 ,WLAN_EID_PREP =69 ,WLAN_EID_PERR =70 , +WLAN_EID_RANN =49 ,/* compatible with FreeBSD */ /* 802.11h */ WLAN_EID_PWR_CONSTRAINT =32 , WLAN_EID_PWR_CAPABILITY = 33,
net/mac80211/ieee80211_i.h +2 -0
@@ -799,6 +799,7 @@ struct ieee802_11_elems {u8 *preq;u8 *prep;u8 *perr; +struct ieee80211_rann_ie *rann;u8 *ch_switch_elem;u8 *country_elem;u8 *pwr_constr_elem;
@@ -826,6 +827,7 @@ struct ieee802_11_elems {u8 preq_len;u8 prep_len;u8 perr_len; +u8 rann_len;u8 ch_switch_elem_len;u8 country_elem_len;u8 pwr_constr_elem_len;
net/mac80211/mesh_hwmp.c +71 -8
127 lines not on this page · raw message
net/mac80211/util.c +6 -0
@@ -685,6 +685,12 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len, elems->perr = pos; elems->perr_len = elen;break ; +case WLAN_EID_RANN : +if (elen >=sizeof (struct ieee80211_rann_ie )) { + elems->rann = (void *)pos; + elems->rann_len = elen; + } +break ;case WLAN_EID_CHANNEL_SWITCH : elems->ch_switch_elem = pos; elems->ch_switch_elem_len = elen;
Signature · 1 line
1.5.6.5
Johannes Berg
maintainerRe: [PATCH v2 11/20] mac80211: implement RANN processing and forwarding
include/linux/ieee80211.h struct ieee80211_tim_ie { · line 566
Quoted 5 lines · Rui Paulo
include/linux/ieee80211.h +5
-0+struct ieee80211_rann_ie { +u8 rann_flags; +u8 rann_hopcount; +u8 rann_ttl; +u8 rann_addr[6 ];
I'd prefer ETH_ALEN here, but it only changes the code, not the binary, of course :)
net/mac80211/ieee80211_i.h struct ieee802_11_elems { · line 831
Quoted 6 lines
net/mac80211/ieee80211_i.h +1
-0@@ -826,6 +827,7 @@ struct ieee802_11_elems {u8 preq_len;u8 prep_len;u8 perr_len; +u8 rann_len;u8 ch_switch_elem_len;
I suspect you can remove rann_len since it's fixed?
net/mac80211/mesh_hwmp.c static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags, · line 135
Quoted 3 lines
net/mac80211/mesh_hwmp.c +3
-0+case MPATH_RANN : +mhwmp_dbg ("sending RANN from %pM\n" , orig_addr); + ie_len =17 ;
The other two I wouldn't care too much about, but please use sizeof() like you did when parsing the IEs.
johannes
PATCH v2 12/20 mac80211: update PERR frame format
In reply to Rui PauloUpdate the PERR IE frame format according to latest draft (3.03).
--- net/mac80211/mesh.h | 9 +++++- net/mac80211/mesh_hwmp.c | 58 ++++++++++++++++++++++++++++++++++++------ net/mac80211/mesh_pathtbl.c | 6 +++- 3 files changed, 60 insertions(+), 13 deletions(-)
net/mac80211/mesh.h +7 -2
@@ -210,6 +210,11 @@ struct mesh_rmc {#define MESH_PATH_SEL_CATEGORY 32#define MESH_PATH_SEL_ACTION 0 +/* PERR reason codes */ +#define PEER_RCODE_UNSPECIFIED 11 +#define PERR_RCODE_NO_ROUTE 12 +#define PERR_RCODE_DEST_UNREACH 13 +/* Public interfaces */ /* Various */ int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc,
@@ -275,8 +280,8 @@ void mesh_mpp_table_grow(void);u32 mesh_table_hash (u8 *addr,struct ieee80211_sub_if_data *sdata,struct mesh_table *tbl);/* Mesh paths */ -int mesh_path_error_tx (u8 *dest,__le32 dest_dsn,u8 *ra, -struct ieee80211_sub_if_data *sdata); +int mesh_path_error_tx (u8 ttl,u8 *dest,__le32 dest_dsn,__le16 dest_rcode, +u8 *ra,struct ieee80211_sub_if_data *sdata);void mesh_path_assign_nexthop (struct mesh_path *mpath,struct sta_info *sta);void mesh_path_flush_pending (struct mesh_path *mpath);void mesh_path_tx_pending (struct mesh_path *mpath);
net/mac80211/mesh_hwmp.c +49 -9
121 lines not on this page · raw message
net/mac80211/mesh_pathtbl.c +4 -2
@@ -465,8 +465,9 @@ void mesh_plink_broken(struct sta_info *sta) mpath->flags &= ~MESH_PATH_ACTIVE ; ++mpath->dsn;spin_unlock_bh (&mpath->state_lock); -mesh_path_error_tx (mpath->dst, +mesh_path_error_tx (MESH_TTL , mpath->dst,cpu_to_le32 (mpath->dsn), +PERR_RCODE_DEST_UNREACH , sdata->dev->broadcast, sdata); }else spin_unlock_bh (&mpath->state_lock);
@@ -611,7 +612,8 @@ void mesh_path_discard_frame(struct sk_buff *skb, mpath =mesh_path_lookup (da, sdata);if (mpath) dsn = ++mpath->dsn; -mesh_path_error_tx (skb->data,cpu_to_le32 (dsn), ra, sdata); +mesh_path_error_tx (MESH_TTL , skb->data,cpu_to_le32 (dsn), +PERR_RCODE_NO_ROUTE , ra, sdata); }kfree_skb (skb);
Signature · 1 line
1.5.6.5
PATCH v2 13/20 mac80211: properly forward the RANN IE
In reply to Rui PauloIncrease hopcount and convert metric to LE before forwarding the RANN action frame.
--- net/mac80211/mesh_hwmp.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
net/mac80211/mesh_hwmp.c +3 -1
@@ -686,6 +686,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata, orig_addr = rann->rann_addr; orig_dsn = rann->rann_seq; hopcount = rann->rann_hopcount; + hopcount++; metric = rann->rann_metric;mhwmp_dbg ("received RANN from %pM\n" , orig_addr);
@@ -706,7 +707,8 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,mesh_path_sel_frame_tx (MPATH_RANN , flags, orig_addr,cpu_to_le32 (orig_dsn),0 ,NULL ,0 , sdata->dev->broadcast, - hopcount, ttl,0 ,cpu_to_le32 (metric), + hopcount, ttl,0 , +cpu_to_le32 (metric + mpath->metric),0 , sdata); mpath->dsn = orig_dsn; }
Signature · 1 line
1.5.6.5
PATCH v2 14/20 mac80211: set the AID field correctly for mesh peer frames
In reply to Rui PauloThis sets the AID field correctly for mesh peer confirm frames.
--- net/mac80211/mesh_plink.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
net/mac80211/mesh_plink.c +2 -1
@@ -181,7 +181,8 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,if (action ==PLINK_CONFIRM ) { pos =skb_put (skb,4 );/* two-byte status code followed by two-byte AID */ -memset (pos,0 ,4 ); +memset (pos,0 ,2 ); +memcpy (pos +2 , &plid,2 ); }mesh_mgmt_ies_add (skb, sdata); }
Signature · 1 line
1.5.6.5
PATCH v2 15/20 mac80211: fix BSSID setup for beacon frames
In reply to Rui PauloBSSID is now set to the TA.
--- net/mac80211/tx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/mac80211/tx.c +1 -1
@@ -2114,7 +2114,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,cpu_to_le16 (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_BEACON );memset (mgmt->da,0xff ,ETH_ALEN );memcpy (mgmt->sa, sdata->dev->dev_addr,ETH_ALEN ); -/* BSSID is left zeroed, wildcard value */ +memcpy (mgmt->bssid, sdata->dev->dev_addr,ETH_ALEN ); mgmt->u.beacon.beacon_int =cpu_to_le16 (sdata->vif.bss_conf.beacon_int); mgmt->u.beacon.capab_info =0x0 ;/* 0x0 for MPs */
Signature · 1 line
1.5.6.5
PATCH v2 16/20 mac80211: add the DS params to the beacon
In reply to Rui Paulo--- net/mac80211/mesh.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
net/mac80211/mesh.c +7 -0
@@ -247,6 +247,13 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) } } +if (sband->band ==IEEE80211_BAND_2GHZ ) { + pos =skb_put (skb,2 +1 ); + *pos++ =WLAN_EID_DS_PARAMS ; + *pos++ =1 ; + *pos++ =ieee80211_frequency_to_channel (local->hw.conf.channel->center_freq); + } + pos =skb_put (skb,2 + sdata->u.mesh.mesh_id_len); *pos++ =WLAN_EID_MESH_ID ; *pos++ = sdata->u.mesh.mesh_id_len;
Signature · 1 line
1.5.6.5
PATCH v2 17/20 mac80211: replace "destination" with "target" to follow the spec
In reply to Rui PauloResulting object files have the same MD5 as before.
--- include/linux/nl80211.h | 8 +- include/net/cfg80211.h | 8 +- net/mac80211/cfg.c | 8 +- net/mac80211/ieee80211_i.h | 10 +- net/mac80211/mesh.c | 2 +- net/mac80211/mesh.h | 10 +- net/mac80211/mesh_hwmp.c | 221 ++++++++++++++++++++++--------------------- net/mac80211/mesh_pathtbl.c | 12 +- net/wireless/nl80211.c | 6 +- 9 files changed, 144 insertions(+), 141 deletions(-)
include/linux/nl80211.h +4 -4
@@ -895,14 +895,14 @@ enum nl80211_sta_info {* * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active * @NL80211_MPATH_FLAG_RESOLVING: the mesh path discovery process is running -* @NL80211_MPATH_FLAG_DSN_VALID: the mesh path contains a valid DSN +* @NL80211_MPATH_FLAG_SN_VALID: the mesh path contains a valid SN * @NL80211_MPATH_FLAG_FIXED: the mesh path has been manually set * @NL80211_MPATH_FLAG_RESOLVED: the mesh path discovery process succeeded */ enum nl80211_mpath_flags {NL80211_MPATH_FLAG_ACTIVE =1 <<0 ,NL80211_MPATH_FLAG_RESOLVING =1 <<1 , -NL80211_MPATH_FLAG_DSN_VALID =1 <<2 , +NL80211_MPATH_FLAG_SN_VALID =1 <<2 ,NL80211_MPATH_FLAG_FIXED =1 <<3 ,NL80211_MPATH_FLAG_RESOLVED =1 <<4 , };
@@ -915,7 +915,7 @@ enum nl80211_mpath_flags {* * @__NL80211_MPATH_INFO_INVALID: attribute number 0 is reserved * @NL80211_ATTR_MPATH_FRAME_QLEN: number of queued frames for this destination -* @NL80211_ATTR_MPATH_DSN: destination sequence number +* @NL80211_ATTR_MPATH_SN: destination sequence number * @NL80211_ATTR_MPATH_METRIC: metric (cost) of this mesh path * @NL80211_ATTR_MPATH_EXPTIME: expiration time for the path, in msec from now * @NL80211_ATTR_MPATH_FLAGS: mesh path flags, enumerated in
@@ -926,7 +926,7 @@ enum nl80211_mpath_flags {enum nl80211_mpath_info { __NL80211_MPATH_INFO_INVALID,NL80211_MPATH_INFO_FRAME_QLEN , -NL80211_MPATH_INFO_DSN , +NL80211_MPATH_INFO_SN ,NL80211_MPATH_INFO_METRIC ,NL80211_MPATH_INFO_EXPTIME ,NL80211_MPATH_INFO_FLAGS ,
include/net/cfg80211.h +4 -4
@@ -418,7 +418,7 @@ enum monitor_flags {* in during get_station() or dump_station(). * * MPATH_INFO_FRAME_QLEN: @frame_qlen filled -* MPATH_INFO_DSN: @dsn filled +* MPATH_INFO_SN: @sn filled * MPATH_INFO_METRIC: @metric filled * MPATH_INFO_EXPTIME: @exptime filled * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
@@ -427,7 +427,7 @@ enum monitor_flags {*/ enum mpath_info_flags {MPATH_INFO_FRAME_QLEN =BIT (0 ), -MPATH_INFO_DSN =BIT (1 ), +MPATH_INFO_SN =BIT (1 ),MPATH_INFO_METRIC =BIT (2 ),MPATH_INFO_EXPTIME =BIT (3 ),MPATH_INFO_DISCOVERY_TIMEOUT =BIT (4 ),
@@ -442,7 +442,7 @@ enum mpath_info_flags {* * @filled: bitfield of flags from &enum mpath_info_flags * @frame_qlen: number of queued frames for this destination -* @dsn: destination sequence number +* @sn: target sequence number * @metric: metric (cost) of this mesh path * @exptime: expiration time for the mesh path from now, in msecs * @flags: mesh path flags
@@ -456,7 +456,7 @@ enum mpath_info_flags {struct mpath_info {u32 filled;u32 frame_qlen; -u32 dsn; +u32 sn;u32 metric;u32 exptime;u32 discovery_timeout;
net/mac80211/cfg.c +4 -4
@@ -907,7 +907,7 @@ static void mpath_set_pinfo(struct mesh_path *mpath, u8 *next_hop, pinfo->generation = mesh_paths_generation; pinfo->filled =MPATH_INFO_FRAME_QLEN | -MPATH_INFO_DSN | +MPATH_INFO_SN |MPATH_INFO_METRIC |MPATH_INFO_EXPTIME | MPATH_INFO_DISCOVERY_TIMEOUT |
@@ -915,7 +915,7 @@ static void mpath_set_pinfo(struct mesh_path *mpath, u8 *next_hop,MPATH_INFO_FLAGS ; pinfo->frame_qlen = mpath->frame_queue.qlen; - pinfo->dsn = mpath->dsn; + pinfo->sn = mpath->sn; pinfo->metric = mpath->metric;if (time_before (jiffies, mpath->exp_time)) pinfo->exptime =jiffies_to_msecs (mpath->exp_time - jiffies);
@@ -927,8 +927,8 @@ static void mpath_set_pinfo(struct mesh_path *mpath, u8 *next_hop, pinfo->flags |=NL80211_MPATH_FLAG_ACTIVE ;if (mpath->flags &MESH_PATH_RESOLVING ) pinfo->flags |=NL80211_MPATH_FLAG_RESOLVING ; -if (mpath->flags &MESH_PATH_DSN_VALID ) - pinfo->flags |=NL80211_MPATH_FLAG_DSN_VALID ; +if (mpath->flags &MESH_PATH_SN_VALID ) + pinfo->flags |=NL80211_MPATH_FLAG_SN_VALID ;if (mpath->flags &MESH_PATH_FIXED ) pinfo->flags |=NL80211_MPATH_FLAG_FIXED ;if (mpath->flags &MESH_PATH_RESOLVING )
net/mac80211/ieee80211_i.h +5 -5
@@ -370,14 +370,14 @@ struct ieee80211_if_mesh {u8 mesh_sp_id;/* Authentication Protocol Identifier */ u8 mesh_auth_id; -/* Local mesh Destination Sequence Number */ -u32 dsn; +/* Local mesh Sequence Number */ +u32 sn;/* Last used PREQ ID */ u32 preq_id;atomic_t mpaths; -/* Timestamp of last DSN update */ -unsigned long last_dsn_update; -/* Timestamp of last DSN sent */ +/* Timestamp of last SN update */ +unsigned long last_sn_update; +/* Timestamp of last SN sent */ unsigned long last_preq;struct mesh_rmc *rmc;spinlock_t mesh_preq_queue_lock;
net/mac80211/mesh.c +1 -1
@@ -672,7 +672,7 @@ void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)MESH_MIN_DISCOVERY_TIMEOUT ; ifmsh->accepting_plinks = true; ifmsh->preq_id =0 ; - ifmsh->dsn =0 ; + ifmsh->sn =0 ;atomic_set (&ifmsh->mpaths,0 );mesh_rmc_init (sdata); ifmsh->last_preq = jiffies;
net/mac80211/mesh.h +5 -5
@@ -26,7 +26,7 @@* * @MESH_PATH_ACTIVE: the mesh path can be used for forwarding * @MESH_PATH_RESOLVING: the discovery process is running for this mesh path -* @MESH_PATH_DSN_VALID: the mesh path contains a valid destination sequence +* @MESH_PATH_SN_VALID: the mesh path contains a valid destination sequence * number * @MESH_PATH_FIXED: the mesh path has been manually set and should not be * modified
@@ -38,7 +38,7 @@enum mesh_path_flags {MESH_PATH_ACTIVE =BIT (0 ),MESH_PATH_RESOLVING =BIT (1 ), -MESH_PATH_DSN_VALID =BIT (2 ), +MESH_PATH_SN_VALID =BIT (2 ),MESH_PATH_FIXED =BIT (3 ),MESH_PATH_RESOLVED =BIT (4 ), };
@@ -70,7 +70,7 @@ enum mesh_deferred_task_flags {* @timer: mesh path discovery timer * @frame_queue: pending queue for frames sent to this destination while the * path is unresolved -* @dsn: destination sequence number of the destination +* @sn: target sequence number * @metric: current metric to this destination * @hop_count: hops to destination * @exp_time: in jiffies, when the path will expire or when it expired
@@ -94,7 +94,7 @@ struct mesh_path {struct timer_list timer;struct sk_buff_head frame_queue;struct rcu_head rcu; -u32 dsn; +u32 sn;u32 metric;u8 hop_count;unsigned long exp_time;
@@ -280,7 +280,7 @@ void mesh_mpp_table_grow(void);u32 mesh_table_hash (u8 *addr,struct ieee80211_sub_if_data *sdata,struct mesh_table *tbl);/* Mesh paths */ -int mesh_path_error_tx (u8 ttl,u8 *dest,__le32 dest_dsn,__le16 dest_rcode, +int mesh_path_error_tx (u8 ttl,u8 *target,__le32 target_sn,__le16 target_rcode,u8 *ra,struct ieee80211_sub_if_data *sdata);void mesh_path_assign_nexthop (struct mesh_path *mpath,struct sta_info *sta);void mesh_path_flush_pending (struct mesh_path *mpath);
net/mac80211/mesh_hwmp.c +112 -109
471 lines not on this page · raw message
net/mac80211/mesh_pathtbl.c +6 -6
@@ -463,10 +463,10 @@ void mesh_plink_broken(struct sta_info *sta) mpath->flags & MESH_PATH_ACTIVE && !(mpath->flags & MESH_PATH_FIXED)) { mpath->flags &= ~MESH_PATH_ACTIVE ; - ++mpath->dsn; + ++mpath->sn;spin_unlock_bh (&mpath->state_lock);mesh_path_error_tx (MESH_TTL , mpath->dst, -cpu_to_le32 (mpath->dsn), +cpu_to_le32 (mpath->sn),PERR_RCODE_DEST_UNREACH , sdata->dev->broadcast, sdata); } else
@@ -602,7 +602,7 @@ void mesh_path_discard_frame(struct sk_buff *skb, {struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;struct mesh_path *mpath; -u32 dsn =0 ; +u32 sn =0 ;if (memcmp (hdr->addr4, sdata->dev->dev_addr,ETH_ALEN ) !=0 ) {u8 *ra, *da;
@@ -611,8 +611,8 @@ void mesh_path_discard_frame(struct sk_buff *skb, ra = hdr->addr1; mpath =mesh_path_lookup (da, sdata);if (mpath) - dsn = ++mpath->dsn; -mesh_path_error_tx (MESH_TTL , skb->data,cpu_to_le32 (dsn), + sn = ++mpath->sn; +mesh_path_error_tx (MESH_TTL , skb->data,cpu_to_le32 (sn),PERR_RCODE_NO_ROUTE , ra, sdata); }
@@ -648,7 +648,7 @@ void mesh_path_fix_nexthop(struct mesh_path *mpath, struct sta_info *next_hop) {spin_lock_bh (&mpath->state_lock);mesh_path_assign_nexthop (mpath, next_hop); - mpath->dsn =0xffff ; + mpath->sn =0xffff ; mpath->metric =0 ; mpath->hop_count =0 ; mpath->exp_time =0 ;
net/wireless/nl80211.c +3 -3
@@ -2105,9 +2105,9 @@ static int nl80211_send_mpath(struct sk_buff *msg, u32 pid, u32 seq,if (pinfo->filled &MPATH_INFO_FRAME_QLEN )NLA_PUT_U32 (msg,NL80211_MPATH_INFO_FRAME_QLEN , pinfo->frame_qlen); -if (pinfo->filled &MPATH_INFO_DSN ) -NLA_PUT_U32 (msg,NL80211_MPATH_INFO_DSN , - pinfo->dsn); +if (pinfo->filled &MPATH_INFO_SN ) +NLA_PUT_U32 (msg,NL80211_MPATH_INFO_SN , + pinfo->sn);if (pinfo->filled &MPATH_INFO_METRIC )NLA_PUT_U32 (msg,NL80211_MPATH_INFO_METRIC , pinfo->metric);
Signature · 1 line
1.5.6.5
PATCH v2 18/20 mac80211: implement a timer to send RANN action frames
In reply to Rui PauloRANN (Root Annoucement) frame TX. Send an action frame every second trying to build a path to all nodes on the mesh.
--- net/mac80211/ieee80211_i.h | 1 + net/mac80211/mesh.c | 39 +++++++++++++++++++++++++++++++++++++++ net/mac80211/mesh.h | 3 +++ net/mac80211/mesh_hwmp.c | 11 +++++++++++ 4 files changed, 54 insertions(+), 0 deletions(-)
net/mac80211/ieee80211_i.h +1 -0
@@ -352,6 +352,7 @@ struct ieee80211_if_mesh {struct work_struct work;struct timer_list housekeeping_timer;struct timer_list mesh_path_timer; +struct timer_list mesh_path_root_timer;struct sk_buff_head skb_queue;unsigned long timers_running;
net/mac80211/mesh.c +39 -0
@@ -14,6 +14,7 @@#define IEEE80211_MESH_PEER_INACTIVITY_LIMIT (1800 * HZ)#define IEEE80211_MESH_HOUSEKEEPING_INTERVAL (60 * HZ) +#define IEEE80211_MESH_RANN_INTERVAL (1 * HZ)#define MESHCONF_PP_OFFSET 0/* Path Selection Protocol */ #define MESHCONF_PM_OFFSET 1/* Path Selection Metric */
@@ -26,6 +27,7 @@#define TMR_RUNNING_HK 0#define TMR_RUNNING_MP 1 +#define TMR_RUNNING_MPR 2int mesh_allocated;static struct kmem_cache *rm_cache;
@@ -354,6 +356,23 @@ static void ieee80211_mesh_path_timer(unsigned long data)ieee80211_queue_work (&local->hw, &ifmsh->work); } +static void ieee80211_mesh_path_root_timer (unsigned long data) +{ +struct ieee80211_sub_if_data *sdata = + (struct ieee80211_sub_if_data *) data; +struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; +struct ieee80211_local *local = sdata->local; + +set_bit (MESH_WORK_ROOT , &ifmsh->wrkq_flags); + +if (local->quiescing) { +set_bit (TMR_RUNNING_MPR , &ifmsh->timers_running); +return ; + } + +ieee80211_queue_work (&local->hw, &ifmsh->work); +} +/** * ieee80211_fill_mesh_addresses - fill addresses of a locally originated mesh frame * @hdr: 802.11 frame header
@@ -447,6 +466,15 @@ static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata, round_jiffies(jiffies + IEEE80211_MESH_HOUSEKEEPING_INTERVAL)); } +static void ieee80211_mesh_rootpath (struct ieee80211_sub_if_data *sdata) +{ +struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; + +mesh_path_tx_root_frame (sdata); +mod_timer (&ifmsh->mesh_path_root_timer, +round_jiffies (jiffies +IEEE80211_MESH_RANN_INTERVAL )); +} +#ifdef CONFIG_PM void ieee80211_mesh_quiesce (struct ieee80211_sub_if_data *sdata) {
@@ -461,6 +489,8 @@ void ieee80211_mesh_quiesce(struct ieee80211_sub_if_data *sdata)set_bit (TMR_RUNNING_HK , &ifmsh->timers_running);if (del_timer_sync (&ifmsh->mesh_path_timer))set_bit (TMR_RUNNING_MP , &ifmsh->timers_running); +if (del_timer_sync (&ifmsh->mesh_path_root_timer)) +set_bit (TMR_RUNNING_MPR , &ifmsh->timers_running); }void ieee80211_mesh_restart (struct ieee80211_sub_if_data *sdata)
@@ -471,6 +501,8 @@ void ieee80211_mesh_restart(struct ieee80211_sub_if_data *sdata)add_timer (&ifmsh->housekeeping_timer);if (test_and_clear_bit (TMR_RUNNING_MP , &ifmsh->timers_running))add_timer (&ifmsh->mesh_path_timer); +if (test_and_clear_bit (TMR_RUNNING_MPR , &ifmsh->timers_running)) + add_timer(&ifmsh->mesh_path_root_timer); }#endif
@@ -490,6 +522,7 @@ void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)void ieee80211_stop_mesh (struct ieee80211_sub_if_data *sdata) {del_timer_sync (&sdata->u.mesh.housekeeping_timer); +del_timer_sync (&sdata->u.mesh.mesh_path_root_timer);/* * If the timer fired while we waited for it, it will have * requeued the work. Now the work will be running again
@@ -627,6 +660,9 @@ static void ieee80211_mesh_work(struct work_struct *work)if (test_and_clear_bit (MESH_WORK_HOUSEKEEPING , &ifmsh->wrkq_flags))ieee80211_mesh_housekeeping (sdata, ifmsh); + +if (test_and_clear_bit (MESH_WORK_ROOT , &ifmsh->wrkq_flags)) +ieee80211_mesh_rootpath (sdata); }void ieee80211_mesh_notify_scan_completed (struct ieee80211_local *local)
@@ -683,6 +719,9 @@ void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)setup_timer (&ifmsh->mesh_path_timer, ieee80211_mesh_path_timer, (unsigned long ) sdata); +setup_timer (&ifmsh->mesh_path_root_timer, + ieee80211_mesh_path_root_timer, + (unsigned long ) sdata);INIT_LIST_HEAD (&ifmsh->preq_queue.list);spin_lock_init (&ifmsh->mesh_preq_queue_lock); }
net/mac80211/mesh.h +3 -0
@@ -53,11 +53,13 @@ enum mesh_path_flags {* to grow. * @MESH_WORK_GROW_MPP_TABLE: the mesh portals table is full and needs to * grow +* @MESH_WORK_ROOT: the mesh root station needs to send a frame */ enum mesh_deferred_task_flags {MESH_WORK_HOUSEKEEPING ,MESH_WORK_GROW_MPATH_TABLE ,MESH_WORK_GROW_MPP_TABLE , +MESH_WORK_ROOT , };/**
@@ -294,6 +296,7 @@ void mesh_path_discard_frame(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata);void mesh_path_quiesce (struct ieee80211_sub_if_data *sdata);void mesh_path_restart (struct ieee80211_sub_if_data *sdata); +void mesh_path_tx_root_frame (struct ieee80211_sub_if_data *sdata);extern int mesh_paths_generation;
net/mac80211/mesh_hwmp.c +11 -0
@@ -1003,3 +1003,14 @@ void mesh_path_timer(unsigned long data) endmpathtimer:rcu_read_unlock (); } + +void +mesh_path_tx_root_frame (struct ieee80211_sub_if_data *sdata) +{ +struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; + +mesh_path_sel_frame_tx (MPATH_RANN ,0 , sdata->dev->dev_addr, +cpu_to_le32 (++ifmsh->sn), +0 ,NULL ,0 , sdata->dev->broadcast, +0 ,MESH_TTL ,0 ,0 ,0 , sdata); +}
Signature · 1 line
1.5.6.5
PATCH v2 19/20 mac80211: add nl80211/cfg80211 handling of the new mesh root mode option.
In reply to Rui Paulo--- include/linux/nl80211.h | 3 +++ include/net/cfg80211.h | 1 + net/mac80211/cfg.c | 7 +++++++ net/mac80211/debugfs_netdev.c | 2 ++ net/mac80211/mesh.c | 13 +++++++++++++ net/mac80211/mesh.h | 1 + net/wireless/nl80211.c | 6 ++++++ 7 files changed, 33 insertions(+), 0 deletions(-)
include/linux/nl80211.h +3 -0
@@ -1196,6 +1196,8 @@ enum nl80211_mntr_flags {* @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs) * that it takes for an HWMP information element to propagate across the mesh * +* @NL80211_MESHCONF_ROOTMODE: whether root mode is enabled or not +* * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute * * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
@@ -1215,6 +1217,7 @@ enum nl80211_meshconf_params {NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT ,NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL ,NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME , +NL80211_MESHCONF_HWMP_ROOTMODE ,/* keep last */ __NL80211_MESHCONF_ATTR_AFTER_LAST,
include/net/cfg80211.h +1 -0
@@ -506,6 +506,7 @@ struct mesh_config {u32 dot11MeshHWMPactivePathTimeout;u16 dot11MeshHWMPpreqMinInterval;u16 dot11MeshHWMPnetDiameterTraversalTime; +u8 dot11MeshHWMPRootMode; };/**
net/mac80211/cfg.c +7 -0
@@ -1001,7 +1001,10 @@ static int ieee80211_set_mesh_params(struct wiphy *wiphy, {struct mesh_config *conf;struct ieee80211_sub_if_data *sdata; +struct ieee80211_if_mesh *ifmsh; + sdata =IEEE80211_DEV_TO_SUB_IF (dev); + ifmsh = &sdata->u.mesh;/* Set the config options which we are interested in setting */ conf = &(sdata->u.mesh.mshcfg);
@@ -1036,6 +1039,10 @@ static int ieee80211_set_mesh_params(struct wiphy *wiphy, mask)) conf->dot11MeshHWMPnetDiameterTraversalTime = nconf->dot11MeshHWMPnetDiameterTraversalTime; +if (_chg_mesh_attr (NL80211_MESHCONF_HWMP_ROOTMODE , mask)) { + conf->dot11MeshHWMPRootMode = nconf->dot11MeshHWMPRootMode; +ieee80211_mesh_root_setup (ifmsh); + }return 0 ; }
net/mac80211/debugfs_netdev.c +2 -0
@@ -149,6 +149,8 @@ IEEE80211_IF_FILE(path_refresh_time, u.mesh.mshcfg.path_refresh_time, DEC);IEEE80211_IF_FILE (min_discovery_timeout, u.mesh.mshcfg.min_discovery_timeout,DEC ); +IEEE80211_IF_FILE (dot11MeshHWMPRootMode, + u.mesh.mshcfg.dot11MeshHWMPRootMode,DEC );#endif
net/mac80211/mesh.c +13 -0
@@ -373,6 +373,17 @@ static void ieee80211_mesh_path_root_timer(unsigned long data)ieee80211_queue_work (&local->hw, &ifmsh->work); } +void ieee80211_mesh_root_setup (struct ieee80211_if_mesh *ifmsh) +{ +if (ifmsh->mshcfg.dot11MeshHWMPRootMode) +set_bit (MESH_WORK_ROOT , &ifmsh->wrkq_flags); +else { +clear_bit (MESH_WORK_ROOT , &ifmsh->wrkq_flags); +/* stop running timer */ +del_timer_sync (&ifmsh->mesh_path_root_timer); + } +} +/** * ieee80211_fill_mesh_addresses - fill addresses of a locally originated mesh frame * @hdr: 802.11 frame header
@@ -503,6 +514,7 @@ void ieee80211_mesh_restart(struct ieee80211_sub_if_data *sdata)add_timer (&ifmsh->mesh_path_timer);if (test_and_clear_bit (TMR_RUNNING_MPR , &ifmsh->timers_running))add_timer (&ifmsh->mesh_path_root_timer); + ieee80211_mesh_root_setup(ifmsh); }#endif
@@ -512,6 +524,7 @@ void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)struct ieee80211_local *local = sdata->local;set_bit (MESH_WORK_HOUSEKEEPING , &ifmsh->wrkq_flags); +ieee80211_mesh_root_setup (ifmsh);ieee80211_queue_work (&local->hw, &ifmsh->work); sdata->vif.bss_conf.beacon_int =MESH_DEFAULT_BEACON_INTERVAL ; ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON |
net/mac80211/mesh.h +1 -0
@@ -242,6 +242,7 @@ ieee80211_rx_result ieee80211_mesh_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);void ieee80211_start_mesh (struct ieee80211_sub_if_data *sdata);void ieee80211_stop_mesh (struct ieee80211_sub_if_data *sdata); +void ieee80211_mesh_root_setup (struct ieee80211_if_mesh *ifmsh);/* Mesh paths */ int mesh_nexthop_lookup(struct sk_buff *skb,
net/wireless/nl80211.c +6 -0
@@ -2605,6 +2605,8 @@ static int nl80211_get_mesh_params(struct sk_buff *skb, cur_params.dot11MeshHWMPpreqMinInterval);NLA_PUT_U16 (msg,NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME , cur_params.dot11MeshHWMPnetDiameterTraversalTime); +NLA_PUT_U8 (msg,NL80211_MESHCONF_HWMP_ROOTMODE , + cur_params.dot11MeshHWMPRootMode);nla_nest_end (msg, pinfoattr);genlmsg_end (msg, hdr); err =genlmsg_reply (msg, info);
@@ -2715,6 +2717,10 @@ static int nl80211_set_mesh_params(struct sk_buff *skb, struct genl_info *info) dot11MeshHWMPnetDiameterTraversalTime, mask,NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME , nla_get_u16); +FILL_IN_MESH_PARAM_IF_SET (tb, cfg, + dot11MeshHWMPRootMode, mask, +NL80211_MESHCONF_HWMP_ROOTMODE , + nla_get_u8);/* Apply changes */ err = rdev->ops->set_mesh_params (&rdev->wiphy, dev, &cfg, mask);
Signature · 1 line
1.5.6.5
PATCH v2 20/20 mac80211: update copyrights to 2009
In reply to Rui Paulo--- net/mac80211/mesh.c | 2 +- net/mac80211/mesh.h | 2 +- net/mac80211/mesh_hwmp.c | 2 +- net/mac80211/mesh_pathtbl.c | 2 +- net/mac80211/mesh_plink.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
net/mac80211/mesh.c +1 -1
@@ -1,5 +1,5 @@/* -* Copyright (c) 2008 open80211s Ltd. +* Copyright (c) 2008, 2009 open80211s Ltd. * Authors: Luis Carlos Cobo <[email protected]> * Javier Cardona <[email protected]> *
net/mac80211/mesh.h +1 -1
@@ -1,5 +1,5 @@/* -* Copyright (c) 2008 open80211s Ltd. +* Copyright (c) 2008, 2009 open80211s Ltd. * Authors: Luis Carlos Cobo <[email protected]> * Javier Cardona <[email protected]> *
net/mac80211/mesh_hwmp.c +1 -1
@@ -1,5 +1,5 @@/* -* Copyright (c) 2008 open80211s Ltd. +* Copyright (c) 2008, 2009 open80211s Ltd. * Author: Luis Carlos Cobo <[email protected]> * * This program is free software; you can redistribute it and/or modify
net/mac80211/mesh_pathtbl.c +1 -1
@@ -1,5 +1,5 @@/* -* Copyright (c) 2008 open80211s Ltd. +* Copyright (c) 2008, 2009 open80211s Ltd. * Author: Luis Carlos Cobo <[email protected]> * * This program is free software; you can redistribute it and/or modify
net/mac80211/mesh_plink.c +1 -1
@@ -1,5 +1,5 @@/* -* Copyright (c) 2008 open80211s Ltd. +* Copyright (c) 2008, 2009 open80211s Ltd. * Author: Luis Carlos Cobo <[email protected]> * * This program is free software; you can redistribute it and/or modify
Signature · 1 line
1.5.6.5
Johannes Berg
maintainerQuoted 5 lines · Rui Paulo
Hi again,
Here's take two of the mesh update patch. As I already said, the following patches update the mesh code to latest draft, 3.03. They also include some minor cleanups and improved debugging.
I can't judge this in terms of draft compliance since I don't have that draft, but the code looks fine to me -- had just those few comments that I sent out in reply to particular patches.
johannes