Browse Source

bitfury: If previous nonce mismatch persists, try recalibrating oldbuf

Luke Dashjr 12 years ago
parent
commit
20aee7137c
2 changed files with 10 additions and 0 deletions
  1. 9 0
      driver-bitfury.c
  2. 1 0
      libbitfury.h

+ 9 - 0
driver-bitfury.c

@@ -475,10 +475,19 @@ void bitfury_do_io(struct thr_info *thr)
 	if (newbuf[0xf] != oldbuf[0xf])
 	if (newbuf[0xf] != oldbuf[0xf])
 	{
 	{
 		inc_hw_errors2(thr, NULL, NULL);
 		inc_hw_errors2(thr, NULL, NULL);
+		if (unlikely(++bitfury->desync_counter >= 4))
+		{
+			applog(LOG_WARNING, "%"PRIpreprv": Previous nonce mismatch (4th try), recalibrating",
+			       proc->proc_repr);
+			bitfury_init_oldbuf(proc);
+			goto out;
+		}
 		applog(LOG_DEBUG, "%"PRIpreprv": Previous nonce mismatch, ignoring response",
 		applog(LOG_DEBUG, "%"PRIpreprv": Previous nonce mismatch, ignoring response",
 		       proc->proc_repr);
 		       proc->proc_repr);
 		goto out;
 		goto out;
 	}
 	}
+	else
+		bitfury->desync_counter = 0;
 	
 	
 	if (bitfury->oldjob != newjob && thr->next_work)
 	if (bitfury->oldjob != newjob && thr->next_work)
 	{
 	{

+ 1 - 0
libbitfury.h

@@ -54,6 +54,7 @@ struct bitfury_device {
 	unsigned fasync;
 	unsigned fasync;
 	unsigned strange_counter;
 	unsigned strange_counter;
 	bool second_run;
 	bool second_run;
+	int desync_counter;
 	
 	
 	time_t short_out_t;
 	time_t short_out_t;
 	time_t long_out_t;
 	time_t long_out_t;