[vpp] Add sonic_ext RIF loopback packet action nodes and binary API - #259
Open
aaronber0614 wants to merge 5 commits into
Open
[vpp] Add sonic_ext RIF loopback packet action nodes and binary API#259aaronber0614 wants to merge 5 commits into
aaronber0614 wants to merge 5 commits into
Conversation
Fold the router-interface loopback (hairpin) packet action feature into the consolidated sonic_ext plugin instead of a standalone plugin, so all custom SONiC VPP dataplane nodes live in one place (see sonic-platform-vpp sonic-net#255). - Add ip4/ip6 loopback output-arc nodes (sonic-ext-ip4-loopback / sonic-ext-ip6-loopback): a routed packet whose egress interface equals its ingress interface is dropped and the interface tx-error counter incremented when the per-interface action is DROP; otherwise it continues on the arc. - Add the first binary API to sonic_ext (sonic_ext.api: iface_loopback_set_action) with the msg-id-base setup and reply handler, and a per-sw_if_index action vector in sonic_ext_main_t. - sonic_ext_iface_loopback_set_action() toggles the output arcs only on an actual FORWARD<->DROP transition (VPP feature enable/disable is ref-counted), and rolls back both the arc state and the stored action on failure. - Reset the action on interface delete so a recycled sw_if_index cannot inherit a stale DROP. - Bump VPP_VERSION 2606-0.3 -> 2606-0.4 (plugin content changed). Signed-off-by: Aaron Bernardino <aaronber@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This was referenced Jul 9, 2026
…k-sonicext Signed-off-by: Aaron Bernardino <aaronber@microsoft.com>
Merging upstream/master brought in the sflow VPP patches (0012-0014), changing vppbld/patches/series on this branch. Per the VPP_VERSION convention, bump the minor suffix (0.4 -> 0.5) so CI rebuilds the VPP and sonic_ext plugin debs against the new series instead of reusing a stale cached 0.4 deb that predates the sflow patches. Part of sonic-net/sonic-buildimage#25788. Signed-off-by: Aaron Bernardino <aaronber@microsoft.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
…k-sonicext Signed-off-by: Aaron Bernardino <aaronber@microsoft.com>
…0012 Merging upstream/master pulled the sflow phase-three change to 0012-sflow-per-port-sample-rate.patch. Since the patch series content changed, bump the VPP_VERSION suffix so CI does not reuse a stale cached .deb keyed on the old 0.5 content. 0.6 and 0.7 are in use by the VXLAN branches, so 0.8 is the next free suffix. Signed-off-by: Aaron Bernardino <aaronber@microsoft.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
Adds the VPP dataplane portion of SONiC’s RIF loopback (hairpin) packet action feature by extending the existing sonic_ext plugin with per-interface configuration and output-arc nodes that can drop routed hairpin packets and account them as TX errors.
Changes:
- Added
sonic-ext-ip4-loopbackandsonic-ext-ip6-loopbackfeature nodes on theip4-output/ip6-outputarcs to drop hairpin packets and incrementVNET_INTERFACE_COUNTER_TX_ERROR. - Introduced the plugin’s first binary API (
iface_loopback_set_action) to toggle per-interface loopback action and enable/disable the feature nodes accordingly. - Bumped
VPP_VERSIONto avoid consuming cached debs that predate the new plugin content.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| vppbld/plugins/sonic_ext/sonic_ext.h | Adds loopback action constants, API message-id base storage, and per-interface action vector + setter declaration. |
| vppbld/plugins/sonic_ext/sonic_ext.c | Implements per-interface loopback action setter, API handler, message-id setup, and sw_if_index delete reset logic. |
| vppbld/plugins/sonic_ext/sonic_ext.api | Defines the new iface_loopback_set_action binary API message. |
| vppbld/plugins/sonic_ext/ip4_loopback_node.c | Implements IPv4 output-arc feature node to drop routed hairpin packets and count TX errors. |
| vppbld/plugins/sonic_ext/ip6_loopback_node.c | Implements IPv6 output-arc feature node to drop routed hairpin packets and count TX errors. |
| vppbld/plugins/sonic_ext/FEATURE.yaml | Documents the new iface-loopback feature in the plugin feature list. |
| vppbld/plugins/sonic_ext/CMakeLists.txt | Adds new node sources and wires in API generation for sonic_ext.api. |
| rules/vpp.mk | Bumps VPP version suffix to invalidate cached artifacts after plugin changes. |
Comment on lines
+277
to
+284
| int | ||
| sonic_ext_iface_loopback_set_action (u32 sw_if_index, u8 action) | ||
| { | ||
| sonic_ext_main_t *sem = &sonic_ext_main; | ||
| int enable = (action == SONIC_EXT_LOOPBACK_ACTION_DROP); | ||
| u8 prev; | ||
| int rv; | ||
|
|
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why I did it
Dataplane half of the RIF loopback packet action feature. VPP needs graph nodes on the ip4-output and ip6-output arcs that drop a routed hairpin packet (a packet whose ingress RIF equals its egress RIF) and count it as tx-error, plus a binary API so the SAI layer can toggle the behavior per interface.
Feature tracking issue: sonic-net/sonic-buildimage#25788
How I did it
How to verify it
Build docker-sonic-vpp. Run "vppctl show node sonic-ext-ip4-loopback" and confirm the state is active. Set "config interface ip loopback-action Ethernet0 drop", inject a hairpin packet, and confirm tx-error increments; with forward, the packet egresses and tx-error stays 0.
Which release branch to backport (provide reason below if selected)
None.
Description for the changelog
Add sonic_ext plugin nodes and a binary API for RIF loopback packet action on the VPP dataplane.
Part of sonic-net/sonic-buildimage#25788.
PR series (landing order)
Tracking issue: sonic-net/sonic-buildimage#25788