DPDK patches and discussions
 help / color / mirror / Atom feed
From: Igor Russkikh <Igor.Russkikh@aquantia.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Cc: "ferruh.yigit@intel.com" <ferruh.yigit@intel.com>,
	Pavel Belous <Pavel.Belous@aquantia.com>,
	John McNamara <john.mcnamara@intel.com>,
	Konstantin Ananyev <konstantin.ananyev@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Akhil Goyal <akhil.goyal@nxp.com>,
	Declan Doherty <declan.doherty@intel.com>,
	Igor Russkikh <Igor.Russkikh@aquantia.com>
Subject: [dpdk-dev] [RFC 4/5] app/testpmd: macsec: update set sc command with new interface
Date: Fri, 31 May 2019 16:14:56 +0000	[thread overview]
Message-ID: <9ce5237e4ad0bf1e163d47323027277afb31457d.1559319237.git.igor.russkikh@aquantia.com> (raw)
In-Reply-To: <4595add642bf8ca1114488657d12a973b966e8f5.1559319237.git.igor.russkikh@aquantia.com>

---
 app/test-pmd/cmdline.c | 40 ++++++++++++++++++++++++++++++++--------
 1 file changed, 32 insertions(+), 8 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index af7c2853fd2c..1bcf63e31ee3 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -14083,6 +14083,7 @@ cmd_set_macsec_offload_on_parsed(
 
 	macsec_conf.action_type = RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL;
 	macsec_conf.protocol = RTE_SECURITY_PROTOCOL_MACSEC;
+	macsec_conf.macsec.
 	/** should be moved to SC properties */
 	macsec_encrypt = en;
 	macsec_replay_protection = rp;
@@ -14280,15 +14281,38 @@ cmd_set_macsec_sc_parsed(
 	struct cmd_macsec_sc_result *res = parsed_result;
 	int ret = -ENOTSUP;
 	int is_tx = (strcmp(res->tx_rx, "tx") == 0) ? 1 : 0;
+	struct rte_security_ctx *ctx;
+	struct rte_eth_dev_info dev_info;
+	struct rte_security_session_conf conf = {};
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
-	ret = is_tx ?
-		rte_pmd_ixgbe_macsec_config_txsc(res->port_id,
-				res->mac.addr_bytes) :
-		rte_pmd_ixgbe_macsec_config_rxsc(res->port_id,
-				res->mac.addr_bytes, res->pi);
-#endif
-	RTE_SET_USED(is_tx);
+	ctx = rte_eth_dev_get_sec_ctx(port_id);
+	if (!ctx) {
+		ret = ENOTSUP;
+		goto done;
+	}
+
+	if (is_tx) {
+		conf.macsec.op = RTE_SECURITY_MACSEC_OP_ADD_TXSC;
+
+		rte_memcpy(&conf.macsec.txsc_options.s_mac, res->mac.addr_bytes,
+			sizeof(struct ether_addr));
+		conf.macsec.txsc_options.encrypt = macsec_encrypt;
+		conf.macsec.txsc_options.protect = 1;
+
+		ret = rte_security_session_update(ctx, macsec_session, &conf);
+	} else {
+		conf.macsec.op = RTE_SECURITY_MACSEC_OP_ADD_RXSC;
+
+		rte_memcpy(&conf.macsec.rxsc_options.s_mac, res->mac.addr_bytes,
+			sizeof(struct ether_addr));
+		/* Default */
+		conf.macsec.rxsc_options.anti_replay_window = 0;
+		conf.macsec.rxsc_options.replay_protection = macsec_replay_protection;
+		conf.macsec.rxsc_options.auto_rollover_enabled = true;
+
+		ret = rte_security_session_update(ctx, macsec_session, &conf);
+
+	}
 
 	switch (ret) {
 	case 0:
-- 
2.17.1


  parent reply	other threads:[~2019-05-31 16:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31 16:14 [dpdk-dev] [RFC 1/5] security: MACSEC infrastructure data declarations Igor Russkikh
2019-05-31 16:14 ` [dpdk-dev] [RFC 2/5] app/testpmd: macsec on command draft via security context Igor Russkikh
2019-05-31 16:14 ` [dpdk-dev] [RFC 3/5] app/testpmd: macsec off command Igor Russkikh
2019-05-31 16:14 ` Igor Russkikh [this message]
2019-05-31 16:15 ` [dpdk-dev] [RFC 5/5] net/atlantic: macsec security context draft Igor Russkikh

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=9ce5237e4ad0bf1e163d47323027277afb31457d.1559319237.git.igor.russkikh@aquantia.com \
    --to=igor.russkikh@aquantia.com \
    --cc=Pavel.Belous@aquantia.com \
    --cc=akhil.goyal@nxp.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=thomas@monjalon.net \
    /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).