From owner-svn-src-head@FreeBSD.ORG Tue Apr 10 06:25:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 67ABA106564A; Tue, 10 Apr 2012 06:25:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5290F8FC17; Tue, 10 Apr 2012 06:25:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q3A6PC4T007310; Tue, 10 Apr 2012 06:25:12 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q3A6PChq007308; Tue, 10 Apr 2012 06:25:12 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201204100625.q3A6PChq007308@svn.freebsd.org> From: Adrian Chadd Date: Tue, 10 Apr 2012 06:25:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r234085 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Apr 2012 06:25:12 -0000 Author: adrian Date: Tue Apr 10 06:25:11 2012 New Revision: 234085 URL: http://svn.freebsd.org/changeset/base/234085 Log: * Since the API changed along the -CURRENT path (december 2011), add a FreeBSD_version check. It should work fine for compiling on -HEAD, 9.x and 8.x. * Conditionally compile the 11n options only when 11n is enabled. The above changes allow the ath(4) driver to compile and run on 8.1-RELEASE (Hi old PC-BSD!) but with the 11n stuff disabled. I've done a test against the net80211 and tools in 8.1-RELEASE. The NIC used in testing is the AR2427 in an EEEPC. Just to be clear - this change is to allow the -HEAD ath/hal/rate code to run on 9.x _and_ 8.x with no source changes. However, when running on earlier kernels, it should only be used for legacy mode. (Don't define ATH_ENABLE_11N.) Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Tue Apr 10 05:42:48 2012 (r234084) +++ head/sys/dev/ath/if_ath.c Tue Apr 10 06:25:11 2012 (r234085) @@ -131,10 +131,17 @@ __FBSDID("$FreeBSD$"); */ CTASSERT(ATH_BCBUF <= 8); +#if __FreeBSD_version > 1000003 static struct ieee80211vap *ath_vap_create(struct ieee80211com *, const char [IFNAMSIZ], int, enum ieee80211_opmode, int, const uint8_t [IEEE80211_ADDR_LEN], const uint8_t [IEEE80211_ADDR_LEN]); +#else +static struct ieee80211vap *ath_vap_create(struct ieee80211com *, + const char [IFNAMSIZ], int, int, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); +#endif static void ath_vap_delete(struct ieee80211vap *); static void ath_init(void *); static void ath_stop_locked(struct ifnet *); @@ -200,7 +207,9 @@ static void ath_chan_change(struct ath_s static void ath_scan_start(struct ieee80211com *); static void ath_scan_end(struct ieee80211com *); static void ath_set_channel(struct ieee80211com *); +#ifdef ATH_ENABLE_11N static void ath_update_chw(struct ieee80211com *); +#endif /* ATH_ENABLE_11N */ static void ath_calibrate(void *); static int ath_newstate(struct ieee80211vap *, enum ieee80211_state, int); static void ath_setup_stationkey(struct ieee80211_node *); @@ -804,8 +813,7 @@ ath_attach(u_int16_t devid, struct ath_s ic->ic_scan_start = ath_scan_start; ic->ic_scan_end = ath_scan_end; ic->ic_set_channel = ath_set_channel; - ic->ic_update_chw = ath_update_chw; - +#ifdef ATH_ENABLE_11N /* 802.11n specific - but just override anyway */ sc->sc_addba_request = ic->ic_addba_request; sc->sc_addba_response = ic->ic_addba_response; @@ -819,6 +827,9 @@ ath_attach(u_int16_t devid, struct ath_s ic->ic_addba_stop = ath_addba_stop; ic->ic_bar_response = ath_bar_response; + ic->ic_update_chw = ath_update_chw; +#endif /* ATH_ENABLE_11N */ + ieee80211_radiotap_attach(ic, &sc->sc_tx_th.wt_ihdr, sizeof(sc->sc_tx_th), ATH_TX_RADIOTAP_PRESENT, @@ -955,11 +966,18 @@ assign_bslot(struct ath_softc *sc) return free; } +#if __FreeBSD_version > 1000003 static struct ieee80211vap * ath_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, enum ieee80211_opmode opmode, int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t mac0[IEEE80211_ADDR_LEN]) +#else +static struct ieee80211vap * +ath_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + int opmode, int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac0[IEEE80211_ADDR_LEN]) +#endif { struct ath_softc *sc = ic->ic_ifp->if_softc; struct ath_vap *avp; @@ -5766,6 +5784,7 @@ ath_scan_end(struct ieee80211com *ic) sc->sc_curaid); } +#ifdef ATH_ENABLE_11N /* * For now, just do a channel change. * @@ -5790,6 +5809,7 @@ ath_update_chw(struct ieee80211com *ic) DPRINTF(sc, ATH_DEBUG_STATE, "%s: called\n", __func__); ath_set_channel(ic); } +#endif /* ATH_ENABLE_11N */ static void ath_set_channel(struct ieee80211com *ic)