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

Hostif Trap for route to interface (subnet route) #2037

Open
rck-innovium opened this issue Jun 27, 2024 · 1 comment · May be fixed by #2066
Open

Hostif Trap for route to interface (subnet route) #2037

rck-innovium opened this issue Jun 27, 2024 · 1 comment · May be fixed by #2066

Comments

@rck-innovium
Copy link
Contributor

rck-innovium commented Jun 27, 2024

Problem statement

There are cases where routes trap packets to CPU other than IP2ME routes.
Defining a trap type allows the SAI application to:

  1. decide the packet action (drop/trap)
  2. rate limit by attaching a policer to the trap group
  3. 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:

  1. 10.1.1.1/32 to CPU using SAI_HOSTIF_TRAP_TYPE_IP2ME,
  2. 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.
  3. 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?

  1. 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,
  1. 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.

@rck-innovium rck-innovium changed the title Hostif Trap for route to interface, and route's with no ARP Hostif Trap for route to interface (subnet route) Aug 13, 2024
rck-innovium added a commit to rck-innovium/SAI that referenced this issue Aug 13, 2024
@rck-innovium rck-innovium linked a pull request Aug 13, 2024 that will close this issue
rck-innovium added a commit to rck-innovium/SAI that referenced this issue Aug 15, 2024
rck-innovium added a commit to rck-innovium/SAI that referenced this issue Aug 15, 2024
@AdityaSkhorne
Copy link

Thanks for raising this issue. I agree that the current SAI trap types are insufficient for handling subnet routes, particularly when packets need to be trapped to the CPU.

Summary of the Issue:
Current Limitation: The SAI_HOSTIF_TRAP_TYPE_IP2ME trap type doesn’t cover packets matched by subnet routes.
Impact: Without a specific trap type for subnet routes, it's challenging to control packet actions (e.g., drop/trap) and implement rate limiting effectively.

Proposed Solution:
New Trap Type: Introducing SAI_HOSTIF_TRAP_TYPE_IP2SUBNET will allow better management of packets that match subnet routes with next-hop pointing to a router interface.
Benefits: This new type will enable the SAI application to:
Decide the packet action (drop/trap).
Apply rate limiting by attaching a policer.
Select the CPU queue via the trap group.

Next Steps:
Define SAI_HOSTIF_TRAP_TYPE_IP2SUBNET in the SAI specification to cover the described use cases.
Update Documentation: Ensure that the comments and documentation for SAI_HOSTIF_USER_DEFINED_TRAP_TYPE_NEIGHBOR are updated to clarify its limitations and the need for the new trap type.

This addition will greatly enhance the flexibility and control over packet handling in scenarios involving subnet routes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants