if_ath.c (242271) | if_ath.c (242391) |
---|---|
1/*- 2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 * THE POSSIBILITY OF SUCH DAMAGES. 28 */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 * THE POSSIBILITY OF SUCH DAMAGES. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/ath/if_ath.c 242271 2012-10-28 21:13:12Z adrian $"); | 31__FBSDID("$FreeBSD: head/sys/dev/ath/if_ath.c 242391 2012-10-31 06:27:58Z adrian $"); |
32 33/* 34 * Driver for the Atheros Wireless LAN controller. 35 * 36 * This software is derived from work of Atsushi Onoe; his contribution 37 * is greatly appreciated. 38 */ 39 --- 379 unchanged lines hidden (view full) --- 419 "%s taskq", ifp->if_xname); 420 421 TASK_INIT(&sc->sc_rxtask, 0, sc->sc_rx.recv_tasklet, sc); 422 TASK_INIT(&sc->sc_bmisstask, 0, ath_bmiss_proc, sc); 423 TASK_INIT(&sc->sc_bstucktask,0, ath_bstuck_proc, sc); 424 TASK_INIT(&sc->sc_resettask,0, ath_reset_proc, sc); 425 TASK_INIT(&sc->sc_txqtask,0, ath_txq_sched_tasklet, sc); 426 TASK_INIT(&sc->sc_fataltask,0, ath_fatal_proc, sc); | 32 33/* 34 * Driver for the Atheros Wireless LAN controller. 35 * 36 * This software is derived from work of Atsushi Onoe; his contribution 37 * is greatly appreciated. 38 */ 39 --- 379 unchanged lines hidden (view full) --- 419 "%s taskq", ifp->if_xname); 420 421 TASK_INIT(&sc->sc_rxtask, 0, sc->sc_rx.recv_tasklet, sc); 422 TASK_INIT(&sc->sc_bmisstask, 0, ath_bmiss_proc, sc); 423 TASK_INIT(&sc->sc_bstucktask,0, ath_bstuck_proc, sc); 424 TASK_INIT(&sc->sc_resettask,0, ath_reset_proc, sc); 425 TASK_INIT(&sc->sc_txqtask,0, ath_txq_sched_tasklet, sc); 426 TASK_INIT(&sc->sc_fataltask,0, ath_fatal_proc, sc); |
427 TASK_INIT(&sc->sc_txsndtask, 0, ath_start_task, sc); | |
428 429 /* 430 * Allocate hardware transmit queues: one queue for 431 * beacon frames and one data queue for each QoS 432 * priority. Note that the hal handles resetting 433 * these queues at the needed time. 434 * 435 * XXX PS-Poll --- 2006 unchanged lines hidden (view full) --- 2442 return bf; 2443} 2444 2445static void 2446ath_start_queue(struct ifnet *ifp) 2447{ 2448 struct ath_softc *sc = ifp->if_softc; 2449 | 427 428 /* 429 * Allocate hardware transmit queues: one queue for 430 * beacon frames and one data queue for each QoS 431 * priority. Note that the hal handles resetting 432 * these queues at the needed time. 433 * 434 * XXX PS-Poll --- 2006 unchanged lines hidden (view full) --- 2441 return bf; 2442} 2443 2444static void 2445ath_start_queue(struct ifnet *ifp) 2446{ 2447 struct ath_softc *sc = ifp->if_softc; 2448 |
2449 ATH_KTR(sc, ATH_KTR_TX, 0, "ath_start_queue: start"); |
|
2450 ath_tx_kick(sc); | 2450 ath_tx_kick(sc); |
2451 ATH_KTR(sc, ATH_KTR_TX, 0, "ath_start_queue: finished"); |
|
2451} 2452 2453void 2454ath_start_task(void *arg, int npending) 2455{ 2456 struct ath_softc *sc = (struct ath_softc *) arg; 2457 struct ifnet *ifp = sc->sc_ifp; 2458 | 2452} 2453 2454void 2455ath_start_task(void *arg, int npending) 2456{ 2457 struct ath_softc *sc = (struct ath_softc *) arg; 2458 struct ifnet *ifp = sc->sc_ifp; 2459 |
2460 ATH_KTR(sc, ATH_KTR_TX, 0, "ath_start_task: start"); 2461 |
|
2459 /* XXX is it ok to hold the ATH_LOCK here? */ 2460 ATH_PCU_LOCK(sc); 2461 if (sc->sc_inreset_cnt > 0) { 2462 device_printf(sc->sc_dev, 2463 "%s: sc_inreset_cnt > 0; bailing\n", __func__); 2464 ATH_PCU_UNLOCK(sc); 2465 IF_LOCK(&ifp->if_snd); 2466 sc->sc_stats.ast_tx_qstop++; 2467 ifp->if_drv_flags |= IFF_DRV_OACTIVE; 2468 IF_UNLOCK(&ifp->if_snd); | 2462 /* XXX is it ok to hold the ATH_LOCK here? */ 2463 ATH_PCU_LOCK(sc); 2464 if (sc->sc_inreset_cnt > 0) { 2465 device_printf(sc->sc_dev, 2466 "%s: sc_inreset_cnt > 0; bailing\n", __func__); 2467 ATH_PCU_UNLOCK(sc); 2468 IF_LOCK(&ifp->if_snd); 2469 sc->sc_stats.ast_tx_qstop++; 2470 ifp->if_drv_flags |= IFF_DRV_OACTIVE; 2471 IF_UNLOCK(&ifp->if_snd); |
2472 ATH_KTR(sc, ATH_KTR_TX, 0, "ath_start_task: OACTIVE, finish"); |
|
2469 return; 2470 } 2471 sc->sc_txstart_cnt++; 2472 ATH_PCU_UNLOCK(sc); 2473 2474 ath_start(sc->sc_ifp); 2475 2476 ATH_PCU_LOCK(sc); 2477 sc->sc_txstart_cnt--; 2478 ATH_PCU_UNLOCK(sc); | 2473 return; 2474 } 2475 sc->sc_txstart_cnt++; 2476 ATH_PCU_UNLOCK(sc); 2477 2478 ath_start(sc->sc_ifp); 2479 2480 ATH_PCU_LOCK(sc); 2481 sc->sc_txstart_cnt--; 2482 ATH_PCU_UNLOCK(sc); |
2483 ATH_KTR(sc, ATH_KTR_TX, 0, "ath_start_task: finished"); |
|
2479} 2480 2481void 2482ath_start(struct ifnet *ifp) 2483{ 2484 struct ath_softc *sc = ifp->if_softc; 2485 struct ieee80211_node *ni; 2486 struct ath_buf *bf; 2487 struct mbuf *m, *next; 2488 ath_bufhead frags; | 2484} 2485 2486void 2487ath_start(struct ifnet *ifp) 2488{ 2489 struct ath_softc *sc = ifp->if_softc; 2490 struct ieee80211_node *ni; 2491 struct ath_buf *bf; 2492 struct mbuf *m, *next; 2493 ath_bufhead frags; |
2494 int npkts = 0; |
|
2489 2490 if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || sc->sc_invalid) 2491 return; 2492 | 2495 2496 if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || sc->sc_invalid) 2497 return; 2498 |
2499 ATH_KTR(sc, ATH_KTR_TX, 0, "ath_start: called"); 2500 |
|
2493 for (;;) { 2494 ATH_TXBUF_LOCK(sc); 2495 if (sc->sc_txbuf_cnt <= sc->sc_txq_data_minfree) { 2496 /* XXX increment counter? */ 2497 ATH_TXBUF_UNLOCK(sc); 2498 IF_LOCK(&ifp->if_snd); 2499 ifp->if_drv_flags |= IFF_DRV_OACTIVE; 2500 IF_UNLOCK(&ifp->if_snd); --- 11 unchanged lines hidden (view full) --- 2512 IFQ_DEQUEUE(&ifp->if_snd, m); 2513 if (m == NULL) { 2514 ATH_TXBUF_LOCK(sc); 2515 ath_returnbuf_head(sc, bf); 2516 ATH_TXBUF_UNLOCK(sc); 2517 break; 2518 } 2519 ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; | 2501 for (;;) { 2502 ATH_TXBUF_LOCK(sc); 2503 if (sc->sc_txbuf_cnt <= sc->sc_txq_data_minfree) { 2504 /* XXX increment counter? */ 2505 ATH_TXBUF_UNLOCK(sc); 2506 IF_LOCK(&ifp->if_snd); 2507 ifp->if_drv_flags |= IFF_DRV_OACTIVE; 2508 IF_UNLOCK(&ifp->if_snd); --- 11 unchanged lines hidden (view full) --- 2520 IFQ_DEQUEUE(&ifp->if_snd, m); 2521 if (m == NULL) { 2522 ATH_TXBUF_LOCK(sc); 2523 ath_returnbuf_head(sc, bf); 2524 ATH_TXBUF_UNLOCK(sc); 2525 break; 2526 } 2527 ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; |
2528 npkts ++; |
|
2520 /* 2521 * Check for fragmentation. If this frame 2522 * has been broken up verify we have enough 2523 * buffers to send all the fragments so all 2524 * go out or none... 2525 */ 2526 TAILQ_INIT(&frags); 2527 if ((m->m_flags & M_FRAG) && --- 57 unchanged lines hidden (view full) --- 2585 bf = TAILQ_FIRST(&frags); 2586 KASSERT(bf != NULL, ("no buf for txfrag")); 2587 TAILQ_REMOVE(&frags, bf, bf_list); 2588 goto nextfrag; 2589 } 2590 2591 sc->sc_wd_timer = 5; 2592 } | 2529 /* 2530 * Check for fragmentation. If this frame 2531 * has been broken up verify we have enough 2532 * buffers to send all the fragments so all 2533 * go out or none... 2534 */ 2535 TAILQ_INIT(&frags); 2536 if ((m->m_flags & M_FRAG) && --- 57 unchanged lines hidden (view full) --- 2594 bf = TAILQ_FIRST(&frags); 2595 KASSERT(bf != NULL, ("no buf for txfrag")); 2596 TAILQ_REMOVE(&frags, bf, bf_list); 2597 goto nextfrag; 2598 } 2599 2600 sc->sc_wd_timer = 5; 2601 } |
2602 ATH_KTR(sc, ATH_KTR_TX, 1, "ath_start: finished; npkts=%d", npkts); |
|
2593} 2594 2595static int 2596ath_media_change(struct ifnet *ifp) 2597{ 2598 int error = ieee80211_media_change(ifp); 2599 /* NB: only the fixed rate can change and that doesn't need a reset */ 2600 return (error == ENETRESET ? 0 : error); --- 3049 unchanged lines hidden --- | 2603} 2604 2605static int 2606ath_media_change(struct ifnet *ifp) 2607{ 2608 int error = ieee80211_media_change(ifp); 2609 /* NB: only the fixed rate can change and that doesn't need a reset */ 2610 return (error == ENETRESET ? 0 : error); --- 3049 unchanged lines hidden --- |