Skip to content

Commit fe6be5d

Browse files
authored
[202012] Configure different map between uplink and downlink on t1 switch in dual ToR scenario (#11299)
- Why I did it Configure different DSCP_TO_TC_MAP between uplink and downlink on T1 switch in dual ToR scenario On T1 uplink, both DSCP 2/6 will be mapped to TC 1 for the purpose of avoiding such traffic occupying lossless buffers. On T1 downlink, they will be mapped to TC 2/6 respectively. (unchanged) - How I did it For vendors who want to configure different DSCP_TO_TC_MAP between uplinks and downlinks on T1, they should Define generate_dscp_to_tc_map macro in SKU's qos.json.j2 file Define map AZURE for downlink and AZURE_UPLINK for uplink Define jinja2 variable different_dscp_to_tc_map as True Signed-off-by: Stephen Sun <[email protected]>
1 parent d766e70 commit fe6be5d

File tree

3 files changed

+146
-8
lines changed

3 files changed

+146
-8
lines changed

device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/qos.json.j2

+67
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{% if ('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'LeafRouter') %}
2+
{% set different_dscp_to_tc_map = true %}
23
{%- macro generate_dscp_to_tc_map() %}
34
"DSCP_TO_TC_MAP": {
45
"AZURE": {
@@ -66,6 +67,72 @@
6667
"61": "1",
6768
"62": "1",
6869
"63": "1"
70+
},
71+
"AZURE_UPLINK": {
72+
"0" : "1",
73+
"1" : "1",
74+
"2" : "1",
75+
"3" : "3",
76+
"4" : "4",
77+
"5" : "1",
78+
"6" : "1",
79+
"7" : "1",
80+
"8" : "0",
81+
"9" : "1",
82+
"10": "1",
83+
"11": "1",
84+
"12": "1",
85+
"13": "1",
86+
"14": "1",
87+
"15": "1",
88+
"16": "1",
89+
"17": "1",
90+
"18": "1",
91+
"19": "1",
92+
"20": "1",
93+
"21": "1",
94+
"22": "1",
95+
"23": "1",
96+
"24": "1",
97+
"25": "1",
98+
"26": "1",
99+
"27": "1",
100+
"28": "1",
101+
"29": "1",
102+
"30": "1",
103+
"31": "1",
104+
"32": "1",
105+
"33": "1",
106+
"34": "1",
107+
"35": "1",
108+
"36": "1",
109+
"37": "1",
110+
"38": "1",
111+
"39": "1",
112+
"40": "1",
113+
"41": "1",
114+
"42": "1",
115+
"43": "1",
116+
"44": "1",
117+
"45": "1",
118+
"46": "5",
119+
"47": "1",
120+
"48": "7",
121+
"49": "1",
122+
"50": "1",
123+
"51": "1",
124+
"52": "1",
125+
"53": "1",
126+
"54": "1",
127+
"55": "1",
128+
"56": "1",
129+
"57": "1",
130+
"58": "1",
131+
"59": "1",
132+
"60": "1",
133+
"61": "1",
134+
"62": "1",
135+
"63": "1"
69136
}
70137
},
71138
{%- endmacro %}

files/build_templates/qos_config.j2

+4
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,12 @@
233233
"{{ port }}": {
234234
{% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] in backend_device_types and 'storage_device' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['storage_device'] == 'true' %}
235235
"dot1p_to_tc_map" : "[DOT1P_TO_TC_MAP|AZURE]",
236+
{% else %}
237+
{% if different_dscp_to_tc_map and port not in port_names_list_extra_queues and tunnel_qos_remap_enable %}
238+
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE_UPLINK]",
236239
{% else %}
237240
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]",
241+
{% endif %}
238242
{% endif %}
239243
"tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]",
240244
"tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",

src/sonic-config-engine/tests/sample_output/py3/qos-mellanox4600c-c64.json

+75-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
{
23
"TC_TO_PRIORITY_GROUP_MAP": {
34
"AZURE": {
@@ -101,6 +102,72 @@
101102
"61": "1",
102103
"62": "1",
103104
"63": "1"
105+
},
106+
"AZURE_UPLINK": {
107+
"0" : "1",
108+
"1" : "1",
109+
"2" : "1",
110+
"3" : "3",
111+
"4" : "4",
112+
"5" : "1",
113+
"6" : "1",
114+
"7" : "1",
115+
"8" : "0",
116+
"9" : "1",
117+
"10": "1",
118+
"11": "1",
119+
"12": "1",
120+
"13": "1",
121+
"14": "1",
122+
"15": "1",
123+
"16": "1",
124+
"17": "1",
125+
"18": "1",
126+
"19": "1",
127+
"20": "1",
128+
"21": "1",
129+
"22": "1",
130+
"23": "1",
131+
"24": "1",
132+
"25": "1",
133+
"26": "1",
134+
"27": "1",
135+
"28": "1",
136+
"29": "1",
137+
"30": "1",
138+
"31": "1",
139+
"32": "1",
140+
"33": "1",
141+
"34": "1",
142+
"35": "1",
143+
"36": "1",
144+
"37": "1",
145+
"38": "1",
146+
"39": "1",
147+
"40": "1",
148+
"41": "1",
149+
"42": "1",
150+
"43": "1",
151+
"44": "1",
152+
"45": "1",
153+
"46": "5",
154+
"47": "1",
155+
"48": "7",
156+
"49": "1",
157+
"50": "1",
158+
"51": "1",
159+
"52": "1",
160+
"53": "1",
161+
"54": "1",
162+
"55": "1",
163+
"56": "1",
164+
"57": "1",
165+
"58": "1",
166+
"59": "1",
167+
"60": "1",
168+
"61": "1",
169+
"62": "1",
170+
"63": "1"
104171
}
105172
},
106173
"SCHEDULER": {
@@ -115,63 +182,63 @@
115182
},
116183
"PORT_QOS_MAP": {
117184
"Ethernet0": {
118-
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]",
185+
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE_UPLINK]",
119186
"tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]",
120187
"tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
121188
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
122189
"pfc_enable" : "3,4",
123190
"pfcwd_sw_enable" : "3,4"
124191
},
125192
"Ethernet4": {
126-
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]",
193+
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE_UPLINK]",
127194
"tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]",
128195
"tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
129196
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
130197
"pfc_enable" : "3,4",
131198
"pfcwd_sw_enable" : "3,4"
132199
},
133200
"Ethernet16": {
134-
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]",
201+
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE_UPLINK]",
135202
"tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]",
136203
"tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
137204
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
138205
"pfc_enable" : "3,4",
139206
"pfcwd_sw_enable" : "3,4"
140207
},
141208
"Ethernet20": {
142-
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]",
209+
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE_UPLINK]",
143210
"tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]",
144211
"tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
145212
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
146213
"pfc_enable" : "3,4",
147214
"pfcwd_sw_enable" : "3,4"
148215
},
149216
"Ethernet64": {
150-
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]",
217+
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE_UPLINK]",
151218
"tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]",
152219
"tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
153220
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
154221
"pfc_enable" : "3,4",
155222
"pfcwd_sw_enable" : "3,4"
156223
},
157224
"Ethernet68": {
158-
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]",
225+
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE_UPLINK]",
159226
"tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]",
160227
"tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
161228
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
162229
"pfc_enable" : "3,4",
163230
"pfcwd_sw_enable" : "3,4"
164231
},
165232
"Ethernet80": {
166-
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]",
233+
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE_UPLINK]",
167234
"tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]",
168235
"tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
169236
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
170237
"pfc_enable" : "3,4",
171238
"pfcwd_sw_enable" : "3,4"
172239
},
173240
"Ethernet84": {
174-
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]",
241+
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE_UPLINK]",
175242
"tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]",
176243
"tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
177244
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",

0 commit comments

Comments
 (0)