Skip to content

Commit 658be43

Browse files
committed
Add statistics definitions and APIs for OCS port; more stat counter IDs can be added in the future as needed in more scenarios
Revert last cahnges of adding stats mode on OCS port and cross-connect Signed-off-by: Nathan Ni <nathan.ni@coherent.com>
1 parent 361767f commit 658be43

2 files changed

Lines changed: 72 additions & 21 deletions

File tree

doc/OCS/SAI-Proposal-OCS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,10 @@ OCS cross-connect factory data are read-only information about factory beginning
7474
| ---- | ---- | ---- |
7575
|SAI_OBJECT_TYPE_OCS_CROSS_CONNECT | SAI_OCS_CROSS_CONNECT_ATTR_A_SIDE_PORT_ID | sai_object_id_t
7676
| | SAI_OCS_CROSS_CONNECT_ATTR_B_SIDE_PORT_ID | sai_object_id_t
77-
| | SAI_OCS_CROSS_CONNECT_ATTR_STATS_MODE | sai_stats_mode_t
7877
| SAI_OBJECT_TYPE_OCS_PORT | SAI_OCS_PORT_ATTR_NAME | sai_u8_list_t
7978
| | SAI_OCS_PORT_ATTR_OVERRIDE_STATE | sai_ocs_port_override_state_t
8079
| | SAI_OCS_PORT_ATTR_OPER_STATUS | sai_ocs_port_status_t
8180
| | SAI_OCS_PORT_ATTR_PHYSICAL_MAPPING | sai_u8_list_t
82-
| | SAI_OCS_PORT_ATTR_STATS_MODE | sai_u8_lsai_stats_mode_tist_t
8381
SAI_OBJECT_TYPE_OCS_CROSS_CONNECT_FACTORY_DATA | SAI_OCS_CROSS_CONNECT_FACTORY_DATA_ATTR_A_SIDE_PORT_NAME | sai_u8_list_t
8482
| | SAI_OCS_CROSS_CONNECT_FACTORY_DATA_ATTR_B_SIDE_PORT_NAME | sai_u8_list_t
8583
| | SAI_OCS_CROSS_CONNECT_FACTORY_DATA_ATTR_FREQUENCY_THZ | sai_s32_list_t
@@ -102,6 +100,9 @@ typedef struct _sai_ocs_api_t
102100
sai_bulk_object_remove_fn remove_ocs_ports;
103101
sai_bulk_object_set_attribute_fn set_ocs_ports_attribute;
104102
sai_bulk_object_get_attribute_fn get_ocs_ports_attribute;
103+
sai_get_ocs_port_stats_fn get_ocs_port_stats;
104+
sai_get_ocs_port_stats_ext_fn get_ocs_port_stats_ext;
105+
sai_clear_ocs_port_stats_fn clear_ocs_port_stats;
105106
sai_create_ocs_cross_connect_fn create_ocs_cross_connect;
106107
sai_remove_ocs_cross_connect_fn remove_ocs_cross_connect;
107108
sai_set_ocs_cross_connect_attribute_fn set_ocs_cross_connect_attribute;

experimental/saiexperimentalocs.h

Lines changed: 69 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,6 @@ typedef enum _sai_ocs_cross_connect_attr_t
6363
*/
6464
SAI_OCS_CROSS_CONNECT_ATTR_B_SIDE_PORT_ID,
6565

66-
/**
67-
* @brief Global setting of read-clear or read-only for statistics read
68-
*
69-
* @type sai_stats_mode_t
70-
* @flags CREATE_AND_SET
71-
* @default SAI_STATS_MODE_READ_AND_CLEAR
72-
*/
73-
SAI_OCS_CROSS_CONNECT_ATTR_STATS_MODE,
74-
7566
/**
7667
* @brief End of attributes
7768
*/
@@ -223,21 +214,29 @@ typedef enum _sai_ocs_port_attr_t
223214
*/
224215
SAI_OCS_PORT_ATTR_PHYSICAL_MAPPING,
225216

226-
/**
227-
* @brief Global setting of read-clear or read-only for statistics read
228-
*
229-
* @type sai_stats_mode_t
230-
* @flags CREATE_AND_SET
231-
* @default SAI_STATS_MODE_READ_AND_CLEAR
232-
*/
233-
SAI_OCS_PORT_ATTR_STATS_MODE,
234-
235217
/**
236218
* @brief End of attributes
237219
*/
238220
SAI_OCS_PORT_ATTR_END,
239221
} sai_ocs_port_attr_t;
240222

223+
/**
224+
* @brief OCS port counter IDs in sai_get_ocs_port_stats() call
225+
*
226+
* @flags ranges
227+
*/
228+
typedef enum _sai_ocs_port_stat_t
229+
{
230+
/** OCS port stat range start */
231+
SAI_OCS_PORT_STAT_START,
232+
233+
/** OCS port stat unknown, it is used to make build pass, more stats can be added later. */
234+
SAI_OCS_PORT_STAT_UNKNOWN,
235+
236+
/** OCS port stat range end */
237+
SAI_OCS_PORT_STAT_END,
238+
} sai_ocs_port_stat_t;
239+
241240
/**
242241
* @brief Defines the operational status of the OCS port
243242
*/
@@ -306,6 +305,54 @@ typedef sai_status_t (*sai_get_ocs_port_attribute_fn)(
306305
_In_ uint32_t attr_count,
307306
_Inout_ sai_attribute_t *attr_list);
308307

308+
/**
309+
* @brief Get OCS port statistics counters. Deprecated for backward compatibility.
310+
*
311+
* @param[in] ocs_port_id OCS port id
312+
* @param[in] number_of_counters Number of counters in the array
313+
* @param[in] counter_ids Specifies the array of counter ids
314+
* @param[out] counters Array of resulting counter values.
315+
*
316+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
317+
*/
318+
typedef sai_status_t (*sai_get_ocs_port_stats_fn)(
319+
_In_ sai_object_id_t ocs_port_id,
320+
_In_ uint32_t number_of_counters,
321+
_In_ const sai_stat_id_t *counter_ids,
322+
_Out_ uint64_t *counters);
323+
324+
/**
325+
* @brief Get OCS port statistics counters extended.
326+
*
327+
* @param[in] ocs_port_id OCS port id
328+
* @param[in] number_of_counters Number of counters in the array
329+
* @param[in] counter_ids Specifies the array of counter ids
330+
* @param[in] mode Statistics mode
331+
* @param[out] counters Array of resulting counter values.
332+
*
333+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
334+
*/
335+
typedef sai_status_t (*sai_get_ocs_port_stats_ext_fn)(
336+
_In_ sai_object_id_t ocs_port_id,
337+
_In_ uint32_t number_of_counters,
338+
_In_ const sai_stat_id_t *counter_ids,
339+
_In_ sai_stats_mode_t mode,
340+
_Out_ uint64_t *counters);
341+
342+
/**
343+
* @brief Clear OCS port statistics counters.
344+
*
345+
* @param[in] ocs_port_id OCS port id
346+
* @param[in] number_of_counters Number of counters in the array
347+
* @param[in] counter_ids Specifies the array of counter ids
348+
*
349+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
350+
*/
351+
typedef sai_status_t (*sai_clear_ocs_port_stats_fn)(
352+
_In_ sai_object_id_t ocs_port_id,
353+
_In_ uint32_t number_of_counters,
354+
_In_ const sai_stat_id_t *counter_ids);
355+
309356
/**
310357
* @brief OCS port state change notification
311358
*
@@ -314,7 +361,7 @@ typedef sai_status_t (*sai_get_ocs_port_attribute_fn)(
314361
* @count data[count]
315362
*
316363
* @param[in] count Number of notifications
317-
* @param[in] data Array of port operational status
364+
* @param[in] data Array of OCS port operational status
318365
*/
319366
typedef void (*sai_ocs_port_state_change_notification_fn)(
320367
_In_ uint32_t count,
@@ -459,6 +506,9 @@ typedef struct _sai_ocs_api_t
459506
sai_bulk_object_remove_fn remove_ocs_ports;
460507
sai_bulk_object_set_attribute_fn set_ocs_ports_attribute;
461508
sai_bulk_object_get_attribute_fn get_ocs_ports_attribute;
509+
sai_get_ocs_port_stats_fn get_ocs_port_stats;
510+
sai_get_ocs_port_stats_ext_fn get_ocs_port_stats_ext;
511+
sai_clear_ocs_port_stats_fn clear_ocs_port_stats;
462512
sai_create_ocs_cross_connect_fn create_ocs_cross_connect;
463513
sai_remove_ocs_cross_connect_fn remove_ocs_cross_connect;
464514
sai_set_ocs_cross_connect_attribute_fn set_ocs_cross_connect_attribute;

0 commit comments

Comments
 (0)