DPDK patches and discussions
 help / color / mirror / Atom feed
* [RFC PATCH] ethdev: introduce NAT64 action
@ 2023-08-11 14:07 Bing Zhao
  2023-09-19 10:05 ` Ori Kam
  0 siblings, 1 reply; 5+ messages in thread
From: Bing Zhao @ 2023-08-11 14:07 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, andrew.rybchenko; +Cc: dev

In order to support the communication between IPv4 and IPv6 nodes in
the network, different technologies are used, like dual-stacks,
tunneling and NAT64. In some IPv4-only clients, it is hard to deploy
new software and hardware to support IPv6.

NAT64 is a choice and it will also reduce the unnecessary overhead of
the traffic in the network. The NAT64 gateways take the
responsibility of the packet headers translation between the IPv6
clouds and IPv4-only clouds.

This action should support the offloading of the IP headers'
translation. The following fields should be reset correctly in the
translation.
  - Version
  - Traffic Class / TOS
  - Flow Label (0 in v4)
  - Payload Length / Total length
  - Next Header
  - Hop Limit / TTL

Since there are different mapping and translating modes of the
addresses, it will depend on the capabilities of each vendor.

The ICMP* and transport layers protocol is out of the scope of NAT64
rte_flow action.

Reference links:
  - https://datatracker.ietf.org/doc/html/rfc6146
  - https://datatracker.ietf.org/doc/html/rfc6052
  - https://datatracker.ietf.org/doc/html/rfc6145

Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
 lib/ethdev/rte_flow.c |  1 +
 lib/ethdev/rte_flow.h | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 271d854f78..b60a4f6654 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -265,6 +265,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
 	MK_FLOW_ACTION(IPV6_EXT_REMOVE, sizeof(struct rte_flow_action_ipv6_ext_remove)),
 	MK_FLOW_ACTION(INDIRECT_LIST,
 		       sizeof(struct rte_flow_action_indirect_list)),
+	MK_FLOW_ACTION(NAT64, sizeof(struct rte_flow_action_nat64)),
 };
 
 int
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index 86ed98c562..2002999a35 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -2989,6 +2989,13 @@ enum rte_flow_action_type {
 	 * @see struct rte_flow_action_indirect_list
 	 */
 	RTE_FLOW_ACTION_TYPE_INDIRECT_LIST,
+
+	/**
+	 * Support the NAT64 translation.
+	 *
+	 * @see struct rte_flow_action_nat64
+	 */
+	RTE_FLOW_ACTION_TYPE_NAT64,
 };
 
 /**
@@ -4092,6 +4099,26 @@ rte_flow_dynf_metadata_set(struct rte_mbuf *m, uint32_t v)
 	*RTE_FLOW_DYNF_METADATA(m) = v;
 }
 
+/**
+ * NAT64 translation type for IP headers.
+ */
+enum rte_flow_nat64_type {
+	RTE_FLOW_NAT64_6TO4 = 0, /**< IPv6 to IPv4 headers translation. */
+	RTE_FLOW_NAT64_4TO6 = 1, /**< IPv4 to IPv6 headers translation. */
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ACTION_TYPE_NAT64
+ *
+ * Specify the NAT64 translation type.
+ */
+struct rte_flow_action_nat64 {
+	enum rte_flow_nat64_type type;
+};
+
 /**
  * Definition of a single action.
  *
-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-11-28 15:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-11 14:07 [RFC PATCH] ethdev: introduce NAT64 action Bing Zhao
2023-09-19 10:05 ` Ori Kam
2023-09-21 15:45   ` Ferruh Yigit
2023-10-10  9:55     ` Ferruh Yigit
2023-11-28 15:21       ` Bing Zhao

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).