qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: jasowang@redhat.com, qemu-devel@nongnu.org, peter.maydell@linaro.org
Cc: "Helge Deller" <deller@gmx.de>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [PULL 8/8] tulip: Assign default MAC address if not specified
Date: Wed, 18 May 2022 11:12:14 +0800	[thread overview]
Message-ID: <20220518031214.93760-9-jasowang@redhat.com> (raw)
In-Reply-To: <20220518031214.93760-1-jasowang@redhat.com>

From: Helge Deller <deller@gmx.de>

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>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 hw/net/tulip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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);
-- 
2.25.1



  parent reply	other threads:[~2022-05-18  3:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18  3:12 [PULL 0/8] Net patches Jason Wang
2022-05-18  3:12 ` [PULL 1/8] net/vmnet: add vmnet dependency and customizable option Jason Wang
2022-05-18  3:12 ` [PULL 2/8] net/vmnet: add vmnet backends to qapi/net Jason Wang
2022-05-18  3:12 ` [PULL 3/8] net/vmnet: implement shared mode (vmnet-shared) Jason Wang
2022-05-18  3:12 ` [PULL 4/8] net/vmnet: implement host mode (vmnet-host) Jason Wang
2022-05-18  3:12 ` [PULL 5/8] net/vmnet: implement bridged mode (vmnet-bridged) Jason Wang
2022-05-18  3:12 ` [PULL 6/8] net/vmnet: update qemu-options.hx Jason Wang
2022-05-18  3:12 ` [PULL 7/8] net/vmnet: update hmp-commands.hx Jason Wang
2022-05-18  3:12 ` Jason Wang [this message]
2022-05-18 14:10 ` [PULL 0/8] Net patches Richard Henderson

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=20220518031214.93760-9-jasowang@redhat.com \
    --to=jasowang@redhat.com \
    --cc=deller@gmx.de \
    --cc=f4bug@amsat.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).