Patchwork [RFC,v2,3/5] ne2k: work without vlan.

login
register
mail settings
Submitter Gerd Hoffmann
Date Oct. 7, 2009, 12:36 p.m.
Message ID <1254918996-26050-4-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/35271/
State RFC
Headers show

Comments

Gerd Hoffmann - Oct. 7, 2009, 12:36 p.m.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/ne2000.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Anthony Liguori - Oct. 7, 2009, 1:06 p.m.
Gerd Hoffmann wrote:
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/ne2000.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/hw/ne2000.c b/hw/ne2000.c
> index 87f1e59..0ed6eec 100644
> --- a/hw/ne2000.c
> +++ b/hw/ne2000.c
> @@ -322,7 +322,8 @@ void ne2000_ioport_write(void *opaque, uint32_t addr, uint32_t val)
>                      index -= NE2000_PMEM_SIZE;
>                  /* fail safe: check range on the transmitted length  */
>                  if (index + s->tcnt <= NE2000_PMEM_END) {
> -                    qemu_send_packet(s->vc, s->mem + index, s->tcnt);
> +                    if (s->vc)
> +                        qemu_send_packet(s->vc, s->mem + index, s->tcnt);
>                  }
>   

Perhaps we should just push the s->vc check into qemu_send_packet since 
we want this behavior consistently.

Regards,

Anthony Liguori
Gerd Hoffmann - Oct. 7, 2009, 1:15 p.m.
On 10/07/09 15:06, Anthony Liguori wrote:
>> - qemu_send_packet(s->vc, s->mem + index, s->tcnt);
>> + if (s->vc)
>> + qemu_send_packet(s->vc, s->mem + index, s->tcnt);
>> }
>
> Perhaps we should just push the s->vc check into qemu_send_packet since
> we want this behavior consistently.

Makes sense indeed.  Will change it.

cheers,
   Gerd

Patch

diff --git a/hw/ne2000.c b/hw/ne2000.c
index 87f1e59..0ed6eec 100644
--- a/hw/ne2000.c
+++ b/hw/ne2000.c
@@ -322,7 +322,8 @@  void ne2000_ioport_write(void *opaque, uint32_t addr, uint32_t val)
                     index -= NE2000_PMEM_SIZE;
                 /* fail safe: check range on the transmitted length  */
                 if (index + s->tcnt <= NE2000_PMEM_END) {
-                    qemu_send_packet(s->vc, s->mem + index, s->tcnt);
+                    if (s->vc)
+                        qemu_send_packet(s->vc, s->mem + index, s->tcnt);
                 }
                 /* signal end of transfer */
                 s->tsr = ENTSR_PTX;