[v5,3/7] cryptodev: remove driver name from logs

Message ID 20181014204747.26621-4-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v5,1/7] net/mlx5: remove useless driver name comparison |

Checks

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

Commit Message

Thomas Monjalon Oct. 14, 2018, 8:47 p.m. UTC
  The logs printed by CDEV_LOG_* were prefixed with the driver name.

In order to avoid assigning the driver before the end of the probing,
the driver name is removed from the cryptodev library logs.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/librte_cryptodev/rte_cryptodev_pmd.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)
  

Comments

Thomas Monjalon Oct. 15, 2018, 8:51 a.m. UTC | #1
+Cc Declan

14/10/2018 22:47, Thomas Monjalon:
> The logs printed by CDEV_LOG_* were prefixed with the driver name.
> 
> In order to avoid assigning the driver before the end of the probing,
> the driver name is removed from the cryptodev library logs.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  lib/librte_cryptodev/rte_cryptodev_pmd.c | 23 ++++++++---------------
>  1 file changed, 8 insertions(+), 15 deletions(-)
> 
> diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c
> index 2088ac3f3..f03bdbd5e 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
> +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
> @@ -93,24 +93,20 @@ rte_cryptodev_pmd_create(const char *name,
>  	struct rte_cryptodev *cryptodev;
>  
>  	if (params->name[0] != '\0') {
> -		CDEV_LOG_INFO("[%s] User specified device name = %s\n",
> -				device->driver->name, params->name);
> +		CDEV_LOG_INFO("User specified device name = %s\n", params->name);
>  		name = params->name;
>  	}
>  
> -	CDEV_LOG_INFO("[%s] - Creating cryptodev %s\n",
> -			device->driver->name, name);
> +	CDEV_LOG_INFO("Creating cryptodev %s\n", name);
>  
> -	CDEV_LOG_INFO("[%s] - Initialisation parameters - name: %s,"
> +	CDEV_LOG_INFO("Initialisation parameters - name: %s,"
>  			"socket id: %d, max queue pairs: %u",
> -			device->driver->name, name,
> -			params->socket_id, params->max_nb_queue_pairs);
> +			name, params->socket_id, params->max_nb_queue_pairs);
>  
>  	/* allocate device structure */
>  	cryptodev = rte_cryptodev_pmd_allocate(name, params->socket_id);
>  	if (cryptodev == NULL) {
> -		CDEV_LOG_ERR("[%s] Failed to allocate crypto device for %s",
> -				device->driver->name, name);
> +		CDEV_LOG_ERR("Failed to allocate crypto device for %s", name);
>  		return NULL;
>  	}
>  
> @@ -123,9 +119,8 @@ rte_cryptodev_pmd_create(const char *name,
>  						params->socket_id);
>  
>  		if (cryptodev->data->dev_private == NULL) {
> -			CDEV_LOG_ERR("[%s] Cannot allocate memory for "
> -					"cryptodev %s private data",
> -					device->driver->name, name);
> +			CDEV_LOG_ERR("Cannot allocate memory for cryptodev %s"
> +					" private data", name);
>  
>  			rte_cryptodev_pmd_release_device(cryptodev);
>  			return NULL;
> @@ -145,9 +140,7 @@ rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)
>  {
>  	int retval;
>  
> -	CDEV_LOG_INFO("[%s] Closing crypto device %s",
> -			cryptodev->device->driver->name,
> -			cryptodev->device->name);
> +	CDEV_LOG_INFO("Closing crypto device %s", cryptodev->device->name);
>  
>  	/* free crypto device */
>  	retval = rte_cryptodev_pmd_release_device(cryptodev);
>
  

Patch

diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c
index 2088ac3f3..f03bdbd5e 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
@@ -93,24 +93,20 @@  rte_cryptodev_pmd_create(const char *name,
 	struct rte_cryptodev *cryptodev;
 
 	if (params->name[0] != '\0') {
-		CDEV_LOG_INFO("[%s] User specified device name = %s\n",
-				device->driver->name, params->name);
+		CDEV_LOG_INFO("User specified device name = %s\n", params->name);
 		name = params->name;
 	}
 
-	CDEV_LOG_INFO("[%s] - Creating cryptodev %s\n",
-			device->driver->name, name);
+	CDEV_LOG_INFO("Creating cryptodev %s\n", name);
 
-	CDEV_LOG_INFO("[%s] - Initialisation parameters - name: %s,"
+	CDEV_LOG_INFO("Initialisation parameters - name: %s,"
 			"socket id: %d, max queue pairs: %u",
-			device->driver->name, name,
-			params->socket_id, params->max_nb_queue_pairs);
+			name, params->socket_id, params->max_nb_queue_pairs);
 
 	/* allocate device structure */
 	cryptodev = rte_cryptodev_pmd_allocate(name, params->socket_id);
 	if (cryptodev == NULL) {
-		CDEV_LOG_ERR("[%s] Failed to allocate crypto device for %s",
-				device->driver->name, name);
+		CDEV_LOG_ERR("Failed to allocate crypto device for %s", name);
 		return NULL;
 	}
 
@@ -123,9 +119,8 @@  rte_cryptodev_pmd_create(const char *name,
 						params->socket_id);
 
 		if (cryptodev->data->dev_private == NULL) {
-			CDEV_LOG_ERR("[%s] Cannot allocate memory for "
-					"cryptodev %s private data",
-					device->driver->name, name);
+			CDEV_LOG_ERR("Cannot allocate memory for cryptodev %s"
+					" private data", name);
 
 			rte_cryptodev_pmd_release_device(cryptodev);
 			return NULL;
@@ -145,9 +140,7 @@  rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)
 {
 	int retval;
 
-	CDEV_LOG_INFO("[%s] Closing crypto device %s",
-			cryptodev->device->driver->name,
-			cryptodev->device->name);
+	CDEV_LOG_INFO("Closing crypto device %s", cryptodev->device->name);
 
 	/* free crypto device */
 	retval = rte_cryptodev_pmd_release_device(cryptodev);