Skip to content

Commit

Permalink
[WIRELESS] cfg80211: New wireless config infrastructure.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
jmberg authored and David S. Miller committed Apr 26, 2007
1 parent 2a5e1c0 commit 704232c
Show file tree
Hide file tree
Showing 13 changed files with 583 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,12 @@ S: 2322 37th Ave SW
S: Seattle, Washington 98126-2010
S: USA

N: Johannes Berg
E: [email protected]
W: http://johannes.sipsolutions.net/
P: 1024D/9AB78CA5 AD02 0176 4E29 C137 1DF6 08D2 FC44 CF86 9AB7 8CA5
D: powerpc & 802.11 hacker

N: Stephen R. van den Berg (AKA BuGless)
E: [email protected]
D: General kernel, gcc, and libc hacker
Expand Down
6 changes: 6 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,12 @@ M: [email protected]
L: [email protected]
S: Maintained

CFG80211 and NL80211
P: Johannes Berg
M: [email protected]
L: [email protected]
S: Maintained

COMMON INTERNET FILE SYSTEM (CIFS)
P: Steve French
M: [email protected]
Expand Down
1 change: 1 addition & 0 deletions include/linux/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ header-y += netrom.h
header-y += nfs2.h
header-y += nfs4_mount.h
header-y += nfs_mount.h
header-y += nl80211.h
header-y += oom.h
header-y += param.h
header-y += pci_regs.h
Expand Down
4 changes: 4 additions & 0 deletions include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
struct vlan_group;
struct ethtool_ops;
struct netpoll_info;
/* 802.11 specific */
struct wireless_dev;
/* source back-compat hooks */
#define SET_ETHTOOL_OPS(netdev,ops) \
( (netdev)->ethtool_ops = (ops) )
Expand Down Expand Up @@ -400,6 +402,8 @@ struct net_device
void *ip6_ptr; /* IPv6 specific data */
void *ec_ptr; /* Econet specific data */
void *ax25_ptr; /* AX.25 specific data */
struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
assign before registering */

/*
* Cache line mostly used on receive path (including eth_type_trans())
Expand Down
38 changes: 38 additions & 0 deletions include/linux/nl80211.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#ifndef __LINUX_NL80211_H
#define __LINUX_NL80211_H
/*
* 802.11 netlink interface public header
*
* Copyright 2006, 2007 Johannes Berg <[email protected]>
*/

/**
* enum nl80211_iftype - (virtual) interface types
* @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides
* @NL80211_IFTYPE_ADHOC: independent BSS member
* @NL80211_IFTYPE_STATION: managed BSS member
* @NL80211_IFTYPE_AP: access point
* @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points
* @NL80211_IFTYPE_WDS: wireless distribution interface
* @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
* @__NL80211_IFTYPE_AFTER_LAST: internal use
*
* These values are used with the NL80211_ATTR_IFTYPE
* to set the type of an interface.
*
*/
enum nl80211_iftype {
NL80211_IFTYPE_UNSPECIFIED,
NL80211_IFTYPE_ADHOC,
NL80211_IFTYPE_STATION,
NL80211_IFTYPE_AP,
NL80211_IFTYPE_AP_VLAN,
NL80211_IFTYPE_WDS,
NL80211_IFTYPE_MONITOR,

/* keep last */
__NL80211_IFTYPE_AFTER_LAST
};
#define NL80211_IFTYPE_MAX (__NL80211_IFTYPE_AFTER_LAST - 1)

#endif /* __LINUX_NL80211_H */
36 changes: 36 additions & 0 deletions include/net/cfg80211.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef __NET_CFG80211_H
#define __NET_CFG80211_H

#include <linux/netlink.h>
#include <linux/skbuff.h>
#include <net/genetlink.h>

/*
* 802.11 configuration in-kernel interface
*
* Copyright 2006 Johannes Berg <[email protected]>
*/

/* from net/wireless.h */
struct wiphy;

/**
* struct cfg80211_ops - backend description for wireless configuration
*
* This struct is registered by fullmac card drivers and/or wireless stacks
* in order to handle configuration requests on their interfaces.
*
* All callbacks except where otherwise noted should return 0
* on success or a negative error code.
*
* @add_virtual_intf: create a new virtual interface with the given name
*
* @del_virtual_intf: remove the virtual interface determined by ifindex.
*/
struct cfg80211_ops {
int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
unsigned int type);
int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
};

#endif /* __NET_CFG80211_H */
139 changes: 139 additions & 0 deletions include/net/wireless.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
#ifndef __NET_WIRELESS_H
#define __NET_WIRELESS_H

/*
* 802.11 device management
*
* Copyright 2007 Johannes Berg <[email protected]>
*/

#include <linux/netdevice.h>
#include <linux/debugfs.h>
#include <linux/list.h>
#include <net/cfg80211.h>

/**
* struct wiphy - wireless hardware description
* @idx: the wiphy index assigned to this item
* @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
*/
struct wiphy {
/* assign these fields before you register the wiphy */

/* permanent MAC address */
u8 perm_addr[ETH_ALEN];

/* If multiple wiphys are registered and you're handed e.g.
* a regular netdev with assigned ieee80211_ptr, you won't
* know whether it points to a wiphy your driver has registered
* or not. Assign this to something global to your driver to
* help determine whether you own this wiphy or not. */
void *privid;

/* fields below are read-only, assigned by cfg80211 */

/* the item in /sys/class/ieee80211/ points to this,
* you need use set_wiphy_dev() (see below) */
struct device dev;

/* dir in debugfs: ieee80211/<wiphyname> */
struct dentry *debugfsdir;

char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
};

/** struct wireless_dev - wireless per-netdev state
*
* This structure must be allocated by the driver/stack
* that uses the ieee80211_ptr field in struct net_device
* (this is intentional so it can be allocated along with
* the netdev.)
*
* @wiphy: pointer to hardware description
*/
struct wireless_dev {
struct wiphy *wiphy;

/* private to the generic wireless code */
struct list_head list;
struct net_device *netdev;
};

/**
* wiphy_priv - return priv from wiphy
*/
static inline void *wiphy_priv(struct wiphy *wiphy)
{
BUG_ON(!wiphy);
return &wiphy->priv;
}

/**
* set_wiphy_dev - set device pointer for wiphy
*/
static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
{
wiphy->dev.parent = dev;
}

/**
* wiphy_dev - get wiphy dev pointer
*/
static inline struct device *wiphy_dev(struct wiphy *wiphy)
{
return wiphy->dev.parent;
}

/**
* wiphy_name - get wiphy name
*/
static inline char *wiphy_name(struct wiphy *wiphy)
{
return wiphy->dev.bus_id;
}

/**
* wdev_priv - return wiphy priv from wireless_dev
*/
static inline void *wdev_priv(struct wireless_dev *wdev)
{
BUG_ON(!wdev);
return wiphy_priv(wdev->wiphy);
}

/**
* wiphy_new - create a new wiphy for use with cfg80211
*
* create a new wiphy and associate the given operations with it.
* @sizeof_priv bytes are allocated for private use.
*
* the returned pointer must be assigned to each netdev's
* ieee80211_ptr for proper operation.
*/
struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv);

/**
* wiphy_register - register a wiphy with cfg80211
*
* register the given wiphy
*
* Returns a non-negative wiphy index or a negative error code.
*/
extern int wiphy_register(struct wiphy *wiphy);

/**
* wiphy_unregister - deregister a wiphy from cfg80211
*
* unregister a device with the given priv pointer.
* After this call, no more requests can be made with this priv
* pointer, but the call may sleep to wait for an outstanding
* request that is being handled.
*/
extern void wiphy_unregister(struct wiphy *wiphy);

/**
* wiphy_free - free wiphy
*/
extern void wiphy_free(struct wiphy *wiphy);

#endif /* __NET_WIRELESS_H */
3 changes: 3 additions & 0 deletions net/wireless/Kconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
config CFG80211
tristate "Improved wireless configuration API"

config WIRELESS_EXT
bool "Wireless extensions"
default n
Expand Down
4 changes: 3 additions & 1 deletion net/wireless/Makefile
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# dummy file for now
obj-$(CONFIG_CFG80211) += cfg80211.o

cfg80211-y += core.o sysfs.o
Loading

0 comments on commit 704232c

Please sign in to comment.