Commit 499b25068c40b28fb90fdf9c0358a9b7d7024113

Con Kolivas 2013-05-27T01:29:57

Reset avalon if we continue to be unable to send all the work items.

diff --git a/driver-avalon.c b/driver-avalon.c
index ff17640..b81161b 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -621,9 +621,8 @@ static void avalon_parse_results(struct cgpu_info *avalon, struct avalon_info *i
 
 			if (avalon_decode_nonce(thr, avalon, info, ar, work)) {
 				mutex_lock(&info->lock);
-				if (avalon->results < 0)
-					avalon->results = 0;
-				if (!(++avalon->results % info->miner_count)) {
+				if (++avalon->results > 0 &&
+				    !(avalon->results % info->miner_count)) {
 					gettemp = true;
 					avalon->results = 0;
 				}
@@ -689,7 +688,7 @@ static void *avalon_get_results(void *userdata)
 
 		/* Check for nothing but consecutive bad results and reset the
 		 * FPGA if necessary */
-		if (unlikely(avalon->results < -info->miner_count)) {
+		if (unlikely(avalon->results <= -info->miner_count)) {
 			applog(LOG_ERR, "AVA%d: %d invalid consecutive results, resetting",
 			       avalon->device_id, -avalon->results);
 			avalon_reset(avalon, fd);
@@ -766,6 +765,7 @@ static void *avalon_send_tasks(void *userdata)
 				applog(LOG_WARNING,
 				       "AVA%i: Buffer full before all work queued",
 					avalon->device_id);
+				avalon->results -= avalon_get_work_count - j;
 				break;
 			}