Date: Sun, 23 Sep 2007 06:02:05 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 126709 for review Message-ID: <200709230602.l8N625RN021242@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=126709 Change 126709 by kmacy@kmacy_home:ethng on 2007/09/23 06:01:53 - simplify reclaim logic - remove calls to m_freem_vec - the previous mbuf iovec API has been replaced with something a bit more robust Affected files ... .. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_multiq.c#18 edit Differences ... ==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_multiq.c#18 (text+ko) ==== @@ -56,6 +56,7 @@ #include <sys/queue.h> #include <sys/taskqueue.h> #include <sys/unistd.h> +#include <sys/unistd.h> #include <net/bpf.h> #include <net/ethernet.h> @@ -80,10 +81,15 @@ #include <dev/pci/pcivar.h> #include <dev/pci/pci_private.h> +#include <vm/vm.h> +#include <vm/pmap.h> + #ifdef CONFIG_DEFINED #include <cxgb_include.h> +#include <sys/mvec.h> #else #include <dev/cxgb/cxgb_include.h> +#include <dev/cxgb/sys/mvec.h> #endif extern struct sysctl_oid_list sysctl__hw_cxgb_children; @@ -117,7 +123,7 @@ int err = 0; if (qs->qs_flags & QS_EXITING) { - m_freem_vec(m); + m_freem(m); return (ENXIO); } txq = &qs->txq[TXQ_ETH]; @@ -349,7 +355,7 @@ */ if (mbufq_len(mbq) > cxgb_txq_mbuf_ring_size) { if (imm) { - m_freem_vec(imm); + m_freem(imm); txq->txq_drops++; } return (ENOBUFS); @@ -376,52 +382,35 @@ struct sge_txq *txq = &qs->txq[TXQ_ETH]; while ((m = mbufq_dequeue(&txq->sendq)) != NULL) - m_freem_vec(m); + m_freem(m); cxgb_pcpu_pkt_coalesce(txq, NULL); while ((m = mbufq_dequeue(&txq->sendq)) != NULL) - m_freem_vec(m); + m_freem(m); } static int cxgb_pcpu_reclaim_tx(struct sge_txq *txq, struct mbuf_head *mbq) { - int reclaimable, total_reclaimed, reclaimed, freed, i, j, n; - struct mbuf *m_vec[TX_CLEAN_MAX_DESC]; + int reclaimable; struct sge_qset *qs = txq_to_qset(txq, TXQ_ETH); - +#ifdef notyet KASSERT(qs->qs_cpuid == curcpu, ("cpu qset mismatch cpuid=%d curcpu=%d", qs->qs_cpuid, curcpu)); +#endif + + reclaimable = desc_reclaimable(txq); + if (reclaimable == 0) + return (0); - freed = total_reclaimed = j = 0; - while ((reclaimable = desc_reclaimable(txq)) > 0) { - n = t3_free_tx_desc(txq, reclaimable, m_vec, TX_CLEAN_MAX_DESC, &reclaimed); + t3_free_tx_desc(txq, reclaimable); - total_reclaimed += reclaimed; - - if (j > 20 || cxgb_debug) - printf("n=%d reclaimable=%d txq->processed=%d txq->cleaned=%d txq->in_use=%d\n", - n, reclaimable, txq->processed, txq->cleaned, txq->in_use); - - for (i = 0; i < n; i++) - prefetch(m_vec[i]); - /* - * really want to use an mbuf_ring here to avoid touching touching the mbufs - * when all we want to do is store them for later - */ - for (i = 0; i < n; i++) - mbufq_tail(mbq, m_vec[i]); - freed += n; - j++; - - txq->cleaned += reclaimed; - txq->in_use -= reclaimed; - if (isset(&qs->txq_stopped, TXQ_ETH)) - clrbit(&qs->txq_stopped, TXQ_ETH); - } - - txq->txq_frees += freed; - return (reclaimed); + txq->cleaned += reclaimable; + txq->in_use -= reclaimable; + if (isset(&qs->txq_stopped, TXQ_ETH)) + clrbit(&qs->txq_stopped, TXQ_ETH); + + return (reclaimable); } static int @@ -451,7 +440,7 @@ if (cxgb_debug) printf("cxgb link down\n"); if (immpkt) - m_freem_vec(immpkt); + m_freem(immpkt); return (initerr); } @@ -543,7 +532,7 @@ } else { critical_exit(); while ((m = mbufq_dequeue(&mbq)) != NULL) - m_freem_vec(m); + m_freem(m); } return ((err == ENOSPC) ? 0 : err); @@ -669,7 +658,7 @@ mbufq_init(&txq->cleanq); critical_exit(); while ((m = mbufq_dequeue(&mbq)) != NULL) - m_freem_vec(m); + m_freem(m); tsleep(qs, 1, "cxgbidle", sleep_ticks); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709230602.l8N625RN021242>