mirror of
https://github.com/systemd/systemd.git
synced 2025-03-28 02:50:16 +03:00
parent
6cfef1b308
commit
74f0fb9095
@ -2317,6 +2317,16 @@
|
||||
the value of a received bit by majority rule. When unset, the kernel's default will be used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>ListenOnly=</varname></term>
|
||||
<listitem>
|
||||
<para>Takes a boolean. When <literal>yes</literal>, listen-only mode is enabled. When the
|
||||
interface is in listen-only mode, the interface neither transmit CAN frames nor send ACK
|
||||
bit. Listen-only mode is important to debug CAN networks without interfering with the
|
||||
communication or acknowledge the CAN frame. When unset, the kernel's default will be used.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
|
@ -71,6 +71,7 @@ static int link_set_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link)
|
||||
|
||||
static int link_set_can(Link *link) {
|
||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL;
|
||||
struct can_ctrlmode cm = {};
|
||||
int r;
|
||||
|
||||
assert(link);
|
||||
@ -142,13 +143,18 @@ static int link_set_can(Link *link) {
|
||||
}
|
||||
|
||||
if (link->network->can_triple_sampling >= 0) {
|
||||
struct can_ctrlmode cm = {
|
||||
.mask = CAN_CTRLMODE_3_SAMPLES,
|
||||
.flags = link->network->can_triple_sampling ? CAN_CTRLMODE_3_SAMPLES : 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");
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
if (cm.mask != 0) {
|
||||
r = sd_netlink_message_append_data(m, IFLA_CAN_CTRLMODE, &cm, sizeof(cm));
|
||||
if (r < 0)
|
||||
return log_link_error_errno(link, r, "Could not append IFLA_CAN_CTRLMODE attribute: %m");
|
||||
|
@ -256,6 +256,7 @@ CAN.SamplePoint, config_parse_permille,
|
||||
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)
|
||||
CAN.ListenOnly, config_parse_tristate, 0, offsetof(Network, can_listen_only)
|
||||
QDisc.Parent, config_parse_qdisc_parent, _QDISC_KIND_INVALID, 0
|
||||
QDisc.Handle, config_parse_qdisc_handle, _QDISC_KIND_INVALID, 0
|
||||
BFIFO.Parent, config_parse_qdisc_parent, QDISC_KIND_BFIFO, 0
|
||||
|
@ -200,6 +200,7 @@ struct Network {
|
||||
usec_t can_restart_us;
|
||||
int can_triple_sampling;
|
||||
int can_termination;
|
||||
int can_listen_only;
|
||||
|
||||
AddressFamily ip_forward;
|
||||
bool ip_masquerade;
|
||||
|
@ -201,6 +201,7 @@ BitRate=
|
||||
RestartSec=
|
||||
TripleSampling=
|
||||
Termination=
|
||||
ListenOnly=
|
||||
[Address]
|
||||
DuplicateAddressDetection=
|
||||
AutoJoin=
|
||||
|
Loading…
x
Reference in New Issue
Block a user