numam-dpdk/lib/ipsec/ses.c
Bruce Richardson 99a2dd955f lib: remove librte_ prefix from directory names
There is no reason for the DPDK libraries to all have 'librte_' prefix on
the directory names. This prefix makes the directory names longer and also
makes it awkward to add features referring to individual libraries in the
build - should the lib names be specified with or without the prefix.
Therefore, we can just remove the library prefix and use the library's
unique name as the directory name, i.e. 'eal' rather than 'librte_eal'

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2021-04-21 14:04:09 +02:00

54 lines
1.0 KiB
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2018-2020 Intel Corporation
*/
#include <rte_ipsec.h>
#include "sa.h"
static int
session_check(struct rte_ipsec_session *ss)
{
if (ss == NULL || ss->sa == NULL)
return -EINVAL;
if (ss->type == RTE_SECURITY_ACTION_TYPE_NONE ||
ss->type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO) {
if (ss->crypto.ses == NULL)
return -EINVAL;
} else {
if (ss->security.ses == NULL)
return -EINVAL;
if ((ss->type == RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO ||
ss->type ==
RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL) &&
ss->security.ctx == NULL)
return -EINVAL;
}
return 0;
}
int
rte_ipsec_session_prepare(struct rte_ipsec_session *ss)
{
int32_t rc;
struct rte_ipsec_sa_pkt_func fp;
rc = session_check(ss);
if (rc != 0)
return rc;
rc = ipsec_sa_pkt_func_select(ss, ss->sa, &fp);
if (rc != 0)
return rc;
ss->pkt_func = fp;
if (ss->type == RTE_SECURITY_ACTION_TYPE_NONE)
ss->crypto.ses->opaque_data = (uintptr_t)ss;
else
ss->security.ses->opaque_data = (uintptr_t)ss;
return 0;
}