Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Apr 2012 06:25:12 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r234085 - head/sys/dev/ath
Message-ID:  <201204100625.q3A6PChq007308@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204100625.q3A6PChq007308>