@@ -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",
@@ -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``
^^^^^^^^^^^^^^^^^^^^^
@@ -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.
@@ -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)),
@@ -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
*
@@ -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']
new file mode 100644
@@ -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_ */