Count the number of miners idled in avalon to account more accurately for when its result return rate is too low.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
diff --git a/driver-avalon.c b/driver-avalon.c
index 92ccf0e..48734ea 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -496,7 +496,6 @@ static void avalon_idle(struct cgpu_info *avalon, struct avalon_info *info)
{
int i;
- info->idle = true;
wait_avalon_ready(avalon);
/* Send idle to all miners */
for (i = 0; i < info->miner_count; i++) {
@@ -504,6 +503,7 @@ static void avalon_idle(struct cgpu_info *avalon, struct avalon_info *info)
if (unlikely(avalon_buffer_full(avalon)))
break;
+ info->idle++;
avalon_init_task(&at, 0, 0, info->fan_pwm, info->timeout,
info->asic_count, info->miner_count, 1, 1,
info->frequency);
@@ -709,9 +709,6 @@ static void avalon_update_temps(struct cgpu_info *avalon, struct avalon_info *in
static void avalon_inc_nvw(struct avalon_info *info, struct thr_info *thr)
{
- if (unlikely(info->idle))
- return;
-
applog(LOG_INFO, "%s%d: No matching work - HW error",
thr->cgpu->drv->name, thr->cgpu->device_id);
@@ -901,7 +898,7 @@ static void *avalon_send_tasks(void *userdata)
while (likely(!avalon->shutdown)) {
int start_count, end_count, i, j, ret;
struct avalon_task at;
- int idled = 0;
+ bool idled = false;
while (avalon_buffer_full(avalon))
cgsem_wait(&info->write_sem);
@@ -941,7 +938,6 @@ static void *avalon_send_tasks(void *userdata)
}
if (likely(j < avalon->queued && !info->overheat && avalon->works[i])) {
- info->idle = false;
avalon_init_task(&at, 0, 0, info->fan_pwm,
info->timeout, info->asic_count,
info->miner_count, 1, 0, info->frequency);
@@ -950,7 +946,8 @@ static void *avalon_send_tasks(void *userdata)
} else {
int idle_freq = info->frequency;
- idled++;
+ if (!info->idle++)
+ idled = true;
if (unlikely(info->overheat && opt_avalon_auto))
idle_freq = AVALON_MIN_FREQUENCY;
avalon_init_task(&at, 0, 0, info->fan_pwm,
@@ -976,8 +973,7 @@ static void *avalon_send_tasks(void *userdata)
pthread_cond_signal(&info->qcond);
mutex_unlock(&info->qlock);
- if (unlikely(idled && !info->idle)) {
- info->idle = true;
+ if (unlikely(idled)) {
applog(LOG_WARNING, "AVA%i: Idled %d miners",
avalon->device_id, idled);
}
@@ -1222,14 +1218,12 @@ static int64_t avalon_scanhash(struct thr_info *thr)
mutex_lock(&info->lock);
hash_count = 0xffffffffull * (uint64_t)info->nonces;
- avalon->results += info->nonces;
+ avalon->results += info->nonces + info->idle;
if (avalon->results > miner_count)
avalon->results = miner_count;
- if (!info->idle && !info->reset)
+ if (!info->reset)
avalon->results -= miner_count / 3;
- else
- avalon->results = miner_count;
- info->nonces = 0;
+ info->nonces = info->idle = 0;
mutex_unlock(&info->lock);
/* Check for nothing but consecutive bad results or consistently less
diff --git a/driver-avalon.h b/driver-avalon.h
index 171f61d..4202c06 100644
--- a/driver-avalon.h
+++ b/driver-avalon.h
@@ -131,7 +131,7 @@ struct avalon_info {
int auto_nonces;
int auto_hw;
- bool idle;
+ int idle;
bool reset;
bool overheat;
bool optimal;