iPXE
Functions
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. More...
 
void rc80211_update_rx (struct net80211_device *dev, int retry, u16 rate)
 Update rate-control state for received packet. More...
 
void rc80211_free (struct rc80211_ctx *ctx)
 Free rate-control context. More...
 

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)

◆ 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 316 of file rc80211.c.

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

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 351 of file rc80211.c.

352 {
353  int ridx;
354 
355  for ( ridx = 0; ridx < dev->nr_rates && dev->rates[ridx] != rate;
356  ridx++ )
357  ;
358  if ( ridx >= dev->nr_rates )
359  return; /* couldn't find the rate */
360 
361  rc80211_update ( dev, RX, ridx, retry, 0 );
362 }
static void rc80211_update(struct net80211_device *dev, int direction, int rate_idx, int retries, int failed)
Update rate-control state.
Definition: rc80211.c:283
#define RX
RX direction.
Definition: rc80211.c:130
u8 nr_rates
The number of transmission rates in the rates array.
Definition: net80211.h:821
u16 rates[NET80211_MAX_RATES]
A list of all possible TX rates we might use.
Definition: net80211.h:818

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

Referenced by net80211_rx().

◆ rc80211_free()

void rc80211_free ( struct rc80211_ctx ctx)

Free rate-control context.

Parameters
ctxRate-control context

Definition at line 369 of file rc80211.c.

370 {
371  free ( ctx );
372 }
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
struct golan_eq_context ctx
Definition: CIB_PRM.h:28

References ctx, and free.

Referenced by net80211_free().