Skip to content

Commit

Permalink
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/…
Browse files Browse the repository at this point in the history
…linville/wireless-next-2.6
  • Loading branch information
David S. Miller committed Jun 15, 2008
2 parents 7d06b2e + 87291c0 commit 942e7b1
Show file tree
Hide file tree
Showing 74 changed files with 3,854 additions and 2,974 deletions.
67 changes: 67 additions & 0 deletions Documentation/networking/mac80211_hwsim/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
Copyright (c) 2008, Jouni Malinen <j@w1.fi>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.


Introduction

mac80211_hwsim is a Linux kernel module that can be used to simulate
arbitrary number of IEEE 802.11 radios for mac80211. It can be used to
test most of the mac80211 functionality and user space tools (e.g.,
hostapd and wpa_supplicant) in a way that matches very closely with
the normal case of using real WLAN hardware. From the mac80211 view
point, mac80211_hwsim is yet another hardware driver, i.e., no changes
to mac80211 are needed to use this testing tool.

The main goal for mac80211_hwsim is to make it easier for developers
to test their code and work with new features to mac80211, hostapd,
and wpa_supplicant. The simulated radios do not have the limitations
of real hardware, so it is easy to generate an arbitrary test setup
and always reproduce the same setup for future tests. In addition,
since all radio operation is simulated, any channel can be used in
tests regardless of regulatory rules.

mac80211_hwsim kernel module has a parameter 'radios' that can be used
to select how many radios are simulated (default 2). This allows
configuration of both very simply setups (e.g., just a single access
point and a station) or large scale tests (multiple access points with
hundreds of stations).

mac80211_hwsim works by tracking the current channel of each virtual
radio and copying all transmitted frames to all other radios that are
currently enabled and on the same channel as the transmitting
radio. Software encryption in mac80211 is used so that the frames are
actually encrypted over the virtual air interface to allow more
complete testing of encryption.

A global monitoring netdev, hwsim#, is created independent of
mac80211. This interface can be used to monitor all transmitted frames
regardless of channel.


Simple example

This example shows how to use mac80211_hwsim to simulate two radios:
one to act as an access point and the other as a station that
associates with the AP. hostapd and wpa_supplicant are used to take
care of WPA2-PSK authentication. In addition, hostapd is also
processing access point side of association.

Please note that the current Linux kernel does not enable AP mode, so a
simple patch is needed to enable AP mode selection:
http://johannes.sipsolutions.net/patches/kernel/all/LATEST/006-allow-ap-vlan-modes.patch


# Build mac80211_hwsim as part of kernel configuration

# Load the module
modprobe mac80211_hwsim

# Run hostapd (AP) for wlan0
hostapd hostapd.conf

# Run wpa_supplicant (station) for wlan1
wpa_supplicant -Dwext -iwlan1 -c wpa_supplicant.conf
11 changes: 11 additions & 0 deletions Documentation/networking/mac80211_hwsim/hostapd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
interface=wlan0
driver=nl80211

hw_mode=g
channel=1
ssid=mac80211 test

wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
wpa_passphrase=12345678
10 changes: 10 additions & 0 deletions Documentation/networking/mac80211_hwsim/wpa_supplicant.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ctrl_interface=/var/run/wpa_supplicant

network={
ssid="mac80211 test"
psk="12345678"
key_mgmt=WPA-PSK
proto=WPA2
pairwise=CCMP
group=CCMP
}
13 changes: 13 additions & 0 deletions drivers/net/wireless/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,19 @@ config ADM8211

Thanks to Infineon-ADMtek for their support of this driver.

config MAC80211_HWSIM
tristate "Simulated radio testing tool for mac80211"
depends on MAC80211 && WLAN_80211
---help---
This driver is a developer testing tool that can be used to test
IEEE 802.11 networking stack (mac80211) functionality. This is not
needed for normal wireless LAN usage and is only for testing. See
Documentation/networking/mac80211_hwsim for more information on how
to use this tool.

To compile this driver as a module, choose M here: the module will be
called mac80211_hwsim. If unsure, say N.

source "drivers/net/wireless/p54/Kconfig"
source "drivers/net/wireless/ath5k/Kconfig"
source "drivers/net/wireless/iwlwifi/Kconfig"
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/wireless/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ obj-$(CONFIG_RT2X00) += rt2x00/
obj-$(CONFIG_P54_COMMON) += p54/

obj-$(CONFIG_ATH5K) += ath5k/

obj-$(CONFIG_MAC80211_HWSIM) += mac80211_hwsim.o
15 changes: 3 additions & 12 deletions drivers/net/wireless/airo.c
Original file line number Diff line number Diff line change
Expand Up @@ -4561,22 +4561,13 @@ static ssize_t proc_read( struct file *file,
size_t len,
loff_t *offset )
{
loff_t pos = *offset;
struct proc_data *priv = (struct proc_data*)file->private_data;
struct proc_data *priv = file->private_data;

if (!priv->rbuffer)
return -EINVAL;

if (pos < 0)
return -EINVAL;
if (pos >= priv->readlen)
return 0;
if (len > priv->readlen - pos)
len = priv->readlen - pos;
if (copy_to_user(buffer, priv->rbuffer + pos, len))
return -EFAULT;
*offset = pos + len;
return len;
return simple_read_from_buffer(buffer, len, offset, priv->rbuffer,
priv->readlen);
}

/*
Expand Down
36 changes: 0 additions & 36 deletions drivers/net/wireless/iwlwifi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ config IWLWIFI_LEDS
bool
default n

config IWLWIFI_RUN_TIME_CALIB
bool
depends on IWLCORE
default n
---help---
This option will enable run time calibration for the iwlwifi driver.
These calibrations are Sensitivity and Chain Noise.


config IWLWIFI_RFKILL
boolean "IWLWIFI RF kill support"
depends on IWLCORE
Expand Down Expand Up @@ -54,14 +45,6 @@ config IWL4965
say M here and read <file:Documentation/kbuild/modules.txt>. The
module will be called iwl4965.ko.

config IWL4965_HT
bool "Enable 802.11n HT features in iwl4965 driver"
depends on EXPERIMENTAL
depends on IWL4965
---help---
This option enables IEEE 802.11n High Throughput features
for the iwl4965 driver.

config IWL4965_LEDS
bool "Enable LEDS features in iwl4965 driver"
depends on IWL4965
Expand All @@ -76,15 +59,6 @@ config IWL4965_SPECTRUM_MEASUREMENT
---help---
This option will enable spectrum measurement for the iwl4965 driver.

config IWL4965_RUN_TIME_CALIB
bool "Enable run time Calibration for 4965 NIC"
select IWLWIFI_RUN_TIME_CALIB
depends on IWL4965
default y
---help---
This option will enable run time calibration for the iwl4965 driver.
These calibrations are Sensitivity and Chain Noise. If unsure, say yes

config IWLWIFI_DEBUG
bool "Enable full debugging output in iwl4965 driver"
depends on IWL4965
Expand Down Expand Up @@ -118,16 +92,6 @@ config IWL5000
This option enables support for Intel Wireless WiFi Link 5000AGN Family
Dependency on 4965 is temporary

config IWL5000_RUN_TIME_CALIB
bool "Enable run time Calibration for 5000 NIC"
select IWLWIFI_RUN_TIME_CALIB
depends on IWL5000
default y
---help---
This option will enable run time calibration for the iwl5000 driver.
These calibrations are Sensitivity and Chain Noise. If unsure, say yes


config IWLWIFI_DEBUGFS
bool "Iwlwifi debugfs support"
depends on IWLCORE && IWLWIFI_DEBUG && MAC80211_DEBUGFS
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/wireless/iwlwifi/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
obj-$(CONFIG_IWLCORE) += iwlcore.o
iwlcore-objs := iwl-core.o iwl-eeprom.o iwl-hcmd.o iwl-power.o
iwlcore-objs += iwl-rx.o iwl-tx.o iwl-sta.o
iwlcore-objs += iwl-rx.o iwl-tx.o iwl-sta.o iwl-calib.o
iwlcore-objs += iwl-scan.o
iwlcore-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
iwlcore-$(CONFIG_IWLWIFI_LEDS) += iwl-led.o
iwlcore-$(CONFIG_IWLWIFI_RFKILL) += iwl-rfkill.o
iwlcore-$(CONFIG_IWLWIFI_RUN_TIME_CALIB) += iwl-calib.o

obj-$(CONFIG_IWL3945) += iwl3945.o
iwl3945-objs := iwl3945-base.o iwl-3945.o iwl-3945-rs.o
Expand Down
36 changes: 18 additions & 18 deletions drivers/net/wireless/iwlwifi/iwl-3945.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv,
u32 print_dump = 0; /* set to 1 to dump all frames' contents */
u32 hundred = 0;
u32 dataframe = 0;
u16 fc;
__le16 fc;
u16 seq_ctl;
u16 channel;
u16 phy_flags;
Expand All @@ -407,7 +407,7 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv,
u8 *data = IWL_RX_DATA(pkt);

/* MAC header */
fc = le16_to_cpu(header->frame_control);
fc = header->frame_control;
seq_ctl = le16_to_cpu(header->seq_ctrl);

/* metadata */
Expand All @@ -431,8 +431,8 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv,

/* if data frame is to us and all is good,
* (optionally) print summary for only 1 out of every 100 */
if (to_us && (fc & ~IEEE80211_FCTL_PROTECTED) ==
(IEEE80211_FCTL_FROMDS | IEEE80211_FTYPE_DATA)) {
if (to_us && (fc & ~cpu_to_le16(IEEE80211_FCTL_PROTECTED)) ==
cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FTYPE_DATA)) {
dataframe = 1;
if (!group100)
print_summary = 1; /* print each frame */
Expand All @@ -455,13 +455,13 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv,

if (hundred)
title = "100Frames";
else if (fc & IEEE80211_FCTL_RETRY)
else if (ieee80211_has_retry(fc))
title = "Retry";
else if (ieee80211_is_assoc_response(fc))
else if (ieee80211_is_assoc_resp(fc))
title = "AscRsp";
else if (ieee80211_is_reassoc_response(fc))
else if (ieee80211_is_reassoc_resp(fc))
title = "RasRsp";
else if (ieee80211_is_probe_response(fc)) {
else if (ieee80211_is_probe_resp(fc)) {
title = "PrbRsp";
print_dump = 1; /* dump frame contents */
} else if (ieee80211_is_beacon(fc)) {
Expand Down Expand Up @@ -490,14 +490,14 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv,
if (dataframe)
IWL_DEBUG_RX("%s: mhd=0x%04x, dst=0x%02x, "
"len=%u, rssi=%d, chnl=%d, rate=%u, \n",
title, fc, header->addr1[5],
title, le16_to_cpu(fc), header->addr1[5],
length, rssi, channel, rate);
else {
/* src/dst addresses assume managed mode */
IWL_DEBUG_RX("%s: 0x%04x, dst=0x%02x, "
"src=0x%02x, rssi=%u, tim=%lu usec, "
"phy=0x%02x, chnl=%d\n",
title, fc, header->addr1[5],
title, le16_to_cpu(fc), header->addr1[5],
header->addr3[5], rssi,
tsf_low - priv->scan_start_tsf,
phy_flags, channel);
Expand Down Expand Up @@ -971,7 +971,7 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv,
u8 rts_retry_limit;
u8 data_retry_limit;
__le32 tx_flags;
u16 fc = le16_to_cpu(hdr->frame_control);
__le16 fc = hdr->frame_control;

rate = iwl3945_rates[rate_index].plcp;
tx_flags = cmd->cmd.tx.tx_flags;
Expand All @@ -996,7 +996,7 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv,
else
rts_retry_limit = 7;

if (ieee80211_is_probe_response(fc)) {
if (ieee80211_is_probe_resp(fc)) {
data_retry_limit = 3;
if (data_retry_limit < rts_retry_limit)
rts_retry_limit = data_retry_limit;
Expand All @@ -1006,12 +1006,12 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv,
if (priv->data_retry_limit != -1)
data_retry_limit = priv->data_retry_limit;

if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) {
switch (fc & IEEE80211_FCTL_STYPE) {
case IEEE80211_STYPE_AUTH:
case IEEE80211_STYPE_DEAUTH:
case IEEE80211_STYPE_ASSOC_REQ:
case IEEE80211_STYPE_REASSOC_REQ:
if (ieee80211_is_mgmt(fc)) {
switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) {
case cpu_to_le16(IEEE80211_STYPE_AUTH):
case cpu_to_le16(IEEE80211_STYPE_DEAUTH):
case cpu_to_le16(IEEE80211_STYPE_ASSOC_REQ):
case cpu_to_le16(IEEE80211_STYPE_REASSOC_REQ):
if (tx_flags & TX_CMD_FLG_RTS_MSK) {
tx_flags &= ~TX_CMD_FLG_RTS_MSK;
tx_flags |= TX_CMD_FLG_CTS_MSK;
Expand Down
15 changes: 1 addition & 14 deletions drivers/net/wireless/iwlwifi/iwl-4965-hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
*/
#define IWL_CMD_QUEUE_NUM 4
#define IWL_CMD_FIFO_NUM 4
#define IWL_BACK_QUEUE_FIRST_ID 7
#define IWL49_FIRST_AMPDU_QUEUE 7

/* Tx rates */
#define IWL_CCK_RATES 4
Expand Down Expand Up @@ -793,19 +793,6 @@ enum {

/********************* END TXPOWER *****************************************/

static inline u8 iwl4965_hw_get_rate(__le32 rate_n_flags)
{
return le32_to_cpu(rate_n_flags) & 0xFF;
}
static inline u32 iwl4965_hw_get_rate_n_flags(__le32 rate_n_flags)
{
return le32_to_cpu(rate_n_flags) & 0x1FFFF;
}
static inline __le32 iwl4965_hw_set_rate_n_flags(u8 rate, u16 flags)
{
return cpu_to_le32(flags|(u16)rate);
}


/**
* Tx/Rx Queues
Expand Down
Loading

0 comments on commit 942e7b1

Please sign in to comment.