qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: jasowang@redhat.com, Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH] xen: Drop net_rx_ok
Date: Tue, 30 Jun 2015 10:42:37 +0800	[thread overview]
Message-ID: <1435632157-9275-1-git-send-email-famz@redhat.com> (raw)

This is necessary because once we return false from .can_receive, we
need to flush the queue when the .can_receive conditions become true
again, (for example when more buffer is available).

We can rely on net_rx_packet (which checks the same conditions) to drop
the packet if the device is not ready, so drop net_xen_info.can_receive.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 hw/net/xen_nic.c | 22 ----------------------
 1 file changed, 22 deletions(-)

diff --git a/hw/net/xen_nic.c b/hw/net/xen_nic.c
index 19ecfc4..da9edc0 100644
--- a/hw/net/xen_nic.c
+++ b/hw/net/xen_nic.c
@@ -234,27 +234,6 @@ static void net_rx_response(struct XenNetDev *netdev,
 
 #define NET_IP_ALIGN 2
 
-static int net_rx_ok(NetClientState *nc)
-{
-    struct XenNetDev *netdev = qemu_get_nic_opaque(nc);
-    RING_IDX rc, rp;
-
-    if (netdev->xendev.be_state != XenbusStateConnected) {
-        return 0;
-    }
-
-    rc = netdev->rx_ring.req_cons;
-    rp = netdev->rx_ring.sring->req_prod;
-    xen_rmb();
-
-    if (rc == rp || RING_REQUEST_CONS_OVERFLOW(&netdev->rx_ring, rc)) {
-        xen_be_printf(&netdev->xendev, 2, "%s: no rx buffers (%d/%d)\n",
-                      __FUNCTION__, rc, rp);
-        return 0;
-    }
-    return 1;
-}
-
 static ssize_t net_rx_packet(NetClientState *nc, const uint8_t *buf, size_t size)
 {
     struct XenNetDev *netdev = qemu_get_nic_opaque(nc);
@@ -304,7 +283,6 @@ static ssize_t net_rx_packet(NetClientState *nc, const uint8_t *buf, size_t size
 static NetClientInfo net_xen_info = {
     .type = NET_CLIENT_OPTIONS_KIND_NIC,
     .size = sizeof(NICState),
-    .can_receive = net_rx_ok,
     .receive = net_rx_packet,
 };
 
-- 
2.4.4

             reply	other threads:[~2015-06-30  2:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30  2:42 Fam Zheng [this message]
2015-07-02 12:39 ` [Qemu-devel] [PATCH] xen: Drop net_rx_ok Stefan Hajnoczi
2015-07-20 17:12   ` Stefan Hajnoczi
2015-07-27 13:16     ` Stefan Hajnoczi
2015-07-27 22:05       ` Chen Gang
2015-07-29  9:28       ` Stefano Stabellini

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=1435632157-9275-1-git-send-email-famz@redhat.com \
    --to=famz@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).