mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-25 14:04:25 +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;
|
struct cgpu_info *bitforce = thr->cgpu;
|
||||||
unsigned int sleep_time;
|
unsigned int sleep_time;
|
||||||
struct timeval tdiff;
|
struct timeval tdiff;
|
||||||
uint64_t ret;
|
uint64_t ret = 1;
|
||||||
|
|
||||||
bitforce->wait_ms = 0;
|
while (bitforce->end_nonce < 0xffffffff) {
|
||||||
ret = bitforce_send_work(thr, work);
|
bitforce->wait_ms = 0;
|
||||||
|
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);
|
|
||||||
|
|
||||||
/* 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)
|
|
||||||
queue_request(thr, false);
|
queue_request(thr, false);
|
||||||
}
|
|
||||||
|
|
||||||
if (ret)
|
/* Now wait athe final 1/3rd; no bitforce should be finished by now */
|
||||||
ret = bitforce_get_result(thr, work);
|
sleep_time = bitforce->sleep_ms - sleep_time;
|
||||||
|
ms_to_timeval(sleep_time, &tdiff);
|
||||||
|
if (!restart_wait(&tdiff))
|
||||||
|
return 1;
|
||||||
|
|
||||||
if (!ret) {
|
bitforce->wait_ms += sleep_time;
|
||||||
ret = 1;
|
} else {
|
||||||
applog(LOG_ERR, "BFL%i: Comms error", bitforce->device_id);
|
sleep_time = bitforce->sleep_ms;
|
||||||
bitforce->device_last_not_well = time(NULL);
|
ms_to_timeval(sleep_time, &tdiff);
|
||||||
bitforce->device_not_well_reason = REASON_DEV_COMMS_ERROR;
|
if (!restart_wait(&tdiff))
|
||||||
bitforce->dev_comms_error_count++;
|
return 1;
|
||||||
/* empty read buffer */
|
/* queue extra request once more than 2/3 is done */
|
||||||
biforce_clear_buffer(bitforce);
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user