Commit 390ac7062663c688b656cf0dc893163cd7a852b3

Con Kolivas 2013-11-18T10:40:41

With reliable writes to the avalon there is no need for the sleep delays between writes.

diff --git a/driver-avalon.c b/driver-avalon.c
index db94436..4a4b0b8 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -142,12 +142,10 @@ static int avalon_write(struct cgpu_info *avalon, char *buf, ssize_t len, int ep
 	return AVA_SEND_OK;
 }
 
-static int avalon_send_task(const struct avalon_task *at, struct cgpu_info *avalon,
-			    struct avalon_info *info)
-
+static int avalon_send_task(const struct avalon_task *at, struct cgpu_info *avalon)
 {
 	uint8_t buf[AVALON_WRITE_SIZE + 4 * AVALON_DEFAULT_ASIC_NUM];
-	int delay, ret, i, ep = C_AVALON_TASK;
+	int ret, i, ep = C_AVALON_TASK;
 	uint32_t nonce_range;
 	size_t nr_len;
 
@@ -188,10 +186,6 @@ static int avalon_send_task(const struct avalon_task *at, struct cgpu_info *aval
 	tt |= ((buf[4] & 0x80) ? (1 << 0) : 0);
 	buf[4] = tt;
 #endif
-	delay = nr_len * 10 * 1000000;
-	delay = delay / info->baud;
-	delay += 4000;
-
 	if (at->reset) {
 		ep = C_AVALON_RESET;
 		nr_len = 1;
@@ -200,15 +194,8 @@ static int avalon_send_task(const struct avalon_task *at, struct cgpu_info *aval
 		applog(LOG_DEBUG, "Avalon: Sent(%u):", (unsigned int)nr_len);
 		hexdump(buf, nr_len);
 	}
-	/* Sleep from the last time we sent data */
-	cgsleep_us_r(&info->cgsent, info->send_delay);
-
-	cgsleep_prepare_r(&info->cgsent);
 	ret = avalon_write(avalon, (char *)buf, nr_len, ep);
 
-	applog(LOG_DEBUG, "Avalon: Sent: Buffer delay: %dus", info->send_delay);
-	info->send_delay = delay;
-
 	return ret;
 }
 
@@ -337,7 +324,7 @@ static int avalon_reset(struct cgpu_info *avalon, bool initial)
 			 AVALON_DEFAULT_FREQUENCY);
 
 	wait_avalon_ready(avalon);
-	ret = avalon_send_task(&at, avalon, info);
+	ret = avalon_send_task(&at, avalon);
 	if (unlikely(ret == AVA_SEND_ERROR))
 		return -1;
 
@@ -578,7 +565,7 @@ static void avalon_idle(struct cgpu_info *avalon, struct avalon_info *info)
 		avalon_init_task(&at, 0, 0, info->fan_pwm, info->timeout,
 				 info->asic_count, info->miner_count, 1, 1,
 				 info->frequency);
-		if (avalon_send_task(&at, avalon, info) == AVA_SEND_ERROR)
+		if (avalon_send_task(&at, avalon) == AVA_SEND_ERROR)
 			break;
 	}
 	applog(LOG_WARNING, "%s%i: Idling %d miners", avalon->drv->name, avalon->device_id, i);
@@ -1172,7 +1159,7 @@ static void *avalon_send_tasks(void *userdata)
 			}
 			mutex_unlock(&info->qlock);
 
-			ret = avalon_send_task(&at, avalon, info);
+			ret = avalon_send_task(&at, avalon);
 
 			if (unlikely(ret == AVA_SEND_ERROR)) {
 				/* Send errors are fatal */
diff --git a/driver-avalon.h b/driver-avalon.h
index 9111291..5b6cf83 100644
--- a/driver-avalon.h
+++ b/driver-avalon.h
@@ -145,8 +145,6 @@ struct avalon_info {
 	pthread_mutex_t lock;
 	pthread_mutex_t qlock;
 	cgsem_t qsem;
-	cgtimer_t cgsent;
-	int send_delay;
 
 	int nonces;
 	int auto_queued;