mirror of https://github.com/proski/madwifi
Some cleanup for jiffies rollover problems. Use of time_before/time_after macros and correct units for storing jiffies. On some distributions Jiffies rollover after 5m.
git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3483 0192ed92-7a03-0410-a25b-9323aeb14dbd
This commit is contained in:
parent
24f048e954
commit
85119ae227
|
@ -160,7 +160,7 @@ ath_rate_tx_complete(struct ath_softc *sc,
|
|||
on->on_tx_err++;
|
||||
on->on_tx_retr += ts->ts_shortretry
|
||||
+ ts->ts_longretry;
|
||||
if (jiffies >= on->on_nextcheck) {
|
||||
if (time_after(jiffies, on->on_nextcheck)) {
|
||||
ath_rate_ctl(sc, &an->an_node);
|
||||
/* XXX halve rate for station mode */
|
||||
on->on_nextcheck = jiffies + (ath_rateinterval * HZ) / 1000;
|
||||
|
|
|
@ -63,7 +63,7 @@ struct onoe_node {
|
|||
u_int8_t on_tx_rate1sp; /* series 1 short preamble h/w rate */
|
||||
u_int8_t on_tx_rate2sp; /* series 2 short preamble h/w rate */
|
||||
u_int8_t on_tx_rate3sp; /* series 3 short preamble h/w rate */
|
||||
int on_nextcheck; /* time of next check for rate drop */
|
||||
long unsigned int on_nextcheck; /* time of next check for rate drop */
|
||||
};
|
||||
#define ATH_NODE_ONOE(an) ((struct onoe_node *)&an[1])
|
||||
#endif /* _DEV_ATH_RATE_ONOE_H */
|
||||
|
|
|
@ -344,7 +344,7 @@ pick_sample_ndx(struct sample_node *sn, int size_bin)
|
|||
continue;
|
||||
|
||||
/* rarely sample bit-rates that fail a lot */
|
||||
if (jiffies - sn->stats[size_bin][ndx].last_tx < ((HZ * STALE_FAILURE_TIMEOUT_MS) / 1000) &&
|
||||
if (time_before(jiffies, sn->stats[size_bin][ndx].last_tx + ((HZ * STALE_FAILURE_TIMEOUT_MS) / 1000)) &&
|
||||
sn->stats[size_bin][ndx].successive_failures > 3)
|
||||
continue;
|
||||
|
||||
|
@ -447,7 +447,8 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_node *an,
|
|||
} else if (sn->packets_sent[size_bin] < 20) {
|
||||
/* let the bit-rate switch quickly during the first few packets */
|
||||
change_rates = 1;
|
||||
} else if (jiffies - ((HZ * MIN_SWITCH_MS) / 1000) > sn->jiffies_since_switch[size_bin]) {
|
||||
} else if (time_after(jiffies, sn->jiffies_since_switch[size_bin] +
|
||||
((HZ * MIN_SWITCH_MS) / 1000))) {
|
||||
/* 2 seconds have gone by */
|
||||
change_rates = 1;
|
||||
} else if (average_tx_time * 2 < sn->stats[size_bin][sn->current_rate[size_bin]].average_tx_time) {
|
||||
|
|
|
@ -65,7 +65,7 @@ struct rate_stats {
|
|||
int total_packets;
|
||||
int packets_acked;
|
||||
unsigned perfect_tx_time; /* transmit time for 0 retries */
|
||||
int last_tx;
|
||||
unsigned long int last_tx;
|
||||
};
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ struct sample_node {
|
|||
|
||||
int current_rate[NUM_PACKET_SIZE_BINS];
|
||||
int packets_since_switch[NUM_PACKET_SIZE_BINS];
|
||||
unsigned jiffies_since_switch[NUM_PACKET_SIZE_BINS];
|
||||
unsigned long int jiffies_since_switch[NUM_PACKET_SIZE_BINS];
|
||||
|
||||
int packets_since_sample[NUM_PACKET_SIZE_BINS];
|
||||
unsigned sample_tt[NUM_PACKET_SIZE_BINS];
|
||||
|
|
Loading…
Reference in New Issue