{"action":"created","comment":{"url":"https://api.github.com/repos/p4lang/p4c/pulls/comments/115133533","pull_request_review_id":36656359,"id":115133533,"diff_hunk":"@@ -0,0 +1,675 @@\n+/*\n+Copyright 2013-present Barefoot Networks, Inc.\n+\n+Licensed under the Apache License, Version 2.0 (the \"License\");\n+you may not use this file except in compliance with the License.\n+You may obtain a copy of the License at\n+\n+    http://www.apache.org/licenses/LICENSE-2.0\n+\n+Unless required by applicable law or agreed to in writing, software\n+distributed under the License is distributed on an \"AS IS\" BASIS,\n+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+See the License for the specific language governing permissions and\n+limitations under the License.\n+*/\n+\n+#ifndef _PORTABLE_SWITCH_ARCHITECTURE_P4_\n+#define _PORTABLE_SWITCH_ARCHITECTURE_P4_\n+\n+/**\n+ *   P4-16 declaration of the Portable Switch Architecture\n+ */\n+\n+/**\n+ * These types need to be defined before including the architecture file\n+ * and the macro protecting them should be defined.\n+ */\n+#ifndef PSA_CORE_TYPES\n+#error \"Please define the following types for PSA and the PSA_CORE_TYPES macro\"\n+typedef bit<unspecified> PortId_t;\n+const   PortId_t         PORT_CPU = unspecified;\n+\n+typedef bit<unspecified> MulticastGroup_t;\n+typedef bit<unspecified> PacketLength_t;\n+typedef bit<unspecified> EgressInstance_t;\n+typedef bit<unspecified> ParserStatus_t;\n+typedef bit<unspecified> ParserErrorLocation_t;\n+typedef bit<unspecified> entry_key;           /// for DirectCounters\n+\n+// typedef bit<unspecified> InstanceType_t;\n+// const   InstanceType_t   INSTANCE_NORMAL = unspecified;\n+#endif\n+\n+#include \"core.p4\"\n+\n+/* --------------------------------------------------------------------- *\n+/**\n+ * PSA supported metadata types\n+ */\n+typedef enum { NORMALINSTANCE_, CLONE_INSTANCE } InstanceType_t;\n+\n+struct psa_parser_input_metadata_t {\n+  PortId_t                 ingress_port;\n+  InstanceType_t           instance_type;\n+}\n+\n+struct psa_ingress_input_metadata_t {\n+  PortId_t                 ingress_port;\n+  InstanceType_t           instance_type;  /// Clone or Normal\n+  /// set by the runtime in the parser, these are not under programmer control\n+  ParserStatus_t           parser_status;\n+  ParserErrorLocation_t    parser_error_location;\n+}\n+\n+struct psa_ingress_output_metadata_t {\n+  PortId_t                 egress_port;\n+}\n+\n+struct psa_egress_input_metadata_t {\n+  PortId_t                 egress_port;\n+  InstanceType_t           instance_type;  /// Clone or Normal\n+  EgressInstance_t         instance;       /// instance coming from PRE\n+}\n+\n+/* --------------------------------------------------------------------- */\n+/**\n+ * Additional supported match_kind types\n+ */\n+match_kind {\n+    range,   /// Used to represent min..max intervals\n+    selector /// Used for implementing dynamic_action_selection\n+}\n+\n+/* --------------------------------------------------------------------- */\n+/**\n+ *  Cloning methods\n+ */\n+enum CloneMethod_t {\n+  /// Clone method         Packet source             Insertion point\n+  Ingress2Ingress,  /// original ingress,            Ingress parser\n+  Ingres2Egress,    /// post parse original ingres,  Buffering queue\n+  Egress2Ingress,   /// post deparse in egress,      Ingress parser\n+  Egress2Egress     /// inout to deparser in egress, Buffering queue\n+}\n+\n+/* --------------------------------------------------------------------- */\n+/*\n+ * PSA Externs\n+ */\n+\n+/**\n+ * The PacketReplicationEngine extern represents the non-programmable\n+ * part of the PSA pipeline.\n+ *\n+ * Even though the PRE can not be programmed using P4, it can be\n+ * configured both directly using control plane APIs and by setting\n+ * intrinsic metadata. In this specification we opt to define the\n+ * operations available in the PRE as method invocations. A target\n+ * backend is responsible for mapping the PRE extern APIs to the\n+ * appropriate mechanisms for performing these operations in the\n+ * hardware.\n+ *\n+ * The PRE is instantiated by the architecture and a P4 program can\n+ * use it directly. It is an error to instantiate the PRE multiple\n+ * times.  The PRE is made available to the Ingress programmable block\n+ * using the same mechanism as packet_in. A corresponding Buffering\n+ * and Queueing Engine (BQE) extern is defined for the Egress\n+ * pipeline (@see BufferingQueueingEngine).\n+ *\n+ * Note: some of these operations may not be implemented as primitive\n+ * operations on a certain target. However, All of the operations can\n+ * be implemented as a combination of other operations. Applications\n+ * that rely on non-primitive operations may incur significant\n+ * performance penalties, however, they should be functionally\n+ * correct.\n+ *\n+ * Semantics of behavior for multiple calls to PRE APIs\n+ *\n+ * The semantics of calling the PRE APIs is equivalent to setting\n+ * intrinsic metadata fields/bits and assumming that the PRE looks up\n+ * the fields in the following order: drop, truncate, multicast,\n+ * clone, output_port.","path":"p4include/psa.p4","position":128,"original_position":132,"commit_id":"d032a7043df975041d7e7f07b7414eca45b87ef1","original_commit_id":"f67444cf3533e23b70effec8b51693eb1cbd9b05","user":{"login":"jafingerhut","id":109629,"avatar_url":"https://avatars1.githubusercontent.com/u/109629?v=3","gravatar_id":"","url":"https://api.github.com/users/jafingerhut","html_url":"https://github.com/jafingerhut","followers_url":"https://api.github.com/users/jafingerhut/followers","following_url":"https://api.github.com/users/jafingerhut/following{/other_user}","gists_url":"https://api.github.com/users/jafingerhut/gists{/gist_id}","starred_url":"https://api.github.com/users/jafingerhut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jafingerhut/subscriptions","organizations_url":"https://api.github.com/users/jafingerhut/orgs","repos_url":"https://api.github.com/users/jafingerhut/repos","events_url":"https://api.github.com/users/jafingerhut/events{/privacy}","received_events_url":"https://api.github.com/users/jafingerhut/received_events","type":"User","site_admin":false},"body":"I think my comment was more basic than that.  The names drop, truncate, multicast, and clone are all names of methods in the PRE object.  The only one that is _not_ is output_port, which is the name of the argument for the method set_output_port.  Is there a good reason to make that name a different kind of name than the others in the list?","created_at":"2017-05-07T03:39:05Z","updated_at":"2017-05-07T03:39:05Z","html_url":"https://github.com/p4lang/p4c/pull/569#discussion_r115133533","pull_request_url":"https://api.github.com/repos/p4lang/p4c/pulls/569","_links":{"self":{"href":"https://api.github.com/repos/p4lang/p4c/pulls/comments/115133533"},"html":{"href":"https://github.com/p4lang/p4c/pull/569#discussion_r115133533"},"pull_request":{"href":"https://api.github.com/repos/p4lang/p4c/pulls/569"}}},"pull_request":{"url":"https://api.github.com/repos/p4lang/p4c/pulls/569","id":119242613,"html_url":"https://github.com/p4lang/p4c/pull/569","diff_url":"https://github.com/p4lang/p4c/pull/569.diff","patch_url":"https://github.com/p4lang/p4c/pull/569.patch","issue_url":"https://api.github.com/repos/p4lang/p4c/issues/569","number":569,"state":"open","locked":false,"title":"[do not merge] PSA definition","user":{"login":"cc10512","id":3770874,"avatar_url":"https://avatars2.githubusercontent.com/u/3770874?v=3","gravatar_id":"","url":"https://api.github.com/users/cc10512","html_url":"https://github.com/cc10512","followers_url":"https://api.github.com/users/cc10512/followers","following_url":"https://api.github.com/users/cc10512/following{/other_user}","gists_url":"https://api.github.com/users/cc10512/gists{/gist_id}","starred_url":"https://api.github.com/users/cc10512/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cc10512/subscriptions","organizations_url":"https://api.github.com/users/cc10512/orgs","repos_url":"https://api.github.com/users/cc10512/repos","events_url":"https://api.github.com/users/cc10512/events{/privacy}","received_events_url":"https://api.github.com/users/cc10512/received_events","type":"User","site_admin":false},"body":"I'm providing this PR so that people can review the PSA definition as it stands today. I incorporated feedback from @hanw, @antoninbas, @ChrisDodd, @vgurevich, @mbudiu-vmw, and @jafingerhut. There are still a number of TODOs marked in this file. I would like to use this PR as the means to collect more feedback and provide a forum for the discussion that will allow us to finalize the PSA spec. Please share your thoughts.","created_at":"2017-05-05T19:26:51Z","updated_at":"2017-05-07T03:39:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f2363da720fdd890d1be61b00945c0d5d95cd9a1","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/p4lang/p4c/pulls/569/commits","review_comments_url":"https://api.github.com/repos/p4lang/p4c/pulls/569/comments","review_comment_url":"https://api.github.com/repos/p4lang/p4c/pulls/comments{/number}","comments_url":"https://api.github.com/repos/p4lang/p4c/issues/569/comments","statuses_url":"https://api.github.com/repos/p4lang/p4c/statuses/d032a7043df975041d7e7f07b7414eca45b87ef1","head":{"label":"cc10512:cc/psa","ref":"cc/psa","sha":"d032a7043df975041d7e7f07b7414eca45b87ef1","user":{"login":"cc10512","id":3770874,"avatar_url":"https://avatars2.githubusercontent.com/u/3770874?v=3","gravatar_id":"","url":"https://api.github.com/users/cc10512","html_url":"https://github.com/cc10512","followers_url":"https://api.github.com/users/cc10512/followers","following_url":"https://api.github.com/users/cc10512/following{/other_user}","gists_url":"https://api.github.com/users/cc10512/gists{/gist_id}","starred_url":"https://api.github.com/users/cc10512/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cc10512/subscriptions","organizations_url":"https://api.github.com/users/cc10512/orgs","repos_url":"https://api.github.com/users/cc10512/repos","events_url":"https://api.github.com/users/cc10512/events{/privacy}","received_events_url":"https://api.github.com/users/cc10512/received_events","type":"User","site_admin":false},"repo":{"id":82749819,"name":"p4c","full_name":"cc10512/p4c","owner":{"login":"cc10512","id":3770874,"avatar_url":"https://avatars2.githubusercontent.com/u/3770874?v=3","gravatar_id":"","url":"https://api.github.com/users/cc10512","html_url":"https://github.com/cc10512","followers_url":"https://api.github.com/users/cc10512/followers","following_url":"https://api.github.com/users/cc10512/following{/other_user}","gists_url":"https://api.github.com/users/cc10512/gists{/gist_id}","starred_url":"https://api.github.com/users/cc10512/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cc10512/subscriptions","organizations_url":"https://api.github.com/users/cc10512/orgs","repos_url":"https://api.github.com/users/cc10512/repos","events_url":"https://api.github.com/users/cc10512/events{/privacy}","received_events_url":"https://api.github.com/users/cc10512/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cc10512/p4c","description":"P4_16 prototype compiler","fork":true,"url":"https://api.github.com/repos/cc10512/p4c","forks_url":"https://api.github.com/repos/cc10512/p4c/forks","keys_url":"https://api.github.com/repos/cc10512/p4c/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cc10512/p4c/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cc10512/p4c/teams","hooks_url":"https://api.github.com/repos/cc10512/p4c/hooks","issue_events_url":"https://api.github.com/repos/cc10512/p4c/issues/events{/number}","events_url":"https://api.github.com/repos/cc10512/p4c/events","assignees_url":"https://api.github.com/repos/cc10512/p4c/assignees{/user}","branches_url":"https://api.github.com/repos/cc10512/p4c/branches{/branch}","tags_url":"https://api.github.com/repos/cc10512/p4c/tags","blobs_url":"https://api.github.com/repos/cc10512/p4c/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cc10512/p4c/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cc10512/p4c/git/refs{/sha}","trees_url":"https://api.github.com/repos/cc10512/p4c/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cc10512/p4c/statuses/{sha}","languages_url":"https://api.github.com/repos/cc10512/p4c/languages","stargazers_url":"https://api.github.com/repos/cc10512/p4c/stargazers","contributors_url":"https://api.github.com/repos/cc10512/p4c/contributors","subscribers_url":"https://api.github.com/repos/cc10512/p4c/subscribers","subscription_url":"https://api.github.com/repos/cc10512/p4c/subscription","commits_url":"https://api.github.com/repos/cc10512/p4c/commits{/sha}","git_commits_url":"https://api.github.com/repos/cc10512/p4c/git/commits{/sha}","comments_url":"https://api.github.com/repos/cc10512/p4c/comments{/number}","issue_comment_url":"https://api.github.com/repos/cc10512/p4c/issues/comments{/number}","contents_url":"https://api.github.com/repos/cc10512/p4c/contents/{+path}","compare_url":"https://api.github.com/repos/cc10512/p4c/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cc10512/p4c/merges","archive_url":"https://api.github.com/repos/cc10512/p4c/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cc10512/p4c/downloads","issues_url":"https://api.github.com/repos/cc10512/p4c/issues{/number}","pulls_url":"https://api.github.com/repos/cc10512/p4c/pulls{/number}","milestones_url":"https://api.github.com/repos/cc10512/p4c/milestones{/number}","notifications_url":"https://api.github.com/repos/cc10512/p4c/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cc10512/p4c/labels{/name}","releases_url":"https://api.github.com/repos/cc10512/p4c/releases{/id}","deployments_url":"https://api.github.com/repos/cc10512/p4c/deployments","created_at":"2017-02-22T02:12:23Z","updated_at":"2017-02-22T02:12:32Z","pushed_at":"2017-05-06T20:28:17Z","git_url":"git://github.com/cc10512/p4c.git","ssh_url":"git@github.com:cc10512/p4c.git","clone_url":"https://github.com/cc10512/p4c.git","svn_url":"https://github.com/cc10512/p4c","homepage":"","size":21829,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"p4lang:master","ref":"master","sha":"53eaa27c3ba6b174bac90a777fb889b240aa04f4","user":{"login":"p4lang","id":10765181,"avatar_url":"https://avatars2.githubusercontent.com/u/10765181?v=3","gravatar_id":"","url":"https://api.github.com/users/p4lang","html_url":"https://github.com/p4lang","followers_url":"https://api.github.com/users/p4lang/followers","following_url":"https://api.github.com/users/p4lang/following{/other_user}","gists_url":"https://api.github.com/users/p4lang/gists{/gist_id}","starred_url":"https://api.github.com/users/p4lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/p4lang/subscriptions","organizations_url":"https://api.github.com/users/p4lang/orgs","repos_url":"https://api.github.com/users/p4lang/repos","events_url":"https://api.github.com/users/p4lang/events{/privacy}","received_events_url":"https://api.github.com/users/p4lang/received_events","type":"Organization","site_admin":false},"repo":{"id":55433859,"name":"p4c","full_name":"p4lang/p4c","owner":{"login":"p4lang","id":10765181,"avatar_url":"https://avatars2.githubusercontent.com/u/10765181?v=3","gravatar_id":"","url":"https://api.github.com/users/p4lang","html_url":"https://github.com/p4lang","followers_url":"https://api.github.com/users/p4lang/followers","following_url":"https://api.github.com/users/p4lang/following{/other_user}","gists_url":"https://api.github.com/users/p4lang/gists{/gist_id}","starred_url":"https://api.github.com/users/p4lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/p4lang/subscriptions","organizations_url":"https://api.github.com/users/p4lang/orgs","repos_url":"https://api.github.com/users/p4lang/repos","events_url":"https://api.github.com/users/p4lang/events{/privacy}","received_events_url":"https://api.github.com/users/p4lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/p4lang/p4c","description":"P4_16 prototype compiler","fork":false,"url":"https://api.github.com/repos/p4lang/p4c","forks_url":"https://api.github.com/repos/p4lang/p4c/forks","keys_url":"https://api.github.com/repos/p4lang/p4c/keys{/key_id}","collaborators_url":"https://api.github.com/repos/p4lang/p4c/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/p4lang/p4c/teams","hooks_url":"https://api.github.com/repos/p4lang/p4c/hooks","issue_events_url":"https://api.github.com/repos/p4lang/p4c/issues/events{/number}","events_url":"https://api.github.com/repos/p4lang/p4c/events","assignees_url":"https://api.github.com/repos/p4lang/p4c/assignees{/user}","branches_url":"https://api.github.com/repos/p4lang/p4c/branches{/branch}","tags_url":"https://api.github.com/repos/p4lang/p4c/tags","blobs_url":"https://api.github.com/repos/p4lang/p4c/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/p4lang/p4c/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/p4lang/p4c/git/refs{/sha}","trees_url":"https://api.github.com/repos/p4lang/p4c/git/trees{/sha}","statuses_url":"https://api.github.com/repos/p4lang/p4c/statuses/{sha}","languages_url":"https://api.github.com/repos/p4lang/p4c/languages","stargazers_url":"https://api.github.com/repos/p4lang/p4c/stargazers","contributors_url":"https://api.github.com/repos/p4lang/p4c/contributors","subscribers_url":"https://api.github.com/repos/p4lang/p4c/subscribers","subscription_url":"https://api.github.com/repos/p4lang/p4c/subscription","commits_url":"https://api.github.com/repos/p4lang/p4c/commits{/sha}","git_commits_url":"https://api.github.com/repos/p4lang/p4c/git/commits{/sha}","comments_url":"https://api.github.com/repos/p4lang/p4c/comments{/number}","issue_comment_url":"https://api.github.com/repos/p4lang/p4c/issues/comments{/number}","contents_url":"https://api.github.com/repos/p4lang/p4c/contents/{+path}","compare_url":"https://api.github.com/repos/p4lang/p4c/compare/{base}...{head}","merges_url":"https://api.github.com/repos/p4lang/p4c/merges","archive_url":"https://api.github.com/repos/p4lang/p4c/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/p4lang/p4c/downloads","issues_url":"https://api.github.com/repos/p4lang/p4c/issues{/number}","pulls_url":"https://api.github.com/repos/p4lang/p4c/pulls{/number}","milestones_url":"https://api.github.com/repos/p4lang/p4c/milestones{/number}","notifications_url":"https://api.github.com/repos/p4lang/p4c/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/p4lang/p4c/labels{/name}","releases_url":"https://api.github.com/repos/p4lang/p4c/releases{/id}","deployments_url":"https://api.github.com/repos/p4lang/p4c/deployments","created_at":"2016-04-04T18:12:32Z","updated_at":"2017-05-03T12:36:03Z","pushed_at":"2017-05-06T20:28:19Z","git_url":"git://github.com/p4lang/p4c.git","ssh_url":"git@github.com:p4lang/p4c.git","clone_url":"https://github.com/p4lang/p4c.git","svn_url":"https://github.com/p4lang/p4c","homepage":"","size":55985,"stargazers_count":28,"watchers_count":28,"language":"P4","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":24,"mirror_url":null,"open_issues_count":65,"forks":24,"open_issues":65,"watchers":28,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/p4lang/p4c/pulls/569"},"html":{"href":"https://github.com/p4lang/p4c/pull/569"},"issue":{"href":"https://api.github.com/repos/p4lang/p4c/issues/569"},"comments":{"href":"https://api.github.com/repos/p4lang/p4c/issues/569/comments"},"review_comments":{"href":"https://api.github.com/repos/p4lang/p4c/pulls/569/comments"},"review_comment":{"href":"https://api.github.com/repos/p4lang/p4c/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/p4lang/p4c/pulls/569/commits"},"statuses":{"href":"https://api.github.com/repos/p4lang/p4c/statuses/d032a7043df975041d7e7f07b7414eca45b87ef1"}}}}
{"actor":{"display_login":"jafingerhut"}}