Skip to content

Commit 98198d0

Browse files
authored
[Mellanox] Update buffer calculation for platform SN6600 (#3948)
- What I did Starting from SN6600, Mellanox/Nvidia switches need update buffer calculation. Update buffer calculation for SN6600 and later platforms. - Why I did it Need update new calculation for SN6600 and later platforms. - How I verified it Verify in SN6600 to see if buffer calculation is updated. Other platform, buffer calculation is same as before. --------- Signed-off-by: Jianyue Wu <[email protected]>
1 parent 0e1558e commit 98198d0

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

cfgmgr/buffer_pool_mellanox.lua

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ local total_port = 0
2222

2323
local mgmt_pool_size = 256 * 1024
2424
local egress_mirror_headroom = 10 * 1024
25+
local modification_descriptors_pool_size = 0
2526

2627
-- The set of ports with 8 lanes
2728
local port_set_8lanes = {}
@@ -186,6 +187,22 @@ end
186187
-- Connect to CONFIG_DB
187188
redis.call('SELECT', config_db)
188189

190+
-- Check if platform is SPC6 or later and set modification descriptors pool size
191+
-- Extract model number from platform string (e.g., "sn6600" -> 6600, "sn5800" -> 5800, "sn10600" -> 10600)
192+
-- Use (%d+) pattern to capture one or more digits for extensibility (handles future multi-digit series like sn10xxx, sn11xxx)
193+
local platform = redis.call('HGET', 'DEVICE_METADATA|localhost', 'platform')
194+
if platform then
195+
local model_str = string.match(platform, "sn(%d+)")
196+
if model_str then
197+
local model_number = tonumber(model_str)
198+
-- SPC6 or later models (>= 6000 excludes SPC5 models like 5400/5800, includes SPC6+ like 6600/7xxx/10xxx)
199+
-- Reserve 32MB for modification descriptors pool
200+
if model_number and model_number >= 6000 then
201+
modification_descriptors_pool_size = 32 * 1024 * 1024
202+
end
203+
end
204+
end
205+
189206
-- Parse all the pools and seperate them according to the direction
190207
local ipools = {}
191208
local epools = {}
@@ -384,7 +401,7 @@ accumulative_occupied_buffer = accumulative_occupied_buffer + accumulative_manag
384401

385402
-- Accumulate sizes for egress mirror and management pool
386403
local accumulative_egress_mirror_overhead = admin_up_port * egress_mirror_headroom
387-
accumulative_occupied_buffer = accumulative_occupied_buffer + accumulative_egress_mirror_overhead + mgmt_pool_size
404+
accumulative_occupied_buffer = accumulative_occupied_buffer + accumulative_egress_mirror_overhead + mgmt_pool_size + modification_descriptors_pool_size
388405

389406
-- Switch to CONFIG_DB
390407
redis.call('SELECT', config_db)
@@ -475,5 +492,6 @@ table.insert(result, "debug:shp_enabled:" .. tostring(shp_enabled))
475492
table.insert(result, "debug:shp_size:" .. shp_size)
476493
table.insert(result, "debug:total port:" .. total_port .. " ports with 8 lanes:" .. port_count_8lanes)
477494
table.insert(result, "debug:admin up port:" .. admin_up_port .. " admin up ports with 8 lanes:" .. admin_up_8lanes_port)
495+
table.insert(result, "debug:modification_descriptors_pool_size:" .. modification_descriptors_pool_size)
478496

479497
return result

0 commit comments

Comments
 (0)