linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/9] pull-request: can-next 2022-05-16
@ 2022-05-16 20:26 Marc Kleine-Budde
  2022-05-16 20:26 ` [PATCH net-next 1/9] can: raw: raw_sendmsg(): remove not needed setting of skb->sk Marc Kleine-Budde
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2022-05-16 20:26 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, linux-can, kernel

Hello Jakub, hello David,

this is a pull request of 9 patches for net-next/master.

the first 2 patches are by me and target the CAN raw protocol. The 1st
removes an unneeded assignment, the other one adds support for
SO_TXTIME/SCM_TXTIME.

Oliver Hartkopp contributes 2 patches for the ISOTP protocol. The 1st
adds support for transmission without flow control, the other let's
bind() return an error on incorrect CAN ID formatting.

Geert Uytterhoeven contributes a patch to clean up ctucanfd's Kconfig
file.

Vincent Mailhol's patch for the slcan driver uses the proper function
to check for invalid CAN frames in the xmit callback.

The next patch is by Geert Uytterhoeven and makes the interrupt-names
of the renesas,rcar-canfd dt bindings mandatory.

A patch by my update the ctucanfd dt bindings to include the common
CAN controller bindings.

The last patch is by Akira Yokosawa and fixes a breakage the
ctucanfd's documentation.

regards,
Marc

---

The following changes since commit d887ae3247e022183f244cb325dca1dfbd0a9ed0:

  octeontx2-pf: Remove unnecessary synchronize_irq() before free_irq() (2022-05-16 11:47:22 +0100)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git tags/linux-can-next-for-5.19-20220516

for you to fetch changes up to ba3e2eaef1ae5019775989aeec3be8e9df83baa5:

  docs: ctucanfd: Use 'kernel-figure' directive instead of 'figure' (2022-05-16 22:11:11 +0200)

----------------------------------------------------------------
linux-can-next-for-5.19-20220516

----------------------------------------------------------------
Akira Yokosawa (1):
      docs: ctucanfd: Use 'kernel-figure' directive instead of 'figure'

Geert Uytterhoeven (2):
      can: ctucanfd: Let users select instead of depend on CAN_CTUCANFD
      dt-bindings: can: renesas,rcar-canfd: Make interrupt-names required

Marc Kleine-Budde (3):
      can: raw: raw_sendmsg(): remove not needed setting of skb->sk
      can: raw: add support for SO_TXTIME/SCM_TXTIME
      dt-bindings: can: ctucanfd: include common CAN controller bindings

Oliver Hartkopp (2):
      can: isotp: add support for transmission without flow control
      can: isotp: isotp_bind(): return -EINVAL on incorrect CAN ID formatting

Vincent Mailhol (1):
      can: slcan: slc_xmit(): use can_dropped_invalid_skb() instead of manual check

 .../devicetree/bindings/net/can/ctu,ctucanfd.yaml  |   3 +
 .../bindings/net/can/renesas,rcar-canfd.yaml       |   3 +-
 .../device_drivers/can/ctu/ctucanfd-driver.rst     |   4 +-
 drivers/net/can/ctucanfd/Kconfig                   |   6 +-
 drivers/net/can/slcan.c                            |   4 +-
 include/uapi/linux/can/isotp.h                     |  25 ++---
 net/can/isotp.c                                    | 105 ++++++++++++++++-----
 net/can/raw.c                                      |  12 ++-
 8 files changed, 119 insertions(+), 43 deletions(-)



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

* [PATCH net-next 1/9] can: raw: raw_sendmsg(): remove not needed setting of skb->sk
  2022-05-16 20:26 [PATCH net-next 0/9] pull-request: can-next 2022-05-16 Marc Kleine-Budde
@ 2022-05-16 20:26 ` Marc Kleine-Budde
  2022-05-17  0:10   ` patchwork-bot+netdevbpf
  2022-05-16 20:26 ` [PATCH net-next 2/9] can: raw: add support for SO_TXTIME/SCM_TXTIME Marc Kleine-Budde
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 11+ messages in thread
From: Marc Kleine-Budde @ 2022-05-16 20:26 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, linux-can, kernel, Marc Kleine-Budde, Oliver Hartkopp

The skb in raw_sendmsg() is allocated with sock_alloc_send_skb(),
which subsequently calls sock_alloc_send_pskb() -> skb_set_owner_w(),
which assigns "skb->sk = sk".

This patch removes the not needed setting of skb->sk.

Link: https://lore.kernel.org/all/20220502091946.1916211-2-mkl@pengutronix.de
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 net/can/raw.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/can/raw.c b/net/can/raw.c
index b7dbb57557f3..1a68efae43c2 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -820,7 +820,6 @@ static int raw_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
 	skb_setup_tx_timestamp(skb, sk->sk_tsflags);
 
 	skb->dev = dev;
-	skb->sk = sk;
 	skb->priority = sk->sk_priority;
 
 	err = can_send(skb, ro->loopback);

base-commit: d887ae3247e022183f244cb325dca1dfbd0a9ed0
-- 
2.35.1



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

* [PATCH net-next 2/9] can: raw: add support for SO_TXTIME/SCM_TXTIME
  2022-05-16 20:26 [PATCH net-next 0/9] pull-request: can-next 2022-05-16 Marc Kleine-Budde
  2022-05-16 20:26 ` [PATCH net-next 1/9] can: raw: raw_sendmsg(): remove not needed setting of skb->sk Marc Kleine-Budde
@ 2022-05-16 20:26 ` Marc Kleine-Budde
  2022-05-16 20:26 ` [PATCH net-next 3/9] can: isotp: add support for transmission without flow control Marc Kleine-Budde
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2022-05-16 20:26 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, linux-can, kernel, Marc Kleine-Budde, Oliver Hartkopp

This patch calls into sock_cmsg_send() to parse the user supplied
control information into a struct sockcm_cookie. Then assign the
requested transmit time to the skb.

This makes it possible to use the Earliest TXTIME First (ETF) packet
scheduler with the CAN_RAW protocol. The user can send a CAN_RAW frame
with a TXTIME and the kernel (with the ETF scheduler) will take care
of sending it to the network interface.

Link: https://lore.kernel.org/all/20220502091946.1916211-3-mkl@pengutronix.de
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 net/can/raw.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/net/can/raw.c b/net/can/raw.c
index 1a68efae43c2..d1bd9cc51ebe 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -772,6 +772,7 @@ static int raw_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
 {
 	struct sock *sk = sock->sk;
 	struct raw_sock *ro = raw_sk(sk);
+	struct sockcm_cookie sockc;
 	struct sk_buff *skb;
 	struct net_device *dev;
 	int ifindex;
@@ -817,10 +818,18 @@ static int raw_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
 	if (err < 0)
 		goto free_skb;
 
-	skb_setup_tx_timestamp(skb, sk->sk_tsflags);
+	sockcm_init(&sockc, sk);
+	if (msg->msg_controllen) {
+		err = sock_cmsg_send(sk, msg, &sockc);
+		if (unlikely(err))
+			goto free_skb;
+	}
 
 	skb->dev = dev;
 	skb->priority = sk->sk_priority;
+	skb->tstamp = sockc.transmit_time;
+
+	skb_setup_tx_timestamp(skb, sockc.tsflags);
 
 	err = can_send(skb, ro->loopback);
 
-- 
2.35.1



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

* [PATCH net-next 3/9] can: isotp: add support for transmission without flow control
  2022-05-16 20:26 [PATCH net-next 0/9] pull-request: can-next 2022-05-16 Marc Kleine-Budde
  2022-05-16 20:26 ` [PATCH net-next 1/9] can: raw: raw_sendmsg(): remove not needed setting of skb->sk Marc Kleine-Budde
  2022-05-16 20:26 ` [PATCH net-next 2/9] can: raw: add support for SO_TXTIME/SCM_TXTIME Marc Kleine-Budde
@ 2022-05-16 20:26 ` Marc Kleine-Budde
  2022-05-16 20:26 ` [PATCH net-next 4/9] can: isotp: isotp_bind(): return -EINVAL on incorrect CAN ID formatting Marc Kleine-Budde
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2022-05-16 20:26 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, linux-can, kernel, Oliver Hartkopp, Marc Kleine-Budde

From: Oliver Hartkopp <socketcan@hartkopp.net>

Usually the ISO 15765-2 protocol is a point-to-point protocol to transfer
segmented PDUs to a dedicated receiver. This receiver sends a flow control
message to specify protocol options and timings (e.g. block size / STmin).

The so called functional addressing communication allows a 1:N
communication but is limited to a single frame length.

This new CAN_ISOTP_CF_BROADCAST allows an unconfirmed 1:N communication
with PDU length that would not fit into a single frame. This feature is
not covered by the ISO 15765-2 standard.

Link: https://lore.kernel.org/all/20220507115558.19065-1-socketcan@hartkopp.net
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 include/uapi/linux/can/isotp.h |  25 +++++----
 net/can/isotp.c                | 100 ++++++++++++++++++++++++++-------
 2 files changed, 92 insertions(+), 33 deletions(-)

diff --git a/include/uapi/linux/can/isotp.h b/include/uapi/linux/can/isotp.h
index 590f8aea2b6d..439c982f7e81 100644
--- a/include/uapi/linux/can/isotp.h
+++ b/include/uapi/linux/can/isotp.h
@@ -124,18 +124,19 @@ struct can_isotp_ll_options {
 
 /* flags for isotp behaviour */
 
-#define CAN_ISOTP_LISTEN_MODE	0x001	/* listen only (do not send FC) */
-#define CAN_ISOTP_EXTEND_ADDR	0x002	/* enable extended addressing */
-#define CAN_ISOTP_TX_PADDING	0x004	/* enable CAN frame padding tx path */
-#define CAN_ISOTP_RX_PADDING	0x008	/* enable CAN frame padding rx path */
-#define CAN_ISOTP_CHK_PAD_LEN	0x010	/* check received CAN frame padding */
-#define CAN_ISOTP_CHK_PAD_DATA	0x020	/* check received CAN frame padding */
-#define CAN_ISOTP_HALF_DUPLEX	0x040	/* half duplex error state handling */
-#define CAN_ISOTP_FORCE_TXSTMIN	0x080	/* ignore stmin from received FC */
-#define CAN_ISOTP_FORCE_RXSTMIN	0x100	/* ignore CFs depending on rx stmin */
-#define CAN_ISOTP_RX_EXT_ADDR	0x200	/* different rx extended addressing */
-#define CAN_ISOTP_WAIT_TX_DONE	0x400	/* wait for tx completion */
-#define CAN_ISOTP_SF_BROADCAST	0x800	/* 1-to-N functional addressing */
+#define CAN_ISOTP_LISTEN_MODE	0x0001	/* listen only (do not send FC) */
+#define CAN_ISOTP_EXTEND_ADDR	0x0002	/* enable extended addressing */
+#define CAN_ISOTP_TX_PADDING	0x0004	/* enable CAN frame padding tx path */
+#define CAN_ISOTP_RX_PADDING	0x0008	/* enable CAN frame padding rx path */
+#define CAN_ISOTP_CHK_PAD_LEN	0x0010	/* check received CAN frame padding */
+#define CAN_ISOTP_CHK_PAD_DATA	0x0020	/* check received CAN frame padding */
+#define CAN_ISOTP_HALF_DUPLEX	0x0040	/* half duplex error state handling */
+#define CAN_ISOTP_FORCE_TXSTMIN	0x0080	/* ignore stmin from received FC */
+#define CAN_ISOTP_FORCE_RXSTMIN	0x0100	/* ignore CFs depending on rx stmin */
+#define CAN_ISOTP_RX_EXT_ADDR	0x0200	/* different rx extended addressing */
+#define CAN_ISOTP_WAIT_TX_DONE	0x0400	/* wait for tx completion */
+#define CAN_ISOTP_SF_BROADCAST	0x0800	/* 1-to-N functional addressing */
+#define CAN_ISOTP_CF_BROADCAST	0x1000	/* 1-to-N transmission w/o FC */
 
 /* protocol machine default values */
 
diff --git a/net/can/isotp.c b/net/can/isotp.c
index 35a1ae61744c..2caeeae8ec16 100644
--- a/net/can/isotp.c
+++ b/net/can/isotp.c
@@ -104,6 +104,7 @@ MODULE_ALIAS("can-proto-6");
 #define FC_CONTENT_SZ 3	/* flow control content size in byte (FS/BS/STmin) */
 
 #define ISOTP_CHECK_PADDING (CAN_ISOTP_CHK_PAD_LEN | CAN_ISOTP_CHK_PAD_DATA)
+#define ISOTP_ALL_BC_FLAGS (CAN_ISOTP_SF_BROADCAST | CAN_ISOTP_CF_BROADCAST)
 
 /* Flow Status given in FC frame */
 #define ISOTP_FC_CTS 0		/* clear to send */
@@ -159,6 +160,23 @@ static inline struct isotp_sock *isotp_sk(const struct sock *sk)
 	return (struct isotp_sock *)sk;
 }
 
+static u32 isotp_bc_flags(struct isotp_sock *so)
+{
+	return so->opt.flags & ISOTP_ALL_BC_FLAGS;
+}
+
+static bool isotp_register_rxid(struct isotp_sock *so)
+{
+	/* no broadcast modes => register rx_id for FC frame reception */
+	return (isotp_bc_flags(so) == 0);
+}
+
+static bool isotp_register_txecho(struct isotp_sock *so)
+{
+	/* all modes but SF_BROADCAST register for tx echo skbs */
+	return (isotp_bc_flags(so) != CAN_ISOTP_SF_BROADCAST);
+}
+
 static enum hrtimer_restart isotp_rx_timer_handler(struct hrtimer *hrtimer)
 {
 	struct isotp_sock *so = container_of(hrtimer, struct isotp_sock,
@@ -803,7 +821,6 @@ static void isotp_create_fframe(struct canfd_frame *cf, struct isotp_sock *so,
 		cf->data[i] = so->tx.buf[so->tx.idx++];
 
 	so->tx.sn = 1;
-	so->tx.state = ISOTP_WAIT_FIRST_FC;
 }
 
 static void isotp_rcv_echo(struct sk_buff *skb, void *data)
@@ -936,7 +953,7 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
 	off = (so->tx.ll_dl > CAN_MAX_DLEN) ? 1 : 0;
 
 	/* does the given data fit into a single frame for SF_BROADCAST? */
-	if ((so->opt.flags & CAN_ISOTP_SF_BROADCAST) &&
+	if ((isotp_bc_flags(so) == CAN_ISOTP_SF_BROADCAST) &&
 	    (size > so->tx.ll_dl - SF_PCI_SZ4 - ae - off)) {
 		err = -EINVAL;
 		goto err_out_drop;
@@ -1000,12 +1017,41 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
 		/* don't enable wait queue for a single frame transmission */
 		wait_tx_done = 0;
 	} else {
-		/* send first frame and wait for FC */
+		/* send first frame */
 
 		isotp_create_fframe(cf, so, ae);
 
-		/* start timeout for FC */
-		hrtimer_sec = 1;
+		if (isotp_bc_flags(so) == CAN_ISOTP_CF_BROADCAST) {
+			/* set timer for FC-less operation (STmin = 0) */
+			if (so->opt.flags & CAN_ISOTP_FORCE_TXSTMIN)
+				so->tx_gap = ktime_set(0, so->force_tx_stmin);
+			else
+				so->tx_gap = ktime_set(0, so->frame_txtime);
+
+			/* disable wait for FCs due to activated block size */
+			so->txfc.bs = 0;
+
+			/* cfecho should have been zero'ed by init */
+			if (so->cfecho)
+				pr_notice_once("can-isotp: no fc cfecho %08X\n",
+					       so->cfecho);
+
+			/* set consecutive frame echo tag */
+			so->cfecho = *(u32 *)cf->data;
+
+			/* switch directly to ISOTP_SENDING state */
+			so->tx.state = ISOTP_SENDING;
+
+			/* start timeout for unlikely lost echo skb */
+			hrtimer_sec = 2;
+		} else {
+			/* standard flow control check */
+			so->tx.state = ISOTP_WAIT_FIRST_FC;
+
+			/* start timeout for FC */
+			hrtimer_sec = 1;
+		}
+
 		hrtimer_start(&so->txtimer, ktime_set(hrtimer_sec, 0),
 			      HRTIMER_MODE_REL_SOFT);
 	}
@@ -1025,6 +1071,9 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
 		if (hrtimer_sec)
 			hrtimer_cancel(&so->txtimer);
 
+		/* reset consecutive frame echo tag */
+		so->cfecho = 0;
+
 		goto err_out_drop;
 	}
 
@@ -1120,15 +1169,17 @@ static int isotp_release(struct socket *sock)
 	lock_sock(sk);
 
 	/* remove current filters & unregister */
-	if (so->bound && (!(so->opt.flags & CAN_ISOTP_SF_BROADCAST))) {
+	if (so->bound && isotp_register_txecho(so)) {
 		if (so->ifindex) {
 			struct net_device *dev;
 
 			dev = dev_get_by_index(net, so->ifindex);
 			if (dev) {
-				can_rx_unregister(net, dev, so->rxid,
-						  SINGLE_MASK(so->rxid),
-						  isotp_rcv, sk);
+				if (isotp_register_rxid(so))
+					can_rx_unregister(net, dev, so->rxid,
+							  SINGLE_MASK(so->rxid),
+							  isotp_rcv, sk);
+
 				can_rx_unregister(net, dev, so->txid,
 						  SINGLE_MASK(so->txid),
 						  isotp_rcv_echo, sk);
@@ -1164,7 +1215,6 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len)
 	canid_t tx_id, rx_id;
 	int err = 0;
 	int notify_enetdown = 0;
-	int do_rx_reg = 1;
 
 	if (len < ISOTP_MIN_NAMELEN)
 		return -EINVAL;
@@ -1192,12 +1242,8 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len)
 		goto out;
 	}
 
-	/* do not register frame reception for functional addressing */
-	if (so->opt.flags & CAN_ISOTP_SF_BROADCAST)
-		do_rx_reg = 0;
-
-	/* do not validate rx address for functional addressing */
-	if (do_rx_reg && rx_id == tx_id) {
+	/* ensure different CAN IDs when the rx_id is to be registered */
+	if (isotp_register_rxid(so) && rx_id == tx_id) {
 		err = -EADDRNOTAVAIL;
 		goto out;
 	}
@@ -1222,10 +1268,11 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len)
 
 	ifindex = dev->ifindex;
 
-	if (do_rx_reg) {
+	if (isotp_register_rxid(so))
 		can_rx_register(net, dev, rx_id, SINGLE_MASK(rx_id),
 				isotp_rcv, sk, "isotp", sk);
 
+	if (isotp_register_txecho(so)) {
 		/* no consecutive frame echo skb in flight */
 		so->cfecho = 0;
 
@@ -1294,6 +1341,15 @@ static int isotp_setsockopt_locked(struct socket *sock, int level, int optname,
 		if (!(so->opt.flags & CAN_ISOTP_RX_EXT_ADDR))
 			so->opt.rx_ext_address = so->opt.ext_address;
 
+		/* these broadcast flags are not allowed together */
+		if (isotp_bc_flags(so) == ISOTP_ALL_BC_FLAGS) {
+			/* CAN_ISOTP_SF_BROADCAST is prioritized */
+			so->opt.flags &= ~CAN_ISOTP_CF_BROADCAST;
+
+			/* give user feedback on wrong config attempt */
+			ret = -EINVAL;
+		}
+
 		/* check for frame_txtime changes (0 => no changes) */
 		if (so->opt.frame_txtime) {
 			if (so->opt.frame_txtime == CAN_ISOTP_FRAME_TXTIME_ZERO)
@@ -1444,10 +1500,12 @@ static void isotp_notify(struct isotp_sock *so, unsigned long msg,
 	case NETDEV_UNREGISTER:
 		lock_sock(sk);
 		/* remove current filters & unregister */
-		if (so->bound && (!(so->opt.flags & CAN_ISOTP_SF_BROADCAST))) {
-			can_rx_unregister(dev_net(dev), dev, so->rxid,
-					  SINGLE_MASK(so->rxid),
-					  isotp_rcv, sk);
+		if (so->bound && isotp_register_txecho(so)) {
+			if (isotp_register_rxid(so))
+				can_rx_unregister(dev_net(dev), dev, so->rxid,
+						  SINGLE_MASK(so->rxid),
+						  isotp_rcv, sk);
+
 			can_rx_unregister(dev_net(dev), dev, so->txid,
 					  SINGLE_MASK(so->txid),
 					  isotp_rcv_echo, sk);
-- 
2.35.1



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

* [PATCH net-next 4/9] can: isotp: isotp_bind(): return -EINVAL on incorrect CAN ID formatting
  2022-05-16 20:26 [PATCH net-next 0/9] pull-request: can-next 2022-05-16 Marc Kleine-Budde
                   ` (2 preceding siblings ...)
  2022-05-16 20:26 ` [PATCH net-next 3/9] can: isotp: add support for transmission without flow control Marc Kleine-Budde
@ 2022-05-16 20:26 ` Marc Kleine-Budde
  2022-05-16 20:26 ` [PATCH net-next 5/9] can: ctucanfd: Let users select instead of depend on CAN_CTUCANFD Marc Kleine-Budde
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2022-05-16 20:26 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, linux-can, kernel, Oliver Hartkopp, Derek Will,
	Marc Kleine-Budde

From: Oliver Hartkopp <socketcan@hartkopp.net>

Commit 3ea566422cbd ("can: isotp: sanitize CAN ID checks in
isotp_bind()") checks the given CAN ID address information by
sanitizing the input values.

This check (silently) removes obsolete bits by masking the given CAN
IDs.

Derek Will suggested to give a feedback to the application programmer
when the 'sanitizing' was actually needed which means the programmer
provided CAN ID content in a wrong format (e.g. SFF CAN IDs with a CAN
ID > 0x7FF).

Link: https://lore.kernel.org/all/20220515181633.76671-1-socketcan@hartkopp.net
Suggested-by: Derek Will <derekrobertwill@gmail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 net/can/isotp.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/can/isotp.c b/net/can/isotp.c
index 2caeeae8ec16..4a4007f10970 100644
--- a/net/can/isotp.c
+++ b/net/can/isotp.c
@@ -1232,6 +1232,11 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len)
 	else
 		rx_id &= CAN_SFF_MASK;
 
+	/* give feedback on wrong CAN-ID values */
+	if (tx_id != addr->can_addr.tp.tx_id ||
+	    rx_id != addr->can_addr.tp.rx_id)
+		return -EINVAL;
+
 	if (!addr->can_ifindex)
 		return -ENODEV;
 
-- 
2.35.1



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

* [PATCH net-next 5/9] can: ctucanfd: Let users select instead of depend on CAN_CTUCANFD
  2022-05-16 20:26 [PATCH net-next 0/9] pull-request: can-next 2022-05-16 Marc Kleine-Budde
                   ` (3 preceding siblings ...)
  2022-05-16 20:26 ` [PATCH net-next 4/9] can: isotp: isotp_bind(): return -EINVAL on incorrect CAN ID formatting Marc Kleine-Budde
@ 2022-05-16 20:26 ` Marc Kleine-Budde
  2022-05-16 20:26 ` [PATCH net-next 6/9] can: slcan: slc_xmit(): use can_dropped_invalid_skb() instead of manual check Marc Kleine-Budde
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2022-05-16 20:26 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, linux-can, kernel, Geert Uytterhoeven, Pavel Pisa,
	Marc Kleine-Budde

From: Geert Uytterhoeven <geert+renesas@glider.be>

The CTU CAN-FD IP core is only useful when used with one of the
corresponding PCI/PCIe or platform (FPGA, SoC) drivers, which depend on
PCI resp. OF.

Hence make the users select the core driver code, instead of letting
then depend on it.  Keep the core code config option visible when
compile-testing, to maintain compile-coverage.

Link: https://lore.kernel.org/all/887b7440446b6244a20a503cc6e8dc9258846706.1652104941.git.geert+renesas@glider.be
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/ctucanfd/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/ctucanfd/Kconfig b/drivers/net/can/ctucanfd/Kconfig
index 48963efc7f19..3c383612eb17 100644
--- a/drivers/net/can/ctucanfd/Kconfig
+++ b/drivers/net/can/ctucanfd/Kconfig
@@ -1,5 +1,5 @@
 config CAN_CTUCANFD
-	tristate "CTU CAN-FD IP core"
+	tristate "CTU CAN-FD IP core" if COMPILE_TEST
 	help
 	  This driver adds support for the CTU CAN FD open-source IP core.
 	  More documentation and core sources at project page
@@ -13,8 +13,8 @@ config CAN_CTUCANFD
 
 config CAN_CTUCANFD_PCI
 	tristate "CTU CAN-FD IP core PCI/PCIe driver"
-	depends on CAN_CTUCANFD
 	depends on PCI
+	select CAN_CTUCANFD
 	help
 	  This driver adds PCI/PCIe support for CTU CAN-FD IP core.
 	  The project providing FPGA design for Intel EP4CGX15 based DB4CGX15
@@ -23,8 +23,8 @@ config CAN_CTUCANFD_PCI
 
 config CAN_CTUCANFD_PLATFORM
 	tristate "CTU CAN-FD IP core platform (FPGA, SoC) driver"
-	depends on CAN_CTUCANFD
 	depends on OF || COMPILE_TEST
+	select CAN_CTUCANFD
 	help
 	  The core has been tested together with OpenCores SJA1000
 	  modified to be CAN FD frames tolerant on MicroZed Zynq based
-- 
2.35.1



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

* [PATCH net-next 6/9] can: slcan: slc_xmit(): use can_dropped_invalid_skb() instead of manual check
  2022-05-16 20:26 [PATCH net-next 0/9] pull-request: can-next 2022-05-16 Marc Kleine-Budde
                   ` (4 preceding siblings ...)
  2022-05-16 20:26 ` [PATCH net-next 5/9] can: ctucanfd: Let users select instead of depend on CAN_CTUCANFD Marc Kleine-Budde
@ 2022-05-16 20:26 ` Marc Kleine-Budde
  2022-05-16 20:26 ` [PATCH net-next 7/9] dt-bindings: can: renesas,rcar-canfd: Make interrupt-names required Marc Kleine-Budde
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2022-05-16 20:26 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, linux-can, kernel, Vincent Mailhol, Marc Kleine-Budde

From: Vincent Mailhol <mailhol.vincent@wanadoo.fr>

slcan does a manual check in slc_xmit() to verify if the skb is valid.
This check is incomplete, use instead can_dropped_invalid_skb().

Link: https://lore.kernel.org/all/20220514141650.1109542-2-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/slcan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index ec294d0c5722..64a3aee8a7da 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -359,8 +359,8 @@ static netdev_tx_t slc_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct slcan *sl = netdev_priv(dev);
 
-	if (skb->len != CAN_MTU)
-		goto out;
+	if (can_dropped_invalid_skb(dev, skb))
+		return NETDEV_TX_OK;
 
 	spin_lock(&sl->lock);
 	if (!netif_running(dev))  {
-- 
2.35.1



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

* [PATCH net-next 7/9] dt-bindings: can: renesas,rcar-canfd: Make interrupt-names required
  2022-05-16 20:26 [PATCH net-next 0/9] pull-request: can-next 2022-05-16 Marc Kleine-Budde
                   ` (5 preceding siblings ...)
  2022-05-16 20:26 ` [PATCH net-next 6/9] can: slcan: slc_xmit(): use can_dropped_invalid_skb() instead of manual check Marc Kleine-Budde
@ 2022-05-16 20:26 ` Marc Kleine-Budde
  2022-05-16 20:26 ` [PATCH net-next 8/9] dt-bindings: can: ctucanfd: include common CAN controller bindings Marc Kleine-Budde
  2022-05-16 20:26 ` [PATCH net-next 9/9] docs: ctucanfd: Use 'kernel-figure' directive instead of 'figure' Marc Kleine-Budde
  8 siblings, 0 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2022-05-16 20:26 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, linux-can, kernel, Geert Uytterhoeven, Marc Kleine-Budde

From: Geert Uytterhoeven <geert+renesas@glider.be>

The Renesas R-Car CAN FD Controller always uses two or more interrupts.
Make the interrupt-names properties a required property, to make it
easier to identify the individual interrupts.

Update the example accordingly.

Link: https://lore.kernel.org/all/a68e65955e0df4db60233d468f348203c2e7b940.1651512451.git.geert+renesas@glider.be
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 .../devicetree/bindings/net/can/renesas,rcar-canfd.yaml        | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
index 9fc137fafed9..6f71fc96bc4e 100644
--- a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
+++ b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
@@ -88,6 +88,7 @@ required:
   - compatible
   - reg
   - interrupts
+  - interrupt-names
   - clocks
   - clock-names
   - power-domains
@@ -136,7 +137,6 @@ then:
         - const: rstc_n
 
   required:
-    - interrupt-names
     - reset-names
 else:
   properties:
@@ -167,6 +167,7 @@ examples:
             reg = <0xe66c0000 0x8000>;
             interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>,
                          <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
+            interrupt-names = "ch_int", "g_int";
             clocks = <&cpg CPG_MOD 914>,
                      <&cpg CPG_CORE R8A7795_CLK_CANFD>,
                      <&can_clk>;
-- 
2.35.1



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

* [PATCH net-next 8/9] dt-bindings: can: ctucanfd: include common CAN controller bindings
  2022-05-16 20:26 [PATCH net-next 0/9] pull-request: can-next 2022-05-16 Marc Kleine-Budde
                   ` (6 preceding siblings ...)
  2022-05-16 20:26 ` [PATCH net-next 7/9] dt-bindings: can: renesas,rcar-canfd: Make interrupt-names required Marc Kleine-Budde
@ 2022-05-16 20:26 ` Marc Kleine-Budde
  2022-05-16 20:26 ` [PATCH net-next 9/9] docs: ctucanfd: Use 'kernel-figure' directive instead of 'figure' Marc Kleine-Budde
  8 siblings, 0 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2022-05-16 20:26 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, linux-can, kernel, Marc Kleine-Budde, Ondrej Ille,
	Pavel Pisa, Rob Herring

Since commit

| 1f9234401ce0 ("dt-bindings: can: add can-controller.yaml")

there is a common CAN controller binding. Add this to the ctucanfd
binding.

Cc: Ondrej Ille <ondrej.ille@gmail.com>
Acked-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 Documentation/devicetree/bindings/net/can/ctu,ctucanfd.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/can/ctu,ctucanfd.yaml b/Documentation/devicetree/bindings/net/can/ctu,ctucanfd.yaml
index fb34d971dcb3..4635cb96fc64 100644
--- a/Documentation/devicetree/bindings/net/can/ctu,ctucanfd.yaml
+++ b/Documentation/devicetree/bindings/net/can/ctu,ctucanfd.yaml
@@ -25,6 +25,9 @@ maintainers:
   - Ondrej Ille <ondrej.ille@gmail.com>
   - Martin Jerabek <martin.jerabek01@gmail.com>
 
+allOf:
+  - $ref: can-controller.yaml#
+
 properties:
   compatible:
     oneOf:
-- 
2.35.1



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

* [PATCH net-next 9/9] docs: ctucanfd: Use 'kernel-figure' directive instead of 'figure'
  2022-05-16 20:26 [PATCH net-next 0/9] pull-request: can-next 2022-05-16 Marc Kleine-Budde
                   ` (7 preceding siblings ...)
  2022-05-16 20:26 ` [PATCH net-next 8/9] dt-bindings: can: ctucanfd: include common CAN controller bindings Marc Kleine-Budde
@ 2022-05-16 20:26 ` Marc Kleine-Budde
  8 siblings, 0 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2022-05-16 20:26 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, linux-can, kernel, Akira Yokosawa, Pavel Pisa,
	Martin Jerabek, Ondrej Ille, Marc Kleine-Budde

From: Akira Yokosawa <akiyks@gmail.com>

Two issues were observed in the ReST doc added by commit c3a0addefbde
("docs: ctucanfd: CTU CAN FD open-source IP core documentation.")
with Sphinx versions 2.4.4 and 4.5.0.

The plain "figure" directive broke "make pdfdocs" due to a missing
PDF figure.  For conversion of SVG -> PDF to work, the "kernel-figure"
directive, which is an extension for kernel documentation, should
be used instead.

The directive of "code:: raw" causes a warning from both
"make htmldocs" and "make pdfdocs", which reads:

    [...]/can/ctu/ctucanfd-driver.rst:75: WARNING: Pygments lexer name
    'raw' is not known

A plain literal-block marker should suffice where no syntax
highlighting is intended.

Fix the issues by using suitable directive and marker.

Fixes: c3a0addefbde ("docs: ctucanfd: CTU CAN FD open-source IP core documentation.")
Link: https://lore.kernel.org/all/5986752a-1c2a-5d64-f91d-58b1e6decd17@gmail.com
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
Acked-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Cc: Martin Jerabek <martin.jerabek01@gmail.com>
Cc: Ondrej Ille <ondrej.ille@gmail.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 .../networking/device_drivers/can/ctu/ctucanfd-driver.rst     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/networking/device_drivers/can/ctu/ctucanfd-driver.rst b/Documentation/networking/device_drivers/can/ctu/ctucanfd-driver.rst
index 2fde5551e756..40c92ea272af 100644
--- a/Documentation/networking/device_drivers/can/ctu/ctucanfd-driver.rst
+++ b/Documentation/networking/device_drivers/can/ctu/ctucanfd-driver.rst
@@ -72,7 +72,7 @@ it is reachable (on which bus it resides) and its configuration –
 registers address, interrupts and so on. An example of such a device
 tree is given in .
 
-.. code:: raw
+::
 
            / {
                /* ... */
@@ -451,7 +451,7 @@ the FIFO is maintained, together with priority rotation, is depicted in
 
 |
 
-.. figure:: fsm_txt_buffer_user.svg
+.. kernel-figure:: fsm_txt_buffer_user.svg
 
    TX Buffer states with possible transitions
 
-- 
2.35.1



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

* Re: [PATCH net-next 1/9] can: raw: raw_sendmsg(): remove not needed setting of skb->sk
  2022-05-16 20:26 ` [PATCH net-next 1/9] can: raw: raw_sendmsg(): remove not needed setting of skb->sk Marc Kleine-Budde
@ 2022-05-17  0:10   ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 11+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-17  0:10 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: netdev, davem, kuba, linux-can, kernel, socketcan

Hello:

This series was applied to netdev/net-next.git (master)
by Marc Kleine-Budde <mkl@pengutronix.de>:

On Mon, 16 May 2022 22:26:17 +0200 you wrote:
> The skb in raw_sendmsg() is allocated with sock_alloc_send_skb(),
> which subsequently calls sock_alloc_send_pskb() -> skb_set_owner_w(),
> which assigns "skb->sk = sk".
> 
> This patch removes the not needed setting of skb->sk.
> 
> Link: https://lore.kernel.org/all/20220502091946.1916211-2-mkl@pengutronix.de
> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> 
> [...]

Here is the summary with links:
  - [net-next,1/9] can: raw: raw_sendmsg(): remove not needed setting of skb->sk
    https://git.kernel.org/netdev/net-next/c/2af84932b3a1
  - [net-next,2/9] can: raw: add support for SO_TXTIME/SCM_TXTIME
    https://git.kernel.org/netdev/net-next/c/51a0d5e51178
  - [net-next,3/9] can: isotp: add support for transmission without flow control
    https://git.kernel.org/netdev/net-next/c/9f39d36530e5
  - [net-next,4/9] can: isotp: isotp_bind(): return -EINVAL on incorrect CAN ID formatting
    https://git.kernel.org/netdev/net-next/c/2aa39889c463
  - [net-next,5/9] can: ctucanfd: Let users select instead of depend on CAN_CTUCANFD
    https://git.kernel.org/netdev/net-next/c/94737ef56b61
  - [net-next,6/9] can: slcan: slc_xmit(): use can_dropped_invalid_skb() instead of manual check
    https://git.kernel.org/netdev/net-next/c/30abc9291329
  - [net-next,7/9] dt-bindings: can: renesas,rcar-canfd: Make interrupt-names required
    https://git.kernel.org/netdev/net-next/c/48b171dbf7b6
  - [net-next,8/9] dt-bindings: can: ctucanfd: include common CAN controller bindings
    https://git.kernel.org/netdev/net-next/c/14e1e9338c08
  - [net-next,9/9] docs: ctucanfd: Use 'kernel-figure' directive instead of 'figure'
    https://git.kernel.org/netdev/net-next/c/ba3e2eaef1ae

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] 11+ messages in thread

end of thread, other threads:[~2022-05-17  0:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16 20:26 [PATCH net-next 0/9] pull-request: can-next 2022-05-16 Marc Kleine-Budde
2022-05-16 20:26 ` [PATCH net-next 1/9] can: raw: raw_sendmsg(): remove not needed setting of skb->sk Marc Kleine-Budde
2022-05-17  0:10   ` patchwork-bot+netdevbpf
2022-05-16 20:26 ` [PATCH net-next 2/9] can: raw: add support for SO_TXTIME/SCM_TXTIME Marc Kleine-Budde
2022-05-16 20:26 ` [PATCH net-next 3/9] can: isotp: add support for transmission without flow control Marc Kleine-Budde
2022-05-16 20:26 ` [PATCH net-next 4/9] can: isotp: isotp_bind(): return -EINVAL on incorrect CAN ID formatting Marc Kleine-Budde
2022-05-16 20:26 ` [PATCH net-next 5/9] can: ctucanfd: Let users select instead of depend on CAN_CTUCANFD Marc Kleine-Budde
2022-05-16 20:26 ` [PATCH net-next 6/9] can: slcan: slc_xmit(): use can_dropped_invalid_skb() instead of manual check Marc Kleine-Budde
2022-05-16 20:26 ` [PATCH net-next 7/9] dt-bindings: can: renesas,rcar-canfd: Make interrupt-names required Marc Kleine-Budde
2022-05-16 20:26 ` [PATCH net-next 8/9] dt-bindings: can: ctucanfd: include common CAN controller bindings Marc Kleine-Budde
2022-05-16 20:26 ` [PATCH net-next 9/9] docs: ctucanfd: Use 'kernel-figure' directive instead of 'figure' Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).