From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEv2O-0007ZF-68 for qemu-devel@nongnu.org; Tue, 14 Jul 2015 03:54:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZEv2N-0001bg-B8 for qemu-devel@nongnu.org; Tue, 14 Jul 2015 03:54:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52808) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEv2N-0001bc-6G for qemu-devel@nongnu.org; Tue, 14 Jul 2015 03:53:59 -0400 From: Fam Zheng Date: Tue, 14 Jul 2015 15:53:31 +0800 Message-Id: <1436860421-4604-3-git-send-email-famz@redhat.com> In-Reply-To: <1436860421-4604-1-git-send-email-famz@redhat.com> References: <1436860421-4604-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH for-2.4 02/12] pcnet: Drop pcnet_can_receive List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Peter Crosthwaite , Rob Herring , jasowang@redhat.com, Michael Walle , Gerd Hoffmann , stefanha@redhat.com, "Edgar E. Iglesias" 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 --- 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