From 5254200bf1198ca62662919c0475e838e49215d7 Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Wed, 7 Jul 2021 15:26:16 +0200 Subject: [PATCH] [meta] Skip objects on (de)serialize acl field data mask (#1273) (#1275) 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. --- meta/serialize.pm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/meta/serialize.pm b/meta/serialize.pm index e4481b51f..18330ef88 100644 --- a/meta/serialize.pm +++ b/meta/serialize.pm @@ -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; @@ -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) @@ -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)