network,udev: configure SR-IOV VF attribute one-by-one

When a [SR-IOV] section has no setting, e.g.
```ini
[SR-IOV]
VirtualFunction=0
```
then the kernel previously replied -EINVAL, as we send a rtnl message
with an empty IFLA_VF_INFO container.
See See do_setvfinfo() in net/core/rtnetlink.c of the kernel.

When a [SR-IOV] section that has an unsupported settings by the
interface driver, then previously the kernel partially applied
settings and returned -EOPNOTSUPP. E.f.
```ini
[SR-IOV]
VirtualFunction=0
LinkState=auto
Trust=true
MACAddress=02:01:00:3e:61:34
```
and the interface does not support configuring the link state, then
the MAC address is assigned, but the trust is not applied:
```
enp3s0f0: Failed to configure SR-IOV virtual function 0, ignoring: Operation not supported
    vf 0     link/ether 02:01:00:3e:61:34 brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off
```

To fix such issues, this makes networkd/udevd send each attribute
for VF one-by-one.

Fixes #37257 and #37275.
This commit is contained in:
Yu Watanabe
2025-04-30 15:47:19 +09:00
parent c8b3f1d47d
commit 371005ac98
6 changed files with 148 additions and 51 deletions
+6 -1
View File
@@ -384,7 +384,12 @@ static const char *const request_type_table[_REQUEST_TYPE_MAX] = {
[REQUEST_TYPE_SET_LINK_MAC] = "MAC address",
[REQUEST_TYPE_SET_LINK_MASTER] = "master interface",
[REQUEST_TYPE_SET_LINK_MTU] = "MTU",
[REQUEST_TYPE_SRIOV] = "SR-IOV",
[REQUEST_TYPE_SRIOV_VF_MAC] = "SR-IOV VF MAC address",
[REQUEST_TYPE_SRIOV_VF_SPOOFCHK] = "SR-IOV VF spoof check",
[REQUEST_TYPE_SRIOV_VF_RSS_QUERY_EN] = "SR-IOV VF RSS query",
[REQUEST_TYPE_SRIOV_VF_TRUST] = "SR-IOV VF trust",
[REQUEST_TYPE_SRIOV_VF_LINK_STATE] = "SR-IOV VF link state",
[REQUEST_TYPE_SRIOV_VF_VLAN_LIST] = "SR-IOV VF vlan list",
[REQUEST_TYPE_TC_QDISC] = "QDisc",
[REQUEST_TYPE_TC_CLASS] = "TClass",
[REQUEST_TYPE_UP_DOWN] = "bring link up or down",