public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
* [PATCH] iplink_can: add support to set one-shot mode
@ 2009-12-23 12:02 Marc Kleine-Budde
       [not found] ` <1261569778-23669-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Kleine-Budde @ 2009-12-23 12:02 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
	shemminger-ZtmgI6mnKB3QT0dZR+AlfA, Marc Kleine-Budde,
	Wolfgang Grandegger

This patch adds the flag CAN_CTRLMODE_ONE_SHOT. It is used as mask
or flag in the "struct can_ctrlmode".

It also adds to "ip" the option to set a CAN controller into the special
"one-shot" mode. In this mode, if supported by the CAN controller,
tries only once to deliver a CAN frame and aborts it if an error
(e.g.: arbitration lost) happens.

Signed-off-by: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public•gmane.org>
Acked-by: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public•gmane.org>
---
 include/linux/can/netlink.h |    1 +
 ip/iplink_can.c             |    6 ++++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/linux/can/netlink.h b/include/linux/can/netlink.h
index 9ecbb78..c818335 100644
--- a/include/linux/can/netlink.h
+++ b/include/linux/can/netlink.h
@@ -80,6 +80,7 @@ struct can_ctrlmode {
 #define CAN_CTRLMODE_LOOPBACK	0x1	/* Loopback mode */
 #define CAN_CTRLMODE_LISTENONLY	0x2 	/* Listen-only mode */
 #define CAN_CTRLMODE_3_SAMPLES	0x4	/* Triple sampling mode */
+#define CAN_CTRLMODE_ONE_SHOT	0x8	/* One-Shot mode */
 
 /*
  * CAN device statistics
diff --git a/ip/iplink_can.c b/ip/iplink_can.c
index 50221e1..5d0d82c 100644
--- a/ip/iplink_can.c
+++ b/ip/iplink_can.c
@@ -30,6 +30,7 @@ static void usage(void)
 	        "\t[ loopback { on | off } ]\n"
 	        "\t[ listen-only { on | off } ]\n"
 	        "\t[ triple-sampling { on | off } ]\n"
+	        "\t[ one-shot { on | off } ]\n"
 		"\n"
 	        "\t[ restart-ms TIME-MS ]\n"
 	        "\t[ restart ]\n"
@@ -84,6 +85,7 @@ static void print_ctrlmode(FILE *f, __u32 cm)
 	_PF(CAN_CTRLMODE_LOOPBACK, "LOOPBACK");
 	_PF(CAN_CTRLMODE_LISTENONLY, "LISTEN-ONLY");
 	_PF(CAN_CTRLMODE_3_SAMPLES, "TRIPLE-SAMPLING");
+	_PF(CAN_CTRLMODE_ONE_SHOT, "ONE-SHOT");
 #undef _PF
 	if (cm)
 		fprintf(f, "%x", cm);
@@ -142,6 +144,10 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
 			NEXT_ARG();
 			set_ctrlmode("triple-sampling", *argv, &cm,
 				     CAN_CTRLMODE_3_SAMPLES);
+		} else if (matches(*argv, "one-shot") == 0) {
+			NEXT_ARG();
+			set_ctrlmode("one-shot", *argv, &cm,
+				     CAN_CTRLMODE_ONE_SHOT);
 		} else if (matches(*argv, "restart") == 0) {
 			__u32 val = 1;
 
-- 
1.6.5.7

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iplink_can: add support to set one-shot mode
       [not found] ` <1261569778-23669-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2010-01-12 21:17   ` Wolfgang Grandegger
       [not found]     ` <4B4CE6D0.1030803-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Grandegger @ 2010-01-12 21:17 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
	netdev-u79uwXL29TY76Z2rM5mHXA, shemminger-ZtmgI6mnKB3QT0dZR+AlfA

Marc Kleine-Budde wrote:
> This patch adds the flag CAN_CTRLMODE_ONE_SHOT. It is used as mask
> or flag in the "struct can_ctrlmode".
> 
> It also adds to "ip" the option to set a CAN controller into the special
> "one-shot" mode. In this mode, if supported by the CAN controller,
> tries only once to deliver a CAN frame and aborts it if an error
> (e.g.: arbitration lost) happens.
> 
> Signed-off-by: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public•gmane.org>
> Acked-by: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public•gmane.org>

Could this patch be considered for iproute2 inclusion? The corresponding
kernel patch has been accepted in the meantime.

Thanks,

Wolfgang.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iplink_can: add support to set one-shot mode
       [not found]     ` <4B4CE6D0.1030803-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
@ 2010-01-31 12:22       ` Oliver Hartkopp
  0 siblings, 0 replies; 3+ messages in thread
From: Oliver Hartkopp @ 2010-01-31 12:22 UTC (permalink / raw)
  To: shemminger-ZtmgI6mnKB3QT0dZR+AlfA
  Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
	netdev-u79uwXL29TY76Z2rM5mHXA, Marc Kleine-Budde,
	Wolfgang Grandegger

Wolfgang Grandegger wrote:
> Marc Kleine-Budde wrote:
>> This patch adds the flag CAN_CTRLMODE_ONE_SHOT. It is used as mask
>> or flag in the "struct can_ctrlmode".
>>
>> It also adds to "ip" the option to set a CAN controller into the special
>> "one-shot" mode. In this mode, if supported by the CAN controller,
>> tries only once to deliver a CAN frame and aborts it if an error
>> (e.g.: arbitration lost) happens.
>>
>> Signed-off-by: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public•gmane.org>
>> Acked-by: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public•gmane.org>
> 
> Could this patch be considered for iproute2 inclusion? The corresponding
> kernel patch has been accepted in the meantime.
> 
> Thanks,
> 
> Wolfgang.

Hello Stephen,

this patch sits in patchwork with the state "Changes Requested"

http://patchwork.ozlabs.org/patch/41660/

which is obviously wrong.

It would by nice if this change could get into iproute2 until 2.6.33 hits the
ground.

Thanks,
Oliver

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-01-31 12:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-23 12:02 [PATCH] iplink_can: add support to set one-shot mode Marc Kleine-Budde
     [not found] ` <1261569778-23669-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-01-12 21:17   ` Wolfgang Grandegger
     [not found]     ` <4B4CE6D0.1030803-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2010-01-31 12:22       ` Oliver Hartkopp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox