Author: arybchik
Date: Wed Mar 25 09:45:07 2015
New Revision: 280497
URL: https://svnweb.freebsd.org/changeset/base/280497

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

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

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==============================================================================
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 09:40:48 2015        
(r280496)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 09:45:07 2015        
(r280497)
@@ -515,6 +515,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
@@ -552,6 +557,7 @@ sfxge_tx_packet_add(struct sfxge_txq *tx
 
 fail:
        m_freem(m);
+       atomic_add_long(&txq->early_drops, 1);
        return (rc);
        
 }
@@ -602,11 +608,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;
@@ -1406,6 +1407,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: stable/10/sys/dev/sfxge/sfxge_tx.h
==============================================================================
--- stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 09:40:48 2015        
(r280496)
+++ stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 09:45:07 2015        
(r280497)
@@ -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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to