SAI
SAI copied to clipboard
Hostif Trap for route to interface (subnet route)
Problem statement
There are cases where routes trap packets to CPU other than IP2ME routes. Defining a trap type allows the SAI application to:
- decide the packet action (drop/trap)
- rate limit by attaching a policer to the trap group
- select the CPU queue via the trap group
Today, SAI has only defined a trap type for IP2ME packets (SAI_HOSTIF_TRAP_TYPE_IP2ME). The below scenarios need the route to point the packets to CPU but we do not have a trap type defined.
When an IP address and subnet, say 10.1.1.1/24 is on a RIF and a neighbor 10.1.1.2 is learnt, the following set of routes are needed:
- 10.1.1.1/32 to CPU using SAI_HOSTIF_TRAP_TYPE_IP2ME,
- 10.1.1.1/24 route : This route points to CPU when NOS wants hints to trigger ARP requests. Some NOS implementations can choose to blackhole this route. Today, SAI does not let the NOS control- whether this packets should be dropped or trapped, and more importantly when it is trapped it neither allows the user to rate-limit this traffic nor select the CPU queue.
- 10.1.1.2/32 route: to the learnt neighbor
Related SAI constructs:
SAI has a user defined trap instead of a regular trap defined for neighbor.
/**
* @brief Neighbor table traps
*
* Generated by neighbor table entry hit with action trap/log, or by neighbor table miss
*/
SAI_HOSTIF_USER_DEFINED_TRAP_TYPE_NEIGHBOR
Why this is not sufficient? A user defined trap by definition can be attached to only the objects of that type. So a user defined trap of type SAI_HOSTIF_USER_DEFINED_TRAP_TYPE_NEIGHBOR can be attached only to a Neighbor object and not to a nexthop/route object.
What is required?
- New Router trap type:
/**
* @brief Packets matching subnet routes with NH pointing to router interface
* (default packet action is trap)
*/
SAI_HOSTIF_TRAP_TYPE_IP2SUBNET = 0x00002015,
- Fix the comments in SAI_HOSTIF_USER_DEFINED_TRAP_TYPE_NEIGHBOR
Generated by neighbor table entry hit with action trap/log, or by neighbor table miss for a router interface that has SAI_ROUTER_INTERFACE_ATTR_NEIGHBOR_MISS_PACKET_ACTION set to trap.