test/security: check MACSEC offload before configuration

Message ID 20250124182235.3587648-1-gakhil@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series test/security: check MACSEC offload before configuration |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS

Commit Message

Akhil Goyal Jan. 24, 2025, 6:22 p.m. UTC
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(+)
  

Comments

Akhil Goyal Feb. 6, 2025, 12:36 p.m. UTC | #1
> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> Sent: Friday, January 24, 2025 11:53 PM
> To: dev@dpdk.org
> Cc: Akhil Goyal <gakhil@marvell.com>
> Subject: [PATCH] test/security: check MACSEC offload before configuration
> 
> 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>
Applied to dpdk-next-crypto
  

Patch

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);