[PATCH 4/6] sfxge: add counter for Tx errors returned from if_transmit
Andrew Rybchenko
Andrew.Rybchenko at oktetlabs.ru
Tue Mar 18 09:58:42 UTC 2014
sfxge: add counter for Tx errors returned from if_transmit
Submitted-by: Boris Misenov <Boris.Misenov at oktetlabs.ru>
Sponsored by: Solarflare Communications, Inc.
diff -r 53935db50f8a -r af2586a023d8 src/driver/freebsd/sfxge_tx.c
--- a/head/sys/dev/sfxge/sfxge_tx.c Mon Mar 10 11:37:12 2014 +0400
+++ b/head/sys/dev/sfxge/sfxge_tx.c Mon Mar 10 11:37:12 2014 +0400
@@ -503,6 +503,11 @@
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 @@
fail:
m_freem(m);
+ atomic_add_long(&txq->early_drops, 1);
return (rc);
}
@@ -587,11 +593,6 @@
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 @@
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
diff -r 53935db50f8a -r af2586a023d8 src/driver/freebsd/sfxge_tx.h
--- a/head/sys/dev/sfxge/sfxge_tx.h Mon Mar 10 11:37:12 2014 +0400
+++ b/head/sys/dev/sfxge/sfxge_tx.h Mon Mar 10 11:37:12 2014 +0400
@@ -160,6 +160,7 @@
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
More information about the freebsd-net
mailing list