Commit 36503e5e authored by Zhu Lingshan's avatar Zhu Lingshan Committed by Michael S. Tsirkin
Browse files

vDPA/ifcvf: implement vdpa_config_ops.get_vq_size



This commit implements vdpa_ops.get_vq_size to report
the size of a specific virtqueue.

Signed-off-by: default avatarZhu Lingshan <lingshan.zhu@intel.com>
Message-Id: <20240202163905.8834-4-lingshan.zhu@intel.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 0a926fc9
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -69,10 +69,13 @@ static int ifcvf_read_config_range(struct pci_dev *dev,
	return 0;
}

static u16 ifcvf_get_vq_size(struct ifcvf_hw *hw, u16 qid)
u16 ifcvf_get_vq_size(struct ifcvf_hw *hw, u16 qid)
{
	u16 queue_size;

	if (qid >= hw->nr_vring)
		return 0;

	vp_iowrite16(qid, &hw->common_cfg->queue_select);
	queue_size = vp_ioread16(&hw->common_cfg->queue_size);

+1 −0
Original line number Diff line number Diff line
@@ -131,4 +131,5 @@ void ifcvf_set_vq_ready(struct ifcvf_hw *hw, u16 qid, bool ready);
void ifcvf_set_driver_features(struct ifcvf_hw *hw, u64 features);
u64 ifcvf_get_driver_features(struct ifcvf_hw *hw);
u16 ifcvf_get_max_vq_size(struct ifcvf_hw *hw);
u16 ifcvf_get_vq_size(struct ifcvf_hw *hw, u16 qid);
#endif /* _IFCVF_H_ */
+9 −0
Original line number Diff line number Diff line
@@ -597,6 +597,14 @@ static int ifcvf_vdpa_get_vq_irq(struct vdpa_device *vdpa_dev,
		return -EINVAL;
}

static u16 ifcvf_vdpa_get_vq_size(struct vdpa_device *vdpa_dev,
			     u16 qid)
{
	struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);

	return ifcvf_get_vq_size(vf, qid);
}

static struct vdpa_notification_area ifcvf_get_vq_notification(struct vdpa_device *vdpa_dev,
							       u16 idx)
{
@@ -632,6 +640,7 @@ static const struct vdpa_config_ops ifc_vdpa_ops = {
	.set_vq_num	= ifcvf_vdpa_set_vq_num,
	.set_vq_address	= ifcvf_vdpa_set_vq_address,
	.get_vq_irq	= ifcvf_vdpa_get_vq_irq,
	.get_vq_size	= ifcvf_vdpa_get_vq_size,
	.kick_vq	= ifcvf_vdpa_kick_vq,
	.get_generation	= ifcvf_vdpa_get_generation,
	.get_device_id	= ifcvf_vdpa_get_device_id,