Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow SAI_ROUTE_ATTR_NEXT_HOP_ID point to SAI_NULL_OBJECT_ID by default #253

Merged
merged 2 commits into from
Oct 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion inc/sairoute.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,23 @@ typedef enum _sai_route_entry_attr_t
* @brief Next hop or next hop group id for the packet, or a router interface
* in case of directly reachable route, or the CPU port in case of IP2ME route
*
* The next hop id is only effective when the packet action is one of the following:
* FORWARD, COPY, LOG, TRANSIT
*
* The next hop id can be a generic next hop object, such as next hop, next
* hop group. Directly reachable routes are the IP subnets that are
* directly attached to the router. For such routes, fill the router
* interface id to which the subnet is attached. IP2ME route adds a local
* router IP address. For such routes, fill the CPU port
* (#SAI_SWITCH_ATTR_CPU_PORT).
*
* When it is SAI_NULL_OBJECT_ID, then packet will be dropped.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm the understanding that NULL_OBJECT_ID can be set when packet action is set to TRAP before and the packet action will take precedence in that case. In other words, the packet will be dropped when packet action is one of the following: FORWARD, COPY, LOG, TRANSIT as mentioned in the comments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is the understanding. packet action will take precedence.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or its just cancel forward copy. So for LOG and COPY we still get a copy.

*
* @type sai_object_id_t
* @objects SAI_OBJECT_TYPE_NEXT_HOP, SAI_OBJECT_TYPE_NEXT_HOP_GROUP, SAI_OBJECT_TYPE_ROUTER_INTERFACE, SAI_OBJECT_TYPE_PORT
* @flags MANDATORY_ON_CREATE | CREATE_AND_SET
* @default SAI_NULL_OBJECT_ID
* @flags CREATE_AND_SET
* @allownull true
*/
SAI_ROUTE_ENTRY_ATTR_NEXT_HOP_ID,

Expand Down
6 changes: 6 additions & 0 deletions meta/parse.pl
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,8 @@ sub ProcessDefaultValueType

return "SAI_DEFAULT_VALUE_TYPE_NONE" if not defined $default;

return "SAI_DEFAULT_VALUE_TYPE_CONST" if $default =~ /^SAI_NULL_OBJECT_ID$/;

return "SAI_DEFAULT_VALUE_TYPE_CONST" if $default =~ /^(true|false|const|\d+|SAI_\w+)$/ and not $default =~ /_ATTR_|SAI_OBJECT_TYPE_/;

return "SAI_DEFAULT_VALUE_TYPE_INHERIT" if $default =~ /^inherit SAI_\w+$/ and $default =~ /_ATTR_/;
Expand Down Expand Up @@ -902,6 +904,10 @@ sub ProcessDefaultValue
{
WriteSource "$val = { .booldata = $default };";
}
elsif ($default =~ /^SAI_NULL_OBJECT_ID$/ and $type =~ /^sai_object_id_t$/)
{
WriteSource "$val = { .oid = $default };";
}
elsif ($default =~ /^SAI_\w+$/ and $type =~ /^sai_\w+_t$/ and not defined $VALUE_TYPES{$type})
{
WriteSource "$val = { .s32 = $default };";
Expand Down