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

Reply via email to