Date: Sat, 16 May 2015 05:43:21 +0000 (UTC) From: Andrew Rybchenko <arybchik@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282998 - head/sys/dev/sfxge Message-ID: <201505160543.t4G5hLPh040580@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: arybchik Date: Sat May 16 05:43:20 2015 New Revision: 282998 URL: https://svnweb.freebsd.org/changeset/base/282998 Log: sfxge: move mbuf free to sfxge_if_transmit() It is a preparation to the next patch which will service packet queue even if packet addtion fails. Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D2552 Modified: head/sys/dev/sfxge/sfxge_tx.c Modified: head/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- head/sys/dev/sfxge/sfxge_tx.c Sat May 16 05:37:47 2015 (r282997) +++ head/sys/dev/sfxge/sfxge_tx.c Sat May 16 05:43:20 2015 (r282998) @@ -605,9 +605,8 @@ sfxge_tx_packet_add(struct sfxge_txq *tx int rc; if (!SFXGE_LINK_UP(txq->sc)) { - rc = ENETDOWN; atomic_add_long(&txq->netdown_drops, 1); - goto fail; + return (ENETDOWN); } /* @@ -622,7 +621,7 @@ sfxge_tx_packet_add(struct sfxge_txq *tx rc = sfxge_tx_qdpl_put_locked(txq, m); if (rc != 0) { SFXGE_TXQ_UNLOCK(txq); - goto fail; + return (rc); } /* Try to service the list. */ @@ -631,7 +630,7 @@ sfxge_tx_packet_add(struct sfxge_txq *tx } else { rc = sfxge_tx_qdpl_put_unlocked(txq, m); if (rc != 0) - goto fail; + return (rc); /* * Try to grab the lock again. @@ -649,10 +648,6 @@ sfxge_tx_packet_add(struct sfxge_txq *tx SFXGE_TXQ_LOCK_ASSERT_NOTOWNED(txq); return (0); - -fail: - m_freem(m); - return (rc); } static void @@ -730,6 +725,8 @@ sfxge_if_transmit(struct ifnet *ifp, str } rc = sfxge_tx_packet_add(txq, m); + if (rc != 0) + m_freem(m); return (rc); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505160543.t4G5hLPh040580>