Patchwork iplink_can: add support to set one-shot mode

login
register
mail settings
Submitter Marc Kleine-Budde
Date Dec. 23, 2009, 12:02 p.m.
Message ID <1261569778-23669-1-git-send-email-mkl@pengutronix.de>
Download mbox | patch
Permalink /patch/41660/
State Changes Requested
Delegated to: stephen hemminger
Headers show

Comments

Marc Kleine-Budde - Dec. 23, 2009, 12:02 p.m.
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@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
---
 include/linux/can/netlink.h |    1 +
 ip/iplink_can.c             |    6 ++++++
 2 files changed, 7 insertions(+), 0 deletions(-)
Wolfgang Grandegger - Jan. 12, 2010, 9:17 p.m.
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@pengutronix.de>
> Acked-by: Wolfgang Grandegger <wg@grandegger.com>

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

Thanks,

Wolfgang.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Oliver Hartkopp - Jan. 31, 2010, 12:22 p.m.
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@pengutronix.de>
>> Acked-by: Wolfgang Grandegger <wg@grandegger.com>
> 
> 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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

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;