Added support for supported loopback mode for port object - #2325
Open
pdhruv-marvell wants to merge 1 commit into
Open
Conversation
Signed-off-by: Dhruvkumar Patel <pdhruvkumarr@marvell.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
JaiOCP
reviewed
Jul 29, 2026
| * @type sai_s32_list_t sai_port_loopback_mode_t | ||
| * @flags READ_ONLY | ||
| */ | ||
| SAI_PORT_ATTR_SUPPORTED_LOOPBACK_MODE, |
Contributor
There was a problem hiding this comment.
How would the local port know the remote end behavior?
/** Port loopback at PHY remote end */
SAI_PORT_LOOPBACK_MODE_PHY_REMOTE,
/** Port loopback at MAC remote end */
SAI_PORT_LOOPBACK_MODE_MAC_REMOTE
Contributor
Author
There was a problem hiding this comment.
@JaiOCP
The remote loopback mode is configured on the local port, not on the remote device. When enabled, the local port loops back traffic received from the remote link partner back toward that same link partner, effectively emulating loopback behavior at the remote end.
For additional context, this behavior was introduced as part of the original remote loopback mode contribution: #1234
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.
This PR introduces a new port attribute: SAI_PORT_ATTR_SUPPORTED_LOOPBACK_MODE
This attribute provides a list of loopback modes supported by the underlying hardware for a given port.
These values represent the loopback modes that can be configured on a port, such as no loopback, PHY loopback, MAC loopback, or remote loopback modes.
Motivation
Different ports on the same ASIC may support different loopback modes based on hardware and SerDes configuration. sai_query_attribute_enum_values_capability() cannot represent this accurately because it is switch-scoped and takes switch_id, not a port OID. Therefore, a per-port READ_ONLY attribute is needed to report the loopback modes supported by each port.
This enhancement allows applications to:
Avoid configuration failures due to unsupported loopback modes
Enable runtime validation before applying SAI_PORT_ATTR_LOOPBACK_MODE
Example
A port may report:
[SAI_PORT_LOOPBACK_MODE_NONE,
SAI_PORT_LOOPBACK_MODE_PHY,
SAI_PORT_LOOPBACK_MODE_MAC,
SAI_PORT_LOOPBACK_MODE_PHY_REMOTE,
SAI_PORT_LOOPBACK_MODE_MAC_REMOTE,],
indicating all loopback modes are supported.
or
[SAI_PORT_LOOPBACK_MODE_NONE,
SAI_PORT_LOOPBACK_MODE_PHY,
SAI_PORT_LOOPBACK_MODE_MAC],
indicating remote loopback is not supported on that port.