Date: Wed, 14 Jan 2015 02:17:35 +0300 From: Gleb Smirnoff <glebius@FreeBSD.org> To: John Baldwin <jhb@freebsd.org> Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r277122 - projects/ifnet/sys/dev/msk Message-ID: <20150113231735.GZ15484@FreeBSD.org> In-Reply-To: <5330876.Sb1U9Iz8Cz@ralph.baldwin.cx> References: <201501130902.t0D927NE077024@svn.freebsd.org> <5330876.Sb1U9Iz8Cz@ralph.baldwin.cx>
next in thread | previous in thread | raw e-mail | index | archive | help
John, On Tue, Jan 13, 2015 at 01:22:09PM -0500, John Baldwin wrote: J> > o Convert from xxx_start(ifp) to xxx_transmit(ifp, m). J> > A simple conversion itself is quite straight: J> > * In ifdriver declaration define .ifdrv_maxqlen, take the value J> > from IFQ_SET_MAXLEN() macro. J> > * In ifdriver ifops declaration define if_transmit function. J> > * Rename xxx_start() to xxx_transmit() and change its prototype. J> > * The new named xxx_transmit() should: J> > - Try to if_snd_enqueue() the mbuf or return. J> > - Try to mtx_lock() the driver softc or return. J> J> Please no. This is a major source of pain with the current drivers that use J> buf_ring that is worked around in various (often broken) ways. The problem J> is that the other thread holding the lock might drop it right after your try J> lock fails and then the packet you just queued doesn't go out until you queue J> another packet. That's all fine and good if you are blasting packets out an J> interface. It is not fine and good if you have sparse traffic. That packet J> is now potentially delayed indefinitely. (In a real world scenario with a J> heartbeat protocol that sent out timing packets once a second or so to measure J> RTT between hosts this manifested as odd timings because we would see the J> timings jump by a second every so often when the packet was delayed until the J> next heartbeat). Yes, I also see this problem when coding that. J> This kind of design decision is why I do not want to just blindly convert J> everything to suboptimal if_transmit routines. The current ifq based if_start J> model is better for 10/100 single-queue drivers than this. If I convert mtx_trylock() to mtx_lock(), then we will get 1:1 conversion to the current model. But, I still want to do an improvement while converting drivers. :) May be the xxx_transmit() should check the queue again after softc unlock? -- Totus tuus, Glebius.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150113231735.GZ15484>