if (unlikely(!pentry)) {
ret = -ENOSPC; goto destroy_info;
}
/* * Check if we are close to filling in entire pending queue, * if so then tell the sender to stop/sleep by returning -EBUSY * We do it only for context which can sleep (GFP_KERNEL)
*/ if (gfp == GFP_KERNEL &&
pqueue->pending_count > (pqueue->qlen - CPT_IQ_STOP_MARGIN)) {
pentry->resume_sender = true;
} else
pentry->resume_sender = false;
resume_sender = pentry->resume_sender;
pqueue->pending_count++;
/* * We allocate and prepare pending queue entry in critical section * together with submitting CPT instruction to CPT instruction queue * to make sure that order of CPT requests is the same in both * pending and instruction queues
*/
spin_unlock_bh(&pqueue->lock);
ret = resume_sender ? -EBUSY : -EINPROGRESS; return ret;
switch (ccode) { case OTX2_CPT_COMP_E_FAULT:
dev_err(&pdev->dev, "Request failed with DMA fault\n");
otx2_cpt_dump_sg_list(pdev, info->req); break;
case OTX2_CPT_COMP_E_HWERR:
dev_err(&pdev->dev, "Request failed with hardware error\n");
otx2_cpt_dump_sg_list(pdev, info->req); break;
case OTX2_CPT_COMP_E_INSTERR:
dev_err(&pdev->dev, "Request failed with instruction error\n");
otx2_cpt_dump_sg_list(pdev, info->req); break;
case OTX2_CPT_COMP_E_NOTDONE: /* check for timeout */ if (time_after_eq(jiffies, info->time_in +
CPT_COMMAND_TIMEOUT * HZ))
dev_warn(&pdev->dev, "Request timed out 0x%p", info->req); elseif (info->extra_time < CPT_TIME_IN_RESET_COUNT) {
info->time_in = jiffies;
info->extra_time++;
} return 1;
case OTX2_CPT_COMP_E_GOOD: case OTX2_CPT_COMP_E_WARN: /* * Check microcode completion code, it is only valid * when completion code is CPT_COMP_E::GOOD
*/ if (uc_ccode != OTX2_CPT_UCC_SUCCESS) { /* * If requested hmac is truncated and ucode returns * s/g write length error then we report success * because ucode writes as many bytes of calculated * hmac as available in gather buffer and reports * s/g write length error if number of bytes in gather * buffer is less than full hmac size.
*/ if (info->req->is_trunc_hmac &&
uc_ccode == OTX2_CPT_UCC_SG_WRITE_LENGTH) {
*res_code = 0; break;
}
pr_debug("Request failed with software error code 0x%x: algo = %s driver = %s\n",
cpt_status->s.uc_compcode,
info->req->areq->tfm->__crt_alg->cra_name,
info->req->areq->tfm->__crt_alg->cra_driver_name);
otx2_cpt_dump_sg_list(pdev, info->req); break;
} /* Request has been processed with success */
*res_code = 0; break;
default:
dev_err(&pdev->dev, "Request returned invalid status %d\n", ccode); break;
} return 0;
}
process_pentry: /* * Check if we should inform sending side to resume * We do it CPT_IQ_RESUME_MARGIN elements in advance before * pending queue becomes empty
*/
resume_index = modulo_inc(pqueue->front, pqueue->qlen,
CPT_IQ_RESUME_MARGIN);
resume_pentry = &pqueue->head[resume_index]; if (resume_pentry &&
resume_pentry->resume_sender) {
resume_pentry->resume_sender = false;
callback = resume_pentry->callback;
areq = resume_pentry->areq;
if (callback) {
spin_unlock_bh(&pqueue->lock);
/* * EINPROGRESS is an indication for sending * side that it can resume sending requests
*/
callback(-EINPROGRESS, areq, info);
spin_lock_bh(&pqueue->lock);
}
}
/* * Call callback after current pending entry has been * processed, we don't do it if the callback pointer is * invalid.
*/ if (callback)
callback(res_code, areq, info);
}
}
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.