udev/net: allow to set number of SR-IOV virtual functions
This adds SR-IOVVirtualFunctions= setting in [Link] section.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user