From: Marc Kleine-Budde <mkl@pengutronix.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, linux-can@vger.kernel.org,
kernel@pengutronix.de, Marc Kleine-Budde <mkl@pengutronix.de>,
Oliver Hartkopp <socketcan@hartkopp.net>
Subject: [net 03/11] can: isotp: TX-path: ensure that CAN frame flags are initialized
Date: Tue, 16 Mar 2021 09:20:56 +0100 [thread overview]
Message-ID: <20210316082104.4027260-4-mkl@pengutronix.de> (raw)
In-Reply-To: <20210316082104.4027260-1-mkl@pengutronix.de>
The previous patch ensures that the TX flags (struct
can_isotp_ll_options::tx_flags) are 0 for classic CAN frames or a user
configured value for CAN-FD frames.
This patch sets the CAN frames flags unconditionally to the ISO-TP TX
flags, so that they are initialized to a proper value. Otherwise when
running "candump -x" on a classical CAN ISO-TP stream shows wrongly
set "B" and "E" flags.
| $ candump any,0:0,#FFFFFFFF -extA
| [...]
| can0 TX B E 713 [8] 2B 0A 0B 0C 0D 0E 0F 00
| can0 TX B E 713 [8] 2C 01 02 03 04 05 06 07
| can0 TX B E 713 [8] 2D 08 09 0A 0B 0C 0D 0E
| can0 TX B E 713 [8] 2E 0F 00 01 02 03 04 05
Fixes: e057dd3fc20f ("can: add ISO 15765-2:2016 transport protocol")
Link: https://lore.kernel.org/r/20210218215434.1708249-2-mkl@pengutronix.de
Cc: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
net/can/isotp.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/net/can/isotp.c b/net/can/isotp.c
index e32d446c121e..430976485d95 100644
--- a/net/can/isotp.c
+++ b/net/can/isotp.c
@@ -215,8 +215,7 @@ static int isotp_send_fc(struct sock *sk, int ae, u8 flowstatus)
if (ae)
ncf->data[0] = so->opt.ext_address;
- if (so->ll.mtu == CANFD_MTU)
- ncf->flags = so->ll.tx_flags;
+ ncf->flags = so->ll.tx_flags;
can_send_ret = can_send(nskb, 1);
if (can_send_ret)
@@ -790,8 +789,7 @@ static enum hrtimer_restart isotp_tx_timer_handler(struct hrtimer *hrtimer)
so->tx.sn %= 16;
so->tx.bs++;
- if (so->ll.mtu == CANFD_MTU)
- cf->flags = so->ll.tx_flags;
+ cf->flags = so->ll.tx_flags;
skb->dev = dev;
can_skb_set_owner(skb, sk);
@@ -939,8 +937,7 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
}
/* send the first or only CAN frame */
- if (so->ll.mtu == CANFD_MTU)
- cf->flags = so->ll.tx_flags;
+ cf->flags = so->ll.tx_flags;
skb->dev = dev;
skb->sk = sk;
--
2.30.1
next prev parent reply other threads:[~2021-03-16 8:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-16 8:20 pull-request: can 2021-03-16 Marc Kleine-Budde
2021-03-16 8:20 ` [net 01/11] can: dev: Move device back to init netns on owning netns delete Marc Kleine-Budde
2021-03-16 21:16 ` Jakub Kicinski
2021-03-16 8:20 ` [net 02/11] can: isotp: isotp_setsockopt(): only allow to set low level TX flags for CAN-FD Marc Kleine-Budde
2021-03-16 8:20 ` Marc Kleine-Budde [this message]
2021-03-18 10:11 ` [net 03/11] can: isotp: TX-path: ensure that CAN frame flags are initialized Oliver Hartkopp
2021-03-16 8:20 ` [net 04/11] can: peak_usb: add forgotten supported devices Marc Kleine-Budde
2021-03-16 8:20 ` [net 05/11] can: flexcan: flexcan_chip_freeze(): fix chip freeze for missing bitrate Marc Kleine-Budde
2021-03-16 9:02 ` Angelo Dureghello
2021-03-16 9:12 ` Marc Kleine-Budde
2021-03-16 8:20 ` [net 06/11] can: kvaser_pciefd: Always disable bus load reporting Marc Kleine-Budde
2021-03-16 8:21 ` [net 07/11] can: kvaser_usb: Add support for USBcan Pro 4xHS Marc Kleine-Budde
2021-03-16 8:21 ` [net 08/11] can: c_can_pci: c_can_pci_remove(): fix use-after-free Marc Kleine-Budde
2021-03-16 8:21 ` [net 09/11] can: c_can: move runtime PM enable/disable to c_can_platform Marc Kleine-Budde
2021-03-16 8:21 ` [net 10/11] can: m_can: m_can_do_rx_poll(): fix extraneous msg loss warning Marc Kleine-Budde
2021-03-16 8:21 ` [net 11/11] can: m_can: m_can_rx_peripheral(): fix RX being blocked by errors Marc Kleine-Budde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210316082104.4027260-4-mkl@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=davem@davemloft.net \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=socketcan@hartkopp.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).