lkml.org 
[lkml]   [2020]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 13/17] vdpa_sim: set vringh notify callback
On Mon, Nov 30, 2020 at 11:27:51AM +0800, Jason Wang wrote:
>
>On 2020/11/26 下午10:49, Stefano Garzarella wrote:
>>Instead of calling the vq callback directly, we can leverage the
>>vringh_notify() function, adding vdpasim_vq_notify() and setting it
>>in the vringh notify callback.
>>
>>Suggested-by: Jason Wang <jasowang@redhat.com>
>>Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
>>---
>> drivers/vdpa/vdpa_sim/vdpa_sim.c | 21 +++++++++++++++++----
>> 1 file changed, 17 insertions(+), 4 deletions(-)
>>
>>diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
>>index 8b87ce0485b6..4327efd6d41e 100644
>>--- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
>>+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
>>@@ -120,6 +120,17 @@ static struct vdpasim *dev_to_sim(struct device *dev)
>> return vdpa_to_sim(vdpa);
>> }
>>+static void vdpasim_vq_notify(struct vringh *vring)
>>+{
>>+ struct vdpasim_virtqueue *vq =
>>+ container_of(vring, struct vdpasim_virtqueue, vring);
>>+
>>+ if (!vq->cb)
>>+ return;
>>+
>>+ vq->cb(vq->private);
>>+}
>>+
>> static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx)
>> {
>> struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];
>>@@ -131,6 +142,8 @@ static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx)
>> (uintptr_t)vq->driver_addr,
>> (struct vring_used *)
>> (uintptr_t)vq->device_addr);
>>+
>>+ vq->vring.notify = vdpasim_vq_notify;
>
>
>Do we need to clear notify during reset?

Right, I'll clear it.

>
>Other looks good.
>

Thanks,
Stefano

\
 
 \ /
  Last update: 2020-11-30 15:20    [W:0.102 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site