#include "ipsec.h"
#include "sad.h"
.v4 = NULL,
.v6 = NULL,
.mask = 0,
};
int
ipsec_sad_add(struct ipsec_sad *sad, struct ipsec_sa *sa)
{
int ret;
void *tmp = NULL;
union rte_ipsec_sad_key key = { {0} };
const union rte_ipsec_sad_key *lookup_key[1];
lookup_key[0] = &key;
switch (WITHOUT_TRANSPORT_VERSION(sa->flags)) {
case IP4_TUNNEL:
if (tmp != NULL)
return -EEXIST;
RTE_IPSEC_SAD_SPI_ONLY, sa);
if (ret != 0)
return ret;
break;
case IP6_TUNNEL:
if (tmp != NULL)
return -EEXIST;
RTE_IPSEC_SAD_SPI_ONLY, sa);
if (ret != 0)
return ret;
break;
case TRANSPORT:
if (sp4_spi_present(sa->spi, 1, NULL, NULL) >= 0) {
if (tmp != NULL)
return -EEXIST;
RTE_IPSEC_SAD_SPI_ONLY, sa);
if (ret != 0)
return ret;
}
if (sp6_spi_present(sa->spi, 1, NULL, NULL) >= 0) {
if (tmp != NULL)
return -EEXIST;
RTE_IPSEC_SAD_SPI_ONLY, sa);
if (ret != 0)
return ret;
}
}
return 0;
}
int
ipsec_sad_lcore_cache_init(uint32_t nb_cache_ent)
{
uint32_t cache_elem;
size_t cache_mem_sz;
struct ipsec_sad_cache *cache;
cache_mem_sz = sizeof(struct ipsec_sa *) * cache_elem;
if (cache_mem_sz != 0) {
if (cache->v4 == NULL)
if (cache->v6 == NULL)
cache->mask = cache_elem - 1;
}
return 0;
}
int
ipsec_sad_create(const char *name, struct ipsec_sad *sad,
int socket_id, struct ipsec_sa_cnt *sa_cnt)
{
int ret;
if ((name == NULL) || (sad == NULL) || (sa_cnt == NULL))
return -EINVAL;
return -ENAMETOOLONG;
sad_conf.flags = 0;
sad_conf.max_sa[RTE_IPSEC_SAD_SPI_ONLY] = sa_cnt->nb_v4 * 5 / 4;
sad_conf.max_sa[RTE_IPSEC_SAD_SPI_DIP] = 0;
sad_conf.max_sa[RTE_IPSEC_SAD_SPI_DIP_SIP] = 0;
if (sa_cnt->nb_v4 != 0) {
sad->sad_v4 = rte_ipsec_sad_create(sad_name, &sad_conf);
if (sad->sad_v4 == NULL)
}
return -ENAMETOOLONG;
sad_conf.max_sa[RTE_IPSEC_SAD_SPI_ONLY] = sa_cnt->nb_v6 * 5 / 4;
if (sa_cnt->nb_v6 != 0) {
sad->sad_v6 = rte_ipsec_sad_create(name, &sad_conf);
if (sad->sad_v6 == NULL)
}
return 0;
}