From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [dpdk-dev] [PATCH 1/5] lpm: make ipv6 address immutable
Date: Sat, 25 Jan 2020 17:09:07 -0800 [thread overview]
Message-ID: <20200126010911.3733-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20200126010911.3733-1-stephen@networkplumber.org>
Both the table setup and lookup do no modify their arguments.
Therefore the parameter should be constant.
This is not actually an API breakage since programs can be
recompiled without change. This is not an ABI breakage because
old programs will still run.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/librte_lpm/rte_lpm6.c | 8 ++++----
lib/librte_lpm/rte_lpm6.h | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c
index c46e557e2389..5ea818abd6e9 100644
--- a/lib/librte_lpm/rte_lpm6.c
+++ b/lib/librte_lpm/rte_lpm6.c
@@ -854,8 +854,8 @@ simulate_add(struct rte_lpm6 *lpm, const uint8_t *masked_ip, uint8_t depth)
* Add a route
*/
int
-rte_lpm6_add(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth,
- uint32_t next_hop)
+rte_lpm6_add(struct rte_lpm6 *lpm, const uint8_t *ip, uint8_t depth,
+ uint32_t next_hop)
{
struct rte_lpm6_tbl_entry *tbl;
struct rte_lpm6_tbl_entry *tbl_next = NULL;
@@ -913,7 +913,7 @@ rte_lpm6_add(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth,
*/
static inline int
lookup_step(const struct rte_lpm6 *lpm, const struct rte_lpm6_tbl_entry *tbl,
- const struct rte_lpm6_tbl_entry **tbl_next, uint8_t *ip,
+ const struct rte_lpm6_tbl_entry **tbl_next, const uint8_t *ip,
uint8_t first_byte, uint32_t *next_hop)
{
uint32_t tbl8_index, tbl_entry;
@@ -943,7 +943,7 @@ lookup_step(const struct rte_lpm6 *lpm, const struct rte_lpm6_tbl_entry *tbl,
* Looks up an IP
*/
int
-rte_lpm6_lookup(const struct rte_lpm6 *lpm, uint8_t *ip,
+rte_lpm6_lookup(const struct rte_lpm6 *lpm, const uint8_t *ip,
uint32_t *next_hop)
{
const struct rte_lpm6_tbl_entry *tbl;
diff --git a/lib/librte_lpm/rte_lpm6.h b/lib/librte_lpm/rte_lpm6.h
index 37dfb20249a8..042991f8cdb7 100644
--- a/lib/librte_lpm/rte_lpm6.h
+++ b/lib/librte_lpm/rte_lpm6.h
@@ -94,8 +94,8 @@ rte_lpm6_free(struct rte_lpm6 *lpm);
* 0 on success, negative value otherwise
*/
int
-rte_lpm6_add(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth,
- uint32_t next_hop);
+rte_lpm6_add(struct rte_lpm6 *lpm, const uint8_t *ip, uint8_t depth,
+ uint32_t next_hop);
/**
* Check if a rule is present in the LPM table,
@@ -171,7 +171,7 @@ rte_lpm6_delete_all(struct rte_lpm6 *lpm);
* -EINVAL for incorrect arguments, -ENOENT on lookup miss, 0 on lookup hit
*/
int
-rte_lpm6_lookup(const struct rte_lpm6 *lpm, uint8_t *ip, uint32_t *next_hop);
+rte_lpm6_lookup(const struct rte_lpm6 *lpm, const uint8_t *ip, uint32_t *next_hop);
/**
* Lookup multiple IP addresses in an LPM table.
--
2.20.1
next prev parent reply other threads:[~2020-01-26 1:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-26 1:09 [dpdk-dev] [PATCH 0/5] l3fwd and lpm cleanups Stephen Hemminger
2020-01-26 1:09 ` Stephen Hemminger [this message]
2020-01-26 1:09 ` [dpdk-dev] [PATCH 2/5] examples/l3fwd: use RTE_DIM Stephen Hemminger
2020-01-26 1:09 ` [dpdk-dev] [PATCH 3/5] examples/l3fwd: make lookup struct static Stephen Hemminger
2020-01-26 1:09 ` [dpdk-dev] [PATCH 4/5] examples/l3fwd: make route array constant Stephen Hemminger
2020-01-26 1:09 ` [dpdk-dev] [PATCH 5/5] examples/l3fwd: improve readability for destination lookup Stephen Hemminger
2020-02-16 19:39 ` [dpdk-dev] [PATCH 0/5] l3fwd and lpm cleanups 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=20200126010911.3733-2-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
/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).