Date: Tue, 14 Apr 2009 00:27:59 +0000 (UTC) From: Kip Macy <kmacy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r191033 - head/sys/net Message-ID: <200904140027.n3E0RxZe088564@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kmacy Date: Tue Apr 14 00:27:59 2009 New Revision: 191033 URL: http://svn.freebsd.org/changeset/base/191033 Log: Adapt buf_ring abstraction interface to allow consumers to interoperate with ALTQ Modified: head/sys/net/if_var.h Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Tue Apr 14 00:27:05 2009 (r191032) +++ head/sys/net/if_var.h Tue Apr 14 00:27:59 2009 (r191033) @@ -560,6 +560,12 @@ drbr_enqueue(struct ifnet *ifp, struct b int len = m->m_pkthdr.len; int mflags = m->m_flags; +#ifdef ALTQ + if (ALTQ_IS_ENABLED(&ifp->if_snd)) { + IFQ_ENQUEUE(&ifp->if_snd, m, error); + return (error); + } +#endif if ((error = buf_ring_enqueue(br, m)) == ENOBUFS) { br->br_drops++; _IF_DROP(&ifp->if_snd); @@ -580,8 +586,31 @@ drbr_free(struct buf_ring *br, struct ma buf_ring_free(br, type); } + +static __inline struct mbuf * +drbr_dequeue(struct ifnet *ifp, struct buf_ring *br) +{ +#ifdef ALTQ + struct mbuf *m; + + if (ALTQ_IS_ENABLED(&ifp->if_snd)) { + IFQ_DRV_DEQUEUE(&ifp->if_snd, m); + return (m); + } #endif + 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_DRV_IS_EMPTY(&ifp->if_snd)); +#endif + return (buf_ring_empty(br)); +} +#endif /* * 72 was chosen below because it is the size of a TCP/IP * header (40) + the minimum mss (32).
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904140027.n3E0RxZe088564>