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 63AFBA0571; Tue, 3 Mar 2020 13:53:53 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BDB9D1BFEF; Tue, 3 Mar 2020 13:53:52 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 920141BFE9 for ; Tue, 3 Mar 2020 13:53:50 +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 023CiLXe001007; Tue, 3 Mar 2020 04:53:50 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=otwBwgPcRnx1zI+Cx5ZBAq1mdlfZYPKbZEOkbKon+JA=; b=QVk45BGrkmgh/WvB17+thXGXV6wVU1Jh4Lmd7xwH1k3/l1EPCq8W3/HwhcXkoIz91/mk IuBHLQgn7uBAszJZ9HKZujRdH4/eQPLm+M/Vtd6eXLeN0dxECeTxsOOs1pCf8ebTHGqi 2I3aXuYeAboxfkRW28ibTfAOZzA7OLNMQ8xs/MRGoL1HRh/eEM4b8l0lcojtJn+zpCec pLNmyardzNPeO/BfcLWP/khG4tyY0UNQ1pZrO+55uEPlFH/qg3CS7yuRtRIjZEoUk2y1 9dkWThMtmayvGjCg9s9gEUEmjsgHbNUt+h8yNUwHSMjh+tKzoXa7seD5OIZWLsjZsmmd fA== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2yhn0xrp2g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 03 Mar 2020 04:53:49 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 3 Mar 2020 04:53:47 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 3 Mar 2020 04:53:47 -0800 Received: from amok.marvell.com (unknown [10.95.130.42]) by maili.marvell.com (Postfix) with ESMTP id D422F3F7043; Tue, 3 Mar 2020 04:53:46 -0800 (PST) From: Andrzej Ostruszka To: , Bruce Richardson , Vladimir Medvedkin CC: Date: Tue, 3 Mar 2020 13:53:45 +0100 Message-ID: <20200303125345.26317-1-aostruszka@marvell.com> X-Mailer: git-send-email 2.17.1 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-03_04:2020-03-03, 2020-03-03 signatures=0 Subject: [dpdk-dev] [PATCH] 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. 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 --- lib/librte_lpm/rte_lpm6.c | 14 +++++++------- lib/librte_lpm/rte_lpm6.h | 13 +++++++------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c index d515600f1..6089217d6 100644 --- a/lib/librte_lpm/rte_lpm6.c +++ b/lib/librte_lpm/rte_lpm6.c @@ -975,8 +975,8 @@ rte_lpm6_lookup(const struct rte_lpm6 *lpm, const uint8_t *ip, */ int rte_lpm6_lookup_bulk_func(const struct rte_lpm6 *lpm, - uint8_t ips[][RTE_LPM6_IPV6_ADDR_SIZE], - int32_t *next_hops, unsigned int n) + const uint8_t ips[][RTE_LPM6_IPV6_ADDR_SIZE], + int32_t *next_hops, unsigned int n) { unsigned int i; const struct rte_lpm6_tbl_entry *tbl; @@ -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]; @@ -1069,8 +1069,8 @@ rule_delete(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth) */ int rte_lpm6_delete_bulk_func(struct rte_lpm6 *lpm, - uint8_t ips[][RTE_LPM6_IPV6_ADDR_SIZE], uint8_t *depths, - unsigned n) + const uint8_t ips[][RTE_LPM6_IPV6_ADDR_SIZE], + uint8_t *depths, unsigned n) { uint8_t masked_ip[RTE_LPM6_IPV6_ADDR_SIZE]; unsigned i; @@ -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..facf09b2b 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. @@ -147,7 +147,8 @@ rte_lpm6_delete(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth); */ int rte_lpm6_delete_bulk_func(struct rte_lpm6 *lpm, - uint8_t ips[][RTE_LPM6_IPV6_ADDR_SIZE], uint8_t *depths, unsigned n); + const uint8_t ips[][RTE_LPM6_IPV6_ADDR_SIZE], + uint8_t *depths, unsigned n); /** * Delete all rules from the LPM table. @@ -191,8 +192,8 @@ rte_lpm6_lookup(const struct rte_lpm6 *lpm, const uint8_t *ip, uint32_t *next_ho */ int rte_lpm6_lookup_bulk_func(const struct rte_lpm6 *lpm, - uint8_t ips[][RTE_LPM6_IPV6_ADDR_SIZE], - int32_t *next_hops, unsigned int n); + const uint8_t ips[][RTE_LPM6_IPV6_ADDR_SIZE], + int32_t *next_hops, unsigned int n); #ifdef __cplusplus } -- 2.17.1