From owner-freebsd-net@FreeBSD.ORG Tue Mar 18 12:59:23 2014 Return-Path: Delivered-To: net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C08EF939 for ; Tue, 18 Mar 2014 12:59:23 +0000 (UTC) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5BDF7CD7 for ; Tue, 18 Mar 2014 12:59:22 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.8/8.14.8) with ESMTP id s2ICxL7L003917 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 18 Mar 2014 16:59:21 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.8/8.14.8/Submit) id s2ICxLYL003916; Tue, 18 Mar 2014 16:59:21 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 18 Mar 2014 16:59:21 +0400 From: Gleb Smirnoff To: Andrew Rybchenko , Boris Misenov Subject: Re: [PATCH 4/6] sfxge: add counter for Tx errors returned from if_transmit Message-ID: <20140318125921.GF1499@FreeBSD.org> References: <532818D0.4080006@oktetlabs.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <532818D0.4080006@oktetlabs.ru> User-Agent: Mutt/1.5.22 (2013-10-16) Cc: net@FreeBSD.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Mar 2014 12:59:23 -0000 Andrew, Boris, On Tue, Mar 18, 2014 at 01:58:40PM +0400, Andrew Rybchenko wrote: A> sfxge: add counter for Tx errors returned from if_transmit A> A> Submitted-by: Boris Misenov A> Sponsored by: Solarflare Communications, Inc. I'd suggest not to use atomic(9) increment there, since it locks memory bus and thus has performance impact. Using ++ would be fine, since we probably don't care about absolute precision of this counter. However, if you are interested in precision and also in performance, I'd suggest you to convert all statistics in sfxge(4) that are shared between CPUs to the counter(9) framework. More info on it can be found in manual page and some measurements are available here: http://lists.freebsd.org/pipermail/freebsd-arch/2013-April/014204.html If you insist, I can apply your patch as is. The only problem is that when you send patches inlined into email, your MUA mangles all TABs to spaces, so I can't apply your patches. If it possible, next time send them as attachments. A> diff -r 53935db50f8a -r af2586a023d8 src/driver/freebsd/sfxge_tx.c A> --- a/head/sys/dev/sfxge/sfxge_tx.c Mon Mar 10 11:37:12 2014 +0400 A> +++ b/head/sys/dev/sfxge/sfxge_tx.c Mon Mar 10 11:37:12 2014 +0400 A> @@ -503,6 +503,11 @@ A> int locked; A> int rc; A> A> + if (!SFXGE_LINK_UP(txq->sc)) { A> + rc = ENETDOWN; A> + goto fail; A> + } A> + A> /* A> * Try to grab the txq lock. If we are able to get the lock, A> * the packet will be appended to the "get list" of the deferred A> @@ -537,6 +542,7 @@ A> A> fail: A> m_freem(m); A> + atomic_add_long(&txq->early_drops, 1); A> return (rc); A> A> } A> @@ -587,11 +593,6 @@ A> A> KASSERT(ifp->if_flags & IFF_UP, ("interface not up")); A> A> - if (!SFXGE_LINK_UP(sc)) { A> - m_freem(m); A> - return (ENETDOWN); A> - } A> - A> /* Pick the desired transmit queue. */ A> if (m->m_pkthdr.csum_flags & (CSUM_DELAY_DATA | CSUM_TSO)) { A> int index = 0; A> @@ -1391,6 +1392,7 @@ A> SFXGE_TX_STAT(tso_long_headers, tso_long_headers), A> SFXGE_TX_STAT(tx_collapses, collapses), A> SFXGE_TX_STAT(tx_drops, drops), A> + SFXGE_TX_STAT(tx_early_drops, early_drops), A> }; A> A> static int A> diff -r 53935db50f8a -r af2586a023d8 src/driver/freebsd/sfxge_tx.h A> --- a/head/sys/dev/sfxge/sfxge_tx.h Mon Mar 10 11:37:12 2014 +0400 A> +++ b/head/sys/dev/sfxge/sfxge_tx.h Mon Mar 10 11:37:12 2014 +0400 A> @@ -160,6 +160,7 @@ A> unsigned long tso_long_headers; A> unsigned long collapses; A> unsigned long drops; A> + unsigned long early_drops; A> A> /* The following fields change more often, and are used mostly A> * on the completion path A> A> _______________________________________________ A> freebsd-net@freebsd.org mailing list A> http://lists.freebsd.org/mailman/listinfo/freebsd-net A> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" -- Totus tuus, Glebius.