misc: deprecate dpdk hqos
[vpp.git] / extras / deprecated / dpdk-hqos / dpdk-hqos.diff
1 diff --git a/src/plugins/dpdk/CMakeLists.txt b/src/plugins/dpdk/CMakeLists.txt
2 index e0122d928..af8c80d8f 100644
3 --- a/src/plugins/dpdk/CMakeLists.txt
4 +++ b/src/plugins/dpdk/CMakeLists.txt
5 @@ -118,8 +118,6 @@ add_vpp_plugin(dpdk
6    buffer.c
7    main.c
8    thread.c
9 -#  api/dpdk_api.c
10 -#  api/dpdk_test.c
11    device/cli.c
12    device/common.c
13    device/device.c
14 @@ -127,7 +125,6 @@ add_vpp_plugin(dpdk
15    device/format.c
16    device/init.c
17    device/node.c
18 -#   hqos/hqos.c
19    ipsec/cli.c
20    ipsec/crypto_node.c
21    ipsec/esp_decrypt.c
22 @@ -142,12 +139,6 @@ add_vpp_plugin(dpdk
23    ipsec/esp_decrypt.c
24    ipsec/esp_encrypt.c
25  
26 -#  API_FILES
27 -#  api/dpdk.api
28 -
29 -#  API_TEST_SOURCES
30 -#  api/dpdk_test.c
31 -
32    INSTALL_HEADERS
33    device/dpdk.h
34    ipsec/ipsec.h
35 diff --git a/src/plugins/dpdk/device/cli.c b/src/plugins/dpdk/device/cli.c
36 index 416d97360..0f771c6ba 100644
37 --- a/src/plugins/dpdk/device/cli.c
38 +++ b/src/plugins/dpdk/device/cli.c
39 @@ -40,61 +40,6 @@
40   */
41  
42  
43 -#if 0
44 -static clib_error_t *
45 -get_hqos (u32 hw_if_index, u32 subport_id, dpdk_device_t ** xd,
46 -         dpdk_device_config_t ** devconf)
47 -{
48 -  dpdk_main_t *dm = &dpdk_main;
49 -  vnet_hw_interface_t *hw;
50 -  struct rte_eth_dev_info dev_info;
51 -  struct rte_pci_device *pci_dev;
52 -  uword *p = 0;
53 -  clib_error_t *error = NULL;
54 -
55 -
56 -  if (hw_if_index == (u32) ~ 0)
57 -    {
58 -      error = clib_error_return (0, "please specify valid interface name");
59 -      goto done;
60 -    }
61 -
62 -  if (subport_id != 0)
63 -    {
64 -      error = clib_error_return (0, "Invalid subport");
65 -      goto done;
66 -    }
67 -
68 -  hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
69 -  *xd = vec_elt_at_index (dm->devices, hw->dev_instance);
70 -
71 -  rte_eth_dev_info_get ((*xd)->port_id, &dev_info);
72 -
73 -  pci_dev = dpdk_get_pci_device (&dev_info);
74 -
75 -  if (pci_dev)
76 -    {
77 -      vlib_pci_addr_t pci_addr;
78 -
79 -      pci_addr.domain = pci_dev->addr.domain;
80 -      pci_addr.bus = pci_dev->addr.bus;
81 -      pci_addr.slot = pci_dev->addr.devid;
82 -      pci_addr.function = pci_dev->addr.function;
83 -
84 -      p =
85 -       hash_get (dm->conf->device_config_index_by_pci_addr, pci_addr.as_u32);
86 -    }
87 -
88 -  if (p)
89 -    (*devconf) = pool_elt_at_index (dm->conf->dev_confs, p[0]);
90 -  else
91 -    (*devconf) = &dm->conf->default_devconf;
92 -
93 -done:
94 -  return error;
95 -}
96 -#endif
97 -
98  static clib_error_t *
99  show_dpdk_buffer (vlib_main_t * vm, unformat_input_t * input,
100                   vlib_cli_command_t * cmd)
101 @@ -408,1308 +353,6 @@ VLIB_CLI_COMMAND (cmd_set_dpdk_if_desc,static) = {
102  };
103  /* *INDENT-ON* */
104  
105 -#if 0
106 -static int
107 -dpdk_device_queue_sort (void *a1, void *a2)
108 -{
109 -  dpdk_device_and_queue_t *dq1 = a1;
110 -  dpdk_device_and_queue_t *dq2 = a2;
111 -
112 -  if (dq1->device > dq2->device)
113 -    return 1;
114 -  else if (dq1->device < dq2->device)
115 -    return -1;
116 -  else if (dq1->queue_id > dq2->queue_id)
117 -    return 1;
118 -  else if (dq1->queue_id < dq2->queue_id)
119 -    return -1;
120 -  else
121 -    return 0;
122 -}
123 -
124 -
125 -static clib_error_t *
126 -show_dpdk_if_hqos_placement (vlib_main_t * vm, unformat_input_t * input,
127 -                            vlib_cli_command_t * cmd)
128 -{
129 -  vlib_thread_main_t *tm = vlib_get_thread_main ();
130 -  dpdk_main_t *dm = &dpdk_main;
131 -  dpdk_device_and_queue_t *dq;
132 -  int cpu;
133 -
134 -  if (tm->n_vlib_mains == 1)
135 -    vlib_cli_output (vm, "All interfaces are handled by main thread");
136 -
137 -  for (cpu = 0; cpu < vec_len (dm->devices_by_hqos_cpu); cpu++)
138 -    {
139 -      if (cpu >= dm->hqos_cpu_first_index &&
140 -         cpu < (dm->hqos_cpu_first_index + dm->hqos_cpu_count))
141 -       vlib_cli_output (vm, "Thread %u (%s at lcore %u):", cpu,
142 -                        vlib_worker_threads[cpu].name,
143 -                        vlib_worker_threads[cpu].cpu_id);
144 -
145 -      vec_foreach (dq, dm->devices_by_hqos_cpu[cpu])
146 -      {
147 -       u32 hw_if_index = dm->devices[dq->device].hw_if_index;
148 -       vnet_hw_interface_t *hi =
149 -         vnet_get_hw_interface (dm->vnet_main, hw_if_index);
150 -       vlib_cli_output (vm, "  %v queue %u", hi->name, dq->queue_id);
151 -      }
152 -    }
153 -  return 0;
154 -}
155 -
156 -/*?
157 - * This command is used to display the thread and core each
158 - * DPDK output interface and HQoS queue is assigned too.
159 - *
160 - * @cliexpar
161 - * Example of how to display the DPDK output interface and HQoS queue placement:
162 - * @cliexstart{show dpdk interface hqos placement}
163 - * Thread 1 (vpp_hqos-threads_0 at lcore 3):
164 - *   GigabitEthernet0/8/0 queue 0
165 - * Thread 2 (vpp_hqos-threads_1 at lcore 4):
166 - *   GigabitEthernet0/9/0 queue 0
167 - * @cliexend
168 -?*/
169 -/* *INDENT-OFF* */
170 -VLIB_CLI_COMMAND (cmd_show_dpdk_if_hqos_placement, static) = {
171 -  .path = "show dpdk interface hqos placement",
172 -  .short_help = "show dpdk interface hqos placement",
173 -  .function = show_dpdk_if_hqos_placement,
174 -};
175 -/* *INDENT-ON* */
176 -
177 -static clib_error_t *
178 -set_dpdk_if_hqos_placement (vlib_main_t * vm, unformat_input_t * input,
179 -                           vlib_cli_command_t * cmd)
180 -{
181 -  unformat_input_t _line_input, *line_input = &_line_input;
182 -  dpdk_main_t *dm = &dpdk_main;
183 -  dpdk_device_and_queue_t *dq;
184 -  vnet_hw_interface_t *hw;
185 -  dpdk_device_t *xd;
186 -  u32 hw_if_index = (u32) ~ 0;
187 -  u32 cpu = (u32) ~ 0;
188 -  int i;
189 -  clib_error_t *error = NULL;
190 -
191 -  if (!unformat_user (input, unformat_line_input, line_input))
192 -    return 0;
193 -
194 -  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
195 -    {
196 -      if (unformat
197 -         (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
198 -          &hw_if_index))
199 -       ;
200 -      else if (unformat (line_input, "thread %d", &cpu))
201 -       ;
202 -      else
203 -       {
204 -         error = clib_error_return (0, "parse error: '%U'",
205 -                                    format_unformat_error, line_input);
206 -         goto done;
207 -       }
208 -    }
209 -
210 -  if (hw_if_index == (u32) ~ 0)
211 -    return clib_error_return (0, "please specify valid interface name");
212 -
213 -  if (cpu < dm->hqos_cpu_first_index ||
214 -      cpu >= (dm->hqos_cpu_first_index + dm->hqos_cpu_count))
215 -    {
216 -      error = clib_error_return (0, "please specify valid thread id");
217 -      goto done;
218 -    }
219 -
220 -  hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
221 -  xd = vec_elt_at_index (dm->devices, hw->dev_instance);
222 -
223 -  for (i = 0; i < vec_len (dm->devices_by_hqos_cpu); i++)
224 -    {
225 -      vec_foreach (dq, dm->devices_by_hqos_cpu[i])
226 -      {
227 -       if (hw_if_index == dm->devices[dq->device].hw_if_index)
228 -         {
229 -           if (cpu == i)       /* nothing to do */
230 -             goto done;
231 -
232 -           vec_del1 (dm->devices_by_hqos_cpu[i],
233 -                     dq - dm->devices_by_hqos_cpu[i]);
234 -           vec_add2 (dm->devices_by_hqos_cpu[cpu], dq, 1);
235 -           dq->queue_id = 0;
236 -           dq->device = xd->device_index;
237 -
238 -           vec_sort_with_function (dm->devices_by_hqos_cpu[i],
239 -                                   dpdk_device_queue_sort);
240 -
241 -           vec_sort_with_function (dm->devices_by_hqos_cpu[cpu],
242 -                                   dpdk_device_queue_sort);
243 -
244 -           goto done;
245 -         }
246 -      }
247 -    }
248 -
249 -  error = clib_error_return (0, "not found");
250 -
251 -done:
252 -  unformat_free (line_input);
253 -
254 -  return error;
255 -}
256 -
257 -/*?
258 - * This command is used to assign a given DPDK output interface and
259 - * HQoS queue to a different thread. This will not create a thread,
260 - * so the thread must already exist. Use '<em>/etc/vpp/startup.conf</em>'
261 - * for the initial thread creation. See @ref qos_doc for more details.
262 - *
263 - * @cliexpar
264 - * Example of how to display the DPDK output interface and HQoS queue placement:
265 - * @cliexstart{show dpdk interface hqos placement}
266 - * Thread 1 (vpp_hqos-threads_0 at lcore 3):
267 - *   GigabitEthernet0/8/0 queue 0
268 - * Thread 2 (vpp_hqos-threads_1 at lcore 4):
269 - *   GigabitEthernet0/9/0 queue 0
270 - * @cliexend
271 - * Example of how to assign a DPDK output interface and HQoS queue to a thread:
272 - * @cliexcmd{set dpdk interface hqos placement GigabitEthernet0/8/0 thread 2}
273 -?*/
274 -/* *INDENT-OFF* */
275 -VLIB_CLI_COMMAND (cmd_set_dpdk_if_hqos_placement, static) = {
276 -  .path = "set dpdk interface hqos placement",
277 -  .short_help = "set dpdk interface hqos placement <interface> thread <n>",
278 -  .function = set_dpdk_if_hqos_placement,
279 -};
280 -/* *INDENT-ON* */
281 -
282 -static clib_error_t *
283 -set_dpdk_if_hqos_pipe (vlib_main_t * vm, unformat_input_t * input,
284 -                      vlib_cli_command_t * cmd)
285 -{
286 -  unformat_input_t _line_input, *line_input = &_line_input;
287 -  dpdk_main_t *dm = &dpdk_main;
288 -  vnet_hw_interface_t *hw;
289 -  dpdk_device_t *xd;
290 -  u32 hw_if_index = (u32) ~ 0;
291 -  u32 subport_id = (u32) ~ 0;
292 -  u32 pipe_id = (u32) ~ 0;
293 -  u32 profile_id = (u32) ~ 0;
294 -  int rv;
295 -  clib_error_t *error = NULL;
296 -
297 -  if (!unformat_user (input, unformat_line_input, line_input))
298 -    return 0;
299 -
300 -  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
301 -    {
302 -      if (unformat
303 -         (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
304 -          &hw_if_index))
305 -       ;
306 -      else if (unformat (line_input, "subport %d", &subport_id))
307 -       ;
308 -      else if (unformat (line_input, "pipe %d", &pipe_id))
309 -       ;
310 -      else if (unformat (line_input, "profile %d", &profile_id))
311 -       ;
312 -      else
313 -       {
314 -         error = clib_error_return (0, "parse error: '%U'",
315 -                                    format_unformat_error, line_input);
316 -         goto done;
317 -       }
318 -    }
319 -
320 -  if (hw_if_index == (u32) ~ 0)
321 -    {
322 -      error = clib_error_return (0, "please specify valid interface name");
323 -      goto done;
324 -    }
325 -
326 -  hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
327 -  xd = vec_elt_at_index (dm->devices, hw->dev_instance);
328 -
329 -  rv =
330 -    rte_sched_pipe_config (xd->hqos_ht->hqos, subport_id, pipe_id,
331 -                          profile_id);
332 -  if (rv)
333 -    {
334 -      error = clib_error_return (0, "pipe configuration failed");
335 -      goto done;
336 -    }
337 -
338 -done:
339 -  unformat_free (line_input);
340 -
341 -  return error;
342 -}
343 -
344 -/*?
345 - * This command is used to change the profile associate with a HQoS pipe. The
346 - * '<em><profile_id></em>' is zero based. Use the command
347 - * '<em>show dpdk interface hqos</em>' to display the content of each profile.
348 - * See @ref qos_doc for more details.
349 - *
350 - * @note
351 - * Currently there is not an API to create a new HQoS pipe profile. One is
352 - * created by default in the code (search for '<em>hqos_pipe_params_default</em>'').
353 - * Additional profiles can be created in code and code recompiled. Then use this
354 - * command to assign it.
355 - *
356 - * @cliexpar
357 - * Example of how to assign a new profile to a HQoS pipe:
358 - * @cliexcmd{set dpdk interface hqos pipe GigabitEthernet0/8/0 subport 0 pipe 2 profile 1}
359 -?*/
360 -/* *INDENT-OFF* */
361 -VLIB_CLI_COMMAND (cmd_set_dpdk_if_hqos_pipe, static) =
362 -{
363 -  .path = "set dpdk interface hqos pipe",
364 -  .short_help = "set dpdk interface hqos pipe <interface> subport <subport_id> pipe <pipe_id> "
365 -                  "profile <profile_id>",
366 -  .function = set_dpdk_if_hqos_pipe,
367 -};
368 -/* *INDENT-ON* */
369 -
370 -static clib_error_t *
371 -set_dpdk_if_hqos_subport (vlib_main_t * vm, unformat_input_t * input,
372 -                         vlib_cli_command_t * cmd)
373 -{
374 -  unformat_input_t _line_input, *line_input = &_line_input;
375 -  dpdk_main_t *dm = &dpdk_main;
376 -  dpdk_device_t *xd = NULL;
377 -  u32 hw_if_index = (u32) ~ 0;
378 -  u32 subport_id = (u32) ~ 0;
379 -  struct rte_sched_subport_params p;
380 -  int rv;
381 -  clib_error_t *error = NULL;
382 -  u32 tb_rate = (u32) ~ 0;
383 -  u32 tb_size = (u32) ~ 0;
384 -  u32 tc_rate[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE] =
385 -    { (u32) ~ 0, (u32) ~ 0, (u32) ~ 0, (u32) ~ 0 };
386 -  u32 tc_period = (u32) ~ 0;
387 -  dpdk_device_config_t *devconf = NULL;
388 -
389 -  if (!unformat_user (input, unformat_line_input, line_input))
390 -    return 0;
391 -
392 -  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
393 -    {
394 -      if (unformat
395 -         (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
396 -          &hw_if_index))
397 -       ;
398 -      else if (unformat (line_input, "subport %d", &subport_id))
399 -       ;
400 -      else if (unformat (line_input, "rate %d", &tb_rate))
401 -       ;
402 -      else if (unformat (line_input, "bktsize %d", &tb_size))
403 -       ;
404 -      else if (unformat (line_input, "tc0 %d", &tc_rate[0]))
405 -       ;
406 -      else if (unformat (line_input, "tc1 %d", &tc_rate[1]))
407 -       ;
408 -      else if (unformat (line_input, "tc2 %d", &tc_rate[2]))
409 -       ;
410 -      else if (unformat (line_input, "tc3 %d", &tc_rate[3]))
411 -       ;
412 -      else if (unformat (line_input, "period %d", &tc_period))
413 -       ;
414 -      else
415 -       {
416 -         error = clib_error_return (0, "parse error: '%U'",
417 -                                    format_unformat_error, line_input);
418 -         goto done;
419 -       }
420 -    }
421 -
422 -  error = get_hqos (hw_if_index, subport_id, &xd, &devconf);
423 -
424 -  if (error == NULL)
425 -    {
426 -      /* Copy the current values over to local structure. */
427 -      memcpy (&p, &devconf->hqos.subport[subport_id], sizeof (p));
428 -
429 -      /* Update local structure with input values. */
430 -      if (tb_rate != (u32) ~ 0)
431 -       {
432 -         p.tb_rate = tb_rate;
433 -         p.tc_rate[0] = tb_rate;
434 -         p.tc_rate[1] = tb_rate;
435 -         p.tc_rate[2] = tb_rate;
436 -         p.tc_rate[3] = tb_rate;
437 -       }
438 -      if (tb_size != (u32) ~ 0)
439 -       {
440 -         p.tb_size = tb_size;
441 -       }
442 -      if (tc_rate[0] != (u32) ~ 0)
443 -       {
444 -         p.tc_rate[0] = tc_rate[0];
445 -       }
446 -      if (tc_rate[1] != (u32) ~ 0)
447 -       {
448 -         p.tc_rate[1] = tc_rate[1];
449 -       }
450 -      if (tc_rate[2] != (u32) ~ 0)
451 -       {
452 -         p.tc_rate[2] = tc_rate[2];
453 -       }
454 -      if (tc_rate[3] != (u32) ~ 0)
455 -       {
456 -         p.tc_rate[3] = tc_rate[3];
457 -       }
458 -      if (tc_period != (u32) ~ 0)
459 -       {
460 -         p.tc_period = tc_period;
461 -       }
462 -
463 -      /* Apply changes. */
464 -      rv = rte_sched_subport_config (xd->hqos_ht->hqos, subport_id, &p);
465 -      if (rv)
466 -       {
467 -         error = clib_error_return (0, "subport configuration failed");
468 -         goto done;
469 -       }
470 -      else
471 -       {
472 -         /* Successfully applied, so save of the input values. */
473 -         memcpy (&devconf->hqos.subport[subport_id], &p, sizeof (p));
474 -       }
475 -    }
476 -
477 -done:
478 -  unformat_free (line_input);
479 -
480 -  return error;
481 -}
482 -
483 -/*?
484 - * This command is used to set the subport level parameters such as token
485 - * bucket rate (bytes per seconds), token bucket size (bytes), traffic class
486 - * rates (bytes per seconds) and token update period (Milliseconds).
487 - *
488 - * By default, the '<em>rate</em>' is set to 1250000000 bytes/second (10GbE
489 - * rate) and each of the four traffic classes is set to 100% of the port rate.
490 - * If the '<em>rate</em>' is updated by this command, all four traffic classes
491 - * are assigned the same value. Each of the four traffic classes can be updated
492 - * individually.
493 - *
494 - * @cliexpar
495 - * Example of how modify the subport attributes for a 1GbE link:
496 - * @cliexcmd{set dpdk interface hqos subport GigabitEthernet0/8/0 subport 0 rate 125000000}
497 -?*/
498 -/* *INDENT-OFF* */
499 -VLIB_CLI_COMMAND (cmd_set_dpdk_if_hqos_subport, static) = {
500 -  .path = "set dpdk interface hqos subport",
501 -  .short_help = "set dpdk interface hqos subport <interface> subport <subport_id> "
502 -                 "[rate <n>] [bktsize <n>] [tc0 <n>] [tc1 <n>] [tc2 <n>] [tc3 <n>] "
503 -                 "[period <n>]",
504 -  .function = set_dpdk_if_hqos_subport,
505 -};
506 -/* *INDENT-ON* */
507 -
508 -static clib_error_t *
509 -set_dpdk_if_hqos_tctbl (vlib_main_t * vm, unformat_input_t * input,
510 -                       vlib_cli_command_t * cmd)
511 -{
512 -  unformat_input_t _line_input, *line_input = &_line_input;
513 -  vlib_thread_main_t *tm = vlib_get_thread_main ();
514 -  dpdk_main_t *dm = &dpdk_main;
515 -  vnet_hw_interface_t *hw;
516 -  dpdk_device_t *xd;
517 -  u32 hw_if_index = (u32) ~ 0;
518 -  u32 tc = (u32) ~ 0;
519 -  u32 queue = (u32) ~ 0;
520 -  u32 entry = (u32) ~ 0;
521 -  u32 val, i;
522 -  clib_error_t *error = NULL;
523 -
524 -  if (!unformat_user (input, unformat_line_input, line_input))
525 -    return 0;
526 -
527 -  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
528 -    {
529 -      if (unformat
530 -         (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
531 -          &hw_if_index))
532 -       ;
533 -      else if (unformat (line_input, "entry %d", &entry))
534 -       ;
535 -      else if (unformat (line_input, "tc %d", &tc))
536 -       ;
537 -      else if (unformat (line_input, "queue %d", &queue))
538 -       ;
539 -      else
540 -       {
541 -         error = clib_error_return (0, "parse error: '%U'",
542 -                                    format_unformat_error, line_input);
543 -         goto done;
544 -       }
545 -    }
546 -
547 -  if (hw_if_index == (u32) ~ 0)
548 -    {
549 -      error = clib_error_return (0, "please specify valid interface name");
550 -      goto done;
551 -    }
552 -  if (entry >= 64)
553 -    {
554 -      error = clib_error_return (0, "invalid entry");
555 -      goto done;
556 -    }
557 -  if (tc >= RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE)
558 -    {
559 -      error = clib_error_return (0, "invalid traffic class");
560 -      goto done;
561 -    }
562 -  if (queue >= RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS)
563 -    {
564 -      error = clib_error_return (0, "invalid traffic class queue");
565 -      goto done;
566 -    }
567 -
568 -  hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
569 -  xd = vec_elt_at_index (dm->devices, hw->dev_instance);
570 -
571 -  /* Detect the set of worker threads */
572 -  uword *p = hash_get_mem (tm->thread_registrations_by_name, "workers");
573 -  /* Should never happen, shut up Coverity warning */
574 -  if (p == 0)
575 -    {
576 -      error = clib_error_return (0, "no worker registrations?");
577 -      goto done;
578 -    }
579 -
580 -  vlib_thread_registration_t *tr = (vlib_thread_registration_t *) p[0];
581 -  int worker_thread_first = tr->first_index;
582 -  int worker_thread_count = tr->count;
583 -
584 -  val = tc * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + queue;
585 -  for (i = 0; i < worker_thread_count; i++)
586 -    xd->hqos_wt[worker_thread_first + i].hqos_tc_table[entry] = val;
587 -
588 -done:
589 -  unformat_free (line_input);
590 -
591 -  return error;
592 -}
593 -
594 -/*?
595 - * This command is used to set the traffic class translation table. The
596 - * traffic class translation table is used to map 64 values (0-63) to one of
597 - * four traffic class and one of four HQoS input queue. Use the '<em>show
598 - * dpdk interface hqos</em>' command to display the traffic class translation
599 - * table. See @ref qos_doc for more details.
600 - *
601 - * This command has the following parameters:
602 - *
603 - * - <b><interface></b> - Used to specify the output interface.
604 - *
605 - * - <b>entry <map_val></b> - Mapped value (0-63) to assign traffic class and queue to.
606 - *
607 - * - <b>tc <tc_id></b> - Traffic class (0-3) to be used by the provided mapped value.
608 - *
609 - * - <b>queue <queue_id></b> - HQoS input queue (0-3) to be used by the provided mapped value.
610 - *
611 - * @cliexpar
612 - * Example of how modify the traffic class translation table:
613 - * @cliexcmd{set dpdk interface hqos tctbl GigabitEthernet0/8/0 entry 16 tc 2 queue 2}
614 -?*/
615 -/* *INDENT-OFF* */
616 -VLIB_CLI_COMMAND (cmd_set_dpdk_if_hqos_tctbl, static) = {
617 -  .path = "set dpdk interface hqos tctbl",
618 -  .short_help = "set dpdk interface hqos tctbl <interface> entry <map_val> tc <tc_id> queue <queue_id>",
619 -  .function = set_dpdk_if_hqos_tctbl,
620 -};
621 -/* *INDENT-ON* */
622 -
623 -static clib_error_t *
624 -set_dpdk_if_hqos_pktfield (vlib_main_t * vm, unformat_input_t * input,
625 -                          vlib_cli_command_t * cmd)
626 -{
627 -  unformat_input_t _line_input, *line_input = &_line_input;
628 -  vlib_thread_main_t *tm = vlib_get_thread_main ();
629 -  dpdk_main_t *dm = &dpdk_main;
630 -  clib_error_t *error = NULL;
631 -
632 -  /* Device specific data */
633 -  struct rte_eth_dev_info dev_info;
634 -  struct rte_pci_device *pci_dev;
635 -  dpdk_device_config_t *devconf = 0;
636 -  vnet_hw_interface_t *hw;
637 -  dpdk_device_t *xd;
638 -  u32 hw_if_index = (u32) ~ 0;
639 -
640 -  /* Detect the set of worker threads */
641 -  uword *p = hash_get_mem (tm->thread_registrations_by_name, "workers");
642 -  /* Should never happen, shut up Coverity warning */
643 -  if (p == 0)
644 -    return clib_error_return (0, "no worker registrations?");
645 -
646 -  vlib_thread_registration_t *tr = (vlib_thread_registration_t *) p[0];
647 -  int worker_thread_first = tr->first_index;
648 -  int worker_thread_count = tr->count;
649 -
650 -  /* Packet field configuration */
651 -  u64 mask = (u64) ~ 0;
652 -  u32 id = (u32) ~ 0;
653 -  u32 offset = (u32) ~ 0;
654 -
655 -  /* HQoS params */
656 -  u32 n_subports_per_port, n_pipes_per_subport, tctbl_size;
657 -
658 -  u32 i;
659 -
660 -  /* Parse input arguments */
661 -  if (!unformat_user (input, unformat_line_input, line_input))
662 -    return 0;
663 -
664 -  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
665 -    {
666 -      if (unformat
667 -         (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
668 -          &hw_if_index))
669 -       ;
670 -      else if (unformat (line_input, "id subport"))
671 -       id = 0;
672 -      else if (unformat (line_input, "id pipe"))
673 -       id = 1;
674 -      else if (unformat (line_input, "id tc"))
675 -       id = 2;
676 -      else if (unformat (line_input, "id %d", &id))
677 -       ;
678 -      else if (unformat (line_input, "offset %d", &offset))
679 -       ;
680 -      else if (unformat (line_input, "mask %llx", &mask))
681 -       ;
682 -      else
683 -       {
684 -         error = clib_error_return (0, "parse error: '%U'",
685 -                                    format_unformat_error, line_input);
686 -         goto done;
687 -       }
688 -    }
689 -
690 -  /* Get interface */
691 -  if (hw_if_index == (u32) ~ 0)
692 -    {
693 -      error = clib_error_return (0, "please specify valid interface name");
694 -      goto done;
695 -    }
696 -
697 -  hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
698 -  xd = vec_elt_at_index (dm->devices, hw->dev_instance);
699 -
700 -  rte_eth_dev_info_get (xd->port_id, &dev_info);
701 -
702 -  pci_dev = dpdk_get_pci_device (&dev_info);
703 -
704 -  if (pci_dev)
705 -    {
706 -      vlib_pci_addr_t pci_addr;
707 -
708 -      pci_addr.domain = pci_dev->addr.domain;
709 -      pci_addr.bus = pci_dev->addr.bus;
710 -      pci_addr.slot = pci_dev->addr.devid;
711 -      pci_addr.function = pci_dev->addr.function;
712 -
713 -      p =
714 -       hash_get (dm->conf->device_config_index_by_pci_addr, pci_addr.as_u32);
715 -    }
716 -
717 -  if (p)
718 -    devconf = pool_elt_at_index (dm->conf->dev_confs, p[0]);
719 -  else
720 -    devconf = &dm->conf->default_devconf;
721 -
722 -  if (devconf->hqos_enabled == 0)
723 -    {
724 -      vlib_cli_output (vm, "HQoS disabled for this interface");
725 -      goto done;
726 -    }
727 -
728 -  n_subports_per_port = devconf->hqos.port.n_subports_per_port;
729 -  n_pipes_per_subport = devconf->hqos.port.n_pipes_per_subport;
730 -  tctbl_size = RTE_DIM (devconf->hqos.tc_table);
731 -
732 -  /* Validate packet field configuration: id, offset and mask */
733 -  if (id >= 3)
734 -    {
735 -      error = clib_error_return (0, "invalid packet field id");
736 -      goto done;
737 -    }
738 -
739 -  switch (id)
740 -    {
741 -    case 0:
742 -      if (dpdk_hqos_validate_mask (mask, n_subports_per_port) != 0)
743 -       {
744 -         error = clib_error_return (0, "invalid subport ID mask "
745 -                                    "(n_subports_per_port = %u)",
746 -                                    n_subports_per_port);
747 -         goto done;
748 -       }
749 -      break;
750 -    case 1:
751 -      if (dpdk_hqos_validate_mask (mask, n_pipes_per_subport) != 0)
752 -       {
753 -         error = clib_error_return (0, "invalid pipe ID mask "
754 -                                    "(n_pipes_per_subport = %u)",
755 -                                    n_pipes_per_subport);
756 -         goto done;
757 -       }
758 -      break;
759 -    case 2:
760 -    default:
761 -      if (dpdk_hqos_validate_mask (mask, tctbl_size) != 0)
762 -       {
763 -         error = clib_error_return (0, "invalid TC table index mask "
764 -                                    "(TC table size = %u)", tctbl_size);
765 -         goto done;
766 -       }
767 -    }
768 -
769 -  /* Propagate packet field configuration to all workers */
770 -  for (i = 0; i < worker_thread_count; i++)
771 -    switch (id)
772 -      {
773 -      case 0:
774 -       xd->hqos_wt[worker_thread_first + i].hqos_field0_slabpos = offset;
775 -       xd->hqos_wt[worker_thread_first + i].hqos_field0_slabmask = mask;
776 -       xd->hqos_wt[worker_thread_first + i].hqos_field0_slabshr =
777 -         count_trailing_zeros (mask);
778 -       break;
779 -      case 1:
780 -       xd->hqos_wt[worker_thread_first + i].hqos_field1_slabpos = offset;
781 -       xd->hqos_wt[worker_thread_first + i].hqos_field1_slabmask = mask;
782 -       xd->hqos_wt[worker_thread_first + i].hqos_field1_slabshr =
783 -         count_trailing_zeros (mask);
784 -       break;
785 -      case 2:
786 -      default:
787 -       xd->hqos_wt[worker_thread_first + i].hqos_field2_slabpos = offset;
788 -       xd->hqos_wt[worker_thread_first + i].hqos_field2_slabmask = mask;
789 -       xd->hqos_wt[worker_thread_first + i].hqos_field2_slabshr =
790 -         count_trailing_zeros (mask);
791 -      }
792 -
793 -done:
794 -  unformat_free (line_input);
795 -
796 -  return error;
797 -}
798 -
799 -/*?
800 - * This command is used to set the packet fields required for classifying the
801 - * incoming packet. As a result of classification process, packet field
802 - * information will be mapped to 5 tuples (subport, pipe, traffic class, pipe,
803 - * color) and stored in packet mbuf.
804 - *
805 - * This command has the following parameters:
806 - *
807 - * - <b><interface></b> - Used to specify the output interface.
808 - *
809 - * - <b>id subport|pipe|tc</b> - Classification occurs across three fields.
810 - * This parameter indicates which of the three masks are being configured. Legacy
811 - * code used 0-2 to represent these three fields, so 0-2 is still accepted.
812 - *   - <b>subport|0</b> - Currently only one subport is supported, so only
813 - * an empty mask is supported for the subport classification.
814 - *   - <b>pipe|1</b> - Currently, 4096 pipes per subport are supported, so a
815 - * 12-bit mask should be configure to map to the 0-4095 pipes.
816 - *   - <b>tc|2</b> - The translation table (see '<em>set dpdk interface hqos
817 - * tctbl</em>' command) maps each value (0-63) into one of the 4 traffic classes
818 - * per pipe. A 6-bit mask should be configure to map this field to a traffic class.
819 - *
820 - * - <b>offset <n></b> - Offset in the packet to apply the 64-bit mask for classification.
821 - * The offset should be on an 8-byte boundary (0,8,16,24..).
822 - *
823 - * - <b>mask <hex-mask></b> - 64-bit mask to apply to packet at the given '<em>offset</em>'.
824 - * Bits must be contiguous and should not include '<em>0x</em>'.
825 - *
826 - * The default values for the '<em>pktfield</em>' assumes Ethernet/IPv4/UDP packets with
827 - * no VLAN. Adjust based on expected packet format and desired classification field.
828 - * - '<em>subport</em>' is always empty (offset 0 mask 0000000000000000)
829 - * - By default, '<em>pipe</em>' maps to the UDP payload bits 12 .. 23 (offset 40
830 - * mask 0000000fff000000)
831 - * - By default, '<em>tc</em>' maps to the DSCP field in IP header (offset 48 mask
832 - * 00000000000000fc)
833 - *
834 - * @cliexpar
835 - * Example of how modify the '<em>pipe</em>' classification filter to match VLAN:
836 - * @cliexcmd{set dpdk interface hqos pktfield GigabitEthernet0/8/0 id pipe offset 8 mask 0000000000000FFF}
837 -?*/
838 -/* *INDENT-OFF* */
839 -VLIB_CLI_COMMAND (cmd_set_dpdk_if_hqos_pktfield, static) = {
840 -  .path = "set dpdk interface hqos pktfield",
841 -  .short_help = "set dpdk interface hqos pktfield <interface> id subport|pipe|tc offset <n> "
842 -                 "mask <hex-mask>",
843 -  .function = set_dpdk_if_hqos_pktfield,
844 -};
845 -/* *INDENT-ON* */
846 -
847 -static clib_error_t *
848 -show_dpdk_if_hqos (vlib_main_t * vm, unformat_input_t * input,
849 -                  vlib_cli_command_t * cmd)
850 -{
851 -  unformat_input_t _line_input, *line_input = &_line_input;
852 -  vlib_thread_main_t *tm = vlib_get_thread_main ();
853 -  dpdk_main_t *dm = &dpdk_main;
854 -  vnet_hw_interface_t *hw;
855 -  dpdk_device_t *xd;
856 -  dpdk_device_config_hqos_t *cfg;
857 -  dpdk_device_hqos_per_hqos_thread_t *ht;
858 -  dpdk_device_hqos_per_worker_thread_t *wk;
859 -  u32 *tctbl;
860 -  u32 hw_if_index = (u32) ~ 0;
861 -  u32 profile_id, subport_id, i;
862 -  struct rte_eth_dev_info dev_info;
863 -  struct rte_pci_device *pci_dev;
864 -  dpdk_device_config_t *devconf = 0;
865 -  vlib_thread_registration_t *tr;
866 -  uword *p = 0;
867 -  clib_error_t *error = NULL;
868 -
869 -  if (!unformat_user (input, unformat_line_input, line_input))
870 -    return 0;
871 -
872 -  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
873 -    {
874 -      if (unformat
875 -         (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
876 -          &hw_if_index))
877 -       ;
878 -      else
879 -       {
880 -         error = clib_error_return (0, "parse error: '%U'",
881 -                                    format_unformat_error, line_input);
882 -         goto done;
883 -       }
884 -    }
885 -
886 -  if (hw_if_index == (u32) ~ 0)
887 -    {
888 -      error = clib_error_return (0, "please specify interface name!!");
889 -      goto done;
890 -    }
891 -
892 -  hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
893 -  xd = vec_elt_at_index (dm->devices, hw->dev_instance);
894 -
895 -  rte_eth_dev_info_get (xd->port_id, &dev_info);
896 -
897 -  pci_dev = dpdk_get_pci_device (&dev_info);
898 -
899 -  if (pci_dev)
900 -    {
901 -      vlib_pci_addr_t pci_addr;
902 -
903 -      pci_addr.domain = pci_dev->addr.domain;
904 -      pci_addr.bus = pci_dev->addr.bus;
905 -      pci_addr.slot = pci_dev->addr.devid;
906 -      pci_addr.function = pci_dev->addr.function;
907 -
908 -      p =
909 -       hash_get (dm->conf->device_config_index_by_pci_addr, pci_addr.as_u32);
910 -    }
911 -
912 -  if (p)
913 -    devconf = pool_elt_at_index (dm->conf->dev_confs, p[0]);
914 -  else
915 -    devconf = &dm->conf->default_devconf;
916 -
917 -  if (devconf->hqos_enabled == 0)
918 -    {
919 -      vlib_cli_output (vm, "HQoS disabled for this interface");
920 -      goto done;
921 -    }
922 -
923 -  /* Detect the set of worker threads */
924 -  p = hash_get_mem (tm->thread_registrations_by_name, "workers");
925 -
926 -  /* Should never happen, shut up Coverity warning */
927 -  if (p == 0)
928 -    {
929 -      error = clib_error_return (0, "no worker registrations?");
930 -      goto done;
931 -    }
932 -
933 -  tr = (vlib_thread_registration_t *) p[0];
934 -
935 -  cfg = &devconf->hqos;
936 -  ht = xd->hqos_ht;
937 -  wk = &xd->hqos_wt[tr->first_index];
938 -  tctbl = wk->hqos_tc_table;
939 -
940 -  vlib_cli_output (vm, " Thread:");
941 -  vlib_cli_output (vm, "   Input SWQ size = %u packets", cfg->swq_size);
942 -  vlib_cli_output (vm, "   Enqueue burst size = %u packets",
943 -                  ht->hqos_burst_enq);
944 -  vlib_cli_output (vm, "   Dequeue burst size = %u packets",
945 -                  ht->hqos_burst_deq);
946 -
947 -  vlib_cli_output (vm,
948 -                  "   Packet field 0: slab position = %4u, slab bitmask = 0x%016llx   (subport)",
949 -                  wk->hqos_field0_slabpos, wk->hqos_field0_slabmask);
950 -  vlib_cli_output (vm,
951 -                  "   Packet field 1: slab position = %4u, slab bitmask = 0x%016llx   (pipe)",
952 -                  wk->hqos_field1_slabpos, wk->hqos_field1_slabmask);
953 -  vlib_cli_output (vm,
954 -                  "   Packet field 2: slab position = %4u, slab bitmask = 0x%016llx   (tc)",
955 -                  wk->hqos_field2_slabpos, wk->hqos_field2_slabmask);
956 -  vlib_cli_output (vm,
957 -                  "   Packet field 2  tc translation table: ([Mapped Value Range]: tc/queue tc/queue ...)");
958 -  vlib_cli_output (vm,
959 -                  "     [ 0 .. 15]: "
960 -                  "%u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u",
961 -                  tctbl[0] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
962 -                  tctbl[0] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
963 -                  tctbl[1] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
964 -                  tctbl[1] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
965 -                  tctbl[2] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
966 -                  tctbl[2] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
967 -                  tctbl[3] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
968 -                  tctbl[3] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
969 -                  tctbl[4] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
970 -                  tctbl[4] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
971 -                  tctbl[5] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
972 -                  tctbl[5] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
973 -                  tctbl[6] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
974 -                  tctbl[6] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
975 -                  tctbl[7] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
976 -                  tctbl[7] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
977 -                  tctbl[8] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
978 -                  tctbl[8] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
979 -                  tctbl[9] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
980 -                  tctbl[9] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
981 -                  tctbl[10] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
982 -                  tctbl[10] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
983 -                  tctbl[11] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
984 -                  tctbl[11] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
985 -                  tctbl[12] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
986 -                  tctbl[12] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
987 -                  tctbl[13] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
988 -                  tctbl[13] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
989 -                  tctbl[14] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
990 -                  tctbl[14] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
991 -                  tctbl[15] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
992 -                  tctbl[15] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS);
993 -  vlib_cli_output (vm,
994 -                  "     [16 .. 31]: "
995 -                  "%u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u",
996 -                  tctbl[16] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
997 -                  tctbl[16] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
998 -                  tctbl[17] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
999 -                  tctbl[17] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1000 -                  tctbl[18] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1001 -                  tctbl[18] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1002 -                  tctbl[19] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1003 -                  tctbl[19] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1004 -                  tctbl[20] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1005 -                  tctbl[20] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1006 -                  tctbl[21] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1007 -                  tctbl[21] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1008 -                  tctbl[22] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1009 -                  tctbl[22] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1010 -                  tctbl[23] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1011 -                  tctbl[23] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1012 -                  tctbl[24] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1013 -                  tctbl[24] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1014 -                  tctbl[25] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1015 -                  tctbl[25] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1016 -                  tctbl[26] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1017 -                  tctbl[26] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1018 -                  tctbl[27] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1019 -                  tctbl[27] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1020 -                  tctbl[28] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1021 -                  tctbl[28] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1022 -                  tctbl[29] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1023 -                  tctbl[29] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1024 -                  tctbl[30] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1025 -                  tctbl[30] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1026 -                  tctbl[31] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1027 -                  tctbl[31] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS);
1028 -  vlib_cli_output (vm,
1029 -                  "     [32 .. 47]: "
1030 -                  "%u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u",
1031 -                  tctbl[32] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1032 -                  tctbl[32] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1033 -                  tctbl[33] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1034 -                  tctbl[33] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1035 -                  tctbl[34] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1036 -                  tctbl[34] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1037 -                  tctbl[35] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1038 -                  tctbl[35] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1039 -                  tctbl[36] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1040 -                  tctbl[36] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1041 -                  tctbl[37] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1042 -                  tctbl[37] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1043 -                  tctbl[38] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1044 -                  tctbl[38] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1045 -                  tctbl[39] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1046 -                  tctbl[39] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1047 -                  tctbl[40] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1048 -                  tctbl[40] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1049 -                  tctbl[41] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1050 -                  tctbl[41] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1051 -                  tctbl[42] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1052 -                  tctbl[42] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1053 -                  tctbl[43] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1054 -                  tctbl[43] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1055 -                  tctbl[44] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1056 -                  tctbl[44] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1057 -                  tctbl[45] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1058 -                  tctbl[45] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1059 -                  tctbl[46] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1060 -                  tctbl[46] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1061 -                  tctbl[47] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1062 -                  tctbl[47] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS);
1063 -  vlib_cli_output (vm,
1064 -                  "     [48 .. 63]: "
1065 -                  "%u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u",
1066 -                  tctbl[48] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1067 -                  tctbl[48] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1068 -                  tctbl[49] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1069 -                  tctbl[49] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1070 -                  tctbl[50] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1071 -                  tctbl[50] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1072 -                  tctbl[51] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1073 -                  tctbl[51] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1074 -                  tctbl[52] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1075 -                  tctbl[52] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1076 -                  tctbl[53] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1077 -                  tctbl[53] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1078 -                  tctbl[54] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1079 -                  tctbl[54] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1080 -                  tctbl[55] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1081 -                  tctbl[55] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1082 -                  tctbl[56] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1083 -                  tctbl[56] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1084 -                  tctbl[57] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1085 -                  tctbl[57] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1086 -                  tctbl[58] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1087 -                  tctbl[58] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1088 -                  tctbl[59] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1089 -                  tctbl[59] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1090 -                  tctbl[60] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1091 -                  tctbl[60] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1092 -                  tctbl[61] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1093 -                  tctbl[61] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1094 -                  tctbl[62] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1095 -                  tctbl[62] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1096 -                  tctbl[63] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1097 -                  tctbl[63] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS);
1098 -  vlib_cli_output (vm, " Port:");
1099 -  vlib_cli_output (vm, "   Rate = %u bytes/second", cfg->port.rate);
1100 -  vlib_cli_output (vm, "   MTU = %u bytes", cfg->port.mtu);
1101 -  vlib_cli_output (vm, "   Frame overhead = %u bytes",
1102 -                  cfg->port.frame_overhead);
1103 -  vlib_cli_output (vm, "   Number of subports = %u",
1104 -                  cfg->port.n_subports_per_port);
1105 -  vlib_cli_output (vm, "   Number of pipes per subport = %u",
1106 -                  cfg->port.n_pipes_per_subport);
1107 -  vlib_cli_output (vm,
1108 -                  "   Packet queue size: TC0 = %u, TC1 = %u, TC2 = %u, TC3 = %u packets",
1109 -                  cfg->port.qsize[0], cfg->port.qsize[1], cfg->port.qsize[2],
1110 -                  cfg->port.qsize[3]);
1111 -  vlib_cli_output (vm, "   Number of pipe profiles = %u",
1112 -                  cfg->port.n_pipe_profiles);
1113 -
1114 -  for (subport_id = 0; subport_id < vec_len (cfg->subport); subport_id++)
1115 -    {
1116 -      vlib_cli_output (vm, " Subport %u:", subport_id);
1117 -      vlib_cli_output (vm, "   Rate = %u bytes/second",
1118 -                      cfg->subport[subport_id].tb_rate);
1119 -      vlib_cli_output (vm, "   Token bucket size = %u bytes",
1120 -                      cfg->subport[subport_id].tb_size);
1121 -      vlib_cli_output (vm,
1122 -                      "   Traffic class rate: TC0 = %u, TC1 = %u, TC2 = %u, TC3 = %u bytes/second",
1123 -                      cfg->subport[subport_id].tc_rate[0],
1124 -                      cfg->subport[subport_id].tc_rate[1],
1125 -                      cfg->subport[subport_id].tc_rate[2],
1126 -                      cfg->subport[subport_id].tc_rate[3]);
1127 -      vlib_cli_output (vm, "   TC period = %u milliseconds",
1128 -                      cfg->subport[subport_id].tc_period);
1129 -    }
1130 -
1131 -  for (profile_id = 0; profile_id < vec_len (cfg->pipe); profile_id++)
1132 -    {
1133 -      vlib_cli_output (vm, " Pipe profile %u:", profile_id);
1134 -      vlib_cli_output (vm, "   Rate = %u bytes/second",
1135 -                      cfg->pipe[profile_id].tb_rate);
1136 -      vlib_cli_output (vm, "   Token bucket size = %u bytes",
1137 -                      cfg->pipe[profile_id].tb_size);
1138 -      vlib_cli_output (vm,
1139 -                      "   Traffic class rate: TC0 = %u, TC1 = %u, TC2 = %u, TC3 = %u bytes/second",
1140 -                      cfg->pipe[profile_id].tc_rate[0],
1141 -                      cfg->pipe[profile_id].tc_rate[1],
1142 -                      cfg->pipe[profile_id].tc_rate[2],
1143 -                      cfg->pipe[profile_id].tc_rate[3]);
1144 -      vlib_cli_output (vm, "   TC period = %u milliseconds",
1145 -                      cfg->pipe[profile_id].tc_period);
1146 -#ifdef RTE_SCHED_SUBPORT_TC_OV
1147 -      vlib_cli_output (vm, "   TC3 oversubscription_weight = %u",
1148 -                      cfg->pipe[profile_id].tc_ov_weight);
1149 -#endif
1150 -
1151 -      for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++)
1152 -       {
1153 -         vlib_cli_output (vm,
1154 -                          "   TC%u WRR weights: Q0 = %u, Q1 = %u, Q2 = %u, Q3 = %u",
1155 -                          i, cfg->pipe[profile_id].wrr_weights[i * 4],
1156 -                          cfg->pipe[profile_id].wrr_weights[i * 4 + 1],
1157 -                          cfg->pipe[profile_id].wrr_weights[i * 4 + 2],
1158 -                          cfg->pipe[profile_id].wrr_weights[i * 4 + 3]);
1159 -       }
1160 -    }
1161 -
1162 -#ifdef RTE_SCHED_RED
1163 -  vlib_cli_output (vm, " Weighted Random Early Detection (WRED):");
1164 -  for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++)
1165 -    {
1166 -      vlib_cli_output (vm, "   TC%u min: G = %u, Y = %u, R = %u", i,
1167 -                      cfg->port.red_params[i][e_RTE_METER_GREEN].min_th,
1168 -                      cfg->port.red_params[i][e_RTE_METER_YELLOW].min_th,
1169 -                      cfg->port.red_params[i][e_RTE_METER_RED].min_th);
1170 -
1171 -      vlib_cli_output (vm, "   TC%u max: G = %u, Y = %u, R = %u", i,
1172 -                      cfg->port.red_params[i][e_RTE_METER_GREEN].max_th,
1173 -                      cfg->port.red_params[i][e_RTE_METER_YELLOW].max_th,
1174 -                      cfg->port.red_params[i][e_RTE_METER_RED].max_th);
1175 -
1176 -      vlib_cli_output (vm,
1177 -                      "   TC%u inverted probability: G = %u, Y = %u, R = %u",
1178 -                      i, cfg->port.red_params[i][e_RTE_METER_GREEN].maxp_inv,
1179 -                      cfg->port.red_params[i][e_RTE_METER_YELLOW].maxp_inv,
1180 -                      cfg->port.red_params[i][e_RTE_METER_RED].maxp_inv);
1181 -
1182 -      vlib_cli_output (vm, "   TC%u weight: R = %u, Y = %u, R = %u", i,
1183 -                      cfg->port.red_params[i][e_RTE_METER_GREEN].wq_log2,
1184 -                      cfg->port.red_params[i][e_RTE_METER_YELLOW].wq_log2,
1185 -                      cfg->port.red_params[i][e_RTE_METER_RED].wq_log2);
1186 -    }
1187 -#endif
1188 -
1189 -done:
1190 -  unformat_free (line_input);
1191 -
1192 -  return error;
1193 -}
1194 -
1195 -/*?
1196 - * This command is used to display details of an output interface's HQoS
1197 - * settings.
1198 - *
1199 - * @cliexpar
1200 - * Example of how to display HQoS settings for an interfaces:
1201 - * @cliexstart{show dpdk interface hqos GigabitEthernet0/8/0}
1202 - *  Thread:
1203 - *    Input SWQ size = 4096 packets
1204 - *    Enqueue burst size = 256 packets
1205 - *    Dequeue burst size = 220 packets
1206 - *    Packet field 0: slab position =    0, slab bitmask = 0x0000000000000000   (subport)
1207 - *    Packet field 1: slab position =   40, slab bitmask = 0x0000000fff000000   (pipe)
1208 - *    Packet field 2: slab position =    8, slab bitmask = 0x00000000000000fc   (tc)
1209 - *    Packet field 2  tc translation table: ([Mapped Value Range]: tc/queue tc/queue ...)
1210 - *      [ 0 .. 15]: 0/0 0/1 0/2 0/3 1/0 1/1 1/2 1/3 2/0 2/1 2/2 2/3 3/0 3/1 3/2 3/3
1211 - *      [16 .. 31]: 0/0 0/1 0/2 0/3 1/0 1/1 1/2 1/3 2/0 2/1 2/2 2/3 3/0 3/1 3/2 3/3
1212 - *      [32 .. 47]: 0/0 0/1 0/2 0/3 1/0 1/1 1/2 1/3 2/0 2/1 2/2 2/3 3/0 3/1 3/2 3/3
1213 - *      [48 .. 63]: 0/0 0/1 0/2 0/3 1/0 1/1 1/2 1/3 2/0 2/1 2/2 2/3 3/0 3/1 3/2 3/3
1214 - *  Port:
1215 - *    Rate = 1250000000 bytes/second
1216 - *    MTU = 1514 bytes
1217 - *    Frame overhead = 24 bytes
1218 - *    Number of subports = 1
1219 - *    Number of pipes per subport = 4096
1220 - *    Packet queue size: TC0 = 64, TC1 = 64, TC2 = 64, TC3 = 64 packets
1221 - *    Number of pipe profiles = 2
1222 - *  Subport 0:
1223 - *    Rate = 1250000000 bytes/second
1224 - *    Token bucket size = 1000000 bytes
1225 - *    Traffic class rate: TC0 = 1250000000, TC1 = 1250000000, TC2 = 1250000000, TC3 = 1250000000 bytes/second
1226 - *    TC period = 10 milliseconds
1227 - *  Pipe profile 0:
1228 - *    Rate = 305175 bytes/second
1229 - *    Token bucket size = 1000000 bytes
1230 - *    Traffic class rate: TC0 = 305175, TC1 = 305175, TC2 = 305175, TC3 = 305175 bytes/second
1231 - *    TC period = 40 milliseconds
1232 - *    TC0 WRR weights: Q0 = 1, Q1 = 1, Q2 = 1, Q3 = 1
1233 - *    TC1 WRR weights: Q0 = 1, Q1 = 1, Q2 = 1, Q3 = 1
1234 - *    TC2 WRR weights: Q0 = 1, Q1 = 1, Q2 = 1, Q3 = 1
1235 - *    TC3 WRR weights: Q0 = 1, Q1 = 1, Q2 = 1, Q3 = 1
1236 - * @cliexend
1237 -?*/
1238 -/* *INDENT-OFF* */
1239 -VLIB_CLI_COMMAND (cmd_show_dpdk_if_hqos, static) = {
1240 -  .path = "show dpdk interface hqos",
1241 -  .short_help = "show dpdk interface hqos <interface>",
1242 -  .function = show_dpdk_if_hqos,
1243 -};
1244 -
1245 -/* *INDENT-ON* */
1246 -
1247 -static clib_error_t *
1248 -show_dpdk_hqos_queue_stats (vlib_main_t * vm, unformat_input_t * input,
1249 -                           vlib_cli_command_t * cmd)
1250 -{
1251 -  unformat_input_t _line_input, *line_input = &_line_input;
1252 -  clib_error_t *error = NULL;
1253 -#ifdef RTE_SCHED_COLLECT_STATS
1254 -  dpdk_main_t *dm = &dpdk_main;
1255 -  u32 hw_if_index = (u32) ~ 0;
1256 -  u32 subport = (u32) ~ 0;
1257 -  u32 pipe = (u32) ~ 0;
1258 -  u32 tc = (u32) ~ 0;
1259 -  u32 tc_q = (u32) ~ 0;
1260 -  vnet_hw_interface_t *hw;
1261 -  dpdk_device_t *xd;
1262 -  uword *p = 0;
1263 -  struct rte_eth_dev_info dev_info;
1264 -  struct rte_pci_device *pci_dev;
1265 -  dpdk_device_config_t *devconf = 0;
1266 -  u32 qindex;
1267 -  struct rte_sched_queue_stats stats;
1268 -  u16 qlen;
1269 -
1270 -  if (!unformat_user (input, unformat_line_input, line_input))
1271 -    return 0;
1272 -
1273 -  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
1274 -    {
1275 -      if (unformat
1276 -         (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
1277 -          &hw_if_index))
1278 -       ;
1279 -
1280 -      else if (unformat (line_input, "subport %d", &subport))
1281 -       ;
1282 -
1283 -      else if (unformat (line_input, "pipe %d", &pipe))
1284 -       ;
1285 -
1286 -      else if (unformat (line_input, "tc %d", &tc))
1287 -       ;
1288 -
1289 -      else if (unformat (line_input, "tc_q %d", &tc_q))
1290 -       ;
1291 -
1292 -      else
1293 -       {
1294 -         error = clib_error_return (0, "parse error: '%U'",
1295 -                                    format_unformat_error, line_input);
1296 -         goto done;
1297 -       }
1298 -    }
1299 -
1300 -  if (hw_if_index == (u32) ~ 0)
1301 -    {
1302 -      error = clib_error_return (0, "please specify interface name!!");
1303 -      goto done;
1304 -    }
1305 -
1306 -  hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
1307 -  xd = vec_elt_at_index (dm->devices, hw->dev_instance);
1308 -
1309 -  rte_eth_dev_info_get (xd->port_id, &dev_info);
1310 -
1311 -  pci_dev = dpdk_get_pci_device (&dev_info);
1312 -
1313 -  if (pci_dev)
1314 -    {                          /* bonded interface has no pci info */
1315 -      vlib_pci_addr_t pci_addr;
1316 -
1317 -      pci_addr.domain = pci_dev->addr.domain;
1318 -      pci_addr.bus = pci_dev->addr.bus;
1319 -      pci_addr.slot = pci_dev->addr.devid;
1320 -      pci_addr.function = pci_dev->addr.function;
1321 -
1322 -      p =
1323 -       hash_get (dm->conf->device_config_index_by_pci_addr, pci_addr.as_u32);
1324 -    }
1325 -
1326 -  if (p)
1327 -    devconf = pool_elt_at_index (dm->conf->dev_confs, p[0]);
1328 -  else
1329 -    devconf = &dm->conf->default_devconf;
1330 -
1331 -  if (devconf->hqos_enabled == 0)
1332 -    {
1333 -      vlib_cli_output (vm, "HQoS disabled for this interface");
1334 -      goto done;
1335 -    }
1336 -
1337 -  /*
1338 -   * Figure out which queue to query.  cf rte_sched_port_qindex.  (Not sure why
1339 -   * that method isn't made public by DPDK - how _should_ we get the queue ID?)
1340 -   */
1341 -  qindex = subport * devconf->hqos.port.n_pipes_per_subport + pipe;
1342 -  qindex = qindex * RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE + tc;
1343 -  qindex = qindex * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + tc_q;
1344 -
1345 -  if (rte_sched_queue_read_stats (xd->hqos_ht->hqos, qindex, &stats, &qlen) !=
1346 -      0)
1347 -    {
1348 -      error = clib_error_return (0, "failed to read stats");
1349 -      goto done;
1350 -    }
1351 -
1352 -  vlib_cli_output (vm, "%=24s%=16s", "Stats Parameter", "Value");
1353 -  vlib_cli_output (vm, "%=24s%=16d", "Packets", stats.n_pkts);
1354 -  vlib_cli_output (vm, "%=24s%=16d", "Packets dropped", stats.n_pkts_dropped);
1355 -#ifdef RTE_SCHED_RED
1356 -  vlib_cli_output (vm, "%=24s%=16d", "Packets dropped (RED)",
1357 -                  stats.n_pkts_red_dropped);
1358 -#endif
1359 -  vlib_cli_output (vm, "%=24s%=16d", "Bytes", stats.n_bytes);
1360 -  vlib_cli_output (vm, "%=24s%=16d", "Bytes dropped", stats.n_bytes_dropped);
1361 -
1362 -#else
1363 -
1364 -  /* Get a line of input */
1365 -  if (!unformat_user (input, unformat_line_input, line_input))
1366 -    return 0;
1367 -
1368 -  vlib_cli_output (vm, "RTE_SCHED_COLLECT_STATS disabled in DPDK");
1369 -  goto done;
1370 -
1371 -#endif
1372 -
1373 -done:
1374 -  unformat_free (line_input);
1375 -
1376 -  return error;
1377 -}
1378 -
1379 -/*?
1380 - * This command is used to display statistics associated with a HQoS traffic class
1381 - * queue.
1382 - *
1383 - * @note
1384 - * Statistic collection by the scheduler is disabled by default in DPDK. In order to
1385 - * turn it on, add the following line to '<em>../vpp/dpdk/Makefile</em>':
1386 - * - <b>$(call set,RTE_SCHED_COLLECT_STATS,y)</b>
1387 - *
1388 - * @cliexpar
1389 - * Example of how to display statistics of HQoS a HQoS traffic class queue:
1390 - * @cliexstart{show dpdk hqos queue GigabitEthernet0/9/0 subport 0 pipe 3181 tc 0 tc_q 0}
1391 - *      Stats Parameter          Value
1392 - *          Packets               140
1393 - *      Packets dropped            0
1394 - *           Bytes               8400
1395 - *       Bytes dropped             0
1396 - * @cliexend
1397 -?*/
1398 -/* *INDENT-OFF* */
1399 -VLIB_CLI_COMMAND (cmd_show_dpdk_hqos_queue_stats, static) = {
1400 -  .path = "show dpdk hqos queue",
1401 -  .short_help = "show dpdk hqos queue <interface> subport <subport_id> pipe <pipe_id> tc <tc_id> tc_q <queue_id>",
1402 -  .function = show_dpdk_hqos_queue_stats,
1403 -};
1404 -/* *INDENT-ON* */
1405 -#endif
1406 -
1407  static clib_error_t *
1408  show_dpdk_version_command_fn (vlib_main_t * vm,
1409                               unformat_input_t * input,
1410 diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c
1411 index 323149043..c355edf6a 100644
1412 --- a/src/plugins/dpdk/device/device.c
1413 +++ b/src/plugins/dpdk/device/device.c
1414 @@ -180,21 +180,6 @@ static_always_inline
1415             queue_id = (queue_id + 1) % xd->tx_q_used;
1416         }
1417  
1418 -#if 0
1419 -      if (PREDICT_FALSE (xd->flags & DPDK_DEVICE_FLAG_HQOS))   /* HQoS ON */
1420 -       {
1421 -         /* no wrap, transmit in one burst */
1422 -         dpdk_device_hqos_per_worker_thread_t *hqos =
1423 -           &xd->hqos_wt[vm->thread_index];
1424 -
1425 -         ASSERT (hqos->swq != NULL);
1426 -
1427 -         dpdk_hqos_metadata_set (hqos, mb, n_left);
1428 -         n_sent = rte_ring_sp_enqueue_burst (hqos->swq, (void **) mb,
1429 -                                             n_left, 0);
1430 -       }
1431 -      else
1432 -#endif
1433        if (PREDICT_TRUE (xd->flags & DPDK_DEVICE_FLAG_PMD))
1434         {
1435           /* no wrap, transmit in one burst */
1436 diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h
1437 index ab28ac06a..68d9e712b 100644
1438 --- a/src/plugins/dpdk/device/dpdk.h
1439 +++ b/src/plugins/dpdk/device/dpdk.h
1440 @@ -119,40 +119,6 @@ typedef enum
1441  
1442  typedef uint16_t dpdk_portid_t;
1443  
1444 -typedef struct
1445 -{
1446 -  /* Required for vec_validate_aligned */
1447 -  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
1448 -
1449 -  struct rte_ring *swq;
1450 -
1451 -  u64 hqos_field0_slabmask;
1452 -  u32 hqos_field0_slabpos;
1453 -  u32 hqos_field0_slabshr;
1454 -  u64 hqos_field1_slabmask;
1455 -  u32 hqos_field1_slabpos;
1456 -  u32 hqos_field1_slabshr;
1457 -  u64 hqos_field2_slabmask;
1458 -  u32 hqos_field2_slabpos;
1459 -  u32 hqos_field2_slabshr;
1460 -  u32 hqos_tc_table[64];
1461 -} dpdk_device_hqos_per_worker_thread_t;
1462 -
1463 -typedef struct
1464 -{
1465 -  /* Required for vec_validate_aligned */
1466 -  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
1467 -  struct rte_ring **swq;
1468 -  struct rte_mbuf **pkts_enq;
1469 -  struct rte_mbuf **pkts_deq;
1470 -  struct rte_sched_port *hqos;
1471 -  u32 hqos_burst_enq;
1472 -  u32 hqos_burst_deq;
1473 -  u32 pkts_enq_len;
1474 -  u32 swq_pos;
1475 -  u32 flush_count;
1476 -} dpdk_device_hqos_per_hqos_thread_t;
1477 -
1478  #define foreach_dpdk_device_flags \
1479    _( 0, ADMIN_UP, "admin-up") \
1480    _( 1, PROMISC, "promisc") \
1481 @@ -160,7 +126,6 @@ typedef struct
1482    _( 3, PMD_INIT_FAIL, "pmd-init-fail") \
1483    _( 4, MAYBE_MULTISEG, "maybe-multiseg") \
1484    _( 5, HAVE_SUBIF, "subif") \
1485 -  _( 6, HQOS, "hqos") \
1486    _( 9, TX_OFFLOAD, "tx-offload") \
1487    _(10, INTEL_PHDR_CKSUM, "intel-phdr-cksum") \
1488    _(11, RX_FLOW_OFFLOAD, "rx-flow-offload") \
1489 @@ -235,10 +200,6 @@ typedef struct
1490    u32 parked_loop_count;
1491    struct rte_flow_error last_flow_error;
1492  
1493 -  /* HQoS related */
1494 -  dpdk_device_hqos_per_worker_thread_t *hqos_wt;
1495 -  dpdk_device_hqos_per_hqos_thread_t *hqos_ht;
1496 -
1497    /* af_packet instance number */
1498    u16 af_packet_instance_num;
1499  
1500 @@ -278,39 +239,6 @@ typedef struct
1501  #define HQOS_FLUSH_COUNT_THRESHOLD              100000
1502  #endif
1503  
1504 -typedef struct dpdk_device_config_hqos_t
1505 -{
1506 -  u32 hqos_thread;
1507 -  u32 hqos_thread_valid;
1508 -
1509 -  u32 swq_size;
1510 -  u32 burst_enq;
1511 -  u32 burst_deq;
1512 -
1513 -  u32 pktfield0_slabpos;
1514 -  u32 pktfield1_slabpos;
1515 -  u32 pktfield2_slabpos;
1516 -  u64 pktfield0_slabmask;
1517 -  u64 pktfield1_slabmask;
1518 -  u64 pktfield2_slabmask;
1519 -  u32 tc_table[64];
1520 -
1521 -  struct rte_sched_port_params port;
1522 -  struct rte_sched_subport_params *subport;
1523 -  struct rte_sched_pipe_params *pipe;
1524 -  uint32_t *pipe_map;
1525 -} dpdk_device_config_hqos_t;
1526 -
1527 -int dpdk_hqos_validate_mask (u64 mask, u32 n);
1528 -void dpdk_device_config_hqos_pipe_profile_default (dpdk_device_config_hqos_t *
1529 -                                                  hqos, u32 pipe_profile_id);
1530 -#if 0
1531 -void dpdk_device_config_hqos_default (dpdk_device_config_hqos_t * hqos);
1532 -#endif
1533 -clib_error_t *dpdk_port_setup_hqos (dpdk_device_t * xd,
1534 -                                   dpdk_device_config_hqos_t * hqos);
1535 -void dpdk_hqos_metadata_set (dpdk_device_hqos_per_worker_thread_t * hqos,
1536 -                            struct rte_mbuf **pkts, u32 n_pkts);
1537  
1538  #define foreach_dpdk_device_config_item \
1539    _ (num_rx_queues) \
1540 @@ -333,8 +261,6 @@ typedef struct
1541      foreach_dpdk_device_config_item
1542  #undef _
1543      clib_bitmap_t * workers;
1544 -  u32 hqos_enabled;
1545 -  dpdk_device_config_hqos_t hqos;
1546    u8 tso;
1547    u8 *devargs;
1548  
1549 @@ -397,7 +323,6 @@ typedef struct
1550  
1551    /* Devices */
1552    dpdk_device_t *devices;
1553 -  dpdk_device_and_queue_t **devices_by_hqos_cpu;
1554    dpdk_per_thread_data_t *per_thread_data;
1555  
1556    /* buffer flags template, configurable to enable/disable tcp / udp cksum */
1557 @@ -409,10 +334,6 @@ typedef struct
1558     */
1559    u8 admin_up_down_in_progress;
1560  
1561 -  /* which cpus are running I/O TX */
1562 -  int hqos_cpu_first_index;
1563 -  int hqos_cpu_count;
1564 -
1565    /* control interval of dpdk link state and stat polling */
1566    f64 link_state_poll_interval;
1567    f64 stat_poll_interval;
1568 @@ -502,8 +423,6 @@ format_function_t format_dpdk_tx_offload_caps;
1569  vnet_flow_dev_ops_function_t dpdk_flow_ops_fn;
1570  
1571  clib_error_t *unformat_rss_fn (unformat_input_t * input, uword * rss_fn);
1572 -clib_error_t *unformat_hqos (unformat_input_t * input,
1573 -                            dpdk_device_config_hqos_t * hqos);
1574  
1575  struct rte_pci_device *dpdk_get_pci_device (const struct rte_eth_dev_info
1576                                             *info);
1577 diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c
1578 index 20493eb77..8ef46512c 100644
1579 --- a/src/plugins/dpdk/device/format.c
1580 +++ b/src/plugins/dpdk/device/format.c
1581 @@ -913,25 +913,6 @@ unformat_rss_fn (unformat_input_t * input, uword * rss_fn)
1582    return 0;
1583  }
1584  
1585 -clib_error_t *
1586 -unformat_hqos (unformat_input_t * input, dpdk_device_config_hqos_t * hqos)
1587 -{
1588 -  clib_error_t *error = 0;
1589 -
1590 -  while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
1591 -    {
1592 -      if (unformat (input, "hqos-thread %u", &hqos->hqos_thread))
1593 -       hqos->hqos_thread_valid = 1;
1594 -      else
1595 -       {
1596 -         error = clib_error_return (0, "unknown input `%U'",
1597 -                                    format_unformat_error, input);
1598 -         break;
1599 -       }
1600 -    }
1601 -
1602 -  return error;
1603 -}
1604  
1605  /*
1606   * fd.io coding-style-patch-verification: OFF
1607 diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
1608 index d0125e939..5d0e5a260 100644
1609 --- a/src/plugins/dpdk/device/init.c
1610 +++ b/src/plugins/dpdk/device/init.c
1611 @@ -214,29 +214,9 @@ dpdk_lib_init (dpdk_main_t * dm)
1612    dpdk_device_t *xd;
1613    vlib_pci_addr_t last_pci_addr;
1614    u32 last_pci_addr_port = 0;
1615 -  vlib_thread_registration_t *tr_hqos;
1616 -  uword *p_hqos;
1617 -
1618 -  u32 next_hqos_cpu = 0;
1619    u8 af_packet_instance_num = 0;
1620    last_pci_addr.as_u32 = ~0;
1621  
1622 -  dm->hqos_cpu_first_index = 0;
1623 -  dm->hqos_cpu_count = 0;
1624 -
1625 -  /* find out which cpus will be used for I/O TX */
1626 -  p_hqos = hash_get_mem (tm->thread_registrations_by_name, "hqos-threads");
1627 -  tr_hqos = p_hqos ? (vlib_thread_registration_t *) p_hqos[0] : 0;
1628 -
1629 -  if (tr_hqos && tr_hqos->count > 0)
1630 -    {
1631 -      dm->hqos_cpu_first_index = tr_hqos->first_index;
1632 -      dm->hqos_cpu_count = tr_hqos->count;
1633 -    }
1634 -
1635 -  vec_validate_aligned (dm->devices_by_hqos_cpu, tm->n_vlib_mains - 1,
1636 -                       CLIB_CACHE_LINE_BYTES);
1637 -
1638    nports = rte_eth_dev_count_avail ();
1639  
1640    if (nports < 1)
1641 @@ -596,38 +576,6 @@ dpdk_lib_init (dpdk_main_t * dm)
1642        /* assign interface to input thread */
1643        int q;
1644  
1645 -      if (devconf->hqos_enabled)
1646 -       {
1647 -         xd->flags |= DPDK_DEVICE_FLAG_HQOS;
1648 -
1649 -         int cpu;
1650 -         if (devconf->hqos.hqos_thread_valid)
1651 -           {
1652 -             if (devconf->hqos.hqos_thread >= dm->hqos_cpu_count)
1653 -               return clib_error_return (0, "invalid HQoS thread index");
1654 -
1655 -             cpu = dm->hqos_cpu_first_index + devconf->hqos.hqos_thread;
1656 -           }
1657 -         else
1658 -           {
1659 -             if (dm->hqos_cpu_count == 0)
1660 -               return clib_error_return (0, "no HQoS threads available");
1661 -
1662 -             cpu = dm->hqos_cpu_first_index + next_hqos_cpu;
1663 -
1664 -             next_hqos_cpu++;
1665 -             if (next_hqos_cpu == dm->hqos_cpu_count)
1666 -               next_hqos_cpu = 0;
1667 -
1668 -             devconf->hqos.hqos_thread_valid = 1;
1669 -             devconf->hqos.hqos_thread = cpu;
1670 -           }
1671 -
1672 -         dpdk_device_and_queue_t *dq;
1673 -         vec_add2 (dm->devices_by_hqos_cpu[cpu], dq, 1);
1674 -         dq->device = xd->device_index;
1675 -         dq->queue_id = 0;
1676 -       }
1677  
1678        error = ethernet_register_interface
1679         (dm->vnet_main, dpdk_device_class.index, xd->device_index,
1680 @@ -770,14 +718,6 @@ dpdk_lib_init (dpdk_main_t * dm)
1681                       format_dpdk_device_name, i,
1682                       format_dpdk_device_errors, xd);
1683  
1684 -      if (devconf->hqos_enabled)
1685 -       {
1686 -         clib_error_t *rv;
1687 -         rv = dpdk_port_setup_hqos (xd, &devconf->hqos);
1688 -         if (rv)
1689 -           return rv;
1690 -       }
1691 -
1692        /*
1693         * A note on Cisco VIC (PMD_ENIC) and VLAN:
1694         *
1695 @@ -1060,11 +1000,7 @@ dpdk_device_config (dpdk_config_main_t * conf, vlib_pci_addr_t pci_addr,
1696      }
1697  
1698    devconf->pci_addr.as_u32 = pci_addr.as_u32;
1699 -  devconf->hqos_enabled = 0;
1700    devconf->tso = DPDK_DEVICE_TSO_DEFAULT;
1701 -#if 0
1702 -  dpdk_device_config_hqos_default (&devconf->hqos);
1703 -#endif
1704  
1705    if (!input)
1706      return 0;
1707 @@ -1097,19 +1033,6 @@ dpdk_device_config (dpdk_config_main_t * conf, vlib_pci_addr_t pci_addr,
1708         devconf->vlan_strip_offload = DPDK_DEVICE_VLAN_STRIP_OFF;
1709        else if (unformat (input, "vlan-strip-offload on"))
1710         devconf->vlan_strip_offload = DPDK_DEVICE_VLAN_STRIP_ON;
1711 -      else
1712 -       if (unformat
1713 -           (input, "hqos %U", unformat_vlib_cli_sub_input, &sub_input))
1714 -       {
1715 -         devconf->hqos_enabled = 1;
1716 -         error = unformat_hqos (&sub_input, &devconf->hqos);
1717 -         if (error)
1718 -           break;
1719 -       }
1720 -      else if (unformat (input, "hqos"))
1721 -       {
1722 -         devconf->hqos_enabled = 1;
1723 -       }
1724        else if (unformat (input, "tso on"))
1725         {
1726           devconf->tso = DPDK_DEVICE_TSO_ON;