From d379320a032ee9b54868c987f8687ea4c5a04cd7 Mon Sep 17 00:00:00 2001 From: nshinoud Date: Mon, 8 Jul 2024 14:33:34 -0400 Subject: [PATCH] Prefix Compression feature addition to SAI --- doc/ACL/SAI-Proposal-ACL-Bincode.md | 159 +++++++++++++ doc/SAI-Proposal-Prefix-Compression.md | 271 ++++++++++++++++++++++ inc/sai.h | 1 + inc/saiacl.h | 72 +++++- inc/saiobject.h | 4 + inc/saiprefixcompression.h | 305 +++++++++++++++++++++++++ inc/saitypes.h | 2 + meta/acronyms.txt | 1 + 8 files changed, 813 insertions(+), 2 deletions(-) create mode 100644 doc/ACL/SAI-Proposal-ACL-Bincode.md create mode 100644 doc/SAI-Proposal-Prefix-Compression.md create mode 100644 inc/saiprefixcompression.h diff --git a/doc/ACL/SAI-Proposal-ACL-Bincode.md b/doc/ACL/SAI-Proposal-ACL-Bincode.md new file mode 100644 index 000000000..5df42a929 --- /dev/null +++ b/doc/ACL/SAI-Proposal-ACL-Bincode.md @@ -0,0 +1,159 @@ +# ACL BINCODE Field Matching +------------------------------------------------------------------------------- + Title | ACL BINCODE Field Matching +-------------|----------------------------------------------------------------- + Authors | Nader Shinouda, Cisco + Status | In review + Type | Standards track + Created | 2024-07-01 - Initial Draft + SAI-Version | 1.14 +------------------------------------------------------------------------------- + + +## 1.0 Introduction ## + +This spec enhances the existing ACL spec to add support for bincode field matching. Bincode is part of prefix compression, where an IP prefix is mapped to Bincode. + +New table attributes allow setting a source and destination prefix compression tables on the creation of an ACL table. New field entry attributes allow for matching on a specific bincode from either the source or destionation prefix tables. + +## 2.0 Specification ## + +New table attributes allow for setting both the source and destination prefix compression tables that will be used in field matching +```c + /** + * @brief SRC BINCODE + * + * This key is dedicated to matching on a SRC BINCODE + * + * @type bool + * @flags CREATE_ONLY + * @default false + */ + SAI_ACL_TABLE_ATTR_FIELD_SRC_PREFIX_BINCODE + + /** + * @brief DST BINCODE + * + * This key is dedicated to matching on a DST BINCODE + * + * @type bool + * @flags CREATE_ONLY + * @default false + */ + SAI_ACL_TABLE_ATTR_FIELD_DST_PREFIX_BINCODE + + /** + * @brief SRC prefix Table Object ID + * + * An object pointer to a prefix table used for + * source prefix lookups + * + * @type sai_object_id_t + * @flags CREATE_ONLY + * @objects SAI_OBJECT_TYPE_PREFIX_COMPRESSION_TABLE + * @allownull true + * @default SAI_NULL_OBJECT_ID + */ + SAI_ACL_TABLE_ATTR_SRC_PREFIX_COMPRESSION_TABLE, + + /** + * @brief DST prefix Table Object ID + * + * An object pointer to a prefix table used for + * destination prefix lookups + * + * @type sai_object_id_t + * @flags CREATE_ONLY + * @objects SAI_OBJECT_TYPE_PREFIX_COMPRESSION_TABLE + * @allownull true + * @default SAI_NULL_OBJECT_ID + */ + SAI_ACL_TABLE_ATTR_DST_PREFIX_COMPRESSION_TABLE, +``` + +New field entry attributes allow for lookups based on a bincode value. + +```c + /** + * @brief SRC BINCODE + * + * @type sai_acl_field_data_t sai_uint32_t + * @flags CREATE_AND_SET + * @default disabled + */ + SAI_ACL_ENTRY_ATTR_FIELD_SRC_PREFIX_BINCODE, + + /** + * @brief DST BINCODE + * + * @type sai_acl_field_data_t sai_uint32_t + * @flags CREATE_AND_SET + * @default disabled + */ + SAI_ACL_ENTRY_ATTR_FIELD_DST_PREFIX_BINCODE, +``` + +## 3.0 Examples ## + +```c +// Example: Create Prefix Compression Table +sai_attr_table_list[0].id = SAI_PREFIX_COMPRESSION_TABLE_ATTR_DEFAULT_ENTRY_BINCODE; +sai_attr_table_list[0].value.u32 = 9000; +attr_table_count = 1; + +// Create SRC Prefix Table +sai_create_prefix_compression_table_fn( + &src_prefix_compression_table_id, + switch_id, + attr_table_count, + sai_attr_table_list); + +// Example: Create Prefix Compression Entries +// IPV4 First Entry source prefix table +sai_prefix_compression_entry_t entry_v4_src_1; +entry_v4_src_1.switch_id = switch_id; +entry_v4_src_1.prefix_table_id = src_prefix_compression_table_id; +entry_v4_src_1.prefix.addr_family = SAI_IP_ADDR_FAMILY_IPV4; +entry_v4_src_1.prefix.addr.ipv4 = "1.1.1.1"; +entry_v4_src_1.prefix_mask.ipv4 = "255.255.255.0"; +sai_attr_list_src[1].id = SAI_PREFIX_COMPRESSION_ENTRY_ATTR_BINCODE; +sai_attr_list_src[1].value.u32 = 500; + +entry_list_src = [entry_v4_src_1]; +entry_list_size = 1; +attr_count_src = 1; +sai_status_t bulk_status; + +// Adding using bulk add +sai_bulk_create_prefix_compression_entry_fn( + entry_list_size, + entry_list_src, + attr_count_src, + sai_attr_list_src, + SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, + bulk_status); + +// Create ACL table +sai_table_attr_list[0].id = SAI_ACL_TABLE_ATTR_SRC_PREFIX_COMPRESSION_TABLE; +sai_table_attr_list[0].value.oid = src_prefix_compression_table_id; +sai_table_attr_count = 1; + +sai_create_acl_table_fn( + &acl_table_id, + switch_id, + sai_table_attr_count, + sai_table_attr_list); + +sai_entry_attr_list[0].id = SAI_ACL_ENTRY_ATTR_FIELD_SRC_PREFIX_BINCODE; +sai_attr_list[1].value.aclfield.enable = true; +sai_attr_list[1].value.aclfield.mask = 0xFFFFFF; +sai_attr_list[1].value.aclfield.data = 500; +sai_entry_attr_count = 1; + +// Create an Entry to match on Bincode 1 +sai_create_acl_entry_fn( + &acl_entry_id, + switch_id, + sai_entry_attr_count, + sai_entry_attr_list); +``` \ No newline at end of file diff --git a/doc/SAI-Proposal-Prefix-Compression.md b/doc/SAI-Proposal-Prefix-Compression.md new file mode 100644 index 000000000..d1c3b3d3d --- /dev/null +++ b/doc/SAI-Proposal-Prefix-Compression.md @@ -0,0 +1,271 @@ +# Prefix Compression # +------------------------------------------------------------------------------- + Title | Prefix Compression +-------------|----------------------------------------------------------------- + Authors | Nader Shinouda, Cisco + Status | In review + Type | Standards track + Created | 2024-07-1 - Initial Draft + SAI-Version | 1.14 +------------------------------------------------------------------------------- + + +## 1.0 Introduction ## + +This spec adds Prefix Compression. Prefix Compression allows mapping an IP prefix/mask to a bincode. These prefix/bincode mapping can be grouped together to form prefix compression table. Tables can have both IPV4 and IPV6 entries. + +Prefix Compression tables can be used in features such as ACL to match on a specific bincode. This allows additional functionality to ACL or any feature that can take advantage of such groupings. + +## 1.1.0 Function Requirement of Prefix Compression +- Enable the creation of a prefix compresison table as a SAI object +- Enable adding IPV4/IPV6 Prefix mapping to a BINCODE value + +## 2.0 Specification ## + +A prefix compression tables is represented by an object of SAI_PREFIX_COMPRESSION_TABLE. The creation of this object will allocate an empty table that can be used later to add specific entries to it. + +### sai.h ### +New type SAI_API_PREFIX_COMPRESSION is added into sai_api_t + +### saiobject.h ### +New entry sai_prefix_compression_entry_t prefix_compression_entry. + + +### saitypes.h ### +Two new types: SAI_OBJECT_TYPE_PREFIX_COMPRESSION_TABLE and SAI_OBJECT_TYPE_PREFIX_COMPRESSION_ENTRY + +### New Header saiprefixcompression.h ### + +#### sai_prefix_compression_table_attr_t #### +This defines the prefix compression attributes table + +Tables are composed of prefix compression entries. These entries map a specific IP prefix to a bincode. Both IPV4 and IPV6 entries can be added to the same table. During a table creation a bincode must be provided for the default entry. A default entry bincode is a default bincode applied to any address that does not match a prefix in the table. A default entry is an entry where the prefix/length is zero + +IPV4 defaulty entry: 0.0.0.0/0.0.0.0 +IPV6 default entry: ::/:: + +```c +typedef enum _sai_prefix_compression_table_attr_t +{ + /** + * @brief Start of attributes + */ + SAI_PREFIX_COMPRESSION_TABLE_ATTR_START, + + /** + * @brief Label attribute used to unique identify Table. + * + * @type char + * @flags CREATE_AND_SET + * @default "" + */ + SAI_PREFIX_COMPRESSION_TABLE_ATTR_LABEL = SAI_PREFIX_COMPRESSION_TABLE_ATTR_START, + + /** + * @brief Prefix Compression table default entry bincode. + * Bincode applied to any address that does not match a prefix in the table + * + * @type sai_uint32_t + * @flags MANDATORY_ON_CREATE | CREATE_AND_SET + */ + SAI_PREFIX_COMPRESSION_TABLE_ATTR_DEFAULT_ENTRY_BINCODE, + +``` + +#### sai_prefix_compression_entry_attr_t #### + +Attributes structure for prefix compression entries + +```c + /** + * @brief Attribute Id for SAI prefix compression object + */ + typedef enum _sai_prefix_compression_entry_attr_t + { + /** + * @brief Start of attributes + */ + SAI_PREFIX_COMPRESSION_ENTRY_ATTR_START, + + /** + * @brief Prefix Compression entry Bincode + * + * @type sai_uint32_t + * @flags MANDATORY_ON_CREATE | CREATE_AND_SET + */ + SAI_PREFIX_COMPRESSION_ENTRY_ATTR_BINCODE = SAI_PREFIX_COMPRESSION_ENTRY_ATTR_START, +``` + +#### sai_prefix_compression_entry_t #### + +This structure defines a prefix compression entry. A prefix compression entry is composed of switch ID, a table ID that the entry will be added to and a IP prefix + +```c +typedef struct _sai_prefix_compression_entry_t +{ + /** + * @brief Switch ID + * + * @objects SAI_OBJECT_TYPE_SWITCH + */ + sai_object_id_t switch_id; + + /** + * @brief Prefix Compression Table ID + * + * @objects SAI_OBJECT_TYPE_PREFIX_COMPRESSION_TABLE + */ + sai_object_id_t prefix_table_id; + + /** + * @brief IP Prefix Destination + */ + sai_ip_prefix_t prefix; +``` + +#### sai_create_prefix_compression_table_fn #### +This defines the interface to create prefix compression table + +- prefix_compression_table_id (Out): Prefix Compression table object ID +- switch_id (In): The ID of the switch on which the ICMP ECHO session is to be created. +- attr_count (In): The number of attributes provided in the attr_list. +- attr_list (In): An array of sai_attribute_t structures containing the attribute key-value pairs to configure the ICMP ECHO session. + +#### sai_remove_prefix_compression_table_fn #### +The function takes a Prefix Compression object ID as a parameter. The function returns SAI_STATUS_SUCCESS if the operation is successful; otherwise, it returns a different error code indicating the nature of the failure. + +#### sai_set_prefix_compression_table_attribute_fn #### +This defines the interfaces to update prefix compression table. It requires the unique identifier prefix_compression_table_id, and the attr parameter represents the attribute to be set along with its value. The function returns SAI_STATUS_SUCCESS if the operation is successful; otherwise, it returns an error code, indicating the nature of the failure. + +#### sai_get_prefix_compression_table_attribute_fn #### +It takes the unique identifier prefix_compression_table_id to specify the Prefix Compression table for which attributes are to be retrieved. The attr_count parameter indicates the number of attributes in the attr_list, and the attr_list itself holds the values of the requested attributes. + +#### sai_create_prefix_compression_entry_fn #### +This defines the interface to create prefix compression entry + +- prefix_compression_entry (In): Prefix Compression table object ID +- attr_count (In): The number of attributes provided in the attr_list. +- attr_list (In): An array of sai_attribute_t structures containing the attribute key-value pairs to configure the ICMP ECHO session. + +#### sai_set_prefix_compression_entry_attribute_fn #### +This defines the interfaces to update prefix compression entry. It takes the entry to be modified, and the attr parameter represents the attribute to be set along with its value. The function returns SAI_STATUS_SUCCESS if the operation is successful; otherwise, it returns an error code, indicating the nature of the failure. + +#### sai_get_prefix_compression_entry_attribute_fn #### +It takes a specific entry that will be used to reterive information about the entry. The attr_count parameter indicates the number of attributes in the attr_list, and the attr_list itself holds the values of the requested attributes. + +#### sai_bulk_create_prefix_compression_entry_fn #### +This defines a bulk entry create API that is used to create multiple entries at once. This API takes: +- object_count (In): Number of objects to create +- prefix_compression_entry (In): List of object to create +- attr_count (In): List of attr_count. Caller passes the number of attribute for each object to create. +- attr_list (In): List of attributes for every object. +- mode (In): Bulk operation error handling mode. +- object_statuses (Out): List of status for every object. Caller needs to allocate the buffer + +#### sai_bulk_remove_prefix_compression_entry_fn #### +This defines a bulk remove of entries in a prefix compression table: +- object_count (In): Number of objects to remove +- prefix_compression_entry (In): List of objects to remove +- mode (In): Bulk operation error handling mode. +- object_statuses (Out): List of status for every object. Caller needs to allocate the buffer + +#### sai_prefix_compression_api_t #### +```c +typedef struct _sai_prefix_compression_api_t +{ + sai_create_prefix_compression_table_fn create_prefix_compression_table; + sai_remove_prefix_compression_table_fn remove_prefix_compression_table; + sai_set_prefix_compression_table_attribute_fn set_prefix_compression_table_attribute; + sai_get_prefix_compression_table_attribute_fn get_prefix_compression_table_attribute; + sai_create_prefix_compression_entry_fn create_prefix_compression_entry; + sai_remove_prefix_compression_entry_fn remove_prefix_compression_entry; + sai_set_prefix_compression_entry_attribute_fn set_prefix_compression_entry_attribute; + sai_get_prefix_compression_entry_attribute_fn get_prefix_compression_entry_attribute; + sai_bulk_create_prefix_compression_entry_fn create_prefix_compression_entries; + sai_bulk_remove_prefix_compression_entry_fn remove_prefix_compression_entries; +} sai_prefix_compression_api_t; +``` + +## 3 Examples + +## 3.0.1 Create Prefix Compression Table with entries + +```c +sai_attr_table_list[]; +sai_attr_table_list[0].id = SAI_PREFIX_COMPRESSION_TABLE_ATTR_DEFAULT_ENTRY_BINCODE; +sai_attr_table_list[0].value.u32 = 9000; +attr_table_count = 0; +sai_create_prefix_compression_table_fn( + &src_prefix_compression_table_id, + switch_id, + attr_table_count, + sai_attr_table_list); + +// Example: Create Prefix Compression Entries +// IPV4 First Entry +sai_prefix_compression_entry_t entry_v4_1; +entry_v4_1.switch_id = switch_id; +entry_v4_1.prefix_table_id = src_prefix_compression_table_id; +entry_v4_1.prefix.addr_family = SAI_IP_ADDR_FAMILY_IPV4; +entry_v4_1.prefix.addr.ipv4 = "1.1.1.1"; +entry_v4_1.prefix_mask.ipv4 = "255.255.255.0"; +sai_entry_list[0].id = SAI_PREFIX_COMPRESSION_ENTRY_ATTR_BINCODE; +sai_entry_list[0].value.u32 = 2; + +// IPV4 Second Entry +sai_prefix_compression_entry_t entry_v4_1; +entry_v4_1.switch_id = switch_id; +entry_v4_1.prefix_table_id = src_prefix_compression_table_id; +entry_v4_1.prefix.addr_family = SAI_IP_ADDR_FAMILY_IPV4; +entry_v4_1.prefix.addr.ipv4 = "2.2.2.1"; +entry_v4_1.prefix_mask.ipv4 = "255.255.255.0"; +sai_entries_attribute_list[0].id = SAI_PREFIX_COMPRESSION_ENTRY_ATTR_BINCODE; +sai_entries_attribute_list[0].value.u32 = 800; + +// IPV6 Entry +sai_prefix_compression_entry_t entry_v6_1; +entry_v6_1.switch_id = switch_id; +entry_v6_1.prefix_table_id = src_prefix_compression_table_id; +entry_v6_1.prefix.addr_family = SAI_IP_ADDR_FAMILY_IPV6; +entry_v6_1.prefix.addr.ipv4 ="2001:1::4"; +entry_v6_1.prefix_mask = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffc"; +sai_entries_attribute_list[1].id = SAI_PREFIX_COMPRESSION_ENTRY_ATTR_BINCODE; +sai_entries_attribute_list[1].value.u32 = 4; + +entries_list = [entry_v4_2, entry_v6_1]; +entries_list_size = 2; +sai_status_t bulk_status; + +// Adding a single entry to a table +sai_attr_list_count = 1; +sai_create_prefix_compression_entry_fn( + entry_v4_1, + sai_attr_list, + sai_attr_list_count); + +// Adding using bulk add +attr_entries_count = 2; +sai_bulk_create_prefix_compression_entry_fn( + entries_list_size, + entries_list, + attr_entries_count, + sai_entries_attribute_list, + SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, + bulk_status); + +// Remove Single Entry +sai_remove_prefix_compression_entry_fn( + entry_v4_1); + +// Remove Bulk Entries +sai_bulk_remove_prefix_compression_entry_fn( + entries_list_size, + entries_list, + SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, + bulk_status); + +// Remove Prefix Compression Table +sai_remove_prefix_compression_table_fn( + src_prefix_compression_table_id); + +``` \ No newline at end of file diff --git a/inc/sai.h b/inc/sai.h index f33293364..05660b859 100644 --- a/inc/sai.h +++ b/inc/sai.h @@ -148,6 +148,7 @@ typedef enum _sai_api_t SAI_API_ARS_PROFILE = 49, /** #include #include +#include /* new experimental object type includes */ #include @@ -111,6 +112,9 @@ typedef union _sai_object_key_entry_t /** @validonly object_type == SAI_OBJECT_TYPE_PA_VALIDATION_ENTRY */ sai_pa_validation_entry_t pa_validation_entry; + /** @validonly object_type == SAI_OBJECT_TYPE_PREFIX_COMPRESSION_ENTRY */ + sai_prefix_compression_entry_t prefix_compression_entry; + /** @validonly object_type == SAI_OBJECT_TYPE_VIP_ENTRY */ sai_vip_entry_t vip_entry; diff --git a/inc/saiprefixcompression.h b/inc/saiprefixcompression.h new file mode 100644 index 000000000..5367cc965 --- /dev/null +++ b/inc/saiprefixcompression.h @@ -0,0 +1,305 @@ +/** + * Copyright (c) 2024 Microsoft Open Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT + * LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS + * FOR A PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT. + * + * See the Apache Version 2.0 License for specific language governing + * permissions and limitations under the License. + * + * Microsoft would like to thank the following companies for their review and + * assistance with these files: Intel Corporation, Mellanox Technologies Ltd, + * Dell Products, L.P., Facebook, Inc., Marvell International Ltd. + * + * @file saiprefixcompression.h + * + * @brief This module defines SAI prefix compression interface + */ + +#if !defined (__SAIPREFIXCOMPRESSION_H_) +#define __SAIPREFIXCOMPRESSION_H_ + +#include + +/** + * @defgroup SAIPREFIXCOMPRESSION SAI - Prefix Compression API definitions + * + * @{ + */ + +/** + * @brief Attribute Id for SAI prefix compression object + */ +typedef enum _sai_prefix_compression_table_attr_t +{ + /** + * @brief Start of attributes + */ + SAI_PREFIX_COMPRESSION_TABLE_ATTR_START, + + /** + * @brief Label attribute used to unique identify Table. + * + * @type char + * @flags CREATE_AND_SET + * @default "" + */ + SAI_PREFIX_COMPRESSION_TABLE_ATTR_LABEL = SAI_PREFIX_COMPRESSION_TABLE_ATTR_START, + + /** + * @brief Prefix Compression table default entry BINCODE. + * BINCODE applied to any address that does not match a prefix in the table + * + * @type sai_uint32_t + * @flags MANDATORY_ON_CREATE | CREATE_AND_SET + */ + SAI_PREFIX_COMPRESSION_TABLE_ATTR_DEFAULT_ENTRY_BINCODE, + + /** + * @brief End of attributes + */ + SAI_PREFIX_COMPRESSION_TABLE_ATTR_END, + + /** Custom range base value */ + SAI_PREFIX_COMPRESSION_TABLE_ATTR_CUSTOM_RANGE_START = 0x10000000, + + /** End of custom range base */ + SAI_PREFIX_COMPRESSION_TABLE_ATTR_CUSTOM_RANGE_END + +} sai_prefix_compression_table_attr_t; + +/** + * @brief Attribute Id for SAI prefix compression object + */ +typedef enum _sai_prefix_compression_entry_attr_t +{ + /** + * @brief Start of attributes + */ + SAI_PREFIX_COMPRESSION_ENTRY_ATTR_START, + + /** + * @brief Prefix Compression entry BINCODE + * + * @type sai_uint32_t + * @flags MANDATORY_ON_CREATE | CREATE_AND_SET + */ + SAI_PREFIX_COMPRESSION_ENTRY_ATTR_BINCODE = SAI_PREFIX_COMPRESSION_ENTRY_ATTR_START, + + /** + * @brief End of attributes + */ + SAI_PREFIX_COMPRESSION_ENTRY_ATTR_END, + + /** Custom range base value */ + SAI_PREFIX_COMPRESSION_ENTRY_ATTR_CUSTOM_RANGE_START = 0x10000000, + + /** End of custom range base */ + SAI_PREFIX_COMPRESSION_ENTRY_ATTR_CUSTOM_RANGE_END + +} sai_prefix_compression_entry_attr_t; + +/** + * @brief Prefix Compression entry + */ +typedef struct _sai_prefix_compression_entry_t +{ + /** + * @brief Switch ID + * + * @objects SAI_OBJECT_TYPE_SWITCH + */ + sai_object_id_t switch_id; + + /** + * @brief Prefix Compression Table ID + * + * @objects SAI_OBJECT_TYPE_PREFIX_COMPRESSION_TABLE + */ + sai_object_id_t prefix_table_id; + + /** + * @brief IP Prefix Destination + */ + sai_ip_prefix_t prefix; + +} sai_prefix_compression_entry_t; + +/** + * @brief Create prefix compression table + * + * @param[out] prefix_compression_table_id Prefix compression table ID + * @param[in] switch_id Switch id + * @param[in] attr_count Number of attributes + * @param[in] attr_list Array of attributes + * + * @return #SAI_STATUS_SUCCESS on success, failure status code on error + */ +typedef sai_status_t (*sai_create_prefix_compression_table_fn)( + _Out_ sai_object_id_t *prefix_compression_table_id, + _In_ sai_object_id_t switch_id, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list); + +/** + * @brief Remove prefix compression table + * + * @param[in] prefix_compression_table_id Prefix compression table ID + * + * @return #SAI_STATUS_SUCCESS on success, failure status code on error + */ +typedef sai_status_t (*sai_remove_prefix_compression_table_fn)( + _In_ sai_object_id_t prefix_compression_table_id); + +/** + * @brief Set prefix compression attribute Value + * + * @param[in] prefix_compression_table_id Prefix compression table ID + * @param[in] attr Attribute + * + * @return #SAI_STATUS_SUCCESS on success, failure status code on error + */ +typedef sai_status_t (*sai_set_prefix_compression_table_attribute_fn)( + _In_ sai_object_id_t prefix_compression_table_id, + _In_ const sai_attribute_t *attr); + +/** + * @brief Get prefix compression attribute Value + * + * @param[in] prefix_compression_table_id Prefix compression table ID + * @param[in] attr_count Number of attributes + * @param[inout] attr_list Array of attributes + * + * @return #SAI_STATUS_SUCCESS on success, failure status code on error + */ +typedef sai_status_t (*sai_get_prefix_compression_table_attribute_fn)( + _In_ sai_object_id_t prefix_compression_table_id, + _In_ uint32_t attr_count, + _Inout_ sai_attribute_t *attr_list); + +/** + * @brief Create prefix compression Entry + * + * Note: IP prefix/mask expected in Network Byte Order. + * + * @param[in] prefix_compression_entry Prefix Compression entry + * @param[in] attr_count Number of attributes + * @param[in] attr_list Array of attributes + * + * @return #SAI_STATUS_SUCCESS on success, failure status code on error + */ +typedef sai_status_t (*sai_create_prefix_compression_entry_fn)( + _In_ const sai_prefix_compression_entry_t *prefix_compression_entry, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list); + +/** + * @brief Remove prefix compression Entry + * + * Note: IP prefix/mask expected in Network Byte Order. + * + * @param[in] prefix_compression_entry Prefix Compression entry + * + * @return #SAI_STATUS_SUCCESS on success, failure status code on error + */ +typedef sai_status_t (*sai_remove_prefix_compression_entry_fn)( + _In_ const sai_prefix_compression_entry_t *prefix_compression_entry); + +/** + * @brief Set prefix compression attribute value + * + * @param[in] prefix_compression_entry Prefix Compression entry + * @param[in] attr Attribute + * + * @return #SAI_STATUS_SUCCESS on success, failure status code on error + */ +typedef sai_status_t (*sai_set_prefix_compression_entry_attribute_fn)( + _In_ const sai_prefix_compression_entry_t *prefix_compression_entry, + _In_ const sai_attribute_t *attr); + +/** + * @brief Get prefix compression attribute value + * + * @param[in] prefix_compression_entry Prefix Compression entry + * @param[in] attr_count Number of attributes + * @param[inout] attr_list Array of attributes + * + * @return #SAI_STATUS_SUCCESS on success, failure status code on error + */ +typedef sai_status_t (*sai_get_prefix_compression_entry_attribute_fn)( + _In_ const sai_prefix_compression_entry_t *prefix_compression_entry, + _In_ uint32_t attr_count, + _Inout_ sai_attribute_t *attr_list); + +/** + * @brief Bulk create prefix compression entry + * + * @param[in] object_count Number of objects to create + * @param[in] prefix_compression_entry List of object to create + * @param[in] attr_count List of attr_count. Caller passes the number + * of attribute for each object to create. + * @param[in] attr_list List of attributes for every object. + * @param[in] mode Bulk operation error handling mode. + * @param[out] object_statuses List of status for every object. Caller needs to + * allocate the buffer + * + * @return #SAI_STATUS_SUCCESS on success when all objects are created or + * #SAI_STATUS_FAILURE when any of the objects fails to create. When there is + * failure, Caller is expected to go through the list of returned statuses to + * find out which fails and which succeeds. + */ +typedef sai_status_t (*sai_bulk_create_prefix_compression_entry_fn)( + _In_ uint32_t object_count, + _In_ const sai_prefix_compression_entry_t *prefix_compression_entry, + _In_ const uint32_t *attr_count, + _In_ const sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses); + +/** + * @brief Bulk remove prefix compression entry + * + * @param[in] object_count Number of objects to remove + * @param[in] prefix_compression_entry List of objects to remove + * @param[in] mode Bulk operation error handling mode. + * @param[out] object_statuses List of status for every object. Caller needs to + * allocate the buffer + * + * @return #SAI_STATUS_SUCCESS on success when all objects are removed or + * #SAI_STATUS_FAILURE when any of the objects fails to remove. When there is + * failure, Caller is expected to go through the list of returned statuses to + * find out which fails and which succeeds. + */ +typedef sai_status_t (*sai_bulk_remove_prefix_compression_entry_fn)( + _In_ uint32_t object_count, + _In_ const sai_prefix_compression_entry_t *prefix_compression_entry, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses); + +/** + * @brief Prefix Compression methods table retrieved with sai_api_query() + */ +typedef struct _sai_prefix_compression_api_t +{ + sai_create_prefix_compression_table_fn create_prefix_compression_table; + sai_remove_prefix_compression_table_fn remove_prefix_compression_table; + sai_set_prefix_compression_table_attribute_fn set_prefix_compression_table_attribute; + sai_get_prefix_compression_table_attribute_fn get_prefix_compression_table_attribute; + sai_create_prefix_compression_entry_fn create_prefix_compression_entry; + sai_remove_prefix_compression_entry_fn remove_prefix_compression_entry; + sai_set_prefix_compression_entry_attribute_fn set_prefix_compression_entry_attribute; + sai_get_prefix_compression_entry_attribute_fn get_prefix_compression_entry_attribute; + sai_bulk_create_prefix_compression_entry_fn create_prefix_compression_entries; + sai_bulk_remove_prefix_compression_entry_fn remove_prefix_compression_entries; +} sai_prefix_compression_api_t; + +/** + * @} + */ +#endif /** __SAIPREFIXCOMPRESSION_H_ */ diff --git a/inc/saitypes.h b/inc/saitypes.h index 3ec3c9984..eb9c77b66 100644 --- a/inc/saitypes.h +++ b/inc/saitypes.h @@ -298,6 +298,8 @@ typedef enum _sai_object_type_t SAI_OBJECT_TYPE_POE_DEVICE = 108, SAI_OBJECT_TYPE_POE_PSE = 109, SAI_OBJECT_TYPE_POE_PORT = 110, + SAI_OBJECT_TYPE_PREFIX_COMPRESSION_TABLE = 111, + SAI_OBJECT_TYPE_PREFIX_COMPRESSION_ENTRY = 112, /** Must remain in last position */ SAI_OBJECT_TYPE_MAX, diff --git a/meta/acronyms.txt b/meta/acronyms.txt index 4e58ad9c2..8c369348a 100644 --- a/meta/acronyms.txt +++ b/meta/acronyms.txt @@ -10,6 +10,7 @@ ASIC - Application Specific Integrated Circuit BFD - Bidirectional Forwarding Detection BFDV6 - Bidirectional Forwarding Detection for IPv6 BGP - Border Gateway Protocol +BINCODE - Binary code BMTOR - Behavioral Model Top-of-Rack BOS - Bottom Of Stack BW - Bandwidth