PERFORCE change 42867 for review
Sam Leffler
sam at FreeBSD.org
Thu Nov 20 19:18:18 PST 2003
http://perforce.freebsd.org/chv.cgi?CH=42867
Change 42867 by sam at sam_ebb on 2003/11/20 19:17:41
more diff reduction against netbsd
Affected files ...
.. //depot/projects/netperf/sys/net80211/ieee80211.c#7 edit
.. //depot/projects/netperf/sys/net80211/ieee80211.h#4 edit
.. //depot/projects/netperf/sys/net80211/ieee80211_compat.c#2 edit
.. //depot/projects/netperf/sys/net80211/ieee80211_compat.h#2 edit
.. //depot/projects/netperf/sys/net80211/ieee80211_crypto.c#4 edit
.. //depot/projects/netperf/sys/net80211/ieee80211_crypto.h#2 edit
.. //depot/projects/netperf/sys/net80211/ieee80211_input.c#15 edit
.. //depot/projects/netperf/sys/net80211/ieee80211_ioctl.c#9 edit
.. //depot/projects/netperf/sys/net80211/ieee80211_ioctl.h#5 edit
.. //depot/projects/netperf/sys/net80211/ieee80211_node.c#17 edit
.. //depot/projects/netperf/sys/net80211/ieee80211_node.h#12 edit
.. //depot/projects/netperf/sys/net80211/ieee80211_output.c#12 edit
.. //depot/projects/netperf/sys/net80211/ieee80211_proto.c#9 edit
.. //depot/projects/netperf/sys/net80211/ieee80211_proto.h#5 edit
.. //depot/projects/netperf/sys/net80211/ieee80211_var.h#11 edit
Differences ...
==== //depot/projects/netperf/sys/net80211/ieee80211.c#7 (text+ko) ====
@@ -32,6 +32,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211.c,v 1.8 2003/09/14 22:32:18 sam Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211.c,v 1.7 2003/10/16 22:25:00 matt Exp $");
/*
* IEEE 802.11 generic handler
@@ -96,8 +97,10 @@
int i;
ether_ifattach(ifp, ic->ic_myaddr);
+#if NBPFILTER > 0
bpfattach2(ifp, DLT_IEEE802_11,
sizeof(struct ieee80211_frame_addr4), &ic->ic_rawbpf);
+#endif
ieee80211_crypto_attach(ifp);
/*
@@ -159,8 +162,14 @@
ieee80211_proto_detach(ifp);
ieee80211_crypto_detach(ifp);
ieee80211_node_detach(ifp);
+#ifdef __FreeBSD__
ifmedia_removeall(&ic->ic_media);
+#else
+ ifmedia_delete_instance(&ic->ic_media, IFM_INST_ANY);
+#endif
+#if NBPFILTER > 0
bpfdetach(ifp);
+#endif
ether_ifdetach(ifp);
}
@@ -577,7 +586,8 @@
imr->ifm_active |= IFM_IEEE80211_FH;
break;
case IEEE80211_MODE_TURBO:
- imr->ifm_active |= IFM_IEEE80211_11A | IFM_IEEE80211_TURBO;
+ imr->ifm_active |= IFM_IEEE80211_11A
+ | IFM_IEEE80211_TURBO;
break;
}
}
==== //depot/projects/netperf/sys/net80211/ieee80211.h#4 (text+ko) ====
@@ -1,3 +1,4 @@
+/* $NetBSD: ieee80211.h,v 1.4 2003/10/15 11:43:51 dyoung Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
==== //depot/projects/netperf/sys/net80211/ieee80211_compat.c#2 (text+ko) ====
@@ -1,4 +1,3 @@
-/* $NetBSD: ieee80211_compat.c,v 1.3 2003/09/23 15:57:25 dyoung Exp $ */
/*-
* Copyright (c) 2003, 2004 David Young
* All rights reserved.
==== //depot/projects/netperf/sys/net80211/ieee80211_compat.h#2 (text+ko) ====
@@ -29,6 +29,8 @@
#define _NET80211_IEEE80211_COMPAT_H_
#ifdef __NetBSD__
+#include "bpfilter.h"
+
#undef KASSERT
#define KASSERT(cond, complaint) if (!(cond)) panic complaint
@@ -59,6 +61,8 @@
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
+#define NBPFILTER 1 /* always enabled */
+
/*
* Locking definitions.
*/
@@ -70,7 +74,8 @@
#define IEEE80211_NODE_LOCK_ASSERT(_ic) \
mtx_assert(&(_ic)->ic_nodelock, MA_OWNED)
-#define M_LINK0 M_PROTO1
+#define M_LINK0 M_PROTO1
+#define ALTQ_DECL(_x)
/*
* Node reference counting definitions.
==== //depot/projects/netperf/sys/net80211/ieee80211_crypto.c#4 (text+ko) ====
@@ -32,6 +32,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_crypto.c,v 1.3 2003/10/17 23:15:30 sam Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto.c,v 1.4 2003/09/23 16:03:46 dyoung Exp $");
#include "opt_inet.h"
@@ -92,7 +93,7 @@
struct ieee80211com *ic = (void *)ifp;
if (ic->ic_wep_ctx != NULL) {
- free(ic->ic_wep_ctx, M_DEVBUF);
+ FREE(ic->ic_wep_ctx, M_DEVBUF);
ic->ic_wep_ctx = NULL;
}
}
@@ -112,7 +113,7 @@
n0 = NULL;
if ((ctx = ic->ic_wep_ctx) == NULL) {
- ctx = malloc(arc4_ctxlen(), M_DEVBUF, M_NOWAIT);
+ MALLOC(ctx, void *, arc4_ctxlen(), M_DEVBUF, M_NOWAIT);
if (ctx == NULL) {
ic->ic_stats.is_crypto_nomem++;
goto fail;
@@ -130,7 +131,11 @@
ic->ic_stats.is_rx_nombuf++;
goto fail;
}
+#ifdef __FreeBSD__
M_MOVE_PKTHDR(n, m);
+#else
+ M_COPY_PKTHDR(n, m);
+#endif
len = IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN;
if (txflag) {
n->m_pkthdr.len += len;
==== //depot/projects/netperf/sys/net80211/ieee80211_crypto.h#2 (text+ko) ====
@@ -1,3 +1,4 @@
+/* $NetBSD: ieee80211_crypto.h,v 1.2 2003/09/14 01:14:55 dyoung Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
==== //depot/projects/netperf/sys/net80211/ieee80211_input.c#15 (text+ko) ====
@@ -32,6 +32,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.12 2003/10/17 23:59:11 sam Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.14 2003/10/27 17:11:19 mycroft Exp $");
#include "opt_inet.h"
@@ -59,7 +60,9 @@
#include <net80211/ieee80211_var.h>
+#if NBPFILTER > 0
#include <net/bpf.h>
+#endif
#ifdef INET
#include <netinet/in.h>
@@ -93,6 +96,7 @@
u_int8_t dir, type, subtype;
u_int8_t *bssid;
u_int16_t rxseq;
+ ALTQ_DECL(struct altq_pktattr pktattr;)
KASSERT(ni != NULL, ("null node"));
@@ -292,9 +296,11 @@
goto out;
}
}
+#if NBPFILTER > 0
/* copy to listener after decrypt */
if (ic->ic_rawbpf)
bpf_mtap(ic->ic_rawbpf, m);
+#endif
m = ieee80211_reass(ic, ni, m);
if (m == NULL)
goto out;
@@ -339,12 +345,14 @@
}
}
if (m != NULL) {
+#if NBPFILTER > 0
/*
* If we forward packet into transmitter of the AP,
* we don't need to duplicate for DLT_EN10MB.
*/
if (ifp->if_bpf && m1 == NULL)
bpf_mtap(ifp->if_bpf, m);
+#endif
(*ifp->if_input)(ifp, m);
}
return;
@@ -401,8 +409,10 @@
>> IEEE80211_FC0_SUBTYPE_SHIFT],
ether_sprintf(wh->i_addr2), rssi);
}
+#if NBPFILTER > 0
if (ic->ic_rawbpf)
bpf_mtap(ic->ic_rawbpf, m);
+#endif
m = ieee80211_reass(ic, ni, m);
if (m == NULL)
goto out;
@@ -433,8 +443,10 @@
ifp->if_ierrors++;
out:
if (m != NULL) {
+#if NBPFILTER > 0
if (ic->ic_rawbpf)
bpf_mtap(ic->ic_rawbpf, m);
+#endif
m_freem(m);
}
}
@@ -811,7 +823,7 @@
} else
allocbs = 0;
if (ni->ni_challenge == NULL)
- ni->ni_challenge = (u_int32_t*)malloc(
+ MALLOC(ni->ni_challenge, u_int32_t *,
IEEE80211_CHALLENGE_LEN, M_DEVBUF,
M_NOWAIT);
if (ni->ni_challenge == NULL) {
@@ -860,7 +872,7 @@
switch (seq) {
case IEEE80211_AUTH_SHARED_PASS:
if (ni->ni_challenge != NULL) {
- free(ni->ni_challenge, M_DEVBUF);
+ FREE(ni->ni_challenge, M_DEVBUF);
ni->ni_challenge = NULL;
}
if (status != 0) {
@@ -878,7 +890,7 @@
break;
case IEEE80211_AUTH_SHARED_CHALLENGE:
if (ni->ni_challenge == NULL)
- ni->ni_challenge = (u_int32_t*)malloc(
+ MALLOC(ni->ni_challenge, u_int32_t *,
challenge[1], M_DEVBUF, M_NOWAIT);
if (ni->ni_challenge == NULL) {
IEEE80211_DPRINTF((
@@ -1275,7 +1287,7 @@
}
/* discard challenge after association */
if (ni->ni_challenge != NULL) {
- free(ni->ni_challenge, M_DEVBUF);
+ FREE(ni->ni_challenge, M_DEVBUF);
ni->ni_challenge = NULL;
}
/* XXX per-node cipher suite */
==== //depot/projects/netperf/sys/net80211/ieee80211_ioctl.c#9 (text+ko) ====
@@ -32,6 +32,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.9 2003/11/13 05:23:58 sam Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.5 2003/10/13 20:05:09 dyoung Exp $");
/*
* IEEE 802.11 ioctl support (FreeBSD-specific)
==== //depot/projects/netperf/sys/net80211/ieee80211_ioctl.h#5 (text+ko) ====
@@ -1,3 +1,4 @@
+/* $NetBSD: ieee80211_ioctl.h,v 1.5 2003/10/13 04:16:59 dyoung Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
==== //depot/projects/netperf/sys/net80211/ieee80211_node.c#17 (text+ko) ====
@@ -32,6 +32,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.13 2003/11/09 23:36:46 sam Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.8 2003/11/02 01:29:05 dyoung Exp $");
#include "opt_inet.h"
@@ -410,18 +411,20 @@
static struct ieee80211_node *
ieee80211_node_alloc(struct ieee80211com *ic)
{
- return malloc(sizeof(struct ieee80211_node), M_80211_NODE,
- M_NOWAIT | M_ZERO);
+ struct ieee80211_node *ni;
+ MALLOC(ni, struct ieee80211_node *, sizeof(struct ieee80211_node),
+ M_80211_NODE, M_NOWAIT | M_ZERO);
+ return ni;
}
static void
ieee80211_node_free(struct ieee80211com *ic, struct ieee80211_node *ni)
{
if (ni->ni_challenge != NULL) {
- free(ni->ni_challenge, M_DEVBUF);
+ FREE(ni->ni_challenge, M_DEVBUF);
ni->ni_challenge = NULL;
}
- free(ni, M_80211_NODE);
+ FREE(ni, M_80211_NODE);
}
static void
==== //depot/projects/netperf/sys/net80211/ieee80211_node.h#12 (text+ko) ====
@@ -1,3 +1,4 @@
+/* $NetBSD: ieee80211_node.h,v 1.7 2003/10/29 21:50:57 dyoung Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
==== //depot/projects/netperf/sys/net80211/ieee80211_output.c#12 (text+ko) ====
@@ -32,6 +32,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_output.c,v 1.9 2003/10/17 23:15:30 sam Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_output.c,v 1.9 2003/11/02 00:17:27 dyoung Exp $");
#include "opt_inet.h"
@@ -628,13 +629,15 @@
#undef senderr
}
-#if 0
+/*
+ * Save an outbound packet for a node in power-save sleep state.
+ * The new packet is placed on the node's saved queue, and the TIM
+ * is changed, if necessary.
+ */
void
ieee80211_pwrsave(struct ieee80211com *ic, struct ieee80211_node *ni,
struct mbuf *m)
{
- /* Store the new packet on our queue, changing the TIM if necessary */
-
if (_IF_QLEN(&ni->ni_savedq) == 0)
ic->ic_set_tim(ic, ni->ni_associd, 1);
if (ni->ni_savedq.ifq_len >= IEEE80211_PS_MAX_QUEUE) {
@@ -650,11 +653,11 @@
IEEE80211_PS_MAX_QUEUE,
ni->ni_savedq.ifq_drops);
} else {
- /* Similar to ieee80211_mgmt_output, store the node in
- * the rcvif field.
+ /*
+ * Similar to ieee80211_mgmt_output, store the node in
+ * the rcvif field for use the driver start routine.
*/
IF_ENQUEUE(&ni->ni_savedq, m);
m->m_pkthdr.rcvif = (void *)ni;
}
}
-#endif
==== //depot/projects/netperf/sys/net80211/ieee80211_proto.c#9 (text+ko) ====
@@ -32,6 +32,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_proto.c,v 1.6 2003/10/31 18:32:09 brooks Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_proto.c,v 1.5 2003/10/13 04:23:56 dyoung Exp $");
/*
* IEEE 802.11 protocol support.
@@ -364,7 +365,7 @@
IF_DRAIN(&ic->ic_mgtq);
IF_DRAIN(&ic->ic_pwrsaveq);
if (ic->ic_wep_ctx != NULL) {
- free(ic->ic_wep_ctx, M_DEVBUF);
+ FREE(ic->ic_wep_ctx, M_DEVBUF);
ic->ic_wep_ctx = NULL;
}
ieee80211_free_allnodes(ic);
==== //depot/projects/netperf/sys/net80211/ieee80211_proto.h#5 (text+ko) ====
@@ -1,3 +1,4 @@
+/* $NetBSD: ieee80211_proto.h,v 1.3 2003/10/13 04:23:56 dyoung Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@@ -62,6 +63,8 @@
struct ieee80211_node *, int, int, u_int32_t);
extern int ieee80211_send_mgmt(struct ieee80211com *, struct ieee80211_node *,
int, int);
+extern void ieee80211_pwrsave(struct ieee80211com *, struct ieee80211_node *,
+ struct mbuf *);
extern struct mbuf *ieee80211_encap(struct ifnet *, struct mbuf *,
struct ieee80211_node **);
extern struct mbuf *ieee80211_decap(struct ifnet *, struct mbuf *);
==== //depot/projects/netperf/sys/net80211/ieee80211_var.h#11 (text+ko) ====
@@ -1,3 +1,4 @@
+/* $NetBSD: ieee80211_var.h,v 1.4 2003/10/13 04:27:40 dyoung Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
More information about the p4-projects
mailing list