diff options
author | damien <damien@FreeBSD.org> | 2005-11-23 17:32:57 +0000 |
---|---|---|
committer | damien <damien@FreeBSD.org> | 2005-11-23 17:32:57 +0000 |
commit | bb8a6c0caed07e629d1177c4e8d4bf380705e138 (patch) | |
tree | 71f6a37574f70e3b70dad1405a9fe820a91dbbf3 /sys | |
parent | 3d571e2f28283e633fbc3eade19d120a71bb0e87 (diff) | |
download | FreeBSD-src-bb8a6c0caed07e629d1177c4e8d4bf380705e138.zip FreeBSD-src-bb8a6c0caed07e629d1177c4e8d4bf380705e138.tar.gz |
Optimize PLCP length field computation for 802.11b rates.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ral/if_ral.c | 9 | ||||
-rw-r--r-- | sys/dev/usb/if_ural.c | 9 |
2 files changed, 8 insertions, 10 deletions
diff --git a/sys/dev/ral/if_ral.c b/sys/dev/ral/if_ral.c index 86e74a0..cb918f6 100644 --- a/sys/dev/ral/if_ral.c +++ b/sys/dev/ral/if_ral.c @@ -1703,12 +1703,11 @@ ral_setup_tx_desc(struct ral_softc *sc, struct ral_tx_desc *desc, * Long PLCP LENGTH field. * From IEEE Std 802.11b-1999, pp. 16. */ - plcp_length = (8 * len * 2) / rate; - remainder = (8 * len * 2) % rate; - if (remainder != 0) { - if (rate == 22 && (rate - remainder) / 16 != 0) + plcp_length = (16 * len + rate - 1) / rate; + if (rate == 22) { + remainder = (16 * len) % 22; + if (remainder != 0 && remainder < 7) desc->plcp_service |= RAL_PLCP_LENGEXT; - plcp_length++; } desc->plcp_length = htole16(plcp_length); } diff --git a/sys/dev/usb/if_ural.c b/sys/dev/usb/if_ural.c index 85a55cf..5723003 100644 --- a/sys/dev/usb/if_ural.c +++ b/sys/dev/usb/if_ural.c @@ -1050,12 +1050,11 @@ ural_setup_tx_desc(struct ural_softc *sc, struct ural_tx_desc *desc, * Long PLCP LENGTH field. * From IEEE Std 802.11b-1999, pp. 16. */ - plcp_length = (8 * len * 2) / rate; - remainder = (8 * len * 2) % rate; - if (remainder != 0) { - if (rate == 22 && (rate - remainder) / 16 != 0) + plcp_length = (16 * len + rate - 1) / rate; + if (rate == 22) { + remainder = (16 * len) % 22; + if (remainder != 0 && remainder < 7) desc->plcp_service |= RAL_PLCP_LENGEXT; - plcp_length++; } desc->plcp_length = htole16(plcp_length); } |