Date: Mon, 24 Mar 2014 15:22:23 +0000 (UTC) From: Randall Stewart <rrs@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r263689 - in projects/rrs_mqueue/sys: amd64/conf dev/virtio/network dev/vmware/vmxnet3 net Message-ID: <201403241522.s2OFMNY7052292@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rrs Date: Mon Mar 24 15:22:22 2014 New Revision: 263689 URL: http://svnweb.freebsd.org/changeset/base/263689 Log: Change to at least make it compile (-witness and -invariants to start). > Description of fields to fill in above: 76 columns --| > PR: If a GNATS PR is affected by the change. > Submitted by: If someone else sent in the change. > Reviewed by: If someone else reviewed your modification. > Approved by: If you needed approval for this commit. > Obtained from: If the change is from a third party. > MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. > Security: Vulnerability reference (one per line) or description. > Sponsored by: If the change was sponsored by an organization. > Empty fields above will be automatically removed. M sys/amd64/conf/GENERIC M sys/dev/virtio/network/if_vtnet.c M sys/dev/vmware/vmxnet3/if_vmx.c M sys/dev/vmware/vmxnet3/if_vmxvar.h M sys/net/ifq.h Modified: projects/rrs_mqueue/sys/amd64/conf/GENERIC projects/rrs_mqueue/sys/dev/virtio/network/if_vtnet.c projects/rrs_mqueue/sys/dev/vmware/vmxnet3/if_vmx.c projects/rrs_mqueue/sys/dev/vmware/vmxnet3/if_vmxvar.h projects/rrs_mqueue/sys/net/ifq.h Modified: projects/rrs_mqueue/sys/amd64/conf/GENERIC ============================================================================== --- projects/rrs_mqueue/sys/amd64/conf/GENERIC Mon Mar 24 13:50:11 2014 (r263688) +++ projects/rrs_mqueue/sys/amd64/conf/GENERIC Mon Mar 24 15:22:22 2014 (r263689) @@ -78,11 +78,11 @@ options KDB_TRACE # Print a stack trac # For full debugger support use (turn off in stable branch): options DDB # Support DDB. options GDB # Support remote GDB. -options DEADLKRES # Enable the deadlock resolver -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed +#options DEADLKRES # Enable the deadlock resolver +#options INVARIANTS # Enable calls of extra sanity checking +#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +#options WITNESS # Enable checks to detect deadlocks and cycles +#options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones # Make an SMP-capable kernel by default Modified: projects/rrs_mqueue/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- projects/rrs_mqueue/sys/dev/virtio/network/if_vtnet.c Mon Mar 24 13:50:11 2014 (r263688) +++ projects/rrs_mqueue/sys/dev/virtio/network/if_vtnet.c Mon Mar 24 15:22:22 2014 (r263689) @@ -2263,7 +2263,7 @@ vtnet_txq_mq_start_locked(struct vtnet_t while ((m = drbr_peek(ifp, br, &qnum)) != NULL) { if (virtqueue_full(vq)) { - drbr_putback(ifp, br, m); + drbr_putback(ifp, br, m, qnum); error = ENOBUFS; break; } Modified: projects/rrs_mqueue/sys/dev/vmware/vmxnet3/if_vmx.c ============================================================================== --- projects/rrs_mqueue/sys/dev/vmware/vmxnet3/if_vmx.c Mon Mar 24 13:50:11 2014 (r263688) +++ projects/rrs_mqueue/sys/dev/vmware/vmxnet3/if_vmx.c Mon Mar 24 15:22:22 2014 (r263689) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include <net/if_vlan_var.h> #include <net/bpf.h> +#include <net/drbr.h> #include <netinet/in_systm.h> #include <netinet/in.h> @@ -986,7 +987,7 @@ vmxnet3_init_txq(struct vmxnet3_softc *s #ifndef VMXNET3_LEGACY_TX TASK_INIT(&txq->vxtxq_defrtask, 0, vmxnet3_txq_tq_deferred, txq); - txq->vxtxq_br = buf_ring_alloc(VMXNET3_DEF_BUFRING_SIZE, M_DEVBUF, + txq->vxtxq_br = drbr_alloc(M_DEVBUF, M_NOWAIT, &txq->vxtxq_mtx); if (txq->vxtxq_br == NULL) return (ENOMEM); @@ -1068,7 +1069,7 @@ vmxnet3_destroy_txq(struct vmxnet3_txque #ifndef VMXNET3_LEGACY_TX if (txq->vxtxq_br != NULL) { - buf_ring_free(txq->vxtxq_br, M_DEVBUF); + drbr_free(txq->vxtxq_br, M_DEVBUF); txq->vxtxq_br = NULL; } #endif @@ -2901,9 +2902,10 @@ vmxnet3_txq_mq_start_locked(struct vmxne { struct vmxnet3_softc *sc; struct vmxnet3_txring *txr; - struct buf_ring *br; + struct drbr_ring *br; struct ifnet *ifp; int tx, avail, error; + uint8_t qused; sc = txq->vxtxq_sc; br = txq->vxtxq_br; @@ -2928,13 +2930,13 @@ vmxnet3_txq_mq_start_locked(struct vmxne } while ((avail = VMXNET3_TXRING_AVAIL(txr)) >= 2) { - m = drbr_peek(ifp, br); + m = drbr_peek(ifp, br, &qused); if (m == NULL) break; /* Assume worse case if this mbuf is the head of a chain. */ if (m->m_next != NULL && avail < VMXNET3_TX_MAXSEGS) { - drbr_putback(ifp, br, m); + drbr_putback(ifp, br, m, qused); error = ENOBUFS; break; } @@ -2942,12 +2944,12 @@ vmxnet3_txq_mq_start_locked(struct vmxne error = vmxnet3_txq_encap(txq, &m); if (error) { if (m != NULL) - drbr_putback(ifp, br, m); + drbr_putback(ifp, br, m, qused); else - drbr_advance(ifp, br); + drbr_advance(ifp, br, qused); break; } - drbr_advance(ifp, br); + drbr_advance(ifp, br, qused); tx++; ETHER_BPF_MTAP(ifp, m); @@ -3267,7 +3269,6 @@ vmxnet3_qflush(struct ifnet *ifp) { struct vmxnet3_softc *sc; struct vmxnet3_txqueue *txq; - struct mbuf *m; int i; sc = ifp->if_softc; @@ -3276,8 +3277,7 @@ vmxnet3_qflush(struct ifnet *ifp) txq = &sc->vmx_txq[i]; VMXNET3_TXQ_LOCK(txq); - while ((m = buf_ring_dequeue_sc(txq->vxtxq_br)) != NULL) - m_freem(m); + drbr_flush(ifp, txq->vxtxq_br); VMXNET3_TXQ_UNLOCK(txq); } Modified: projects/rrs_mqueue/sys/dev/vmware/vmxnet3/if_vmxvar.h ============================================================================== --- projects/rrs_mqueue/sys/dev/vmware/vmxnet3/if_vmxvar.h Mon Mar 24 13:50:11 2014 (r263688) +++ projects/rrs_mqueue/sys/dev/vmware/vmxnet3/if_vmxvar.h Mon Mar 24 15:22:22 2014 (r263689) @@ -132,7 +132,7 @@ struct vmxnet3_txqueue { struct mtx vxtxq_mtx; struct vmxnet3_softc *vxtxq_sc; #ifndef VMXNET3_TX_LEGACY - struct buf_ring *vxtxq_br; + struct drbr_ring *vxtxq_br; #endif int vxtxq_id; int vxtxq_intr_idx; Modified: projects/rrs_mqueue/sys/net/ifq.h ============================================================================== --- projects/rrs_mqueue/sys/net/ifq.h Mon Mar 24 13:50:11 2014 (r263688) +++ projects/rrs_mqueue/sys/net/ifq.h Mon Mar 24 15:22:22 2014 (r263689) @@ -313,165 +313,6 @@ do { \ IFQ_PURGE(ifq); \ } while (0) -static __inline int -drbr_enqueue(struct ifnet *ifp, struct buf_ring *br, struct mbuf *m) -{ - int error = 0; - -#ifdef ALTQ - if (ALTQ_IS_ENABLED(&ifp->if_snd)) { - IFQ_ENQUEUE(&ifp->if_snd, m, error); - return (error); - } -#endif - error = buf_ring_enqueue(br, m); - if (error) - m_freem(m); - - return (error); -} - -static __inline void -drbr_putback(struct ifnet *ifp, struct buf_ring *br, struct mbuf *new) -{ - /* - * The top of the list needs to be swapped - * for this one. - */ -#ifdef ALTQ - if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) { - /* - * Peek in altq case dequeued it - * so put it back. - */ - IFQ_DRV_PREPEND(&ifp->if_snd, new); - return; - } -#endif - buf_ring_putback_sc(br, new); -} - -static __inline struct mbuf * -drbr_peek(struct ifnet *ifp, struct buf_ring *br) -{ -#ifdef ALTQ - struct mbuf *m; - if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) { - /* - * Pull it off like a dequeue - * since drbr_advance() does nothing - * for altq and drbr_putback() will - * use the old prepend function. - */ - IFQ_DEQUEUE(&ifp->if_snd, m); - return (m); - } -#endif - return(buf_ring_peek(br)); -} - -static __inline void -drbr_flush(struct ifnet *ifp, struct buf_ring *br) -{ - struct mbuf *m; - -#ifdef ALTQ - if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) - IFQ_PURGE(&ifp->if_snd); -#endif - while ((m = buf_ring_dequeue_sc(br)) != NULL) - m_freem(m); -} - -static __inline void -drbr_free(struct buf_ring *br, struct malloc_type *type) -{ - - drbr_flush(NULL, br); - buf_ring_free(br, type); -} - -static __inline struct mbuf * -drbr_dequeue(struct ifnet *ifp, struct buf_ring *br) -{ -#ifdef ALTQ - struct mbuf *m; - - if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) { - IFQ_DEQUEUE(&ifp->if_snd, m); - return (m); - } -#endif - return (buf_ring_dequeue_sc(br)); -} - -static __inline void -drbr_advance(struct ifnet *ifp, struct buf_ring *br) -{ -#ifdef ALTQ - /* Nothing to do here since peek dequeues in altq case */ - if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) - return; -#endif - return (buf_ring_advance_sc(br)); -} - - -static __inline struct mbuf * -drbr_dequeue_cond(struct ifnet *ifp, struct buf_ring *br, - int (*func) (struct mbuf *, void *), void *arg) -{ - struct mbuf *m; -#ifdef ALTQ - if (ALTQ_IS_ENABLED(&ifp->if_snd)) { - IFQ_LOCK(&ifp->if_snd); - IFQ_POLL_NOLOCK(&ifp->if_snd, m); - if (m != NULL && func(m, arg) == 0) { - IFQ_UNLOCK(&ifp->if_snd); - return (NULL); - } - IFQ_DEQUEUE_NOLOCK(&ifp->if_snd, m); - IFQ_UNLOCK(&ifp->if_snd); - return (m); - } -#endif - m = buf_ring_peek(br); - if (m == NULL || func(m, arg) == 0) - return (NULL); - - return (buf_ring_dequeue_sc(br)); -} - -static __inline int -drbr_empty(struct ifnet *ifp, struct buf_ring *br) -{ -#ifdef ALTQ - if (ALTQ_IS_ENABLED(&ifp->if_snd)) - return (IFQ_IS_EMPTY(&ifp->if_snd)); -#endif - return (buf_ring_empty(br)); -} - -static __inline int -drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br) -{ -#ifdef ALTQ - if (ALTQ_IS_ENABLED(&ifp->if_snd)) - return (1); -#endif - return (!buf_ring_empty(br)); -} - -static __inline int -drbr_inuse(struct ifnet *ifp, struct buf_ring *br) -{ -#ifdef ALTQ - if (ALTQ_IS_ENABLED(&ifp->if_snd)) - return (ifp->if_snd.ifq_len); -#endif - return (buf_ring_count(br)); -} - extern int ifqmaxlen; void if_qflush(struct ifnet *);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403241522.s2OFMNY7052292>