The pointer to event structure should be cast to uintptr_t first. Fixes: f803734b0f2e ("net/virtio: vring init for packed queues") Cc: stable@dpdk.org Signed-off-by: Tiwei Bie <tiwei.bie@intel.com> --- drivers/net/virtio/virtio_ring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_ring.h b/drivers/net/virtio/virtio_ring.h index 1760823c6..5a37629fe 100644 --- a/drivers/net/virtio/virtio_ring.h +++ b/drivers/net/virtio/virtio_ring.h @@ -165,7 +165,7 @@ vring_init_packed(struct vring_packed *vr, uint8_t *p, unsigned long align, vr->driver_event = (struct vring_packed_desc_event *)(p + vr->num * sizeof(struct vring_packed_desc)); vr->device_event = (struct vring_packed_desc_event *) - RTE_ALIGN_CEIL((uintptr_t)(vr->driver_event + + RTE_ALIGN_CEIL(((uintptr_t)vr->driver_event + sizeof(struct vring_packed_desc_event)), align); } -- 2.17.1
When disabling interrupt, the shadow event flags should also be updated accordingly. The unnecessary wmb is also dropped. Fixes: e9f4feb7e622 ("net/virtio: add packed virtqueue helpers") Cc: stable@dpdk.org Signed-off-by: Tiwei Bie <tiwei.bie@intel.com> --- drivers/net/virtio/virtqueue.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h index ca9d8e6e3..24fa873c3 100644 --- a/drivers/net/virtio/virtqueue.h +++ b/drivers/net/virtio/virtqueue.h @@ -321,12 +321,13 @@ vring_desc_init_split(struct vring_desc *dp, uint16_t n) static inline void virtqueue_disable_intr_packed(struct virtqueue *vq) { - uint16_t *event_flags = &vq->ring_packed.driver_event->desc_event_flags; - - *event_flags = RING_EVENT_FLAGS_DISABLE; + if (vq->event_flags_shadow != RING_EVENT_FLAGS_DISABLE) { + vq->event_flags_shadow = RING_EVENT_FLAGS_DISABLE; + vq->ring_packed.driver_event->desc_event_flags = + vq->event_flags_shadow; + } } - /** * Tell the backend not to interrupt us. */ @@ -348,7 +349,6 @@ virtqueue_enable_intr_packed(struct virtqueue *vq) uint16_t *event_flags = &vq->ring_packed.driver_event->desc_event_flags; if (vq->event_flags_shadow == RING_EVENT_FLAGS_DISABLE) { - virtio_wmb(vq->hw->weak_barriers); vq->event_flags_shadow = RING_EVENT_FLAGS_ENABLE; *event_flags = vq->event_flags_shadow; } -- 2.17.1
Typically, after enabling Rx interrupt, a check should be done to make sure that there is no new incoming packets before going to sleep. So a barrier is needed to make sure that any following check won't happen before the interrupt is actually enabled. Fixes: c056be239db5 ("net/virtio: add Rx interrupt enable/disable functions") Cc: stable@dpdk.org Signed-off-by: Tiwei Bie <tiwei.bie@intel.com> --- drivers/net/virtio/virtio_ethdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 78ba7bd29..ff16fb63e 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -850,10 +850,12 @@ virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int virtio_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) { + struct virtio_hw *hw = dev->data->dev_private; struct virtnet_rx *rxvq = dev->data->rx_queues[queue_id]; struct virtqueue *vq = rxvq->vq; virtqueue_enable_intr(vq); + virtio_mb(hw->weak_barriers); return 0; } -- 2.17.1
On Tue, Mar 19, 2019 at 02:43:03PM +0800, Tiwei Bie wrote:
>The pointer to event structure should be cast to uintptr_t first.
>
>Fixes: f803734b0f2e ("net/virtio: vring init for packed queues")
>Cc: stable@dpdk.org
>
>Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
>---
> drivers/net/virtio/virtio_ring.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
On 3/19/19 7:43 AM, Tiwei Bie wrote:
> The pointer to event structure should be cast to uintptr_t first.
>
> Fixes: f803734b0f2e ("net/virtio: vring init for packed queues")
> Cc: stable@dpdk.org
>
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
> drivers/net/virtio/virtio_ring.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
On 3/19/19 7:43 AM, Tiwei Bie wrote:
> When disabling interrupt, the shadow event flags should also be
> updated accordingly. The unnecessary wmb is also dropped.
>
> Fixes: e9f4feb7e622 ("net/virtio: add packed virtqueue helpers")
> Cc: stable@dpdk.org
>
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
> drivers/net/virtio/virtqueue.h | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
On 3/19/19 7:43 AM, Tiwei Bie wrote:
> Typically, after enabling Rx interrupt, a check should be done
> to make sure that there is no new incoming packets before going
> to sleep. So a barrier is needed to make sure that any following
> check won't happen before the interrupt is actually enabled.
>
> Fixes: c056be239db5 ("net/virtio: add Rx interrupt enable/disable functions")
> Cc: stable@dpdk.org
>
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
> drivers/net/virtio/virtio_ethdev.c | 2 ++
> 1 file changed, 2 insertions(+)
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime