From: Leo Xu <yongquanx@nvidia.com>
To: <dev@dpdk.org>
Cc: Bing Zhao <bingz@nvidia.com>, Ori Kam <orika@nvidia.com>,
Wenzhuo Lu <wenzhuo.lu@intel.com>,
Beilei Xing <beilei.xing@intel.com>,
"Bernard Iremonger" <bernard.iremonger@intel.com>,
Thomas Monjalon <thomas@monjalon.net>,
Ferruh Yigit <ferruh.yigit@intel.com>,
"Andrew Rybchenko" <andrew.rybchenko@oktetlabs.ru>,
Olivier Matz <olivier.matz@6wind.com>
Subject: [PATCH 1/3] ethdev: add ICMPv6 id and sequence
Date: Mon, 12 Dec 2022 10:59:20 +0200 [thread overview]
Message-ID: <20221212085923.2314350-2-yongquanx@nvidia.com> (raw)
In-Reply-To: <20221212085923.2314350-1-yongquanx@nvidia.com>
This patch adds API support for ICMPv6 id and sequence.
1: Add two new pattern item types for ICMPv6 echo request and reply:
RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST
RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY
2: Add new header file rte_icmp6.h for ICMPv6 packet definitions.
3: Enhance testpmd flow pattern to support ICMPv6 identifier and sequence.
Example of ICMPv6 echo pattern in testpmd command:
pattern eth / ipv6 / icmp6_echo_request / end
pattern eth / ipv6 / icmp6_echo_reply / end
pattern eth / ipv6 / icmp6_echo_request ident is 20 seq is 30 / end
Signed-off-by: Leo Xu <yongquanx@nvidia.com>
Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
app/test-pmd/cmdline_flow.c | 70 +++++++++++++++++++++
doc/guides/prog_guide/rte_flow.rst | 14 +++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 +++
lib/librte_ethdev/rte_flow.c | 4 ++
lib/librte_ethdev/rte_flow.h | 25 ++++++++
lib/librte_net/meson.build | 3 +-
lib/librte_net/rte_icmp6.h | 48 ++++++++++++++
7 files changed, 173 insertions(+), 1 deletion(-)
create mode 100644 lib/librte_net/rte_icmp6.h
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index ce8035cb46..413ef905f2 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -375,6 +375,12 @@ enum index {
ITEM_ICMP6,
ITEM_ICMP6_TYPE,
ITEM_ICMP6_CODE,
+ ITEM_ICMP6_ECHO_REQUEST,
+ ITEM_ICMP6_ECHO_REQUEST_ID,
+ ITEM_ICMP6_ECHO_REQUEST_SEQ,
+ ITEM_ICMP6_ECHO_REPLY,
+ ITEM_ICMP6_ECHO_REPLY_ID,
+ ITEM_ICMP6_ECHO_REPLY_SEQ,
ITEM_ICMP6_ND_NS,
ITEM_ICMP6_ND_NS_TARGET_ADDR,
ITEM_ICMP6_ND_NA,
@@ -1373,6 +1379,8 @@ static const enum index next_item[] = {
ITEM_IPV6_EXT,
ITEM_IPV6_FRAG_EXT,
ITEM_ICMP6,
+ ITEM_ICMP6_ECHO_REQUEST,
+ ITEM_ICMP6_ECHO_REPLY,
ITEM_ICMP6_ND_NS,
ITEM_ICMP6_ND_NA,
ITEM_ICMP6_ND_OPT,
@@ -1629,6 +1637,20 @@ static const enum index item_icmp6[] = {
ZERO,
};
+static const enum index item_icmp6_echo_request[] = {
+ ITEM_ICMP6_ECHO_REQUEST_ID,
+ ITEM_ICMP6_ECHO_REQUEST_SEQ,
+ ITEM_NEXT,
+ ZERO,
+};
+
+static const enum index item_icmp6_echo_reply[] = {
+ ITEM_ICMP6_ECHO_REPLY_ID,
+ ITEM_ICMP6_ECHO_REPLY_SEQ,
+ ITEM_NEXT,
+ ZERO,
+};
+
static const enum index item_icmp6_nd_ns[] = {
ITEM_ICMP6_ND_NS_TARGET_ADDR,
ITEM_NEXT,
@@ -4432,6 +4454,54 @@ static const struct token token_list[] = {
.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp6,
code)),
},
+ [ITEM_ICMP6_ECHO_REQUEST] = {
+ .name = "icmp6_echo_request",
+ .help = "match ICMPv6 echo request",
+ .priv = PRIV_ITEM(ICMP6_ECHO_REQUEST,
+ sizeof(struct rte_flow_item_icmp6_echo)),
+ .next = NEXT(item_icmp6_echo_request),
+ .call = parse_vc,
+ },
+ [ITEM_ICMP6_ECHO_REQUEST_ID] = {
+ .name = "ident",
+ .help = "ICMPv6 echo request identifier",
+ .next = NEXT(item_icmp6_echo_request, NEXT_ENTRY(UNSIGNED),
+ item_param),
+ .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp6_echo,
+ echo.identifier)),
+ },
+ [ITEM_ICMP6_ECHO_REQUEST_SEQ] = {
+ .name = "seq",
+ .help = "ICMPv6 echo request sequence",
+ .next = NEXT(item_icmp6_echo_request, NEXT_ENTRY(UNSIGNED),
+ item_param),
+ .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp6_echo,
+ echo.sequence)),
+ },
+ [ITEM_ICMP6_ECHO_REPLY] = {
+ .name = "icmp6_echo_reply",
+ .help = "match ICMPv6 echo reply",
+ .priv = PRIV_ITEM(ICMP6_ECHO_REPLY,
+ sizeof(struct rte_flow_item_icmp6_echo)),
+ .next = NEXT(item_icmp6_echo_reply),
+ .call = parse_vc,
+ },
+ [ITEM_ICMP6_ECHO_REPLY_ID] = {
+ .name = "ident",
+ .help = "ICMPv6 echo reply identifier",
+ .next = NEXT(item_icmp6_echo_reply, NEXT_ENTRY(UNSIGNED),
+ item_param),
+ .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp6_echo,
+ echo.identifier)),
+ },
+ [ITEM_ICMP6_ECHO_REPLY_SEQ] = {
+ .name = "seq",
+ .help = "ICMPv6 echo reply sequence",
+ .next = NEXT(item_icmp6_echo_reply, NEXT_ENTRY(UNSIGNED),
+ item_param),
+ .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp6_echo,
+ echo.sequence)),
+ },
[ITEM_ICMP6_ND_NS] = {
.name = "icmp6_nd_ns",
.help = "match ICMPv6 neighbor discovery solicitation",
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index b0bbb6fcbe..282fa1176c 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1260,6 +1260,20 @@ Matches any ICMPv6 header.
- ``checksum``: ICMPv6 checksum.
- Default ``mask`` matches ``type`` and ``code``.
+Item: ``ICMP6_ECHO_REQUEST``
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Matches an ICMPv6 echo request.
+
+- ``echo``: ICMP6 echo definition (``rte_icmp6.h``).
+
+Item: ``ICMP6_ECHO_REPLY``
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Matches an ICMPv6 echo reply.
+
+- ``echo``: ICMP6 echo definition (``rte_icmp6.h``).
+
Item: ``ICMP6_ND_NS``
^^^^^^^^^^^^^^^^^^^^^
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index d711ca1f5c..6c370c033f 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -4033,6 +4033,16 @@ This section lists supported pattern items and their attributes, if any.
- ``type {unsigned}``: ICMPv6 type.
- ``code {unsigned}``: ICMPv6 code.
+- ``icmp6_echo_request``: match ICMPv6 echo request.
+
+ - ``ident {unsigned}``: ICMPv6 echo request identifier.
+ - ``seq {unsigned}``: ICMPv6 echo request sequence number.
+
+- ``icmp6_echo_reply``: match ICMPv6 echo reply.
+
+ - ``ident {unsigned}``: ICMPv6 echo reply identifier.
+ - ``seq {unsigned}``: ICMPv6 echo reply sequence number.
+
- ``icmp6_nd_ns``: match ICMPv6 neighbor discovery solicitation.
- ``target_addr {ipv6 address}``: target address.
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 350c46420c..4f4c641111 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -128,6 +128,10 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
MK_FLOW_ITEM(IPV6_EXT, sizeof(struct rte_flow_item_ipv6_ext)),
MK_FLOW_ITEM(IPV6_FRAG_EXT, sizeof(struct rte_flow_item_ipv6_frag_ext)),
MK_FLOW_ITEM(ICMP6, sizeof(struct rte_flow_item_icmp6)),
+ MK_FLOW_ITEM(ICMP6_ECHO_REQUEST,
+ sizeof(struct rte_flow_item_icmp6_echo)),
+ MK_FLOW_ITEM(ICMP6_ECHO_REPLY,
+ sizeof(struct rte_flow_item_icmp6_echo)),
MK_FLOW_ITEM(ICMP6_ND_NS, sizeof(struct rte_flow_item_icmp6_nd_ns)),
MK_FLOW_ITEM(ICMP6_ND_NA, sizeof(struct rte_flow_item_icmp6_nd_na)),
MK_FLOW_ITEM(ICMP6_ND_OPT, sizeof(struct rte_flow_item_icmp6_nd_opt)),
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 1b527f045a..fa21ed0c52 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -21,6 +21,7 @@
#include <rte_common.h>
#include <rte_ether.h>
#include <rte_icmp.h>
+#include <rte_icmp6.h>
#include <rte_ip.h>
#include <rte_sctp.h>
#include <rte_tcp.h>
@@ -684,6 +685,20 @@ enum rte_flow_item_type {
* @see struct rte_flow_item_quota
*/
RTE_FLOW_ITEM_TYPE_QUOTA,
+
+ /**
+ * Matches an ICMPv6 echo request.
+ *
+ * See struct rte_flow_item_icmp6_echo.
+ */
+ RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST,
+
+ /**
+ * Matches an ICMPv6 echo reply.
+ *
+ * See struct rte_flow_item_icmp6_echo.
+ */
+ RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY,
};
/**
@@ -1428,6 +1443,16 @@ static const struct rte_flow_item_icmp6 rte_flow_item_icmp6_mask = {
};
#endif
+/**
+ * RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST
+ * RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY
+ *
+ * Matches an ICMPv6 echo request or reply.
+ */
+struct rte_flow_item_icmp6_echo {
+ struct rte_icmp6_echo echo;
+};
+
/**
* RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
*
diff --git a/lib/librte_net/meson.build b/lib/librte_net/meson.build
index 94d816e79f..5c5d0a03c6 100644
--- a/lib/librte_net/meson.build
+++ b/lib/librte_net/meson.build
@@ -17,7 +17,8 @@ headers = files('rte_ip.h',
'rte_mpls.h',
'rte_higig.h',
'rte_ecpri.h',
- 'rte_geneve.h')
+ 'rte_geneve.h',
+ 'rte_icmp6.h')
sources = files('rte_arp.c', 'rte_ether.c', 'rte_net.c', 'rte_net_crc.c')
deps += ['mbuf']
diff --git a/lib/librte_net/rte_icmp6.h b/lib/librte_net/rte_icmp6.h
new file mode 100644
index 0000000000..bf6956d7c9
--- /dev/null
+++ b/lib/librte_net/rte_icmp6.h
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 NVIDIA Corporation & Affiliates
+ */
+
+#ifndef _RTE_ICMP6_H_
+#define _RTE_ICMP6_H_
+
+/**
+ * @file
+ *
+ * ICMP6-related defines
+ */
+
+#include <stdint.h>
+
+#include <rte_byteorder.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * ICMP6 header
+ */
+struct rte_icmp6_hdr {
+ uint8_t type;
+ uint8_t code;
+ rte_be16_t checksum;
+} __rte_packed;
+
+/**
+ * ICMP6 echo
+ */
+struct rte_icmp6_echo {
+ struct rte_icmp6_hdr hdr;
+ rte_be16_t identifier;
+ rte_be16_t sequence;
+} __rte_packed;
+
+/* ICMP6 packet types */
+#define RTE_ICMP6_ECHO_REQUEST 128
+#define RTE_ICMP6_ECHO_REPLY 129
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_ICMP6_H_ */
--
2.27.0
next prev parent reply other threads:[~2022-12-12 9:01 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-12 8:59 [PATCH 0/3] support match icmpv6 " Leo Xu
2022-12-12 8:59 ` Leo Xu [this message]
2022-12-12 8:59 ` [PATCH 2/3] net/mlx5: add ICMPv6 id and sequence match support Leo Xu
2022-12-12 8:59 ` [PATCH 3/3] net/mlx5/hws: " Leo Xu
2022-12-20 7:44 ` [PATCH v2 0/3] support match icmpv6 ID and sequence Leo Xu
2022-12-20 7:44 ` [PATCH v2 1/3] ethdev: add ICMPv6 " Leo Xu
2023-01-03 8:17 ` Ori Kam
2023-01-18 9:30 ` Thomas Monjalon
2023-01-31 6:53 ` Leo Xu (Networking SW)
2023-02-01 9:56 ` Thomas Monjalon
2023-02-02 18:33 ` Leo Xu (Networking SW)
2023-02-02 21:23 ` Thomas Monjalon
2023-02-03 2:56 ` Leo Xu (Networking SW)
2023-01-26 10:45 ` Ferruh Yigit
2023-01-31 3:58 ` Leo Xu (Networking SW)
2022-12-20 7:44 ` [PATCH v2 2/3] net/mlx5: add ICMPv6 ID and sequence match support Leo Xu
2023-01-18 8:55 ` Thomas Monjalon
2023-01-31 6:57 ` Leo Xu (Networking SW)
2022-12-20 7:44 ` [PATCH v2 3/3] net/mlx5/hws: " Leo Xu
2023-01-18 8:58 ` Thomas Monjalon
2023-01-31 6:56 ` Leo Xu (Networking SW)
2023-01-26 10:47 ` [PATCH v2 0/3] support match icmpv6 ID and sequence Ferruh Yigit
2023-01-31 3:54 ` Leo Xu (Networking SW)
2023-02-05 13:41 ` [PATCH v3 " Leo Xu
2023-02-05 13:41 ` [PATCH v3 1/3] ethdev: add ICMPv6 " Leo Xu
2023-02-05 13:41 ` [PATCH v3 2/3] net/mlx5: add ICMPv6 ID and sequence match support Leo Xu
2023-02-07 13:48 ` Slava Ovsiienko
2023-02-05 13:41 ` [PATCH v3 3/3] net/mlx5/hws: " Leo Xu
2023-02-07 13:05 ` Alex Vesker
2023-02-07 13:49 ` Slava Ovsiienko
2023-02-09 13:04 ` [PATCH v3 0/3] support match icmpv6 ID and sequence Ferruh Yigit
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=20221212085923.2314350-2-yongquanx@nvidia.com \
--to=yongquanx@nvidia.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=beilei.xing@intel.com \
--cc=bernard.iremonger@intel.com \
--cc=bingz@nvidia.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=olivier.matz@6wind.com \
--cc=orika@nvidia.com \
--cc=thomas@monjalon.net \
--cc=wenzhuo.lu@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).