Date: Fri, 19 Sep 2014 09:01:20 +0000 (UTC) From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271856 - in head: share/man/man9 sys/contrib/altq/altq sys/dev/ce sys/dev/cp sys/dev/ctau sys/dev/cx sys/dev/cxgb sys/dev/lmc sys/dev/mxge sys/net sys/netgraph sys/netgraph/bluetooth/d... Message-ID: <201409190901.s8J91KvK096766@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: glebius Date: Fri Sep 19 09:01:19 2014 New Revision: 271856 URL: http://svnweb.freebsd.org/changeset/base/271856 Log: Remove ifq_drops from struct ifqueue. Now queue drops are accounted in struct ifnet if_oqdrops. Some netgraph modules used ifqueue w/o ifnet. Accounting of queue drops is simply removed from them. There were no API to read this statistic. Sponsored by: Netflix Sponsored by: Nginx, Inc. Modified: head/share/man/man9/altq.9 head/sys/contrib/altq/altq/if_altq.h head/sys/dev/ce/if_ce.c head/sys/dev/cp/if_cp.c head/sys/dev/ctau/if_ct.c head/sys/dev/cx/if_cx.c head/sys/dev/cxgb/cxgb_main.c head/sys/dev/lmc/if_lmc.c head/sys/dev/mxge/if_mxge.c head/sys/net/if.c head/sys/net/if_debug.c head/sys/net/if_epair.c head/sys/net/if_mib.c head/sys/net/ifq.h head/sys/net/rtsock.c head/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c head/sys/netgraph/bluetooth/drivers/h4/ng_h4.c head/sys/netgraph/ng_device.c head/sys/netgraph/ng_iface.c head/sys/netgraph/ng_tty.c head/sys/netpfil/pf/if_pflog.c head/sys/netpfil/pf/if_pfsync.c Modified: head/share/man/man9/altq.9 ============================================================================== --- head/share/man/man9/altq.9 Fri Sep 19 07:44:49 2014 (r271855) +++ head/share/man/man9/altq.9 Fri Sep 19 09:01:19 2014 (r271856) @@ -256,7 +256,6 @@ still work with struct mbuf *ifq_tail; | struct mbuf *ifq_tail; int ifq_len; | int ifq_len; int ifq_maxlen; | int ifq_maxlen; - int ifq_drops; | int ifq_drops; }; | /* driver queue fields */ | ...... | /* altq related fields */ Modified: head/sys/contrib/altq/altq/if_altq.h ============================================================================== --- head/sys/contrib/altq/altq/if_altq.h Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/contrib/altq/altq/if_altq.h Fri Sep 19 09:01:19 2014 (r271856) @@ -50,7 +50,6 @@ struct ifaltq { struct mbuf *ifq_tail; int ifq_len; int ifq_maxlen; - int ifq_drops; #ifdef __FreeBSD__ struct mtx ifq_mtx; #endif Modified: head/sys/dev/ce/if_ce.c ============================================================================== --- head/sys/dev/ce/if_ce.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/dev/ce/if_ce.c Fri Sep 19 09:01:19 2014 (r271856) @@ -2408,7 +2408,6 @@ static int ng_ce_rcvdata (hook_p hook, s #if __FreeBSD_version >= 500000 IF_LOCK (q); if (_IF_QFULL (q)) { - _IF_DROP (q); IF_UNLOCK (q); CE_UNLOCK (bd); splx (s); Modified: head/sys/dev/cp/if_cp.c ============================================================================== --- head/sys/dev/cp/if_cp.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/dev/cp/if_cp.c Fri Sep 19 09:01:19 2014 (r271856) @@ -2141,7 +2141,6 @@ static int ng_cp_rcvdata (hook_p hook, i CP_LOCK (bd); IF_LOCK (q); if (_IF_QFULL (q)) { - _IF_DROP (q); IF_UNLOCK (q); CP_UNLOCK (bd); splx (s); Modified: head/sys/dev/ctau/if_ct.c ============================================================================== --- head/sys/dev/ctau/if_ct.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/dev/ctau/if_ct.c Fri Sep 19 09:01:19 2014 (r271856) @@ -2083,7 +2083,6 @@ static int ng_ct_rcvdata (hook_p hook, i CT_LOCK (bd); IF_LOCK (q); if (_IF_QFULL (q)) { - _IF_DROP (q); IF_UNLOCK (q); CT_UNLOCK (bd); splx (s); Modified: head/sys/dev/cx/if_cx.c ============================================================================== --- head/sys/dev/cx/if_cx.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/dev/cx/if_cx.c Fri Sep 19 09:01:19 2014 (r271856) @@ -2421,7 +2421,6 @@ static int ng_cx_rcvdata (hook_p hook, i CX_LOCK (bd); IF_LOCK (q); if (_IF_QFULL (q)) { - _IF_DROP (q); IF_UNLOCK (q); CX_UNLOCK (bd); splx (s); Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/dev/cxgb/cxgb_main.c Fri Sep 19 09:01:19 2014 (r271856) @@ -2357,7 +2357,7 @@ cxgb_tick_handler(void *arg, int count) drops = 0; for (j = pi->first_qset; j < pi->first_qset + pi->nqsets; j++) drops += sc->sge.qs[j].txq[TXQ_ETH].txq_mr->br_drops; - ifp->if_snd.ifq_drops = drops; + ifp->if_oqdrops = drops; ifp->if_oerrors = mstats->tx_excess_collisions + Modified: head/sys/dev/lmc/if_lmc.c ============================================================================== --- head/sys/dev/lmc/if_lmc.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/dev/lmc/if_lmc.c Fri Sep 19 09:01:19 2014 (r271856) @@ -4635,6 +4635,7 @@ lmc_raw_output(struct ifnet *ifp, struct { m_freem(m); sc->status.cntrs.odiscards++; + ifp->if_oqdrops++; if (DRIVER_DEBUG) printf("%s: lmc_raw_output: IFQ_ENQUEUE() failed; error %d\n", NAME_UNIT, error); Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/dev/mxge/if_mxge.c Fri Sep 19 09:01:19 2014 (r271856) @@ -4069,7 +4069,7 @@ mxge_update_stats(mxge_softc_t *sc) #ifdef IFNET_BUF_RING sc->ifp->if_obytes = obytes; sc->ifp->if_omcasts = omcasts; - sc->ifp->if_snd.ifq_drops = odrops; + sc->ifp->if_oqdrops = odrops; #endif sc->ifp->if_oerrors = oerrors; return pkts; Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/net/if.c Fri Sep 19 09:01:19 2014 (r271856) @@ -3521,8 +3521,8 @@ if_handoff(struct ifqueue *ifq, struct m IF_LOCK(ifq); if (_IF_QFULL(ifq)) { - _IF_DROP(ifq); IF_UNLOCK(ifq); + ifp->if_oqdrops++; m_freem(m); return (0); } Modified: head/sys/net/if_debug.c ============================================================================== --- head/sys/net/if_debug.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/net/if_debug.c Fri Sep 19 09:01:19 2014 (r271856) @@ -79,7 +79,6 @@ if_show_ifnet(struct ifnet *ifp) IF_DB_PRINTF("%p", if_snd.ifq_tail); IF_DB_PRINTF("%d", if_snd.ifq_len); IF_DB_PRINTF("%d", if_snd.ifq_maxlen); - IF_DB_PRINTF("%d", if_snd.ifq_drops); IF_DB_PRINTF("%p", if_snd.ifq_drv_head); IF_DB_PRINTF("%p", if_snd.ifq_drv_tail); IF_DB_PRINTF("%d", if_snd.ifq_drv_len); Modified: head/sys/net/if_epair.c ============================================================================== --- head/sys/net/if_epair.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/net/if_epair.c Fri Sep 19 09:01:19 2014 (r271856) @@ -517,7 +517,7 @@ epair_transmit_locked(struct ifnet *ifp, if (ALTQ_IS_ENABLED(&ifp->if_snd)) { ALTQ_ENQUEUE(&ifp->if_snd, m, NULL, error); if (error) - ifp->if_snd.ifq_drops++; + ifp->if_oqdrops++; IF_UNLOCK(&ifp->if_snd); if (!error) { ifp->if_obytes += len; Modified: head/sys/net/if_mib.c ============================================================================== --- head/sys/net/if_mib.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/net/if_mib.c Fri Sep 19 09:01:19 2014 (r271856) @@ -105,7 +105,8 @@ sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XX ifmd.ifmd_flags = ifp->if_flags | ifp->if_drv_flags; ifmd.ifmd_snd_len = ifp->if_snd.ifq_len; ifmd.ifmd_snd_maxlen = ifp->if_snd.ifq_maxlen; - ifmd.ifmd_snd_drops = ifp->if_snd.ifq_drops; + ifmd.ifmd_snd_drops = + ifp->if_get_counter(ifp, IFCOUNTER_OQDROPS); error = SYSCTL_OUT(req, &ifmd, sizeof ifmd); if (error) Modified: head/sys/net/ifq.h ============================================================================== --- head/sys/net/ifq.h Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/net/ifq.h Fri Sep 19 09:01:19 2014 (r271856) @@ -53,7 +53,6 @@ struct ifqueue { struct mbuf *ifq_tail; int ifq_len; int ifq_maxlen; - int ifq_drops; struct mtx ifq_mtx; }; @@ -68,7 +67,6 @@ struct ifqueue { #define IF_UNLOCK(ifq) mtx_unlock(&(ifq)->ifq_mtx) #define IF_LOCK_ASSERT(ifq) mtx_assert(&(ifq)->ifq_mtx, MA_OWNED) #define _IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) -#define _IF_DROP(ifq) ((ifq)->ifq_drops++) #define _IF_QLEN(ifq) ((ifq)->ifq_len) #define _IF_ENQUEUE(ifq, m) do { \ @@ -171,8 +169,6 @@ do { \ (err) = 0; \ } \ } \ - if (err) \ - (ifq)->ifq_drops++; \ IF_UNLOCK(ifq); \ } while (0) @@ -234,7 +230,6 @@ do { \ #define IFQ_IS_EMPTY(ifq) ((ifq)->ifq_len == 0) #define IFQ_INC_LEN(ifq) ((ifq)->ifq_len++) #define IFQ_DEC_LEN(ifq) (--(ifq)->ifq_len) -#define IFQ_INC_DROPS(ifq) ((ifq)->ifq_drops++) #define IFQ_SET_MAXLEN(ifq, len) ((ifq)->ifq_maxlen = (len)) /* @@ -255,7 +250,8 @@ do { \ (ifp)->if_omcasts++; \ if (((ifp)->if_drv_flags & IFF_DRV_OACTIVE) == 0) \ if_start(ifp); \ - } \ + } else \ + ifp->if_oqdrops++; \ } while (0) #define IFQ_HANDOFF(ifp, m, err) \ @@ -321,6 +317,8 @@ drbr_enqueue(struct ifnet *ifp, struct b #ifdef ALTQ if (ALTQ_IS_ENABLED(&ifp->if_snd)) { IFQ_ENQUEUE(&ifp->if_snd, m, error); + if (error) + ifp->if_oqdrops++; return (error); } #endif Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/net/rtsock.c Fri Sep 19 09:01:19 2014 (r271856) @@ -1577,9 +1577,6 @@ sysctl_iflist_ifml(struct ifnet *ifp, st if_data_copy(ifp, ifd); - /* Some drivers still use ifqueue(9), add its stats. */ - ifd->ifi_oqdrops += ifp->if_snd.ifq_drops; - return (SYSCTL_OUT(w->w_req, (caddr_t)ifm, len)); } @@ -1612,9 +1609,6 @@ sysctl_iflist_ifm(struct ifnet *ifp, str if_data_copy(ifp, ifd); - /* Some drivers still use ifqueue(9), add its stats. */ - ifd->ifi_oqdrops += ifp->if_snd.ifq_drops; - return (SYSCTL_OUT(w->w_req, (caddr_t)ifm, len)); } Modified: head/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c ============================================================================== --- head/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c Fri Sep 19 09:01:19 2014 (r271856) @@ -560,7 +560,6 @@ ng_bt3c_rcvdata(hook_p hook, item_p item NG_BT3C_ERR(sc->dev, "Outgoing queue is full. Dropping mbuf, len=%d\n", m->m_pkthdr.len); - _IF_DROP(&sc->outq); NG_BT3C_STAT_OERROR(sc->stat); NG_FREE_M(m); @@ -939,7 +938,6 @@ bt3c_receive(bt3c_softc_p sc) NG_BT3C_ERR(sc->dev, "Incoming queue is full. Dropping mbuf, len=%d\n", sc->m->m_pkthdr.len); - _IF_DROP(&sc->inq); NG_BT3C_STAT_IERROR(sc->stat); NG_FREE_M(sc->m); Modified: head/sys/netgraph/bluetooth/drivers/h4/ng_h4.c ============================================================================== --- head/sys/netgraph/bluetooth/drivers/h4/ng_h4.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/netgraph/bluetooth/drivers/h4/ng_h4.c Fri Sep 19 09:01:19 2014 (r271856) @@ -798,7 +798,6 @@ ng_h4_rcvdata(hook_p hook, item_p item) NG_NODE_NAME(sc->node), m->m_pkthdr.len); NG_H4_STAT_OERROR(sc->stat); - _IF_DROP(&sc->outq); NG_H4_UNLOCK(sc); Modified: head/sys/netgraph/ng_device.c ============================================================================== --- head/sys/netgraph/ng_device.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/netgraph/ng_device.c Fri Sep 19 09:01:19 2014 (r271856) @@ -270,7 +270,6 @@ ng_device_rcvdata(hook_p hook, item_p it IF_LOCK(&priv->readq); if (_IF_QFULL(&priv->readq)) { - _IF_DROP(&priv->readq); IF_UNLOCK(&priv->readq); NG_FREE_M(m); return (ENOBUFS); Modified: head/sys/netgraph/ng_iface.c ============================================================================== --- head/sys/netgraph/ng_iface.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/netgraph/ng_iface.c Fri Sep 19 09:01:19 2014 (r271856) @@ -393,10 +393,7 @@ ng_iface_output(struct ifnet *ifp, struc if (ALTQ_IS_ENABLED(&ifp->if_snd)) { M_PREPEND(m, sizeof(sa_family_t), M_NOWAIT); if (m == NULL) { - IFQ_LOCK(&ifp->if_snd); - IFQ_INC_DROPS(&ifp->if_snd); - IFQ_UNLOCK(&ifp->if_snd); - if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + if_inc_counter(ifp, IFCOUNTER_OQDROPS, 1); return (ENOBUFS); } *(sa_family_t *)m->m_data = af; Modified: head/sys/netgraph/ng_tty.c ============================================================================== --- head/sys/netgraph/ng_tty.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/netgraph/ng_tty.c Fri Sep 19 09:01:19 2014 (r271856) @@ -327,7 +327,6 @@ ngt_rcvdata(hook_p hook, item_p item) IF_LOCK(&sc->outq); if (_IF_QFULL(&sc->outq)) { - _IF_DROP(&sc->outq); IF_UNLOCK(&sc->outq); NG_FREE_M(m); return (ENOBUFS); Modified: head/sys/netpfil/pf/if_pflog.c ============================================================================== --- head/sys/netpfil/pf/if_pflog.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/netpfil/pf/if_pflog.c Fri Sep 19 09:01:19 2014 (r271856) @@ -159,7 +159,6 @@ pflogstart(struct ifnet *ifp) for (;;) { IF_LOCK(&ifp->if_snd); - _IF_DROP(&ifp->if_snd); _IF_DEQUEUE(&ifp->if_snd, m); IF_UNLOCK(&ifp->if_snd); Modified: head/sys/netpfil/pf/if_pfsync.c ============================================================================== --- head/sys/netpfil/pf/if_pfsync.c Fri Sep 19 07:44:49 2014 (r271855) +++ head/sys/netpfil/pf/if_pfsync.c Fri Sep 19 09:01:19 2014 (r271856) @@ -1640,7 +1640,7 @@ pfsync_sendout(int schedswi) _IF_ENQUEUE(&sc->sc_ifp->if_snd, m); else { m_freem(m); - sc->sc_ifp->if_snd.ifq_drops++; + sc->sc_ifp->if_oqdrops++; } if (schedswi) swi_sched(V_pfsync_swi_cookie, 0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409190901.s8J91KvK096766>