svn commit: r247706 - user/adrian/net80211_tx/sys/net80211
Adrian Chadd
adrian at FreeBSD.org
Sun Mar 3 10:02:10 UTC 2013
Author: adrian
Date: Sun Mar 3 10:02:08 2013
New Revision: 247706
URL: http://svnweb.freebsd.org/changeset/base/247706
Log:
Migrate the vap if_transmit calls to ieee80211_vap_transmit().
* Do a mechanical conversion of vap ifp -> ieee80211_vap_transmit().
* Tidy up the hostap pspoll receive code - have it call either
ieee80211_parent_transmit() or ieee80211_vap_transmit() as appropriate.
* Tidy up the hwmp discover code to send via ieee80211_vap_transmit()
as we shouldn't ever see encapsulated frames here.
Tested:
* AR5416, STA mode
TODO:
* Lots, lots more hostap testing!
Modified:
user/adrian/net80211_tx/sys/net80211/ieee80211_freebsd.c
user/adrian/net80211_tx/sys/net80211/ieee80211_freebsd.h
user/adrian/net80211_tx/sys/net80211/ieee80211_hostap.c
user/adrian/net80211_tx/sys/net80211/ieee80211_hwmp.c
user/adrian/net80211_tx/sys/net80211/ieee80211_power.c
Modified: user/adrian/net80211_tx/sys/net80211/ieee80211_freebsd.c
==============================================================================
--- user/adrian/net80211_tx/sys/net80211/ieee80211_freebsd.c Sun Mar 3 09:47:47 2013 (r247705)
+++ user/adrian/net80211_tx/sys/net80211/ieee80211_freebsd.c Sun Mar 3 10:02:08 2013 (r247706)
@@ -516,7 +516,7 @@ ieee80211_parent_transmit(struct ieee802
{
struct ifnet *parent = ic->ic_ifp;
/*
- * Assert the IC lock is held - this enforces the
+ * Assert the IC TX lock is held - this enforces the
* processing -> queuing order is maintained
*/
IEEE80211_TX_LOCK_ASSERT(ic);
@@ -524,6 +524,24 @@ ieee80211_parent_transmit(struct ieee802
return (parent->if_transmit(parent, m));
}
+/*
+ * Transmit a frame to the VAP interface.
+ */
+int
+ieee80211_vap_transmit(struct ieee80211vap *vap, struct mbuf *m)
+{
+ struct ifnet *ifp = vap->iv_ifp;
+
+ /*
+ * When transmitting via the VAP, we shouldn't hold
+ * any IC TX lock as the VAP TX path will acquire it.
+ */
+ IEEE80211_TX_UNLOCK_ASSERT(vap->iv_ic);
+
+ return (ifp->if_transmit(ifp, m));
+
+}
+
#include <sys/libkern.h>
void
Modified: user/adrian/net80211_tx/sys/net80211/ieee80211_freebsd.h
==============================================================================
--- user/adrian/net80211_tx/sys/net80211/ieee80211_freebsd.h Sun Mar 3 09:47:47 2013 (r247705)
+++ user/adrian/net80211_tx/sys/net80211/ieee80211_freebsd.h Sun Mar 3 10:02:08 2013 (r247706)
@@ -298,11 +298,10 @@ void ieee80211_process_callback(struct i
struct ieee80211com;
int ieee80211_parent_transmit(struct ieee80211com *, struct mbuf *);
+int ieee80211_vap_transmit(struct ieee80211vap *, struct mbuf *);
void get_random_bytes(void *, size_t);
-struct ieee80211com;
-
void ieee80211_sysctl_attach(struct ieee80211com *);
void ieee80211_sysctl_detach(struct ieee80211com *);
void ieee80211_sysctl_vattach(struct ieee80211vap *);
Modified: user/adrian/net80211_tx/sys/net80211/ieee80211_hostap.c
==============================================================================
--- user/adrian/net80211_tx/sys/net80211/ieee80211_hostap.c Sun Mar 3 09:47:47 2013 (r247705)
+++ user/adrian/net80211_tx/sys/net80211/ieee80211_hostap.c Sun Mar 3 10:02:08 2013 (r247706)
@@ -412,7 +412,7 @@ hostap_deliver_data(struct ieee80211vap
if (mcopy != NULL) {
int len, err;
len = mcopy->m_pkthdr.len;
- err = ifp->if_transmit(ifp, mcopy);
+ err = ieee80211_vap_transmit(vap, mcopy);
if (err) {
/* NB: IFQ_HANDOFF reclaims mcopy */
} else {
@@ -2255,8 +2255,8 @@ void
ieee80211_recv_pspoll(struct ieee80211_node *ni, struct mbuf *m0)
{
struct ieee80211vap *vap = ni->ni_vap;
+ struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_frame_min *wh;
- struct ifnet *ifp;
struct mbuf *m;
uint16_t aid;
int qlen;
@@ -2320,23 +2320,15 @@ ieee80211_recv_pspoll(struct ieee80211_n
}
m->m_flags |= M_PWR_SAV; /* bypass PS handling */
- if (m->m_flags & M_ENCAP)
- ifp = vap->iv_ic->ic_ifp;
- else
- ifp = vap->iv_ifp;
-
/*
- * Free any node ref which this mbuf may have.
- *
- * Much like psq_mfree(), we assume that M_ENCAP nodes have
- * node references.
+ * Do the right thing; if it's an encap'ed frame then
+ * call ieee80211_parent_transmit() (and free the ref) else
+ * call ieee80211_vap_transmit().
*/
- if (ifp->if_transmit(ifp, m) != 0) {
- /*
- * XXX m is invalid (freed) at this point, determine M_ENCAP
- * an alternate way.
- */
- if (ifp == vap->iv_ic->ic_ifp)
+ if (m->m_flags & M_ENCAP) {
+ if (ieee80211_parent_transmit(ic, m) != 0)
ieee80211_free_node(ni);
+ } else {
+ (void) ieee80211_vap_transmit(vap, m);
}
}
Modified: user/adrian/net80211_tx/sys/net80211/ieee80211_hwmp.c
==============================================================================
--- user/adrian/net80211_tx/sys/net80211/ieee80211_hwmp.c Sun Mar 3 09:47:47 2013 (r247705)
+++ user/adrian/net80211_tx/sys/net80211/ieee80211_hwmp.c Sun Mar 3 10:02:08 2013 (r247706)
@@ -1277,12 +1277,9 @@ hwmp_recv_prep(struct ieee80211vap *vap,
struct ieee80211_mesh_route *rtext = NULL;
struct ieee80211_hwmp_route *hr;
struct ieee80211com *ic = vap->iv_ic;
- struct ifnet *ifp = vap->iv_ifp;
struct mbuf *m, *next;
uint32_t metric = 0;
const uint8_t *addr;
- int is_encap;
- struct ieee80211_node *ni_encap;
IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
"received PREP, orig %6D, targ %6D", prep->prep_origaddr, ":",
@@ -1456,22 +1453,21 @@ hwmp_recv_prep(struct ieee80211vap *vap,
m = ieee80211_ageq_remove(&ic->ic_stageq,
(struct ieee80211_node *)(uintptr_t)
ieee80211_mac_hash(ic, addr)); /* either dest or ext_dest */
+
+ /*
+ * All frames in the stageq here should be non-M_ENCAP; or things
+ * will get very unhappy.
+ */
for (; m != NULL; m = next) {
- is_encap = !! (m->m_flags & M_ENCAP);
- ni_encap = (struct ieee80211_node *) m->m_pkthdr.rcvif;
next = m->m_nextpkt;
m->m_nextpkt = NULL;
IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
"flush queued frame %p len %d", m, m->m_pkthdr.len);
-
/*
* If the mbuf has M_ENCAP set, ensure we free it.
* Note that after if_transmit() is called, m is invalid.
*/
- if (ifp->if_transmit(ifp, m) != 0) {
- if (is_encap)
- ieee80211_free_node(ni_encap);
- }
+ (void) ieee80211_vap_transmit(vap, m);
}
#undef IS_PROXY
#undef PROXIED_BY_US
Modified: user/adrian/net80211_tx/sys/net80211/ieee80211_power.c
==============================================================================
--- user/adrian/net80211_tx/sys/net80211/ieee80211_power.c Sun Mar 3 09:47:47 2013 (r247705)
+++ user/adrian/net80211_tx/sys/net80211/ieee80211_power.c Sun Mar 3 10:02:08 2013 (r247706)
@@ -476,7 +476,7 @@ pwrsave_flushq(struct ieee80211_node *ni
ifp_q = m->m_nextpkt;
KASSERT((!(m->m_flags & M_ENCAP)),
("%s: vapq with M_ENCAP frame!\n", __func__));
- (void) ifp->if_transmit(ifp, m);
+ (void) ieee80211_vap_transmit(vap, m);
}
}
}
More information about the svn-src-user
mailing list