search for: vhost_vring_packed_need_event

Displaying 20 results from an estimated 38 matches for "vhost_vring_packed_need_event".

2018 May 03
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...ger, old will > be a big number. > > Best regards, > Tiwei Bie > How about just do something like vhost: static u16 vhost_idx_diff(struct vhost_virtqueue *vq, u16 old, u16 new) { ??? if (new > old) ??? ??? return new - old; ??? return? (new + vq->num - old); } static bool vhost_vring_packed_need_event(struct vhost_virtqueue *vq, ??? ??? ??? ??? ??? ? __u16 event_off, __u16 new, ??? ??? ??? ??? ??? ? __u16 old) { ??? return (__u16)(vhost_idx_diff(vq, new, event_off) - 1) < ??? ?????? (__u16)vhost_idx_diff(vq, new, old); } ?
2018 May 03
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...ger, old will > be a big number. > > Best regards, > Tiwei Bie > How about just do something like vhost: static u16 vhost_idx_diff(struct vhost_virtqueue *vq, u16 old, u16 new) { ??? if (new > old) ??? ??? return new - old; ??? return? (new + vq->num - old); } static bool vhost_vring_packed_need_event(struct vhost_virtqueue *vq, ??? ??? ??? ??? ??? ? __u16 event_off, __u16 new, ??? ??? ??? ??? ??? ? __u16 old) { ??? return (__u16)(vhost_idx_diff(vq, new, event_off) - 1) < ??? ?????? (__u16)vhost_idx_diff(vq, new, old); } ?
2018 May 08
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...n't match > > > > without the need to try to add vq.num here. > > > > > > > > Thanks > > > Sorry, looks like the following should work, we need add vq.num if > > > used_wrap_counter does not match: > > > > > > static bool vhost_vring_packed_need_event(struct vhost_virtqueue *vq, > > > ??? ??? ??? ??? ??? ? __u16 off_wrap, __u16 new, > > > ??? ??? ??? ??? ??? ? __u16 old) > > > { > > > ??? bool wrap = off_wrap >> 15; > > > ??? int off = off_wrap & ~(1 << 15); > > > ??? __u...
2018 May 08
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...n't match > > > > without the need to try to add vq.num here. > > > > > > > > Thanks > > > Sorry, looks like the following should work, we need add vq.num if > > > used_wrap_counter does not match: > > > > > > static bool vhost_vring_packed_need_event(struct vhost_virtqueue *vq, > > > ??? ??? ??? ??? ??? ? __u16 off_wrap, __u16 new, > > > ??? ??? ??? ??? ??? ? __u16 old) > > > { > > > ??? bool wrap = off_wrap >> 15; > > > ??? int off = off_wrap & ~(1 << 15); > > > ??? __u...
2018 May 08
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...gt; need to compare the warp counter and return false if it doesn't match > > without the need to try to add vq.num here. > > > > Thanks > > Sorry, looks like the following should work, we need add vq.num if > used_wrap_counter does not match: > > static bool vhost_vring_packed_need_event(struct vhost_virtqueue *vq, > ??? ??? ??? ??? ??? ? __u16 off_wrap, __u16 new, > ??? ??? ??? ??? ??? ? __u16 old) > { > ??? bool wrap = off_wrap >> 15; > ??? int off = off_wrap & ~(1 << 15); > ??? __u16 d1, d2; > > ??? if (wrap != vq->used_wrap_counter) &...
2018 May 08
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...gt; need to compare the warp counter and return false if it doesn't match > > without the need to try to add vq.num here. > > > > Thanks > > Sorry, looks like the following should work, we need add vq.num if > used_wrap_counter does not match: > > static bool vhost_vring_packed_need_event(struct vhost_virtqueue *vq, > ??? ??? ??? ??? ??? ? __u16 off_wrap, __u16 new, > ??? ??? ??? ??? ??? ? __u16 old) > { > ??? bool wrap = off_wrap >> 15; > ??? int off = off_wrap & ~(1 << 15); > ??? __u16 d1, d2; > > ??? if (wrap != vq->used_wrap_counter) &...
2018 May 08
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...; How about just do something like vhost: >> >> static u16 vhost_idx_diff(struct vhost_virtqueue *vq, u16 old, u16 new) >> { >> ??? if (new > old) >> ??? ??? return new - old; >> ??? return? (new + vq->num - old); >> } >> >> static bool vhost_vring_packed_need_event(struct vhost_virtqueue *vq, >> ??? ??? ??? ??? ??? ? __u16 event_off, __u16 new, >> ??? ??? ??? ??? ??? ? __u16 old) >> { >> ??? return (__u16)(vhost_idx_diff(vq, new, event_off) - 1) < >> ??? ?????? (__u16)vhost_idx_diff(vq, new, old); >> } >> >&...
2018 May 08
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...; How about just do something like vhost: >> >> static u16 vhost_idx_diff(struct vhost_virtqueue *vq, u16 old, u16 new) >> { >> ??? if (new > old) >> ??? ??? return new - old; >> ??? return? (new + vq->num - old); >> } >> >> static bool vhost_vring_packed_need_event(struct vhost_virtqueue *vq, >> ??? ??? ??? ??? ??? ? __u16 event_off, __u16 new, >> ??? ??? ??? ??? ??? ? __u16 old) >> { >> ??? return (__u16)(vhost_idx_diff(vq, new, event_off) - 1) < >> ??? ?????? (__u16)vhost_idx_diff(vq, new, old); >> } >> >&...
2018 May 08
1
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...add vq.num here. > > > > > > > > > > > > Thanks > > > > > Sorry, looks like the following should work, we need add vq.num if > > > > > used_wrap_counter does not match: > > > > > > > > > > static bool vhost_vring_packed_need_event(struct vhost_virtqueue *vq, > > > > > ??? ??? ??? ??? ??? ? __u16 off_wrap, __u16 new, > > > > > ??? ??? ??? ??? ??? ? __u16 old) > > > > > { > > > > > ??? bool wrap = off_wrap >> 15; > > > > > ??? int off = of...
2018 May 03
0
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...; > Tiwei Bie > > > > How about just do something like vhost: > > static u16 vhost_idx_diff(struct vhost_virtqueue *vq, u16 old, u16 new) > { > ??? if (new > old) > ??? ??? return new - old; > ??? return? (new + vq->num - old); > } > > static bool vhost_vring_packed_need_event(struct vhost_virtqueue *vq, > ??? ??? ??? ??? ??? ? __u16 event_off, __u16 new, > ??? ??? ??? ??? ??? ? __u16 old) > { > ??? return (__u16)(vhost_idx_diff(vq, new, event_off) - 1) < > ??? ?????? (__u16)vhost_idx_diff(vq, new, old); > } > > ? It seems that there is a typ...
2018 May 08
0
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...re the warp counter and return false if it doesn't match >>> without the need to try to add vq.num here. >>> >>> Thanks >> Sorry, looks like the following should work, we need add vq.num if >> used_wrap_counter does not match: >> >> static bool vhost_vring_packed_need_event(struct vhost_virtqueue *vq, >> ??? ??? ??? ??? ??? ? __u16 off_wrap, __u16 new, >> ??? ??? ??? ??? ??? ? __u16 old) >> { >> ??? bool wrap = off_wrap >> 15; >> ??? int off = off_wrap & ~(1 << 15); >> ??? __u16 d1, d2; >> >> ??? if...
2018 May 08
0
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...atch >>>>> without the need to try to add vq.num here. >>>>> >>>>> Thanks >>>> Sorry, looks like the following should work, we need add vq.num if >>>> used_wrap_counter does not match: >>>> >>>> static bool vhost_vring_packed_need_event(struct vhost_virtqueue *vq, >>>> ??? ??? ??? ??? ??? ? __u16 off_wrap, __u16 new, >>>> ??? ??? ??? ??? ??? ? __u16 old) >>>> { >>>> ??? bool wrap = off_wrap >> 15; >>>> ??? int off = off_wrap & ~(1 << 15); >>&...
2018 May 16
0
[RFC V4 PATCH 8/8] vhost: event suppression for packed ring
...out used index updates. This is paired * with the barrier that the Guest executes when enabling * interrupts. */ @@ -2682,6 +2731,78 @@ static bool vhost_notify(struct vhost_dev *dev, struct vhost_virtqueue *vq) return vring_need_event(vhost16_to_cpu(vq, event), new, old); } +static bool vhost_vring_packed_need_event(struct vhost_virtqueue *vq, + __u16 off_wrap, __u16 new, + __u16 old) +{ + bool wrap = vq->used_wrap_counter; + int off = off_wrap & ~(1 << 15); + + if (new < old) { + new += vq->num; + wrap ^= 1; + } + + if (wrap != off_wrap >> 15) +...
2018 Mar 26
0
[RFC PATCH V2 8/8] vhost: event suppression for packed ring
..._notify(struct vhost_dev *dev, struct vhost_virtqueue *vq) return vring_need_event(vhost16_to_cpu(vq, event), new, old); } +static bool vhost_idx_diff(struct vhost_virtqueue *vq, u16 old, u16 new) +{ + if (new > old) + return new - old; + return (new + vq->num - old); +} + +static bool vhost_vring_packed_need_event(struct vhost_virtqueue *vq, + __u16 event_off, __u16 new, + __u16 old) +{ + return (__u16)(vhost_idx_diff(vq, new, event_off) - 1) < + (__u16)vhost_idx_diff(vq, new, old); +} + +static bool vhost_notify_packed(struct vhost_dev *dev, + struct vhost_virtqueue *vq) +{ + __virt...
2018 Mar 30
1
[RFC PATCH V2 8/8] vhost: event suppression for packed ring
...served, set to 0 */ } flags; }; > + > + > + old = vq->signalled_used; > + v = vq->signalled_used_valid; > + new = vq->signalled_used = vq->last_used_idx; > + vq->signalled_used_valid = true; > + > + if (unlikely(!v)) > + return true; > + > + return vhost_vring_packed_need_event(vq, new, old, off) && > + wrap == vq->used_wrap_counter; > +} > + > +static bool vhost_notify(struct vhost_dev *dev, struct vhost_virtqueue *vq) > +{ > + if (vhost_has_feature(vq, VIRTIO_F_RING_PACKED)) > + return vhost_notify_packed(dev, vq); > + else &gt...
2018 May 08
0
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...ctly between event and new, we just > need to compare the warp counter and return false if it doesn't match > without the need to try to add vq.num here. > > Thanks Sorry, looks like the following should work, we need add vq.num if used_wrap_counter does not match: static bool vhost_vring_packed_need_event(struct vhost_virtqueue *vq, ??? ??? ??? ??? ??? ? __u16 off_wrap, __u16 new, ??? ??? ??? ??? ??? ? __u16 old) { ??? bool wrap = off_wrap >> 15; ??? int off = off_wrap & ~(1 << 15); ??? __u16 d1, d2; ??? if (wrap != vq->used_wrap_counter) ??? ??? d1 = new + vq->num - of...
2018 Jul 03
0
[PATCH net-next 8/8] vhost: event suppression for packed ring
...mp_rmb(); + + if (vhost_get_avail(vq, event_off_wrap, + &vq->driver_event->off_wrap) < 0) { + vq_err(vq, "Failed to get driver desc_event_off/wrap"); + return true; + } + + off_wrap = vhost16_to_cpu(vq, event_off_wrap); + + if (unlikely(!v)) + return true; + + return vhost_vring_packed_need_event(vq, vq->last_used_wrap_counter, + off_wrap, new, old); +} + +static bool vhost_notify(struct vhost_dev *dev, struct vhost_virtqueue *vq) +{ + if (vhost_has_feature(vq, VIRTIO_F_RING_PACKED)) + return vhost_notify_packed(dev, vq); + else + return vhost_notify_split(dev, vq); +} + /* T...
2018 May 29
0
[RFC V5 PATCH 8/8] vhost: event suppression for packed ring
...mp_rmb(); + + if (vhost_get_avail(vq, event_off_wrap, + &vq->driver_event->off_wrap) < 0) { + vq_err(vq, "Failed to get driver desc_event_off/wrap"); + return true; + } + + off_wrap = vhost16_to_cpu(vq, event_off_wrap); + + if (unlikely(!v)) + return true; + + return vhost_vring_packed_need_event(vq, vq->used_wrap_counter, + off_wrap, new, old); +} + +static bool vhost_notify(struct vhost_dev *dev, struct vhost_virtqueue *vq) +{ + if (vhost_has_feature(vq, VIRTIO_F_RING_PACKED)) + return vhost_notify_packed(dev, vq); + else + return vhost_notify_split(dev, vq); +} + /* This a...
2018 Jul 16
0
[PATCH net-next V2 6/8] vhost: packed ring support
...NG_DESC_F_AVAIL); + flags |= cpu_to_vhost16(vq, VRING_DESC_F_USED); + } else { + flags &= ~cpu_to_vhost16(vq, VRING_DESC_F_AVAIL); + flags &= ~cpu_to_vhost16(vq, VRING_DESC_F_USED); + } + + if (write) + flags |= cpu_to_vhost16(vq, VRING_DESC_F_WRITE); + + return flags; +} + +static bool vhost_vring_packed_need_event(struct vhost_virtqueue *vq, + bool wrap, __u16 off_wrap, __u16 new, + __u16 old) +{ + int off = off_wrap & ~(1 << 15); + + if (wrap != off_wrap >> 15) + off -= vq->num; + + return vring_need_event(off, new, old); +} + +static int vhost_get_vq_desc_packed(struct vhost...
2018 May 30
2
[RFC V5 PATCH 8/8] vhost: event suppression for packed ring
...gt; + &vq->driver_event->off_wrap) < 0) { > + vq_err(vq, "Failed to get driver desc_event_off/wrap"); > + return true; > + } > + > + off_wrap = vhost16_to_cpu(vq, event_off_wrap); > + > + if (unlikely(!v)) > + return true; > + > + return vhost_vring_packed_need_event(vq, vq->used_wrap_counter, > + off_wrap, new, old); > +} > + > +static bool vhost_notify(struct vhost_dev *dev, struct vhost_virtqueue *vq) > +{ > + if (vhost_has_feature(vq, VIRTIO_F_RING_PACKED)) > + return vhost_notify_packed(dev, vq); > + else > + return...