Skip to content

Commit

Permalink
ternary masks
Browse files Browse the repository at this point in the history
  • Loading branch information
r12f committed Jun 2, 2024
1 parent 6783189 commit 8336bdf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
15 changes: 14 additions & 1 deletion dash-pipeline/SAI/specs/dash_meter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,20 @@ sai_apis:
allow_null: false
valid_only: null
is_vlan: false
deprecated: false
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_METER_RULE_ATTR_DIP_MASK
description: Ternary matched key dip mask
type: sai_ip_address_t
attr_value_field: ipaddr
default: null
isresourcetype: false
flags: MANDATORY_ON_CREATE | CREATE_ONLY
object_name: null
allow_null: false
valid_only: null
is_vlan: false
deprecated: false
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_METER_RULE_ATTR_METER_CLASS
description: Action parameter meter class
Expand Down Expand Up @@ -172,7 +186,6 @@ sai_apis:
valid_only: null
deprecated: false
is_vlan: false
deprecated: false
stats: []
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
tables:
Expand Down
14 changes: 14 additions & 0 deletions dash-pipeline/SAI/utils/dash_p4/dash_p4_table_attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,20 @@ def to_sai_attribute(self, table_name: str, create_only: bool = False) -> List[S
)
]

if self.match_type == "ternary":
attributes.append(SaiAttribute(
name = f"{name}_MASK",
description = f"{description} mask",
type = self.type,
attr_value_field = self.field,
default = None,
isresourcetype = self.isresourcetype == "true",
flags = sai_flags,
object_name = object_name,
allow_null = allow_null,
valid_only = self.validonly,
))

return attributes

def get_sai_name(self, table_name: str) -> str:
Expand Down

0 comments on commit 8336bdf

Please sign in to comment.