Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lz4Ns-0000Yn-74 for qemu-devel@nongnu.org; Wed, 29 Apr 2009 03:39:12 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lz4Nm-0000Ya-Kk for qemu-devel@nongnu.org; Wed, 29 Apr 2009 03:39:10 -0400 Received: from [199.232.76.173] (port=38371 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lz4Nm-0000YX-F1 for qemu-devel@nongnu.org; Wed, 29 Apr 2009 03:39:06 -0400 Received: from mx2.redhat.com ([66.187.237.31]:46224) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lz4Nl-00029V-Rt for qemu-devel@nongnu.org; Wed, 29 Apr 2009 03:39:06 -0400 Subject: Re: [Qemu-devel] Re: [PATCH 9/9] Introduce VLANClientState::cleanup() References: <1239812969-8320-2-git-send-email-markmc@redhat.com> <20090416010725.GA24264@amt.cnet> <1239893397.6860.190.camel@blaa> <200904281308.26203.paul@codesourcery.com> <49F732F4.6020708@codemonkey.ws> From: Markus Armbruster Date: Wed, 29 Apr 2009 09:36:59 +0200 In-Reply-To: <49F732F4.6020708@codemonkey.ws> (Anthony Liguori's message of "Tue\, 28 Apr 2009 11\:46\:44 -0500") Message-ID: <87zldzgbc4.fsf@pike.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Mark McLoughlin , Anthony Liguori , Marcelo Tosatti , Paul Brook , qemu-devel@nongnu.org Anthony Liguori writes: > Paul Brook wrote: >> On Thursday 16 April 2009, Mark McLoughlin wrote: >> >>> However, the way I see it is that the VLANClientState should "own" the >>> PCIDevice, not the other way around - e.g. you want to free the device, >>> you should do qemu_del_vlan_client(), rather than >>> pci_device_unregister(). >>> >> >> I disagree. This makes it impossible to have multiport devices. >> The controlling entity should be the device, not the vlan interface. >> > > I agree. The biggest problem with the current API (and most QEMU > APIs) is there's no way to associate host configuration with the > function's devices implement. Instead, host configurations are > associated with actual devices which implies that all devices > implement one function. This is clearly wrong. > > For example, the way this all should work is (ignore the current VLAN > concept in QEMU, it's orthogonal to this discussion): > > 1) Network backend is created. As part of the configuration of the > backend, a unique device identifier is associated with it. > 2) A PCI device is created. > a) The PCI device creates one or more Network frontends. Each > frontend carries the device identifier and perhaps something like a > port id. > b) When the PCI device is destroyed, it destroys any frontends it owns. > > The unique device identifier could be a device tree path, or it could > be something more opaque that is later correlated to a device tree > path. > > Regards, > > Anthony Liguori The machine configuration patch is designed for such a separation. A target device can be connected to host artifacts. The connection is a tree node UID. Currently the node address, but it could be anything; we could use small integer handles or textual labels. The initial implementation of a device is a simple wrapper around existing device interfaces. This is intentional. It lets us convert to the new device interface device by device. Such a conversion involves disentangling host and target part, putting the former in suitable host artifacts, leaving the latter in the target device.