From owner-svn-src-all@FreeBSD.ORG Sat May 16 05:43:21 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 55BC6BC1; Sat, 16 May 2015 05:43:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 444E1199F; Sat, 16 May 2015 05:43:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4G5hLSY040581; Sat, 16 May 2015 05:43:21 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4G5hLPh040580; Sat, 16 May 2015 05:43:21 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505160543.t4G5hLPh040580@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Sat, 16 May 2015 05:43:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282998 - head/sys/dev/sfxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2015 05:43:21 -0000 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); }