aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211_sta.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2008-04-08 14:15:46 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-08 14:15:46 -0400
commit247367016305637fb981db020679520e354c80c4 (patch)
treed1ffcbb1e88cf38eb2dc40efa80f2f6d45aa9c24 /net/mac80211/ieee80211_sta.c
parent8eefca4888c986d993b2571eb31f0397a5d0a178 (diff)
Revert "mac80211: use a struct for bss->mesh_config"
This reverts commit 6c4711b4697d93424e4b1f76a9929ba844d714a5. That patch breaks mesh config comparison between beacons/probe reponses, so every beacon from a mesh network would be added as a new bss. Since the comparison has to be performed for every received beacon I believe it is best to save the mesh config in a format easy to compare, rather than do a bunch of unaligned accesses to compare field by field. Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/ieee80211_sta.c')
-rw-r--r--net/mac80211/ieee80211_sta.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index c20ef89acad6..1ee07f0b02e2 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -27,7 +27,6 @@
27#include <linux/rtnetlink.h> 27#include <linux/rtnetlink.h>
28#include <net/iw_handler.h> 28#include <net/iw_handler.h>
29#include <asm/types.h> 29#include <asm/types.h>
30#include <asm/unaligned.h>
31 30
32#include <net/mac80211.h> 31#include <net/mac80211.h>
33#include "ieee80211_i.h" 32#include "ieee80211_i.h"
@@ -2123,11 +2122,6 @@ ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid, int freq,
2123} 2122}
2124 2123
2125#ifdef CONFIG_MAC80211_MESH 2124#ifdef CONFIG_MAC80211_MESH
2126static inline u32 bss_mesh_cfg_get(u8 *mesh_cfg, u8 offset)
2127{
2128 return be32_to_cpu(get_unaligned((__be32 *) (mesh_cfg + offset)));
2129}
2130
2131static struct ieee80211_sta_bss * 2125static struct ieee80211_sta_bss *
2132ieee80211_rx_mesh_bss_get(struct net_device *dev, u8 *mesh_id, int mesh_id_len, 2126ieee80211_rx_mesh_bss_get(struct net_device *dev, u8 *mesh_id, int mesh_id_len,
2133 u8 *mesh_cfg, int freq) 2127 u8 *mesh_cfg, int freq)
@@ -2167,7 +2161,7 @@ ieee80211_rx_mesh_bss_add(struct net_device *dev, u8 *mesh_id, int mesh_id_len,
2167 if (!bss) 2161 if (!bss)
2168 return NULL; 2162 return NULL;
2169 2163
2170 bss->mesh_cfg = kmalloc(sizeof(struct bss_mesh_config), GFP_ATOMIC); 2164 bss->mesh_cfg = kmalloc(MESH_CFG_CMP_LEN, GFP_ATOMIC);
2171 if (!bss->mesh_cfg) { 2165 if (!bss->mesh_cfg) {
2172 kfree(bss); 2166 kfree(bss);
2173 return NULL; 2167 return NULL;
@@ -2185,12 +2179,7 @@ ieee80211_rx_mesh_bss_add(struct net_device *dev, u8 *mesh_id, int mesh_id_len,
2185 2179
2186 atomic_inc(&bss->users); 2180 atomic_inc(&bss->users);
2187 atomic_inc(&bss->users); 2181 atomic_inc(&bss->users);
2188 bss->mesh_cfg->mesh_version = mesh_cfg[0]; 2182 memcpy(bss->mesh_cfg, mesh_cfg, MESH_CFG_CMP_LEN);
2189 bss->mesh_cfg->path_proto_id = bss_mesh_cfg_get(mesh_cfg, PP_OFFSET);
2190 bss->mesh_cfg->path_metric_id = bss_mesh_cfg_get(mesh_cfg, PM_OFFSET);
2191 bss->mesh_cfg->cong_control_id = bss_mesh_cfg_get(mesh_cfg, CC_OFFSET);
2192 bss->mesh_cfg->channel_precedence = bss_mesh_cfg_get(mesh_cfg,
2193 CP_OFFSET);
2194 bss->mesh_id_len = mesh_id_len; 2183 bss->mesh_id_len = mesh_id_len;
2195 bss->freq = freq; 2184 bss->freq = freq;
2196 spin_lock_bh(&local->sta_bss_lock); 2185 spin_lock_bh(&local->sta_bss_lock);
@@ -4067,33 +4056,36 @@ ieee80211_sta_scan_result(struct net_device *dev,
4067 4056
4068 if (bss_mesh_cfg(bss)) { 4057 if (bss_mesh_cfg(bss)) {
4069 char *buf; 4058 char *buf;
4070 struct bss_mesh_config *cfg = bss_mesh_cfg(bss); 4059 u8 *cfg = bss_mesh_cfg(bss);
4071 buf = kmalloc(50, GFP_ATOMIC); 4060 buf = kmalloc(50, GFP_ATOMIC);
4072 if (buf) { 4061 if (buf) {
4073 memset(&iwe, 0, sizeof(iwe)); 4062 memset(&iwe, 0, sizeof(iwe));
4074 iwe.cmd = IWEVCUSTOM; 4063 iwe.cmd = IWEVCUSTOM;
4075 sprintf(buf, "Mesh network (version %d)", 4064 sprintf(buf, "Mesh network (version %d)", cfg[0]);
4076 cfg->mesh_version);
4077 iwe.u.data.length = strlen(buf); 4065 iwe.u.data.length = strlen(buf);
4078 current_ev = iwe_stream_add_point(current_ev, end_buf, 4066 current_ev = iwe_stream_add_point(current_ev, end_buf,
4079 &iwe, buf); 4067 &iwe, buf);
4080 sprintf(buf, "Path Selection Protocol ID: " 4068 sprintf(buf, "Path Selection Protocol ID: "
4081 "0x%08X", cfg->path_proto_id); 4069 "0x%02X%02X%02X%02X", cfg[1], cfg[2], cfg[3],
4070 cfg[4]);
4082 iwe.u.data.length = strlen(buf); 4071 iwe.u.data.length = strlen(buf);
4083 current_ev = iwe_stream_add_point(current_ev, end_buf, 4072 current_ev = iwe_stream_add_point(current_ev, end_buf,
4084 &iwe, buf); 4073 &iwe, buf);
4085 sprintf(buf, "Path Selection Metric ID: " 4074 sprintf(buf, "Path Selection Metric ID: "
4086 "0x%08X", cfg->path_metric_id); 4075 "0x%02X%02X%02X%02X", cfg[5], cfg[6], cfg[7],
4076 cfg[8]);
4087 iwe.u.data.length = strlen(buf); 4077 iwe.u.data.length = strlen(buf);
4088 current_ev = iwe_stream_add_point(current_ev, end_buf, 4078 current_ev = iwe_stream_add_point(current_ev, end_buf,
4089 &iwe, buf); 4079 &iwe, buf);
4090 sprintf(buf, "Congestion Control Mode ID: " 4080 sprintf(buf, "Congestion Control Mode ID: "
4091 "0x%08X", cfg->cong_control_id); 4081 "0x%02X%02X%02X%02X", cfg[9], cfg[10],
4082 cfg[11], cfg[12]);
4092 iwe.u.data.length = strlen(buf); 4083 iwe.u.data.length = strlen(buf);
4093 current_ev = iwe_stream_add_point(current_ev, end_buf, 4084 current_ev = iwe_stream_add_point(current_ev, end_buf,
4094 &iwe, buf); 4085 &iwe, buf);
4095 sprintf(buf, "Channel Precedence: " 4086 sprintf(buf, "Channel Precedence: "
4096 "0x%08X", cfg->channel_precedence); 4087 "0x%02X%02X%02X%02X", cfg[13], cfg[14],
4088 cfg[15], cfg[16]);
4097 iwe.u.data.length = strlen(buf); 4089 iwe.u.data.length = strlen(buf);
4098 current_ev = iwe_stream_add_point(current_ev, end_buf, 4090 current_ev = iwe_stream_add_point(current_ev, end_buf,
4099 &iwe, buf); 4091 &iwe, buf);