SAI NAT aging notification#1365
Merged
rlhui merged 1 commit intoopencomputeproject:masterfrom Feb 28, 2022
Merged
Conversation
Signed-off-by: Arvind Bhat <[email protected]>
kcudnik
approved these changes
Jan 10, 2022
Contributor
Author
|
Updating after review in SAI meeting on Jan 20, 2022:
sai_query_attribute_capability(gSwitchId, SAI_OBJECT_TYPE_NAT_ENTRY, SAI_NAT_ENTRY_ATTR_AGING_TIME, &capability); The returned 'capability' would indicate if SAI supports NAT aging
If this attribute is not specified or if attribute set to 0 (i.e. default), SAI notifies NOS as soon as NAT entry is aged out. |
Collaborator
|
@JaiOCP , @marian-pritsak - please help review/approve? |
Collaborator
|
@JaiOCP - reminder to please review/approve this. Thanks. |
kcudnik
pushed a commit
to sonic-net/sonic-sairedis
that referenced
this pull request
Oct 6, 2022
The sairedis changes related to the SAI here: opencomputeproject/SAI#1365
pettershao-ragilenetworks
pushed a commit
to pettershao-ragilenetworks/sonic-sairedis
that referenced
this pull request
Nov 18, 2022
The sairedis changes related to the SAI here: opencomputeproject/SAI#1365
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In the Hit Bit query mechanism described in https://github.com/opencomputeproject/SAI/blob/master/doc/NAT/SAI-NAT-API.md, the NOS periodically polls the NAT entries for aging out unused entries. In a highly scaled environment with tens of thousands of NAT entries programmed, the frequent polling for aging out is not performant. An alternative is to use a callback from SAI to notify NOS about the NAT entries that are aged out after a certain time.
The NOS registers a callback named sai_nat_event_notification_fn through the switch attribute SAI_SWITCH_ATTR_NAT_EVENT_NOTIFY.
The NOS then create/sets the NAT entry with the optional attribute SAI_NAT_ENTRY_ATTR_AGING_TIME.
nat_entry_attr[0].id = SAI_NAT_ENTRY_ATTR_AGING_TIME;
nat_entry_attr[0].value.u32 = aging_time; // in seconds
If the attribute is not added the NAT entry does not age out. If the aging time is specified as 0, the NAT entry does not age out. The aging time configured can be queried using a GET request of this attribute.
Once the NAT entry ages out, SAI notifies NOS using sai_nat_event_notification_fn callback. This callback provides events of type sai_nat_event_notification_data_t which has information about the specific NAT entries that got aged out. The NOS uses the NAT entry information to delete these NAT entries.