From: Andrzej Ostruszka <aostruszka@marvell.com>
To: <dev@dpdk.org>, Bruce Richardson <bruce.richardson@intel.com>,
Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Cc: <stephen@networkplumber.org>
Subject: [dpdk-dev] [PATCH] lpm6: make IPv6 addresses immutable
Date: Tue, 3 Mar 2020 13:53:45 +0100 [thread overview]
Message-ID: <20200303125345.26317-1-aostruszka@marvell.com> (raw)
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 <aostruszka@marvell.com>
---
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
next reply other threads:[~2020-03-03 12:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-03 12:53 Andrzej Ostruszka [this message]
2020-03-09 13:38 ` Medvedkin, Vladimir
2020-03-09 15:52 ` Stephen Hemminger
2020-03-09 18:02 ` Medvedkin, Vladimir
2020-03-09 18:57 ` Stephen Hemminger
2020-03-09 19:13 ` Stephen Hemminger
2020-03-10 7:49 ` Andrzej Ostruszka
2020-03-10 9:13 ` [dpdk-dev] [PATCH v2] " Andrzej Ostruszka
2020-03-10 14:47 ` Medvedkin, Vladimir
2020-03-31 19:46 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200303125345.26317-1-aostruszka@marvell.com \
--to=aostruszka@marvell.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=vladimir.medvedkin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).