Re: j1939: control messages and PGN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On di, 28 mei 2019 13:54:35 +0200, Oleksij Rempel wrote:
> Hi all,
> 
> when receiving j1939 control messages, the current code looks up the
> session by DA and SA only, not taking the PGN (which is part of the
> control messages' data) into account.
> 
> When it comes to error control messages the session is aborted, even if
> the PGN doesn't match. In EOMA the session is aborted, too. This means
> receiving control messages with non matching PGNs lead to session abort.
> 
> Is this in general a good behavior?

It is indeed a bit stupid.

If 2 ends are talking to each other, and 1 of those 2 talks about
something else, that implies that you talk not about the same thing
either, and you probably want to abort soon. It would be better if
you only abort 'probably soon' and not 'immediately' in such case, since
you're right that reception of another PGN control frame does not imply
that you're current session became invalid.

In j1939 however, the data part does not carry PGN info, since only 1
session can be open. This implies 2 things:
* Ignoring PGN difference in control frames makes you blind to the data
  consistency, so you may think in certain cases that you continue to receive
  data while it's actually the data that belongs to another PGN.
* If node A talks to node B on a different PGN that node B thinks that
  node A is talking, then this is AFAIK considered as protocol
  violation because you risk data corruption.

The PGN in all-but-1st control frame could be considered redundant, but
since it's there, it should match.

So, it's still not a good behaviour, but j1939 IMHO requires you to do so.

So you think this is bad, let's make it even worse :-)
Between 2 nodes, actually 2 sessions may exist, 1 recv & 1 send.
Still, control frames that to RTS, CTS, DPO, ... are uni-directional,
i.e. they map to only 1 of those 2 sessions exclusively.
This is not the case for an abort message.
_If I'm not mistaken_, the PGN info should be ignored for abort frames,
since it may be unclear what exactly you abort: a old PGN, or a newly
requested PGN. And due to that, it's also unclear if it applies to the
send or recv path, so you abort, AFAIK, both directions at once.
But I have not the specifications around now, I can't verify.

Hope this helps.
Kind regards,
Kurt

> 
> regards,
> Oleksij & Marc
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux