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.
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 ( GPL2_OR_LATER  )
struct rc80211_ctx* rc80211_init ( struct net80211_device dev) [read]
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.

References ctx, DBGC, rc80211_ctx::goodness, net80211_device::rate, net80211_device::rates, rc80211_set_rate(), rc80211_update(), RC_TX_EMERG_FAIL, net80211_device::rctl, rc80211_ctx::started, and TX.

Referenced by net80211_tx_complete().

{
        struct rc80211_ctx *ctx = dev->rctl;

        if ( ! ctx->started )
                return;

        rc80211_update ( dev, TX, dev->rate, retries, rc );

        /* Check if the last RC_TX_EMERG_FAIL packets have all failed */
        if ( ! ( ctx->goodness[TX][dev->rate] &
                 ( ( 1 << ( 2 * RC_TX_EMERG_FAIL ) ) - 1 ) ) ) {
                if ( dev->rate == 0 )
                        DBGC ( dev->rctl, "802.11 RC %p saw %d consecutive "
                               "failed TX, but cannot lower rate any further\n",
                               dev->rctl, RC_TX_EMERG_FAIL );
                else {
                        DBGC ( dev->rctl, "802.11 RC %p lowering rate (%d->%d "
                               "Mbps) due to %d consecutive TX failures\n",
                               dev->rctl, dev->rates[dev->rate] / 10,
                               dev->rates[dev->rate - 1] / 10,
                               RC_TX_EMERG_FAIL );

                        rc80211_set_rate ( dev, dev->rate - 1 );
                }
        }
}
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.

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

Referenced by net80211_rx().

{
        int ridx;

        for ( ridx = 0; ridx < dev->nr_rates && dev->rates[ridx] != rate;
              ridx++ )
                ;
        if ( ridx >= dev->nr_rates )
                return;         /* couldn't find the rate */

        rc80211_update ( dev, RX, ridx, retry, 0 );
}
void rc80211_free ( struct rc80211_ctx ctx)

Free rate-control context.

Parameters:
ctxRate-control context

Definition at line 369 of file rc80211.c.

References free.

Referenced by net80211_free().

{
        free ( ctx );
}