/share/man/man9/ieee80211_amrr.9

https://bitbucket.org/freebsd/freebsd-head/ · Unknown · 194 lines · 192 code · 2 blank · 0 comment · 0 complexity · ae74b54782ca9380c290acc6c98e31ad MD5 · raw file

  1. .\"
  2. .\" Copyright (c) 2009 Sam Leffler, Errno Consulting
  3. .\" All rights reserved.
  4. .\"
  5. .\" Redistribution and use in source and binary forms, with or without
  6. .\" modification, are permitted provided that the following conditions
  7. .\" are met:
  8. .\" 1. Redistributions of source code must retain the above copyright
  9. .\" notice, this list of conditions and the following disclaimer.
  10. .\" 2. Redistributions in binary form must reproduce the above copyright
  11. .\" notice, this list of conditions and the following disclaimer in the
  12. .\" documentation and/or other materials provided with the distribution.
  13. .\"
  14. .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  15. .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  16. .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  17. .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  18. .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  19. .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  20. .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  21. .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  22. .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  23. .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  24. .\" SUCH DAMAGE.
  25. .\"
  26. .\" $FreeBSD$
  27. .\"
  28. .Dd August 4, 2009
  29. .Dt IEEE8021_AMRR 9
  30. .Os
  31. .Sh NAME
  32. .Nm ieee80211_amrr
  33. .Nd 802.11 network driver transmit rate control support
  34. .Sh SYNOPSIS
  35. .In net80211/ieee80211_amrr.h
  36. .Ft void
  37. .Fo ieee80211_amrr_init
  38. .Fa "struct ieee80211_amrr *"
  39. .Fa "struct ieee80211vap *"
  40. .Fa "int amin"
  41. .Fa "int amax"
  42. .Fa "int interval"
  43. .Fc
  44. .\"
  45. .Ft void
  46. .Fn ieee80211_amrr_cleanup "struct ieee80211_amrr *"
  47. .\"
  48. .Ft void
  49. .Fn ieee80211_amrr_setinterval "struct ieee80211_amrr *" "int interval"
  50. .\"
  51. .Ft void
  52. .Fo ieee80211_amrr_node_init
  53. .Fa "struct ieee80211_amrr *"
  54. .Fa "struct ieee80211_amrr_node *"
  55. .Fa "struct ieee80211_node *"
  56. .Fc
  57. .\"
  58. .Ft int
  59. .Fo ieee80211_amrr_choose
  60. .Fa "struct ieee80211_node *"
  61. .Fa "struct ieee80211_amrr_node *"
  62. .Fc
  63. .\"
  64. .Ft void
  65. .Fo ieee80211_amrr_tx_complete
  66. .Fa "struct ieee80211_amrr_node *"
  67. .Fa "int ok"
  68. .Fa "int retries"
  69. .Fc
  70. .\"
  71. .Ft void
  72. .Fo ieee80211_amrr_tx_update
  73. .Fa "struct ieee80211_amrr_node *"
  74. .Fa "int txnct"
  75. .Fa "int success"
  76. .Fa "int retrycnt"
  77. .Fc
  78. .Sh DESCRIPTION
  79. .Nm
  80. is an implementation of the AMRR transmit rate control algorithm
  81. for drivers that use the
  82. .Nm net80211
  83. software layer.
  84. A rate control algorithm is responsible for choosing the transmit
  85. rate for each frame.
  86. To maximize throughput algorithms try to use the highest rate that
  87. is appropriate for the operating conditions.
  88. The rate will vary as conditions change; the distance between two stations
  89. may change, transient noise may be present that affects signal quality,
  90. etc.
  91. .Nm
  92. uses very simple information from a driver to do it's job:
  93. whether a frame was successfully delivered and how many transmit
  94. attempts were made.
  95. While this enables its use with virtually any wireless device it
  96. limits it's effectiveness--do not expect it to function well in
  97. difficult environments and/or respond quickly to changing conditions.
  98. .Pp
  99. .Nm
  100. requires per-vap state and per-node state for each station it is to
  101. select rates for.
  102. The API's are designed for drivers to pre-allocate state in the
  103. driver-private extension areas of each vap and node.
  104. For example the
  105. .Xr ral 4
  106. driver defines a vap as:
  107. .Bd -literal -offset indent
  108. struct rt2560_vap {
  109. struct ieee80211vap ral_vap;
  110. struct ieee80211_beacon_offsets ral_bo;
  111. struct ieee80211_amrr amrr;
  112. int (*ral_newstate)(struct ieee80211vap *,
  113. enum ieee80211_state, int);
  114. };
  115. .Ed
  116. .Pp
  117. The
  118. .Vt amrr
  119. structure member holds the per-vap state for
  120. .Nm
  121. and
  122. .Xr ral 4
  123. initializes it in the vap create method with:
  124. .Bd -literal -offset indent
  125. ieee80211_amrr_init(&rvp->amrr, vap,
  126. IEEE80211_AMRR_MIN_SUCCESS_THRESHOLD,
  127. IEEE80211_AMRR_MAX_SUCCESS_THRESHOLD,
  128. 500 /* ms */);
  129. .Ed
  130. .Pp
  131. The node is defined as:
  132. .Bd -literal -offset indent
  133. struct rt2560_node {
  134. struct ieee80211_node ni;
  135. struct ieee80211_amrr_node amrr;
  136. };
  137. .Ed
  138. .Pp
  139. with initialization done in the driver's
  140. .Vt iv_newassoc
  141. method:
  142. .Bd -literal -offset indent
  143. static void
  144. rt2560_newassoc(struct ieee80211_node *ni, int isnew)
  145. {
  146. struct ieee80211vap *vap = ni->ni_vap;
  147. ieee80211_amrr_node_init(&RT2560_VAP(vap)->amrr,
  148. &RT2560_NODE(ni)->amrr, ni);
  149. }
  150. .Ed
  151. .Pp
  152. Once
  153. .Nm
  154. state is setup, transmit rates are requested by calling
  155. .Fn ieee80211_amrr_choose
  156. in the transmit path; e.g.:
  157. .Bd -literal -offset indent
  158. tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)];
  159. if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
  160. rate = tp->mcastrate;
  161. } else if (m0->m_flags & M_EAPOL) {
  162. rate = tp->mgmtrate;
  163. } else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) {
  164. rate = tp->ucastrate;
  165. } else {
  166. (void) ieee80211_amrr_choose(ni, &RT2560_NODE(ni)->amrr);
  167. rate = ni->ni_txrate;
  168. }
  169. .Ed
  170. .Pp
  171. Note a rate is chosen only for unicast data frames when a fixed
  172. transmit rate is not configured; the other cases are handled with
  173. the
  174. .Nm net80211
  175. transmit parameters.
  176. Note also that
  177. .Fn ieee80211_amrr_choose
  178. writes the chosen rate in
  179. .Vt ni_txrate ;
  180. this eliminates copying the value as it is exported to user applications so
  181. they can display the current transmit rate in status.
  182. .Pp
  183. The remaining work a driver must do is feed status back to
  184. .Nm
  185. when a frame transmit completes using
  186. .Fn ieee80211_amrr_tx_complete .
  187. Drivers that poll a device to retrieve statistics can use
  188. .Fn ieee80211_amrr_tx_update
  189. (instead or in addition).
  190. .Sh SEE ALSO
  191. .Xr ieee80211 9 ,
  192. .Xr ieee80211_output 9