-
Notifications
You must be signed in to change notification settings - Fork 497
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
SAI NAT aging notification #1365
Conversation
Signed-off-by: Arvind Bhat <[email protected]>
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.
|
@JaiOCP , @marian-pritsak - please help review/approve? |
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.
lgtm
@JaiOCP - reminder to please review/approve this. Thanks. |
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.
Looks Good
The sairedis changes related to the SAI here: opencomputeproject/SAI#1365
The sairedis changes related to the SAI here: opencomputeproject/SAI#1365
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.