[dpdk-dev,2/2] test/crypto: create unique driver name

Message ID 1492515579-130563-2-git-send-email-pablo.de.lara.guarch@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Pablo de Lara Guarch
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

De Lara Guarch, Pablo April 18, 2017, 11:39 a.m. UTC
  Since commit <dda987315ca2> ("vdev: make virtual bus use
its device struct"), rte_eal_vdev_init cannot be called
with same name twice.

If several devices with the same driver are needed
(as in the crypto scheduler test), then driver name argument
has to be unique, concatenating the driver name and an index.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

---

I have tested all PMDs expect for the ARMv8 one, but I assume
it should work as well. Let me know if you see a problem.
---
 test/test/test_cryptodev.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Comments

Fan Zhang April 18, 2017, 1:12 p.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pablo de Lara
> Sent: Tuesday, April 18, 2017 12:40 PM
> To: dev@dpdk.org
> Cc: zbigniew.bodek@caviumnetworks.com;
> jerin.jacob@caviumnetworks.com; Doherty, Declan
> <declan.doherty@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>
> Subject: [dpdk-dev] [PATCH 2/2] test/crypto: create unique driver name
> 
> Since commit <dda987315ca2> ("vdev: make virtual bus use its device struct"),
> rte_eal_vdev_init cannot be called with same name twice.
> 
> If several devices with the same driver are needed (as in the crypto
> scheduler test), then driver name argument has to be unique, concatenating
> the driver name and an index.
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
  
De Lara Guarch, Pablo April 18, 2017, 3:46 p.m. UTC | #2
> -----Original Message-----
> From: Zhang, Roy Fan
> Sent: Tuesday, April 18, 2017 2:12 PM
> To: De Lara Guarch, Pablo; dev@dpdk.org
> Cc: zbigniew.bodek@caviumnetworks.com;
> jerin.jacob@caviumnetworks.com; Doherty, Declan; De Lara Guarch, Pablo
> Subject: RE: [dpdk-dev] [PATCH 2/2] test/crypto: create unique driver name
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pablo de Lara
> > Sent: Tuesday, April 18, 2017 12:40 PM
> > To: dev@dpdk.org
> > Cc: zbigniew.bodek@caviumnetworks.com;
> > jerin.jacob@caviumnetworks.com; Doherty, Declan
> > <declan.doherty@intel.com>; De Lara Guarch, Pablo
> > <pablo.de.lara.guarch@intel.com>
> > Subject: [dpdk-dev] [PATCH 2/2] test/crypto: create unique driver name
> >
> > Since commit <dda987315ca2> ("vdev: make virtual bus use its device
> struct"),
> > rte_eal_vdev_init cannot be called with same name twice.
> >
> > If several devices with the same driver are needed (as in the crypto
> > scheduler test), then driver name argument has to be unique,
> concatenating
> > the driver name and an index.
> >
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> 
> Acked-by: Fan Zhang <roy.fan.zhang@intel.com>

Applied to dpdk-next-crypto.

Pablo
  

Patch

diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index ca7d6df..9f13171 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -7751,14 +7751,17 @@  test_scheduler_attach_slave_op(void)
 	uint8_t sched_id = ts_params->valid_devs[0];
 	uint32_t nb_devs, i, nb_devs_attached = 0;
 	int ret;
+	char vdev_name[32];
 
 	/* create 2 AESNI_MB if necessary */
 	nb_devs = rte_cryptodev_count_devtype(
 			RTE_CRYPTODEV_AESNI_MB_PMD);
 	if (nb_devs < 2) {
 		for (i = nb_devs; i < 2; i++) {
-			ret = rte_eal_vdev_init(
-				RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL);
+			snprintf(vdev_name, sizeof(vdev_name), "%s_%u",
+					RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD),
+					i);
+			ret = rte_eal_vdev_init(vdev_name, NULL);
 
 			TEST_ASSERT(ret == 0,
 				"Failed to create instance %u of"