From f212f0cc169e4e5f93a8f7e10f467efa32840fbb Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Fri, 13 Dec 2024 23:19:01 +0100 Subject: [PATCH] board/common: ensure virtio ports have an initial speed/duplex The speed/duplex of a virtio interface is not eenforced in any way. The driver initializes them to unknown/unkown: https://github.com/torvalds/linux/blob/dccbe2047a5b0859de24bf463dae9eeea8e01c1e/drivers/net/virtio_net.c#L5375-L5381 It is however possible to set them since there are kernel subsystems that rely on them, e.g., miimon in the bond driver, which in turn is required for use with the 802.3ad (lacp) mode. If we do not initialize speed/duplex the miimon will complain in the log on virtual test systems every second: Dec 13 22:34:08 laggy kernel: lag0: (slave e1): failed to get link speed/duplex Signed-off-by: Joachim Wiberg --- board/common/rootfs/usr/libexec/infix/init.d/25-qemu | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 board/common/rootfs/usr/libexec/infix/init.d/25-qemu diff --git a/board/common/rootfs/usr/libexec/infix/init.d/25-qemu b/board/common/rootfs/usr/libexec/infix/init.d/25-qemu new file mode 100755 index 00000000..ef48b390 --- /dev/null +++ b/board/common/rootfs/usr/libexec/infix/init.d/25-qemu @@ -0,0 +1,8 @@ +#!/bin/sh +# Initialize speed/duplex of virtio interfaces +# For virtual test systems (lacp tests) + +ifaces=$(ip -d -json link show | jq -r '.[] | select(.parentbus == "virtio") | .ifname') +for iface in $ifaces; do + ethtool -s "$iface" speed 1000 duplex full +done