aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-04-23 15:20:05 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:29:41 -0400
commit704232c2718c9d4b3375ec15a14fc0397970c449 (patch)
tree6ffaa759ebaee36c4242bff6b7630f148efcaea3 /include
parent2a5e1c0eb9efe26eed1dd072fe08de5797a7efd5 (diff)
[WIRELESS] cfg80211: New wireless config infrastructure.
This patch creates the core cfg80211 code along with some sysfs bits. This is a stripped down version to allow mac80211 to function, but doesn't include any configuration yet except for creating and removing virtual interfaces. This patch includes the nl80211 header file but it only contains the interface types which the cfg80211 interface for creating virtual interfaces relies on. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/netdevice.h4
-rw-r--r--include/linux/nl80211.h38
-rw-r--r--include/net/cfg80211.h36
-rw-r--r--include/net/wireless.h139
5 files changed, 218 insertions, 0 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index ea86f2e02716..4ff0f57d0add 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -113,6 +113,7 @@ header-y += netrom.h
113header-y += nfs2.h 113header-y += nfs2.h
114header-y += nfs4_mount.h 114header-y += nfs4_mount.h
115header-y += nfs_mount.h 115header-y += nfs_mount.h
116header-y += nl80211.h
116header-y += oom.h 117header-y += oom.h
117header-y += param.h 118header-y += param.h
118header-y += pci_regs.h 119header-y += pci_regs.h
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 71fc8ff4888b..584c199ec2d5 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -42,6 +42,8 @@
42struct vlan_group; 42struct vlan_group;
43struct ethtool_ops; 43struct ethtool_ops;
44struct netpoll_info; 44struct netpoll_info;
45/* 802.11 specific */
46struct wireless_dev;
45 /* source back-compat hooks */ 47 /* source back-compat hooks */
46#define SET_ETHTOOL_OPS(netdev,ops) \ 48#define SET_ETHTOOL_OPS(netdev,ops) \
47 ( (netdev)->ethtool_ops = (ops) ) 49 ( (netdev)->ethtool_ops = (ops) )
@@ -400,6 +402,8 @@ struct net_device
400 void *ip6_ptr; /* IPv6 specific data */ 402 void *ip6_ptr; /* IPv6 specific data */
401 void *ec_ptr; /* Econet specific data */ 403 void *ec_ptr; /* Econet specific data */
402 void *ax25_ptr; /* AX.25 specific data */ 404 void *ax25_ptr; /* AX.25 specific data */
405 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
406 assign before registering */
403 407
404/* 408/*
405 * Cache line mostly used on receive path (including eth_type_trans()) 409 * Cache line mostly used on receive path (including eth_type_trans())
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
new file mode 100644
index 000000000000..9a30ba2ca75e
--- /dev/null
+++ b/include/linux/nl80211.h
@@ -0,0 +1,38 @@
1#ifndef __LINUX_NL80211_H
2#define __LINUX_NL80211_H
3/*
4 * 802.11 netlink interface public header
5 *
6 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net>
7 */
8
9/**
10 * enum nl80211_iftype - (virtual) interface types
11 * @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides
12 * @NL80211_IFTYPE_ADHOC: independent BSS member
13 * @NL80211_IFTYPE_STATION: managed BSS member
14 * @NL80211_IFTYPE_AP: access point
15 * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points
16 * @NL80211_IFTYPE_WDS: wireless distribution interface
17 * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
18 * @__NL80211_IFTYPE_AFTER_LAST: internal use
19 *
20 * These values are used with the NL80211_ATTR_IFTYPE
21 * to set the type of an interface.
22 *
23 */
24enum nl80211_iftype {
25 NL80211_IFTYPE_UNSPECIFIED,
26 NL80211_IFTYPE_ADHOC,
27 NL80211_IFTYPE_STATION,
28 NL80211_IFTYPE_AP,
29 NL80211_IFTYPE_AP_VLAN,
30 NL80211_IFTYPE_WDS,
31 NL80211_IFTYPE_MONITOR,
32
33 /* keep last */
34 __NL80211_IFTYPE_AFTER_LAST
35};
36#define NL80211_IFTYPE_MAX (__NL80211_IFTYPE_AFTER_LAST - 1)
37
38#endif /* __LINUX_NL80211_H */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
new file mode 100644
index 000000000000..783a11437a57
--- /dev/null
+++ b/include/net/cfg80211.h
@@ -0,0 +1,36 @@
1#ifndef __NET_CFG80211_H
2#define __NET_CFG80211_H
3
4#include <linux/netlink.h>
5#include <linux/skbuff.h>
6#include <net/genetlink.h>
7
8/*
9 * 802.11 configuration in-kernel interface
10 *
11 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
12 */
13
14/* from net/wireless.h */
15struct wiphy;
16
17/**
18 * struct cfg80211_ops - backend description for wireless configuration
19 *
20 * This struct is registered by fullmac card drivers and/or wireless stacks
21 * in order to handle configuration requests on their interfaces.
22 *
23 * All callbacks except where otherwise noted should return 0
24 * on success or a negative error code.
25 *
26 * @add_virtual_intf: create a new virtual interface with the given name
27 *
28 * @del_virtual_intf: remove the virtual interface determined by ifindex.
29 */
30struct cfg80211_ops {
31 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
32 unsigned int type);
33 int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
34};
35
36#endif /* __NET_CFG80211_H */
diff --git a/include/net/wireless.h b/include/net/wireless.h
new file mode 100644
index 000000000000..d30c4ba8fd99
--- /dev/null
+++ b/include/net/wireless.h
@@ -0,0 +1,139 @@
1#ifndef __NET_WIRELESS_H
2#define __NET_WIRELESS_H
3
4/*
5 * 802.11 device management
6 *
7 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
8 */
9
10#include <linux/netdevice.h>
11#include <linux/debugfs.h>
12#include <linux/list.h>
13#include <net/cfg80211.h>
14
15/**
16 * struct wiphy - wireless hardware description
17 * @idx: the wiphy index assigned to this item
18 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
19 */
20struct wiphy {
21 /* assign these fields before you register the wiphy */
22
23 /* permanent MAC address */
24 u8 perm_addr[ETH_ALEN];
25
26 /* If multiple wiphys are registered and you're handed e.g.
27 * a regular netdev with assigned ieee80211_ptr, you won't
28 * know whether it points to a wiphy your driver has registered
29 * or not. Assign this to something global to your driver to
30 * help determine whether you own this wiphy or not. */
31 void *privid;
32
33 /* fields below are read-only, assigned by cfg80211 */
34
35 /* the item in /sys/class/ieee80211/ points to this,
36 * you need use set_wiphy_dev() (see below) */
37 struct device dev;
38
39 /* dir in debugfs: ieee80211/<wiphyname> */
40 struct dentry *debugfsdir;
41
42 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
43};
44
45/** struct wireless_dev - wireless per-netdev state
46 *
47 * This structure must be allocated by the driver/stack
48 * that uses the ieee80211_ptr field in struct net_device
49 * (this is intentional so it can be allocated along with
50 * the netdev.)
51 *
52 * @wiphy: pointer to hardware description
53 */
54struct wireless_dev {
55 struct wiphy *wiphy;
56
57 /* private to the generic wireless code */
58 struct list_head list;
59 struct net_device *netdev;
60};
61
62/**
63 * wiphy_priv - return priv from wiphy
64 */
65static inline void *wiphy_priv(struct wiphy *wiphy)
66{
67 BUG_ON(!wiphy);
68 return &wiphy->priv;
69}
70
71/**
72 * set_wiphy_dev - set device pointer for wiphy
73 */
74static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
75{
76 wiphy->dev.parent = dev;
77}
78
79/**
80 * wiphy_dev - get wiphy dev pointer
81 */
82static inline struct device *wiphy_dev(struct wiphy *wiphy)
83{
84 return wiphy->dev.parent;
85}
86
87/**
88 * wiphy_name - get wiphy name
89 */
90static inline char *wiphy_name(struct wiphy *wiphy)
91{
92 return wiphy->dev.bus_id;
93}
94
95/**
96 * wdev_priv - return wiphy priv from wireless_dev
97 */
98static inline void *wdev_priv(struct wireless_dev *wdev)
99{
100 BUG_ON(!wdev);
101 return wiphy_priv(wdev->wiphy);
102}
103
104/**
105 * wiphy_new - create a new wiphy for use with cfg80211
106 *
107 * create a new wiphy and associate the given operations with it.
108 * @sizeof_priv bytes are allocated for private use.
109 *
110 * the returned pointer must be assigned to each netdev's
111 * ieee80211_ptr for proper operation.
112 */
113struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv);
114
115/**
116 * wiphy_register - register a wiphy with cfg80211
117 *
118 * register the given wiphy
119 *
120 * Returns a non-negative wiphy index or a negative error code.
121 */
122extern int wiphy_register(struct wiphy *wiphy);
123
124/**
125 * wiphy_unregister - deregister a wiphy from cfg80211
126 *
127 * unregister a device with the given priv pointer.
128 * After this call, no more requests can be made with this priv
129 * pointer, but the call may sleep to wait for an outstanding
130 * request that is being handled.
131 */
132extern void wiphy_unregister(struct wiphy *wiphy);
133
134/**
135 * wiphy_free - free wiphy
136 */
137extern void wiphy_free(struct wiphy *wiphy);
138
139#endif /* __NET_WIRELESS_H */