Browse Source

Merge commit '5c3a252' into bfgminer

Conflicts:
	adl.c
Luke Dashjr 13 years ago
parent
commit
d5945fcb32
5 changed files with 18 additions and 20 deletions
  1. 1 5
      adl.c
  2. 4 0
      api-example.c
  3. 1 1
      driver-icarus.c
  4. 10 14
      miner.c
  5. 2 0
      miner.h

+ 1 - 5
adl.c

@@ -692,11 +692,7 @@ int gpu_fanpercent(int gpu)
 	unlock_adl();
 	unlock_adl();
 	if (unlikely(ga->has_fanspeed && ret == -1)) {
 	if (unlikely(ga->has_fanspeed && ret == -1)) {
 		applog(LOG_WARNING, "GPU %d stopped reporting fanspeed due to driver corruption", gpu);
 		applog(LOG_WARNING, "GPU %d stopped reporting fanspeed due to driver corruption", gpu);
-		if (opt_restart) {
-			applog(LOG_WARNING, "Restart enabled, will restart BFGMiner");
-			applog(LOG_WARNING, "You can disable this with the --no-restart option");
-			app_restart();
-		}
+		applog(LOG_WARNING, "You will need to start BFGMiner from scratch to correct this");
 		applog(LOG_WARNING, "Disabling fanspeed monitoring on this device");
 		applog(LOG_WARNING, "Disabling fanspeed monitoring on this device");
 		ga->has_fanspeed = false;
 		ga->has_fanspeed = false;
 	}
 	}

+ 4 - 0
api-example.c

@@ -7,6 +7,10 @@
  * any later version.  See COPYING for more details.
  * any later version.  See COPYING for more details.
  */
  */
 
 
+/* Compile:
+ *   gcc api-example.c -I compat/jansson -o cgminer-api
+ */
+
 #include "config.h"
 #include "config.h"
 
 
 #include <stdio.h>
 #include <stdio.h>

+ 1 - 1
driver-icarus.c

@@ -437,7 +437,7 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
 		return ESTIMATE_HASHES;
 		return ESTIMATE_HASHES;
 	}
 	}
 
 
-#ifndef __BIG_ENDIAN__
+#if !defined (__BIG_ENDIAN__) && !defined(MIPSEB)
 	nonce = swab32(nonce);
 	nonce = swab32(nonce);
 #endif
 #endif
 	submit_nonce(thr, &state->last_work, nonce);
 	submit_nonce(thr, &state->last_work, nonce);

+ 10 - 14
miner.c

@@ -1197,6 +1197,11 @@ static bool work_decode(const json_t *val, struct work *work)
 		sha2_starts( &ctx, 0 );
 		sha2_starts( &ctx, 0 );
 		sha2_update( &ctx, data.c, 64 );
 		sha2_update( &ctx, data.c, 64 );
 		memcpy(work->midstate, ctx.state, sizeof(work->midstate));
 		memcpy(work->midstate, ctx.state, sizeof(work->midstate));
+#if defined(__BIG_ENDIAN__) || defined(MIPSEB)
+		int i;
+		for (i = 0; i < 8; i++)
+			(((uint32_t*) (work->midstate))[i]) = swab32(((uint32_t*) (work->midstate))[i]);
+#endif
 	}
 	}
 
 
 	if (likely(!jobj_binary(val, "hash1", work->hash1, sizeof(work->hash1), false))) {
 	if (likely(!jobj_binary(val, "hash1", work->hash1, sizeof(work->hash1), false))) {
@@ -1211,18 +1216,6 @@ static bool work_decode(const json_t *val, struct work *work)
 
 
 	memset(work->hash, 0, sizeof(work->hash));
 	memset(work->hash, 0, sizeof(work->hash));
 
 
-#ifdef __BIG_ENDIAN__
-        int swapcounter = 0;
-        for (swapcounter = 0; swapcounter < 32; swapcounter++)
-            (((uint32_t*) (work->data))[swapcounter]) = swab32(((uint32_t*) (work->data))[swapcounter]);
-        for (swapcounter = 0; swapcounter < 16; swapcounter++)
-            (((uint32_t*) (work->hash1))[swapcounter]) = swab32(((uint32_t*) (work->hash1))[swapcounter]);
-        for (swapcounter = 0; swapcounter < 8; swapcounter++)
-            (((uint32_t*) (work->midstate))[swapcounter]) = swab32(((uint32_t*) (work->midstate))[swapcounter]);
-        for (swapcounter = 0; swapcounter < 8; swapcounter++)
-            (((uint32_t*) (work->target))[swapcounter]) = swab32(((uint32_t*) (work->target))[swapcounter]);
-#endif
-
 	gettimeofday(&work->tv_staged, NULL);
 	gettimeofday(&work->tv_staged, NULL);
 
 
 	return true;
 	return true;
@@ -1740,8 +1733,10 @@ static bool submit_upstream_work(const struct work *work, CURL *curl)
 		/* Once we have more than a nominal amount of sequential rejects,
 		/* Once we have more than a nominal amount of sequential rejects,
 		 * at least 10 and more than 3 mins at the current utility,
 		 * at least 10 and more than 3 mins at the current utility,
 		 * disable the pool because some pool error is likely to have
 		 * disable the pool because some pool error is likely to have
-		 * ensued. */
-		if (pool->seq_rejects > 10 && opt_disable_pool && total_pools > 1) {
+		 * ensued. Do not do this if we know the share just happened to
+		 * be stale due to networking delays.
+		 */
+		if (pool->seq_rejects > 10 && !work->stale && opt_disable_pool && total_pools > 1) {
 			double utility = total_accepted / ( total_secs ? total_secs : 1 ) * 60;
 			double utility = total_accepted / ( total_secs ? total_secs : 1 ) * 60;
 
 
 			if (pool->seq_rejects > utility * 3) {
 			if (pool->seq_rejects > utility * 3) {
@@ -2179,6 +2174,7 @@ static void *submit_work_thread(void *userdata)
 			pool->stale_shares++;
 			pool->stale_shares++;
 			goto out;
 			goto out;
 		}
 		}
+		work->stale = true;
 	}
 	}
 
 
 	ce = pop_curl_entry(pool);
 	ce = pop_curl_entry(pool);

+ 2 - 0
miner.h

@@ -714,11 +714,13 @@ struct work {
 	int		thr_id;
 	int		thr_id;
 	struct pool	*pool;
 	struct pool	*pool;
 	struct timeval	tv_staged;
 	struct timeval	tv_staged;
+
 	bool		mined;
 	bool		mined;
 	bool		clone;
 	bool		clone;
 	bool		cloned;
 	bool		cloned;
 	bool		rolltime;
 	bool		rolltime;
 	bool		longpoll;
 	bool		longpoll;
+	bool		stale;
 
 
 	unsigned int	work_block;
 	unsigned int	work_block;
 	int		id;
 	int		id;