public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Ryosuke Nakayama <ryosuke.nakayama@ryskn.com>
To: pve-devel@lists.proxmox.com
Cc: unixtech <ryosuke_666@icloud.com>
Subject: [RFC PATCH qemu-server 2/2] qemu: VPP: clean up vhost-user interfaces on stop, fix tx_queue_size
Date: Tue, 17 Mar 2026 20:14:03 +0900	[thread overview]
Message-ID: <20260317111404.37254-3-ryosuke.nakayama@ryskn.com> (raw)
In-Reply-To: <20260317111404.37254-1-ryosuke.nakayama@ryskn.com>

From: unixtech <ryosuke_666@icloud.com>

- add vpp_cleanup_vhost_nets() to delete VirtualEthernet interfaces
  when VM stops
- set tx_queue_size=1024 for VPP bridge interfaces (was 256, causing
  RX bottleneck)

Signed-off-by: Ryosuke Nakayama <ryosuke.nakayama@ryskn.com>
Signed-off-by: unixtech <ryosuke.nakayama@ryskn.com>
---
 src/PVE/QemuServer.pm | 38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index cf1c9e9f..e946e0f8 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -1351,7 +1351,8 @@ sub print_netdevice_full {
     }
 
     if (min_version($machine_version, 7, 1) && $net->{model} eq 'virtio') {
-        $tmpstr .= ",rx_queue_size=1024,tx_queue_size=256";
+        my $tx_queue_size = ($net->{bridge} && $net->{bridge} =~ /^vppbr\d+$/) ? 1024 : 256;
+        $tmpstr .= ",rx_queue_size=1024,tx_queue_size=$tx_queue_size";
     }
 
     $tmpstr .= ",bootindex=$net->{bootindex}" if $net->{bootindex};
@@ -5215,6 +5216,39 @@ sub vpp_connect_vhost_nets {
     }
 }
 
+sub vpp_cleanup_vhost_nets {
+    my ($conf, $vmid) = @_;
+
+    return if !-x '/usr/bin/vppctl';
+
+    foreach my $opt (keys %$conf) {
+        next if $opt !~ m/^net\d+$/;
+        my $net = PVE::QemuServer::Network::parse_net($conf->{$opt});
+        next if !$net || !$net->{bridge} || $net->{bridge} !~ /^vppbr\d+$/;
+
+        my $socket = "/var/run/vpp/qemu-${vmid}-${opt}.sock";
+
+        eval {
+            my $ifaces = '';
+            PVE::Tools::run_command(
+                ['/usr/bin/vppctl', 'show', 'vhost-user'],
+                outfunc => sub { $ifaces .= $_[0] . "\n"; },
+                timeout => 5,
+            );
+            while ($ifaces =~ /^Interface:\s+(\S+).*socket filename\s+\Q$socket\E/ms) {
+                my $iface = $1;
+                PVE::Tools::run_command(
+                    ['/usr/bin/vppctl', 'delete', 'vhost-user', $iface],
+                    timeout => 5,
+                );
+                print "VPP: deleted vhost-user interface $iface for $opt\n";
+                last;
+            }
+        };
+        warn "VPP vhost-user cleanup failed for $opt: $@" if $@;
+    }
+}
+
 sub vmconfig_update_agent {
     my ($conf, $opt, $value) = @_;
 
@@ -6233,6 +6267,8 @@ sub vm_stop_cleanup {
 
         cleanup_pci_devices($vmid, $conf);
 
+        vpp_cleanup_vhost_nets($conf, $vmid);
+
         vmconfig_apply_pending($vmid, $conf, $storecfg) if $apply_pending_changes;
     };
     if (my $err = $@) {
-- 
2.50.1 (Apple Git-155)




  parent reply	other threads:[~2026-03-17 11:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16 22:28 [RFC PATCH 0/2] network: add VPP (fd.io) as alternative dataplane Ryosuke Nakayama
2026-03-16 22:28 ` [RFC PATCH manager 1/2] api: network: add VPP (fd.io) dataplane bridge support Ryosuke Nakayama
2026-03-16 22:28 ` [RFC PATCH widget-toolkit 2/2] ui: network: add VPP (fd.io) bridge type support Ryosuke Nakayama
2026-03-17  6:39 ` [RFC PATCH 0/2] network: add VPP (fd.io) as alternative dataplane Stefan Hanreich
2026-03-17 10:18 ` DERUMIER, Alexandre
2026-03-17 11:14   ` Ryosuke Nakayama
2026-03-17 11:14     ` [RFC PATCH qemu-server 1/2] qemu: add VPP vhost-user dataplane support Ryosuke Nakayama
2026-03-17 11:14     ` Ryosuke Nakayama [this message]
2026-03-17 11:26     ` Ryosuke Nakayama
2026-03-17 11:21 ` [RFC PATCH 0/2] network: add VPP (fd.io) as alternative dataplane Ryosuke Nakayama
2026-03-17 11:21   ` [RFC PATCH pve-common] network: add VPP bridge helpers for vhost-user dataplane Ryosuke Nakayama

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=20260317111404.37254-3-ryosuke.nakayama@ryskn.com \
    --to=ryosuke.nakayama@ryskn.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=ryosuke_666@icloud.com \
    /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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal