[v7,05/18] vdpa/ifc: add vDPA interrupt for blk device

Message ID 1651048206-282372-6-git-send-email-andy.pei@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series add virtio_blk device support to vdpa/ifc |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Pei, Andy April 27, 2022, 8:29 a.m. UTC
  For the block device type, we use one queue to transfer
both read and write requests, so we have to relay commands
on all queues.

Signed-off-by: Andy Pei <andy.pei@intel.com>
---
 drivers/vdpa/ifc/ifcvf_vdpa.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
  

Comments

Chenbo Xia May 11, 2022, 2:35 p.m. UTC | #1
> -----Original Message-----
> From: Pei, Andy <andy.pei@intel.com>
> Sent: Wednesday, April 27, 2022 4:30 PM
> To: dev@dpdk.org
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com; Cao,
> Gang <gang.cao@intel.com>; Liu, Changpeng <changpeng.liu@intel.com>
> Subject: [PATCH v7 05/18] vdpa/ifc: add vDPA interrupt for blk device
> 
> For the block device type, we use one queue to transfer
> both read and write requests, so we have to relay commands

relay interrupt?

I suggest using this commit log:

For the net device type, only interrupt of rxq needed to be relayed.
But for block, since all the queues are used for both read and write
requests. Interrupt of all queues needed to be relayed.

With this fixed:

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>

> on all queues.
> 
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> ---
>  drivers/vdpa/ifc/ifcvf_vdpa.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
> index 8ee041f..07fc3ca 100644
> --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> @@ -370,6 +370,7 @@ struct rte_vdpa_dev_info {
>  	irq_set->index = VFIO_PCI_MSIX_IRQ_INDEX;
>  	irq_set->start = 0;
>  	fd_ptr = (int *)&irq_set->data;
> +	/* The first interrupt is for the configure space change
> notification */
>  	fd_ptr[RTE_INTR_VEC_ZERO_OFFSET] =
>  		rte_intr_fd_get(internal->pdev->intr_handle);
> 
> @@ -379,7 +380,13 @@ struct rte_vdpa_dev_info {
>  	for (i = 0; i < nr_vring; i++) {
>  		rte_vhost_get_vhost_vring(internal->vid, i, &vring);
>  		fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] = vring.callfd;
> -		if ((i & 1) == 0 && m_rx == true) {
> +		if (m_rx == true &&
> +			((i & 1) == 0 || internal->device_type == IFCVF_BLK)) {
> +			/* For the net we only need to relay rx queue,
> +			 * which will change the mem of VM.
> +			 * For the blk we need to relay all the read cmd
> +			 * of each queue
> +			 */
>  			fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
>  			if (fd < 0) {
>  				DRV_LOG(ERR, "can't setup eventfd: %s",
> --
> 1.8.3.1
  
Pei, Andy May 12, 2022, 3:49 a.m. UTC | #2
Hi Chenbo,

Thanks for your reply.
Sure, I will use your commit log suggestion, and I will also change subject to "vdpa/ifc: add vDPA interrupt relay for blk device"

> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Wednesday, May 11, 2022 10:36 PM
> To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Cao, Gang <gang.cao@intel.com>; Liu,
> Changpeng <changpeng.liu@intel.com>
> Subject: RE: [PATCH v7 05/18] vdpa/ifc: add vDPA interrupt for blk device
> 
> > -----Original Message-----
> > From: Pei, Andy <andy.pei@intel.com>
> > Sent: Wednesday, April 27, 2022 4:30 PM
> > To: dev@dpdk.org
> > Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com;
> > Cao, Gang <gang.cao@intel.com>; Liu, Changpeng
> > <changpeng.liu@intel.com>
> > Subject: [PATCH v7 05/18] vdpa/ifc: add vDPA interrupt for blk device
> >
> > For the block device type, we use one queue to transfer both read and
> > write requests, so we have to relay commands
> 
> relay interrupt?
> 
> I suggest using this commit log:
> 
> For the net device type, only interrupt of rxq needed to be relayed.
> But for block, since all the queues are used for both read and write requests.
> Interrupt of all queues needed to be relayed.
> 
> With this fixed:
> 
> Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
> 
> > on all queues.
> >
> > Signed-off-by: Andy Pei <andy.pei@intel.com>
> > ---
> >  drivers/vdpa/ifc/ifcvf_vdpa.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > b/drivers/vdpa/ifc/ifcvf_vdpa.c index 8ee041f..07fc3ca 100644
> > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> > @@ -370,6 +370,7 @@ struct rte_vdpa_dev_info {
> >  	irq_set->index = VFIO_PCI_MSIX_IRQ_INDEX;
> >  	irq_set->start = 0;
> >  	fd_ptr = (int *)&irq_set->data;
> > +	/* The first interrupt is for the configure space change
> > notification */
> >  	fd_ptr[RTE_INTR_VEC_ZERO_OFFSET] =
> >  		rte_intr_fd_get(internal->pdev->intr_handle);
> >
> > @@ -379,7 +380,13 @@ struct rte_vdpa_dev_info {
> >  	for (i = 0; i < nr_vring; i++) {
> >  		rte_vhost_get_vhost_vring(internal->vid, i, &vring);
> >  		fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] = vring.callfd;
> > -		if ((i & 1) == 0 && m_rx == true) {
> > +		if (m_rx == true &&
> > +			((i & 1) == 0 || internal->device_type == IFCVF_BLK)) {
> > +			/* For the net we only need to relay rx queue,
> > +			 * which will change the mem of VM.
> > +			 * For the blk we need to relay all the read cmd
> > +			 * of each queue
> > +			 */
> >  			fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
> >  			if (fd < 0) {
> >  				DRV_LOG(ERR, "can't setup eventfd: %s",
> > --
> > 1.8.3.1
>
  

Patch

diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index 8ee041f..07fc3ca 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -370,6 +370,7 @@  struct rte_vdpa_dev_info {
 	irq_set->index = VFIO_PCI_MSIX_IRQ_INDEX;
 	irq_set->start = 0;
 	fd_ptr = (int *)&irq_set->data;
+	/* The first interrupt is for the configure space change notification */
 	fd_ptr[RTE_INTR_VEC_ZERO_OFFSET] =
 		rte_intr_fd_get(internal->pdev->intr_handle);
 
@@ -379,7 +380,13 @@  struct rte_vdpa_dev_info {
 	for (i = 0; i < nr_vring; i++) {
 		rte_vhost_get_vhost_vring(internal->vid, i, &vring);
 		fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] = vring.callfd;
-		if ((i & 1) == 0 && m_rx == true) {
+		if (m_rx == true &&
+			((i & 1) == 0 || internal->device_type == IFCVF_BLK)) {
+			/* For the net we only need to relay rx queue,
+			 * which will change the mem of VM.
+			 * For the blk we need to relay all the read cmd
+			 * of each queue
+			 */
 			fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 			if (fd < 0) {
 				DRV_LOG(ERR, "can't setup eventfd: %s",