// SPDX-License-Identifier: GPL-2.0 /* Marvell OcteonTX CPT driver * * Copyright (C) 2019 Marvell International Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation.
*/
switch (mbx.msg) { case OTX_CPT_MSG_VF_UP:
cptvf->pf_acked = true;
cptvf->num_vfs = mbx.data; break; case OTX_CPT_MSG_READY:
cptvf->pf_acked = true;
cptvf->vfid = mbx.data;
dev_dbg(&cptvf->pdev->dev, "Received VFID %d\n", cptvf->vfid); break; case OTX_CPT_MSG_QBIND_GRP:
cptvf->pf_acked = true;
cptvf->vftype = mbx.data;
dev_dbg(&cptvf->pdev->dev, "VF %d type %s group %d\n",
cptvf->vfid,
((mbx.data == OTX_CPT_SE_TYPES) ? "SE" : "AE"),
cptvf->vfgrp); break; case OTX_CPT_MSG_ACK:
cptvf->pf_acked = true; break; case OTX_CPT_MSG_NACK:
cptvf->pf_nacked = true; break; default:
dev_err(&cptvf->pdev->dev, "Invalid msg from PF, msg 0x%llx\n",
mbx.msg); break;
}
}
staticint cptvf_send_msg_to_pf_timeout(struct otx_cptvf *cptvf, struct otx_cpt_mbox *mbx)
{ int timeout = CPT_MBOX_MSG_TIMEOUT; int sleep = 10;
cptvf->pf_acked = false;
cptvf->pf_nacked = false;
cptvf_send_msg_to_pf(cptvf, mbx); /* Wait for previous message to be acked, timeout 2sec */ while (!cptvf->pf_acked) { if (cptvf->pf_nacked) return -EINVAL;
msleep(sleep); if (cptvf->pf_acked) break;
timeout -= sleep; if (!timeout) {
dev_err(&cptvf->pdev->dev, "PF didn't ack to mbox msg %llx from VF%u\n",
mbx->msg, cptvf->vfid); return -EBUSY;
}
} return 0;
}
/* * Checks if VF is able to comminicate with PF * and also gets the CPT number this VF is associated to.
*/ int otx_cptvf_check_pf_ready(struct otx_cptvf *cptvf)
{ struct otx_cpt_mbox mbx = {};
/* * Communicate VQs size to PF to program CPT(0)_PF_Q(0-15)_CTL of the VF. * Must be ACKed.
*/ int otx_cptvf_send_vq_size_msg(struct otx_cptvf *cptvf)
{ struct otx_cpt_mbox mbx = {};
/* * Communicate VF group required to PF and get the VQ binded to that group
*/ int otx_cptvf_send_vf_to_grp_msg(struct otx_cptvf *cptvf, int group)
{ struct otx_cpt_mbox mbx = {}; int ret;
mbx.msg = OTX_CPT_MSG_QBIND_GRP; /* Convey group of the VF */
mbx.data = group;
ret = cptvf_send_msg_to_pf_timeout(cptvf, &mbx); if (ret) return ret;
cptvf->vfgrp = group;
return 0;
}
/* * Communicate VF group required to PF and get the VQ binded to that group
*/ int otx_cptvf_send_vf_priority_msg(struct otx_cptvf *cptvf)
{ struct otx_cpt_mbox mbx = {};
mbx.msg = OTX_CPT_MSG_VQ_PRIORITY; /* Convey group of the VF */
mbx.data = cptvf->priority;
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.