Date: Tue, 18 Mar 2014 16:59:21 +0400 From: Gleb Smirnoff <glebius@FreeBSD.org> To: Andrew Rybchenko <Andrew.Rybchenko@oktetlabs.ru>, Boris Misenov <Boris.Misenov@oktetlabs.ru> Cc: net@FreeBSD.org Subject: Re: [PATCH 4/6] sfxge: add counter for Tx errors returned from if_transmit Message-ID: <20140318125921.GF1499@FreeBSD.org> In-Reply-To: <532818D0.4080006@oktetlabs.ru> References: <532818D0.4080006@oktetlabs.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <Boris.Misenov@oktetlabs.ru> 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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140318125921.GF1499>