Re: [PATCH 2/4] virtio_net: return NETDEV_TX_BUSY instead of queueing an extra skb.

2009-06-02 Thread Rusty Russell
On Wed, 3 Jun 2009 09:15:32 am Herbert Xu wrote: > On Tue, Jun 02, 2009 at 11:25:57PM +0930, Rusty Russell wrote: > > Or, we could just "return NETDEV_TX_BUSY;". I like that :) > > No you should fix it so that you check the queue status after > transmitting a packet so we never get into this state

Re: [PATCH 1/4] net: skb_orphan on dev_hard_start_xmit

2009-06-02 Thread David Miller
From: Rusty Russell Date: Tue, 2 Jun 2009 23:38:29 +0930 > On Tue, 2 Jun 2009 04:55:53 pm David Miller wrote: >> From: Patrick Ohly >> Date: Mon, 01 Jun 2009 21:47:22 +0200 >> >> > On Fri, 2009-05-29 at 23:44 +0930, Rusty Russell wrote: >> >> This patch adds skb_orphan to the start of dev_hard_s

Re: [PATCH 2/4] virtio_net: return NETDEV_TX_BUSY instead of queueing an extra skb.

2009-06-02 Thread Herbert Xu
On Tue, Jun 02, 2009 at 11:25:57PM +0930, Rusty Russell wrote: > > Or, we could just "return NETDEV_TX_BUSY;". I like that :) No you should fix it so that you check the queue status after transmitting a packet so we never get into this state in the first place. NETDEV_TX_BUSY is just passing the

Re: find_vqs operation starting at arbitrary index

2009-06-02 Thread Michael S. Tsirkin
On Tue, Jun 02, 2009 at 10:39:16PM +0530, Amit Shah wrote: > On (Tue) Jun 02 2009 [19:32:27], Michael S. Tsirkin wrote: > > On Tue, Jun 02, 2009 at 08:53:07AM +0930, Rusty Russell wrote: > > > On Mon, 1 Jun 2009 05:33:48 pm Amit Shah wrote: > > > > Hello, > > > > > > > > The recent find_vqs operati

Re: find_vqs operation starting at arbitrary index

2009-06-02 Thread Amit Shah
On (Tue) Jun 02 2009 [19:32:27], Michael S. Tsirkin wrote: > On Tue, Jun 02, 2009 at 08:53:07AM +0930, Rusty Russell wrote: > > On Mon, 1 Jun 2009 05:33:48 pm Amit Shah wrote: > > > Hello, > > > > > > The recent find_vqs operation doesn't allow for a vq to be found at an > > > arbitrary location; i

Re: find_vqs operation starting at arbitrary index

2009-06-02 Thread Michael S. Tsirkin
On Tue, Jun 02, 2009 at 08:53:07AM +0930, Rusty Russell wrote: > On Mon, 1 Jun 2009 05:33:48 pm Amit Shah wrote: > > Hello, > > > > The recent find_vqs operation doesn't allow for a vq to be found at an > > arbitrary location; it's meant to be called once at startup to find all > > possible queues

[PATCHv2 12/13] qemu: virtio save/load bindings

2009-06-02 Thread Michael S. Tsirkin
Implement bindings for virtio save/load. Use them in virtio pci. Signed-off-by: Michael S. Tsirkin --- hw/virtio-pci.c | 49 - hw/virtio.c | 31 ++- hw/virtio.h |4 3 files changed, 66 insertions(+),

[PATCHv2 10/13] qemu: MSI-X support in virtio PCI

2009-06-02 Thread Michael S. Tsirkin
This enables actual support for MSI-X in virtio PCI. First user will be virtio-net. Signed-off-by: Michael S. Tsirkin --- hw/virtio-pci.c | 152 -- 1 files changed, 112 insertions(+), 40 deletions(-) diff --git a/hw/virtio-pci.c b/hw/virtio-p

[PATCHv2 05/13] qemu: MSI-X support functions

2009-06-02 Thread Michael S. Tsirkin
Add functions implementing MSI-X support. First user will be virtio-pci. Note that platform must set a flag to declare MSI supported. For PC this will be set by APIC. Signed-off-by: Michael S. Tsirkin --- Makefile.target |2 +- hw/msix.c | 423 +

[PATCHv2 13/13] qemu: add pci_get/set_byte

2009-06-02 Thread Michael S. Tsirkin
Add pci_get/set_byte to keep *_word and *_long access functions company. They are unused for now. Signed-off-by: Michael S. Tsirkin --- hw/pci.h | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/hw/pci.h b/hw/pci.h index 4072f16..e1e4fb4 100644 --- a/hw/pci.h +

[PATCHv2 09/13] qemu: virtio support for many interrupt vectors

2009-06-02 Thread Michael S. Tsirkin
Extend virtio to support many interrupt vectors, and rearrange code in preparation for multi-vector support (mostly move reset out to bindings, because we will have to reset the vectors in transport-specific code). Actual bindings in pci, and use in net, to follow. Load and save are not connected t

[PATCHv2 07/13] qemu: minimal MSI/MSI-X implementation for PC

2009-06-02 Thread Michael S. Tsirkin
Implement MSI support in APIC. Note that MSI and MMIO APIC registers are at the same memory location, but actually not on the global bus: MSI is on PCI bus, APIC is connected directly to the CPU. We map them on the global bus at the same address which happens to work because MSI registers are reser

Re: [PATCH 1/4] net: skb_orphan on dev_hard_start_xmit

2009-06-02 Thread Patrick Ohly
On Fri, 2009-05-29 at 23:44 +0930, Rusty Russell wrote: > This patch adds skb_orphan to the start of dev_hard_start_xmit(): it > can be premature in the NETDEV_TX_BUSY case, but that's uncommon. Would it be possible to make the new skb_orphan() at the start of dev_hard_start_xmit() conditionally s

[PATCHv2 08/13] qemu: add support for resizing regions

2009-06-02 Thread Michael S. Tsirkin
Make it possible to resize PCI regions. This will be used by virtio with MSI-X, where the region size depends on whether MSI-X is enabled, and can change across load/save. Signed-off-by: Michael S. Tsirkin --- hw/pci.c | 54 -- hw/pci.h |

[PATCHv2 11/13] qemu: request 3 vectors in virtio-net

2009-06-02 Thread Michael S. Tsirkin
Request up to 3 vectors in virtio-net. Actual bindings might supply less. Signed-off-by: Michael S. Tsirkin --- hw/virtio-net.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 60aa6da..6118fe3 100644 --- a/hw/virtio-net.c +++ b/hw/

[PATCHv2 04/13] qemu: helper routines for pci access.

2009-06-02 Thread Michael S. Tsirkin
Add inline routines for convenient access to pci devices with correct (little) endianness. Will be used by MSI-X support. Signed-off-by: Michael S. Tsirkin --- hw/pci.h | 30 +++--- 1 files changed, 27 insertions(+), 3 deletions(-) diff --git a/hw/pci.h b/hw/pci.h inde

[PATCHv2 06/13] qemu: add flag to disable MSI-X by default

2009-06-02 Thread Michael S. Tsirkin
Add global flag to disable MSI-X by default. This is useful primarily to make images loadable by older qemu (without msix). Even when MSI-X is disabled by flag, you can still load images that have MSI-X enabled. Signed-off-by: Michael S. Tsirkin --- hw/msix.c |3 +++ qemu-options.hx

[PATCHv2 03/13] qemu: add routines to manage PCI capabilities

2009-06-02 Thread Michael S. Tsirkin
Add routines to manage PCI capability list. First user will be MSI-X. Signed-off-by: Michael S. Tsirkin --- hw/pci.c | 98 -- hw/pci.h | 18 +++- 2 files changed, 106 insertions(+), 10 deletions(-) diff --git a/hw/pci.c b/h

[PATCHv2 02/13] qemu: capability bits in pci save/restore

2009-06-02 Thread Michael S. Tsirkin
Add support for capability bits in save/restore for pci. These will be used for MSI, where the capability might be present or not as requested by user, which does not map well into a single version number. Signed-off-by: Michael S. Tsirkin --- hw/pci.c | 14 -- hw/pci.h |4

[PATCHv2 01/13] qemu: make default_write_config use mask table

2009-06-02 Thread Michael S. Tsirkin
Change much of hw/pci to use symbolic constants and a table-driven design: add a mask table with writable bits set and readonly bits unset. Detect change by comparing original and new registers. This makes it easy to support capabilities where read-only/writeable bit layout differs between devices

[PATCHv2 00/13] qemu: MSI-X support

2009-06-02 Thread Michael S. Tsirkin
Resending. Incorporated a minor fix pointed out by Isaku Yamahata. Here is the port of MSI-X support patches to upstream qemu. Please comment or commit. This patchset adds generic support for MSI-X, adds implementation in APIC, and uses MSI-X in virtio-net. At Paul's suggestion, I use stl_phy to

Re: [PATCH 3/4] virtio_net: don't free buffers in xmit ring

2009-06-02 Thread Rusty Russell
On Tue, 2 Jun 2009 09:11:42 pm Mark McLoughlin wrote: > On Tue, 2009-06-02 at 09:13 +0100, Mark McLoughlin wrote: > > I think skb_orphan() is enough to prevent this, is it? > > Oops, I meant: > > I don't think skb_orphan() is enough to prevent this, is it? Yes, point taken. No, it's not. We co

Re: [PATCH 1/4] net: skb_orphan on dev_hard_start_xmit

2009-06-02 Thread Rusty Russell
On Tue, 2 Jun 2009 04:55:53 pm David Miller wrote: > From: Patrick Ohly > Date: Mon, 01 Jun 2009 21:47:22 +0200 > > > On Fri, 2009-05-29 at 23:44 +0930, Rusty Russell wrote: > >> This patch adds skb_orphan to the start of dev_hard_start_xmit(): it > >> can be premature in the NETDEV_TX_BUSY case,

Re: [PATCH 2/4] virtio_net: return NETDEV_TX_BUSY instead of queueing an extra skb.

2009-06-02 Thread Rusty Russell
On Tue, 2 Jun 2009 05:37:30 pm Mark McLoughlin wrote: > On Fri, 2009-05-29 at 23:46 +0930, Rusty Russell wrote: > > This effectively reverts 99ffc696d10b28580fe93441d627cf290ac4484c > > "virtio: wean net driver off NETDEV_TX_BUSY". > > > > The complexity of queuing an skb (setting a tasklet to re-x

Re: [PATCH 2/4] virtio_net: return NETDEV_TX_BUSY instead of queueing an extra skb.

2009-06-02 Thread Rusty Russell
On Tue, 2 Jun 2009 06:35:52 pm Herbert Xu wrote: > On Fri, May 29, 2009 at 11:46:04PM +0930, Rusty Russell wrote: > > This effectively reverts 99ffc696d10b28580fe93441d627cf290ac4484c > > "virtio: wean net driver off NETDEV_TX_BUSY". > > > > The complexity of queuing an skb (setting a tasklet to re

Re: [PATCH 3/4] virtio_net: don't free buffers in xmit ring

2009-06-02 Thread Rusty Russell
On Tue, 2 Jun 2009 05:43:42 pm Mark McLoughlin wrote: > On Fri, 2009-05-29 at 23:46 +0930, Rusty Russell wrote: > > The virtio_net driver is complicated by the two methods of freeing old > > xmit buffers (in addition to freeing old ones at the start of the xmit > > path). > > > > The original code

Re: [PATCH 3/4] virtio_net: don't free buffers in xmit ring

2009-06-02 Thread Mark McLoughlin
On Tue, 2009-06-02 at 09:13 +0100, Mark McLoughlin wrote: > On Fri, 2009-05-29 at 23:46 +0930, Rusty Russell wrote: > > The virtio_net driver is complicated by the two methods of freeing old > > xmit buffers (in addition to freeing old ones at the start of the xmit > > path). > > > > The original

Re: [PATCH 2/4] virtio_net: return NETDEV_TX_BUSY instead of queueing an extra skb.

2009-06-02 Thread Herbert Xu
On Fri, May 29, 2009 at 11:46:04PM +0930, Rusty Russell wrote: > > This effectively reverts 99ffc696d10b28580fe93441d627cf290ac4484c > "virtio: wean net driver off NETDEV_TX_BUSY". > > The complexity of queuing an skb (setting a tasklet to re-xmit) is > questionable, especially once we get rid of

Re: [PATCH 3/4] virtio_net: don't free buffers in xmit ring

2009-06-02 Thread Mark McLoughlin
On Fri, 2009-05-29 at 23:46 +0930, Rusty Russell wrote: > The virtio_net driver is complicated by the two methods of freeing old > xmit buffers (in addition to freeing old ones at the start of the xmit > path). > > The original code used a 1/10 second timer attached to xmit_free(), > reset on ever

Re: [PATCH 2/4] virtio_net: return NETDEV_TX_BUSY instead of queueing an extra skb.

2009-06-02 Thread Mark McLoughlin
On Fri, 2009-05-29 at 23:46 +0930, Rusty Russell wrote: > This effectively reverts 99ffc696d10b28580fe93441d627cf290ac4484c > "virtio: wean net driver off NETDEV_TX_BUSY". > > The complexity of queuing an skb (setting a tasklet to re-xmit) is > questionable, It certainly adds some subtle complex

Re: [PATCH 1/4] net: skb_orphan on dev_hard_start_xmit

2009-06-02 Thread David Miller
From: Patrick Ohly Date: Mon, 01 Jun 2009 21:47:22 +0200 > On Fri, 2009-05-29 at 23:44 +0930, Rusty Russell wrote: >> This patch adds skb_orphan to the start of dev_hard_start_xmit(): it >> can be premature in the NETDEV_TX_BUSY case, but that's uncommon. > > Would it be possible to make the new