Count missing work items from behind a successful work read in avalon 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 46 47
diff --git a/driver-avalon.c b/driver-avalon.c
index da0ee74..3c98d12 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -616,6 +616,17 @@ static struct work *avalon_valid_result(struct cgpu_info *avalon, struct avalon_
static void avalon_update_temps(struct cgpu_info *avalon, struct avalon_info *info,
struct avalon_result *ar);
+static void avalon_inc_nvw(struct avalon_info *info, struct thr_info *thr)
+{
+ applog(LOG_WARNING, "%s%d: No valid work - HW error",
+ thr->cgpu->drv->name, thr->cgpu->device_id);
+
+ inc_hw_errors(thr);
+ mutex_lock(&info->lock);
+ info->no_matching_work++;
+ mutex_unlock(&info->lock);
+}
+
static void avalon_parse_results(struct cgpu_info *avalon, struct avalon_info *info,
struct thr_info *thr, char *buf, int *offset)
{
@@ -654,17 +665,15 @@ static void avalon_parse_results(struct cgpu_info *avalon, struct avalon_info *i
* work result. */
if (spare < (int)AVALON_READ_SIZE)
return;
- applog(LOG_WARNING, "%s%d: No valid work - HW error",
- thr->cgpu->drv->name, thr->cgpu->device_id);
-
- inc_hw_errors(thr);
- mutex_lock(&info->lock);
- info->no_matching_work++;
- mutex_unlock(&info->lock);
+ avalon_inc_nvw(info, thr);
} else {
spare = AVALON_READ_SIZE + i;
- if (i)
- applog(LOG_WARNING, "Avalon: Discarding %d bytes from buffer", i);
+ if (i) {
+ if (i >= (int)AVALON_READ_SIZE)
+ avalon_inc_nvw(info, thr);
+ else
+ applog(LOG_WARNING, "Avalon: Discarding %d bytes from buffer", i);
+ }
}
*offset -= spare;