diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2008-08-27 09:05:05 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2008-08-27 09:05:05 +0000 |
commit | ae8d786435a0cd5b546644a9f5e3592c26c022e5 (patch) | |
tree | 3e8cc621792a9e7e11267f6eb127006e3f4e5810 /sys/dev/ic/rt2560.c | |
parent | 667d3188711dacb1f8a406d01c9c42412ed0c710 (diff) |
introduce new IEEE80211_STA_ONLY kernel option that can be set to
remove IBSS and HostAP support from net80211 and 802.11 drivers.
it can be used to shrink RAMDISK kernels for instance (like what
was done for wi(4)).
it also has the benefit of highlighting what is specific to IBSS
and HostAP modes in the code.
the cost is that we now have two code paths to maintain.
Diffstat (limited to 'sys/dev/ic/rt2560.c')
-rw-r--r-- | sys/dev/ic/rt2560.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/sys/dev/ic/rt2560.c b/sys/dev/ic/rt2560.c index 0879d492e97..e8f9cafdf05 100644 --- a/sys/dev/ic/rt2560.c +++ b/sys/dev/ic/rt2560.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2560.c,v 1.38 2008/08/14 16:02:24 damien Exp $ */ +/* $OpenBSD: rt2560.c,v 1.39 2008/08/27 09:05:03 damien Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -102,7 +102,9 @@ void rt2560_tx_intr(struct rt2560_softc *); void rt2560_prio_intr(struct rt2560_softc *); void rt2560_decryption_intr(struct rt2560_softc *); void rt2560_rx_intr(struct rt2560_softc *); +#ifndef IEEE80211_STA_ONLY void rt2560_beacon_expire(struct rt2560_softc *); +#endif void rt2560_wakeup_expire(struct rt2560_softc *); #if NBPFILTER > 0 uint8_t rt2560_rxrate(const struct rt2560_rx_desc *); @@ -113,8 +115,10 @@ uint8_t rt2560_plcp_signal(int); void rt2560_setup_tx_desc(struct rt2560_softc *, struct rt2560_tx_desc *, uint32_t, int, int, int, bus_addr_t); +#ifndef IEEE80211_STA_ONLY int rt2560_tx_bcn(struct rt2560_softc *, struct mbuf *, struct ieee80211_node *); +#endif int rt2560_tx_mgt(struct rt2560_softc *, struct mbuf *, struct ieee80211_node *); int rt2560_tx_data(struct rt2560_softc *, struct mbuf *, @@ -236,9 +240,11 @@ rt2560_attach(void *xsc, int id) /* set device capabilities */ ic->ic_caps = - IEEE80211_C_IBSS | /* IBSS mode supported */ IEEE80211_C_MONITOR | /* monitor mode supported */ +#ifndef IEEE80211_STA_ONLY + IEEE80211_C_IBSS | /* IBSS mode supported */ IEEE80211_C_HOSTAP | /* HostAp mode supported */ +#endif IEEE80211_C_TXPMGT | /* tx power management */ IEEE80211_C_SHPREAMBLE | /* short preamble supported */ IEEE80211_C_SHSLOT | /* short slot time supported */ @@ -703,8 +709,10 @@ rt2560_amrr_timeout(void *arg) s = splnet(); if (ic->ic_opmode == IEEE80211_M_STA) rt2560_iter_func(sc, ic->ic_bss); +#ifndef IEEE80211_STA_ONLY else ieee80211_iterate_nodes(ic, rt2560_iter_func, sc); +#endif splx(s); timeout_add(&sc->amrr_to, hz / 2); @@ -731,7 +739,6 @@ rt2560_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) struct rt2560_softc *sc = ic->ic_if.if_softc; enum ieee80211_state ostate; struct ieee80211_node *ni; - struct mbuf *m; int error = 0; ostate = ic->ic_state; @@ -774,9 +781,10 @@ rt2560_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) rt2560_set_bssid(sc, ni->ni_bssid); } +#ifndef IEEE80211_STA_ONLY if (ic->ic_opmode == IEEE80211_M_HOSTAP || ic->ic_opmode == IEEE80211_M_IBSS) { - m = ieee80211_beacon_alloc(ic, ni); + struct mbuf *m = ieee80211_beacon_alloc(ic, ni); if (m == NULL) { printf("%s: could not allocate beacon\n", sc->sc_dev.dv_xname); @@ -788,6 +796,7 @@ rt2560_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) if (error != 0) break; } +#endif /* turn assocation led on */ rt2560_update_led(sc, 1, 0); @@ -1268,6 +1277,7 @@ rt2560_rx_intr(struct rt2560_softc *sc) RAL_WRITE(sc, RT2560_SECCSR0, RT2560_KICK_DECRYPT); } +#ifndef IEEE80211_STA_ONLY /* * This function is called in HostAP or IBSS modes when it's time to send a * new beacon (every ni_intval milliseconds). @@ -1306,6 +1316,7 @@ rt2560_beacon_expire(struct rt2560_softc *sc) DPRINTFN(15, ("beacon expired\n")); } +#endif void rt2560_wakeup_expire(struct rt2560_softc *sc) @@ -1333,8 +1344,10 @@ rt2560_intr(void *arg) if (!(ifp->if_flags & IFF_RUNNING)) return 0; +#ifndef IEEE80211_STA_ONLY if (r & RT2560_BEACON_EXPIRE) rt2560_beacon_expire(sc); +#endif if (r & RT2560_WAKEUP_EXPIRE) rt2560_wakeup_expire(sc); @@ -1532,6 +1545,7 @@ rt2560_setup_tx_desc(struct rt2560_softc *sc, struct rt2560_tx_desc *desc, } } +#ifndef IEEE80211_STA_ONLY int rt2560_tx_bcn(struct rt2560_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) @@ -1587,6 +1601,7 @@ rt2560_tx_bcn(struct rt2560_softc *sc, struct mbuf *m0, return 0; } +#endif int rt2560_tx_mgt(struct rt2560_softc *sc, struct mbuf *m0, @@ -1645,11 +1660,13 @@ rt2560_tx_mgt(struct rt2560_softc *sc, struct mbuf *m0, RAL_SIFS; *(uint16_t *)wh->i_dur = htole16(dur); +#ifndef IEEE80211_STA_ONLY /* tell hardware to set timestamp for probe responses */ if ((wh->i_fc[0] & (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) == (IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP)) flags |= RT2560_TX_TIMESTAMP; +#endif } rt2560_setup_tx_desc(sc, desc, flags, m0->m_pkthdr.len, rate, 0, @@ -2268,9 +2285,11 @@ rt2560_enable_tsf_sync(struct rt2560_softc *sc) tmp = RT2560_ENABLE_TSF | RT2560_ENABLE_TBCN; if (ic->ic_opmode == IEEE80211_M_STA) tmp |= RT2560_ENABLE_TSF_SYNC(1); +#ifndef IEEE80211_STA_ONLY else tmp |= RT2560_ENABLE_TSF_SYNC(2) | RT2560_ENABLE_BEACON_GENERATOR; +#endif RAL_WRITE(sc, RT2560_CSR14, tmp); DPRINTF(("enabling TSF synchronization\n")); @@ -2305,6 +2324,7 @@ rt2560_updateslot(struct ieee80211com *ic) { struct rt2560_softc *sc = ic->ic_if.if_softc; +#ifndef IEEE80211_STA_ONLY if (ic->ic_opmode == IEEE80211_M_HOSTAP) { /* * In HostAP mode, we defer setting of new slot time until @@ -2313,6 +2333,7 @@ rt2560_updateslot(struct ieee80211com *ic) */ sc->sc_flags |= RT2560_UPDATE_SLOT; } else +#endif rt2560_set_slottime(sc); } @@ -2634,7 +2655,9 @@ rt2560_init(struct ifnet *ifp) tmp = RT2560_DROP_PHY_ERROR | RT2560_DROP_CRC_ERROR; if (ic->ic_opmode != IEEE80211_M_MONITOR) { tmp |= RT2560_DROP_CTL | RT2560_DROP_VERSION_ERROR; +#ifndef IEEE80211_STA_ONLY if (ic->ic_opmode != IEEE80211_M_HOSTAP) +#endif tmp |= RT2560_DROP_TODS; if (!(ifp->if_flags & IFF_PROMISC)) tmp |= RT2560_DROP_NOT_TO_ME; |