Re: interface queue drops in systat again, plus netstat
On Mon, Mar 04, 2019 at 09:17:00PM +1000, David Gwynne wrote: > this combines errors and qdrops into fails, and shows them by default. > if you want to look at drops or errors, you can use d or f to switch to > that view. > > this also changes netstat so it shows fails by default which is a > combination of errors and qdrops too, but -d and -e force drops or > errors respectively. > > it is really frustrating at the moment that i can't see qdrops anywhere, > which makes it hard to judge the effectiveness of some changes im > working on. > > for example, this is before and after with netstat: > > dlg@ix netstat$ netstat -I ix1 > NameMtu Network Address Ipkts IerrsOpkts Oerrs > Colls > ix1 1500b8:ca:3a:66:e2:72 193968251 0 172754300 0 > ix1 1500 192.168.1.3 192.168.1.3 193968251 0 172754300 0 > ix1 1500 192.168.1.1 192.168.1.19 193968251 0 172754300 0 > dlg@ix netstat$ ./obj/netstat -I ix1 > NameMtu Network Address Ipkts IfailOpkts Ofail > Colls > ix1 1500b8:ca:3a:66:e2:72 193968251 1789065 172754300 0 > ix1 1500 192.168.1.3 192.168.1.3 193968251 1789065 172754300 0 > ix1 1500 192.168.1.1 192.168.1.19 193968251 1789065 172754300 0 > dlg@ix netstat$ ./obj/netstat -dI ix1 > NameMtu Network Address Ipkts IdropOpkts Odrop > Colls > ix1 1500b8:ca:3a:66:e2:72 193968251 1789065 172754300 0 > ix1 1500 192.168.1.3 192.168.1.3 193968251 1789065 172754300 0 > ix1 1500 192.168.1.1 192.168.1.19 193968251 1789065 172754300 0 > dlg@ix netstat$ ./obj/netstat -eI ix1 > NameMtu Network Address Ipkts IerrsOpkts Oerrs > Colls > ix1 1500b8:ca:3a:66:e2:72 193968251 0 172754300 0 > ix1 1500 192.168.1.3 192.168.1.3 193968251 0 172754300 0 > ix1 1500 192.168.1.1 192.168.1.19 193968251 0 172754300 0 > > thoughts? I'm all for this. Having a way to see every place where packets are dropped is important. > Index: systat/if.c > === > RCS file: /cvs/src/usr.bin/systat/if.c,v > retrieving revision 1.23 > diff -u -p -r1.23 if.c > --- systat/if.c 16 Jan 2015 00:03:37 - 1.23 > +++ systat/if.c 4 Mar 2019 11:13:40 - > @@ -56,6 +56,49 @@ static void showifstat(struct ifstat *); > static void showtotal(void); > static void rt_getaddrinfo(struct sockaddr *, int, struct sockaddr **); > > +const char ifails[] = "IFAILS"; > +const char ofails[] = "OFAILS"; > + > +#define IF_ERR_SUM 0 > +#define IF_ERR_ERRORS1 > +#define IF_ERR_QDROPS2 > + > +struct if_err_view { > + const char *iname; > + const char *oname; > + uint64_t (*icount)(const struct ifcount *); > + uint64_t (*ocount)(const struct ifcount *); > +}; > + > +static uint64_t if_err_ifails(const struct ifcount *); > +static uint64_t if_err_ofails(const struct ifcount *); > +static uint64_t if_err_ierrors(const struct ifcount *); > +static uint64_t if_err_oerrors(const struct ifcount *); > +static uint64_t if_err_iqdrops(const struct ifcount *); > +static uint64_t if_err_oqdrops(const struct ifcount *); > + > +static const struct if_err_view if_err_views[] = { > + [IF_ERR_SUM] ={ > + .iname = ifails, > + .oname = ofails, > + .icount = if_err_ifails, > + .ocount = if_err_ofails, > + }, > + [IF_ERR_ERRORS] = { > + .iname = "IERRS", > + .oname = "OERRS", > + .icount = if_err_ierrors, > + .ocount = if_err_oerrors, > + }, > + [IF_ERR_QDROPS] = { > + .iname = "IQDROPS", > + .oname = "OQDROPS", > + .icount = if_err_iqdrops, > + .ocount = if_err_oqdrops, > + }, > +}; > + > +static const struct if_err_view *if_err_view = &if_err_views[IF_ERR_SUM]; > > /* Define fields */ > field_def fields_if[] = { > @@ -63,10 +106,10 @@ field_def fields_if[] = { > {"STATE", 4, 6, 1, FLD_ALIGN_LEFT, -1, 0, 0, 0}, > {"IPKTS", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > {"IBYTES", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > - {"IERRS", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > + {ifails, 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > {"OPKTS", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > {"OBYTES", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > - {"OERRS", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > + {ofails, 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > {"COLLS", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > {"DESC", 14, 64, 1, FLD_ALIGN_LEFT, -1, 0, 0, 0}, > }; > @@ -264,9 +307,11 @@ fetchifstat(void) > UPDATE(ifc_ip, ifm_data.ifi_ipackets); > UPDATE(ifc_ib, ifm_data.ifi_ibytes); > UPDATE(ifc_ie, ifm_data.ifi_ierrors); > +
interface queue drops in systat again, plus netstat
this combines errors and qdrops into fails, and shows them by default. if you want to look at drops or errors, you can use d or f to switch to that view. this also changes netstat so it shows fails by default which is a combination of errors and qdrops too, but -d and -e force drops or errors respectively. it is really frustrating at the moment that i can't see qdrops anywhere, which makes it hard to judge the effectiveness of some changes im working on. for example, this is before and after with netstat: dlg@ix netstat$ netstat -I ix1 NameMtu Network Address Ipkts IerrsOpkts Oerrs Colls ix1 1500b8:ca:3a:66:e2:72 193968251 0 172754300 0 ix1 1500 192.168.1.3 192.168.1.3 193968251 0 172754300 0 ix1 1500 192.168.1.1 192.168.1.19 193968251 0 172754300 0 dlg@ix netstat$ ./obj/netstat -I ix1 NameMtu Network Address Ipkts IfailOpkts Ofail Colls ix1 1500b8:ca:3a:66:e2:72 193968251 1789065 172754300 0 ix1 1500 192.168.1.3 192.168.1.3 193968251 1789065 172754300 0 ix1 1500 192.168.1.1 192.168.1.19 193968251 1789065 172754300 0 dlg@ix netstat$ ./obj/netstat -dI ix1 NameMtu Network Address Ipkts IdropOpkts Odrop Colls ix1 1500b8:ca:3a:66:e2:72 193968251 1789065 172754300 0 ix1 1500 192.168.1.3 192.168.1.3 193968251 1789065 172754300 0 ix1 1500 192.168.1.1 192.168.1.19 193968251 1789065 172754300 0 dlg@ix netstat$ ./obj/netstat -eI ix1 NameMtu Network Address Ipkts IerrsOpkts Oerrs Colls ix1 1500b8:ca:3a:66:e2:72 193968251 0 172754300 0 ix1 1500 192.168.1.3 192.168.1.3 193968251 0 172754300 0 ix1 1500 192.168.1.1 192.168.1.19 193968251 0 172754300 0 thoughts? Index: systat/if.c === RCS file: /cvs/src/usr.bin/systat/if.c,v retrieving revision 1.23 diff -u -p -r1.23 if.c --- systat/if.c 16 Jan 2015 00:03:37 - 1.23 +++ systat/if.c 4 Mar 2019 11:13:40 - @@ -56,6 +56,49 @@ static void showifstat(struct ifstat *); static void showtotal(void); static void rt_getaddrinfo(struct sockaddr *, int, struct sockaddr **); +const char ifails[] = "IFAILS"; +const char ofails[] = "OFAILS"; + +#define IF_ERR_SUM 0 +#define IF_ERR_ERRORS 1 +#define IF_ERR_QDROPS 2 + +struct if_err_view { + const char *iname; + const char *oname; + uint64_t (*icount)(const struct ifcount *); + uint64_t (*ocount)(const struct ifcount *); +}; + +static uint64_t if_err_ifails(const struct ifcount *); +static uint64_t if_err_ofails(const struct ifcount *); +static uint64_t if_err_ierrors(const struct ifcount *); +static uint64_t if_err_oerrors(const struct ifcount *); +static uint64_t if_err_iqdrops(const struct ifcount *); +static uint64_t if_err_oqdrops(const struct ifcount *); + +static const struct if_err_view if_err_views[] = { + [IF_ERR_SUM] ={ + .iname = ifails, + .oname = ofails, + .icount = if_err_ifails, + .ocount = if_err_ofails, + }, + [IF_ERR_ERRORS] = { + .iname = "IERRS", + .oname = "OERRS", + .icount = if_err_ierrors, + .ocount = if_err_oerrors, + }, + [IF_ERR_QDROPS] = { + .iname = "IQDROPS", + .oname = "OQDROPS", + .icount = if_err_iqdrops, + .ocount = if_err_oqdrops, + }, +}; + +static const struct if_err_view *if_err_view = &if_err_views[IF_ERR_SUM]; /* Define fields */ field_def fields_if[] = { @@ -63,10 +106,10 @@ field_def fields_if[] = { {"STATE", 4, 6, 1, FLD_ALIGN_LEFT, -1, 0, 0, 0}, {"IPKTS", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, {"IBYTES", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, - {"IERRS", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, + {ifails, 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, {"OPKTS", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, {"OBYTES", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, - {"OERRS", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, + {ofails, 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, {"COLLS", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, {"DESC", 14, 64, 1, FLD_ALIGN_LEFT, -1, 0, 0, 0}, }; @@ -264,9 +307,11 @@ fetchifstat(void) UPDATE(ifc_ip, ifm_data.ifi_ipackets); UPDATE(ifc_ib, ifm_data.ifi_ibytes); UPDATE(ifc_ie, ifm_data.ifi_ierrors); + UPDATE(ifc_iq, ifm_data.ifi_iqdrops); UPDATE(ifc_op, ifm_data.ifi_opackets); UPDATE(ifc_ob, ifm_data.ifi_obytes); UPDATE(ifc_oe, ifm_data.ifi_oerrors); + UPDATE(ifc_oq, ifm_data.ifi_oqdrops); UPDATE(ifc_co, ifm_data.ifi_collisions); ifs->i