Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tcp TN Draft: Flag bit discussion is wrong. #12

Closed
RobertPHeller opened this issue Mar 21, 2019 · 9 comments
Closed

Tcp TN Draft: Flag bit discussion is wrong. #12

RobertPHeller opened this issue Mar 21, 2019 · 9 comments

Comments

@RobertPHeller
Copy link
Contributor

In reading TcpTransferTN and TcpTransferS, I have found a somewhat major
error:

TcpTransferS talks about the flag word at the start of a OpenLCB Tcp message
from the high bit to the low bit, briefly:

8000 -- OpenLCB/Link
4000 -- Chain
3000 -- Zero
0C00 -- Multipart: 0b00 single, 0b01 first, 0b11 center, 0b10 last
03FF -- Zero

But TcpTransferTN talks about these bits in the opposite order (page 2,
Section 2.3, the yellow text starting around line 35 though line 45). The
whole yellow text section needs to be rewritten.

I would propose something like this:

Flags field.

The MSB 0x8000 is an expansion flag used to (eventually) add link control
messages. These might be needed for e.g. turning gateway-filtering on and off,
loading/resetting remote diagnostic information, etc.

The 0x4000 bit indicates "chaining": Another prefix is next, before the body
of the message.

The 0x0C00 bits provide a way of extending a single OpenLCB message across
multiple TCP transfers. This might be used to e.g. simplify buffering and
framing in CAN-Ethernet gateways. A single OpenLCB message that extends across
multiple CAN frames is best accumulated into a single TCP transmission. If
that's not possible due to buffering or other issues, it can be sent as
multiple TCP transmissions using the 0x0C00 bits. When the bits are zero it is
a single part message, when 0x0400 it indicates the first part of the message
(there can be only one first part), when 0x0C00, it is a middle part of the
message (there can be multiple middle parts), when it is 0x0800 it is the last
part (there can be only one last part). The multiple parts must have matching
MTIs, Source NIDs, and for addressed messages matching Destination NIDs. The
message fragments should be combined in the order received.

@dpharris
Copy link
Contributor

dpharris commented Mar 21, 2019 via email

@bakerstu
Copy link
Contributor

You absolutely can guarantee the order of TCP message parts. If you couldn’t, TCP would be absolutely useless as a protocol, might as well just use UDP.

@RobertPHeller
Copy link
Contributor Author

It is my understanding that somewhere in the bowels of the Tcp/Ip stack is code dealing with packet ordering. A lot of the sort of low-level stuff that is a pain to deal with when writing drivers for CAN interfaces, is already handled when using Tcp/Ip.

@pabender
Copy link
Member

pabender commented Mar 21, 2019 via email

@balazsracz
Copy link
Contributor

balazsracz commented Mar 23, 2019 via email

@RobertPHeller
Copy link
Contributor Author

Is there any reason not to update the TcpTransferTN discussion of the flag bits to match what is in TcpTransferS? Riight now, the two documents are in disagreement about the flag bits and I suspect it is just a matter of typos in the TcpTransferTN document. Correcting that should be a trivial issue.

@kiwi64ajs
Copy link
Contributor

kiwi64ajs commented Jul 7, 2019 via email

@kiwi64ajs
Copy link
Contributor

Has this been resolved with the PR here: #15 ?
If yes then this can probably be closed unless there is some residual testing etc needing to be done

@RobertPHeller
Copy link
Contributor Author

Yes, before Balazs refactored the repo, he merged the pull request. There isn't anything to test, it is just fix to the TN doc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants