[dpdk-dev,v2,3/4] cryptodev: rework PMD init to not require rte_vdev.h

Message ID 20170712195846.65286-4-jblunck@infradead.org (mailing list archive)
State Changes Requested, archived
Delegated to: Pablo de Lara Guarch
Headers

Checks

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

Commit Message

Jan Blunck July 12, 2017, 7:58 p.m. UTC
  The rte_cryptodev_vdev_pmd_init() is a helper for vdev-based drivers.
By moving the helper to the header we don't require rte_vdev.h at
build-time of the librte_cryptodev library. This is a preparation to
move the vdev bus into a standalone library.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
 lib/librte_cryptodev/rte_cryptodev_pmd.c       | 29 --------------------------
 lib/librte_cryptodev/rte_cryptodev_vdev.h      | 29 ++++++++++++++++++++++++--
 lib/librte_cryptodev/rte_cryptodev_version.map |  1 -
 3 files changed, 27 insertions(+), 32 deletions(-)
  

Comments

De Lara Guarch, Pablo July 15, 2017, 11:04 a.m. UTC | #1
Hi

> -----Original Message-----
> From: Jan Blunck [mailto:jblunck@gmail.com] On Behalf Of Jan Blunck
> Sent: Wednesday, July 12, 2017 8:59 PM
> To: dev@dpdk.org
> Cc: Doherty, Declan <declan.doherty@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>
> Subject: [PATCH v2 3/4] cryptodev: rework PMD init to not require
> rte_vdev.h
> 
> The rte_cryptodev_vdev_pmd_init() is a helper for vdev-based drivers.
> By moving the helper to the header we don't require rte_vdev.h at build-
> time of the librte_cryptodev library. This is a preparation to move the vdev
> bus into a standalone library.
> 
> Signed-off-by: Jan Blunck <jblunck@infradead.org>

I am seeing some clang errors when applying this patch:

lib/librte_cryptodev/rte_cryptodev_vdev.h:88:14: error: implicit declaration of function
'rte_cryptodev_pmd_allocate' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
                    ^
lib/librte_cryptodev/rte_cryptodev_vdev.h:88:12: error: incompatible integer to pointer
conversion assigning to 'struct rte_cryptodev *' from 'int' [-Werror,-Wint-conversion]
        cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);

Also, looks like git commit title is not correct, according to check-git-log.sh:

Wrong headline format:
        cryptodev: rework PMD init to not require rte_vdev.h


Pablo
  
De Lara Guarch, Pablo Sept. 4, 2017, 2:32 p.m. UTC | #2
Hi Jan,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of De Lara Guarch,
> Pablo
> Sent: Saturday, July 15, 2017 12:05 PM
> To: Jan Blunck <jblunck@infradead.org>; dev@dpdk.org
> Cc: Doherty, Declan <declan.doherty@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 3/4] cryptodev: rework PMD init to not
> require rte_vdev.h
> 
> Hi
> 
> > -----Original Message-----
> > From: Jan Blunck [mailto:jblunck@gmail.com] On Behalf Of Jan Blunck
> > Sent: Wednesday, July 12, 2017 8:59 PM
> > To: dev@dpdk.org
> > Cc: Doherty, Declan <declan.doherty@intel.com>; De Lara Guarch, Pablo
> > <pablo.de.lara.guarch@intel.com>
> > Subject: [PATCH v2 3/4] cryptodev: rework PMD init to not require
> > rte_vdev.h
> >
> > The rte_cryptodev_vdev_pmd_init() is a helper for vdev-based drivers.
> > By moving the helper to the header we don't require rte_vdev.h at
> > build- time of the librte_cryptodev library. This is a preparation to
> > move the vdev bus into a standalone library.
> >
> > Signed-off-by: Jan Blunck <jblunck@infradead.org>
> 
> I am seeing some clang errors when applying this patch:
> 
> lib/librte_cryptodev/rte_cryptodev_vdev.h:88:14: error: implicit
> declaration of function 'rte_cryptodev_pmd_allocate' is invalid in C99 [-
> Werror,-Wimplicit-function-declaration]
>         cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
>                     ^
> lib/librte_cryptodev/rte_cryptodev_vdev.h:88:12: error: incompatible
> integer to pointer conversion assigning to 'struct rte_cryptodev *' from 'int'
> [-Werror,-Wint-conversion]
>         cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
> 
> Also, looks like git commit title is not correct, according to check-git-log.sh:
> 
> Wrong headline format:
>         cryptodev: rework PMD init to not require rte_vdev.h

Would you have time in this release to fix this?

Thanks,
Pablo

> 
> 
> Pablo
  
Jan Blunck Oct. 5, 2017, 2:52 p.m. UTC | #3
On Mon, Sep 4, 2017 at 4:32 PM, De Lara Guarch, Pablo
<pablo.de.lara.guarch@intel.com> wrote:
> Hi Jan,
>
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of De Lara Guarch,
>> Pablo
>> Sent: Saturday, July 15, 2017 12:05 PM
>> To: Jan Blunck <jblunck@infradead.org>; dev@dpdk.org
>> Cc: Doherty, Declan <declan.doherty@intel.com>
>> Subject: Re: [dpdk-dev] [PATCH v2 3/4] cryptodev: rework PMD init to not
>> require rte_vdev.h
>>
>> Hi
>>
>> > -----Original Message-----
>> > From: Jan Blunck [mailto:jblunck@gmail.com] On Behalf Of Jan Blunck
>> > Sent: Wednesday, July 12, 2017 8:59 PM
>> > To: dev@dpdk.org
>> > Cc: Doherty, Declan <declan.doherty@intel.com>; De Lara Guarch, Pablo
>> > <pablo.de.lara.guarch@intel.com>
>> > Subject: [PATCH v2 3/4] cryptodev: rework PMD init to not require
>> > rte_vdev.h
>> >
>> > The rte_cryptodev_vdev_pmd_init() is a helper for vdev-based drivers.
>> > By moving the helper to the header we don't require rte_vdev.h at
>> > build- time of the librte_cryptodev library. This is a preparation to
>> > move the vdev bus into a standalone library.
>> >
>> > Signed-off-by: Jan Blunck <jblunck@infradead.org>
>>
>> I am seeing some clang errors when applying this patch:
>>
>> lib/librte_cryptodev/rte_cryptodev_vdev.h:88:14: error: implicit
>> declaration of function 'rte_cryptodev_pmd_allocate' is invalid in C99 [-
>> Werror,-Wimplicit-function-declaration]
>>         cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
>>                     ^
>> lib/librte_cryptodev/rte_cryptodev_vdev.h:88:12: error: incompatible
>> integer to pointer conversion assigning to 'struct rte_cryptodev *' from 'int'
>> [-Werror,-Wint-conversion]
>>         cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
>>

Pablo,

I can not reproduce this. There is already an include for
rte_cryptodev_pmd_allocate() in rte_cryptodev_vdev.h.

>> Also, looks like git commit title is not correct, according to check-git-log.sh:
>>
>> Wrong headline format:
>>         cryptodev: rework PMD init to not require rte_vdev.h
>

This script complains about underscores ...

Tell me what you think,
Jan
  

Patch

diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c
index ec6eeffa1..eaeddf74b 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
@@ -75,35 +75,6 @@  rte_cryptodev_vdev_parse_integer_arg(const char *key __rte_unused,
 	return 0;
 }
 
-struct rte_cryptodev *
-rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
-		int socket_id, struct rte_vdev_device *vdev)
-{
-	struct rte_cryptodev *cryptodev;
-
-	/* allocate device structure */
-	cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
-	if (cryptodev == NULL)
-		return NULL;
-
-	/* allocate private device structure */
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
-		cryptodev->data->dev_private =
-				rte_zmalloc_socket("cryptodev device private",
-						dev_private_size,
-						RTE_CACHE_LINE_SIZE,
-						socket_id);
-
-		if (cryptodev->data->dev_private == NULL)
-			rte_panic("Cannot allocate memzone for private device"
-					" data");
-	}
-
-	cryptodev->device = &vdev->device;
-
-	return cryptodev;
-}
-
 int
 rte_cryptodev_vdev_parse_init_params(struct rte_crypto_vdev_init_params *params,
 		const char *input_args)
diff --git a/lib/librte_cryptodev/rte_cryptodev_vdev.h b/lib/librte_cryptodev/rte_cryptodev_vdev.h
index 94ab9d33d..04d0796d4 100644
--- a/lib/librte_cryptodev/rte_cryptodev_vdev.h
+++ b/lib/librte_cryptodev/rte_cryptodev_vdev.h
@@ -78,9 +78,34 @@  struct rte_crypto_vdev_init_params {
  *   - Cryptodev pointer if device is successfully created.
  *   - NULL if device cannot be created.
  */
-struct rte_cryptodev *
+static inline struct rte_cryptodev *
 rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
-		int socket_id, struct rte_vdev_device *vdev);
+		int socket_id, struct rte_vdev_device *dev)
+{
+	struct rte_cryptodev *cryptodev;
+
+	/* allocate device structure */
+	cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
+	if (cryptodev == NULL)
+		return NULL;
+
+	/* allocate private device structure */
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+		cryptodev->data->dev_private =
+				rte_zmalloc_socket("cryptodev device private",
+						dev_private_size,
+						RTE_CACHE_LINE_SIZE,
+						socket_id);
+
+		if (cryptodev->data->dev_private == NULL)
+			rte_panic("Cannot allocate memzone for private device"
+					" data");
+	}
+
+	cryptodev->device = &dev->device;
+
+	return cryptodev;
+}
 
 /**
  * @internal
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index e9ba88ac5..abdbbdada 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -74,7 +74,6 @@  DPDK_17.08 {
 	rte_cryptodev_sym_session_init;
 	rte_cryptodev_sym_session_clear;
 	rte_cryptodev_vdev_parse_init_params;
-	rte_cryptodev_vdev_pmd_init;
 	rte_crypto_aead_algorithm_strings;
 	rte_crypto_aead_operation_strings;