aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/util.c')
-rw-r--r--net/mac80211/util.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 790c32f894c0..6b50b6c12da3 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -26,6 +26,9 @@
26 26
27#include "ieee80211_i.h" 27#include "ieee80211_i.h"
28#include "ieee80211_rate.h" 28#include "ieee80211_rate.h"
29#ifdef CONFIG_MAC80211_MESH
30#include "mesh.h"
31#endif
29#include "wme.h" 32#include "wme.h"
30 33
31/* privid for wiphys to determine whether they belong to us or not */ 34/* privid for wiphys to determine whether they belong to us or not */
@@ -146,6 +149,26 @@ int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb)
146} 149}
147EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb); 150EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
148 151
152#ifdef CONFIG_MAC80211_MESH
153int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
154{
155 int ae = meshhdr->flags & IEEE80211S_FLAGS_AE;
156 /* 7.1.3.5a.2 */
157 switch (ae) {
158 case 0:
159 return 5;
160 case 1:
161 return 11;
162 case 2:
163 return 17;
164 case 3:
165 return 23;
166 default:
167 return 5;
168 }
169}
170#endif
171
149void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx) 172void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx)
150{ 173{
151 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; 174 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data;
@@ -395,3 +418,31 @@ void ieee80211_iterate_active_interfaces(
395 rcu_read_unlock(); 418 rcu_read_unlock();
396} 419}
397EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces); 420EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces);
421
422#ifdef CONFIG_MAC80211_MESH
423/**
424 * ieee80211_new_mesh_header - create a new mesh header
425 * @meshhdr: uninitialized mesh header
426 * @sdata: mesh interface to be used
427 *
428 * Return the header length.
429 */
430int ieee80211_new_mesh_header(struct ieee80211s_hdr *meshhdr,
431 struct ieee80211_sub_if_data *sdata)
432{
433 meshhdr->flags = 0;
434 meshhdr->ttl = sdata->u.sta.mshcfg.dot11MeshTTL;
435
436 meshhdr->seqnum[0] = sdata->u.sta.mesh_seqnum[0]++;
437 meshhdr->seqnum[1] = sdata->u.sta.mesh_seqnum[1];
438 meshhdr->seqnum[2] = sdata->u.sta.mesh_seqnum[2];
439
440 if (sdata->u.sta.mesh_seqnum[0] == 0) {
441 sdata->u.sta.mesh_seqnum[1]++;
442 if (sdata->u.sta.mesh_seqnum[1] == 0)
443 sdata->u.sta.mesh_seqnum[2]++;
444 }
445
446 return 5;
447}
448#endif