ret = otx2_cpt_sync_mbox_msg(&cptpf->afpf_mbox); /* Error code -EIO indicate there is a communication failure * to the AF. Rest of the error codes indicate that AF processed * VF messages and set the error codes in response messages * (if any) so simply forward responses to VF.
*/ if (ret == -EIO) {
dev_warn(&cptpf->pdev->dev, "AF not responding to VF%d messages\n", vf->vf_id);
mutex_unlock(&cptpf->lock); return ret;
}
mutex_unlock(&cptpf->lock); return 0;
}
cfg_req = (struct otx2_cpt_rx_inline_lf_cfg *)req; if (cptpf->lfs.lfs_num) {
dev_err(&cptpf->pdev->dev, "LF is already configured for RX inline ipsec.\n"); return -EEXIST;
} /* * Allow LFs to execute requests destined to only grp IE_TYPES and * set queue priority of each LF to high
*/
egrp = otx2_cpt_get_eng_grp(&cptpf->eng_grps, OTX2_CPT_IE_TYPES); if (egrp == OTX2_CPT_INVALID_CRYPTO_ENG_GRP) {
dev_err(&cptpf->pdev->dev, "Engine group for inline ipsec is not available\n"); return -ENOENT;
}
irqreturn_t otx2_cptpf_vfpf_mbox_intr(int __always_unused irq, void *arg)
{ struct otx2_cptpf_dev *cptpf = arg; struct otx2_cptvf_info *vf; int i, vf_idx;
u64 intr;
/* * Check which VF has raised an interrupt and schedule * corresponding work queue to process the messages
*/ for (i = 0; i < 2; i++) { /* Read the interrupt bits */
intr = otx2_cpt_read64(cptpf->reg_base, BLKADDR_RVUM, 0,
RVU_PF_VFPF_MBOX_INTX(i));
for (vf_idx = i * 64; vf_idx < cptpf->enabled_vfs; vf_idx++) {
vf = &cptpf->vf[vf_idx]; if (intr & (1ULL << vf->intr_idx)) {
queue_work(cptpf->vfpf_mbox_wq,
&vf->vfpf_mbox_work); /* Clear the interrupt */
otx2_cpt_write64(cptpf->reg_base, BLKADDR_RVUM,
0, RVU_PF_VFPF_MBOX_INTX(i),
BIT_ULL(vf->intr_idx));
}
}
} return IRQ_HANDLED;
}
for (i = 0; i < req_hdr->num_msgs; i++) {
msg = (struct mbox_msghdr *)(mdev->mbase + offset);
/* Set which VF sent this message based on mbox IRQ */
msg->pcifunc = rvu_make_pcifunc(cptpf->pdev, cptpf->pf_id,
(vf->vf_id + 1));
err = cptpf_handle_vf_req(cptpf, vf, msg,
msg->next_msgoff - offset); /* * Behave as the AF, drop the msg if there is * no memory, timeout handling also goes here
*/ if (err == -ENOMEM || err == -EIO) break;
offset = msg->next_msgoff; /* Write barrier required for VF responses which are handled by * PF driver and not forwarded to AF.
*/
smp_wmb();
} /* Send mbox responses to VF */ if (mdev->num_msgs)
otx2_mbox_msg_send(mbox, vf->vf_id);
}
if (intr & 0x1ULL) {
mbox = &cptpf->afpf_mbox;
mdev = &mbox->dev[0];
hdr = mdev->mbase + mbox->rx_start; if (hdr->num_msgs) /* Schedule work queue function to process the MBOX request */
queue_work(cptpf->afpf_mbox_wq, &cptpf->afpf_mbox_work);
mbox = &cptpf->afpf_mbox_up;
mdev = &mbox->dev[0];
hdr = mdev->mbase + mbox->rx_start; if (hdr->num_msgs) /* Schedule work queue function to process the MBOX request */
queue_work(cptpf->afpf_mbox_wq, &cptpf->afpf_mbox_up_work); /* Clear and ack the interrupt */
otx2_cpt_write64(cptpf->reg_base, BLKADDR_RVUM, 0, RVU_PF_INT,
0x1ULL);
} return IRQ_HANDLED;
}
if (msg->id >= MBOX_MSG_MAX) {
dev_err(dev, "MBOX msg with unknown ID %d\n", msg->id); return;
} if (msg->sig != OTX2_MBOX_RSP_SIG) {
dev_err(dev, "MBOX msg with wrong signature %x, ID %d\n",
msg->sig, msg->id); return;
} if (cptpf->rsrc_req_blkaddr == BLKADDR_CPT1)
lfs = &cptpf->cpt1_lfs;
switch (msg->id) { case MBOX_MSG_READY:
cptpf->pf_id = rvu_get_pf(cptpf->pdev, msg->pcifunc); break; case MBOX_MSG_MSIX_OFFSET:
rsp_msix = (struct msix_offset_rsp *) msg; for (i = 0; i < rsp_msix->cptlfs; i++)
lfs->lf[i].msix_offset = rsp_msix->cptlf_msixoff[i];
for (i = 0; i < rsp_msix->cpt1_lfs; i++)
lfs->lf[i].msix_offset = rsp_msix->cpt1_lf_msixoff[i]; break; case MBOX_MSG_CPT_RD_WR_REGISTER:
rsp_rd_wr = (struct cpt_rd_wr_reg_msg *)msg; if (msg->rc) {
dev_err(dev, "Reg %llx rd/wr(%d) failed %d\n",
rsp_rd_wr->reg_offset, rsp_rd_wr->is_write,
msg->rc); return;
} if (!rsp_rd_wr->is_write)
*rsp_rd_wr->ret_val = rsp_rd_wr->val; break; case MBOX_MSG_ATTACH_RESOURCES: if (!msg->rc)
lfs->are_lfs_attached = 1; break; case MBOX_MSG_DETACH_RESOURCES: if (!msg->rc)
lfs->are_lfs_attached = 0; break; case MBOX_MSG_CPT_INLINE_IPSEC_CFG: case MBOX_MSG_NIX_INLINE_IPSEC_CFG: case MBOX_MSG_CPT_LF_RESET: case MBOX_MSG_LMTST_TBL_SETUP: break;
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.