From 4530a74e0b0ad54f4121cc55acd195399bc6f690 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sun, 9 Jun 2013 21:52:42 +1000 Subject: [PATCH] Only return one nonce range per device per cycle through scanwork in bflsc to avoid batching of result count. --- driver-bflsc.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/driver-bflsc.c b/driver-bflsc.c index b72d3e14..457cc8c7 100644 --- a/driver-bflsc.c +++ b/driver-bflsc.c @@ -59,7 +59,7 @@ struct bflsc_dev { int work_complete; int nonces_hw; // TODO: this - need to add a paramter to submit_nonce() // so can pass 'dev' to hw_error - uint64_t hashes_unsent; + uint64_t nonces_unsent; uint64_t hashes_sent; uint64_t nonces_found; @@ -1360,7 +1360,7 @@ static void process_nonces(struct cgpu_info *bflsc, int dev, char *xlink, char * if (res) sc_info->sc_devs[dev].result_id++; sc_info->sc_devs[dev].work_complete++; - sc_info->sc_devs[dev].hashes_unsent += FULLNONCE; + sc_info->sc_devs[dev].nonces_unsent++; // If not flushed (stale) if (!(work->devflag)) sc_info->sc_devs[dev].work_queued -= 1; @@ -1698,10 +1698,10 @@ static int64_t bflsc_scanwork(struct thr_info *thr) { struct cgpu_info *bflsc = thr->cgpu; struct bflsc_info *sc_info = (struct bflsc_info *)(bflsc->device_data); - int64_t ret, unsent; - bool flushed, cleanup; struct work *work, *tmp; + bool flushed, cleanup; int dev, waited, i; + int64_t ret; // Device is gone if (bflsc->usbinfo.nodev) @@ -1791,11 +1791,14 @@ static int64_t bflsc_scanwork(struct thr_info *thr) ret = 0; wr_lock(&(sc_info->stat_lock)); for (dev = 0; dev < sc_info->sc_count; dev++) { - unsent = sc_info->sc_devs[dev].hashes_unsent; - sc_info->sc_devs[dev].hashes_unsent = 0; - sc_info->sc_devs[dev].hashes_sent += unsent; - sc_info->hashes_sent += unsent; - ret += unsent; + /* Only return one nonce range per cycle through scanwork to + * avoid batching of results during downtime. */ + if (sc_info->sc_devs[dev].nonces_unsent) { + sc_info->sc_devs[dev].nonces_unsent--; + sc_info->sc_devs[dev].hashes_sent += FULLNONCE; + sc_info->hashes_sent += FULLNONCE; + ret += FULLNONCE; + } } wr_unlock(&(sc_info->stat_lock));