Skip to content

Commit

Permalink
wext: refactor
Browse files Browse the repository at this point in the history
Refactor wext to
 * split out iwpriv handling
 * split out iwspy handling
 * split out procfs support
 * allow cfg80211 to have wireless extensions compat code
   w/o CONFIG_WIRELESS_EXT

After this, drivers need to
 - select WIRELESS_EXT	- for wext support
 - select WEXT_PRIV	- for iwpriv support
 - select WEXT_SPY	- for iwspy support

except cfg80211 -- which gets new hooks in wext-core.c
and can then get wext handlers without CONFIG_WIRELESS_EXT.

Wireless extensions procfs support is auto-selected
based on PROC_FS and anything that requires the wext core
(i.e. WIRELESS_EXT or CFG80211_WEXT).

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
  • Loading branch information
jmberg authored and linvjw committed Oct 7, 2009
1 parent bc974f4 commit 3d23e34
Show file tree
Hide file tree
Showing 22 changed files with 1,198 additions and 1,195 deletions.
29 changes: 22 additions & 7 deletions drivers/net/wireless/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ config WAVELAN
tristate "AT&T/Lucent old WaveLAN & DEC RoamAbout DS ISA support"
depends on ISA && WLAN_PRE80211
select WIRELESS_EXT
select WEXT_SPY
select WEXT_PRIV
---help---
The Lucent WaveLAN (formerly NCR and AT&T; or DEC RoamAbout DS) is
a Radio LAN (wireless Ethernet-like Local Area Network) using the
Expand All @@ -90,6 +92,8 @@ config PCMCIA_WAVELAN
tristate "AT&T/Lucent old WaveLAN Pcmcia wireless support"
depends on PCMCIA && WLAN_PRE80211
select WIRELESS_EXT
select WEXT_SPY
select WEXT_PRIV
help
Say Y here if you intend to attach an AT&T/Lucent Wavelan PCMCIA
(PC-card) wireless Ethernet networking card to your computer. This
Expand All @@ -102,6 +106,7 @@ config PCMCIA_NETWAVE
tristate "Xircom Netwave AirSurfer Pcmcia wireless support"
depends on PCMCIA && WLAN_PRE80211
select WIRELESS_EXT
select WEXT_PRIV
help
Say Y here if you intend to attach this type of PCMCIA (PC-card)
wireless Ethernet networking card to your computer.
Expand All @@ -123,6 +128,8 @@ config PCMCIA_RAYCS
tristate "Aviator/Raytheon 2.4GHz wireless support"
depends on PCMCIA && WLAN_80211
select WIRELESS_EXT
select WEXT_SPY
select WEXT_PRIV
---help---
Say Y here if you intend to attach an Aviator/Raytheon PCMCIA
(PC-card) wireless Ethernet networking card to your computer.
Expand All @@ -136,6 +143,7 @@ config LIBERTAS
tristate "Marvell 8xxx Libertas WLAN driver support"
depends on WLAN_80211
select WIRELESS_EXT
select WEXT_SPY
select LIB80211
select FW_LOADER
---help---
Expand Down Expand Up @@ -190,6 +198,8 @@ config AIRO
depends on ISA_DMA_API && WLAN_80211 && (PCI || BROKEN)
select WIRELESS_EXT
select CRYPTO
select WEXT_SPY
select WEXT_PRIV
---help---
This is the standard Linux driver to support Cisco/Aironet ISA and
PCI 802.11 wireless cards.
Expand All @@ -207,6 +217,7 @@ config ATMEL
tristate "Atmel at76c50x chipset 802.11b support"
depends on (PCI || PCMCIA) && WLAN_80211
select WIRELESS_EXT
select WEXT_PRIV
select FW_LOADER
select CRC32
---help---
Expand Down Expand Up @@ -266,18 +277,21 @@ config AIRO_CS
Cisco Linux utilities can be used to configure the card.

config PCMCIA_WL3501
tristate "Planet WL3501 PCMCIA cards"
depends on EXPERIMENTAL && PCMCIA && WLAN_80211
select WIRELESS_EXT
---help---
A driver for WL3501 PCMCIA 802.11 wireless cards made by Planet.
It has basic support for Linux wireless extensions and initial
micro support for ethtool.
tristate "Planet WL3501 PCMCIA cards"
depends on EXPERIMENTAL && PCMCIA && WLAN_80211
select WIRELESS_EXT
select WEXT_SPY
help
A driver for WL3501 PCMCIA 802.11 wireless cards made by Planet.
It has basic support for Linux wireless extensions and initial
micro support for ethtool.

config PRISM54
tristate 'Intersil Prism GT/Duette/Indigo PCI/Cardbus (DEPRECATED)'
depends on PCI && EXPERIMENTAL && WLAN_80211
select WIRELESS_EXT
select WEXT_SPY
select WEXT_PRIV
select FW_LOADER
---help---
This enables support for FullMAC PCI/Cardbus prism54 devices. This
Expand All @@ -300,6 +314,7 @@ config USB_ZD1201
tristate "USB ZD1201 based Wireless device support"
depends on USB && WLAN_80211
select WIRELESS_EXT
select WEXT_PRIV
select FW_LOADER
---help---
Say Y if you want to use wireless LAN adapters based on the ZyDAS
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/wireless/hostap/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ config HOSTAP
tristate "IEEE 802.11 for Host AP (Prism2/2.5/3 and WEP/TKIP/CCMP)"
depends on WLAN_80211
select WIRELESS_EXT
select WEXT_SPY
select WEXT_PRIV
select CRYPTO
select CRYPTO_ARC4
select CRYPTO_ECB
Expand Down
5 changes: 5 additions & 0 deletions drivers/net/wireless/ipw2x00/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ config IPW2100
tristate "Intel PRO/Wireless 2100 Network Connection"
depends on PCI && WLAN_80211 && CFG80211
select WIRELESS_EXT
select WEXT_SPY
select WEXT_PRIV
select FW_LOADER
select LIB80211
select LIBIPW
Expand Down Expand Up @@ -65,6 +67,8 @@ config IPW2200
tristate "Intel PRO/Wireless 2200BG and 2915ABG Network Connection"
depends on PCI && WLAN_80211 && CFG80211
select WIRELESS_EXT
select WEXT_SPY
select WEXT_PRIV
select FW_LOADER
select LIB80211
select LIBIPW
Expand Down Expand Up @@ -152,6 +156,7 @@ config LIBIPW
tristate
depends on PCI && WLAN_80211 && CFG80211
select WIRELESS_EXT
select WEXT_SPY
select CRYPTO
select CRYPTO_ARC4
select CRYPTO_ECB
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/wireless/orinoco/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ config HERMES
depends on (PPC_PMAC || PCI || PCMCIA) && WLAN_80211
depends on CFG80211
select WIRELESS_EXT
select WEXT_SPY
select WEXT_PRIV
select FW_LOADER
select CRYPTO
select CRYPTO_MICHAEL_MIC
Expand Down
6 changes: 5 additions & 1 deletion include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,10 @@ struct wiphy {
struct net *_net;
#endif

#ifdef CONFIG_CFG80211_WEXT
const struct iw_handler_def *wext;
#endif

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

Expand Down Expand Up @@ -1345,7 +1349,7 @@ struct wireless_dev {
struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES];
struct cfg80211_internal_bss *current_bss; /* associated / joined */

#ifdef CONFIG_WIRELESS_EXT
#ifdef CONFIG_CFG80211_WEXT
/* wext data */
struct {
struct cfg80211_ibss_params ibss;
Expand Down
14 changes: 8 additions & 6 deletions include/net/iw_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,18 +323,19 @@ typedef int (*iw_handler)(struct net_device *dev, struct iw_request_info *info,
*/
struct iw_handler_def
{
/* Number of handlers defined (more precisely, index of the
* last defined handler + 1) */
__u16 num_standard;
__u16 num_private;
/* Number of private arg description */
__u16 num_private_args;

/* Array of handlers for standard ioctls
* We will call dev->wireless_handlers->standard[ioctl - SIOCSIWCOMMIT]
*/
const iw_handler * standard;
/* Number of handlers defined (more precisely, index of the
* last defined handler + 1) */
__u16 num_standard;

#ifdef CONFIG_WEXT_PRIV
__u16 num_private;
/* Number of private arg description */
__u16 num_private_args;
/* Array of handlers for private ioctls
* Will call dev->wireless_handlers->private[ioctl - SIOCIWFIRSTPRIV]
*/
Expand All @@ -344,6 +345,7 @@ struct iw_handler_def
* can put it in any order you want and should not leave holes...
* We will automatically export that to user space... */
const struct iw_priv_args * private_args;
#endif

/* New location of get_wireless_stats, to de-bloat struct net_device.
* The old pointer in struct net_device will be gradually phased
Expand Down
2 changes: 1 addition & 1 deletion include/net/net_namespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct net {
#ifdef CONFIG_XFRM
struct netns_xfrm xfrm;
#endif
#ifdef CONFIG_WIRELESS_EXT
#ifdef CONFIG_WEXT_CORE
struct sk_buff_head wext_nlevents;
#endif
struct net_generic *gen;
Expand Down
49 changes: 35 additions & 14 deletions include/net/wext.h
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
#ifndef __NET_WEXT_H
#define __NET_WEXT_H

/*
* wireless extensions interface to the core code
*/
#include <net/iw_handler.h>

struct net;

#ifdef CONFIG_WIRELESS_EXT
extern int wext_proc_init(struct net *net);
extern void wext_proc_exit(struct net *net);
#ifdef CONFIG_WEXT_CORE
extern int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
void __user *arg);
extern int compat_wext_handle_ioctl(struct net *net, unsigned int cmd,
unsigned long arg);

extern struct iw_statistics *get_wireless_stats(struct net_device *dev);
extern int call_commit_handler(struct net_device *dev);
#else
static inline int wext_proc_init(struct net *net)
{
return 0;
}
static inline void wext_proc_exit(struct net *net)
{
return;
}
static inline int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
void __user *arg)
{
Expand All @@ -36,4 +26,35 @@ static inline int compat_wext_handle_ioctl(struct net *net, unsigned int cmd,
}
#endif

#ifdef CONFIG_WEXT_PROC
extern int wext_proc_init(struct net *net);
extern void wext_proc_exit(struct net *net);
#else
static inline int wext_proc_init(struct net *net)
{
return 0;
}
static inline void wext_proc_exit(struct net *net)
{
return;
}
#endif

#ifdef CONFIG_WEXT_PRIV
int ioctl_private_call(struct net_device *dev, struct iwreq *iwr,
unsigned int cmd, struct iw_request_info *info,
iw_handler handler);
int compat_private_call(struct net_device *dev, struct iwreq *iwr,
unsigned int cmd, struct iw_request_info *info,
iw_handler handler);
int iw_handler_get_private(struct net_device * dev,
struct iw_request_info * info,
union iwreq_data * wrqu,
char * extra);
#else
#define ioctl_private_call NULL
#define compat_private_call NULL
#endif


#endif /* __NET_WEXT_H */
6 changes: 5 additions & 1 deletion net/core/net-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,12 @@ int netdev_register_kobject(struct net_device *net)
*groups++ = &netstat_group;

#ifdef CONFIG_WIRELESS_EXT_SYSFS
if (net->wireless_handlers || net->ieee80211_ptr)
if (net->ieee80211_ptr)
*groups++ = &wireless_group;
#ifdef CONFIG_WIRELESS_EXT
else if (net->wireless_handlers)
*groups++ = &wireless_group;
#endif
#endif
#endif /* CONFIG_SYSFS */

Expand Down
4 changes: 2 additions & 2 deletions net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,11 +905,11 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg)
if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) {
err = dev_ioctl(net, cmd, argp);
} else
#ifdef CONFIG_WIRELESS_EXT
#ifdef CONFIG_WEXT_CORE
if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) {
err = dev_ioctl(net, cmd, argp);
} else
#endif /* CONFIG_WIRELESS_EXT */
#endif
switch (cmd) {
case FIOSETOWN:
case SIOCSPGRP:
Expand Down
50 changes: 35 additions & 15 deletions net/wireless/Kconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
config WIRELESS_EXT
bool

config WEXT_CORE
def_bool y
depends on CFG80211_WEXT || WIRELESS_EXT

config WEXT_PROC
def_bool y
depends on PROC_FS
depends on WEXT_CORE

config WEXT_SPY
bool

config WEXT_PRIV
bool

config CFG80211
tristate "cfg80211 - wireless configuration API"
depends on RFKILL || !RFKILL
Expand Down Expand Up @@ -56,6 +74,12 @@ config CFG80211_REG_DEBUG

If unsure, say N.

config CFG80211_DEFAULT_PS_VALUE
int
default 1 if CFG80211_DEFAULT_PS
default 0
depends on CFG80211

config CFG80211_DEFAULT_PS
bool "enable powersave by default"
depends on CFG80211
Expand All @@ -67,14 +91,10 @@ config CFG80211_DEFAULT_PS
applications instead -- they need to register their network
latency requirement, see Documentation/power/pm_qos_interface.txt.

config CFG80211_DEFAULT_PS_VALUE
int
default 1 if CFG80211_DEFAULT_PS
default 0

config CFG80211_DEBUGFS
bool "cfg80211 DebugFS entries"
depends on CFG80211 && DEBUG_FS
depends on CFG80211
depends on DEBUG_FS
---help---
You can enable this if you want to debugfs entries for cfg80211.

Expand All @@ -83,6 +103,7 @@ config CFG80211_DEBUGFS
config WIRELESS_OLD_REGULATORY
bool "Old wireless static regulatory definitions"
default n
depends on CFG80211
---help---
This option enables the old static regulatory information
and uses it within the new framework. This option is available
Expand All @@ -94,20 +115,19 @@ config WIRELESS_OLD_REGULATORY

Say N and if you say Y, please tell us why. The default is N.

config WIRELESS_EXT
bool "Wireless extensions"
config CFG80211_WEXT
bool "cfg80211 wireless extensions compatibility"
depends on CFG80211
select WEXT_CORE
default y
---help---
This option enables the legacy wireless extensions
(wireless network interface configuration via ioctls.)

Say Y unless you've upgraded all your userspace to use
nl80211 instead of wireless extensions.
help
Enable this option if you need old userspace for wireless
extensions with cfg80211-based drivers.

config WIRELESS_EXT_SYSFS
bool "Wireless extensions sysfs files"
default y
depends on WIRELESS_EXT && SYSFS
depends on WEXT_CORE && SYSFS
help
This option enables the deprecated wireless statistics
files in /sys/class/net/*/wireless/. The same information
Expand Down
Loading

0 comments on commit 3d23e34

Please sign in to comment.