svn commit: r195516 - projects/mesh11s/sys/net80211

Rui Paulo rpaulo at FreeBSD.org
Thu Jul 9 20:49:56 UTC 2009


Author: rpaulo
Date: Thu Jul  9 20:49:56 2009
New Revision: 195516
URL: http://svn.freebsd.org/changeset/base/195516

Log:
  Rework mesh_forward() to use if_start instead of raw_xmit. Gives more
  throughput.
  
  Sponsored by:	sam

Modified:
  projects/mesh11s/sys/net80211/ieee80211_mesh.c

Modified: projects/mesh11s/sys/net80211/ieee80211_mesh.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_mesh.c	Thu Jul  9 20:22:05 2009	(r195515)
+++ projects/mesh11s/sys/net80211/ieee80211_mesh.c	Thu Jul  9 20:49:56 2009	(r195516)
@@ -681,13 +681,12 @@ mesh_forward(struct ieee80211vap *vap, s
 	struct ieee80211com *ic = vap->iv_ic;
 	struct ieee80211_mesh_state *ms = vap->iv_mesh;
 	struct ifnet *ifp = vap->iv_ifp;
+	struct ifnet *parent = ic->ic_ifp;
 	const struct ieee80211_frame *wh =
 	    mtod(m, const struct ieee80211_frame *);
 	struct mbuf *mcopy;
 	struct ieee80211_meshcntl *mccopy;
 	struct ieee80211_frame *whcopy;
-	const struct ieee80211_txparam *tp;
-	struct ieee80211_bpf_params params;
 	struct ieee80211_node *ni;
 	int err;
 
@@ -724,16 +723,11 @@ mesh_forward(struct ieee80211vap *vap, s
 	whcopy = mtod(mcopy, struct ieee80211_frame *);
 	mccopy = (struct ieee80211_meshcntl *)
 	    (mtod(mcopy, uint8_t *) + ieee80211_hdrspace(ic, wh));
-	memset(&params, 0, sizeof(params));
 	/* XXX clear other bits? */
 	whcopy->i_fc[1] &= ~IEEE80211_FC1_RETRY;
 	IEEE80211_ADDR_COPY(whcopy->i_addr2, vap->iv_myaddr);
 	if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
-		ni = vap->iv_bss;
-		tp = ni->ni_txparms;
-		params.ibp_rate0 = tp->mcastrate;
-		params.ibp_flags |= IEEE80211_BPF_NOACK;
-		params.ibp_try0 = 1;
+		ni = ieee80211_ref_node(vap->iv_bss);
 		mcopy->m_flags |= M_MCAST;
 	} else {
 		ni = mesh_find_txnode(vap, whcopy->i_addr3);
@@ -744,36 +738,28 @@ mesh_forward(struct ieee80211vap *vap, s
 			m_freem(mcopy);
 			return;
 		}
-		tp = ni->ni_txparms;
-		params.ibp_rate0 = tp->ucastrate;
-		params.ibp_try0 = tp->maxretry;
 		IEEE80211_ADDR_COPY(whcopy->i_addr1, ni->ni_macaddr);
 	}
 	IEEE80211_NOTE(vap, IEEE80211_MSG_MESH, ni,
 	    "fwd %s frame from %s ttl %d",
 	    IEEE80211_IS_MULTICAST(wh->i_addr1) ?  "mcast" : "ucast",
 	    ether_sprintf(wh->i_addr3), mccopy->mc_ttl);
+
 	KASSERT(mccopy->mc_ttl > 0, ("%s called with wrong ttl", __func__));
 	mccopy->mc_ttl--;
+
 	/* XXX calculate priority so drivers can find the tx queue */
 	M_WME_SETAC(mcopy, WME_AC_BE);
-	params.ibp_pri = M_WME_GETAC(mcopy);
-	params.ibp_power = ni->ni_txpower;
-#ifdef IEEE80211_DEBUG_REFCNT
-	IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE,
-	    "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n",
-	    __func__, __LINE__,
-	    ni, ether_sprintf(ni->ni_macaddr),
-	    ieee80211_node_refcnt(ni)+1);
-#endif
-	ieee80211_ref_node(ni);
-	err = ic->ic_raw_xmit(ni, mcopy, &params);
-	if (err) {
+
+	/* XXX do we know m_nextpkt is NULL? */
+	mcopy->m_pkthdr.rcvif = (void *) ni;
+	err = parent->if_transmit(parent, mcopy);
+	if (err != 0) {
 		/* NB: IFQ_HANDOFF reclaims mbuf */
-		ifp->if_oerrors++;
 		ieee80211_free_node(ni);
-	} else
+	} else {
 		ifp->if_opackets++;
+	}
 }
 
 static int


More information about the svn-src-projects mailing list