NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
erasure_coding_recover_main.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 NVIDIA CORPORATION AND AFFILIATES. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification, are permitted
5  * provided that the following conditions are met:
6  * * Redistributions of source code must retain the above copyright notice, this list of
7  * conditions and the following disclaimer.
8  * * Redistributions in binary form must reproduce the above copyright notice, this list of
9  * conditions and the following disclaimer in the documentation and/or other materials
10  * provided with the distribution.
11  * * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
12  * to endorse or promote products derived from this software without specific prior written
13  * permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
19  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
21  * STRICT LIABILITY, OR TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  *
24  */
25 
26 #include <stdbool.h>
27 #include <stdlib.h>
28 #include <string.h>
29 
30 #include <doca_argp.h>
31 #include <doca_dev.h>
32 #include <doca_erasure_coding.h>
33 #include <doca_error.h>
34 #include <doca_log.h>
35 
36 #include <utils.h>
37 
38 DOCA_LOG_REGISTER(EC_RECOVER::MAIN);
39 
40 #define USER_MAX_PATH_NAME 255 /* max file name length */
41 #define MAX_PATH_NAME (USER_MAX_PATH_NAME + 1) /* max file name string length */
42 #define MAX_BLOCKS (128 + 32) /* ec blocks up to 128 in, 32 out */
43 
44 /* Configuration struct */
45 struct ec_cfg {
46  char input_path[MAX_PATH_NAME]; /* input file to encode or input blocks dir to decode */
47  char output_path[MAX_PATH_NAME]; /* output might be a file or a folder - depends on the input and do_both */
48  char pci_address[DOCA_DEVINFO_PCI_ADDR_SIZE]; /* device PCI address */
49  bool do_both; /* to do full process - encoding & decoding */
50  enum doca_ec_matrix_type matrix; /* ec matrix type */
51  uint32_t data_block_count; /* data block count */
52  uint32_t rdnc_block_count; /* redundancy block count */
53  size_t n_delete_block; /* number of deleted block indices */
54  uint32_t delete_block_indices[MAX_BLOCKS]; /* indices of data blocks to delete */
55  int num_src_buf; /* Number of linked_list doca_buf element for the source buffer */
56  int num_dst_buf; /* Number of linked_list doca_buf element for the destination buffer */
57 };
58 
59 /* Sample's Logic */
60 doca_error_t ec_recover(const char *pci_addr,
61  const char *input_path,
62  const char *output_path,
63  bool do_both,
64  enum doca_ec_matrix_type matrix_type,
65  uint32_t data_block_count,
66  uint32_t rdnc_block_count,
67  uint32_t *missing_indices,
68  size_t n_missing,
69  int num_src_buf,
70  int num_dst_buf);
71 
72 /*
73  * ARGP Callback - Handle PCI device address parameter
74  *
75  * @param [in]: Input parameter
76  * @config [in/out]: Program configuration context
77  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
78  */
79 static doca_error_t pci_address_callback(void *param, void *config)
80 {
81  struct ec_cfg *ec_cfg = (struct ec_cfg *)config;
82  char *pci_address = (char *)param;
83  int len;
84 
87  DOCA_LOG_ERR("Entered device PCI address exceeding the maximum size of %d",
90  }
91  strncpy(ec_cfg->pci_address, pci_address, len + 1);
92  return DOCA_SUCCESS;
93 }
94 
95 /*
96  * ARGP Callback - Handle user input path parameter
97  *
98  * @param [in]: Input parameter
99  * @config [in/out]: Program configuration context
100  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
101  */
102 static doca_error_t input_path_callback(void *param, void *config)
103 {
104  struct ec_cfg *ec_cfg = (struct ec_cfg *)config;
105  char *path = (char *)param;
106  int len;
107 
108  len = strnlen(path, MAX_PATH_NAME);
109  if (len >= MAX_PATH_NAME) {
110  DOCA_LOG_ERR("Invalid input path name length, max %d", USER_MAX_PATH_NAME);
112  }
113  if (access(path, F_OK) == -1) {
114  DOCA_LOG_ERR("Input file/folder not found %s", ec_cfg->input_path);
115  return DOCA_ERROR_NOT_FOUND;
116  }
117  strcpy(ec_cfg->input_path, path);
118  return DOCA_SUCCESS;
119 }
120 
121 /*
122  * ARGP Callback - Handle user output path parameter
123  *
124  * @param [in]: Input parameter
125  * @config [in/out]: Program configuration context
126  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
127  */
128 static doca_error_t output_path_callback(void *param, void *config)
129 {
130  struct ec_cfg *ec_cfg = (struct ec_cfg *)config;
131  char *file = (char *)param;
132  int len;
133 
134  len = strnlen(file, MAX_PATH_NAME);
135  if (len >= MAX_PATH_NAME) {
136  DOCA_LOG_ERR("Invalid output path name length, max %d", USER_MAX_PATH_NAME);
138  }
139  if (access(ec_cfg->output_path, F_OK) == -1) {
140  DOCA_LOG_ERR("Output file/folder not found %s", ec_cfg->output_path);
141  return DOCA_ERROR_NOT_FOUND;
142  }
143  strcpy(ec_cfg->output_path, file);
144  return DOCA_SUCCESS;
145 }
146 
147 /*
148  * ARGP Callback - Handle do both parameter
149  *
150  * @param [in]: Input parameter
151  * @config [in/out]: Program configuration context
152  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
153  */
154 static doca_error_t do_both_callback(void *param, void *config)
155 {
156  struct ec_cfg *ec_cfg = (struct ec_cfg *)config;
157 
158  ec_cfg->do_both = *(bool *)param;
159 
160  return DOCA_SUCCESS;
161 }
162 
163 /*
164  * ARGP Callback - Handle matrix parameter
165  *
166  * @param [in]: Input parameter
167  * @config [in/out]: Program configuration context
168  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
169  */
170 static doca_error_t matrix_callback(void *param, void *config)
171 {
172  struct ec_cfg *ec_cfg = (struct ec_cfg *)config;
173  char *matrix = (char *)param;
174 
175  if (strcasecmp(matrix, "cauchy") == 0)
177  else if (strcasecmp(matrix, "vandermonde") == 0)
179  else {
180  DOCA_LOG_ERR("Illegal mode = [%s]", matrix);
182  }
183  return DOCA_SUCCESS;
184 }
185 
186 /*
187  * ARGP Callback - Handle data block count parameter
188  *
189  * @param [in]: Input parameter
190  * @config [in/out]: Program configuration context
191  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
192  */
193 static doca_error_t data_block_count_callback(void *param, void *config)
194 {
195  struct ec_cfg *ec_cfg = (struct ec_cfg *)config;
196 
197  ec_cfg->data_block_count = *(uint32_t *)param;
198  if (ec_cfg->data_block_count <= 0) {
199  DOCA_LOG_ERR("Data block size should be bigger than 0");
201  }
202  return DOCA_SUCCESS;
203 }
204 
205 /*
206  * ARGP Callback - Handle redundancy block count parameter
207  *
208  * @param [in]: Input parameter
209  * @config [in/out]: Program configuration context
210  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
211  */
212 static doca_error_t rdnc_block_count_callback(void *param, void *config)
213 {
214  struct ec_cfg *ec_cfg = (struct ec_cfg *)config;
215 
216  ec_cfg->rdnc_block_count = *(uint32_t *)param;
217  if (ec_cfg->rdnc_block_count <= 0) {
218  DOCA_LOG_ERR("Redundancy block size should be bigger than 0");
220  }
221  return DOCA_SUCCESS;
222 }
223 
224 /*
225  * ARGP Callback - Handle deleted block indices parameter
226  *
227  * @param [in]: Input parameter
228  * @config [in/out]: Program configuration context
229  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
230  */
231 static doca_error_t delete_block_indices_callback(void *param, void *config)
232 {
233  struct ec_cfg *ec_cfg = (struct ec_cfg *)config;
234  char *ind = (char *)param;
235  int64_t num;
236 
237  ec_cfg->n_delete_block = 0;
238  while (*ind != '\0') {
239  num = strtol(ind, &ind, 10);
240  if (num < 0) {
241  DOCA_LOG_ERR("Delete block indices are negative");
243  }
244  if (ec_cfg->n_delete_block + 1 > MAX_BLOCKS) {
245  DOCA_LOG_ERR("Delete block indices count is bigger then max: %d, requested: %ld",
246  MAX_BLOCKS,
249  }
251  while (*ind == ',')
252  ind++;
253  }
254  return DOCA_SUCCESS;
255 }
256 
257 /*
258  * ARGP Callback - Handle number of source doca_buf parameter
259  *
260  * @param [in]: Input parameter
261  * @config [in/out]: Program configuration context
262  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
263  */
264 static doca_error_t num_src_buf_callback(void *param, void *config)
265 {
266  struct ec_cfg *conf = (struct ec_cfg *)config;
267  const int *num = (int *)param;
268 
269  if (*num <= 0) {
270  DOCA_LOG_ERR("Entered number of source doca_buf: %d, valid value must be >= 1", *num);
272  }
273 
274  conf->num_src_buf = *num;
275 
276  return DOCA_SUCCESS;
277 }
278 
279 /*
280  * ARGP Callback - Handle number of destination doca_buf parameter
281  *
282  * @param [in]: Input parameter
283  * @config [in/out]: Program configuration context
284  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
285  */
286 static doca_error_t num_dst_buf_callback(void *param, void *config)
287 {
288  struct ec_cfg *conf = (struct ec_cfg *)config;
289  const int *num = (int *)param;
290 
291  if (*num <= 0) {
292  DOCA_LOG_ERR("Entered number of destination doca_buf: %d, valid value must be >= 1", *num);
294  }
295 
296  conf->num_dst_buf = *num;
297 
298  return DOCA_SUCCESS;
299 }
300 
301 /*
302  * Register the command line parameters for the sample.
303  *
304  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
305  */
307 {
309  struct doca_argp_param *pci_param, *input_path_param, *output_path_param, *do_both_param, *matrix_param,
310  *data_block_count_param, *rdnc_block_count_param, *delete_block_indices_param, *num_src_buf_param,
311  *num_dst_buf_param;
312 
313  result = doca_argp_param_create(&pci_param);
314  if (result != DOCA_SUCCESS) {
315  DOCA_LOG_ERR("Failed to create ARGP param: %s", doca_error_get_descr(result));
316  return result;
317  }
318  doca_argp_param_set_short_name(pci_param, "p");
319  doca_argp_param_set_long_name(pci_param, "pci-addr");
320  doca_argp_param_set_description(pci_param, "DOCA device PCI device address - default: 03:00.0");
323  result = doca_argp_register_param(pci_param);
324  if (result != DOCA_SUCCESS) {
325  DOCA_LOG_ERR("Failed to register program param: %s", doca_error_get_descr(result));
326  return result;
327  }
328 
329  result = doca_argp_param_create(&input_path_param);
330  if (result != DOCA_SUCCESS) {
331  DOCA_LOG_ERR("Failed to create ARGP param: %s", doca_error_get_descr(result));
332  return result;
333  }
334  doca_argp_param_set_short_name(input_path_param, "i");
335  doca_argp_param_set_long_name(input_path_param, "input");
336  doca_argp_param_set_description(input_path_param, "Input file/folder to ec - default: self");
339  result = doca_argp_register_param(input_path_param);
340  if (result != DOCA_SUCCESS) {
341  DOCA_LOG_ERR("Failed to register program param: %s", doca_error_get_descr(result));
342  return result;
343  }
344 
345  result = doca_argp_param_create(&output_path_param);
346  if (result != DOCA_SUCCESS) {
347  DOCA_LOG_ERR("Failed to create ARGP param: %s", doca_error_get_descr(result));
348  return result;
349  }
350  doca_argp_param_set_short_name(output_path_param, "o");
351  doca_argp_param_set_long_name(output_path_param, "output");
352  doca_argp_param_set_description(output_path_param, "Output file/folder to ec - default: /tmp");
355  result = doca_argp_register_param(output_path_param);
356  if (result != DOCA_SUCCESS) {
357  DOCA_LOG_ERR("Failed to register program param: %s", doca_error_get_descr(result));
358  return result;
359  }
360 
361  result = doca_argp_param_create(&do_both_param);
362  if (result != DOCA_SUCCESS) {
363  DOCA_LOG_ERR("Failed to create ARGP param: %s", doca_error_get_descr(result));
364  return result;
365  }
366  doca_argp_param_set_short_name(do_both_param, "b");
367  doca_argp_param_set_long_name(do_both_param, "both");
368  doca_argp_param_set_description(do_both_param, "Do both (encode & decode) - default: false");
371  result = doca_argp_register_param(do_both_param);
372  if (result != DOCA_SUCCESS) {
373  DOCA_LOG_ERR("Failed to register program param: %s", doca_error_get_descr(result));
374  return result;
375  }
376 
377  result = doca_argp_param_create(&matrix_param);
378  if (result != DOCA_SUCCESS) {
379  DOCA_LOG_ERR("Failed to create ARGP param: %s", doca_error_get_descr(result));
380  return result;
381  }
382  doca_argp_param_set_short_name(matrix_param, "x");
383  doca_argp_param_set_long_name(matrix_param, "matrix");
384  doca_argp_param_set_description(matrix_param, "Matrix - {cauchy, vandermonde} - default: cauchy");
387  result = doca_argp_register_param(matrix_param);
388  if (result != DOCA_SUCCESS) {
389  DOCA_LOG_ERR("Failed to register program param: %s", doca_error_get_descr(result));
390  return result;
391  }
392 
393  result = doca_argp_param_create(&data_block_count_param);
394  if (result != DOCA_SUCCESS) {
395  DOCA_LOG_ERR("Failed to create ARGP param: %s", doca_error_get_descr(result));
396  return result;
397  }
398  doca_argp_param_set_short_name(data_block_count_param, "t");
399  doca_argp_param_set_long_name(data_block_count_param, "data");
400  doca_argp_param_set_description(data_block_count_param, "Data block count - default: 2");
402  doca_argp_param_set_type(data_block_count_param, DOCA_ARGP_TYPE_INT);
403  result = doca_argp_register_param(data_block_count_param);
404  if (result != DOCA_SUCCESS) {
405  DOCA_LOG_ERR("Failed to register program param: %s", doca_error_get_descr(result));
406  return result;
407  }
408 
409  result = doca_argp_param_create(&rdnc_block_count_param);
410  if (result != DOCA_SUCCESS) {
411  DOCA_LOG_ERR("Failed to create ARGP param: %s", doca_error_get_descr(result));
412  return result;
413  }
414  doca_argp_param_set_short_name(rdnc_block_count_param, "r");
415  doca_argp_param_set_long_name(rdnc_block_count_param, "rdnc");
416  doca_argp_param_set_description(rdnc_block_count_param, "Redundancy block count - default: 2");
418  doca_argp_param_set_type(rdnc_block_count_param, DOCA_ARGP_TYPE_INT);
419  result = doca_argp_register_param(rdnc_block_count_param);
420  if (result != DOCA_SUCCESS) {
421  DOCA_LOG_ERR("Failed to register program param: %s", doca_error_get_descr(result));
422  return result;
423  }
424 
425  result = doca_argp_param_create(&delete_block_indices_param);
426  if (result != DOCA_SUCCESS) {
427  DOCA_LOG_ERR("Failed to create ARGP param: %s", doca_error_get_descr(result));
428  return result;
429  }
430  doca_argp_param_set_short_name(delete_block_indices_param, "d");
431  doca_argp_param_set_long_name(delete_block_indices_param, "delete-index");
432  doca_argp_param_set_description(delete_block_indices_param,
433  "Indices of data blocks to delete comma separated i.e. 0,3,4 - default: 0");
434  doca_argp_param_set_callback(delete_block_indices_param, delete_block_indices_callback);
435  doca_argp_param_set_type(delete_block_indices_param, DOCA_ARGP_TYPE_STRING);
436  result = doca_argp_register_param(delete_block_indices_param);
437  if (result != DOCA_SUCCESS) {
438  DOCA_LOG_ERR("Failed to register program param: %s", doca_error_get_descr(result));
439  return result;
440  }
441 
442  /* Create and register number of source doca_buf param */
443  result = doca_argp_param_create(&num_src_buf_param);
444  if (result != DOCA_SUCCESS) {
445  DOCA_LOG_ERR("Failed to create ARGP param: %s", doca_error_get_descr(result));
446  return result;
447  }
448  doca_argp_param_set_short_name(num_src_buf_param, "ns");
449  doca_argp_param_set_long_name(num_src_buf_param, "num-src-buf");
450  doca_argp_param_set_description(num_src_buf_param, "number of doca_buf for source buffer");
452  doca_argp_param_set_type(num_src_buf_param, DOCA_ARGP_TYPE_INT);
453  result = doca_argp_register_param(num_src_buf_param);
454  if (result != DOCA_SUCCESS) {
455  DOCA_LOG_ERR("Failed to register program param: %s", doca_error_get_descr(result));
456  return result;
457  }
458 
459  /* Create and register number of destination doca_buf param */
460  result = doca_argp_param_create(&num_dst_buf_param);
461  if (result != DOCA_SUCCESS) {
462  DOCA_LOG_ERR("Failed to create ARGP param: %s", doca_error_get_descr(result));
463  return result;
464  }
465  doca_argp_param_set_short_name(num_dst_buf_param, "nd");
466  doca_argp_param_set_long_name(num_dst_buf_param, "num-dst-buf");
467  doca_argp_param_set_description(num_dst_buf_param, "number of doca_buf for destination buffer");
469  doca_argp_param_set_type(num_dst_buf_param, DOCA_ARGP_TYPE_INT);
470  result = doca_argp_register_param(num_dst_buf_param);
471  if (result != DOCA_SUCCESS) {
472  DOCA_LOG_ERR("Failed to register program param: %s", doca_error_get_descr(result));
473  return result;
474  }
475 
476  return DOCA_SUCCESS;
477 }
478 
479 /*
480  * Sample main function
481  *
482  * @argc [in]: command line arguments size
483  * @argv [in]: array of command line arguments
484  * @return: EXIT_SUCCESS on success and EXIT_FAILURE otherwise
485  */
486 int main(int argc, char **argv)
487 {
489  int exit_status = EXIT_FAILURE;
490  struct ec_cfg ec_cfg;
491  struct doca_log_backend *sdk_log;
492  int len;
493 
494  /* Register a logger backend */
496  if (result != DOCA_SUCCESS)
497  goto sample_exit;
498 
499  /* Register a logger backend for internal SDK errors and warnings */
500  result = doca_log_backend_create_with_file_sdk(stderr, &sdk_log);
501  if (result != DOCA_SUCCESS)
502  goto sample_exit;
504  if (result != DOCA_SUCCESS)
505  goto sample_exit;
506 
507  DOCA_LOG_INFO("Starting the sample");
508 
509  len = strnlen(argv[0], USER_MAX_PATH_NAME);
510  if (len >= MAX_PATH_NAME) {
511  DOCA_LOG_ERR("Self path is too long, max %d", USER_MAX_PATH_NAME);
512  goto sample_exit;
513  }
514  strcpy(ec_cfg.pci_address, "03:00.0");
515  strncpy(ec_cfg.input_path, argv[0], USER_MAX_PATH_NAME);
516  strcpy(ec_cfg.output_path, "/tmp");
517  ec_cfg.do_both = false; /* do both encoding & decoding (and delete data block between them) */
519  ec_cfg.data_block_count = 2; /* data block count */
520  ec_cfg.rdnc_block_count = 2; /* redundancy block count */
523  ec_cfg.num_dst_buf = 1;
524  ec_cfg.num_src_buf = 1;
525 
527  if (result != DOCA_SUCCESS) {
528  DOCA_LOG_ERR("Failed to init ARGP resources: %s", doca_error_get_descr(result));
529  goto sample_exit;
530  }
531 
533  if (result != DOCA_SUCCESS) {
534  DOCA_LOG_ERR("Failed to register ARGP params: %s", doca_error_get_descr(result));
535  goto argp_cleanup;
536  }
537 
538  result = doca_argp_start(argc, argv);
539  if (result != DOCA_SUCCESS) {
540  DOCA_LOG_ERR("Failed to parse sample input: %s", doca_error_get_descr(result));
541  goto argp_cleanup;
542  }
543 
547  ec_cfg.do_both,
548  ec_cfg.matrix,
555  if (result != DOCA_SUCCESS) {
556  DOCA_LOG_ERR("ec_recover() encountered an error: %s", doca_error_get_descr(result));
557  goto argp_cleanup;
558  }
559 
560  exit_status = EXIT_SUCCESS;
561 
562 argp_cleanup:
564 sample_exit:
565  if (exit_status == EXIT_SUCCESS)
566  DOCA_LOG_INFO("Sample finished successfully");
567  else
568  DOCA_LOG_INFO("Sample finished with errors");
569  return exit_status;
570 }
#define NULL
Definition: __stddef_null.h:26
char path[MAX_PATH_LEN+1]
int32_t result
uint64_t len
if(bitoffset % 64+bitlength > 64) result|
static doca_error_t input_path_callback(void *param, void *config)
int main(int argc, char **argv)
static doca_error_t matrix_callback(void *param, void *config)
static doca_error_t output_path_callback(void *param, void *config)
static doca_error_t delete_block_indices_callback(void *param, void *config)
static doca_error_t pci_address_callback(void *param, void *config)
doca_error_t ec_recover(const char *pci_addr, const char *input_path, const char *output_path, bool do_both, enum doca_ec_matrix_type matrix_type, uint32_t data_block_count, uint32_t rdnc_block_count, uint32_t *missing_indices, size_t n_missing, int num_src_buf, int num_dst_buf)
static doca_error_t register_ec_params(void)
DOCA_LOG_REGISTER(EC_RECOVER::MAIN)
static doca_error_t rdnc_block_count_callback(void *param, void *config)
#define USER_MAX_PATH_NAME
static doca_error_t do_both_callback(void *param, void *config)
#define MAX_BLOCKS
#define MAX_PATH_NAME
static doca_error_t num_dst_buf_callback(void *param, void *config)
static doca_error_t data_block_count_callback(void *param, void *config)
static doca_error_t num_src_buf_callback(void *param, void *config)
DOCA_EXPERIMENTAL void doca_argp_param_set_description(struct doca_argp_param *param, const char *description)
Set the description of the program param, used during program usage.
DOCA_EXPERIMENTAL void doca_argp_param_set_long_name(struct doca_argp_param *param, const char *name)
Set the long name of the program param.
DOCA_EXPERIMENTAL doca_error_t doca_argp_start(int argc, char **argv)
Parse incoming arguments (cmd line/json).
DOCA_EXPERIMENTAL doca_error_t doca_argp_init(const char *program_name, void *program_config)
Initialize the parser interface.
DOCA_EXPERIMENTAL void doca_argp_param_set_callback(struct doca_argp_param *param, doca_argp_param_cb_t callback)
Set the callback function of the program param.
DOCA_EXPERIMENTAL doca_error_t doca_argp_param_create(struct doca_argp_param **param)
Create new program param.
DOCA_EXPERIMENTAL void doca_argp_param_set_type(struct doca_argp_param *param, enum doca_argp_type type)
Set the type of the param arguments.
DOCA_EXPERIMENTAL void doca_argp_param_set_short_name(struct doca_argp_param *param, const char *name)
Set the short name of the program param.
DOCA_EXPERIMENTAL doca_error_t doca_argp_destroy(void)
ARG Parser destroy.
DOCA_EXPERIMENTAL doca_error_t doca_argp_register_param(struct doca_argp_param *input_param)
Register a program flag.
@ DOCA_ARGP_TYPE_STRING
Definition: doca_argp.h:56
@ DOCA_ARGP_TYPE_BOOLEAN
Definition: doca_argp.h:58
@ DOCA_ARGP_TYPE_INT
Definition: doca_argp.h:57
#define DOCA_DEVINFO_PCI_ADDR_SIZE
Buffer size to hold PCI BDF format: "XXXX:XX:XX.X". Including a null terminator.
Definition: doca_dev.h:313
doca_ec_matrix_type
Types of coding matrix used for erasure codes.
@ DOCA_EC_MATRIX_TYPE_VANDERMONDE
@ DOCA_EC_MATRIX_TYPE_CAUCHY
enum doca_error doca_error_t
DOCA API return codes.
DOCA_STABLE const char * doca_error_get_descr(doca_error_t error)
Returns the description string of an error code.
@ DOCA_ERROR_INVALID_VALUE
Definition: doca_error.h:44
@ DOCA_ERROR_NOT_FOUND
Definition: doca_error.h:54
@ DOCA_SUCCESS
Definition: doca_error.h:38
DOCA_EXPERIMENTAL doca_error_t doca_log_backend_create_standard(void)
Create default, non configurable backend for application messages.
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
Definition: doca_log.h:466
#define DOCA_LOG_INFO(format,...)
Generates an INFO application log message.
Definition: doca_log.h:486
DOCA_EXPERIMENTAL doca_error_t doca_log_backend_create_with_file_sdk(FILE *fptr, struct doca_log_backend **backend)
Create a logging backend with a FILE* stream for SDK messages.
DOCA_EXPERIMENTAL doca_error_t doca_log_backend_set_sdk_level(struct doca_log_backend *backend, uint32_t level)
Set the log level limit for SDK logging backends.
@ DOCA_LOG_LEVEL_WARNING
Definition: doca_log.h:47
enum doca_ec_matrix_type matrix
char output_path[MAX_PATH_NAME]
uint32_t delete_block_indices[MAX_BLOCKS]
char pci_address[DOCA_DEVINFO_PCI_ADDR_SIZE]
char input_path[MAX_PATH_NAME]