Skip to content

Commit

Permalink
[meta] Skip objects on (de)serialize acl field data mask (#1273) (#1275)
Browse files Browse the repository at this point in the history
Mask is special, since it's combined with field data, but there is not field corresponded to object or object list so we can skip, them in serialize and deserialize.

Cherry pick commit from master to v1.8.1 branch. No headers changes, only introduce new metadata features.
  • Loading branch information
kcudnik committed Jul 7, 2021
1 parent bf36303 commit 5254200
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions meta/serialize.pm
Expand Up @@ -455,6 +455,22 @@ sub EmitSerializeHeader
WriteSource "EMIT(\"{\");\n";
}

sub WriteSkipForMask
{
# mask is special, since it's combined with field data, but there
# is not field corresponded to object or object list so we can skip
# them in serialize and deserialize

WriteSource "else if (meta->attrvaluetype == SAI_ATTR_VALUE_TYPE_ACL_FIELD_DATA_OBJECT_ID)";
WriteSource "{";
WriteSource "/* skip */";
WriteSource "}";
WriteSource "else if (meta->attrvaluetype == SAI_ATTR_VALUE_TYPE_ACL_FIELD_DATA_OBJECT_LIST)";
WriteSource "{";
WriteSource "/* skip */";
WriteSource "}";
}

sub EmitSerializeFooter
{
my $refStructInfoEx = shift;
Expand All @@ -463,6 +479,8 @@ sub EmitSerializeFooter
{
my $name = $refStructInfoEx->{name};

WriteSkipForMask() if $name eq "sai_acl_field_data_mask_t";

# NOTE: if it's union, we must check if we serialized something
# (not always true for acl mask)

Expand Down Expand Up @@ -1061,6 +1079,8 @@ sub EmitDeserializeFooter
{
my $name = $refStructInfoEx->{name};

WriteSkipForMask() if $name eq "sai_acl_field_data_mask_t";

# if it's union, we must check if we serialized something
# (not always true for acl mask)

Expand Down

0 comments on commit 5254200

Please sign in to comment.