All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] runqemu: support multiple NICs
@ 2020-03-07 15:01 Adrian Freihofer
  2020-03-07 18:09 ` Richard Purdie
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian Freihofer @ 2020-03-07 15:01 UTC (permalink / raw)
  To: openembedded-core; +Cc: Adrian Freihofer

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-net-device,mac=52:54:00:12:34:03 \
"

Note:
 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 gets 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@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)
-- 
2.24.1



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

* Re: [PATCH v3] runqemu: support multiple NICs
  2020-03-07 15:01 [PATCH v3] runqemu: support multiple NICs Adrian Freihofer
@ 2020-03-07 18:09 ` Richard Purdie
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2020-03-07 18:09 UTC (permalink / raw)
  To: Adrian Freihofer, openembedded-core; +Cc: Adrian Freihofer

On Sat, 2020-03-07 at 16:01 +0100, Adrian Freihofer wrote:
> 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-net-device,mac=52:54:00:12:34:03 \
> "
> 
> Note:
>  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 gets 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

This appears to break our automated testing, e.g.:

https://autobuilder.yoctoproject.org/typhoon/#/builders/76/builds/1657

(there is a full list of failures on 
https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/779
but the missing xz ones aren't yours!)

Cheers,

Richard



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

end of thread, other threads:[~2020-03-07 18:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-07 15:01 [PATCH v3] runqemu: support multiple NICs Adrian Freihofer
2020-03-07 18:09 ` Richard Purdie

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.