DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] cryptodev: crypto PMD functions incorrectly inlined
@ 2017-01-23 12:18 Declan Doherty
  2017-01-23 12:24 ` Zhang, Roy Fan
  0 siblings, 1 reply; 3+ messages in thread
From: Declan Doherty @ 2017-01-23 12:18 UTC (permalink / raw)
  To: dev; +Cc: pablo.de.lara.guarch, stable, Declan Doherty

rte_cryptodev_pmd_get_dev, rte_cryptodev_pmd_get_named_dev, 
rte_cryptodev_pmd_is_valid_dev were incorrectly marked as inline and
therefore not useable from crypto PMDs when built as shared
libraries as they accessed the global rte_cryptodev_globals device
structure.

Fixes: d11b0f30 ("cryptodev: introduce API and framework for crypto
devices")

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
---
 lib/librte_cryptodev/rte_cryptodev.c           | 42 ++++++++++++++++++++++++
 lib/librte_cryptodev/rte_cryptodev_pmd.h       | 44 ++++----------------------
 lib/librte_cryptodev/rte_cryptodev_version.map |  3 ++
 3 files changed, 51 insertions(+), 38 deletions(-)

diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 6a51eec..42707cb 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -255,6 +255,48 @@ rte_cryptodev_create_vdev(const char *name, const char *args)
 	return rte_eal_vdev_init(name, args);
 }
 
+struct rte_cryptodev *
+rte_cryptodev_pmd_get_dev(uint8_t dev_id)
+{
+	return &rte_cryptodev_globals->devs[dev_id];
+}
+
+struct rte_cryptodev *
+rte_cryptodev_pmd_get_named_dev(const char *name)
+{
+	struct rte_cryptodev *dev;
+	unsigned i;
+
+	if (name == NULL)
+		return NULL;
+
+	for (i = 0; i < rte_cryptodev_globals->max_devs; i++) {
+		dev = &rte_cryptodev_globals->devs[i];
+
+		if ((dev->attached == RTE_CRYPTODEV_ATTACHED) &&
+				(strcmp(dev->data->name, name) == 0))
+			return dev;
+	}
+
+	return NULL;
+}
+
+unsigned
+rte_cryptodev_pmd_is_valid_dev(uint8_t dev_id)
+{
+	struct rte_cryptodev *dev = NULL;
+
+	if (dev_id >= rte_cryptodev_globals->nb_devs)
+		return 0;
+
+	dev = rte_cryptodev_pmd_get_dev(dev_id);
+	if (dev->attached != RTE_CRYPTODEV_ATTACHED)
+		return 0;
+	else
+		return 1;
+}
+
+
 int
 rte_cryptodev_get_dev_id(const char *name)
 {
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index aabef41..b6dc32c 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -160,11 +160,8 @@ extern struct rte_cryptodev_global *rte_cryptodev_globals;
  * @return
  *   - The rte_cryptodev structure pointer for the given device ID.
  */
-static inline struct rte_cryptodev *
-rte_cryptodev_pmd_get_dev(uint8_t dev_id)
-{
-	return &rte_cryptodev_globals->devs[dev_id];
-}
+struct rte_cryptodev *
+rte_cryptodev_pmd_get_dev(uint8_t dev_id);
 
 /**
  * Get the rte_cryptodev structure device pointer for the named device.
@@ -174,25 +171,8 @@ rte_cryptodev_pmd_get_dev(uint8_t dev_id)
  * @return
  *   - The rte_cryptodev structure pointer for the given device ID.
  */
-static inline struct rte_cryptodev *
-rte_cryptodev_pmd_get_named_dev(const char *name)
-{
-	struct rte_cryptodev *dev;
-	unsigned i;
-
-	if (name == NULL)
-		return NULL;
-
-	for (i = 0; i < rte_cryptodev_globals->max_devs; i++) {
-		dev = &rte_cryptodev_globals->devs[i];
-
-		if ((dev->attached == RTE_CRYPTODEV_ATTACHED) &&
-				(strcmp(dev->data->name, name) == 0))
-			return dev;
-	}
-
-	return NULL;
-}
+struct rte_cryptodev *
+rte_cryptodev_pmd_get_named_dev(const char *name);
 
 /**
  * Validate if the crypto device index is valid attached crypto device.
@@ -202,20 +182,8 @@ rte_cryptodev_pmd_get_named_dev(const char *name)
  * @return
  *   - If the device index is valid (1) or not (0).
  */
-static inline unsigned
-rte_cryptodev_pmd_is_valid_dev(uint8_t dev_id)
-{
-	struct rte_cryptodev *dev = NULL;
-
-	if (dev_id >= rte_cryptodev_globals->nb_devs)
-		return 0;
-
-	dev = rte_cryptodev_pmd_get_dev(dev_id);
-	if (dev->attached != RTE_CRYPTODEV_ATTACHED)
-		return 0;
-	else
-		return 1;
-}
+unsigned
+rte_cryptodev_pmd_is_valid_dev(uint8_t dev_id);
 
 /**
  * The pool of rte_cryptodev structures.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index c581eea..a92df62 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -51,5 +51,8 @@ DPDK_17.02 {
 	global:
 
 	rte_cryptodev_pmd_create_dev_name;
+	rte_cryptodev_pmd_get_dev;
+	rte_cryptodev_pmd_get_named_dev;
+	rte_cryptodev_pmd_is_valid_dev;
 
 } DPDK_16.11;
-- 
2.9.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] cryptodev: crypto PMD functions incorrectly inlined
  2017-01-23 12:18 [dpdk-dev] [PATCH] cryptodev: crypto PMD functions incorrectly inlined Declan Doherty
@ 2017-01-23 12:24 ` Zhang, Roy Fan
  2017-01-24 10:37   ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang, Roy Fan @ 2017-01-23 12:24 UTC (permalink / raw)
  To: Doherty, Declan, dev; +Cc: De Lara Guarch, Pablo, stable, Doherty, Declan

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Declan Doherty
> Sent: Monday, January 23, 2017 12:19 PM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;
> stable@dpdk.org; Doherty, Declan <declan.doherty@intel.com>
> Subject: [dpdk-dev] [PATCH] cryptodev: crypto PMD functions incorrectly
> inlined
> 
> rte_cryptodev_pmd_get_dev, rte_cryptodev_pmd_get_named_dev,
> rte_cryptodev_pmd_is_valid_dev were incorrectly marked as inline and
> therefore not useable from crypto PMDs when built as shared libraries as
> they accessed the global rte_cryptodev_globals device structure.
> 
> Fixes: d11b0f30 ("cryptodev: introduce API and framework for crypto
> devices")
> 
> Signed-off-by: Declan Doherty <declan.doherty@intel.com>
> ---
>  lib/librte_cryptodev/rte_cryptodev.c           | 42
> ++++++++++++++++++++++++
>  lib/librte_cryptodev/rte_cryptodev_pmd.h       | 44 ++++----------------------
>  lib/librte_cryptodev/rte_cryptodev_version.map |  3 ++
>  3 files changed, 51 insertions(+), 38 deletions(-)
> 
> diff --git a/lib/librte_cryptodev/rte_cryptodev.c
> b/lib/librte_cryptodev/rte_cryptodev.c
> index 6a51eec..42707cb 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.c
> +++ b/lib/librte_cryptodev/rte_cryptodev.c
> @@ -255,6 +255,48 @@ rte_cryptodev_create_vdev(const char *name,
> const char *args)
>  	return rte_eal_vdev_init(name, args);
>  }
> 
> +struct rte_cryptodev *
> +rte_cryptodev_pmd_get_dev(uint8_t dev_id) {
> +	return &rte_cryptodev_globals->devs[dev_id];
> +}
> +
> +struct rte_cryptodev *
> +rte_cryptodev_pmd_get_named_dev(const char *name) {
> +	struct rte_cryptodev *dev;
> +	unsigned i;
> +
> +	if (name == NULL)
> +		return NULL;
> +
> +	for (i = 0; i < rte_cryptodev_globals->max_devs; i++) {
> +		dev = &rte_cryptodev_globals->devs[i];
> +
> +		if ((dev->attached == RTE_CRYPTODEV_ATTACHED) &&
> +				(strcmp(dev->data->name, name) == 0))
> +			return dev;
> +	}
> +
> +	return NULL;
> +}
> +
> +unsigned
> +rte_cryptodev_pmd_is_valid_dev(uint8_t dev_id) {
> +	struct rte_cryptodev *dev = NULL;
> +
> +	if (dev_id >= rte_cryptodev_globals->nb_devs)
> +		return 0;
> +
> +	dev = rte_cryptodev_pmd_get_dev(dev_id);
> +	if (dev->attached != RTE_CRYPTODEV_ATTACHED)
> +		return 0;
> +	else
> +		return 1;
> +}
> +
> +
>  int
>  rte_cryptodev_get_dev_id(const char *name)  { diff --git
> a/lib/librte_cryptodev/rte_cryptodev_pmd.h
> b/lib/librte_cryptodev/rte_cryptodev_pmd.h
> index aabef41..b6dc32c 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
> +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
> @@ -160,11 +160,8 @@ extern struct rte_cryptodev_global
> *rte_cryptodev_globals;
>   * @return
>   *   - The rte_cryptodev structure pointer for the given device ID.
>   */
> -static inline struct rte_cryptodev *
> -rte_cryptodev_pmd_get_dev(uint8_t dev_id) -{
> -	return &rte_cryptodev_globals->devs[dev_id];
> -}
> +struct rte_cryptodev *
> +rte_cryptodev_pmd_get_dev(uint8_t dev_id);
> 
>  /**
>   * Get the rte_cryptodev structure device pointer for the named device.
> @@ -174,25 +171,8 @@ rte_cryptodev_pmd_get_dev(uint8_t dev_id)
>   * @return
>   *   - The rte_cryptodev structure pointer for the given device ID.
>   */
> -static inline struct rte_cryptodev *
> -rte_cryptodev_pmd_get_named_dev(const char *name) -{
> -	struct rte_cryptodev *dev;
> -	unsigned i;
> -
> -	if (name == NULL)
> -		return NULL;
> -
> -	for (i = 0; i < rte_cryptodev_globals->max_devs; i++) {
> -		dev = &rte_cryptodev_globals->devs[i];
> -
> -		if ((dev->attached == RTE_CRYPTODEV_ATTACHED) &&
> -				(strcmp(dev->data->name, name) == 0))
> -			return dev;
> -	}
> -
> -	return NULL;
> -}
> +struct rte_cryptodev *
> +rte_cryptodev_pmd_get_named_dev(const char *name);
> 
>  /**
>   * Validate if the crypto device index is valid attached crypto device.
> @@ -202,20 +182,8 @@ rte_cryptodev_pmd_get_named_dev(const char
> *name)
>   * @return
>   *   - If the device index is valid (1) or not (0).
>   */
> -static inline unsigned
> -rte_cryptodev_pmd_is_valid_dev(uint8_t dev_id) -{
> -	struct rte_cryptodev *dev = NULL;
> -
> -	if (dev_id >= rte_cryptodev_globals->nb_devs)
> -		return 0;
> -
> -	dev = rte_cryptodev_pmd_get_dev(dev_id);
> -	if (dev->attached != RTE_CRYPTODEV_ATTACHED)
> -		return 0;
> -	else
> -		return 1;
> -}
> +unsigned
> +rte_cryptodev_pmd_is_valid_dev(uint8_t dev_id);
> 
>  /**
>   * The pool of rte_cryptodev structures.
> diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map
> b/lib/librte_cryptodev/rte_cryptodev_version.map
> index c581eea..a92df62 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_version.map
> +++ b/lib/librte_cryptodev/rte_cryptodev_version.map
> @@ -51,5 +51,8 @@ DPDK_17.02 {
>  	global:
> 
>  	rte_cryptodev_pmd_create_dev_name;
> +	rte_cryptodev_pmd_get_dev;
> +	rte_cryptodev_pmd_get_named_dev;
> +	rte_cryptodev_pmd_is_valid_dev;
> 
>  } DPDK_16.11;
> --
> 2.9.3

Acked-by: Fan Zhang <roy.fan.zhang@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] cryptodev: crypto PMD functions incorrectly inlined
  2017-01-23 12:24 ` Zhang, Roy Fan
@ 2017-01-24 10:37   ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 3+ messages in thread
From: De Lara Guarch, Pablo @ 2017-01-24 10:37 UTC (permalink / raw)
  To: Zhang, Roy Fan, Doherty, Declan, dev; +Cc: stable, Doherty, Declan



> -----Original Message-----
> From: Zhang, Roy Fan
> Sent: Monday, January 23, 2017 12:25 PM
> To: Doherty, Declan; dev@dpdk.org
> Cc: De Lara Guarch, Pablo; stable@dpdk.org; Doherty, Declan
> Subject: RE: [dpdk-dev] [PATCH] cryptodev: crypto PMD functions
> incorrectly inlined
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Declan Doherty
> > Sent: Monday, January 23, 2017 12:19 PM
> > To: dev@dpdk.org
> > Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;
> > stable@dpdk.org; Doherty, Declan <declan.doherty@intel.com>
> > Subject: [dpdk-dev] [PATCH] cryptodev: crypto PMD functions incorrectly
> > inlined
> >
> > rte_cryptodev_pmd_get_dev, rte_cryptodev_pmd_get_named_dev,
> > rte_cryptodev_pmd_is_valid_dev were incorrectly marked as inline and
> > therefore not useable from crypto PMDs when built as shared libraries as
> > they accessed the global rte_cryptodev_globals device structure.
> >
> > Fixes: d11b0f30 ("cryptodev: introduce API and framework for crypto
> > devices")
> >
> > Signed-off-by: Declan Doherty <declan.doherty@intel.com>

...
> Acked-by: Fan Zhang <roy.fan.zhang@intel.com>

Applied to dpdk-next-crypto.
Thanks,

Pablo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-24 10:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-23 12:18 [dpdk-dev] [PATCH] cryptodev: crypto PMD functions incorrectly inlined Declan Doherty
2017-01-23 12:24 ` Zhang, Roy Fan
2017-01-24 10:37   ` De Lara Guarch, Pablo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).