Skip to content

Conversation

@mykaul
Copy link
Contributor

@mykaul mykaul commented Dec 31, 2025

From CoPi:
I have fixed the issue by adding support for Azure's netvsc driver in perftune.py.

The changes include:

Added nic_is_netvsc_iface method to NetPerfTuner class to identify interfaces using the hv_netvsc driver.
Updated nic_is_hw_iface to exclude netvsc interfaces, so they are treated as composite interfaces.
Updated nic_is_composite_iface to include netvsc interfaces.
Modified _learn_slaves_one to correctly identify the underlying physical device (VF) for netvsc interfaces by looking for lower* links in sysfs.
Updated the tune method to print the correct interface type when configuring netvsc interfaces.
These changes ensure that perftune.py can correctly identify and tune the underlying physical network device when running in Azure with accelerated networking enabled.

Fixes: #2534

@fruch
Copy link

fruch commented Dec 31, 2025

@mykaul this is my suggestion

I've tested both codes, and they did what expected, i.e.

sudo /opt/scylladb/scripts/perftune.py --nic eth0 --tune net
...
eth1 was configured as expected
commit ba589d404f16055443cc70d4809b068059c5729c
Author: Israel Fruchter <[email protected]>
Date:   Wed Dec 31 21:36:21 2025 +0200

    Change to be not interface specific
    
    now every device that we identify it has slaves, we assume it's composite
    one, and we go and configure the slave

diff --git a/scripts/perftune.py b/scripts/perftune.py
index 8b2b324f..1a5cad2f 100755
--- a/scripts/perftune.py
+++ b/scripts/perftune.py
@@ -653,7 +653,7 @@ class NetPerfTuner(PerfTunerBase):
                 perftune_print("Setting a physical interface {}...".format(nic))
                 self.__setup_one_hw_iface(nic)
             else:
-                type_str = 'bond' if self.nic_is_bond_iface(nic) else ('VLAN' if self.nic_is_vlan_iface(nic) else 'netvsc')
+                type_str = 'bond' if self.nic_is_bond_iface(nic) else ('VLAN' if self.nic_is_vlan_iface(nic) else 'has_slaves')
                 perftune_print(f"Setting a {nic} {type_str} interface...")
                 self.__setup_composite_iface(nic)
 
@@ -681,17 +681,17 @@ class NetPerfTuner(PerfTunerBase):
     def nic_is_vlan_iface(self, nic):
         return self.__nic_is_vlan_iface.get(nic, False)
 
-    def nic_is_netvsc_iface(self, nic):
-        return self.__get_driver_name(nic) == 'hv_netvsc'
+    def nic_has_slaves(self, nic):
+        return bool(glob.glob(f"/sys/class/net/{nic}/lower_*"))
 
     def nic_is_composite_iface(self, nic):
-        return self.nic_is_bond_iface(nic) or self.nic_is_vlan_iface(nic) or self.nic_is_netvsc_iface(nic)
+        return self.nic_is_bond_iface(nic) or self.nic_is_vlan_iface(nic) or self.nic_has_slaves(nic)
 
     def nic_exists(self, nic):
         return self.__iface_exists(nic)
 
     def nic_is_hw_iface(self, nic):
-        return self.__dev_is_hw_iface(nic) and not self.nic_is_netvsc_iface(nic)
+        return self.__dev_is_hw_iface(nic) and not self.nic_has_slaves(nic)
 
     def slaves(self, nic):
         """
@@ -841,7 +841,7 @@ class NetPerfTuner(PerfTunerBase):
         if self.nic_is_bond_iface(nic):
             top_slaves_list = set(itertools.chain.from_iterable(
                 [line.split() for line in open("/sys/class/net/{}/bonding/slaves".format(nic), 'r').readlines()]))
-        elif self.nic_is_vlan_iface(nic):
+        elif self.nic_is_vlan_iface(nic) or self.nic_has_slaves(nic):
             # VLAN interfaces have a symbolic link 'lower_<parent_interface_name>' under
             # /sys/class/net/<VLAN interface name>.
             #
@@ -851,11 +851,6 @@ class NetPerfTuner(PerfTunerBase):
             #
             top_slaves_list = set([pathlib.PurePath(pathlib.Path(f).resolve()).name
                                    for f in glob.glob(f"/sys/class/net/{nic}/lower_*")])
-        elif self.nic_is_netvsc_iface(nic):
-            # Azure 'netvsc' interface has a symbolic link 'lower_<parent_interface_name>' under
-            # /sys/class/net/<interface name>.
-            top_slaves_list = set([pathlib.PurePath(pathlib.Path(f).resolve()).name
-                                   for f in glob.glob(f"/sys/class/net/{nic}/lower_*")])
 
         # Slaves can be themselves bond or VLAN devices: let's descend (DFS) all the way down to get physical devices.
         # Bond slaves can't be VLAN interfaces but VLAN interface parent device can be a bond interface.

@mykaul
Copy link
Contributor Author

mykaul commented Jan 1, 2026

CoPi completely has overwritten the previous PR. Now it's reflecting on its mistake :-/

@mykaul mykaul closed this Jan 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[perftune.py][Azure]: identify dependent physical network device

3 participants