diff options
| author | Damien Bergamini <damien@FreeBSD.org> | 2005-11-15 17:17:15 +0000 |
|---|---|---|
| committer | Damien Bergamini <damien@FreeBSD.org> | 2005-11-15 17:17:15 +0000 |
| commit | 43b60fd47d14e8152971621e86a7ee55ec2270b6 (patch) | |
| tree | 42a10684a8dcbb723e502887450a81a7a14fb349 /sys/dev | |
| parent | 878124fed45bdf75633a7278947362b77f34a31f (diff) | |
Notes
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/ral/if_ral.c | 29 | ||||
| -rw-r--r-- | sys/dev/usb/if_ural.c | 29 |
2 files changed, 14 insertions, 44 deletions
diff --git a/sys/dev/ral/if_ral.c b/sys/dev/ral/if_ral.c index 79cbd05e5f136..86e74a0854729 100644 --- a/sys/dev/ral/if_ral.c +++ b/sys/dev/ral/if_ral.c @@ -1624,33 +1624,18 @@ static uint16_t ral_txtime(int len, int rate, uint32_t flags) { uint16_t txtime; - int ceil, dbps; if (RAL_RATE_IS_OFDM(rate)) { - /* - * OFDM TXTIME calculation. - * From IEEE Std 802.11a-1999, pp. 37. - */ - dbps = rate * 2; /* data bits per OFDM symbol */ - - ceil = (16 + 8 * len + 6) / dbps; - if ((16 + 8 * len + 6) % dbps != 0) - ceil++; - - txtime = 16 + 4 + 4 * ceil + 6; + /* IEEE Std 802.11a-1999, pp. 37 */ + txtime = (8 + 4 * len + 3 + rate - 1) / rate; + txtime = 16 + 4 + 4 * txtime + 6; } else { - /* - * High Rate TXTIME calculation. - * From IEEE Std 802.11b-1999, pp. 28. - */ - ceil = (8 * len * 2) / rate; - if ((8 * len * 2) % rate != 0) - ceil++; - + /* IEEE Std 802.11b-1999, pp. 28 */ + txtime = (16 * len + rate - 1) / rate; if (rate != 2 && (flags & IEEE80211_F_SHPREAMBLE)) - txtime = 72 + 24 + ceil; + txtime += 72 + 24; else - txtime = 144 + 48 + ceil; + txtime += 144 + 48; } return txtime; diff --git a/sys/dev/usb/if_ural.c b/sys/dev/usb/if_ural.c index 92d103aab7730..2e5f38b2ebbe0 100644 --- a/sys/dev/usb/if_ural.c +++ b/sys/dev/usb/if_ural.c @@ -955,33 +955,18 @@ Static uint16_t ural_txtime(int len, int rate, uint32_t flags) { uint16_t txtime; - int ceil, dbps; if (RAL_RATE_IS_OFDM(rate)) { - /* - * OFDM TXTIME calculation. - * From IEEE Std 802.11a-1999, pp. 37. - */ - dbps = rate * 2; /* data bits per OFDM symbol */ - - ceil = (16 + 8 * len + 6) / dbps; - if ((16 + 8 * len + 6) % dbps != 0) - ceil++; - - txtime = 16 + 4 + 4 * ceil + 6; + /* IEEE Std 802.11a-1999, pp. 37 */ + txtime = (8 + 4 * len + 3 + rate - 1) / rate; + txtime = 16 + 4 + 4 * txtime + 6; } else { - /* - * High Rate TXTIME calculation. - * From IEEE Std 802.11b-1999, pp. 28. - */ - ceil = (8 * len * 2) / rate; - if ((8 * len * 2) % rate != 0) - ceil++; - + /* IEEE Std 802.11b-1999, pp. 28 */ + txtime = (16 * len + rate - 1) / rate; if (rate != 2 && (flags & IEEE80211_F_SHPREAMBLE)) - txtime = 72 + 24 + ceil; + txtime += 72 + 24; else - txtime = 144 + 48 + ceil; + txtime += 144 + 48; } return txtime; |
