Skip to content

[lldp] Replace per-port portidsubtype loop with global ifname directive#2227

Open
ZhaohuiS wants to merge 1 commit into
Azure:202412from
ZhaohuiS:fix/lldp-portidsubtype-ifname-202412
Open

[lldp] Replace per-port portidsubtype loop with global ifname directive#2227
ZhaohuiS wants to merge 1 commit into
Azure:202412from
ZhaohuiS:fix/lldp-portidsubtype-ifname-202412

Conversation

@ZhaohuiS
Copy link
Copy Markdown
Contributor

@ZhaohuiS ZhaohuiS commented Apr 27, 2026

Description of PR

Summary:
Cherry-pick of sonic-net/sonic-buildimage#26873 for the 202412 branch.

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 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 ifname directive 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:

# First LLDP packet — Port ID is kernel interface name (not MAC, not alias)
ARISTA01T1#show lldp nei
Port          Neighbor Device ID       Neighbor Port ID    TTL
---------- ------------------------ ---------------------- ---
Et1           str5-sn5640-6            Ethernet64          120

# After lldpmgrd sets alias — Port ID becomes platform alias
ARISTA01T1#show lldp nei
Port          Neighbor Device ID       Neighbor Port ID    TTL
---------- ------------------------ ---------------------- ---
Et1           str5-sn5640-6            etp9a               120

Note: The original PR had conflicts on 202412 because the lldpd-ipv4-iface-with-ports.conf test file does not exist on this branch, and the lldpd-ipv6-iface.conf has a different baseline. These conflicts are resolved in this PR.

Type of change

  • Bug fix

Back port request

  • 202412

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:

  1. lldpd.conf.j2: Replaced the per-port Jinja2 loop with global configure lldp portidsubtype ifname
  2. lldpd-ipv4-iface.conf: Added configure lldp portidsubtype ifname before pause
  3. lldpd-ipv6-iface.conf: Added configure lldp portidsubtype ifname before pause
  4. lldpd-ipv4-iface-with-ports.conf: Does not exist on 202412, skipped

How 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

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>
@ZhaohuiS ZhaohuiS requested a review from lguohan as a code owner April 27, 2026 04:36
@ZhaohuiS
Copy link
Copy Markdown
Contributor Author

ZhaohuiS commented May 7, 2026

@r12f could you pls help review ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants