1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

sd-netlink: add support to configure Generic Segment Offload

This commit is contained in:
Susant Sahani 2021-01-12 13:35:31 +01:00
parent ba423af6b5
commit c97cad60d1
2 changed files with 17 additions and 3 deletions

View File

@ -58,14 +58,15 @@ int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) {
}
int rtnl_set_link_properties(sd_netlink **rtnl, int ifindex, const char *alias,
const struct ether_addr *mac, uint32_t mtu) {
const struct ether_addr *mac, uint32_t mtu,
uint32_t gso_max_size, size_t gso_max_segments) {
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL;
int r;
assert(rtnl);
assert(ifindex > 0);
if (!alias && !mac && mtu == 0)
if (!alias && !mac && mtu == 0 && gso_max_size == 0 && gso_max_segments == 0)
return 0;
if (!*rtnl) {
@ -96,6 +97,18 @@ int rtnl_set_link_properties(sd_netlink **rtnl, int ifindex, const char *alias,
return r;
}
if (gso_max_size > 0) {
r = sd_netlink_message_append_u32(message, IFLA_GSO_MAX_SIZE, gso_max_size);
if (r < 0)
return r;
}
if (gso_max_segments > 0) {
r = sd_netlink_message_append_u32(message, IFLA_GSO_MAX_SEGS, gso_max_segments);
if (r < 0)
return r;
}
r = sd_netlink_call(*rtnl, message, 0, NULL);
if (r < 0)
return r;

View File

@ -70,7 +70,8 @@ static inline bool rtnl_message_type_is_mdb(uint16_t type) {
}
int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name);
int rtnl_set_link_properties(sd_netlink **rtnl, int ifindex, const char *alias, const struct ether_addr *mac, uint32_t mtu);
int rtnl_set_link_properties(sd_netlink **rtnl, int ifindex, const char *alias, const struct ether_addr *mac, uint32_t mtu,
uint32_t gso_max_size, size_t gso_max_segments);
int rtnl_get_link_alternative_names(sd_netlink **rtnl, int ifindex, char ***ret);
int rtnl_set_link_alternative_names(sd_netlink **rtnl, int ifindex, char * const *alternative_names);
int rtnl_set_link_alternative_names_by_ifname(sd_netlink **rtnl, const char *ifname, char * const *alternative_names);