Skip to content

Commit 88be3b9

Browse files
author
Akhil Goyal
committed
app/crypto-perf: test queue pair priority
Updated the application to test variable queue pair priority. A mask using `--low-prio-qp-mask` can be set to lower the priority of queues which are set in the mask. This would result in lower performance for those queues. By default the priority is set as highest. This option is added just to verify the performance drop of queues which have lower priority set. Signed-off-by: Akhil Goyal <[email protected]>
1 parent 91a491d commit 88be3b9

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

app/test-crypto-perf/cperf_options.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
#define CPERF_TEST_FILE ("test-file")
3333
#define CPERF_TEST_NAME ("test-name")
3434

35+
#define CPERF_LOW_PRIO_QP_MASK ("low-prio-qp-mask")
36+
3537
#define CPERF_CIPHER_ALGO ("cipher-algo")
3638
#define CPERF_CIPHER_OP ("cipher-op")
3739
#define CPERF_CIPHER_KEY_SZ ("cipher-key-sz")
@@ -107,6 +109,7 @@ struct cperf_options {
107109
uint32_t *imix_buffer_sizes;
108110
uint32_t nb_descriptors;
109111
uint16_t nb_qps;
112+
uint64_t low_prio_qp_mask;
110113

111114
uint32_t sessionless:1;
112115
uint32_t shared_session:1;

app/test-crypto-perf/cperf_options_parsing.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ usage(char *progname)
3737
" --segment-sz N: set the size of the segment to use\n"
3838
" --desc-nb N: set number of descriptors for each crypto device\n"
3939
" --devtype TYPE: set crypto device type to use\n"
40+
" --low-prio-qp-mask mask: set low priority for queues set in mask(hex)\n"
4041
" --optype cipher-only / auth-only / cipher-then-auth / auth-then-cipher /\n"
4142
" aead / pdcp / docsis / ipsec / modex / secp256r1 / sm2 / tls-record : set operation type\n"
4243
" --sessionless: enable session-less crypto operations\n"
@@ -941,6 +942,22 @@ parse_pmd_cyclecount_delay_ms(struct cperf_options *opts,
941942
return 0;
942943
}
943944

945+
static int
946+
parse_low_prio_qp_mask(struct cperf_options *opts, const char *arg)
947+
{
948+
char *end = NULL;
949+
unsigned long n;
950+
951+
/* parse hexadecimal string */
952+
n = strtoul(arg, &end, 16);
953+
if ((optarg[0] == '\0') || (end == NULL) || (*end != '\0'))
954+
return -1;
955+
956+
opts->low_prio_qp_mask = n;
957+
958+
return 0;
959+
}
960+
944961
typedef int (*option_parser_t)(struct cperf_options *opts,
945962
const char *arg);
946963

@@ -962,6 +979,8 @@ static struct option lgopts[] = {
962979
{ CPERF_SEGMENT_SIZE, required_argument, 0, 0 },
963980
{ CPERF_DESC_NB, required_argument, 0, 0 },
964981

982+
{ CPERF_LOW_PRIO_QP_MASK, required_argument, 0, 0 },
983+
965984
{ CPERF_IMIX, required_argument, 0, 0 },
966985
{ CPERF_DEVTYPE, required_argument, 0, 0 },
967986
{ CPERF_OPTYPE, required_argument, 0, 0 },
@@ -1097,6 +1116,7 @@ cperf_opts_parse_long(int opt_idx, struct cperf_options *opts)
10971116
{ CPERF_BUFFER_SIZE, parse_buffer_sz },
10981117
{ CPERF_SEGMENT_SIZE, parse_segment_sz },
10991118
{ CPERF_DESC_NB, parse_desc_nb },
1119+
{ CPERF_LOW_PRIO_QP_MASK, parse_low_prio_qp_mask },
11001120
{ CPERF_DEVTYPE, parse_device_type },
11011121
{ CPERF_OPTYPE, parse_op_type },
11021122
{ CPERF_SESSIONLESS, parse_sessionless },

app/test-crypto-perf/main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
249249
}
250250

251251
struct rte_cryptodev_qp_conf qp_conf = {
252-
.nb_descriptors = opts->nb_descriptors
252+
.nb_descriptors = opts->nb_descriptors,
253+
.priority = RTE_CRYPTODEV_QP_PRIORITY_HIGHEST
253254
};
254255

255256
/**
@@ -315,6 +316,9 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
315316
}
316317

317318
for (j = 0; j < opts->nb_qps; j++) {
319+
if ((1 << j) & opts->low_prio_qp_mask)
320+
qp_conf.priority = RTE_CRYPTODEV_QP_PRIORITY_LOWEST;
321+
318322
ret = rte_cryptodev_queue_pair_setup(cdev_id, j,
319323
&qp_conf, socket_id);
320324
if (ret < 0) {

doc/guides/tools/cryptoperf.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,11 @@ The following are the application command-line options:
361361

362362
Set TLS/DTLS protocol version for perf test (default is TLS1.2).
363363

364+
* ``--low-prio-qp-mask <mask>``
365+
366+
Set low priority for queue pairs set in the hexadecimal mask.
367+
This is an optional parameter, if not set all queue pairs will be on same high priority.
368+
364369
Test Vector File
365370
~~~~~~~~~~~~~~~~
366371

0 commit comments

Comments
 (0)