From 24a615bd0799eb6850a5a0cb60e10eed9bae8b70 Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Tue, 16 Nov 2021 14:14:58 +0800 Subject: [PATCH] Fix issue: accumulative headroom can exceed limit in rare scenario (#2020) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - What I did The egress mirror size is not taken into account when checking the accumulative headroom size, which causes the estimated accumulate headroom size to be greater than the real one and unable to be applied. - Why I did it Bug fix - How I verified it Run regression test. - Details if related An example to explain the logic . The current accumulative headroom is 90k, egress mirror headroom is 10k, the ASIC limitation of the port is 100k. Now a user wants to change the port configuration which will make the accumulative headroom to be increased by 10k. Now the accumulative headroom estimated by buffer manager is 100k, which doesn’t exceed the limitation. However in the ASIC the real accumulative headroom is 110k which does. --- cfgmgr/buffer_check_headroom_mellanox.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cfgmgr/buffer_check_headroom_mellanox.lua b/cfgmgr/buffer_check_headroom_mellanox.lua index 73d720668e..20b62d2938 100644 --- a/cfgmgr/buffer_check_headroom_mellanox.lua +++ b/cfgmgr/buffer_check_headroom_mellanox.lua @@ -22,6 +22,8 @@ end -- Initialize the accumulative size with 4096 -- This is to absorb the possible deviation local accumulative_size = 4096 +-- Egress mirror size: 2 * maximum MTU (10k) +local egress_mirror_size = 20*1024 local appl_db = "0" local state_db = "6" @@ -56,8 +58,9 @@ local pipeline_latency = tonumber(redis.call('HGET', asic_keys[1], 'pipeline_lat if is_port_with_8lanes(lanes) then -- The pipeline latency should be adjusted accordingly for ports with 2 buffer units pipeline_latency = pipeline_latency * 2 - 1 + egress_mirror_size = egress_mirror_size * 2 end -accumulative_size = accumulative_size + 2 * pipeline_latency * 1024 +accumulative_size = accumulative_size + 2 * pipeline_latency * 1024 + egress_mirror_size -- Fetch all keys in BUFFER_PG according to the port redis.call('SELECT', appl_db)