[lldp] Replace per-port portidsubtype loop with global ifname directive#2227
Open
ZhaohuiS wants to merge 1 commit into
Open
[lldp] Replace per-port portidsubtype loop with global ifname directive#2227ZhaohuiS wants to merge 1 commit into
ZhaohuiS wants to merge 1 commit into
Conversation
Replace the per-port portidsubtype configuration loop in lldpd.conf.j2 with a single global `configure lldp portidsubtype ifname` directive. The per-port loop was added to prevent MAC-based Port IDs on the first LLDP frame, but it causes startup delays proportional to port count (e.g., 20+ seconds on 512-port systems). The global ifname directive achieves the same goal — lldpd uses interface names as Port IDs from the start — while lldpmgrd subsequently sets the correct alias per port. Cherry-pick of sonic-net/sonic-buildimage#26873 for the 202412 branch. Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
Contributor
Author
|
@r12f could you pls help review ? |
r12f
approved these changes
May 7, 2026
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:
Cherry-pick of sonic-net/sonic-buildimage#26873 for the 202412 branch.
Replace the per-port
portidsubtypeconfiguration loop inlldpd.conf.j2with a single globalconfigure lldp portidsubtype ifnamedirective.The per-port loop was added by #26144 to prevent MAC-based Port IDs on the first LLDP frame, but it causes LLDP neighbor churns on high-scale systems — startup delays proportional to port count (e.g., 20+ seconds on 512-port systems) lead to neighbor table instability.
#26873 fixes this by using the global
configure lldp portidsubtype ifnamedirective instead. The trade-off is that the Port ID in the first LLDP packet uses the kernel interface name (e.g.,Ethernet64) rather than the platform alias (e.g.,etp9a). After lldpmgrd configures the per-port alias, subsequent packets use the correct alias. The key improvement is that the Port ID is no longer a MAC address, which was the original problem #26144 aimed to solve.Observed behavior:
Note: The original PR had conflicts on 202412 because the
lldpd-ipv4-iface-with-ports.conftest file does not exist on this branch, and thelldpd-ipv6-iface.confhas a different baseline. These conflicts are resolved in this PR.Type of change
Back port request
Approach
What is the motivation for this PR?
#26144 introduced per-port portidsubtype configuration to prevent MAC-based Port IDs. However, on high-scale systems this causes LLDP neighbor churns due to slow startup. #26873 fixes it with a global directive that eliminates the startup delay while still avoiding MAC-based Port IDs.
How did you do it?
Applied the same change as sonic-net/sonic-buildimage#26873 with conflict resolution:
lldpd.conf.j2: Replaced the per-port Jinja2 loop with globalconfigure lldp portidsubtype ifnamelldpd-ipv4-iface.conf: Addedconfigure lldp portidsubtype ifnamebeforepauselldpd-ipv6-iface.conf: Addedconfigure lldp portidsubtype ifnamebeforepauselldpd-ipv4-iface-with-ports.conf: Does not exist on 202412, skippedHow did you verify/test it?
Verified the generated config matches expected output format. The original PR was tested on sonic-net master. Observed LLDP behavior on str5-sn5640-6 confirms Port ID transitions from kernel ifname to alias after lldpmgrd configures it.
Any platform specific information?
N/A
Supported testbed topology if it's a new test case?
N/A
Documentation
N/A