Received: from eggs.gnu.org ([2001:4830:134:3::10]:51207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZF1O9-0000aU-8L for qemu-devel@nongnu.org; Tue, 14 Jul 2015 10:40:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZF1O5-0003Su-M3 for qemu-devel@nongnu.org; Tue, 14 Jul 2015 10:40:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39801) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZF1O5-0003Sk-7d for qemu-devel@nongnu.org; Tue, 14 Jul 2015 10:40:49 -0400 Date: Tue, 14 Jul 2015 15:40:46 +0100 From: Stefan Hajnoczi Message-ID: <20150714144046.GP17927@stefanha-thinkpad.redhat.com> References: <1436860421-4604-1-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="K8zN2sh9fO5jmbe4" Content-Disposition: inline In-Reply-To: <1436860421-4604-1-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH 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 , "Edgar E. Iglesias" --K8zN2sh9fO5jmbe4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 14, 2015 at 03:53:29PM +0800, Fam Zheng wrote: > 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 > - returns false from .can_receive when guest buffers are busy. > - calls qemu_flush_queued_packets when buffers are available again. > - returns -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 thread: >=20 > https://lists.gnu.org/archive/html/qemu-devel/2015-06/msg07377.html >=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 | 15 +++++++++------ > hw/net/lance.c | 1 - > hw/net/mcf_fec.c | 9 +-------- > hw/net/milkymist-minimac2.c | 12 ++++++------ > 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 | 22 ++++++++++++++++++++++ > hw/usb/dev-network.c | 20 ++++---------------- > 16 files changed, 79 insertions(+), 85 deletions(-) Reviewed-by: Stefan Hajnoczi I'm waiting to see if Michael is happy with the virtio-net changes, then we can apply these + hub + virtio-net + other outstanding fixes. --K8zN2sh9fO5jmbe4 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVpR9uAAoJEJykq7OBq3PIyqkH/1IGPRG6D2Ed57ftK82IwION eLLGSs8H06yxy+/hmSqnK/cePxT2vwDcvYoyrGQ7gQOhdxPzZXD6X60cCzR2Whly /FfTN2/EzPjwiD+Y0HpiW0UiwL8tSS9/oeFFC7uZy4jAuByo7huIjdvDAgQk7/hE kSPqFP5eXY9tzrGv5E0CTbMPsx3kEifLwU6+gNGVvrtk7VBJ+vf/1bFIWCT+imxU dO6fIGMi8AlhaLdLGZkduthBsAf9UgbWDpOHOns8u6ABnW4Http2Xo0bswTwvcMQ fEuv+n8azhFmZIhrvr1JAKPx/nwj8nszDVFrNZO6EqyQvDkjVr/VfXk8Xv22g1Q= =vdo1 -----END PGP SIGNATURE----- --K8zN2sh9fO5jmbe4--