[RFC,3/5] app/testpmd: macsec off command

Message ID 3abfda8b6646fde5b6c411a2e141bd04a4ec03c5.1559319237.git.igor.russkikh@aquantia.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers
Series [RFC,1/5] security: MACSEC infrastructure data declarations |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation fail Compilation issues

Commit Message

Igor Russkikh May 31, 2019, 4:14 p.m. UTC
  draft on how macsec off command will looks like

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 app/test-pmd/cmdline.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
  

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index dbee3d958c2e..af7c2853fd2c 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -14173,6 +14173,8 @@  cmd_set_macsec_offload_off_parsed(
 	int ret = -ENOTSUP;
 	struct rte_eth_dev_info dev_info;
 	portid_t port_id = res->port_id;
+	struct rte_security_ctx *ctx;
+	struct rte_eth_dev_info dev_info;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
 		return;
@@ -14181,14 +14183,24 @@  cmd_set_macsec_offload_off_parsed(
 		return;
 	}
 
-	rte_eth_dev_info_get(port_id, &dev_info);
-	if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MACSEC_INSERT) {
-#ifdef RTE_LIBRTE_IXGBE_PMD
-		ret = rte_pmd_ixgbe_macsec_disable(port_id);
-#endif
+	if (!macsec_session) {
+		printf("MACsec is not active\n", port_id);
+		return;
+	}
+
+	ctx = rte_eth_dev_get_sec_ctx(port_id);
+	if (!ctx) {
+		ret = -ENOTSUP;
+		goto done;
 	}
+
+	/* Use of the same mempool for session header and private data */
+	ret = rte_security_session_destroy(ctx, macsec_session);
+
+done:
 	switch (ret) {
 	case 0:
+		/* TBD: Remove this offload bit? */
 		ports[port_id].dev_conf.txmode.offloads &=
 						~DEV_TX_OFFLOAD_MACSEC_INSERT;
 		cmd_reconfig_device_queue(port_id, 1, 1);