Commit Graph

51 Commits (71b2aec834e74d57c643e7a6776f21a1448ef17a)

Author SHA1 Message Date
Marc Kleine-Budde 7093a73185 canfdtest: compare_frame: add 0x prefix to indicate hex value 2024-12-11 10:24:33 +01:00
Oliver Hartkopp 8d7d7650d4
can-utils: fix sign-compare warnings (#513)
Fixing several build issues reported by Gary Bisson when he was building
can-utils with clang (AOSP14).

URL: https://github.com/linux-can/can-utils/pull/512
Reported-by: Gary Bisson (https://github.com/gibsson)

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-04-24 20:02:02 +02:00
Marc Kleine-Budde 18f710efb9 canfdtest: with -vvv verbosity also print the MSG_DONTROUTE and MSG_CONFIRM flags 2024-01-17 10:13:32 +01:00
Marc Kleine-Budde fc2aad8704 canfdtest: add support for loopback testing 2024-01-17 09:31:40 +01:00
Marc Kleine-Budde 655b0633e5 canfdtest: fix detection of own frames
Use the correct flag MSG_CONFIRM to detect frames generated on this
socket.

Fixes: c35ed80b3d ("canfdtest: use struct msghdr::msg_flags to detect own frames")
2024-01-17 08:51:22 +01:00
Marc Kleine-Budde 046b9d3b8f canfdtest: use can0 per default 2024-01-14 15:16:16 +01:00
Marc Kleine-Budde 2b07d15264 canfdtest: normalize_canid(): introduce and make use of it 2024-01-14 14:51:27 +01:00
Marc Kleine-Budde c35ed80b3d canfdtest: use struct msghdr::msg_flags to detect own frames
...instead of relying on the can_id_ping.
2024-01-14 14:50:52 +01:00
Marc Kleine-Budde f110bf4cde canfdtest: can_echo_gen(): use modulo instead of if to handle wrap arounds 2023-12-24 13:44:13 +01:00
Marc Kleine-Budde 7bb00837d0 canfdtest: can_echo_gen(): introduce struct canfd_frame *tx_frame; 2023-12-24 13:44:13 +01:00
Marc Kleine-Budde 874b0d9fae canfdtest: can_echo_gen(): decrease scope of struct canfd_frame rx_frame 2023-12-24 13:44:13 +01:00
Marc Kleine-Budde 104072f038 canfdtest: make use of bool 2023-12-24 13:44:13 +01:00
Marc Kleine-Budde 146fd949c9 canfdtest: don't initialize global variables to 0 2023-12-24 13:44:13 +01:00
Marc Kleine-Budde 0be95b5318 canfdtest: fix filter for extended CAN frames
Fixes: 8e66a0bae3 ("canfdtest: Add extended frame format support")
Cc: RICCIARDI-Adrien <adrien.ricciardi@hotmail.fr>
2023-12-24 13:44:13 +01:00
Marc Kleine-Budde 493c74815f canfdtest: convert towards kernel coding style 2023-12-11 09:37:09 +01:00
Yasushi SHOJI 7e35c7e1de canfdtest: Follow Bash exit status when signaled
Bash and many other shells use 128 + signum as the exit status when a
program get signal and exit.  Follow the common behavior so that we
know how the programs are killed.

canfdtest.c was effectively raising the received signal again to run
the default signal handler.  This has been declined by the maintainer
because it's over-engineering.  This commit replaces it with the
method proposed by the maintainer.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2023-03-20 10:23:01 +09:00
RICCIARDI-Adrien 8e66a0bae3 canfdtest: Add extended frame format support
Added the '-e' command line option to enable 29-bit CAN ID.

Signed-off-by: RICCIARDI-Adrien <adrien.ricciardi@hotmail.fr>
2022-09-09 11:01:43 +02:00
RICCIARDI-Adrien b8af5a6031 canfdtest: Add message length support
Added the '-s' command line option to set the frame payload length in bytes.

Signed-off-by: RICCIARDI-Adrien <adrien.ricciardi@hotmail.fr>
2022-06-27 23:49:02 +02:00
RICCIARDI-Adrien 6d3bf51e0a canfdtest: Add CAN FD Bit Rate Switch support
Added the '-b' command line option, to be used in conjunction with the '-d'
option that enables CAN FD, to set the BRS bit in a CAN FD frame. When
enabled, the data part of the CAN FD frame is transmitted at a higher speed.
All remaining parts of the CAN FD frame use the classic CAN speed.

Signed-off-by: RICCIARDI-Adrien <adrien.ricciardi@hotmail.fr>
2022-06-22 10:50:12 +02:00
RICCIARDI-Adrien d3bb67136f canfdtest: Add CAN FD support
Add the '-d' command line option that allow to transmit CAN FD frames instead
of CAN 2.0 frames. The frames content is the same.

This allows to stress test the flexible data rate part of a CAN FD network.

Signed-off-by: RICCIARDI-Adrien <adrien.ricciardi@hotmail.fr>
2022-06-20 18:13:18 +02:00
Philippe Schenker 26842295b8 canfdtest: make use of return value of check_frame
check_frame has a return value. Make use of this in can_echo_dut which
then is evaluated and returned thereof in main()

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
2022-04-12 17:18:22 +02:00
Philippe Schenker 24de626f33 canfdtest: return -1 if compare_frame fails
Do report errors from function compare_frame also on the exit-code.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
2022-04-12 17:10:58 +02:00
Jean Gressmann 2dde06801a canfdtest: adds support for custom CAN IDs
This change enables the use of this app alongside the traffic
typically found on a CAN bus.
2021-10-25 11:20:58 +02:00
Marc Kleine-Budde fd6829eb4f canfdtest: main(): sort switch/case in cmd line parser alphabetically
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-05-04 12:00:39 +02:00
Marc Kleine-Budde 4b94546cf9 canfdtest: print_usage(): sort options alphabetically
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-05-04 11:58:25 +02:00
Rosen Penev b153fe3f35
clang-tidy: sort includes alphabetically
Found with llvm-include-order

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-12 23:28:58 -07:00
Rosen Penev 17a5fe6022
clang-tidy: do not use else after return
Found with readability-else-after-return

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-12 23:28:22 -07:00
Marc Kleine-Budde ce7f22928d canfdtest: bail out if trying to use non-existing CAN interface
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-09-29 09:06:12 +02:00
Marc Kleine-Budde 435a59a394 canfdtest: can_echo_gen(): print RX'ed frame in case of RX before TX
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-09-24 11:13:41 +02:00
Marc Kleine-Budde 73e421557f canfdtest: remove trailing whitespace
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-09-24 11:13:38 +02:00
Marc Kleine-Budde c43a168c68 canfdtest: fix frame consistency check
This patch fixes the issue reported in:

d7f28a0ffe
https://github.com/linux-can/can-utils/issues/236

Reported-by: https://github.com/ronitnvidia
Fixes: d7f28a0ffe ("canfdtest: can_echo_dut(): check received frame for consistency")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-08-20 09:30:27 +02:00
Marc Kleine-Budde 13ecaa6d7e canfdtest: make number of frames in flight a command line option
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 11:59:35 +02:00
Marc Kleine-Budde d7f28a0ffe canfdtest: can_echo_dut(): check received frame for consistency
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 11:38:48 +02:00
Marc Kleine-Budde e393697112 canfdtest: can_echo_dut(): move functionality to increment frame data into separate function
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 11:38:48 +02:00
Marc Kleine-Budde 645cd1b1ba canfdtest: can_echo_dut(): make use of print_frame() instead of open coding it
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 11:38:48 +02:00
Marc Kleine-Budde aa5386f1cb canfdtest: print_frame(): add missing cast to uint8_t to avoid overruns
While there, use cast in compare_frame(), too.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 11:38:48 +02:00
Marc Kleine-Budde ff3d0e0d05 canfdtest: print_frame()/print_compare(): mark parameters "struct can_frame *" as const
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 11:38:17 +02:00
Marc Kleine-Budde 29605e3314 canfdtest: compare_frame(): remove stray space in front of "!"
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 11:26:03 +02:00
Marc Kleine-Budde d92adf68e8 canfdtest: main(): remove double ";"
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 11:25:21 +02:00
Marc Kleine-Budde 063e361cc5
Merge pull request #194 from marckleinebudde/canfdtest-initialize-tx_frames
canfdtest: can_echo_gen(): initialize tx_frames with zero
2020-06-17 12:53:32 +02:00
Alexander Gerasiov c56259ab33 canfdtest.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0005-canfdtest.c-Reformat-help-usage-output-to-be-compati.patch
2020-04-27 08:20:08 +03:00
Marc Kleine-Budde 506f6f3043 canfdtest: can_echo_gen(): initialize tx_frames with zero
This avoids having the padding in the struct can_fame contain bogus
values, which are interpreted by "candump -x" as CAN-FD BRS and ESI
values.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-02-03 23:58:34 +01:00
Yegor Yefremov 59f92965b9 Relicense GPL-2.0-or-later files to GPL-2.0-only
This way all licenses in the project will be homogenised.

Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Acked-by: Sven Schmitt <sven.schmitt@gmx.net>
Acked-by: Oleksij Rempel <ore@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Brennan Ashton <bashton@brennanashton.com>
Acked-By: IOhannes m zmölnig <zmoelnig@iem.at>
Acked-by: Frank Theile <ftheile@grundfos.com>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Acked-by: Jeremiah Mahler <jmmahler@gmail.com>
Acked-by: Jonathan Challinger <mr.challinger@gmail.com>
Acked-by: Cheng-Lung Lee <chenglung@gmail.com>
Acked-by: Ramesh Shanmugasundaram <rashanmu@gmail.com>
Acked-by: Mans Rullgard <mans@mansr.com>
Acked-by: Søren Holm <sgh@sgh.dk>
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-07-10 14:01:23 +02:00
Yegor Yefremov 7b7331976a Add SPDX identifiers
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-06-19 12:24:24 +02:00
Oleksij Rempel ba603c59ae canfdtest: test if TX and RX msg are properly ordered
In some cases we can get local TX echo after remote response
for same TXed message was already received.

For applications which relay on proper order of TXed and RXed
message this will be fatal.

With this patch the package generating side will test if TX and RX are
properly ordered.
Currently with following commands, this issue can be easily
reproducible:
canfdtest -g can0 &
while(true); do chrt 40 dd if=/dev/zero of=/dev/null count=10000; done

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
2018-09-18 11:57:33 +02:00
Oleksij Rempel 18834410ac canfdtest: don't remap SIG to 0
Scripts can be configured to handle different SIGnals and
return codes in different ways. In this case it is better
to forward received signal, instead of converting it to return 0.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
2018-09-18 11:57:33 +02:00
Ramesh Shanmugasundaram cf1b2a177f canfdtest: remove usage of gettimeofday
This patch fixes this bug
https://github.com/linux-can/can-utils/issues/13

Modified the existing millisleep function to use clock_nanosleep with
MONOTONIC clock and relative timeout.

Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
2016-11-21 13:55:27 +00:00
Stephane Grosjean 4d0e6d5169 canfdtest: fix typo while waiting for tv_stop time
After a few complaint about 100% CPU usage of canfdtest over our PCI
-like boards, I have had a look to the source file, and think I have
found the issue in can_echo_dut().

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2016-11-21 11:37:01 +01:00
Sven Schmitt f5fb7317aa treewide: use if_nametoindex to avoid overflows
replaced strcpy(if_name, argv[x]) + ioctl by if_idx = if_nametoindex(argv[x])
to avoid overflows caused by long user input.

Signed-off-by: Sven Schmitt <sven.schmitt@gmx.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2015-06-30 21:00:04 +02:00
Marc Kleine-Budde 722a09116d treewide: replace berlios contact email by linux-can@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2012-01-11 12:14:15 +01:00