Deleted Added
full compact
if_run.c (258641) if_run.c (258643)
1/*-
2 * Copyright (c) 2008,2010 Damien Bergamini <damien.bergamini@free.fr>
3 * ported to FreeBSD by Akinori Furukoshi <moonlightakkiy@yahoo.ca>
4 * USB Consulting, Hans Petter Selasky <hselasky@freebsd.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2008,2010 Damien Bergamini <damien.bergamini@free.fr>
3 * ported to FreeBSD by Akinori Furukoshi <moonlightakkiy@yahoo.ca>
4 * USB Consulting, Hans Petter Selasky <hselasky@freebsd.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <sys/cdefs.h>
20__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_run.c 258641 2013-11-26 10:53:12Z hselasky $");
20__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_run.c 258643 2013-11-26 11:11:24Z hselasky $");
21
22/*-
23 * Ralink Technology RT2700U/RT2800U/RT3000U/RT3900E chipset driver.
24 * http://www.ralinktech.com/
25 */
26
27#include <sys/param.h>
28#include <sys/sockio.h>

--- 2486 unchanged lines hidden (view full) ---

2515{
2516 struct ifnet *ifp = sc->sc_ifp;
2517 struct ieee80211com *ic = ifp->if_l2com;
2518 struct ieee80211_frame *wh;
2519 struct ieee80211_node *ni;
2520 struct rt2870_rxd *rxd;
2521 struct rt2860_rxwi *rxwi;
2522 uint32_t flags;
21
22/*-
23 * Ralink Technology RT2700U/RT2800U/RT3000U/RT3900E chipset driver.
24 * http://www.ralinktech.com/
25 */
26
27#include <sys/param.h>
28#include <sys/sockio.h>

--- 2486 unchanged lines hidden (view full) ---

2515{
2516 struct ifnet *ifp = sc->sc_ifp;
2517 struct ieee80211com *ic = ifp->if_l2com;
2518 struct ieee80211_frame *wh;
2519 struct ieee80211_node *ni;
2520 struct rt2870_rxd *rxd;
2521 struct rt2860_rxwi *rxwi;
2522 uint32_t flags;
2523 uint16_t len, phy;
2523 uint16_t len;
2524 uint8_t ant, rssi;
2525 int8_t nf;
2526
2527 rxwi = mtod(m, struct rt2860_rxwi *);
2528 len = le16toh(rxwi->len) & 0xfff;
2529 if (__predict_false(len > dmalen)) {
2530 m_freem(m);
2531 ifp->if_ierrors++;

--- 50 unchanged lines hidden (view full) ---

2582 (void)ieee80211_input(ni, m, rssi, nf);
2583 ieee80211_free_node(ni);
2584 } else {
2585 (void)ieee80211_input_all(ic, m, rssi, nf);
2586 }
2587
2588 if (__predict_false(ieee80211_radiotap_active(ic))) {
2589 struct run_rx_radiotap_header *tap = &sc->sc_rxtap;
2524 uint8_t ant, rssi;
2525 int8_t nf;
2526
2527 rxwi = mtod(m, struct rt2860_rxwi *);
2528 len = le16toh(rxwi->len) & 0xfff;
2529 if (__predict_false(len > dmalen)) {
2530 m_freem(m);
2531 ifp->if_ierrors++;

--- 50 unchanged lines hidden (view full) ---

2582 (void)ieee80211_input(ni, m, rssi, nf);
2583 ieee80211_free_node(ni);
2584 } else {
2585 (void)ieee80211_input_all(ic, m, rssi, nf);
2586 }
2587
2588 if (__predict_false(ieee80211_radiotap_active(ic))) {
2589 struct run_rx_radiotap_header *tap = &sc->sc_rxtap;
2590 uint16_t phy;
2590
2591 tap->wr_flags = 0;
2592 tap->wr_chan_freq = htole16(ic->ic_curchan->ic_freq);
2593 tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags);
2594 tap->wr_antsignal = rssi;
2595 tap->wr_antenna = ant;
2596 tap->wr_dbm_antsignal = run_rssi2dbm(sc, rssi, ant);
2597 tap->wr_rate = 2; /* in case it can't be found below */

--- 2683 unchanged lines hidden (view full) ---

5281 }
5282
5283 /* Disable Tx/Rx DMA. */
5284 if (run_read(sc, RT2860_WPDMA_GLO_CFG, &tmp) != 0)
5285 return;
5286 tmp &= ~(RT2860_RX_DMA_EN | RT2860_TX_DMA_EN);
5287 run_write(sc, RT2860_WPDMA_GLO_CFG, tmp);
5288
2591
2592 tap->wr_flags = 0;
2593 tap->wr_chan_freq = htole16(ic->ic_curchan->ic_freq);
2594 tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags);
2595 tap->wr_antsignal = rssi;
2596 tap->wr_antenna = ant;
2597 tap->wr_dbm_antsignal = run_rssi2dbm(sc, rssi, ant);
2598 tap->wr_rate = 2; /* in case it can't be found below */

--- 2683 unchanged lines hidden (view full) ---

5282 }
5283
5284 /* Disable Tx/Rx DMA. */
5285 if (run_read(sc, RT2860_WPDMA_GLO_CFG, &tmp) != 0)
5286 return;
5287 tmp &= ~(RT2860_RX_DMA_EN | RT2860_TX_DMA_EN);
5288 run_write(sc, RT2860_WPDMA_GLO_CFG, tmp);
5289
5289 for (ntries = 0; ntries < 100; ntries++) {
5290 for (ntries = 0; ntries < 100; ntries++) {
5290 if (run_read(sc, RT2860_WPDMA_GLO_CFG, &tmp) != 0)
5291 return;
5292 if ((tmp & (RT2860_TX_DMA_BUSY | RT2860_RX_DMA_BUSY)) == 0)
5293 break;
5294 run_delay(sc, 10);
5295 }
5296 if (ntries == 100) {
5297 device_printf(sc->sc_dev, "timeout waiting for DMA engine\n");

--- 60 unchanged lines hidden ---
5291 if (run_read(sc, RT2860_WPDMA_GLO_CFG, &tmp) != 0)
5292 return;
5293 if ((tmp & (RT2860_TX_DMA_BUSY | RT2860_RX_DMA_BUSY)) == 0)
5294 break;
5295 run_delay(sc, 10);
5296 }
5297 if (ntries == 100) {
5298 device_printf(sc->sc_dev, "timeout waiting for DMA engine\n");

--- 60 unchanged lines hidden ---