inet-framework / inet

INET Framework for the OMNeT++ discrete event simulator
https://inet.omnetpp.org
Other
431 stars 483 forks source link

pcapng wrong timestamp at TsnSwitch #979

Open andrew-lukin opened 4 months ago

andrew-lukin commented 4 months ago

Platform

I'm trying to check residence time for TsnSwitch node with pcapng analysis. For this I'm using a simple network with source(TsnDevice) then switch(TsnSwitch) then sink(TsnDevice). I'm recording all the interfaces of a switch into one file. As the result, I'm experiencing the same Arrival time in pcapng files for inbound and outbound packets. So, outbound packets are timestamped with inbound's Arrival time. Then, a check of a correspondent packet timestamp on the sink side shows a proper value, which includes the switch's residence time.

I'm expecting to see smth like this: source eth0 time: 0.000000 switch eth0 time: 0.000006 switch eth1 time: 0.000013 sink eth0 time: 0.000013

but what I get instead: source eth0 time: 0.000000 switch eth0 time: 0.000006 switch eth1 time: 0.000006 sink eth0 time: 0.000013

For EthernetSwitch and StandardHost type nodes everything works as expected, for instance.

I'm using the following configuration for pcapng capturing:

**.crcMode = "computed"
**.fcsMode = "computed"
**.recordPcap = true

**.fileFormat = "pcapng"
**.numPcapRecorders = 1

*.source1.pcapRecorder[*].pcapFile = "results/source1.pcapng"
*.sink1.pcapRecorder[*].pcapFile = "results/sink1.pcapng"
*.switch1.pcapRecorder[*].pcapFile = "results/switch1.pcapng"

It could be added to inet4.5/showcases/tsn/timesynchronization/clockdrift/omnetpp.ini, for instance, with the same result.

levy commented 4 months ago

There's a difference between how StandardHost/EthernetSwitch and TsnDevice/TsnSwitch records PCAPng files. The former records the TX end and RX start timestamps. The latter records the TX start and RX start timestamps. In your case the TX start equals with RX end for all packets processed by the switch. The difference comes that you see comes from the different operation of the above mentioned modules.

I'm not sure what to do with this. Ideally they should work the same way, or at least let the user chose what timestamp to record. I'll come back to this.