[vslib/vpp] Implement SAI packet trimming (DROP_AND_TRIM) translation to VPP sonic_ext - #2017
[vslib/vpp] Implement SAI packet trimming (DROP_AND_TRIM) translation to VPP sonic_ext#2017aaronber0614 wants to merge 2 commits into
Conversation
|
/azp run |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Companion PRs (SONiC-VPP packet trimming, tracked in sonic-net/sonic-buildimage#25789):
Suggested review/merge order: HLD → sonic-platform-vpp → sonic-sairedis → sonic-mgmt. |
There was a problem hiding this comment.
Pull request overview
This PR extends the VPP-backed vslib (SwitchVpp) to translate SAI packet-trimming configuration (buffer-profile DROP_AND_TRIM + switch trim attributes) into sonic_ext VPP trim plugin programming, so orchagent’s trim configuration is enforced in the VPP admission datapath.
Changes:
- Add VPP binary-API wrappers for
sonic_ext_trimglobal policy, DSCP map, per-queue admission, and trim counters. - Implement switch-global trim policy tracking and idempotent global programming, plus recompute-all refresh of per-(port,queue) trim admission and switch-global DSCP→queue mapping derived from QoS objects.
- Add unit tests for trim-related capability overrides and “trim-relevant attribute” detection.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| vslib/vpp/vppxlate/SaiVppXlate.h | Adds declarations for sonic_ext_trim control/counters APIs exposed to vslib. |
| vslib/vpp/vppxlate/SaiVppXlate.c | Implements sonic_ext_trim VPP message wiring, reply handlers, plugin msg-id base lookup, and wrapper functions returning VPP retval. |
| vslib/vpp/SwitchVpp.h | Declares trim policy state + trim programming/refresh helpers and overrides enum-values capability for supported trim modes. |
| vslib/vpp/SwitchVpp.cpp | Implements trim attribute handling, global policy programming, per-queue admission refresh, and DSCP→queue composition from QoS maps. |
| unittest/vslib/TestSwitchVpp.cpp | Adds unit tests for trim enum capability override and trim-dataplane attribute detection. |
| case SAI_SWITCH_ATTR_PACKET_TRIM_SIZE: | ||
| m_trim_policy.trim_size = static_cast<uint16_t>(attr->value.u32); | ||
| m_trim_policy.enabled = (attr->value.u32 != 0); | ||
| break; |
| uint8_t dscp_to_queue[64]; | ||
| for (int d = 0; d < 64; d++) | ||
| { | ||
| uint8_t tc = tc_by_dscp[d] & 0x3f; | ||
| dscp_to_queue[d] = queue_by_tc[tc]; | ||
| } |
…lane
Translate the SAI switch packet-trimming attributes onto the sonic_ext VPP
trim plugin and source trim counters:
- SwitchVpp.{cpp,h}: setSwitchTrimAttr / isTrimDataplaneAttr push global trim
policy (trim size, DSCP mode/value, trim queue) into VPP, plus capability
and stats handling.
- SaiVppXlate.{c,h}: binary API wrappers for the trim configuration calls.
- unittest/vslib/TestSwitchVpp.cpp: unit coverage for the trim attribute path.
Pairs with the sonic-platform-vpp sonic_ext trim dataplane.
Tracking: sonic-net/sonic-buildimage#25789
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Aaron Bernardino <aaronber@microsoft.com>
…fresh Address code-review gaps M1, M2 and H2 in the VPP packet-trim wiring: - M1 (error propagation): programTrimGlobal, refreshTrimDataplaneOnChange, refreshTrimDataplane, refreshTrimQueue and refreshTrimDscpToQueueMap now return sai_status_t and propagate VPP programming failures instead of returning void and swallowing them. A SET surfaces the failure; CREATE keeps it non-fatal so bring-up is not blocked by a transient push error. - M2 (qos-map refresh): isTrimDataplaneAttr now also recognizes the PORT qos-map attributes (DSCP_TO_TC / TC_TO_QUEUE bindings) and QOS_MAP object updates, so runtime qos reconfiguration re-resolves and re-pushes the trim DSCP->queue map and per-queue admission state instead of drifting. - H2 (unit tests): replace isPacketTrimSwitchAttr and isUnsupportedTrimEnumCapability -- which referenced methods that no longer exist and did not compile -- with real coverage for the new static getTrimEnumValuesCapability helper and for isTrimDataplaneAttr. Built clean under -Werror; three in-scope PTF trimming tests pass on the dev-VM t1-lag-vpp testbed. Tracking: sonic-net/sonic-buildimage#25789 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Aaron Bernardino <aaronber@microsoft.com>
cc01de3 to
fc551e1
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. |
|
CI note: the This PR's Those headers are generated from This is the expected "land the VPP side first" cross-repo ordering. Once #269 merges and platform-vpp republishes the VPP debs, this build will compile cleanly with no changes here. Reviewing the SAI-translation logic can proceed in the meantime. Companion PRs:
|
What / Why
Implements the SAI packet-trimming (
DROP_AND_TRIM) translation in the VPPvslib so orchagent's trimming configuration is programmed onto the
sonic_extVPP admission datapath.
Part of the SONiC packet-trimming enablement tracked in
sonic-net/sonic-buildimage#25789.
Changes
vslib/vpp/SwitchVpp.{cpp,h}: translate SAI switch trim attributes andbuffer-profile
DROP_AND_TRIMeligibility into VPP global trim policy andper-
{port,queue}admission programming; resolve the switch-wideDSCP-to-queue table from bound QoS maps.
vslib/vpp/vppxlate/SaiVppXlate.{c,h}: binary-API wrappers for the newsonic_exttrim messages, propagating the VPP reply retval so failuressurface to orchagent for retry.
unittest/vslib/TestSwitchVpp.cpp: unit coverage for the translation.Testing
TestSwitchVppunit tests.t1-lag-vpptestbed with the companionsonic-platform-vpp and sonic-mgmt changes.
🤖 Co-authored with GitHub Copilot.