-devlink-port(8) - Linux manual page
To prevent a SmartNIC Function (SF) or VF from using an arbitrary MAC address in switchdev mode, use devlink port function set to assign MAC.
IE: devlink port function set pci/0000:01:00.0/1 hw_addr 00:00:00:11:22:33 state active trusted false
Assigns a MAC address to the function.
Makes it non-trusted, which disables the ability to change MAC or spoof it.
This prevents the SF from sending with any MAC other than the one configured.
Note: Only trusted=true allows arbitrary MACs; trusted=false restricts it to the assigned MAC.
-You can also install hardware filter rules that only allow egress packets with a specific MAC source. On the representor interface.
-After reading the driver source code, I have a hypothesis that, unlike ixgbe, mlx5 doesn’t configure a specific MAC address filter but instead allows only one specific MAC address on the port. Is this correct? YES
-If so, it can be configured, for example, using tc filter or rte_flow, right? YES
-Yes — it is possible to assign different MAC addresses to the eth and vDPA (vnet) ports of a Single SF — but with key constraints depending on the NIC model (e.g., ConnectX-6 Dx, ConnectX-7), firmware version, and driver/kernel support.
-Yes, you can have different MAC addresses on the eth port and the vDPA port of a single SF, as long as:
- You assign the eth MAC via devlink.
- You assign the vDPA MAC via vdpa-tool or QEMU.
- You explicitly allow the second MAC at the eswitch level (via tc or by enabling trust if supported).
Note: When both eth and vnet are enabled for a single SF, you’re dealing with multi-functionality over a single function, but they share the underlying devlink port.
The default MAC address for the SF (via devlink port function set) is propagated to both eth and vnet.
-Also, what does hw_addr in devlink port function set affect?
Field Purpose Applies To Enforced by HW? Used as src MAC?
mac Active MAC address of netdev PF, VF, SF (ethX) ✅ Yes ✅ Yes
hw_addr Stored hardware MAC (low-level) Management, auxiliary, fw ❌ Often No ❌ Usually No
- And, what does the MAC address affect on the SF representor netdev? Nothing?
The representor (rep) is a host-side netdev that represents the traffic of a VF or SF in switchdev mode. It acts like a virtual patch cable into the NIC’s embedded switch (eswitch), allowing the host to:
- Apply tc rules for classification/offload.
- Monitor traffic.
- Control flows between SFs/VFs and uplinks.
The MAC address of the SF representor (rep) netdev is mostly informational, and does not affect actual traffic handling or filtering.