public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Alexandre Derumier <aderumier@odiso.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 pve-common 1/1] network_interfaces: disable rx-vlan-filter for physical interfaces ports of a vlan-aware bridge
Date: Tue, 27 Jun 2023 08:53:51 +0200	[thread overview]
Message-ID: <20230627065351.1348117-2-aderumier@odiso.com> (raw)
In-Reply-To: <20230627065351.1348117-1-aderumier@odiso.com>

some nic like mellanox connectx or intel i40e don't work well vlan-aware bridge
because they are limited in number of vlan filtering in hardware

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 src/PVE/INotify.pm                              | 15 +++++++++++++++
 test/etc_network_interfaces/t.parsed_options.pl |  7 +++++++
 2 files changed, 22 insertions(+)

diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
index bc33a8f..c4dd85d 100644
--- a/src/PVE/INotify.pm
+++ b/src/PVE/INotify.pm
@@ -963,6 +963,7 @@ sub __read_etc_network_interfaces {
 			'vxlan-svcnodeip' => 1,
 			'vxlan-physdev' => 1,
 			'vxlan-local-tunnelip' => 1,
+			'rx-vlan-filter' => 1,
 		    };
 
 		    if ($id eq 'address' || $id eq 'netmask' || $id eq 'broadcast' || $id eq 'gateway') {
@@ -1514,6 +1515,7 @@ sub __write_etc_network_interfaces {
     }
 
     # check bond
+    my $bondslaves = {};
     foreach my $iface (keys %$ifaces) {
 	my $d = $ifaces->{$iface};
 	next if !($d->{type} eq 'bond' && $d->{slaves});
@@ -1529,6 +1531,7 @@ sub __write_etc_network_interfaces {
 
 	    $check_mtu->($ifaces, $iface, $p);
 	    $bond_primary_is_slave = 1 if $d->{'bond-primary'} && $d->{'bond-primary'} eq $p;
+	    $bondslaves->{$p} = $iface;
 	}
 	die "bond '$iface' - bond-primary interface is not a slave" if $d->{'bond-primary'} && !$bond_primary_is_slave;
     }
@@ -1658,6 +1661,18 @@ sub __write_etc_network_interfaces {
 	}
     }
 
+    # disable rx-vlan-filter if physical nic is port of a vlan-aware bridge
+    foreach my $iface (keys %$ifaces) {
+	next if $iface !~ /^$PVE::Network::PHYSICAL_NIC_RE/;
+	my $phys_iface = $iface;
+	$iface = $bondslaves->{$iface} if $bondslaves->{$iface};
+	if ($bridgeports->{$iface} && $bridges->{$bridgeports->{$iface}}->{bridge_vlan_aware}) {
+	    $ifaces->{$phys_iface}->{'rx-vlan-filter'} = 'off' if !defined($ifaces->{$phys_iface}->{'rx-vlan-filter'});
+	} else {
+	    delete $ifaces->{$phys_iface}->{'rx-vlan-filter'};
+	}
+    }
+
     my $raw = <<'NETWORKDOC';
 # network interface settings; autogenerated
 # Please do NOT modify this file directly, unless you know what
diff --git a/test/etc_network_interfaces/t.parsed_options.pl b/test/etc_network_interfaces/t.parsed_options.pl
index bbb2a27..fbedf6a 100644
--- a/test/etc_network_interfaces/t.parsed_options.pl
+++ b/test/etc_network_interfaces/t.parsed_options.pl
@@ -15,6 +15,7 @@ my $gw6 = 'fc05::1';
 # Load
 my $cfg = load('base') . <<"CHECK";
 iface eth1 inet manual
+	rx-vlan-filter off
 
 auto vmbr0
 iface vmbr0 inet static
@@ -23,6 +24,12 @@ iface vmbr0 inet static
 	bridge-ports eth0
 	bridge-stp off
 	bridge-fd 0
+
+auto vmbr1
+iface vmbr1 inet manual
+	bridge-ports eth1
+	bridge-stp off
+	bridge-fd 0
 	bridge-vlan-aware yes
 	bridge-vids 2-4094
 
-- 
2.39.2




      reply	other threads:[~2023-06-27  6:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27  6:53 [pve-devel] [PATCH v2 pve-common 0/1] disable rx-vlan-filter on iface in vlan-aware-bridge Alexandre Derumier
2023-06-27  6:53 ` Alexandre Derumier [this message]

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=20230627065351.1348117-2-aderumier@odiso.com \
    --to=aderumier@odiso.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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal