if_ath.c (172206) | if_ath.c (172211) |
---|---|
1/*- 2 * Copyright (c) 2002-2007 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-2007 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 172206 2007-09-17 05:16:38Z sam $"); | 31__FBSDID("$FreeBSD: head/sys/dev/ath/if_ath.c 172211 2007-09-17 19:07:24Z sam $"); |
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 --- 79 unchanged lines hidden (view full) --- 119 const u_int8_t mac[IEEE80211_ADDR_LEN]); 120static void ath_key_update_begin(struct ieee80211com *); 121static void ath_key_update_end(struct ieee80211com *); 122static void ath_mode_init(struct ath_softc *); 123static void ath_setslottime(struct ath_softc *); 124static void ath_updateslot(struct ifnet *); 125static int ath_beaconq_setup(struct ath_hal *); 126static int ath_beacon_alloc(struct ath_softc *, struct ieee80211_node *); | 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 --- 79 unchanged lines hidden (view full) --- 119 const u_int8_t mac[IEEE80211_ADDR_LEN]); 120static void ath_key_update_begin(struct ieee80211com *); 121static void ath_key_update_end(struct ieee80211com *); 122static void ath_mode_init(struct ath_softc *); 123static void ath_setslottime(struct ath_softc *); 124static void ath_updateslot(struct ifnet *); 125static int ath_beaconq_setup(struct ath_hal *); 126static int ath_beacon_alloc(struct ath_softc *, struct ieee80211_node *); |
127static void ath_beacon_update(struct ieee80211com *, int item); |
|
127static void ath_beacon_setup(struct ath_softc *, struct ath_buf *); 128static void ath_beacon_proc(void *, int); 129static void ath_bstuck_proc(void *, int); 130static void ath_beacon_free(struct ath_softc *); 131static void ath_beacon_config(struct ath_softc *); 132static void ath_descdma_cleanup(struct ath_softc *sc, 133 struct ath_descdma *, ath_bufhead *); 134static int ath_desc_alloc(struct ath_softc *); --- 485 unchanged lines hidden (view full) --- 620 ic->ic_set_channel = ath_set_channel; 621 ic->ic_crypto.cs_max_keyix = sc->sc_keymax; 622 ic->ic_crypto.cs_key_alloc = ath_key_alloc; 623 ic->ic_crypto.cs_key_delete = ath_key_delete; 624 ic->ic_crypto.cs_key_set = ath_key_set; 625 ic->ic_crypto.cs_key_update_begin = ath_key_update_begin; 626 ic->ic_crypto.cs_key_update_end = ath_key_update_end; 627 ic->ic_raw_xmit = ath_raw_xmit; | 128static void ath_beacon_setup(struct ath_softc *, struct ath_buf *); 129static void ath_beacon_proc(void *, int); 130static void ath_bstuck_proc(void *, int); 131static void ath_beacon_free(struct ath_softc *); 132static void ath_beacon_config(struct ath_softc *); 133static void ath_descdma_cleanup(struct ath_softc *sc, 134 struct ath_descdma *, ath_bufhead *); 135static int ath_desc_alloc(struct ath_softc *); --- 485 unchanged lines hidden (view full) --- 621 ic->ic_set_channel = ath_set_channel; 622 ic->ic_crypto.cs_max_keyix = sc->sc_keymax; 623 ic->ic_crypto.cs_key_alloc = ath_key_alloc; 624 ic->ic_crypto.cs_key_delete = ath_key_delete; 625 ic->ic_crypto.cs_key_set = ath_key_set; 626 ic->ic_crypto.cs_key_update_begin = ath_key_update_begin; 627 ic->ic_crypto.cs_key_update_end = ath_key_update_end; 628 ic->ic_raw_xmit = ath_raw_xmit; |
629 ic->ic_update_beacon = ath_beacon_update; |
|
628 /* complete initialization */ 629 ieee80211_media_init(ic, ath_media_change, ieee80211_media_status); 630 631 ath_bpfattach(sc); 632 /* 633 * Setup dynamic sysctl's now that country code and 634 * regdomain are available from the hal. 635 */ --- 1801 unchanged lines hidden (view full) --- 2437} 2438 2439/* 2440 * Allocate and setup an initial beacon frame. 2441 */ 2442static int 2443ath_beacon_alloc(struct ath_softc *sc, struct ieee80211_node *ni) 2444{ | 630 /* complete initialization */ 631 ieee80211_media_init(ic, ath_media_change, ieee80211_media_status); 632 633 ath_bpfattach(sc); 634 /* 635 * Setup dynamic sysctl's now that country code and 636 * regdomain are available from the hal. 637 */ --- 1801 unchanged lines hidden (view full) --- 2439} 2440 2441/* 2442 * Allocate and setup an initial beacon frame. 2443 */ 2444static int 2445ath_beacon_alloc(struct ath_softc *sc, struct ieee80211_node *ni) 2446{ |
2445 struct ieee80211com *ic = ni->ni_ic; | |
2446 struct ath_buf *bf; 2447 struct mbuf *m; 2448 int error; 2449 2450 bf = STAILQ_FIRST(&sc->sc_bbuf); 2451 if (bf == NULL) { 2452 DPRINTF(sc, ATH_DEBUG_BEACON, "%s: no dma buffers\n", __func__); 2453 sc->sc_stats.ast_be_nombuf++; /* XXX */ 2454 return ENOMEM; /* XXX */ 2455 } 2456 /* 2457 * NB: the beacon data buffer must be 32-bit aligned; 2458 * we assume the mbuf routines will return us something 2459 * with this alignment (perhaps should assert). 2460 */ | 2447 struct ath_buf *bf; 2448 struct mbuf *m; 2449 int error; 2450 2451 bf = STAILQ_FIRST(&sc->sc_bbuf); 2452 if (bf == NULL) { 2453 DPRINTF(sc, ATH_DEBUG_BEACON, "%s: no dma buffers\n", __func__); 2454 sc->sc_stats.ast_be_nombuf++; /* XXX */ 2455 return ENOMEM; /* XXX */ 2456 } 2457 /* 2458 * NB: the beacon data buffer must be 32-bit aligned; 2459 * we assume the mbuf routines will return us something 2460 * with this alignment (perhaps should assert). 2461 */ |
2461 m = ieee80211_beacon_alloc(ic, ni, &sc->sc_boff); | 2462 m = ieee80211_beacon_alloc(ni, &sc->sc_boff); |
2462 if (m == NULL) { 2463 DPRINTF(sc, ATH_DEBUG_BEACON, "%s: cannot get mbuf\n", 2464 __func__); 2465 sc->sc_stats.ast_be_nombuf++; 2466 return ENOMEM; 2467 } 2468 error = bus_dmamap_load_mbuf_sg(sc->sc_dmat, bf->bf_dmamap, m, 2469 bf->bf_segs, &bf->bf_nseg, --- 78 unchanged lines hidden (view full) --- 2548 , roundup(m->m_len, 4) /* buffer length */ 2549 , AH_TRUE /* first segment */ 2550 , AH_TRUE /* last segment */ 2551 , ds /* first descriptor */ 2552 ); 2553#undef USE_SHPREAMBLE 2554} 2555 | 2463 if (m == NULL) { 2464 DPRINTF(sc, ATH_DEBUG_BEACON, "%s: cannot get mbuf\n", 2465 __func__); 2466 sc->sc_stats.ast_be_nombuf++; 2467 return ENOMEM; 2468 } 2469 error = bus_dmamap_load_mbuf_sg(sc->sc_dmat, bf->bf_dmamap, m, 2470 bf->bf_segs, &bf->bf_nseg, --- 78 unchanged lines hidden (view full) --- 2549 , roundup(m->m_len, 4) /* buffer length */ 2550 , AH_TRUE /* first segment */ 2551 , AH_TRUE /* last segment */ 2552 , ds /* first descriptor */ 2553 ); 2554#undef USE_SHPREAMBLE 2555} 2556 |
2557static void 2558ath_beacon_update(struct ieee80211com *ic, int item) 2559{ 2560 struct ath_softc *sc = ic->ic_ifp->if_softc; 2561 struct ieee80211_beacon_offsets *bo = &sc->sc_boff; 2562 2563 setbit(bo->bo_flags, item); 2564} 2565 |
|
2556/* 2557 * Append the contents of src to dst; both queues 2558 * are assumed to be locked. 2559 */ 2560static void 2561ath_txqmove(struct ath_txq *dst, struct ath_txq *src) 2562{ 2563 STAILQ_CONCAT(&dst->axq_q, &src->axq_q); --- 57 unchanged lines hidden (view full) --- 2621 * Update dynamic beacon contents. If this returns 2622 * non-zero then we need to remap the memory because 2623 * the beacon frame changed size (probably because 2624 * of the TIM bitmap). 2625 */ 2626 m = bf->bf_m; 2627 nmcastq = sc->sc_mcastq.axq_depth; 2628 ncabq = ath_hal_numtxpending(ah, cabq->axq_qnum); | 2566/* 2567 * Append the contents of src to dst; both queues 2568 * are assumed to be locked. 2569 */ 2570static void 2571ath_txqmove(struct ath_txq *dst, struct ath_txq *src) 2572{ 2573 STAILQ_CONCAT(&dst->axq_q, &src->axq_q); --- 57 unchanged lines hidden (view full) --- 2631 * Update dynamic beacon contents. If this returns 2632 * non-zero then we need to remap the memory because 2633 * the beacon frame changed size (probably because 2634 * of the TIM bitmap). 2635 */ 2636 m = bf->bf_m; 2637 nmcastq = sc->sc_mcastq.axq_depth; 2638 ncabq = ath_hal_numtxpending(ah, cabq->axq_qnum); |
2629 if (ieee80211_beacon_update(ic, bf->bf_node, &sc->sc_boff, m, ncabq+nmcastq)) { | 2639 if (ieee80211_beacon_update(bf->bf_node, &sc->sc_boff, m, ncabq+nmcastq)) { |
2630 /* XXX too conservative? */ 2631 bus_dmamap_unload(sc->sc_dmat, bf->bf_dmamap); 2632 error = bus_dmamap_load_mbuf_sg(sc->sc_dmat, bf->bf_dmamap, m, 2633 bf->bf_segs, &bf->bf_nseg, 2634 BUS_DMA_NOWAIT); 2635 if (error != 0) { 2636 if_printf(ic->ic_ifp, 2637 "%s: bus_dmamap_load_mbuf_sg failed, error %u\n", --- 3967 unchanged lines hidden --- | 2640 /* XXX too conservative? */ 2641 bus_dmamap_unload(sc->sc_dmat, bf->bf_dmamap); 2642 error = bus_dmamap_load_mbuf_sg(sc->sc_dmat, bf->bf_dmamap, m, 2643 bf->bf_segs, &bf->bf_nseg, 2644 BUS_DMA_NOWAIT); 2645 if (error != 0) { 2646 if_printf(ic->ic_ifp, 2647 "%s: bus_dmamap_load_mbuf_sg failed, error %u\n", --- 3967 unchanged lines hidden --- |