From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-common 1/3] iproute2: restructure get_physical_bridge_ports
Date: Thu, 9 Jul 2026 15:28:53 +0200 [thread overview]
Message-ID: <20260709132857.239615-2-s.hanreich@proxmox.com> (raw)
In-Reply-To: <20260709132857.239615-1-s.hanreich@proxmox.com>
By checking first if the interface is a member of the bridge, instead
of determining its type, a lot of unnecessary checks are not performed
since checking for membership first is a lot more discriminatory. When
applying a SDN configuration with 100 VLAN VNets on a non-VLAN-aware
bridge, this saves a significant amount of statements executed:
without this optimization:
Executed 438813 statements in 110ms
with this optimization:
Executed 3693 statements in 10.2ms
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
Notes:
This is a remnant from an earlier approach where only the
ip_link_details output was used, but the bridge ports were still
recalculated. Nevertheless I decided to still include this patch
instead of dropping it, since other call sites also profit from it.
src/PVE/IPRoute2.pm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/PVE/IPRoute2.pm b/src/PVE/IPRoute2.pm
index 53a17b0..ae837dc 100644
--- a/src/PVE/IPRoute2.pm
+++ b/src/PVE/IPRoute2.pm
@@ -83,11 +83,11 @@ sub get_physical_bridge_ports($bridge, $ip_links = undef) {
}
return grep {
- (ip_link_is_physical($ip_links->{$_})
+ defined($ip_links->{$_}->{master})
+ && $ip_links->{$_}->{master} eq $bridge
+ && (ip_link_is_physical($ip_links->{$_})
|| ip_link_is_bond($ip_links->{$_})
|| ip_link_is_vlan($ip_links->{$_}))
- && defined($ip_links->{$_}->{master})
- && $ip_links->{$_}->{master} eq $bridge
} keys $ip_links->%*;
}
--
2.47.3
next prev parent reply other threads:[~2026-07-09 13:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 13:28 [PATCH common/network 0/3] Performance improvements for applying VLAN / QinQ zones Stefan Hanreich
2026-07-09 13:28 ` Stefan Hanreich [this message]
2026-07-09 13:28 ` [PATCH pve-common 2/3] iproute2: add helper for getting bridge port mappings Stefan Hanreich
2026-07-09 13:28 ` [PATCH pve-network 3/3] fix #7738: zones: use pre-computed bridge port list Stefan Hanreich
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=20260709132857.239615-2-s.hanreich@proxmox.com \
--to=s.hanreich@proxmox.com \
--cc=pve-devel@lists.proxmox.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