Browse Source

rockminer: When we detect a task failure, check if we ought to grab a new work rather than resend

Luke Dashjr 11 years ago
parent
commit
ae66d7a7d7
1 changed files with 10 additions and 0 deletions
  1. 10 0
      driver-rockminer.c

+ 10 - 0
driver-rockminer.c

@@ -413,6 +413,16 @@ void rockminer_poll(struct thr_info * const master_thr)
 			applog(LOG_WARNING, "%"PRIpreprv": No task request? Probably lost, resending task %d", proc->proc_repr, chip->last_taskid);
 			applog(LOG_WARNING, "%"PRIpreprv": No task request? Probably lost, resending task %d", proc->proc_repr, chip->last_taskid);
 			inc_hw_errors_only(thr);
 			inc_hw_errors_only(thr);
 			timer_set_delay(&chip->tv_midtask_timeout, &tv_now, ROCKMINER_MIDTASK_RETRY_US);
 			timer_set_delay(&chip->tv_midtask_timeout, &tv_now, ROCKMINER_MIDTASK_RETRY_US);
+			struct work *work;
+			if ((!(work = chip->works[chip->last_taskid])) || stale_work(work, false))
+			{
+				// Either no work was queued, or it was stale
+				// Instead of resending, just queue a new one
+				if (!chip->requested_work)
+					chip->requested_work = 1;
+				thr->queue_full = false;
+			}
+			else
 			if (!rockminer_send_work(thr))
 			if (!rockminer_send_work(thr))
 			{
 			{
 				rockminer_dead(dev);
 				rockminer_dead(dev);