search for: vhost_discard_vq_desc

Displaying 20 results from an estimated 310 matches for "vhost_discard_vq_desc".

2020 Jun 11
2
[PATCH RFC v6 02/11] vhost: use batched get_vq_desc version
On 2020/6/10 ??7:05, Michael S. Tsirkin wrote: >>> +EXPORT_SYMBOL_GPL(vhost_get_vq_desc); >>> /* Reverse the effect of vhost_get_vq_desc. Useful for error handling. */ >>> void vhost_discard_vq_desc(struct vhost_virtqueue *vq, int n) >>> { >>> + unfetch_descs(vq); >>> vq->last_avail_idx -= n; >> So unfetch_descs() has decreased last_avail_idx. >> Can we fix this by letting unfetch_descs() return the number and then we can >> do: >> &...
2020 Jun 11
2
[PATCH RFC v6 02/11] vhost: use batched get_vq_desc version
On 2020/6/10 ??7:05, Michael S. Tsirkin wrote: >>> +EXPORT_SYMBOL_GPL(vhost_get_vq_desc); >>> /* Reverse the effect of vhost_get_vq_desc. Useful for error handling. */ >>> void vhost_discard_vq_desc(struct vhost_virtqueue *vq, int n) >>> { >>> + unfetch_descs(vq); >>> vq->last_avail_idx -= n; >> So unfetch_descs() has decreased last_avail_idx. >> Can we fix this by letting unfetch_descs() return the number and then we can >> do: >> &...
2020 Jun 08
1
[PATCH RFC v5 13/13] vhost: drop head based APIs
...st/vhost.c > @@ -2299,12 +2299,12 @@ static int fetch_buf(struct vhost_virtqueue *vq) > return 1; > } > > -/* Reverse the effect of vhost_get_vq_desc. Useful for error handling. */ > +/* Revert the effect of fetch_buf. Useful for error handling. */ > +static > void vhost_discard_vq_desc(struct vhost_virtqueue *vq, int n) > { > vq->last_avail_idx -= n; > } > -EXPORT_SYMBOL_GPL(vhost_discard_vq_desc); The same question as previous version. Do we need to rewind cached descriptor here? Thanks
2018 Jul 16
0
[PATCH net-next V2 6/8] vhost: packed ring support
...ions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 2432002..77ec287 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -591,7 +591,7 @@ static void handle_tx(struct vhost_net *net) nvq->upend_idx = ((unsigned)nvq->upend_idx - 1) % UIO_MAXIOV; } - vhost_discard_vq_desc(vq, 1); + vhost_discard_vq_desc(vq, &used, 1); vhost_net_enable_vq(net, vq); break; } @@ -755,10 +755,12 @@ static void handle_rx(struct vhost_net *net) while ((sock_len = vhost_net_rx_peek_head_len(net, sock->sk, &busyloop_intr))) { + struct vhost_used_ele...
2010 Mar 03
1
[RFC][ PATCH 1/3] vhost-net: support multiple buffer heads in receiver
...vq_err(vq, "Unexpected header len for TX: " @@ -163,14 +162,14 @@ /* TODO: Check specific error and bomb out unless ENOBUFS? */ err = sock->ops->sendmsg(NULL, sock, &msg, len); if (unlikely(err < 0)) { - vhost_discard_vq_desc(vq); + vhost_discard(vq, 1); tx_poll_start(net, sock); break; } if (err != len) pr_err("Truncated TX packet: " " len %d != %zd\...
2010 Mar 03
1
[RFC][ PATCH 1/3] vhost-net: support multiple buffer heads in receiver
...vq_err(vq, "Unexpected header len for TX: " @@ -163,14 +162,14 @@ /* TODO: Check specific error and bomb out unless ENOBUFS? */ err = sock->ops->sendmsg(NULL, sock, &msg, len); if (unlikely(err < 0)) { - vhost_discard_vq_desc(vq); + vhost_discard(vq, 1); tx_poll_start(net, sock); break; } if (err != len) pr_err("Truncated TX packet: " " len %d != %zd\...
2017 Sep 28
1
[PATCH net-next RFC 5/5] vhost_net: basic tx virtqueue batched processing
...gt; + vhost_net_ubuf_put(ubufs); > + nvq->upend_idx = > + ((unsigned)nvq->upend_idx - 1) % UIO_MAXIOV; > + } > + vhost_discard_vq_desc(vq, 1); > + goto out; > + } > + if (err != len) > + pr_debug("Truncated TX packet: " > + " len %d != %zd\n", err, len); &g...
2017 Sep 28
1
[PATCH net-next RFC 5/5] vhost_net: basic tx virtqueue batched processing
...gt; + vhost_net_ubuf_put(ubufs); > + nvq->upend_idx = > + ((unsigned)nvq->upend_idx - 1) % UIO_MAXIOV; > + } > + vhost_discard_vq_desc(vq, 1); > + goto out; > + } > + if (err != len) > + pr_debug("Truncated TX packet: " > + " len %d != %zd\n", err, len); &g...
2010 Apr 06
1
[PATCH v3] Add Mergeable receive buffer support to vhost_net
This patch adds support for the Mergeable Receive Buffers feature to vhost_net. +-DLS Changes from 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...
2010 Apr 06
1
[PATCH v3] Add Mergeable receive buffer support to vhost_net
This patch adds support for the Mergeable Receive Buffers feature to vhost_net. +-DLS Changes from 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...
2020 Jun 03
1
[PATCH RFC 08/13] vhost/net: convert to new API: heads->bufs
...; > } else if (unlikely(vhost_enable_notify(&net->dev, > @@ -808,7 +823,7 @@ static void handle_tx_copy(struct vhost_net *net, struct socket *sock) > goto done; > } else if (unlikely(err != -ENOSPC)) { > vhost_tx_batch(net, nvq, sock, &msg); > - vhost_discard_vq_desc(vq, 1); > + vhost_discard_avail_bufs(vq, &buf, 1); > vhost_net_enable_vq(net, vq); > break; > } > @@ -829,7 +844,7 @@ static void handle_tx_copy(struct vhost_net *net, struct socket *sock) > /* TODO: Check specific error and bomb out unless ENOBUFS? */...
2018 Jul 03
0
[PATCH net-next 1/8] vhost: move get_rx_bufs to vhost.c
...talen -= len; - ++headcount; - seg += in; - } - heads[headcount - 1].len = cpu_to_vhost32(vq, len + datalen); - *iovcount = seg; - if (unlikely(log)) - *log_num = nlogs; - - /* Detect overrun */ - if (unlikely(datalen > 0)) { - r = UIO_MAXIOV + 1; - goto err; - } - return headcount; -err: - vhost_discard_vq_desc(vq, headcount); - return r; -} - /* Expects to be always run from workqueue - which acts as * read-size critical section for our kind of RCU. */ static void handle_rx(struct vhost_net *net) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index a502f1a..8814e5b 100644 --- a/drivers/vh...
2018 Apr 23
0
[RFC V3 PATCH 1/8] vhost: move get_rx_bufs to vhost.c
...talen -= len; - ++headcount; - seg += in; - } - heads[headcount - 1].len = cpu_to_vhost32(vq, len + datalen); - *iovcount = seg; - if (unlikely(log)) - *log_num = nlogs; - - /* Detect overrun */ - if (unlikely(datalen > 0)) { - r = UIO_MAXIOV + 1; - goto err; - } - return headcount; -err: - vhost_discard_vq_desc(vq, headcount); - return r; -} - /* Expects to be always run from workqueue - which acts as * read-size critical section for our kind of RCU. */ static void handle_rx(struct vhost_net *net) @@ -790,9 +713,9 @@ static void handle_rx(struct vhost_net *net) while ((sock_len = vhost_net_rx_peek_h...
2018 May 02
1
[RFC V3 PATCH 1/8] vhost: move get_rx_bufs to vhost.c
...count - 1].len = cpu_to_vhost32(vq, len + datalen); > - *iovcount = seg; > - if (unlikely(log)) > - *log_num = nlogs; > - > - /* Detect overrun */ > - if (unlikely(datalen > 0)) { > - r = UIO_MAXIOV + 1; > - goto err; > - } > - return headcount; > -err: > - vhost_discard_vq_desc(vq, headcount); > - return r; > -} > - > /* Expects to be always run from workqueue - which acts as > * read-size critical section for our kind of RCU. */ > static void handle_rx(struct vhost_net *net) > @@ -790,9 +713,9 @@ static void handle_rx(struct vhost_net *net) >...
2020 Jun 02
0
[PATCH RFC 08/13] vhost/net: convert to new API: heads->bufs
...vhost_poll_queue(&vq->poll); } else if (unlikely(vhost_enable_notify(&net->dev, @@ -808,7 +823,7 @@ static void handle_tx_copy(struct vhost_net *net, struct socket *sock) goto done; } else if (unlikely(err != -ENOSPC)) { vhost_tx_batch(net, nvq, sock, &msg); - vhost_discard_vq_desc(vq, 1); + vhost_discard_avail_bufs(vq, &buf, 1); vhost_net_enable_vq(net, vq); break; } @@ -829,7 +844,7 @@ static void handle_tx_copy(struct vhost_net *net, struct socket *sock) /* TODO: Check specific error and bomb out unless ENOBUFS? */ err = sock->ops->sendmsg(...
2020 Aug 10
2
[PATCH v4 4/4] vhost: add an RPMsg API
...__func__, in, out); > > > + goto return_buf; > > > + } > > > + > > > + return head; > > > + > > > +return_buf: > > > + /* > > > + * FIXME: might need to return the buffer using vhost_add_used() > > > + * or vhost_discard_vq_desc(). vhost_discard_vq_desc() is > > > + * described as "being useful for error handling," but it makes > > > + * the thus discarded buffers "unseen," so next time we look we > > > + * retrieve them again? > > > > > > Yes. It's...
2010 Apr 19
2
[PATCH v4] Add mergeable RX bufs support to vhost
...expected %zd\n", - iov_length(vq->hdr, s), hdr_size); + iov_length(vq->hdr, s), vhost_hlen); break; } /* TODO: Check specific error and bomb out unless ENOBUFS? */ err = sock->ops->sendmsg(NULL, sock, &msg, len); if (unlikely(err < 0)) { - vhost_discard_vq_desc(vq); + vhost_discard_desc(vq, 1); tx_poll_start(net, sock); break; } @@ -186,12 +186,25 @@ static void handle_tx(struct vhost_net * unuse_mm(net->dev.mm); } +static int vhost_head_len(struct vhost_virtqueue *vq, struct sock *sk) +{ + struct sk_buff *head; + int len = 0; + + loc...
2020 Aug 10
2
[PATCH v4 4/4] vhost: add an RPMsg API
...__func__, in, out); > > > + goto return_buf; > > > + } > > > + > > > + return head; > > > + > > > +return_buf: > > > + /* > > > + * FIXME: might need to return the buffer using vhost_add_used() > > > + * or vhost_discard_vq_desc(). vhost_discard_vq_desc() is > > > + * described as "being useful for error handling," but it makes > > > + * the thus discarded buffers "unseen," so next time we look we > > > + * retrieve them again? > > > > > > Yes. It's...
2010 Apr 19
2
[PATCH v4] Add mergeable RX bufs support to vhost
...expected %zd\n", - iov_length(vq->hdr, s), hdr_size); + iov_length(vq->hdr, s), vhost_hlen); break; } /* TODO: Check specific error and bomb out unless ENOBUFS? */ err = sock->ops->sendmsg(NULL, sock, &msg, len); if (unlikely(err < 0)) { - vhost_discard_vq_desc(vq); + vhost_discard_desc(vq, 1); tx_poll_start(net, sock); break; } @@ -186,12 +186,25 @@ static void handle_tx(struct vhost_net * unuse_mm(net->dev.mm); } +static int vhost_head_len(struct vhost_virtqueue *vq, struct sock *sk) +{ + struct sk_buff *head; + int len = 0; + + loc...
2020 Aug 04
2
[PATCH v4 4/4] vhost: add an RPMsg API
...> + "%s(): invalid %d input and %d output in request queue\n", > + __func__, in, out); > + goto return_buf; > + } > + > + return head; > + > +return_buf: > + /* > + * FIXME: might need to return the buffer using vhost_add_used() > + * or vhost_discard_vq_desc(). vhost_discard_vq_desc() is > + * described as "being useful for error handling," but it makes > + * the thus discarded buffers "unseen," so next time we look we > + * retrieve them again? Yes. It's your decision what to do on error. if you also signal an eve...