src/dpdk/drivers/common/octeontx2/otx2_dev.c
static void
pf_vf_mbox_send_up_msg(struct otx2_dev *dev, void *rec_msg)
{
	uint16_t max_bits = sizeof(dev->active_vfs[0]) * sizeof(uint64_t);
	struct otx2_mbox *vf_mbox = &dev->mbox_vfpf_up;
	struct msg_req *msg = rec_msg;
	struct mbox_msghdr *vf_msg;
	uint16_t vf;
	size_t size;

	size = RTE_ALIGN(otx2_mbox_id2size(msg->hdr.id), MBOX_MSG_ALIGN);
	/* Send UP message to all VF's */
	for (vf = 0; vf < vf_mbox->ndevs; vf++) {
		/* VF active */
		if (!(dev->active_vfs[vf / max_bits] & (BIT_ULL(vf))))
			continue;

		otx2_base_dbg("(%s) size: %zx to VF: %d",
			      otx2_mbox_id2name(msg->hdr.id), size, vf);

		/* Reserve PF/VF mbox message */
		vf_msg = otx2_mbox_alloc_msg(vf_mbox, vf, size);
		if (!vf_msg) {
			otx2_err("Failed to alloc VF%d UP message", vf);
			continue;
		}
		otx2_mbox_req_init(msg->hdr.id, vf_msg);

		/*
		 * Copy message from AF<->PF UP mbox
		 * to PF<->VF UP mbox
		 */
		otx2_mbox_memcpy((uint8_t *)vf_msg +
				 sizeof(struct mbox_msghdr), (uint8_t *)msg
				 + sizeof(struct mbox_msghdr), size -
				 sizeof(struct mbox_msghdr));

		vf_msg->rc = msg->hdr.rc;
		/* Set PF to be a sender */
		vf_msg->pcifunc = dev->pf_func;

		/* Send to VF */
		otx2_mbox_msg_send(vf_mbox, vf);
	}
}
/* Copies the message received from AF and sends it to VF */
Copies the message received from AF and sends it to VF
Copies the message received from AF and sends it to VF
static void
pf_vf_mbox_send_up_msg(struct otx2_dev *dev, void *rec_msg)
{
	uint16_t max_bits = sizeof(dev->active_vfs[0]) * sizeof(uint64_t);
	struct otx2_mbox *vf_mbox = &dev->mbox_vfpf_up;
	struct msg_req *msg = rec_msg;
	struct mbox_msghdr *vf_msg;
	uint16_t vf;
	size_t size;
	size = RTE_ALIGN(otx2_mbox_id2size(msg->hdr.id), MBOX_MSG_ALIGN);
	for (vf = 0; vf < vf_mbox->ndevs; vf++) {
		if (!(dev->active_vfs[vf / max_bits] & (BIT_ULL(vf))))
			continue;
		otx2_base_dbg("(%s) size: %zx to VF: %d",
			      otx2_mbox_id2name(msg->hdr.id), size, vf);
		vf_msg = otx2_mbox_alloc_msg(vf_mbox, vf, size);
		if (!vf_msg) {
			otx2_err("Failed to alloc VF%d UP message", vf);
			continue;
		}
		otx2_mbox_req_init(msg->hdr.id, vf_msg);
		otx2_mbox_memcpy((uint8_t *)vf_msg +
				 sizeof(struct mbox_msghdr), (uint8_t *)msg
				 + sizeof(struct mbox_msghdr), size -
				 sizeof(struct mbox_msghdr));
		vf_msg->rc = msg->hdr.rc;
		vf_msg->pcifunc = dev->pf_func;
		otx2_mbox_msg_send(vf_mbox, vf);
	}
}
static void pf_vf_mbox_send_up_msg ( struct otx2_dev * dev , void * rec_msg ) { uint16_t max_bits = sizeof ( dev -> active_vfs [ 0 ] ) * sizeof ( uint64_t ) ; struct otx2_mbox * vf_mbox = & dev -> mbox_vfpf_up ; struct msg_req * msg = rec_msg ; struct mbox_msghdr * vf_msg ; uint16_t vf ; size_t size ; size = RTE_ALIGN ( otx2_mbox_id2size ( msg -> hdr . id ) , MBOX_MSG_ALIGN ) ; for ( vf = 0 ; vf < vf_mbox -> ndevs ; vf ++ ) { if ( ! ( dev -> active_vfs [ vf / max_bits ] & ( BIT_ULL ( vf ) ) ) ) continue ; otx2_base_dbg ( " " , otx2_mbox_id2name ( msg -> hdr . id ) , size , vf ) ; vf_msg = otx2_mbox_alloc_msg ( vf_mbox , vf , size ) ; if ( ! vf_msg ) { otx2_err ( " " , vf ) ; continue ; } otx2_mbox_req_init ( msg -> hdr . id , vf_msg ) ; otx2_mbox_memcpy ( ( uint8_t * ) vf_msg + sizeof ( struct mbox_msghdr ) , ( uint8_t * ) msg + sizeof ( struct mbox_msghdr ) , size - sizeof ( struct mbox_msghdr ) ) ; vf_msg -> rc = msg -> hdr . rc ; vf_msg -> pcifunc = dev -> pf_func ; otx2_mbox_msg_send ( vf_mbox , vf ) ; } }
Copies the message received from AF and sends it to VF
Copies the message received from AF and sends it to VF
/* Send UP message to all VF's */ /* VF active */ /* Reserve PF/VF mbox message */ /*
		 * Copy message from AF<->PF UP mbox
		 * to PF<->VF UP mbox
		 */ /* Set PF to be a sender */ /* Send to VF */