can: j1939: transport: add j1939_session_skb_find_by_offset() function
authorOleksij Rempel <o.rempel@pengutronix.de>
Fri, 7 Aug 2020 10:51:59 +0000 (12:51 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Aug 2020 09:42:16 +0000 (11:42 +0200)
commita17f5cafe9bff5661b52455b945ab472575eb000
tree0b4d8e6d7fb915510e4d7e6da2a14bd47a0ee5fb
parent9e670bbcb4d7d41c6af75f2e65c4f31a8a617a28
can: j1939: transport: add j1939_session_skb_find_by_offset() function

[ Upstream commit 840835c9281215341d84966a8855f267a971e6a3 ]

Sometimes it makes no sense to search the skb by pkt.dpo, since we need
next the skb within the transaction block. This may happen if we have an
ETP session with CTS set to less than 255 packets.

After this patch, we will be able to work with ETP sessions where the
block size (ETP.CM_CTS byte 2) is less than 255 packets.

Reported-by: Henrique Figueira <henrislip@gmail.com>
Reported-by: https://github.com/linux-can/can-utils/issues/228
Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20200807105200.26441-5-o.rempel@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/can/j1939/transport.c