Skip to content

Added support for supported loopback mode for port object - #2325

Open
pdhruv-marvell wants to merge 1 commit into
opencomputeproject:masterfrom
pdhruv-marvell:adding_port_attribute_for_supported_loopback_mode
Open

Added support for supported loopback mode for port object#2325
pdhruv-marvell wants to merge 1 commit into
opencomputeproject:masterfrom
pdhruv-marvell:adding_port_attribute_for_supported_loopback_mode

Conversation

@pdhruv-marvell

@pdhruv-marvell pdhruv-marvell commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

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.

Signed-off-by: Dhruvkumar Patel <pdhruvkumarr@marvell.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Comment thread inc/saiport.h
  * @type sai_s32_list_t sai_port_loopback_mode_t
  * @flags READ_ONLY
  */
  SAI_PORT_ATTR_SUPPORTED_LOOPBACK_MODE,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

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