Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Dec 2013 13:04:43 -0800
From:      Adrian Chadd <adrian@freebsd.org>
To:        Ryan Stone <rysto32@gmail.com>
Cc:        Jack F Vogel <jfv@freebsd.org>, Michael Tuexen <Michael.Tuexen@lurchi.franken.de>, freebsd-net <freebsd-net@freebsd.org>
Subject:   Removing queue length check in ip_output (was Re: buf_ring in HEAD is racy)
Message-ID:  <CAJ-VmomyPq_2K-MFhb7vt6MM7RBbmn7yaTzUXb7%2BN7TbW1RmHQ@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
How about we can this check in ip_output():

        /*
         * Verify that we have any chance at all of being able to queue the
         * packet or packet fragments, unless ALTQ is enabled on the given
         * interface in which case packetdrop should be done by queueing.
         */
        n = ip_len / mtu + 1; /* how many fragments ? */
        if (
#ifdef ALTQ
            (!ALTQ_IS_ENABLED(&ifp->if_snd)) &&
#endif /* ALTQ */
            (ifp->if_snd.ifq_len + n) >= ifp->if_snd.ifq_maxlen ) {
                error = ENOBUFS;
                IPSTAT_INC(ips_odropped);
                ifp->if_snd.ifq_drops += n;
                goto bad;
        }

.. it's totally bogus in an if_transmit / SMP world. There's no
locking and there's no guarantee that there will be headroom in the
queue between this point and the later call to the if_output() method.



-adrian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-VmomyPq_2K-MFhb7vt6MM7RBbmn7yaTzUXb7%2BN7TbW1RmHQ>