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

Remove old intrinsic_metadata fields #1852

Merged
merged 1 commit into from
Apr 16, 2019

Conversation

jafingerhut
Copy link
Contributor

Removed ucast_egress_port
Only occured in in this one test program: p4_14_samples/sai_p4.p4

Replaced occurrences of ingress_global_tstamp with current
intrinsic_metadata.ingress_global_timestamp

Replaced occurrences of enq_tstamp with current
queueing_metadata.enq_timestamp

Removed occurrences of enq_congest_stat and deq_congest_stat, which
were defined in the two old switch.p4 versions, but never used.

mcast_hash in the two old switch.p4 test programs. There is nothing
in current v1model.p4 to replace them with, but seems best to not
simply delete their few occurrences from switch.p4 source programs.

Deleted occurences of mcast_hash from P4_14 programs that simply
defined it, but never used it.

Deleted all occurrences of intrinsic_metadata struct from P4_16 test
programs that include v1model.p4, since all of those fields are
defined in struct standard_metadata_t now.

Removed ucast_egress_port
Only occured in in this one test program: p4_14_samples/sai_p4.p4

Replaced occurrences of ingress_global_tstamp with current
intrinsic_metadata.ingress_global_timestamp

Replaced occurrences of enq_tstamp with current
queueing_metadata.enq_timestamp

Removed occurrences of enq_congest_stat and deq_congest_stat, which
were defined in the two old switch.p4 versions, but never used.

mcast_hash in the two old switch.p4 test programs.  There is nothing
in current v1model.p4 to replace them with, but seems best to not
simply delete their few occurrences from switch.p4 source programs.

Deleted occurences of mcast_hash from P4_14 programs that simply
defined it, but never used it.

Deleted all occurrences of intrinsic_metadata struct from P4_16 test
programs that include v1model.p4, since all of those fields are
defined in struct standard_metadata_t now.
Copy link
Contributor

@mihaibudiu mihaibudiu left a comment

Choose a reason for hiding this comment

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

I will approve this, since it is an improvement, but I don't think this solves the problem entirely, it only postpones it. Perhaps we can start with this step, though.

// arrival at ingress.

mcast_grp : 16; // multicast group id (key for the
// mcast replication table)

#ifdef INCLUDE_OLD_INTRINSIC_METADATA_FIELDS
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this macro?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I remove that macro and the #ifdef and corresponding #endif, then three of the old intrinsic_metadata fields remain in the post-preprocessed program, and these changes are attempting to prevent that from happening, because simple_switch has no implementation of these fields.

I could delete that code entirely, but the reason I introduced a new macro was because I was thinking that perhaps someone somewhere might want to see the source code that accessed these old fields, and re-enable it.

If folks think that is not going to happen, I could simply delete the few dozen lines of code that are currently between such #ifdef / #endif pairs in the current proposed changes.

fields {
enq_timestamp : 48; // time snapshot taken when the packet
// is enqueued (in microsec).
enq_qdepth : 16; // queue depth at the packet enqueue
Copy link
Contributor

Choose a reason for hiding this comment

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

Well, if they are here or in intrinsic_metadata it's rather the same thing; they won't be handled correctly by the compiler if they are expected to have values when the pipeline starts. We still need to move them to stdandard_metadata in v1model.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, but at least this is the name of the metadata "header" that simple_switch documentation has said that these fields must be defined in a P4_14 program for several years now, here: https://github.com/p4lang/behavioral-model/blob/master/docs/simple_switch.md

Copy link
Contributor Author

@jafingerhut jafingerhut Apr 12, 2019

Choose a reason for hiding this comment

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

Also, these fields are initialized by simple_switch today.

EDIT: I mean, they are if they have the expected correct names in the BMv2 JSON file, which they do not today because of the related PR #1704 or something similarly effective goes through, and a similar change is made for queueing_metadata, then simple_switch initializes these fields correctly today.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but the way the P4-14 to P4-16 translates this struct will not enable it to use the simple_switch values. We essentially need to put these fields in standard_metadata and make the translator refer to them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The simple_switch documentation about queueing_metadata is the reason I asked about it in this comment earlier: #1704 (comment)

You replied you had no example programs that used queueing_metadata: #1704 (comment)

I just did some grep'ing through the code and found this test program that uses queueing_metadata, that was committed to the code in 2016 and hasn't been modified since then: https://github.com/p4lang/p4c/blob/master/testdata/p4_14_samples/queueing.p4

Please let me know if there is something you would like changed in this PR, though. I am fine with whatever on this P4_14 intrinsic_metadata and queueing_metadata stuff. It has been documented for years as working this way, then broken some time around Nov 2018. Just looking for a path to getting back to working here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By the way, if part of the path to getting things working is to change documentation that has been the same for a couple of years, I have no problem with that, either. Just nice if the documentation and implementation are consistent with each other, is all.

@jafingerhut jafingerhut requested a review from cc10512 April 15, 2019 22:15
Copy link
Contributor

@cc10512 cc10512 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 7b844d4 into p4lang:master Apr 16, 2019
peteli3 pushed a commit to peteli3/p4c that referenced this pull request Jun 6, 2019
Removed ucast_egress_port
Only occured in in this one test program: p4_14_samples/sai_p4.p4

Replaced occurrences of ingress_global_tstamp with current
intrinsic_metadata.ingress_global_timestamp

Replaced occurrences of enq_tstamp with current
queueing_metadata.enq_timestamp

Removed occurrences of enq_congest_stat and deq_congest_stat, which
were defined in the two old switch.p4 versions, but never used.

mcast_hash in the two old switch.p4 test programs.  There is nothing
in current v1model.p4 to replace them with, but seems best to not
simply delete their few occurrences from switch.p4 source programs.

Deleted occurences of mcast_hash from P4_14 programs that simply
defined it, but never used it.

Deleted all occurrences of intrinsic_metadata struct from P4_16 test
programs that include v1model.p4, since all of those fields are
defined in struct standard_metadata_t now.
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