Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Mar 2014 06:03:26 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r263332 - head/sys/dev/sfxge
Message-ID:  <201403190603.s2J63QF7068466@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Wed Mar 19 06:03:26 2014
New Revision: 263332
URL: http://svnweb.freebsd.org/changeset/base/263332

Log:
  Add counter for Tx errors returned from if_transmit.
  
  Submitted-by:	Boris Misenov <Boris.Misenov@oktetlabs.ru>
  Sponsored by:	Solarflare Communications, Inc.

Modified:
  head/sys/dev/sfxge/sfxge_tx.c
  head/sys/dev/sfxge/sfxge_tx.h

Modified: head/sys/dev/sfxge/sfxge_tx.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_tx.c	Wed Mar 19 03:33:32 2014	(r263331)
+++ head/sys/dev/sfxge/sfxge_tx.c	Wed Mar 19 06:03:26 2014	(r263332)
@@ -500,6 +500,11 @@ sfxge_tx_packet_add(struct sfxge_txq *tx
 	int locked;
 	int rc;
 
+	if (!SFXGE_LINK_UP(txq->sc)) {
+		rc = ENETDOWN;
+		goto fail;
+	}
+
 	/*
 	 * Try to grab the txq lock.  If we are able to get the lock,
 	 * the packet will be appended to the "get list" of the deferred
@@ -537,6 +542,7 @@ sfxge_tx_packet_add(struct sfxge_txq *tx
 
 fail:
 	m_freem(m);
+	atomic_add_long(&txq->early_drops, 1);
 	return (rc);
 	
 }
@@ -587,11 +593,6 @@ sfxge_if_transmit(struct ifnet *ifp, str
 
 	KASSERT(ifp->if_flags & IFF_UP, ("interface not up"));
 
-	if (!SFXGE_LINK_UP(sc)) {
-		m_freem(m);
-		return (ENETDOWN);
-	}
-
 	/* Pick the desired transmit queue. */
 	if (m->m_pkthdr.csum_flags & (CSUM_DELAY_DATA | CSUM_TSO)) {
 		int index = 0;
@@ -1391,6 +1392,7 @@ static const struct {
 	SFXGE_TX_STAT(tso_long_headers, tso_long_headers),
 	SFXGE_TX_STAT(tx_collapses, collapses),
 	SFXGE_TX_STAT(tx_drops, drops),
+	SFXGE_TX_STAT(tx_early_drops, early_drops),
 };
 
 static int

Modified: head/sys/dev/sfxge/sfxge_tx.h
==============================================================================
--- head/sys/dev/sfxge/sfxge_tx.h	Wed Mar 19 03:33:32 2014	(r263331)
+++ head/sys/dev/sfxge/sfxge_tx.h	Wed Mar 19 06:03:26 2014	(r263332)
@@ -159,6 +159,7 @@ struct sfxge_txq {
 	unsigned long			tso_long_headers;
 	unsigned long			collapses;
 	unsigned long			drops;
+	unsigned long			early_drops;
 
 	/* The following fields change more often, and are used mostly
 	 * on the completion path



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403190603.s2J63QF7068466>