diff mbox series

[v3,2/2] app/proc-info: add crypto security context info

Message ID 20200713131501.17422-2-hemant.agrawal@nxp.com
State New
Headers show
Series [v3,1/2] app/proc-info: enhance mempool to print ops name | expand

Commit Message

Hemant Agrawal July 13, 2020, 1:15 p.m. UTC
This patch adds the crypto based security context info.
Also improve the flag printing to SECURITY OFFLOAD from
INLINE.

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

---
 app/proc-info/main.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

-- 
2.17.1
diff mbox series

Patch

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index a5d16765b..34acea12a 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -1169,7 +1169,7 @@  display_crypto_feature_info(uint64_t x)
 	printf("\t\t  + AESNI: CPU (%c), HW (%c)\n",
 		(x & RTE_CRYPTODEV_FF_CPU_AESNI) ? 'y' : 'n',
 		(x & RTE_CRYPTODEV_FF_HW_ACCELERATED) ? 'y' : 'n');
-	printf("\t\t  + INLINE (%c)\n",
+	printf("\t\t  + SECURITY OFFLOAD (%c)\n",
 		(x & RTE_CRYPTODEV_FF_SECURITY) ? 'y' : 'n');
 	printf("\t\t  + ARM: NEON (%c), CE (%c)\n",
 		(x & RTE_CRYPTODEV_FF_CPU_NEON) ? 'y' : 'n',
@@ -1226,6 +1226,26 @@  show_crypto(void)
 				stats.dequeued_count,
 				stats.dequeue_err_count);
 		}
+#ifdef RTE_LIBRTE_SECURITY
+		void *p_ctx = rte_eth_dev_get_sec_ctx(i);
+		printf("\t  -- security context - %p\n", p_ctx);
+
+		if (p_ctx) {
+			printf("\t  -- size %u\n",
+					rte_security_session_get_size(p_ctx));
+			const struct rte_security_capability *s_cap =
+				rte_security_capabilities_get(p_ctx);
+			if (s_cap) {
+				printf("\t  -- action (0x%x), protocol (0x%x),"
+						" offload flags (0x%x)\n",
+						s_cap->action,
+						s_cap->protocol,
+						s_cap->ol_flags);
+				printf("\t  -- capabilities - oper type %x\n",
+						s_cap->crypto_capabilities->op);
+			}
+		}
+#endif
 	}
 }