[dhcpmon] Track PortChannels under downstream VLANs - #89
Closed
Xichen96 wants to merge 5 commits into
Closed
Conversation
Resolve nested Ethernet-to-PortChannel-to-VLAN membership and aggregate counters at each immediate parent without changing existing Dual-ToR attribution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 39f979be-d826-4d5c-949a-f20abb58bb83 Signed-off-by: Xichen96 <lukelin0907@gmail.com>
Collaborator
|
/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). |
There was a problem hiding this comment.
Pull request overview
This PR updates dhcpmon’s interface attribution model to support nested downstream hierarchies where a monitored VLAN contains a PortChannel, and the PortChannel contains physical members. The goal is to correctly classify/attribute packets that may arrive on a bare physical member during LAG convergence, and to expose intermediate aggregation edges.
Changes:
- Build VLAN mappings before PortChannel-member mappings so PortChannels that are VLAN members can have their physical members tracked.
- Add device-manager helpers to resolve an interface’s immediate parent and the aggregate-counter name for that parent.
- Switch live counter increments and aggregate-counter recomputation to use the new immediate-parent aggregate selection helper.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/util.h | Removes the previous inline aggregate-counter helper in favor of device-manager helpers. |
| src/packet_handler.cpp | Updates live per-packet aggregate-counter selection to use device-manager aggregation logic. |
| src/dhcp_mon.cpp | Updates aggregate-counter recomputation to use device-manager aggregation logic. |
| src/dhcp_devman.h | Adds public APIs for parent resolution and aggregate-counter name derivation. |
| src/dhcp_devman.cpp | Implements nested PortChannel-member mapping for downstream VLANs and adds parent/aggregate helper implementations. |
This was referenced Jul 25, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 39f979be-d826-4d5c-949a-f20abb58bb83 Signed-off-by: Xichen96 <lukelin0907@gmail.com>
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Treat a self-mapped VLAN or PortChannel member as a root interface instead of creating a self aggregate. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 39f979be-d826-4d5c-949a-f20abb58bb83 Signed-off-by: Xichen96 <lukelin0907@gmail.com>
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Include family, direction, parent and child-aggregate deltas, expected ratio, and message type in persistent hierarchy mismatch logs for precise loss localization. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 39f979be-d826-4d5c-949a-f20abb58bb83 Signed-off-by: Xichen96 <lukelin0907@gmail.com>
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Evaluate both an interface and its immediate-child aggregate before declaring a quiet window, so child-only packet observations expose the exact forwarding edge that did not advance. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 39f979be-d826-4d5c-949a-f20abb58bb83 Signed-off-by: Xichen96 <lukelin0907@gmail.com>
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/dhcp_device.cpp:240
check_aggregate_health()also takesuint8_t ratio, so the member-count expression passed bydhcp_device_check_agg_multiple_*()will truncate before the comparison even runs. Update this parameter to a wider type to match the (widened)check_counters_delta_expected()ratio.
static dhcp_mon_status_t check_aggregate_health(const std::string &ifname, int sock, uint8_t ratio,
const int *monitored_msgs, size_t monitored_msg_cnt)
Comment on lines
219
to
+223
| uint64_t delta = counters.at(monitored_msgs[i]) - counters_snapshot.at(monitored_msgs[i]); | ||
| uint64_t other_delta = other_counters.at(monitored_msgs[i]) - other_counters_snapshot.at(monitored_msgs[i]); | ||
| if (delta * ratio != other_delta) { | ||
| const std::string *message_names = sock_info.is_v6 ? db_counter_name_v6 : db_counter_name; | ||
| last_counter_mismatch = |
Contributor
Author
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.
Description of PR
Summary:
Fungible F2 uses PortChannels as members of the downstream VLAN.
dhcpmoncurrently records
PortChannel1005 -> Vlan1000, but skipsEthernet312 -> PortChannel1005because the PortChannel is not a command-linecontext interface. A packet delivered on the bare physical member during LAG
convergence is therefore not attributed through the full downstream hierarchy.
This change recognizes physical members of a PortChannel that belongs to the
monitored downstream VLAN on single-ToR systems. It also aggregates each
interface into its immediate parent:
Ethernet -> PortChannel -> VLAN -> root aggregateExisting direct VLAN-member, upstream PortChannel, and Dual-ToR attribution
behavior is unchanged.
Dependencies:
and [dhcpmon] Clean up source include dependencies #88 merge to avoid overlapping
source-file churn.
sonic-buildimage PR.
Work item tracking
Type of change
Approach
What is the motivation for this PR?
The existing one-level mapping cannot resolve a physical packet ingress through
a PortChannel that is itself a member of the downstream VLAN. It also collapses
aggregate counters directly into the final context, so the PortChannel-to-VLAN
edge cannot be distinguished from the physical-to-PortChannel edge.
How did you do it?
command-line context or a member of the monitored VLAN.
attribution requires separate MUX-aware handling.
Ethernet -> PortChannel -> VLAN.command-line context.
recalculation after counter synchronization.
Agg-<Vlan>debug output.How did you verify/test it?
Pending this PR's Azure CI and master hardware validation.
Planned hardware validation:
dhcpmon counter tests.
Ethernet312/314 -> PortChannel1005 -> Vlan1000.counter attribution.
Any platform specific information?
The new nested physical-member attribution is limited to single-ToR. Existing
Dual-ToR counting remains unchanged because its downstream RX counters are
derived from MUX state.
Back port request
None. This repair targets master only.
Tested branch
Pending.
Test result
Pending this PR's Azure CI and master hardware validation.
Documentation
Not applicable; existing counter schemas and command output fields are
unchanged.