svn commit: r283211 - stable/10/sys/dev/sfxge

Andrew Rybchenko arybchik at FreeBSD.org
Thu May 21 09:12:26 UTC 2015


Author: arybchik
Date: Thu May 21 09:12:25 2015
New Revision: 283211
URL: https://svnweb.freebsd.org/changeset/base/283211

Log:
  MFC: r282998
  
  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.
  
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  stable/10/sys/dev/sfxge/sfxge_tx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==============================================================================
--- stable/10/sys/dev/sfxge/sfxge_tx.c	Thu May 21 09:11:03 2015	(r283210)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c	Thu May 21 09:12:25 2015	(r283211)
@@ -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);
 }


More information about the svn-src-all mailing list