network: also check SR-IOV PF port and other VF ports before configuring

When a PF port becomes down (this can happens e.g. the PF port is joining
a bond interface), some drivers make its VF ports also become down, and
may cause failures in configuring VF ports.

Similary, when a VF port become down, some drivers make its PF port and
other VF ports down.

Let's configure SR-IOV ports (both PF and VFs) after all link-layer
settings of all ports being applied.

Fixes #23315.
This commit is contained in:
Yu Watanabe
2022-08-05 21:49:27 +09:00
parent b0ff6dea38
commit e33232d405
5 changed files with 83 additions and 5 deletions
+11 -2
View File
@@ -31,6 +31,7 @@
#include "networkd-manager.h"
#include "networkd-queue.h"
#include "networkd-setlink.h"
#include "networkd-sriov.h"
#include "nlmon.h"
#include "path-lookup.h"
#include "siphash24.h"
@@ -604,12 +605,15 @@ static int stacked_netdev_create(NetDev *netdev, Link *link, Request *req) {
return 0;
}
static bool link_is_ready_to_create_stacked_netdev(Link *link) {
static bool link_is_ready_to_create_stacked_netdev_one(Link *link, bool allow_unmanaged) {
assert(link);
if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED, LINK_STATE_UNMANAGED))
return false;
if (!link->network)
return allow_unmanaged;
if (link->set_link_messages > 0)
return false;
@@ -621,6 +625,11 @@ static bool link_is_ready_to_create_stacked_netdev(Link *link) {
return true;
}
static bool link_is_ready_to_create_stacked_netdev(Link *link) {
return check_ready_for_all_sr_iov_ports(link, /* allow_unmanaged = */ false,
link_is_ready_to_create_stacked_netdev_one);
}
static int netdev_is_ready_to_create(NetDev *netdev, Link *link) {
assert(netdev);