Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 150 additions & 0 deletions tests/qos/files/mellanox/qos_param_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import math

class QosParamMellanox(object):
def __init__(self, qos_params, asic_type, speed_cable_len, ingressLosslessProfile, ingressLossyProfile, egressLosslessProfile, egressLossyProfile):
asic_param_dic = {
'spc1': {
'cell_size': 96,
'headroom_overhead': 95
},
'spc2': {
'cell_size': 144,
'headroom_overhead': 64
},
'spc3': {
'cell_size': 144,
'headroom_overhead': 64
}
}

self.asic_type = asic_type
self.cell_size = asic_param_dic[asic_type]['cell_size']
self.headroom_overhead = asic_param_dic[asic_type]['headroom_overhead']
if speed_cable_len[0:6] == '400000':
self.headroom_overhead += 59
self.speed_cable_len = speed_cable_len
self.lossless_profile = "pg_lossless_{}_profile".format(speed_cable_len)
self.pools_info = {}
self.qos_parameters = {}
self.qos_params_mlnx = qos_params
self.qos_params_mlnx[self.speed_cable_len] = self.qos_params_mlnx['profile']
self.ingressLosslessProfile = ingressLosslessProfile
self.ingressLossyProfile = ingressLossyProfile
self.egressLosslessProfile = egressLosslessProfile
self.egressLossyProfile = egressLossyProfile

return

def run(self):
"""
Main method of the class
Returns the dictionary containing all the parameters required for the qos test
"""
self.collect_qos_configurations()
self.calculate_parameters()
return self.qos_params_mlnx

def collect_qos_configurations(self):
"""
Collect qos configuration from the following fixtures
ingressLosslessProfile
egressLossyProfile
"""
xon = int(math.ceil(float(self.ingressLosslessProfile['xon']) / self.cell_size))
xoff = int(math.ceil(float(self.ingressLosslessProfile['xoff']) / self.cell_size))
size = int(math.ceil(float(self.ingressLosslessProfile['size']) / self.cell_size))
headroom = size
hysteresis = headroom - (xon + xoff)
ingress_lossless_size = int(math.ceil(float(self.ingressLosslessProfile['static_th']) / self.cell_size)) - headroom
egress_lossy_size = int(math.ceil(float(self.egressLossyProfile['static_th']) / self.cell_size))

pkts_num_trig_pfc = ingress_lossless_size + xon + hysteresis
pkts_num_trig_ingr_drp = ingress_lossless_size + headroom - self.headroom_overhead
pkts_num_dismiss_pfc = ingress_lossless_size + 1
pkts_num_trig_egr_drp = egress_lossy_size + 1

self.qos_parameters['pkts_num_trig_pfc'] = pkts_num_trig_pfc
self.qos_parameters['pkts_num_trig_ingr_drp'] = pkts_num_trig_ingr_drp
self.qos_parameters['pkts_num_dismiss_pfc'] = pkts_num_dismiss_pfc
self.qos_parameters['pkts_num_trig_egr_drp'] = pkts_num_trig_egr_drp
self.qos_parameters['pkts_num_hysteresis'] = hysteresis

def calculate_parameters(self):
"""
Generate qos test parameters based on the configuration
xon
xoff
wm_pg_headroom
wm_pg_shared_lossless
wm_q_shared_lossless
lossy_queue_1
wm_pg_shared_lossy
wm_q_shared_lossy
wm_buf_pool_lossless
wm_buf_pool_lossy
"""
pkts_num_trig_pfc = self.qos_parameters['pkts_num_trig_pfc']
pkts_num_trig_ingr_drp = self.qos_parameters['pkts_num_trig_ingr_drp']
pkts_num_dismiss_pfc = self.qos_parameters['pkts_num_dismiss_pfc']
pkts_num_trig_egr_drp = self.qos_parameters['pkts_num_trig_egr_drp']
pkts_num_hysteresis = self.qos_parameters['pkts_num_hysteresis']

xoff = {}
xoff['pkts_num_trig_pfc'] = pkts_num_trig_pfc
xoff['pkts_num_trig_ingr_drp'] = pkts_num_trig_ingr_drp
# One motivation of margin is to tolerance the deviation.
# We need a larger margin on SPC2/3
if self.asic_type != 'spc1':
xoff['pkts_num_margin'] = 3
self.qos_params_mlnx[self.speed_cable_len]['xoff_1'].update(xoff)
self.qos_params_mlnx[self.speed_cable_len]['xoff_2'].update(xoff)

xon = {}
xon['pkts_num_trig_pfc'] = pkts_num_trig_pfc
xon['pkts_num_dismiss_pfc'] = pkts_num_dismiss_pfc
xon['pkts_num_hysteresis'] = pkts_num_hysteresis
if self.asic_type == 'spc2':
xon['pkts_num_margin'] = 2
elif self.asic_type == 'spc3':
xon['pkts_num_margin'] = 0
self.qos_params_mlnx['xon_1'].update(xon)
self.qos_params_mlnx['xon_2'].update(xon)

wm_pg_headroom = self.qos_params_mlnx[self.speed_cable_len]['wm_pg_headroom']
wm_pg_headroom['pkts_num_trig_pfc'] = pkts_num_trig_pfc
wm_pg_headroom['pkts_num_trig_ingr_drp'] = pkts_num_trig_ingr_drp
wm_pg_headroom['cell_size'] = self.cell_size
if self.asic_type == 'spc1':
wm_pg_headroom['pkts_num_margin'] = 1
else:
wm_pg_headroom['pkts_num_margin'] = 2

wm_pg_shared_lossless = self.qos_params_mlnx['wm_pg_shared_lossless']
wm_pg_shared_lossless['pkts_num_trig_pfc'] = pkts_num_dismiss_pfc
wm_pg_shared_lossless['cell_size'] = self.cell_size

wm_q_shared_lossless = self.qos_params_mlnx[self.speed_cable_len]['wm_q_shared_lossless']
wm_q_shared_lossless['pkts_num_trig_ingr_drp'] = pkts_num_trig_ingr_drp
wm_q_shared_lossless['cell_size'] = self.cell_size

lossy_queue = self.qos_params_mlnx['lossy_queue_1']
lossy_queue['pkts_num_trig_egr_drp'] = pkts_num_trig_egr_drp - 1
lossy_queue['cell_size'] = self.cell_size

wm_shared_lossy = {}
wm_shared_lossy['pkts_num_trig_egr_drp'] = pkts_num_trig_egr_drp
wm_shared_lossy['cell_size'] = self.cell_size
self.qos_params_mlnx['wm_pg_shared_lossy'].update(wm_shared_lossy)
self.qos_params_mlnx['wm_q_shared_lossy'].update(wm_shared_lossy)

wm_buf_pool_lossless = self.qos_params_mlnx['wm_buf_pool_lossless']
wm_buf_pool_lossless['pkts_num_trig_pfc'] = pkts_num_trig_pfc
wm_buf_pool_lossless['pkts_num_trig_ingr_drp'] = pkts_num_trig_ingr_drp
wm_buf_pool_lossless['cell_size'] = self.cell_size

wm_buf_pool_lossy = self.qos_params_mlnx['wm_buf_pool_lossy']
wm_buf_pool_lossy['pkts_num_trig_egr_drp'] = pkts_num_trig_egr_drp
wm_buf_pool_lossy['cell_size'] = self.cell_size

for i in range(4):
self.qos_params_mlnx['ecn_{}'.format(i+1)]['cell_size'] = self.cell_size
118 changes: 54 additions & 64 deletions tests/qos/files/qos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,140 +17,130 @@
# xoff_1 for 50G
# xoff_2 for 100G
qos_params:
spc1:
40000_5m:
mellanox:
profile:
pkts_num_leak_out: 0
xoff_1:
dscp: 3
ecn: 1
pg: 3
pkts_num_trig_pfc: 22038
pkts_num_trig_ingr_drp: 22115
xoff_2:
dscp: 4
ecn: 1
pg: 4
pkts_num_trig_pfc: 22038
pkts_num_trig_ingr_drp: 22115
wm_pg_headroom:
dscp: 3
ecn: 1
pg: 3
pkts_num_trig_pfc: 22038
pkts_num_trig_ingr_drp: 22115
cell_size: 96
packet_size: 300
pkts_num_leak_out: 0
wm_q_shared_lossless:
dscp: 3
ecn: 1
queue: 3
pkts_num_leak_out: 0
pkts_num_fill_min: 0
pkts_num_trig_ingr_drp: 22115
cell_size: 96
40000_40m:
pkts_num_leak_out: 0
xoff_1:
dscp: 3
ecn: 1
pg: 3
pkts_num_trig_pfc: 22038
pkts_num_trig_ingr_drp: 22190
xoff_2:
dscp: 4
ecn: 1
pg: 4
pkts_num_trig_pfc: 22038
pkts_num_trig_ingr_drp: 22190
wm_pg_headroom:
dscp: 3
ecn: 1
pg: 3
pkts_num_trig_pfc: 22038
pkts_num_trig_ingr_drp: 22190
cell_size: 96
packet_size: 300
wm_q_shared_lossless:
dscp: 3
ecn: 1
queue: 3
pkts_num_fill_min: 0
pkts_num_trig_ingr_drp: 22190
cell_size: 96
xon_1:
dscp: 3
ecn: 1
pg: 3
pkts_num_trig_pfc: 22038
pkts_num_dismiss_pfc: 21847
pkts_num_leak_out: 0
xon_2:
dscp: 4
ecn: 1
pg: 4
pkts_num_trig_pfc: 22038
pkts_num_dismiss_pfc: 21847
pkts_num_leak_out: 0
ecn_1:
dscp: 8
ecn: 0
num_of_pkts: 5000
limit: 182000
min_limit: 180000
cell_size: 96
ecn_2:
dscp: 8
ecn: 1
num_of_pkts: 2047
limit: 182320
min_limit: 0
cell_size: 96
ecn_3:
dscp: 0
ecn: 0
num_of_pkts: 5000
limit: 182000
min_limit: 180000
cell_size: 96
ecn_4:
dscp: 0
ecn: 1
num_of_pkts: 2047
limit: 182320
min_limit: 0
cell_size: 96
lossy_queue_1:
dscp: 8
ecn: 1
pg: 0
pkts_num_trig_egr_drp: 67965
pkts_num_leak_out: 0
packet_size: 300
pkts_num_margin: 4
wrr:
ecn: 1
q0_num_of_pkts: 140
q1_num_of_pkts: 140
q2_num_of_pkts: 140
q3_num_of_pkts: 150
q4_num_of_pkts: 150
q5_num_of_pkts: 140
q6_num_of_pkts: 140
limit: 80
pkts_num_leak_out: 0
wm_pg_shared_lossless:
dscp: 3
ecn: 1
pg: 3
pkts_num_fill_min: 6
pkts_num_trig_pfc: 22038
cell_size: 96
pkts_num_leak_out: 0
pkts_num_fill_min: 0
packet_size: 300
wm_pg_shared_lossy:
dscp: 1
dscp: 8
ecn: 1
pg: 0
pkts_num_leak_out: 0
pkts_num_fill_min: 0
pkts_num_trig_egr_drp: 67965
cell_size: 96
packet_size: 300
wm_q_shared_lossy:
dscp: 1
dscp: 8
ecn: 1
queue: 1
queue: 0
pkts_num_leak_out: 0
pkts_num_fill_min: 0
pkts_num_trig_egr_drp: 67965
cell_size: 96
wrr:
packet_size: 300
wm_buf_pool_lossless:
dscp: 3
ecn: 1
q0_num_of_pkts: 600
q1_num_of_pkts: 400
q3_num_of_pkts: 500
q4_num_of_pkts: 500
pg: 3
queue: 3
pkts_num_leak_out: 0
pkts_num_fill_ingr_min: 0
pkts_num_fill_egr_min: 0
wm_buf_pool_lossy:
dscp: 8
ecn: 1
pg: 0
queue: 0
pkts_num_leak_out: 0
pkts_num_fill_ingr_min: 0
pkts_num_fill_egr_min: 0
wrr_chg:
ecn: 1
q0_num_of_pkts: 80
q1_num_of_pkts: 80
q2_num_of_pkts: 80
q3_num_of_pkts: 300
q4_num_of_pkts: 300
q5_num_of_pkts: 80
q6_num_of_pkts: 80
limit: 80
pkts_num_leak_out: 48
lossy_weight: 8
td2:
40000_5m:
pkts_num_leak_out: 48
Expand Down
Loading