Removing queue length check in ip_output (was Re: buf_ring in HEAD is racy)
Gleb Smirnoff
glebius at FreeBSD.org
Thu Dec 19 15:16:09 UTC 2013
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.
--
Totus tuus, Glebius.
More information about the freebsd-net
mailing list