-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nl80211: support the MAC80211_HWSIM netlink protocol family
The mac80211_hwsim module exposes a custom generic netlink family for managing simulated phys and userspace data frame transmission. Since hwsim functionality is closely related to nl80211 and useful to e.g. manage simulated wireless testbeds, I decided to include support directly into the nl80211 module. Example calls for creating and destroying hwsim wiphys: nl80211.request(nl80211.const.HWSIM_CMD_NEW_RADIO, 0, { perm_addr: "02:11:22:33:44:55", support_p2p_device: true }); nl80211.request(nl80211.const.HWSIM_CMD_DEL_RADIO, 0, { radio_name: "phy2" }); Signed-off-by: Jo-Philipp Wich <[email protected]>
- Loading branch information
Showing
2 changed files
with
239 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/* Upstream source: | ||
* https://github.com/torvalds/linux/blob/master/drivers/net/wireless/virtual/mac80211_hwsim.h | ||
*/ | ||
|
||
#ifndef __LINUX_MAC80211_HWSIM_H | ||
#define __LINUX_MAC80211_HWSIM_H | ||
|
||
#include <stdint.h> | ||
#include <linux/nl80211.h> | ||
|
||
enum hwsim_tx_control_flags { | ||
HWSIM_TX_CTL_REQ_TX_STATUS = (1 << 0), | ||
HWSIM_TX_CTL_NO_ACK = (1 << 1), | ||
HWSIM_TX_STAT_ACK = (1 << 2), | ||
}; | ||
|
||
enum hwsim_commands { | ||
HWSIM_CMD_OFFSET = NL80211_CMD_MAX, | ||
HWSIM_CMD_REGISTER, | ||
HWSIM_CMD_FRAME, | ||
HWSIM_CMD_TX_INFO_FRAME, | ||
HWSIM_CMD_NEW_RADIO, | ||
HWSIM_CMD_DEL_RADIO, | ||
HWSIM_CMD_GET_RADIO, | ||
HWSIM_CMD_ADD_MAC_ADDR, | ||
HWSIM_CMD_DEL_MAC_ADDR, | ||
HWSIM_CMD_START_PMSR, | ||
HWSIM_CMD_ABORT_PMSR, | ||
HWSIM_CMD_REPORT_PMSR, | ||
}; | ||
|
||
enum hwsim_attrs { | ||
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, | ||
HWSIM_ATTR_CHANNELS, | ||
HWSIM_ATTR_RADIO_ID, | ||
HWSIM_ATTR_REG_HINT_ALPHA2, | ||
HWSIM_ATTR_REG_CUSTOM_REG, | ||
HWSIM_ATTR_REG_STRICT_REG, | ||
HWSIM_ATTR_SUPPORT_P2P_DEVICE, | ||
HWSIM_ATTR_USE_CHANCTX, | ||
HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE, | ||
HWSIM_ATTR_RADIO_NAME, | ||
HWSIM_ATTR_NO_VIF, | ||
HWSIM_ATTR_FREQ, | ||
HWSIM_ATTR_PAD, | ||
HWSIM_ATTR_TX_INFO_FLAGS, | ||
HWSIM_ATTR_PERM_ADDR, | ||
HWSIM_ATTR_IFTYPE_SUPPORT, | ||
HWSIM_ATTR_CIPHER_SUPPORT, | ||
HWSIM_ATTR_MLO_SUPPORT, | ||
HWSIM_ATTR_PMSR_SUPPORT, | ||
HWSIM_ATTR_PMSR_REQUEST, | ||
HWSIM_ATTR_PMSR_RESULT, | ||
}; | ||
|
||
struct hwsim_tx_rate { | ||
int8_t idx; | ||
uint8_t count; | ||
} __attribute__((packed)); | ||
|
||
enum hwsim_tx_rate_flags { | ||
MAC80211_HWSIM_TX_RC_USE_RTS_CTS = (1 << 0), | ||
MAC80211_HWSIM_TX_RC_USE_CTS_PROTECT = (1 << 1), | ||
MAC80211_HWSIM_TX_RC_USE_SHORT_PREAMBLE = (1 << 2), | ||
MAC80211_HWSIM_TX_RC_MCS = (1 << 3), | ||
MAC80211_HWSIM_TX_RC_GREEN_FIELD = (1 << 4), | ||
MAC80211_HWSIM_TX_RC_40_MHZ_WIDTH = (1 << 5), | ||
MAC80211_HWSIM_TX_RC_DUP_DATA = (1 << 6), | ||
MAC80211_HWSIM_TX_RC_SHORT_GI = (1 << 7), | ||
MAC80211_HWSIM_TX_RC_VHT_MCS = (1 << 8), | ||
MAC80211_HWSIM_TX_RC_80_MHZ_WIDTH = (1 << 9), | ||
MAC80211_HWSIM_TX_RC_160_MHZ_WIDTH = (1 << 10), | ||
}; | ||
|
||
struct hwsim_tx_rate_flag { | ||
int8_t idx; | ||
uint16_t flags; | ||
} __attribute__((packed)); | ||
|
||
enum hwsim_vqs { | ||
HWSIM_VQ_TX, | ||
HWSIM_VQ_RX, | ||
HWSIM_NUM_VQS, | ||
}; | ||
|
||
enum hwsim_rate_info_attributes { | ||
__HWSIM_RATE_INFO_ATTR_INVALID, | ||
|
||
HWSIM_RATE_INFO_ATTR_FLAGS, | ||
HWSIM_RATE_INFO_ATTR_MCS, | ||
HWSIM_RATE_INFO_ATTR_LEGACY, | ||
HWSIM_RATE_INFO_ATTR_NSS, | ||
HWSIM_RATE_INFO_ATTR_BW, | ||
HWSIM_RATE_INFO_ATTR_HE_GI, | ||
HWSIM_RATE_INFO_ATTR_HE_DCM, | ||
HWSIM_RATE_INFO_ATTR_HE_RU_ALLOC, | ||
HWSIM_RATE_INFO_ATTR_N_BOUNDED_CH, | ||
HWSIM_RATE_INFO_ATTR_EHT_GI, | ||
HWSIM_RATE_INFO_ATTR_EHT_RU_ALLOC, | ||
|
||
NUM_HWSIM_RATE_INFO_ATTRS, | ||
}; | ||
|
||
#endif /* __LINUX_MAC80211_HWSIM_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters