void
ieee80211_rssadapt_input(
struct ieee80211com *ic
, struct ieee80211_node *ni
, struct ieee80211_rssadapt *ra
, int rssi
)
void
ieee80211_rssadapt_lower_rate(
struct ieee80211com *ic
, struct ieee80211_node *ni
, struct ieee80211_rssadapt *ra
, struct ieee80211_rssdesc *id
)
void
ieee80211_rssadapt_raise_rate(
struct ieee80211com *ic
, struct ieee80211_rssadapt *ra
, struct ieee80211_rssdesc *id
)
void
ieee80211_rssadapt_updatestats(
struct ieee80211_rssadapt *ra
)
int
ieee80211_rssadapt_choose(
struct ieee80211_rssadapt *ra
, struct ieee80211_rateset *rs
, struct ieee80211_frame *wh
, u_int len
, int fixed_rate
, const char *dvname
, int do_not_adapt
)
rssadapt models an 802.11 channel very simply (see also the BUGS section.) It assumes that the packet-error rate (PER) is determined by the signal-to-noise ratio (S/N) at the receiver, the transmission data rate, and the packet length. The S/N determines the choice of data rate that yields the lowest PER for all packets of a certain length.
ra
, rs
, wh
, len
, fixed_rate
, dvname
, do_not_adapt
)
ra
ra
belongs to the BSS node,
ic->ic_bss.
rs
len
fixed_rate
fixed_rate
tells the index of that rate in
rs
.
rssadapt
obeys a fixed data rate whenever the 802.11 standard allows it:
sometimes the standard requires multicast/broadcast packets to be
transmitted at a so-called
``basic rate''.
dvname
dvname
to indicate the name of the
interface for the purpose of diagnostic and debug messages.
The driver sets
dvname
to
NULL
when no messages are desired.
do_not_adapt
do_not_adapt
is non-zero, then
ieee80211_rssadapt_choose(
)
will choose the highest rate in
rs
that suits the destination, regardless of the RSS.
)
is an index into
rs
,
indicating its choice of transmit data rate.
ic
, ni
, ra
, rssi
)
),
whose arguments are:
ic
ni
ra
rssi
rssi
is from 0 to 255.
ic
, ni
, ra
, id
)
ic
, ra
, id
)
)
and
ieee80211_rssadapt_lower_rate(
)
to indicate transmit successes and failures, respectively.
ic
ni
ra
id
ra
)
)
every 1/10th second for each node's
object.
ra
The rate of decay is controlled. In an interval of 1/10th second to 10 seconds, only one RSS threshold per neighbor may decay. The interval is connected to the exponential-average rate that packets are being transmitted. At high packet rates, the interval is shortest. It is longest at low packet rates. The rationale for this is that RSS thresholds should not decay rapidly if there is no information from packet transmissions to counteract their decay.
struct ieee80211_rssdesc {
u_int id_len;
u_int id_rateidx;
struct ieee80211_node *id_node;
u_int8_t id_rssi;
};
id_len
is the length, in bytes, of the transmitted packet.
id_node
points to the neighbor's
and
id_rssi
is the exponential-average RSS at the time the packet was
transmitted.
id_rateidx
is an index into the destination-neighbor's rate-set,
id_node->ni_rates
,
indicating the transmit data rate for the packet.
An contains the rate-adaptation state for a neighboring 802.11 node. Ordinarily a driver will ``subclass'' The structure will be a subclass member. In this way, every node's rssadapt condition is independently tracked and stored in its node object.
struct ieee80211_rssadapt {
u_int16_t ra_avg_rssi;
u_int32_t ra_nfail;
u_int32_t ra_nok;
u_int32_t ra_pktrate;
u_int16_t ra_rate_thresh[IEEE80211_RSSADAPT_BKTS]
[IEEE80211_RATE_SIZE];
struct timeval ra_last_raise;
struct timeval ra_raise_interval;
};
ra_avg_rssi
is the exponential-average RSS, shifted left 8 bits.
ra_nfail
tells the number of transmit failures in the current update interval.
ra_nok
tells the number of transmit successes in the current update interval.
ra_pktrate
tells the exponential average number of transmit failure/success
indications over past update intervals.
This approximates the rate of packet-transmission.
ra_rate_thresh
contains RSS thresholds that are indexed by
<packet length, data rate>
tuples.
When this node's exponential-average RSS exceeds
ra_rate_thresh[i][j]
,
then packets at most 128 x 8^i bytes long are eligible to be
transmitted at the rate indexed by j.
ra_last_raise
and
ra_raise_interval
are used to control the rate that RSS thresholds
``decay''.
ra_last_raise
indicates when
ieee80211_rssadapt_raise_rate()
was last called.
ra_raise_interval
tells the minimum period between consecutive calls to
ieee80211_rssadapt_raise_rate().
If
ieee80211_rssadapt_raise_rate(
)
is called more than once in any period, the second and subsequent
calls are ignored.
/usr/src
.
The code for
rssadapt
is in the file
sys/net80211/ieee80211_rssadapt.c
.
wi(4)
contains a reference implementation.
See
sys/dev/ic/wi.c
.
For improved throughput, rssadapt should indicate to drivers when they should use the 802.11b short-preamble.
The constants in
ieee80211_rssadapt_updatestats()
should be configurable.