From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Fam Zheng <famz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PULL for-2.4 06/16] pcnet: Drop pcnet_can_receive
Date: Mon, 27 Jul 2015 14:51:51 +0100 [thread overview]
Message-ID: <1438005121-31153-7-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1438005121-31153-1-git-send-email-stefanha@redhat.com>
From: Fam Zheng <famz@redhat.com>
pcnet_receive already checks the conditions and drop packets if false.
Due to the new semantics since 6e99c63 ("net/socket: Drop
net_socket_can_send"), having .can_receive returning 0 requires us to
explicitly flush the queued packets when the conditions are becoming
true, but queuing the packets when guest driver is not ready doesn't
make much sense.
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
Message-id: 1436955553-22791-3-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
hw/net/lance.c | 1 -
hw/net/pcnet-pci.c | 1 -
hw/net/pcnet.c | 9 ---------
hw/net/pcnet.h | 1 -
4 files changed, 12 deletions(-)
diff --git a/hw/net/lance.c b/hw/net/lance.c
index 4baa016..780b39d 100644
--- a/hw/net/lance.c
+++ b/hw/net/lance.c
@@ -94,7 +94,6 @@ static const MemoryRegionOps lance_mem_ops = {
static NetClientInfo net_lance_info = {
.type = NET_CLIENT_OPTIONS_KIND_NIC,
.size = sizeof(NICState),
- .can_receive = pcnet_can_receive,
.receive = pcnet_receive,
.link_status_changed = pcnet_set_link_status,
};
diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c
index 8305d1b..b4d60b8 100644
--- a/hw/net/pcnet-pci.c
+++ b/hw/net/pcnet-pci.c
@@ -273,7 +273,6 @@ static void pci_pcnet_uninit(PCIDevice *dev)
static NetClientInfo net_pci_pcnet_info = {
.type = NET_CLIENT_OPTIONS_KIND_NIC,
.size = sizeof(NICState),
- .can_receive = pcnet_can_receive,
.receive = pcnet_receive,
.link_status_changed = pcnet_set_link_status,
};
diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c
index 68b9981..3437376 100644
--- a/hw/net/pcnet.c
+++ b/hw/net/pcnet.c
@@ -995,15 +995,6 @@ static int pcnet_tdte_poll(PCNetState *s)
return !!(CSR_CXST(s) & 0x8000);
}
-int pcnet_can_receive(NetClientState *nc)
-{
- PCNetState *s = qemu_get_nic_opaque(nc);
- if (CSR_STOP(s) || CSR_SPND(s))
- return 0;
-
- return sizeof(s->buffer)-16;
-}
-
#define MIN_BUF_SIZE 60
ssize_t pcnet_receive(NetClientState *nc, const uint8_t *buf, size_t size_)
diff --git a/hw/net/pcnet.h b/hw/net/pcnet.h
index 79c4c84..dec8de8 100644
--- a/hw/net/pcnet.h
+++ b/hw/net/pcnet.h
@@ -60,7 +60,6 @@ uint32_t pcnet_ioport_readw(void *opaque, uint32_t addr);
void pcnet_ioport_writel(void *opaque, uint32_t addr, uint32_t val);
uint32_t pcnet_ioport_readl(void *opaque, uint32_t addr);
uint32_t pcnet_bcr_readw(PCNetState *s, uint32_t rap);
-int pcnet_can_receive(NetClientState *nc);
ssize_t pcnet_receive(NetClientState *nc, const uint8_t *buf, size_t size_);
void pcnet_set_link_status(NetClientState *nc);
void pcnet_common_init(DeviceState *dev, PCNetState *s, NetClientInfo *info);
--
2.4.3
next prev parent reply other threads:[~2015-07-27 13:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-27 13:51 [Qemu-devel] [PULL for-2.4 00/16] Net patches Stefan Hajnoczi
2015-07-27 13:51 ` [Qemu-devel] [PULL for-2.4 01/16] hw/net: create common collection of MII definitions Stefan Hajnoczi
2015-07-27 13:51 ` [Qemu-devel] [PULL for-2.4 02/16] hw/net: add ANLPAR bit definitions to generic mii Stefan Hajnoczi
2015-07-27 13:51 ` [Qemu-devel] [PULL for-2.4 03/16] hw/net: add simple phy support to mcf_fec driver Stefan Hajnoczi
2015-07-27 13:51 ` [Qemu-devel] [PULL for-2.4 04/16] hw/net: fix mcf_fec driver receiver Stefan Hajnoczi
2015-07-27 13:51 ` [Qemu-devel] [PULL for-2.4 05/16] xgmac: Drop packets with eth_can_rx is false Stefan Hajnoczi
2015-07-27 13:51 ` Stefan Hajnoczi [this message]
2015-07-27 13:51 ` [Qemu-devel] [PULL for-2.4 07/16] eepro100: Drop nic_can_receive Stefan Hajnoczi
2015-07-27 13:51 ` [Qemu-devel] [PULL for-2.4 08/16] usbnet: Drop usbnet_can_receive Stefan Hajnoczi
2015-07-27 13:51 ` [Qemu-devel] [PULL for-2.4 09/16] etsec: Move etsec_can_receive into etsec_receive Stefan Hajnoczi
2015-07-27 13:51 ` [Qemu-devel] [PULL for-2.4 10/16] etsec: Flush queue when rx buffer is consumed Stefan Hajnoczi
2015-07-27 13:51 ` [Qemu-devel] [PULL for-2.4 11/16] mcf_fec: Drop mcf_fec_can_receive Stefan Hajnoczi
2015-07-27 13:51 ` [Qemu-devel] [PULL for-2.4 12/16] milkymist-minimac2: Flush queued packets when link comes up Stefan Hajnoczi
2015-07-27 13:51 ` [Qemu-devel] [PULL for-2.4 13/16] mipsnet: Flush queued packets when receiving is enabled Stefan Hajnoczi
2015-07-27 13:51 ` [Qemu-devel] [PULL for-2.4 14/16] stellaris_enet: Flush queued packets when read done Stefan Hajnoczi
2015-07-27 13:52 ` [Qemu-devel] [PULL for-2.4 15/16] dp8393x: Flush packets when link comes up Stefan Hajnoczi
2015-07-27 13:52 ` [Qemu-devel] [PULL for-2.4 16/16] axienet: Flush queued packets when rx is done Stefan Hajnoczi
2015-07-27 15:13 ` [Qemu-devel] [PULL for-2.4 00/16] Net patches Peter Maydell
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=1438005121-31153-7-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=famz@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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).