DPDK patches and discussions
 help / color / mirror / Atom feed
From: Robin Jarry <rjarry@redhat.com>
To: dev@dpdk.org, Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
	Jerin Jacob <jerinj@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Zhirun Yan <yanzhirun_163@163.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	Pavan Nikhilesh <pbhagavatula@marvell.com>
Subject: [PATCH dpdk v3 08/17] rib6,fib6,lpm6: remove duplicate constants
Date: Thu, 10 Oct 2024 21:41:38 +0200	[thread overview]
Message-ID: <20241010194148.1877659-9-rjarry@redhat.com> (raw)
In-Reply-To: <20241010194148.1877659-1-rjarry@redhat.com>

Replace all address size and max depth macros with common ones from
rte_ip6.h. Mark the old symbols as deprecated.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
---

Notes:
    v3:
    
    - replace memcpy() with direct struct assignments
    - restore RTE_FIB6_IPV6_ADDR_SIZE, RTE_FIB6_MAXDEPTH, TRIE_MAX_DEPTH,
      RTE_LPM6_MAX_DEPTH, RTE_LPM6_IPV6_ADDR_SIZE, RTE_RIB6_IPV6_ADDR_SIZE
      and mark them as RTE_DEPRECATED()
    - replace string initializers with RTE_IPV6()

 app/test/test_fib6.c        | 50 ++++++++++++++++++-------------------
 examples/l3fwd-graph/main.c |  4 +--
 lib/fib/rte_fib6.c          |  6 ++---
 lib/fib/rte_fib6.h          |  5 ++--
 lib/fib/trie.c              |  6 ++---
 lib/fib/trie.h              |  3 ++-
 lib/lpm/rte_lpm6.c          | 10 ++++----
 lib/lpm/rte_lpm6.h          |  5 ++--
 lib/node/ip6_lookup.c       |  2 +-
 lib/rib/rte_rib6.c          | 11 ++++----
 lib/rib/rte_rib6.h          |  6 ++---
 11 files changed, 55 insertions(+), 53 deletions(-)

diff --git a/app/test/test_fib6.c b/app/test/test_fib6.c
index 8853adeaac7c..79220a88b112 100644
--- a/app/test/test_fib6.c
+++ b/app/test/test_fib6.c
@@ -170,13 +170,13 @@ test_add_del_invalid(void)
 	fib = rte_fib6_create(__func__, SOCKET_ID_ANY, &config);
 	RTE_TEST_ASSERT(fib != NULL, "Failed to create FIB\n");
 
-	/* rte_fib6_add: depth > RTE_FIB6_MAXDEPTH */
-	ret = rte_fib6_add(fib, &ip, RTE_FIB6_MAXDEPTH + 1, nh);
+	/* rte_fib6_add: depth > RTE_IPV6_MAX_DEPTH */
+	ret = rte_fib6_add(fib, &ip, RTE_IPV6_MAX_DEPTH + 1, nh);
 	RTE_TEST_ASSERT(ret < 0,
 		"Call succeeded with invalid parameters\n");
 
-	/* rte_fib6_delete: depth > RTE_FIB6_MAXDEPTH */
-	ret = rte_fib6_delete(fib, &ip, RTE_FIB6_MAXDEPTH + 1);
+	/* rte_fib6_delete: depth > RTE_IPV6_MAX_DEPTH */
+	ret = rte_fib6_delete(fib, &ip, RTE_IPV6_MAX_DEPTH + 1);
 	RTE_TEST_ASSERT(ret < 0,
 		"Call succeeded with invalid parameters\n");
 
@@ -216,18 +216,18 @@ lookup_and_check_asc(struct rte_fib6 *fib,
 	struct rte_ipv6_addr *ip_missing, uint64_t def_nh,
 	uint32_t n)
 {
-	uint64_t nh_arr[RTE_FIB6_MAXDEPTH];
+	uint64_t nh_arr[RTE_IPV6_MAX_DEPTH];
 	int ret;
 	uint32_t i = 0;
 
-	ret = rte_fib6_lookup_bulk(fib, ip_arr, nh_arr, RTE_FIB6_MAXDEPTH);
+	ret = rte_fib6_lookup_bulk(fib, ip_arr, nh_arr, RTE_IPV6_MAX_DEPTH);
 	RTE_TEST_ASSERT(ret == 0, "Failed to lookup\n");
 
-	for (; i <= RTE_FIB6_MAXDEPTH - n; i++)
+	for (; i <= RTE_IPV6_MAX_DEPTH - n; i++)
 		RTE_TEST_ASSERT(nh_arr[i] == n,
 			"Failed to get proper nexthop\n");
 
-	for (; i < RTE_FIB6_MAXDEPTH; i++)
+	for (; i < RTE_IPV6_MAX_DEPTH; i++)
 		RTE_TEST_ASSERT(nh_arr[i] == --n,
 			"Failed to get proper nexthop\n");
 
@@ -244,18 +244,18 @@ lookup_and_check_desc(struct rte_fib6 *fib,
 	struct rte_ipv6_addr *ip_missing, uint64_t def_nh,
 	uint32_t n)
 {
-	uint64_t nh_arr[RTE_FIB6_MAXDEPTH];
+	uint64_t nh_arr[RTE_IPV6_MAX_DEPTH];
 	int ret;
 	uint32_t i = 0;
 
-	ret = rte_fib6_lookup_bulk(fib, ip_arr, nh_arr, RTE_FIB6_MAXDEPTH);
+	ret = rte_fib6_lookup_bulk(fib, ip_arr, nh_arr, RTE_IPV6_MAX_DEPTH);
 	RTE_TEST_ASSERT(ret == 0, "Failed to lookup\n");
 
 	for (; i < n; i++)
-		RTE_TEST_ASSERT(nh_arr[i] == RTE_FIB6_MAXDEPTH - i,
+		RTE_TEST_ASSERT(nh_arr[i] == RTE_IPV6_MAX_DEPTH - i,
 			"Failed to get proper nexthop\n");
 
-	for (; i < RTE_FIB6_MAXDEPTH; i++)
+	for (; i < RTE_IPV6_MAX_DEPTH; i++)
 		RTE_TEST_ASSERT(nh_arr[i] == def_nh,
 			"Failed to get proper nexthop\n");
 
@@ -270,19 +270,19 @@ static int
 check_fib(struct rte_fib6 *fib)
 {
 	uint64_t def_nh = 100;
-	struct rte_ipv6_addr ip_arr[RTE_FIB6_MAXDEPTH];
+	struct rte_ipv6_addr ip_arr[RTE_IPV6_MAX_DEPTH];
 	struct rte_ipv6_addr ip_add = RTE_IPV6(0x8000, 0, 0, 0, 0, 0, 0, 0);
 	struct rte_ipv6_addr ip_missing =
 		RTE_IPV6(0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff);
 	uint32_t i, j;
 	int ret;
 
-	for (i = 0; i < RTE_FIB6_MAXDEPTH; i++) {
+	for (i = 0; i < RTE_IPV6_MAX_DEPTH; i++) {
 		ip_arr[i] = ip_add;
-		j = (RTE_FIB6_MAXDEPTH - i) / CHAR_BIT;
-		if (j < RTE_FIB6_IPV6_ADDR_SIZE) {
-			ip_arr[i].a[j] |= UINT8_MAX >> ((RTE_FIB6_MAXDEPTH - i) % CHAR_BIT);
-			for (j++; j < RTE_FIB6_IPV6_ADDR_SIZE; j++)
+		j = (RTE_IPV6_MAX_DEPTH - i) / CHAR_BIT;
+		if (j < RTE_IPV6_ADDR_SIZE) {
+			ip_arr[i].a[j] |= UINT8_MAX >> ((RTE_IPV6_MAX_DEPTH - i) % CHAR_BIT);
+			for (j++; j < RTE_IPV6_ADDR_SIZE; j++)
 				ip_arr[i].a[j] = 0xff;
 		}
 	}
@@ -290,7 +290,7 @@ check_fib(struct rte_fib6 *fib)
 	ret = lookup_and_check_desc(fib, ip_arr, &ip_missing, def_nh, 0);
 	RTE_TEST_ASSERT(ret == TEST_SUCCESS, "Lookup and check fails\n");
 
-	for (i = 1; i <= RTE_FIB6_MAXDEPTH; i++) {
+	for (i = 1; i <= RTE_IPV6_MAX_DEPTH; i++) {
 		ret = rte_fib6_add(fib, &ip_add, i, i);
 		RTE_TEST_ASSERT(ret == 0, "Failed to add a route\n");
 		ret = lookup_and_check_asc(fib, ip_arr, &ip_missing, def_nh, i);
@@ -298,7 +298,7 @@ check_fib(struct rte_fib6 *fib)
 			"Lookup and check fails\n");
 	}
 
-	for (i = RTE_FIB6_MAXDEPTH; i > 1; i--) {
+	for (i = RTE_IPV6_MAX_DEPTH; i > 1; i--) {
 		ret = rte_fib6_delete(fib, &ip_add, i);
 		RTE_TEST_ASSERT(ret == 0, "Failed to delete a route\n");
 		ret = lookup_and_check_asc(fib, ip_arr, &ip_missing,
@@ -313,9 +313,9 @@ check_fib(struct rte_fib6 *fib)
 	RTE_TEST_ASSERT(ret == TEST_SUCCESS,
 		"Lookup and check fails\n");
 
-	for (i = 0; i < RTE_FIB6_MAXDEPTH; i++) {
-		ret = rte_fib6_add(fib, &ip_add, RTE_FIB6_MAXDEPTH - i,
-			RTE_FIB6_MAXDEPTH - i);
+	for (i = 0; i < RTE_IPV6_MAX_DEPTH; i++) {
+		ret = rte_fib6_add(fib, &ip_add, RTE_IPV6_MAX_DEPTH - i,
+			RTE_IPV6_MAX_DEPTH - i);
 		RTE_TEST_ASSERT(ret == 0, "Failed to add a route\n");
 		ret = lookup_and_check_desc(fib, ip_arr, &ip_missing,
 			def_nh, i + 1);
@@ -323,11 +323,11 @@ check_fib(struct rte_fib6 *fib)
 			"Lookup and check fails\n");
 	}
 
-	for (i = 1; i <= RTE_FIB6_MAXDEPTH; i++) {
+	for (i = 1; i <= RTE_IPV6_MAX_DEPTH; i++) {
 		ret = rte_fib6_delete(fib, &ip_add, i);
 		RTE_TEST_ASSERT(ret == 0, "Failed to delete a route\n");
 		ret = lookup_and_check_desc(fib, ip_arr, &ip_missing, def_nh,
-			RTE_FIB6_MAXDEPTH - i);
+			RTE_IPV6_MAX_DEPTH - i);
 		RTE_TEST_ASSERT(ret == TEST_SUCCESS,
 			"Lookup and check fails\n");
 	}
diff --git a/examples/l3fwd-graph/main.c b/examples/l3fwd-graph/main.c
index a13dc011380d..9bda0ab633e1 100644
--- a/examples/l3fwd-graph/main.c
+++ b/examples/l3fwd-graph/main.c
@@ -151,7 +151,7 @@ struct ipv4_l3fwd_lpm_route {
 };
 
 struct ipv6_l3fwd_lpm_route {
-	uint8_t ip[RTE_LPM6_IPV6_ADDR_SIZE];
+	uint8_t ip[RTE_IPV6_ADDR_SIZE];
 	uint8_t depth;
 	uint8_t if_out;
 };
@@ -1371,7 +1371,7 @@ main(int argc, char **argv)
 
 		dst_port = ipv6_l3fwd_lpm_route_array[i].if_out;
 
-		memcpy(in6.s6_addr, ipv6_l3fwd_lpm_route_array[i].ip, RTE_LPM6_IPV6_ADDR_SIZE);
+		memcpy(in6.s6_addr, ipv6_l3fwd_lpm_route_array[i].ip, RTE_IPV6_ADDR_SIZE);
 		snprintf(route_str, sizeof(route_str), "%s / %d (%d)",
 			 inet_ntop(AF_INET6, &in6, abuf, sizeof(abuf)),
 			 ipv6_l3fwd_lpm_route_array[i].depth,
diff --git a/lib/fib/rte_fib6.c b/lib/fib/rte_fib6.c
index d95cac79cbb5..9c7d4fde433a 100644
--- a/lib/fib/rte_fib6.c
+++ b/lib/fib/rte_fib6.c
@@ -71,7 +71,7 @@ dummy_modify(struct rte_fib6 *fib, const struct rte_ipv6_addr *ip,
 	uint8_t depth, uint64_t next_hop, int op)
 {
 	struct rte_rib6_node *node;
-	if ((fib == NULL) || (depth > RTE_FIB6_MAXDEPTH))
+	if ((fib == NULL) || (depth > RTE_IPV6_MAX_DEPTH))
 		return -EINVAL;
 
 	node = rte_rib6_lookup_exact(fib->rib, ip, depth);
@@ -123,7 +123,7 @@ rte_fib6_add(struct rte_fib6 *fib, const struct rte_ipv6_addr *ip,
 	uint8_t depth, uint64_t next_hop)
 {
 	if ((fib == NULL) || (ip == NULL) || (fib->modify == NULL) ||
-			(depth > RTE_FIB6_MAXDEPTH))
+			(depth > RTE_IPV6_MAX_DEPTH))
 		return -EINVAL;
 	return fib->modify(fib, ip, depth, next_hop, RTE_FIB6_ADD);
 }
@@ -133,7 +133,7 @@ rte_fib6_delete(struct rte_fib6 *fib, const struct rte_ipv6_addr *ip,
 	uint8_t depth)
 {
 	if ((fib == NULL) || (ip == NULL) || (fib->modify == NULL) ||
-			(depth > RTE_FIB6_MAXDEPTH))
+			(depth > RTE_IPV6_MAX_DEPTH))
 		return -EINVAL;
 	return fib->modify(fib, ip, depth, 0, RTE_FIB6_DEL);
 }
diff --git a/lib/fib/rte_fib6.h b/lib/fib/rte_fib6.h
index d26a0c7c0b77..21f0492374d9 100644
--- a/lib/fib/rte_fib6.h
+++ b/lib/fib/rte_fib6.h
@@ -17,15 +17,16 @@
 
 #include <stdint.h>
 
+#include <rte_common.h>
 #include <rte_ip6.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#define RTE_FIB6_IPV6_ADDR_SIZE		16
+#define RTE_FIB6_IPV6_ADDR_SIZE (RTE_DEPRECATED(RTE_FIB6_IPV6_ADDR_SIZE) RTE_IPV6_ADDR_SIZE)
 /** Maximum depth value possible for IPv6 FIB. */
-#define RTE_FIB6_MAXDEPTH       128
+#define RTE_FIB6_MAXDEPTH (RTE_DEPRECATED(RTE_FIB6_MAXDEPTH) RTE_IPV6_MAX_DEPTH)
 
 struct rte_fib6;
 struct rte_rib6;
diff --git a/lib/fib/trie.c b/lib/fib/trie.c
index b0d80c3db815..ee9c2395414d 100644
--- a/lib/fib/trie.c
+++ b/lib/fib/trie.c
@@ -350,9 +350,9 @@ write_edge(struct rte_trie_tbl *dp, const uint8_t *ip_part, uint64_t next_hop,
 	return ret;
 }
 
-#define IPV6_MAX_IDX	(RTE_FIB6_IPV6_ADDR_SIZE - 1)
+#define IPV6_MAX_IDX	(RTE_IPV6_ADDR_SIZE - 1)
 #define TBL24_BYTES	3
-#define TBL8_LEN	(RTE_FIB6_IPV6_ADDR_SIZE - TBL24_BYTES)
+#define TBL8_LEN	(RTE_IPV6_ADDR_SIZE - TBL24_BYTES)
 
 static int
 install_to_dp(struct rte_trie_tbl *dp, const struct rte_ipv6_addr *ledge,
@@ -518,7 +518,7 @@ trie_modify(struct rte_fib6 *fib, const struct rte_ipv6_addr *ip,
 	uint64_t par_nh, node_nh;
 	uint8_t tmp_depth, depth_diff = 0, parent_depth = 24;
 
-	if ((fib == NULL) || (ip == NULL) || (depth > RTE_FIB6_MAXDEPTH))
+	if ((fib == NULL) || (ip == NULL) || (depth > RTE_IPV6_MAX_DEPTH))
 		return -EINVAL;
 
 	dp = rte_fib6_get_dp(fib);
diff --git a/lib/fib/trie.h b/lib/fib/trie.h
index 6e235edaf89c..6004ec49ce7c 100644
--- a/lib/fib/trie.h
+++ b/lib/fib/trie.h
@@ -8,6 +8,7 @@
 
 #include <stdalign.h>
 
+#include <rte_common.h>
 #include <rte_fib6.h>
 
 /**
@@ -18,7 +19,7 @@
 /* @internal Total number of tbl24 entries. */
 #define TRIE_TBL24_NUM_ENT	(1 << 24)
 /* Maximum depth value possible for IPv6 LPM. */
-#define TRIE_MAX_DEPTH		128
+#define TRIE_MAX_DEPTH (RTE_DEPRECATED(TRIE_MAX_DEPTH) RTE_IPV6_MAX_DEPTH)
 /* @internal Number of entries in a tbl8 group. */
 #define TRIE_TBL8_GRP_NUM_ENT	256ULL
 /* @internal Total number of tbl8 groups in the tbl8. */
diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c
index 1d5577f263b1..8beb394c4701 100644
--- a/lib/lpm/rte_lpm6.c
+++ b/lib/lpm/rte_lpm6.c
@@ -802,7 +802,7 @@ simulate_add(struct rte_lpm6 *lpm, const struct rte_ipv6_addr *masked_ip, uint8_
 	 * Inspect one by one the rest of the bytes until
 	 * the process is completed.
 	 */
-	for (i = ADD_FIRST_BYTE; i < RTE_LPM6_IPV6_ADDR_SIZE && ret == 1; i++) {
+	for (i = ADD_FIRST_BYTE; i < RTE_IPV6_ADDR_SIZE && ret == 1; i++) {
 		tbl = tbl_next;
 		ret = simulate_add_step(lpm, tbl, &tbl_next, masked_ip, 1,
 			(uint8_t)(i + 1), depth, &need_tbl_nb);
@@ -832,7 +832,7 @@ rte_lpm6_add(struct rte_lpm6 *lpm, const struct rte_ipv6_addr *ip, uint8_t depth
 	int i;
 
 	/* Check user arguments. */
-	if ((lpm == NULL) || (depth < 1) || (depth > RTE_LPM6_MAX_DEPTH))
+	if ((lpm == NULL) || (depth < 1) || (depth > RTE_IPV6_MAX_DEPTH))
 		return -EINVAL;
 
 	/* Copy the IP and mask it to avoid modifying user's input data. */
@@ -861,7 +861,7 @@ rte_lpm6_add(struct rte_lpm6 *lpm, const struct rte_ipv6_addr *ip, uint8_t depth
 	 * Inspect one by one the rest of the bytes until
 	 * the process is completed.
 	 */
-	for (i = ADD_FIRST_BYTE; i < RTE_LPM6_IPV6_ADDR_SIZE && status == 1; i++) {
+	for (i = ADD_FIRST_BYTE; i < RTE_IPV6_ADDR_SIZE && status == 1; i++) {
 		tbl = tbl_next;
 		status = add_step(lpm, tbl, tbl_next_num, &tbl_next,
 			&tbl_next_num, &masked_ip, 1, (uint8_t)(i + 1),
@@ -993,7 +993,7 @@ rte_lpm6_is_rule_present(struct rte_lpm6 *lpm, const struct rte_ipv6_addr *ip, u
 
 	/* Check user arguments. */
 	if ((lpm == NULL) || next_hop == NULL || ip == NULL ||
-			(depth < 1) || (depth > RTE_LPM6_MAX_DEPTH))
+			(depth < 1) || (depth > RTE_IPV6_MAX_DEPTH))
 		return -EINVAL;
 
 	/* Copy the IP and mask it to avoid modifying user's input data. */
@@ -1268,7 +1268,7 @@ rte_lpm6_delete(struct rte_lpm6 *lpm, const struct rte_ipv6_addr *ip, uint8_t de
 	struct rte_lpm6_tbl_entry *from, *to;
 
 	/* Check input arguments. */
-	if ((lpm == NULL) || (depth < 1) || (depth > RTE_LPM6_MAX_DEPTH))
+	if ((lpm == NULL) || (depth < 1) || (depth > RTE_IPV6_MAX_DEPTH))
 		return -EINVAL;
 
 	/* Copy the IP and mask it to avoid modifying user's input data. */
diff --git a/lib/lpm/rte_lpm6.h b/lib/lpm/rte_lpm6.h
index 87392194237c..d7ebe9245c8e 100644
--- a/lib/lpm/rte_lpm6.h
+++ b/lib/lpm/rte_lpm6.h
@@ -9,6 +9,7 @@
  * RTE Longest Prefix Match for IPv6 (LPM6)
  */
 
+#include <rte_common.h>
 #include <rte_ip6.h>
 
 #include <stdint.h>
@@ -18,8 +19,8 @@ extern "C" {
 #endif
 
 
-#define RTE_LPM6_MAX_DEPTH               128
-#define RTE_LPM6_IPV6_ADDR_SIZE           16
+#define RTE_LPM6_MAX_DEPTH (RTE_DEPRECATED(RTE_LPM6_MAX_DEPTH) RTE_IPV6_MAX_DEPTH)
+#define RTE_LPM6_IPV6_ADDR_SIZE (RTE_DEPRECATED(RTE_LPM6_IPV6_ADDR_SIZE) RTE_IPV6_ADDR_SIZE)
 /** Max number of characters in LPM name. */
 #define RTE_LPM6_NAMESIZE                 32
 
diff --git a/lib/node/ip6_lookup.c b/lib/node/ip6_lookup.c
index f291ef74832b..faaea5085938 100644
--- a/lib/node/ip6_lookup.c
+++ b/lib/node/ip6_lookup.c
@@ -267,7 +267,7 @@ rte_node_ip6_route_add(const uint8_t *ip, uint8_t depth, uint16_t next_hop,
 	uint32_t val;
 	int ret;
 
-	memcpy(in6.s6_addr, ip, RTE_LPM6_IPV6_ADDR_SIZE);
+	memcpy(in6.s6_addr, ip, RTE_IPV6_ADDR_SIZE);
 	inet_ntop(AF_INET6, &in6, abuf, sizeof(abuf));
 	/* Embedded next node id into 24 bit next hop */
 	val = ((next_node << 16) | next_hop) & ((1ull << 24) - 1);
diff --git a/lib/rib/rte_rib6.c b/lib/rib/rte_rib6.c
index 75175c6aaf98..84c47fed6d1f 100644
--- a/lib/rib/rte_rib6.c
+++ b/lib/rib/rte_rib6.c
@@ -20,7 +20,6 @@
 #include "rib_log.h"
 
 #define RTE_RIB_VALID_NODE	1
-#define RIB6_MAXDEPTH		128
 /* Maximum length of a RIB6 name. */
 #define RTE_RIB6_NAMESIZE	64
 
@@ -89,7 +88,7 @@ static inline struct rte_rib6_node *
 get_nxt_node(struct rte_rib6_node *node,
 	const struct rte_ipv6_addr *ip)
 {
-	if (node->depth == RIB6_MAXDEPTH)
+	if (node->depth == RTE_IPV6_MAX_DEPTH)
 		return NULL;
 
 	return (get_dir(ip, node->depth)) ? node->right : node->left;
@@ -158,7 +157,7 @@ rte_rib6_lookup_exact(struct rte_rib6 *rib,
 	struct rte_rib6_node *cur;
 	struct rte_ipv6_addr tmp_ip;
 
-	if (unlikely(rib == NULL || ip == NULL || depth > RIB6_MAXDEPTH)) {
+	if (unlikely(rib == NULL || ip == NULL || depth > RTE_IPV6_MAX_DEPTH)) {
 		rte_errno = EINVAL;
 		return NULL;
 	}
@@ -196,7 +195,7 @@ rte_rib6_get_nxt(struct rte_rib6 *rib,
 	struct rte_rib6_node *tmp, *prev = NULL;
 	struct rte_ipv6_addr tmp_ip;
 
-	if (unlikely(rib == NULL || ip == NULL || depth > RIB6_MAXDEPTH)) {
+	if (unlikely(rib == NULL || ip == NULL || depth > RTE_IPV6_MAX_DEPTH)) {
 		rte_errno = EINVAL;
 		return NULL;
 	}
@@ -279,7 +278,7 @@ rte_rib6_insert(struct rte_rib6 *rib,
 	int i, d;
 	uint8_t common_depth, ip_xor;
 
-	if (unlikely((rib == NULL || ip == NULL || depth > RIB6_MAXDEPTH))) {
+	if (unlikely((rib == NULL || ip == NULL || depth > RTE_IPV6_MAX_DEPTH))) {
 		rte_errno = EINVAL;
 		return NULL;
 	}
@@ -341,7 +340,7 @@ rte_rib6_insert(struct rte_rib6 *rib,
 
 	/* closest node found, new_node should be inserted in the middle */
 	common_depth = RTE_MIN(depth, (*tmp)->depth);
-	for (i = 0, d = 0; i < RTE_RIB6_IPV6_ADDR_SIZE; i++) {
+	for (i = 0, d = 0; i < RTE_IPV6_ADDR_SIZE; i++) {
 		ip_xor = tmp_ip.a[i] ^ (*tmp)->ip.a[i];
 		if (ip_xor == 0)
 			d += 8;
diff --git a/lib/rib/rte_rib6.h b/lib/rib/rte_rib6.h
index ec62fdafecb6..a60756f798d8 100644
--- a/lib/rib/rte_rib6.h
+++ b/lib/rib/rte_rib6.h
@@ -22,7 +22,7 @@
 extern "C" {
 #endif
 
-#define RTE_RIB6_IPV6_ADDR_SIZE	16
+#define RTE_RIB6_IPV6_ADDR_SIZE (RTE_DEPRECATED(RTE_RIB6_IPV6_ADDR_SIZE) RTE_IPV6_ADDR_SIZE)
 
 /**
  * rte_rib6_get_nxt() flags
@@ -65,7 +65,7 @@ rte_rib6_copy_addr(uint8_t *dst, const uint8_t *src)
 {
 	if ((dst == NULL) || (src == NULL))
 		return;
-	rte_memcpy(dst, src, RTE_RIB6_IPV6_ADDR_SIZE);
+	rte_memcpy(dst, src, RTE_IPV6_ADDR_SIZE);
 }
 
 /**
@@ -89,7 +89,7 @@ rte_rib6_is_equal(const uint8_t *ip1, const uint8_t *ip2) {
 
 	if ((ip1 == NULL) || (ip2 == NULL))
 		return 0;
-	for (i = 0; i < RTE_RIB6_IPV6_ADDR_SIZE; i++) {
+	for (i = 0; i < RTE_IPV6_ADDR_SIZE; i++) {
 		if (ip1[i] != ip2[i])
 			return 0;
 	}
-- 
2.46.2


  parent reply	other threads:[~2024-10-10 19:43 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-21 16:25 [PATCH dpdk v1 00/15] IPv6 APIs overhaul Robin Jarry
2024-08-21 16:25 ` [PATCH dpdk v1 01/15] net: split raw checksum functions in separate header Robin Jarry
2024-08-21 16:25 ` [PATCH dpdk v1 02/15] net: split ipv6 symbols " Robin Jarry
2024-08-21 16:25 ` [PATCH dpdk v1 03/15] net: add structure for ipv6 addresses Robin Jarry
2024-08-21 16:25 ` [PATCH dpdk v1 04/15] net: use ipv6 structure for header addresses Robin Jarry
2024-08-21 16:25 ` [PATCH dpdk v1 05/15] fib6,rib6,lpm6: use ipv6 addr struct Robin Jarry
2024-08-21 16:25 ` [PATCH dpdk v1 06/15] net: add ipv6 address utilities Robin Jarry
2024-08-21 16:25 ` [PATCH dpdk v1 07/15] fib6,rib6,lpm6: use ipv6 utils Robin Jarry
2024-08-21 16:25 ` [PATCH dpdk v1 08/15] graph,node: use ipv6 addr struct and utils Robin Jarry
2024-08-21 16:25 ` [PATCH dpdk v1 09/15] pipeline: use ipv6 addr struct Robin Jarry
2024-08-21 16:25 ` [PATCH dpdk v1 10/15] ipsec: " Robin Jarry
2024-08-21 16:25 ` [PATCH dpdk v1 11/15] thash: " Robin Jarry
2024-08-21 16:25 ` [PATCH dpdk v1 12/15] gro: " Robin Jarry
2024-08-21 16:25 ` [PATCH dpdk v1 13/15] rte_flow: " Robin Jarry
2024-08-21 16:25 ` [PATCH dpdk v1 14/15] rib6,fib6,lpm6: remove duplicate constants Robin Jarry
2024-08-21 16:25 ` [PATCH dpdk v1 15/15] net: add utilities for well known ipv6 address types Robin Jarry
2024-08-21 22:28 ` [PATCH dpdk v1 00/15] IPv6 APIs overhaul Morten Brørup
2024-08-22 14:13 ` Stephen Hemminger
2024-08-22 15:13   ` Morten Brørup
2024-08-22 15:27     ` Robin Jarry
2024-08-22 18:41       ` Morten Brørup
2024-08-22 15:14   ` Robin Jarry
2024-08-22 15:16   ` Robin Jarry
2024-10-01  8:17 ` [PATCH dpdk v2 00/16] " Robin Jarry
2024-10-01  8:17   ` [PATCH dpdk v2 01/16] net: split raw checksum functions in separate header Robin Jarry
2024-10-03 23:12     ` Stephen Hemminger
2024-10-01  8:17   ` [PATCH dpdk v2 02/16] net: split ipv6 symbols " Robin Jarry
2024-10-03 23:15     ` Stephen Hemminger
2024-10-01  8:17   ` [PATCH dpdk v2 03/16] net: add structure for ipv6 addresses Robin Jarry
2024-10-03 23:18     ` Stephen Hemminger
2024-10-04 11:59       ` Robin Jarry
2024-10-06  8:18     ` Morten Brørup
2024-10-10 20:08       ` Robin Jarry
2024-10-11 12:37         ` Morten Brørup
2024-10-11 17:02           ` Stephen Hemminger
2024-10-01  8:17   ` [PATCH dpdk v2 04/16] net: use ipv6 structure for header addresses Robin Jarry
2024-10-03 23:20     ` Stephen Hemminger
2024-10-04 18:01     ` Ferruh Yigit
2024-10-04 20:04       ` Robin Jarry
2024-10-06 21:03         ` Ferruh Yigit
2024-10-01  8:17   ` [PATCH dpdk v2 05/16] fib6,rib6,lpm6: use ipv6 addr struct Robin Jarry
2024-10-03 23:21     ` Stephen Hemminger
2024-10-01  8:17   ` [PATCH dpdk v2 06/16] net: add ipv6 address utilities Robin Jarry
2024-10-01 15:35     ` Stephen Hemminger
2024-10-03 23:22     ` Stephen Hemminger
2024-10-01  8:17   ` [PATCH dpdk v2 07/16] fib6,rib6,lpm6: use ipv6 utils Robin Jarry
2024-10-01  8:17   ` [PATCH dpdk v2 08/16] graph,node: use ipv6 addr struct and utils Robin Jarry
2024-10-01  8:17   ` [PATCH dpdk v2 09/16] pipeline: use ipv6 addr struct Robin Jarry
2024-10-03 23:23     ` Stephen Hemminger
2024-10-04 11:55       ` Robin Jarry
2024-10-01  8:17   ` [PATCH dpdk v2 10/16] ipsec: " Robin Jarry
2024-10-01  8:17   ` [PATCH dpdk v2 11/16] thash: " Robin Jarry
2024-10-01  8:17   ` [PATCH dpdk v2 12/16] gro: " Robin Jarry
2024-10-01  8:17   ` [PATCH dpdk v2 13/16] rte_flow: " Robin Jarry
2024-10-01  8:17   ` [PATCH dpdk v2 14/16] rib6,fib6,lpm6: remove duplicate constants Robin Jarry
2024-10-03 23:12     ` Stephen Hemminger
2024-10-04 11:54       ` Robin Jarry
2024-10-04 16:16         ` Stephen Hemminger
2024-10-01  8:17   ` [PATCH dpdk v2 15/16] net: add utilities for well known ipv6 address types Robin Jarry
2024-10-03 23:24     ` Stephen Hemminger
2024-10-01  8:17   ` [PATCH dpdk v2 16/16] ipv6: add function to check ipv6 version Robin Jarry
2024-10-06  9:02     ` Morten Brørup
2024-10-10 20:00       ` Robin Jarry
2024-10-11 12:05         ` Morten Brørup
2024-10-10 15:26     ` Konstantin Ananyev
2024-10-06  9:04   ` [PATCH dpdk v2 00/16] IPv6 APIs overhaul Morten Brørup
2024-10-10 15:27   ` Konstantin Ananyev
2024-10-10 19:41 ` [PATCH dpdk v3 00/17] " Robin Jarry
2024-10-10 19:41   ` [PATCH dpdk v3 01/17] net: split raw checksum functions in separate header Robin Jarry
2024-10-10 19:41   ` [PATCH dpdk v3 02/17] net: split ipv6 symbols " Robin Jarry
2024-10-10 19:41   ` [PATCH dpdk v3 03/17] net: add structure for ipv6 addresses Robin Jarry
2024-10-10 19:41   ` [PATCH dpdk v3 04/17] net: add ipv6 address utilities Robin Jarry
2024-10-10 19:41   ` [PATCH dpdk v3 05/17] net: use struct rte_ipv6_addr for header addresses Robin Jarry
2024-10-10 19:41   ` [PATCH dpdk v3 06/17] fib6,rib6,lpm6: use struct rte_ipv6_addr Robin Jarry
2024-10-10 19:41   ` [PATCH dpdk v3 07/17] fib6,rib6,lpm6: use ipv6 utils Robin Jarry
2024-10-10 19:41   ` Robin Jarry [this message]
2024-10-10 19:41   ` [PATCH dpdk v3 09/17] cmdline: replace in6_addr with rte_ipv6_addr Robin Jarry
2024-10-10 19:41   ` [PATCH dpdk v3 10/17] graph,node: use struct rte_ipv6_addr and utils Robin Jarry
2024-10-10 19:41   ` [PATCH dpdk v3 11/17] pipeline: use struct rte_ipv6_addr Robin Jarry
2024-10-10 19:41   ` [PATCH dpdk v3 12/17] ipsec, security: use struct rte_ipv6_addr and utils Robin Jarry
2024-10-10 19:41   ` [PATCH dpdk v3 13/17] thash: use struct rte_ipv6_addr Robin Jarry
2024-10-10 19:41   ` [PATCH dpdk v3 14/17] gro: " Robin Jarry
2024-10-10 19:41   ` [PATCH dpdk v3 15/17] rte_flow: " Robin Jarry
2024-10-10 19:41   ` [PATCH dpdk v3 16/17] net: add utilities for well known ipv6 address types Robin Jarry
2024-10-10 19:41   ` [PATCH dpdk v3 17/17] ipv6: add function to check ipv6 version Robin Jarry
2024-10-15 17:12     ` Stephen Hemminger
2024-10-17 13:52   ` [PATCH dpdk v3 00/17] IPv6 APIs overhaul David Marchand
2024-10-17 18:03     ` Robin Jarry
2024-10-18  9:17 ` [PATCH dpdk v4 " Robin Jarry
2024-10-18  9:17   ` [PATCH dpdk v4 01/17] net: split raw checksum functions in separate header Robin Jarry
2024-10-18  9:17   ` [PATCH dpdk v4 02/17] net: split IPv4 and IPv6 symbols in separate headers Robin Jarry
2024-10-18  9:17   ` [PATCH dpdk v4 03/17] net: add IPv6 address structure and utils Robin Jarry
2024-10-18  9:17   ` [PATCH dpdk v4 04/17] net: use IPv6 structure for packet headers Robin Jarry
2024-10-18  9:17   ` [PATCH dpdk v4 05/17] lpm6: use IPv6 address structure and utils Robin Jarry
2024-10-18  9:17   ` [PATCH dpdk v4 06/17] fib6: " Robin Jarry
2024-10-18  9:17   ` [PATCH dpdk v4 07/17] rib6: " Robin Jarry
2024-10-18  9:17   ` [PATCH dpdk v4 08/17] cmdline: use IPv6 address structure Robin Jarry
2024-10-18  9:17   ` [PATCH dpdk v4 09/17] node: use IPv6 address structure and utils Robin Jarry
2024-10-18  9:17   ` [PATCH dpdk v4 10/17] pipeline: use IPv6 structures Robin Jarry
2024-10-18  9:17   ` [PATCH dpdk v4 11/17] ipsec: use IPv6 address structure Robin Jarry
2024-10-18  9:17   ` [PATCH dpdk v4 12/17] security: " Robin Jarry
2024-10-18  9:17   ` [PATCH dpdk v4 13/17] hash: " Robin Jarry
2024-10-18  9:17   ` [PATCH dpdk v4 14/17] gro: " Robin Jarry
2024-10-18  9:17   ` [PATCH dpdk v4 15/17] flow: " Robin Jarry
2024-10-18  9:17   ` [PATCH dpdk v4 16/17] net: add utilities for well known IPv6 address types Robin Jarry
2024-10-18  9:17   ` [PATCH dpdk v4 17/17] net: add function to check IPv6 version Robin Jarry

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=20241010194148.1877659-9-rjarry@redhat.com \
    --to=rjarry@redhat.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=pbhagavatula@marvell.com \
    --cc=vladimir.medvedkin@intel.com \
    --cc=yanzhirun_163@163.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).