[PATCH v4 5/8] vdpa/ifc: only configure enabled queue
Pei, Andy
andy.pei at intel.com
Mon Oct 17 08:38:43 CEST 2022
Hi Chenbo,
Thanks for your efforts.
> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia at intel.com>
> Sent: Monday, October 17, 2022 2:24 PM
> To: Pei, Andy <andy.pei at intel.com>; dev at dpdk.org
> Cc: Xu, Rosen <rosen.xu at intel.com>; Huang, Wei <wei.huang at intel.com>;
> Cao, Gang <gang.cao at intel.com>; maxime.coquelin at redhat.com
> Subject: RE: [PATCH v4 5/8] vdpa/ifc: only configure enabled queue
>
> > -----Original Message-----
> > From: Pei, Andy <andy.pei at intel.com>
> > Sent: Thursday, October 13, 2022 4:45 PM
> > To: dev at dpdk.org
> > Cc: Xia, Chenbo <chenbo.xia at intel.com>; Xu, Rosen
> > <rosen.xu at intel.com>; Huang, Wei <wei.huang at intel.com>; Cao, Gang
> > <gang.cao at intel.com>; maxime.coquelin at redhat.com
> > Subject: [PATCH v4 5/8] vdpa/ifc: only configure enabled queue
> >
> > When configuring the hardware queue, we only configure queues which
> > have been enabled by vhost.
> >
> > Signed-off-by: Andy Pei <andy.pei at intel.com>
> > Signed-off-by: Huang Wei <wei.huang at intel.com>
> > Reviewed-by: Chenbo Xia <chenbo.xia at intel.com>
> > ---
> > drivers/vdpa/ifc/base/ifcvf.c | 3 +++ drivers/vdpa/ifc/ifcvf_vdpa.c
> > | 16 ++++++++++++++--
> > 2 files changed, 17 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/vdpa/ifc/base/ifcvf.c
> > b/drivers/vdpa/ifc/base/ifcvf.c index 60c7017..4d85911 100644
> > --- a/drivers/vdpa/ifc/base/ifcvf.c
> > +++ b/drivers/vdpa/ifc/base/ifcvf.c
> > @@ -252,6 +252,9 @@
> >
> > ifcvf_enable_mq(hw);
> > for (i = 0; i < hw->nr_vring; i++) {
> > + if (!hw->vring[i].enable)
> > + continue;
> > +
> > IFCVF_WRITE_REG16(i, &cfg->queue_select);
> > io_write64_twopart(hw->vring[i].desc, &cfg->queue_desc_lo,
> > &cfg->queue_desc_hi);
> > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > b/drivers/vdpa/ifc/ifcvf_vdpa.c index 5a24204..0c3407a 100644
> > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> > @@ -284,6 +284,8 @@ struct rte_vdpa_dev_info {
> > rte_vhost_get_negotiated_features(vid, &hw->req_features);
> >
> > for (i = 0; i < nr_vring; i++) {
> > + if (!hw->vring[i].enable)
> > + continue;
> > rte_vhost_get_vhost_vring(vid, i, &vq);
> > gpa = hva_to_gpa(vid, (uint64_t)(uintptr_t)vq.desc);
> > if (gpa == 0) {
> > @@ -499,6 +501,8 @@ struct rte_vdpa_dev_info {
> >
> > vring.kickfd = -1;
> > for (qid = 0; qid < q_num; qid++) {
> > + if (!hw->vring[qid].enable)
> > + continue;
> > ev.events = EPOLLIN | EPOLLPRI;
> > rte_vhost_get_vhost_vring(internal->vid, qid, &vring);
> > ev.data.u64 = qid | (uint64_t)vring.kickfd << 32; @@ -1058,6
> > +1062,8 @@ struct rte_vdpa_dev_info {
> > struct rte_vdpa_device *vdev;
> > struct internal_list *list;
> > struct ifcvf_internal *internal;
> > + struct ifcvf_hw *hw;
> > + uint16_t i;
> >
> > vdev = rte_vhost_get_vdpa_device(vid);
> > list = find_internal_resource_by_vdev(vdev);
> > @@ -1071,11 +1077,17 @@ struct rte_vdpa_dev_info {
> > rte_atomic32_set(&internal->dev_attached, 1);
> > update_datapath(internal);
> >
> > - if (rte_vhost_host_notifier_ctrl(vid, RTE_VHOST_QUEUE_ALL, true) !=
> > 0)
> > - DRV_LOG(NOTICE, "vDPA (%s): software relay is used.",
> > + hw = &internal->hw;
> > + for (i = 0; i < hw->nr_vring; i++) {
> > + if (!hw->vring[i].enable)
> > + continue;
> > + if (rte_vhost_host_notifier_ctrl(vid, i, true) != 0)
> > + DRV_LOG(NOTICE, "vDPA (%s): software relay is
> used.",
> > vdev->device->name);
> > + }
> >
> > internal->configured = 1;
> > + DRV_LOG(INFO, "vDPA device %s is configured", vdev->device-
> >name);
> > return 0;
> > }
> >
> > --
> > 1.8.3.1
>
> Reviewed-by: Chenbo Xia <chenbo.xia at intel.com>
More information about the dev
mailing list