Page MenuHomeFreeBSD

D17308.id.diff
No OneTemporary

D17308.id.diff

Index: head/sys/net80211/ieee80211_freebsd.h
===================================================================
--- head/sys/net80211/ieee80211_freebsd.h
+++ head/sys/net80211/ieee80211_freebsd.h
@@ -40,6 +40,10 @@
#include <sys/taskqueue.h>
#include <sys/time.h>
+#ifdef DEBUGNET
+#include <net/debugnet.h>
+#endif
+
/*
* Common state locking definitions.
*/
@@ -492,6 +496,36 @@
struct ieee80211req *);
SET_DECLARE(ieee80211_ioctl_setset, ieee80211_ioctl_setfunc);
#define IEEE80211_IOCTL_SET(_name, _set) TEXT_SET(ieee80211_ioctl_setset, _set)
+
+#ifdef DEBUGNET
+typedef void debugnet80211_init_t(struct ieee80211com *, int *nrxr, int *ncl,
+ int *clsize);
+typedef void debugnet80211_event_t(struct ieee80211com *, enum debugnet_ev);
+typedef int debugnet80211_poll_t(struct ieee80211com *, int);
+
+struct debugnet80211_methods {
+ debugnet80211_init_t *dn8_init;
+ debugnet80211_event_t *dn8_event;
+ debugnet80211_poll_t *dn8_poll;
+};
+
+#define DEBUGNET80211_DEFINE(driver) \
+ static debugnet80211_init_t driver##_debugnet80211_init; \
+ static debugnet80211_event_t driver##_debugnet80211_event; \
+ static debugnet80211_poll_t driver##_debugnet80211_poll; \
+ \
+ static struct debugnet80211_methods driver##_debugnet80211_methods = { \
+ .dn8_init = driver##_debugnet80211_init, \
+ .dn8_event = driver##_debugnet80211_event, \
+ .dn8_poll = driver##_debugnet80211_poll, \
+ }
+#define DEBUGNET80211_SET(ic, driver) \
+ (ic)->ic_debugnet_meth = &driver##_debugnet80211_methods
+#else
+#define DEBUGNET80211_DEFINE(driver)
+#define DEBUGNET80211_SET(ic, driver)
+#endif /* DEBUGNET */
+
#endif /* _KERNEL */
/* XXX this stuff belongs elsewhere */
Index: head/sys/net80211/ieee80211_freebsd.c
===================================================================
--- head/sys/net80211/ieee80211_freebsd.c
+++ head/sys/net80211/ieee80211_freebsd.c
@@ -60,6 +60,7 @@
#include <net80211/ieee80211_var.h>
#include <net80211/ieee80211_input.h>
+DEBUGNET_DEFINE(ieee80211);
SYSCTL_NODE(_net, OID_AUTO, wlan, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
"IEEE 80211 parameters");
@@ -111,7 +112,14 @@
cp.icp_flags & IEEE80211_CLONE_MACADDR ?
cp.icp_macaddr : ic->ic_macaddr);
- return (vap == NULL ? EIO : 0);
+ if (vap == NULL)
+ return (EIO);
+
+#ifdef DEBUGNET
+ if (ic->ic_debugnet_meth != NULL)
+ DEBUGNET_SET(vap->iv_ifp, ieee80211);
+#endif
+ return (0);
}
static void
@@ -1046,6 +1054,54 @@
return "(none)";
return vap->iv_ifp->if_xname;
}
+
+#ifdef DEBUGNET
+static void
+ieee80211_debugnet_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize)
+{
+ struct ieee80211vap *vap;
+ struct ieee80211com *ic;
+
+ vap = if_getsoftc(ifp);
+ ic = vap->iv_ic;
+
+ IEEE80211_LOCK(ic);
+ ic->ic_debugnet_meth->dn8_init(ic, nrxr, ncl, clsize);
+ IEEE80211_UNLOCK(ic);
+}
+
+static void
+ieee80211_debugnet_event(struct ifnet *ifp, enum debugnet_ev ev)
+{
+ struct ieee80211vap *vap;
+ struct ieee80211com *ic;
+
+ vap = if_getsoftc(ifp);
+ ic = vap->iv_ic;
+
+ IEEE80211_LOCK(ic);
+ ic->ic_debugnet_meth->dn8_event(ic, ev);
+ IEEE80211_UNLOCK(ic);
+}
+
+static int
+ieee80211_debugnet_transmit(struct ifnet *ifp, struct mbuf *m)
+{
+ return (ieee80211_vap_transmit(ifp, m));
+}
+
+static int
+ieee80211_debugnet_poll(struct ifnet *ifp, int count)
+{
+ struct ieee80211vap *vap;
+ struct ieee80211com *ic;
+
+ vap = if_getsoftc(ifp);
+ ic = vap->iv_ic;
+
+ return (ic->ic_debugnet_meth->dn8_poll(ic, count));
+}
+#endif
/*
* Module glue.
Index: head/sys/net80211/ieee80211_var.h
===================================================================
--- head/sys/net80211/ieee80211_var.h
+++ head/sys/net80211/ieee80211_var.h
@@ -132,6 +132,8 @@
struct ieee80211_superg;
struct ieee80211_frame;
+struct net80211dump_methods;
+
struct ieee80211com {
void *ic_softc; /* driver softc */
const char *ic_name; /* usually device name */
@@ -370,6 +372,7 @@
/* The channel width has changed (20<->2040) */
void (*ic_update_chw)(struct ieee80211com *);
+ const struct debugnet80211_methods *ic_debugnet_meth;
uint64_t ic_spare[7];
};

File Metadata

Mime Type
text/plain
Expires
Sat, Aug 8, 1:02 AM (11 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36203626
Default Alt Text
D17308.id.diff (4 KB)

Event Timeline