[dpdk-dev] [PATCH v1 2/5] ipsec: add SAD create/free API

Ananyev, Konstantin konstantin.ananyev at intel.com
Thu Sep 12 20:08:24 CEST 2019


> --- a/lib/librte_ipsec/ipsec_sad.c
> +++ b/lib/librte_ipsec/ipsec_sad.c
> @@ -2,10 +2,41 @@
>   * Copyright(c) 2019 Intel Corporation
>   */
> 
> +#include <rte_eal_memconfig.h>
>  #include <rte_errno.h>
> +#include <rte_hash.h>
> +#include <rte_jhash.h>
> +#include <rte_malloc.h>
> +#include <rte_random.h>
> +#include <rte_rwlock.h>
> +#include <rte_tailq.h>
> 
>  #include "rte_ipsec_sad.h"
> 
> +#define IPSEC_SAD_NAMESIZE	64
> +#define SAD_PREFIX		"SAD_"
> +/* "SAD_<name>" */
> +#define SAD_FORMAT		SAD_PREFIX "%s"
> +
> +#define DEFAULT_HASH_FUNC	rte_jhash
> +


As a nit - probably worth to add a comment what this structure is for,
Aslo might be better to use something more informative for names:
dip, dip_sip or so.
or even:


> +struct hash_cnt {
> +	uint32_t cnt_2;
> +	uint32_t cnt_3;
> +};
> +
> +struct rte_ipsec_sad {
> +	char name[IPSEC_SAD_NAMESIZE];
> +	struct rte_hash	*hash[RTE_IPSEC_SAD_KEY_TYPE_MASK];
> +	__extension__ struct hash_cnt cnt_arr[];
> +};
> +


More information about the dev mailing list