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
Fix sonic-net/SONiC#601
Sub port interface has a separate admin status control from parent port. However, at kernel side, the admin status operation of parent port is not fully decoupled from that of sub port interface: Admin down parent port also admins down sub port, and admin up parent port also admins up sub port.
Under such a behavior, one case that need additional care from user software, specifically,
intfmgrd
, is that sub port interface is configured admin down in CONFIG_DB, and parent port goes from admin down to admin up in CONFIG_DB. Sub port interface at kernel will go from admin down to admin up accordingly, leaving its kernel-side admin status to be different from what is configured in CONFIG_DB. This may affect behavior of some control plane packets.Other admin status combination of {parent port, sub port interface} pair is discussed in sonic-net/SONiC#601 (comment)
The SAI/ASIC side admin status of sub port interface is not affected by this PR.
What I did
Have IntfMgr subscribe to CONFIG PORT and LAG table to listen to parent port admin status change. The particular status we are interested in is parent port admin status up and sub port interface admin status down. When such a case is captured, we will admin down sub port interface in kernel.
Because the operation of admin down parent port is issued from
portmgrd
orteammgrd
, which is a separate process fromintfmgrd
, we need to make sure that parent port admin operation is completed in the first place. To this end, we will check whether parent port admin status is syncd from CONFIG DB to APPL DB. We use this as an indicator that kernel-side operation for parent port is completed as setting APPL DB is coded as the last step in*mgrd
task processing by convention.How I verified it
vs test
Details if related
vs test failure message without the fix in this PR. Failure on line 864: