[dpdk-dev] net/virtio: fix queue notify

Message ID 1491907468-68207-1-git-send-email-xiao.w.wang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Yuanhan Liu
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Xiao Wang April 11, 2017, 10:44 a.m. UTC
  According to spec, we should write virtqueue index into the notify
address, rather than 1. Besides, some HW backend may rely on the data
written to identify which queue need to serve.

Fixes: 6ba1f63b5ab0 ("virtio: support specification 1.0")
Cc: stable@dpdk.org

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/virtio/virtio_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Stephen Hemminger April 12, 2017, 9:39 p.m. UTC | #1
On Tue, 11 Apr 2017 03:44:28 -0700
Xiao Wang <xiao.w.wang@intel.com> wrote:

> According to spec, we should write virtqueue index into the notify
> address, rather than 1. Besides, some HW backend may rely on the data
> written to identify which queue need to serve.
> 
> Fixes: 6ba1f63b5ab0 ("virtio: support specification 1.0")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> ---
>  drivers/net/virtio/virtio_pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
> index ce9a9d3..b767c03 100644
> --- a/drivers/net/virtio/virtio_pci.c
> +++ b/drivers/net/virtio/virtio_pci.c
> @@ -504,7 +504,7 @@
>  static void
>  modern_notify_queue(struct virtio_hw *hw __rte_unused, struct virtqueue *vq)
>  {
> -	rte_write16(1, vq->notify_addr);
> +	rte_write16(vq->vq_queue_index, vq->notify_addr);
>  }


Yes, this looks correct. It is what Linux and FreeBSD drivers do.

Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
  
Yuanhan Liu April 13, 2017, 1:39 a.m. UTC | #2
On Wed, Apr 12, 2017 at 02:39:25PM -0700, Stephen Hemminger wrote:
> On Tue, 11 Apr 2017 03:44:28 -0700
> Xiao Wang <xiao.w.wang@intel.com> wrote:
> 
> > According to spec, we should write virtqueue index into the notify
> > address, rather than 1. Besides, some HW backend may rely on the data
> > written to identify which queue need to serve.
> > 
> > Fixes: 6ba1f63b5ab0 ("virtio: support specification 1.0")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> > ---
> >  drivers/net/virtio/virtio_pci.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
> > index ce9a9d3..b767c03 100644
> > --- a/drivers/net/virtio/virtio_pci.c
> > +++ b/drivers/net/virtio/virtio_pci.c
> > @@ -504,7 +504,7 @@
> >  static void
> >  modern_notify_queue(struct virtio_hw *hw __rte_unused, struct virtqueue *vq)
> >  {
> > -	rte_write16(1, vq->notify_addr);
> > +	rte_write16(vq->vq_queue_index, vq->notify_addr);
> >  }
> 
> 
> Yes, this looks correct. It is what Linux and FreeBSD drivers do.
> 
> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>

Applied to dpdk-next-virtio.

Thanks.

	--yliu
  

Patch

diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index ce9a9d3..b767c03 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -504,7 +504,7 @@ 
 static void
 modern_notify_queue(struct virtio_hw *hw __rte_unused, struct virtqueue *vq)
 {
-	rte_write16(1, vq->notify_addr);
+	rte_write16(vq->vq_queue_index, vq->notify_addr);
 }
 
 const struct virtio_pci_ops modern_ops = {