|
@@ -653,6 +653,7 @@ void bitforce_job_get_results(struct thr_info *thr, struct work *work)
|
|
|
struct timeval now;
|
|
struct timeval now;
|
|
|
char *pdevbuf = &data->noncebuf[0];
|
|
char *pdevbuf = &data->noncebuf[0];
|
|
|
bool stale;
|
|
bool stale;
|
|
|
|
|
+ int count;
|
|
|
|
|
|
|
|
gettimeofday(&now, NULL);
|
|
gettimeofday(&now, NULL);
|
|
|
timersub(&now, &bitforce->work_start_tv, &elapsed);
|
|
timersub(&now, &bitforce->work_start_tv, &elapsed);
|
|
@@ -680,7 +681,6 @@ void bitforce_job_get_results(struct thr_info *thr, struct work *work)
|
|
|
|
|
|
|
|
while (1) {
|
|
while (1) {
|
|
|
const char *cmd = (data->proto == BFP_QUEUE) ? "ZOX" : "ZFX";
|
|
const char *cmd = (data->proto == BFP_QUEUE) ? "ZOX" : "ZFX";
|
|
|
- int count;
|
|
|
|
|
mutex_lock(mutexp);
|
|
mutex_lock(mutexp);
|
|
|
bitforce_cmd1(fdDev, bitforce->proc_id, pdevbuf, sizeof(data->noncebuf), cmd);
|
|
bitforce_cmd1(fdDev, bitforce->proc_id, pdevbuf, sizeof(data->noncebuf), cmd);
|
|
|
if (!strncasecmp(pdevbuf, "COUNT:", 6))
|
|
if (!strncasecmp(pdevbuf, "COUNT:", 6))
|
|
@@ -731,12 +731,6 @@ void bitforce_job_get_results(struct thr_info *thr, struct work *work)
|
|
|
goto out;
|
|
goto out;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (count > 0)
|
|
|
|
|
- {
|
|
|
|
|
- applog(LOG_DEBUG, "%"PRIpreprv": waited %dms until %s", bitforce->proc_repr, bitforce->wait_ms, pdevbuf);
|
|
|
|
|
- goto out;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
if (pdevbuf[0] && strncasecmp(pdevbuf, "B", 1)) /* BFL does not respond during throttling */
|
|
if (pdevbuf[0] && strncasecmp(pdevbuf, "B", 1)) /* BFL does not respond during throttling */
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
@@ -755,6 +749,13 @@ noqr:
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (count < 0 && pdevbuf[0] == 'N')
|
|
|
|
|
+ count = strncasecmp(pdevbuf, "NONCE-FOUND", 11) ? 1 : 0;
|
|
|
|
|
+ // At this point, 'count' is:
|
|
|
|
|
+ // negative, in case of some kind of error
|
|
|
|
|
+ // zero, if NO-NONCE (FPGA either completed with no results, or rebooted)
|
|
|
|
|
+ // positive, if at least one job completed successfully
|
|
|
|
|
+
|
|
|
if (elapsed.tv_sec > BITFORCE_TIMEOUT_S) {
|
|
if (elapsed.tv_sec > BITFORCE_TIMEOUT_S) {
|
|
|
applog(LOG_ERR, "%"PRIpreprv": took %lums - longer than %lums", bitforce->proc_repr,
|
|
applog(LOG_ERR, "%"PRIpreprv": took %lums - longer than %lums", bitforce->proc_repr,
|
|
|
tv_to_ms(elapsed), (unsigned long)BITFORCE_TIMEOUT_MS);
|
|
tv_to_ms(elapsed), (unsigned long)BITFORCE_TIMEOUT_MS);
|
|
@@ -766,9 +767,9 @@ noqr:
|
|
|
* are no results. But check first, just in case we're wrong about it
|
|
* are no results. But check first, just in case we're wrong about it
|
|
|
* throttling.
|
|
* throttling.
|
|
|
*/
|
|
*/
|
|
|
- if (strncasecmp(pdevbuf, "NONCE-FOUND", 11))
|
|
|
|
|
|
|
+ if (count > 0)
|
|
|
goto out;
|
|
goto out;
|
|
|
- } else if (!strncasecmp(pdevbuf, "N", 1)) {/* Hashing complete (NONCE-FOUND or NO-NONCE) */
|
|
|
|
|
|
|
+ } else if (count >= 0) {/* Hashing complete (NONCE-FOUND or NO-NONCE) */
|
|
|
/* Simple timing adjustment. Allow a few polls to cope with
|
|
/* Simple timing adjustment. Allow a few polls to cope with
|
|
|
* OS timer delays being variably reliable. wait_ms will
|
|
* OS timer delays being variably reliable. wait_ms will
|
|
|
* always equal sleep_ms when we've waited greater than or
|
|
* always equal sleep_ms when we've waited greater than or
|
|
@@ -793,7 +794,7 @@ noqr:
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
applog(LOG_DEBUG, "%"PRIpreprv": waited %dms until %s", bitforce->proc_repr, bitforce->wait_ms, pdevbuf);
|
|
applog(LOG_DEBUG, "%"PRIpreprv": waited %dms until %s", bitforce->proc_repr, bitforce->wait_ms, pdevbuf);
|
|
|
- if (strncasecmp(pdevbuf, "NONCE-FOUND", 11) && (pdevbuf[2] != '-') && strncasecmp(pdevbuf, "I", 1)) {
|
|
|
|
|
|
|
+ if (count < 0 && strncasecmp(pdevbuf, "I", 1)) {
|
|
|
bitforce->hw_errors++;
|
|
bitforce->hw_errors++;
|
|
|
++hw_errors;
|
|
++hw_errors;
|
|
|
applog(LOG_WARNING, "%"PRIpreprv": Error: Get result reports: %s", bitforce->proc_repr, pdevbuf);
|
|
applog(LOG_WARNING, "%"PRIpreprv": Error: Get result reports: %s", bitforce->proc_repr, pdevbuf);
|