Skip to content

Commit

Permalink
examples/ipsec-secgw: fix cryptodev to SA mapping
Browse files Browse the repository at this point in the history
[ upstream commit f406064ff0988a53f955c74a672d696c595dc0f0 ]

There are use cases where a SA should be able to use different
cryptodevs on different lcores, for example there can be cryptodevs
with just 1 qp per VF.
Hence, the check in create lookaside session function is relaxed.
Also added a check to verify that a CQP is available for the current lcore.

Fixes: a8ade12 ("examples/ipsec-secgw: create lookaside sessions at init")

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Tested-by: Ting-Kai Ku <ting-kai.ku@intel.com>
Acked-by: Ciara Power <ciara.power@intel.com>
Acked-by: Kai Ji <kai.ji@intel.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
  • Loading branch information
rnicolau authored and bluca committed Mar 18, 2024
1 parent a05a096 commit 642fff5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,7 @@ Timothy McDaniel <timothy.mcdaniel@intel.com>
Timothy Miskell <timothy.miskell@intel.com>
Timothy Redaelli <tredaelli@redhat.com>
Tim Shearer <tim.shearer@overturenetworks.com>
Ting-Kai Ku <ting-kai.ku@intel.com>
Ting Xu <ting.xu@intel.com>
Tiwei Bie <tiwei.bie@intel.com> <btw@mail.ustc.edu.cn>
Todd Fujinaka <todd.fujinaka@intel.com>
Expand Down
20 changes: 16 additions & 4 deletions examples/ipsec-secgw/ipsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,21 @@ create_lookaside_session(struct ipsec_ctx *ipsec_ctx_lcore[],
if (cdev_id == RTE_CRYPTO_MAX_DEVS)
cdev_id = ipsec_ctx->tbl[cdev_id_qp].id;
else if (cdev_id != ipsec_ctx->tbl[cdev_id_qp].id) {
RTE_LOG(ERR, IPSEC,
"SA mapping to multiple cryptodevs is "
"not supported!");
return -EINVAL;
struct rte_cryptodev_info dev_info_1, dev_info_2;
rte_cryptodev_info_get(cdev_id, &dev_info_1);
rte_cryptodev_info_get(ipsec_ctx->tbl[cdev_id_qp].id,
&dev_info_2);
if (dev_info_1.driver_id == dev_info_2.driver_id) {
RTE_LOG(WARNING, IPSEC,
"SA mapped to multiple cryptodevs for SPI %d\n",
sa->spi);

} else {
RTE_LOG(WARNING, IPSEC,
"SA mapped to multiple cryptodevs of different types for SPI %d\n",
sa->spi);

}
}

/* Store per core queue pair information */
Expand Down Expand Up @@ -758,6 +769,7 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx,
continue;
}

RTE_ASSERT(sa->cqp[ipsec_ctx->lcore_id] != NULL);
enqueue_cop(sa->cqp[ipsec_ctx->lcore_id], &priv->cop);
}
}
Expand Down

0 comments on commit 642fff5

Please sign in to comment.