FD.io VPP  v19.04.4-rc0-5-ge88582fac
Vector Packet Processing
cli.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Intel and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <vnet/vnet.h>
17 #include <dpdk/device/dpdk.h>
18 #include <dpdk/ipsec/ipsec.h>
19 
20 static u8 *
21 format_crypto_resource (u8 * s, va_list * args)
22 {
24 
25  u32 indent = va_arg (*args, u32);
26  u32 res_idx = va_arg (*args, u32);
27 
28  crypto_resource_t *res = vec_elt_at_index (dcm->resource, res_idx);
29 
30 
31  s = format (s, "%U thr_id %3d qp %2u enc_inflight %u, dec_inflights %u\n",
32  format_white_space, indent, (i16) res->thread_idx,
33  res->qp_id, res->inflights[0], res->inflights[1]);
34 
35  return s;
36 }
37 
38 static u8 *
39 format_crypto (u8 * s, va_list * args)
40 {
42  crypto_dev_t *dev = va_arg (*args, crypto_dev_t *);
43  crypto_drv_t *drv = vec_elt_at_index (dcm->drv, dev->drv_id);
44  u64 feat, mask;
45  u32 i;
46  char *pre = " ";
47 
48  s = format (s, "%-25s%-20s%-10s\n", dev->name, drv->name,
49  rte_cryptodevs[dev->id].data->dev_started ? "up" : "down");
50  s = format (s, " numa_node %u, max_queues %u\n", dev->numa, dev->max_qp);
51 
52  if (dev->features)
53  {
54  for (mask = 1; mask != 0; mask <<= 1)
55  {
56  feat = dev->features & mask;
57  if (feat)
58  {
59  s =
60  format (s, "%s%s", pre,
61  rte_cryptodev_get_feature_name (feat));
62  pre = ", ";
63  }
64  }
65  s = format (s, "\n");
66  }
67 
68  s = format (s, " Cipher:");
69  pre = " ";
70  for (i = 0; i < IPSEC_CRYPTO_N_ALG; i++)
71  if (dev->cipher_support[i])
72  {
73  s = format (s, "%s%s", pre, dcm->cipher_algs[i].name);
74  pre = ", ";
75  }
76  s = format (s, "\n");
77 
78  s = format (s, " Auth:");
79  pre = " ";
80  for (i = 0; i < IPSEC_INTEG_N_ALG; i++)
81  if (dev->auth_support[i])
82  {
83  s = format (s, "%s%s", pre, dcm->auth_algs[i].name);
84  pre = ", ";
85  }
86  s = format (s, "\n");
87 
88  struct rte_cryptodev_stats stats;
89  rte_cryptodev_stats_get (dev->id, &stats);
90 
91  s =
92  format (s,
93  " enqueue %-10lu dequeue %-10lu enqueue_err %-10lu dequeue_err %-10lu \n",
94  stats.enqueued_count, stats.dequeued_count,
95  stats.enqueue_err_count, stats.dequeue_err_count);
96 
97  u16 *res_idx;
98  s = format (s, " free_resources %u :", vec_len (dev->free_resources));
99 
100  u32 indent = format_get_indent (s);
101  s = format (s, "\n");
102 
103  /* *INDENT-OFF* */
104  vec_foreach (res_idx, dev->free_resources)
105  s = format (s, "%U", format_crypto_resource, indent, res_idx[0]);
106  /* *INDENT-ON* */
107 
108  s = format (s, " used_resources %u :", vec_len (dev->used_resources));
109  indent = format_get_indent (s);
110 
111  s = format (s, "\n");
112 
113  /* *INDENT-OFF* */
114  vec_foreach (res_idx, dev->used_resources)
115  s = format (s, "%U", format_crypto_resource, indent, res_idx[0]);
116  /* *INDENT-ON* */
117 
118  s = format (s, "\n");
119 
120  return s;
121 }
122 
123 
124 static clib_error_t *
126  vlib_cli_command_t * cmd)
127 {
129  crypto_dev_t *dev;
130 
131  /* *INDENT-OFF* */
132  vec_foreach (dev, dcm->dev)
133  rte_cryptodev_stats_reset (dev->id);
134  /* *INDENT-ON* */
135 
136  return NULL;
137 }
138 
139 /*?
140  * This command is used to clear the DPDK Crypto device statistics.
141  *
142  * @cliexpar
143  * Example of how to clear the DPDK Crypto device statistics:
144  * @cliexsart{clear dpdk crypto devices statistics}
145  * vpp# clear dpdk crypto devices statistics
146  * @cliexend
147  * Example of clearing the DPDK Crypto device statistic data:
148  * @cliexend
149 ?*/
150 /* *INDENT-OFF* */
151 VLIB_CLI_COMMAND (clear_dpdk_crypto_stats, static) = {
152  .path = "clear dpdk crypto devices statistics",
153  .short_help = "clear dpdk crypto devices statistics",
154  .function = clear_crypto_stats_fn,
155 };
156 /* *INDENT-ON* */
157 
158 
159 static clib_error_t *
161  vlib_cli_command_t * cmd)
162 {
164  crypto_dev_t *dev;
165 
166  /* *INDENT-OFF* */
167  vec_foreach (dev, dcm->dev)
168  vlib_cli_output (vm, "%U", format_crypto, dev);
169  /* *INDENT-ON* */
170 
171  return NULL;
172 }
173 
174 /*?
175  * This command is used to display the DPDK Crypto device information.
176  *
177  * @cliexpar
178  * Example of how to display the DPDK Crypto device information:
179  * @cliexsart{show dpdk crypto devices}
180  * vpp# show dpdk crypto devices
181  * aesni_mb0 crypto_aesni_mb up
182  * numa_node 0, max_queues 4
183  * SYMMETRIC_CRYPTO, SYM_OPERATION_CHAINING, CPU_AVX2, CPU_AESNI
184  * Cipher: aes-cbc-128, aes-cbc-192, aes-cbc-256, aes-ctr-128, aes-ctr-192, aes-ctr-256, aes-gcm-128, aes-gcm-192, aes-gcm-256
185  * Auth: md5-96, sha1-96, sha-256-128, sha-384-192, sha-512-256
186  * enqueue 2 dequeue 2 enqueue_err 0 dequeue_err 0
187  * free_resources 3 :
188  * thr_id -1 qp 3 inflight 0
189  * thr_id -1 qp 2 inflight 0
190  * thr_id -1 qp 1 inflight 0
191  * used_resources 1 :
192  * thr_id 1 qp 0 inflight 0
193  * @cliexend
194  * Example of displaying the DPDK Crypto device data when enabled:
195  * @cliexend
196 ?*/
197 /* *INDENT-OFF* */
198 VLIB_CLI_COMMAND (show_dpdk_crypto, static) = {
199  .path = "show dpdk crypto devices",
200  .short_help = "show dpdk crypto devices",
201  .function = show_dpdk_crypto_fn,
202 };
203 
204 /* *INDENT-ON* */
205 static u8 *
206 format_crypto_worker (u8 * s, va_list * args)
207 {
208  u32 thread_idx = va_arg (*args, u32);
209  u8 verbose = (u8) va_arg (*args, u32);
212  crypto_resource_t *res;
213  u16 *res_idx;
214  char *pre, *ind;
215  u32 i;
216 
217  cwm = vec_elt_at_index (dcm->workers_main, thread_idx);
218 
219  s = format (s, "Thread %u (%v):\n", thread_idx,
220  vlib_worker_threads[thread_idx].name);
221 
222  /* *INDENT-OFF* */
223  vec_foreach (res_idx, cwm->resource_idx)
224  {
225  ind = " ";
226  res = vec_elt_at_index (dcm->resource, res_idx[0]);
227  s = format (s, "%s%-20s dev-id %2u queue-pair %2u\n",
228  ind, vec_elt_at_index (dcm->dev, res->dev_id)->name,
229  res->dev_id, res->qp_id);
230 
231  ind = " ";
232  if (verbose)
233  {
234  s = format (s, "%sCipher:", ind);
235  pre = " ";
236  for (i = 0; i < IPSEC_CRYPTO_N_ALG; i++)
237  if (cwm->cipher_resource_idx[i] == res_idx[0])
238  {
239  s = format (s, "%s%s", pre, dcm->cipher_algs[i].name);
240  pre = ", ";
241  }
242  s = format (s, "\n");
243 
244  s = format (s, "%sAuth:", ind);
245  pre = " ";
246  for (i = 0; i < IPSEC_INTEG_N_ALG; i++)
247  if (cwm->auth_resource_idx[i] == res_idx[0])
248  {
249  s = format (s, "%s%s", pre, dcm->auth_algs[i].name);
250  pre = ", ";
251  }
252  s = format (s, "\n");
253  }
254  }
255  /* *INDENT-ON* */
256 
257  return s;
258 }
259 
260 static clib_error_t *
262  vlib_cli_command_t * cmd, u8 verbose)
263 {
265  clib_error_t *error = NULL;
266  u32 i;
267  u8 skip_master;
268 
269  if (!dcm->enabled)
270  {
271  vlib_cli_output (vm, "\nDPDK Cryptodev support is disabled\n");
272  return error;
273  }
274 
275  skip_master = vlib_num_workers () > 0;
276 
277  /* *INDENT-OFF* */
279  {
280  if (i < skip_master)
281  continue;
282 
283  vlib_cli_output (vm, "%U\n", format_crypto_worker, i, verbose);
284  }
285  /* *INDENT-ON* */
286 
287  return error;
288 }
289 
290 static clib_error_t *
292  vlib_cli_command_t * cmd)
293 {
294  return common_crypto_placement_fn (vm, input, cmd, 0);
295 }
296 
297 static clib_error_t *
299  vlib_cli_command_t * cmd)
300 {
301  return common_crypto_placement_fn (vm, input, cmd, 1);
302 }
303 
304 /*?
305  * This command is used to display the DPDK Crypto device placement.
306  *
307  * @cliexpar
308  * Example of displaying the DPDK Crypto device placement:
309  * @cliexstart{show dpdk crypto placement}
310  * vpp# show dpdk crypto placement
311  * Thread 1 (vpp_wk_0):
312  * cryptodev_aesni_mb_p dev-id 0 queue-pair 0
313  * cryptodev_aesni_gcm_ dev-id 1 queue-pair 0
314  *
315  * Thread 2 (vpp_wk_1):
316  * cryptodev_aesni_mb_p dev-id 0 queue-pair 1
317  * cryptodev_aesni_gcm_ dev-id 1 queue-pair 1
318  * @cliexend
319 ?*/
320 /* *INDENT-OFF* */
321 VLIB_CLI_COMMAND (show_dpdk_crypto_placement, static) = {
322  .path = "show dpdk crypto placement",
323  .short_help = "show dpdk crypto placement",
324  .function = show_dpdk_crypto_placement_fn,
325 };
326 /* *INDENT-ON* */
327 
328 /*?
329  * This command is used to display the DPDK Crypto device placement
330  * with verbose output.
331  *
332  * @cliexpar
333  * Example of displaying the DPDK Crypto device placement verbose:
334  * @cliexstart{show dpdk crypto placement verbose}
335  * vpp# show dpdk crypto placement verbose
336  * Thread 1 (vpp_wk_0):
337  * cryptodev_aesni_mb_p dev-id 0 queue-pair 0
338  * Cipher: aes-cbc-128, aes-cbc-192, aes-cbc-256, aes-ctr-128, aes-ctr-192, aes-ctr-256
339  * Auth: md5-96, sha1-96, sha-256-128, sha-384-192, sha-512-256
340  * cryptodev_aesni_gcm_ dev-id 1 queue-pair 0
341  * Cipher: aes-gcm-128, aes-gcm-192, aes-gcm-256
342  * Auth:
343  *
344  * Thread 2 (vpp_wk_1):
345  * cryptodev_aesni_mb_p dev-id 0 queue-pair 1
346  * Cipher: aes-cbc-128, aes-cbc-192, aes-cbc-256, aes-ctr-128, aes-ctr-192, aes-ctr-256
347  * Auth: md5-96, sha1-96, sha-256-128, sha-384-192, sha-512-256
348  * cryptodev_aesni_gcm_ dev-id 1 queue-pair 1
349  * Cipher: aes-gcm-128, aes-gcm-192, aes-gcm-256
350  * Auth:
351  *
352  * @cliexend
353 ?*/
354 /* *INDENT-OFF* */
355 VLIB_CLI_COMMAND (show_dpdk_crypto_placement_v, static) = {
356  .path = "show dpdk crypto placement verbose",
357  .short_help = "show dpdk crypto placement verbose",
359 };
360 /* *INDENT-ON* */
361 
362 static clib_error_t *
364  unformat_input_t * input,
365  vlib_cli_command_t * cmd)
366 {
367  unformat_input_t _line_input, *line_input = &_line_input;
370  crypto_dev_t *dev;
371  u32 thread_idx, i;
372  u16 res_idx, *idx;
373  u8 dev_idx, auto_en = 0;
374 
375  if (!unformat_user (input, unformat_line_input, line_input))
376  return clib_error_return (0, "invalid syntax");
377 
378  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
379  {
380  if (unformat (line_input, "%u %u", &dev_idx, &thread_idx))
381  ;
382  else if (unformat (line_input, "auto"))
383  auto_en = 1;
384  else
385  {
386  unformat_free (line_input);
387  return clib_error_return (0, "parse error: '%U'",
388  format_unformat_error, line_input);
389  }
390  }
391 
392  unformat_free (line_input);
393 
394  if (auto_en)
395  {
397  return 0;
398  }
399 
400  /* TODO support device name */
401 
402  if (!(dev_idx < vec_len (dcm->dev)))
403  return clib_error_return (0, "please specify valid device index");
404 
405  if (thread_idx != (u32) ~ 0 && !(thread_idx < vec_len (dcm->workers_main)))
406  return clib_error_return (0, "invalid thread index");
407 
408  dev = vec_elt_at_index (dcm->dev, dev_idx);
409  if (!(vec_len (dev->free_resources)))
410  return clib_error_return (0, "all device resources are being used");
411 
412  /* Check thread is not already using the device */
413  /* *INDENT-OFF* */
414  vec_foreach (idx, dev->used_resources)
415  if (dcm->resource[idx[0]].thread_idx == thread_idx)
416  return clib_error_return (0, "thread %u already using device %u",
417  thread_idx, dev_idx);
418  /* *INDENT-ON* */
419 
420  res_idx = vec_pop (dev->free_resources);
421  vec_add1 (dev->used_resources, res_idx);
422 
423  cwm = vec_elt_at_index (dcm->workers_main, thread_idx);
424 
425  ASSERT (dcm->resource[res_idx].thread_idx == (u16) ~ 0);
426  dcm->resource[res_idx].thread_idx = thread_idx;
427 
428  /* Add device to vector of polling resources */
429  vec_add1 (cwm->resource_idx, res_idx);
430 
431  /* Set device as default for all supported algos */
432  for (i = 0; i < IPSEC_CRYPTO_N_ALG; i++)
433  if (dev->cipher_support[i])
434  {
435  if (cwm->cipher_resource_idx[i] == (u16) ~ 0)
436  dcm->cipher_algs[i].disabled--;
437  cwm->cipher_resource_idx[i] = res_idx;
438  }
439 
440  for (i = 0; i < IPSEC_INTEG_N_ALG; i++)
441  if (dev->auth_support[i])
442  {
443  if (cwm->auth_resource_idx[i] == (u16) ~ 0)
444  dcm->auth_algs[i].disabled--;
445  cwm->auth_resource_idx[i] = res_idx;
446  }
447 
448  /* Check if any unused resource */
449 
450  u8 used = 0;
451  /* *INDENT-OFF* */
452  vec_foreach (idx, cwm->resource_idx)
453  {
454  if (idx[0] == res_idx)
455  continue;
456 
457  for (i = 0; i < IPSEC_CRYPTO_N_ALG; i++)
458  used |= cwm->cipher_resource_idx[i] == idx[0];
459 
460  for (i = 0; i < IPSEC_INTEG_N_ALG; i++)
461  used |= cwm->auth_resource_idx[i] == idx[0];
462 
463  vec_elt_at_index (dcm->resource, idx[0])->remove = !used;
464  }
465  /* *INDENT-ON* */
466 
467  return 0;
468 }
469 
470 /* *INDENT-OFF* */
471 VLIB_CLI_COMMAND (set_dpdk_crypto_placement, static) = {
472  .path = "set dpdk crypto placement",
473  .short_help = "set dpdk crypto placement (<device> <thread> | auto)",
474  .function = set_dpdk_crypto_placement_fn,
475 };
476 /* *INDENT-ON* */
477 
478 /*
479  * The thread will not enqueue more operations to the device but will poll
480  * from it until there are no more inflight operations.
481 */
482 static void
484 {
486  crypto_resource_t *res = vec_elt_at_index (dcm->resource, res_idx);
487  crypto_worker_main_t *cwm = &dcm->workers_main[res->thread_idx];
488  u32 i;
489 
490  for (i = 0; i < IPSEC_CRYPTO_N_ALG; i++)
491  if (cwm->cipher_resource_idx[i] == res_idx)
492  {
493  cwm->cipher_resource_idx[i] = (u16) ~ 0;
494  dcm->cipher_algs[i].disabled++;
495  }
496 
497  for (i = 0; i < IPSEC_INTEG_N_ALG; i++)
498  if (cwm->auth_resource_idx[i] == res_idx)
499  {
500  cwm->auth_resource_idx[i] = (u16) ~ 0;
501  dcm->auth_algs[i].disabled++;
502  }
503 
504  /* Fully remove device on crypto_node once there are no inflights */
505  res->remove = 1;
506 }
507 
508 static clib_error_t *
511  input, vlib_cli_command_t * cmd)
512 {
513  unformat_input_t _line_input, *line_input = &_line_input;
515  crypto_dev_t *dev;
516  u32 thread_idx = (u32) ~ 0;
517  u16 *res_idx;
518  u8 dev_idx = (u8) ~ 0;
519  u8 free_all = 0;
520 
521  if (!unformat_user (input, unformat_line_input, line_input))
522  return clib_error_return (0, "invalid syntax");
523 
524  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
525  {
526  if (unformat (line_input, "%u %u", &dev_idx, &thread_idx))
527  ;
528  else if (unformat (line_input, "%u", &dev_idx))
529  free_all = 1;
530  else
531  {
532  unformat_free (line_input);
533  return clib_error_return (0, "parse error: '%U'",
534  format_unformat_error, line_input);
535  }
536  }
537 
538  unformat_free (line_input);
539 
540  if (!(dev_idx < vec_len (dcm->dev)))
541  return clib_error_return (0, "invalid device index");
542 
543  dev = vec_elt_at_index (dcm->dev, dev_idx);
544 
545  /* Clear all resources placements */
546  if (free_all)
547  {
548  /* *INDENT-OFF* */
549  vec_foreach (res_idx, dev->used_resources)
550  dpdk_crypto_clear_resource (res_idx[0]);
551  /* *INDENT-ON* */
552 
553  return 0;
554  }
555 
556  if (!(thread_idx < vec_len (dcm->workers_main)))
557  return clib_error_return (0, "invalid thread index");
558 
559  /* Clear placement of device for given thread index */
560  /* *INDENT-OFF* */
561  vec_foreach (res_idx, dev->used_resources)
562  if (dcm->resource[res_idx[0]].thread_idx == thread_idx)
563  break;
564  /* *INDENT-ON* */
565 
566  if (!(res_idx < vec_end (dev->used_resources)))
567  return clib_error_return (0, "thread %u is not using device %u",
568  thread_idx, dev_idx);
569 
570  dpdk_crypto_clear_resource (res_idx[0]);
571 
572  return 0;
573 }
574 
575 /* *INDENT-OFF* */
576 VLIB_CLI_COMMAND (clear_dpdk_crypto_placement, static) = {
577  .path = "clear dpdk crypto placement",
578  .short_help = "clear dpdk crypto placement <device> [<thread>]",
579  .function = clear_dpdk_crypto_placement_fn,
580 };
581 /* *INDENT-ON* */
582 
583 u8 *
584 format_dpdk_mempool (u8 * s, va_list * args)
585 {
586  struct rte_mempool *mp = va_arg (*args, struct rte_mempool *);
587  u32 indent = format_get_indent (s);
588  u32 count = rte_mempool_avail_count (mp);
589 
590  s = format (s, "%s\n%Uavailable %7d, allocated %7d total %7d\n",
591  mp->name, format_white_space, indent + 2,
592  count, mp->size - count, mp->size);
593  s = format (s, "%Uphys_addr %p, flags %08x, nb_mem_chunks %u\n",
594  format_white_space, indent + 2,
595  mp->mz->phys_addr, mp->flags, mp->nb_mem_chunks);
596  s = format (s, "%Uelt_size %4u, header_size %3u, trailer_size %u\n",
597  format_white_space, indent + 2,
598  mp->elt_size, mp->header_size, mp->trailer_size);
599  s = format (s, "%Uprivate_data_size %3u, total_elt_size %u\n",
600  format_white_space, indent + 2,
601  mp->private_data_size,
602  mp->elt_size + mp->header_size + mp->trailer_size);
603  return s;
604 }
605 
606 static clib_error_t *
608  unformat_input_t * input, vlib_cli_command_t * cmd)
609 {
612 
613  /* *INDENT-OFF* */
614  vec_foreach (data, dcm->data)
615  {
616  if (data->crypto_op)
617  vlib_cli_output (vm, "%U\n", format_dpdk_mempool, data->crypto_op);
618  if (data->session_h)
619  vlib_cli_output (vm, "%U\n", format_dpdk_mempool, data->session_h);
620 
621  struct rte_mempool **mp;
622  vec_foreach (mp, data->session_drv)
623  if (mp[0])
624  vlib_cli_output (vm, "%U\n", format_dpdk_mempool, mp[0]);
625  }
626  /* *INDENT-ON* */
627 
628  return NULL;
629 }
630 
631 /*?
632  * This command is used to display the DPDK Crypto pools information.
633  *
634  * @cliexpar
635  * Example of how to display the DPDK Crypto pools information:
636  * @cliexstart{show crypto device mapping}
637  * vpp# show dpdk crypto pools
638  * crypto_pool_numa1
639  * available 15872, allocated 512 total 16384
640  * phys_addr 0xf3d2086c0, flags 00000010, nb_mem_chunks 1
641  * elt_size 160, header_size 64, trailer_size 96
642  * private_data_size 64, total_elt_size 320
643  *
644  * session_h_pool_numa1
645  * available 19998, allocated 2 total 20000
646  * phys_addr 0xf3c9c4380, flags 00000010, nb_mem_chunks 1
647  * elt_size 40, header_size 64, trailer_size 88
648  * private_data_size 0, total_elt_size 192
649  *
650  * session_drv0_pool_numa1
651  * available 19998, allocated 2 total 20000
652  * phys_addr 0xf3ad42d80, flags 00000010, nb_mem_chunks 1
653  * elt_size 512, header_size 64, trailer_size 0
654  * private_data_size 0, total_elt_size 576
655  * @cliexend
656 ?*/
657 /* *INDENT-OFF* */
658 VLIB_CLI_COMMAND (show_dpdk_crypto_pools, static) = {
659  .path = "show dpdk crypto pools",
660  .short_help = "show dpdk crypto pools",
661  .function = show_dpdk_crypto_pools_fn,
662 };
663 /* *INDENT-ON* */
664 
665 /* TODO Allow user define number of sessions supported */
666 /* TODO Allow user define descriptor queue size */
667 
668 /*
669  * fd.io coding-style-patch-verification: ON
670  *
671  * Local Variables:
672  * eval: (c-set-style "gnu")
673  * End:
674  */
#define vec_foreach_index(var, v)
Iterate over vector indices.
static clib_error_t * clear_crypto_stats_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:125
static clib_error_t * show_dpdk_crypto_placement_v_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:298
unsigned long u64
Definition: types.h:89
#define NULL
Definition: clib.h:58
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:522
for(i=1;i<=collision_buckets;i++)
int i
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:983
static u32 format_get_indent(u8 *s)
Definition: format.h:72
u8 disabled
Definition: ipsec.h:91
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:424
u8 data[128]
Definition: ipsec.api:248
unsigned char u8
Definition: types.h:56
#define vec_pop(V)
Returns last element of a vector and decrements its length.
Definition: vec.h:615
u16 * resource_idx
Definition: ipsec.h:74
u16 cipher_resource_idx[IPSEC_CRYPTO_N_ALG]
Definition: ipsec.h:76
dpdk_crypto_main_t dpdk_crypto_main
Definition: ipsec.c:25
u8 * format_white_space(u8 *s, va_list *va)
Definition: std-formats.c:113
static clib_error_t * show_dpdk_crypto_pools_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:607
crypto_drv_t * drv
Definition: ipsec.h:168
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
u8 drv_id
Definition: ipsec.h:101
#define clib_error_return(e, args...)
Definition: error.h:99
u16 * free_resources
Definition: ipsec.h:97
unsigned int u32
Definition: types.h:88
#define vec_end(v)
End (last data address) of vector.
crypto_alg_t * auth_algs
Definition: ipsec.h:166
unformat_function_t unformat_line_input
Definition: format.h:282
u16 * used_resources
Definition: ipsec.h:98
vlib_worker_thread_t * vlib_worker_threads
Definition: threads.c:36
crypto_alg_t * cipher_algs
Definition: ipsec.h:165
struct _unformat_input_t unformat_input_t
unsigned short u16
Definition: types.h:57
const char * name
Definition: ipsec.h:111
u64 features
Definition: ipsec.h:106
u8 * format_dpdk_mempool(u8 *s, va_list *args)
Definition: cli.c:584
static u8 * format_crypto(u8 *s, va_list *args)
Definition: cli.c:39
static u8 * format_crypto_worker(u8 *s, va_list *args)
Definition: cli.c:206
u8 name[64]
Definition: memclnt.api:152
struct rte_mempool ** session_drv
Definition: ipsec.h:148
#define UNFORMAT_END_OF_INPUT
Definition: format.h:144
vlib_main_t * vm
Definition: buffer.c:312
static void dpdk_crypto_clear_resource(u16 res_idx)
Definition: cli.c:483
u16 id
Definition: ipsec.h:103
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:155
#define ASSERT(truth)
struct rte_mempool * crypto_op
Definition: ipsec.h:146
u32 max_qp
Definition: ipsec.h:105
u16 inflights[2]
Definition: ipsec.h:123
crypto_worker_main_t * workers_main
Definition: ipsec.h:162
static clib_error_t * show_dpdk_crypto_placement_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:291
static u8 * format_crypto_resource(u8 *s, va_list *args)
Definition: cli.c:21
size_t count
Definition: vapi.c:47
crypto_resource_t * resource
Definition: ipsec.h:164
struct rte_mempool * session_h
Definition: ipsec.h:147
char * name
Definition: ipsec.h:84
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void crypto_auto_placement(void)
Definition: ipsec.c:749
static clib_error_t * set_dpdk_crypto_placement_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:363
static void unformat_free(unformat_input_t *i)
Definition: format.h:162
const char * name
Definition: ipsec.h:104
crypto_dev_t * dev
Definition: ipsec.h:163
crypto_data_t * data
Definition: ipsec.h:167
static clib_error_t * clear_dpdk_crypto_placement_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:509
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
static u32 vlib_num_workers()
Definition: threads.h:366
static clib_error_t * common_crypto_placement_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd, u8 verbose)
Definition: cli.c:261
u16 auth_resource_idx[IPSEC_INTEG_N_ALG]
Definition: ipsec.h:77
u8 auth_support[IPSEC_INTEG_N_ALG]
Definition: ipsec.h:100
#define vec_foreach(var, vec)
Vector iterator.
static clib_error_t * show_dpdk_crypto_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:160
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:762
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:972
u8 cipher_support[IPSEC_CRYPTO_N_ALG]
Definition: ipsec.h:99
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:170
signed short i16
Definition: types.h:46