Skip to content

ECMP and LAG Hash Seed

Shuotian Cheng edited this page Aug 16, 2017 · 11 revisions

Overview

In tree-sized data center network topology, different hashing is needed in different tiers to avoid traffic polarization. In SONiC, we are using different hashing algorithms for ECMP and LAG by default, so we only need to configure the hash seed. For easy configuration and debugging, we should be able to change the hash seed during the run time.

In SAI, two attributes are available - SAI_SWITCH_ATTR_ECMP_DEFAULT_HASH_SEED and SAI_SWITCH_ATTR_LAG_DEFAULT_HASH_SEED. By default, the value of these attributes is 0.

Requirement

User only needs to provide one hash seed value. This value will be used on both attributes.

Once the user specifies the seed, it could be picked up and applied when the switch starts or during the run time.

Implementation

With the design of CONFIG_DB, SwSS will get notified once the value is updated. Orchagent will be able to pick up the change and execute the corresponding SAI function calls.

In order to fit the current design, a SwitchOrch class is needed to deal with the switch related tasks.

The schema of the configuration:

127.0.0.1:6379[4]> hget "DEVICE_METADATA:localhost" "hash_seed"
1) "100"
Clone this wiki locally