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:
dev 802.11 device
retries Number of times packet was transmitted before success
rc Return status code for transmission

Definition at line 315 of file rc80211.c.

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

00316 {
00317         struct rc80211_ctx *ctx = dev->rctl;
00318 
00319         if ( ! ctx->started )
00320                 return;
00321 
00322         rc80211_update ( dev, TX, dev->rate, retries, rc );
00323 
00324         /* Check if the last RC_TX_EMERG_FAIL packets have all failed */
00325         if ( ! ( ctx->goodness[TX][dev->rate] &
00326                  ( ( 1 << ( 2 * RC_TX_EMERG_FAIL ) ) - 1 ) ) ) {
00327                 if ( dev->rate == 0 )
00328                         DBGC ( dev->rctl, "802.11 RC %p saw %d consecutive "
00329                                "failed TX, but cannot lower rate any further\n",
00330                                dev->rctl, RC_TX_EMERG_FAIL );
00331                 else {
00332                         DBGC ( dev->rctl, "802.11 RC %p lowering rate (%d->%d "
00333                                "Mbps) due to %d consecutive TX failures\n",
00334                                dev->rctl, dev->rates[dev->rate] / 10,
00335                                dev->rates[dev->rate - 1] / 10,
00336                                RC_TX_EMERG_FAIL );
00337 
00338                         rc80211_set_rate ( dev, dev->rate - 1 );
00339                 }
00340         }
00341 }

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

Update rate-control state for received packet.

Parameters:
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 350 of file rc80211.c.

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

Referenced by net80211_rx().

00351 {
00352         int ridx;
00353 
00354         for ( ridx = 0; ridx < dev->nr_rates && dev->rates[ridx] != rate;
00355               ridx++ )
00356                 ;
00357         if ( ridx >= dev->nr_rates )
00358                 return;         /* couldn't find the rate */
00359 
00360         rc80211_update ( dev, RX, ridx, retry, 0 );
00361 }

void rc80211_free ( struct rc80211_ctx ctx  ) 

Free rate-control context.

Parameters:
ctx Rate-control context

Definition at line 368 of file rc80211.c.

References free().

Referenced by net80211_free().

00369 {
00370         free ( ctx );
00371 }


Generated on Tue Apr 6 20:01:52 2010 for gPXE by  doxygen 1.5.7.1