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.
This commit is contained in:
parent
35163b6c15
commit
56b61ca27a
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -2408,7 +2408,6 @@ static int ng_ce_rcvdata (hook_p hook, struct mbuf *m, meta_p meta)
|
||||
#if __FreeBSD_version >= 500000
|
||||
IF_LOCK (q);
|
||||
if (_IF_QFULL (q)) {
|
||||
_IF_DROP (q);
|
||||
IF_UNLOCK (q);
|
||||
CE_UNLOCK (bd);
|
||||
splx (s);
|
||||
|
@ -2141,7 +2141,6 @@ static int ng_cp_rcvdata (hook_p hook, item_p item)
|
||||
CP_LOCK (bd);
|
||||
IF_LOCK (q);
|
||||
if (_IF_QFULL (q)) {
|
||||
_IF_DROP (q);
|
||||
IF_UNLOCK (q);
|
||||
CP_UNLOCK (bd);
|
||||
splx (s);
|
||||
|
@ -2083,7 +2083,6 @@ static int ng_ct_rcvdata (hook_p hook, item_p item)
|
||||
CT_LOCK (bd);
|
||||
IF_LOCK (q);
|
||||
if (_IF_QFULL (q)) {
|
||||
_IF_DROP (q);
|
||||
IF_UNLOCK (q);
|
||||
CT_UNLOCK (bd);
|
||||
splx (s);
|
||||
|
@ -2421,7 +2421,6 @@ static int ng_cx_rcvdata (hook_p hook, item_p item)
|
||||
CX_LOCK (bd);
|
||||
IF_LOCK (q);
|
||||
if (_IF_QFULL (q)) {
|
||||
_IF_DROP (q);
|
||||
IF_UNLOCK (q);
|
||||
CX_UNLOCK (bd);
|
||||
splx (s);
|
||||
|
@ -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 +
|
||||
|
@ -4635,6 +4635,7 @@ lmc_raw_output(struct ifnet *ifp, struct mbuf *m,
|
||||
{
|
||||
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);
|
||||
|
@ -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;
|
||||
|
@ -3521,8 +3521,8 @@ if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, int adjust)
|
||||
|
||||
IF_LOCK(ifq);
|
||||
if (_IF_QFULL(ifq)) {
|
||||
_IF_DROP(ifq);
|
||||
IF_UNLOCK(ifq);
|
||||
ifp->if_oqdrops++;
|
||||
m_freem(m);
|
||||
return (0);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -517,7 +517,7 @@ epair_transmit_locked(struct ifnet *ifp, struct mbuf *m)
|
||||
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;
|
||||
|
@ -105,7 +105,8 @@ sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XXX bad syntax! */
|
||||
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)
|
||||
|
@ -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 buf_ring *br, struct mbuf *m)
|
||||
#ifdef ALTQ
|
||||
if (ALTQ_IS_ENABLED(&ifp->if_snd)) {
|
||||
IFQ_ENQUEUE(&ifp->if_snd, m, error);
|
||||
if (error)
|
||||
ifp->if_oqdrops++;
|
||||
return (error);
|
||||
}
|
||||
#endif
|
||||
|
@ -1577,9 +1577,6 @@ sysctl_iflist_ifml(struct ifnet *ifp, struct rt_addrinfo *info,
|
||||
|
||||
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, struct rt_addrinfo *info,
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -270,7 +270,6 @@ ng_device_rcvdata(hook_p hook, item_p item)
|
||||
|
||||
IF_LOCK(&priv->readq);
|
||||
if (_IF_QFULL(&priv->readq)) {
|
||||
_IF_DROP(&priv->readq);
|
||||
IF_UNLOCK(&priv->readq);
|
||||
NG_FREE_M(m);
|
||||
return (ENOBUFS);
|
||||
|
@ -393,10 +393,7 @@ ng_iface_output(struct ifnet *ifp, struct mbuf *m,
|
||||
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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user