mirror of
https://github.com/systemd/systemd.git
synced 2025-03-28 02:50:16 +03:00
network: add CAN Termination tristate option
This commit is contained in:
parent
9c01b203a7
commit
52aa38f14a
@ -2277,6 +2277,13 @@
|
||||
automatic restart off. By default automatic restart is disabled.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>Termination=</varname></term>
|
||||
<listitem>
|
||||
<para>Takes a boolean. When <literal>yes</literal>, the termination resistor will be selected for
|
||||
the bias network. When unset, the kernel's default will be used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>TripleSampling=</varname></term>
|
||||
<listitem>
|
||||
|
@ -316,6 +316,7 @@ static const NLType rtnl_link_info_data_can_types[] = {
|
||||
[IFLA_CAN_BITTIMING] = { .size = sizeof(struct can_bittiming) },
|
||||
[IFLA_CAN_RESTART_MS] = { .type = NETLINK_TYPE_U32 },
|
||||
[IFLA_CAN_CTRLMODE] = { .size = sizeof(struct can_ctrlmode) },
|
||||
[IFLA_CAN_TERMINATION] = { .type = NETLINK_TYPE_U16 },
|
||||
};
|
||||
|
||||
static const NLType rtnl_link_info_data_macsec_types[] = {
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "networkd-manager.h"
|
||||
#include "string-util.h"
|
||||
|
||||
#define CAN_TERMINATION_OHM_VALUE 120
|
||||
|
||||
static int link_up_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
int r;
|
||||
|
||||
@ -152,6 +154,17 @@ static int link_set_can(Link *link) {
|
||||
return log_link_error_errno(link, r, "Could not append IFLA_CAN_CTRLMODE attribute: %m");
|
||||
}
|
||||
|
||||
if (link->network->can_termination >= 0) {
|
||||
|
||||
log_link_debug(link, "%sabling can-termination", link->network->can_termination ? "En" : "Dis");
|
||||
|
||||
r = sd_netlink_message_append_u16(m, IFLA_CAN_TERMINATION,
|
||||
link->network->can_termination ? CAN_TERMINATION_OHM_VALUE : 0);
|
||||
if (r < 0)
|
||||
return log_link_error_errno(link, r, "Could not append IFLA_CAN_TERMINATION attribute: %m");
|
||||
|
||||
}
|
||||
|
||||
r = sd_netlink_message_close_container(m);
|
||||
if (r < 0)
|
||||
return log_link_error_errno(link, r, "Failed to close netlink container: %m");
|
||||
|
@ -251,6 +251,7 @@ CAN.BitRate, config_parse_si_uint64,
|
||||
CAN.SamplePoint, config_parse_permille, 0, offsetof(Network, can_sample_point)
|
||||
CAN.RestartSec, config_parse_sec, 0, offsetof(Network, can_restart_us)
|
||||
CAN.TripleSampling, config_parse_tristate, 0, offsetof(Network, can_triple_sampling)
|
||||
CAN.Termination, config_parse_tristate, 0, offsetof(Network, can_termination)
|
||||
QDisc.Parent, config_parse_qdisc_parent, _QDISC_KIND_INVALID, 0
|
||||
QDisc.Handle, config_parse_qdisc_handle, _QDISC_KIND_INVALID, 0
|
||||
ControlledDelay.Parent, config_parse_qdisc_parent, QDISC_KIND_CODEL, 0
|
||||
|
@ -455,6 +455,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
|
||||
.keep_configuration = _KEEP_CONFIGURATION_INVALID,
|
||||
|
||||
.can_triple_sampling = -1,
|
||||
.can_termination = -1,
|
||||
.ip_service_type = -1,
|
||||
};
|
||||
|
||||
|
@ -199,6 +199,7 @@ struct Network {
|
||||
unsigned can_sample_point;
|
||||
usec_t can_restart_us;
|
||||
int can_triple_sampling;
|
||||
int can_termination;
|
||||
|
||||
AddressFamily ip_forward;
|
||||
bool ip_masquerade;
|
||||
|
@ -198,6 +198,7 @@ SamplePoint=
|
||||
BitRate=
|
||||
RestartSec=
|
||||
TripleSampling=
|
||||
Termination=
|
||||
[Address]
|
||||
DuplicateAddressDetection=
|
||||
AutoJoin=
|
||||
|
Loading…
x
Reference in New Issue
Block a user