/* * snic_ver_enc : Encodes version str to int * version string is similar to netmask string
*/ staticint
snic_ver_enc(constchar *s)
{ int v[4] = {0}; int i = 0, x = 0; char c; constchar *p = s;
/* validate version string */ if ((strlen(s) > 15) || (strlen(s) < 7)) goto end;
while ((c = *p++)) { if (c == '.') {
i++; continue;
}
if (i > 3 || !isdigit(c)) goto end;
v[i] = v[i] * 10 + (c - '0');
}
/* validate sub version numbers */ for (i = 3; i >= 0; i--) if (v[i] > 0xff) goto end;
end: if (x == 0) {
SNIC_ERR("Invalid version string [%s].\n", s);
return -1;
}
return x;
} /* end of snic_ver_enc */
/* * snic_qeueue_exch_ver_req : * * Queues Exchange Version Request, to communicate host information * in return, it gets firmware version details
*/ int
snic_queue_exch_ver_req(struct snic *snic)
{ struct snic_req_info *rqi = NULL; struct snic_host_req *req = NULL;
u32 ver = 0; int ret = 0;
SNIC_HOST_INFO(snic->shost, "Exch Ver Req Preparing...\n");
rqi = snic_req_init(snic, 0); if (!rqi) {
SNIC_HOST_ERR(snic->shost, "Init Exch Ver Req failed\n");
ret = -ENOMEM; goto error;
}
/* Additional delay to handle HW Resource initialization. */
msleep(50);
/* * Exch ver req can be ignored by FW, if HW Resource initialization * is in progress, Hence retry.
*/ do {
ret = snic_queue_exch_ver_req(snic); if (ret) return ret;
wait_for_completion_timeout(&wait, msecs_to_jiffies(2000));
spin_lock_irqsave(&snic->snic_lock, flags);
ret = (snic->fwinfo.fw_ver != 0) ? 0 : -ETIMEDOUT; if (ret)
SNIC_HOST_ERR(snic->shost, "Failed to retrieve snic params,\n");
/* Unset fwinfo.wait, on success or on last retry */ if (ret == 0 || nr_retries == 1)
snic->fwinfo.wait = NULL;
spin_unlock_irqrestore(&snic->snic_lock, flags);
} while (ret && --nr_retries);
return ret;
} /* end of snic_get_info */
Messung V0.5
¤ Dauer der Verarbeitung: 0.21 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.