Browse Source

minergate: Fix hashmeter

Luke Dashjr 11 years ago
parent
commit
a36d4784a0
1 changed files with 12 additions and 5 deletions
  1. 12 5
      driver-minergate.c

+ 12 - 5
driver-minergate.c

@@ -449,13 +449,20 @@ void minergate_queue_flush(struct thr_info * const thr)
 }
 }
 
 
 static
 static
-bool minergate_submit(struct thr_info * const thr, struct work * const work, const uint32_t nonce, const uint8_t ntime_offset)
+bool minergate_submit(struct thr_info * const thr, struct work * const work, const uint32_t nonce, const uint8_t ntime_offset, int64_t * const hashes)
 {
 {
 	if (!nonce)
 	if (!nonce)
 		return false;
 		return false;
 	
 	
 	if (likely(work))
 	if (likely(work))
+	{
 		submit_noffset_nonce(thr, work, nonce, ntime_offset);
 		submit_noffset_nonce(thr, work, nonce, ntime_offset);
+		
+		struct cgpu_info * const dev = thr->cgpu;
+		struct minergate_config * const mgcfg = dev->device_data;
+		if (mgcfg->desired_roll)
+			*hashes += 0x100000000 * work->nonce_diff;
+	}
 	else
 	else
 		inc_hw_errors3(thr, NULL, &nonce, 1.);
 		inc_hw_errors3(thr, NULL, &nonce, 1.);
 	
 	
@@ -506,12 +513,12 @@ void minergate_poll(struct thr_info * const thr)
 		if (unlikely(!work))
 		if (unlikely(!work))
 			applog(LOG_ERR, "%s: Unknown job %"PRIwdi, dev->dev_repr, jobid);
 			applog(LOG_ERR, "%s: Unknown job %"PRIwdi, dev->dev_repr, jobid);
 		
 		
-		if (minergate_submit(thr, work, nonce, ntime_offset))
+		if (minergate_submit(thr, work, nonce, ntime_offset, &hashes))
 		{
 		{
 			if (mgcfg->protover == MPV_SP10)
 			if (mgcfg->protover == MPV_SP10)
 			{
 			{
 				nonce = upk_u32le(jobrsp, 0xc);
 				nonce = upk_u32le(jobrsp, 0xc);
-				minergate_submit(thr, work, nonce, ntime_offset);
+				minergate_submit(thr, work, nonce, ntime_offset, &hashes);
 			}
 			}
 		}
 		}
 		else
 		else
@@ -524,8 +531,8 @@ void minergate_poll(struct thr_info * const thr)
 		{
 		{
 			HASH_DEL(thr->work, work);
 			HASH_DEL(thr->work, work);
 			applog(LOG_DEBUG, "%s: %s job %"PRIwdi" completed", dev->dev_repr, work->tv_stamp.tv_sec ? "Flushed" : "Active", work->device_id);
 			applog(LOG_DEBUG, "%s: %s job %"PRIwdi" completed", dev->dev_repr, work->tv_stamp.tv_sec ? "Flushed" : "Active", work->device_id);
-			if (!work->tv_stamp.tv_sec)
-				hashes += 100000000 * work->nonce_diff;
+			if ((!mgcfg->desired_roll) && !work->tv_stamp.tv_sec)
+				hashes += 0x100000000 * work->nonce_diff;
 			free_work(work);
 			free_work(work);
 		}
 		}
 	}
 	}