Browse Source

icarus: Do hwerror-triggered reopen before sending the next job the first time, to avoid having to resend it later

Luke Dashjr 12 years ago
parent
commit
77757c2a68
2 changed files with 11 additions and 13 deletions
  1. 10 12
      driver-icarus.c
  2. 1 1
      libblkmaker

+ 10 - 12
driver-icarus.c

@@ -979,7 +979,10 @@ keepwaiting:
 			submit_nonce(thr, nonce_work, nonce);
 			goto keepwaiting;
 		}
+		was_hw_error = (!nonce_work);
 	}
+	else
+		was_hw_error = false;
 	
 	// Handle dynamic clocking for "subclass" devices
 	// This needs to run before sending next job, since it hashes the command too
@@ -987,9 +990,15 @@ keepwaiting:
 		int qsec = ((4 * elapsed.tv_sec) + (elapsed.tv_usec / 250000)) ?: 1;
 		for (int n = qsec; n; --n)
 			dclk_gotNonces(&info->dclk);
-		if (ret == ICA_GETS_OK && !nonce_work)
+		if (was_hw_error)
 			dclk_errorCount(&info->dclk, qsec);
 	}
+	
+	// Force a USB close/reopen on any hw error
+	if (was_hw_error && info->quirk_reopen != 2) {
+		if (!icarus_reopen(icarus, state, &fd))
+			state->firstrun = true;
+	}
 
 	if (unlikely(state->identify))
 	{
@@ -1040,23 +1049,12 @@ keepwaiting:
 
 	// Only ICA_GETS_OK gets here
 	
-	was_hw_error = (!nonce_work);
 	if (likely(!was_hw_error))
 		submit_nonce(thr, nonce_work, nonce);
 	else
 		inc_hw_errors(thr, state->last_work, nonce);
 	icarus_transition_work(state, work);
 
-	// Force a USB close/reopen on any hw error
-	if (was_hw_error)
-		if (info->quirk_reopen != 2) {
-			if (!icarus_reopen(icarus, state, &fd))
-				state->firstrun = true;
-			// Some devices (Cairnsmore1, for example) abort hashing when reopened, so send the job again
-			if (!icarus_job_start(thr))
-				state->firstrun = true;
-		}
-
 	hash_count = (nonce & info->nonce_mask);
 	hash_count++;
 	hash_count *= info->fpga_count;

+ 1 - 1
libblkmaker

@@ -1 +1 @@
-Subproject commit 8f4bb3ee9f43405203fef6f64ca938dc7933a060
+Subproject commit bca8f6f5e56c547e9bbc808fb644152e44f3344d