[vpp] SAI support for CoPP dataplane enforcement - #2070
nhegde-microsoft wants to merge 4 commits into
Conversation
|
/azp run |
|
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. |
c798375 to
04330f6
Compare
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Multi-model review: sonic-sairedis #2070 (CoPP dataplane enforcement)I ran this through a three model consensus review (Claude Opus, GPT, Grok, all at high reasoning) and then a second adversarial pass to disprove each finding. Everything below is grounded against the pinned VPP revision Blocker 1: SAI policer stats return 0 (HLD REQ-5 gap)
Blocker (dependency): this PR aborts syncd unless #281 also enables
|
|
Thanks — all three check out, fixed.
Shared ARP ethertype unbind: Fixed. Trap moved between groups: Fixed. All three verified via a real build ( |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Add SAI POLICER, HOSTIF_TRAP, and HOSTIF_TRAP_GROUP support backed by VPP native policer objects and the copp_punt_policer device-input plugin. Control-plane traffic (ARP, LACP, LLDP, UDLD, TTL_ERROR) is classified and rate-limited. Also fixes a bug in setHostifTrapGroup() where the switch's implicit default trap group was never tracked, silently dropping its policer binding. Signed-off-by: Nikhil Hegde <nikhilhegde@microsoft.com>
…up move - SwitchVppPolicer.cpp: extract programPolicer() (the VPP-side work) out of createPolicer(), shared with setPolicer() instead of routing through createPolicer()'s create_internal() call, which always returned ITEM_ALREADY_EXISTS on an existing OID and silently short-circuited every runtime SET before it ever reached VPP. Also fixes is_replace (was hardcoded false) and looks up the existing VPP policer_index so the replace path's delete-then-recreate lands at the correct slot. - SwitchVppPolicer.cpp: vpp_policer_mode_from_sai()'s SR_TCM (RFC 2697, 1R3C) branch now discriminates on has_pbs instead of has_pir -- PIR/EIR belongs to the two-rate TR_TCM modes, not single-rate SR_TCM. - SwitchVppHostifTrap.cpp: uninstallTrapClassify() now checks whether any other tracked, classify_installed trap still needs the same ethertype before actually unbinding it (the device-input plugin's bind table has one slot per ethertype, and SAI_HOSTIF_TRAP_TYPE_ ARP_REQUEST/_RESPONSE both map to 0x0806, so removing one trap could otherwise silently unpolice the other). - SwitchVppHostifTrap.cpp: setHostifTrap() now re-runs the classify install with the new trap group's policer when a trap stays installed but its TRAP_GROUP attribute changes -- previously this transition hit neither the install nor uninstall branch, so the trap silently kept its old group's policer binding. All changes verified via a real build (-Wall -Wextra -Werror), clean. Signed-off-by: Nikhil Hegde <nikhilhegde@microsoft.com>
Fixes syncd watchdog hangs: policer programming and installTrapClassify/uninstallTrapClassify now use the existing deferred one-item-per-call queue pattern instead of calling VPP synchronously. Also registers the missing policer_classify_set_interface reply handler (msg id 425), which VPP was replying to but the client silently dropped, causing an infinite wait. Confirmed live: testbed fully converged (24/24 BGP, 8/8 LACP), unblocks test_add_new_trap/test_remove_trap. Signed-off-by: Nikhil Hegde <nikhilhegde@microsoft.com>
Replace the ip4-policer-classify approach (per-interface binding, deferred-queue bookkeeping) with calls into the new copp_ip2me_policer plugin, which polices on the global ip4-punt arc instead -- no per-interface binding needed. Signed-off-by: Nikhil Hegde <nikhilhegde@microsoft.com>
b974b1e to
cf3ea34
Compare
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
What
Adds SAI
POLICER,HOSTIF_TRAP,HOSTIF_TRAP_GROUPsupport tovslib/vpp, backed by real VPP policer objects and two VPP plugins (companion sonic-platform-vpp PR):copp_punt_policer(ethertype-keyed) andcopp_ip2me_policer(IP2ME/SNMP/SSH).Why
sonic-buildimage#25801. These object types previously fell through to a generic attribute store with no VPP dataplane wiring — CoPP config was accepted but never enforced.
How
SwitchVppPolicer.cpp/.h(new): SAIPOLICER→ VPP nativepolicer_add/policer_update/policer_dump.SwitchVppHostifTrap.cpp(new): per-trap ethertype/TTL match table; bindscopp_punt_policer.IP2ME(also covers SNMP/SSH) bindscopp_ip2me_policerinstead, since it has no ethertype. Also fixes a default-trap-group binding bug (affected TTL_ERROR).SwitchVppRif.cpp: router-interface IPv4 add/remove syncscopp_ip2me_policer's tracked-address set.SwitchVpp.cpp/.h: dispatch wiring for the 3 new object types.vppxlate/SaiVppXlate.c/.h: VAPI wrappers for both plugins.An earlier
ip4-policer-classify-based IP2ME approach (per-interface bind) was replaced after proving fragile — see HLD.Design: https://github.com/nhegde-microsoft/SONiC/blob/copp-vpp-enablement/doc/vpp/vpp_copp_HLD.md
Suggested merge order: sonic-platform-vpp#281 → this PR.
Companion PRs
Test
vlab-vpp-01: all 24tests/copp/test_copp.pysubtests pass, zero skips.