Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 May 2015 20:06:50 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r283541 - head/sys/net80211
Message-ID:  <201505252006.t4PK6o1H033582@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Mon May 25 20:06:49 2015
New Revision: 283541
URL: https://svnweb.freebsd.org/changeset/base/283541

Log:
  Cleanup compat shims for FreeBSD versions that predate 10.0-RELEASE.
  There are no plans to merge anything save a trivial bugfix to stable/9.
  
  Discussed with:	adrian

Modified:
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_freebsd.c
  head/sys/net80211/ieee80211_freebsd.h
  head/sys/net80211/ieee80211_hostap.c
  head/sys/net80211/ieee80211_input.c
  head/sys/net80211/ieee80211_output.c
  head/sys/net80211/ieee80211_proto.h
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/net80211/ieee80211.c
==============================================================================
--- head/sys/net80211/ieee80211.c	Mon May 25 19:53:29 2015	(r283540)
+++ head/sys/net80211/ieee80211.c	Mon May 25 20:06:49 2015	(r283541)
@@ -245,15 +245,9 @@ null_transmit(struct ifnet *ifp, struct 
 	return EACCES;		/* XXX EIO/EPERM? */
 }
 
-#if __FreeBSD_version >= 1000031
 static int
 null_output(struct ifnet *ifp, struct mbuf *m,
 	const struct sockaddr *dst, struct route *ro)
-#else
-static int
-null_output(struct ifnet *ifp, struct mbuf *m,
-	struct sockaddr *dst, struct route *ro)
-#endif
 {
 	if_printf(ifp, "discard raw packet\n");
 	return null_transmit(ifp, m);

Modified: head/sys/net80211/ieee80211_freebsd.c
==============================================================================
--- head/sys/net80211/ieee80211_freebsd.c	Mon May 25 19:53:29 2015	(r283540)
+++ head/sys/net80211/ieee80211_freebsd.c	Mon May 25 20:06:49 2015	(r283541)
@@ -66,10 +66,8 @@ SYSCTL_INT(_net_wlan, OID_AUTO, debug, C
 
 static MALLOC_DEFINE(M_80211_COM, "80211com", "802.11 com state");
 
-#if __FreeBSD_version >= 1000020
 static const char wlanname[] = "wlan";
 static struct if_clone *wlan_cloner;
-#endif
 
 /*
  * Allocate/free com structure in conjunction with ifnet;
@@ -136,18 +134,10 @@ wlan_clone_create(struct if_clone *ifc, 
 		if_printf(ifp, "TDMA not supported\n");
 		return EOPNOTSUPP;
 	}
-#if __FreeBSD_version >= 1000020
 	vap = ic->ic_vap_create(ic, wlanname, unit,
 			cp.icp_opmode, cp.icp_flags, cp.icp_bssid,
 			cp.icp_flags & IEEE80211_CLONE_MACADDR ?
 			    cp.icp_macaddr : (const uint8_t *)IF_LLADDR(ifp));
-#else
-	vap = ic->ic_vap_create(ic, ifc->ifc_name, unit,
-			cp.icp_opmode, cp.icp_flags, cp.icp_bssid,
-			cp.icp_flags & IEEE80211_CLONE_MACADDR ?
-			    cp.icp_macaddr : (const uint8_t *)IF_LLADDR(ifp));
-
-#endif
 
 	return (vap == NULL ? EIO : 0);
 }
@@ -161,19 +151,11 @@ wlan_clone_destroy(struct ifnet *ifp)
 	ic->ic_vap_delete(vap);
 }
 
-#if __FreeBSD_version < 1000020
-IFC_SIMPLE_DECLARE(wlan, 0);
-#endif
-
 void
 ieee80211_vap_destroy(struct ieee80211vap *vap)
 {
 	CURVNET_SET(vap->iv_ifp->if_vnet);
-#if __FreeBSD_version >= 1000020
 	if_clone_destroyif(wlan_cloner, vap->iv_ifp);
-#else
-	if_clone_destroyif(&wlan_cloner, vap->iv_ifp);
-#endif
 	CURVNET_RESTORE();
 }
 
@@ -891,21 +873,13 @@ wlan_modevent(module_t mod, int type, vo
 		    bpf_track, 0, EVENTHANDLER_PRI_ANY);
 		wlan_ifllevent = EVENTHANDLER_REGISTER(iflladdr_event,
 		    wlan_iflladdr, NULL, EVENTHANDLER_PRI_ANY);
-#if __FreeBSD_version >= 1000020
 		wlan_cloner = if_clone_simple(wlanname, wlan_clone_create,
 		    wlan_clone_destroy, 0);
-#else
-		if_clone_attach(&wlan_cloner);
-#endif
 		if_register_com_alloc(IFT_IEEE80211, wlan_alloc, wlan_free);
 		return 0;
 	case MOD_UNLOAD:
 		if_deregister_com_alloc(IFT_IEEE80211);
-#if __FreeBSD_version >= 1000020
 		if_clone_detach(wlan_cloner);
-#else
-		if_clone_detach(&wlan_cloner);
-#endif
 		EVENTHANDLER_DEREGISTER(bpf_track, wlan_bpfevent);
 		EVENTHANDLER_DEREGISTER(iflladdr_event, wlan_ifllevent);
 		return 0;
@@ -914,11 +888,7 @@ wlan_modevent(module_t mod, int type, vo
 }
 
 static moduledata_t wlan_mod = {
-#if __FreeBSD_version >= 1000020
 	wlanname,
-#else
-	"wlan",
-#endif
 	wlan_modevent,
 	0
 };

Modified: head/sys/net80211/ieee80211_freebsd.h
==============================================================================
--- head/sys/net80211/ieee80211_freebsd.h	Mon May 25 19:53:29 2015	(r283540)
+++ head/sys/net80211/ieee80211_freebsd.h	Mon May 25 20:06:49 2015	(r283541)
@@ -234,21 +234,9 @@ struct mbuf *ieee80211_getmgtframe(uint8
 #define	M_FF		M_PROTO6		/* fast frame */
 #define	M_TXCB		M_PROTO7		/* do tx complete callback */
 #define	M_AMPDU_MPDU	M_PROTO8		/* ok for A-MPDU aggregation */
-
-/*
- * FreeBSD-HEAD from 1000046 retired M_*FRAG* flags and turned them
- * into header flags instead.  So, we use the new protocol-specific
- * flags.
- *
- * Earlier FreeBSD versions overload M_FRAG, M_FIRSTFRAG and M_LASTFRAG.
- *
- * XXX TODO: rename these fields so there are no namespace clashes!
- */
-#if __FreeBSD_version >= 1000046
 #define	M_FRAG		M_PROTO9		/* frame fragmentation */
 #define	M_FIRSTFRAG	M_PROTO10		/* first frame fragment */
 #define	M_LASTFRAG	M_PROTO11		/* last frame fragment */
-#endif
 
 #define	M_80211_TX \
 	(M_ENCAP|M_EAPOL|M_PWR_SAV|M_MORE_DATA|M_FF|M_TXCB| \
@@ -262,18 +250,10 @@ struct mbuf *ieee80211_getmgtframe(uint8
 #endif
 #define	M_80211_RX	(M_AMPDU|M_WEP|M_AMPDU_MPDU)
 
-#if __FreeBSD_version >= 1000046
 #define	IEEE80211_MBUF_TX_FLAG_BITS \
 	M_FLAG_BITS \
 	"\15M_ENCAP\17M_EAPOL\20M_PWR_SAV\21M_MORE_DATA\22M_FF\23M_TXCB" \
 	"\24M_AMPDU_MPDU\25M_FRAG\26M_FIRSTFRAG\27M_LASTFRAG"
-#else
-/* There aren't any flag bits available for versions before this */
-/* XXX TODO: implement M_FLAG_BITS for this! */
-#define	IEEE80211_MBUF_TX_FLAG_BITS \
-	"\15M_ENCAP\17M_EAPOL\20M_PWR_SAV\21M_MORE_DATA\22M_FF\23M_TXCB" \
-	"\24M_AMPDU_MPDU"
-#endif
 
 #define	IEEE80211_MBUF_RX_FLAG_BITS \
 	M_FLAG_BITS \

Modified: head/sys/net80211/ieee80211_hostap.c
==============================================================================
--- head/sys/net80211/ieee80211_hostap.c	Mon May 25 19:53:29 2015	(r283540)
+++ head/sys/net80211/ieee80211_hostap.c	Mon May 25 20:06:49 2015	(r283541)
@@ -357,12 +357,8 @@ hostap_deliver_data(struct ieee80211vap 
 	struct ifnet *ifp = vap->iv_ifp;
 
 	/* clear driver/net80211 flags before passing up */
-#if __FreeBSD_version >= 1000046
 	m->m_flags &= ~(M_MCAST | M_BCAST);
 	m_clrprotoflags(m);
-#else
-	m->m_flags &= ~(M_80211_RX | M_MCAST | M_BCAST);
-#endif
 
 	KASSERT(vap->iv_opmode == IEEE80211_M_HOSTAP,
 	    ("gack, opmode %d", vap->iv_opmode));

Modified: head/sys/net80211/ieee80211_input.c
==============================================================================
--- head/sys/net80211/ieee80211_input.c	Mon May 25 19:53:29 2015	(r283540)
+++ head/sys/net80211/ieee80211_input.c	Mon May 25 20:06:49 2015	(r283541)
@@ -253,9 +253,7 @@ ieee80211_deliver_data(struct ieee80211v
 
 	/* clear driver/net80211 flags before passing up */
 	m->m_flags &= ~(M_MCAST | M_BCAST);
-#if __FreeBSD_version >= 1000046
 	m_clrprotoflags(m);
-#endif
 
 	/* NB: see hostap_deliver_data, this path doesn't handle hostap */
 	KASSERT(vap->iv_opmode != IEEE80211_M_HOSTAP, ("gack, hostap"));

Modified: head/sys/net80211/ieee80211_output.c
==============================================================================
--- head/sys/net80211/ieee80211_output.c	Mon May 25 19:53:29 2015	(r283540)
+++ head/sys/net80211/ieee80211_output.c	Mon May 25 20:06:49 2015	(r283541)
@@ -516,15 +516,9 @@ ieee80211_raw_output(struct ieee80211vap
  * connect bpf write calls to the 802.11 layer for injecting
  * raw 802.11 frames.
  */
-#if __FreeBSD_version >= 1000031
 int
 ieee80211_output(struct ifnet *ifp, struct mbuf *m,
 	const struct sockaddr *dst, struct route *ro)
-#else
-int
-ieee80211_output(struct ifnet *ifp, struct mbuf *m,
-	struct sockaddr *dst, struct route *ro)
-#endif
 {
 #define senderr(e) do { error = (e); goto bad;} while (0)
 	struct ieee80211_node *ni = NULL;

Modified: head/sys/net80211/ieee80211_proto.h
==============================================================================
--- head/sys/net80211/ieee80211_proto.h	Mon May 25 19:53:29 2015	(r283540)
+++ head/sys/net80211/ieee80211_proto.h	Mon May 25 20:06:49 2015	(r283541)
@@ -101,13 +101,8 @@ int	ieee80211_mgmt_output(struct ieee802
 		struct ieee80211_bpf_params *);
 int	ieee80211_raw_xmit(struct ieee80211_node *, struct mbuf *,
 		const struct ieee80211_bpf_params *);
-#if __FreeBSD_version >= 1000031
 int	ieee80211_output(struct ifnet *, struct mbuf *,
                const struct sockaddr *, struct route *ro);
-#else
-int	ieee80211_output(struct ifnet *, struct mbuf *,
-               struct sockaddr *, struct route *ro);
-#endif
 int	ieee80211_vap_pkt_send_dest(struct ieee80211vap *, struct mbuf *,
 		struct ieee80211_node *);
 int	ieee80211_raw_output(struct ieee80211vap *, struct ieee80211_node *,

Modified: head/sys/net80211/ieee80211_var.h
==============================================================================
--- head/sys/net80211/ieee80211_var.h	Mon May 25 19:53:29 2015	(r283540)
+++ head/sys/net80211/ieee80211_var.h	Mon May 25 20:06:49 2015	(r283541)
@@ -502,13 +502,8 @@ struct ieee80211vap {
 	int			(*iv_newstate)(struct ieee80211vap *,
 				    enum ieee80211_state, int);
 	/* 802.3 output method for raw frame xmit */
-#if __FreeBSD_version >= 1000031
 	int			(*iv_output)(struct ifnet *, struct mbuf *,
 				    const struct sockaddr *, struct route *);
-#else
-	int			(*iv_output)(struct ifnet *, struct mbuf *,
-				    struct sockaddr *, struct route *);
-#endif
 	uint64_t		iv_spare[6];
 };
 MALLOC_DECLARE(M_80211_VAP);



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