|
|
@ -420,52 +420,50 @@ static uint64_t bitforce_scanhash(struct thr_info *thr, struct work *work, uint6 |
|
|
|
struct cgpu_info *bitforce = thr->cgpu; |
|
|
|
struct cgpu_info *bitforce = thr->cgpu; |
|
|
|
unsigned int sleep_time; |
|
|
|
unsigned int sleep_time; |
|
|
|
struct timeval tdiff; |
|
|
|
struct timeval tdiff; |
|
|
|
uint64_t ret = 1; |
|
|
|
uint64_t ret; |
|
|
|
|
|
|
|
|
|
|
|
while (bitforce->end_nonce < 0xffffffff) { |
|
|
|
bitforce->wait_ms = 0; |
|
|
|
bitforce->wait_ms = 0; |
|
|
|
ret = bitforce_send_work(thr, work); |
|
|
|
ret = bitforce_send_work(thr, work); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!bitforce->nonce_range) { |
|
|
|
if (!bitforce->nonce_range) { |
|
|
|
/* Initially wait 2/3 of the average cycle time so we can request more
|
|
|
|
/* Initially wait 2/3 of the average cycle time so we can request more
|
|
|
|
work before full scan is up */ |
|
|
|
work before full scan is up */ |
|
|
|
sleep_time = (2 * bitforce->sleep_ms) / 3; |
|
|
|
sleep_time = (2 * bitforce->sleep_ms) / 3; |
|
|
|
ms_to_timeval(sleep_time, &tdiff); |
|
|
|
ms_to_timeval(sleep_time, &tdiff); |
|
|
|
if (!restart_wait(&tdiff)) |
|
|
|
if (!restart_wait(&tdiff)) |
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
|
|
|
|
|
|
|
|
bitforce->wait_ms += sleep_time; |
|
|
|
bitforce->wait_ms += sleep_time; |
|
|
|
queue_request(thr, false); |
|
|
|
queue_request(thr, false); |
|
|
|
|
|
|
|
|
|
|
|
/* Now wait athe final 1/3rd; no bitforce should be finished by now */ |
|
|
|
/* Now wait athe final 1/3rd; no bitforce should be finished by now */ |
|
|
|
sleep_time = bitforce->sleep_ms - sleep_time; |
|
|
|
sleep_time = bitforce->sleep_ms - sleep_time; |
|
|
|
ms_to_timeval(sleep_time, &tdiff); |
|
|
|
ms_to_timeval(sleep_time, &tdiff); |
|
|
|
if (!restart_wait(&tdiff)) |
|
|
|
if (!restart_wait(&tdiff)) |
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
|
|
|
|
|
|
|
|
bitforce->wait_ms += sleep_time; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
sleep_time = bitforce->sleep_ms; |
|
|
|
|
|
|
|
ms_to_timeval(sleep_time, &tdiff); |
|
|
|
|
|
|
|
if (!restart_wait(&tdiff)) |
|
|
|
|
|
|
|
return 1; |
|
|
|
|
|
|
|
/* queue extra request once more than 2/3 is done */ |
|
|
|
|
|
|
|
if (work->blk.nonce > 0xffffffff / 3 * 2) |
|
|
|
|
|
|
|
queue_request(thr, false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ret) |
|
|
|
|
|
|
|
ret = bitforce_get_result(thr, work); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!ret) { |
|
|
|
bitforce->wait_ms += sleep_time; |
|
|
|
applog(LOG_ERR, "BFL%i: Comms error", bitforce->device_id); |
|
|
|
} else { |
|
|
|
bitforce->device_last_not_well = time(NULL); |
|
|
|
sleep_time = bitforce->sleep_ms; |
|
|
|
bitforce->device_not_well_reason = REASON_DEV_COMMS_ERROR; |
|
|
|
ms_to_timeval(sleep_time, &tdiff); |
|
|
|
bitforce->dev_comms_error_count++; |
|
|
|
if (!restart_wait(&tdiff)) |
|
|
|
/* empty read buffer */ |
|
|
|
|
|
|
|
biforce_clear_buffer(bitforce); |
|
|
|
|
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
} |
|
|
|
/* queue extra request once more than 2/3 is done */ |
|
|
|
|
|
|
|
if (work->blk.nonce > 0xffffffff / 3 * 2) |
|
|
|
|
|
|
|
queue_request(thr, false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ret) |
|
|
|
|
|
|
|
ret = bitforce_get_result(thr, work); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!ret) { |
|
|
|
|
|
|
|
ret = 1; |
|
|
|
|
|
|
|
applog(LOG_ERR, "BFL%i: Comms error", bitforce->device_id); |
|
|
|
|
|
|
|
bitforce->device_last_not_well = time(NULL); |
|
|
|
|
|
|
|
bitforce->device_not_well_reason = REASON_DEV_COMMS_ERROR; |
|
|
|
|
|
|
|
bitforce->dev_comms_error_count++; |
|
|
|
|
|
|
|
/* empty read buffer */ |
|
|
|
|
|
|
|
biforce_clear_buffer(bitforce); |
|
|
|
} |
|
|
|
} |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
|