Skip to content

Conversation

@longhuan-cisco
Copy link
Contributor

@longhuan-cisco longhuan-cisco commented Jul 14, 2025

sonic-swss side change: sonic-net/sonic-swss#3764

Description

Add support for custom serdes attrs SAI_PORT_SERDES_ATTR_CUSTOM_COLLECTION

In media_settings.json, custom attributes can be defined by using CUSTOM: as prefix, and existing parsing logic/format will be reused.

Example media_settings.json snippet

                    "CUSTOM:ABC": {
                        "lane0": "0x1",
                        "lane1": "0x1",
                        "lane2": "0x1",
                        "lane3": "0x1",
                        "lane4": "0x1",
                        "lane5": "0x1",
                        "lane6": "0x1",
                        "lane7": "0x1"
                    },
                    "CUSTOM:XYZ": {
                        "lane0": "0x10",
                        "lane1": "0x10",
                        "lane2": "0x10",
                        "lane3": "0x10",
                        "lane4": "0x10",
                        "lane5": "0x10",
                        "lane6": "0x10",
                        "lane7": "0x10"
                    },
                    "CUSTOM:XXX": {
                        "lane0": "0x7",
                        "lane1": "0x7",
                        "lane2": "0x7",
                        "lane3": "0x7",
                        "lane4": "0x7",
                        "lane5": "0x7",
                        "lane6": "0x7",
                        "lane7": "0x7"
                    },

Motivation and Context

How Has This Been Tested?

Tested end-to-end xcvrd->OA->SAI/SDK on 8-hostlanes optics with both non-breakout and breakout modes.

Additional Information (Optional)

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@longhuan-cisco
Copy link
Contributor Author

@prgeor @mihirpat1 could you please review, thanks

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mihirpat1 mihirpat1 requested a review from Copilot October 15, 2025 02:56
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for custom SerDes attributes in the media settings parser, allowing custom attributes to be defined in media_settings.json with a CUSTOM: prefix and converted to JSON format for consumption by the SAI layer.

  • Introduces parsing logic for custom SerDes attributes prefixed with CUSTOM:
  • Adds conversion functions to handle hex/int string values and convert them to signed integers
  • Implements JSON serialization of custom attributes for database storage

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
sonic-xcvrd/xcvrd/xcvrd_utilities/media_settings_parser.py Adds custom SerDes attribute parsing logic, helper functions for string-to-int conversion, and integration into the media setting notification flow
sonic-xcvrd/tests/test_xcvrd.py Adds unit tests for the custom SerDes attribute handling functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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.

3 participants