Index: ifq.c =================================================================== RCS file: /cvs/src/sys/net/ifq.c,v retrieving revision 1.4 diff -u -p -r1.4 ifq.c --- ifq.c 29 Dec 2015 12:35:43 -0000 1.4 +++ ifq.c 20 Jan 2017 01:36:06 -0000 @@ -172,7 +172,7 @@ ifq_init(struct ifqueue *ifq, struct ifn ifq->ifq_if = ifp; mtx_init(&ifq->ifq_mtx, IPL_NET); - ifq->ifq_drops = 0; + ifq->ifq_qdrops = 0; /* default to priq */ ifq->ifq_ops = &priq_ops; @@ -214,7 +214,7 @@ ifq_attach(struct ifqueue *ifq, const st while ((m = ml_dequeue(&ml)) != NULL) { if (ifq->ifq_ops->ifqop_enq(ifq, m) != 0) { - ifq->ifq_drops++; + ifq->ifq_qdrops++; ml_enqueue(&free_ml, m); } else ifq->ifq_len++; @@ -246,10 +246,15 @@ ifq_enqueue_try(struct ifqueue *ifq, str mtx_enter(&ifq->ifq_mtx); rv = ifq->ifq_ops->ifqop_enq(ifq, m); - if (rv == 0) + if (rv == 0) { ifq->ifq_len++; - else - ifq->ifq_drops++; + + ifq->ifq_packets++; + ifq->ifq_bytes += m->m_pkthdr.len; + if (ISSET(m->m_flags, M_MCAST)) + ifq->ifq_mcasts++; + } else + ifq->ifq_qdrops++; mtx_leave(&ifq->ifq_mtx); return (rv); @@ -330,7 +335,7 @@ ifq_purge(struct ifqueue *ifq) ifq->ifq_ops->ifqop_purge(ifq, &ml); rv = ifq->ifq_len; ifq->ifq_len = 0; - ifq->ifq_drops += rv; + ifq->ifq_qdrops += rv; mtx_leave(&ifq->ifq_mtx); KASSERT(rv == ml_len(&ml)); Index: ifq.h =================================================================== RCS file: /cvs/src/sys/net/ifq.h,v retrieving revision 1.5 diff -u -p -r1.5 ifq.h --- ifq.h 20 Jan 2016 17:27:16 -0000 1.5 +++ ifq.h 20 Jan 2017 01:36:06 -0000 @@ -28,11 +28,17 @@ struct ifqueue { /* mbuf handling */ struct mutex ifq_mtx; - uint64_t ifq_drops; const struct ifq_ops *ifq_ops; void *ifq_q; unsigned int ifq_len; unsigned int ifq_oactive; + + /* statistics */ + uint64_t ifq_packets; + uint64_t ifq_bytes; + uint64_t ifq_qdrops; + uint64_t ifq_errors; + uint64_t ifq_mcasts; /* work serialisation */ struct mutex ifq_task_mtx;