Hi ck, please take a look at this:
driver-bitmain.c, line# ~ 2753:
sendret = bitmain_send_data(sendbuf, sendlen, bitmain);
if (unlikely(sendret == BTM_SEND_ERROR)) {
applog(LOG_ERR, "%s%d: send status comms error",
bitmain->drv->name, bitmain->device_id);
//dev_error(bitmain, REASON_DEV_COMMS_ERROR);
info->reset = true;
info->errorcount++;
senderror = 1;
if (info->errorcount > 1000) {
info->errorcount = 0;
applog(LOG_ERR, "%s%d: Device disappeared,"
" shutting down thread",
bitmain->drv->name, bitmain->device_id);
bitmain->shutdown = true;
}
} else {
info->errorcount = 0;
if (info->fifo_space <= 0) {
senderror = 1;
}
}
In this code block bitmain_send_data() succeeds and it goes into the else branch.
But there "senderror = 1" will be executed if fifo_space <= 0.
And if senderror is set to 1 then in later part of the code a penalty pausing of 50ms is done.
I don't understand why senderror gets set if the bitmain_send_data() already succeeded.
I think in the success case the testing for fifo_space shouldn't be done, IMO. Isn't it?