Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Aug 2005 22:41:05 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 81810 for review
Message-ID:  <200508102241.j7AMf56l070757@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=81810

Change 81810 by sam@sam_ebb on 2005/08/10 22:40:35

	o clear m_nextpkt in ath_tx_start to be safe
	o add comments about how frags are handled

Affected files ...

.. //depot/projects/wifi/sys/dev/ath/if_ath.c#101 edit

Differences ...

==== //depot/projects/wifi/sys/dev/ath/if_ath.c#101 (text+ko) ====

@@ -1595,6 +1595,18 @@
 		}
 
 	nextfrag:
+		/*
+		 * Pass the frame to the h/w for transmission.
+		 * Fragmented frames have each frag chained together
+		 * with m_nextpkt.  We know there are sufficient ath_buf's
+		 * to send all the frags because of work done by
+		 * ath_txfrag_setup.  We leave m_nextpkt set while
+		 * calling ath_tx_start so it can use it to extend the
+		 * the tx duration to cover the subsequent frag and
+		 * so it can reclaim all the mbufs in case of an error;
+		 * ath_tx_start clears m_nextpkt once it commits to
+		 * handing the frame to the hardware.
+		 */
 		next = m->m_nextpkt;
 		if (ath_tx_start(sc, ni, bf, m)) {
 	bad:
@@ -3598,6 +3610,10 @@
 	return 0;		/* NB: lowest rate */
 }
 
+/*
+ * Reclaim mbuf resources.  For fragmented frames we
+ * need to claim each frag chained with m_nextpkt.
+ */
 static void
 ath_freetx(struct mbuf *m)
 {
@@ -3990,6 +4006,13 @@
 	} else
 		ctsrate = 0;
 
+	/*
+	 * At this point we are committed to sending the frame
+	 * and we don't need to look at m_nextpkt; clear it in
+	 * case this frame is part of frag chain.
+	 */
+	m0->m_nextpkt = NULL;
+
 	if (IFF_DUMPPKTS(sc, ATH_DEBUG_XMIT))
 		ieee80211_dump_pkt(ic, mtod(m0, caddr_t), m0->m_len,
 			sc->sc_hwmap[txrate].ieeerate, -1);



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