Skip to content

Commit

Permalink
fully remove the table name annotation parsing logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
r12f committed Dec 12, 2023
1 parent e543ea4 commit 1105d4a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
19 changes: 7 additions & 12 deletions dash-pipeline/SAI/sai_api_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def parse_p4rt(self, p4rt_table_action, sai_enums):
]
}
'''
#print("Parsing table action: " + self.name)
# print("Parsing table action: " + self.name)
_, self.name, _ = self.parse_sai_annotated_name(self.name)
self.parse_action_params(p4rt_table_action, sai_enums)

Expand Down Expand Up @@ -523,7 +523,7 @@ def parse_p4rt(self, p4rt_table_action_param, sai_enums, ip_is_v6_param_ids):
self.id = p4rt_table_action_param['id']
self.name = p4rt_table_action_param[NAME_TAG]
self.bitwidth = p4rt_table_action_param[BITWIDTH_TAG]
print("Parsing table action param: " + self.name)
# print("Parsing table action param: " + self.name)

if STRUCTURED_ANNOTATIONS_TAG in p4rt_table_action_param:
self._parse_sai_object_annotation(p4rt_table_action_param)
Expand Down Expand Up @@ -592,21 +592,16 @@ def parse_p4rt(self, p4rt_table, program, all_actions, ignore_tables):
"size": "1024"
}
'''

# The first part of full name is the top level control block name, which is removed for showing better comments as stage.
self.stage, self.name, self.api_name = self.parse_sai_annotated_name(self.name, full_name_part_start = 1)
self.stage = self.stage.replace('.', '_')
if "stage" not in self.stage:
self.stage = None
self.__parse_sai_table_annotations(p4rt_table[PREAMBLE_TAG])

# If tables are specified as ignored via CLI or annotations, skip them.
if self.name in ignore_tables:
self.ignored = True
return
elif self.ignored:
ignore_tables.append(self.name)

self.__parse_sai_table_annotations(p4rt_table[PREAMBLE_TAG])
if self.ignored:
ignore_tables.append(self.name)
print("Ignoring table: " + self.name)
return

print("Parsing table: " + self.name)
Expand Down Expand Up @@ -634,7 +629,7 @@ def __parse_sai_table_annotations(self, p4rt_table_preamble):
for kv in anno[KV_PAIR_LIST_TAG][KV_PAIRS_TAG]:
if kv['key'] == 'isobject':
self.is_object = kv['value']['stringValue']
if kv['key'] == 'ignoretable':
if kv['key'] == 'ignored':
self.ignored = True
if kv['key'] == 'name':
self.name = kv['value']['stringValue']
Expand Down
2 changes: 1 addition & 1 deletion dash-pipeline/bmv2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ Available tags are:
- `api_order`: Specify the order of the generated API in the SAI API header file. When multiple tables generates API entries in the same API set, e.g., acl group and acl rules. This explicit attribute helps us keep the order of the generated APIs to keep ABI compatibility.
- `stage`: Specify which stage this table represents for the matching stage type, e.g. `acl.stage1`.
- `isobject`: When set to "true", a top level objects in SAI that attached to switch will be generated. Otherwise, a new type of entry will be generated, if nothing else helps us to determine this table is an object table.
- `ignoretable`: When set to "true", we skip this table in SAI API generation.
- `ignored`: When set to "true", we skip this table in SAI API generation.

For more details, please check the SAI API generation script: [sai_api_gen.py](../SAI/sai_api_gen.py).
2 changes: 2 additions & 0 deletions dash-pipeline/bmv2/dash_pipeline.p4
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ control dash_ingress(
}

/* This table API should be implemented manually using underlay SAI */
@SaiTable[ignored = "true"]
table appliance {
key = {
meta.appliance_id : ternary @name("meta.appliance_id:appliance_id");
Expand Down Expand Up @@ -185,6 +186,7 @@ control dash_ingress(
#endif // DPDK_SUPPORTS_DIRECT_COUNTER_ON_WILDCARD_KEY_TABLE
#endif // TARGET_DPDK_PNA

@SaiTable[ignored = "true"]
table eni_meter {
key = {
meta.eni_id : exact @name("meta.eni_id:eni_id");
Expand Down

0 comments on commit 1105d4a

Please sign in to comment.