Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5e32f5c
ECMP Member Capability and Configuration (#1461)
JaiOCP Apr 4, 2022
1f7f5f0
Updated absolute path to general to fix sonic build issue. (#1465)
vmittal-msft Apr 6, 2022
a00aa0f
Revert "ECMP Member Capability and Configuration (#1461)"
rlhui Apr 7, 2022
2af4c67
Update version to v1.10.1
rlhui Apr 7, 2022
2df5d42
ECMP Member Capability and Configuration (#1461)
JaiOCP Apr 4, 2022
f5097f6
Bulk API for setting Port Attributes (#1460)
JaiOCP Apr 5, 2022
d721a65
Update version to 1.10.2
rlhui Apr 8, 2022
ea58a49
[meta] Disable doxygen TCL_SUBST and COLS_IN_ALPHA_INDEX (#1457) (#14…
alexrallen Apr 25, 2022
f69394f
Allow builds with multiple python3 versions (#1441) (#1469) (#1472)
alexrallen Apr 26, 2022
f79004c
Add thr missing API into saithriftv2 missing for syncd (#1503)
vivekrnv Jun 25, 2022
6a9def5
Build saithrift with python3.9 in bullseye (#1541) (#1544)
richardyu-ms Jul 26, 2022
566d4a8
[SAI-PTF] Enable saiserverv2 with syncd-rpc and fix saithriftv2 build…
richardyu-ms Aug 11, 2022
ff9d1d3
[Cherry pick][SAI-PTF]Two fix for sai-ptf infra (#1634)
richardyu-ms Nov 1, 2022
fd50fbb
[SAI-PTF] Add uninit API support in SAI-PTF and enhance the platform …
richardyu-ms Nov 2, 2022
2b03cba
[cherry-pick][SAI-PTF] add invocation logger (#1651)
richardyu-ms Nov 16, 2022
9e9ca99
[SAI-PTF]add conditional import for unit test (#1656)
richardyu-ms Nov 17, 2022
95e7803
[SAI-PTF]Fix issue when transfer make parameter GEN_SAIRPC_OPTS (#1674)
richardyu-ms Dec 4, 2022
a68cc48
[SAI-PTF]Add return value in the SAI-PTF log (#1684)
richardyu-ms Dec 20, 2022
9c82b01
[SAI-PTF] API Logger - reformat dict in return value (#1689)
richardyu-ms Dec 22, 2022
9d78ced
[SAI-PTF] API Logger - reformat arg values (#1695)
richardyu-ms Dec 23, 2022
a17d258
[SAI-PTF] Skip test when hit expected error from sai api (#1698)
richardyu-ms Dec 24, 2022
677ed9c
Enable github code scanning to replace LGTM. (#1708)
liushilongbuaa Dec 28, 2022
347ae84
improve enum values integration check (#1727) (#1734)
richardyu-ms Feb 7, 2023
2972f73
[1.10]Enhance the check enum lock script (#1740)
richardyu-ms Feb 8, 2023
161f9f7
[cherry-pick][1.10][SAI-PTF] Convert generated enum code from ctypesg…
richardyu-ms Feb 24, 2023
b5faa57
Cherry-pick of Master PR: #1814 in v1.10
abdosi Jul 13, 2023
fdc4ff9
Added saithrift support to return sai_object_id for a given system_po…
saksarav-nokia Dec 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: "CodeQL config"
queries:
- uses: security-and-quality
- uses: security-extended
44 changes: 44 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# For more infomation, please visit: https://github.com/github/codeql-action

name: "CodeQL"

on:
push:
branches:
- 'master'
- 'v[0-9].*'
pull_request_target:
branches:
- 'master'
- 'v[0-9].*'
workflow_dispatch:

jobs:
analyze:
name: Analyze
runs-on: ubuntu-20.04
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/[email protected]
with:
config-file: ./.github/codeql/codeql-config.yml
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/[email protected]
with:
category: "/language:${{matrix.language}}"
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
14 changes: 10 additions & 4 deletions debian/copy_installer.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions debian/installerFiles/python-saithriftv1-bullseye.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#compatiable with bullseye python 3.9 environment
debian/usr/local/lib/python3.9/site-packages/* /usr/lib/python3/dist-packages/
1 change: 0 additions & 1 deletion debian/installerFiles/python-saithriftv2.install

This file was deleted.

2 changes: 2 additions & 0 deletions debian/installerFiles/python3-saithrift.install
Original file line number Diff line number Diff line change
@@ -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/
41 changes: 41 additions & 0 deletions doc/SAI-Proposal-ECMP-Member-Count.md
Original file line number Diff line number Diff line change
@@ -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.

2 changes: 1 addition & 1 deletion inc/saiobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include <saisrv6.h>

/* new experimental object type includes */
#include "../experimental/saiexperimentalbmtor.h"
#include <saiexperimentalbmtor.h>

/**
* @defgroup SAIOBJECT SAI - Object API definitions.
Expand Down
4 changes: 4 additions & 0 deletions inc/saiport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
17 changes: 17 additions & 0 deletions inc/saiswitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion inc/saiversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#define SAI_MAJOR 1
#define SAI_MINOR 10
#define SAI_REVISION 0
#define SAI_REVISION 2

#define SAI_VERSION(major, minor, revision) (10000 * (major) + 100 * (minor) + (revision))

Expand Down
4 changes: 2 additions & 2 deletions meta/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions meta/Doxyfile.compat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion meta/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
# @brief This module defines SAI Metadata Makefile
#

# Passed to genrpc.pl:
GEN_SAIRPC_OPTS?=

WARNINGS = \
-ansi \
-Wall \
Expand Down Expand Up @@ -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)

Expand Down
6 changes: 5 additions & 1 deletion meta/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<option flags>] make
```
e.g.
```
GEN_SAIRPC_OPTS="-ve" make
```
4 changes: 2 additions & 2 deletions meta/checkenumlock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ set -e

rm -rf temp

mkdir temp
sairepo=`git remote get-url origin`

git --work-tree=temp/ checkout origin/master inc
git clone $sairepo temp

echo "Checking for possible enum values shift (current branch vs origin/master) ..."

Expand Down
2 changes: 1 addition & 1 deletion meta/checkheaders.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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 '$dir'/../experimental -I '$dir' -o $bin") == 0 or die "gcc failed! $!";

close $fhs;
close $fhb;
Expand Down
18 changes: 11 additions & 7 deletions meta/gensairpc.README
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ USAGE

DEPENDENCIES
Ubuntu packages:

libtemplate-perl
libconst-fast-perl
libmoosex-aliases-perl
libnamespace-autoclean-perl
libgetopt-long-descriptive-perl

```
[sudo] apt-get install -y \
libtemplate-perl \
libconst-fast-perl \
libmoosex-aliases-perl \
libnamespace-autoclean-perl \
libgetopt-long-descriptive-perl \
doxygen \
graphviz \
aspell-en
```
5 changes: 4 additions & 1 deletion meta/gensairpc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
[ 'verbose|v', 'Print more details', { default => 0 } ],
[ 'mandatory-attrs', 'Make mandatory attributes obligatory in sai_adapter.py', { default => 0 } ],
[ 'dev-utils:s', 'Generate additional development utils within the generated code. Additional options: [=log,zero]', { default => 0 } ],
[ 'adapter_logger', 'Enable the logger in sai_adapter, it will log all the method invocation.', { default => 0} ],
[ 'attr-header', 'Generate additional header of attributes definitions (including object types)', { default => 0 } ],
[ 'help|h', 'Print this help', { shortcircuit => 1 } ],
);
Expand All @@ -114,6 +115,7 @@
my $clean = $args->clean_meta;
my $mandatory_attrs = $args->mandatory_attrs;
my $dev_utils = ( $args->dev_utils ne q{} ? $args->dev_utils : 1 );
my $adapter_logger = ( $args->adapter_logger ne q{} ? $args->adapter_logger : 1 );
my $attr_header = $args->attr_header;

# Configure SAI meta
Expand Down Expand Up @@ -159,6 +161,7 @@
dbg => $dbg,
mandatory_attrs => $mandatory_attrs,
dev_utils => $dev_utils,
adapter_logger => $adapter_logger,
templates_dir => $templates_dir
};

Expand Down Expand Up @@ -281,7 +284,7 @@ sub generate_server_template_from_skeleton {

# Define global variable before "class"
print {$server_template}
"\nextern sai_object_id_t switch_id;\nsai_object_id_t switch_id;\n\n\n";
"\nextern sai_object_id_t switch_id;\nsai_object_id_t switch_id;\nextern sai_object_id_t gSwitchId;\n\n\n";

# Define helper functions
print {$server_template} "[% PROCESS helper_functions %]\n\n\n";
Expand Down
1 change: 1 addition & 0 deletions meta/rpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Optional arguments are useful for development purposes.
| `-d` `--dump` | Dump all data to the file. **Should be used during development**. |
| `--mandatory-attrs` | Make mandatory attributes obligatory in *sai\_adapter.py*. It removes `=None` from attributes, which are passed as arguments into python functions. Can be useful for debugging purposes, but since most of attributes are **optionally** mandatory, this is not as useful as it could be. |
| `--dev-utils[=STR]` | Generate additional development utils within the generated code. Additional options: [=log,zero]. Useful for tests development and debugging. The generated code **should not** be committed. |
| `--adapter_logger` | Enable the logger in sai_adapter, it will log all the method invocation. |
| `-h` `--help` | Print the help. |

*gensairpc.pl* development
Expand Down
18 changes: 18 additions & 0 deletions meta/sai_rpc_frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,14 @@ class sai_rpcHandlerFrontend : virtual public sai_rpcHandler {
return sai_switch_id_query(object_id);
}

/**
* @brief Thrift wrapper for sai_api_uninitialize() SAI function
*/
sai_thrift_status_t sai_thrift_api_uninitialize(void) {

return sai_api_uninitialize();
}

/**
* @brief Thrift wrapper for sai_query_attribute_enum_values_capability()
* function
Expand Down Expand Up @@ -929,6 +937,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
*/
Expand Down
Loading