aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211_cfg.c
diff options
context:
space:
mode:
authorJiri Benc <jbenc@suse.cz>2007-05-05 14:45:53 -0400
committerDavid S. Miller <davem@davemloft.net>2007-05-05 14:45:53 -0400
commitf0706e828e96d0fa4e80c0d25aa98523f6d589a0 (patch)
treea03c7f94939d74c1e1b82fcd9a215871590d8b35 /net/mac80211/ieee80211_cfg.c
parenta9de8ce0943e03b425be18561f51159fcceb873d (diff)
[MAC80211]: Add mac80211 wireless stack.
Add mac80211, the IEEE 802.11 software MAC layer. Signed-off-by: Jiri Benc <jbenc@suse.cz> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/ieee80211_cfg.c')
-rw-r--r--net/mac80211/ieee80211_cfg.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/net/mac80211/ieee80211_cfg.c b/net/mac80211/ieee80211_cfg.c
new file mode 100644
index 000000000000..509096edb324
--- /dev/null
+++ b/net/mac80211/ieee80211_cfg.c
@@ -0,0 +1,66 @@
1/*
2 * mac80211 configuration hooks for cfg80211
3 *
4 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
5 *
6 * This file is GPLv2 as found in COPYING.
7 */
8
9#include <linux/nl80211.h>
10#include <linux/rtnetlink.h>
11#include <net/cfg80211.h>
12#include "ieee80211_i.h"
13#include "ieee80211_cfg.h"
14
15static int ieee80211_add_iface(struct wiphy *wiphy, char *name,
16 unsigned int type)
17{
18 struct ieee80211_local *local = wiphy_priv(wiphy);
19 int itype;
20
21 if (unlikely(local->reg_state != IEEE80211_DEV_REGISTERED))
22 return -ENODEV;
23
24 switch (type) {
25 case NL80211_IFTYPE_UNSPECIFIED:
26 itype = IEEE80211_IF_TYPE_STA;
27 break;
28 case NL80211_IFTYPE_ADHOC:
29 itype = IEEE80211_IF_TYPE_IBSS;
30 break;
31 case NL80211_IFTYPE_STATION:
32 itype = IEEE80211_IF_TYPE_STA;
33 break;
34 case NL80211_IFTYPE_MONITOR:
35 itype = IEEE80211_IF_TYPE_MNTR;
36 break;
37 default:
38 return -EINVAL;
39 }
40
41 return ieee80211_if_add(local->mdev, name, NULL, itype);
42}
43
44static int ieee80211_del_iface(struct wiphy *wiphy, int ifindex)
45{
46 struct ieee80211_local *local = wiphy_priv(wiphy);
47 struct net_device *dev;
48 char *name;
49
50 if (unlikely(local->reg_state != IEEE80211_DEV_REGISTERED))
51 return -ENODEV;
52
53 dev = dev_get_by_index(ifindex);
54 if (!dev)
55 return 0;
56
57 name = dev->name;
58 dev_put(dev);
59
60 return ieee80211_if_remove(local->mdev, name, -1);
61}
62
63struct cfg80211_ops mac80211_config_ops = {
64 .add_virtual_intf = ieee80211_add_iface,
65 .del_virtual_intf = ieee80211_del_iface,
66};