DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] test/security: check MACSEC offload before configuration
@ 2025-01-24 18:22 Akhil Goyal
  0 siblings, 0 replies; only message in thread
From: Akhil Goyal @ 2025-01-24 18:22 UTC (permalink / raw)
  To: dev; +Cc: Akhil Goyal

rte_ethdev_dev_configure need application to check the
device info if the offload flags are supported or not.
Added check to verify MACsec is supported before configuring
ethernet inline device.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
---
 app/test/test_security_inline_macsec.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/app/test/test_security_inline_macsec.c b/app/test/test_security_inline_macsec.c
index c921bf8ebb..4043667701 100644
--- a/app/test/test_security_inline_macsec.c
+++ b/app/test/test_security_inline_macsec.c
@@ -2358,6 +2358,7 @@ ut_teardown_inline_macsec(void)
 static int
 inline_macsec_testsuite_setup(void)
 {
+	struct rte_eth_dev_info dev_info;
 	uint16_t nb_rxd;
 	uint16_t nb_txd;
 	uint16_t nb_ports;
@@ -2400,6 +2401,19 @@ inline_macsec_testsuite_setup(void)
 
 	/* configuring port 0 for the test is enough */
 	port_id = 0;
+	if (rte_eth_dev_info_get(port_id, &dev_info)) {
+		printf("Failed to get devinfo");
+		return -1;
+	}
+
+	if ((dev_info.rx_offload_capa & RTE_ETH_RX_OFFLOAD_MACSEC_STRIP) !=
+				RTE_ETH_RX_OFFLOAD_MACSEC_STRIP ||
+	    (dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_MACSEC_INSERT) !=
+				RTE_ETH_TX_OFFLOAD_MACSEC_INSERT) {
+		printf("Device does not support MACsec\n");
+		return TEST_SKIPPED;
+	}
+
 	/* port configure */
 	ret = rte_eth_dev_configure(port_id, nb_rx_queue,
 				    nb_tx_queue, &port_conf);
-- 
2.25.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-01-24 18:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-24 18:22 [PATCH] test/security: check MACSEC offload before configuration Akhil Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).