[dpdk-dev,v6,01/11] crypto/dpaa: replace rte_panic instances in crypto/dpaa driver

Message ID 1524552123-31378-2-git-send-email-arnon@qwilt.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Checks

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

Commit Message

Arnon Warshavsky April 24, 2018, 6:41 a.m. UTC
  replace panic calls with log and return value.

Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 8 +++++---
 drivers/crypto/dpaa_sec/dpaa_sec.c          | 8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)
  

Comments

Stephen Hemminger April 24, 2018, 3 p.m. UTC | #1
On Tue, 24 Apr 2018 09:41:53 +0300
Arnon Warshavsky <arnon@qwilt.com> wrote:

> +		if (cryptodev->data->dev_private == NULL) {
> +			RTE_LOG(ERR, PMD, "%s() Cannot allocate memzone for private device data",
> +			__func__);

dpaa2_sec is already doing private log type, via DPAA2_SEC_LOG macro.

You should go through your patch and make sure there are as few direct calls
to RTE_LOG as possible.
  
Arnon Warshavsky April 24, 2018, 7:27 p.m. UTC | #2
>
>
> > +             if (cryptodev->data->dev_private == NULL) {
> > +                     RTE_LOG(ERR, PMD, "%s() Cannot allocate memzone
> for private device data",
> > +                     __func__);
>
> dpaa2_sec is already doing private log type, via DPAA2_SEC_LOG macro.
>
> You should go through your patch and make sure there are as few direct
> calls
> to RTE_LOG as possible.
>

Thanks Stephen,
missed that one which seems to be declared but not yet used.Will replace

I may be missing something here.
While seeing the point in a short common form such as PMD_DRV_LOG,
why won't dpaa use the same syntax rather than adding another syntax
variant which does pretty much the same?
  

Patch

diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 58cbce8..75c50a5 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -2883,9 +2883,11 @@  struct rte_security_ops dpaa2_sec_security_ops = {
 					RTE_CACHE_LINE_SIZE,
 					rte_socket_id());
 
-		if (cryptodev->data->dev_private == NULL)
-			rte_panic("Cannot allocate memzone for private "
-				  "device data");
+		if (cryptodev->data->dev_private == NULL) {
+			RTE_LOG(ERR, PMD, "%s() Cannot allocate memzone for private device data",
+			__func__);
+			return -ENOMEM;
+		}
 	}
 
 	dpaa2_dev->cryptodev = cryptodev;
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index e456fd5..025f844 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -2384,9 +2384,11 @@  struct rte_security_ops dpaa_sec_security_ops = {
 					RTE_CACHE_LINE_SIZE,
 					rte_socket_id());
 
-		if (cryptodev->data->dev_private == NULL)
-			rte_panic("Cannot allocate memzone for private "
-					"device data");
+		if (cryptodev->data->dev_private == NULL) {
+			RTE_LOG(ERR, PMD, "%s() Cannot allocate memzone for private device data",
+			__func__);
+			return -ENOMEM;
+		}
 	}
 
 	dpaa_dev->crypto_dev = cryptodev;