Date: Tue, 17 Dec 2013 22:37:44 -0500 From: Ryan Stone <rysto32@gmail.com> To: Adrian Chadd <adrian@freebsd.org> Cc: Jack F Vogel <jfv@freebsd.org>, Michael Tuexen <Michael.Tuexen@lurchi.franken.de>, freebsd-net <freebsd-net@freebsd.org> Subject: Re: buf_ring in HEAD is racy Message-ID: <CAFMmRNysDGD-pjcNw6L3%2BA%2BBTprZMZ==MxKJonpNz574D-UNFQ@mail.gmail.com> In-Reply-To: <CAJ-Vmo=%2BxqBc1S5ENNq5Fdh26gxKhiMTq3w9Uqk7zPrBTMizzQ@mail.gmail.com> References: <CAFMmRNyJpvZ0AewWr62w16=qKer%2BFNXUJJy0Qc=EBqMnUV3OyQ@mail.gmail.com> <CAJ-VmonJG-M_f_m36f-z3ArumBKNdt5%2B6muwFJzWABRxRQWJaw@mail.gmail.com> <CAJ-Vmo=OpWZ_OphA=%2BXbmgHw%2BFwuCMwngHq9_2WOnNHMa_RA9A@mail.gmail.com> <CAJ-Vmo=iayVJiMNihmPf_Dd18uEZ5W-j9E3g4SeaRhfFJQj4Ow@mail.gmail.com> <E5612C2C-C9B9-45D8-A794-9993FE39D9E6@lurchi.franken.de> <CAJ-Vmomw8qF4f=ZVA0ELHOXtcD-4OQosBU3gqeM5p-zKbPbcdg@mail.gmail.com> <CAJ-Vmo=%2BxqBc1S5ENNq5Fdh26gxKhiMTq3w9Uqk7zPrBTMizzQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 17, 2013 at 11:49 AM, Adrian Chadd <adrian@freebsd.org> wrote: > Try: > > Index: sys/dev/ixgbe/ixgbe.c > =================================================================== > --- sys/dev/ixgbe/ixgbe.c (revision 2995) > +++ sys/dev/ixgbe/ixgbe.c (working copy) > @@ -5178,6 +5178,7 @@ > struct ixgbe_hw *hw = &adapter->hw; > u32 missed_rx = 0, bprc, lxon, lxoff, total; > u64 total_missed_rx = 0; > + u64 odrops = 0; > > adapter->stats.crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS); > adapter->stats.illerrc += IXGBE_READ_REG(hw, IXGBE_ILLERRC); > @@ -5308,6 +5309,11 @@ > adapter->stats.fcoedwtc += IXGBE_READ_REG(hw, IXGBE_FCOEDWTC); > } > > + /* TX drops */ > + for (int i = 0; i < adapter->num_queues; i++) { > + odrops += adapter->tx_rings[i].br->br_drops; > + } > + > /* Fill out the OS statistics structure */ > ifp->if_ipackets = adapter->stats.gprc; > ifp->if_opackets = adapter->stats.gptc; > @@ -5317,6 +5323,9 @@ > ifp->if_omcasts = adapter->stats.mptc; > ifp->if_collisions = 0; > > + /* TX drops are stored in if_snd for now, not the top level counters */ > + ifp->if_snd.ifq_drops = odrops; > + > /* Rx Errors */ > ifp->if_iqdrops = total_missed_rx; > ifp->if_ierrors = adapter->stats.crcerrs + adapter->stats.rlec; > > > -adrian The trick with this is that if ALTQ is enabled then we will use if_snd queue instead of the buf ring, and if that queue drops then ifq_drops will be incremented. With this patch if ALTQ is in use then we will not count any drops (as you will be overwriting the drop count from the queue).
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFMmRNysDGD-pjcNw6L3%2BA%2BBTprZMZ==MxKJonpNz574D-UNFQ>