Skip to content

Commit c1e840b

Browse files
SAI proposal for icmp echo offload (#1943)
This specification suggests: The idea of an ICMP echo object or session that can be transferred to HW/ASIC or other modules for faster link detection. The introduction of SAI APIs to outline ICMP echo session properties. The introduction of a switch-level notification API to monitor changes in ICMP echo session states.
1 parent d90568e commit c1e840b

File tree

7 files changed

+808
-0
lines changed

7 files changed

+808
-0
lines changed

doc/SAI-Proposal-ICMP-ECHO_Extensions.md

Lines changed: 415 additions & 0 deletions
Large diffs are not rendered by default.
37.6 KB
Loading
Lines changed: 376 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,376 @@
1+
/**
2+
* Copyright (c) 2014 Microsoft Open Technologies, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
5+
* not use this file except in compliance with the License. You may obtain
6+
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR
9+
* CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
10+
* LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS
11+
* FOR A PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
12+
*
13+
* See the Apache Version 2.0 License for specific language governing
14+
* permissions and limitations under the License.
15+
*
16+
* Microsoft would like to thank the following companies for their review and
17+
* assistance with these files: Intel Corporation, Mellanox Technologies Ltd,
18+
* Dell Products, L.P., Facebook, Inc., Marvell International Ltd.
19+
*
20+
* @file saiexperimentalicmpecho.h
21+
*
22+
* @brief This module defines SAI extension interface
23+
*/
24+
25+
#if !defined (__SAIEXPERIMENTALICMPECHO_H_)
26+
#define __SAIEXPERIMENTALICMPECHO_H_
27+
28+
#include <saitypes.h>
29+
30+
/**
31+
* @defgroup SAIICMPECHO SAI - ICMP_ECHO Extension specific public APIs and data structures
32+
*
33+
* @{
34+
*/
35+
36+
/**
37+
* @brief SAI ICMP_ECHO session state
38+
*/
39+
typedef enum _sai_icmp_echo_session_state_t
40+
{
41+
/** ICMP_ECHO Session is in Down */
42+
SAI_ICMP_ECHO_SESSION_STATE_DOWN = 0,
43+
44+
/** ICMP_ECHO Session is Up */
45+
SAI_ICMP_ECHO_SESSION_STATE_UP,
46+
47+
} sai_icmp_echo_session_state_t;
48+
49+
/**
50+
* @brief Defines the operational status of the ICMP_ECHO session
51+
*/
52+
typedef struct _sai_icmp_echo_session_state_notification_t
53+
{
54+
/**
55+
* @brief ICMP_ECHO Session id
56+
*
57+
* @objects SAI_OBJECT_TYPE_ICMP_ECHO_SESSION
58+
*/
59+
sai_object_id_t icmp_echo_session_id;
60+
61+
/** ICMP_ECHO session state */
62+
sai_icmp_echo_session_state_t session_state;
63+
64+
} sai_icmp_echo_session_state_notification_t;
65+
66+
/**
67+
* @brief SAI attributes for ICMP_ECHO session
68+
*/
69+
typedef enum _sai_icmp_echo_session_attr_t
70+
{
71+
/**
72+
* @brief Start of attributes
73+
*/
74+
SAI_ICMP_ECHO_SESSION_ATTR_START,
75+
76+
/**
77+
* @brief Hardware lookup valid
78+
*
79+
* @type bool
80+
* @flags CREATE_ONLY
81+
* @default true
82+
*/
83+
SAI_ICMP_ECHO_SESSION_ATTR_HW_LOOKUP_VALID = SAI_ICMP_ECHO_SESSION_ATTR_START,
84+
85+
/**
86+
* @brief Virtual Router
87+
*
88+
* @type sai_object_id_t
89+
* @flags MANDATORY_ON_CREATE | CREATE_AND_SET
90+
* @objects SAI_OBJECT_TYPE_VIRTUAL_ROUTER
91+
* @condition SAI_ICMP_ECHO_SESSION_ATTR_HW_LOOKUP_VALID == true
92+
*/
93+
SAI_ICMP_ECHO_SESSION_ATTR_VIRTUAL_ROUTER,
94+
95+
/**
96+
* @brief Destination Port
97+
*
98+
* @type sai_object_id_t
99+
* @flags MANDATORY_ON_CREATE | CREATE_AND_SET
100+
* @objects SAI_OBJECT_TYPE_PORT
101+
* @condition SAI_ICMP_ECHO_SESSION_ATTR_HW_LOOKUP_VALID == false
102+
*/
103+
SAI_ICMP_ECHO_SESSION_ATTR_PORT,
104+
105+
/**
106+
* @brief Session Global Unique Identifier
107+
*
108+
* @type sai_uint64_t
109+
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
110+
*/
111+
SAI_ICMP_ECHO_SESSION_ATTR_GUID,
112+
113+
/**
114+
* @brief Session Cookie
115+
*
116+
* @type sai_uint32_t
117+
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
118+
*/
119+
SAI_ICMP_ECHO_SESSION_ATTR_COOKIE,
120+
121+
/**
122+
* @brief IP header version
123+
*
124+
* @type sai_uint8_t
125+
* @flags MANDATORY_ON_CREATE | CREATE_AND_SET
126+
*/
127+
SAI_ICMP_ECHO_SESSION_ATTR_IPHDR_VERSION,
128+
129+
/**
130+
* @brief IP header TOS
131+
*
132+
* @type sai_uint8_t
133+
* @flags CREATE_AND_SET
134+
* @default 0
135+
*/
136+
SAI_ICMP_ECHO_SESSION_ATTR_TOS,
137+
138+
/**
139+
* @brief IP header TTL
140+
*
141+
* @type sai_uint8_t
142+
* @flags CREATE_AND_SET
143+
* @default 255
144+
*/
145+
SAI_ICMP_ECHO_SESSION_ATTR_TTL,
146+
147+
/**
148+
* @brief Source IP
149+
*
150+
* @type sai_ip_address_t
151+
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
152+
*/
153+
SAI_ICMP_ECHO_SESSION_ATTR_SRC_IP_ADDRESS,
154+
155+
/**
156+
* @brief Destination IP
157+
*
158+
* @type sai_ip_address_t
159+
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
160+
*/
161+
SAI_ICMP_ECHO_SESSION_ATTR_DST_IP_ADDRESS,
162+
163+
/**
164+
* @brief L2 source MAC address
165+
*
166+
* @type sai_mac_t
167+
* @flags MANDATORY_ON_CREATE | CREATE_AND_SET
168+
* @condition SAI_ICMP_ECHO_SESSION_ATTR_HW_LOOKUP_VALID == false
169+
*/
170+
SAI_ICMP_ECHO_SESSION_ATTR_SRC_MAC_ADDRESS,
171+
172+
/**
173+
* @brief L2 destination MAC address
174+
*
175+
* @type sai_mac_t
176+
* @flags MANDATORY_ON_CREATE | CREATE_AND_SET
177+
* @condition SAI_ICMP_ECHO_SESSION_ATTR_HW_LOOKUP_VALID == false
178+
*/
179+
SAI_ICMP_ECHO_SESSION_ATTR_DST_MAC_ADDRESS,
180+
181+
/**
182+
* @brief Transmit interval in microseconds
183+
*
184+
* @type sai_uint32_t
185+
* @flags MANDATORY_ON_CREATE | CREATE_AND_SET
186+
*/
187+
SAI_ICMP_ECHO_SESSION_ATTR_TX_INTERVAL,
188+
189+
/**
190+
* @brief Receive interval in microseconds
191+
*
192+
* @type sai_uint32_t
193+
* @flags MANDATORY_ON_CREATE | CREATE_AND_SET
194+
*/
195+
SAI_ICMP_ECHO_SESSION_ATTR_RX_INTERVAL,
196+
197+
/**
198+
* @brief To enable protection group switchover on session state change
199+
*
200+
* @type bool
201+
* @flags CREATE_AND_SET
202+
* @default false
203+
*/
204+
SAI_ICMP_ECHO_SESSION_ATTR_SET_NEXT_HOP_GROUP_SWITCHOVER,
205+
206+
/**
207+
* @brief ICMP_ECHO Session state
208+
*
209+
* @type sai_icmp_echo_session_state_t
210+
* @flags READ_ONLY
211+
*/
212+
SAI_ICMP_ECHO_SESSION_ATTR_STATE,
213+
214+
/**
215+
* @brief End of attributes
216+
*/
217+
SAI_ICMP_ECHO_SESSION_ATTR_END,
218+
219+
/** Custom range base value */
220+
SAI_ICMP_ECHO_SESSION_ATTR_CUSTOM_RANGE_START = 0x10000000,
221+
222+
/** End of custom range base */
223+
SAI_ICMP_ECHO_SESSION_ATTR_CUSTOM_RANGE_END
224+
225+
} sai_icmp_echo_session_attr_t;
226+
227+
/**
228+
* @brief ICMP_ECHO Session counter IDs in sai_get_icmp_echo_session_stats() call
229+
*/
230+
typedef enum _sai_icmp_echo_session_stat_t
231+
{
232+
/** Ingress packet stat count */
233+
SAI_ICMP_ECHO_SESSION_STAT_IN_PACKETS,
234+
235+
/** Egress packet stat count */
236+
SAI_ICMP_ECHO_SESSION_STAT_OUT_PACKETS,
237+
238+
} sai_icmp_echo_session_stat_t;
239+
240+
/**
241+
* @brief Create ICMP_ECHO session.
242+
*
243+
* @param[out] icmp_echo_session_id ICMP_ECHO session id
244+
* @param[in] switch_id Switch id
245+
* @param[in] attr_count Number of attributes
246+
* @param[in] attr_list Value of attributes
247+
*
248+
* @return #SAI_STATUS_SUCCESS if operation is successful otherwise a different
249+
* error code is returned.
250+
*/
251+
typedef sai_status_t (*sai_create_icmp_echo_session_fn)(
252+
_Out_ sai_object_id_t *icmp_echo_session_id,
253+
_In_ sai_object_id_t switch_id,
254+
_In_ uint32_t attr_count,
255+
_In_ const sai_attribute_t *attr_list);
256+
257+
/**
258+
* @brief Remove ICMP_ECHO session.
259+
*
260+
* @param[in] icmp_echo_session_id ICMP_ECHO session id
261+
*
262+
* @return #SAI_STATUS_SUCCESS if operation is successful otherwise a different
263+
* error code is returned.
264+
*/
265+
typedef sai_status_t (*sai_remove_icmp_echo_session_fn)(
266+
_In_ sai_object_id_t icmp_echo_session_id);
267+
268+
/**
269+
* @brief Set ICMP_ECHO session attributes.
270+
*
271+
* @param[in] icmp_echo_session_id ICMP_ECHO session id
272+
* @param[in] attr Value of attribute
273+
*
274+
* @return #SAI_STATUS_SUCCESS if operation is successful otherwise a different
275+
* error code is returned.
276+
*/
277+
typedef sai_status_t (*sai_set_icmp_echo_session_attribute_fn)(
278+
_In_ sai_object_id_t icmp_echo_session_id,
279+
_In_ const sai_attribute_t *attr);
280+
281+
/**
282+
* @brief Get ICMP_ECHO session attributes.
283+
*
284+
* @param[in] icmp_echo_session_id ICMP_ECHO session id
285+
* @param[in] attr_count Number of attributes
286+
* @param[inout] attr_list Value of attribute
287+
*
288+
* @return #SAI_STATUS_SUCCESS if operation is successful otherwise a different
289+
* error code is returned.
290+
*/
291+
typedef sai_status_t (*sai_get_icmp_echo_session_attribute_fn)(
292+
_In_ sai_object_id_t icmp_echo_session_id,
293+
_In_ uint32_t attr_count,
294+
_Inout_ sai_attribute_t *attr_list);
295+
296+
/**
297+
* @brief Get ICMP_ECHO session statistics counters. Deprecated for backward compatibility.
298+
*
299+
* @param[in] icmp_echo_session_id ICMP_ECHO session id
300+
* @param[in] number_of_counters Number of counters in the array
301+
* @param[in] counter_ids Specifies the array of counter ids
302+
* @param[out] counters Array of resulting counter values.
303+
*
304+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
305+
*/
306+
typedef sai_status_t (*sai_get_icmp_echo_session_stats_fn)(
307+
_In_ sai_object_id_t icmp_echo_session_id,
308+
_In_ uint32_t number_of_counters,
309+
_In_ const sai_stat_id_t *counter_ids,
310+
_Out_ uint64_t *counters);
311+
312+
/**
313+
* @brief Get ICMP_ECHO session statistics counters extended.
314+
*
315+
* @param[in] icmp_echo_session_id ICMP_ECHO session id
316+
* @param[in] number_of_counters Number of counters in the array
317+
* @param[in] counter_ids Specifies the array of counter ids
318+
* @param[in] mode Statistics mode
319+
* @param[out] counters Array of resulting counter values.
320+
*
321+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
322+
*/
323+
typedef sai_status_t (*sai_get_icmp_echo_session_stats_ext_fn)(
324+
_In_ sai_object_id_t icmp_echo_session_id,
325+
_In_ uint32_t number_of_counters,
326+
_In_ const sai_stat_id_t *counter_ids,
327+
_In_ sai_stats_mode_t mode,
328+
_Out_ uint64_t *counters);
329+
330+
/**
331+
* @brief Clear ICMP_ECHO session statistics counters.
332+
*
333+
* @param[in] icmp_echo_session_id ICMP_ECHO session id
334+
* @param[in] number_of_counters Number of counters in the array
335+
* @param[in] counter_ids Specifies the array of counter ids
336+
*
337+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
338+
*/
339+
typedef sai_status_t (*sai_clear_icmp_echo_session_stats_fn)(
340+
_In_ sai_object_id_t icmp_echo_session_id,
341+
_In_ uint32_t number_of_counters,
342+
_In_ const sai_stat_id_t *counter_ids);
343+
344+
/**
345+
* @brief ICMP_ECHO session state change notification
346+
*
347+
* Passed as a parameter into sai_initialize_switch()
348+
*
349+
* @count data[count]
350+
*
351+
* @param[in] count Number of notifications
352+
* @param[in] data Array of ICMP_ECHO session state
353+
*/
354+
typedef void (*sai_icmp_echo_session_state_change_notification_fn)(
355+
_In_ uint32_t count,
356+
_In_ const sai_icmp_echo_session_state_notification_t *data);
357+
358+
/**
359+
* @brief ICMP_ECHO method table retrieved with sai_api_query()
360+
*/
361+
typedef struct _sai_icmp_echo_api_t
362+
{
363+
sai_create_icmp_echo_session_fn create_icmp_echo_session;
364+
sai_remove_icmp_echo_session_fn remove_icmp_echo_session;
365+
sai_set_icmp_echo_session_attribute_fn set_icmp_echo_session_attribute;
366+
sai_get_icmp_echo_session_attribute_fn get_icmp_echo_session_attribute;
367+
sai_get_icmp_echo_session_stats_fn get_icmp_echo_session_stats;
368+
sai_get_icmp_echo_session_stats_ext_fn get_icmp_echo_session_stats_ext;
369+
sai_clear_icmp_echo_session_stats_fn clear_icmp_echo_session_stats;
370+
371+
} sai_icmp_echo_api_t;
372+
373+
/**
374+
* @}
375+
*/
376+
#endif /** __SAIEXPERIMENTALICMPECHO_H_ */

experimental/saiextensions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "saiexperimentaldashdirectionlookup.h"
4646
#include "saiexperimentaldashacl.h"
4747
#include "saiexperimentalbmtor.h"
48+
#include "saiexperimentalicmpecho.h"
4849

4950
/**
5051
* @brief Extensions to SAI APIs
@@ -77,6 +78,8 @@ typedef enum _sai_api_extensions_t
7778

7879
SAI_API_DASH_VIP,
7980

81+
SAI_API_ICMP_ECHO,
82+
8083
/* Add new experimental APIs above this line */
8184

8285
SAI_API_EXTENSIONS_RANGE_END

0 commit comments

Comments
 (0)