mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Loop in bitforce scanhash till end nonce reaches full nonce range.
This commit is contained in:
parent
1f2e9a49f4
commit
e10aa2092b
@ -420,50 +420,52 @@ static uint64_t bitforce_scanhash(struct thr_info *thr, struct work *work, uint6
|
||||
struct cgpu_info *bitforce = thr->cgpu;
|
||||
unsigned int sleep_time;
|
||||
struct timeval tdiff;
|
||||
uint64_t ret;
|
||||
uint64_t ret = 1;
|
||||
|
||||
bitforce->wait_ms = 0;
|
||||
ret = bitforce_send_work(thr, work);
|
||||
while (bitforce->end_nonce < 0xffffffff) {
|
||||
bitforce->wait_ms = 0;
|
||||
ret = bitforce_send_work(thr, work);
|
||||
|
||||
if (!bitforce->nonce_range) {
|
||||
/* Initially wait 2/3 of the average cycle time so we can request more
|
||||
work before full scan is up */
|
||||
sleep_time = (2 * bitforce->sleep_ms) / 3;
|
||||
ms_to_timeval(sleep_time, &tdiff);
|
||||
if (!restart_wait(&tdiff))
|
||||
return 1;
|
||||
if (!bitforce->nonce_range) {
|
||||
/* Initially wait 2/3 of the average cycle time so we can request more
|
||||
work before full scan is up */
|
||||
sleep_time = (2 * bitforce->sleep_ms) / 3;
|
||||
ms_to_timeval(sleep_time, &tdiff);
|
||||
if (!restart_wait(&tdiff))
|
||||
return 1;
|
||||
|
||||
bitforce->wait_ms += sleep_time;
|
||||
queue_request(thr, false);
|
||||
|
||||
/* Now wait athe final 1/3rd; no bitforce should be finished by now */
|
||||
sleep_time = bitforce->sleep_ms - sleep_time;
|
||||
ms_to_timeval(sleep_time, &tdiff);
|
||||
if (!restart_wait(&tdiff))
|
||||
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)
|
||||
bitforce->wait_ms += sleep_time;
|
||||
queue_request(thr, false);
|
||||
}
|
||||
|
||||
if (ret)
|
||||
ret = bitforce_get_result(thr, work);
|
||||
/* Now wait athe final 1/3rd; no bitforce should be finished by now */
|
||||
sleep_time = bitforce->sleep_ms - sleep_time;
|
||||
ms_to_timeval(sleep_time, &tdiff);
|
||||
if (!restart_wait(&tdiff))
|
||||
return 1;
|
||||
|
||||
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);
|
||||
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) {
|
||||
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 1;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user