Date: Tue, 3 Nov 2015 21:11:30 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r290339 - head/sys/dev/ath Message-ID: <201511032111.tA3LBUpB079382@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Tue Nov 3 21:11:30 2015 New Revision: 290339 URL: https://svnweb.freebsd.org/changeset/base/290339 Log: ath(4) - don't try to free buffers / return an error if we've committed to transmit the buffer. ath_tx_start() may manipulate/reallocate the mbuf as part of the DMA code, so we can't expect the mbuf can be returned back to the caller. Now, the net80211 ifnet work changed the semantics slightly so if an error is returned here, the mbuf/reference is freed by the caller (here, it's net80211.) So, once we reach ath_tx_start(), we never return failure. If we fail then we still return OK and we free the mbuf/noderef ourselves, and we increment OERRORS. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Tue Nov 3 21:03:26 2015 (r290338) +++ head/sys/dev/ath/if_ath.c Tue Nov 3 21:11:30 2015 (r290339) @@ -3320,6 +3320,9 @@ nextfrag: * * Note: if this fails, then the mbufs are freed but * not the node reference. + * + * So, we now have to free the node reference ourselves here + * and return OK up to the stack. */ next = m->m_nextpkt; if (ath_tx_start(sc, ni, bf, m)) { @@ -3336,7 +3339,14 @@ reclaim: */ ath_txfrag_cleanup(sc, &frags, ni); ATH_TXBUF_UNLOCK(sc); - retval = ENOBUFS; + + /* + * XXX: And free the node/return OK; ath_tx_start() may have + * modified the buffer. We currently have no way to + * signify that the mbuf was freed but there was an error. + */ + ieee80211_free_node(ni); + retval = 0; goto finish; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511032111.tA3LBUpB079382>