From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 05D0DA0524; Fri, 31 Jan 2020 18:39:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CE7971C123; Fri, 31 Jan 2020 18:39:53 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 90B211C10F for ; Fri, 31 Jan 2020 18:39:50 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2020 09:39:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,386,1574150400"; d="scan'208";a="223202779" Received: from silpixa00400072.ir.intel.com ([10.237.222.213]) by orsmga008.jf.intel.com with ESMTP; 31 Jan 2020 09:39:49 -0800 From: Vladimir Medvedkin To: dev@dpdk.org Cc: konstantin.ananyev@intel.com, akhil.goyal@nxp.com Date: Fri, 31 Jan 2020 17:39:38 +0000 Message-Id: <1580492385-120134-2-git-send-email-vladimir.medvedkin@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1580492385-120134-1-git-send-email-vladimir.medvedkin@intel.com> References: <1580492385-120134-1-git-send-email-vladimir.medvedkin@intel.com> In-Reply-To: <1580306768-110555-1-git-send-email-vladimir.medvedkin@intel.com> References: <1580306768-110555-1-git-send-email-vladimir.medvedkin@intel.com> Subject: [dpdk-dev] [PATCH v6 1/8] ipsec: move ipsec sad name length into .h X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Move IPSEC_SAD_NAMESIZE into public header and rename it to RTE_IPSEC_SAD_NAMESIZE Signed-off-by: Vladimir Medvedkin Acked-by: Konstantin Ananyev Acked-by: Akhil Goyal --- lib/librte_ipsec/ipsec_sad.c | 20 ++++++++++---------- lib/librte_ipsec/rte_ipsec_sad.h | 2 ++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/librte_ipsec/ipsec_sad.c b/lib/librte_ipsec/ipsec_sad.c index db2c44c..2c994ed 100644 --- a/lib/librte_ipsec/ipsec_sad.c +++ b/lib/librte_ipsec/ipsec_sad.c @@ -20,7 +20,6 @@ * indicate presence of entries with the same SPI in DIP and DIP+SIP tables. */ -#define IPSEC_SAD_NAMESIZE 64 #define SAD_PREFIX "SAD_" /* "SAD_" */ #define SAD_FORMAT SAD_PREFIX "%s" @@ -34,7 +33,7 @@ struct hash_cnt { }; struct rte_ipsec_sad { - char name[IPSEC_SAD_NAMESIZE]; + char name[RTE_IPSEC_SAD_NAMESIZE]; struct rte_hash *hash[RTE_IPSEC_SAD_KEY_TYPE_MASK]; /* Array to track number of more specific rules * (spi_dip or spi_dip_sip). Used only in add/delete @@ -231,7 +230,7 @@ struct rte_ipsec_sad * rte_ipsec_sad_create(const char *name, const struct rte_ipsec_sad_conf *conf) { char hash_name[RTE_HASH_NAMESIZE]; - char sad_name[IPSEC_SAD_NAMESIZE]; + char sad_name[RTE_IPSEC_SAD_NAMESIZE]; struct rte_tailq_entry *te; struct rte_ipsec_sad_list *sad_list; struct rte_ipsec_sad *sad, *tmp_sad = NULL; @@ -249,8 +248,8 @@ rte_ipsec_sad_create(const char *name, const struct rte_ipsec_sad_conf *conf) return NULL; } - ret = snprintf(sad_name, IPSEC_SAD_NAMESIZE, SAD_FORMAT, name); - if (ret < 0 || ret >= IPSEC_SAD_NAMESIZE) { + ret = snprintf(sad_name, RTE_IPSEC_SAD_NAMESIZE, SAD_FORMAT, name); + if (ret < 0 || ret >= RTE_IPSEC_SAD_NAMESIZE) { rte_errno = ENAMETOOLONG; return NULL; } @@ -326,7 +325,8 @@ rte_ipsec_sad_create(const char *name, const struct rte_ipsec_sad_conf *conf) /* guarantee there's no existing */ TAILQ_FOREACH(te, sad_list, next) { tmp_sad = (struct rte_ipsec_sad *)te->data; - if (strncmp(sad_name, tmp_sad->name, IPSEC_SAD_NAMESIZE) == 0) + if (strncmp(sad_name, tmp_sad->name, + RTE_IPSEC_SAD_NAMESIZE) == 0) break; } if (te != NULL) { @@ -354,14 +354,14 @@ rte_ipsec_sad_create(const char *name, const struct rte_ipsec_sad_conf *conf) struct rte_ipsec_sad * rte_ipsec_sad_find_existing(const char *name) { - char sad_name[IPSEC_SAD_NAMESIZE]; + char sad_name[RTE_IPSEC_SAD_NAMESIZE]; struct rte_ipsec_sad *sad = NULL; struct rte_tailq_entry *te; struct rte_ipsec_sad_list *sad_list; int ret; - ret = snprintf(sad_name, IPSEC_SAD_NAMESIZE, SAD_FORMAT, name); - if (ret < 0 || ret >= IPSEC_SAD_NAMESIZE) { + ret = snprintf(sad_name, RTE_IPSEC_SAD_NAMESIZE, SAD_FORMAT, name); + if (ret < 0 || ret >= RTE_IPSEC_SAD_NAMESIZE) { rte_errno = ENAMETOOLONG; return NULL; } @@ -372,7 +372,7 @@ rte_ipsec_sad_find_existing(const char *name) rte_mcfg_tailq_read_lock(); TAILQ_FOREACH(te, sad_list, next) { sad = (struct rte_ipsec_sad *) te->data; - if (strncmp(sad_name, sad->name, IPSEC_SAD_NAMESIZE) == 0) + if (strncmp(sad_name, sad->name, RTE_IPSEC_SAD_NAMESIZE) == 0) break; } rte_mcfg_tailq_read_unlock(); diff --git a/lib/librte_ipsec/rte_ipsec_sad.h b/lib/librte_ipsec/rte_ipsec_sad.h index 8386f73..dcc8224 100644 --- a/lib/librte_ipsec/rte_ipsec_sad.h +++ b/lib/librte_ipsec/rte_ipsec_sad.h @@ -47,6 +47,8 @@ union rte_ipsec_sad_key { struct rte_ipsec_sadv6_key v6; }; +/** Max number of characters in SAD name. */ +#define RTE_IPSEC_SAD_NAMESIZE 64 /** Flag to create SAD with ipv6 dip and sip addresses */ #define RTE_IPSEC_SAD_FLAG_IPV6 0x1 /** Flag to support reader writer concurrency */ -- 2.7.4