mirror of
https://github.com/systemd/systemd.git
synced 2025-03-19 22:50:17 +03:00
Merge pull request #18169 from OnkelUlla/can_bus_error_reporting
network: can: add support for bus error reporting
This commit is contained in:
commit
66bf4617b1
@ -2750,6 +2750,16 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
|
||||
the value of a received bit by majority rule. When unset, the kernel's default will be used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>BusErrorReporting=</varname></term>
|
||||
<listitem>
|
||||
<para>Takes a boolean. When <literal>yes</literal>, reporting of CAN bus errors is activated
|
||||
(those include single bit, frame format, and bit stuffing errors, unable to send dominant bit,
|
||||
unable to send recessive bit, bus overload, active error announcement, error occurred on
|
||||
transmission). When unset, the kernel's default will be used. Note: in case of a CAN bus with a
|
||||
single CAN device, sending a CAN frame may result in a huge number of CAN bus errors.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>ListenOnly=</varname></term>
|
||||
<listitem>
|
||||
|
@ -174,14 +174,14 @@ static int link_set_can(Link *link) {
|
||||
|
||||
if (link->network->can_fd_mode >= 0) {
|
||||
cm.mask |= CAN_CTRLMODE_FD;
|
||||
SET_FLAG(cm.flags, CAN_CTRLMODE_FD, link->network->can_fd_mode > 0);
|
||||
log_link_debug(link, "%sabling FD mode", link->network->can_fd_mode > 0 ? "En" : "Dis");
|
||||
SET_FLAG(cm.flags, CAN_CTRLMODE_FD, link->network->can_fd_mode);
|
||||
log_link_debug(link, "Setting FD mode to '%s'.", yes_no(link->network->can_fd_mode));
|
||||
}
|
||||
|
||||
if (link->network->can_non_iso >= 0) {
|
||||
cm.mask |= CAN_CTRLMODE_FD_NON_ISO;
|
||||
SET_FLAG(cm.flags, CAN_CTRLMODE_FD_NON_ISO, link->network->can_non_iso > 0);
|
||||
log_link_debug(link, "%sabling FD non-ISO mode", link->network->can_non_iso > 0 ? "En" : "Dis");
|
||||
SET_FLAG(cm.flags, CAN_CTRLMODE_FD_NON_ISO, link->network->can_non_iso);
|
||||
log_link_debug(link, "Setting FD non-ISO mode to '%s'.", yes_no(link->network->can_non_iso));
|
||||
}
|
||||
|
||||
if (link->network->can_restart_us > 0) {
|
||||
@ -208,13 +208,19 @@ static int link_set_can(Link *link) {
|
||||
if (link->network->can_triple_sampling >= 0) {
|
||||
cm.mask |= CAN_CTRLMODE_3_SAMPLES;
|
||||
SET_FLAG(cm.flags, CAN_CTRLMODE_3_SAMPLES, link->network->can_triple_sampling);
|
||||
log_link_debug(link, "%sabling triple-sampling", link->network->can_triple_sampling ? "En" : "Dis");
|
||||
log_link_debug(link, "Setting triple-sampling to '%s'.", yes_no(link->network->can_triple_sampling));
|
||||
}
|
||||
|
||||
if (link->network->can_berr_reporting >= 0) {
|
||||
cm.mask |= CAN_CTRLMODE_BERR_REPORTING;
|
||||
SET_FLAG(cm.flags, CAN_CTRLMODE_BERR_REPORTING, link->network->can_berr_reporting);
|
||||
log_link_debug(link, "Setting bus error reporting to '%s'.", yes_no(link->network->can_berr_reporting));
|
||||
}
|
||||
|
||||
if (link->network->can_listen_only >= 0) {
|
||||
cm.mask |= CAN_CTRLMODE_LISTENONLY;
|
||||
SET_FLAG(cm.flags, CAN_CTRLMODE_LISTENONLY, link->network->can_listen_only);
|
||||
log_link_debug(link, "%sabling listen-only mode", link->network->can_listen_only ? "En" : "Dis");
|
||||
log_link_debug(link, "Setting listen-only mode to '%s'.", yes_no(link->network->can_listen_only));
|
||||
}
|
||||
|
||||
if (cm.mask != 0) {
|
||||
@ -225,7 +231,7 @@ static int link_set_can(Link *link) {
|
||||
|
||||
if (link->network->can_termination >= 0) {
|
||||
|
||||
log_link_debug(link, "%sabling can-termination", link->network->can_termination ? "En" : "Dis");
|
||||
log_link_debug(link, "Setting can-termination to '%s'.", yes_no(link->network->can_termination));
|
||||
|
||||
r = sd_netlink_message_append_u16(m, IFLA_CAN_TERMINATION,
|
||||
link->network->can_termination ? CAN_TERMINATION_OHM_VALUE : 0);
|
||||
|
@ -321,6 +321,7 @@ CAN.FDMode, config_parse_tristate,
|
||||
CAN.FDNonISO, config_parse_tristate, 0, offsetof(Network, can_non_iso)
|
||||
CAN.RestartSec, config_parse_sec, 0, offsetof(Network, can_restart_us)
|
||||
CAN.TripleSampling, config_parse_tristate, 0, offsetof(Network, can_triple_sampling)
|
||||
CAN.BusErrorReporting, config_parse_tristate, 0, offsetof(Network, can_berr_reporting)
|
||||
CAN.Termination, config_parse_tristate, 0, offsetof(Network, can_termination)
|
||||
CAN.ListenOnly, config_parse_tristate, 0, offsetof(Network, can_listen_only)
|
||||
QDisc.Parent, config_parse_qdisc_parent, _QDISC_KIND_INVALID, 0
|
||||
|
@ -415,6 +415,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
|
||||
.ipv6_accept_ra_start_dhcp6_client = IPV6_ACCEPT_RA_START_DHCP6_CLIENT_YES,
|
||||
|
||||
.can_triple_sampling = -1,
|
||||
.can_berr_reporting = -1,
|
||||
.can_termination = -1,
|
||||
.can_listen_only = -1,
|
||||
.can_fd_mode = -1,
|
||||
|
@ -231,6 +231,7 @@ struct Network {
|
||||
unsigned can_data_sample_point;
|
||||
usec_t can_restart_us;
|
||||
int can_triple_sampling;
|
||||
int can_berr_reporting;
|
||||
int can_termination;
|
||||
int can_listen_only;
|
||||
int can_fd_mode;
|
||||
|
@ -247,6 +247,7 @@ FDMode=
|
||||
FDNonISO=
|
||||
RestartSec=
|
||||
TripleSampling=
|
||||
BusErrorReporting=
|
||||
Termination=
|
||||
ListenOnly=
|
||||
[Address]
|
||||
|
Loading…
x
Reference in New Issue
Block a user