-
Notifications
You must be signed in to change notification settings - Fork 539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SWSS] Static LAG Support #3090
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,6 +144,47 @@ std::string ValuesStore::get_value(json_t * root, const std::string & path, Valu | |
throw std::runtime_error("Reach the end of the ValuesStore::get_value. Path=" + path); | ||
} | ||
|
||
/// | ||
/// Extract static lag values for LAG with name lag_name, from the parsed json tree with root, to the temporary storage | ||
/// @param lag_name a name of the LAG | ||
/// @param root a pointer to the parsed json tree | ||
/// @param storage a reference to the temporary storage | ||
/// | ||
|
||
void ValuesStore::extract_values_static(const std::string & lag_name, json_t * root, HashOfRecords & storage) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to have a separate function to extract values for static? This appears to be duplicate of the existing API. Can you clarify the difference? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. teamdctl state information for Static lag and Dynamic LACP are little different. Dynamic LACP has the following fields along with setup Static Lag will not contain the runner option (Dynamic LACP needs runner option to determine peer lacp link protocol information) { Since Static doesnt have those runner information modifying existing LAG Member table done for LACP can create more collaterals, thats the reason for separating it out between Static and LACP. |
||
{ | ||
|
||
const std::string key = "LAG_TABLE|" + lag_name; | ||
Records lag_values; | ||
|
||
for (const auto & p: m_lag_static_paths) | ||
{ | ||
const auto & path = p.first; | ||
const auto & type = p.second; | ||
const auto & value = get_value(root, path, type); | ||
lag_values.emplace(path, value); | ||
} | ||
storage.emplace(key, lag_values); | ||
|
||
const auto & ports = get_ports(root); | ||
for (const auto & port: ports) | ||
{ | ||
const std::string key = "LAG_MEMBER_TABLE|" + lag_name + "|" + port; | ||
Records member_values; | ||
for (const auto & p: m_member_static_paths) | ||
{ | ||
const auto & path = p.first; | ||
const auto & type = p.second; | ||
const std::string full_path = "ports." + port + "." + path; | ||
const auto & value = get_value(root, full_path, type); | ||
member_values.emplace(path, value); | ||
} | ||
storage.emplace(key, member_values); | ||
} | ||
|
||
return; | ||
} | ||
|
||
/// | ||
/// Extract values for LAG with name lag_name, from the parsed json tree with root, to the temporary storage | ||
/// @param lag_name a name of the LAG | ||
|
@@ -155,6 +196,28 @@ void ValuesStore::extract_values(const std::string & lag_name, json_t * root, Ha | |
|
||
const std::string key = "LAG_TABLE|" + lag_name; | ||
Records lag_values; | ||
|
||
|
||
bool is_static = false; | ||
|
||
for (const auto & p: m_lag_static_paths) | ||
{ | ||
const auto & path = p.first; | ||
const auto & type = p.second; | ||
if (path == "setup.runner_name") { | ||
const auto & value = get_value(root, path, type); | ||
if(value == "loadbalance" || | ||
value == "roundrobin") | ||
is_static = true; | ||
break; | ||
} | ||
} | ||
|
||
if (is_static) { | ||
extract_values_static(lag_name, root, storage); | ||
return; | ||
} | ||
|
||
for (const auto & p: m_lag_paths) | ||
{ | ||
const auto & path = p.first; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe based on HLD discussion the default mode should be loadbalance and not round robin. Can you please clarify why do we have roundrobin defined as default?
sonic-net/SONiC#1039 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition if we have roundrobin how is it achieved in the hardware. If I understand roundrobin is to send one packet per link in roundrobin fashion https://man.archlinux.org/man/teamd.conf.5.en . However we don't have such hash algorithm in SAI.
If SAI is going with loadbalance we should have the same defined in teamd as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @dgsudharsan ,
Apologies for the delay... unwell last week (this week too ... )
No Round Robin is only for Linux traffic (CPU traffic), Right now it is not mapped to saiars.h (which support packet spraying in hardware for ECMP and LAG)
Regarding spec will modify to round robin..
With loadbalance facing issue of 100% teamd always thats the reason for the change to roundrobin.
Thanks,
Kannan.S