Browse Source

ztex: Silence false "unexpected" hardware errors

Luke Dashjr 13 years ago
parent
commit
ee4802e1c9
3 changed files with 14 additions and 5 deletions
  1. 8 0
      driver-ztex.c
  2. 5 4
      miner.c
  3. 1 1
      miner.h

+ 8 - 0
driver-ztex.c

@@ -389,6 +389,13 @@ static void ztex_shutdown(struct thr_info *thr)
 	libztex_destroy_device(ztex);
 }
 
+static bool ztex_silence_hwerr(__maybe_unused struct thr_info *thr)
+{
+	// Current code has a false hw error for every real nonce
+	// At least silence these by pretending we handle them internally
+	return true;
+}
+
 static void ztex_disable(struct thr_info *thr)
 {
 	applog(LOG_ERR, "%s: Disabling!", thr->cgpu->device_ztex->repr);
@@ -404,5 +411,6 @@ struct device_api ztex_api = {
 	.get_api_extra_device_status = get_ztex_api_extra_device_status,
 	.thread_init = ztex_prepare,
 	.scanhash = ztex_scanhash,
+	.hw_error = ztex_silence_hwerr,
 	.thread_shutdown = ztex_shutdown,
 };

+ 5 - 4
miner.c

@@ -6090,13 +6090,14 @@ bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce)
 		case TNR_BAD:
 		{
 			struct cgpu_info *cgpu = thr->cgpu;
-			applog(LOG_WARNING, "%s %u: invalid nonce - HW error",
-			       cgpu->api->name, cgpu->device_id);
+			struct device_api *dapi = cgpu->api;
+
 			++hw_errors;
 			++thr->cgpu->hw_errors;
 
-			if (thr->cgpu->api->hw_error)
-				thr->cgpu->api->hw_error(thr);
+			if (!(dapi->hw_error && dapi->hw_error(thr)))
+				applog(LOG_WARNING, "%s %u: invalid nonce - HW error",
+				       dapi->name, cgpu->device_id);
 
 			return false;
 		}

+ 1 - 1
miner.h

@@ -313,7 +313,7 @@ struct device_api {
 	void (*free_work)(struct thr_info*, struct work*);
 	bool (*prepare_work)(struct thr_info*, struct work*);
 	int64_t (*scanhash)(struct thr_info*, struct work*, int64_t);
-	void (*hw_error)(struct thr_info*);
+	bool (*hw_error)(struct thr_info*);
 	void (*thread_shutdown)(struct thr_info*);
 	void (*thread_enable)(struct thr_info*);
 };