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

Header converting erro when enabling gPTP (802.1as) with frame preemption #932

Open
howhangliu opened this issue Dec 12, 2023 · 1 comment
Assignees
Labels

Comments

@howhangliu
Copy link

Hi all,

In the TSN showcases, I am experimenting with the gPTP and FP features.
I discovered that when enabling both together, there is an issue as follows:

Cannot convert chunk from type inet::physicallayer::EthernetFragmentPhyHeader to type inet::physicallayer::EthernetPhyHeader. The most likely cause of this error is that a packet header is being misinterpreted while processing a received packet. The most likely fix is to find the code where the misinterpretation happens and change it.If the intention is to reinterpret the chunk via serialization/deserialization, then it needs to be enabled by passing the PF_ALLOW_REINTERPRETATION flag into the peek() or similar function.The automatic conversion is disabled by default to prevent unexpected behavior due to unintended data reinterpretation. -- in module (inet::Gptp) fp_gptp.switch1_fibrolan.gptp (id=248), at t=0.0000092825s, event 71

Note: The link between switch1-eth[1] and swtich2-eth[0] is the FP-capable link.
It seems that when switch2 received the peer delay response message from switch1, it could not convert the header.
I would appreciate it if you could point me to the file where I should look to fix the problem.

You can find the ned and ini files in the attachments.
fp_gptp.zip

Thank you
Best regards,

@levy levy self-assigned this Feb 20, 2024
@levy levy added the Bug label Mar 27, 2024
@Ganht99
Copy link

Ganht99 commented May 31, 2024

Hi,

I met the same problem and figured it out.

In source file Gptp.cc, there is a function named void Gptp::receiveSignal. When the frame is trasmitted to the node, it will produce transmissionEndedSignal and receptionEndedSignal .And Gptp will use that signal to check whether that frame is an AS frame.During the judging process, it uses the chunk named EthernetPhyHeader as followed.

const auto& ethPhyHeader = packet->peekAtFrontphysicallayer::EthernetPhyHeader();

However, when using frame preemption and AS, preemptable frame does not have that chunk. It has a chunk named EthernetFramentHeader .That's the reason.

Here is a solution.Since the judging process does not actually use the phyheader chunk, it only use its length as followed
const auto& ethMacHeader = packet->peekAt(ethPhyHeader->getChunkLength());
const auto& gptp = packet->peekAt(ethPhyHeader->getChunkLength() + ethMacHeader->getChunkLength());
Thus we can modify the sentence like this:
const auto& ethMacHeader = packet->peekAt(b(64));
const auto& gptp = packet->peekAt(b(64) + ethMacHeader->getChunkLength());

You can have a try.

Best wishes

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

No branches or pull requests

3 participants