Skip to content

Commit

Permalink
Merge current master
Browse files Browse the repository at this point in the history
  • Loading branch information
bacrossland committed Sep 20, 2022
2 parents 80181c4 + 7cc035f commit c29e376
Show file tree
Hide file tree
Showing 186 changed files with 21,549 additions and 4,608 deletions.
1 change: 1 addition & 0 deletions .azure-pipelines/build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ jobs:
target/debs/buster/libnl-route-3-dev_*.deb
target/debs/buster/libnl-nf-3-200_*.deb
target/debs/buster/libnl-nf-3-dev_*.deb
target/debs/buster/libyang_*.deb
displayName: "Download common libs"
- script: |
set -ex
Expand Down
10 changes: 2 additions & 8 deletions .azure-pipelines/docker-sonic-vs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@ ARG docker_container_name

ADD ["debs", "/debs"]

RUN dpkg --purge python-swsscommon
RUN dpkg --purge python3-swsscommon
RUN dpkg --purge swss
RUN dpkg --purge libsairedis
RUN dpkg --purge libswsscommon
RUN dpkg --purge libsaimetadata
RUN dpkg --purge libsaivs
RUN dpkg --purge syncd-vs
RUN dpkg --purge python-swsscommon python3-swsscommon swss libsairedis sonic-db-cli libswsscommon libsaimetadata libsaivs syncd-vs

RUN dpkg -i /debs/libswsscommon_1.0.0_amd64.deb
RUN dpkg -i /debs/python-swsscommon_1.0.0_amd64.deb
RUN dpkg -i /debs/python3-swsscommon_1.0.0_amd64.deb
RUN dpkg -i /debs/sonic-db-cli_1.0.0_amd64.deb

RUN dpkg -i /debs/libsaimetadata_1.0.0_amd64.deb
RUN dpkg -i /debs/libsairedis_1.0.0_amd64.deb
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/gcov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ parameters:

- name: timeout
type: number
default: 180
default: 240

- name: sonic_slave
type: string
Expand Down
43 changes: 35 additions & 8 deletions .azure-pipelines/test-docker-sonic-vs-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
set -ex
sudo .azure-pipelines/build_and_install_module.sh
sudo apt-get install -y libhiredis0.14
sudo apt-get install -y libhiredis0.14 libyang0.16
sudo dpkg -i --force-confask,confnew $(Build.ArtifactStagingDirectory)/download/libswsscommon_1.0.0_amd64.deb || apt-get install -f
sudo dpkg -i $(Build.ArtifactStagingDirectory)/download/python3-swsscommon_1.0.0_amd64.deb
Expand All @@ -69,16 +69,43 @@ jobs:
pushd tests
if [ '${{ parameters.archive_gcov }}' == True ]; then
sudo py.test -v --force-flaky --junitxml=tr.xml --keeptb --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
all_tests=$(ls test_*.py)
all_tests="${all_tests} p4rt"
test_set=()
# Run 20 tests as a set.
for test in ${all_tests}; do
test_set+=("${test}")
if [ ${#test_set[@]} -ge 20 ]; then
test_name=$(echo "${test_set[0]}" | cut -d "." -f 1)
echo "${test_set[*]}" | xargs sudo py.test -v --force-flaky --junitxml="${test_name}_tr.xml" --keeptb --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
container_count=$(docker ps -q -a | wc -l)
if [ ${container_count} -gt 0 ]; then
./gcov_support.sh set_environment $(Build.ArtifactStagingDirectory)
docker stop $(docker ps -q -a)
docker rm $(docker ps -q -a)
fi
test_set=()
fi
done
if [ ${#test_set[@]} -gt 0 ]; then
test_name=$(echo "${test_set[0]}" | cut -d "." -f 1)
echo "${test_set[*]}" | xargs sudo py.test -v --force-flaky --junitxml="${test_name}_tr.xml" --keeptb --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
container_count=$(docker ps -q -a | wc -l)
if [ ${container_count} -gt 0 ]; then
./gcov_support.sh set_environment $(Build.ArtifactStagingDirectory)
docker stop $(docker ps -q -a)
docker rm $(docker ps -q -a)
fi
fi
else
sudo py.test -v --force-flaky --junitxml=tr.xml --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
sudo py.test -v --force-flaky --junitxml=tests_tr.xml --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
fi
rm -rf $(Build.ArtifactStagingDirectory)/download
displayName: "Run vs tests"
- task: PublishTestResults@2
inputs:
testResultsFiles: '**/tr.xml'
testResultsFiles: '**/*_tr.xml'
testRunTitle: vstest
condition: always()

Expand All @@ -87,17 +114,17 @@ jobs:
if [ '${{ parameters.archive_gcov }}' == True ]; then
sudo apt-get install -y lcov
./tests/gcov_support.sh set_environment $(Build.ArtifactStagingDirectory)
docker stop $(docker ps -q -a)
docker rm $(docker ps -q -a)
cd $(Build.ArtifactStagingDirectory)/gcov_tmp/
tar -zcvf sonic-gcov.tar.gz sonic-gcov/
rm -rf sonic-gcov
fi
displayName: "Collect logs"
condition: always()
- publish: $(Build.ArtifactStagingDirectory)/gcov_tmp
artifact: ${{ parameters.gcov_artifact_name }}
displayName: "Publish gcov output"
condition: eq('${{ parameters.archive_gcov }}', true)
condition: and(succeeded(), eq('${{ parameters.archive_gcov }}', true))

- publish: $(Build.ArtifactStagingDirectory)/
artifact: ${{ parameters.log_artifact_name }}@$(System.JobAttempt)
Expand Down
40 changes: 35 additions & 5 deletions cfgmgr/buffermgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
#include "exec.h"
#include "shellcmd.h"
#include "warm_restart.h"
#include "converter.h"

using namespace std;
using namespace swss;

#define PORT_NAME_GLOBAL "global"

BufferMgr::BufferMgr(DBConnector *cfgDb, DBConnector *applDb, string pg_lookup_file, const vector<string> &tableNames) :
Orch(cfgDb, tableNames),
m_cfgPortTable(cfgDb, CFG_PORT_TABLE_NAME),
Expand Down Expand Up @@ -175,10 +178,27 @@ task_process_status BufferMgr::doSpeedUpdateTask(string port)
string profile_ref = buffer_profile_key;

vector<string> lossless_pgs = tokenize(pfc_enable, ',');
// Convert to bitmap
unsigned long lossless_pg_id = 0;
for (auto pg : lossless_pgs)
{
try
{
uint8_t cur_pg = to_uint<uint8_t>(pg);
lossless_pg_id |= (1<<cur_pg);
}
catch (const std::invalid_argument &e)
{
// Ignore invalid value
continue;
}
}
// Although we have up to 8 PGs for now, the range to check is expanded to 32 support more PGs
set<string> lossless_pg_combinations = generateIdListFromMap(lossless_pg_id, sizeof(lossless_pg_id));

if (m_portStatusLookup[port] == "down" && m_platform == "mellanox")
{
for (auto lossless_pg : lossless_pgs)
for (auto lossless_pg : lossless_pg_combinations)
{
// Remove the entry in BUFFER_PG table if any
vector<FieldValueTuple> fvVectorPg;
Expand Down Expand Up @@ -251,23 +271,27 @@ task_process_status BufferMgr::doSpeedUpdateTask(string port)
SWSS_LOG_NOTICE("Reusing existing profile '%s'", buffer_profile_key.c_str());
}

for (auto lossless_pg : lossless_pgs)
for (auto lossless_pg : lossless_pg_combinations)
{
vector<FieldValueTuple> fvVectorPg;
string buffer_pg_key = port + m_cfgBufferPgTable.getTableNameSeparator() + lossless_pg;

m_cfgBufferPgTable.get(buffer_pg_key, fvVectorPg);

bool profile_existing = false;
/* Check if PG Mapping is already then log message and return. */
for (auto& prop : fvVectorPg)
{
if ((fvField(prop) == "profile") && (profile_ref == fvValue(prop)))
{
SWSS_LOG_NOTICE("PG to Buffer Profile Mapping %s already present", buffer_pg_key.c_str());
continue;
profile_existing = true;
break;
}
}

if (profile_existing)
{
continue;
}
fvVectorPg.clear();

fvVectorPg.push_back(make_pair("profile", profile_ref));
Expand Down Expand Up @@ -391,6 +415,12 @@ void BufferMgr::doPortQosTableTask(Consumer &consumer)
{
KeyOpFieldsValuesTuple tuple = it->second;
string port_name = kfvKey(tuple);
if (port_name == PORT_NAME_GLOBAL)
{
// Ignore the entry for global level
it = consumer.m_toSync.erase(it);
continue;
}
string op = kfvOp(tuple);
if (op == SET_COMMAND)
{
Expand Down
Loading

0 comments on commit c29e376

Please sign in to comment.