From: Amit Shah <amit.shah@redhat.com>
To: rusty@rustcorp.com.au
Cc: Amit Shah <amit.shah@redhat.com>,
virtualization@lists.linux-foundation.org
Subject: [PATCH v2 2/2] virtio_net: Use can_add_buf to test for enough room to add
Date: Wed, 19 Aug 2009 13:55:24 +0530 [thread overview]
Message-ID: <1250670324-8426-2-git-send-email-amit.shah@redhat.com> (raw)
In-Reply-To: <1250670324-8426-1-git-send-email-amit.shah@redhat.com>
Use the can_add_buf virtqueue operation to test if
there's room to add another buf to the queue.
Saves us one cycle of alloc-add-free if the queue
was full.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
v2:
convert usage in try_fill_recv() as well
drivers/net/virtio_net.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 2a6e81d..a93ca07 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -280,7 +280,7 @@ static void try_fill_recv_maxbufs(struct virtnet_info *vi)
int num, err, i;
sg_init_table(sg, 2+MAX_SKB_FRAGS);
- for (;;) {
+ while (vi->rvq->vq_ops->can_add_buf(vi->rvq)) {
struct virtio_net_hdr *hdr;
skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN + NET_IP_ALIGN);
@@ -338,7 +338,7 @@ static void try_fill_recv(struct virtnet_info *vi)
return;
}
- for (;;) {
+ while (vi->rvq->vq_ops->can_add_buf(vi->rvq)) {
skb_frag_t *f;
skb = netdev_alloc_skb(vi->dev, GOOD_COPY_LEN + NET_IP_ALIGN);
--
1.6.2.5
prev parent reply other threads:[~2009-08-19 8:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-19 8:25 [PATCH v2 1/2] virtio: Add a can_add_buf helper Amit Shah
2009-08-19 8:25 ` Amit Shah [this message]
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=1250670324-8426-2-git-send-email-amit.shah@redhat.com \
--to=amit.shah@redhat.com \
--cc=rusty@rustcorp.com.au \
--cc=virtualization@lists.linux-foundation.org \
/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).