Skip to content

CoPP Neighbor Miss Trap and Other Enhancements HLD #1943

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rminnikanti
Copy link

@rminnikanti rminnikanti commented Mar 7, 2025

HLD for CoPP Neighbor Miss Trap type support and Other CoPP Enhancements

What we did:

  • Added support for new Neighbor Miss trap type and its default CoPP configuration.
  • Introduced SAI enum capability query in orchagent to identify SAI neighbor miss trap support and publish the supported trap types to STATE_DB for application visibility
  • Introduced CoPP CLI support to display trap CoPP configuration and their status.

PRs:

Repository PR Title State Context
sonic-buildimage sonic-net/sonic-buildimage#22406 PR Status checks
sonic-swss sonic-net/sonic-swss#3624 PR Status checks
sonic-swss-common sonic-net/sonic-swss-common#1010 PR Status checks
sonic-sairedis sonic-net/sonic-sairedis#1586 PR Status checks
sonic-utilities sonic-net/sonic-utilities#3863 PR Status checks

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

linux-foundation-easycla bot commented Mar 7, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@prsunny
Copy link
Contributor

prsunny commented Mar 12, 2025

@prabhataravind , please review as this should cover subnet trap.

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

No pipelines are associated with this pull request.

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

No pipelines are associated with this pull request.

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

No pipelines are associated with this pull request.

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

No pipelines are associated with this pull request.


During initialization, Copporch in Orchagent will perform an SAI enum capability query to identify supported trap types and maintain them in a local list called `supported_trap_ids`.

Additionally, Copporch will maintain a list called `default_supported_trap_ids`, which contains currently supported trap IDs in copporch in orchagent. If the SAI does not support the enum capability query API, Copporch will assume that the `default_supported_trap_ids` are supported for backward compatibility.

Choose a reason for hiding this comment

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

the existing default_supported_trap_ids is vendor specific?

Copy link
Author

Choose a reason for hiding this comment

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

default_supported_trap_ids is not vendor specific. This will have all the enums that are currently known to Orchagent. New trap types like neighbor miss won't be part of this list.

Idea is to have backward compatibility with existing behavior if the SAI enum capability query for trap type attribute is not supported.

### 7.4 Schema Changes

State DB will have a new table called COPP_TRAP_CAPABILITY_TABLE which will have the supported trap types.
Introducing new value pair "oper_status" field in existing COPP_TRAP_TABLE, to track the operational status of the trap type.

Choose a reason for hiding this comment

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

What happens if there is any change happens in SAI capabilities (e..g firmware upgrade)? Will it trigger any daemon restart? how this list will be updated for such changes?

Copy link
Author

Choose a reason for hiding this comment

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

When syncd docker restarts, it triggers a restart of swss. During the initialization of CoppOrch, an enum capability query is performed. This occurs in both warmboot and coldboot scenarios. This process is similar to the flow in other Orch's, such as aclorch.cpp
Can you elaborate the use case?

"queue": "1",
"meter_type":"packets",
"mode":"sr_tcm",
"cir":"200",

Choose a reason for hiding this comment

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

How the cir, cbs, and red_action values are derived? These values might be strict for high-traffic environments causing unnecessary packet drops.

Copy link
Author

Choose a reason for hiding this comment

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

These values are posted by Microsoft in the SAI PR based on their internal tests:
opencomputeproject/SAI#2066 (comment)


An existing test case in the sonic-mgmt PTF framework tests VLAN subnet route traffic policing under the default CoPP configuration.

A new test case will be introduced to verify the neighbor miss trap configuration with its default settings in copp_cfg.json using VLAN subnet route traffic. This test case will also update/empty/NULL configuration for neighbor miss in CONFIG_DB to override the default settings and verify the operational status of neighbor miss in the CLI output accordingly.

Choose a reason for hiding this comment

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

can we add real-world ARP traffic stress tests ?

Copy link
Author

@rminnikanti rminnikanti Mar 25, 2025

Choose a reason for hiding this comment

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

Neighbor miss traffic does not police ARP traffic. It is to police IP traffic that is trapped to the CPU when the L3 lookup for ARP resolution has no entry for the neighbor. ARP traffic has a separate copp configuration in copp_cfg.json.

A new trap group queue1_group3 will be added to the default configuration with the following settings:

```json
"queue1_group3": {

Choose a reason for hiding this comment

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

Rationale behind using queue1_group3?
If queue1_group3 is congested, Neighbor Miss traffic may be dropped while other less critical packets get through.

### 10.1 Show Commands

A new CLI command, `show copp configuration`, is being introduced. The purpose of this command is to display the CoPP configuration applied to SAI. The command will retrieve configuration from copp_cfg.json and CONFIG_DB. Additionally, the command will display the operational status of the trap types retrieved from STATE_DB.

Choose a reason for hiding this comment

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

Can we measure the performance of this CLI in scale/stress environment? It is retrieving from multiple sources and it might take several seconds in large-scale switches.

Copy link
Author

Choose a reason for hiding this comment

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

At present, traps supported by Orchagent are 47 and total traps defined by SAI are only ~67.
Trap configurations are not expected to grow in large-scale networks.


## 11. Warmboot and Fastboot Design Impact

No warmboot and fastboot impact is expected for this feature.

Choose a reason for hiding this comment

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

how CoPP changes apply during warmboot?

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

No pipelines are associated with this pull request.

@dgsudharsan
Copy link
Contributor

Can you please test trap flow counters with this feature?

@zhangyanzhao zhangyanzhao moved this to 🏗 In Progress in SONiC 202505 Release Apr 1, 2025
rminnikanti added a commit to rminnikanti/sonic-swss that referenced this pull request Apr 22, 2025
What I did
* Added neighbor_miss trap type support
* enum capability query for hostif trap type
* Added trap hw_status field to state_db

HLD: sonic-net/SONiC#1943

Signed-off-by: Ravi Minnikanti <[email protected]>
rminnikanti added a commit to rminnikanti/sonic-utilities that referenced this pull request Apr 22, 2025
What I did:
CoPP show commands:
* show copp configuration
* show copp configuration detailed --trapid <trap_id>
* show copp configuration detailed --group <group>

Added UT for the CLI commands.

HLD: sonic-net/SONiC#1943

Signed-off-by: Ravi Minnikanti <[email protected]>
rminnikanti added a commit to rminnikanti/sonic-swss that referenced this pull request Apr 22, 2025
What I did
* Added neighbor_miss trap type support
* enum capability query for hostif trap type
* Added trap hw_status field to state_db

HLD: sonic-net/SONiC#1943

Signed-off-by: Ravi Minnikanti <[email protected]>
rminnikanti added a commit to rminnikanti/sonic-swss that referenced this pull request Apr 22, 2025
What I did
* Added neighbor_miss trap type support
* enum capability query for hostif trap type
* Added trap hw_status field to state_db

HLD: sonic-net/SONiC#1943

Signed-off-by: Ravi Minnikanti <[email protected]>
rminnikanti added a commit to rminnikanti/sonic-swss-common that referenced this pull request Apr 22, 2025
rminnikanti added a commit to rminnikanti/sonic-sairedis that referenced this pull request Apr 22, 2025
vslib support for SAI_OBJECT_TYPE_HOSTIF_TRAP,
attribute - SAI_HOSTIF_TRAP_ATTR_TRAP_TYPE

HLD: sonic-net/SONiC#1943

Signed-off-by: Ravi Minnikanti <[email protected]>
rminnikanti added a commit to rminnikanti/sonic-buildimage that referenced this pull request Apr 22, 2025
Added copp default configuration for neighbor_miss trap type
to copp_cfg.json

HLD: sonic-net/SONiC#1943

Signed-off-by: Ravi Minnikanti <[email protected]>
rminnikanti added a commit to rminnikanti/sonic-utilities that referenced this pull request Apr 23, 2025
What I did:
CoPP show commands:
* show copp configuration
* show copp configuration detailed --trapid <trap_id>
* show copp configuration detailed --group <group>

Added UT for the CLI commands.

HLD: sonic-net/SONiC#1943

Signed-off-by: Ravi Minnikanti <[email protected]>
rminnikanti added a commit to rminnikanti/sonic-utilities that referenced this pull request Apr 23, 2025
What I did:
CoPP show commands:
* show copp configuration
* show copp configuration detailed --trapid <trap_id>
* show copp configuration detailed --group <group>

Added UT for the CLI commands.

HLD: sonic-net/SONiC#1943

Signed-off-by: Ravi Minnikanti <[email protected]>
rminnikanti added a commit to rminnikanti/sonic-sairedis that referenced this pull request Apr 23, 2025
vslib support for SAI_OBJECT_TYPE_HOSTIF_TRAP,
attribute - SAI_HOSTIF_TRAP_ATTR_TRAP_TYPE

HLD: sonic-net/SONiC#1943

Signed-off-by: Ravi Minnikanti <[email protected]>
rminnikanti added a commit to rminnikanti/sonic-utilities that referenced this pull request Apr 23, 2025
What I did:
CoPP show commands:
* show copp configuration
* show copp configuration detailed --trapid <trap_id>
* show copp configuration detailed --group <group>

Added UT for the CLI commands.

HLD: sonic-net/SONiC#1943

Signed-off-by: Ravi Minnikanti <[email protected]>
@mssonicbld
Copy link
Collaborator

/azp run

Copy link

No pipelines are associated with this pull request.

rminnikanti added a commit to rminnikanti/sonic-utilities that referenced this pull request Apr 23, 2025
What I did:
CoPP show commands:
* show copp configuration
* show copp configuration detailed --trapid <trap_id>
* show copp configuration detailed --group <group>

Added UT for the CLI commands.

HLD: sonic-net/SONiC#1943

Signed-off-by: Ravi Minnikanti <[email protected]>
rminnikanti added a commit to rminnikanti/sonic-sairedis that referenced this pull request Apr 24, 2025
vslib support for SAI_OBJECT_TYPE_HOSTIF_TRAP,
attribute - SAI_HOSTIF_TRAP_ATTR_TRAP_TYPE

HLD: sonic-net/SONiC#1943

Signed-off-by: Ravi Minnikanti <[email protected]>
rminnikanti added a commit to rminnikanti/sonic-swss that referenced this pull request Apr 24, 2025
What I did
* Added neighbor_miss trap type support
* enum capability query for hostif trap type
* Added trap hw_status field to state_db

HLD: sonic-net/SONiC#1943

Signed-off-by: Ravi Minnikanti <[email protected]>
@rminnikanti
Copy link
Author

Can you please test trap flow counters with this feature?

trap counters tested.

@prsunny
Copy link
Contributor

prsunny commented May 1, 2025

@rminnikanti , can you please follow the description template and update all the associated PRs?

rminnikanti added a commit to rminnikanti/sonic-buildimage that referenced this pull request May 2, 2025
Added copp default configuration for neighbor_miss trap type
to copp_cfg.json

HLD: sonic-net/SONiC#1943

Signed-off-by: Ravi Minnikanti <[email protected]>

During initialization, Copporch in Orchagent will perform an SAI enum capability query to identify supported trap types and maintain them in a local list called `supported_trap_ids`.

Additionally, Copporch will maintain a list called `default_supported_trap_ids`, which contains currently supported trap IDs in copporch in orchagent. If the SAI does not support the enum capability query API, Copporch will assume that the `default_supported_trap_ids` are supported for backward compatibility.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't support adding default_supported_trap_ids. If the query API is not present, we should treat it as any configuration and push to the SAI. This will ensure the backward compatibility as well

Copy link
Author

Choose a reason for hiding this comment

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

Hi @dgsudharsan,

The default_supported_trap_ids list ensures backward compatibility. It includes all currently known traps used by orchagent, except for "neighbor_miss". This ensures that all existing trap configurations are pushed to the SAI, even if the query API isn't available. It also prevents orchagent from throwing exceptions in cases where the vendor SAI does not support "neighbor_miss" and using a different method to handle neighbor_miss traffic.

In summary, all current traps are pushed to SAI even if query API is not available only neighbor_miss and future traps need query API availability.

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

Successfully merging this pull request may close these issues.

5 participants