rt2560.c (289165) | rt2560.c (292165) |
---|---|
1/* $FreeBSD: head/sys/dev/ral/rt2560.c 289165 2015-10-12 04:55:20Z adrian $ */ | 1/* $FreeBSD: head/sys/dev/ral/rt2560.c 292165 2015-12-13 20:48:24Z avos $ */ |
2 3/*- 4 * Copyright (c) 2005, 2006 5 * Damien Bergamini <damien.bergamini@free.fr> 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20#include <sys/cdefs.h> | 2 3/*- 4 * Copyright (c) 2005, 2006 5 * Damien Bergamini <damien.bergamini@free.fr> 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20#include <sys/cdefs.h> |
21__FBSDID("$FreeBSD: head/sys/dev/ral/rt2560.c 289165 2015-10-12 04:55:20Z adrian $"); | 21__FBSDID("$FreeBSD: head/sys/dev/ral/rt2560.c 292165 2015-12-13 20:48:24Z avos $"); |
22 23/*- 24 * Ralink Technology RT2560 chipset driver 25 * http://www.ralinktech.com/ 26 */ 27 28#include <sys/param.h> 29#include <sys/sysctl.h> --- 2219 unchanged lines hidden (view full) --- 2249rt2560_update_slot(struct ieee80211com *ic) 2250{ 2251 struct rt2560_softc *sc = ic->ic_softc; 2252 uint8_t slottime; 2253 uint16_t tx_sifs, tx_pifs, tx_difs, eifs; 2254 uint32_t tmp; 2255 2256#ifndef FORCE_SLOTTIME | 22 23/*- 24 * Ralink Technology RT2560 chipset driver 25 * http://www.ralinktech.com/ 26 */ 27 28#include <sys/param.h> 29#include <sys/sysctl.h> --- 2219 unchanged lines hidden (view full) --- 2249rt2560_update_slot(struct ieee80211com *ic) 2250{ 2251 struct rt2560_softc *sc = ic->ic_softc; 2252 uint8_t slottime; 2253 uint16_t tx_sifs, tx_pifs, tx_difs, eifs; 2254 uint32_t tmp; 2255 2256#ifndef FORCE_SLOTTIME |
2257 slottime = (ic->ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20; | 2257 slottime = IEEE80211_GET_SLOTTIME(ic); |
2258#else 2259 /* 2260 * Setting slot time according to "short slot time" capability 2261 * in beacon/probe_resp seems to cause problem to acknowledge 2262 * certain AP's data frames transimitted at CCK/DS rates: the 2263 * problematic AP keeps retransmitting data frames, probably 2264 * because MAC level acks are not received by hardware. 2265 * So we cheat a little bit here by claiming we are capable of 2266 * "short slot time" but setting hardware slot time to the normal 2267 * slot time. ral(4) does not seem to have trouble to receive 2268 * frames transmitted using short slot time even if hardware 2269 * slot time is set to normal slot time. If we didn't use this 2270 * trick, we would have to claim that short slot time is not 2271 * supported; this would give relative poor RX performance 2272 * (-1Mb~-2Mb lower) and the _whole_ BSS would stop using short 2273 * slot time. 2274 */ | 2258#else 2259 /* 2260 * Setting slot time according to "short slot time" capability 2261 * in beacon/probe_resp seems to cause problem to acknowledge 2262 * certain AP's data frames transimitted at CCK/DS rates: the 2263 * problematic AP keeps retransmitting data frames, probably 2264 * because MAC level acks are not received by hardware. 2265 * So we cheat a little bit here by claiming we are capable of 2266 * "short slot time" but setting hardware slot time to the normal 2267 * slot time. ral(4) does not seem to have trouble to receive 2268 * frames transmitted using short slot time even if hardware 2269 * slot time is set to normal slot time. If we didn't use this 2270 * trick, we would have to claim that short slot time is not 2271 * supported; this would give relative poor RX performance 2272 * (-1Mb~-2Mb lower) and the _whole_ BSS would stop using short 2273 * slot time. 2274 */ |
2275 slottime = 20; | 2275 slottime = IEEE80211_DUR_SLOT; |
2276#endif 2277 2278 /* update the MAC slot boundaries */ 2279 tx_sifs = RAL_SIFS - RT2560_TXRX_TURNAROUND; 2280 tx_pifs = tx_sifs + slottime; | 2276#endif 2277 2278 /* update the MAC slot boundaries */ 2279 tx_sifs = RAL_SIFS - RT2560_TXRX_TURNAROUND; 2280 tx_pifs = tx_sifs + slottime; |
2281 tx_difs = tx_sifs + 2 * slottime; | 2281 tx_difs = IEEE80211_DUR_DIFS(tx_sifs, slottime); |
2282 eifs = (ic->ic_curmode == IEEE80211_MODE_11B) ? 364 : 60; 2283 2284 tmp = RAL_READ(sc, RT2560_CSR11); 2285 tmp = (tmp & ~0x1f00) | slottime << 8; 2286 RAL_WRITE(sc, RT2560_CSR11, tmp); 2287 2288 tmp = tx_pifs << 16 | tx_sifs; 2289 RAL_WRITE(sc, RT2560_CSR18, tmp); --- 456 unchanged lines hidden --- | 2282 eifs = (ic->ic_curmode == IEEE80211_MODE_11B) ? 364 : 60; 2283 2284 tmp = RAL_READ(sc, RT2560_CSR11); 2285 tmp = (tmp & ~0x1f00) | slottime << 8; 2286 RAL_WRITE(sc, RT2560_CSR11, tmp); 2287 2288 tmp = tx_pifs << 16 | tx_sifs; 2289 RAL_WRITE(sc, RT2560_CSR18, tmp); --- 456 unchanged lines hidden --- |