summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2019-03-04 21:57:17 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2019-03-04 21:57:17 +0000
commitd932e2640e457a6e6cdb1ada8ce79edb53fc1844 (patch)
tree6b806ed168f008133968965ae1cf2191a67ff964 /sys
parent2d2e21a682804d2d1624fc465a5b11736c05ac56 (diff)
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@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/ifq.c15
1 files changed, 7 insertions, 8 deletions
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 <dlg@openbsd.org>
@@ -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);