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 a6dbc76
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion doc/SAI-Proposal-VlanStack-QinQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ If set the outer to 10 and set the inner to 0, it means finding the packet which
If set the outer to 0 and set the inner to 10, it means finding the packet which has double tag and its inner tag VID=10.
If set the outer to 10 and set the inner to 20, it means finding the packet which has double tag and its outer VID=10 (SVID), inner VID=20 (CVID).

The data type also used to provide the new dot1q header setting after the vlan stacking rule by the attribute, SAI_VLAN_STACK_ATTR_APPLIED_VLAN_ID.
The data type will also be used to provide the new dot1q header setting after the vlan stacking rule by the attribute, SAI_VLAN_STACK_ATTR_APPLIED_VLAN_ID.
If the action is PUSH, the value of the "outer" will be used to create an outer dot1q header on the packet.
If the action is SWAP, the original dot1q header will be replaced with "outer", "inner" or both. Depends on the attribute setting.

Expand Down
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 a6dbc76

Please sign in to comment.