From patchwork Tue Jun 30 07:18:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 489529 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 411211402C0 for ; Tue, 30 Jun 2015 17:18:40 +1000 (AEST) Received: from localhost ([::1]:45340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9poT-00073o-6A for incoming@patchwork.ozlabs.org; Tue, 30 Jun 2015 03:18:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9poE-0006nO-8q for qemu-devel@nongnu.org; Tue, 30 Jun 2015 03:18:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z9poA-00024F-4z for qemu-devel@nongnu.org; Tue, 30 Jun 2015 03:18:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49047) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9po9-000245-WE for qemu-devel@nongnu.org; Tue, 30 Jun 2015 03:18:18 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 501648EA53; Tue, 30 Jun 2015 07:18:17 +0000 (UTC) Received: from localhost (dhcp-14-104.nay.redhat.com [10.66.14.104]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5U7IEFj002215; Tue, 30 Jun 2015 03:18:15 -0400 Date: Tue, 30 Jun 2015 15:18:13 +0800 From: Fam Zheng To: Scott Feldman Message-ID: <20150630071813.GB5599@ad.nay.redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: =?utf-8?B?SmnFmcOtIFDDrXJrbw==?= , QEMU Developers , Stefan Hajnoczi Subject: Re: [Qemu-devel] (no subject) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Tue, 06/30 00:49, Scott Feldman wrote: > Hi Fam, Stefan, > > I'm running a test with rocker device using UDP sockets connections > and I'm seeing the socket s->read_poll stay disabled if the device > receives a packet when the device's can_receive returns false. > Receive is stuck after that; nothing ever re-enables s->read_poll. I > see the first packet queued on queue->packets and that's it. No more > receives. If I modify the device to lie and always return > can_receive=true, and drop the pkt in driver receive, then things work > fine. > > I think this patch broke can_receive semantics for net/socket.c: Yes. The semantics now is if .can_receive returns false, the NIC needs to flush the queue explicitly when the conditions in .can_receive become true, because net/{socket,tap,...} no longer polls .can_receive(). > > commit 6e99c631f116221d169ea53953d91b8aa74d297a > Author: Fam Zheng > Date: Thu Jun 4 14:45:16 2015 +0800 > > net/socket: Drop net_socket_can_send > > Anything jump out? > > (In the test, rocker device is enabling the netdev port once the guest > OS driver signals to enable the port based on STP process running on > the guest. The initial STP state is DISABLED, so the port is isolated > from the network. As STP algo progresses, the port is opened up and > the netdev is enabled for Rx traffic). > > -scott > Does dropping .can_receive or forcing 1 work for you? Or maybe something like this: --- Fam diff --git a/hw/net/rocker/rocker_fp.c b/hw/net/rocker/rocker_fp.c index d8d934c..3209ccd 100644 --- a/hw/net/rocker/rocker_fp.c +++ b/hw/net/rocker/rocker_fp.c @@ -203,6 +203,7 @@ void fp_port_enable(FpPort *port) fp_port_set_link(port, true); port->enabled = true; DPRINTF("port %d enabled\n", port->index); + qemu_flush_queued_packets(qemu_get_queue(port->nic)); } void fp_port_disable(FpPort *port)