Skip to content

Commit

Permalink
Add vlan stacking default value check
Browse files Browse the repository at this point in the history
Signed-off-by: kuanyu_chen <kuanyu_chen@edge-core.com>
  • Loading branch information
kuanyu99 committed May 9, 2022
1 parent de456e5 commit 35c95b5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions inc/saivlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ typedef enum _sai_vlan_stack_attr_t
*
* @type sai_vlan_stacking_vid_t
* @flags CREATE_AND_SET
* @default 0,0
* @validonly SAI_VLAN_STACK_ATTR_ACTION == SAI_VLAN_STACK_ACTION_PUSH or SAI_VLAN_STACK_ATTR_ACTION == SAI_VLAN_STACK_ACTION_SWAP
*/
SAI_VLAN_STACK_ATTR_APPLIED_VLAN_ID,
Expand Down
8 changes: 8 additions & 0 deletions meta/parse.pl
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ sub ProcessTagDefault

return $val if $val eq "\"\"";

return $val if $val =~ /^0\,0$/;

LogError "invalid default tag value '$val' on $type $value";
return undef;
}
Expand Down Expand Up @@ -1569,6 +1571,8 @@ sub ProcessDefaultValueType

return "SAI_DEFAULT_VALUE_TYPE_CONST" if $default eq "\"\"";

return "SAI_DEFAULT_VALUE_TYPE_CONST" if $default =~ /^0\,0$/;

LogError "invalid default value type '$default' on $attr";

return "";
Expand Down Expand Up @@ -1640,6 +1644,10 @@ sub ProcessDefaultValue
{
WriteSource "$val = { .mac = { 0, 0, 0, 0, 0, 0 } };";
}
elsif ($default =~ /^0\,0$/ and $type =~ /^(sai_vlan_stacking_vid_t)/)
{
WriteSource "$val = { .$VALUE_TYPES{$1} = { .outer = 0, .inner = 0 } };";
}
else
{
LogError "invalid default value '$default' on $attr ($type)";
Expand Down
1 change: 1 addition & 0 deletions meta/saisanitycheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -2669,6 +2669,7 @@ void check_attr_is_primitive(
case SAI_ATTR_VALUE_TYPE_MACSEC_SALT:
case SAI_ATTR_VALUE_TYPE_SYSTEM_PORT_CONFIG:
case SAI_ATTR_VALUE_TYPE_FABRIC_PORT_REACHABILITY:
case SAI_ATTR_VALUE_TYPE_VLAN_STACKING_VID:

if (!md->isprimitive)
{
Expand Down

0 comments on commit 35c95b5

Please sign in to comment.