From b115fcc5563e6f9c9b513d44ade7502fb44692f9 Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Mon, 1 Jul 2019 00:44:30 +0000 Subject: reintroduce ifiq_input counting backpressure instead of counting the number of packets on an ifiq, count the number of times a nic has tried to queue packets before the stack processes them. this new semantic interacted badly with virtual interfaces like vlan and trunk, but these interfaces have been tweaked to call if_vinput instead of if_input so their packets are processed directly because theyre already running inside the stack. im putting this in so we can see what the effect is. if it goes badly i'll back it out again. ok cheloha@ proctor@ visa@ --- sys/net/ifq.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'sys') diff --git a/sys/net/ifq.c b/sys/net/ifq.c index c35f33f642e..bd0764e907f 100644 --- a/sys/net/ifq.c +++ b/sys/net/ifq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifq.c,v 1.31 2019/04/16 04:04:19 dlg Exp $ */ +/* $OpenBSD: ifq.c,v 1.32 2019/07/01 00:44:29 dlg Exp $ */ /* * Copyright (c) 2015 David Gwynne @@ -498,8 +498,8 @@ ifiq_destroy(struct ifiqueue *ifiq) ml_purge(&ifiq->ifiq_ml); } -unsigned int ifiq_maxlen_drop = 2048 * 5; -unsigned int ifiq_maxlen_return = 2048 * 3; +unsigned int ifiq_pressure_drop = 8; +unsigned int ifiq_pressure_return = 6; int ifiq_input(struct ifiqueue *ifiq, struct mbuf_list *ml) @@ -508,7 +508,7 @@ ifiq_input(struct ifiqueue *ifiq, struct mbuf_list *ml) struct mbuf *m; uint64_t packets; uint64_t bytes = 0; - unsigned int len; + unsigned int pressure; #if NBPFILTER > 0 caddr_t if_bpf; #endif @@ -552,8 +552,8 @@ ifiq_input(struct ifiqueue *ifiq, struct mbuf_list *ml) ifiq->ifiq_packets += packets; ifiq->ifiq_bytes += bytes; - len = ml_len(&ifiq->ifiq_ml); - if (len > ifiq_maxlen_drop) + pressure = ++ifiq->ifiq_pressure; + if (pressure > ifiq_pressure_drop) ifiq->ifiq_qdrops += ml_len(ml); else ml_enlist(&ifiq->ifiq_ml, ml); @@ -564,7 +564,7 @@ ifiq_input(struct ifiqueue *ifiq, struct mbuf_list *ml) else ml_purge(ml); - return (len > ifiq_maxlen_return); + return (pressure > ifiq_pressure_return); } void @@ -599,6 +599,7 @@ ifiq_process(void *arg) return; mtx_enter(&ifiq->ifiq_mtx); + ifiq->ifiq_pressure = 0; ml = ifiq->ifiq_ml; ml_init(&ifiq->ifiq_ml); mtx_leave(&ifiq->ifiq_mtx); -- cgit v1.2.3