^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (c) 2008, Jouni Malinen <j@w1.fi>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2011, Javier Lopez <jlopex@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 2020 Intel Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #ifndef __MAC80211_HWSIM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define __MAC80211_HWSIM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * enum hwsim_tx_control_flags - flags to describe transmission info/status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * These flags are used to give the wmediumd extra information in order to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * modify its behavior for each frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * @HWSIM_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * @HWSIM_TX_CTL_NO_ACK: tell the wmediumd not to wait for an ack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * @HWSIM_TX_STAT_ACK: Frame was acknowledged
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) enum hwsim_tx_control_flags {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) HWSIM_TX_CTL_REQ_TX_STATUS = BIT(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) HWSIM_TX_CTL_NO_ACK = BIT(1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) HWSIM_TX_STAT_ACK = BIT(2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * DOC: Frame transmission/registration support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * Frame transmission and registration support exists to allow userspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * entities such as wmediumd to receive and process all broadcasted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * frames from a mac80211_hwsim radio device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * This allow user space applications to decide if the frame should be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * dropped or not and implement a wireless medium simulator at user space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * Registration is done by sending a register message to the driver and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * will be automatically unregistered if the user application doesn't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * responds to sent frames.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) * Once registered the user application has to take responsibility of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * broadcasting the frames to all listening mac80211_hwsim radio
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) * interfaces.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) * For more technical details, see the corresponding command descriptions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) * below.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) * enum hwsim_commands - supported hwsim commands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) * @HWSIM_CMD_UNSPEC: unspecified command to catch errors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * @HWSIM_CMD_REGISTER: request to register and received all broadcasted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * frames by any mac80211_hwsim radio device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * @HWSIM_CMD_FRAME: send/receive a broadcasted frame from/to kernel/user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * space, uses:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) * %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_ADDR_RECEIVER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) * %HWSIM_ATTR_FRAME, %HWSIM_ATTR_FLAGS, %HWSIM_ATTR_RX_RATE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) * %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE, %HWSIM_ATTR_FREQ (optional)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) * @HWSIM_CMD_TX_INFO_FRAME: Transmission info report from user space to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) * kernel, uses:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) * %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_FLAGS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) * %HWSIM_ATTR_TX_INFO, %WSIM_ATTR_TX_INFO_FLAGS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) * %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) * @HWSIM_CMD_NEW_RADIO: create a new radio with the given parameters,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * returns the radio ID (>= 0) or negative on errors, if successful
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) * then multicast the result, uses optional parameter:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * %HWSIM_ATTR_REG_STRICT_REG, %HWSIM_ATTR_SUPPORT_P2P_DEVICE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) * %HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE, %HWSIM_ATTR_CHANNELS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) * %HWSIM_ATTR_NO_VIF, %HWSIM_ATTR_RADIO_NAME, %HWSIM_ATTR_USE_CHANCTX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * %HWSIM_ATTR_REG_HINT_ALPHA2, %HWSIM_ATTR_REG_CUSTOM_REG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) * %HWSIM_ATTR_PERM_ADDR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) * @HWSIM_CMD_DEL_RADIO: destroy a radio, reply is multicasted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) * @HWSIM_CMD_GET_RADIO: fetch information about existing radios, uses:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) * %HWSIM_ATTR_RADIO_ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) * @HWSIM_CMD_ADD_MAC_ADDR: add a receive MAC address (given in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) * %HWSIM_ATTR_ADDR_RECEIVER attribute) to a device identified by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) * %HWSIM_ATTR_ADDR_TRANSMITTER. This lets wmediumd forward frames
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) * to this receiver address for a given station.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) * @HWSIM_CMD_DEL_MAC_ADDR: remove the MAC address again, the attributes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) * are the same as to @HWSIM_CMD_ADD_MAC_ADDR.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) * @__HWSIM_CMD_MAX: enum limit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) HWSIM_CMD_UNSPEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) HWSIM_CMD_REGISTER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) HWSIM_CMD_FRAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) HWSIM_CMD_TX_INFO_FRAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) HWSIM_CMD_NEW_RADIO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) HWSIM_CMD_DEL_RADIO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) HWSIM_CMD_GET_RADIO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) HWSIM_CMD_ADD_MAC_ADDR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) HWSIM_CMD_DEL_MAC_ADDR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) __HWSIM_CMD_MAX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) #define HWSIM_CMD_MAX (_HWSIM_CMD_MAX - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define HWSIM_CMD_CREATE_RADIO HWSIM_CMD_NEW_RADIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #define HWSIM_CMD_DESTROY_RADIO HWSIM_CMD_DEL_RADIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) * enum hwsim_attrs - hwsim netlink attributes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) * @HWSIM_ATTR_UNSPEC: unspecified attribute to catch errors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) * @HWSIM_ATTR_ADDR_RECEIVER: MAC address of the radio device that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) * the frame is broadcasted to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) * @HWSIM_ATTR_ADDR_TRANSMITTER: MAC address of the radio device that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) * the frame was broadcasted from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) * @HWSIM_ATTR_FRAME: Data array
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) * @HWSIM_ATTR_FLAGS: mac80211 transmission flags, used to process
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) properly the frame at user space
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) * @HWSIM_ATTR_RX_RATE: estimated rx rate index for this frame at user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) space
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) * @HWSIM_ATTR_SIGNAL: estimated RX signal for this frame at user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) space
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) * @HWSIM_ATTR_TX_INFO: ieee80211_tx_rate array
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) * @HWSIM_ATTR_COOKIE: sk_buff cookie to identify the frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) * @HWSIM_ATTR_CHANNELS: u32 attribute used with the %HWSIM_CMD_CREATE_RADIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) * command giving the number of channels supported by the new radio
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) * @HWSIM_ATTR_RADIO_ID: u32 attribute used with %HWSIM_CMD_DESTROY_RADIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) * only to destroy a radio
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * @HWSIM_ATTR_REG_HINT_ALPHA2: alpha2 for regulatoro driver hint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * (nla string, length 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * @HWSIM_ATTR_REG_CUSTOM_REG: custom regulatory domain index (u32 attribute)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) * @HWSIM_ATTR_REG_STRICT_REG: request REGULATORY_STRICT_REG (flag attribute)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) * @HWSIM_ATTR_SUPPORT_P2P_DEVICE: support P2P Device virtual interface (flag)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) * @HWSIM_ATTR_USE_CHANCTX: used with the %HWSIM_CMD_CREATE_RADIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) * command to force use of channel contexts even when only a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * single channel is supported
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * @HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE: used with the %HWSIM_CMD_CREATE_RADIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) * command to force radio removal when process that created the radio dies
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) * @HWSIM_ATTR_RADIO_NAME: Name of radio, e.g. phy666
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) * @HWSIM_ATTR_NO_VIF: Do not create vif (wlanX) when creating radio.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * @HWSIM_ATTR_FREQ: Frequency at which packet is transmitted or received.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) * @HWSIM_ATTR_TX_INFO_FLAGS: additional flags for corresponding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * rates of %HWSIM_ATTR_TX_INFO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * @HWSIM_ATTR_PERM_ADDR: permanent mac address of new radio
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) * @HWSIM_ATTR_IFTYPE_SUPPORT: u32 attribute of supported interface types bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) * @HWSIM_ATTR_CIPHER_SUPPORT: u32 array of supported cipher types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) * @__HWSIM_ATTR_MAX: enum limit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) HWSIM_ATTR_UNSPEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) HWSIM_ATTR_ADDR_RECEIVER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) HWSIM_ATTR_ADDR_TRANSMITTER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) HWSIM_ATTR_FRAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) HWSIM_ATTR_FLAGS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) HWSIM_ATTR_RX_RATE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) HWSIM_ATTR_SIGNAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) HWSIM_ATTR_TX_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) HWSIM_ATTR_COOKIE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) HWSIM_ATTR_CHANNELS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) HWSIM_ATTR_RADIO_ID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) HWSIM_ATTR_REG_HINT_ALPHA2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) HWSIM_ATTR_REG_CUSTOM_REG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) HWSIM_ATTR_REG_STRICT_REG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) HWSIM_ATTR_SUPPORT_P2P_DEVICE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) HWSIM_ATTR_USE_CHANCTX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) HWSIM_ATTR_RADIO_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) HWSIM_ATTR_NO_VIF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) HWSIM_ATTR_FREQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) HWSIM_ATTR_PAD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) HWSIM_ATTR_TX_INFO_FLAGS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) HWSIM_ATTR_PERM_ADDR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) HWSIM_ATTR_IFTYPE_SUPPORT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) HWSIM_ATTR_CIPHER_SUPPORT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) __HWSIM_ATTR_MAX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) #define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) * struct hwsim_tx_rate - rate selection/status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) * @idx: rate index to attempt to send with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) * @count: number of tries in this rate before going to the next rate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) * A value of -1 for @idx indicates an invalid rate and, if used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) * in an array of retry rates, that no more rates should be tried.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) * When used for transmit status reporting, the driver should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) * always report the rate and number of retries used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) struct hwsim_tx_rate {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) s8 idx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) u8 count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) * enum hwsim_tx_rate_flags - per-rate flags set by the rate control algorithm.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) * Inspired by structure mac80211_rate_control_flags. New flags may be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) * appended, but old flags not deleted, to keep compatibility for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) * userspace.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) * These flags are set by the Rate control algorithm for each rate during tx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) * in the @flags member of struct ieee80211_tx_rate.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) * @MAC80211_HWSIM_TX_RC_USE_RTS_CTS: Use RTS/CTS exchange for this rate.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) * @MAC80211_HWSIM_TX_RC_USE_CTS_PROTECT: CTS-to-self protection is required.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) * This is set if the current BSS requires ERP protection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) * @MAC80211_HWSIM_TX_RC_USE_SHORT_PREAMBLE: Use short preamble.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) * @MAC80211_HWSIM_TX_RC_MCS: HT rate.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) * @MAC80211_HWSIM_TX_RC_VHT_MCS: VHT MCS rate, in this case the idx field is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) * split into a higher 4 bits (Nss) and lower 4 bits (MCS number)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) * @MAC80211_HWSIM_TX_RC_GREEN_FIELD: Indicates whether this rate should be used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) * in Greenfield mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) * @MAC80211_HWSIM_TX_RC_40_MHZ_WIDTH: Indicates if the Channel Width should be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) * 40 MHz.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) * @MAC80211_HWSIM_TX_RC_80_MHZ_WIDTH: Indicates 80 MHz transmission
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) * @MAC80211_HWSIM_TX_RC_160_MHZ_WIDTH: Indicates 160 MHz transmission
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) * (80+80 isn't supported yet)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) * @MAC80211_HWSIM_TX_RC_DUP_DATA: The frame should be transmitted on both of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) * the adjacent 20 MHz channels, if the current channel type is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) * NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) * @MAC80211_HWSIM_TX_RC_SHORT_GI: Short Guard interval should be used for this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) * rate.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) enum hwsim_tx_rate_flags {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) MAC80211_HWSIM_TX_RC_USE_RTS_CTS = BIT(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) MAC80211_HWSIM_TX_RC_USE_CTS_PROTECT = BIT(1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) MAC80211_HWSIM_TX_RC_USE_SHORT_PREAMBLE = BIT(2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) /* rate index is an HT/VHT MCS instead of an index */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) MAC80211_HWSIM_TX_RC_MCS = BIT(3),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) MAC80211_HWSIM_TX_RC_GREEN_FIELD = BIT(4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) MAC80211_HWSIM_TX_RC_40_MHZ_WIDTH = BIT(5),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) MAC80211_HWSIM_TX_RC_DUP_DATA = BIT(6),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) MAC80211_HWSIM_TX_RC_SHORT_GI = BIT(7),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) MAC80211_HWSIM_TX_RC_VHT_MCS = BIT(8),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) MAC80211_HWSIM_TX_RC_80_MHZ_WIDTH = BIT(9),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) MAC80211_HWSIM_TX_RC_160_MHZ_WIDTH = BIT(10),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) * struct hwsim_tx_rate - rate selection/status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) * @idx: rate index to attempt to send with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) * @count: number of tries in this rate before going to the next rate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) * A value of -1 for @idx indicates an invalid rate and, if used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) * in an array of retry rates, that no more rates should be tried.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) * When used for transmit status reporting, the driver should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) * always report the rate and number of retries used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) struct hwsim_tx_rate_flag {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) s8 idx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) u16 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) * DOC: Frame transmission support over virtio
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) * Frame transmission is also supported over virtio to allow communication
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) * with external entities.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) * enum hwsim_vqs - queues for virtio frame transmission
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) * @HWSIM_VQ_TX: send frames to external entity
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) * @HWSIM_VQ_RX: receive frames and transmission info reports
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) * @HWSIM_NUM_VQS: enum limit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) HWSIM_VQ_TX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) HWSIM_VQ_RX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) HWSIM_NUM_VQS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) #endif /* __MAC80211_HWSIM_H */