summaryrefslogtreecommitdiff
path: root/sys/net/ifq.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2022-11-22 03:40:54 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2022-11-22 03:40:54 +0000
commit708a24532923ad487ba7936bcf178faf627c7335 (patch)
tree00fc7b7905dbec06bdaa522134a4a76ba6e3c1b5 /sys/net/ifq.c
parent2d0464d1b725d0948567e42d25bf5d912525a3c5 (diff)
count how many times ifiqs enqueue and dequeue packets.
network cards try to enqueue a list of packets on an ifiq once per interrupt and ifiqs already count how many packets they're handling. this let's us see how well interrupt mitigation is working on a ring or interface. ifiqs are supposed to provide backpressure signalling to a driver if it enqueues a lot more work than it's able to process in softnet, so recording dequeues let's us see this ratio.
Diffstat (limited to 'sys/net/ifq.c')
-rw-r--r--sys/net/ifq.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/net/ifq.c b/sys/net/ifq.c
index 26ac1701b9d..99777327d73 100644
--- a/sys/net/ifq.c
+++ b/sys/net/ifq.c
@@ -1,4 +1,4 @@
-/* $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>
@@ -582,6 +582,9 @@ struct ifiq_kstat_data {
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 = {
@@ -595,6 +598,11 @@ 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
@@ -610,6 +618,9 @@ ifiq_kstat_copy(struct kstat *ks, void *dst)
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
@@ -721,8 +732,10 @@ ifiq_input(struct ifiqueue *ifiq, struct mbuf_list *ml)
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);
@@ -766,6 +779,7 @@ ifiq_process(void *arg)
return;
mtx_enter(&ifiq->ifiq_mtx);
+ ifiq->ifiq_dequeues++;
ml = ifiq->ifiq_ml;
ml_init(&ifiq->ifiq_ml);
mtx_leave(&ifiq->ifiq_mtx);