Skip to content

Commit 8f262b4

Browse files
author
Shrikrishna (Shri) Khare
committed
Bulk get/set for switches
Refer: https://github.com/opencomputeproject/SAI/blob/master/inc/saitypes.h#L1725 sai_bulk_object_create_fn - Accepts @param[in] attr_list List of attributes for every object. sai_bulk_object_set_attribute_fn - Accepts @param[in] attr_list List of attributes for every object, one per object. sai_bulk_object_get_attribute_fn - Accepts @param[in] attr_count List of attr_count. Caller passes the number of attribute for each object to get. In other words bulk set and get accept "list of attributes" for "list of objects", while the bulk set only accepts "one attribute per object". Thus, today, there is no mechanism to "set a list of attributes on one or more objects". This PR addresses that. It keeps the old set method for backward compatibility but marks ti as deprecated. It also introduces bulk get/set for switches and leverages this new method. Signed-off-by: Shrikrishna (Shri) Khare <[email protected]>
1 parent 754ca66 commit 8f262b4

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

inc/saiswitch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4061,6 +4061,8 @@ typedef struct _sai_switch_api_t
40614061
sai_get_switch_tunnel_attribute_fn get_switch_tunnel_attribute;
40624062
sai_switch_mdio_cl22_read_fn switch_mdio_cl22_read;
40634063
sai_switch_mdio_cl22_write_fn switch_mdio_cl22_write;
4064+
sai_bulk_object_set_attribute_ext_fn set_switches_attribute;
4065+
sai_bulk_object_get_attribute_fn get_switches_attribute
40644066

40654067
} sai_switch_api_t;
40664068

inc/saitypes.h

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,7 @@ typedef sai_status_t (*sai_bulk_object_remove_fn)(
17671767
_Out_ sai_status_t *object_statuses);
17681768

17691769
/**
1770-
* @brief Bulk objects set attributes.
1770+
* @brief Bulk objects set attributes. Deprecated for backward compatibility
17711771
*
17721772
* @param[in] object_count Number of objects to set on attribute
17731773
* @param[in] object_id List of object ids
@@ -1787,6 +1787,30 @@ typedef sai_status_t (*sai_bulk_object_set_attribute_fn)(
17871787
_In_ sai_bulk_op_error_mode_t mode,
17881788
_Out_ sai_status_t *object_statuses);
17891789

1790+
/**
1791+
* @brief Bulk objects set attributes extended.
1792+
*
1793+
* @param[in] object_count Number of objects to set on attribute
1794+
* @param[in] object_id List of object ids
1795+
* @param[in] attr_count List of attr_count. Caller passes the number
1796+
* of attribute for each object to get.
1797+
* @param[in] attr_list List of attributes for every object, one per object.
1798+
* @param[in] mode Bulk operation error handling mode.
1799+
* @param[out] object_statuses List of status for every object. Caller needs to allocate the buffer.
1800+
*
1801+
* @return #SAI_STATUS_SUCCESS when set attributes on all objects succeeded or
1802+
* #SAI_STATUS_FAILURE when any of the objects fails to set attribute. When
1803+
* there is failure, Caller is expected to go through the list of returned
1804+
* statuses to find out which fails and which succeeds.
1805+
*/
1806+
typedef sai_status_t (*sai_bulk_object_set_attribute_ext_fn)(
1807+
_In_ uint32_t object_count,
1808+
_In_ const sai_object_id_t *object_id,
1809+
_In_ const uint32_t *attr_count,
1810+
_In_ const sai_attribute_t **attr_list,
1811+
_In_ sai_bulk_op_error_mode_t mode,
1812+
_Out_ sai_status_t *object_statuses);
1813+
17901814
/**
17911815
* @brief Bulk objects get attributes.
17921816
*

0 commit comments

Comments
 (0)