|
iPXE
|
Simple 802.11 rate-control algorithm. More...
Go to the source code of this file.
Data Structures | |
| struct | rc80211_ctx |
| A rate control context. More... | |
Macros | |
| #define | RC_PKT_OK 0x3 |
| Two-bit packet status indicator for a packet with no retries. | |
| #define | RC_PKT_RETRIED_ONCE 0x2 |
| Two-bit packet status indicator for a packet with one retry. | |
| #define | RC_PKT_RETRIED_MULTI 0x1 |
| Two-bit packet status indicator for a TX packet with multiple retries. | |
| #define | RC_PKT_FAILED 0x0 |
| Two-bit packet status indicator for a TX packet that was never ACKed. | |
| #define | RC_TX_FACTOR 4 |
| Number of times to weight TX packets more heavily than RX packets. | |
| #define | RC_TX_EMERG_FAIL 3 |
| Number of consecutive failed TX packets that cause an automatic rate drop. | |
| #define | RC_GOODNESS_MIN 85 |
| Minimum net goodness below which we will search for a better rate. | |
| #define | RC_GOODNESS_MAX 95 |
| Maximum net goodness above which we will try to increase our rate. | |
| #define | RC_UNCERTAINTY_THRESH 4 |
Minimum (num RX + RC_TX_FACTOR * num TX) to use a certain rate. | |
| #define | TX 0 |
| TX direction. | |
| #define | RX 1 |
| RX direction. | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| FILE_SECBOOT (FORBIDDEN) | |
| struct rc80211_ctx * | rc80211_init (struct net80211_device *dev __unused) |
| Initialize rate-control algorithm. | |
| static int | rc80211_calc_net_goodness (struct rc80211_ctx *ctx, int rate_idx) |
| Calculate net goodness for a certain rate. | |
| static int | rc80211_pick_best (struct net80211_device *dev) |
| Determine the best rate to switch to and return it. | |
| static void | rc80211_set_rate (struct net80211_device *dev, int rate_idx) |
| Set 802.11 device rate. | |
| static void | rc80211_maybe_set_new (struct net80211_device *dev) |
| Check rate-control state and change rate if necessary. | |
| static void | rc80211_update (struct net80211_device *dev, int direction, int rate_idx, int retries, int failed) |
| Update rate-control state. | |
| void | rc80211_update_tx (struct net80211_device *dev, int retries, int rc) |
| Update rate-control state for transmitted packet. | |
| void | rc80211_update_rx (struct net80211_device *dev, int retry, u16 rate) |
| Update rate-control state for received packet. | |
| void | rc80211_free (struct rc80211_ctx *ctx) |
| Free rate-control context. | |
Simple 802.11 rate-control algorithm.
Definition in file rc80211.c.
| #define RC_PKT_OK 0x3 |
Two-bit packet status indicator for a packet with no retries.
Definition at line 89 of file rc80211.c.
Referenced by rc80211_update().
| #define RC_PKT_RETRIED_ONCE 0x2 |
Two-bit packet status indicator for a packet with one retry.
Definition at line 92 of file rc80211.c.
Referenced by rc80211_update().
| #define RC_PKT_RETRIED_MULTI 0x1 |
Two-bit packet status indicator for a TX packet with multiple retries.
It is not possible to tell whether an RX packet had one or multiple retries; we rely instead on the fact that failed RX packets won't get to us at all, so if we receive a lot of RX packets on a certain rate it must be pretty good.
Definition at line 101 of file rc80211.c.
Referenced by rc80211_update().
| #define RC_PKT_FAILED 0x0 |
Two-bit packet status indicator for a TX packet that was never ACKed.
It is not possible to tell whether an RX packet was setn if it didn't get through to us, but if we don't see one we won't increase the goodness for its rate. This asymmetry is part of why TX packets are weighted much more heavily than RX.
Definition at line 110 of file rc80211.c.
Referenced by rc80211_update().
| #define RC_TX_FACTOR 4 |
Number of times to weight TX packets more heavily than RX packets.
Definition at line 113 of file rc80211.c.
Referenced by rc80211_calc_net_goodness().
| #define RC_TX_EMERG_FAIL 3 |
Number of consecutive failed TX packets that cause an automatic rate drop.
Definition at line 116 of file rc80211.c.
Referenced by rc80211_update_tx().
| #define RC_GOODNESS_MIN 85 |
Minimum net goodness below which we will search for a better rate.
Definition at line 119 of file rc80211.c.
Referenced by rc80211_maybe_set_new(), and rc80211_pick_best().
| #define RC_GOODNESS_MAX 95 |
Maximum net goodness above which we will try to increase our rate.
Definition at line 122 of file rc80211.c.
Referenced by rc80211_maybe_set_new().
| #define RC_UNCERTAINTY_THRESH 4 |
Minimum (num RX + RC_TX_FACTOR * num TX) to use a certain rate.
Definition at line 125 of file rc80211.c.
Referenced by rc80211_calc_net_goodness().
| #define TX 0 |
TX direction.
Definition at line 128 of file rc80211.c.
Referenced by rc80211_calc_net_goodness(), and rc80211_update_tx().
| #define RX 1 |
RX direction.
Definition at line 131 of file rc80211.c.
Referenced by rc80211_calc_net_goodness(), and rc80211_update_rx().
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| FILE_SECBOOT | ( | FORBIDDEN | ) |
| struct rc80211_ctx * rc80211_init | ( | struct net80211_device *dev | __unused | ) |
Initialize rate-control algorithm.
| dev | 802.11 device |
| ctx | Rate-control context, to be stored in dev->rctl |
Definition at line 155 of file rc80211.c.
References __unused, and zalloc().
Referenced by net80211_step_associate().
|
static |
Calculate net goodness for a certain rate.
| ctx | Rate-control context |
| rate_idx | Index of rate to calculate net goodness for |
Definition at line 167 of file rc80211.c.
References ctx, num, RC_TX_FACTOR, RC_UNCERTAINTY_THRESH, RX, TX, and u32.
Referenced by rc80211_maybe_set_new(), and rc80211_pick_best().
|
static |
Determine the best rate to switch to and return it.
| dev | 802.11 device |
| rate_idx | Index of the best rate to switch to |
Definition at line 195 of file rc80211.c.
References ctx, DBGC, net80211_device::nr_rates, net80211_device::rate, rc80211_calc_net_goodness(), RC_GOODNESS_MIN, and net80211_device::rctl.
Referenced by rc80211_maybe_set_new().
|
inlinestatic |
Set 802.11 device rate.
| dev | 802.11 device |
| rate_idx | Index of rate to switch to |
This is a thin wrapper around net80211_set_rate_idx to insert a debugging message where appropriate.
Definition at line 233 of file rc80211.c.
References DBGC, net80211_set_rate_idx(), net80211_device::rate, net80211_device::rates, and net80211_device::rctl.
Referenced by rc80211_maybe_set_new(), and rc80211_update_tx().
|
static |
Check rate-control state and change rate if necessary.
| dev | 802.11 device |
Definition at line 247 of file rc80211.c.
References ctx, net80211_device::nr_rates, net80211_device::rate, rc80211_calc_net_goodness(), rc80211_pick_best(), rc80211_set_rate(), RC_GOODNESS_MAX, RC_GOODNESS_MIN, and net80211_device::rctl.
Referenced by rc80211_update().
|
static |
Update rate-control state.
| dev | 802.11 device |
| direction | One of the direction constants TX or RX |
| rate_idx | Index of rate at which packet was sent or received |
| retries | Number of times packet was retried before success |
| failed | If nonzero, the packet failed to get through |
Definition at line 284 of file rc80211.c.
References ctx, direction, rc80211_ctx::goodness, rc80211_maybe_set_new(), RC_PKT_FAILED, RC_PKT_OK, RC_PKT_RETRIED_MULTI, RC_PKT_RETRIED_ONCE, net80211_device::rctl, and u32.
Referenced by rc80211_update_rx(), and rc80211_update_tx().
| void rc80211_update_tx | ( | struct net80211_device * | dev, |
| int | retries, | ||
| int | rc ) |
Update rate-control state for transmitted packet.
| dev | 802.11 device |
| retries | Number of times packet was transmitted before success |
| rc | Return status code for transmission |
Definition at line 317 of file rc80211.c.
References ctx, DBGC, net80211_device::rate, net80211_device::rates, rc, rc80211_set_rate(), rc80211_update(), RC_TX_EMERG_FAIL, net80211_device::rctl, and TX.
Referenced by net80211_tx_complete().
| void rc80211_update_rx | ( | struct net80211_device * | dev, |
| int | retry, | ||
| u16 | rate ) |
Update rate-control state for received packet.
| dev | 802.11 device |
| retry | Whether the received packet had been retransmitted |
| rate | Rate at which packet was received, in 100 kbps units |
Definition at line 352 of file rc80211.c.
References net80211_device::nr_rates, net80211_device::rates, rc80211_update(), RX, and u16.
Referenced by net80211_rx().
| void rc80211_free | ( | struct rc80211_ctx * | ctx | ) |
Free rate-control context.
| ctx | Rate-control context |
Definition at line 370 of file rc80211.c.
Referenced by net80211_free().