Skip to content

Commit 24a615b

Browse files
authored
Fix issue: accumulative headroom can exceed limit in rare scenario (sonic-net#2020)
- 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.
1 parent 708e232 commit 24a615b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cfgmgr/buffer_check_headroom_mellanox.lua

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ end
2222
-- Initialize the accumulative size with 4096
2323
-- This is to absorb the possible deviation
2424
local accumulative_size = 4096
25+
-- Egress mirror size: 2 * maximum MTU (10k)
26+
local egress_mirror_size = 20*1024
2527

2628
local appl_db = "0"
2729
local state_db = "6"
@@ -56,8 +58,9 @@ local pipeline_latency = tonumber(redis.call('HGET', asic_keys[1], 'pipeline_lat
5658
if is_port_with_8lanes(lanes) then
5759
-- The pipeline latency should be adjusted accordingly for ports with 2 buffer units
5860
pipeline_latency = pipeline_latency * 2 - 1
61+
egress_mirror_size = egress_mirror_size * 2
5962
end
60-
accumulative_size = accumulative_size + 2 * pipeline_latency * 1024
63+
accumulative_size = accumulative_size + 2 * pipeline_latency * 1024 + egress_mirror_size
6164

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

0 commit comments

Comments
 (0)