From 806dc80d94ad9ad208cb7a0b44f52b0ad08b04ec Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 15 Apr 2024 19:48:25 +0300 Subject: [PATCH] Add DASH tunnel object Signed-off-by: Marian Pritsak --- .../saiexperimentaldashoutboundcatopa.h | 12 ++ .../saiexperimentaldashoutboundrouting.h | 12 ++ experimental/saiexperimentaldashtunnel.h | 152 ++++++++++++++++++ experimental/saitypesextensions.h | 2 + 4 files changed, 178 insertions(+) create mode 100644 experimental/saiexperimentaldashtunnel.h diff --git a/experimental/saiexperimentaldashoutboundcatopa.h b/experimental/saiexperimentaldashoutboundcatopa.h index 29d56f7a0..72f8729ef 100644 --- a/experimental/saiexperimentaldashoutboundcatopa.h +++ b/experimental/saiexperimentaldashoutboundcatopa.h @@ -142,6 +142,18 @@ typedef enum _sai_outbound_ca_to_pa_entry_attr_t */ SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_METER_CLASS_OVERRIDE, + /** + * @brief Action set_tunnel_mapping, set_private_link_mapping parameter DASH_TUNNEL_ID + * + * @type sai_object_id_t + * @flags CREATE_AND_SET + * @objects SAI_OBJECT_TYPE_DASH_TUNNEL + * @allownull true + * @default SAI_NULL_OBJECT_ID + * @validonly SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_ACTION == SAI_OUTBOUND_CA_TO_PA_ENTRY_ACTION_SET_TUNNEL_MAPPING or SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_ACTION == SAI_OUTBOUND_CA_TO_PA_ENTRY_ACTION_SET_PRIVATE_LINK_MAPPING + */ + SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_DASH_TUNNEL_ID, + /** * @brief Action set_private_link_mapping parameter OVERLAY_SIP * diff --git a/experimental/saiexperimentaldashoutboundrouting.h b/experimental/saiexperimentaldashoutboundrouting.h index 18b57fd94..771f47de9 100644 --- a/experimental/saiexperimentaldashoutboundrouting.h +++ b/experimental/saiexperimentaldashoutboundrouting.h @@ -130,6 +130,18 @@ typedef enum _sai_outbound_routing_entry_attr_t */ SAI_OUTBOUND_ROUTING_ENTRY_ATTR_METER_CLASS, + /** + * @brief Action route_vnet, route_vnet_direct, route_direct, route_service_tunnel parameter DASH_TUNNEL_ID + * + * @type sai_object_id_t + * @flags CREATE_AND_SET + * @objects SAI_OBJECT_TYPE_DASH_TUNNEL + * @allownull true + * @default SAI_NULL_OBJECT_ID + * @validonly SAI_OUTBOUND_ROUTING_ENTRY_ATTR_ACTION == SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_VNET or SAI_OUTBOUND_ROUTING_ENTRY_ATTR_ACTION == SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_VNET_DIRECT or SAI_OUTBOUND_ROUTING_ENTRY_ATTR_ACTION == SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_DIRECT or SAI_OUTBOUND_ROUTING_ENTRY_ATTR_ACTION == SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_SERVICE_TUNNEL + */ + SAI_OUTBOUND_ROUTING_ENTRY_ATTR_DASH_TUNNEL_ID, + /** * @brief Action route_vnet_direct parameter OVERLAY_IP * diff --git a/experimental/saiexperimentaldashtunnel.h b/experimental/saiexperimentaldashtunnel.h new file mode 100644 index 000000000..94fa10e6c --- /dev/null +++ b/experimental/saiexperimentaldashtunnel.h @@ -0,0 +1,152 @@ +/** + * Copyright (c) 2014 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 saiexperimentaldashtunnel.h + * + * @brief This module defines SAI P4 extension interface + */ + +#if !defined (__SAIEXPERIMENTALDASHTUNNEL_H_) +#define __SAIEXPERIMENTALDASHTUNNEL_H_ + +#include + +/** + * @defgroup SAIEXPERIMENTALDASH_TUNNEL SAI - Extension specific API definitions + * + * @{ + */ + +/** + * @brief Attribute ID for dash_tunnel_dash_tunnel + */ +typedef enum _sai_dash_tunnel_attr_t +{ + /** + * @brief Start of attributes + */ + SAI_DASH_TUNNEL_ATTR_START, + + /** + * @brief Action set_tunnel_attrs parameter UNDERLAY_DIP + * + * @type sai_ip_address_t + * @flags CREATE_AND_SET + * @default 0.0.0.0 + */ + SAI_DASH_TUNNEL_ATTR_UNDERLAY_DIP = SAI_DASH_TUNNEL_ATTR_START, + + /** + * @brief Action set_tunnel_attrs parameter DASH_ENCAPSULATION + * + * @type sai_dash_encapsulation_t + * @flags CREATE_AND_SET + * @default SAI_DASH_ENCAPSULATION_VXLAN + */ + SAI_DASH_TUNNEL_ATTR_DASH_ENCAPSULATION, + + /** + * @brief Action set_tunnel_attrs parameter TUNNEL_KEY + * + * @type sai_uint32_t + * @flags CREATE_AND_SET + * @default 0 + */ + SAI_DASH_TUNNEL_ATTR_TUNNEL_KEY, + + /** + * @brief End of attributes + */ + SAI_DASH_TUNNEL_ATTR_END, + + /** Custom range base value */ + SAI_DASH_TUNNEL_ATTR_CUSTOM_RANGE_START = 0x10000000, + + /** End of custom range base */ + SAI_DASH_TUNNEL_ATTR_CUSTOM_RANGE_END, + +} sai_dash_tunnel_attr_t; + +/** + * @brief Create dash_tunnel_dash_tunnel + * + * @param[out] dash_tunnel_id Entry 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_dash_tunnel_fn)( + _Out_ sai_object_id_t *dash_tunnel_id, + _In_ sai_object_id_t switch_id, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list); + +/** + * @brief Remove dash_tunnel_dash_tunnel + * + * @param[in] dash_tunnel_id Entry id + * + * @return #SAI_STATUS_SUCCESS on success Failure status code on error + */ +typedef sai_status_t (*sai_remove_dash_tunnel_fn)( + _In_ sai_object_id_t dash_tunnel_id); + +/** + * @brief Set attribute for dash_tunnel_dash_tunnel + * + * @param[in] dash_tunnel_id Entry id + * @param[in] attr Attribute + * + * @return #SAI_STATUS_SUCCESS on success Failure status code on error + */ +typedef sai_status_t (*sai_set_dash_tunnel_attribute_fn)( + _In_ sai_object_id_t dash_tunnel_id, + _In_ const sai_attribute_t *attr); + +/** + * @brief Get attribute for dash_tunnel_dash_tunnel + * + * @param[in] dash_tunnel_id Entry 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_dash_tunnel_attribute_fn)( + _In_ sai_object_id_t dash_tunnel_id, + _In_ uint32_t attr_count, + _Inout_ sai_attribute_t *attr_list); + +typedef struct _sai_dash_tunnel_api_t +{ + sai_create_dash_tunnel_fn create_dash_tunnel; + sai_remove_dash_tunnel_fn remove_dash_tunnel; + sai_set_dash_tunnel_attribute_fn set_dash_tunnel_attribute; + sai_get_dash_tunnel_attribute_fn get_dash_tunnel_attribute; + sai_bulk_object_create_fn create_dash_tunnels; + sai_bulk_object_remove_fn remove_dash_tunnels; + +} sai_dash_tunnel_api_t; + +/** + * @} + */ +#endif /** __SAIEXPERIMENTALDASHTUNNEL_H_ */ diff --git a/experimental/saitypesextensions.h b/experimental/saitypesextensions.h index 00a3cd559..1df9c0d38 100644 --- a/experimental/saitypesextensions.h +++ b/experimental/saitypesextensions.h @@ -70,6 +70,8 @@ typedef enum _sai_object_type_extensions_t SAI_OBJECT_TYPE_VIP_ENTRY, + SAI_OBJECT_TYPE_DASH_TUNNEL, + /* Add new experimental object types above this line */ SAI_OBJECT_TYPE_EXTENSIONS_RANGE_END