Deleted Added
full compact
if_ath.c (184368) if_ath.c (184369)
1/*-
2 * Copyright (c) 2002-2008 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-2008 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 184368 2008-10-27 18:22:44Z sam $");
31__FBSDID("$FreeBSD: head/sys/dev/ath/if_ath.c 184369 2008-10-27 18:30:33Z 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

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

293int
294ath_attach(u_int16_t devid, struct ath_softc *sc)
295{
296 struct ifnet *ifp;
297 struct ieee80211com *ic;
298 struct ath_hal *ah = NULL;
299 HAL_STATUS status;
300 int error = 0, i;
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

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

293int
294ath_attach(u_int16_t devid, struct ath_softc *sc)
295{
296 struct ifnet *ifp;
297 struct ieee80211com *ic;
298 struct ath_hal *ah = NULL;
299 HAL_STATUS status;
300 int error = 0, i;
301 u_int wmodes;
301
302 DPRINTF(sc, ATH_DEBUG_ANY, "%s: devid 0x%x\n", __func__, devid);
303
304 ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
305 if (ifp == NULL) {
306 device_printf(sc->sc_dev, "can not if_alloc()\n");
307 error = ENOSPC;
308 goto bad;

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

600 * Check for misc other capabilities.
601 */
602 if (ath_hal_hasbursting(ah))
603 ic->ic_caps |= IEEE80211_C_BURST;
604 sc->sc_hasbmask = ath_hal_hasbssidmask(ah);
605 sc->sc_hastsfadd = ath_hal_hastsfadjust(ah);
606 if (ath_hal_hasfastframes(ah))
607 ic->ic_caps |= IEEE80211_C_FF;
302
303 DPRINTF(sc, ATH_DEBUG_ANY, "%s: devid 0x%x\n", __func__, devid);
304
305 ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
306 if (ifp == NULL) {
307 device_printf(sc->sc_dev, "can not if_alloc()\n");
308 error = ENOSPC;
309 goto bad;

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

601 * Check for misc other capabilities.
602 */
603 if (ath_hal_hasbursting(ah))
604 ic->ic_caps |= IEEE80211_C_BURST;
605 sc->sc_hasbmask = ath_hal_hasbssidmask(ah);
606 sc->sc_hastsfadd = ath_hal_hastsfadjust(ah);
607 if (ath_hal_hasfastframes(ah))
608 ic->ic_caps |= IEEE80211_C_FF;
608 if (ath_hal_getwirelessmodes(ah, ic->ic_regdomain.country) & (HAL_MODE_108G|HAL_MODE_TURBO))
609 wmodes = ath_hal_getwirelessmodes(ah, ic->ic_regdomain.country);
610 if (wmodes & (HAL_MODE_108G|HAL_MODE_TURBO))
609 ic->ic_caps |= IEEE80211_C_TURBOP;
610
611 /*
612 * Indicate we need the 802.11 header padded to a
613 * 32-bit boundary for 4-address and QoS frames.
614 */
615 ic->ic_flags |= IEEE80211_F_DATAPAD;
616

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

2545}
2546
2547/*
2548 * Calculate the receive filter according to the
2549 * operating mode and state:
2550 *
2551 * o always accept unicast, broadcast, and multicast traffic
2552 * o accept PHY error frames when hardware doesn't have MIB support
611 ic->ic_caps |= IEEE80211_C_TURBOP;
612
613 /*
614 * Indicate we need the 802.11 header padded to a
615 * 32-bit boundary for 4-address and QoS frames.
616 */
617 ic->ic_flags |= IEEE80211_F_DATAPAD;
618

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

2547}
2548
2549/*
2550 * Calculate the receive filter according to the
2551 * operating mode and state:
2552 *
2553 * o always accept unicast, broadcast, and multicast traffic
2554 * o accept PHY error frames when hardware doesn't have MIB support
2553 * to count and we need them for ANI (sta mode only at the moment)
2555 * to count and we need them for ANI (sta mode only until recently)
2554 * and we are not scanning (ANI is disabled)
2556 * and we are not scanning (ANI is disabled)
2555 * NB: only with recent hal's; older hal's add rx filter bits out
2556 * of sight and we need to blindly preserve them
2557 * NB: older hal's add rx filter bits out of sight and we need to
2558 * blindly preserve them
2557 * o probe request frames are accepted only when operating in
2558 * hostap, adhoc, or monitor modes
2559 * o enable promiscuous mode
2560 * - when in monitor mode
2561 * - if interface marked PROMISC (assumes bridge setting is filtered)
2562 * o accept beacons:
2563 * - when operating in station mode for collecting rssi data when
2564 * the station is otherwise quiet, or

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

2575 */
2576static u_int32_t
2577ath_calcrxfilter(struct ath_softc *sc)
2578{
2579 struct ifnet *ifp = sc->sc_ifp;
2580 struct ieee80211com *ic = ifp->if_l2com;
2581 u_int32_t rfilt;
2582
2559 * o probe request frames are accepted only when operating in
2560 * hostap, adhoc, or monitor modes
2561 * o enable promiscuous mode
2562 * - when in monitor mode
2563 * - if interface marked PROMISC (assumes bridge setting is filtered)
2564 * o accept beacons:
2565 * - when operating in station mode for collecting rssi data when
2566 * the station is otherwise quiet, or

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

2577 */
2578static u_int32_t
2579ath_calcrxfilter(struct ath_softc *sc)
2580{
2581 struct ifnet *ifp = sc->sc_ifp;
2582 struct ieee80211com *ic = ifp->if_l2com;
2583 u_int32_t rfilt;
2584
2583#if HAL_ABI_VERSION < 0x08011600
2584 rfilt = (ath_hal_getrxfilter(sc->sc_ah) &
2585 (HAL_RX_FILTER_PHYRADAR | HAL_RX_FILTER_PHYERR))
2586 | HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | HAL_RX_FILTER_MCAST;
2587#else
2588 rfilt = HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | HAL_RX_FILTER_MCAST;
2585 rfilt = HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | HAL_RX_FILTER_MCAST;
2586#if HAL_ABI_VERSION < 0x08011600
2587 rfilt |= (ath_hal_getrxfilter(sc->sc_ah) &
2588 (HAL_RX_FILTER_PHYRADAR | HAL_RX_FILTER_PHYERR));
2589#elif HAL_ABI_VERSION < 0x08060100
2589 if (ic->ic_opmode == IEEE80211_M_STA &&
2590 !sc->sc_needmib && !sc->sc_scanning)
2591 rfilt |= HAL_RX_FILTER_PHYERR;
2590 if (ic->ic_opmode == IEEE80211_M_STA &&
2591 !sc->sc_needmib && !sc->sc_scanning)
2592 rfilt |= HAL_RX_FILTER_PHYERR;
2593#else
2594 if (!sc->sc_needmib && !sc->sc_scanning)
2595 rfilt |= HAL_RX_FILTER_PHYERR;
2592#endif
2593 if (ic->ic_opmode != IEEE80211_M_STA)
2594 rfilt |= HAL_RX_FILTER_PROBEREQ;
2595 if (ic->ic_opmode == IEEE80211_M_MONITOR || (ifp->if_flags & IFF_PROMISC))
2596 rfilt |= HAL_RX_FILTER_PROM;
2597 if (ic->ic_opmode == IEEE80211_M_STA ||
2598 ic->ic_opmode == IEEE80211_M_IBSS ||
2599 sc->sc_swbmiss || sc->sc_scanning)

--- 4502 unchanged lines hidden ---
2596#endif
2597 if (ic->ic_opmode != IEEE80211_M_STA)
2598 rfilt |= HAL_RX_FILTER_PROBEREQ;
2599 if (ic->ic_opmode == IEEE80211_M_MONITOR || (ifp->if_flags & IFF_PROMISC))
2600 rfilt |= HAL_RX_FILTER_PROM;
2601 if (ic->ic_opmode == IEEE80211_M_STA ||
2602 ic->ic_opmode == IEEE80211_M_IBSS ||
2603 sc->sc_swbmiss || sc->sc_scanning)

--- 4502 unchanged lines hidden ---