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 55E60A0565; Tue, 10 Mar 2020 10:13:33 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BA6991C012; Tue, 10 Mar 2020 10:13:32 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 780D11C00D for ; Tue, 10 Mar 2020 10:13:31 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02A95jmw009070; Tue, 10 Mar 2020 02:13:30 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=ZG6+kxZlPMSsH/kXT1bPK7nU5ELh3sJ2gfdOtcCgDEk=; b=WNevm10S5i/uW/oFIjeym0c77m8PLvkz+cgM9QCmfZDN+dcshmQyAhYny5rWs3s6Qj2T TWyEB1xa7e10j5AUDmdbaVjhhY2O0ADuivmeNC9G289xg3I4IGGszuGWucuZjzbkhsoB dQqDb04w7Rev32D9ERyNgmQYZC6DyLgCoiVWIOUDIp3yk0iMS6oQtjxB67yg0yrKrYoG 50+1aC5ycx2tHKrMnya72l12p7F15OIzxWsaTofFPMco7rHGz6ogTj47d4IXLvS/36G3 F7aXJawOwQ8kLuRIAXeY9Eh826NySp8Oiz9c7tcLwofuKQm7mLOdfu7inQXV6veUvwQz Rw== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2yp04fj881-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 10 Mar 2020 02:13:30 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 10 Mar 2020 02:13:28 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 10 Mar 2020 02:13:28 -0700 Received: from amok.marvell.com (unknown [10.95.130.112]) by maili.marvell.com (Postfix) with ESMTP id 8DD073F703F; Tue, 10 Mar 2020 02:13:27 -0700 (PDT) From: Andrzej Ostruszka To: , Bruce Richardson , Vladimir Medvedkin CC: Date: Tue, 10 Mar 2020 10:13:26 +0100 Message-ID: <20200310091326.5017-1-aostruszka@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200303125345.26317-1-aostruszka@marvell.com> References: <20200303125345.26317-1-aostruszka@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-03-10_04:2020-03-09, 2020-03-10 signatures=0 Subject: [dpdk-dev] [PATCH v2] lpm6: make IPv6 addresses immutable 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" None of the public functions modify IPv6 address passed. So their parameters are made const - with the exception of bulk functions. This exception is due to compatibility problems - some compilers report problems with const-casting of array of arrays. Previously only lookup and add were updated to have addresses passed as const so I'm adding this fixline. Fixes: d82927d2f81d ("lpm6: make IPv6 address immutable") Cc: stephen@networkplumber.org Signed-off-by: Andrzej Ostruszka --- V2 changes: ----------- * reverted changes to the bulk functions and modified commit message to reflect that --- lib/librte_lpm/rte_lpm6.c | 6 +++--- lib/librte_lpm/rte_lpm6.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c index d515600f1..1047efa8a 100644 --- a/lib/librte_lpm/rte_lpm6.c +++ b/lib/librte_lpm/rte_lpm6.c @@ -1019,8 +1019,8 @@ rte_lpm6_lookup_bulk_func(const struct rte_lpm6 *lpm, * Look for a rule in the high-level rules table */ int -rte_lpm6_is_rule_present(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth, - uint32_t *next_hop) +rte_lpm6_is_rule_present(struct rte_lpm6 *lpm, const uint8_t *ip, uint8_t depth, + uint32_t *next_hop) { uint8_t masked_ip[RTE_LPM6_IPV6_ADDR_SIZE]; @@ -1290,7 +1290,7 @@ remove_tbl(struct rte_lpm6 *lpm, struct rte_lpm_tbl8_hdr *tbl_hdr, * Deletes a rule */ int -rte_lpm6_delete(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth) +rte_lpm6_delete(struct rte_lpm6 *lpm, const uint8_t *ip, uint8_t depth) { uint8_t masked_ip[RTE_LPM6_IPV6_ADDR_SIZE]; struct rte_lpm6_rule lsp_rule_obj; diff --git a/lib/librte_lpm/rte_lpm6.h b/lib/librte_lpm/rte_lpm6.h index 042991f8c..f96f3372e 100644 --- a/lib/librte_lpm/rte_lpm6.h +++ b/lib/librte_lpm/rte_lpm6.h @@ -113,8 +113,8 @@ rte_lpm6_add(struct rte_lpm6 *lpm, const uint8_t *ip, uint8_t depth, * 1 if the rule exists, 0 if it does not, a negative value on failure */ int -rte_lpm6_is_rule_present(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth, - uint32_t *next_hop); +rte_lpm6_is_rule_present(struct rte_lpm6 *lpm, const uint8_t *ip, uint8_t depth, + uint32_t *next_hop); /** * Delete a rule from the LPM table. @@ -129,7 +129,7 @@ rte_lpm6_is_rule_present(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth, * 0 on success, negative value otherwise */ int -rte_lpm6_delete(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth); +rte_lpm6_delete(struct rte_lpm6 *lpm, const uint8_t *ip, uint8_t depth); /** * Delete a rule from the LPM table. -- 2.17.1