From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvmW1-0002aK-TM for qemu-devel@nongnu.org; Thu, 17 Jan 2013 05:16:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TvmVw-0004FZ-Ac for qemu-devel@nongnu.org; Thu, 17 Jan 2013 05:16:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44374) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvmVw-0004FS-2r for qemu-devel@nongnu.org; Thu, 17 Jan 2013 05:16:04 -0500 Date: Thu, 17 Jan 2013 11:34:42 +0200 From: "Michael S. Tsirkin" Message-ID: <20130117093441.GB14388@redhat.com> References: <1358315821-29519-1-git-send-email-akong@redhat.com> <1358317007-29972-1-git-send-email-akong@redhat.com> <87mww8y5bb.fsf@rustcorp.com.au> <20130117054511.GA12468@t430s.redhat.com> <20130117083954.GA19648@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130117083954.GA19648@stefanha-thinkpad.redhat.com> Subject: Re: [Qemu-devel] [QEMU PATCH v2] virtio-net: introduce a new macaddr control List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Rusty Russell , Amos Kong , qemu-devel@nongnu.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org On Thu, Jan 17, 2013 at 09:39:54AM +0100, Stefan Hajnoczi wrote: > On Thu, Jan 17, 2013 at 01:45:11PM +0800, Amos Kong wrote: > > On Thu, Jan 17, 2013 at 11:49:20AM +1030, Rusty Russell wrote: > > > akong@redhat.com writes: > > > > @@ -349,6 +351,14 @@ static int virtio_net_handle_mac(VirtIONet *n, uint8_t cmd, > > > > { > > > > struct virtio_net_ctrl_mac mac_data; > > > > > > > > + if (cmd == VIRTIO_NET_CTRL_MAC_ADDR_SET && elem->out_num == 2 && > > > > + elem->out_sg[1].iov_len == ETH_ALEN) { > > > > + /* Set MAC address */ > > > > + memcpy(n->mac, elem->out_sg[1].iov_base, elem->out_sg[1].iov_len); > > > > + qemu_format_nic_info_str(&n->nic->nc, n->mac); > > > > + return VIRTIO_NET_OK; > > > > + } > > > > > > Does the rest of the net device still rely on the layout of descriptors? > > > > No, only info string of net client relies on n->mac > > I think the question is whether the hw/virtio-net.c code makes > assumptions about virtqueue descriptor layout (e.g. sg[0] is the header, > sg[1] is the data buffer). > > The answer is yes, the control virtqueue function directly accesses > iov[n]. > > Additional patches would be required to convert the existing > hw/virtio-net.c code to make no assumptions about virtqueue descriptor > layout. It's outside the scope of this series. > > Stefan It's not hard at all though - the harder part is data path processing, this has been done already. Will send a patch shortly.