mirror of
https://github.com/GOSTSec/sgminer
synced 2025-03-13 06:01:03 +00:00
Clear the bitforce buffer whenever we get an unexpected result as it has likely throttled and we are getting cached responses out of order, and use the temperature monitoring as a kind of watchdog to flush unexpected results.
This commit is contained in:
parent
7fa794a499
commit
245552c5b5
@ -157,7 +157,7 @@ static bool bitforce_thread_prepare(struct thr_info *thr)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void biforce_clear_buffer(struct cgpu_info *bitforce)
|
||||
static void bitforce_clear_buffer(struct cgpu_info *bitforce)
|
||||
{
|
||||
int fdDev = bitforce->device_fd;
|
||||
char pdevbuf[0x100];
|
||||
@ -185,7 +185,7 @@ void bitforce_init(struct cgpu_info *bitforce)
|
||||
|
||||
applog(LOG_WARNING, "BFL%i: Re-initialising", bitforce->device_id);
|
||||
|
||||
biforce_clear_buffer(bitforce);
|
||||
bitforce_clear_buffer(bitforce);
|
||||
|
||||
mutex_lock(&bitforce->device_mutex);
|
||||
if (fdDev) {
|
||||
@ -270,7 +270,15 @@ static bool bitforce_get_temp(struct cgpu_info *bitforce)
|
||||
bitforce->dev_thermal_cutoff_count++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Use the temperature monitor as a kind of watchdog for when
|
||||
* our responses are out of sync and flush the buffer to
|
||||
* hopefully recover */
|
||||
applog(LOG_WARNING, "BFL%i: Garbled response probably throttling, clearing buffer");
|
||||
bitforce_clear_buffer(bitforce);
|
||||
return false;;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -305,6 +313,7 @@ re_send:
|
||||
goto re_send;
|
||||
}
|
||||
applog(LOG_ERR, "BFL%i: Error: Send work reports: %s", bitforce->device_id, pdevbuf);
|
||||
bitforce_clear_buffer(bitforce);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -345,6 +354,7 @@ re_send:
|
||||
|
||||
if (unlikely(strncasecmp(pdevbuf, "OK", 2))) {
|
||||
applog(LOG_ERR, "BFL%i: Error: Send block data reports: %s", bitforce->device_id, pdevbuf);
|
||||
bitforce_clear_buffer(bitforce);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -433,6 +443,7 @@ static int64_t bitforce_get_result(struct thr_info *thr, struct work *work)
|
||||
return 0; /* Device idle */
|
||||
else if (strncasecmp(pdevbuf, "NONCE-FOUND", 11)) {
|
||||
applog(LOG_WARNING, "BFL%i: Error: Get result reports: %s", bitforce->device_id, pdevbuf);
|
||||
bitforce_clear_buffer(bitforce);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -521,7 +532,7 @@ static int64_t bitforce_scanhash(struct thr_info *thr, struct work *work, int64_
|
||||
bitforce->device_not_well_reason = REASON_DEV_COMMS_ERROR;
|
||||
bitforce->dev_comms_error_count++;
|
||||
/* empty read buffer */
|
||||
biforce_clear_buffer(bitforce);
|
||||
bitforce_clear_buffer(bitforce);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user