From d932e2640e457a6e6cdb1ada8ce79edb53fc1844 Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Mon, 4 Mar 2019 21:57:17 +0000 Subject: move back to ifiq_input counting packets instead of queue operations. the backpressure seems to have kicked in too early, introducing a lot of packet loss where there wasn't any before. secondly, counting operations interacted extremely badly with pseudo-interfaces. for example, if you have a physical interface that rxes 100 vlan encapsulated packets, it will call ifiq_input once for all 100 packets. when the network stack is running vlan_input against thes packets, vlan_input will take the packet and call ifiq_input against each of them. because the stack is running packets on the parent interface, it can't run the packets on the vlan interface, so you end up with ifiq_input being called 100 times, and we dropped packets after 16 calls to ifiq_input without a matching run of the stack. chris cappuccio hit some weird stuff too. discussed with claudio@ --- sys/net/ifq.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'sys') diff --git a/sys/net/ifq.c b/sys/net/ifq.c index 640c6c151c4..a43716563e5 100644 --- a/sys/net/ifq.c +++ b/sys/net/ifq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifq.c,v 1.27 2019/03/04 21:34:08 dlg Exp $ */ +/* $OpenBSD: ifq.c,v 1.28 2019/03/04 21:57:16 dlg Exp $ */ /* * Copyright (c) 2015 David Gwynne @@ -466,8 +466,8 @@ ifiq_destroy(struct ifiqueue *ifiq) ml_purge(&ifiq->ifiq_ml); } -unsigned int ifiq_pressure_drop = 16; -unsigned int ifiq_pressure_return = 2; +unsigned int ifiq_maxlen_drop = 2048 * 5; +unsigned int ifiq_maxlen_return = 2048 * 3; int ifiq_input(struct ifiqueue *ifiq, struct mbuf_list *ml) @@ -476,7 +476,7 @@ ifiq_input(struct ifiqueue *ifiq, struct mbuf_list *ml) struct mbuf *m; uint64_t packets; uint64_t bytes = 0; - unsigned int pressure; + unsigned int len; #if NBPFILTER > 0 caddr_t if_bpf; #endif @@ -520,8 +520,8 @@ ifiq_input(struct ifiqueue *ifiq, struct mbuf_list *ml) ifiq->ifiq_packets += packets; ifiq->ifiq_bytes += bytes; - pressure = ++ifiq->ifiq_pressure; - if (pressure > ifiq_pressure_drop) + len = ml_len(&ifiq->ifiq_ml); + if (len > ifiq_maxlen_drop) ifiq->ifiq_qdrops += ml_len(ml); else ml_enlist(&ifiq->ifiq_ml, ml); @@ -532,7 +532,7 @@ ifiq_input(struct ifiqueue *ifiq, struct mbuf_list *ml) else ml_purge(ml); - return (pressure > ifiq_pressure_return); + return (len > ifiq_maxlen_return); } void @@ -574,7 +574,6 @@ 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