-
Notifications
You must be signed in to change notification settings - Fork 1k
[QoS] Support generating QoS test parameters according to configuration on Mellanox platform #1886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
liat-grozovik
merged 10 commits into
sonic-net:master
from
stephenxs:generate-qos-param-from-config
Aug 6, 2020
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3804b93
[QoS] Support generating QoS test parameters according to configurati…
7c48158
Fix review comments
2e5d6c0
default_packet_size => packet_size
f2d6184
Fix LGTM issues
9c39ca8
Adjust parameters for spc3
8e4c852
Fix lower bound in PGHeadroomWatermarkTest
42133a4
Update sai_qos_tests.py
stephenxs 25dfd09
[qos] Remove cell_occupancy * 2 * cell_size from the upper bound limi…
f8d6947
[qos] Tolerance the case that packet_size isn't provided in testQosSa…
24b69d2
[qos] Fix debug output
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
neethajohn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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)) | ||
neethajohn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| 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 | ||
neethajohn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.