Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-04 Thread Jason Wang
On Tuesday, December 04, 2012 09:35:03 AM Michael S. Tsirkin wrote: > On Mon, Dec 03, 2012 at 06:30:49PM +0800, Jason Wang wrote: > > On 12/03/2012 06:14 PM, Michael S. Tsirkin wrote: > > > On Tue, Nov 27, 2012 at 06:15:59PM +0800, Jason Wang wrote: > > >> > - if (!try_fill_recv(>rq,

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-04 Thread Jason Wang
On Monday, December 03, 2012 01:11:18 PM Michael S. Tsirkin wrote: > On Mon, Dec 03, 2012 at 06:01:58PM +0800, Jason Wang wrote: > > On 12/03/2012 05:47 PM, Michael S. Tsirkin wrote: > > > On Mon, Dec 03, 2012 at 02:05:27PM +0800, Jason Wang wrote: > > >> On Monday, December 03, 2012 12:34:08 PM

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-04 Thread Jason Wang
On Monday, December 03, 2012 01:11:18 PM Michael S. Tsirkin wrote: On Mon, Dec 03, 2012 at 06:01:58PM +0800, Jason Wang wrote: On 12/03/2012 05:47 PM, Michael S. Tsirkin wrote: On Mon, Dec 03, 2012 at 02:05:27PM +0800, Jason Wang wrote: On Monday, December 03, 2012 12:34:08 PM Rusty

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-04 Thread Jason Wang
On Tuesday, December 04, 2012 09:35:03 AM Michael S. Tsirkin wrote: On Mon, Dec 03, 2012 at 06:30:49PM +0800, Jason Wang wrote: On 12/03/2012 06:14 PM, Michael S. Tsirkin wrote: On Tue, Nov 27, 2012 at 06:15:59PM +0800, Jason Wang wrote: - if (!try_fill_recv(vi-rq, GFP_KERNEL))

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-03 Thread Michael S. Tsirkin
On Mon, Dec 03, 2012 at 06:30:49PM +0800, Jason Wang wrote: > On 12/03/2012 06:14 PM, Michael S. Tsirkin wrote: > > On Tue, Nov 27, 2012 at 06:15:59PM +0800, Jason Wang wrote: > >> > -if (!try_fill_recv(>rq, GFP_KERNEL)) > >> > -schedule_delayed_work(>rq.refill, 0); > >> >

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-03 Thread Michael S. Tsirkin
On Mon, Dec 03, 2012 at 06:01:58PM +0800, Jason Wang wrote: > On 12/03/2012 05:47 PM, Michael S. Tsirkin wrote: > > On Mon, Dec 03, 2012 at 02:05:27PM +0800, Jason Wang wrote: > >> On Monday, December 03, 2012 12:34:08 PM Rusty Russell wrote: > >>> Jason Wang writes: > +static const struct

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-03 Thread Michael S. Tsirkin
On Mon, Dec 03, 2012 at 06:30:49PM +0800, Jason Wang wrote: > On 12/03/2012 06:14 PM, Michael S. Tsirkin wrote: > > On Tue, Nov 27, 2012 at 06:15:59PM +0800, Jason Wang wrote: > >> > -if (!try_fill_recv(>rq, GFP_KERNEL)) > >> > -schedule_delayed_work(>rq.refill, 0); > >> >

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-03 Thread Jason Wang
On 12/03/2012 06:14 PM, Michael S. Tsirkin wrote: > On Tue, Nov 27, 2012 at 06:15:59PM +0800, Jason Wang wrote: >> > - if (!try_fill_recv(>rq, GFP_KERNEL)) >> > - schedule_delayed_work(>rq.refill, 0); >> > + for (i = 0; i < vi->max_queue_pairs; i++) >> > + if

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-03 Thread Michael S. Tsirkin
On Tue, Nov 27, 2012 at 06:15:59PM +0800, Jason Wang wrote: > - if (!try_fill_recv(>rq, GFP_KERNEL)) > - schedule_delayed_work(>rq.refill, 0); > + for (i = 0; i < vi->max_queue_pairs; i++) > + if (!try_fill_recv(>rq[i], GFP_KERNEL)) > +

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-03 Thread Jason Wang
On 12/03/2012 05:47 PM, Michael S. Tsirkin wrote: > On Mon, Dec 03, 2012 at 02:05:27PM +0800, Jason Wang wrote: >> On Monday, December 03, 2012 12:34:08 PM Rusty Russell wrote: >>> Jason Wang writes: +static const struct ethtool_ops virtnet_ethtool_ops; + +/* + * Converting

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-03 Thread Michael S. Tsirkin
On Mon, Dec 03, 2012 at 02:05:27PM +0800, Jason Wang wrote: > On Monday, December 03, 2012 12:34:08 PM Rusty Russell wrote: > > Jason Wang writes: > > > +static const struct ethtool_ops virtnet_ethtool_ops; > > > + > > > +/* > > > + * Converting between virtqueue no. and kernel tx/rx queue no. >

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-03 Thread Michael S. Tsirkin
On Mon, Dec 03, 2012 at 02:05:27PM +0800, Jason Wang wrote: On Monday, December 03, 2012 12:34:08 PM Rusty Russell wrote: Jason Wang jasow...@redhat.com writes: +static const struct ethtool_ops virtnet_ethtool_ops; + +/* + * Converting between virtqueue no. and kernel tx/rx queue

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-03 Thread Jason Wang
On 12/03/2012 05:47 PM, Michael S. Tsirkin wrote: On Mon, Dec 03, 2012 at 02:05:27PM +0800, Jason Wang wrote: On Monday, December 03, 2012 12:34:08 PM Rusty Russell wrote: Jason Wang jasow...@redhat.com writes: +static const struct ethtool_ops virtnet_ethtool_ops; + +/* + * Converting

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-03 Thread Michael S. Tsirkin
On Tue, Nov 27, 2012 at 06:15:59PM +0800, Jason Wang wrote: - if (!try_fill_recv(vi-rq, GFP_KERNEL)) - schedule_delayed_work(vi-rq.refill, 0); + for (i = 0; i vi-max_queue_pairs; i++) + if (!try_fill_recv(vi-rq[i], GFP_KERNEL)) +

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-03 Thread Jason Wang
On 12/03/2012 06:14 PM, Michael S. Tsirkin wrote: On Tue, Nov 27, 2012 at 06:15:59PM +0800, Jason Wang wrote: - if (!try_fill_recv(vi-rq, GFP_KERNEL)) - schedule_delayed_work(vi-rq.refill, 0); + for (i = 0; i vi-max_queue_pairs; i++) + if (!try_fill_recv(vi-rq[i],

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-03 Thread Michael S. Tsirkin
On Mon, Dec 03, 2012 at 06:30:49PM +0800, Jason Wang wrote: On 12/03/2012 06:14 PM, Michael S. Tsirkin wrote: On Tue, Nov 27, 2012 at 06:15:59PM +0800, Jason Wang wrote: -if (!try_fill_recv(vi-rq, GFP_KERNEL)) -schedule_delayed_work(vi-rq.refill, 0); +

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-03 Thread Michael S. Tsirkin
On Mon, Dec 03, 2012 at 06:01:58PM +0800, Jason Wang wrote: On 12/03/2012 05:47 PM, Michael S. Tsirkin wrote: On Mon, Dec 03, 2012 at 02:05:27PM +0800, Jason Wang wrote: On Monday, December 03, 2012 12:34:08 PM Rusty Russell wrote: Jason Wang jasow...@redhat.com writes: +static const

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-03 Thread Michael S. Tsirkin
On Mon, Dec 03, 2012 at 06:30:49PM +0800, Jason Wang wrote: On 12/03/2012 06:14 PM, Michael S. Tsirkin wrote: On Tue, Nov 27, 2012 at 06:15:59PM +0800, Jason Wang wrote: -if (!try_fill_recv(vi-rq, GFP_KERNEL)) -schedule_delayed_work(vi-rq.refill, 0); +

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-02 Thread Jason Wang
On Monday, December 03, 2012 12:34:08 PM Rusty Russell wrote: > Jason Wang writes: > > +static const struct ethtool_ops virtnet_ethtool_ops; > > + > > +/* > > + * Converting between virtqueue no. and kernel tx/rx queue no. > > + * 0:rx0 1:tx0 2:cvq 3:rx1 4:tx1 ... 2N+1:rxN 2N+2:txN > > + */ > >

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-02 Thread Jason Wang
On Sunday, December 02, 2012 06:06:31 PM Michael S. Tsirkin wrote: > On Tue, Nov 27, 2012 at 06:15:59PM +0800, Jason Wang wrote: > > This addes multiqueue support to virtio_net driver. In multiple queue > > modes, the driver expects the number of queue paris is equal to the > > number of vcpus. To

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-02 Thread Rusty Russell
Jason Wang writes: > +static const struct ethtool_ops virtnet_ethtool_ops; > + > +/* > + * Converting between virtqueue no. and kernel tx/rx queue no. > + * 0:rx0 1:tx0 2:cvq 3:rx1 4:tx1 ... 2N+1:rxN 2N+2:txN > + */ > +static int vq2txq(struct virtqueue *vq) > +{ > + int index =

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-02 Thread Michael S. Tsirkin
On Tue, Nov 27, 2012 at 06:15:59PM +0800, Jason Wang wrote: > This addes multiqueue support to virtio_net driver. In multiple queue modes, > the > driver expects the number of queue paris is equal to the number of vcpus. To > eliminate the contention bettwen vcpus and virtqueues, per-cpu

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-02 Thread Michael S. Tsirkin
On Tue, Nov 27, 2012 at 06:15:59PM +0800, Jason Wang wrote: This addes multiqueue support to virtio_net driver. In multiple queue modes, the driver expects the number of queue paris is equal to the number of vcpus. To eliminate the contention bettwen vcpus and virtqueues, per-cpu virtqueue

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-02 Thread Rusty Russell
Jason Wang jasow...@redhat.com writes: +static const struct ethtool_ops virtnet_ethtool_ops; + +/* + * Converting between virtqueue no. and kernel tx/rx queue no. + * 0:rx0 1:tx0 2:cvq 3:rx1 4:tx1 ... 2N+1:rxN 2N+2:txN + */ +static int vq2txq(struct virtqueue *vq) +{ + int index =

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-02 Thread Jason Wang
On Sunday, December 02, 2012 06:06:31 PM Michael S. Tsirkin wrote: On Tue, Nov 27, 2012 at 06:15:59PM +0800, Jason Wang wrote: This addes multiqueue support to virtio_net driver. In multiple queue modes, the driver expects the number of queue paris is equal to the number of vcpus. To

Re: [net-next rfc v7 2/3] virtio_net: multiqueue support

2012-12-02 Thread Jason Wang
On Monday, December 03, 2012 12:34:08 PM Rusty Russell wrote: Jason Wang jasow...@redhat.com writes: +static const struct ethtool_ops virtnet_ethtool_ops; + +/* + * Converting between virtqueue no. and kernel tx/rx queue no. + * 0:rx0 1:tx0 2:cvq 3:rx1 4:tx1 ... 2N+1:rxN 2N+2:txN + */

[net-next rfc v7 2/3] virtio_net: multiqueue support

2012-11-27 Thread Jason Wang
This addes multiqueue support to virtio_net driver. In multiple queue modes, the driver expects the number of queue paris is equal to the number of vcpus. To eliminate the contention bettwen vcpus and virtqueues, per-cpu virtqueue pairs were implemented through: - select the txq based on the smp

[net-next rfc v7 2/3] virtio_net: multiqueue support

2012-11-27 Thread Jason Wang
This addes multiqueue support to virtio_net driver. In multiple queue modes, the driver expects the number of queue paris is equal to the number of vcpus. To eliminate the contention bettwen vcpus and virtqueues, per-cpu virtqueue pairs were implemented through: - select the txq based on the smp