diff mbox series

app/proc-info: fix security context info

Message ID 20201224075133.15020-1-hemant.agrawal@nxp.com
State Superseded
Headers show
Series app/proc-info: fix security context info | expand

Commit Message

Hemant Agrawal Dec. 24, 2020, 7:51 a.m. UTC
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>

---
 app/proc-info/main.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

-- 
2.17.1

Comments

Thomas Monjalon Jan. 15, 2021, 11:25 a.m. UTC | #1
24/12/2020 08:51, Hemant Agrawal:
>  static void

> -show_security_context(uint16_t portid)

> +show_security_context(uint16_t portid, uint8_t 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;

>  

> @@ -859,7 +864,7 @@ show_port(void)

>  		}

>  

>  #ifdef RTE_LIB_SECURITY

> -		show_security_context(i);

> +		show_security_context(i, 1);

>  #endif

>  	}

>  }

> @@ -1224,7 +1229,7 @@ show_crypto(void)

>  		}

>  

>  #ifdef RTE_LIB_SECURITY

> -		show_security_context(i);

> +		show_security_context(i, 0);

>  #endif


It seems this new parameter would better be a boolean.
diff mbox series

Patch

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index d743209f0d..6486a2419e 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -648,11 +648,16 @@  metrics_display(int port_id)
 }
 
 static void
-show_security_context(uint16_t portid)
+show_security_context(uint16_t portid, uint8_t 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;
 
@@ -859,7 +864,7 @@  show_port(void)
 		}
 
 #ifdef RTE_LIB_SECURITY
-		show_security_context(i);
+		show_security_context(i, 1);
 #endif
 	}
 }
@@ -1224,7 +1229,7 @@  show_crypto(void)
 		}
 
 #ifdef RTE_LIB_SECURITY
-		show_security_context(i);
+		show_security_context(i, 0);
 #endif
 	}
 }