|
@@ -929,6 +929,7 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
|
|
+keepwaiting:
|
|
|
/* Icarus will return 4 bytes (ICARUS_READ_SIZE) nonces or nothing */
|
|
/* Icarus will return 4 bytes (ICARUS_READ_SIZE) nonces or nothing */
|
|
|
ret = icarus_gets((void*)&nonce, fd, &state->tv_workfinish, thr, info->read_count);
|
|
ret = icarus_gets((void*)&nonce, fd, &state->tv_workfinish, thr, info->read_count);
|
|
|
switch (ret) {
|
|
switch (ret) {
|
|
@@ -969,18 +970,25 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
|
|
|
tcflush(fd, TCOFLUSH);
|
|
tcflush(fd, TCOFLUSH);
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
|
|
+ if (ret == ICA_GETS_OK)
|
|
|
|
|
+ {
|
|
|
|
|
+ nonce_work = icarus_process_worknonce(state, &nonce);
|
|
|
|
|
+ if (nonce_work == state->last2_work)
|
|
|
|
|
+ {
|
|
|
|
|
+ // nonce was for the last job; submit and keep processing the current one
|
|
|
|
|
+ submit_nonce(thr, nonce_work, nonce);
|
|
|
|
|
+ goto keepwaiting;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// Handle dynamic clocking for "subclass" devices
|
|
// Handle dynamic clocking for "subclass" devices
|
|
|
// This needs to run before sending next job, since it hashes the command too
|
|
// This needs to run before sending next job, since it hashes the command too
|
|
|
if (info->dclk.freqM && likely(ret == ICA_GETS_OK || ret == ICA_GETS_TIMEOUT)) {
|
|
if (info->dclk.freqM && likely(ret == ICA_GETS_OK || ret == ICA_GETS_TIMEOUT)) {
|
|
|
int qsec = ((4 * elapsed.tv_sec) + (elapsed.tv_usec / 250000)) ?: 1;
|
|
int qsec = ((4 * elapsed.tv_sec) + (elapsed.tv_usec / 250000)) ?: 1;
|
|
|
for (int n = qsec; n; --n)
|
|
for (int n = qsec; n; --n)
|
|
|
dclk_gotNonces(&info->dclk);
|
|
dclk_gotNonces(&info->dclk);
|
|
|
- if (ret == ICA_GETS_OK)
|
|
|
|
|
- {
|
|
|
|
|
- nonce_work = icarus_process_worknonce(state, &nonce);
|
|
|
|
|
- if (!nonce_work)
|
|
|
|
|
- dclk_errorCount(&info->dclk, qsec);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (ret == ICA_GETS_OK && !nonce_work)
|
|
|
|
|
+ dclk_errorCount(&info->dclk, qsec);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (unlikely(state->identify))
|
|
if (unlikely(state->identify))
|
|
@@ -1032,9 +1040,6 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
|
|
|
|
|
|
|
|
// Only ICA_GETS_OK gets here
|
|
// Only ICA_GETS_OK gets here
|
|
|
|
|
|
|
|
- if (!info->dclk.freqM)
|
|
|
|
|
- nonce_work = icarus_process_worknonce(state, &nonce);
|
|
|
|
|
-
|
|
|
|
|
was_hw_error = (!nonce_work);
|
|
was_hw_error = (!nonce_work);
|
|
|
if (likely(!was_hw_error))
|
|
if (likely(!was_hw_error))
|
|
|
submit_nonce(thr, nonce_work, nonce);
|
|
submit_nonce(thr, nonce_work, nonce);
|