kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: krkumar2@in.ibm.com, aliguori@us.ibm.com, kvm@vger.kernel.org,
	mst@redhat.com, mprivozn@redhat.com, rusty@rustcorp.com.au,
	qemu-devel@nongnu.org, stefanha@redhat.com,
	jwhan@filewood.snu.ac.kr, shiyer@redhat.com
Subject: Re: [PATCH 10/12] virtio-net: multiqueue support
Date: Fri, 04 Jan 2013 13:12:41 +0800	[thread overview]
Message-ID: <50E664C9.7020905@redhat.com> (raw)
In-Reply-To: <CAAu8pHus-3yghULgGX_1EVVAcjGedNPDsC7AC_t-e-i1BV57qg@mail.gmail.com>

On 12/29/2012 01:52 AM, Blue Swirl wrote:
> On Fri, Dec 28, 2012 at 10:32 AM, Jason Wang <jasowang@redhat.com> wrote:
>> This patch implements both userspace and vhost support for multiple queue
>> virtio-net (VIRTIO_NET_F_MQ). This is done by introducing an array of
>> VirtIONetQueue to VirtIONet.
>>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>>  hw/virtio-net.c |  318 ++++++++++++++++++++++++++++++++++++++++++-------------
>>  hw/virtio-net.h |   27 +++++-
>>  2 files changed, 271 insertions(+), 74 deletions(-)
[...]
>>  static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
>>  {
>>      VirtIONet *n = to_virtio_net(vdev);
>> @@ -464,6 +578,8 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
>>              status = virtio_net_handle_mac(n, ctrl.cmd, &elem);
>>          else if (ctrl.class == VIRTIO_NET_CTRL_VLAN)
>>              status = virtio_net_handle_vlan_table(n, ctrl.cmd, &elem);
>> +        else if (ctrl.class == VIRTIO_NET_CTRL_MQ)
> Please add braces.

Sure.
>
>> +            status = virtio_net_handle_mq(n, ctrl.cmd, &elem);
>>
>>          stb_p(elem.in_sg[elem.in_num - 1].iov_base, status);
>>
>> @@ -477,19 +593,24 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
>>  static void virtio_net_handle_rx(VirtIODevice *vdev, VirtQueue *vq)
>>  {
>>      VirtIONet *n = to_virtio_net(vdev);
>> +    int queue_index = vq2q(virtio_get_queue_index(vq));
>>
>> -    qemu_flush_queued_packets(qemu_get_queue(n->nic));
>> +    qemu_flush_queued_packets(qemu_get_subqueue(n->nic, queue_index));
>>  }
>>
>>  
[...]
>>
>> +static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue, int ctrl)
>> +{
>> +    VirtIODevice *vdev = &n->vdev;
>> +    int i;
>> +
>> +    n->multiqueue = multiqueue;
>> +
>> +    if (!multiqueue)
>> +        n->curr_queues = 1;
> Ditto. Didn't checkpatch.pl catch these or did you not check?

Sorry, will add braces here. I run checkpatch.pl but finally find that
some or lots of the existed codes (such as this file) does not obey the
rules. So I'm not sure whether I need to correct my own codes, or left
them as this file does and correct them all in the future.
>
[...]
>>  } QEMU_PACKED;
>>
>>  /* This is the first element of the scatter-gather list.  If you don't
>> @@ -168,6 +172,26 @@ struct virtio_net_ctrl_mac {
>>   #define VIRTIO_NET_CTRL_VLAN_ADD             0
>>   #define VIRTIO_NET_CTRL_VLAN_DEL             1
>>
>> +/*
>> + * Control Multiqueue
>> + *
>> + * The command VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET
>> + * enables multiqueue, specifying the number of the transmit and
>> + * receive queues that will be used. After the command is consumed and acked by
>> + * the device, the device will not steer new packets on receive virtqueues
>> + * other than specified nor read from transmit virtqueues other than specified.
>> + * Accordingly, driver should not transmit new packets  on virtqueues other than
>> + * specified.
>> + */
>> +struct virtio_net_ctrl_mq {
> VirtIONetCtrlMQ and please don't forget the typedef.

Sure, but the same question as above. (See other structures in this file).
>
>> +    uint16_t virtqueue_pairs;
>> +};
>> +
>> +#define VIRTIO_NET_CTRL_MQ   4
>> + #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET        0
>> + #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN        1
>> + #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX        0x8000
>> +
>>  #define DEFINE_VIRTIO_NET_FEATURES(_state, _field) \
>>          DEFINE_VIRTIO_COMMON_FEATURES(_state, _field), \
>>          DEFINE_PROP_BIT("csum", _state, _field, VIRTIO_NET_F_CSUM, true), \
>> @@ -186,5 +210,6 @@ struct virtio_net_ctrl_mac {
>>          DEFINE_PROP_BIT("ctrl_vq", _state, _field, VIRTIO_NET_F_CTRL_VQ, true), \
>>          DEFINE_PROP_BIT("ctrl_rx", _state, _field, VIRTIO_NET_F_CTRL_RX, true), \
>>          DEFINE_PROP_BIT("ctrl_vlan", _state, _field, VIRTIO_NET_F_CTRL_VLAN, true), \
>> -        DEFINE_PROP_BIT("ctrl_rx_extra", _state, _field, VIRTIO_NET_F_CTRL_RX_EXTRA, true)
>> +        DEFINE_PROP_BIT("ctrl_rx_extra", _state, _field, VIRTIO_NET_F_CTRL_RX_EXTRA, true), \
>> +        DEFINE_PROP_BIT("mq", _state, _field, VIRTIO_NET_F_MQ, true)
>>  #endif
>> --
>> 1.7.1
>>
>>

  reply	other threads:[~2013-01-04  5:12 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-28 10:31 [PATCH 00/12] Multiqueue virtio-net Jason Wang
2012-12-28 10:31 ` [PATCH 01/12] tap: multiqueue support Jason Wang
2013-01-09  9:56   ` Stefan Hajnoczi
2013-01-09 15:25     ` Jason Wang
2013-01-10  8:32       ` Stefan Hajnoczi
2013-01-10 10:28   ` Stefan Hajnoczi
2013-01-10 13:52     ` Jason Wang
2012-12-28 10:31 ` [PATCH 02/12] net: introduce qemu_get_queue() Jason Wang
2012-12-28 10:31 ` [PATCH 03/12] net: introduce qemu_get_nic() Jason Wang
2012-12-28 10:31 ` [PATCH 04/12] net: intorduce qemu_del_nic() Jason Wang
2012-12-28 10:31 ` [PATCH 05/12] net: multiqueue support Jason Wang
2012-12-28 18:06   ` Blue Swirl
2012-12-28 10:31 ` [PATCH 06/12] vhost: " Jason Wang
2012-12-28 10:31 ` [PATCH 07/12] virtio: introduce virtio_queue_del() Jason Wang
2013-01-08  7:14   ` Michael S. Tsirkin
2013-01-08  9:28     ` Jason Wang
2012-12-28 10:32 ` [PATCH 08/12] virtio: add a queue_index to VirtQueue Jason Wang
2012-12-28 10:32 ` [PATCH 09/12] virtio-net: separate virtqueue from VirtIONet Jason Wang
2012-12-28 10:32 ` [PATCH 10/12] virtio-net: multiqueue support Jason Wang
2012-12-28 17:52   ` Blue Swirl
2013-01-04  5:12     ` Jason Wang [this message]
2013-01-04 20:41       ` Blue Swirl
2013-01-08  9:07   ` [Qemu-devel] " Wanlong Gao
2013-01-08  9:29     ` Jason Wang
2013-01-08  9:32       ` [Qemu-devel] " Wanlong Gao
2013-01-08  9:49       ` Wanlong Gao
2013-01-08  9:51         ` Jason Wang
2013-01-08 10:00           ` [Qemu-devel] " Wanlong Gao
2013-01-08 10:14             ` Jason Wang
2013-01-08 11:24               ` [Qemu-devel] " Wanlong Gao
2013-01-09  3:11                 ` Jason Wang
2013-01-09  8:23               ` Wanlong Gao
2013-01-09  9:30                 ` Jason Wang
2013-01-09 10:01                   ` [Qemu-devel] " Wanlong Gao
2013-01-09 15:26                     ` Jason Wang
2013-01-10  6:43                       ` Jason Wang
2013-01-10  6:49                         ` Wanlong Gao
2013-01-10  7:16                           ` Jason Wang
2013-01-10  9:06                             ` Wanlong Gao
2013-01-10  9:40                               ` [Qemu-devel] " Jason Wang
2012-12-28 10:32 ` [PATCH 11/12] virtio-net: migration support for multiqueue Jason Wang
2013-01-08  7:10   ` Michael S. Tsirkin
2013-01-08  9:27     ` Jason Wang
2012-12-28 10:32 ` [PATCH 12/12] virtio-net: compat multiqueue support Jason Wang
2013-01-09 14:29 ` [Qemu-devel] [PATCH 00/12] Multiqueue virtio-net Stefan Hajnoczi
2013-01-09 15:32   ` Michael S. Tsirkin
2013-01-09 15:33     ` Jason Wang
2013-01-10  8:44       ` Stefan Hajnoczi
2013-01-10  9:34         ` [Qemu-devel] " Jason Wang
2013-01-10 11:49           ` Stefan Hajnoczi
2013-01-10 14:15             ` Jason Wang
2013-01-14 19:44 ` Anthony Liguori
2013-01-15 10:12   ` Jason Wang
2013-01-16 15:09     ` Anthony Liguori
2013-01-16 15:19       ` Michael S. Tsirkin
2013-01-16 16:14         ` Anthony Liguori
2013-01-16 16:48           ` Michael S. Tsirkin
2013-01-17 10:31           ` [Qemu-devel] " Michael S. Tsirkin

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=50E664C9.7020905@redhat.com \
    --to=jasowang@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=blauwirbel@gmail.com \
    --cc=jwhan@filewood.snu.ac.kr \
    --cc=krkumar2@in.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=mprivozn@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rusty@rustcorp.com.au \
    --cc=shiyer@redhat.com \
    --cc=stefanha@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).