search for: vhost_add_us

Displaying 20 results from an estimated 270 matches for "vhost_add_us".

Did you mean: vhost_add_used
2013 Aug 16
1
[PATCH 3/6] vhost: switch to use vhost_add_used_n()
On Fri, Aug 16, 2013 at 01:16:27PM +0800, Jason Wang wrote: > Let vhost_add_used() to use vhost_add_used_n() to reduce the code duplication. > > Signed-off-by: Jason Wang <jasowang at redhat.com> Does compiler inline it then? Reason I ask, last time I checked put_user inside vhost_add_used was much cheaper than copy_to_user inside vhost_add_used_n, so I wouldn...
2013 Aug 16
1
[PATCH 3/6] vhost: switch to use vhost_add_used_n()
On Fri, Aug 16, 2013 at 01:16:27PM +0800, Jason Wang wrote: > Let vhost_add_used() to use vhost_add_used_n() to reduce the code duplication. > > Signed-off-by: Jason Wang <jasowang at redhat.com> Does compiler inline it then? Reason I ask, last time I checked put_user inside vhost_add_used was much cheaper than copy_to_user inside vhost_add_used_n, so I wouldn...
2017 Sep 26
2
[PATCH net-next RFC 3/5] vhost: introduce vhost_add_used_idx()
...++++++++++++++++++++ > drivers/vhost/vhost.h | 1 + > 2 files changed, 34 insertions(+) > > diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c > index 8424166d..6532cda 100644 > --- a/drivers/vhost/vhost.c > +++ b/drivers/vhost/vhost.c > @@ -2178,6 +2178,39 @@ int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len) > } > EXPORT_SYMBOL_GPL(vhost_add_used); > > +int vhost_add_used_idx(struct vhost_virtqueue *vq, int n) > +{ > + u16 old, new; > + > + old = vq->last_used_idx; > + new = (vq->last_used_idx += n); > + /...
2017 Sep 26
2
[PATCH net-next RFC 3/5] vhost: introduce vhost_add_used_idx()
...++++++++++++++++++++ > drivers/vhost/vhost.h | 1 + > 2 files changed, 34 insertions(+) > > diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c > index 8424166d..6532cda 100644 > --- a/drivers/vhost/vhost.c > +++ b/drivers/vhost/vhost.c > @@ -2178,6 +2178,39 @@ int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len) > } > EXPORT_SYMBOL_GPL(vhost_add_used); > > +int vhost_add_used_idx(struct vhost_virtqueue *vq, int n) > +{ > + u16 old, new; > + > + old = vq->last_used_idx; > + new = (vq->last_used_idx += n); > + /...
2020 Jun 07
0
[PATCH RFC v5 13/13] vhost: drop head based APIs
...rd_vq_desc(struct vhost_virtqueue *vq, int n) { vq->last_avail_idx -= n; } -EXPORT_SYMBOL_GPL(vhost_discard_vq_desc); /* This function returns a value > 0 if a descriptor was found, or 0 if none were found. * A negative code is returned on error. */ @@ -2464,8 +2464,7 @@ static int __vhost_add_used_n(struct vhost_virtqueue *vq, return 0; } -/* After we've used one of their buffers, we tell them about it. We'll then - * want to notify the guest, using eventfd. */ +static int vhost_add_used_n(struct vhost_virtqueue *vq, struct vring_used_elem *heads, unsigned count) {...
2010 Apr 06
1
[PATCH v3] Add Mergeable receive buffer support to vhost_net
...m previous revision: 1) renamed: vhost_discard_vq_desc -> vhost_discard_desc vhost_get_heads -> vhost_get_desc_n vhost_get_vq_desc -> vhost_get_desc 2) added heads as argument to ghost_get_desc_n 3) changed "vq->heads" from iovec to vring_used_elem, removed casts 4) changed vhost_add_used to do multiple elements in a single copy_to_user, or two when we wrap the ring. 5) removed rxmaxheadcount and available buffer checks in favor of running until an allocation failure, but making sure we break the loop if we get two in a row, indicating we have at least 1 buffer, but not enough...
2010 Apr 06
1
[PATCH v3] Add Mergeable receive buffer support to vhost_net
...m previous revision: 1) renamed: vhost_discard_vq_desc -> vhost_discard_desc vhost_get_heads -> vhost_get_desc_n vhost_get_vq_desc -> vhost_get_desc 2) added heads as argument to ghost_get_desc_n 3) changed "vq->heads" from iovec to vring_used_elem, removed casts 4) changed vhost_add_used to do multiple elements in a single copy_to_user, or two when we wrap the ring. 5) removed rxmaxheadcount and available buffer checks in favor of running until an allocation failure, but making sure we break the loop if we get two in a row, indicating we have at least 1 buffer, but not enough...
2017 Sep 27
2
[PATCH net-next RFC 3/5] vhost: introduce vhost_add_used_idx()
...2 files changed, 34 insertions(+) > > > > > > diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c > > > index 8424166d..6532cda 100644 > > > --- a/drivers/vhost/vhost.c > > > +++ b/drivers/vhost/vhost.c > > > @@ -2178,6 +2178,39 @@ int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len) > > > } > > > EXPORT_SYMBOL_GPL(vhost_add_used); > > > +int vhost_add_used_idx(struct vhost_virtqueue *vq, int n) > > > +{ > > > + u16 old, new; > > > + > > > + old = vq->...
2017 Sep 27
2
[PATCH net-next RFC 3/5] vhost: introduce vhost_add_used_idx()
...2 files changed, 34 insertions(+) > > > > > > diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c > > > index 8424166d..6532cda 100644 > > > --- a/drivers/vhost/vhost.c > > > +++ b/drivers/vhost/vhost.c > > > @@ -2178,6 +2178,39 @@ int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len) > > > } > > > EXPORT_SYMBOL_GPL(vhost_add_used); > > > +int vhost_add_used_idx(struct vhost_virtqueue *vq, int n) > > > +{ > > > + u16 old, new; > > > + > > > + old = vq->...
2010 Mar 03
1
[RFC][ PATCH 1/3] vhost-net: support multiple buffer heads in receiver
...discard(vq, 1); tx_poll_start(net, sock); break; } if (err != len) pr_err("Truncated TX packet: " " len %d != %zd\n", err, len); - vhost_add_used_and_signal(&net->dev, vq, head, 0); + vhost_add_used_and_signal(&net->dev, vq, &head, 1); total_len += len; if (unlikely(total_len >= VHOST_NET_WEIGHT)) { vhost_poll_queue(&vq->poll); @@ -182,12 +181...
2010 Mar 03
1
[RFC][ PATCH 1/3] vhost-net: support multiple buffer heads in receiver
...discard(vq, 1); tx_poll_start(net, sock); break; } if (err != len) pr_err("Truncated TX packet: " " len %d != %zd\n", err, len); - vhost_add_used_and_signal(&net->dev, vq, head, 0); + vhost_add_used_and_signal(&net->dev, vq, &head, 1); total_len += len; if (unlikely(total_len >= VHOST_NET_WEIGHT)) { vhost_poll_queue(&vq->poll); @@ -182,12 +181...
2014 Jul 01
0
[PATCH RFC 2/2] vhost: support urgent descriptors
...ue *, bool *urgent, struct iovec iov[], unsigned int iov_count, unsigned int *out_num, unsigned int *in_num, struct vhost_log *log, unsigned int *log_num); void vhost_discard_vq_desc(struct vhost_virtqueue *, int n); int vhost_init_used(struct vhost_virtqueue *); -int vhost_add_used(struct vhost_virtqueue *, unsigned int head, int len); -int vhost_add_used_n(struct vhost_virtqueue *, struct vring_used_elem *heads, - unsigned count); -void vhost_add_used_and_signal(struct vhost_dev *, struct vhost_virtqueue *, +int vhost_add_used(struct vhost_virtqueue *, bool urgent, +...
2020 Jun 03
2
[PATCH RFC 07/13] vhost: format-independent API for used buffers
..._get_avail_buf. Useful for error handling. */ > +void vhost_discard_avail_bufs(struct vhost_virtqueue *vq, > + struct vhost_buf *buf, unsigned count) > +{ > + vhost_discard_vq_desc(vq, count); > +} > +EXPORT_SYMBOL_GPL(vhost_discard_avail_bufs); > > static int __vhost_add_used_n(struct vhost_virtqueue *vq, > struct vring_used_elem *heads, > @@ -2459,6 +2471,26 @@ int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len) > } > EXPORT_SYMBOL_GPL(vhost_add_used); > > +int vhost_put_used_buf(struct vhost_virtqueue *vq, str...
2020 Jun 03
2
[PATCH RFC 07/13] vhost: format-independent API for used buffers
..._get_avail_buf. Useful for error handling. */ > +void vhost_discard_avail_bufs(struct vhost_virtqueue *vq, > + struct vhost_buf *buf, unsigned count) > +{ > + vhost_discard_vq_desc(vq, count); > +} > +EXPORT_SYMBOL_GPL(vhost_discard_avail_bufs); > > static int __vhost_add_used_n(struct vhost_virtqueue *vq, > struct vring_used_elem *heads, > @@ -2459,6 +2471,26 @@ int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len) > } > EXPORT_SYMBOL_GPL(vhost_add_used); > > +int vhost_put_used_buf(struct vhost_virtqueue *vq, str...
2019 Apr 05
1
[PATCH RFC 2/4] vhost/vsock: split packets to send using multiple buffers
...+ */ > > + if (payload_len > iov_len - sizeof(pkt->hdr)) > > Integer underflow. iov_len is controlled by the guest and therefore > untrusted. Please validate iov_len before assuming it's larger than > sizeof(pkt->hdr). > Okay, I'll do it! > > - vhost_add_used(vq, head, sizeof(pkt->hdr) + pkt->len); > > + vhost_add_used(vq, head, sizeof(pkt->hdr) + payload_len); > > added = true; > > > > + pkt->off += payload_len; > > + > > + /* If we didn't send all the payload we can requeue the packet >...
2019 Apr 05
1
[PATCH RFC 2/4] vhost/vsock: split packets to send using multiple buffers
...+ */ > > + if (payload_len > iov_len - sizeof(pkt->hdr)) > > Integer underflow. iov_len is controlled by the guest and therefore > untrusted. Please validate iov_len before assuming it's larger than > sizeof(pkt->hdr). > Okay, I'll do it! > > - vhost_add_used(vq, head, sizeof(pkt->hdr) + pkt->len); > > + vhost_add_used(vq, head, sizeof(pkt->hdr) + payload_len); > > added = true; > > > > + pkt->off += payload_len; > > + > > + /* If we didn't send all the payload we can requeue the packet >...
2020 Jun 08
2
[PATCH RFC v5 12/13] vhost/vsock: switch to the buf API
...d_pkt_list_lock); > list_add(&pkt->list, &vsock->send_pkt_list); > spin_unlock_bh(&vsock->send_pkt_list_lock); > @@ -186,7 +188,8 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock, > */ > virtio_transport_deliver_tap_pkt(pkt); > > - vhost_add_used(vq, head, sizeof(pkt->hdr) + payload_len); > + buf.in_len = sizeof(pkt->hdr) + payload_len; > + vhost_put_used_buf(vq, &buf); > added = true; > > pkt->off += payload_len; > @@ -440,7 +443,8 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work)...
2020 Jun 08
2
[PATCH RFC v5 12/13] vhost/vsock: switch to the buf API
...d_pkt_list_lock); > list_add(&pkt->list, &vsock->send_pkt_list); > spin_unlock_bh(&vsock->send_pkt_list_lock); > @@ -186,7 +188,8 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock, > */ > virtio_transport_deliver_tap_pkt(pkt); > > - vhost_add_used(vq, head, sizeof(pkt->hdr) + payload_len); > + buf.in_len = sizeof(pkt->hdr) + payload_len; > + vhost_put_used_buf(vq, &buf); > added = true; > > pkt->off += payload_len; > @@ -440,7 +443,8 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work)...
2019 Apr 04
1
[PATCH RFC 2/4] vhost/vsock: split packets to send using multiple buffers
...pkt->len, &iov_iter); - if (nbytes != pkt->len) { + nbytes = copy_to_iter(pkt->buf + pkt->off, payload_len, + &iov_iter); + if (nbytes != payload_len) { virtio_transport_free_pkt(pkt); vq_err(vq, "Faulted on copying pkt buf\n"); break; } - vhost_add_used(vq, head, sizeof(pkt->hdr) + pkt->len); + vhost_add_used(vq, head, sizeof(pkt->hdr) + payload_len); added = true; + pkt->off += payload_len; + + /* If we didn't send all the payload we can requeue the packet + * to send it with the next available buffer. + */ + if (pk...
2014 Jul 01
5
[PATCH RFC 1/2] virtio: support for urgent descriptors
Below should be useful for some experiments Jason is doing. I thought I'd send it out for early review/feedback. Compiled-only at this point. event idx feature allows us to defer interrupts until a specific # of descriptors were used. Sometimes it might be useful to get an interrupt after a specific descriptor, regardless. This adds a descriptor flag for this, and an API to create an urgent