mac80211_hwsim.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
  3. * Copyright (c) 2008, Jouni Malinen <j@w1.fi>
  4. * Copyright (c) 2011, Javier Lopez <jlopex@gmail.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef __MAC80211_HWSIM_H
  11. #define __MAC80211_HWSIM_H
  12. /**
  13. * enum hwsim_tx_control_flags - flags to describe transmission info/status
  14. *
  15. * These flags are used to give the wmediumd extra information in order to
  16. * modify its behavior for each frame
  17. *
  18. * @HWSIM_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame.
  19. * @HWSIM_TX_CTL_NO_ACK: tell the wmediumd not to wait for an ack
  20. * @HWSIM_TX_STAT_ACK: Frame was acknowledged
  21. *
  22. */
  23. enum hwsim_tx_control_flags {
  24. HWSIM_TX_CTL_REQ_TX_STATUS = BIT(0),
  25. HWSIM_TX_CTL_NO_ACK = BIT(1),
  26. HWSIM_TX_STAT_ACK = BIT(2),
  27. };
  28. /**
  29. * DOC: Frame transmission/registration support
  30. *
  31. * Frame transmission and registration support exists to allow userspace
  32. * entities such as wmediumd to receive and process all broadcasted
  33. * frames from a mac80211_hwsim radio device.
  34. *
  35. * This allow user space applications to decide if the frame should be
  36. * dropped or not and implement a wireless medium simulator at user space.
  37. *
  38. * Registration is done by sending a register message to the driver and
  39. * will be automatically unregistered if the user application doesn't
  40. * responds to sent frames.
  41. * Once registered the user application has to take responsibility of
  42. * broadcasting the frames to all listening mac80211_hwsim radio
  43. * interfaces.
  44. *
  45. * For more technical details, see the corresponding command descriptions
  46. * below.
  47. */
  48. /**
  49. * enum hwsim_commands - supported hwsim commands
  50. *
  51. * @HWSIM_CMD_UNSPEC: unspecified command to catch errors
  52. *
  53. * @HWSIM_CMD_REGISTER: request to register and received all broadcasted
  54. * frames by any mac80211_hwsim radio device.
  55. * @HWSIM_CMD_FRAME: send/receive a broadcasted frame from/to kernel/user
  56. * space, uses:
  57. * %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_ADDR_RECEIVER,
  58. * %HWSIM_ATTR_FRAME, %HWSIM_ATTR_FLAGS, %HWSIM_ATTR_RX_RATE,
  59. * %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE, %HWSIM_ATTR_FREQ (optional)
  60. * @HWSIM_CMD_TX_INFO_FRAME: Transmission info report from user space to
  61. * kernel, uses:
  62. * %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_FLAGS,
  63. * %HWSIM_ATTR_TX_INFO, %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE
  64. * @HWSIM_CMD_NEW_RADIO: create a new radio with the given parameters,
  65. * returns the radio ID (>= 0) or negative on errors, if successful
  66. * then multicast the result
  67. * @HWSIM_CMD_DEL_RADIO: destroy a radio, reply is multicasted
  68. * @HWSIM_CMD_GET_RADIO: fetch information about existing radios, uses:
  69. * %HWSIM_ATTR_RADIO_ID
  70. * @__HWSIM_CMD_MAX: enum limit
  71. */
  72. enum {
  73. HWSIM_CMD_UNSPEC,
  74. HWSIM_CMD_REGISTER,
  75. HWSIM_CMD_FRAME,
  76. HWSIM_CMD_TX_INFO_FRAME,
  77. HWSIM_CMD_NEW_RADIO,
  78. HWSIM_CMD_DEL_RADIO,
  79. HWSIM_CMD_GET_RADIO,
  80. __HWSIM_CMD_MAX,
  81. };
  82. #define HWSIM_CMD_MAX (_HWSIM_CMD_MAX - 1)
  83. #define HWSIM_CMD_CREATE_RADIO HWSIM_CMD_NEW_RADIO
  84. #define HWSIM_CMD_DESTROY_RADIO HWSIM_CMD_DEL_RADIO
  85. /**
  86. * enum hwsim_attrs - hwsim netlink attributes
  87. *
  88. * @HWSIM_ATTR_UNSPEC: unspecified attribute to catch errors
  89. *
  90. * @HWSIM_ATTR_ADDR_RECEIVER: MAC address of the radio device that
  91. * the frame is broadcasted to
  92. * @HWSIM_ATTR_ADDR_TRANSMITTER: MAC address of the radio device that
  93. * the frame was broadcasted from
  94. * @HWSIM_ATTR_FRAME: Data array
  95. * @HWSIM_ATTR_FLAGS: mac80211 transmission flags, used to process
  96. properly the frame at user space
  97. * @HWSIM_ATTR_RX_RATE: estimated rx rate index for this frame at user
  98. space
  99. * @HWSIM_ATTR_SIGNAL: estimated RX signal for this frame at user
  100. space
  101. * @HWSIM_ATTR_TX_INFO: ieee80211_tx_rate array
  102. * @HWSIM_ATTR_COOKIE: sk_buff cookie to identify the frame
  103. * @HWSIM_ATTR_CHANNELS: u32 attribute used with the %HWSIM_CMD_CREATE_RADIO
  104. * command giving the number of channels supported by the new radio
  105. * @HWSIM_ATTR_RADIO_ID: u32 attribute used with %HWSIM_CMD_DESTROY_RADIO
  106. * only to destroy a radio
  107. * @HWSIM_ATTR_REG_HINT_ALPHA2: alpha2 for regulatoro driver hint
  108. * (nla string, length 2)
  109. * @HWSIM_ATTR_REG_CUSTOM_REG: custom regulatory domain index (u32 attribute)
  110. * @HWSIM_ATTR_REG_STRICT_REG: request REGULATORY_STRICT_REG (flag attribute)
  111. * @HWSIM_ATTR_SUPPORT_P2P_DEVICE: support P2P Device virtual interface (flag)
  112. * @HWSIM_ATTR_USE_CHANCTX: used with the %HWSIM_CMD_CREATE_RADIO
  113. * command to force use of channel contexts even when only a
  114. * single channel is supported
  115. * @HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE: used with the %HWSIM_CMD_CREATE_RADIO
  116. * command to force radio removal when process that created the radio dies
  117. * @HWSIM_ATTR_RADIO_NAME: Name of radio, e.g. phy666
  118. * @HWSIM_ATTR_NO_VIF: Do not create vif (wlanX) when creating radio.
  119. * @HWSIM_ATTR_FREQ: Frequency at which packet is transmitted or received.
  120. * @__HWSIM_ATTR_MAX: enum limit
  121. */
  122. enum {
  123. HWSIM_ATTR_UNSPEC,
  124. HWSIM_ATTR_ADDR_RECEIVER,
  125. HWSIM_ATTR_ADDR_TRANSMITTER,
  126. HWSIM_ATTR_FRAME,
  127. HWSIM_ATTR_FLAGS,
  128. HWSIM_ATTR_RX_RATE,
  129. HWSIM_ATTR_SIGNAL,
  130. HWSIM_ATTR_TX_INFO,
  131. HWSIM_ATTR_COOKIE,
  132. HWSIM_ATTR_CHANNELS,
  133. HWSIM_ATTR_RADIO_ID,
  134. HWSIM_ATTR_REG_HINT_ALPHA2,
  135. HWSIM_ATTR_REG_CUSTOM_REG,
  136. HWSIM_ATTR_REG_STRICT_REG,
  137. HWSIM_ATTR_SUPPORT_P2P_DEVICE,
  138. HWSIM_ATTR_USE_CHANCTX,
  139. HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE,
  140. HWSIM_ATTR_RADIO_NAME,
  141. HWSIM_ATTR_NO_VIF,
  142. HWSIM_ATTR_FREQ,
  143. __HWSIM_ATTR_MAX,
  144. };
  145. #define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1)
  146. /**
  147. * struct hwsim_tx_rate - rate selection/status
  148. *
  149. * @idx: rate index to attempt to send with
  150. * @count: number of tries in this rate before going to the next rate
  151. *
  152. * A value of -1 for @idx indicates an invalid rate and, if used
  153. * in an array of retry rates, that no more rates should be tried.
  154. *
  155. * When used for transmit status reporting, the driver should
  156. * always report the rate and number of retries used.
  157. *
  158. */
  159. struct hwsim_tx_rate {
  160. s8 idx;
  161. u8 count;
  162. } __packed;
  163. #endif /* __MAC80211_HWSIM_H */