iPXE
rc80211.h File Reference

Rate-control algorithm prototype for 802.11. More...

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
struct rc80211_ctxrc80211_init (struct net80211_device *dev)
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.

Detailed Description

Rate-control algorithm prototype for 802.11.

Definition in file rc80211.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER )

◆ rc80211_init()

struct rc80211_ctx * rc80211_init ( struct net80211_device * dev)

References ctx, rc, and u16.

◆ rc80211_update_tx()

void rc80211_update_tx ( struct net80211_device * dev,
int retries,
int rc )

Update rate-control state for transmitted packet.

Parameters
dev802.11 device
retriesNumber of times packet was transmitted before success
rcReturn status code for transmission

Definition at line 317 of file rc80211.c.

318{
319 struct rc80211_ctx *ctx = dev->rctl;
320
321 if ( ! ctx->started )
322 return;
323
324 rc80211_update ( dev, TX, dev->rate, retries, rc );
325
326 /* Check if the last RC_TX_EMERG_FAIL packets have all failed */
327 if ( ! ( ctx->goodness[TX][dev->rate] &
328 ( ( 1 << ( 2 * RC_TX_EMERG_FAIL ) ) - 1 ) ) ) {
329 if ( dev->rate == 0 )
330 DBGC ( dev->rctl, "802.11 RC %p saw %d consecutive "
331 "failed TX, but cannot lower rate any further\n",
332 dev->rctl, RC_TX_EMERG_FAIL );
333 else {
334 DBGC ( dev->rctl, "802.11 RC %p lowering rate (%d->%d "
335 "Mbps) due to %d consecutive TX failures\n",
336 dev->rctl, dev->rates[dev->rate] / 10,
337 dev->rates[dev->rate - 1] / 10,
339
340 rc80211_set_rate ( dev, dev->rate - 1 );
341 }
342 }
343}
struct golan_eq_context ctx
Definition CIB_PRM.h:0
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
#define DBGC(...)
Definition compiler.h:505
static void rc80211_set_rate(struct net80211_device *dev, int rate_idx)
Set 802.11 device rate.
Definition rc80211.c:233
static void rc80211_update(struct net80211_device *dev, int direction, int rate_idx, int retries, int failed)
Update rate-control state.
Definition rc80211.c:284
#define TX
TX direction.
Definition rc80211.c:128
#define RC_TX_EMERG_FAIL
Number of consecutive failed TX packets that cause an automatic rate drop.
Definition rc80211.c:116
u16 rates[NET80211_MAX_RATES]
A list of all possible TX rates we might use.
Definition net80211.h:818
struct rc80211_ctx * rctl
Rate control state.
Definition net80211.h:989
u8 rate
The rate currently in use, as an index into the rates array.
Definition net80211.h:824
A rate control context.
Definition rc80211.c:135

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().

◆ rc80211_update_rx()

void rc80211_update_rx ( struct net80211_device * dev,
int retry,
u16 rate )

Update rate-control state for received packet.

Parameters
dev802.11 device
retryWhether the received packet had been retransmitted
rateRate at which packet was received, in 100 kbps units

Definition at line 352 of file rc80211.c.

353{
354 int ridx;
355
356 for ( ridx = 0; ridx < dev->nr_rates && dev->rates[ridx] != rate;
357 ridx++ )
358 ;
359 if ( ridx >= dev->nr_rates )
360 return; /* couldn't find the rate */
361
362 rc80211_update ( dev, RX, ridx, retry, 0 );
363}
#define RX
RX direction.
Definition rc80211.c:131
u8 nr_rates
The number of transmission rates in the rates array.
Definition net80211.h:821

References net80211_device::nr_rates, net80211_device::rates, rc80211_update(), RX, and u16.

Referenced by net80211_rx().

◆ rc80211_free()

void rc80211_free ( struct rc80211_ctx * ctx)

Free rate-control context.

Parameters
ctxRate-control context

Definition at line 370 of file rc80211.c.

371{
372 free ( ctx );
373}
static void(* free)(struct refcnt *refcnt))
Definition refcnt.h:55

References ctx, and free.

Referenced by net80211_free().