diff options
author | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2017-03-09 20:15:37 +0000 |
---|---|---|
committer | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2017-03-09 20:15:37 +0000 |
commit | b9fb8fd5379d1eb104ccfa4b9b51806f5cb2b329 (patch) | |
tree | 00d647e1e267258356172fb55d0f650af93b1bc9 /sys | |
parent | 9573392f314dffe3fc437f0951d61c2df69eb485 (diff) |
Fix an off by one when updating the TX consumer event index
The transmit completion notification is posted when the consumer index
becomes equal to the consumer event index. The code attempted to save
up on an update if the current value of the consumer index was below
its event index, but incorrectly handled the situation when they were
equal: the consumer event index wouldn't be advanced and the ring would
stall.
With help from Jan Schreiber who asked some good questions.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pv/if_xnf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/pv/if_xnf.c b/sys/dev/pv/if_xnf.c index 71db795b43f..0d7a605287c 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.51 2017/02/24 16:58:12 mikeb Exp $ */ +/* $OpenBSD: if_xnf.c,v 1.52 2017/03/09 20:15:36 mikeb Exp $ */ /* * Copyright (c) 2015, 2016 Mike Belopuhov @@ -525,7 +525,7 @@ xnf_start(struct ifqueue *ifq) } if (pkts > 0) { txr->txr_prod = prod; - if (txr->txr_cons_event < txr->txr_cons) + if (txr->txr_cons_event <= txr->txr_cons) txr->txr_cons_event = txr->txr_cons + ((txr->txr_prod - txr->txr_cons) >> 1) + 1; bus_dmamap_sync(sc->sc_dmat, sc->sc_tx_rmap, 0, 0, |