#include <rte_cryptodev.h>
#include <rte_malloc.h>
+#include <rte_ether.h>
#include "cperf_options.h"
" --pmd-cyclecount-delay-ms N: set delay between enqueue\n"
" and dequeue in pmd-cyclecount benchmarking mode\n"
" --csv-friendly: enable test result output CSV friendly\n"
+#ifdef RTE_LIBRTE_SECURITY
+ " --docsis-hdr-sz: set DOCSIS header size\n"
+#endif
" -h: prints this help\n",
progname);
}
{
cperf_op_type_strs[CPERF_PDCP],
CPERF_PDCP
+ },
+ {
+ cperf_op_type_strs[CPERF_DOCSIS],
+ CPERF_DOCSIS
}
};
return 0;
}
+
+static int
+parse_docsis_hdr_sz(struct cperf_options *opts, const char *arg)
+{
+ return parse_uint16_t(&opts->docsis_hdr_sz, arg);
+}
#endif
static int
#ifdef RTE_LIBRTE_SECURITY
{ CPERF_PDCP_SN_SZ, required_argument, 0, 0 },
{ CPERF_PDCP_DOMAIN, required_argument, 0, 0 },
+ { CPERF_DOCSIS_HDR_SZ, required_argument, 0, 0 },
#endif
{ CPERF_CSV, no_argument, 0, 0},
#ifdef RTE_LIBRTE_SECURITY
opts->pdcp_sn_sz = 12;
opts->pdcp_domain = RTE_SECURITY_PDCP_MODE_CONTROL;
+ opts->docsis_hdr_sz = 17;
#endif
}
#ifdef RTE_LIBRTE_SECURITY
{ CPERF_PDCP_SN_SZ, parse_pdcp_sn_sz },
{ CPERF_PDCP_DOMAIN, parse_pdcp_domain },
+ { CPERF_DOCSIS_HDR_SZ, parse_docsis_hdr_sz },
#endif
{ CPERF_CSV, parse_csv_friendly},
{ CPERF_PMDCC_DELAY_MS, parse_pmd_cyclecount_delay_ms},
return 0;
}
+#ifdef RTE_LIBRTE_SECURITY
+static int
+check_docsis_buffer_length(struct cperf_options *options)
+{
+ uint32_t buffer_size, buffer_size_idx = 0;
+
+ if (options->inc_buffer_size != 0)
+ buffer_size = options->min_buffer_size;
+ else
+ buffer_size = options->buffer_size_list[0];
+
+ while (buffer_size <= options->max_buffer_size) {
+ if (buffer_size < (uint32_t)(options->docsis_hdr_sz +
+ RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)) {
+ RTE_LOG(ERR, USER1, "Some of the buffer sizes are not "
+ "valid for DOCSIS\n");
+ return -EINVAL;
+ }
+
+ if (options->inc_buffer_size != 0)
+ buffer_size += options->inc_buffer_size;
+ else {
+ if (++buffer_size_idx == options->buffer_size_count)
+ break;
+ buffer_size =
+ options->buffer_size_list[buffer_size_idx];
+ }
+ }
+
+ return 0;
+}
+#endif
+
int
cperf_options_check(struct cperf_options *options)
{
- if (options->op_type == CPERF_CIPHER_ONLY)
+ if (options->op_type == CPERF_CIPHER_ONLY ||
+ options->op_type == CPERF_DOCSIS)
options->digest_sz = 0;
if (options->out_of_place &&
return -EINVAL;
}
+#ifdef RTE_LIBRTE_SECURITY
+ if (options->op_type == CPERF_DOCSIS) {
+ if (check_docsis_buffer_length(options) < 0)
+ return -EINVAL;
+ }
+#endif
+
return 0;
}
printf("# aead aad size: %u\n", opts->aead_aad_sz);
printf("#\n");
}
+
+#ifdef RTE_LIBRTE_SECURITY
+ if (opts->op_type == CPERF_DOCSIS) {
+ printf("# docsis header size: %u\n", opts->docsis_hdr_sz);
+ printf("#\n");
+ }
+#endif
}