diff mbox series

[v3,1/1] app/procinfo: fix security context info

Message ID 20210126130616.3840205-1-thomas@monjalon.net
State Accepted
Commit 026a546a22ab20c325f07435e3a12debd267524d
Headers show
Series [v3,1/1] app/procinfo: fix security context info | expand

Commit Message

Thomas Monjalon Jan. 26, 2021, 1:06 p.m. UTC
From: Hemant Agrawal <hemant.agrawal@nxp.com>


We need to differentiate between crypto and ethernet security
context as they belong to different devices.

Fixes: d82d6ac64338 ("app/procinfo: add crypto security context info")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>

---
v3: include stdbool.h and use true/false instead of 1/0
---
 app/proc-info/main.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

-- 
2.30.0

Comments

Thomas Monjalon Jan. 26, 2021, 1:08 p.m. UTC | #1
26/01/2021 14:06, Thomas Monjalon:
> From: Hemant Agrawal <hemant.agrawal@nxp.com>

> 

> We need to differentiate between crypto and ethernet security

> context as they belong to different devices.

> 

> Fixes: d82d6ac64338 ("app/procinfo: add crypto security context info")

> Cc: stable@dpdk.org

> 

> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>

> ---

> v3: include stdbool.h and use true/false instead of 1/0


Applied, thanks
diff mbox series

Patch

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 44249dd2cb..b9587f7ded 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -5,6 +5,7 @@ 
 #include <stdio.h>
 #include <string.h>
 #include <stdint.h>
+#include <stdbool.h>
 #include <errno.h>
 #include <stdarg.h>
 #include <inttypes.h>
@@ -645,11 +646,16 @@  metrics_display(int port_id)
 }
 
 static void
-show_security_context(uint16_t portid)
+show_security_context(uint16_t portid, bool inline_offload)
 {
-	void *p_ctx = rte_eth_dev_get_sec_ctx(portid);
+	void *p_ctx;
 	const struct rte_security_capability *s_cap;
 
+	if (inline_offload)
+		p_ctx = rte_eth_dev_get_sec_ctx(portid);
+	else
+		p_ctx = rte_cryptodev_get_sec_ctx(portid);
+
 	if (p_ctx == NULL)
 		return;
 
@@ -856,7 +862,7 @@  show_port(void)
 		}
 
 #ifdef RTE_LIB_SECURITY
-		show_security_context(i);
+		show_security_context(i, true);
 #endif
 	}
 }
@@ -1220,7 +1226,7 @@  show_crypto(void)
 		}
 
 #ifdef RTE_LIB_SECURITY
-		show_security_context(i);
+		show_security_context(i, false);
 #endif
 	}
 }