From: Alexander Kozyrev <akozyrev@nvidia.com>
To: <dev@dpdk.org>
Cc: <dsosnowski@nvidia.com>, <orika@nvidia.com>,
<nithind1988@gmail.com>, <olivier.matz@6wind.com>,
<thomas@monjalon.net>, <matan@nvidia.com>, <jerinj@marvell.com>,
<rbhansali@marvell.com>, <ferruh.yigit@amd.com>
Subject: [PATCH] mbuf: add transport mode ESP packet type
Date: Thu, 22 Aug 2024 18:32:18 +0300 [thread overview]
Message-ID: <20240822153218.3782170-1-akozyrev@nvidia.com> (raw)
Support the IP Encapsulating Security Payload (ESP) in transport mode.
Currently, we have RTE_PTYPE_TUNNEL_ESP for the ESP tunnel mode.
Transport mode can be detected by parsing the "Next Header" field.
The Next Header is TCP for the transport mode and IP for the tunnel mode.
Add RTE_PTYPE_L4_ESP for the regular transport mode and
RTE_PTYPE_INNER_L4_ESP for the ESP over UDP packets.
Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
lib/mbuf/rte_mbuf_ptype.c | 2 ++
lib/mbuf/rte_mbuf_ptype.h | 36 ++++++++++++++++++++++++++++++------
2 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/lib/mbuf/rte_mbuf_ptype.c b/lib/mbuf/rte_mbuf_ptype.c
index d6f906b06c..ab180b3dda 100644
--- a/lib/mbuf/rte_mbuf_ptype.c
+++ b/lib/mbuf/rte_mbuf_ptype.c
@@ -50,6 +50,7 @@ const char *rte_get_ptype_l4_name(uint32_t ptype)
case RTE_PTYPE_L4_ICMP: return "L4_ICMP";
case RTE_PTYPE_L4_NONFRAG: return "L4_NONFRAG";
case RTE_PTYPE_L4_IGMP: return "L4_IGMP";
+ case RTE_PTYPE_L4_ESP: return "L4_ESP";
default: return "L4_UNKNOWN";
}
}
@@ -112,6 +113,7 @@ const char *rte_get_ptype_inner_l4_name(uint32_t ptype)
case RTE_PTYPE_INNER_L4_SCTP: return "INNER_L4_SCTP";
case RTE_PTYPE_INNER_L4_ICMP: return "INNER_L4_ICMP";
case RTE_PTYPE_INNER_L4_NONFRAG: return "INNER_L4_NONFRAG";
+ case RTE_PTYPE_INNER_L4_ESP: return "INNER_L4_ESP";
default: return "INNER_L4_UNKNOWN";
}
}
diff --git a/lib/mbuf/rte_mbuf_ptype.h b/lib/mbuf/rte_mbuf_ptype.h
index f2276e2909..c46a94f89f 100644
--- a/lib/mbuf/rte_mbuf_ptype.h
+++ b/lib/mbuf/rte_mbuf_ptype.h
@@ -247,7 +247,7 @@ extern "C" {
* It refers to those packets of any IP types, which can be recognized as
* fragmented. A fragmented packet cannot be recognized as any other L4 types
* (RTE_PTYPE_L4_TCP, RTE_PTYPE_L4_UDP, RTE_PTYPE_L4_SCTP, RTE_PTYPE_L4_ICMP,
- * RTE_PTYPE_L4_NONFRAG).
+ * RTE_PTYPE_L4_NONFRAG, RTE_PTYPE_L4_IGMP, RTE_PTYPE_L4_ESP).
*
* Packet format:
* <'ether type'=0x0800
@@ -290,14 +290,15 @@ extern "C" {
*
* It refers to those packets of any IP types, while cannot be recognized as
* any of above L4 types (RTE_PTYPE_L4_TCP, RTE_PTYPE_L4_UDP,
- * RTE_PTYPE_L4_FRAG, RTE_PTYPE_L4_SCTP, RTE_PTYPE_L4_ICMP).
+ * RTE_PTYPE_L4_FRAG (for IPv6), RTE_PTYPE_L4_SCTP, RTE_PTYPE_L4_ICMP,
+ * RTE_PTYPE_L4_IGMP (for IPv4), RTE_PTYPE_L4_ESP).
*
* Packet format:
* <'ether type'=0x0800
- * | 'version'=4, 'protocol'!=[6|17|132|1], 'MF'=0, 'frag_offset'=0>
+ * | 'version'=4, 'protocol'!=[1|2|6|17|50|132], 'MF'=0, 'frag_offset'=0>
* or,
* <'ether type'=0x86DD
- * | 'version'=6, 'next header'!=[6|17|44|132|1]>
+ * | 'version'=6, 'next header'!=[1|6|17|44|50|132]>
*/
#define RTE_PTYPE_L4_NONFRAG 0x00000600
/**
@@ -308,6 +309,17 @@ extern "C" {
* | 'version'=4, 'protocol'=2, 'MF'=0, 'frag_offset'=0>
*/
#define RTE_PTYPE_L4_IGMP 0x00000700
+/**
+ * ESP (IP Encapsulating Security Payload) transport packet type.
+ *
+ * Packet format:
+ * <'ether type'=0x0800
+ * | 'version'=4, 'protocol'=50, 'MF'=0, 'frag_offset'=0>
+ * or,
+ * <'ether type'=0x86DD
+ * | 'version'=6, 'next header'=50>
+ */
+#define RTE_PTYPE_L4_ESP 0x00000800
/**
* Mask of layer 4 packet types.
* It is used for outer packet for tunneling cases.
@@ -652,12 +664,24 @@ extern "C" {
*
* Packet format (inner only):
* <'ether type'=0x0800
- * | 'version'=4, 'protocol'!=[6|17|132|1], 'MF'=0, 'frag_offset'=0>
+ * | 'version'=4, 'protocol'!=[1|6|17|50|132], 'MF'=0, 'frag_offset'=0>
* or,
* <'ether type'=0x86DD
- * | 'version'=6, 'next header'!=[6|17|44|132|1]>
+ * | 'version'=6, 'next header'!=[1|6|17|44|50|132]>
*/
#define RTE_PTYPE_INNER_L4_NONFRAG 0x06000000
+/**
+ * ESP (IP Encapsulating Security Payload) transport packet type.
+ * It is used for inner packet only.
+ *
+ * Packet format (inner only):
+ * <'ether type'=0x0800
+ * | 'version'=4, 'protocol'=50, 'MF'=0, 'frag_offset'=0>
+ * or,
+ * <'ether type'=0x86DD
+ * | 'version'=6, 'next header'=50>
+ */
+#define RTE_PTYPE_INNER_L4_ESP 0x08000000
/**
* Mask of inner layer 4 packet types.
*/
--
2.18.2
next reply other threads:[~2024-08-22 15:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-22 15:32 Alexander Kozyrev [this message]
2024-09-02 8:43 ` Nithin Dabilpuram
2024-09-04 21:09 ` Alexander Kozyrev
2024-10-15 14:40 ` Dariusz Sosnowski
2024-11-09 11:50 ` Thomas Monjalon
2024-10-17 20:47 ` Thomas Monjalon
2024-10-18 13:44 ` David Marchand
2024-10-22 13:19 ` Alexander Kozyrev
2024-10-23 4:54 ` Nithin Dabilpuram
2024-10-24 19:30 ` Alexander Kozyrev
2024-10-24 23:32 ` Ajit Khaparde
2024-10-29 14:48 ` Ori Kam
2024-10-29 18:41 ` Ajit Khaparde
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=20240822153218.3782170-1-akozyrev@nvidia.com \
--to=akozyrev@nvidia.com \
--cc=dev@dpdk.org \
--cc=dsosnowski@nvidia.com \
--cc=ferruh.yigit@amd.com \
--cc=jerinj@marvell.com \
--cc=matan@nvidia.com \
--cc=nithind1988@gmail.com \
--cc=olivier.matz@6wind.com \
--cc=orika@nvidia.com \
--cc=rbhansali@marvell.com \
--cc=thomas@monjalon.net \
/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).