]> err.no Git - linux-2.6/blobdiff - net/mac80211/mesh.c
Merge branch 'pxa-devel' into pxa
[linux-2.6] / net / mac80211 / mesh.c
index ebe1a7a80bad494a32a3efc62d75c6f8d9e6d539..697ef67f96b6796bc60aaefa88720e67191ff007 100644 (file)
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <asm/unaligned.h>
 #include "ieee80211_i.h"
 #include "mesh.h"
 
@@ -48,11 +49,6 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct net_device *dev)
        struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
        struct ieee80211_if_sta *sta = &sdata->u.sta;
 
-       if (sta->mesh_id_len == ie->mesh_id_len &&
-               memcmp(sta->mesh_id, ie->mesh_id, ie->mesh_id_len) == 0 &&
-               memcmp(sta->mesh_pp_id, ie->mesh_config + PP_OFFSET, 4) == 0 &&
-               memcmp(sta->mesh_pm_id, ie->mesh_config + PM_OFFSET, 4) == 0 &&
-               memcmp(sta->mesh_cc_id, ie->mesh_config + CC_OFFSET, 4) == 0)
        /*
         * As support for each feature is added, check for matching
         * - On mesh config capabilities
@@ -63,6 +59,11 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct net_device *dev)
         *   - MDA enabled
         * - Power management control on fc
         */
+       if (sta->mesh_id_len == ie->mesh_id_len &&
+               memcmp(sta->mesh_id, ie->mesh_id, ie->mesh_id_len) == 0 &&
+               memcmp(sta->mesh_pp_id, ie->mesh_config + PP_OFFSET, 4) == 0 &&
+               memcmp(sta->mesh_pm_id, ie->mesh_config + PM_OFFSET, 4) == 0 &&
+               memcmp(sta->mesh_cc_id, ie->mesh_config + CC_OFFSET, 4) == 0)
                return true;
 
        return false;
@@ -83,18 +84,17 @@ bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie,
 /**
  * mesh_accept_plinks_update: update accepting_plink in local mesh beacons
  *
- * @dev: mesh interface in which mesh beacons are going to be updated
+ * @sdata: mesh interface in which mesh beacons are going to be updated
  */
-void mesh_accept_plinks_update(struct net_device *dev)
+void mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata)
 {
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
        bool free_plinks;
 
        /* In case mesh_plink_free_count > 0 and mesh_plinktbl_capacity == 0,
         * the mesh interface might be able to establish plinks with peers that
-        * are already on the table but are not on ESTAB state. However, in
-        * general the mesh interface is not accepting peer link requests from
-        * new peers, and that must be reflected in the beacon
+        * are already on the table but are not on PLINK_ESTAB state. However,
+        * in general the mesh interface is not accepting peer link requests
+        * from new peers, and that must be reflected in the beacon
         */
        free_plinks = mesh_plink_availables(sdata);
 
@@ -168,8 +168,8 @@ int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr,
        struct rmc_entry *p, *n;
 
        /* Don't care about endianness since only match matters */
-       memcpy(&seqnum, mesh_hdr->seqnum, sizeof(mesh_hdr->seqnum));
-       idx = mesh_hdr->seqnum[0] & rmc->idx_mask;
+       memcpy(&seqnum, &mesh_hdr->seqnum, sizeof(mesh_hdr->seqnum));
+       idx = le32_to_cpu(mesh_hdr->seqnum) & rmc->idx_mask;
        list_for_each_entry_safe(p, n, &rmc->bucket[idx].list, list) {
                ++entries;
                if (time_after(jiffies, p->exp_time) ||
@@ -394,18 +394,10 @@ int ieee80211_new_mesh_header(struct ieee80211s_hdr *meshhdr,
 {
        meshhdr->flags = 0;
        meshhdr->ttl = sdata->u.sta.mshcfg.dot11MeshTTL;
+       put_unaligned(cpu_to_le32(sdata->u.sta.mesh_seqnum), &meshhdr->seqnum);
+       sdata->u.sta.mesh_seqnum++;
 
-       meshhdr->seqnum[0] = sdata->u.sta.mesh_seqnum[0]++;
-       meshhdr->seqnum[1] = sdata->u.sta.mesh_seqnum[1];
-       meshhdr->seqnum[2] = sdata->u.sta.mesh_seqnum[2];
-
-       if (sdata->u.sta.mesh_seqnum[0] == 0) {
-               sdata->u.sta.mesh_seqnum[1]++;
-               if (sdata->u.sta.mesh_seqnum[1] == 0)
-                       sdata->u.sta.mesh_seqnum[2]++;
-       }
-
-       return 5;
+       return 6;
 }
 
 void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)