Skip to content
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

Merged
merged 1 commit into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions inc/sainat.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,17 @@ typedef enum _sai_nat_entry_attr_t
*/
SAI_NAT_ENTRY_ATTR_HIT_BIT,

/**
* @brief NAT entry aging time in seconds
*
* Zero means aging is disabled.
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default 0
*/
SAI_NAT_ENTRY_ATTR_AGING_TIME,

/**
* @brief End of NAT Entry attributes
*/
Expand Down Expand Up @@ -334,6 +345,34 @@ typedef struct _sai_nat_entry_t

} sai_nat_entry_t;

/**
* @brief NAT event type
*/
typedef enum _sai_nat_event_t
{
/** NAT entry event none */
SAI_NAT_EVENT_NONE,

/** NAT entry event aged */
SAI_NAT_EVENT_AGED,

} sai_nat_event_t;

/**
* @brief Notification data format received from SAI NAT callback
*
* @count attr[attr_count]
*/
typedef struct _sai_nat_event_notification_data_t
{
/** Event type */
sai_nat_event_t event_type;

/** NAT entry */
sai_nat_entry_t nat_entry;

} sai_nat_event_notification_data_t;

/**
* @brief Create and return a NAT object
*
Expand Down Expand Up @@ -384,6 +423,18 @@ typedef sai_status_t (*sai_get_nat_entry_attribute_fn)(
_In_ uint32_t attr_count,
_Inout_ sai_attribute_t *attr_list);

/**
* @brief NAT notifications
*
* @count data[count]
*
* @param[in] count Number of notifications
* @param[in] data Pointer to NAT event notification data array
*/
typedef void (*sai_nat_event_notification_fn)(
_In_ uint32_t count,
_In_ const sai_nat_event_notification_data_t *data);

/**
* @brief Bulk create NAT entry
*
Expand Down
11 changes: 11 additions & 0 deletions inc/saiswitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -2695,6 +2695,17 @@ typedef enum _sai_switch_attr_t
*/
SAI_SWITCH_ATTR_IPSEC_SA_STATUS_CHANGE_NOTIFY,

/**
* @brief NAT event notification callback function passed to the adapter.
*
* Use sai_nat_event_notification_fn as notification function.
*
* @type sai_pointer_t sai_nat_event_notification_fn
* @flags CREATE_AND_SET
* @default NULL
*/
SAI_SWITCH_ATTR_NAT_EVENT_NOTIFY,

/**
* @brief End of attributes
*/
Expand Down
1 change: 1 addition & 0 deletions meta/parse.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2520,6 +2520,7 @@ sub ProcessStructValueType
return "SAI_ATTR_VALUE_TYPE_INT32" if defined $SAI_ENUMS{$type}; # enum

return "-1" if $type eq "sai_fdb_entry_t";
return "-1" if $type eq "sai_nat_entry_t";
return "-1" if $type eq "sai_attribute_t*";

LogError "invalid struct member value type $type";
Expand Down