summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAnoob Joseph <anoob.joseph@caviumnetworks.com>2018-09-07 11:25:26 +0530
committerAkhil Goyal <akhil.goyal@nxp.com>2018-09-25 17:57:25 +0200
commit2e960c97c6b9311bea90b775e21a4b99ac1d50dc (patch)
tree72a333050c5cba38bdd9e26d02f1285bfe20cffd /examples
parentf48cc7af02abc8a462bc0020aa76878d5238a753 (diff)
downloaddpdk-2e960c97c6b9311bea90b775e21a4b99ac1d50dc.zip
dpdk-2e960c97c6b9311bea90b775e21a4b99ac1d50dc.tar.gz
dpdk-2e960c97c6b9311bea90b775e21a4b99ac1d50dc.tar.xz
examples/ipsec-secgw: fix wrong session size
Crypto devices, which support lookaside protocol, exposes security session size in addition to the crypto private symmetric session data size. For applications using the security capabilities, both these sizes need to be considered. Fixes: ec17993a145a ("examples/ipsec-secgw: support security offload") Cc: stable@dpdk.org Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com> Signed-off-by: Archana Muniganti <muniganti.archana@caviumnetworks.com> Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/ipsec-secgw/ipsec-secgw.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index f9a90c6..1bc0b5b 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1391,9 +1391,27 @@ cryptodevs_init(void)
uint32_t max_sess_sz = 0, sess_sz;
for (cdev_id = 0; cdev_id < rte_cryptodev_count(); cdev_id++) {
+ void *sec_ctx;
+
+ /* Get crypto priv session size */
sess_sz = rte_cryptodev_sym_get_private_session_size(cdev_id);
if (sess_sz > max_sess_sz)
max_sess_sz = sess_sz;
+
+ /*
+ * If crypto device is security capable, need to check the
+ * size of security session as well.
+ */
+
+ /* Get security context of the crypto device */
+ sec_ctx = rte_cryptodev_get_sec_ctx(cdev_id);
+ if (sec_ctx == NULL)
+ continue;
+
+ /* Get size of security session */
+ sess_sz = rte_security_session_get_size(sec_ctx);
+ if (sess_sz > max_sess_sz)
+ max_sess_sz = sess_sz;
}
RTE_ETH_FOREACH_DEV(port_id) {
void *sec_ctx;