Skip to content

Commit 28dfb29

Browse files
authored
Fix issue that dynamic/static threshold 0 can not be configured using mmuconfig (sonic-net#4049)
What I did Fix issue that dynamic/static threshold 0 can not be configured using mmuconfig
1 parent e276765 commit 28dfb29

3 files changed

Lines changed: 32 additions & 9 deletions

File tree

scripts/mmuconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ def main(show_config, profile, alpha, staticth, trim, namespace, verbose):
196196
mmu_cfg.list()
197197
# Buffershow cannot modify profiles
198198
elif config and profile:
199-
if alpha:
199+
if alpha is not None:
200200
mmu_cfg.set(profile, DYNAMIC_THRESHOLD, alpha)
201-
elif staticth:
201+
elif staticth is not None:
202202
mmu_cfg.set(profile, STATIC_THRESHOLD, staticth)
203203
elif trim:
204204
mmu_cfg.set(profile, PACKET_TRIMMING, trim)

tests/mmuconfig_input/mmuconfig_test_vectors.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,30 @@
269269
'cmp_args': [',ingress_lossless_profile_hbm,static_th,12121213'],
270270
'rc_msg': ''
271271
},
272-
'mmu_cfg_alpha' : {'cmd' : ['config'],
273-
'args' : ['-p', 'alpha_profile', '-a', '2'],
274-
'rc' : 0,
275-
'db_table' : 'BUFFER_PROFILE',
276-
'cmp_args': [',alpha_profile,dynamic_th,2'],
277-
'rc_msg' : ''
278-
},
272+
'mmu_cfg_static_th_zero': {
273+
'cmd': ['config'],
274+
'args': ['-p', 'ingress_lossless_profile_hbm', '-s', '0'],
275+
'rc': 0,
276+
'db_table': 'BUFFER_PROFILE',
277+
'cmp_args': [',ingress_lossless_profile_hbm,static_th,0'],
278+
'rc_msg': ''
279+
},
280+
'mmu_cfg_alpha': {
281+
'cmd': ['config'],
282+
'args': ['-p', 'alpha_profile', '-a', '2'],
283+
'rc': 0,
284+
'db_table': 'BUFFER_PROFILE',
285+
'cmp_args': [',alpha_profile,dynamic_th,2'],
286+
'rc_msg': ''
287+
},
288+
'mmu_cfg_alpha_zero': {
289+
'cmd': ['config'],
290+
'args': ['-p', 'alpha_profile', '-a', '0'],
291+
'rc': 0,
292+
'db_table': 'BUFFER_PROFILE',
293+
'cmp_args': [',alpha_profile,dynamic_th,0'],
294+
'rc_msg': ''
295+
},
279296
'mmu_cfg_alpha_invalid': {'cmd': ['config'],
280297
'args': ['-p', 'alpha_profile', '-a', '12'],
281298
'rc': 2,

tests/mmuconfig_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ def test_mmu_alpha_invalid_config(self):
8787
def test_mmu_staticth_config(self):
8888
self.executor(testData['mmu_cfg_static_th'])
8989

90+
def test_mmu_alpha_zero_config(self):
91+
self.executor(testData['mmu_cfg_alpha_zero'])
92+
93+
def test_mmu_staticth_zero_config(self):
94+
self.executor(testData['mmu_cfg_static_th_zero'])
95+
9096
def test_mmu_trim_config(self):
9197
self.executor(testData['mmu_cfg_trim'])
9298

0 commit comments

Comments
 (0)