From: "Michael S. Tsirkin" <mst@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: Re: [Qemu-devel] [QEMU PATCH v2] virtio-net: introduce a new macaddr control
Date: Thu, 17 Jan 2013 11:34:42 +0200 [thread overview]
Message-ID: <20130117093441.GB14388@redhat.com> (raw)
In-Reply-To: <20130117083954.GA19648@stefanha-thinkpad.redhat.com>
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.
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
Amos Kong <akong@redhat.com>,
qemu-devel@nongnu.org, kvm@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: Re: [Qemu-devel] [QEMU PATCH v2] virtio-net: introduce a new macaddr control
Date: Thu, 17 Jan 2013 11:34:42 +0200 [thread overview]
Message-ID: <20130117093441.GB14388@redhat.com> (raw)
In-Reply-To: <20130117083954.GA19648@stefanha-thinkpad.redhat.com>
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.
next prev parent reply other threads:[~2013-01-17 9:34 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-16 5:56 [PATCH v2 0/2] make mac programming for virtio net more robust akong
2013-01-16 5:56 ` [Qemu-devel] " akong
2013-01-16 5:57 ` [PATCH v2 1/2] move virtnet_send_command() above virtnet_set_mac_address() akong
2013-01-16 5:57 ` akong
2013-01-16 5:57 ` [Qemu-devel] " akong
2013-01-16 5:57 ` [PATCH v2 2/2] virtio-net: introduce a new control to set macaddr akong
2013-01-16 5:57 ` [Qemu-devel] " akong
2013-01-16 6:20 ` Jason Wang
2013-01-16 6:20 ` [Qemu-devel] " Jason Wang
2013-01-16 8:24 ` Amos Kong
2013-01-16 8:24 ` Amos Kong
2013-01-16 8:24 ` [Qemu-devel] " Amos Kong
2013-01-16 8:36 ` Michael S. Tsirkin
2013-01-16 8:36 ` [Qemu-devel] " Michael S. Tsirkin
2013-01-16 5:57 ` akong
2013-01-16 6:16 ` [QEMU PATCH v2] virtio-net: introduce a new macaddr control akong
2013-01-16 6:16 ` akong
2013-01-16 6:16 ` [Qemu-devel] " akong
2013-01-16 6:37 ` Jason Wang
2013-01-16 6:37 ` [Qemu-devel] " Jason Wang
2013-01-16 8:19 ` Michael S. Tsirkin
2013-01-16 8:19 ` [Qemu-devel] " Michael S. Tsirkin
2013-01-16 8:59 ` Stefan Hajnoczi
2013-01-16 8:59 ` [Qemu-devel] " Stefan Hajnoczi
2013-01-16 9:07 ` Michael S. Tsirkin
2013-01-16 9:07 ` Michael S. Tsirkin
2013-01-16 9:07 ` [Qemu-devel] " Michael S. Tsirkin
2013-01-17 1:19 ` Rusty Russell
2013-01-17 1:19 ` [Qemu-devel] " Rusty Russell
2013-01-17 5:45 ` Amos Kong
2013-01-17 8:37 ` Amos Kong
2013-01-17 8:39 ` Stefan Hajnoczi
2013-01-17 8:39 ` Stefan Hajnoczi
2013-01-17 9:34 ` Michael S. Tsirkin [this message]
2013-01-17 9:34 ` Michael S. Tsirkin
2013-01-17 12:13 ` Michael S. Tsirkin
2013-01-17 12:13 ` [Qemu-devel] " Michael S. Tsirkin
2013-01-18 2:43 ` Amos Kong
2013-01-18 2:43 ` [Qemu-devel] " Amos Kong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130117093441.GB14388@redhat.com \
--to=mst@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.