Commit 8a710a68d77be2417fc883a9690cec20e0a31fc2

Con Kolivas 2013-11-14T13:21:58

Parse bxf work submits fully, submitting the results.

diff --git a/driver-bitfury.c b/driver-bitfury.c
index dfeee96..8e73b00 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -234,6 +234,8 @@ static void bitfury_detect(bool __maybe_unused hotplug)
 
 static void parse_bxf_submit(struct cgpu_info *bitfury, struct bitfury_info *info, char *buf)
 {
+	struct work *match_work = NULL, *work = NULL;
+	struct thr_info *thr = info->thr;
 	uint32_t nonce, timestamp;
 	unsigned int workid;
 
@@ -242,6 +244,29 @@ static void parse_bxf_submit(struct cgpu_info *bitfury, struct bitfury_info *inf
 		       bitfury->drv->name, bitfury->device_id);
 		return;
 	}
+
+	rd_lock(&bitfury->qlock);
+	HASH_FIND_INT(bitfury->queued_work, &workid, match_work);
+	if (match_work)
+		work = copy_work(match_work);
+	rd_unlock(&bitfury->qlock);
+
+	if (!work) {
+		applog(LOG_INFO, "%s %d: No matching work", bitfury->drv->name, bitfury->device_id);
+
+		mutex_lock(&info->lock);
+		info->no_matching_work++;
+		mutex_unlock(&info->lock);
+
+		return;
+	}
+	set_work_ntime(work, timestamp);
+	if (submit_nonce(thr, work, nonce)) {
+		mutex_lock(&info->lock);
+		info->nonces++;
+		mutex_unlock(&info->lock);
+	}
+	free_work(work);
 }
 
 static void parse_bxf_temp(struct cgpu_info *bitfury, struct bitfury_info *info, char *buf)
diff --git a/driver-bitfury.h b/driver-bitfury.h
index 27f0411..2438e28 100644
--- a/driver-bitfury.h
+++ b/driver-bitfury.h
@@ -33,6 +33,7 @@ struct bitfury_info {
 	pthread_t read_thr;
 	double temperature;
 	int work_id; // Current work->subid
+	int no_matching_work;
 };
 
 #endif /* BITFURY_H */