public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2-next v1 0/6] iplink_can: preparation before introduction of CAN XL
@ 2024-11-12 17:27 Vincent Mailhol
  2024-11-12 17:27 ` [PATCH iproute2-next v1 1/6] iplink_can: remove unused FILE *f parameter in three functions Vincent Mailhol
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Vincent Mailhol @ 2024-11-12 17:27 UTC (permalink / raw)
  To: netdev, Stephen Hemminger, David Ahern, linux-can,
	Marc Kleine-Budde, Oliver Hartkopp
  Cc: Robert Nawrath, linux-kernel, Vincent Mailhol

An RFC was sent last weekend to kick-off the discussion of the
introduction of CAN XL: [1] for the kernel side and [2] for the
iproute2 interface. While the series received some positive feedback,
it is far from completion. Some work is still needed to:

  - adjust the nesting of the IFLA_CAN_XL_DATA_BITTIMING_CONST in the
    netlink interface

  - add the CAN XL PWM configuration

and this TODO list may grow if more feedback is received.

Regardless of this, the RFC started with a set of trivial patches to
do some clean-up and some renaming in preparation of the introduction
of CAN XL.

This series just contains those preparation patches which were cherry
picked from the RFC.

The goal is to have those merged first to remove some overhead from
the netlink CAN XL main series before tacking care of the other
comments.

[1] [RFC] can: netlink: add CAN XL
Link: https://lore.kernel.org/linux-can/20241110155902.72807-16-mailhol.vincent@wanadoo.fr/

[2] [RFC] iplink_can: add CAN XL
Link: https://lore.kernel.org/linux-can/20241110160406.73584-10-mailhol.vincent@wanadoo.fr/

Vincent Mailhol (6):
  iplink_can: remove unused FILE *f parameter in three functions
  iplink_can: reduce the visibility of tdc in can_parse_opt()
  iplink_can: remove newline at the end of invarg()'s messages
  iplink_can: use invarg() instead of fprintf()
  iplink_can: add struct can_tdc
  iplink_can: rename dbt into fd_dbt in can_parse_opt()

 ip/iplink_can.c | 107 +++++++++++++++++++++++++-----------------------
 1 file changed, 56 insertions(+), 51 deletions(-)

-- 
2.45.2


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

* [PATCH iproute2-next v1 1/6] iplink_can: remove unused FILE *f parameter in three functions
  2024-11-12 17:27 [PATCH iproute2-next v1 0/6] iplink_can: preparation before introduction of CAN XL Vincent Mailhol
@ 2024-11-12 17:27 ` Vincent Mailhol
  2024-11-12 17:27 ` [PATCH iproute2-next v1 2/6] iplink_can: reduce the visibility of tdc in can_parse_opt() Vincent Mailhol
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Vincent Mailhol @ 2024-11-12 17:27 UTC (permalink / raw)
  To: netdev, Stephen Hemminger, David Ahern, linux-can,
	Marc Kleine-Budde, Oliver Hartkopp
  Cc: Robert Nawrath, linux-kernel, Vincent Mailhol

FILE *f, the first parameter of below functions:

 * can_print_tdc_opt()
 * can_print_tdc_const_opt()
 * void can_print_ctrlmode_ext()

is unused. Remove it.

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
 ip/iplink_can.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/ip/iplink_can.c b/ip/iplink_can.c
index f2967db5..01d977fa 100644
--- a/ip/iplink_can.c
+++ b/ip/iplink_can.c
@@ -337,7 +337,7 @@ can_print_timing_min_max(const char *json_attr, const char *fp_attr,
 	close_json_object();
 }
 
-static void can_print_tdc_opt(FILE *f, struct rtattr *tdc_attr)
+static void can_print_tdc_opt(struct rtattr *tdc_attr)
 {
 	struct rtattr *tb[IFLA_CAN_TDC_MAX + 1];
 
@@ -365,7 +365,7 @@ static void can_print_tdc_opt(FILE *f, struct rtattr *tdc_attr)
 	}
 }
 
-static void can_print_tdc_const_opt(FILE *f, struct rtattr *tdc_attr)
+static void can_print_tdc_const_opt(struct rtattr *tdc_attr)
 {
 	struct rtattr *tb[IFLA_CAN_TDC_MAX + 1];
 
@@ -393,7 +393,7 @@ static void can_print_tdc_const_opt(FILE *f, struct rtattr *tdc_attr)
 	close_json_object();
 }
 
-static void can_print_ctrlmode_ext(FILE *f, struct rtattr *ctrlmode_ext_attr,
+static void can_print_ctrlmode_ext(struct rtattr *ctrlmode_ext_attr,
 				   __u32 cm_flags)
 {
 	struct rtattr *tb[IFLA_CAN_CTRLMODE_MAX + 1];
@@ -417,7 +417,7 @@ static void can_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 
 		print_ctrlmode(PRINT_ANY, cm->flags, "ctrlmode");
 		if (tb[IFLA_CAN_CTRLMODE_EXT])
-			can_print_ctrlmode_ext(f, tb[IFLA_CAN_CTRLMODE_EXT],
+			can_print_ctrlmode_ext(tb[IFLA_CAN_CTRLMODE_EXT],
 					       cm->flags);
 	}
 
@@ -542,7 +542,7 @@ static void can_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 		print_uint(PRINT_ANY, "brp", " dbrp %u", dbt->brp);
 
 		if (tb[IFLA_CAN_TDC])
-			can_print_tdc_opt(f, tb[IFLA_CAN_TDC]);
+			can_print_tdc_opt(tb[IFLA_CAN_TDC]);
 
 		close_json_object();
 	}
@@ -566,7 +566,7 @@ static void can_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 		print_uint(PRINT_ANY, "brp_inc", " dbrp_inc %u", dbtc->brp_inc);
 
 		if (tb[IFLA_CAN_TDC])
-			can_print_tdc_const_opt(f, tb[IFLA_CAN_TDC]);
+			can_print_tdc_const_opt(tb[IFLA_CAN_TDC]);
 
 		close_json_object();
 	}
-- 
2.45.2


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

* [PATCH iproute2-next v1 2/6] iplink_can: reduce the visibility of tdc in can_parse_opt()
  2024-11-12 17:27 [PATCH iproute2-next v1 0/6] iplink_can: preparation before introduction of CAN XL Vincent Mailhol
  2024-11-12 17:27 ` [PATCH iproute2-next v1 1/6] iplink_can: remove unused FILE *f parameter in three functions Vincent Mailhol
@ 2024-11-12 17:27 ` Vincent Mailhol
  2024-11-12 17:27 ` [PATCH iproute2-next v1 3/6] iplink_can: remove newline at the end of invarg()'s messages Vincent Mailhol
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Vincent Mailhol @ 2024-11-12 17:27 UTC (permalink / raw)
  To: netdev, Stephen Hemminger, David Ahern, linux-can,
	Marc Kleine-Budde, Oliver Hartkopp
  Cc: Robert Nawrath, linux-kernel, Vincent Mailhol

tdc is only used in a single if block. Move its declaration to the top
of the compound statement where it is used.

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
 ip/iplink_can.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ip/iplink_can.c b/ip/iplink_can.c
index 01d977fa..3414d6c3 100644
--- a/ip/iplink_can.c
+++ b/ip/iplink_can.c
@@ -128,7 +128,6 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
 {
 	struct can_bittiming bt = {}, dbt = {};
 	struct can_ctrlmode cm = { 0 };
-	struct rtattr *tdc;
 	__u32 tdcv = -1, tdco = -1, tdcf = -1;
 
 	while (argc > 0) {
@@ -298,7 +297,9 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
 		addattr_l(n, 1024, IFLA_CAN_CTRLMODE, &cm, sizeof(cm));
 
 	if (tdcv != -1 || tdco != -1 || tdcf != -1) {
-		tdc = addattr_nest(n, 1024, IFLA_CAN_TDC | NLA_F_NESTED);
+		struct rtattr *tdc = addattr_nest(n, 1024,
+						  IFLA_CAN_TDC | NLA_F_NESTED);
+
 		if (tdcv != -1)
 			addattr32(n, 1024, IFLA_CAN_TDC_TDCV, tdcv);
 		if (tdco != -1)
-- 
2.45.2


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

* [PATCH iproute2-next v1 3/6] iplink_can: remove newline at the end of invarg()'s messages
  2024-11-12 17:27 [PATCH iproute2-next v1 0/6] iplink_can: preparation before introduction of CAN XL Vincent Mailhol
  2024-11-12 17:27 ` [PATCH iproute2-next v1 1/6] iplink_can: remove unused FILE *f parameter in three functions Vincent Mailhol
  2024-11-12 17:27 ` [PATCH iproute2-next v1 2/6] iplink_can: reduce the visibility of tdc in can_parse_opt() Vincent Mailhol
@ 2024-11-12 17:27 ` Vincent Mailhol
  2024-11-12 17:27 ` [PATCH iproute2-next v1 4/6] iplink_can: use invarg() instead of fprintf() Vincent Mailhol
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Vincent Mailhol @ 2024-11-12 17:27 UTC (permalink / raw)
  To: netdev, Stephen Hemminger, David Ahern, linux-can,
	Marc Kleine-Budde, Oliver Hartkopp
  Cc: Robert Nawrath, linux-kernel, Vincent Mailhol

invarg() already prints a new line by default. Adding an explicit "\n"
at the end of the message results in two lines being printed. Remove
all newlines at the end of the invarg() messages.

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
 ip/iplink_can.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/ip/iplink_can.c b/ip/iplink_can.c
index 3414d6c3..6c6fcf61 100644
--- a/ip/iplink_can.c
+++ b/ip/iplink_can.c
@@ -134,78 +134,78 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
 		if (matches(*argv, "bitrate") == 0) {
 			NEXT_ARG();
 			if (get_u32(&bt.bitrate, *argv, 0))
-				invarg("invalid \"bitrate\" value\n", *argv);
+				invarg("invalid \"bitrate\" value", *argv);
 		} else if (matches(*argv, "sample-point") == 0) {
 			float sp;
 
 			NEXT_ARG();
 			if (get_float(&sp, *argv))
-				invarg("invalid \"sample-point\" value\n",
+				invarg("invalid \"sample-point\" value",
 				       *argv);
 			bt.sample_point = (__u32)(sp * 1000);
 		} else if (matches(*argv, "tq") == 0) {
 			NEXT_ARG();
 			if (get_u32(&bt.tq, *argv, 0))
-				invarg("invalid \"tq\" value\n", *argv);
+				invarg("invalid \"tq\" value", *argv);
 		} else if (matches(*argv, "prop-seg") == 0) {
 			NEXT_ARG();
 			if (get_u32(&bt.prop_seg, *argv, 0))
-				invarg("invalid \"prop-seg\" value\n", *argv);
+				invarg("invalid \"prop-seg\" value", *argv);
 		} else if (matches(*argv, "phase-seg1") == 0) {
 			NEXT_ARG();
 			if (get_u32(&bt.phase_seg1, *argv, 0))
-				invarg("invalid \"phase-seg1\" value\n", *argv);
+				invarg("invalid \"phase-seg1\" value", *argv);
 		} else if (matches(*argv, "phase-seg2") == 0) {
 			NEXT_ARG();
 			if (get_u32(&bt.phase_seg2, *argv, 0))
-				invarg("invalid \"phase-seg2\" value\n", *argv);
+				invarg("invalid \"phase-seg2\" value", *argv);
 		} else if (matches(*argv, "sjw") == 0) {
 			NEXT_ARG();
 			if (get_u32(&bt.sjw, *argv, 0))
-				invarg("invalid \"sjw\" value\n", *argv);
+				invarg("invalid \"sjw\" value", *argv);
 		} else if (matches(*argv, "dbitrate") == 0) {
 			NEXT_ARG();
 			if (get_u32(&dbt.bitrate, *argv, 0))
-				invarg("invalid \"dbitrate\" value\n", *argv);
+				invarg("invalid \"dbitrate\" value", *argv);
 		} else if (matches(*argv, "dsample-point") == 0) {
 			float sp;
 
 			NEXT_ARG();
 			if (get_float(&sp, *argv))
-				invarg("invalid \"dsample-point\" value\n", *argv);
+				invarg("invalid \"dsample-point\" value", *argv);
 			dbt.sample_point = (__u32)(sp * 1000);
 		} else if (matches(*argv, "dtq") == 0) {
 			NEXT_ARG();
 			if (get_u32(&dbt.tq, *argv, 0))
-				invarg("invalid \"dtq\" value\n", *argv);
+				invarg("invalid \"dtq\" value", *argv);
 		} else if (matches(*argv, "dprop-seg") == 0) {
 			NEXT_ARG();
 			if (get_u32(&dbt.prop_seg, *argv, 0))
-				invarg("invalid \"dprop-seg\" value\n", *argv);
+				invarg("invalid \"dprop-seg\" value", *argv);
 		} else if (matches(*argv, "dphase-seg1") == 0) {
 			NEXT_ARG();
 			if (get_u32(&dbt.phase_seg1, *argv, 0))
-				invarg("invalid \"dphase-seg1\" value\n", *argv);
+				invarg("invalid \"dphase-seg1\" value", *argv);
 		} else if (matches(*argv, "dphase-seg2") == 0) {
 			NEXT_ARG();
 			if (get_u32(&dbt.phase_seg2, *argv, 0))
-				invarg("invalid \"dphase-seg2\" value\n", *argv);
+				invarg("invalid \"dphase-seg2\" value", *argv);
 		} else if (matches(*argv, "dsjw") == 0) {
 			NEXT_ARG();
 			if (get_u32(&dbt.sjw, *argv, 0))
-				invarg("invalid \"dsjw\" value\n", *argv);
+				invarg("invalid \"dsjw\" value", *argv);
 		} else if (matches(*argv, "tdcv") == 0) {
 			NEXT_ARG();
 			if (get_u32(&tdcv, *argv, 0))
-				invarg("invalid \"tdcv\" value\n", *argv);
+				invarg("invalid \"tdcv\" value", *argv);
 		} else if (matches(*argv, "tdco") == 0) {
 			NEXT_ARG();
 			if (get_u32(&tdco, *argv, 0))
-				invarg("invalid \"tdco\" value\n", *argv);
+				invarg("invalid \"tdco\" value", *argv);
 		} else if (matches(*argv, "tdcf") == 0) {
 			NEXT_ARG();
 			if (get_u32(&tdcf, *argv, 0))
-				invarg("invalid \"tdcf\" value\n", *argv);
+				invarg("invalid \"tdcf\" value", *argv);
 		} else if (matches(*argv, "loopback") == 0) {
 			NEXT_ARG();
 			set_ctrlmode("loopback", *argv, &cm,
@@ -268,14 +268,14 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
 
 			NEXT_ARG();
 			if (get_u32(&val, *argv, 0))
-				invarg("invalid \"restart-ms\" value\n", *argv);
+				invarg("invalid \"restart-ms\" value", *argv);
 			addattr32(n, 1024, IFLA_CAN_RESTART_MS, val);
 		} else if (matches(*argv, "termination") == 0) {
 			__u16 val;
 
 			NEXT_ARG();
 			if (get_u16(&val, *argv, 0))
-				invarg("invalid \"termination\" value\n",
+				invarg("invalid \"termination\" value",
 				       *argv);
 			addattr16(n, 1024, IFLA_CAN_TERMINATION, val);
 		} else if (matches(*argv, "help") == 0) {
-- 
2.45.2


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

* [PATCH iproute2-next v1 4/6] iplink_can: use invarg() instead of fprintf()
  2024-11-12 17:27 [PATCH iproute2-next v1 0/6] iplink_can: preparation before introduction of CAN XL Vincent Mailhol
                   ` (2 preceding siblings ...)
  2024-11-12 17:27 ` [PATCH iproute2-next v1 3/6] iplink_can: remove newline at the end of invarg()'s messages Vincent Mailhol
@ 2024-11-12 17:27 ` Vincent Mailhol
  2024-11-12 17:27 ` [PATCH iproute2-next v1 5/6] iplink_can: add struct can_tdc Vincent Mailhol
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Vincent Mailhol @ 2024-11-12 17:27 UTC (permalink / raw)
  To: netdev, Stephen Hemminger, David Ahern, linux-can,
	Marc Kleine-Budde, Oliver Hartkopp
  Cc: Robert Nawrath, linux-kernel, Vincent Mailhol

invarg() is specifically designed to print error messages when an
invalid argument is provided. Replace the generic fprintf() by
invarg() in can_parse_opt().

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
 ip/iplink_can.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/ip/iplink_can.c b/ip/iplink_can.c
index 6c6fcf61..928d5d79 100644
--- a/ip/iplink_can.c
+++ b/ip/iplink_can.c
@@ -254,10 +254,8 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
 				cm.mask |= CAN_CTRLMODE_TDC_AUTO |
 					   CAN_CTRLMODE_TDC_MANUAL;
 			} else {
-				fprintf(stderr,
-					"Error: argument of \"tdc-mode\" must be \"auto\", \"manual\" or \"off\", not \"%s\"\n",
+				invarg("\"tdc-mode\" must be either of \"auto\", \"manual\" or \"off\"",
 					*argv);
-				exit (-1);
 			}
 		} else if (matches(*argv, "restart") == 0) {
 			__u32 val = 1;
-- 
2.45.2


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

* [PATCH iproute2-next v1 5/6] iplink_can: add struct can_tdc
  2024-11-12 17:27 [PATCH iproute2-next v1 0/6] iplink_can: preparation before introduction of CAN XL Vincent Mailhol
                   ` (3 preceding siblings ...)
  2024-11-12 17:27 ` [PATCH iproute2-next v1 4/6] iplink_can: use invarg() instead of fprintf() Vincent Mailhol
@ 2024-11-12 17:27 ` Vincent Mailhol
  2024-11-12 17:27 ` [PATCH iproute2-next v1 6/6] iplink_can: rename dbt into fd_dbt in can_parse_opt() Vincent Mailhol
  2024-11-18 17:00 ` [PATCH iproute2-next v1 0/6] iplink_can: preparation before introduction of CAN XL patchwork-bot+netdevbpf
  6 siblings, 0 replies; 8+ messages in thread
From: Vincent Mailhol @ 2024-11-12 17:27 UTC (permalink / raw)
  To: netdev, Stephen Hemminger, David Ahern, linux-can,
	Marc Kleine-Budde, Oliver Hartkopp
  Cc: Robert Nawrath, linux-kernel, Vincent Mailhol

Add the struct can_tdc to group the tdcv, tdco and tdvf variables
together. The structure is borrowed from linux/can/bittiming.h [1].

This refactor is a preparation for the introduction of CAN XL.

[1] https://elixir.bootlin.com/linux/v6.11/source/include/linux/can/bittiming.h#L78

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
 ip/iplink_can.c | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/ip/iplink_can.c b/ip/iplink_can.c
index 928d5d79..325a4007 100644
--- a/ip/iplink_can.c
+++ b/ip/iplink_can.c
@@ -15,6 +15,12 @@
 #include "utils.h"
 #include "ip_common.h"
 
+struct can_tdc {
+	__u32 tdcv;
+	__u32 tdco;
+	__u32 tdcf;
+};
+
 static void print_usage(FILE *f)
 {
 	fprintf(f,
@@ -128,7 +134,7 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
 {
 	struct can_bittiming bt = {}, dbt = {};
 	struct can_ctrlmode cm = { 0 };
-	__u32 tdcv = -1, tdco = -1, tdcf = -1;
+	struct can_tdc fd = { .tdcv = -1, .tdco = -1, .tdcf = -1 };
 
 	while (argc > 0) {
 		if (matches(*argv, "bitrate") == 0) {
@@ -196,15 +202,15 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
 				invarg("invalid \"dsjw\" value", *argv);
 		} else if (matches(*argv, "tdcv") == 0) {
 			NEXT_ARG();
-			if (get_u32(&tdcv, *argv, 0))
+			if (get_u32(&fd.tdcv, *argv, 0))
 				invarg("invalid \"tdcv\" value", *argv);
 		} else if (matches(*argv, "tdco") == 0) {
 			NEXT_ARG();
-			if (get_u32(&tdco, *argv, 0))
+			if (get_u32(&fd.tdco, *argv, 0))
 				invarg("invalid \"tdco\" value", *argv);
 		} else if (matches(*argv, "tdcf") == 0) {
 			NEXT_ARG();
-			if (get_u32(&tdcf, *argv, 0))
+			if (get_u32(&fd.tdcf, *argv, 0))
 				invarg("invalid \"tdcf\" value", *argv);
 		} else if (matches(*argv, "loopback") == 0) {
 			NEXT_ARG();
@@ -294,16 +300,16 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
 	if (cm.mask)
 		addattr_l(n, 1024, IFLA_CAN_CTRLMODE, &cm, sizeof(cm));
 
-	if (tdcv != -1 || tdco != -1 || tdcf != -1) {
+	if (fd.tdcv != -1 || fd.tdco != -1 || fd.tdcf != -1) {
 		struct rtattr *tdc = addattr_nest(n, 1024,
 						  IFLA_CAN_TDC | NLA_F_NESTED);
 
-		if (tdcv != -1)
-			addattr32(n, 1024, IFLA_CAN_TDC_TDCV, tdcv);
-		if (tdco != -1)
-			addattr32(n, 1024, IFLA_CAN_TDC_TDCO, tdco);
-		if (tdcf != -1)
-			addattr32(n, 1024, IFLA_CAN_TDC_TDCF, tdcf);
+		if (fd.tdcv != -1)
+			addattr32(n, 1024, IFLA_CAN_TDC_TDCV, fd.tdcv);
+		if (fd.tdco != -1)
+			addattr32(n, 1024, IFLA_CAN_TDC_TDCO, fd.tdco);
+		if (fd.tdcf != -1)
+			addattr32(n, 1024, IFLA_CAN_TDC_TDCF, fd.tdcf);
 		addattr_nest_end(n, tdc);
 	}
 
-- 
2.45.2


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

* [PATCH iproute2-next v1 6/6] iplink_can: rename dbt into fd_dbt in can_parse_opt()
  2024-11-12 17:27 [PATCH iproute2-next v1 0/6] iplink_can: preparation before introduction of CAN XL Vincent Mailhol
                   ` (4 preceding siblings ...)
  2024-11-12 17:27 ` [PATCH iproute2-next v1 5/6] iplink_can: add struct can_tdc Vincent Mailhol
@ 2024-11-12 17:27 ` Vincent Mailhol
  2024-11-18 17:00 ` [PATCH iproute2-next v1 0/6] iplink_can: preparation before introduction of CAN XL patchwork-bot+netdevbpf
  6 siblings, 0 replies; 8+ messages in thread
From: Vincent Mailhol @ 2024-11-12 17:27 UTC (permalink / raw)
  To: netdev, Stephen Hemminger, David Ahern, linux-can,
	Marc Kleine-Budde, Oliver Hartkopp
  Cc: Robert Nawrath, linux-kernel, Vincent Mailhol

The CAN XL support will introduce another dbt variable. Rename the
current dbt variable into fd_dbt to avoid future confusion. When
introduced, the CAN XL variable will be named xl_dbt.

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
 ip/iplink_can.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/ip/iplink_can.c b/ip/iplink_can.c
index 325a4007..fcffa852 100644
--- a/ip/iplink_can.c
+++ b/ip/iplink_can.c
@@ -132,7 +132,7 @@ static void print_ctrlmode(enum output_type t, __u32 flags, const char* key)
 static int can_parse_opt(struct link_util *lu, int argc, char **argv,
 			 struct nlmsghdr *n)
 {
-	struct can_bittiming bt = {}, dbt = {};
+	struct can_bittiming bt = {}, fd_dbt = {};
 	struct can_ctrlmode cm = { 0 };
 	struct can_tdc fd = { .tdcv = -1, .tdco = -1, .tdcf = -1 };
 
@@ -171,7 +171,7 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
 				invarg("invalid \"sjw\" value", *argv);
 		} else if (matches(*argv, "dbitrate") == 0) {
 			NEXT_ARG();
-			if (get_u32(&dbt.bitrate, *argv, 0))
+			if (get_u32(&fd_dbt.bitrate, *argv, 0))
 				invarg("invalid \"dbitrate\" value", *argv);
 		} else if (matches(*argv, "dsample-point") == 0) {
 			float sp;
@@ -179,26 +179,26 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
 			NEXT_ARG();
 			if (get_float(&sp, *argv))
 				invarg("invalid \"dsample-point\" value", *argv);
-			dbt.sample_point = (__u32)(sp * 1000);
+			fd_dbt.sample_point = (__u32)(sp * 1000);
 		} else if (matches(*argv, "dtq") == 0) {
 			NEXT_ARG();
-			if (get_u32(&dbt.tq, *argv, 0))
+			if (get_u32(&fd_dbt.tq, *argv, 0))
 				invarg("invalid \"dtq\" value", *argv);
 		} else if (matches(*argv, "dprop-seg") == 0) {
 			NEXT_ARG();
-			if (get_u32(&dbt.prop_seg, *argv, 0))
+			if (get_u32(&fd_dbt.prop_seg, *argv, 0))
 				invarg("invalid \"dprop-seg\" value", *argv);
 		} else if (matches(*argv, "dphase-seg1") == 0) {
 			NEXT_ARG();
-			if (get_u32(&dbt.phase_seg1, *argv, 0))
+			if (get_u32(&fd_dbt.phase_seg1, *argv, 0))
 				invarg("invalid \"dphase-seg1\" value", *argv);
 		} else if (matches(*argv, "dphase-seg2") == 0) {
 			NEXT_ARG();
-			if (get_u32(&dbt.phase_seg2, *argv, 0))
+			if (get_u32(&fd_dbt.phase_seg2, *argv, 0))
 				invarg("invalid \"dphase-seg2\" value", *argv);
 		} else if (matches(*argv, "dsjw") == 0) {
 			NEXT_ARG();
-			if (get_u32(&dbt.sjw, *argv, 0))
+			if (get_u32(&fd_dbt.sjw, *argv, 0))
 				invarg("invalid \"dsjw\" value", *argv);
 		} else if (matches(*argv, "tdcv") == 0) {
 			NEXT_ARG();
@@ -295,8 +295,8 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
 
 	if (bt.bitrate || bt.tq)
 		addattr_l(n, 1024, IFLA_CAN_BITTIMING, &bt, sizeof(bt));
-	if (dbt.bitrate || dbt.tq)
-		addattr_l(n, 1024, IFLA_CAN_DATA_BITTIMING, &dbt, sizeof(dbt));
+	if (fd_dbt.bitrate || fd_dbt.tq)
+		addattr_l(n, 1024, IFLA_CAN_DATA_BITTIMING, &fd_dbt, sizeof(fd_dbt));
 	if (cm.mask)
 		addattr_l(n, 1024, IFLA_CAN_CTRLMODE, &cm, sizeof(cm));
 
-- 
2.45.2


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

* Re: [PATCH iproute2-next v1 0/6] iplink_can: preparation before introduction of CAN XL
  2024-11-12 17:27 [PATCH iproute2-next v1 0/6] iplink_can: preparation before introduction of CAN XL Vincent Mailhol
                   ` (5 preceding siblings ...)
  2024-11-12 17:27 ` [PATCH iproute2-next v1 6/6] iplink_can: rename dbt into fd_dbt in can_parse_opt() Vincent Mailhol
@ 2024-11-18 17:00 ` patchwork-bot+netdevbpf
  6 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-11-18 17:00 UTC (permalink / raw)
  To: Vincent Mailhol
  Cc: netdev, stephen, dsahern, linux-can, mkl, socketcan, mbro1689,
	linux-kernel

Hello:

This series was applied to iproute2/iproute2-next.git (main)
by David Ahern <dsahern@kernel.org>:

On Wed, 13 Nov 2024 02:27:50 +0900 you wrote:
> An RFC was sent last weekend to kick-off the discussion of the
> introduction of CAN XL: [1] for the kernel side and [2] for the
> iproute2 interface. While the series received some positive feedback,
> it is far from completion. Some work is still needed to:
> 
>   - adjust the nesting of the IFLA_CAN_XL_DATA_BITTIMING_CONST in the
>     netlink interface
> 
> [...]

Here is the summary with links:
  - [iproute2-next,v1,1/6] iplink_can: remove unused FILE *f parameter in three functions
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=df72757907f3
  - [iproute2-next,v1,2/6] iplink_can: reduce the visibility of tdc in can_parse_opt()
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=3bd5fb4d57aa
  - [iproute2-next,v1,3/6] iplink_can: remove newline at the end of invarg()'s messages
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=9b1f33d5a46d
  - [iproute2-next,v1,4/6] iplink_can: use invarg() instead of fprintf()
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=68aaea862838
  - [iproute2-next,v1,5/6] iplink_can: add struct can_tdc
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=aac087a0108b
  - [iproute2-next,v1,6/6] iplink_can: rename dbt into fd_dbt in can_parse_opt()
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=3f2ab9d6070e

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-11-18 17:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-12 17:27 [PATCH iproute2-next v1 0/6] iplink_can: preparation before introduction of CAN XL Vincent Mailhol
2024-11-12 17:27 ` [PATCH iproute2-next v1 1/6] iplink_can: remove unused FILE *f parameter in three functions Vincent Mailhol
2024-11-12 17:27 ` [PATCH iproute2-next v1 2/6] iplink_can: reduce the visibility of tdc in can_parse_opt() Vincent Mailhol
2024-11-12 17:27 ` [PATCH iproute2-next v1 3/6] iplink_can: remove newline at the end of invarg()'s messages Vincent Mailhol
2024-11-12 17:27 ` [PATCH iproute2-next v1 4/6] iplink_can: use invarg() instead of fprintf() Vincent Mailhol
2024-11-12 17:27 ` [PATCH iproute2-next v1 5/6] iplink_can: add struct can_tdc Vincent Mailhol
2024-11-12 17:27 ` [PATCH iproute2-next v1 6/6] iplink_can: rename dbt into fd_dbt in can_parse_opt() Vincent Mailhol
2024-11-18 17:00 ` [PATCH iproute2-next v1 0/6] iplink_can: preparation before introduction of CAN XL patchwork-bot+netdevbpf

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