Skip to content

Commit

Permalink
[swss]: Add default ECMP/LAG hash offset values for T0 and T1 (#18912)
Browse files Browse the repository at this point in the history
To avoid ECMP polarization, hash offset values are set from orchagent.

Earlier, vendor SDK sets the hash_offset value internally with the same value as hash_seed. After introduction of SAI attributes(SAI_SWITCH_ATTR_ECMP_DEFAULT_HASH_OFFSET/SAI_SWITCH_ATTR_LAG_DEFAULT_HASH_OFFSET), those changes in SDK were removed causing imbalance of traffic in T1s.

This change will pass the ECMP/LAG HASH_OFFSET values from orchagent to SAI and set them in ASIC.

Different ECMP/LAG hash_offset values are set for T0 and T1 in swss switch.json(ecmp_hash_offset and lag_hash_offset). Values are different for T0 and T1 to avoid ECMP/LAG hash polarization.
As part of switch initialization, these values are passed to switch orchagent.
Switch orchagent process these values and call SAI switch API to set these values.

Will be merged after swss changes: sonic-net/sonic-swss#3138

sonic-mgmt - sonic-net/sonic-mgmt#12765

Microsoft ADO (number only): 25873808
  • Loading branch information
kperumalbfn authored and gord1306 committed Sep 19, 2024
1 parent 80b7b8a commit 7560a79
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dockers/docker-orchagent/switch.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
{# set default hash seed to 0 #}
{% set hash_seed = 0 %}
{% set hash_seed_offset = 0 %}
{% set ecmp_hash_offset_value = 0 %}
{% set lag_hash_offset_value = 0 %}
{% if DEVICE_METADATA.localhost.type %}
{% if "ToRRouter" in DEVICE_METADATA.localhost.type or DEVICE_METADATA.localhost.type in ["EPMS", "MgmtTsToR"] %}
{% set hash_seed = 0 %}
{% elif "LeafRouter" in DEVICE_METADATA.localhost.type %}
{% set hash_seed = 10 %}
{% set ecmp_hash_offset_value = 10 %}
{% set lag_hash_offset_value = 10 %}
{% elif "SpineRouter" in DEVICE_METADATA.localhost.type %}
{% set hash_seed = 25 %}
{% endif %}
Expand All @@ -21,6 +25,8 @@
"ecmp_hash_seed": "{{ hash_seed_value }}",
"lag_hash_seed": "{{ hash_seed_value }}",
"fdb_aging_time": "600",
"ecmp_hash_offset": "{{ ecmp_hash_offset_value }}",
"lag_hash_offset": "{{ lag_hash_offset_value }}",
{% if DEVICE_METADATA.localhost.type and "LeafRouter" in DEVICE_METADATA.localhost.type %}
"ordered_ecmp": "true"
{% else %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"ecmp_hash_seed": "11",
"lag_hash_seed": "11",
"fdb_aging_time": "600",
"ecmp_hash_offset": "10",
"lag_hash_offset": "10",
"ordered_ecmp": "true"
},
"OP": "SET"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"ecmp_hash_seed": "13",
"lag_hash_seed": "13",
"fdb_aging_time": "600",
"ecmp_hash_offset": "10",
"lag_hash_offset": "10",
"ordered_ecmp": "true"
},
"OP": "SET"
Expand Down
2 changes: 2 additions & 0 deletions src/sonic-config-engine/tests/sample_output/t0-switch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"ecmp_hash_seed": "0",
"lag_hash_seed": "0",
"fdb_aging_time": "600",
"ecmp_hash_offset": "0",
"lag_hash_offset": "0",
"ordered_ecmp": "false"
},
"OP": "SET"
Expand Down
2 changes: 2 additions & 0 deletions src/sonic-config-engine/tests/sample_output/t1-switch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"ecmp_hash_seed": "10",
"lag_hash_seed": "10",
"fdb_aging_time": "600",
"ecmp_hash_offset": "10",
"lag_hash_offset": "10",
"ordered_ecmp": "true"
},
"OP": "SET"
Expand Down

0 comments on commit 7560a79

Please sign in to comment.