From: Krishna Kumar <krkumar2@in.ibm.com>
To: davem@davemloft.net
Cc: eric.dumazet@gmail.com, kvm@vger.kernel.org, mst@redhat.com,
netdev@vger.kernel.org, rusty@rustcorp.com.au,
Krishna Kumar <krkumar2@in.ibm.com>
Subject: [PATCH 2/4] [RFC] virtio: Introduce new API to get free space
Date: Wed, 04 May 2011 19:33:19 +0530 [thread overview]
Message-ID: <20110504140319.14817.23145.sendpatchset@krkumar2.in.ibm.com> (raw)
In-Reply-To: <20110504140258.14817.66596.sendpatchset@krkumar2.in.ibm.com>
Introduce virtqueue_get_capacity() to help bail out of transmit
path early. Also remove notification when we run out of space (I
am not sure if this should be under a feature bit).
Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
---
drivers/virtio/virtio_ring.c | 13 ++++++++-----
include/linux/virtio.h | 5 +++++
2 files changed, 13 insertions(+), 5 deletions(-)
diff -ruNp org/include/linux/virtio.h new/include/linux/virtio.h
--- org/include/linux/virtio.h 2011-05-04 18:57:06.000000000 +0530
+++ new/include/linux/virtio.h 2011-05-04 18:57:09.000000000 +0530
@@ -27,6 +27,9 @@ struct virtqueue {
/**
* operations for virtqueue
+ * virtqueue_get_capacity: Get vq capacity
+ * vq: the struct virtqueue we're talking about.
+ * Returns remaining capacity of queue
* virtqueue_add_buf: expose buffer to other end
* vq: the struct virtqueue we're talking about.
* sg: the description of the buffer(s).
@@ -62,6 +65,8 @@ struct virtqueue {
* All operations can be called in any context.
*/
+int virtqueue_get_capacity(struct virtqueue *vq);
+
int virtqueue_add_buf_gfp(struct virtqueue *vq,
struct scatterlist sg[],
unsigned int out_num,
diff -ruNp org/drivers/virtio/virtio_ring.c new/drivers/virtio/virtio_ring.c
--- org/drivers/virtio/virtio_ring.c 2011-05-04 18:57:06.000000000 +0530
+++ new/drivers/virtio/virtio_ring.c 2011-05-04 18:57:09.000000000 +0530
@@ -156,6 +156,14 @@ static int vring_add_indirect(struct vri
return head;
}
+int virtqueue_get_capacity(struct virtqueue *_vq)
+{
+ struct vring_virtqueue *vq = to_vvq(_vq);
+
+ return vq->num_free;
+}
+EXPORT_SYMBOL_GPL(virtqueue_get_capacity);
+
int virtqueue_add_buf_gfp(struct virtqueue *_vq,
struct scatterlist sg[],
unsigned int out,
@@ -185,11 +193,6 @@ int virtqueue_add_buf_gfp(struct virtque
if (vq->num_free < out + in) {
pr_debug("Can't add buf len %i - avail = %i\n",
out + in, vq->num_free);
- /* FIXME: for historical reasons, we force a notify here if
- * there are outgoing parts to the buffer. Presumably the
- * host should service the ring ASAP. */
- if (out)
- vq->notify(&vq->vq);
END_USE(vq);
return -ENOSPC;
}
next prev parent reply other threads:[~2011-05-04 14:03 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-04 14:02 [PATCH 0/4] [RFC] virtio-net: Improve small packet performance Krishna Kumar
2011-05-04 14:03 ` [PATCH 1/4] [RFC] netdevice: Introduce per-txq xmit_restart Krishna Kumar
2011-05-04 14:03 ` Krishna Kumar [this message]
2011-05-04 14:50 ` [PATCH 2/4] [RFC] virtio: Introduce new API to get free space Michael S. Tsirkin
2011-05-04 20:00 ` Michael S. Tsirkin
2011-05-05 3:08 ` Krishna Kumar2
2011-05-05 9:13 ` Michael S. Tsirkin
2011-05-04 19:58 ` Michael S. Tsirkin
2011-05-04 14:03 ` [PATCH 3/4] [RFC] virtio-net: Changes to virtio-net driver Krishna Kumar
2011-05-05 12:28 ` Michael S. Tsirkin
2011-05-04 14:03 ` [PATCH 4/4] [RFC] sched: Changes to dequeue_skb Krishna Kumar
2011-05-04 14:46 ` [PATCH 0/4] [RFC] virtio-net: Improve small packet performance Michael S. Tsirkin
2011-05-04 14:59 ` Krishna Kumar2
2011-05-04 21:23 ` Michael S. Tsirkin
2011-05-05 8:03 ` Krishna Kumar2
2011-05-05 9:04 ` Michael S. Tsirkin
2011-05-05 9:43 ` Krishna Kumar2
2011-05-05 10:12 ` Michael S. Tsirkin
2011-05-05 10:57 ` Krishna Kumar2
2011-05-05 15:27 ` Krishna Kumar2
2011-05-05 15:34 ` Michael S. Tsirkin
2011-05-07 7:15 ` Krishna Kumar2
2011-05-05 15:36 ` Krishna Kumar2
2011-05-05 15:37 ` Michael S. Tsirkin
2011-05-05 15:42 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110504140319.14817.23145.sendpatchset@krkumar2.in.ibm.com \
--to=krkumar2@in.ibm.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).