Skip to content

Commit b10486f

Browse files
committed
[Mellanox] Update qos sai test for SN56xx buffer configuration alignment
<!-- Please make sure you've read and understood our contributing guidelines; https://github.com/sonic-net/SONiC/blob/gh-pages/CONTRIBUTING.md Please provide following information to help code review process a bit easier: --> ### Description of PR <!-- - Please include a summary of the change and which issue is fixed. - Please also include relevant motivation and context. Where should reviewer start? background context? - List any dependencies that are required for this change. --> Update QoS sai test accoding to the PR: sonic-net/sonic-buildimage#22067 Summary: Fixes # (issue) ### Type of change <!-- - Fill x for your type of change. - e.g. - [x] Bug fix --> - [x] Bug fix - [ ] Testbed and Framework(new/improvement) - [ ] New Test case - [ ] Skipped for non-supported platforms - [ ] Test case improvement ### Back port request - [ ] 202012 - [ ] 202205 - [ ] 202305 - [ ] 202311 - [ ] 202405 - [ ] 202411 ### Approach #### What is the motivation for this PR? Update qos for SN56xx buffer configuration alignment #### How did you do it? Update qos sai test #### How did you verify/test it? Run Qos sai tests on SN56xx platform #### Any platform specific information? SN56xx #### Supported testbed topology if it's a new test case? ### Documentation <!-- (If it's a new feature, new test case) Did you update documentation/Wiki relevant to your implementation? Link to the wiki page? -->
1 parent 2f184e9 commit b10486f

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

tests/qos/qos_sai_base.py

+16-6
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ def __compute_buffer_threshold_for_nvidia_device(self, dut_asic, table, port, pg
236236
port_dynamic_th = dut_asic.run_redis_cmd(
237237
argv=["redis-cli", "-n", db, "HGET", f'BUFFER_PROFILE_TABLE:{port_profile}', "dynamic_th"]
238238
)[0]
239+
port_profile_reserved_size = dut_asic.run_redis_cmd(
240+
argv=["redis-cli", "-n", db, "HGET", f'BUFFER_PROFILE_TABLE:{port_profile}', "size"]
241+
)[0]
239242
break
240243
if port_dynamic_th:
241244

@@ -255,17 +258,24 @@ def calculate_alpha(dynamic_th):
255258
)[0]
256259
)
257260

258-
buffer_scale = port_alpha * pg_q_alpha / (port_alpha * pg_q_alpha + pg_q_alpha + 1)
261+
pg_q_reserved_size = int(port_profile_reserved_size) * pg_q_alpha / (1 + pg_q_alpha)
262+
reserved_size = pg_q_reserved_size if pg_q_reserved_size > int(pg_q_buffer_profile["size"]) \
263+
else int(pg_q_buffer_profile["size"])
264+
265+
if pg_q_buffer_profile['dynamic_th'] == "7" and port_dynamic_th != "7":
266+
buffer_scale = port_alpha / (1 + port_alpha)
267+
else:
268+
buffer_scale = port_alpha * pg_q_alpha / (port_alpha * pg_q_alpha + pg_q_alpha + 1)
259269

260270
pg_q_max_occupancy = int(buffer_size * buffer_scale)
261271

262272
pg_q_buffer_profile.update(
263-
{"static_th": int(
264-
pg_q_buffer_profile["size"]) + int(pg_q_max_occupancy)}
273+
{"static_th": int(pg_q_max_occupancy) + int(reserved_size)}
265274
)
266275
pg_q_buffer_profile["pg_q_alpha"] = pg_q_alpha
267276
pg_q_buffer_profile["port_alpha"] = port_alpha
268277
pg_q_buffer_profile["pool_size"] = buffer_size
278+
logger.info(f'pg_q_buffer_profile:{pg_q_buffer_profile}')
269279
else:
270280
raise Exception("Not found port dynamic th")
271281

@@ -2128,8 +2138,8 @@ def egressLossyProfile(
21282138
logger.info(f"{srcport} has only lossy queue")
21292139
if is_lossy_queue_only:
21302140
is_lossy_queue_only = True
2131-
queue_table_postfix_list = ['1-3', '4', '5']
2132-
queue_to_dscp_map = {'1-3': '1', '4': '11', '5': '31'}
2141+
queue_table_postfix_list = ['0-3', '4', '5']
2142+
queue_to_dscp_map = {'0-3': '1', '4': '11', '5': '31'}
21332143
queues = random.choice(queue_table_postfix_list)
21342144
else:
21352145
queues = "0-2"
@@ -2145,7 +2155,7 @@ def egressLossyProfile(
21452155
)
21462156
if is_lossy_queue_only:
21472157
egress_lossy_profile['lossy_dscp'] = queue_to_dscp_map[queues]
2148-
egress_lossy_profile['lossy_queue'] = '1' if queues == '1-3' else queues
2158+
egress_lossy_profile['lossy_queue'] = '1' if queues == '0-3' else queues
21492159
logger.info(f"queues:{queues}, egressLossyProfile: {egress_lossy_profile}")
21502160

21512161
yield egress_lossy_profile

0 commit comments

Comments
 (0)