summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarybchik <arybchik@FreeBSD.org>2015-05-21 09:12:25 +0000
committerarybchik <arybchik@FreeBSD.org>2015-05-21 09:12:25 +0000
commit700f83961eb76927b3b326ccadd72bc34f5fa29d (patch)
tree7de9d10aa6197b559cbcf686f9e02e9eb9354c56
parenta53d333e88fdff44c4a763c081f2e705747b8870 (diff)
downloadFreeBSD-src-700f83961eb76927b3b326ccadd72bc34f5fa29d.zip
FreeBSD-src-700f83961eb76927b3b326ccadd72bc34f5fa29d.tar.gz
MFC: r282998
sfxge: move mbuf free to sfxge_if_transmit() It is a preparation to the next patch which will service packet queue even if packet addtion fails. Sponsored by: Solarflare Communications, Inc.
-rw-r--r--sys/dev/sfxge/sfxge_tx.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/sys/dev/sfxge/sfxge_tx.c b/sys/dev/sfxge/sfxge_tx.c
index 375fc7c..466cefd 100644
--- a/sys/dev/sfxge/sfxge_tx.c
+++ b/sys/dev/sfxge/sfxge_tx.c
@@ -605,9 +605,8 @@ sfxge_tx_packet_add(struct sfxge_txq *txq, struct mbuf *m)
int rc;
if (!SFXGE_LINK_UP(txq->sc)) {
- rc = ENETDOWN;
atomic_add_long(&txq->netdown_drops, 1);
- goto fail;
+ return (ENETDOWN);
}
/*
@@ -622,7 +621,7 @@ sfxge_tx_packet_add(struct sfxge_txq *txq, struct mbuf *m)
rc = sfxge_tx_qdpl_put_locked(txq, m);
if (rc != 0) {
SFXGE_TXQ_UNLOCK(txq);
- goto fail;
+ return (rc);
}
/* Try to service the list. */
@@ -631,7 +630,7 @@ sfxge_tx_packet_add(struct sfxge_txq *txq, struct mbuf *m)
} else {
rc = sfxge_tx_qdpl_put_unlocked(txq, m);
if (rc != 0)
- goto fail;
+ return (rc);
/*
* Try to grab the lock again.
@@ -649,10 +648,6 @@ sfxge_tx_packet_add(struct sfxge_txq *txq, struct mbuf *m)
SFXGE_TXQ_LOCK_ASSERT_NOTOWNED(txq);
return (0);
-
-fail:
- m_freem(m);
- return (rc);
}
static void
@@ -730,6 +725,8 @@ sfxge_if_transmit(struct ifnet *ifp, struct mbuf *m)
}
rc = sfxge_tx_packet_add(txq, m);
+ if (rc != 0)
+ m_freem(m);
return (rc);
}
OpenPOWER on IntegriCloud