static irqreturn_t nfp_sec_interrupt_handler_1(int irq, void *arg) { MV_CESA_RESULT result; MV_STATUS status; MV_U8 chan = 1; MV_REG_WRITE(MV_CESA_ISR_CAUSE_REG(chan), 0); while (1) { /* Get Ready requests */ status = mvCesaReadyGet(chan, &result); if (status != MV_OK) break; nfp_sec_complete_out((unsigned long)((MV_NFP_SEC_CESA_PRIV_L2FW *)result.pReqPrv)); } return IRQ_HANDLED; }
/* * cesa callback. */ static void cesa_callback(unsigned long dummy) { struct cesa_ocf_process *cesa_ocf_cmd = NULL; struct cryptop *crp = NULL; MV_CESA_RESULT result[MV_CESA_MAX_CHAN]; int res_idx = 0,i; MV_STATUS status; dprintk("%s()\n", __FUNCTION__); #ifdef CESA_OCF_TASKLET disable_irq(cesa_device.irq); #endif while(MV_TRUE) { /* Get Ready requests */ spin_lock(&cesa_lock); status = mvCesaReadyGet(&result[res_idx]); spin_unlock(&cesa_lock); cesaTestTraceAdd(2); if(status != MV_OK) { #ifdef CESA_OCF_POLLING if(status == MV_BUSY) { /* Fragment */ cesa_interrupt_polling(); return; } #endif break; } res_idx++; break; } for(i = 0; i < res_idx; i++) { if(!result[i].pReqPrv) { printk("%s,%d: warning private is NULL\n", __FILE__, __LINE__); break; } cesa_ocf_cmd = result[i].pReqPrv; crp = cesa_ocf_cmd->crp; // ignore HMAC error. //if(result->retCode) // crp->crp_etype = EIO; #if defined(CESA_OCF_POLLING) if(!cesa_ocf_cmd->need_cb){ cesa_interrupt_polling(); } #endif if(cesa_ocf_cmd->need_cb) { if(debug) { mvCesaDebugMbuf("DST BUFFER", cesa_ocf_cmd->cesa_cmd.pDst, 0, cesa_ocf_cmd->cesa_cmd.pDst->mbufSize); } crypto_done(crp); } kfree(cesa_ocf_cmd); } #ifdef CESA_OCF_TASKLET enable_irq(cesa_device.irq); #endif cesaTestTraceAdd(3); return; }
MV_STATUS mvCesaIfReadyGet(MV_U8 chan, MV_CESA_RESULT *pResult) { MV_STATUS status; MV_CESA_RESULT *pRes = NULL; /* Skip policy handling for single channel */ if(MV_CESA_CHANNELS == 1) return mvCesaReadyGet(chan, pResult); while(MV_TRUE) { if(readyStatus[chan] == MV_FALSE) break; pRes = &resQueue[reqEmpty]; /* Get next request */ status = mvCesaReadyGet(chan, pRes); if(status != MV_OK) { readyStatus[chan] = MV_FALSE; break; } switch(currCesaPolicy) { case CESA_WEIGHTED_CHAN_POLICY: case CESA_NULL_POLICY: chanWeight[chan] -= pRes->mbufSize; break; case CESA_FLOW_ASSOC_CHAN_POLICY: /* TBD - handle policy */ break; case CESA_SINGLE_CHAN_POLICY: break; default: mvOsPrintf("%s: Error, policy not supported\n", __func__); return MV_ERROR; } if(pResQueue[pRes->reqId] != NULL) { mvOsPrintf("%s: Warning, results queue entry is being override(reqId=%d)\n", __func__, pRes->reqId); TRC_OUTPUT(); } pResQueue[pRes->reqId] = pRes; reqEmpty = ((reqEmpty+1) % resQueueDepth); } if(pResQueue[currReqId] == NULL) { readyStatus[chan] = MV_TRUE; return MV_NOT_READY; } else { /* Release results in order */ readyStatus[chan] = MV_FALSE; /*memcpy(pResult, pResQueue[currReqId], sizeof(MV_CESA_RESULT));*/ pResult->retCode = ((MV_CESA_RESULT*)pResQueue[currReqId])->retCode; pResult->pReqPrv = ((MV_CESA_RESULT*)pResQueue[currReqId])->pReqPrv; pResult->sessionId = ((MV_CESA_RESULT*)pResQueue[currReqId])->sessionId; pResult->mbufSize = ((MV_CESA_RESULT*)pResQueue[currReqId])->mbufSize; pResult->reqId = ((MV_CESA_RESULT*)pResQueue[currReqId])->reqId; pResQueue[currReqId] = NULL; currReqId = ((currReqId+1) % resQueueDepth); return MV_OK; } }