mac80211_hwsim driver support userspace frame tx/rx
This patch adds to mac80211_hwsim the capability to send traffic via
userspace.
Frame exchange between kernel and user spaces is done through generic
netlink communication protocol. A new generic netlink family
MAC80211_HWSIM is proposed, this family contains three basic commands
HWSIM_CMD_REGISTER, which is the command used to register a new
traffic listener, HWSIM_CMD_FRAME, to exchange the frames from kernel
to user and vice-versa, and HWSIM_CMD_TX_INFO_FRAME which returns
from user all the information about retransmissions, rates, rx signal,
and so on.
How it works:
Once the driver is loaded the MAC80211_HWSIM family will be registered.
In the absence of userspace daemon, the driver itselfs implements a
perfect wireless medium as it did in the past. When a daemon sends a
HWSIM_CMD_REGISTER command, the module stores the application PID, and
from this moment all frames will be sent to the registered daemon.
The user space application will be in charge of process/forward all
frames broadcast by any mac80211_hwsim radio. If the user application
is stopped, the kernel module will detect the release of the socket
and it will switch back to in-kernel perfect channel simulation.
The userspace daemon must be waiting for incoming HWSIM_CMD_FRAME
commands sent from kernel, for each HWSIM_CMD_FRAME command the
application will try to broadcast this frame to all mac80211_hwsim
radios, however the application may decide to forward/drop this frame.
In the case of forwarding the frame, a new HWSIM_CMD_FRAME command will
be created, all necessary attributes will be populated and the frame
will be sent back to the kernel.
Also after the frame broadcast phase, a HWSIM_CMD_TX_INFO_FRAME
command will be sent from userspace to kernel, this command contains
all the information regarding the transmission, such as number of
tries, rates, ack signal, etc.
You can find the actual implementation of wireless mediumd daemon
(wmediumd) at:
* Last version tarball: https://github.com/jlopex/cozybit/tarball/master
* Or visiting my github tree: https://github.com/jlopex/cozybit/tree
Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-06-01 17:26:13 +08:00
|
|
|
/*
|
|
|
|
* mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
|
|
|
|
* Copyright (c) 2008, Jouni Malinen <j@w1.fi>
|
|
|
|
* Copyright (c) 2011, Javier Lopez <jlopex@gmail.com>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MAC80211_HWSIM_H
|
|
|
|
#define __MAC80211_HWSIM_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
* enum hwsim_tx_control_flags - flags to describe transmission info/status
|
|
|
|
*
|
|
|
|
* These flags are used to give the wmediumd extra information in order to
|
|
|
|
* modify its behavior for each frame
|
|
|
|
*
|
|
|
|
* @HWSIM_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame.
|
|
|
|
* @HWSIM_TX_CTL_NO_ACK: tell the wmediumd not to wait for an ack
|
|
|
|
* @HWSIM_TX_STAT_ACK: Frame was acknowledged
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
enum hwsim_tx_control_flags {
|
|
|
|
HWSIM_TX_CTL_REQ_TX_STATUS = BIT(0),
|
|
|
|
HWSIM_TX_CTL_NO_ACK = BIT(1),
|
|
|
|
HWSIM_TX_STAT_ACK = BIT(2),
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DOC: Frame transmission/registration support
|
|
|
|
*
|
|
|
|
* Frame transmission and registration support exists to allow userspace
|
|
|
|
* entities such as wmediumd to receive and process all broadcasted
|
|
|
|
* frames from a mac80211_hwsim radio device.
|
|
|
|
*
|
|
|
|
* This allow user space applications to decide if the frame should be
|
|
|
|
* dropped or not and implement a wireless medium simulator at user space.
|
|
|
|
*
|
|
|
|
* Registration is done by sending a register message to the driver and
|
|
|
|
* will be automatically unregistered if the user application doesn't
|
|
|
|
* responds to sent frames.
|
|
|
|
* Once registered the user application has to take responsibility of
|
|
|
|
* broadcasting the frames to all listening mac80211_hwsim radio
|
|
|
|
* interfaces.
|
|
|
|
*
|
|
|
|
* For more technical details, see the corresponding command descriptions
|
|
|
|
* below.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* enum hwsim_commands - supported hwsim commands
|
|
|
|
*
|
|
|
|
* @HWSIM_CMD_UNSPEC: unspecified command to catch errors
|
|
|
|
*
|
|
|
|
* @HWSIM_CMD_REGISTER: request to register and received all broadcasted
|
|
|
|
* frames by any mac80211_hwsim radio device.
|
|
|
|
* @HWSIM_CMD_FRAME: send/receive a broadcasted frame from/to kernel/user
|
2017-03-02 16:39:40 +08:00
|
|
|
* space, uses:
|
mac80211_hwsim driver support userspace frame tx/rx
This patch adds to mac80211_hwsim the capability to send traffic via
userspace.
Frame exchange between kernel and user spaces is done through generic
netlink communication protocol. A new generic netlink family
MAC80211_HWSIM is proposed, this family contains three basic commands
HWSIM_CMD_REGISTER, which is the command used to register a new
traffic listener, HWSIM_CMD_FRAME, to exchange the frames from kernel
to user and vice-versa, and HWSIM_CMD_TX_INFO_FRAME which returns
from user all the information about retransmissions, rates, rx signal,
and so on.
How it works:
Once the driver is loaded the MAC80211_HWSIM family will be registered.
In the absence of userspace daemon, the driver itselfs implements a
perfect wireless medium as it did in the past. When a daemon sends a
HWSIM_CMD_REGISTER command, the module stores the application PID, and
from this moment all frames will be sent to the registered daemon.
The user space application will be in charge of process/forward all
frames broadcast by any mac80211_hwsim radio. If the user application
is stopped, the kernel module will detect the release of the socket
and it will switch back to in-kernel perfect channel simulation.
The userspace daemon must be waiting for incoming HWSIM_CMD_FRAME
commands sent from kernel, for each HWSIM_CMD_FRAME command the
application will try to broadcast this frame to all mac80211_hwsim
radios, however the application may decide to forward/drop this frame.
In the case of forwarding the frame, a new HWSIM_CMD_FRAME command will
be created, all necessary attributes will be populated and the frame
will be sent back to the kernel.
Also after the frame broadcast phase, a HWSIM_CMD_TX_INFO_FRAME
command will be sent from userspace to kernel, this command contains
all the information regarding the transmission, such as number of
tries, rates, ack signal, etc.
You can find the actual implementation of wireless mediumd daemon
(wmediumd) at:
* Last version tarball: https://github.com/jlopex/cozybit/tarball/master
* Or visiting my github tree: https://github.com/jlopex/cozybit/tree
Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-06-01 17:26:13 +08:00
|
|
|
* %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_ADDR_RECEIVER,
|
|
|
|
* %HWSIM_ATTR_FRAME, %HWSIM_ATTR_FLAGS, %HWSIM_ATTR_RX_RATE,
|
2014-10-28 06:04:46 +08:00
|
|
|
* %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE, %HWSIM_ATTR_FREQ (optional)
|
mac80211_hwsim driver support userspace frame tx/rx
This patch adds to mac80211_hwsim the capability to send traffic via
userspace.
Frame exchange between kernel and user spaces is done through generic
netlink communication protocol. A new generic netlink family
MAC80211_HWSIM is proposed, this family contains three basic commands
HWSIM_CMD_REGISTER, which is the command used to register a new
traffic listener, HWSIM_CMD_FRAME, to exchange the frames from kernel
to user and vice-versa, and HWSIM_CMD_TX_INFO_FRAME which returns
from user all the information about retransmissions, rates, rx signal,
and so on.
How it works:
Once the driver is loaded the MAC80211_HWSIM family will be registered.
In the absence of userspace daemon, the driver itselfs implements a
perfect wireless medium as it did in the past. When a daemon sends a
HWSIM_CMD_REGISTER command, the module stores the application PID, and
from this moment all frames will be sent to the registered daemon.
The user space application will be in charge of process/forward all
frames broadcast by any mac80211_hwsim radio. If the user application
is stopped, the kernel module will detect the release of the socket
and it will switch back to in-kernel perfect channel simulation.
The userspace daemon must be waiting for incoming HWSIM_CMD_FRAME
commands sent from kernel, for each HWSIM_CMD_FRAME command the
application will try to broadcast this frame to all mac80211_hwsim
radios, however the application may decide to forward/drop this frame.
In the case of forwarding the frame, a new HWSIM_CMD_FRAME command will
be created, all necessary attributes will be populated and the frame
will be sent back to the kernel.
Also after the frame broadcast phase, a HWSIM_CMD_TX_INFO_FRAME
command will be sent from userspace to kernel, this command contains
all the information regarding the transmission, such as number of
tries, rates, ack signal, etc.
You can find the actual implementation of wireless mediumd daemon
(wmediumd) at:
* Last version tarball: https://github.com/jlopex/cozybit/tarball/master
* Or visiting my github tree: https://github.com/jlopex/cozybit/tree
Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-06-01 17:26:13 +08:00
|
|
|
* @HWSIM_CMD_TX_INFO_FRAME: Transmission info report from user space to
|
2017-03-02 16:39:40 +08:00
|
|
|
* kernel, uses:
|
mac80211_hwsim driver support userspace frame tx/rx
This patch adds to mac80211_hwsim the capability to send traffic via
userspace.
Frame exchange between kernel and user spaces is done through generic
netlink communication protocol. A new generic netlink family
MAC80211_HWSIM is proposed, this family contains three basic commands
HWSIM_CMD_REGISTER, which is the command used to register a new
traffic listener, HWSIM_CMD_FRAME, to exchange the frames from kernel
to user and vice-versa, and HWSIM_CMD_TX_INFO_FRAME which returns
from user all the information about retransmissions, rates, rx signal,
and so on.
How it works:
Once the driver is loaded the MAC80211_HWSIM family will be registered.
In the absence of userspace daemon, the driver itselfs implements a
perfect wireless medium as it did in the past. When a daemon sends a
HWSIM_CMD_REGISTER command, the module stores the application PID, and
from this moment all frames will be sent to the registered daemon.
The user space application will be in charge of process/forward all
frames broadcast by any mac80211_hwsim radio. If the user application
is stopped, the kernel module will detect the release of the socket
and it will switch back to in-kernel perfect channel simulation.
The userspace daemon must be waiting for incoming HWSIM_CMD_FRAME
commands sent from kernel, for each HWSIM_CMD_FRAME command the
application will try to broadcast this frame to all mac80211_hwsim
radios, however the application may decide to forward/drop this frame.
In the case of forwarding the frame, a new HWSIM_CMD_FRAME command will
be created, all necessary attributes will be populated and the frame
will be sent back to the kernel.
Also after the frame broadcast phase, a HWSIM_CMD_TX_INFO_FRAME
command will be sent from userspace to kernel, this command contains
all the information regarding the transmission, such as number of
tries, rates, ack signal, etc.
You can find the actual implementation of wireless mediumd daemon
(wmediumd) at:
* Last version tarball: https://github.com/jlopex/cozybit/tarball/master
* Or visiting my github tree: https://github.com/jlopex/cozybit/tree
Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-06-01 17:26:13 +08:00
|
|
|
* %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_FLAGS,
|
2018-01-11 00:42:55 +08:00
|
|
|
* %HWSIM_ATTR_TX_INFO, %WSIM_ATTR_TX_INFO_FLAGS,
|
|
|
|
* %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE
|
2014-10-27 18:44:46 +08:00
|
|
|
* @HWSIM_CMD_NEW_RADIO: create a new radio with the given parameters,
|
|
|
|
* returns the radio ID (>= 0) or negative on errors, if successful
|
2018-01-23 01:04:35 +08:00
|
|
|
* then multicast the result, uses optional parameter:
|
|
|
|
* %HWSIM_ATTR_REG_STRICT_REG, %HWSIM_ATTR_SUPPORT_P2P_DEVICE,
|
|
|
|
* %HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE, %HWSIM_ATTR_CHANNELS,
|
|
|
|
* %HWSIM_ATTR_NO_VIF, %HWSIM_ATTR_RADIO_NAME, %HWSIM_ATTR_USE_CHANCTX,
|
|
|
|
* %HWSIM_ATTR_REG_HINT_ALPHA2, %HWSIM_ATTR_REG_CUSTOM_REG,
|
|
|
|
* %HWSIM_ATTR_PERM_ADDR
|
2014-10-27 18:44:46 +08:00
|
|
|
* @HWSIM_CMD_DEL_RADIO: destroy a radio, reply is multicasted
|
2014-11-12 22:42:40 +08:00
|
|
|
* @HWSIM_CMD_GET_RADIO: fetch information about existing radios, uses:
|
|
|
|
* %HWSIM_ATTR_RADIO_ID
|
mac80211_hwsim driver support userspace frame tx/rx
This patch adds to mac80211_hwsim the capability to send traffic via
userspace.
Frame exchange between kernel and user spaces is done through generic
netlink communication protocol. A new generic netlink family
MAC80211_HWSIM is proposed, this family contains three basic commands
HWSIM_CMD_REGISTER, which is the command used to register a new
traffic listener, HWSIM_CMD_FRAME, to exchange the frames from kernel
to user and vice-versa, and HWSIM_CMD_TX_INFO_FRAME which returns
from user all the information about retransmissions, rates, rx signal,
and so on.
How it works:
Once the driver is loaded the MAC80211_HWSIM family will be registered.
In the absence of userspace daemon, the driver itselfs implements a
perfect wireless medium as it did in the past. When a daemon sends a
HWSIM_CMD_REGISTER command, the module stores the application PID, and
from this moment all frames will be sent to the registered daemon.
The user space application will be in charge of process/forward all
frames broadcast by any mac80211_hwsim radio. If the user application
is stopped, the kernel module will detect the release of the socket
and it will switch back to in-kernel perfect channel simulation.
The userspace daemon must be waiting for incoming HWSIM_CMD_FRAME
commands sent from kernel, for each HWSIM_CMD_FRAME command the
application will try to broadcast this frame to all mac80211_hwsim
radios, however the application may decide to forward/drop this frame.
In the case of forwarding the frame, a new HWSIM_CMD_FRAME command will
be created, all necessary attributes will be populated and the frame
will be sent back to the kernel.
Also after the frame broadcast phase, a HWSIM_CMD_TX_INFO_FRAME
command will be sent from userspace to kernel, this command contains
all the information regarding the transmission, such as number of
tries, rates, ack signal, etc.
You can find the actual implementation of wireless mediumd daemon
(wmediumd) at:
* Last version tarball: https://github.com/jlopex/cozybit/tarball/master
* Or visiting my github tree: https://github.com/jlopex/cozybit/tree
Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-06-01 17:26:13 +08:00
|
|
|
* @__HWSIM_CMD_MAX: enum limit
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
HWSIM_CMD_UNSPEC,
|
|
|
|
HWSIM_CMD_REGISTER,
|
|
|
|
HWSIM_CMD_FRAME,
|
|
|
|
HWSIM_CMD_TX_INFO_FRAME,
|
2014-10-27 18:44:46 +08:00
|
|
|
HWSIM_CMD_NEW_RADIO,
|
|
|
|
HWSIM_CMD_DEL_RADIO,
|
2014-11-12 22:42:40 +08:00
|
|
|
HWSIM_CMD_GET_RADIO,
|
mac80211_hwsim driver support userspace frame tx/rx
This patch adds to mac80211_hwsim the capability to send traffic via
userspace.
Frame exchange between kernel and user spaces is done through generic
netlink communication protocol. A new generic netlink family
MAC80211_HWSIM is proposed, this family contains three basic commands
HWSIM_CMD_REGISTER, which is the command used to register a new
traffic listener, HWSIM_CMD_FRAME, to exchange the frames from kernel
to user and vice-versa, and HWSIM_CMD_TX_INFO_FRAME which returns
from user all the information about retransmissions, rates, rx signal,
and so on.
How it works:
Once the driver is loaded the MAC80211_HWSIM family will be registered.
In the absence of userspace daemon, the driver itselfs implements a
perfect wireless medium as it did in the past. When a daemon sends a
HWSIM_CMD_REGISTER command, the module stores the application PID, and
from this moment all frames will be sent to the registered daemon.
The user space application will be in charge of process/forward all
frames broadcast by any mac80211_hwsim radio. If the user application
is stopped, the kernel module will detect the release of the socket
and it will switch back to in-kernel perfect channel simulation.
The userspace daemon must be waiting for incoming HWSIM_CMD_FRAME
commands sent from kernel, for each HWSIM_CMD_FRAME command the
application will try to broadcast this frame to all mac80211_hwsim
radios, however the application may decide to forward/drop this frame.
In the case of forwarding the frame, a new HWSIM_CMD_FRAME command will
be created, all necessary attributes will be populated and the frame
will be sent back to the kernel.
Also after the frame broadcast phase, a HWSIM_CMD_TX_INFO_FRAME
command will be sent from userspace to kernel, this command contains
all the information regarding the transmission, such as number of
tries, rates, ack signal, etc.
You can find the actual implementation of wireless mediumd daemon
(wmediumd) at:
* Last version tarball: https://github.com/jlopex/cozybit/tarball/master
* Or visiting my github tree: https://github.com/jlopex/cozybit/tree
Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-06-01 17:26:13 +08:00
|
|
|
__HWSIM_CMD_MAX,
|
|
|
|
};
|
|
|
|
#define HWSIM_CMD_MAX (_HWSIM_CMD_MAX - 1)
|
|
|
|
|
2014-10-27 18:44:46 +08:00
|
|
|
#define HWSIM_CMD_CREATE_RADIO HWSIM_CMD_NEW_RADIO
|
|
|
|
#define HWSIM_CMD_DESTROY_RADIO HWSIM_CMD_DEL_RADIO
|
|
|
|
|
mac80211_hwsim driver support userspace frame tx/rx
This patch adds to mac80211_hwsim the capability to send traffic via
userspace.
Frame exchange between kernel and user spaces is done through generic
netlink communication protocol. A new generic netlink family
MAC80211_HWSIM is proposed, this family contains three basic commands
HWSIM_CMD_REGISTER, which is the command used to register a new
traffic listener, HWSIM_CMD_FRAME, to exchange the frames from kernel
to user and vice-versa, and HWSIM_CMD_TX_INFO_FRAME which returns
from user all the information about retransmissions, rates, rx signal,
and so on.
How it works:
Once the driver is loaded the MAC80211_HWSIM family will be registered.
In the absence of userspace daemon, the driver itselfs implements a
perfect wireless medium as it did in the past. When a daemon sends a
HWSIM_CMD_REGISTER command, the module stores the application PID, and
from this moment all frames will be sent to the registered daemon.
The user space application will be in charge of process/forward all
frames broadcast by any mac80211_hwsim radio. If the user application
is stopped, the kernel module will detect the release of the socket
and it will switch back to in-kernel perfect channel simulation.
The userspace daemon must be waiting for incoming HWSIM_CMD_FRAME
commands sent from kernel, for each HWSIM_CMD_FRAME command the
application will try to broadcast this frame to all mac80211_hwsim
radios, however the application may decide to forward/drop this frame.
In the case of forwarding the frame, a new HWSIM_CMD_FRAME command will
be created, all necessary attributes will be populated and the frame
will be sent back to the kernel.
Also after the frame broadcast phase, a HWSIM_CMD_TX_INFO_FRAME
command will be sent from userspace to kernel, this command contains
all the information regarding the transmission, such as number of
tries, rates, ack signal, etc.
You can find the actual implementation of wireless mediumd daemon
(wmediumd) at:
* Last version tarball: https://github.com/jlopex/cozybit/tarball/master
* Or visiting my github tree: https://github.com/jlopex/cozybit/tree
Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-06-01 17:26:13 +08:00
|
|
|
/**
|
|
|
|
* enum hwsim_attrs - hwsim netlink attributes
|
|
|
|
*
|
|
|
|
* @HWSIM_ATTR_UNSPEC: unspecified attribute to catch errors
|
|
|
|
*
|
|
|
|
* @HWSIM_ATTR_ADDR_RECEIVER: MAC address of the radio device that
|
|
|
|
* the frame is broadcasted to
|
|
|
|
* @HWSIM_ATTR_ADDR_TRANSMITTER: MAC address of the radio device that
|
|
|
|
* the frame was broadcasted from
|
|
|
|
* @HWSIM_ATTR_FRAME: Data array
|
|
|
|
* @HWSIM_ATTR_FLAGS: mac80211 transmission flags, used to process
|
|
|
|
properly the frame at user space
|
|
|
|
* @HWSIM_ATTR_RX_RATE: estimated rx rate index for this frame at user
|
|
|
|
space
|
|
|
|
* @HWSIM_ATTR_SIGNAL: estimated RX signal for this frame at user
|
|
|
|
space
|
|
|
|
* @HWSIM_ATTR_TX_INFO: ieee80211_tx_rate array
|
|
|
|
* @HWSIM_ATTR_COOKIE: sk_buff cookie to identify the frame
|
2014-01-07 06:29:20 +08:00
|
|
|
* @HWSIM_ATTR_CHANNELS: u32 attribute used with the %HWSIM_CMD_CREATE_RADIO
|
|
|
|
* command giving the number of channels supported by the new radio
|
|
|
|
* @HWSIM_ATTR_RADIO_ID: u32 attribute used with %HWSIM_CMD_DESTROY_RADIO
|
|
|
|
* only to destroy a radio
|
2014-01-10 20:37:38 +08:00
|
|
|
* @HWSIM_ATTR_REG_HINT_ALPHA2: alpha2 for regulatoro driver hint
|
|
|
|
* (nla string, length 2)
|
|
|
|
* @HWSIM_ATTR_REG_CUSTOM_REG: custom regulatory domain index (u32 attribute)
|
|
|
|
* @HWSIM_ATTR_REG_STRICT_REG: request REGULATORY_STRICT_REG (flag attribute)
|
2014-01-11 03:07:49 +08:00
|
|
|
* @HWSIM_ATTR_SUPPORT_P2P_DEVICE: support P2P Device virtual interface (flag)
|
2014-02-10 21:23:03 +08:00
|
|
|
* @HWSIM_ATTR_USE_CHANCTX: used with the %HWSIM_CMD_CREATE_RADIO
|
|
|
|
* command to force use of channel contexts even when only a
|
|
|
|
* single channel is supported
|
2014-10-09 20:27:51 +08:00
|
|
|
* @HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE: used with the %HWSIM_CMD_CREATE_RADIO
|
|
|
|
* command to force radio removal when process that created the radio dies
|
2014-10-23 03:22:59 +08:00
|
|
|
* @HWSIM_ATTR_RADIO_NAME: Name of radio, e.g. phy666
|
2014-10-23 03:23:04 +08:00
|
|
|
* @HWSIM_ATTR_NO_VIF: Do not create vif (wlanX) when creating radio.
|
2014-10-28 06:04:46 +08:00
|
|
|
* @HWSIM_ATTR_FREQ: Frequency at which packet is transmitted or received.
|
2018-01-11 00:42:55 +08:00
|
|
|
* @HWSIM_ATTR_TX_INFO_FLAGS: additional flags for corresponding
|
|
|
|
* rates of %HWSIM_ATTR_TX_INFO
|
2018-01-23 01:04:35 +08:00
|
|
|
* @HWSIM_ATTR_PERM_ADDR: permanent mac address of new radio
|
mac80211_hwsim driver support userspace frame tx/rx
This patch adds to mac80211_hwsim the capability to send traffic via
userspace.
Frame exchange between kernel and user spaces is done through generic
netlink communication protocol. A new generic netlink family
MAC80211_HWSIM is proposed, this family contains three basic commands
HWSIM_CMD_REGISTER, which is the command used to register a new
traffic listener, HWSIM_CMD_FRAME, to exchange the frames from kernel
to user and vice-versa, and HWSIM_CMD_TX_INFO_FRAME which returns
from user all the information about retransmissions, rates, rx signal,
and so on.
How it works:
Once the driver is loaded the MAC80211_HWSIM family will be registered.
In the absence of userspace daemon, the driver itselfs implements a
perfect wireless medium as it did in the past. When a daemon sends a
HWSIM_CMD_REGISTER command, the module stores the application PID, and
from this moment all frames will be sent to the registered daemon.
The user space application will be in charge of process/forward all
frames broadcast by any mac80211_hwsim radio. If the user application
is stopped, the kernel module will detect the release of the socket
and it will switch back to in-kernel perfect channel simulation.
The userspace daemon must be waiting for incoming HWSIM_CMD_FRAME
commands sent from kernel, for each HWSIM_CMD_FRAME command the
application will try to broadcast this frame to all mac80211_hwsim
radios, however the application may decide to forward/drop this frame.
In the case of forwarding the frame, a new HWSIM_CMD_FRAME command will
be created, all necessary attributes will be populated and the frame
will be sent back to the kernel.
Also after the frame broadcast phase, a HWSIM_CMD_TX_INFO_FRAME
command will be sent from userspace to kernel, this command contains
all the information regarding the transmission, such as number of
tries, rates, ack signal, etc.
You can find the actual implementation of wireless mediumd daemon
(wmediumd) at:
* Last version tarball: https://github.com/jlopex/cozybit/tarball/master
* Or visiting my github tree: https://github.com/jlopex/cozybit/tree
Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-06-01 17:26:13 +08:00
|
|
|
* @__HWSIM_ATTR_MAX: enum limit
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
HWSIM_ATTR_UNSPEC,
|
|
|
|
HWSIM_ATTR_ADDR_RECEIVER,
|
|
|
|
HWSIM_ATTR_ADDR_TRANSMITTER,
|
|
|
|
HWSIM_ATTR_FRAME,
|
|
|
|
HWSIM_ATTR_FLAGS,
|
|
|
|
HWSIM_ATTR_RX_RATE,
|
|
|
|
HWSIM_ATTR_SIGNAL,
|
|
|
|
HWSIM_ATTR_TX_INFO,
|
|
|
|
HWSIM_ATTR_COOKIE,
|
2014-01-07 06:29:20 +08:00
|
|
|
HWSIM_ATTR_CHANNELS,
|
|
|
|
HWSIM_ATTR_RADIO_ID,
|
2014-01-10 20:37:38 +08:00
|
|
|
HWSIM_ATTR_REG_HINT_ALPHA2,
|
|
|
|
HWSIM_ATTR_REG_CUSTOM_REG,
|
|
|
|
HWSIM_ATTR_REG_STRICT_REG,
|
2014-01-11 03:07:49 +08:00
|
|
|
HWSIM_ATTR_SUPPORT_P2P_DEVICE,
|
2014-02-10 21:23:03 +08:00
|
|
|
HWSIM_ATTR_USE_CHANCTX,
|
2014-10-09 20:27:51 +08:00
|
|
|
HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE,
|
2014-10-23 03:22:59 +08:00
|
|
|
HWSIM_ATTR_RADIO_NAME,
|
2014-10-23 03:23:04 +08:00
|
|
|
HWSIM_ATTR_NO_VIF,
|
2014-10-28 06:04:46 +08:00
|
|
|
HWSIM_ATTR_FREQ,
|
2016-04-26 16:06:12 +08:00
|
|
|
HWSIM_ATTR_PAD,
|
2018-01-11 00:42:55 +08:00
|
|
|
HWSIM_ATTR_TX_INFO_FLAGS,
|
2018-01-23 01:04:35 +08:00
|
|
|
HWSIM_ATTR_PERM_ADDR,
|
mac80211_hwsim driver support userspace frame tx/rx
This patch adds to mac80211_hwsim the capability to send traffic via
userspace.
Frame exchange between kernel and user spaces is done through generic
netlink communication protocol. A new generic netlink family
MAC80211_HWSIM is proposed, this family contains three basic commands
HWSIM_CMD_REGISTER, which is the command used to register a new
traffic listener, HWSIM_CMD_FRAME, to exchange the frames from kernel
to user and vice-versa, and HWSIM_CMD_TX_INFO_FRAME which returns
from user all the information about retransmissions, rates, rx signal,
and so on.
How it works:
Once the driver is loaded the MAC80211_HWSIM family will be registered.
In the absence of userspace daemon, the driver itselfs implements a
perfect wireless medium as it did in the past. When a daemon sends a
HWSIM_CMD_REGISTER command, the module stores the application PID, and
from this moment all frames will be sent to the registered daemon.
The user space application will be in charge of process/forward all
frames broadcast by any mac80211_hwsim radio. If the user application
is stopped, the kernel module will detect the release of the socket
and it will switch back to in-kernel perfect channel simulation.
The userspace daemon must be waiting for incoming HWSIM_CMD_FRAME
commands sent from kernel, for each HWSIM_CMD_FRAME command the
application will try to broadcast this frame to all mac80211_hwsim
radios, however the application may decide to forward/drop this frame.
In the case of forwarding the frame, a new HWSIM_CMD_FRAME command will
be created, all necessary attributes will be populated and the frame
will be sent back to the kernel.
Also after the frame broadcast phase, a HWSIM_CMD_TX_INFO_FRAME
command will be sent from userspace to kernel, this command contains
all the information regarding the transmission, such as number of
tries, rates, ack signal, etc.
You can find the actual implementation of wireless mediumd daemon
(wmediumd) at:
* Last version tarball: https://github.com/jlopex/cozybit/tarball/master
* Or visiting my github tree: https://github.com/jlopex/cozybit/tree
Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-06-01 17:26:13 +08:00
|
|
|
__HWSIM_ATTR_MAX,
|
|
|
|
};
|
|
|
|
#define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct hwsim_tx_rate - rate selection/status
|
|
|
|
*
|
|
|
|
* @idx: rate index to attempt to send with
|
|
|
|
* @count: number of tries in this rate before going to the next rate
|
|
|
|
*
|
|
|
|
* A value of -1 for @idx indicates an invalid rate and, if used
|
|
|
|
* in an array of retry rates, that no more rates should be tried.
|
|
|
|
*
|
|
|
|
* When used for transmit status reporting, the driver should
|
|
|
|
* always report the rate and number of retries used.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
struct hwsim_tx_rate {
|
|
|
|
s8 idx;
|
|
|
|
u8 count;
|
|
|
|
} __packed;
|
|
|
|
|
2018-01-11 00:42:55 +08:00
|
|
|
/**
|
|
|
|
* enum hwsim_tx_rate_flags - per-rate flags set by the rate control algorithm.
|
|
|
|
* Inspired by structure mac80211_rate_control_flags. New flags may be
|
|
|
|
* appended, but old flags not deleted, to keep compatibility for
|
|
|
|
* userspace.
|
|
|
|
*
|
|
|
|
* These flags are set by the Rate control algorithm for each rate during tx,
|
|
|
|
* in the @flags member of struct ieee80211_tx_rate.
|
|
|
|
*
|
|
|
|
* @MAC80211_HWSIM_TX_RC_USE_RTS_CTS: Use RTS/CTS exchange for this rate.
|
|
|
|
* @MAC80211_HWSIM_TX_RC_USE_CTS_PROTECT: CTS-to-self protection is required.
|
|
|
|
* This is set if the current BSS requires ERP protection.
|
|
|
|
* @MAC80211_HWSIM_TX_RC_USE_SHORT_PREAMBLE: Use short preamble.
|
|
|
|
* @MAC80211_HWSIM_TX_RC_MCS: HT rate.
|
|
|
|
* @MAC80211_HWSIM_TX_RC_VHT_MCS: VHT MCS rate, in this case the idx field is
|
|
|
|
* split into a higher 4 bits (Nss) and lower 4 bits (MCS number)
|
|
|
|
* @MAC80211_HWSIM_TX_RC_GREEN_FIELD: Indicates whether this rate should be used
|
|
|
|
* in Greenfield mode.
|
|
|
|
* @MAC80211_HWSIM_TX_RC_40_MHZ_WIDTH: Indicates if the Channel Width should be
|
|
|
|
* 40 MHz.
|
|
|
|
* @MAC80211_HWSIM_TX_RC_80_MHZ_WIDTH: Indicates 80 MHz transmission
|
|
|
|
* @MAC80211_HWSIM_TX_RC_160_MHZ_WIDTH: Indicates 160 MHz transmission
|
|
|
|
* (80+80 isn't supported yet)
|
|
|
|
* @MAC80211_HWSIM_TX_RC_DUP_DATA: The frame should be transmitted on both of
|
|
|
|
* the adjacent 20 MHz channels, if the current channel type is
|
|
|
|
* NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS.
|
|
|
|
* @MAC80211_HWSIM_TX_RC_SHORT_GI: Short Guard interval should be used for this
|
|
|
|
* rate.
|
|
|
|
*/
|
|
|
|
enum hwsim_tx_rate_flags {
|
|
|
|
MAC80211_HWSIM_TX_RC_USE_RTS_CTS = BIT(0),
|
|
|
|
MAC80211_HWSIM_TX_RC_USE_CTS_PROTECT = BIT(1),
|
|
|
|
MAC80211_HWSIM_TX_RC_USE_SHORT_PREAMBLE = BIT(2),
|
|
|
|
|
|
|
|
/* rate index is an HT/VHT MCS instead of an index */
|
|
|
|
MAC80211_HWSIM_TX_RC_MCS = BIT(3),
|
|
|
|
MAC80211_HWSIM_TX_RC_GREEN_FIELD = BIT(4),
|
|
|
|
MAC80211_HWSIM_TX_RC_40_MHZ_WIDTH = BIT(5),
|
|
|
|
MAC80211_HWSIM_TX_RC_DUP_DATA = BIT(6),
|
|
|
|
MAC80211_HWSIM_TX_RC_SHORT_GI = BIT(7),
|
|
|
|
MAC80211_HWSIM_TX_RC_VHT_MCS = BIT(8),
|
|
|
|
MAC80211_HWSIM_TX_RC_80_MHZ_WIDTH = BIT(9),
|
|
|
|
MAC80211_HWSIM_TX_RC_160_MHZ_WIDTH = BIT(10),
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct hwsim_tx_rate - rate selection/status
|
|
|
|
*
|
|
|
|
* @idx: rate index to attempt to send with
|
|
|
|
* @count: number of tries in this rate before going to the next rate
|
|
|
|
*
|
|
|
|
* A value of -1 for @idx indicates an invalid rate and, if used
|
|
|
|
* in an array of retry rates, that no more rates should be tried.
|
|
|
|
*
|
|
|
|
* When used for transmit status reporting, the driver should
|
|
|
|
* always report the rate and number of retries used.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
struct hwsim_tx_rate_flag {
|
|
|
|
s8 idx;
|
|
|
|
u16 flags;
|
|
|
|
} __packed;
|
mac80211_hwsim driver support userspace frame tx/rx
This patch adds to mac80211_hwsim the capability to send traffic via
userspace.
Frame exchange between kernel and user spaces is done through generic
netlink communication protocol. A new generic netlink family
MAC80211_HWSIM is proposed, this family contains three basic commands
HWSIM_CMD_REGISTER, which is the command used to register a new
traffic listener, HWSIM_CMD_FRAME, to exchange the frames from kernel
to user and vice-versa, and HWSIM_CMD_TX_INFO_FRAME which returns
from user all the information about retransmissions, rates, rx signal,
and so on.
How it works:
Once the driver is loaded the MAC80211_HWSIM family will be registered.
In the absence of userspace daemon, the driver itselfs implements a
perfect wireless medium as it did in the past. When a daemon sends a
HWSIM_CMD_REGISTER command, the module stores the application PID, and
from this moment all frames will be sent to the registered daemon.
The user space application will be in charge of process/forward all
frames broadcast by any mac80211_hwsim radio. If the user application
is stopped, the kernel module will detect the release of the socket
and it will switch back to in-kernel perfect channel simulation.
The userspace daemon must be waiting for incoming HWSIM_CMD_FRAME
commands sent from kernel, for each HWSIM_CMD_FRAME command the
application will try to broadcast this frame to all mac80211_hwsim
radios, however the application may decide to forward/drop this frame.
In the case of forwarding the frame, a new HWSIM_CMD_FRAME command will
be created, all necessary attributes will be populated and the frame
will be sent back to the kernel.
Also after the frame broadcast phase, a HWSIM_CMD_TX_INFO_FRAME
command will be sent from userspace to kernel, this command contains
all the information regarding the transmission, such as number of
tries, rates, ack signal, etc.
You can find the actual implementation of wireless mediumd daemon
(wmediumd) at:
* Last version tarball: https://github.com/jlopex/cozybit/tarball/master
* Or visiting my github tree: https://github.com/jlopex/cozybit/tree
Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-06-01 17:26:13 +08:00
|
|
|
#endif /* __MAC80211_HWSIM_H */
|