DPDK patches and discussions
 help / color / mirror / Atom feed
From: Robin Jarry <rjarry@redhat.com>
To: dev@dpdk.org, Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Subject: [PATCH dpdk v4 10/17] pipeline: use IPv6 structures
Date: Fri, 18 Oct 2024 11:17:27 +0200	[thread overview]
Message-ID: <20241018091734.64601-11-rjarry@redhat.com> (raw)
In-Reply-To: <20241018091734.64601-1-rjarry@redhat.com>

Update rte_table_action_ipv6_header and rte_table_action_nat_params to
use rte_ipv6_addr structures instead of uint8_t[16] arrays.

For consistency, also update rte_swx_ipsec_sa_encap_params to use
rte_ipv6_addr instead of in6_addr.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
 doc/guides/rel_notes/deprecation.rst   |  2 -
 doc/guides/rel_notes/release_24_11.rst |  4 ++
 examples/ip_pipeline/cli.c             | 61 +++++++++++---------------
 examples/ip_pipeline/parser.c          |  2 +-
 examples/ip_pipeline/parser.h          |  3 +-
 examples/ip_pipeline/pipeline.h        |  6 +--
 examples/ip_pipeline/thread.c          | 15 +++----
 lib/pipeline/rte_swx_ipsec.c           | 16 ++++---
 lib/pipeline/rte_swx_ipsec.h           |  5 ++-
 lib/pipeline/rte_table_action.c        | 36 ++++++---------
 lib/pipeline/rte_table_action.h        |  7 +--
 11 files changed, 72 insertions(+), 85 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 14b7f151afc1..c41124ee6e4a 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -76,8 +76,6 @@ Deprecation Notices
     - ``struct rte_ipv6_tuple``
   ipsec
     - ``struct rte_ipsec_sadv6_key``
-  pipeline
-    - ``struct rte_table_action_ipv6_header``
 
 * 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 59d9338a59f8..cd6c4cf25ecc 100644
--- a/doc/guides/rel_notes/release_24_11.rst
+++ b/doc/guides/rel_notes/release_24_11.rst
@@ -306,6 +306,10 @@ API Changes
     - ``struct rte_ipv6_hdr``
   node
     - ``rte_node_ip6_route_add()``
+  pipeline
+    - ``struct rte_swx_ipsec_sa_encap_params``
+    - ``struct rte_table_action_ipv6_header``
+    - ``struct rte_table_action_nat_params``
   table
     - ``struct rte_table_lpm_ipv6_key``
   rib
diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index e8269ea90c11..92dfacdeb0fe 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -2587,8 +2587,8 @@ struct pkt_key_ipv6_5tuple {
 	uint16_t payload_length;
 	uint8_t proto;
 	uint8_t hop_limit;
-	uint8_t sa[16];
-	uint8_t da[16];
+	struct rte_ipv6_addr sa;
+	struct rte_ipv6_addr da;
 	uint16_t sp;
 	uint16_t dp;
 } __rte_packed;
@@ -2598,7 +2598,7 @@ struct pkt_key_ipv4_addr {
 } __rte_packed;
 
 struct pkt_key_ipv6_addr {
-	uint8_t addr[16];
+	struct rte_ipv6_addr addr;
 } __rte_packed;
 
 static uint32_t
@@ -2654,7 +2654,7 @@ parse_match(char **tokens,
 			}
 			m->match.acl.ipv4.da = rte_be_to_cpu_32(daddr.s_addr);
 		} else if (strcmp(tokens[4], "ipv6") == 0) {
-			struct in6_addr saddr, daddr;
+			struct rte_ipv6_addr saddr, daddr;
 
 			m->match.acl.ip_version = 0;
 
@@ -2662,13 +2662,13 @@ parse_match(char **tokens,
 				snprintf(out, out_size, MSG_ARG_INVALID, "sa");
 				return 0;
 			}
-			memcpy(m->match.acl.ipv6.sa, saddr.s6_addr, 16);
+			m->match.acl.ipv6.sa = saddr;
 
 			if (parse_ipv6_addr(tokens[7], &daddr) != 0) {
 				snprintf(out, out_size, MSG_ARG_INVALID, "da");
 				return 0;
 			}
-			memcpy(m->match.acl.ipv6.da, daddr.s6_addr, 16);
+			m->match.acl.ipv6.da = daddr;
 		} else {
 			snprintf(out, out_size, MSG_ARG_NOT_FOUND,
 				"ipv4 or ipv6");
@@ -2810,7 +2810,7 @@ parse_match(char **tokens,
 		if (strcmp(tokens[2], "ipv6_5tuple") == 0) {
 			struct pkt_key_ipv6_5tuple *ipv6 =
 				(struct pkt_key_ipv6_5tuple *) m->match.hash.key;
-			struct in6_addr saddr, daddr;
+			struct rte_ipv6_addr saddr, daddr;
 			uint16_t sp, dp;
 			uint8_t proto;
 
@@ -2846,8 +2846,8 @@ parse_match(char **tokens,
 				return 0;
 			}
 
-			memcpy(ipv6->sa, saddr.s6_addr, 16);
-			memcpy(ipv6->da, daddr.s6_addr, 16);
+			ipv6->sa = saddr;
+			ipv6->da = daddr;
 			ipv6->sp = rte_cpu_to_be_16(sp);
 			ipv6->dp = rte_cpu_to_be_16(dp);
 			ipv6->proto = proto;
@@ -2880,7 +2880,7 @@ parse_match(char **tokens,
 		if (strcmp(tokens[2], "ipv6_addr") == 0) {
 			struct pkt_key_ipv6_addr *ipv6_addr =
 				(struct pkt_key_ipv6_addr *) m->match.hash.key;
-			struct in6_addr addr;
+			struct rte_ipv6_addr addr;
 
 			if (n_tokens < 4) {
 				snprintf(out, out_size, MSG_ARG_MISMATCH,
@@ -2894,7 +2894,7 @@ parse_match(char **tokens,
 				return 0;
 			}
 
-			memcpy(ipv6_addr->addr, addr.s6_addr, 16);
+			ipv6_addr->addr = addr;
 
 			return 4;
 		} /* hash ipv6_5tuple */
@@ -2955,7 +2955,7 @@ parse_match(char **tokens,
 
 			m->match.lpm.ipv4 = rte_be_to_cpu_32(addr.s_addr);
 		} else if (strcmp(tokens[2], "ipv6") == 0) {
-			struct in6_addr addr;
+			struct rte_ipv6_addr addr;
 
 			m->match.lpm.ip_version = 0;
 
@@ -2965,7 +2965,7 @@ parse_match(char **tokens,
 				return 0;
 			}
 
-			memcpy(m->match.lpm.ipv6, addr.s6_addr, 16);
+			m->match.lpm.ipv6 = addr;
 		} else {
 			snprintf(out, out_size, MSG_ARG_MISMATCH,
 				"ipv4 or ipv6");
@@ -3527,7 +3527,7 @@ parse_table_action_encap(char **tokens,
 			tokens += 5;
 			n += 5;
 		} else if (strcmp(tokens[0], "ipv6") == 0) {
-			struct in6_addr sa, da;
+			struct rte_ipv6_addr sa, da;
 			uint32_t flow_label;
 			uint8_t dscp, hop_limit;
 
@@ -3540,8 +3540,8 @@ parse_table_action_encap(char **tokens,
 				parser_read_uint8(&hop_limit, tokens[5]))
 				return 0;
 
-			memcpy(a->encap.vxlan.ipv6.sa, sa.s6_addr, 16);
-			memcpy(a->encap.vxlan.ipv6.da, da.s6_addr, 16);
+			a->encap.vxlan.ipv6.sa = sa;
+			a->encap.vxlan.ipv6.da = da;
 			a->encap.vxlan.ipv6.flow_label = flow_label;
 			a->encap.vxlan.ipv6.dscp = dscp;
 			a->encap.vxlan.ipv6.hop_limit = hop_limit;
@@ -3607,7 +3607,7 @@ parse_table_action_nat(char **tokens,
 	}
 
 	if (strcmp(tokens[1], "ipv6") == 0) {
-		struct in6_addr addr;
+		struct rte_ipv6_addr addr;
 		uint16_t port;
 
 		if (parse_ipv6_addr(tokens[2], &addr) ||
@@ -3615,7 +3615,7 @@ parse_table_action_nat(char **tokens,
 			return 0;
 
 		a->nat.ip_version = 0;
-		memcpy(a->nat.addr.ipv6, addr.s6_addr, 16);
+		a->nat.addr.ipv6 = addr;
 		a->nat.port = port;
 		a->action_mask |= 1 << RTE_TABLE_ACTION_NAT;
 		return 4;
@@ -4700,18 +4700,9 @@ ipv4_addr_show(FILE *f, uint32_t addr)
 }
 
 static void
-ipv6_addr_show(FILE *f, uint8_t *addr)
+ipv6_addr_show(FILE *f, const struct rte_ipv6_addr *ip)
 {
-	fprintf(f, "%02x%02x:%02x%02x:%02x%02x:%02x%02x:"
-		"%02x%02x:%02x%02x:%02x%02x:%02x%02x:",
-		(uint32_t)addr[0], (uint32_t)addr[1],
-		(uint32_t)addr[2], (uint32_t)addr[3],
-		(uint32_t)addr[4], (uint32_t)addr[5],
-		(uint32_t)addr[6], (uint32_t)addr[7],
-		(uint32_t)addr[8], (uint32_t)addr[9],
-		(uint32_t)addr[10], (uint32_t)addr[11],
-		(uint32_t)addr[12], (uint32_t)addr[13],
-		(uint32_t)addr[14], (uint32_t)addr[15]);
+	fprintf(f, RTE_IPV6_ADDR_FMT ":", RTE_IPV6_ADDR_SPLIT(ip));
 }
 
 static const char *
@@ -4769,14 +4760,14 @@ table_rule_show(const char *pipeline_name,
 			if (m->match.acl.ip_version)
 				ipv4_addr_show(f, m->match.acl.ipv4.sa);
 			else
-				ipv6_addr_show(f, m->match.acl.ipv6.sa);
+				ipv6_addr_show(f, &m->match.acl.ipv6.sa);
 
 			fprintf(f, "%u",	m->match.acl.sa_depth);
 
 			if (m->match.acl.ip_version)
 				ipv4_addr_show(f, m->match.acl.ipv4.da);
 			else
-				ipv6_addr_show(f, m->match.acl.ipv6.da);
+				ipv6_addr_show(f, &m->match.acl.ipv6.da);
 
 			fprintf(f, "%u",	m->match.acl.da_depth);
 
@@ -4808,7 +4799,7 @@ table_rule_show(const char *pipeline_name,
 			if (m->match.acl.ip_version)
 				ipv4_addr_show(f, m->match.lpm.ipv4);
 			else
-				ipv6_addr_show(f, m->match.lpm.ipv6);
+				ipv6_addr_show(f, &m->match.lpm.ipv6);
 
 			fprintf(f, "%u ",
 				(uint32_t)m->match.lpm.depth);
@@ -4956,9 +4947,9 @@ table_rule_show(const char *pipeline_name,
 						(uint32_t)a->encap.vxlan.ipv4.ttl);
 				} else {
 					fprintf(f, " ipv6 ");
-					ipv6_addr_show(f, a->encap.vxlan.ipv6.sa);
+					ipv6_addr_show(f, &a->encap.vxlan.ipv6.sa);
 					fprintf(f, " ");
-					ipv6_addr_show(f, a->encap.vxlan.ipv6.da);
+					ipv6_addr_show(f, &a->encap.vxlan.ipv6.da);
 					fprintf(f, " %u %u %u ",
 						a->encap.vxlan.ipv6.flow_label,
 						(uint32_t)a->encap.vxlan.ipv6.dscp,
@@ -4980,7 +4971,7 @@ table_rule_show(const char *pipeline_name,
 			if (a->nat.ip_version)
 				ipv4_addr_show(f, a->nat.addr.ipv4);
 			else
-				ipv6_addr_show(f, a->nat.addr.ipv6);
+				ipv6_addr_show(f, &a->nat.addr.ipv6);
 			fprintf(f, " %u ", (uint32_t)(a->nat.port));
 		}
 
diff --git a/examples/ip_pipeline/parser.c b/examples/ip_pipeline/parser.c
index 62fc52f9db78..dfca026be58b 100644
--- a/examples/ip_pipeline/parser.c
+++ b/examples/ip_pipeline/parser.c
@@ -387,7 +387,7 @@ parse_ipv4_addr(const char *token, struct in_addr *ipv4)
 }
 
 int
-parse_ipv6_addr(const char *token, struct in6_addr *ipv6)
+parse_ipv6_addr(const char *token, struct rte_ipv6_addr *ipv6)
 {
 	if (strlen(token) >= INET6_ADDRSTRLEN)
 		return -EINVAL;
diff --git a/examples/ip_pipeline/parser.h b/examples/ip_pipeline/parser.h
index 32b5ff99764b..758e0032ddc8 100644
--- a/examples/ip_pipeline/parser.h
+++ b/examples/ip_pipeline/parser.h
@@ -9,6 +9,7 @@
 #include <stdint.h>
 
 #include <rte_ip.h>
+#include <rte_ip6.h>
 #include <rte_ether.h>
 
 #define PARSE_DELIMITER				" \f\n\r\t\v"
@@ -39,7 +40,7 @@ int parser_read_uint8_hex(uint8_t *value, const char *p);
 int parse_hex_string(char *src, uint8_t *dst, uint32_t *size);
 
 int parse_ipv4_addr(const char *token, struct in_addr *ipv4);
-int parse_ipv6_addr(const char *token, struct in6_addr *ipv6);
+int parse_ipv6_addr(const char *token, struct rte_ipv6_addr *ipv6);
 int parse_mac_addr(const char *token, struct rte_ether_addr *addr);
 int parse_mpls_labels(char *string, uint32_t *labels, uint32_t *n_labels);
 
diff --git a/examples/ip_pipeline/pipeline.h b/examples/ip_pipeline/pipeline.h
index 22f04fd752ca..89696480fc01 100644
--- a/examples/ip_pipeline/pipeline.h
+++ b/examples/ip_pipeline/pipeline.h
@@ -218,8 +218,8 @@ struct table_rule_match_acl {
 		} ipv4;
 
 		struct {
-			uint8_t sa[16];
-			uint8_t da[16];
+			struct rte_ipv6_addr sa;
+			struct rte_ipv6_addr da;
 		} ipv6;
 	};
 
@@ -255,7 +255,7 @@ struct table_rule_match_lpm {
 
 	union {
 		uint32_t ipv4;
-		uint8_t ipv6[16];
+		struct rte_ipv6_addr ipv6;
 	};
 
 	uint8_t depth;
diff --git a/examples/ip_pipeline/thread.c b/examples/ip_pipeline/thread.c
index 9d8082b73080..0a44bddd90fc 100644
--- a/examples/ip_pipeline/thread.c
+++ b/examples/ip_pipeline/thread.c
@@ -2409,10 +2409,8 @@ match_convert(struct table_rule_match *mh,
 			}
 		else
 			if (add) {
-				uint32_t *sa32 =
-					(uint32_t *) mh->match.acl.ipv6.sa;
-				uint32_t *da32 =
-					(uint32_t *) mh->match.acl.ipv6.da;
+				uint32_t *sa32 = (uint32_t *)&mh->match.acl.ipv6.sa;
+				uint32_t *da32 = (uint32_t *)&mh->match.acl.ipv6.da;
 				uint32_t sa32_depth[4], da32_depth[4];
 				int status;
 
@@ -2480,10 +2478,8 @@ match_convert(struct table_rule_match *mh,
 				ml->acl_add.priority =
 					(int32_t) mh->match.acl.priority;
 			} else {
-				uint32_t *sa32 =
-					(uint32_t *) mh->match.acl.ipv6.sa;
-				uint32_t *da32 =
-					(uint32_t *) mh->match.acl.ipv6.da;
+				uint32_t *sa32 = (uint32_t *)&mh->match.acl.ipv6.sa;
+				uint32_t *da32 = (uint32_t *)&mh->match.acl.ipv6.da;
 				uint32_t sa32_depth[4], da32_depth[4];
 				int status;
 
@@ -2563,8 +2559,7 @@ match_convert(struct table_rule_match *mh,
 			ml->lpm_ipv4.ip = mh->match.lpm.ipv4;
 			ml->lpm_ipv4.depth = mh->match.lpm.depth;
 		} else {
-			memcpy(&ml->lpm_ipv6.ip,
-				mh->match.lpm.ipv6, sizeof(ml->lpm_ipv6.ip));
+			ml->lpm_ipv6.ip = mh->match.lpm.ipv6;
 			ml->lpm_ipv6.depth = mh->match.lpm.depth;
 		}
 
diff --git a/lib/pipeline/rte_swx_ipsec.c b/lib/pipeline/rte_swx_ipsec.c
index 0ed0ecd134c8..6bc81145409b 100644
--- a/lib/pipeline/rte_swx_ipsec.c
+++ b/lib/pipeline/rte_swx_ipsec.c
@@ -1320,14 +1320,14 @@ rte_swx_ipsec_sa_read(struct rte_swx_ipsec *ipsec __rte_unused,
 			CHECK(!strcmp(t[2], "srcaddr"), "Missing \"srcaddr\" keyword");
 
 			status = hex_string_parse(t[3],
-						  p->encap.tunnel.ipv6.src_addr.s6_addr,
+						  p->encap.tunnel.ipv6.src_addr.a,
 						  16);
 			CHECK(!status, "Tunnel IPv6 source address invalid format");
 
 			CHECK(!strcmp(t[4], "dstaddr"), "Missing \"dstaddr\" keyword");
 
 			status = hex_string_parse(t[5],
-						  p->encap.tunnel.ipv6.dst_addr.s6_addr,
+						  p->encap.tunnel.ipv6.dst_addr.a,
 						  16);
 			CHECK(!status, "Tunnel IPv6 destination address invalid format");
 
@@ -1386,11 +1386,11 @@ tunnel_ipv6_header_set(struct rte_ipv6_hdr *h, struct rte_swx_ipsec_sa_params *p
 		.payload_len = 0, /* Cannot be pre-computed. */
 		.proto = IPPROTO_ESP,
 		.hop_limits = 64,
+		.src_addr = p->encap.tunnel.ipv6.src_addr,
+		.dst_addr = p->encap.tunnel.ipv6.dst_addr,
 	};
 
 	memcpy(h, &ipv6_hdr, sizeof(ipv6_hdr));
-	memcpy(&h->src_addr, p->encap.tunnel.ipv6.src_addr.s6_addr, 16);
-	memcpy(&h->dst_addr, p->encap.tunnel.ipv6.dst_addr.s6_addr, 16);
 }
 
 /* IPsec library SA parameters. */
@@ -1579,8 +1579,12 @@ ipsec_xform_get(struct rte_swx_ipsec_sa_params *p,
 			ipsec_xform->tunnel.ipv4.df = 0;
 			ipsec_xform->tunnel.ipv4.ttl = 64;
 		} else {
-			ipsec_xform->tunnel.ipv6.src_addr = p->encap.tunnel.ipv6.src_addr;
-			ipsec_xform->tunnel.ipv6.dst_addr = p->encap.tunnel.ipv6.dst_addr;
+			memcpy(&ipsec_xform->tunnel.ipv6.src_addr,
+				&p->encap.tunnel.ipv6.src_addr,
+				sizeof(ipsec_xform->tunnel.ipv6.src_addr));
+			memcpy(&ipsec_xform->tunnel.ipv6.dst_addr,
+				&p->encap.tunnel.ipv6.dst_addr,
+				sizeof(ipsec_xform->tunnel.ipv6.dst_addr));
 			ipsec_xform->tunnel.ipv6.dscp = 0;
 			ipsec_xform->tunnel.ipv6.flabel = 0;
 			ipsec_xform->tunnel.ipv6.hlimit = 64;
diff --git a/lib/pipeline/rte_swx_ipsec.h b/lib/pipeline/rte_swx_ipsec.h
index d2e5abef7d61..6cff18084f9c 100644
--- a/lib/pipeline/rte_swx_ipsec.h
+++ b/lib/pipeline/rte_swx_ipsec.h
@@ -48,6 +48,7 @@
 
 #include <rte_compat.h>
 #include <rte_crypto_sym.h>
+#include <rte_ip6.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -248,10 +249,10 @@ struct rte_swx_ipsec_sa_encap_params {
 		/** IPv6 header. */
 		struct {
 			/** Source address. */
-			struct in6_addr src_addr;
+			struct rte_ipv6_addr src_addr;
 
 			/** Destination address. */
-			struct in6_addr dst_addr;
+			struct rte_ipv6_addr dst_addr;
 		} ipv6;
 	} tunnel;
 };
diff --git a/lib/pipeline/rte_table_action.c b/lib/pipeline/rte_table_action.c
index c0be656536eb..a7e63b984643 100644
--- a/lib/pipeline/rte_table_action.c
+++ b/lib/pipeline/rte_table_action.c
@@ -871,12 +871,8 @@ encap_vxlan_apply(void *data,
 			d->ipv6.payload_len = 0; /* not pre-computed */
 			d->ipv6.proto = IP_PROTO_UDP;
 			d->ipv6.hop_limits = p->vxlan.ipv6.hop_limit;
-			memcpy(&d->ipv6.src_addr,
-				p->vxlan.ipv6.sa,
-				sizeof(p->vxlan.ipv6.sa));
-			memcpy(&d->ipv6.dst_addr,
-				p->vxlan.ipv6.da,
-				sizeof(p->vxlan.ipv6.da));
+			d->ipv6.src_addr = p->vxlan.ipv6.sa;
+			d->ipv6.dst_addr = p->vxlan.ipv6.da;
 
 			/* UDP */
 			d->udp.src_port = rte_htons(p->vxlan.udp.sp);
@@ -906,12 +902,8 @@ encap_vxlan_apply(void *data,
 			d->ipv6.payload_len = 0; /* not pre-computed */
 			d->ipv6.proto = IP_PROTO_UDP;
 			d->ipv6.hop_limits = p->vxlan.ipv6.hop_limit;
-			memcpy(&d->ipv6.src_addr,
-				p->vxlan.ipv6.sa,
-				sizeof(p->vxlan.ipv6.sa));
-			memcpy(&d->ipv6.dst_addr,
-				p->vxlan.ipv6.da,
-				sizeof(p->vxlan.ipv6.da));
+			d->ipv6.src_addr = p->vxlan.ipv6.sa;
+			d->ipv6.dst_addr = p->vxlan.ipv6.da;
 
 			/* UDP */
 			d->udp.src_port = rte_htons(p->vxlan.udp.sp);
@@ -1210,7 +1202,7 @@ struct nat_ipv4_data {
 } __rte_packed;
 
 struct nat_ipv6_data {
-	uint8_t addr[16];
+	struct rte_ipv6_addr addr;
 	uint16_t port;
 } __rte_packed;
 
@@ -1257,7 +1249,7 @@ nat_apply(void *data,
 	} else {
 		struct nat_ipv6_data *d = data;
 
-		memcpy(d->addr, p->addr.ipv6, sizeof(d->addr));
+		d->addr = p->addr.ipv6;
 		d->port = rte_htons(p->port);
 	}
 
@@ -1437,11 +1429,11 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip,
 
 			tcp_cksum = nat_ipv6_tcp_udp_checksum_update(tcp->cksum,
 				(uint16_t *)&ip->src_addr,
-				(uint16_t *)data->addr,
+				(uint16_t *)&data->addr,
 				tcp->src_port,
 				data->port);
 
-			rte_memcpy(&ip->src_addr, data->addr, 16);
+			ip->src_addr = data->addr;
 			tcp->src_port = data->port;
 			tcp->cksum = tcp_cksum;
 		} else {
@@ -1450,11 +1442,11 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip,
 
 			udp_cksum = nat_ipv6_tcp_udp_checksum_update(udp->dgram_cksum,
 				(uint16_t *)&ip->src_addr,
-				(uint16_t *)data->addr,
+				(uint16_t *)&data->addr,
 				udp->src_port,
 				data->port);
 
-			rte_memcpy(&ip->src_addr, data->addr, 16);
+			ip->src_addr = data->addr;
 			udp->src_port = data->port;
 			udp->dgram_cksum = udp_cksum;
 		}
@@ -1465,11 +1457,11 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip,
 
 			tcp_cksum = nat_ipv6_tcp_udp_checksum_update(tcp->cksum,
 				(uint16_t *)&ip->dst_addr,
-				(uint16_t *)data->addr,
+				(uint16_t *)&data->addr,
 				tcp->dst_port,
 				data->port);
 
-			rte_memcpy(&ip->dst_addr, data->addr, 16);
+			ip->dst_addr = data->addr;
 			tcp->dst_port = data->port;
 			tcp->cksum = tcp_cksum;
 		} else {
@@ -1478,11 +1470,11 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip,
 
 			udp_cksum = nat_ipv6_tcp_udp_checksum_update(udp->dgram_cksum,
 				(uint16_t *)&ip->dst_addr,
-				(uint16_t *)data->addr,
+				(uint16_t *)&data->addr,
 				udp->dst_port,
 				data->port);
 
-			rte_memcpy(&ip->dst_addr, data->addr, 16);
+			ip->dst_addr = data->addr;
 			udp->dst_port = data->port;
 			udp->dgram_cksum = udp_cksum;
 		}
diff --git a/lib/pipeline/rte_table_action.h b/lib/pipeline/rte_table_action.h
index bab4bfd2e23c..47a7bdfc01cc 100644
--- a/lib/pipeline/rte_table_action.h
+++ b/lib/pipeline/rte_table_action.h
@@ -56,6 +56,7 @@
 
 #include <rte_compat.h>
 #include <rte_ether.h>
+#include <rte_ip6.h>
 #include <rte_meter.h>
 #include <rte_table_hash.h>
 
@@ -419,8 +420,8 @@ struct rte_table_action_ipv4_header {
 
 /** Pre-computed IPv6 header fields for encapsulation action. */
 struct rte_table_action_ipv6_header {
-	uint8_t sa[16]; /**< Source address. */
-	uint8_t da[16]; /**< Destination address. */
+	struct rte_ipv6_addr sa; /**< Source address. */
+	struct rte_ipv6_addr da; /**< Destination address. */
 	uint32_t flow_label; /**< Flow label. */
 	uint8_t dscp; /**< DiffServ Code Point (DSCP). */
 	uint8_t hop_limit; /**< Hop Limit (HL). */
@@ -597,7 +598,7 @@ struct rte_table_action_nat_params {
 		uint32_t ipv4;
 
 		/** IPv6 address; only valid when *ip_version* is set to 0. */
-		uint8_t ipv6[16];
+		struct rte_ipv6_addr ipv6;
 	} addr;
 
 	/** Port. */
-- 
2.47.0


  parent reply	other threads:[~2024-10-18  9:19 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   ` [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   ` Robin Jarry [this message]
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=20241018091734.64601-11-rjarry@redhat.com \
    --to=rjarry@redhat.com \
    --cc=cristian.dumitrescu@intel.com \
    --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).