[dpdk-dev] [PATCH v6 14/15] vhost: add notification for packed ring

Maxime Coquelin maxime.coquelin at redhat.com
Tue Jul 3 08:43:36 CEST 2018



On 07/03/2018 07:57 AM, Jason Wang wrote:
> 
> 
> On 2018年07月02日 16:16, Maxime Coquelin wrote:
>> +static inline int
>> +vhost_enable_notify_split(struct vhost_virtqueue *vq, int enable)
>> +{
>> +    if (enable)
>> +        vq->used->flags &= ~VRING_USED_F_NO_NOTIFY;
>> +    else
>> +        vq->used->flags |= VRING_USED_F_NO_NOTIFY;
>> +
>> +    return 0;
>> +}
>> +
>> +static inline int
>> +vhost_enable_notify_packed(struct virtio_net *dev,
>> +        struct vhost_virtqueue *vq, int enable)
>> +{
>> +    uint16_t flags;
>> +
>> +    if (!enable) {
>> +        vq->device_event->desc_event_flags = RING_EVENT_FLAGS_DISABLE;
>> +        return 0;
>> +    }
>> +
>> +    flags = RING_EVENT_FLAGS_ENABLE;
>> +    if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) {
>> +        flags = RING_EVENT_FLAGS_DESC;
>> +        vq->device_event->desc_event_off_wrap = vq->last_avail_idx |
>> +            vq->avail_wrap_counter << 15;
>> +    }
>> +
>> +    rte_smp_wmb();
>> +
>> +    vq->device_event->desc_event_flags = flags;
>> +
>> +    rte_smp_wmb();
>> +
> 
> We don't do this for split version. Any specific reason for this?

Yeah, maybe this is no necessary.

> Btw, looks like we don't care about the return value so using void instead?

Right, it could be a void.

Thanks!
Maxime

> Thanks
> 
>> +    return 0;
>> +}
>> +
> 
> 


More information about the dev mailing list