Commit 57a035d0f4fd33f1ba688070dfc244d10ddc48a9

Con Kolivas 2013-12-22T22:47:17

Store per-chip submit information for bxf device and show them in the API.

diff --git a/driver-bitfury.c b/driver-bitfury.c
index 016539c..30f8647 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -327,13 +327,15 @@ static void parse_bxf_submit(struct cgpu_info *bitfury, struct bitfury_info *inf
 	struct work *match_work, *tmp, *work = NULL;
 	struct thr_info *thr = info->thr;
 	uint32_t nonce, timestamp;
-	int workid;
+	int workid, chip = -1;
 
-	if (!sscanf(&buf[7], "%x %x %x", &nonce, &workid, &timestamp)) {
+	if (!sscanf(&buf[7], "%x %x %x %d", &nonce, &workid, &timestamp, &chip)) {
 		applog(LOG_WARNING, "%s %d: Failed to parse submit response",
 		       bitfury->drv->name, bitfury->device_id);
 		return;
 	}
+	if (chip > -1 && chip < 2)
+		info->submits[chip]++;
 
 	applog(LOG_DEBUG, "%s %d: Parsed nonce %u workid %d timestamp %u",
 	       bitfury->drv->name, bitfury->device_id, nonce, workid, timestamp);
@@ -897,6 +899,8 @@ static struct api_data *bxf_api_stats(struct bitfury_info *info)
 	root = api_add_int(root, "Core1 hwerror", &info->filtered_hw[1], false);
 	root = api_add_int(root, "Core0 jobs", &info->job[0], false);
 	root = api_add_int(root, "Core1 jobs", &info->job[1], false);
+	root = api_add_int(root, "Core0 submits", &info->submits[0], false);
+	root = api_add_int(root, "Core1 submits", &info->submits[1], false);
 
 	return root;
 }
diff --git a/driver-bitfury.h b/driver-bitfury.h
index 42a805e..9412076 100644
--- a/driver-bitfury.h
+++ b/driver-bitfury.h
@@ -57,6 +57,7 @@ struct bitfury_info {
 	uint8_t clocks; // There are two but we set them equal
 	int filtered_hw[2]; // Hardware errors we're told about but are filtered
 	int job[2]; // Completed jobs we're told about
+	int submits[2]; // Submitted responses
 };
 
 #endif /* BITFURY_H */