mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Icarus: Abandon a scanhash early when work restart requested
This commit is contained in:
parent
1291f5a407
commit
34f86417cc
@ -55,8 +55,8 @@
|
|||||||
#include "miner.h"
|
#include "miner.h"
|
||||||
|
|
||||||
// 8 second timeout
|
// 8 second timeout
|
||||||
#define ICARUS_READ_FAULT_DECISECONDS (10)
|
#define ICARUS_READ_FAULT_DECISECONDS (1)
|
||||||
#define ICARUS_READ_FAULT_COUNT (8)
|
#define ICARUS_READ_FAULT_COUNT (80)
|
||||||
|
|
||||||
struct device_api icarus_api;
|
struct device_api icarus_api;
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ static int icarus_open(const char *devpath)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int icarus_gets(unsigned char *buf, size_t bufLen, int fd)
|
static int icarus_gets(unsigned char *buf, size_t bufLen, int fd, volatile unsigned long *wr)
|
||||||
{
|
{
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
@ -147,6 +147,8 @@ static int icarus_gets(unsigned char *buf, size_t bufLen, int fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rc++;
|
rc++;
|
||||||
|
if (*wr)
|
||||||
|
return 1;
|
||||||
if (rc == ICARUS_READ_FAULT_COUNT) {
|
if (rc == ICARUS_READ_FAULT_COUNT) {
|
||||||
if (epollfd != -1)
|
if (epollfd != -1)
|
||||||
close(epollfd);
|
close(epollfd);
|
||||||
@ -202,7 +204,8 @@ static bool icarus_detect_one(const char *devpath)
|
|||||||
icarus_write(fd, ob_bin, sizeof(ob_bin));
|
icarus_write(fd, ob_bin, sizeof(ob_bin));
|
||||||
|
|
||||||
memset(nonce_bin, 0, sizeof(nonce_bin));
|
memset(nonce_bin, 0, sizeof(nonce_bin));
|
||||||
icarus_gets(nonce_bin, sizeof(nonce_bin), fd);
|
volatile unsigned long wr = 0;
|
||||||
|
icarus_gets(nonce_bin, sizeof(nonce_bin), fd, &wr);
|
||||||
|
|
||||||
icarus_close(fd);
|
icarus_close(fd);
|
||||||
|
|
||||||
@ -273,6 +276,9 @@ static bool icarus_prepare(struct thr_info *thr)
|
|||||||
static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
|
static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
|
||||||
__maybe_unused uint64_t max_nonce)
|
__maybe_unused uint64_t max_nonce)
|
||||||
{
|
{
|
||||||
|
volatile unsigned long *wr = &work_restart[thr->id].restart;
|
||||||
|
*wr = 0;
|
||||||
|
|
||||||
struct cgpu_info *icarus;
|
struct cgpu_info *icarus;
|
||||||
int fd;
|
int fd;
|
||||||
int ret;
|
int ret;
|
||||||
@ -308,7 +314,7 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
|
|||||||
|
|
||||||
/* Icarus will return 8 bytes nonces or nothing */
|
/* Icarus will return 8 bytes nonces or nothing */
|
||||||
memset(nonce_bin, 0, sizeof(nonce_bin));
|
memset(nonce_bin, 0, sizeof(nonce_bin));
|
||||||
ret = icarus_gets(nonce_bin, sizeof(nonce_bin), fd);
|
ret = icarus_gets(nonce_bin, sizeof(nonce_bin), fd, wr);
|
||||||
|
|
||||||
nonce_hex = bin2hex(nonce_bin, sizeof(nonce_bin));
|
nonce_hex = bin2hex(nonce_bin, sizeof(nonce_bin));
|
||||||
if (nonce_hex) {
|
if (nonce_hex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user