summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/if_ural.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/usb/if_ural.c')
-rw-r--r--sys/dev/usb/if_ural.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/sys/dev/usb/if_ural.c b/sys/dev/usb/if_ural.c
index 92d103a..2e5f38b 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;
OpenPOWER on IntegriCloud