Hi Bernard, > - RTE_LOG_DP(DEBUG, IPSEC, "Create session for SA spi %u on cryptodev " > - "%u qp %u\n", sa->spi, > - ipsec_ctx->tbl[cdev_id_qp].id, > - ipsec_ctx->tbl[cdev_id_qp].qp); > + if ((sa == NULL) || (pool == NULL)) > + return -EINVAL; > > - if (sa->type != RTE_SECURITY_ACTION_TYPE_NONE) { > - struct rte_security_session_conf sess_conf = { > + struct rte_security_session_conf sess_conf = { > .action_type = sa->type, > .protocol = RTE_SECURITY_PROTOCOL_IPSEC, > {.ipsec = { > @@ -90,247 +65,340 @@ create_session(struct ipsec_ctx *ipsec_ctx, struct > ipsec_sa *sa) > } }, > .crypto_xform = sa->xforms, > .userdata = NULL, > - > }; > > - if (sa->type == RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL) > { > - struct rte_security_ctx *ctx = (struct > rte_security_ctx *) > - > rte_cryptodev_get_sec_ctx( > - > ipsec_ctx->tbl[cdev_id_qp].id); > - > - /* Set IPsec parameters in conf */ > - set_ipsec_conf(sa, &(sess_conf.ipsec)); > - > - sa->sec_session = rte_security_session_create(ctx, > - &sess_conf, ipsec_ctx->session_pool); > - if (sa->sec_session == NULL) { > - RTE_LOG(ERR, IPSEC, > - "SEC Session init failed: err: %d\n", ret); > - return -1; > - } > - } else if (sa->type == > RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO) { > - struct rte_flow_error err; > - struct rte_security_ctx *ctx = (struct > rte_security_ctx *) > - > rte_eth_dev_get_sec_ctx( > - sa->portid); > - const struct rte_security_capability *sec_cap; > - int ret = 0; > - > - sa->sec_session = rte_security_session_create(ctx, > - &sess_conf, ipsec_ctx->session_pool); > - if (sa->sec_session == NULL) { > - RTE_LOG(ERR, IPSEC, > - "SEC Session init failed: err: %d\n", ret); > - return -1; > - } > + if (sa->type == RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL) { > + ctx = (struct rte_security_ctx *) > + rte_eth_dev_get_sec_ctx(sa->portid);
This is breaking the lookaside mode. Ctx was retrieved using the ipsec_ctx->tbl struct rte_security_ctx *ctx = (struct rte_security_ctx *) rte_cryptodev_get_sec_ctx( ipsec_ctx->tbl[cdev_id_qp].id); I am looking into it, but I don't have time left to get it integrated in RC2. So this has to be pushed to RC3 > > - sec_cap = rte_security_capabilities_get(ctx); > + /* Set IPsec parameters in conf */ > + set_ipsec_conf(sa, &(sess_conf.ipsec)); > > - /* iterate until ESP tunnel*/ > - while (sec_cap->action != > - RTE_SECURITY_ACTION_TYPE_NONE) { > + sa->sec_session = rte_security_session_create(ctx, > + &sess_conf, pool); > + if (sa->sec_session == NULL) { > + RTE_LOG(ERR, IPSEC, > + "SEC Session init failed: err: %d\n", > + ret); > + return -1; > + }