aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mlme.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-09-10 18:01:49 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-15 16:48:20 -0400
commit472dbc45dc1966284de72d7de15690c17ed2cf33 (patch)
treee8bfb88067f7fd8845978d1613f868e6a4499999 /net/mac80211/mlme.c
parent7c95069522d02ff144cd421be6618dce619caf7e (diff)
mac80211: split off mesh handling entirely
This patch splits off mesh handling from the STA/IBSS. Unfortunately it increases mesh code size a bit, but I think it makes things clearer. The patch also reduces per-interface run-time memory usage. Also clean up a few places where ifdef is not required. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r--net/mac80211/mlme.c83
1 files changed, 3 insertions, 80 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index ef73f8953724..9e20a0c20a46 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -22,11 +22,11 @@
22#include <linux/rtnetlink.h> 22#include <linux/rtnetlink.h>
23#include <net/iw_handler.h> 23#include <net/iw_handler.h>
24#include <net/mac80211.h> 24#include <net/mac80211.h>
25#include <asm/unaligned.h>
25 26
26#include "ieee80211_i.h" 27#include "ieee80211_i.h"
27#include "rate.h" 28#include "rate.h"
28#include "led.h" 29#include "led.h"
29#include "mesh.h"
30 30
31#define IEEE80211_ASSOC_SCANS_MAX_TRIES 2 31#define IEEE80211_ASSOC_SCANS_MAX_TRIES 2
32#define IEEE80211_AUTH_TIMEOUT (HZ / 5) 32#define IEEE80211_AUTH_TIMEOUT (HZ / 5)
@@ -34,7 +34,6 @@
34#define IEEE80211_ASSOC_TIMEOUT (HZ / 5) 34#define IEEE80211_ASSOC_TIMEOUT (HZ / 5)
35#define IEEE80211_ASSOC_MAX_TRIES 3 35#define IEEE80211_ASSOC_MAX_TRIES 3
36#define IEEE80211_MONITORING_INTERVAL (2 * HZ) 36#define IEEE80211_MONITORING_INTERVAL (2 * HZ)
37#define IEEE80211_MESH_HOUSEKEEPING_INTERVAL (60 * HZ)
38#define IEEE80211_PROBE_INTERVAL (60 * HZ) 37#define IEEE80211_PROBE_INTERVAL (60 * HZ)
39#define IEEE80211_RETRY_AUTH_INTERVAL (1 * HZ) 38#define IEEE80211_RETRY_AUTH_INTERVAL (1 * HZ)
40#define IEEE80211_SCAN_INTERVAL (2 * HZ) 39#define IEEE80211_SCAN_INTERVAL (2 * HZ)
@@ -43,7 +42,6 @@
43 42
44#define IEEE80211_IBSS_MERGE_INTERVAL (30 * HZ) 43#define IEEE80211_IBSS_MERGE_INTERVAL (30 * HZ)
45#define IEEE80211_IBSS_INACTIVITY_LIMIT (60 * HZ) 44#define IEEE80211_IBSS_INACTIVITY_LIMIT (60 * HZ)
46#define IEEE80211_MESH_PEER_INACTIVITY_LIMIT (1800 * HZ)
47 45
48#define IEEE80211_IBSS_MAX_STA_ENTRIES 128 46#define IEEE80211_IBSS_MAX_STA_ENTRIES 128
49 47
@@ -1508,14 +1506,6 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
1508 if (!channel || channel->flags & IEEE80211_CHAN_DISABLED) 1506 if (!channel || channel->flags & IEEE80211_CHAN_DISABLED)
1509 return; 1507 return;
1510 1508
1511 if (ieee80211_vif_is_mesh(&sdata->vif) && elems->mesh_id &&
1512 elems->mesh_config && mesh_matches_local(elems, sdata)) {
1513 supp_rates = ieee80211_sta_get_rates(local, elems, band);
1514
1515 mesh_neighbour_update(mgmt->sa, supp_rates, sdata,
1516 mesh_peer_accepts_plinks(elems));
1517 }
1518
1519 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && elems->supp_rates && 1509 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && elems->supp_rates &&
1520 memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0) { 1510 memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0) {
1521 supp_rates = ieee80211_sta_get_rates(local, elems, band); 1511 supp_rates = ieee80211_sta_get_rates(local, elems, band);
@@ -1785,26 +1775,6 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
1785 ieee80211_tx_skb(sdata, skb, 0); 1775 ieee80211_tx_skb(sdata, skb, 0);
1786} 1776}
1787 1777
1788static void ieee80211_rx_mgmt_action(struct ieee80211_sub_if_data *sdata,
1789 struct ieee80211_if_sta *ifsta,
1790 struct ieee80211_mgmt *mgmt,
1791 size_t len,
1792 struct ieee80211_rx_status *rx_status)
1793{
1794 /* currently we only handle mesh interface action frames here */
1795 if (!ieee80211_vif_is_mesh(&sdata->vif))
1796 return;
1797
1798 switch (mgmt->u.action.category) {
1799 case PLINK_CATEGORY:
1800 mesh_rx_plink_frame(sdata, mgmt, len, rx_status);
1801 break;
1802 case MESH_PATH_SEL_CATEGORY:
1803 mesh_rx_path_sel_frame(sdata, mgmt, len);
1804 break;
1805 }
1806}
1807
1808void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, 1778void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
1809 struct ieee80211_rx_status *rx_status) 1779 struct ieee80211_rx_status *rx_status)
1810{ 1780{
@@ -1825,7 +1795,6 @@ void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *
1825 case IEEE80211_STYPE_PROBE_REQ: 1795 case IEEE80211_STYPE_PROBE_REQ:
1826 case IEEE80211_STYPE_PROBE_RESP: 1796 case IEEE80211_STYPE_PROBE_RESP:
1827 case IEEE80211_STYPE_BEACON: 1797 case IEEE80211_STYPE_BEACON:
1828 case IEEE80211_STYPE_ACTION:
1829 memcpy(skb->cb, rx_status, sizeof(*rx_status)); 1798 memcpy(skb->cb, rx_status, sizeof(*rx_status));
1830 case IEEE80211_STYPE_AUTH: 1799 case IEEE80211_STYPE_AUTH:
1831 case IEEE80211_STYPE_ASSOC_RESP: 1800 case IEEE80211_STYPE_ASSOC_RESP:
@@ -1881,9 +1850,6 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
1881 case IEEE80211_STYPE_DISASSOC: 1850 case IEEE80211_STYPE_DISASSOC:
1882 ieee80211_rx_mgmt_disassoc(sdata, ifsta, mgmt, skb->len); 1851 ieee80211_rx_mgmt_disassoc(sdata, ifsta, mgmt, skb->len);
1883 break; 1852 break;
1884 case IEEE80211_STYPE_ACTION:
1885 ieee80211_rx_mgmt_action(sdata, ifsta, mgmt, skb->len, rx_status);
1886 break;
1887 } 1853 }
1888 1854
1889 kfree_skb(skb); 1855 kfree_skb(skb);
@@ -1928,35 +1894,6 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata,
1928} 1894}
1929 1895
1930 1896
1931#ifdef CONFIG_MAC80211_MESH
1932static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata,
1933 struct ieee80211_if_sta *ifsta)
1934{
1935 bool free_plinks;
1936
1937 ieee80211_sta_expire(sdata, IEEE80211_MESH_PEER_INACTIVITY_LIMIT);
1938 mesh_path_expire(sdata);
1939
1940 free_plinks = mesh_plink_availables(sdata);
1941 if (free_plinks != sdata->u.sta.accepting_plinks)
1942 ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON);
1943
1944 mod_timer(&ifsta->timer, jiffies +
1945 IEEE80211_MESH_HOUSEKEEPING_INTERVAL);
1946}
1947
1948
1949void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
1950{
1951 struct ieee80211_if_sta *ifsta;
1952 ifsta = &sdata->u.sta;
1953 ifsta->state = IEEE80211_STA_MLME_MESH_UP;
1954 ieee80211_sta_timer((unsigned long)sdata);
1955 ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON);
1956}
1957#endif
1958
1959
1960void ieee80211_sta_timer(unsigned long data) 1897void ieee80211_sta_timer(unsigned long data)
1961{ 1898{
1962 struct ieee80211_sub_if_data *sdata = 1899 struct ieee80211_sub_if_data *sdata =
@@ -2524,21 +2461,13 @@ void ieee80211_sta_work(struct work_struct *work)
2524 return; 2461 return;
2525 2462
2526 if (WARN_ON(sdata->vif.type != IEEE80211_IF_TYPE_STA && 2463 if (WARN_ON(sdata->vif.type != IEEE80211_IF_TYPE_STA &&
2527 sdata->vif.type != IEEE80211_IF_TYPE_IBSS && 2464 sdata->vif.type != IEEE80211_IF_TYPE_IBSS))
2528 sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT))
2529 return; 2465 return;
2530 ifsta = &sdata->u.sta; 2466 ifsta = &sdata->u.sta;
2531 2467
2532 while ((skb = skb_dequeue(&ifsta->skb_queue))) 2468 while ((skb = skb_dequeue(&ifsta->skb_queue)))
2533 ieee80211_sta_rx_queued_mgmt(sdata, skb); 2469 ieee80211_sta_rx_queued_mgmt(sdata, skb);
2534 2470
2535#ifdef CONFIG_MAC80211_MESH
2536 if (ifsta->preq_queue_len &&
2537 time_after(jiffies,
2538 ifsta->last_preq + msecs_to_jiffies(ifsta->mshcfg.dot11MeshHWMPpreqMinInterval)))
2539 mesh_path_start_discovery(sdata);
2540#endif
2541
2542 if (ifsta->state != IEEE80211_STA_MLME_DIRECT_PROBE && 2471 if (ifsta->state != IEEE80211_STA_MLME_DIRECT_PROBE &&
2543 ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE && 2472 ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE &&
2544 ifsta->state != IEEE80211_STA_MLME_ASSOCIATE && 2473 ifsta->state != IEEE80211_STA_MLME_ASSOCIATE &&
@@ -2575,11 +2504,6 @@ void ieee80211_sta_work(struct work_struct *work)
2575 case IEEE80211_STA_MLME_IBSS_JOINED: 2504 case IEEE80211_STA_MLME_IBSS_JOINED:
2576 ieee80211_sta_merge_ibss(sdata, ifsta); 2505 ieee80211_sta_merge_ibss(sdata, ifsta);
2577 break; 2506 break;
2578#ifdef CONFIG_MAC80211_MESH
2579 case IEEE80211_STA_MLME_MESH_UP:
2580 ieee80211_mesh_housekeeping(sdata, ifsta);
2581 break;
2582#endif
2583 default: 2507 default:
2584 WARN_ON(1); 2508 WARN_ON(1);
2585 break; 2509 break;
@@ -2596,8 +2520,7 @@ void ieee80211_sta_work(struct work_struct *work)
2596 2520
2597static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata) 2521static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata)
2598{ 2522{
2599 if (sdata->vif.type == IEEE80211_IF_TYPE_STA || 2523 if (sdata->vif.type == IEEE80211_IF_TYPE_STA)
2600 ieee80211_vif_is_mesh(&sdata->vif))
2601 queue_work(sdata->local->hw.workqueue, 2524 queue_work(sdata->local->hw.workqueue,
2602 &sdata->u.sta.work); 2525 &sdata->u.sta.work);
2603} 2526}