From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHEZi-0001q3-TL for qemu-devel@nongnu.org; Mon, 20 Jul 2015 13:10:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZHEZf-00036c-Ig for qemu-devel@nongnu.org; Mon, 20 Jul 2015 13:09:58 -0400 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]:36632) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHEZf-00035o-7r for qemu-devel@nongnu.org; Mon, 20 Jul 2015 13:09:55 -0400 Received: by wicgb10 with SMTP id gb10so32495608wic.1 for ; Mon, 20 Jul 2015 10:09:54 -0700 (PDT) Date: Mon, 20 Jul 2015 18:09:50 +0100 From: Stefan Hajnoczi Message-ID: <20150720170950.GC3607@stefanha-thinkpad.redhat.com> References: <1436955553-22791-1-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5QAgd0e35j3NYeGe" Content-Disposition: inline In-Reply-To: <1436955553-22791-1-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 for-2.4 00/12] hw/net: Fix .can_receive() for NICs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Peter Maydell , Peter Crosthwaite , Rob Herring , jasowang@redhat.com, qemu-devel@nongnu.org, Michael Walle , Gerd Hoffmann , stefanha@redhat.com, "Edgar E. Iglesias" --5QAgd0e35j3NYeGe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 15, 2015 at 06:19:01PM +0800, Fam Zheng wrote: > v2: Don't use BH in patches 6 and 12. [Jason] > Add Stefan's reviewed-by in all others. > Drop trace point in patch 8 and move function body upward. [Michael] >=20 > Since a90a742 "tap: Drop tap_can_send", all nics that returns false from > .can_receive() are required to explicitly flush the incoming queue when t= he > status of it is changing back to true, otherwise the backend will sop > processing more rx packets. >=20 > The purpose of this callback is to tell the peer backend (tap, socket, et= c) > "hold on until guest consumes old data because my buffer is not ready". M= ore > often than not NICs also do this when driver deactivated the card or disa= bled > rx, causing the packets being unnessarily queued, where they should actua= ly be > dropped. >=20 > This series adds such missing qemu_flush_queued_packets calls for all NIC= s, and > drops such unnecessary conditions in .can_receive(), so that NICs now: >=20 > - return false from .can_receive when guest buffers are busy. > - call qemu_flush_queued_packets when buffers are available again. > - return -1 from .receive when rx is not enabled. >=20 > e1000, ne2000, rocker and vmxnet3 are not included because they're fixed = by > other patches on the list and applied to Stefan's tree. >=20 > virtio-net is covered by another series: >=20 > https://lists.gnu.org/archive/html/qemu-devel/2015-06/msg07377.html ^U >=20 > http://patchwork.ozlabs.org/patch/495379/ (the subject should have v2, m= y bad.) >=20 > All other NICs are okay, as they already do the flush on the state transi= tion > points. >=20 > Please review. >=20 > Fam Zheng (12): > xgmac: Drop packets with eth_can_rx is false. > pcnet: Drop pcnet_can_receive > eepro100: Drop nic_can_receive > usbnet: Drop usbnet_can_receive > etsec: Move etsec_can_receive into etsec_receive > etsec: Flush queue when rx buffer is consumed > mcf_fec: Drop mcf_fec_can_receive > milkymist-minimac2: Flush queued packets when link comes up > mipsnet: Flush queued packets when receiving is enabled > stellaris_enet: Flush queued packets when read done > dp8393x: Flush packets when link comes up > axienet: Flush queued packets when rx is done >=20 > hw/net/dp8393x.c | 8 ++++++++ > hw/net/eepro100.c | 11 ----------- > hw/net/fsl_etsec/etsec.c | 20 ++++++++++---------- > hw/net/fsl_etsec/etsec.h | 4 +++- > hw/net/fsl_etsec/rings.c | 17 +++++++++++------ > hw/net/lance.c | 1 - > hw/net/mcf_fec.c | 9 +-------- > hw/net/milkymist-minimac2.c | 33 ++++++++++++++++----------------- > hw/net/mipsnet.c | 9 +++++++-- > hw/net/pcnet-pci.c | 1 - > hw/net/pcnet.c | 9 --------- > hw/net/pcnet.h | 1 - > hw/net/stellaris_enet.c | 14 +++++--------- > hw/net/xgmac.c | 8 ++++---- > hw/net/xilinx_axienet.c | 17 +++++++++++++---- > hw/usb/dev-network.c | 20 ++++---------------- > trace-events | 1 - > 17 files changed, 82 insertions(+), 101 deletions(-) I can't merge this until net/hub.c is fixed. Anything that relies on qemu_can_send_packet() will break if we drop .can_receive() functions. At this point in the 2.4 release cycle I'm tempted to revert the relevant qemu_set_fd_handler2() refactoring patches and stage this for 2.5 instead. That way we know networking works as before and we can tackle all these fixups in 2.5. --5QAgd0e35j3NYeGe Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVrSteAAoJEJykq7OBq3PIHtgIAIG6EUybqIbbl8fBzeq68GuP VgqrnQVSONQ+L3fu0+wIlCEURPMZo47eSEOBA3nA5SuBS8FAK+InBASqHfWfcOFi /b/ZXU12vXDb31a1KdFXF1GyzQhyXgTCSX0NevACvcoVzFRh2o49AY9lEt/qGe0g XLjW2mAvwX5voBezp1pABwHdRQOiuMbZO9q+jME5bF5K4LaYFkrJdpDievYErOFg Y4NB0aWtSLCwgkQmf9faHBvS7mFH1iUmceRYMC+iNp7FAUpe4LkzUah5RGoE3nZh rkbQpDu6gyMQiSdWikWHf/Nzu5+Z6deWxra1Z5IoKX4WzgLokTioqg0P6EAgS9E= =rxBi -----END PGP SIGNATURE----- --5QAgd0e35j3NYeGe--