Skip to content

[sonic-utilities] Add CLI support for generic hash (per-packet-type ECMP/LAG hashing)#4539

Open
jithenderkondam wants to merge 3 commits into
sonic-net:masterfrom
jithenderkondam:feature/pkt-type-hash
Open

[sonic-utilities] Add CLI support for generic hash (per-packet-type ECMP/LAG hashing)#4539
jithenderkondam wants to merge 3 commits into
sonic-net:masterfrom
jithenderkondam:feature/pkt-type-hash

Conversation

@jithenderkondam

@jithenderkondam jithenderkondam commented May 13, 2026

Copy link
Copy Markdown

Why I did it:
SONiC HLD sonic-net/SONiC#2100 introduces a "Generic
Hash" feature that adds per-packet-type ECMP/LAG hashing (IPv4, IPv6, IPNIP,
IPV4_RDMA, IPV6_RDMA) and two new RDMA hash fields (RDMA_BTH_OPCODE,
RDMA_BTH_DEST_QP). The existing CLI only supported a single switch-wide
ECMP/LAG hash list and had no awareness of the new per-packet-type
capabilities advertised in STATE_DB. This change adds the user-facing
configure/show commands, validation and tests needed to use the feature.

How I did it:

  • Added new per-packet-type capability keys and the two new RDMA hash
    fields in utilities_common/switch_hash.py.
  • Extended config switch-hash global ecmp-hash/lag-hash with
    --packet-type and --action {add|del} options (overwrite/merge/
    delete semantics) and updated the validators to check the new
    capabilities.
  • Extended show switch-hash global with --packet-type and updated
    show switch-hash capabilities to display the new "Packet Type"
    column (text and JSON).
  • Updated doc/Command-Reference.md with the new options and examples.
  • Added new mock STATE_DB files, refreshed existing ones, updated
    expected outputs, and added pytest cases for add/del/merge,
    idempotency and negative scenarios.

How to verify it:
Run the sonic-utilities unit tests.

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

  • 202511

Tested branch (Please provide the tested image version):

  • 202511

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

…CMP/LAG hashing)

Why I did it:
SONiC HLD sonic-net/SONiC#2100 introduces a "Generic
Hash" feature that adds per-packet-type ECMP/LAG hashing (IPv4, IPv6, IPNIP,
IPV4_RDMA, IPV6_RDMA) and two new RDMA hash fields (RDMA_BTH_OPCODE,
RDMA_BTH_DEST_QP). The existing CLI only supported a single switch-wide
ECMP/LAG hash list and had no awareness of the new per-packet-type
capabilities advertised in STATE_DB. This change adds the user-facing
configure/show commands, validation and tests needed to use the feature.

How I did it:
- Added new per-packet-type capability keys and the two new RDMA hash
  fields in utilities_common/switch_hash.py.
- Extended `config switch-hash global ecmp-hash/lag-hash` with
  `--packet-type` and `--action {add|del}` options (overwrite/merge/
  delete semantics) and updated the validators to check the new
  capabilities.
- Extended `show switch-hash global` with `--packet-type` and updated
  `show switch-hash capabilities` to display the new "Packet Type"
  column (text and JSON).
- Updated doc/Command-Reference.md with the new options and examples.
- Added new mock STATE_DB files, refreshed existing ones, updated
  expected outputs, and added pytest cases for add/del/merge,
  idempotency and negative scenarios.

Signed-off-by: Jithender Kondam <jreddy@marvell.com>
@jithenderkondam
jithenderkondam force-pushed the feature/pkt-type-hash branch from e9cb976 to 1f6e74b Compare May 13, 2026 07:43
@jithenderkondam jithenderkondam changed the title [sonic-swss] Generic Hash: Add packet-type specific hash configuration support [sonic-utilities] Add CLI support for generic hash (per-packet-type ECMP/LAG hashing) May 13, 2026
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Jithender Kondam <jreddy@marvell.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Jithender Kondam <jreddy@marvell.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
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.

2 participants