All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Freihofer, Adrian" <adrian.freihofer@siemens.com>
To: "openembedded-core@lists.openembedded.org"
	<openembedded-core@lists.openembedded.org>
Subject: [PATCH v2] runqemu: support multiple NICs
Date: Wed, 4 Mar 2020 08:33:07 +0000	[thread overview]
Message-ID: <a96c65a5e8246d44240511aaf666889fd983b8c8.camel@siemens.com> (raw)
In-Reply-To: 2b48cd168e6050723f4c30b059098b319e5b6df5.camel@siemens.com

Emulating more than one network interface with runqemu is sometimes a
bit tricky, but possible. For example, this leads to an emulated device
with eth0 and eth1:

QB_NETWORK_DEVICE_prepend = " \
    -device virtio-neti-device,mac=52:54:00:12:34:03 \
"

On some emulated NIC types, Qemu and the kernel enumerate the eths in
the guest in reverse order to how the device parameters are passed to
Qemu. So in this case it is important that the additional NICs are
prepended to the -device parameter, which gets automatically added by
Qemu. Otherwise, the interface eth1 will be connected to the host, but
eth0 will be assigned the IP address 192.168.7.x, which obviously does
not work.

When booting Qemu with two NICs, but only one set of network
configuration parameters passed to the kernel, the kernel seems to
search for a configuration for all NICs. This delays the boot process
for a very long time.

This change solves the timeout problem. Tested with:
 oe-selftest --run-tests runqemu

Signed-off-by: Adrian Freihofer <adrian.freihofer at siemens.com>
---
 scripts/runqemu | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index dd0aa4b28f..d34f8eec25 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1147,7 +1147,7 @@ class BaseConfig(object):
         client = gateway + 1
         if self.fstype == 'nfs':
             self.setup_nfs()
-        netconf = "192.168.7.%s::192.168.7.%s:255.255.255.0" %
(client, gateway)
+        netconf = "192.168.7.%s::192.168.7.%s:255.255.255.0::eth0" %
(client, gateway)
         logger.info("Network configuration: %s", netconf)
         self.kernel_cmdline_script += " ip=%s" % netconf
         mac = "%s%02x" % (self.mac_tap, client)
-- 

Siemens Schweiz AG, Smart Infrastructure
SI BP R&D ZG FW CCP
Theilerstrasse 1a
6300 Zug, Switzerland
Mobile: +41 796819596



  parent reply	other threads:[~2020-03-04  8:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-04  8:14 [PATCH] runqemu: support multiple NICs Freihofer, Adrian
2020-03-04  8:32 ` ✗ patchtest: failure for " Patchwork
2020-03-04  8:33 ` Freihofer, Adrian [this message]
2020-03-04  9:02 ` ✗ patchtest: failure for runqemu: support multiple NICs (rev2) Patchwork

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=a96c65a5e8246d44240511aaf666889fd983b8c8.camel@siemens.com \
    --to=adrian.freihofer@siemens.com \
    --cc=openembedded-core@lists.openembedded.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 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.