Skip to content

Commit 1da879c

Browse files
authored
[db_migrator][Mellanox] Update Mellanox buffer migrator with 2km-cable supported (sonic-net#1564)
What I did Update mellanox buffer migrator with 2km-cable supported Signed-off-by: Stephen Sun [email protected] How I did it - Introduce database version 1.0.6 which is based on 201911. This version represents the buffer configuration with 2kb-cable supported. - As 1.0.6 is the latest version in 201911, change the "from" version of warm-reboot to 1.0.6. All mock APPL_DB files are renamed (from xxx_version_1_0_5.json to xxx_version_1_0_6.json) correspondingly. - Add mock files for CONFIG_DB for version 1.0.6. How to verify it Run manually test and unit test.
1 parent c2b760f commit 1da879c

File tree

75 files changed

+44735
-266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+44735
-266
lines changed

scripts/db_migrator.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,23 @@ def version_1_0_5(self):
452452
Version 1_0_5.
453453
"""
454454
log.log_info('Handling version_1_0_5')
455+
456+
# Check ASIC type, if Mellanox platform then need DB migration
457+
if self.asic_type == "mellanox":
458+
if self.mellanox_buffer_migrator.mlnx_migrate_buffer_pool_size('version_1_0_5', 'version_1_0_6') \
459+
and self.mellanox_buffer_migrator.mlnx_migrate_buffer_profile('version_1_0_5', 'version_1_0_6') \
460+
and self.mellanox_buffer_migrator.mlnx_flush_new_buffer_configuration():
461+
self.set_version('version_1_0_6')
462+
else:
463+
self.set_version('version_1_0_6')
464+
465+
return 'version_1_0_6'
466+
467+
def version_1_0_6(self):
468+
"""
469+
Version 1_0_6.
470+
"""
471+
log.log_info('Handling version_1_0_6')
455472
if self.asic_type == "mellanox":
456473
speed_list = self.mellanox_buffer_migrator.default_speed_list
457474
cable_len_list = self.mellanox_buffer_migrator.default_cable_len_list
@@ -461,8 +478,8 @@ def version_1_0_5(self):
461478
abandon_method = self.mellanox_buffer_migrator.mlnx_abandon_pending_buffer_configuration
462479
append_method = self.mellanox_buffer_migrator.mlnx_append_item_on_pending_configuration_list
463480

464-
if self.mellanox_buffer_migrator.mlnx_migrate_buffer_pool_size('version_1_0_5', 'version_2_0_0') \
465-
and self.mellanox_buffer_migrator.mlnx_migrate_buffer_profile('version_1_0_5', 'version_2_0_0') \
481+
if self.mellanox_buffer_migrator.mlnx_migrate_buffer_pool_size('version_1_0_6', 'version_2_0_0') \
482+
and self.mellanox_buffer_migrator.mlnx_migrate_buffer_profile('version_1_0_6', 'version_2_0_0') \
466483
and (not self.mellanox_buffer_migrator.mlnx_is_buffer_model_dynamic() or \
467484
self.migrate_config_db_buffer_tables_for_dynamic_calculation(speed_list, cable_len_list, '0', abandon_method, append_method)) \
468485
and self.mellanox_buffer_migrator.mlnx_flush_new_buffer_configuration() \

scripts/mellanox_buffer_migrator.py

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Current version: 2.0.0 for shared headroom pool and dynamic buffer calculation support.
77
Historical version:
88
- 201911:
9+
- 1.0.6 for 2km cable support
910
- 1.0.5 for shared headroom pool support
1011
- 1.0.4 for optimized headroom calculation:
1112
- For Microsoft SKUs, calculate headroom with small packet percentage as 50%
@@ -119,7 +120,7 @@ def __init__(self, configDB):
119120
# This is the buffer configuration from the very beginning
120121
# Buffer pool configuration info
121122
"buffer_pool_list" : ['ingress_lossless_pool', 'egress_lossless_pool', 'ingress_lossy_pool', 'egress_lossy_pool'],
122-
# default buffer pools
123+
# Default buffer pools
123124
"buffer_pools": {
124125
"spc1_t0_pool": {"ingress_lossless_pool": { "size": "4194304", "type": "ingress", "mode": "dynamic" },
125126
"ingress_lossy_pool": { "size": "7340032", "type": "ingress", "mode": "dynamic" },
@@ -209,7 +210,7 @@ def __init__(self, configDB):
209210
}
210211
},
211212
"version_1_0_4": {
212-
# version 1.0.4 is introduced for updating the buffer settings
213+
# Version 1.0.4 is introduced for updating the buffer settings
213214
# Buffer pool info for normal mode
214215
"buffer_pool_list" : ['ingress_lossless_pool', 'ingress_lossy_pool', 'egress_lossless_pool', 'egress_lossy_pool'],
215216
"buffer_pools": {
@@ -247,7 +248,7 @@ def __init__(self, configDB):
247248
"pg_lossless_40000_300m_profile": {"size": "78848", "xon":"19456"},
248249
"pg_lossless_50000_300m_profile": {"size": "86016", "xon":"19456"},
249250
"pg_lossless_100000_300m_profile": {"size": "123904", "xon":"19456"}},
250-
# lossless headroom info for MSFT SKUs.
251+
# Lossless headroom info for MSFT SKUs.
251252
"msft": {"pg_lossless_10000_5m_profile": {"size": "41984", "xon":"19456"},
252253
"pg_lossless_25000_5m_profile": {"size": "41984", "xon":"19456"},
253254
"pg_lossless_40000_5m_profile": {"size": "41984", "xon":"19456"},
@@ -324,15 +325,15 @@ def __init__(self, configDB):
324325
}
325326
},
326327
"version_1_0_5": {
327-
# version 1.0.5 is introduced for shared headroom pools
328+
# Version 1.0.5 is introduced for shared headroom pools
328329
"pool_convert_map": {
329330
"spc1_t0_pool_sku_map": {"Mellanox-SN2700-C28D8": "spc1_2700-d48c8_t0_pool_shp",
330331
"Mellanox-SN2700-D48C8": "spc1_2700-d48c8_t0_pool_shp",
331-
"Mellanox-SN2700-D40C8S8": "spc1_2700-d48c8_t0_pool_shp",
332+
"Mellanox-SN2700-D40C8S8": "spc1_2700-d48c8_t0_single_pool_shp",
332333
"Mellanox-SN2700": "spc1_2700_t0_pool_shp"},
333334
"spc1_t1_pool_sku_map": {"Mellanox-SN2700-C28D8": "spc1_2700-d48c8_t1_pool_shp",
334335
"Mellanox-SN2700-D48C8": "spc1_2700-d48c8_t1_pool_shp",
335-
"Mellanox-SN2700-D40C8S8": "spc1_2700-d48c8_t1_pool_shp",
336+
"Mellanox-SN2700-D40C8S8": "spc1_2700-d48c8_t1_single_pool_shp",
336337
"Mellanox-SN2700": "spc1_2700_t1_pool_shp"}
337338
},
338339
"pool_mapped_from_old_version": {
@@ -441,8 +442,43 @@ def __init__(self, configDB):
441442
}
442443
}
443444
},
445+
"version_1_0_6": {
446+
# Version 1.0.6 is introduced for 2km cable support
447+
#
448+
# pool_mapped_from_old_version is not required because no pool flavor mapping changed
449+
450+
# Buffer pool info for normal mode
451+
"buffer_pool_list" : ['ingress_lossless_pool', 'ingress_lossy_pool', 'egress_lossless_pool', 'egress_lossy_pool'],
452+
453+
"buffer_pools": {
454+
"spc1_2700_t1_pool_shp": {"doublepool": { "size": "4439552", "xoff": "2146304" }, "egress_lossless_pool": { "size": "13945824"}},
455+
456+
# Buffer pool for single pool
457+
"spc1_2700_t1_single_pool_shp": {"singlepool": { "size": "8719360", "xoff": "2146304" }, "egress_lossless_pool": { "size": "13945824"}},
458+
459+
# The following pools are used for upgrading from 1.0.5 to the newer version
460+
"spc2_3800-c64_t1_pool_shp": {"singlepool": {"size": "24219648", "xoff": "4169728"}, "egress_lossless_pool": {"size": "34287552"}}
461+
},
462+
"buffer_pools_inherited": {
463+
"version_1_0_4": ["spc1_t0_pool", "spc1_t1_pool", "spc2_t0_pool", "spc2_t1_pool", "spc3_t0_pool", "spc3_t1_pool"],
464+
"version_1_0_5": [# Generic SKUs for 3800
465+
"spc2_3800_t0_pool",
466+
"spc2_3800_t1_pool",
467+
# Non generic SKUs
468+
"spc1_2700_t0_pool_shp",
469+
"spc1_2700_t0_single_pool_shp",
470+
"spc1_2700-d48c8_t0_pool_shp",
471+
"spc1_2700-d48c8_t0_single_pool_shp",
472+
"spc2_3800-c64_t0_pool_shp", "spc2_3800-d112c8_t0_pool_shp",
473+
"spc2_3800-d24c52_t0_pool_shp", "spc2_3800-d28c50_t0_pool_shp",
474+
"spc1_2700-d48c8_t1_pool_shp",
475+
"spc1_2700-d48c8_t1_single_pool_shp",
476+
"spc2_3800-d112c8_t1_pool_shp",
477+
"spc2_3800-d24c52_t1_pool_shp", "spc2_3800-d28c50_t1_pool_shp"],
478+
}
479+
},
444480
"version_2_0_0": {
445-
# version 2.0.0 is introduced for dynamic buffer calculation
481+
# Version 2.0.0 is introduced for dynamic buffer calculation
446482
#
447483
"pool_mapped_from_old_version": {
448484
"spc1_t0_pool": "spc1_pool",
@@ -463,13 +499,19 @@ def __init__(self, configDB):
463499
"spc3_pool": {"doublepool": {"size": "dynamic"}, "egress_lossless_pool": { "size": "60817392" }}
464500
},
465501
"buffer_pools_inherited": {
466-
"version_1_0_5": ["spc1_2700_t0_pool", "spc1_2700_t1_pool",
467-
"spc1_2700_t0_pool_shp", "spc1_2700_t1_pool_shp",
468-
"spc1_2700_t0_single_pool_shp", "spc1_2700_t1_single_pool_shp",
469-
"spc1_2700-d48c8_t0_pool_shp", "spc1_2700-d48c8_t1_pool_shp",
470-
"spc1_2700-d48c8_t0_single_pool_shp", "spc1_2700-d48c8_t1_single_pool_shp",
471-
"spc2_3800-c64_t0_pool_shp", "spc2_3800-c64_t1_pool_shp", "spc2_3800-d112c8_t0_pool_shp", "spc2_3800-d112c8_t1_pool_shp",
472-
"spc2_3800-d24c52_t0_pool_shp", "spc2_3800-d24c52_t1_pool_shp", "spc2_3800-d28c50_t0_pool_shp", "spc2_3800-d28c50_t1_pool_shp"]
502+
"version_1_0_5": ["spc1_2700_t0_pool_shp",
503+
"spc1_2700_t0_single_pool_shp",
504+
"spc1_2700-d48c8_t0_pool_shp",
505+
"spc1_2700-d48c8_t0_single_pool_shp",
506+
"spc2_3800-c64_t0_pool_shp", "spc2_3800-d112c8_t0_pool_shp",
507+
"spc2_3800-d24c52_t0_pool_shp", "spc2_3800-d28c50_t0_pool_shp",
508+
"spc1_2700-d48c8_t1_pool_shp",
509+
"spc1_2700-d48c8_t1_single_pool_shp",
510+
"spc2_3800-d112c8_t1_pool_shp",
511+
"spc2_3800-d24c52_t1_pool_shp", "spc2_3800-d28c50_t1_pool_shp"],
512+
"version_1_0_6": ["spc1_2700_t1_pool_shp",
513+
"spc1_2700_t1_single_pool_shp",
514+
"spc2_3800-c64_t1_pool_shp"]
473515
}
474516
}
475517
}

0 commit comments

Comments
 (0)