o11s: other changes in mac80211 for mesh interface support
PATCH 8/13 o11s: other changes in mac80211 for mesh interface support
--- net/mac80211/ieee80211_i.h | 152 ++++++++++++++++++++++++++++++- net/mac80211/ieee80211_iface.c | 49 ++++++++++ net/mac80211/ieee80211_sta.c | 197 +++++++++++++++++++++++++++++++--------- net/mac80211/util.c | 46 +++++++++ 4 files changed, 400 insertions(+), 44 deletions(-)
net/mac80211/ieee80211_i.h +151 -1
@@ -224,6 +224,41 @@ struct ieee80211_if_vlan {struct list_head list; }; +struct mesh_stats { +__u32 fwded_frames;/* Mesh forwarded frames */ +__u32 dropped_frames_ttl;/* Not transmitted since mesh_ttl == 0*/ +__u32 dropped_frames_no_route;/* Not transmitted, no route found */ +atomic_t estab_plinks; +}; + +#define PREQ_Q_F_START 0x1 +#define PREQ_Q_F_REFRESH 0x2 +struct mesh_preq_queue { +struct list_head list; +u8 dst[ETH_ALEN ]; +u8 flags; +}; + + +struct mesh_config { +/* Timeouts in ms */ +/* Mesh plink management parameters */ +u16 dot11MeshRetryTimeout; +u16 dot11MeshConfirmTimeout; +u16 dot11MeshHoldingTimeout; +u16 dot11MeshMaxPeerLinks; +u8 dot11MeshMaxRetries; +u8 dot11MeshTTL; +bool auto_open_plinks; +/* HWMP parameters */ +u32 dot11MeshHWMPactivePathTimeout; +u16 dot11MeshHWMPpreqMinInterval; +u16 dot11MeshHWMPnetDiameterTraversalTime; +u8 dot11MeshHWMPmaxPREQretries; +u32 path_refresh_time; +u16 min_discovery_timeout; +}; +/* flags used in struct ieee80211_if_sta.flags */ #define IEEE80211_STA_SSID_SET BIT(0)#define IEEE80211_STA_BSSID_SET BIT(1)
@@ -242,15 +277,37 @@ struct ieee80211_if_sta {enum {IEEE80211_DISABLED ,IEEE80211_AUTHENTICATE ,IEEE80211_ASSOCIATE ,IEEE80211_ASSOCIATED , -IEEE80211_IBSS_SEARCH ,IEEE80211_IBSS_JOINED +IEEE80211_IBSS_SEARCH ,IEEE80211_IBSS_JOINED , +IEEE80211_MESH_UP } state;struct timer_list timer; +struct timer_list mesh_path_timer;struct work_struct work;u8 bssid[ETH_ALEN ], prev_bssid[ETH_ALEN ];u8 ssid[IEEE80211_MAX_SSID_LEN ];size_t ssid_len;u8 scan_ssid[IEEE80211_MAX_SSID_LEN ];size_t scan_ssid_len; +u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN ]; +bool accepting_plinks; +size_t mesh_id_len; +/* Active Path Selection Protocol Identifier */ +u8 mesh_pp_id[4 ]; +/* Active Path Selection Metric Identifier */ +u8 mesh_pm_id[4 ]; +/* Congestion Control Mode Identifier */ +u8 mesh_cc_id[4 ]; +/* Local mesh Destination Sequence Number */ +u32 dsn; +/* Last used PREQ ID */ +u32 preq_id; +atomic_t plinks; +atomic_t mpaths; +/* Timestamp of last DSN update */ +unsigned long last_dsn_update; +/* Timestamp of last DSN sent */ +unsigned long last_preq; +struct mesh_rmc *rmc;u16 aid;u16 ap_capab, capab;u8 *extra_ie;/* to be added to the end of AssocReq */
@@ -268,6 +325,9 @@ struct ieee80211_if_sta {#define IEEE80211_STA_REQ_RUN 2unsigned long request;struct sk_buff_head skb_queue; +spinlock_t mesh_preq_queue_lock; +struct mesh_preq_queue preq_queue; +int preq_queue_len;unsigned long last_probe;
@@ -283,6 +343,9 @@ struct ieee80211_if_sta {u32 supp_rates_bits[IEEE80211_NUM_BANDS ];int wmm_last_param_set; +struct mesh_stats mshstats; +struct mesh_config mshcfg; +u8 mesh_seqnum[3 ]; };
@@ -386,6 +449,32 @@ struct ieee80211_sub_if_data { } monitor;struct dentry *default_key; } debugfs; + +struct dentry *mesh_stats_dir; +struct { +struct dentry *fwded_frames; +struct dentry *dropped_frames_ttl; +struct dentry *dropped_frames_no_route; +struct dentry *estab_plinks; + } mesh_stats; + +struct dentry *mesh_config_dir; +struct { +struct dentry *dot11MeshRetryTimeout; +struct dentry *dot11MeshConfirmTimeout; +struct dentry *dot11MeshHoldingTimeout; +struct dentry *dot11MeshMaxRetries; +struct dentry *dot11MeshTTL; +struct dentry *auto_open_plinks; +struct dentry *dot11MeshMaxPeerLinks; +struct dentry *dot11MeshHWMPactivePathTimeout; +struct dentry *dot11MeshHWMPpreqMinInterval; +struct dentry *dot11MeshHWMPnetDiameterTraversalTime; +struct dentry *dot11MeshHWMPmaxPREQretries; +struct dentry *path_refresh_time; +struct dentry *min_discovery_timeout; + } mesh_config; +#endif /* must be last, dynamically sized area in this! */ struct ieee80211_vif vif;
@@ -614,6 +703,57 @@ struct ieee80211_ra_tid {u16 tid; }; +/* Parsed Information Elements */ +struct ieee802_11_elems { +/* pointers to IEs */ +u8 *ssid; +u8 *supp_rates; +u8 *fh_params; +u8 *ds_params; +u8 *cf_params; +u8 *tim; +u8 *ibss_params; +u8 *challenge; +u8 *wpa; +u8 *rsn; +u8 *erp_info; +u8 *ext_supp_rates; +u8 *wmm_info; +u8 *wmm_param; +u8 *ht_cap_elem; +u8 *ht_info_elem; +u8 *mesh_config; +u8 *mesh_id; +u8 *peer_link; +u8 *preq; +u8 *prep; +u8 *perr; + +/* length of them, respectively */ +u8 ssid_len; +u8 supp_rates_len; +u8 fh_params_len; +u8 ds_params_len; +u8 cf_params_len; +u8 tim_len; +u8 ibss_params_len; +u8 challenge_len; +u8 wpa_len; +u8 rsn_len; +u8 erp_info_len; +u8 ext_supp_rates_len; +u8 wmm_info_len; +u8 wmm_param_len; +u8 ht_cap_elem_len; +u8 ht_info_elem_len; +u8 mesh_config_len; +u8 mesh_id_len; +u8 peer_link_len; +u8 preq_len; +u8 prep_len; +u8 perr_len; +}; +static inline struct ieee80211_local *hw_to_local (struct ieee80211_hw *hw) {
@@ -757,6 +897,16 @@ void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *da, u16 tid, u16 initiator, u16 reason);void sta_rx_agg_session_timer_expired (unsigned long data);void sta_addba_resp_timer_expired (unsigned long data); +void ieee80211_start_mesh (struct net_device *dev); +int ieee80211_set_mesh_beacon_template (struct net_device *dev, +struct ieee80211_if_conf *conf); +void ieee80211_sta_tx (struct net_device *dev,struct sk_buff *skb, +int encrypt); +void ieee802_11_parse_elems (u8 *start,size_t len, +struct ieee802_11_elems *elems); +void ieee80211_mesh_path_timer (unsigned long data); + +/* ieee80211_iface.c */ int ieee80211_if_add (struct net_device *dev,const char *name,struct net_device **new_dev,int type);
net/mac80211/ieee80211_iface.c +49 -0
85 lines not on this page · raw message
net/mac80211/ieee80211_sta.c +154 -43
294 lines not on this page · raw message
net/mac80211/util.c +46 -0
67 lines not on this page · raw message
Signature · 1 line
1.5.2.5
Johannes Berg
maintainernet/mac80211/ieee80211_sta.c static void ieee80211_rx_mgmt_action(struct net_device *dev, · line 2516
Quoted 3 lines
net/mac80211/ieee80211_sta.c +2
-0default : +printk (KERN_DEBUG "%s: received unknown action frame - " +"category=%d\n" , dev->name, mgmt->u.action.category);
Needs to be rate limited or ignored as it was before.
Quoted 7 lines
net/mac80211/util.c +7
-0+int ieee80211_get_mesh_hdrlen (struct ieee80211s_hdr *meshhdr) +{ +int ae = meshhdr->flags &IEEE80211S_FLAGS_AE ; +/* 7.1.3.5a.2 */ +switch (ae) { +case 0 : +return 5 ;
net/mac80211/util.c int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb) · line 166
Quoted 10 lines
net/mac80211/util.c +10
-0+case 1 : +return 11 ; +case 2 : +return 17 ; +case 3 : +return 23 ; +default : +return 5 ; + } +}
What the hell? This is utterly horrible! Can that be changed in the spec so the header is always a multiple of four bytes? :)
This means we need to copy each mesh frame on platforms that don't handle unaligned loads, I don't see any DMA engine inserting 5 bytes padding... this makes things really complicated with alignment now and means we do have to clean up the mess in the stack, we can't require drivers to handle this weird mesh stuff :(
johannes
Quoted 12 lines · Johannes Berg
Quoted 12 lines
net/mac80211/util.c +12
-0+int ieee80211_get_mesh_hdrlen (struct ieee80211s_hdr *meshhdr) +{ +int ae = meshhdr->flags &IEEE80211S_FLAGS_AE ; +/* 7.1.3.5a.2 */ +switch (ae) { +case 0 : +return 5 ; +case 1 : +return 11 ; +case 2 : +return 17 ; +case 3 :
Quoted 8 lines
net/mac80211/util.c int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb) · line 166
Quoted 5 lines
net/mac80211/util.c +5
-0+return 23 ; +default : +return 5 ; + } +}What the hell? This is utterly horrible! Can that be changed in the spec so the header is always a multiple of four bytes? :)
Well it actually can be changed as it is still a draft... Guess you just need to convince a few hardware manufacturers that the change is in their interest..
Signature · 8 lines
Luis Carlos Cobo Rus GnuPG ID: 44019B60 cozybit Inc. -- Luis Carlos Cobo Rus GnuPG ID: 44019B60 cozybit Inc.