mirror of
https://github.com/systemd/systemd.git
synced 2025-01-10 05:18:17 +03:00
Merge pull request #17628 from ssahani/network-gso
udev: Add support to configure Generic Segment Offload
This commit is contained in:
commit
7c5869530c
@ -743,6 +743,22 @@
|
||||
PAUSE configuration. When unset, the kernel's default will be used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>GenericSegmentOffloadMaxBytes=</varname></term>
|
||||
<listitem>
|
||||
<para>Specifies the maximum size of a Generic Segment Offload (GSO) packet the
|
||||
device should accept. The usual suffixes K, M, G, are supported and are
|
||||
understood to the base of 1024. An unsigned integer in the range 1—65536.
|
||||
Defaults to unset.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>GenericSegmentOffloadMaxSegments=</varname></term>
|
||||
<listitem>
|
||||
<para>Specifies the maximum number of a Generic Segment Offload (GSO) segments the device should accept.
|
||||
An unsigned integer in the range 1—65535. Defaults to unset.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
@ -642,6 +642,8 @@ static const NLType rtnl_link_types[] = {
|
||||
[IFLA_PROMISCUITY] = { .type = NETLINK_TYPE_U32 },
|
||||
[IFLA_NUM_TX_QUEUES] = { .type = NETLINK_TYPE_U32 },
|
||||
[IFLA_NUM_RX_QUEUES] = { .type = NETLINK_TYPE_U32 },
|
||||
[IFLA_GSO_MAX_SEGS] = { .type = NETLINK_TYPE_U32 },
|
||||
[IFLA_GSO_MAX_SIZE] = { .type = NETLINK_TYPE_U32 },
|
||||
[IFLA_CARRIER] = { .type = NETLINK_TYPE_U8 },
|
||||
/*
|
||||
[IFLA_PHYS_PORT_ID] = { .type = NETLINK_TYPE_BINARY, .len = MAX_PHYS_PORT_ID_LEN },
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -66,3 +66,5 @@ Link.TxBufferSize, config_parse_nic_buffer_size, 0,
|
||||
Link.RxFlowControl, config_parse_tristate, 0, offsetof(link_config, rx_flow_control)
|
||||
Link.TxFlowControl, config_parse_tristate, 0, offsetof(link_config, tx_flow_control)
|
||||
Link.AutoNegotiationFlowControl, config_parse_tristate, 0, offsetof(link_config, autoneg_flow_control)
|
||||
Link.GenericSegmentOffloadMaxBytes, config_parse_iec_size, 0, offsetof(link_config, gso_max_size)
|
||||
Link.GenericSegmentOffloadMaxSegments, config_parse_uint32, 0, offsetof(link_config, gso_max_segments)
|
||||
|
@ -426,7 +426,7 @@ static int link_config_apply_rtnl_settings(sd_netlink **rtnl, const link_config
|
||||
} else
|
||||
mac = config->mac;
|
||||
|
||||
r = rtnl_set_link_properties(rtnl, ifindex, config->alias, mac, config->mtu);
|
||||
r = rtnl_set_link_properties(rtnl, ifindex, config->alias, mac, config->mtu, config->gso_max_size, config->gso_max_segments);
|
||||
if (r < 0)
|
||||
log_device_warning_errno(device, r, "Could not set Alias=, MACAddress= or MTU=, ignoring: %m");
|
||||
|
||||
|
@ -47,6 +47,8 @@ struct link_config {
|
||||
char **alternative_names;
|
||||
char *alias;
|
||||
uint32_t mtu;
|
||||
uint32_t gso_max_segments;
|
||||
size_t gso_max_size;
|
||||
uint64_t speed;
|
||||
Duplex duplex;
|
||||
int autonegotiation;
|
||||
|
@ -46,3 +46,5 @@ TxBufferSize=
|
||||
RxFlowControl=
|
||||
TxFlowControl=
|
||||
AutoNegotiationFlowControl=
|
||||
GenericSegmentOffloadMaxBytes=
|
||||
GenericSegmentOffloadMaxSegments=
|
||||
|
Loading…
Reference in New Issue
Block a user