-
Notifications
You must be signed in to change notification settings - Fork 6
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
Fix issues with LACP and nexthop LAG action #146
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -326,6 +326,30 @@ void switchlink_create_lag(switchlink_db_interface_info_t* lag_intf) { | |
return; | ||
} | ||
|
||
/** | ||
* Routine Description: | ||
* Wrapper function to delete lag member | ||
* | ||
* Arguments: | ||
* [in] ifindex - lag member ifindex | ||
* | ||
* Return Values: | ||
* void | ||
*/ | ||
void switchlink_delete_lag_member(uint32_t ifindex) { | ||
switchlink_db_lag_member_info_t lag_member_info; | ||
memset(&lag_member_info, 0, sizeof(switchlink_db_lag_member_info_t)); | ||
lag_member_info.ifindex = ifindex; | ||
if (switchlink_db_get_lag_member_info(&lag_member_info) == | ||
SWITCHLINK_DB_STATUS_ITEM_NOT_FOUND) { | ||
return; | ||
} | ||
|
||
// delete the lag member from backend and DB | ||
delete_lag_member(&lag_member_info, lag_member_info.lag_member_h); | ||
switchlink_db_delete_lag_member(&lag_member_info); | ||
} | ||
|
||
/** | ||
* Routine Description: | ||
* Wrapper function to delete lag | ||
|
@@ -343,6 +367,17 @@ void switchlink_delete_lag(uint32_t ifindex) { | |
return; | ||
} | ||
|
||
/* Delete LAG members for an LACP */ | ||
if (lag_intf.bond_mode == SWITCHLINK_BOND_MODE_LACP) { | ||
uint32_t member_if_index = 0; | ||
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. The loop might be clearer in the following form: for (;;) {
uint32_t member_if_index =
switchlink_db_delete_lacp_member(lag_intf.lag_h);
if (member_if_index == -1) break;
switchlink_delete_lag_member(member_if_index);
} |
||
while (member_if_index != -1) { | ||
member_if_index = switchlink_db_delete_lacp_member(lag_intf.lag_h); | ||
if (member_if_index != -1) { | ||
switchlink_delete_lag_member(member_if_index); | ||
} | ||
} | ||
} | ||
|
||
// delete the lag from backend and DB | ||
delete_lag(&lag_intf, lag_intf.lag_h); | ||
switchlink_db_delete_interface(lag_intf.ifindex); | ||
|
@@ -425,27 +460,3 @@ void switchlink_create_lag_member( | |
|
||
return; | ||
} | ||
|
||
/** | ||
* Routine Description: | ||
* Wrapper function to delete lag member | ||
* | ||
* Arguments: | ||
* [in] ifindex - lag member ifindex | ||
* | ||
* Return Values: | ||
* void | ||
*/ | ||
void switchlink_delete_lag_member(uint32_t ifindex) { | ||
switchlink_db_lag_member_info_t lag_member_info; | ||
memset(&lag_member_info, 0, sizeof(switchlink_db_lag_member_info_t)); | ||
lag_member_info.ifindex = ifindex; | ||
if (switchlink_db_get_lag_member_info(&lag_member_info) == | ||
SWITCHLINK_DB_STATUS_ITEM_NOT_FOUND) { | ||
return; | ||
} | ||
|
||
// delete the lag member from backend and DB | ||
delete_lag_member(&lag_member_info, lag_member_info.lag_member_h); | ||
switchlink_db_delete_lag_member(&lag_member_info); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1132,6 +1132,31 @@ switchlink_db_status_t switchlink_db_delete_lag_member( | |||||
return SWITCHLINK_DB_STATUS_ITEM_NOT_FOUND; | ||||||
} | ||||||
|
||||||
/** | ||||||
* Routine Description: | ||||||
* Lookup through LAG members and fetch the lag member which points to valid | ||||||
* LACP lag_h | ||||||
* | ||||||
* Arguments: | ||||||
* [in] lag_h - LACP LAG handle | ||||||
* | ||||||
* Return Values: | ||||||
* LAG member ifindex on success | ||||||
* -1 otherwise | ||||||
*/ | ||||||
uint32_t switchlink_db_delete_lacp_member(switchlink_handle_t lag_h) { | ||||||
tommy_node* node = tommy_list_head(&switchlink_db_lag_member_obj_list); | ||||||
while (node) { | ||||||
switchlink_db_lag_member_obj_t* obj = node->data; | ||||||
krnlmon_assert(obj != NULL); | ||||||
node = node->next; | ||||||
if ((obj->lag_member_info.lag_h == lag_h)) { | ||||||
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.
Suggested change
|
||||||
return obj->lag_member_info.ifindex; | ||||||
} | ||||||
} | ||||||
return -1; | ||||||
} | ||||||
|
||||||
/** | ||||||
* Routine Description: | ||||||
* Updates oper_state of lag member in switchlink database | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
what is the
0x7
here?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.
He's widening a two-bit mask to three bits, which appears to be the width of the field in the P4 program.