Skip to content

Allow for the speed change in NH-5010 by updating the config_db.json#25423

Merged
rlhui merged 16 commits intosonic-net:masterfrom
nexthop-ai:nh5010.speed_change
Mar 12, 2026
Merged

Allow for the speed change in NH-5010 by updating the config_db.json#25423
rlhui merged 16 commits intosonic-net:masterfrom
nexthop-ai:nh5010.speed_change

Conversation

@arpit-nexthop
Copy link
Contributor

@arpit-nexthop arpit-nexthop commented Feb 10, 2026

Prereq PRs:

sonic-net/sonic-platform-daemons#728
sonic-net/sonic-swss#4113

Why I did it

Prereq changes:
This commit first moves all current signal integrity settings for gearboxes into the media_settings file in the
device/nexthop/x86_64-nexthop_5010-r0 directory. It also removes the older configuration via gearbox_config.json so that we only have a single source of truth for all signal integrity configuration on this platform.

  1. Automate generation of ASIC, gearbox, and PHY configs for different port speeds, instead of maintaining HWSKUs which are inflexible. 2) Derive configuration from platform files:
    a) port_speed.json (port speed profiles + ASIC/gearbox mapping)
    b) Q3D_ports.json (ASIC core/PM → lanes/port names)
    c) CONFIG_DB.PORT (actual ports, speeds, indices, lanes)
  2. Add validation so invalid lane/speed combinations are caught early (before swss brings up ports).
Work item tracking
  • Microsoft ADO (number only):

How I did it

  1. Changed docker image template to provide rw permission to hwsku directory to allow for the config generation. 2) The hwsku-init runs everytime the swss starts and generates the configuration file. 3) Introduced a common hwsku pipeline:
    a) Dataclasses for ASIC ports, gearbox ports, speed profiles, and CONFIG_DB entries.
    b) Loaders for:
    port_speed.json → per-port speed profiles + ASIC/gearbox mapping.
    Q3D_ports.json → core/PM → port → lane map.
    CONFIG_DB PORT table (or a JSON dump) → typed port map.
    c) Generators for:
    Gearbox interfaces list.
    Per‑PHY phy_config.json content.
    ASIC specific config
    d) A run() method that:
    Calls platform-specific ASIC config generation.
    Renders Jinja2 templates into nh5010.bcm, gearbox_config.json, and phy*_config.json, with a fallback to defaults/ on error.
  2. Currently supports:
    (400G-4, 100G-2) ASIC config, (400G-8, 100G-4) front port on the ports 1-32.
    (400G-4, 100G-4) ASIC and front port config (no gearbox) on ports 33-64.

How to verify it

Validated it on mix of 100G and 400G interface:

root@humm119:/usr/share/sonic/device/x86_64-nexthop_5010-r0/NH-5010-F-O64# show interface status
    Interface            Lanes    Speed    MTU    FEC    Alias    Vlan    Oper    Admin                                             Type    Asym PFC
-------------  ---------------  -------  -----  -----  -------  ------  ------  -------  -----------------------------------------------  ----------
    Ethernet0            96,97     100G   9100     rs     etp1  routed      up       up                                  QSFP28 or later         N/A
    Ethernet4          100,101     100G   9100     rs     etp2  routed      up       up                                  QSFP28 or later         N/A
    Ethernet8  104,105,106,107     400G   9100     rs     etp3  routed      up       up  QSFP-DD Double Density 8X Pluggable Transceiver         N/A
   Ethernet12          108,109     100G   9100     rs     etp4  routed      up       up                                  QSFP28 or later         N/A
   Ethernet16  112,113,114,115     400G   9100     rs     etp5  routed      up       up  QSFP-DD Double Density 8X Pluggable Transceiver         N/A
   Ethernet20          116,117     100G   9100     rs     etp6  routed      up       up                                  QSFP28 or later         N/A
   Ethernet24          120,121     100G   9100     rs     etp7  routed      up       up                                  QSFP28 or later         N/A
   Ethernet28          124,125     100G   9100     rs     etp8  routed      up       up                                  QSFP28 or later         N/A
   Ethernet32      56,57,58,59     400G   9100     rs     etp9  routed      up       up  QSFP-DD Double Density 8X Pluggable Transceiver         N/A
   Ethernet36      60,61,62,63     400G   9100     rs    etp10  routed      up       up  QSFP-DD Double Density 8X Pluggable Transceiver         N/A
   Ethernet40            48,49     100G   9100     rs    etp11  routed      up       up                                  QSFP28 or later         N/A
   Ethernet44            52,53     100G   9100     rs    etp12  routed      up       up                                  QSFP28 or later         N/A
   Ethernet48      40,41,42,43     400G   9100     rs    etp13  routed    down       up                                              N/A         N/A
   Ethernet52      44,45,46,47     400G   9100     rs    etp14  routed    down       up                                              N/A         N/A
   Ethernet56      32,33,34,35     400G   9100     rs    etp15  routed      up       up  QSFP-DD Double Density 8X Pluggable Transceiver         N/A
   Ethernet60      36,37,38,39     400G   9100     rs    etp16  routed      up       up  QSFP-DD Double Density 8X Pluggable Transceiver         N/A
   Ethernet64  128,129,130,131     400G   9100     rs    etp17  routed      up       up  QSFP-DD Double Density 8X Pluggable Transceiver         N/A
   Ethernet68  132,133,134,135     400G   9100     rs    etp18  routed      up       up  QSFP-DD Double Density 8X Pluggable Transceiver         N/A
   Ethernet72  136,137,138,139     400G   9100     rs    etp19  routed    down       up                                              N/A         N/A
   Ethernet76  140,141,142,143     400G   9100     rs    etp20  routed    down       up                                              N/A         N/A
   Ethernet80          144,145     100G   9100     rs    etp21  routed      up       up                                  QSFP28 or later         N/A
   Ethernet84  148,149,150,151     400G   9100     rs    etp22  routed      up       up  QSFP-DD Double Density 8X Pluggable Transceiver         N/A
   Ethernet88          152,153     100G   9100     rs    etp23  routed      up       up                                  QSFP28 or later         N/A
   Ethernet92  156,157,158,159     400G   9100     rs    etp24  routed      up       up  QSFP-DD Double Density 8X Pluggable Transceiver         N/A
   Ethernet96          216,217     100G   9100     rs    etp25  routed      up       up                                  QSFP28 or later         N/A
  Ethernet100  220,221,222,223     400G   9100     rs    etp26  routed      up       up  QSFP-DD Double Density 8X Pluggable Transceiver         N/A
  Ethernet104          208,209     100G   9100     rs    etp27  routed      up       up                                  QSFP28 or later         N/A
  Ethernet108  212,213,214,215     400G   9100     rs    etp28  routed      up       up  QSFP-DD Double Density 8X Pluggable Transceiver         N/A
  Ethernet112  200,201,202,203     400G   9100     rs    etp29  routed      up       up  QSFP-DD Double Density 8X Pluggable Transceiver         N/A
  Ethernet116  204,205,206,207     400G   9100     rs    etp30  routed      up       up  QSFP-DD Double Density 8X Pluggable Transceiver         N/A
  Ethernet120  192,193,194,195     400G   9100     rs    etp31  routed      up       up  QSFP-DD Double Density 8X Pluggable Transceiver         N/A
  Ethernet124  196,197,198,199     400G   9100     rs    etp32  routed      up       up  QSFP-DD Double Density 8X Pluggable Transceiver         N/A
  Ethernet128      64,65,66,67     400G   9100     rs    etp33  routed      up       up                         QSFP+ or later with CMIS         N/A
  Ethernet132      68,69,70,71     400G   9100     rs    etp34  routed      up       up                         QSFP+ or later with CMIS         N/A
  Ethernet136      72,73,74,75     400G   9100     rs    etp35  routed    down       up                                              N/A         N/A
  Ethernet140      76,77,78,79     400G   9100     rs    etp36  routed    down       up                                              N/A         N/A
  Ethernet144      80,81,82,83     100G   9100     rs    etp37  routed      up       up                                  QSFP28 or later         N/A
  Ethernet148      84,85,86,87     100G   9100     rs    etp38  routed      up       up                                  QSFP28 or later         N/A
  Ethernet152      88,89,90,91     400G   9100     rs    etp39  routed    down       up                                              N/A         N/A
  Ethernet156      92,93,94,95     400G   9100     rs    etp40  routed    down       up                                              N/A         N/A
  Ethernet160      24,25,26,27     100G   9100     rs    etp41  routed    down       up                                              N/A         N/A
  Ethernet164      28,29,30,31     100G   9100     rs    etp42  routed      up       up                                  QSFP28 or later         N/A
  Ethernet168      16,17,18,19     100G   9100     rs    etp43  routed    down       up                                              N/A         N/A
  Ethernet172      20,21,22,23     100G   9100     rs    etp44  routed      up       up                                  QSFP28 or later         N/A
  Ethernet176        8,9,10,11     100G   9100     rs    etp45  routed      up       up                                  QSFP28 or later         N/A
  Ethernet180      12,13,14,15     100G   9100     rs    etp46  routed    down       up                                              N/A         N/A
  Ethernet184          0,1,2,3     100G   9100     rs    etp47  routed      up       up                                  QSFP28 or later         N/A
  Ethernet188          4,5,6,7     100G   9100     rs    etp48  routed    down       up                                              N/A         N/A
  Ethernet192  160,161,162,163     400G   9100     rs    etp49  routed    down       up                                              N/A         N/A
  Ethernet196  164,165,166,167     400G   9100     rs    etp50  routed    down       up                                              N/A         N/A
  Ethernet200  168,169,170,171     400G   9100     rs    etp51  routed    down       up                                              N/A         N/A
  Ethernet204  172,173,174,175     400G   9100     rs    etp52  routed    down       up                                              N/A         N/A
  Ethernet208  176,177,178,179     400G   9100     rs    etp53  routed    down       up                                              N/A         N/A
  Ethernet212  180,181,182,183     400G   9100     rs    etp54  routed    down       up                                              N/A         N/A
  Ethernet216  184,185,186,187     400G   9100     rs    etp55  routed    down       up                                              N/A         N/A
  Ethernet220  188,189,190,191     400G   9100     rs    etp56  routed    down       up                                              N/A         N/A
  Ethernet224  248,249,250,251     400G   9100     rs    etp57  routed    down       up                                              N/A         N/A
  Ethernet228  252,253,254,255     400G   9100     rs    etp58  routed    down       up                                              N/A         N/A
  Ethernet232  240,241,242,243     400G   9100     rs    etp59  routed    down       up                                              N/A         N/A
  Ethernet236  244,245,246,247     400G   9100     rs    etp60  routed    down       up                                              N/A         N/A
  Ethernet240  232,233,234,235     400G   9100     rs    etp61  routed      up       up                         QSFP+ or later with CMIS         N/A
  Ethernet244  236,237,238,239     400G   9100     rs    etp62  routed      up       up                         QSFP+ or later with CMIS         N/A
  Ethernet248  224,225,226,227     400G   9100     rs    etp63  routed    down       up                                              N/A         N/A
  Ethernet252  228,229,230,231     400G   9100     rs    etp64  routed    down       up                                              N/A         N/A
  Ethernet256  256,257,258,259     100G   9100     rs    etp65  routed    down       up                                              N/A         N/A
  Ethernet260  260,261,262,263     100G   9100     rs    etp66  routed    down       up                                              N/A         N/A
Ethernet-Rec0              621      10G   9100   none  Recirc0  routed      up       up                                              N/A         N/A

Which release branch to backport (provide reason below if selected)

  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511

Tested branch (Please provide the tested image version)

  • master
SONiC OS Version: 13
OCP SAI Header Version: 1.17.1
Vendor SAI Version: 14.1.0.1.0.0.0.0
Vendor SDK Version: sdk-6.5.34-SP1
Distribution: Debian 13.3
Kernel: 6.12.41+deb13-sonic-amd64
Build commit: e73351b0e6
Build date: Mon Feb  9 23:36:58 UTC 2026
Built by: ubuntu@ip-172-31-13-36

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Why I did it
1) Automate generation of ASIC, gearbox, and PHY configs for different port speeds, instead of maintaining HWSKUs which are inflexible.
2) Derive configuration from platform files:
     a) port_speed.json (port speed profiles + ASIC/gearbox mapping)
     b) Q3D_ports.json (ASIC core/PM → lanes/port names)
     c) CONFIG_DB.PORT (actual ports, speeds, indices, lanes)
3) Add validation so invalid lane/speed combinations are caught early (before swss brings up ports).

How I did it
1) Changed docker image template to provide rw permission to hwsku directory to allow for the config generation.
2) The hwsku-init runs everytime the swss starts and generates the configuration file.
3) Introduced a common hwsku pipeline:
    a) Dataclasses for ASIC ports, gearbox ports, speed profiles, and CONFIG_DB entries.
    b) Loaders for:
          port_speed.json → per-port speed profiles + ASIC/gearbox mapping.
          Q3D_ports.json → core/PM → port → lane map.
          CONFIG_DB PORT table (or a JSON dump) → typed port map.
    c) Generators for:
          Gearbox interfaces list.
          Per‑PHY phy_config.json content.
          ASIC specific config
    d) A run() method that:
          Calls platform-specific ASIC config generation.
       Renders Jinja2 templates into nh5010.bcm, gearbox_config.json, and phy*_config.json, with a fallback to defaults/ on error.
4) Currently supports:
    (400G-4, 100G-2) ASIC config, (400G-8, 100G-4) front port on the ports 1-32.
    (400G-4, 100G-4) ASIC and front port config (no gearbox) on ports 33-64.

This commit moves all current signal integrity settings for gearboxes into the media_settings file in the
device/nexthop/x86_64-nexthop_5010-r0 directory. It also removes the older configuration via gearbox_config.json so that we only have a single source of truth for all signal integrity configuration on this platform.

Signed-off-by: arpit-nexthop <arpit@nexthop.ai>

Signed-off-by: arpit-nexthop <arpit@nexthop.ai>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: arpit-nexthop <arpit@nexthop.ai>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@arpit-nexthop
Copy link
Contributor Author

@arlakshm
The PR is failing the check

 python.flask.security.xss.audit.direct-use-of-jinja2.direct-use-of-jinja2
          Detected direct use of jinja2. If not done properly, this may bypass HTML escaping which opens up
          the application to cross-site scripting (XSS) vulnerabilities. Prefer using the Flask method     
          'render_template()' and templates with a '.html' extension in order to prevent XSS.              
          Details: https://sg.run/RoKe                                                                     
                                                                                                           
          348┆ env = Environment(
          349┆     loader=FileSystemLoader(template_dir),
          350┆     autoescape=select_autoescape(["html", "xml"])
          351┆ ) # nosemgrep: python.flask.security.xss.audit.direct-use-of-jinja2.direct-use-of-jinja2
                            
  BLOCKING CODE RULES FIRED:
    python.flask.security.xss.audit.direct-use-of-jinja2.direct-use-of-jinja2

Since the script is not generating html or xml file, we can ignore the warning. Please suggest what should be the way to mark this file in ignore list for this warning.

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: arpit-nexthop <arpit@nexthop.ai>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines failed to run 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tjchadaga
Copy link
Contributor

@arpit-nexthop - since one of the prereq PRs (sonic-net/sonic-platform-daemons#728) is not merged to master, is it safe to merge this PR?

If not, please raise another PR with this change for 202511, so we can go ahead and merge that

@arpit-nexthop
Copy link
Contributor Author

arpit-nexthop commented Mar 5, 2026

@arpit-nexthop - since one of the prereq PRs (sonic-net/sonic-platform-daemons#728) is not merged to master, is it safe to merge this PR?

If not, please raise another PR with this change for 202511, so we can go ahead and merge that

@tjchadaga It is okay to merge, we are already working to get master merged (sonic-net/sonic-platform-daemons#728) (should happen in a couple of days). Only thing it will temporarily break on master would be the serdes settings. Since immediately we are not running tests on master, we can merge this.

Signed-off-by: arpit-nexthop <arpit@nexthop.ai>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: arpit-nexthop <arpit@nexthop.ai>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@arlakshm
Copy link
Contributor

arlakshm commented Mar 9, 2026

/azpw ms_conflict

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@arpit-nexthop
Copy link
Contributor Author

Consistently hitting
#26130
#25695

@vmittal-msft
Copy link
Contributor

@yxieca @rlhui Can you please help merge ?

@rlhui rlhui merged commit bddd246 into sonic-net:master Mar 12, 2026
20 checks passed
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202511: #26150

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

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

9 participants