Removing queue length check in ip_output (was Re: buf_ring in HEAD is racy)
Adrian Chadd
adrian at freebsd.org
Thu Dec 19 17:11:08 UTC 2013
On 19 December 2013 07:16, Gleb Smirnoff <glebius at freebsd.org> wrote:
> On Wed, Dec 18, 2013 at 01:04:43PM -0800, Adrian Chadd wrote:
> A> How about we can this check in ip_output():
> A>
> A> /*
> A> * Verify that we have any chance at all of being able to queue the
> A> * packet or packet fragments, unless ALTQ is enabled on the given
> A> * interface in which case packetdrop should be done by queueing.
> A> */
> A> n = ip_len / mtu + 1; /* how many fragments ? */
> A> if (
> A> #ifdef ALTQ
> A> (!ALTQ_IS_ENABLED(&ifp->if_snd)) &&
> A> #endif /* ALTQ */
> A> (ifp->if_snd.ifq_len + n) >= ifp->if_snd.ifq_maxlen ) {
> A> error = ENOBUFS;
> A> IPSTAT_INC(ips_odropped);
> A> ifp->if_snd.ifq_drops += n;
> A> goto bad;
> A> }
> A>
> A> .. it's totally bogus in an if_transmit / SMP world. There's no
> A> locking and there's no guarantee that there will be headroom in the
> A> queue between this point and the later call to the if_output() method.
>
> My vote is to remove this. But better leave a comment that we need
> an API to send a bunch of packets (or fail them all) via an interface.
Yes. I think we need some path to evolve if_transmit to a) transmit
multiple frames as a transaction (eg a set of IP or 802.11 fragments)
at once, and b) be able to transmit multiple transactions at once.
Right now chaining packets together via m_nextpkt can only be used for
one or the other. We'd have to set flags in the mbufs to delineate the
transaction boundaries and .. ew.
-a
More information about the freebsd-net
mailing list