Skip to content

Commit b243a90

Browse files
committed
stratovirt: improve net mq
1 parent 62b9252 commit b243a90

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

lib/runners/stratovirt.nix

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ let
1212
kernel initrdPath
1313
storeOnDisk storeDisk;
1414

15+
tapMultiQueue = vcpu > 1;
16+
1517
inherit (import ../. { nixpkgs-lib = pkgs.lib; }) withDriveLetters;
1618
volumes = withDriveLetters microvmConfig;
1719

@@ -26,8 +28,6 @@ let
2628
aarch64-linux = "virt";
2729
}.${system};
2830

29-
tapMultiQueue = vcpu > 1;
30-
3131
console = {
3232
x86_64-linux = "ttyS0";
3333
aarch64-linux = "ttyAMA0";
@@ -111,6 +111,7 @@ in {
111111
[
112112
(if type == "macvtap" then "tap" else "${type}")
113113
"id=${id}"
114+
"queues=${toString (lib.min 16 vcpu)}"
114115
]
115116
++ lib.optionals (type == "user" && forwardPortsOptions != []) forwardPortsOptions
116117
++ lib.optionals (type == "bridge") [
@@ -128,7 +129,15 @@ in {
128129
)
129130
)
130131
# TODO: devType (0x10 + i)
131-
"-device" "virtio-net-${devType 30},id=net_${id},netdev=${id},mac=${mac}"
132+
"-device" (
133+
lib.concatStringsSep "," [
134+
"virtio-net-${devType 30}"
135+
"id=net_${id}"
136+
"netdev=${id}"
137+
"mac=${mac}"
138+
"mq=${if tapMultiQueue then "on" else "off"}"
139+
]
140+
)
132141
]) interfaces
133142
)
134143
++

0 commit comments

Comments
 (0)