-/* $OpenBSD: ifq.c,v 1.46 2022/04/30 21:13:57 bluhm Exp $ */
+/* $OpenBSD: ifq.c,v 1.47 2022/11/22 03:40:53 dlg Exp $ */
/*
* Copyright (c) 2015 David Gwynne <dlg@openbsd.org>
struct kstat_kv kd_qdrops;
struct kstat_kv kd_errors;
struct kstat_kv kd_qlen;
+
+ struct kstat_kv kd_enqueues;
+ struct kstat_kv kd_dequeues;
};
static const struct ifiq_kstat_data ifiq_kstat_tpl = {
KSTAT_KV_T_COUNTER64, KSTAT_KV_U_PACKETS),
KSTAT_KV_UNIT_INITIALIZER("qlen",
KSTAT_KV_T_UINT32, KSTAT_KV_U_PACKETS),
+
+ KSTAT_KV_INITIALIZER("enqueues",
+ KSTAT_KV_T_COUNTER64),
+ KSTAT_KV_INITIALIZER("dequeues",
+ KSTAT_KV_T_COUNTER64),
};
int
kstat_kv_u64(&kd->kd_errors) = ifiq->ifiq_errors;
kstat_kv_u32(&kd->kd_qlen) = ml_len(&ifiq->ifiq_ml);
+ kstat_kv_u64(&kd->kd_enqueues) = ifiq->ifiq_enqueues;
+ kstat_kv_u64(&kd->kd_dequeues) = ifiq->ifiq_dequeues;
+
return (0);
}
#endif
if (__predict_true(!ISSET(ifp->if_xflags, IFXF_MONITOR))) {
if (len > ifiq_maxlen_drop)
ifiq->ifiq_qdrops += ml_len(ml);
- else
+ else {
+ ifiq->ifiq_enqueues++;
ml_enlist(&ifiq->ifiq_ml, ml);
+ }
}
mtx_leave(&ifiq->ifiq_mtx);
return;
mtx_enter(&ifiq->ifiq_mtx);
+ ifiq->ifiq_dequeues++;
ml = ifiq->ifiq_ml;
ml_init(&ifiq->ifiq_ml);
mtx_leave(&ifiq->ifiq_mtx);
-/* $OpenBSD: ifq.h,v 1.34 2022/01/28 07:11:15 guenther Exp $ */
+/* $OpenBSD: ifq.h,v 1.35 2022/11/22 03:40:53 dlg Exp $ */
/*
* Copyright (c) 2015 David Gwynne <dlg@openbsd.org>
uint64_t ifiq_mcasts;
uint64_t ifiq_noproto;
+ /* number of times a list of packets were put on ifiq_ml */
+ uint64_t ifiq_enqueues;
+ /* number of times a list of packets were pulled off ifiq_ml */
+ uint64_t ifiq_dequeues;
+
struct kstat *ifiq_kstat;
/* properties */