From 5e32f5c330c329c4f604a84a01a7929d4ad01c2b Mon Sep 17 00:00:00 2001 From: Jai Kumar Date: Mon, 4 Apr 2022 11:22:32 -0700 Subject: [PATCH 01/27] ECMP Member Capability and Configuration (#1461) * Ecmp Member Count wo new Switch attributes are introduced. Read Only: SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT This attribute is queried during switch init to find out device specific max number of ecmp members supported. CREATE_AND_SET (read/write): SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT This attribute is set based on the query for MAX_ECMP_MEMBER_COUNT and can be changed dynamically. If the SAI adapter doesn't support dynamic change of this attribute based on certain conditions like if ECMP groups are already configured then MUST return error. Expected behavior when SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT is set to a value < SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT? SAI adapter should allocate the ECMP member count as specified by SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT. This can be changed dynamically; SAI adapter may return OK or ERROR based on if HW supports dynamic change of ECMP member count or not. Decreasing of ecmp member count MUST always return ERROR. Increasing of ecmp member can be supported by newer generation of HW and return OK if supported. Typical Workflow: Switch object create Switch get SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT: say SAI adapter returns 2k Switch set SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT If step 3 is invoked after the system is fully configured and forwarding traffic SAI adapter MAY return error if HW is not capable of dynamically adjusting the ECMP group size Can you please clarify what is the expected hardware behavior when SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT is set to a value < SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT * Max ECMP Member Capability/Configuration Signed-off-by: Jai Kumar --- doc/SAI-Proposal-ECMP-Member-Count.md | 41 +++++++++++++++++++++++++++ inc/saiswitch.h | 17 +++++++++++ 2 files changed, 58 insertions(+) create mode 100755 doc/SAI-Proposal-ECMP-Member-Count.md diff --git a/doc/SAI-Proposal-ECMP-Member-Count.md b/doc/SAI-Proposal-ECMP-Member-Count.md new file mode 100755 index 000000000..0cf9b5ea7 --- /dev/null +++ b/doc/SAI-Proposal-ECMP-Member-Count.md @@ -0,0 +1,41 @@ +# ECMP Count Capability and Configuration + + +This document talks about the +- Capability query of MAX ECMP Count supported by silicon +- Configuration +- SAI adapter expectation + +## Problem Description +There is a mechanism to set the HW default of max ecmp member count using a Key-Value string SAI_KEY_NUM_ECMP_MEMBERS during the system boot time. This KV string can be set only once and either is based on prior knowledge of HW capability or assumed default. SAI adapter consumes this Key-Value string and sets the ecmp member count in HW. Set value can be queried by a read only attribute SAI_SWITCH_ATTR_ECMP_MEMBERS. + +## Spec Enhancement +Two new Switch attributes are introduced to address the abovementioned issue. + +> SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT (Read Only) +> This is a capability query during switch init to find out device specific max number of ecmp members supported. + +> SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT (read/write) +> This attribute is set based on the query for MAX_ECMP_MEMBER_COUNT and can be changed dynamically. + +## SAI Adapter Requirements +Typical Workflow: + +Switch object create +Switch get SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT +Switch set SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT (either before configuring ecmp groups or during system runtime) + +Following are the possible scenarios for SAI adapter to handle +1. HW does not support the attribute SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT: SAI adapter must return error SAI_STATUS_NOT_SUPPORTED. +2. HW supports dynamic modification of ecmp count only and only if there are no ecmp groups configured + a. If there are no ECMP groups configured: SAI adapter must handle the update and return SAI_STATUS_SUCCESS + b. If there are ECMP groups configured: SAI adapter must return SAI_STATUS_INSUFFICIENT_RESOURCES +3. HW supports dynamic modification of ecmp count irrespestive of ecmp group configuration) + a. If ecmp count is increased: SAI adapter must handle the update and return SAI_STATUS_SUCCESS + b. If ecmp count is decreased: SAI adapter can not handle the update as it doesn't know which members to purge. In this case SAI adaper must return SAI_STATUS_NOT_IMPLEMENTED + +## ECMP Type, Member Count and Next Hop Group Member Count +ECMP member count is a global configuration and controls the allocation of HW memory for carving out chunks of ECMP group with member count. This is used for all ECMP types. If there is a need for differentiating a specific ECMP type for max and configured scale as a separate HW resource, we should add a ecmp type specific attribute later on. + +HW may support variable size member count configuration per nexthop group using the attribute SAI_NEXT_HOP_GROUP_ATTR_NEXT_HOP_COUNT. In this case SAI adapter must return attribute as not supported SAI_STATUS_NOT_SUPPORTED. + diff --git a/inc/saiswitch.h b/inc/saiswitch.h index e1db7f289..692cf8b79 100644 --- a/inc/saiswitch.h +++ b/inc/saiswitch.h @@ -2756,6 +2756,23 @@ typedef enum _sai_switch_attr_t */ SAI_SWITCH_ATTR_NAT_EVENT_NOTIFY, + /** + * @brief Number of ECMP members supported across the all nexthop groups by switch + * + * @type sai_uint32_t + * @flags READ_ONLY + */ + SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT, + + /** + * @brief Number of ECMP Members configured. SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT takes precedence over SAI_KEY_NUM_ECMP_GROUPS string. Default value is same as SAI_SWITCH_ATTR_ECMP_MEMBERS. + * + * @type sai_uint32_t + * @flags CREATE_AND_SET + * @default 64 + */ + SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT, + /** * @brief End of attributes */ From 1f7f5f0e2da9793d36b8b5ed74ef553accc74e32 Mon Sep 17 00:00:00 2001 From: vmittal-msft <46945843+vmittal-msft@users.noreply.github.com> Date: Wed, 6 Apr 2022 09:08:05 -0700 Subject: [PATCH 02/27] Updated absolute path to general to fix sonic build issue. (#1465) Updated header file path to fix sonic build issue Signed-off-by: Vineet Mittal --- inc/saiobject.h | 2 +- meta/checkheaders.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/saiobject.h b/inc/saiobject.h index a08f6ae54..e81c12808 100644 --- a/inc/saiobject.h +++ b/inc/saiobject.h @@ -37,7 +37,7 @@ #include /* new experimental object type includes */ -#include "../experimental/saiexperimentalbmtor.h" +#include /** * @defgroup SAIOBJECT SAI - Object API definitions. diff --git a/meta/checkheaders.pl b/meta/checkheaders.pl index e99e9e8bc..79233303b 100755 --- a/meta/checkheaders.pl +++ b/meta/checkheaders.pl @@ -149,7 +149,7 @@ sub GetValues my ($fhb, $bin) = tempfile( SUFFIX => '.bin', UNLINK => 1 ); - system("gcc $src -I. -I '$dir' -o $bin") == 0 or die "gcc failed! $!"; + system("gcc $src -I. -I ../experimental -I '$dir' -o $bin") == 0 or die "gcc failed! $!"; close $fhs; close $fhb; From a00aa0fcdca4b17bbd7b78defbafdf6968300d88 Mon Sep 17 00:00:00 2001 From: rlhui Date: Wed, 6 Apr 2022 22:56:07 -0700 Subject: [PATCH 03/27] Revert "ECMP Member Capability and Configuration (#1461)" This reverts commit 5e32f5c330c329c4f604a84a01a7929d4ad01c2b. Signed-off-by: Rita Hui Rita.Hui@microsoft.com --- doc/SAI-Proposal-ECMP-Member-Count.md | 41 --------------------------- inc/saiswitch.h | 17 ----------- 2 files changed, 58 deletions(-) delete mode 100755 doc/SAI-Proposal-ECMP-Member-Count.md diff --git a/doc/SAI-Proposal-ECMP-Member-Count.md b/doc/SAI-Proposal-ECMP-Member-Count.md deleted file mode 100755 index 0cf9b5ea7..000000000 --- a/doc/SAI-Proposal-ECMP-Member-Count.md +++ /dev/null @@ -1,41 +0,0 @@ -# ECMP Count Capability and Configuration - - -This document talks about the -- Capability query of MAX ECMP Count supported by silicon -- Configuration -- SAI adapter expectation - -## Problem Description -There is a mechanism to set the HW default of max ecmp member count using a Key-Value string SAI_KEY_NUM_ECMP_MEMBERS during the system boot time. This KV string can be set only once and either is based on prior knowledge of HW capability or assumed default. SAI adapter consumes this Key-Value string and sets the ecmp member count in HW. Set value can be queried by a read only attribute SAI_SWITCH_ATTR_ECMP_MEMBERS. - -## Spec Enhancement -Two new Switch attributes are introduced to address the abovementioned issue. - -> SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT (Read Only) -> This is a capability query during switch init to find out device specific max number of ecmp members supported. - -> SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT (read/write) -> This attribute is set based on the query for MAX_ECMP_MEMBER_COUNT and can be changed dynamically. - -## SAI Adapter Requirements -Typical Workflow: - -Switch object create -Switch get SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT -Switch set SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT (either before configuring ecmp groups or during system runtime) - -Following are the possible scenarios for SAI adapter to handle -1. HW does not support the attribute SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT: SAI adapter must return error SAI_STATUS_NOT_SUPPORTED. -2. HW supports dynamic modification of ecmp count only and only if there are no ecmp groups configured - a. If there are no ECMP groups configured: SAI adapter must handle the update and return SAI_STATUS_SUCCESS - b. If there are ECMP groups configured: SAI adapter must return SAI_STATUS_INSUFFICIENT_RESOURCES -3. HW supports dynamic modification of ecmp count irrespestive of ecmp group configuration) - a. If ecmp count is increased: SAI adapter must handle the update and return SAI_STATUS_SUCCESS - b. If ecmp count is decreased: SAI adapter can not handle the update as it doesn't know which members to purge. In this case SAI adaper must return SAI_STATUS_NOT_IMPLEMENTED - -## ECMP Type, Member Count and Next Hop Group Member Count -ECMP member count is a global configuration and controls the allocation of HW memory for carving out chunks of ECMP group with member count. This is used for all ECMP types. If there is a need for differentiating a specific ECMP type for max and configured scale as a separate HW resource, we should add a ecmp type specific attribute later on. - -HW may support variable size member count configuration per nexthop group using the attribute SAI_NEXT_HOP_GROUP_ATTR_NEXT_HOP_COUNT. In this case SAI adapter must return attribute as not supported SAI_STATUS_NOT_SUPPORTED. - diff --git a/inc/saiswitch.h b/inc/saiswitch.h index 692cf8b79..e1db7f289 100644 --- a/inc/saiswitch.h +++ b/inc/saiswitch.h @@ -2756,23 +2756,6 @@ typedef enum _sai_switch_attr_t */ SAI_SWITCH_ATTR_NAT_EVENT_NOTIFY, - /** - * @brief Number of ECMP members supported across the all nexthop groups by switch - * - * @type sai_uint32_t - * @flags READ_ONLY - */ - SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT, - - /** - * @brief Number of ECMP Members configured. SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT takes precedence over SAI_KEY_NUM_ECMP_GROUPS string. Default value is same as SAI_SWITCH_ATTR_ECMP_MEMBERS. - * - * @type sai_uint32_t - * @flags CREATE_AND_SET - * @default 64 - */ - SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT, - /** * @brief End of attributes */ From 2af4c673000f52f71b020bba69e509d06bf4bb0a Mon Sep 17 00:00:00 2001 From: rlhui Date: Wed, 6 Apr 2022 23:02:35 -0700 Subject: [PATCH 04/27] Update version to v1.10.1 --- inc/saiversion.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/saiversion.h b/inc/saiversion.h index 7fa8ae703..588c9fbfc 100644 --- a/inc/saiversion.h +++ b/inc/saiversion.h @@ -29,7 +29,7 @@ #define SAI_MAJOR 1 #define SAI_MINOR 10 -#define SAI_REVISION 0 +#define SAI_REVISION 1 #define SAI_VERSION(major, minor, revision) (10000 * (major) + 100 * (minor) + (revision)) From 2df5d42475a51c8feaac9940cecf685b62caf741 Mon Sep 17 00:00:00 2001 From: Jai Kumar Date: Mon, 4 Apr 2022 11:22:32 -0700 Subject: [PATCH 05/27] ECMP Member Capability and Configuration (#1461) * Ecmp Member Count wo new Switch attributes are introduced. Read Only: SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT This attribute is queried during switch init to find out device specific max number of ecmp members supported. CREATE_AND_SET (read/write): SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT This attribute is set based on the query for MAX_ECMP_MEMBER_COUNT and can be changed dynamically. If the SAI adapter doesn't support dynamic change of this attribute based on certain conditions like if ECMP groups are already configured then MUST return error. Expected behavior when SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT is set to a value < SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT? SAI adapter should allocate the ECMP member count as specified by SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT. This can be changed dynamically; SAI adapter may return OK or ERROR based on if HW supports dynamic change of ECMP member count or not. Decreasing of ecmp member count MUST always return ERROR. Increasing of ecmp member can be supported by newer generation of HW and return OK if supported. Typical Workflow: Switch object create Switch get SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT: say SAI adapter returns 2k Switch set SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT If step 3 is invoked after the system is fully configured and forwarding traffic SAI adapter MAY return error if HW is not capable of dynamically adjusting the ECMP group size Can you please clarify what is the expected hardware behavior when SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT is set to a value < SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT * Max ECMP Member Capability/Configuration Signed-off-by: Jai Kumar --- doc/SAI-Proposal-ECMP-Member-Count.md | 41 +++++++++++++++++++++++++++ inc/saiswitch.h | 17 +++++++++++ 2 files changed, 58 insertions(+) create mode 100755 doc/SAI-Proposal-ECMP-Member-Count.md diff --git a/doc/SAI-Proposal-ECMP-Member-Count.md b/doc/SAI-Proposal-ECMP-Member-Count.md new file mode 100755 index 000000000..0cf9b5ea7 --- /dev/null +++ b/doc/SAI-Proposal-ECMP-Member-Count.md @@ -0,0 +1,41 @@ +# ECMP Count Capability and Configuration + + +This document talks about the +- Capability query of MAX ECMP Count supported by silicon +- Configuration +- SAI adapter expectation + +## Problem Description +There is a mechanism to set the HW default of max ecmp member count using a Key-Value string SAI_KEY_NUM_ECMP_MEMBERS during the system boot time. This KV string can be set only once and either is based on prior knowledge of HW capability or assumed default. SAI adapter consumes this Key-Value string and sets the ecmp member count in HW. Set value can be queried by a read only attribute SAI_SWITCH_ATTR_ECMP_MEMBERS. + +## Spec Enhancement +Two new Switch attributes are introduced to address the abovementioned issue. + +> SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT (Read Only) +> This is a capability query during switch init to find out device specific max number of ecmp members supported. + +> SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT (read/write) +> This attribute is set based on the query for MAX_ECMP_MEMBER_COUNT and can be changed dynamically. + +## SAI Adapter Requirements +Typical Workflow: + +Switch object create +Switch get SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT +Switch set SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT (either before configuring ecmp groups or during system runtime) + +Following are the possible scenarios for SAI adapter to handle +1. HW does not support the attribute SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT: SAI adapter must return error SAI_STATUS_NOT_SUPPORTED. +2. HW supports dynamic modification of ecmp count only and only if there are no ecmp groups configured + a. If there are no ECMP groups configured: SAI adapter must handle the update and return SAI_STATUS_SUCCESS + b. If there are ECMP groups configured: SAI adapter must return SAI_STATUS_INSUFFICIENT_RESOURCES +3. HW supports dynamic modification of ecmp count irrespestive of ecmp group configuration) + a. If ecmp count is increased: SAI adapter must handle the update and return SAI_STATUS_SUCCESS + b. If ecmp count is decreased: SAI adapter can not handle the update as it doesn't know which members to purge. In this case SAI adaper must return SAI_STATUS_NOT_IMPLEMENTED + +## ECMP Type, Member Count and Next Hop Group Member Count +ECMP member count is a global configuration and controls the allocation of HW memory for carving out chunks of ECMP group with member count. This is used for all ECMP types. If there is a need for differentiating a specific ECMP type for max and configured scale as a separate HW resource, we should add a ecmp type specific attribute later on. + +HW may support variable size member count configuration per nexthop group using the attribute SAI_NEXT_HOP_GROUP_ATTR_NEXT_HOP_COUNT. In this case SAI adapter must return attribute as not supported SAI_STATUS_NOT_SUPPORTED. + diff --git a/inc/saiswitch.h b/inc/saiswitch.h index e1db7f289..692cf8b79 100644 --- a/inc/saiswitch.h +++ b/inc/saiswitch.h @@ -2756,6 +2756,23 @@ typedef enum _sai_switch_attr_t */ SAI_SWITCH_ATTR_NAT_EVENT_NOTIFY, + /** + * @brief Number of ECMP members supported across the all nexthop groups by switch + * + * @type sai_uint32_t + * @flags READ_ONLY + */ + SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT, + + /** + * @brief Number of ECMP Members configured. SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT takes precedence over SAI_KEY_NUM_ECMP_GROUPS string. Default value is same as SAI_SWITCH_ATTR_ECMP_MEMBERS. + * + * @type sai_uint32_t + * @flags CREATE_AND_SET + * @default 64 + */ + SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT, + /** * @brief End of attributes */ From f5097f6a17f4d3a03939208519ba7982c4823552 Mon Sep 17 00:00:00 2001 From: Jai Kumar Date: Mon, 4 Apr 2022 22:10:30 -0700 Subject: [PATCH 06/27] Bulk API for setting Port Attributes (#1460) * Bulk API for setting Port Attributes Signed-off-by: Jai Kumar --- inc/saiport.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inc/saiport.h b/inc/saiport.h index d96413c4d..3a1556631 100644 --- a/inc/saiport.h +++ b/inc/saiport.h @@ -3492,6 +3492,10 @@ typedef struct _sai_port_api_t sai_remove_port_serdes_fn remove_port_serdes; sai_set_port_serdes_attribute_fn set_port_serdes_attribute; sai_get_port_serdes_attribute_fn get_port_serdes_attribute; + sai_bulk_object_create_fn create_ports; + sai_bulk_object_remove_fn remove_ports; + sai_bulk_object_set_attribute_fn set_ports_attribute; + sai_bulk_object_get_attribute_fn get_ports_attribute; } sai_port_api_t; /** From d721a65216cd5073637335b1ca0690f100c617e6 Mon Sep 17 00:00:00 2001 From: rlhui Date: Thu, 7 Apr 2022 22:25:40 -0700 Subject: [PATCH 07/27] Update version to 1.10.2 --- inc/saiversion.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/saiversion.h b/inc/saiversion.h index 588c9fbfc..41028f1fc 100644 --- a/inc/saiversion.h +++ b/inc/saiversion.h @@ -29,7 +29,7 @@ #define SAI_MAJOR 1 #define SAI_MINOR 10 -#define SAI_REVISION 1 +#define SAI_REVISION 2 #define SAI_VERSION(major, minor, revision) (10000 * (major) + 100 * (minor) + (revision)) From ea58a49cda07397ddfe196e4ed438828c0f7819d Mon Sep 17 00:00:00 2001 From: Alexander Allen Date: Mon, 25 Apr 2022 10:54:52 -0400 Subject: [PATCH 08/27] [meta] Disable doxygen TCL_SUBST and COLS_IN_ALPHA_INDEX (#1457) (#1471) (#1473) Those features are no longer present on new doxygen versions and are not used by metadata parser Signed-off-by: Alexander Allen --- meta/Doxyfile | 4 ++-- meta/Doxyfile.compat | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/Doxyfile b/meta/Doxyfile index b80400f1a..1639e2239 100644 --- a/meta/Doxyfile +++ b/meta/Doxyfile @@ -240,7 +240,7 @@ ALIASES += "deprecated =@par Deprecated:^^ @xmlon # A mapping has the form "name=value". For example adding "class=itcl::class" # will allow you to use the command class in the itcl::class meaning. -TCL_SUBST = +#TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For @@ -995,7 +995,7 @@ ALPHABETICAL_INDEX = YES # Minimum value: 1, maximum value: 20, default value: 5. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. -COLS_IN_ALPHA_INDEX = 5 +#COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all classes will # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag diff --git a/meta/Doxyfile.compat b/meta/Doxyfile.compat index f1cc8b6a9..92a93c1c1 100644 --- a/meta/Doxyfile.compat +++ b/meta/Doxyfile.compat @@ -240,7 +240,7 @@ ALIASES += "deprecated =@par Deprecated:\n @xmlon # A mapping has the form "name=value". For example adding "class=itcl::class" # will allow you to use the command class in the itcl::class meaning. -TCL_SUBST = +#TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For @@ -995,7 +995,7 @@ ALPHABETICAL_INDEX = YES # Minimum value: 1, maximum value: 20, default value: 5. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. -COLS_IN_ALPHA_INDEX = 5 +#COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all classes will # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag From f69394f590362b1b02852ec80f00f9a27a02ed97 Mon Sep 17 00:00:00 2001 From: Alexander Allen Date: Tue, 26 Apr 2022 01:06:07 -0400 Subject: [PATCH 09/27] Allow builds with multiple python3 versions (#1441) (#1469) (#1472) Currently Python 3.7 is hardcoded into the debian build system here. These code changes allow other versions of python. This was tested on Python 3.9 on Debian 11. Signed-off-by: Alexander Allen --- debian/installerFiles/python-saithriftv2.install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/installerFiles/python-saithriftv2.install b/debian/installerFiles/python-saithriftv2.install index b37c52c64..e3d2e8c13 100644 --- a/debian/installerFiles/python-saithriftv2.install +++ b/debian/installerFiles/python-saithriftv2.install @@ -1 +1 @@ -debian/usr/local/lib/python3.7/site-packages/* /usr/lib/python3.7/dist-packages/ +debian/usr/local/lib/python3*/site-packages/* /usr/lib/python3/dist-packages/ From f79004c8d2a33055071733aaae653205424d2c52 Mon Sep 17 00:00:00 2001 From: Vivek R Date: Sat, 25 Jun 2022 01:40:10 -0700 Subject: [PATCH 10/27] Add thr missing API into saithriftv2 missing for syncd (#1503) Signed-off-by: Vivek Reddy Co-authored-by: Vivek Reddy Karri --- meta/sai_rpc_frontend.cpp | 10 ++++++++++ test/saithriftv2/src/saiserver.cpp | 7 ------- test/saithriftv2/src/switch_sai_rpc_server.h | 1 + 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/meta/sai_rpc_frontend.cpp b/meta/sai_rpc_frontend.cpp index be8212d78..5da527a09 100644 --- a/meta/sai_rpc_frontend.cpp +++ b/meta/sai_rpc_frontend.cpp @@ -929,6 +929,16 @@ int start_p4_sai_thrift_rpc_server(char *port) { return status; } +/** + * @brief Start Thrift RPC server Wrapper + */ +int start_sai_thrift_rpc_server(int port) +{ + static char port_str[10]; + snprintf(port_str, sizeof(port_str), "%d", port); + return start_p4_sai_thrift_rpc_server(port_str); +} + /** * @brief Stop Thrift RPC server */ diff --git a/test/saithriftv2/src/saiserver.cpp b/test/saithriftv2/src/saiserver.cpp index 786ebd10d..98596b5f6 100644 --- a/test/saithriftv2/src/saiserver.cpp +++ b/test/saithriftv2/src/saiserver.cpp @@ -266,13 +266,6 @@ void handleInitScript(const std::string& initScript) system(initScript.c_str()); } -int start_sai_thrift_rpc_server(int port) -{ - static char port_str[10]; - snprintf(port_str, sizeof(port_str), "%d", port); - return start_p4_sai_thrift_rpc_server(port_str); -} - int main(int argc, char* argv[]) { diff --git a/test/saithriftv2/src/switch_sai_rpc_server.h b/test/saithriftv2/src/switch_sai_rpc_server.h index ea1765dbc..21c7ca631 100644 --- a/test/saithriftv2/src/switch_sai_rpc_server.h +++ b/test/saithriftv2/src/switch_sai_rpc_server.h @@ -1,3 +1,4 @@ extern "C" { int start_p4_sai_thrift_rpc_server(char *port); +int start_sai_thrift_rpc_server(int port); } From 6a9def57f720bebdfa6f14efb548e7ea71e6cab4 Mon Sep 17 00:00:00 2001 From: "Richard.Yu" Date: Tue, 26 Jul 2022 14:35:09 +0800 Subject: [PATCH 11/27] Build saithrift with python3.9 in bullseye (#1541) (#1544) * Build saithrift with python3.9 in bullseye Bullseye upgrade the python to python3.9 and other image, like buster still using python 2.7. To build with different python in different image, add a condition for copy differernt install file in different type of image. Signed-off-by: richardyu-ms * change the release name to version number and reuse existing files Signed-off-by: richardyu-ms Co-authored-by: richardyu Co-authored-by: richardyu --- debian/copy_installer.sh | 14 ++++++++++---- .../python-saithriftv1-bullseye.install | 2 ++ debian/installerFiles/python-saithriftv2.install | 1 - ...hriftv1.install => python2.7-saithrift.install} | 0 debian/installerFiles/python3-saithrift.install | 2 ++ 5 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 debian/installerFiles/python-saithriftv1-bullseye.install delete mode 100644 debian/installerFiles/python-saithriftv2.install rename debian/installerFiles/{python-saithriftv1.install => python2.7-saithrift.install} (100%) create mode 100644 debian/installerFiles/python3-saithrift.install diff --git a/debian/copy_installer.sh b/debian/copy_installer.sh index 8997e87d0..556899e9a 100755 --- a/debian/copy_installer.sh +++ b/debian/copy_installer.sh @@ -1,8 +1,14 @@ if [[ x"$1" =~ x"v2" ]] then - echo "Copy python-saithriftv2.install as python-saithrift.install" - cp ./debian/installerFiles/python-saithriftv2.install ./debian/python-saithrift.install + echo "Copy python3-saithrift.install as python-saithrift.install" + cp ./debian/installerFiles/python3-saithrift.install ./debian/python-saithrift.install else - echo "Copy python-saithriftv1.install as python-saithrift.install" - cp ./debian/installerFiles/python-saithriftv1.install ./debian/python-saithrift.install + if [ $(lsb_release -sr) -ge 11 ] + then + echo "Copy python3-saithrift.install as python-saithrift.install after Ver.11 releases" + cp ./debian/installerFiles/python3-saithrift.install ./debian/python-saithrift.install + else + echo "Copy python2.7-saithrift.install as python-saithrift.install" + cp ./debian/installerFiles/python2.7-saithrift.install ./debian/python-saithrift.install + fi fi diff --git a/debian/installerFiles/python-saithriftv1-bullseye.install b/debian/installerFiles/python-saithriftv1-bullseye.install new file mode 100644 index 000000000..5745e926a --- /dev/null +++ b/debian/installerFiles/python-saithriftv1-bullseye.install @@ -0,0 +1,2 @@ +#compatiable with bullseye python 3.9 environment +debian/usr/local/lib/python3.9/site-packages/* /usr/lib/python3/dist-packages/ diff --git a/debian/installerFiles/python-saithriftv2.install b/debian/installerFiles/python-saithriftv2.install deleted file mode 100644 index e3d2e8c13..000000000 --- a/debian/installerFiles/python-saithriftv2.install +++ /dev/null @@ -1 +0,0 @@ -debian/usr/local/lib/python3*/site-packages/* /usr/lib/python3/dist-packages/ diff --git a/debian/installerFiles/python-saithriftv1.install b/debian/installerFiles/python2.7-saithrift.install similarity index 100% rename from debian/installerFiles/python-saithriftv1.install rename to debian/installerFiles/python2.7-saithrift.install diff --git a/debian/installerFiles/python3-saithrift.install b/debian/installerFiles/python3-saithrift.install new file mode 100644 index 000000000..38be43db2 --- /dev/null +++ b/debian/installerFiles/python3-saithrift.install @@ -0,0 +1,2 @@ +#compatiable with bullseye python 3.9 environment and saithriftv2 build with python3 +debian/usr/local/lib/python3*/site-packages/* /usr/lib/python3/dist-packages/ From 566d4a8ef2e90bee986133042c4f8c2d7478a107 Mon Sep 17 00:00:00 2001 From: "Richard.Yu" Date: Thu, 11 Aug 2022 19:29:08 +0800 Subject: [PATCH 12/27] [SAI-PTF] Enable saiserverv2 with syncd-rpc and fix saithriftv2 build (#1552) (#1533) (#1514) (#1492) (#1558) (#1557) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added missing dependencies required to run gensairpc.pl (#1492) Fixes #1490 Co-authored-by: Chris Sommers * Add GEN_SAIRPC_OPTS to pass flags to gensairpc.pl from top-level Make… (#1514) * [doc] Add SAI metadata introduction presentation (#1487) Small presentation about SAI metadata features added in last time. Signed-off-by: Chris Sommers * Add GEN_SAIRPC_OPTS to pass flags to gensairpc.pl from top-level Makefile or meta/Makefile Signed-off-by: Chris Sommers Co-authored-by: Kamil Cudnik Co-authored-by: Chris Sommers * Saithriftv2 fixes for extensions (#1533) * [doc] Add SAI metadata introduction presentation (#1487) Small presentation about SAI metadata features added in last time. Signed-off-by: Chris Sommers * Add GEN_SAIRPC_OPTS to pass flags to gensairpc.pl from top-level Makefile or meta/Makefile Signed-off-by: Chris Sommers * Add static_cast<> to sairpcgen templates to avoid type mismatches for SAI extensions. Signed-off-by: Chris Sommers * Add new env variable SAIRPC_EXTRA_LIBS which gets passed to final linkage of saiserver, so user can pass in additional libraries. Signed-off-by: Chris Sommers * Add experimental to include path. Signed-off-by: Chris Sommers * Add experimental headers to CPPFLAGS passed to ctypesgen. Signed-off-by: Chris Sommers * Add VLAN and PortChannel test plan (#1480) * Add VLAN and PortChannel test plan For vlan, it includes: 1. Vlan functionalities - Flooding - Forwarding - Trunk/Access - Tagging/Untagging(802.1Q) - VLAN interface (RIF/SVI) 2. SAI APIs operations - Vlan Counters - Vlan and member list operations For PortChannel, it includes: 1. Lag functionalities - Loadbalance 2. Lag SAI APIs - create/check/remove lag and lag member Signed-off-by: richardyu-ms * Update lag_test_plan.md Signed-off-by: richardyu-ms * Update lag_test_plan.md Signed-off-by: richardyu-ms * remove cases not related to T0 Signed-off-by: richardyu-ms * Update lag_test_plan.md Signed-off-by: richardyu-ms * Add VLAN and Lag test plan and put topo config in seperated files Signed-off-by: richardyu * fix typo and more description more clear Signed-off-by: richardyu-ms * fix lag test typo (#29) Signed-off-by: zhoudongxu * refactor vlan test plan and config Signed-off-by: richardyu-ms * refactor lag test plan (#33) Signed-off-by: zhoudongxu * refactor pc and vlan test Signed-off-by: zhoudongxu * Improve pc and vlan test Doc (#35) * fix typo Signed-off-by: zhoudongxu * remove some unnecessary comments Signed-off-by: zhoudongxu * reformat and adjust the description of the tests Signed-off-by: richardyu-ms * set hash algorithm (#36) Signed-off-by: zhoudongxu * refine lag test (#37) Signed-off-by: zhoudongxu * correct vlan interface test (#38) Signed-off-by: zhoudongxu * workaround for the sequence number issue in github and correct typo standardise the ip and mac naming in config add lag test for ingress port indifferenate in lag hash redesign the mac and ip namin convention and reformat Signed-off-by: richardyu-ms * adjust the case numbers and vlan id Signed-off-by: richardyu-ms Co-authored-by: zhoudongxu <1315364814@qq.com> Co-authored-by: richardyu Co-authored-by: zhoudongxu Signed-off-by: Chris Sommers * [SAI-PTF] SAI PTF test structure for T0 test and VLAN,FDB sample cases (#1499) * [SAI-PTF] Add SAI ptf test structure for T0 test Create SAI PTF test structure for T0 1. Create configuration structure for different components configu 2. Add FDB, PORT, switch, vlan configurations 3. Create Test structure base on PTF 4. Add T0 test case samples for FDB Test Done: Checked the ports functionality with port flooding Checked port forwarding base on FDB configurations Signed-off-by: richardyu-ms * add vlan config and vlan test sample case Signed-off-by: richardyu-ms * add dx010 config Signed-off-by: richardyu-ms Signed-off-by: Chris Sommers * [meta] Add sai_status_t to ancestry check (#1501) Signed-off-by: Chris Sommers * reset sleep time during turning up ports (#1502) Signed-off-by: Yang Wang Signed-off-by: Chris Sommers * [saineighbor] Bulk API support for Neighbor entries (#1504) * Bulk support for Neighbor entries Signed-off-by: Chris Sommers * add vlan testcases from Group6 to Group10 (#1506) Signed-off-by: Yang Wang Signed-off-by: Chris Sommers * Support counters on IP MC route entries. This is similar to the support added earlier for Route counters. (#1497) Support counters on IP MC route entries. This is similar to the support added earlier for Route counters. API sequence: sai_attribute_t counter_attr; attr.id = SAI_COUNTER_ATTR_TYPE; attr.value.s32 = SAI_COUNTER_TYPE_REGULAR; sai_object_id_t counter_id; sai_status_t rc = sai_counter_api->create_counter(&counter_id, g_switch_id, 1, &attr); sai_attribute_t ipmc_attr; attr.id = SAI_IPMC_ENTRY_ATTR_COUNTER_ID; attr.value.oid = counter_id; rc = sai_ipmc_api->set_ipmc_entry_attribute(route_entry, ipmc_attr); sai_stat_id_t stat_ids[] = { SAI_COUNTER_STAT_PACKETS, SAI_COUNTER_STAT_BYTES }; uint64_t stats[2]; rc = sai_counter_api->sai_get_counter_stats_ext(counter_id, 2, stat_ids, stats); Signed-off-by: rck-innovium Signed-off-by: Chris Sommers * Add thr missing API into saithriftv2 missing for syncd (#1484) saithriftv1 offers start_sai_thrift_rpc_server API to start the saithrift server and syncd is currently using that API https://github.com/Azure/sonic-sairedis/blob/master/syncd/syncd_main.cpp#L60 But this API is missing from the for saithriftv2. Made the relevant changes to provide a similar API for saithriftv2 library The start_sai_thrift_rpc_server API currently resides in saiserver.cpp which is not included in librpcserver.a and is not available for the users of the static library. Thus moved the function definition into sai_rpc_frontend.cpp for including it in the static library. Signed-off-by: Vivek Reddy Karri Signed-off-by: Chris Sommers * add vlan test case (#1510) Signed-off-by: ms-junyi add vlan test case edit FilteringTest Signed-off-by: ms-junyi edit vlan test case Signed-off-by: ms-junyi Signed-off-by: Chris Sommers * add more waiting time for test (#1511) * add more waiting time for test Signed-off-by: richardyu-ms * Update fdb_configer.py increase the waiting time for fdb entries update Signed-off-by: richardyu-ms * remove useless change Signed-off-by: richardyu-ms Signed-off-by: Chris Sommers * add read config_db.json (#1519) Signed-off-by: ms-junyi format Signed-off-by: ms-junyi addomment for each function Signed-off-by: ms-junyi add comment for each function Signed-off-by: ms-junyi Signed-off-by: Chris Sommers * [Fix]Add necessary test data file for sai test (#1520) In order to set up the port on different platforms, need to read the data for port configuration when turning on the admin state This PR is a bug fix for adding the config_db into test resources folder. Test Done: Test within SONiC mgmt container Signed-off-by: richardyu-ms Signed-off-by: Chris Sommers * Zitingguo/add lag test (#1522) * add lag config Signed-off-by: Ziting Guo Signed-off-by: zitingguo <736034564@qq.com> * enable lag config in test base Signed-off-by: Ziting Guo Signed-off-by: zitingguo <736034564@qq.com> * fix lag config Signed-off-by: Ziting Guo Signed-off-by: zitingguo <736034564@qq.com> * add remove_lag_member in lag_configer Signed-off-by: Ziting Guo Signed-off-by: zitingguo <736034564@qq.com> * add sai_ipprefix() in utils Signed-off-by: Ziting Guo Signed-off-by: zitingguo <736034564@qq.com> * fix typo Signed-off-by: zitingguo <736034564@qq.com> * import LagConfiger in sai_test_base Signed-off-by: Ziting Guo Signed-off-by: zitingguo <736034564@qq.com> * add a simple lag test Signed-off-by: Ziting Guo Signed-off-by: zitingguo <736034564@qq.com> * fix typo Signed-off-by: zitingguo <736034564@qq.com> * fix a config error in lag Signed-off-by: Ziting Guo Signed-off-by: zitingguo <736034564@qq.com> * add lag lb test based on scr port Signed-off-by: Ziting Guo Signed-off-by: zitingguo <736034564@qq.com> * fix Signed-off-by: zitingguo <736034564@qq.com> * set lag v4 hash Signed-off-by: Ziting Guo Signed-off-by: zitingguo <736034564@qq.com> * add lag disable egress test case Signed-off-by: Ziting Guo Signed-off-by: zitingguo <736034564@qq.com> * add IndifferenceIngressPortTest Signed-off-by: Ziting Guo Signed-off-by: zitingguo <736034564@qq.com> * fix set hash function Signed-off-by: Ziting Guo Signed-off-by: zitingguo <736034564@qq.com> * separate route configuration from lag Signed-off-by: Ziting Guo Signed-off-by: zitingguo <736034564@qq.com> * disable setting lag hash Signed-off-by: Ziting Guo Signed-off-by: zitingguo <736034564@qq.com> * add virtual interface Signed-off-by: Ziting Guo Signed-off-by: zitingguo <736034564@qq.com> * Config default v4&v6 route Signed-off-by: zitingguo <736034564@qq.com> Signed-off-by: Chris Sommers * add teardown for testing multiple cases at a time (#1521) * add read config_db.json Signed-off-by: ms-junyi format Signed-off-by: ms-junyi addomment for each function Signed-off-by: ms-junyi add comment for each function Signed-off-by: ms-junyi * tear down Signed-off-by: ms-junyi Signed-off-by: Chris Sommers * Added missing dependencies required to run gensairpc.pl (#1492) Fixes #1490 Co-authored-by: Chris Sommers Signed-off-by: Chris Sommers * Update saitam.h (#1496) Attribute is introduced to configure IPFIX template reporting interval as per the RFC7011. https://datatracker.ietf.org/doc/html/rfc7011#section-8.4 Signed-off-by: Jai Kumar Signed-off-by: Chris Sommers * Pass SAIRPC_EXTRA_LIBS flag in Makefile Signed-off-by: Chris Sommers * Removed changes to include paths for SAI extension headers; as it turns out these changes were not required as originally reported in https://github.com/opencomputeproject/SAI/issues/1531. Signed-off-by: Chris Sommers Co-authored-by: Kamil Cudnik Co-authored-by: Chris Sommers Co-authored-by: Richard.Yu Co-authored-by: zhoudongxu <1315364814@qq.com> Co-authored-by: richardyu Co-authored-by: zhoudongxu Co-authored-by: Yang Wang Co-authored-by: Prince Sunny Co-authored-by: Ravindranath C K Co-authored-by: Vivek R Co-authored-by: ms-junyi <106718431+ms-junyi@users.noreply.github.com> Co-authored-by: zitingguo-ms <736034564@qq.com> Co-authored-by: Jai Kumar * [SAI-PTF]Align the sai rpc front name with swss and syncd (#1552) In Syncd starting process, it will try to start the switch and assign the gSwtichId to the sai implementation. In the syncd rpc container, in order to get the swtich id after syncd initalization, we need to get and check the switch id. Signed-off-by: richardyu-ms * Check for NULL APIs returned by sai_api_query() before calling. (#1558) Signed-off-by: Chris Sommers Co-authored-by: Chris Sommers Signed-off-by: richardyu-ms Co-authored-by: Chris Sommers <31145757+chrispsommers@users.noreply.github.com> Co-authored-by: Chris Sommers Co-authored-by: Kamil Cudnik Co-authored-by: zhoudongxu <1315364814@qq.com> Co-authored-by: richardyu Co-authored-by: zhoudongxu Co-authored-by: Yang Wang Co-authored-by: Prince Sunny Co-authored-by: Ravindranath C K Co-authored-by: Vivek R Co-authored-by: ms-junyi <106718431+ms-junyi@users.noreply.github.com> Co-authored-by: zitingguo-ms <736034564@qq.com> Co-authored-by: Jai Kumar --- Makefile | 8 ++++- meta/Makefile | 5 +++- meta/README.md | 6 +++- meta/gensairpc.README | 18 +++++++----- meta/gensairpc.pl | 2 +- meta/templates/sai_rpc_server_functions.tt | 29 ++++++++++++++++++- .../sai_rpc_server_helper_functions.tt | 4 +-- test/saithriftv2/Makefile | 7 +++-- 8 files changed, 63 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 8509c2e37..691dba474 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,12 @@ else SAITHRIFT_PATH=test/saithrift endif +# Passed to genrpc.pl via "make saithrift-build": +GEN_SAIRPC_OPTS?= + +# Passed to meta/Makefile via "make saithrift-build, can specify add'l libraries along with libsai +SAIRPC_EXTRA_LIBS?= + .PHONY: test doc clean doc: @@ -37,7 +43,7 @@ test: make -C test saithrift-build: - make -C $(SAITHRIFT_PATH) + SAIRPC_EXTRA_LIBS="$(SAIRPC_EXTRA_LIBS)" GEN_SAIRPC_OPTS=$(GEN_SAIRPC_OPTS) make -C $(SAITHRIFT_PATH) saithrift-install: saithrift-build make -C $(SAITHRIFT_PATH) install diff --git a/meta/Makefile b/meta/Makefile index ce5423721..dc41edab9 100644 --- a/meta/Makefile +++ b/meta/Makefile @@ -22,6 +22,9 @@ # @brief This module defines SAI Metadata Makefile # +# Passed to genrpc.pl: +GEN_SAIRPC_OPTS?= + WARNINGS = \ -ansi \ -Wall \ @@ -114,7 +117,7 @@ saimetadatatest.c saimetadata.c saimetadata.h: xml $(XMLDEPS) parse.pl $(CONSTHE perl -I. parse.pl rpc sai.thrift sai_rpc_server.cpp sai_adapter.py: xml $(XMLDEPS) gensairpc.pl - perl -Irpc gensairpc.pl + perl -Irpc gensairpc.pl $(GEN_SAIRPC_OPTS) HEADERS = saimetadata.h $(CONSTHEADERS) diff --git a/meta/README.md b/meta/README.md index d0e2f89fa..c93bea510 100644 --- a/meta/README.md +++ b/meta/README.md @@ -13,5 +13,9 @@ Parser also forces headers to be well formated when adding new code. To test your changes just type: ```sh -make +[GEN_SAIRPC_OPTS=