Date: Wed, 20 Nov 2013 20:21:47 +0000 From: "Robert N. M. Watson" <rwatson@FreeBSD.org> To: Julian Elischer <julian@FreeBSD.ORG> Cc: svn-src-head@freebsd.org, George Neville-Neil <gnn@FreeBSD.org>, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r258328 - head/sys/net Message-ID: <E91CDE96-52EF-45A2-9CAA-A6D3285F1D05@FreeBSD.org> In-Reply-To: <528D1768.9000401@freebsd.org> References: <201311182258.rAIMwEFd048783@svn.freebsd.org> <alpine.BSF.2.00.1311191101060.50802@fledge.watson.org> <528D1768.9000401@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 20 Nov 2013, at 20:11, Julian Elischer <julian@FreeBSD.ORG> wrote: >> Currently, it is quite easy to make mistakes regarding individual = mbuf chains vs. lists of mbuf chains. This leads me to wonder whether a = new type, perhaps simply constructed on the stack before passing in, = should be used for KPIs that accept lists of packets. E.g., >>=20 >> /* >> * This structure is almost always allocated on a caller stack, so >> * cannot itself be queued without memory allocation in most = cases. >> */ >> struct mbuf_queue { >> struct mbuf *mq_head; >> }; >>=20 >>=20 > It's hard to believe that we don't have a structure around already = that we can't use. With Luigi's comment, I wonder that there isn't an = mbuf_list structure already we can just steal. it could almost be the = current interface input queue structure. The exact details don't matter; what does matter is that we make it as = easy as possible to detect mistakes using the compiler (e.g., queue = passed where mbuf expected, or vice versa) and that those situations we = can't check statically, we try to check dynamically (multi-entry queue = passed where mbuf expected). In the past we've had bugs along similar = lines, where code expects m->m_nextpkt to be NULL when it isn't leading = to very unhappy times in socket buffers, etc. Ideally what we did would = have no expense at runtime unless debugging features were turned on = (INVARIANTS). Robert=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E91CDE96-52EF-45A2-9CAA-A6D3285F1D05>