Send extra work regularly to the bxf device and parse the needwork command by sending the amount of work it requests.
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
diff --git a/driver-bitfury.c b/driver-bitfury.c
index b26ec8a..7308faf 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -231,6 +231,8 @@ static bool bxf_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
bitfury->drv->name, bitfury->device_id, bitfury->device_path);
info->total_nonces = 1;
+ /* This unsets it to make sure it gets set on the first pass */
+ info->maxroll = -1;
return true;
}
@@ -379,6 +381,20 @@ static void parse_bxf_temp(struct cgpu_info *bitfury, struct bitfury_info *info,
static void bxf_update_work(struct cgpu_info *bitfury, struct bitfury_info *info);
+static void parse_bxf_needwork(struct cgpu_info *bitfury, struct bitfury_info *info,
+ char *buf)
+{
+ int needed;
+
+ if (!sscanf(&buf[9], "%d", &needed)) {
+ applog(LOG_INFO, "%s %d: Failed to parse needwork",
+ bitfury->drv->name, bitfury->device_id);
+ return;
+ }
+ while (needed-- > 0)
+ bxf_update_work(bitfury, info);
+}
+
static void *bxf_get_results(void *userdata)
{
struct cgpu_info *bitfury = userdata;
@@ -397,6 +413,7 @@ static void *bxf_get_results(void *userdata)
/* Read thread sends the first work item to get the device started
* since it will roll ntime and make work itself from there on. */
bxf_update_work(bitfury, info);
+ bxf_update_work(bitfury, info);
while (likely(!bitfury->shutdown)) {
char *msg;
@@ -424,6 +441,11 @@ static void *bxf_get_results(void *userdata)
parse_bxf_temp(bitfury, info, msg);
continue;
}
+ msg = strstr(buf, "needwork");
+ if (msg) {
+ parse_bxf_needwork(bitfury, info, msg);
+ continue;
+ }
applog(LOG_DEBUG, "%s %d: Unrecognised string %s",
bitfury->drv->name, bitfury->device_id, buf);
}
@@ -634,7 +656,8 @@ static int64_t bxf_scan(struct cgpu_info *bitfury, struct bitfury_info *info)
int64_t ret;
int work_id;
- cgsleep_ms(1200);
+ bxf_update_work(bitfury, info);
+ cgsleep_ms(600);
mutex_lock(&info->lock);
ret = bitfury_rate(info);
@@ -717,6 +740,7 @@ static void bitfury_flush_work(struct cgpu_info *bitfury)
case IDENT_BXF:
bxf_send_flush(bitfury);
bxf_update_work(bitfury, info);
+ bxf_update_work(bitfury, info);
case IDENT_BF1:
default:
break;