Skip to content

Commit

Permalink
Merge branch 'master' into threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
PrabhuSreenivasan authored Jan 28, 2021
2 parents 9ab1114 + f4aefba commit 2cdb571
Show file tree
Hide file tree
Showing 139 changed files with 16,397 additions and 1,773 deletions.
2 changes: 2 additions & 0 deletions .artifactignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/*
!*.deb
202 changes: 202 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
# C/C++ with GCC
# Build your C/C++ project with GCC using make.
# Add steps that publish test results, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/c-cpp/gcc

trigger:
branches:
include:
- "*"

jobs:
- job:
displayName: "amd64"
pool:
vmImage: 'ubuntu-20.04'

container:
image: sonicdev-microsoft.azurecr.io:443/sonic-slave-buster:latest

steps:
- script: |
sudo apt-get install -y libhiredis0.14 libhiredis-dev
sudo apt-get install -y libzmq5 libzmq3-dev
sudo apt-get install -qq -y \
libhiredis-dev \
libnl-3-dev \
libnl-genl-3-dev \
libnl-route-3-dev \
libnl-nf-3-dev \
swig3.0
sudo apt-get install -y libdbus-1-3
sudo apt-get install -y libteam-dev \
libteam5 \
libteamdctl0
displayName: "Install dependencies"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 9
artifacts: sonic-swss-common
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
displayName: "Download sonic swss common deb packages"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 12
artifacts: sonic-sairedis
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
displayName: "Download sonic sairedis deb packages"
- script: |
sudo dpkg -i sonic-swss-common/libswsscommon_1.0.0_amd64.deb
sudo dpkg -i sonic-swss-common/libswsscommon-dev_1.0.0_amd64.deb
sudo dpkg -i sonic-sairedis/libsaivs_*.deb
sudo dpkg -i sonic-sairedis/libsaivs-dev_*.deb
sudo dpkg -i sonic-sairedis/libsairedis_*.deb
sudo dpkg -i sonic-sairedis/libsairedis-dev_*.deb
sudo dpkg -i sonic-sairedis/libsaimetadata_*.deb
sudo dpkg -i sonic-sairedis/libsaimetadata-dev_*.deb
sudo dpkg -i sonic-sairedis/syncd-vs_*.deb
workingDirectory: $(Pipeline.Workspace)
displayName: "Install sonic swss common and sairedis"
- checkout: self
submodules: true
- script: |
./autogen.sh
dpkg-buildpackage -us -uc -b -j$(nproc) && cp ../*.deb .
displayName: "Compile sonic swss"
- publish: $(System.DefaultWorkingDirectory)/
artifact: sonic-swss
displayName: "Archive swss debian packages"

- job:
displayName: "arm64"
timeoutInMinutes: 180
pool: sonicbld

container:
image: sonicdev-microsoft.azurecr.io:443/sonic-slave-buster-arm64:latest

steps:
- script: |
sudo apt-get install -y libhiredis0.14 libhiredis-dev
sudo apt-get install -y libzmq5 libzmq3-dev
sudo apt-get install -qq -y \
libhiredis-dev \
libnl-3-dev \
libnl-genl-3-dev \
libnl-route-3-dev \
libnl-nf-3-dev \
swig3.0
sudo apt-get install -y libdbus-1-3
sudo apt-get install -y libteam-dev \
libteam5 \
libteamdctl0
displayName: "Install dependencies"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 9
artifacts: sonic-swss-common.arm64
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
displayName: "Download sonic swss common deb packages"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 12
artifacts: sonic-sairedis.arm64
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
displayName: "Download sonic sairedis deb packages"
- script: |
sudo dpkg -i sonic-swss-common.arm64/libswsscommon_1.0.0_arm64.deb
sudo dpkg -i sonic-swss-common.arm64/libswsscommon-dev_1.0.0_arm64.deb
sudo dpkg -i sonic-sairedis.arm64/libsaivs_*.deb
sudo dpkg -i sonic-sairedis.arm64/libsaivs-dev_*.deb
sudo dpkg -i sonic-sairedis.arm64/libsairedis_*.deb
sudo dpkg -i sonic-sairedis.arm64/libsairedis-dev_*.deb
sudo dpkg -i sonic-sairedis.arm64/libsaimetadata_*.deb
sudo dpkg -i sonic-sairedis.arm64/libsaimetadata-dev_*.deb
sudo dpkg -i sonic-sairedis.arm64/syncd-vs_*.deb
workingDirectory: $(Pipeline.Workspace)
displayName: "Install sonic swss common and sairedis"
- checkout: self
submodules: true
- script: |
./autogen.sh
dpkg-buildpackage -us -uc -b -j$(nproc) && cp ../*.deb .
displayName: "Compile sonic swss"
- publish: $(System.DefaultWorkingDirectory)/
artifact: sonic-swss.arm64
displayName: "Archive swss debian packages"

- job:
displayName: "armhf"
timeoutInMinutes: 180
pool: sonicbld

container:
image: sonicdev-microsoft.azurecr.io:443/sonic-slave-buster-armhf:latest

steps:
- script: |
sudo apt-get install -y libhiredis0.14 libhiredis-dev
sudo apt-get install -y libzmq5 libzmq3-dev
sudo apt-get install -qq -y \
libhiredis-dev \
libnl-3-dev \
libnl-genl-3-dev \
libnl-route-3-dev \
libnl-nf-3-dev \
swig3.0
sudo apt-get install -y libdbus-1-3
sudo apt-get install -y libteam-dev \
libteam5 \
libteamdctl0
displayName: "Install dependencies"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 9
artifacts: sonic-swss-common.armhf
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
displayName: "Download sonic swss common deb packages"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 12
artifacts: sonic-sairedis.armhf
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
displayName: "Download sonic sairedis deb packages"
- script: |
sudo dpkg -i sonic-swss-common.armhf/libswsscommon_1.0.0_armhf.deb
sudo dpkg -i sonic-swss-common.armhf/libswsscommon-dev_1.0.0_armhf.deb
sudo dpkg -i sonic-sairedis.armhf/libsaivs_*.deb
sudo dpkg -i sonic-sairedis.armhf/libsaivs-dev_*.deb
sudo dpkg -i sonic-sairedis.armhf/libsairedis_*.deb
sudo dpkg -i sonic-sairedis.armhf/libsairedis-dev_*.deb
sudo dpkg -i sonic-sairedis.armhf/libsaimetadata_*.deb
sudo dpkg -i sonic-sairedis.armhf/libsaimetadata-dev_*.deb
sudo dpkg -i sonic-sairedis.armhf/syncd-vs_*.deb
workingDirectory: $(Pipeline.Workspace)
displayName: "Install sonic swss common and sairedis"
- checkout: self
submodules: true
- script: |
./autogen.sh
dpkg-buildpackage -us -uc -b -j$(nproc) && cp ../*.deb .
displayName: "Compile sonic swss"
- publish: $(System.DefaultWorkingDirectory)/
artifact: sonic-swss.armhf
displayName: "Archive swss debian packages"
19 changes: 17 additions & 2 deletions cfgmgr/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@ CFLAGS_SAI = -I /usr/include/sai
LIBNL_CFLAGS = -I/usr/include/libnl3
LIBNL_LIBS = -lnl-genl-3 -lnl-route-3 -lnl-3

bin_PROGRAMS = vlanmgrd teammgrd portmgrd intfmgrd buffermgrd vrfmgrd nbrmgrd vxlanmgrd sflowmgrd natmgrd coppmgrd
bin_PROGRAMS = vlanmgrd teammgrd portmgrd intfmgrd buffermgrd vrfmgrd nbrmgrd vxlanmgrd sflowmgrd natmgrd coppmgrd tunnelmgrd

cfgmgrdir = $(datadir)/swss

dist_cfgmgr_DATA = \
buffer_check_headroom_mellanox.lua \
buffer_headroom_mellanox.lua \
buffer_pool_mellanox.lua \
buffer_check_headroom_vs.lua \
buffer_headroom_vs.lua \
buffer_pool_vs.lua

if DEBUG
DBGFLAGS = -ggdb -DDEBUG
Expand Down Expand Up @@ -31,7 +41,7 @@ intfmgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
intfmgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
intfmgrd_LDADD = -lswsscommon

buffermgrd_SOURCES = buffermgrd.cpp buffermgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
buffermgrd_SOURCES = buffermgrd.cpp buffermgr.cpp buffermgrdyn.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
buffermgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
buffermgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
buffermgrd_LDADD = -lswsscommon
Expand Down Expand Up @@ -66,3 +76,8 @@ coppmgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
coppmgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
coppmgrd_LDADD = -lswsscommon

tunnelmgrd_SOURCES = tunnelmgrd.cpp tunnelmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
tunnelmgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
tunnelmgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
tunnelmgrd_LDADD = -lswsscommon

131 changes: 131 additions & 0 deletions cfgmgr/buffer_check_headroom_mellanox.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
-- KEYS - port name
-- ARGV[1] - profile name
-- ARGV[2] - new size
-- ARGV[3] - pg to add

local port = KEYS[1]
local input_profile_name = ARGV[1]
local input_profile_size = ARGV[2]
local new_pg = ARGV[3]
local accumulative_size = 0

local appl_db = "0"
local config_db = "4"
local state_db = "6"

local ret_true = {}
local ret_false = {}
local ret = {}
local default_ret = {}

table.insert(ret_true, "result:true")
table.insert(ret_false, "result:false")

-- Fetch the cable length from CONFIG_DB
redis.call('SELECT', config_db)
local cable_length_keys = redis.call('KEYS', 'CABLE_LENGTH*')
if #cable_length_keys == 0 then
return ret_true
end

-- Check whether cable length exceeds 300m (maximum value in the non-dynamic-buffer solution)
local cable_length_str = redis.call('HGET', cable_length_keys[1], port)
if cable_length_str == nil then
return ret_true
end
local cable_length = tonumber(string.sub(cable_length_str, 1, -2))
if cable_length > 300 then
default_ret = ret_false
else
default_ret = ret_true
end
table.insert(default_ret, 'debug:no max_headroom_size configured, check cable length instead')

local speed = redis.call('HGET', 'PORT|' .. port, 'speed')

-- Fetch the threshold from STATE_DB
redis.call('SELECT', state_db)

local max_headroom_size = tonumber(redis.call('HGET', 'BUFFER_MAX_PARAM_TABLE|' .. port, 'max_headroom_size'))
if max_headroom_size == nil then
return default_ret
end

local asic_keys = redis.call('KEYS', 'ASIC_TABLE*')
local pipeline_delay = tonumber(redis.call('HGET', asic_keys[1], 'pipeline_latency'))
if speed == 400000 then
pipeline_delay = pipeline_delay * 2 - 1
end
accumulative_size = accumulative_size + 2 * pipeline_delay * 1024

-- Fetch all keys in BUFFER_PG according to the port
redis.call('SELECT', appl_db)

local debuginfo = {}

local function get_number_of_pgs(keyname)
local range = string.match(keyname, "Ethernet%d+:([^%s]+)$")
local size
if range == nil then
table.insert(debuginfo, "debug:invalid pg:" .. keyname)
return 0
end
if string.len(range) == 1 then
size = 1
else
size = 1 + tonumber(string.sub(range, -1)) - tonumber(string.sub(range, 1, 1))
end
return size
end

local no_input_pg = true
if new_pg ~= nil then
if get_number_of_pgs(new_pg) ~= 0 then
no_input_pg = false
new_pg = 'BUFFER_PG_TABLE:' .. new_pg
end
end

-- Fetch all the PGs, accumulate the sizes
-- Assume there is only one lossless profile configured among all PGs on each port
table.insert(debuginfo, 'debug:other overhead:' .. accumulative_size)
local pg_keys = redis.call('KEYS', 'BUFFER_PG_TABLE:' .. port .. ':*')
for i = 1, #pg_keys do
local profile = string.sub(redis.call('HGET', pg_keys[i], 'profile'), 2, -2)
local current_profile_size
if profile ~= 'BUFFER_PROFILE_TABLE:ingress_lossy_profile' and (no_input_pg or new_pg ~= pg_keys[i]) then
if profile ~= input_profile_name and not no_input_pg then
local referenced_profile = redis.call('HGETALL', profile)
for j = 1, #referenced_profile, 2 do
if referenced_profile[j] == 'size' then
current_profile_size = tonumber(referenced_profile[j+1])
end
end
else
current_profile_size = input_profile_size
profile = input_profile_name
end
accumulative_size = accumulative_size + current_profile_size * get_number_of_pgs(pg_keys[i])
table.insert(debuginfo, 'debug:' .. pg_keys[i] .. ':' .. profile .. ':' .. current_profile_size .. ':' .. get_number_of_pgs(pg_keys[i]) .. ':accu:' .. accumulative_size)
end
end

if not no_input_pg then
accumulative_size = accumulative_size + input_profile_size * get_number_of_pgs(new_pg)
table.insert(debuginfo, 'debug:' .. new_pg .. '*:' .. input_profile_name .. ':' .. input_profile_size .. ':' .. get_number_of_pgs(new_pg) .. ':accu:' .. accumulative_size)
end

if max_headroom_size > accumulative_size then
table.insert(ret, "result:true")
else
table.insert(ret, "result:false")
end

table.insert(ret, "debug:max headroom:" .. max_headroom_size)
table.insert(ret, "debug:accumulative headroom:" .. accumulative_size)

for i = 1, #debuginfo do
table.insert(ret, debuginfo[i])
end

return ret
1 change: 1 addition & 0 deletions cfgmgr/buffer_check_headroom_vs.lua
Loading

0 comments on commit 2cdb571

Please sign in to comment.