Date: Tue, 17 Nov 2009 03:29:03 +0300 From: pluknet <pluknet@gmail.com> To: Attilio Rao <attilio@freebsd.org> Cc: pyunyh@gmail.com, freebsd-net@freebsd.org, Bruce Evans <bde@freebsd.org>, John Baldwin <jhb@freebsd.org> Subject: Re: [PATCH] Add idrop report to netstat Message-ID: <a31046fc0911161629h43a4dbcs6809b69e889f2347@mail.gmail.com> In-Reply-To: <3bbf2fe10911161556h6fb602a6qe5043fea590e7800@mail.gmail.com> References: <3bbf2fe10911160715m34fc0ba4hc13af02541405491@mail.gmail.com> <20091116182423.GD1262@michelle.cdnetworks.com> <3bbf2fe10911161404s4c5870a4pe0afbb890e0fdde2@mail.gmail.com> <20091116233828.GG1262@michelle.cdnetworks.com> <3bbf2fe10911161556h6fb602a6qe5043fea590e7800@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
2009/11/17 Attilio Rao <attilio@freebsd.org>: > 2009/11/17 Pyun YongHyeon <pyunyh@gmail.com>: >> On Mon, Nov 16, 2009 at 11:04:20PM +0100, Attilio Rao wrote: >>> 2009/11/16 Pyun YongHyeon <pyunyh@gmail.com>: >>> > On Mon, Nov 16, 2009 at 04:15:09PM +0100, Attilio Rao wrote: >>> >> [Please CC me as I'm not subscribed to -net@] >>> >> >>> >> This patch allows to show the informations about packets droped on >>> >> input for interfaces on netstat: >>> >> http://www.freebsd.org/~attilio/Sandvine/STABLE_8/idrops/idrops.diff >>> >> >>> >> This patch as been contributed back from Sandvine Incorporated. >>> >> Comments, reviews and testing are welcome. >>> >> >>> > >>> > Doesn't -d of netstat(1) show the same information? >>> >>> Am I wrong or "-d" prints the drops on the output path? >>> The patch provides information on the input drops. >>> >> >> struct if_data { >> =A0 =A0 =A0 =A0/* generic interface information */ >> =A0 =A0 =A0 =A0u_char =A0ifi_type; =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* ethern= et, tokenring, etc */ >> =A0 =A0 =A0 =A0u_char =A0ifi_physical; =A0 =A0 =A0 =A0 =A0 /* e.g., AUI,= Thinnet, 10base-T, etc */ >> [...] >> =A0 =A0 =A0 =A0u_long =A0ifi_iqdrops; =A0 =A0 =A0 =A0 =A0 =A0/* dropped = on input, this interface */ >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> >> =A0 =A0 =A0 =A0u_long =A0ifi_noproto; =A0 =A0 =A0 =A0 =A0 =A0/* destined= for unsupported protocol */ >> =A0 =A0 =A0 =A0u_long =A0ifi_hwassist; =A0 =A0 =A0 =A0 =A0 /* HW offload= capabilities, see IFCAP */ >> =A0 =A0 =A0 =A0time_t =A0ifi_epoch; =A0 =A0 =A0 =A0 =A0 =A0 =A0/* uptime= at attach or stat reset */ >> =A0 =A0 =A0 =A0struct =A0timeval ifi_lastchange; /* time of last adminis= trative change */ >> }; > > Err, but dflag does print out if_snd.ifq_drops. Infact: > > @if.c:sidewaysintpr() > > [...] > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (!first) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0show_stat("lu", 10, ifnet.= if_ipackets - ip->ift_ip, 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0show_stat("lu", 5, ifnet.i= f_ierrors - ip->ift_ie, 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0show_stat("lu", 10, ifnet.= if_ibytes - ip->ift_ib, 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0show_stat("lu", 10, ifnet.= if_opackets - ip->ift_op, 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0show_stat("lu", 5, ifnet.i= f_oerrors - ip->ift_oe, 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0show_stat("lu", 10, ifnet.= if_obytes - ip->ift_ob, 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0show_stat("NRSlu", 5, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ifnet.if_collision= s - ip->ift_co, 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (dflag) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0show_stat(= "LSu", 5, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if= net.if_snd.ifq_drops - ip->ift_dr, 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > [...] > =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!first) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0show_stat("lu", 10, sum->i= ft_ip - total->ift_ip, 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0show_stat("lu", 5, sum->if= t_ie - total->ift_ie, 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0show_stat("lu", 10, sum->i= ft_ib - total->ift_ib, 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0show_stat("lu", 10, sum->i= ft_op - total->ift_op, 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0show_stat("lu", 5, sum->if= t_oe - total->ift_oe, 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0show_stat("lu", 10, sum->i= ft_ob - total->ift_ob, 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0show_stat("NRSlu", 5, sum-= >ift_co - total->ift_co, 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (dflag) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0show_stat(= "LSu", 5, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0su= m->ift_dr - total->ift_dr, 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > > > Which is defined in sys/net/if_var.h as: > > struct ifnet { > =A0 =A0 =A0 =A0void =A0 =A0*if_softc; =A0 =A0 =A0 =A0 =A0 =A0 =A0/* point= er to driver state */ > =A0 =A0 =A0 =A0void =A0 =A0*if_l2com; =A0 =A0 =A0 =A0 =A0 =A0 =A0/* point= er to protocol bits */ > =A0 =A0 =A0 =A0struct vnet *if_vnet; =A0 =A0 =A0 =A0 =A0 /* pointer to ne= twork stack instance */ > [...] > =A0 =A0 =A0 =A0int =A0 =A0 if_drv_flags; =A0 =A0 =A0 =A0 =A0 /* driver-ma= naged status flags */ > =A0 =A0 =A0 =A0struct =A0ifaltq if_snd; =A0 =A0 =A0 =A0 =A0/* output queu= e (includes altq) */ > =A0 =A0 =A0 =A0const u_int8_t *if_broadcastaddr; /* linklevel broadcast b= ytestring */ > [...] > }; ifq_drops !=3D *_iqdrops Historically *_iqdrops was designed strictly to record falure to allocate a buffer on Rx chain (or so). while ifq_drops was for logically higher level: output and (some kind of) input ifnet queue shortage stats. [and that's recorded in the earlier BSD's. Though, input queue was replaced later with netisr magics in if_ethersubr.c, though it still possible to track the roots in struct netist_work{ nw_len..nw_qlimit..nw_drops }). --=20 wbr, pluknet
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a31046fc0911161629h43a4dbcs6809b69e889f2347>