Displaying 20 results from an estimated 112 matches for "add_inbuf".
2007 Jun 07
4
[PATCH RFC 0/3] Virtio draft II
...emented the simplest solution: the struct virtio_device
contains the spinlock to use, and it's held when your callbacks get
called.
Core changes:
1) struct virtio_device has a "lock" and "priv" fields (the latter for
the driver to use, esp from callbacks).
2) add_outbuf and add_inbuf take a cb function ptr and void *, rather
than a used pointer.
3) lengths of buffers must now fit in an unsigned int, not long.
4) the virtio_sync wrapper is gone.
Block driver changes (+30 lines)
1) Convert to callbacks not interrupt.
2) Ensure both outbuf & inbuf have been used up before fin...
2007 Jun 07
4
[PATCH RFC 0/3] Virtio draft II
...emented the simplest solution: the struct virtio_device
contains the spinlock to use, and it's held when your callbacks get
called.
Core changes:
1) struct virtio_device has a "lock" and "priv" fields (the latter for
the driver to use, esp from callbacks).
2) add_outbuf and add_inbuf take a cb function ptr and void *, rather
than a used pointer.
3) lengths of buffers must now fit in an unsigned int, not long.
4) the virtio_sync wrapper is gone.
Block driver changes (+30 lines)
1) Convert to callbacks not interrupt.
2) Ensure both outbuf & inbuf have been used up before fin...
2007 Jun 07
4
[PATCH RFC 0/3] Virtio draft II
...emented the simplest solution: the struct virtio_device
contains the spinlock to use, and it's held when your callbacks get
called.
Core changes:
1) struct virtio_device has a "lock" and "priv" fields (the latter for
the driver to use, esp from callbacks).
2) add_outbuf and add_inbuf take a cb function ptr and void *, rather
than a used pointer.
3) lengths of buffers must now fit in an unsigned int, not long.
4) the virtio_sync wrapper is gone.
Block driver changes (+30 lines)
1) Convert to callbacks not interrupt.
2) Ensure both outbuf & inbuf have been used up before fin...
2016 May 24
0
[PATCH] tools/virtio: add noring tool
...file mode 100644
index 0000000..eda2f48
--- /dev/null
+++ b/tools/virtio/ringtest/noring.c
@@ -0,0 +1,69 @@
+#define _GNU_SOURCE
+#include "main.h"
+#include <assert.h>
+
+/* stub implementation: useful for measuring overhead */
+void alloc_ring(void)
+{
+}
+
+/* guest side */
+int add_inbuf(unsigned len, void *buf, void *datap)
+{
+ return 0;
+}
+
+/*
+ * skb_array API provides no way for producer to find out whether a given
+ * buffer was consumed. Our tests merely require that a successful get_buf
+ * implies that add_inbuf succeed in the past, and that add_inbuf will succeed,
+ *...
2016 May 24
0
[PATCH] tools/virtio: add noring tool
...file mode 100644
index 0000000..eda2f48
--- /dev/null
+++ b/tools/virtio/ringtest/noring.c
@@ -0,0 +1,69 @@
+#define _GNU_SOURCE
+#include "main.h"
+#include <assert.h>
+
+/* stub implementation: useful for measuring overhead */
+void alloc_ring(void)
+{
+}
+
+/* guest side */
+int add_inbuf(unsigned len, void *buf, void *datap)
+{
+ return 0;
+}
+
+/*
+ * skb_array API provides no way for producer to find out whether a given
+ * buffer was consumed. Our tests merely require that a successful get_buf
+ * implies that add_inbuf succeed in the past, and that add_inbuf will succeed,
+ *...
2014 Jan 08
1
[PATCH net-next v2 3/4] virtio-net: auto-tune mergeable rx buffer size for improved performance
...gt; > Should we also roll back the frag offset added above to avoid leaking frags?
> I believe the put_page here is sufficient for correctness. When we
> allocate a buffer using skb_page_frag_refill, we use get_page/put_page
> to allocate/free respectively. For example, if the virtqueue_add_inbuf
> succeeded, we would eventually call put_page either in virtio-net
> (e.g., page_to_skb for packets <= GOOD_COPY_LEN bytes) or later in
> __skb_frag_unref and other functions called during dev_kfree_skb.
>
> However, an offset rollback does allow the space to be reused by the ne...
2014 Jan 08
1
[PATCH net-next v2 3/4] virtio-net: auto-tune mergeable rx buffer size for improved performance
...gt; > Should we also roll back the frag offset added above to avoid leaking frags?
> I believe the put_page here is sufficient for correctness. When we
> allocate a buffer using skb_page_frag_refill, we use get_page/put_page
> to allocate/free respectively. For example, if the virtqueue_add_inbuf
> succeeded, we would eventually call put_page either in virtio-net
> (e.g., page_to_skb for packets <= GOOD_COPY_LEN bytes) or later in
> __skb_frag_unref and other functions called during dev_kfree_skb.
>
> However, an offset rollback does allow the space to be reused by the ne...
2007 May 31
5
[PATCH RFC 1/3] virtio infrastructure
...rtio_ops - virtio abstraction layer
+ * @add_outbuf: prepare to send data to the other end:
+ * vdev: the virtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.
+ * used: the length sent (set once sending is done).
+ * Returns an identifier or an error.
+ * @add_inbuf: prepare to receive data from the other end:
+ * vdev: the virtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.
+ * used: the length sent (set once data received).
+ * Returns an identifier or an error (eg. -ENOSPC).
+ * @sync: update after add_inbuf/add_o...
2007 May 31
5
[PATCH RFC 1/3] virtio infrastructure
...rtio_ops - virtio abstraction layer
+ * @add_outbuf: prepare to send data to the other end:
+ * vdev: the virtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.
+ * used: the length sent (set once sending is done).
+ * Returns an identifier or an error.
+ * @add_inbuf: prepare to receive data from the other end:
+ * vdev: the virtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.
+ * used: the length sent (set once data received).
+ * Returns an identifier or an error (eg. -ENOSPC).
+ * @sync: update after add_inbuf/add_o...
2007 May 31
5
[PATCH RFC 1/3] virtio infrastructure
...rtio_ops - virtio abstraction layer
+ * @add_outbuf: prepare to send data to the other end:
+ * vdev: the virtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.
+ * used: the length sent (set once sending is done).
+ * Returns an identifier or an error.
+ * @add_inbuf: prepare to receive data from the other end:
+ * vdev: the virtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.
+ * used: the length sent (set once data received).
+ * Returns an identifier or an error (eg. -ENOSPC).
+ * @sync: update after add_inbuf/add_o...
2016 Jun 13
0
[PATCH v8 2/5] ptr_ring: ring test
...;../../../include/linux/ptr_ring.h"
+
+static unsigned long long headcnt, tailcnt;
+static struct ptr_ring array ____cacheline_aligned_in_smp;
+
+/* implemented by ring */
+void alloc_ring(void)
+{
+ int ret = ptr_ring_init(&array, ring_size, 0);
+ assert(!ret);
+}
+
+/* guest side */
+int add_inbuf(unsigned len, void *buf, void *datap)
+{
+ int ret;
+
+ ret = __ptr_ring_produce(&array, buf);
+ if (ret >= 0) {
+ ret = 0;
+ headcnt++;
+ }
+
+ return ret;
+}
+
+/*
+ * ptr_ring API provides no way for producer to find out whether a given
+ * buffer was consumed. Our tests merely require...
2016 Jun 13
0
[PATCH v8 2/5] ptr_ring: ring test
...;../../../include/linux/ptr_ring.h"
+
+static unsigned long long headcnt, tailcnt;
+static struct ptr_ring array ____cacheline_aligned_in_smp;
+
+/* implemented by ring */
+void alloc_ring(void)
+{
+ int ret = ptr_ring_init(&array, ring_size, 0);
+ assert(!ret);
+}
+
+/* guest side */
+int add_inbuf(unsigned len, void *buf, void *datap)
+{
+ int ret;
+
+ ret = __ptr_ring_produce(&array, buf);
+ if (ret >= 0) {
+ ret = 0;
+ headcnt++;
+ }
+
+ return ret;
+}
+
+/*
+ * ptr_ring API provides no way for producer to find out whether a given
+ * buffer was consumed. Our tests merely require...
2012 Sep 03
3
[RFC 1/2] virtio_console: Add support for DMA memory allocation
...(buf_size, GFP_KERNEL);
+ buf->buf = alloc_databuf(vq->vdev, buf_size, &dma, GFP_KERNEL);
if (!buf->buf)
goto free_buf;
buf->len = 0;
@@ -414,7 +455,7 @@ static void discard_port_data(struct port *port)
port->stats.bytes_discarded += buf->len - buf->offset;
if (add_inbuf(port->in_vq, buf) < 0) {
err++;
- free_buf(buf);
+ free_buf(port->in_vq, buf, PAGE_SIZE);
}
port->inbuf = NULL;
buf = get_inbuf(port);
@@ -485,7 +526,7 @@ static void reclaim_consumed_buffers(struct port *port)
return;
}
while ((buf = virtqueue_get_buf(port->o...
2012 Sep 03
3
[RFC 1/2] virtio_console: Add support for DMA memory allocation
...(buf_size, GFP_KERNEL);
+ buf->buf = alloc_databuf(vq->vdev, buf_size, &dma, GFP_KERNEL);
if (!buf->buf)
goto free_buf;
buf->len = 0;
@@ -414,7 +455,7 @@ static void discard_port_data(struct port *port)
port->stats.bytes_discarded += buf->len - buf->offset;
if (add_inbuf(port->in_vq, buf) < 0) {
err++;
- free_buf(buf);
+ free_buf(port->in_vq, buf, PAGE_SIZE);
}
port->inbuf = NULL;
buf = get_inbuf(port);
@@ -485,7 +526,7 @@ static void reclaim_consumed_buffers(struct port *port)
return;
}
while ((buf = virtqueue_get_buf(port->o...
2016 May 15
0
[PATCH] tools/virtio: add inorder option
...guest.kicked_avail_idx = -1;
guest.last_used_idx = 0;
+#ifndef INORDER
/* Put everything in free lists. */
guest.free_head = 0;
+#endif
for (i = 0; i < ring_size - 1; i++)
ring.desc[i].next = i + 1;
host.used_idx = 0;
@@ -84,13 +98,20 @@ void alloc_ring(void)
/* guest side */
int add_inbuf(unsigned len, void *buf, void *datap)
{
- unsigned head, avail;
+ unsigned head;
+#ifndef INORDER
+ unsigned avail;
+#endif
struct vring_desc *desc;
if (!guest.num_free)
return -1;
+#ifdef INORDER
+ head = (ring_size - 1) & (guest.avail_idx++);
+#else
head = guest.free_head;
+#end...
2016 May 15
0
[PATCH] tools/virtio: add inorder option
...guest.kicked_avail_idx = -1;
guest.last_used_idx = 0;
+#ifndef INORDER
/* Put everything in free lists. */
guest.free_head = 0;
+#endif
for (i = 0; i < ring_size - 1; i++)
ring.desc[i].next = i + 1;
host.used_idx = 0;
@@ -84,13 +98,20 @@ void alloc_ring(void)
/* guest side */
int add_inbuf(unsigned len, void *buf, void *datap)
{
- unsigned head, avail;
+ unsigned head;
+#ifndef INORDER
+ unsigned avail;
+#endif
struct vring_desc *desc;
if (!guest.num_free)
return -1;
+#ifdef INORDER
+ head = (ring_size - 1) & (guest.avail_idx++);
+#else
head = guest.free_head;
+#end...
2012 Dec 07
2
[PATCH 0/1] virtio: console: regression in virtqueue_add_buf() change
...e virtio
changes, but glad that the testsuite caught this :)
Diff relative to your patch:
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 82ebe02..6a36994 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -396,6 +396,8 @@ static int add_inbuf(struct virtqueue *vq, struct port_buffer *buf)
ret = virtqueue_add_buf(vq, sg, 0, 1, buf, GFP_ATOMIC);
virtqueue_kick(vq);
+ if (!ret)
+ ret = vq->num_free;
return ret;
}
Please apply.
Rusty Russell (1):
virtio: console: virtqueue_add_buf() no longer returns > 0
drivers/cha...
2012 Dec 07
2
[PATCH 0/1] virtio: console: regression in virtqueue_add_buf() change
...e virtio
changes, but glad that the testsuite caught this :)
Diff relative to your patch:
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 82ebe02..6a36994 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -396,6 +396,8 @@ static int add_inbuf(struct virtqueue *vq, struct port_buffer *buf)
ret = virtqueue_add_buf(vq, sg, 0, 1, buf, GFP_ATOMIC);
virtqueue_kick(vq);
+ if (!ret)
+ ret = vq->num_free;
return ret;
}
Please apply.
Rusty Russell (1):
virtio: console: virtqueue_add_buf() no longer returns > 0
drivers/cha...
2012 Sep 07
4
[RFCv2 1/2] virtio_console: Add support for DMA memory allocation
...= kzalloc(buf_size, GFP_KERNEL);
+ buf->buf = alloc_databuf(vq->vdev, buf_size, GFP_KERNEL);
if (!buf->buf)
goto free_buf;
buf->len = 0;
@@ -414,7 +457,7 @@ static void discard_port_data(struct port *port)
port->stats.bytes_discarded += buf->len - buf->offset;
if (add_inbuf(port->in_vq, buf) < 0) {
err++;
- free_buf(buf);
+ free_buf(port->in_vq, buf, PAGE_SIZE);
}
port->inbuf = NULL;
buf = get_inbuf(port);
@@ -485,7 +528,7 @@ static void reclaim_consumed_buffers(struct port *port)
return;
}
while ((buf = virtqueue_get_buf(port->o...
2012 Sep 07
4
[RFCv2 1/2] virtio_console: Add support for DMA memory allocation
...= kzalloc(buf_size, GFP_KERNEL);
+ buf->buf = alloc_databuf(vq->vdev, buf_size, GFP_KERNEL);
if (!buf->buf)
goto free_buf;
buf->len = 0;
@@ -414,7 +457,7 @@ static void discard_port_data(struct port *port)
port->stats.bytes_discarded += buf->len - buf->offset;
if (add_inbuf(port->in_vq, buf) < 0) {
err++;
- free_buf(buf);
+ free_buf(port->in_vq, buf, PAGE_SIZE);
}
port->inbuf = NULL;
buf = get_inbuf(port);
@@ -485,7 +528,7 @@ static void reclaim_consumed_buffers(struct port *port)
return;
}
while ((buf = virtqueue_get_buf(port->o...