All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tulip: Assign default MAC address if not specified
@ 2022-03-10 16:55 Helge Deller
  2022-03-10 17:32 ` [PATCH-for-7.0] " Philippe Mathieu-Daudé
  2022-05-11  9:41 ` [PATCH] " Philippe Mathieu-Daudé via
  0 siblings, 2 replies; 4+ messages in thread
From: Helge Deller @ 2022-03-10 16:55 UTC (permalink / raw)
  To: qemu-devel, Jason Wang; +Cc: Sven Schnelle

The MAC of the tulip card is stored in the EEPROM and at startup
tulip_fill_eeprom() is called to initialize the EEPROM with the MAC
address given on the command line, e.g.:
    -device tulip,mac=00:11:22:33:44:55

In case the mac address was not given on the command line,
tulip_fill_eeprom() initializes the MAC in EEPROM with 00:00:00:00:00:00
which breaks e.g. a HP-UX guest.

Fix this problem by moving qemu_macaddr_default_if_unset() a few lines
up, so that a default mac address is assigned before tulip_fill_eeprom()
initializes the EEPROM.

Signed-off-by: Helge Deller <deller@gmx.de>

diff --git a/hw/net/tulip.c b/hw/net/tulip.c
index d5b6cc5ee6..097e905bec 100644
--- a/hw/net/tulip.c
+++ b/hw/net/tulip.c
@@ -967,6 +967,8 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp)
     pci_conf = s->dev.config;
     pci_conf[PCI_INTERRUPT_PIN] = 1; /* interrupt pin A */

+    qemu_macaddr_default_if_unset(&s->c.macaddr);
+
     s->eeprom = eeprom93xx_new(&pci_dev->qdev, 64);
     tulip_fill_eeprom(s);

@@ -981,8 +983,6 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp)

     s->irq = pci_allocate_irq(&s->dev);

-    qemu_macaddr_default_if_unset(&s->c.macaddr);
-
     s->nic = qemu_new_nic(&net_tulip_info, &s->c,
                           object_get_typename(OBJECT(pci_dev)),
                           pci_dev->qdev.id, s);


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH-for-7.0] tulip: Assign default MAC address if not specified
  2022-03-10 16:55 [PATCH] tulip: Assign default MAC address if not specified Helge Deller
@ 2022-03-10 17:32 ` Philippe Mathieu-Daudé
  2022-05-11  9:41 ` [PATCH] " Philippe Mathieu-Daudé via
  1 sibling, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-03-10 17:32 UTC (permalink / raw)
  To: Helge Deller, qemu-devel, Jason Wang; +Cc: Sven Schnelle

On 10/3/22 17:55, Helge Deller wrote:
> The MAC of the tulip card is stored in the EEPROM and at startup
> tulip_fill_eeprom() is called to initialize the EEPROM with the MAC
> address given on the command line, e.g.:
>      -device tulip,mac=00:11:22:33:44:55
> 
> In case the mac address was not given on the command line,
> tulip_fill_eeprom() initializes the MAC in EEPROM with 00:00:00:00:00:00
> which breaks e.g. a HP-UX guest.
> 
> Fix this problem by moving qemu_macaddr_default_if_unset() a few lines
> up, so that a default mac address is assigned before tulip_fill_eeprom()
> initializes the EEPROM.
> 
> Signed-off-by: Helge Deller <deller@gmx.de>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> diff --git a/hw/net/tulip.c b/hw/net/tulip.c
> index d5b6cc5ee6..097e905bec 100644
> --- a/hw/net/tulip.c
> +++ b/hw/net/tulip.c
> @@ -967,6 +967,8 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp)
>       pci_conf = s->dev.config;
>       pci_conf[PCI_INTERRUPT_PIN] = 1; /* interrupt pin A */
> 
> +    qemu_macaddr_default_if_unset(&s->c.macaddr);
> +
>       s->eeprom = eeprom93xx_new(&pci_dev->qdev, 64);
>       tulip_fill_eeprom(s);
> 
> @@ -981,8 +983,6 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp)
> 
>       s->irq = pci_allocate_irq(&s->dev);
> 
> -    qemu_macaddr_default_if_unset(&s->c.macaddr);
> -
>       s->nic = qemu_new_nic(&net_tulip_info, &s->c,
>                             object_get_typename(OBJECT(pci_dev)),
>                             pci_dev->qdev.id, s);
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tulip: Assign default MAC address if not specified
  2022-03-10 16:55 [PATCH] tulip: Assign default MAC address if not specified Helge Deller
  2022-03-10 17:32 ` [PATCH-for-7.0] " Philippe Mathieu-Daudé
@ 2022-05-11  9:41 ` Philippe Mathieu-Daudé via
  2022-05-11 10:19   ` Jason Wang
  1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-05-11  9:41 UTC (permalink / raw)
  To: Jason Wang, QEMU Trivial
  Cc: Helge Deller, qemu-devel@nongnu.org Developers, Sven Schnelle

Hi Jason,

Do you mind taking this single patch via your networking tree?
Otherwise I Cc'ed qemu-trivial :)

Thanks!

On Thu, Mar 10, 2022 at 5:56 PM Helge Deller <deller@gmx.de> wrote:
>
> The MAC of the tulip card is stored in the EEPROM and at startup
> tulip_fill_eeprom() is called to initialize the EEPROM with the MAC
> address given on the command line, e.g.:
>     -device tulip,mac=00:11:22:33:44:55
>
> In case the mac address was not given on the command line,
> tulip_fill_eeprom() initializes the MAC in EEPROM with 00:00:00:00:00:00
> which breaks e.g. a HP-UX guest.
>
> Fix this problem by moving qemu_macaddr_default_if_unset() a few lines
> up, so that a default mac address is assigned before tulip_fill_eeprom()
> initializes the EEPROM.
>
> Signed-off-by: Helge Deller <deller@gmx.de>
>
> diff --git a/hw/net/tulip.c b/hw/net/tulip.c
> index d5b6cc5ee6..097e905bec 100644
> --- a/hw/net/tulip.c
> +++ b/hw/net/tulip.c
> @@ -967,6 +967,8 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp)
>      pci_conf = s->dev.config;
>      pci_conf[PCI_INTERRUPT_PIN] = 1; /* interrupt pin A */
>
> +    qemu_macaddr_default_if_unset(&s->c.macaddr);
> +
>      s->eeprom = eeprom93xx_new(&pci_dev->qdev, 64);
>      tulip_fill_eeprom(s);
>
> @@ -981,8 +983,6 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp)
>
>      s->irq = pci_allocate_irq(&s->dev);
>
> -    qemu_macaddr_default_if_unset(&s->c.macaddr);
> -
>      s->nic = qemu_new_nic(&net_tulip_info, &s->c,
>                            object_get_typename(OBJECT(pci_dev)),
>                            pci_dev->qdev.id, s);
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tulip: Assign default MAC address if not specified
  2022-05-11  9:41 ` [PATCH] " Philippe Mathieu-Daudé via
@ 2022-05-11 10:19   ` Jason Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Wang @ 2022-05-11 10:19 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: QEMU Trivial, Helge Deller, qemu-devel@nongnu.org Developers,
	Sven Schnelle

On Wed, May 11, 2022 at 5:41 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Hi Jason,
>
> Do you mind taking this single patch via your networking tree?
> Otherwise I Cc'ed qemu-trivial :)

I've queued this.

Thanks

>
> Thanks!
>
> On Thu, Mar 10, 2022 at 5:56 PM Helge Deller <deller@gmx.de> wrote:
> >
> > The MAC of the tulip card is stored in the EEPROM and at startup
> > tulip_fill_eeprom() is called to initialize the EEPROM with the MAC
> > address given on the command line, e.g.:
> >     -device tulip,mac=00:11:22:33:44:55
> >
> > In case the mac address was not given on the command line,
> > tulip_fill_eeprom() initializes the MAC in EEPROM with 00:00:00:00:00:00
> > which breaks e.g. a HP-UX guest.
> >
> > Fix this problem by moving qemu_macaddr_default_if_unset() a few lines
> > up, so that a default mac address is assigned before tulip_fill_eeprom()
> > initializes the EEPROM.
> >
> > Signed-off-by: Helge Deller <deller@gmx.de>
> >
> > diff --git a/hw/net/tulip.c b/hw/net/tulip.c
> > index d5b6cc5ee6..097e905bec 100644
> > --- a/hw/net/tulip.c
> > +++ b/hw/net/tulip.c
> > @@ -967,6 +967,8 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp)
> >      pci_conf = s->dev.config;
> >      pci_conf[PCI_INTERRUPT_PIN] = 1; /* interrupt pin A */
> >
> > +    qemu_macaddr_default_if_unset(&s->c.macaddr);
> > +
> >      s->eeprom = eeprom93xx_new(&pci_dev->qdev, 64);
> >      tulip_fill_eeprom(s);
> >
> > @@ -981,8 +983,6 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp)
> >
> >      s->irq = pci_allocate_irq(&s->dev);
> >
> > -    qemu_macaddr_default_if_unset(&s->c.macaddr);
> > -
> >      s->nic = qemu_new_nic(&net_tulip_info, &s->c,
> >                            object_get_typename(OBJECT(pci_dev)),
> >                            pci_dev->qdev.id, s);
> >
>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-11 10:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10 16:55 [PATCH] tulip: Assign default MAC address if not specified Helge Deller
2022-03-10 17:32 ` [PATCH-for-7.0] " Philippe Mathieu-Daudé
2022-05-11  9:41 ` [PATCH] " Philippe Mathieu-Daudé via
2022-05-11 10:19   ` Jason Wang

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.