Send the maxroll command to the bxf driver and store the value to see if we need to update it.
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
diff --git a/driver-bitfury.c b/driver-bitfury.c
index 8214931..93313ab 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -629,13 +629,7 @@ static int64_t bxf_scan(struct cgpu_info *bitfury, struct bitfury_info *info)
int64_t ret;
int work_id;
- /* If we're using work that can't be ntime rolled, send new work every
- * 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)
- bxf_update_work(bitfury, info);
- cgsleep_ms(600);
+ cgsleep_ms(1200);
mutex_lock(&info->lock);
ret = bitfury_rate(info);
@@ -675,6 +669,14 @@ static int64_t bitfury_scanwork(struct thr_info *thr)
}
}
+static void bxf_send_maxroll(struct cgpu_info *bitfury, int maxroll)
+{
+ char buf[20];
+
+ sprintf(buf, "maxroll %d\n", maxroll);
+ bxf_send_msg(bitfury, buf, C_BXF_MAXROLL);
+}
+
static bool bxf_send_work(struct cgpu_info *bitfury, struct work *work)
{
char buf[512], hexwork[156];
@@ -690,10 +692,13 @@ static void bxf_update_work(struct cgpu_info *bitfury, struct bitfury_info *info
struct work *work;
work = get_queue_work(thr, bitfury, thr->id);
+ if (work->drv_rolllimit != info->maxroll) {
+ info->maxroll = work->drv_rolllimit;
+ bxf_send_maxroll(bitfury, info->maxroll);
+ }
mutex_lock(&info->lock);
work->subid = ++info->work_id;
- info->can_roll = !!work->drv_rolllimit;
mutex_unlock(&info->lock);
bxf_send_work(bitfury, work);
diff --git a/driver-bitfury.h b/driver-bitfury.h
index 320f470..851d3cc 100644
--- a/driver-bitfury.h
+++ b/driver-bitfury.h
@@ -35,7 +35,7 @@ struct bitfury_info {
double temperature;
int work_id; // Current work->subid
int no_matching_work;
- bool can_roll;
+ int maxroll; // Last maxroll sent to device
int ver_major;
int ver_minor;
int hw_rev;