]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev/net: mention which SR-IOV setting could not be applied in log message
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 4 May 2025 16:44:51 +0000 (01:44 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 5 May 2025 13:07:04 +0000 (22:07 +0900)
src/udev/net/link-config.c

index 5c67cf2dc6082f2ec3feb6a0605f052762c1954d..d684f76982d5ee7334e0194e09788fa9edbbfc03 100644 (file)
@@ -854,38 +854,32 @@ static int link_generate_alternative_names(Link *link) {
         return 0;
 }
 
-static int sr_iov_configure(Link *link, sd_netlink **rtnl, SRIOV *sr_iov) {
+static int sr_iov_configure(Link *link, sd_netlink **rtnl, SRIOV *sr_iov, SRIOVAttribute attr) {
         int r;
 
         assert(link);
         assert(rtnl);
         assert(link->ifindex > 0);
 
-        for (SRIOVAttribute attr = 0; attr < _SR_IOV_ATTRIBUTE_MAX; attr++) {
-                if (!sr_iov_has_config(sr_iov, attr))
-                        continue;
-
-                if (!*rtnl) {
-                        r = sd_netlink_open(rtnl);
-                        if (r < 0)
-                                return r;
-                }
+        if (!sr_iov_has_config(sr_iov, attr))
+                return 0;
 
-                _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL;
-                r = sd_rtnl_message_new_link(*rtnl, &req, RTM_SETLINK, link->ifindex);
+        if (!*rtnl) {
+                r = sd_netlink_open(rtnl);
                 if (r < 0)
                         return r;
+        }
 
-                r = sr_iov_set_netlink_message(sr_iov, attr, req);
-                if (r < 0)
-                        return r;
+        _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL;
+        r = sd_rtnl_message_new_link(*rtnl, &req, RTM_SETLINK, link->ifindex);
+        if (r < 0)
+                return r;
 
-                r = sd_netlink_call(*rtnl, req, 0, NULL);
-                if (r < 0)
-                        return r;
-        }
+        r = sr_iov_set_netlink_message(sr_iov, attr, req);
+        if (r < 0)
+                return r;
 
-        return 0;
+        return sd_netlink_call(*rtnl, req, 0, NULL);
 }
 
 static int link_apply_sr_iov_config(Link *link) {
@@ -925,11 +919,13 @@ static int link_apply_sr_iov_config(Link *link) {
                         continue;
                 }
 
-                r = sr_iov_configure(link, &link->event->rtnl, sr_iov);
-                if (r < 0)
-                        log_link_warning_errno(link, r,
-                                               "Failed to set up SR-IOV virtual function %"PRIu32", ignoring: %m",
-                                               sr_iov->vf);
+                for (SRIOVAttribute attr = 0; attr < _SR_IOV_ATTRIBUTE_MAX; attr++) {
+                        r = sr_iov_configure(link, &link->event->rtnl, sr_iov, attr);
+                        if (r < 0)
+                                log_link_warning_errno(link, r,
+                                                       "Failed to set up %s for SR-IOV virtual function %"PRIu32", ignoring: %m",
+                                                       sr_iov_attribute_to_string(attr), sr_iov->vf);
+                }
         }
 
         return 0;