Various driver fixes for bitfury devices, including a flag from when first valid work appears.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
diff --git a/driver-bitfury.c b/driver-bitfury.c
index 1cabca3..67382bb 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -149,9 +149,7 @@ static bool bxf_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
applog(LOG_INFO, "%s %d: Successfully initialised %s",
bitfury->drv->name, bitfury->device_id, bitfury->device_path);
- /* FIXME Do some testing here */
-
- info->total_nonces = 5;
+ info->total_nonces = 1;
return true;
}
@@ -261,6 +259,10 @@ static void parse_bxf_submit(struct cgpu_info *bitfury, struct bitfury_info *inf
rd_unlock(&bitfury->qlock);
if (!work) {
+ /* Discard first results from any previous run */
+ if (unlikely(!info->valid))
+ return;
+
applog(LOG_INFO, "%s %d: No matching work", bitfury->drv->name, bitfury->device_id);
mutex_lock(&info->lock);
@@ -270,6 +272,7 @@ static void parse_bxf_submit(struct cgpu_info *bitfury, struct bitfury_info *inf
inc_hw_errors(thr);
return;
}
+ info->valid = true;
set_work_ntime(work, timestamp);
if (submit_nonce(thr, work, nonce)) {
mutex_lock(&info->lock);
@@ -412,7 +415,7 @@ static bool bitfury_checkresults(struct thr_info *thr, struct work *work, uint32
static int64_t bitfury_rate(struct bitfury_info *info)
{
double nonce_rate;
- bool ret = 0;
+ int64_t ret = 0;
info->cycles++;
info->total_nonces += info->nonces;
@@ -505,8 +508,11 @@ out:
}
rd_unlock(&bitfury->qlock);
- if (!found)
- inc_hw_errors(thr);
+ if (!found) {
+ if (likely(info->valid))
+ inc_hw_errors(thr);
+ } else
+ info->valid = true;
}
cgtime(&tv_now);
@@ -548,11 +554,9 @@ static int64_t bxf_scan(struct cgpu_info *bitfury, struct bitfury_info *info)
* loop through bxf_scan. The device will not abort it instantly unless
* the prevhash has changed. This is a problem with getwork work since
* it may be impossible to prevent it working on ntime rolled work. */
- if (!info->can_roll) {
+ if (!info->can_roll)
bxf_update_work(bitfury, info);
- cgsleep_ms(500);
- } else
- cgsleep_ms(3000);
+ cgsleep_ms(600);
mutex_lock(&info->lock);
ret = bitfury_rate(info);
@@ -702,7 +706,7 @@ static void bitfury_get_statline_before(char *buf, size_t bufsiz, struct cgpu_in
switch(info->ident) {
case IDENT_BXF:
- tailsprintf(buf, bufsiz, "%3.1fC | ", info->temperature);
+ tailsprintf(buf, bufsiz, "%3.1fC | ", info->temperature);
break;
case IDENT_BF1:
default:
diff --git a/driver-bitfury.h b/driver-bitfury.h
index f9b8733..de1629f 100644
--- a/driver-bitfury.h
+++ b/driver-bitfury.h
@@ -21,6 +21,7 @@ struct bitfury_info {
int total_nonces;
double saved_nonces;
int cycles;
+ bool valid; /* Set on first valid data being found */
/* BF1 specific data */
uint8_t version;