summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormikeb <mikeb@openbsd.org>2016-07-29 18:31:22 +0000
committermikeb <mikeb@openbsd.org>2016-07-29 18:31:22 +0000
commite9fd943502925210d46ad635c5dec91983a6d08b (patch)
tree907b9cd39b9e2e0550ad648944d032f07d298a2a /sys
parentmax name servers is currently 5, not 3, apparently; (diff)
downloadwireguard-openbsd-e9fd943502925210d46ad635c5dec91983a6d08b.tar.xz
wireguard-openbsd-e9fd943502925210d46ad635c5dec91983a6d08b.zip
Reduce the amount of sent TX producer notifications; from FreeBSD
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pv/if_xnf.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/pv/if_xnf.c b/sys/dev/pv/if_xnf.c
index 1d8f2c4498f..35804176cc1 100644
--- a/sys/dev/pv/if_xnf.c
+++ b/sys/dev/pv/if_xnf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_xnf.c,v 1.24 2016/07/28 17:35:13 mikeb Exp $ */
+/* $OpenBSD: if_xnf.c,v 1.25 2016/07/29 18:31:22 mikeb Exp $ */
/*
* Copyright (c) 2015, 2016 Mike Belopuhov
@@ -468,7 +468,7 @@ xnf_start(struct ifnet *ifp)
struct xnf_tx_ring *txr = sc->sc_tx_ring;
struct mbuf *m;
int pkts = 0;
- uint32_t prod;
+ uint32_t prod, oprod;
if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
@@ -476,7 +476,7 @@ xnf_start(struct ifnet *ifp)
bus_dmamap_sync(sc->sc_dmat, sc->sc_tx_rmap, 0, 0,
BUS_DMASYNC_POSTREAD);
- prod = txr->txr_prod;
+ prod = oprod = txr->txr_prod;
for (;;) {
if ((XNF_TX_DESC - (prod - sc->sc_tx_cons)) <
@@ -505,7 +505,10 @@ xnf_start(struct ifnet *ifp)
}
if (pkts > 0) {
txr->txr_prod = prod;
- xen_intr_signal(sc->sc_xih);
+ bus_dmamap_sync(sc->sc_dmat, sc->sc_tx_rmap, 0, 0,
+ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+ if (prod - txr->txr_prod_event < prod - oprod)
+ xen_intr_signal(sc->sc_xih);
ifp->if_timer = 5;
}
}