Skip to content

Commit a324c45

Browse files
pablodelaraThomas Monjalon
authored andcommitted
aesni_mb: fix wrong return value
cryptodev_aesni_mb_init was returning the device id of the device just created, but rte_eal_vdev_init (the function that calls the first one), was expecting 0 or negative value. This made impossible to create more than one aesni_mb device from command line. Fixes: 924e84f ("aesni_mb: add driver for multi buffer based crypto") Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> Acked-by: Declan Doherty <declan.doherty@intel.com>
1 parent e57dcc3 commit a324c45

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

app/test/test_cryptodev.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ testsuite_setup(void)
143143
{
144144
struct crypto_testsuite_params *ts_params = &testsuite_params;
145145
struct rte_cryptodev_info info;
146-
unsigned i, nb_devs, dev_id = 0;
146+
unsigned i, nb_devs, dev_id;
147+
int ret;
147148
uint16_t qp_id;
148149

149150
memset(ts_params, 0, sizeof(*ts_params));
@@ -177,10 +178,10 @@ testsuite_setup(void)
177178
RTE_CRYPTODEV_AESNI_MB_PMD);
178179
if (nb_devs < 2) {
179180
for (i = nb_devs; i < 2; i++) {
180-
int dev_id = rte_eal_vdev_init(
181+
ret = rte_eal_vdev_init(
181182
CRYPTODEV_NAME_AESNI_MB_PMD, NULL);
182183

183-
TEST_ASSERT(dev_id >= 0,
184+
TEST_ASSERT(ret == 0,
184185
"Failed to create instance %u of"
185186
" pmd : %s",
186187
i, CRYPTODEV_NAME_AESNI_MB_PMD);

app/test/test_cryptodev_perf.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ testsuite_setup(void)
107107
struct crypto_testsuite_params *ts_params = &testsuite_params;
108108
struct rte_cryptodev_info info;
109109
unsigned i, nb_devs, valid_dev_id = 0;
110+
int ret;
110111
uint16_t qp_id;
111112

112113
ts_params->mbuf_mp = rte_mempool_lookup("CRYPTO_PERF_MBUFPOOL");
@@ -138,10 +139,10 @@ testsuite_setup(void)
138139
nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_AESNI_MB_PMD);
139140
if (nb_devs < 2) {
140141
for (i = nb_devs; i < 2; i++) {
141-
int dev_id = rte_eal_vdev_init(
142+
ret = rte_eal_vdev_init(
142143
CRYPTODEV_NAME_AESNI_MB_PMD, NULL);
143144

144-
TEST_ASSERT(dev_id >= 0,
145+
TEST_ASSERT(ret == 0,
145146
"Failed to create instance %u of pmd : %s",
146147
i, CRYPTODEV_NAME_AESNI_MB_PMD);
147148
}

doc/guides/rel_notes/release_16_04.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ EAL
6666
Drivers
6767
~~~~~~~
6868

69+
* **aesni_mb: Fixed wrong return value when creating a device.**
70+
71+
cryptodev_aesni_mb_init() was returning the device id of the device created,
72+
instead of 0 (when success), that rte_eal_vdev_init() expects.
73+
This made impossible the creation of more than one aesni_mb device
74+
from command line.
75+
6976

7077
Libraries
7178
~~~~~~~~~

drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ cryptodev_aesni_mb_create(const char *name, unsigned socket_id)
628628
internals->max_nb_queue_pairs = RTE_AESNI_MB_PMD_MAX_NB_QUEUE_PAIRS;
629629
internals->max_nb_sessions = RTE_AESNI_MB_PMD_MAX_NB_SESSIONS;
630630

631-
return dev->data->dev_id;
631+
return 0;
632632
init_error:
633633
MB_LOG_ERR("driver %s: cryptodev_aesni_create failed", name);
634634

examples/l2fwd-crypto/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,9 +1184,9 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports)
11841184
return -1;
11851185
} else if (options->cdev_type == RTE_CRYPTODEV_AESNI_MB_PMD) {
11861186
for (i = 0; i < nb_ports; i++) {
1187-
int id = rte_eal_vdev_init(CRYPTODEV_NAME_AESNI_MB_PMD,
1187+
int retval = rte_eal_vdev_init(CRYPTODEV_NAME_AESNI_MB_PMD,
11881188
NULL);
1189-
if (id < 0)
1189+
if (retval < 0)
11901190
return -1;
11911191
}
11921192
}

0 commit comments

Comments
 (0)