DPDK patches and discussions
 help / color / mirror / Atom feed
From: Akhil Goyal <gakhil@marvell.com>
To: <dev@dpdk.org>
Cc: Akhil Goyal <gakhil@marvell.com>
Subject: [PATCH] test/security: check MACSEC offload before configuration
Date: Fri, 24 Jan 2025 23:52:35 +0530	[thread overview]
Message-ID: <20250124182235.3587648-1-gakhil@marvell.com> (raw)

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


                 reply	other threads:[~2025-01-24 18:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250124182235.3587648-1-gakhil@marvell.com \
    --to=gakhil@marvell.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).