diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-01-14 19:35:27 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-01-19 07:00:53 +0100 |
commit | 41ce9d769d394d19f1caab8b8a89b7dea50db0bc (patch) | |
tree | 9f1f0daa85ac1bd91151672650efd33e460c8ad9 /src/udev/net | |
parent | udev/net: also support [SR-IOV] section in .link files (diff) | |
download | systemd-41ce9d769d394d19f1caab8b8a89b7dea50db0bc.tar.xz systemd-41ce9d769d394d19f1caab8b8a89b7dea50db0bc.zip |
udev/net: allow to set number of SR-IOV virtual functions
This adds SR-IOVVirtualFunctions= setting in [Link] section.
Diffstat (limited to 'src/udev/net')
-rw-r--r-- | src/udev/net/link-config-gperf.gperf | 1 | ||||
-rw-r--r-- | src/udev/net/link-config.c | 8 | ||||
-rw-r--r-- | src/udev/net/link-config.h | 1 |
3 files changed, 9 insertions, 1 deletions
diff --git a/src/udev/net/link-config-gperf.gperf b/src/udev/net/link-config-gperf.gperf index 3732fd53ef..7dde4ed59f 100644 --- a/src/udev/net/link-config-gperf.gperf +++ b/src/udev/net/link-config-gperf.gperf @@ -102,6 +102,7 @@ Link.RxMaxCoalescedHighFrames, config_parse_coalesce_u32, Link.TxCoalesceHighSec, config_parse_coalesce_sec, 0, offsetof(LinkConfig, coalesce.tx_coalesce_usecs_high) Link.TxMaxCoalescedHighFrames, config_parse_coalesce_u32, 0, offsetof(LinkConfig, coalesce.tx_max_coalesced_frames_high) Link.CoalescePacketRateSampleIntervalSec, config_parse_coalesce_sec, 0, offsetof(LinkConfig, coalesce.rate_sample_interval) +Link.SR-IOVVirtualFunctions, config_parse_sr_iov_num_vfs, 0, offsetof(LinkConfig, sr_iov_num_vfs) SR-IOV.VirtualFunction, config_parse_sr_iov_uint32, 0, offsetof(LinkConfig, sr_iov_by_section) SR-IOV.VLANId, config_parse_sr_iov_uint32, 0, offsetof(LinkConfig, sr_iov_by_section) SR-IOV.QualityOfService, config_parse_sr_iov_uint32, 0, offsetof(LinkConfig, sr_iov_by_section) diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 3e8b6aaaf2..5bd029ecc5 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -250,6 +250,7 @@ int link_load_one(LinkConfigContext *ctx, const char *filename) { .txqueuelen = UINT32_MAX, .coalesce.use_adaptive_rx_coalesce = -1, .coalesce.use_adaptive_tx_coalesce = -1, + .sr_iov_num_vfs = UINT32_MAX, }; for (i = 0; i < ELEMENTSOF(config->features); i++) @@ -290,7 +291,7 @@ int link_load_one(LinkConfigContext *ctx, const char *filename) { if (r < 0) return r; - r = sr_iov_drop_invalid_sections(config->sr_iov_by_section); + r = sr_iov_drop_invalid_sections(config->sr_iov_num_vfs, config->sr_iov_by_section); if (r < 0) return r; @@ -874,6 +875,11 @@ static int link_apply_sr_iov_config(Link *link, sd_netlink **rtnl) { assert(link); assert(link->config); + assert(link->device); + + r = sr_iov_set_num_vfs(link->device, link->config->sr_iov_num_vfs, link->config->sr_iov_by_section); + if (r < 0) + log_link_warning_errno(link, r, "Failed to set the number of SR-IOV virtual functions, ignoring: %m"); ORDERED_HASHMAP_FOREACH(sr_iov, link->config->sr_iov_by_section) { r = sr_iov_configure(link, rtnl, sr_iov); diff --git a/src/udev/net/link-config.h b/src/udev/net/link-config.h index e71738cfbf..0d1d117f2e 100644 --- a/src/udev/net/link-config.h +++ b/src/udev/net/link-config.h @@ -77,6 +77,7 @@ struct LinkConfig { int autoneg_flow_control; netdev_coalesce_param coalesce; + uint32_t sr_iov_num_vfs; OrderedHashmap *sr_iov_by_section; LIST_FIELDS(LinkConfig, configs); |