From: Robin Jarry <rjarry@redhat.com>
To: dev@dpdk.org, Yipeng Wang <yipeng1.wang@intel.com>,
Sameh Gobriel <sameh.gobriel@intel.com>,
Bruce Richardson <bruce.richardson@intel.com>,
Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Subject: [PATCH dpdk v3 13/17] thash: use struct rte_ipv6_addr
Date: Thu, 10 Oct 2024 21:41:43 +0200 [thread overview]
Message-ID: <20241010194148.1877659-14-rjarry@redhat.com> (raw)
In-Reply-To: <20241010194148.1877659-1-rjarry@redhat.com>
Update rte_ipv6_tuple to use rte_ipv6_addr structures instead of
uint8_t[16] arrays. Use IPv6 utils that go along.
Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
Notes:
v3:
- replace memcpy() with direct struct assignments
- replace string initializers with RTE_IPV6()
app/test/test_thash.c | 46 ++++++++++----------------
doc/guides/rel_notes/deprecation.rst | 2 --
doc/guides/rel_notes/release_24_11.rst | 1 +
lib/hash/rte_thash.h | 20 +++++------
4 files changed, 28 insertions(+), 41 deletions(-)
diff --git a/app/test/test_thash.c b/app/test/test_thash.c
index 952da6a52954..0ad6943cf839 100644
--- a/app/test/test_thash.c
+++ b/app/test/test_thash.c
@@ -25,8 +25,8 @@ struct test_thash_v4 {
};
struct test_thash_v6 {
- uint8_t dst_ip[16];
- uint8_t src_ip[16];
+ struct rte_ipv6_addr dst_ip;
+ struct rte_ipv6_addr src_ip;
uint16_t dst_port;
uint16_t src_port;
uint32_t hash_l3;
@@ -49,25 +49,19 @@ struct test_thash_v4 v4_tbl[] = {
struct test_thash_v6 v6_tbl[] = {
/*3ffe:2501:200:3::1*/
-{{0x3f, 0xfe, 0x25, 0x01, 0x02, 0x00, 0x00, 0x03,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,},
+{RTE_IPV6(0x3ffe, 0x2501, 0x0200, 0x0003, 0, 0, 0, 0x0001),
/*3ffe:2501:200:1fff::7*/
-{0x3f, 0xfe, 0x25, 0x01, 0x02, 0x00, 0x1f, 0xff,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,},
+RTE_IPV6(0x3ffe, 0x2501, 0x0200, 0x1fff, 0, 0, 0, 0x0007),
1766, 2794, 0x2cc18cd5, 0x40207d3d},
/*ff02::1*/
-{{0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,},
+{RTE_IPV6(0xff02, 0, 0, 0, 0, 0, 0, 0x0001),
/*3ffe:501:8::260:97ff:fe40:efab*/
-{0x3f, 0xfe, 0x05, 0x01, 0x00, 0x08, 0x00, 0x00,
-0x02, 0x60, 0x97, 0xff, 0xfe, 0x40, 0xef, 0xab,},
+RTE_IPV6(0x3ffe, 0x0501, 0x0008, 0, 0x0260, 0x97ff, 0xfe40, 0xefab),
4739, 14230, 0x0f0c461c, 0xdde51bbf},
/*fe80::200:f8ff:fe21:67cf*/
-{{0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x02, 0x00, 0xf8, 0xff, 0xfe, 0x21, 0x67, 0xcf,},
+{RTE_IPV6(0xfe80, 0, 0, 0, 0x0200, 0xf8ff, 0xfe21, 0x67cf),
/*3ffe:1900:4545:3:200:f8ff:fe21:67cf*/
-{0x3f, 0xfe, 0x19, 0x00, 0x45, 0x45, 0x00, 0x03,
-0x02, 0x00, 0xf8, 0xff, 0xfe, 0x21, 0x67, 0xcf,},
+RTE_IPV6(0x3ffe, 0x1900, 0x4545, 0x0003, 0x0200, 0xf8ff, 0xfe21, 0x67cf),
38024, 44251, 0x4b61e985, 0x02d1feef},
};
@@ -110,7 +104,7 @@ static const uint8_t big_rss_key[] = {
static int
test_toeplitz_hash_calc(void)
{
- uint32_t i, j;
+ uint32_t i;
union rte_thash_tuple tuple;
uint32_t rss_l3, rss_l3l4;
uint8_t rss_key_be[RTE_DIM(default_rss_key)];
@@ -145,10 +139,8 @@ test_toeplitz_hash_calc(void)
}
for (i = 0; i < RTE_DIM(v6_tbl); i++) {
/*Fill ipv6 hdr*/
- for (j = 0; j < RTE_DIM(ipv6_hdr.src_addr.a); j++)
- ipv6_hdr.src_addr.a[j] = v6_tbl[i].src_ip[j];
- for (j = 0; j < RTE_DIM(ipv6_hdr.dst_addr.a); j++)
- ipv6_hdr.dst_addr.a[j] = v6_tbl[i].dst_ip[j];
+ ipv6_hdr.src_addr = v6_tbl[i].src_ip;
+ ipv6_hdr.dst_addr = v6_tbl[i].dst_ip;
/*Load and convert ipv6 address into tuple*/
rte_thash_load_v6_addrs(&ipv6_hdr, &tuple);
tuple.v6.sport = v6_tbl[i].src_port;
@@ -176,7 +168,7 @@ test_toeplitz_hash_calc(void)
static int
test_toeplitz_hash_gfni(void)
{
- uint32_t i, j;
+ uint32_t i;
union rte_thash_tuple tuple;
uint32_t rss_l3, rss_l3l4;
uint64_t rss_key_matrixes[RTE_DIM(default_rss_key)];
@@ -204,10 +196,8 @@ test_toeplitz_hash_gfni(void)
}
for (i = 0; i < RTE_DIM(v6_tbl); i++) {
- for (j = 0; j < RTE_DIM(tuple.v6.src_addr); j++)
- tuple.v6.src_addr[j] = v6_tbl[i].src_ip[j];
- for (j = 0; j < RTE_DIM(tuple.v6.dst_addr); j++)
- tuple.v6.dst_addr[j] = v6_tbl[i].dst_ip[j];
+ tuple.v6.src_addr = v6_tbl[i].src_ip;
+ tuple.v6.dst_addr = v6_tbl[i].dst_ip;
tuple.v6.sport = rte_cpu_to_be_16(v6_tbl[i].dst_port);
tuple.v6.dport = rte_cpu_to_be_16(v6_tbl[i].src_port);
rss_l3 = rte_thash_gfni(rss_key_matrixes, (uint8_t *)&tuple,
@@ -299,7 +289,7 @@ enum {
static int
test_toeplitz_hash_gfni_bulk(void)
{
- uint32_t i, j;
+ uint32_t i;
union rte_thash_tuple tuple[2];
uint8_t *tuples[2];
uint32_t rss[2] = { 0 };
@@ -328,10 +318,8 @@ test_toeplitz_hash_gfni_bulk(void)
rte_memcpy(tuples[0], &tuple[0], RTE_THASH_V4_L4_LEN * 4);
/*Load IPv6 headers and copy it into the corresponding tuple*/
- for (j = 0; j < RTE_DIM(tuple[1].v6.src_addr); j++)
- tuple[1].v6.src_addr[j] = v6_tbl[i].src_ip[j];
- for (j = 0; j < RTE_DIM(tuple[1].v6.dst_addr); j++)
- tuple[1].v6.dst_addr[j] = v6_tbl[i].dst_ip[j];
+ tuple[1].v6.src_addr = v6_tbl[i].src_ip;
+ tuple[1].v6.dst_addr = v6_tbl[i].dst_ip;
tuple[1].v6.sport = rte_cpu_to_be_16(v6_tbl[i].dst_port);
tuple[1].v6.dport = rte_cpu_to_be_16(v6_tbl[i].src_port);
rte_memcpy(tuples[1], &tuple[1], RTE_THASH_V6_L4_LEN * 4);
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 838e22b44444..dc0c6e4182ff 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -72,8 +72,6 @@ Deprecation Notices
- ``struct rte_flow_tunnel``
gro
- ``struct tcp6_flow_key``
- hash
- - ``struct rte_ipv6_tuple``
* net, ethdev: The flow item ``RTE_FLOW_ITEM_TYPE_VXLAN_GPE``
is replaced with ``RTE_FLOW_ITEM_TYPE_VXLAN``.
diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst
index 3c273ce25c75..54badeeecabd 100644
--- a/doc/guides/rel_notes/release_24_11.rst
+++ b/doc/guides/rel_notes/release_24_11.rst
@@ -151,6 +151,7 @@ API Changes
* pipeline: ``rte_swx_ipsec_sa_encap_params`` was modified to use ``rte_ipv6_addr`` instead of ``in6_addr``.
* ipsec: ``rte_ipsec_sadv6_key`` was modified to use ``struct rte_ipv6_addr`` instead of ``uint8_t[16]`` fields.
* security: ``rte_security_ipsec_tunnel_param`` was modified to use ``rte_ipv6_addr`` instead of ``in6_addr``.
+* hash: ``rte_ipv6_tuple`` was modified to use ``struct rte_ipv6_addr`` instead of ``uint8_t[16]`` fields.
ABI Changes
-----------
diff --git a/lib/hash/rte_thash.h b/lib/hash/rte_thash.h
index d988df15a9ba..61f6fa1b08b4 100644
--- a/lib/hash/rte_thash.h
+++ b/lib/hash/rte_thash.h
@@ -89,8 +89,8 @@ struct rte_ipv4_tuple {
* ports/sctp_tag have to be CPU byte order
*/
struct rte_ipv6_tuple {
- uint8_t src_addr[16];
- uint8_t dst_addr[16];
+ struct rte_ipv6_addr src_addr;
+ struct rte_ipv6_addr dst_addr;
union {
struct {
uint16_t dport;
@@ -141,22 +141,22 @@ rte_thash_load_v6_addrs(const struct rte_ipv6_hdr *orig,
{
#ifdef RTE_ARCH_X86
__m128i ipv6 = _mm_loadu_si128((const __m128i *)&orig->src_addr);
- *(__m128i *)targ->v6.src_addr =
+ *(__m128i *)&targ->v6.src_addr =
_mm_shuffle_epi8(ipv6, rte_thash_ipv6_bswap_mask);
ipv6 = _mm_loadu_si128((const __m128i *)&orig->dst_addr);
- *(__m128i *)targ->v6.dst_addr =
+ *(__m128i *)&targ->v6.dst_addr =
_mm_shuffle_epi8(ipv6, rte_thash_ipv6_bswap_mask);
#elif defined(__ARM_NEON)
- uint8x16_t ipv6 = vld1q_u8((uint8_t const *)&orig->src_addr);
- vst1q_u8((uint8_t *)targ->v6.src_addr, vrev32q_u8(ipv6));
- ipv6 = vld1q_u8((uint8_t const *)&orig->dst_addr);
- vst1q_u8((uint8_t *)targ->v6.dst_addr, vrev32q_u8(ipv6));
+ uint8x16_t ipv6 = vld1q_u8(orig->src_addr.a);
+ vst1q_u8(targ->v6.src_addr.a, vrev32q_u8(ipv6));
+ ipv6 = vld1q_u8(orig->dst_addr.a);
+ vst1q_u8(targ->v6.dst_addr.a, vrev32q_u8(ipv6));
#else
int i;
for (i = 0; i < 4; i++) {
- *((uint32_t *)targ->v6.src_addr + i) =
+ *((uint32_t *)&targ->v6.src_addr + i) =
rte_be_to_cpu_32(*((const uint32_t *)&orig->src_addr + i));
- *((uint32_t *)targ->v6.dst_addr + i) =
+ *((uint32_t *)&targ->v6.dst_addr + i) =
rte_be_to_cpu_32(*((const uint32_t *)&orig->dst_addr + i));
}
#endif
--
2.46.2
next prev 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 ` [PATCH dpdk v3 08/17] rib6,fib6,lpm6: remove duplicate constants Robin Jarry
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 ` Robin Jarry [this message]
2024-10-10 19:41 ` [PATCH dpdk v3 14/17] gro: use struct rte_ipv6_addr 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-14-rjarry@redhat.com \
--to=rjarry@redhat.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=sameh.gobriel@intel.com \
--cc=vladimir.medvedkin@intel.com \
--cc=yipeng1.wang@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).