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

Add header union information for extract operator #1064

Merged
merged 1 commit into from
Apr 10, 2023

Conversation

VolodymyrPeschanenkoIntel
Copy link
Contributor

This small changes add information for extract operator then current header is a part of header union stack like in example from this PR.
For example:

header O1 {
    bit<8> data;
}

header O2 {
    bit<16> data;
}

header_union U {
    O1 byte;
    O2 short;
}

struct headers {
    S    base;
    U[2] u;
}
....
parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
    state start {
        packet.extract(hdr.u.next.byte);

This small changes add information for extract operator then current header is a part of header union stack like in example from p4c PR#3193.
For example:
header O1 {
    bit<8> data;
}

header O2 {
    bit<16> data;
}

header_union U {
    O1 byte;
    O2 short;
}

struct headers {
    S    base;
    U[2] u;
}
....
parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
    state start {
        packet.extract(hdr.u.next.byte);
@mihaibudiu
Copy link
Contributor

I think this will need more changes, in particular modifying the pseudocode in the green blocks.

@mihaibudiu
Copy link
Contributor

But this is a good start to have the design committee discuss this problem.

Copy link
Collaborator

@jafingerhut jafingerhut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mihaibudiu mihaibudiu merged commit 433afe9 into p4lang:main Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants