Browse Source

Make the detection of all wrong results on avalon much more conservative to avoid false positives on work restarts.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
8b0531fb2b
  1. 15
      driver-avalon.c

15
driver-avalon.c

@ -824,7 +824,7 @@ static int64_t avalon_scanhash(struct thr_info *thr)
uint32_t nonce; uint32_t nonce;
int64_t hash_count; int64_t hash_count;
static int first_try = 0; static int first_try = 0;
int result_count, result_wrong; int result_wrong;
avalon = thr->cgpu; avalon = thr->cgpu;
works = avalon->works; works = avalon->works;
@ -886,7 +886,6 @@ static int64_t avalon_scanhash(struct thr_info *thr)
elapsed.tv_sec = elapsed.tv_usec = 0; elapsed.tv_sec = elapsed.tv_usec = 0;
gettimeofday(&tv_start, NULL); gettimeofday(&tv_start, NULL);
result_count = 0;
result_wrong = 0; result_wrong = 0;
hash_count = 0; hash_count = 0;
while (true) { while (true) {
@ -904,20 +903,14 @@ static int64_t avalon_scanhash(struct thr_info *thr)
dev_error(avalon, REASON_DEV_COMMS_ERROR); dev_error(avalon, REASON_DEV_COMMS_ERROR);
return 0; return 0;
} }
if (unlikely(ret == AVA_GETS_RESTART)) { if (unlikely(ret == AVA_GETS_RESTART))
/* Reset the wrong count in case there has only been
* a small number of nonces tested before the restart.
*/
result_wrong = 0;
break; break;
}
if (unlikely(ret == AVA_GETS_TIMEOUT)) { if (unlikely(ret == AVA_GETS_TIMEOUT)) {
timersub(&tv_finish, &tv_start, &elapsed); timersub(&tv_finish, &tv_start, &elapsed);
applog(LOG_DEBUG, "Avalon: no nonce in (%ld.%06lds)", applog(LOG_DEBUG, "Avalon: no nonce in (%ld.%06lds)",
elapsed.tv_sec, elapsed.tv_usec); elapsed.tv_sec, elapsed.tv_usec);
continue; continue;
} }
result_count++;
if (!avalon_decode_nonce(thr, &ar, &nonce)) { if (!avalon_decode_nonce(thr, &ar, &nonce)) {
info->no_matching_work++; info->no_matching_work++;
@ -941,8 +934,8 @@ static int64_t avalon_scanhash(struct thr_info *thr)
elapsed.tv_sec, elapsed.tv_usec); elapsed.tv_sec, elapsed.tv_usec);
} }
} }
if (result_wrong && result_count == result_wrong) { if (result_wrong >= info->miner_count) {
/* This mean FPGA controller give all wrong result /* This mean FPGA controller gave all wrong results, so
* try to reset the Avalon */ * try to reset the Avalon */
do_avalon_close(thr); do_avalon_close(thr);
applog(LOG_ERR, applog(LOG_ERR,

Loading…
Cancel
Save