Skip to content

Commit

Permalink
Take management pool and headroom occupied by egress mirror into acco…
Browse files Browse the repository at this point in the history
…unt when calculating buffer pool size for Mellanox

Signed-off-by: Stephen Sun <stephens@nvidia.com>
  • Loading branch information
Stephen Sun authored and stephenxs committed Aug 26, 2020
1 parent b549048 commit 1f33d6d
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions cfgmgr/buffer_pool_mellanox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ local appl_db = "0"
local config_db = "4"
local state_db = "6"

local lossypg_reserved = 18 * 1024
local lossypg_reserved = 19 * 1024
local lossypg_reserved_400g = 37 * 1024
local lossypg_400g = 0

local result = {}
local profiles = {}

local count_up_port = 0
local num_ports = 0
local debug = tonumber(ARGV[1])

local mgmt_pool_size = 256 * 1024
local egress_mirror_headroom = 10 * 1024

local function find_profile(ref)
-- Remove the surrounding square bracket and the find in the list
Expand Down Expand Up @@ -57,6 +60,10 @@ local function iterate_all_items(all_items)
size = 1 + tonumber(string.sub(range, -1)) - tonumber(string.sub(range, 1, 1))
end
profiles[index][2] = profiles[index][2] + size
local speed = redis.call('HGET', 'PORT_TABLE:'..port, 'speed')
if speed == '400000' and profile == '[BUFFER_PROFILE:ingress_lossy_profile]' then
lossypg_400g = lossypg_400g + size
end
end
end
end
Expand All @@ -66,7 +73,6 @@ end
redis.call('SELECT', config_db)

local ports_table = redis.call('KEYS', 'PORT|*')
local num_ports = #ports_table

for i = 1, #ports_table do
local status = redis.call('HGET', ports_table[i], 'admin_status')
Expand Down Expand Up @@ -115,6 +121,14 @@ for i = 1, #profiles, 1 do
end
end

-- Extra lossy xon buffer for 400G port
local lossypg_extra_for_400g = (lossypg_reserved_400g - lossypg_reserved) * lossypg_400g
accumulative_occupied_buffer = accumulative_occupied_buffer + lossypg_extra_for_400g

-- Accumulate sizes for egress mirror and management pool
local accumulative_egress_mirror_overhead = count_up_port * egress_mirror_headroom
accumulative_occupied_buffer = accumulative_occupied_buffer + accumulative_egress_mirror_overhead + mgmt_pool_size

-- Fetch mmu_size
redis.call('SELECT', state_db)
local mmu_size = tonumber(redis.call('HGET', 'BUFFER_MAX_PARAM|global', 'mmu_size'))
Expand All @@ -131,9 +145,6 @@ local ceiling_mmu_size = number_of_cells * cell_size
-- Switch to CONFIG_DB
redis.call('SELECT', config_db)

local ports_table = redis.call('KEYS', 'PORT|*')
local num_ports = #ports_table

-- Fetch all the pools that need update
local pools_need_update = {}
local ipools = redis.call('KEYS', 'BUFFER_POOL|ingress*')
Expand Down Expand Up @@ -175,5 +186,8 @@ table.insert(result, "debug:accumulative:" .. accumulative_occupied_buffer)
for i = 1, #statistics do
table.insert(result, "debug:" .. statistics[i][1] .. ":" .. statistics[i][2] .. ":" .. statistics[i][3])
end
table.insert(result, "debug:extra_400g:" .. (lossypg_reserved_400g - lossypg_reserved) .. ":" .. lossypg_400g)
table.insert(result, "debug:mgmt_pool:" .. mgmt_pool_size)
table.insert(result, "debug:egress_mirror:" .. accumulative_egress_mirror_overhead)

return result

0 comments on commit 1f33d6d

Please sign in to comment.