Rotate the avalon work array and free work on AVA_SEND_BUFFER_EMPTY as well.
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
diff --git a/driver-avalon.c b/driver-avalon.c
index afeb56f..3e19996 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -685,7 +685,7 @@ static void avalon_free_work_array(struct thr_info *thr)
{
struct cgpu_info *avalon;
struct work **works;
- int i, j, mc, wa;
+ int i, j, mc;
avalon = thr->cgpu;
avalon->queued = 0;
@@ -693,11 +693,10 @@ static void avalon_free_work_array(struct thr_info *thr)
return;
works = avalon->works;
mc = avalon_infos[avalon->device_id]->miner_count;
- wa = avalon->work_array + 1;
- if (wa > 3)
- wa = 0;
+ if (++avalon->work_array > 3)
+ avalon->work_array = 0;
- for (i = wa * mc, j = 0; j < mc; i++, j++) {
+ for (i = avalon->work_array * mc, j = 0; j < mc; i++, j++) {
if (likely(works[i])) {
work_completed(avalon, works[i]);
works[i] = NULL;
@@ -861,6 +860,7 @@ static int64_t avalon_scanhash(struct thr_info *thr)
}
if (ret == AVA_SEND_BUFFER_EMPTY && (i + 1 == end_count)) {
first_try = 1;
+ avalon_free_work_array(thr);
return 0xffffffff;
}
@@ -942,8 +942,6 @@ static int64_t avalon_scanhash(struct thr_info *thr)
}
avalon_free_work_array(thr);
- if (++avalon->work_array > 3)
- avalon->work_array = 0;
record_temp_fan(info, &ar, &(avalon->temp));
applog(LOG_INFO,