* [PATCH 1/3] ethdev: add ICMPv6 id and sequence
2022-12-12 8:59 [PATCH 0/3] support match icmpv6 id and sequence Leo Xu
@ 2022-12-12 8:59 ` Leo Xu
2022-12-12 8:59 ` [PATCH 2/3] net/mlx5: add ICMPv6 id and sequence match support Leo Xu
` (2 subsequent siblings)
3 siblings, 0 replies; 31+ messages in thread
From: Leo Xu @ 2022-12-12 8:59 UTC (permalink / raw)
To: dev
Cc: Bing Zhao, Ori Kam, Wenzhuo Lu, Beilei Xing, Bernard Iremonger,
Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Olivier Matz
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
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH 2/3] net/mlx5: add ICMPv6 id and sequence match support
2022-12-12 8:59 [PATCH 0/3] support match icmpv6 id and sequence Leo Xu
2022-12-12 8:59 ` [PATCH 1/3] ethdev: add ICMPv6 " Leo Xu
@ 2022-12-12 8:59 ` 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
3 siblings, 0 replies; 31+ messages in thread
From: Leo Xu @ 2022-12-12 8:59 UTC (permalink / raw)
To: dev; +Cc: Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko
This patch adds ICMPv6 id and sequence match support.
Since type and code of ICMPv6 echo is already specified by ITEM type:
RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST
RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY
mlx5 pmd will set appropriate type and code automatically:
Echo request: type(128), code(0)
Echo reply: type(129), code(0)
type and code provided by application will be ignored.
Signed-off-by: Leo Xu <yongquanx@nvidia.com>
---
doc/guides/nics/mlx5.rst | 2 +-
drivers/net/mlx5/mlx5_flow.c | 61 ++++++++++++++++++++++++++
drivers/net/mlx5/mlx5_flow.h | 4 ++
drivers/net/mlx5/mlx5_flow_dv.c | 76 +++++++++++++++++++++++++++++++++
drivers/net/mlx5/mlx5_flow_hw.c | 2 +
5 files changed, 144 insertions(+), 1 deletion(-)
diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 328c728f13..d17bb1fe47 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -328,7 +328,7 @@ Limitations
- The input buffer, providing the removal size, is not validated.
- The buffer size must match the length of the headers to be removed.
-- ICMP(code/type/identifier/sequence number) / ICMP6(code/type) matching, IP-in-IP and MPLS flow matching are all
+- ICMP(code/type/identifier/sequence number) / ICMP6(code/type/identifier/sequence number) matching, IP-in-IP and MPLS flow matching are all
mutually exclusive features which cannot be supported together
(see :ref:`mlx5_firmware_config`).
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 114451b872..bf6a3010ca 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -2442,6 +2442,67 @@ mlx5_flow_validate_item_icmp6(const struct rte_flow_item *item,
return 0;
}
+/**
+ * Validate ICMP6 echo request/reply item.
+ *
+ * @param[in] item
+ * Item specification.
+ * @param[in] item_flags
+ * Bit-fields that holds the items detected until now.
+ * @param[in] ext_vlan_sup
+ * Whether extended VLAN features are supported or not.
+ * @param[out] error
+ * Pointer to error structure.
+ *
+ * @return
+ * 0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+int
+mlx5_flow_validate_item_icmp6_echo(const struct rte_flow_item *item,
+ uint64_t item_flags,
+ uint8_t target_protocol,
+ struct rte_flow_error *error)
+{
+ const struct rte_flow_item_icmp6_echo *mask = item->mask;
+ const struct rte_flow_item_icmp6_echo nic_mask = {
+ .echo.hdr.type = 0xff,
+ .echo.hdr.code = 0xff,
+ .echo.identifier = RTE_BE16(0xffff),
+ .echo.sequence = RTE_BE16(0xffff),
+ };
+ const int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
+ const uint64_t l3m = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV6 :
+ MLX5_FLOW_LAYER_OUTER_L3_IPV6;
+ const uint64_t l4m = tunnel ? MLX5_FLOW_LAYER_INNER_L4 :
+ MLX5_FLOW_LAYER_OUTER_L4;
+ int ret;
+
+ if (target_protocol != 0xFF && target_protocol != IPPROTO_ICMPV6)
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM, item,
+ "protocol filtering not compatible"
+ " with ICMP6 layer");
+ if (!(item_flags & l3m))
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM, item,
+ "IPv6 is mandatory to filter on"
+ " ICMP6");
+ if (item_flags & l4m)
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM, item,
+ "multiple L4 layers not supported");
+ if (!mask)
+ mask = &nic_mask;
+ ret = mlx5_flow_item_acceptable
+ (item, (const uint8_t *)mask,
+ (const uint8_t *)&nic_mask,
+ sizeof(struct rte_flow_item_icmp6_echo),
+ MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
+ if (ret < 0)
+ return ret;
+ return 0;
+}
+
/**
* Validate ICMP item.
*
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 322ffc5651..e9d763cd4c 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -2333,6 +2333,10 @@ int mlx5_flow_validate_item_icmp6(const struct rte_flow_item *item,
uint64_t item_flags,
uint8_t target_protocol,
struct rte_flow_error *error);
+int mlx5_flow_validate_item_icmp6_echo(const struct rte_flow_item *item,
+ uint64_t item_flags,
+ uint8_t target_protocol,
+ struct rte_flow_error *error);
int mlx5_flow_validate_item_nvgre(const struct rte_flow_item *item,
uint64_t item_flags,
uint8_t target_protocol,
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 49425087d6..1ecfd13d67 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -6194,6 +6194,17 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
item_ipv6_proto = IPPROTO_ICMPV6;
last_item = MLX5_FLOW_LAYER_ICMP6;
break;
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST:
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY:
+ ret = mlx5_flow_validate_item_icmp6_echo(items,
+ item_flags,
+ next_protocol,
+ error);
+ if (ret < 0)
+ return ret;
+ item_ipv6_proto = IPPROTO_ICMPV6;
+ last_item = MLX5_FLOW_LAYER_ICMP6;
+ break;
case RTE_FLOW_ITEM_TYPE_TAG:
ret = flow_dv_validate_item_tag(dev, items,
attr, error);
@@ -9165,6 +9176,65 @@ flow_dv_translate_item_icmp6(void *key, const struct rte_flow_item *item,
icmp6_v->code & icmp6_m->code);
}
+/**
+ * Add ICMP6 echo request/reply item to the value.
+ *
+ * @param[in, out] key
+ * Flow matcher value.
+ * @param[in] item
+ * Flow pattern to translate.
+ * @param[in] inner
+ * Item is inner pattern.
+ * @param[in] key_type
+ * Set flow matcher mask or value.
+ */
+static void
+flow_dv_translate_item_icmp6_echo(void *key, const struct rte_flow_item *item,
+ int inner, uint32_t key_type)
+{
+ const struct rte_flow_item_icmp6_echo *icmp6_m;
+ const struct rte_flow_item_icmp6_echo *icmp6_v;
+ uint32_t icmp6_header_data_m = 0;
+ uint32_t icmp6_header_data_v = 0;
+ void *headers_v;
+ void *misc3_v = MLX5_ADDR_OF(fte_match_param, key, misc_parameters_3);
+ uint8_t icmp6_type = 0;
+ struct rte_flow_item_icmp6_echo zero_mask;
+
+ memset(&zero_mask, 0, sizeof(zero_mask));
+ headers_v = inner ? MLX5_ADDR_OF(fte_match_param, key, inner_headers) :
+ MLX5_ADDR_OF(fte_match_param, key, outer_headers);
+ if (key_type & MLX5_SET_MATCHER_M)
+ MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol, 0xFF);
+ else
+ MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol,
+ IPPROTO_ICMPV6);
+ MLX5_ITEM_UPDATE(item, key_type, icmp6_v, icmp6_m, &zero_mask);
+ /* Set fixed type and code for icmpv6 echo request or reply */
+ icmp6_type = (item->type == RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST ?
+ RTE_ICMP6_ECHO_REQUEST : RTE_ICMP6_ECHO_REPLY);
+ if (key_type & MLX5_SET_MATCHER_M) {
+ MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_type, 0xFF);
+ MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_code, 0xFF);
+ } else {
+ MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_type, icmp6_type);
+ MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_code, 0);
+ }
+ if (icmp6_v == NULL)
+ return;
+ /* Set icmp6 header data (identifier & sequence) accordingly */
+ icmp6_header_data_m =
+ (rte_be_to_cpu_16(icmp6_m->echo.identifier) << 16) |
+ rte_be_to_cpu_16(icmp6_m->echo.sequence);
+ if (icmp6_header_data_m) {
+ icmp6_header_data_v =
+ (rte_be_to_cpu_16(icmp6_v->echo.identifier) << 16) |
+ rte_be_to_cpu_16(icmp6_v->echo.sequence);
+ MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_header_data,
+ icmp6_header_data_v & icmp6_header_data_m);
+ }
+}
+
/**
* Add ICMP item to the value.
*
@@ -12804,6 +12874,12 @@ flow_dv_translate_items(struct rte_eth_dev *dev,
wks->priority = MLX5_PRIORITY_MAP_L4;
last_item = MLX5_FLOW_LAYER_ICMP6;
break;
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST:
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY:
+ flow_dv_translate_item_icmp6_echo(key, items, tunnel, key_type);
+ wks->priority = MLX5_PRIORITY_MAP_L4;
+ last_item = MLX5_FLOW_LAYER_ICMP6;
+ break;
case RTE_FLOW_ITEM_TYPE_TAG:
flow_dv_translate_item_tag(dev, key, items, key_type);
last_item = MLX5_FLOW_ITEM_TAG;
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 8d59e73581..f9ad862707 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -4765,6 +4765,8 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,
case RTE_FLOW_ITEM_TYPE_GRE_OPTION:
case RTE_FLOW_ITEM_TYPE_ICMP:
case RTE_FLOW_ITEM_TYPE_ICMP6:
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST:
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY:
case RTE_FLOW_ITEM_TYPE_CONNTRACK:
case RTE_FLOW_ITEM_TYPE_QUOTA:
break;
--
2.27.0
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH 3/3] net/mlx5/hws: add ICMPv6 id and sequence match support
2022-12-12 8:59 [PATCH 0/3] support match icmpv6 id and sequence Leo Xu
2022-12-12 8:59 ` [PATCH 1/3] ethdev: add ICMPv6 " Leo Xu
2022-12-12 8:59 ` [PATCH 2/3] net/mlx5: add ICMPv6 id and sequence match support Leo Xu
@ 2022-12-12 8:59 ` Leo Xu
2022-12-20 7:44 ` [PATCH v2 0/3] support match icmpv6 ID and sequence Leo Xu
3 siblings, 0 replies; 31+ messages in thread
From: Leo Xu @ 2022-12-12 8:59 UTC (permalink / raw)
To: dev; +Cc: Shun Hao, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko
This patch adds ICMPv6 id and sequence match support for HWS.
Since type and code of ICMPv6 echo is already specified by ITEM type:
RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST
RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY
mlx5 pmd will set appropriate type and code automatically:
Echo request: type(128), code(0)
Echo reply: type(129), code(0)
type and code provided by application will be ignored
This patch also fixes these issues in ICMP definer.
1. Parsing inner ICMP item gets and overwrites the outer IP_PROTOCOL
function, which will remove the outer L4 match incorrectly. Fix this
by getting correct inner function.
2. Member order of mlx5_ifc_header_icmp_bits doesn't follow ICMP format.
Reorder them to make it more consistent.
Signed-off-by: Leo Xu <yongquanx@nvidia.com>
Signed-off-by: Shun Hao <shunh@nvidia.com>
---
drivers/net/mlx5/steering/mlx5dr_definer.c | 110 ++++++++++++++++++---
drivers/net/mlx5/steering/mlx5dr_definer.h | 6 +-
2 files changed, 102 insertions(+), 14 deletions(-)
diff --git a/drivers/net/mlx5/steering/mlx5dr_definer.c b/drivers/net/mlx5/steering/mlx5dr_definer.c
index 9bb0f3b117..96da706ee2 100644
--- a/drivers/net/mlx5/steering/mlx5dr_definer.c
+++ b/drivers/net/mlx5/steering/mlx5dr_definer.c
@@ -316,9 +316,9 @@ mlx5dr_definer_icmp_dw1_set(struct mlx5dr_definer_fc *fc,
icmp_dw1 = (v->hdr.icmp_type << __mlx5_dw_bit_off(header_icmp, type)) |
(v->hdr.icmp_code << __mlx5_dw_bit_off(header_icmp, code)) |
- (v->hdr.icmp_cksum << __mlx5_dw_bit_off(header_icmp, cksum));
+ (rte_be_to_cpu_16(v->hdr.icmp_cksum) << __mlx5_dw_bit_off(header_icmp, cksum));
- DR_SET_BE32(tag, icmp_dw1, fc->byte_off, fc->bit_off, fc->bit_mask);
+ DR_SET(tag, icmp_dw1, fc->byte_off, fc->bit_off, fc->bit_mask);
}
static void
@@ -329,10 +329,10 @@ mlx5dr_definer_icmp_dw2_set(struct mlx5dr_definer_fc *fc,
const struct rte_flow_item_icmp *v = item_spec;
rte_be32_t icmp_dw2;
- icmp_dw2 = (v->hdr.icmp_ident << __mlx5_dw_bit_off(header_icmp, ident)) |
- (v->hdr.icmp_seq_nb << __mlx5_dw_bit_off(header_icmp, seq_nb));
+ icmp_dw2 = (rte_be_to_cpu_16(v->hdr.icmp_ident) << __mlx5_dw_bit_off(header_icmp, ident)) |
+ (rte_be_to_cpu_16(v->hdr.icmp_seq_nb) << __mlx5_dw_bit_off(header_icmp, seq_nb));
- DR_SET_BE32(tag, icmp_dw2, fc->byte_off, fc->bit_off, fc->bit_mask);
+ DR_SET(tag, icmp_dw2, fc->byte_off, fc->bit_off, fc->bit_mask);
}
static void
@@ -345,9 +345,50 @@ mlx5dr_definer_icmp6_dw1_set(struct mlx5dr_definer_fc *fc,
icmp_dw1 = (v->type << __mlx5_dw_bit_off(header_icmp, type)) |
(v->code << __mlx5_dw_bit_off(header_icmp, code)) |
- (v->checksum << __mlx5_dw_bit_off(header_icmp, cksum));
+ (rte_be_to_cpu_16(v->checksum) << __mlx5_dw_bit_off(header_icmp, cksum));
- DR_SET_BE32(tag, icmp_dw1, fc->byte_off, fc->bit_off, fc->bit_mask);
+ DR_SET(tag, icmp_dw1, fc->byte_off, fc->bit_off, fc->bit_mask);
+}
+
+static void
+mlx5dr_definer_icmp6_echo_dw1_mask_set(struct mlx5dr_definer_fc *fc,
+ __rte_unused const void *item_spec,
+ uint8_t *tag)
+{
+ const struct rte_flow_item_icmp6 spec = {0xFF, 0xFF, 0x0};
+ mlx5dr_definer_icmp6_dw1_set(fc, &spec, tag);
+}
+
+static void
+mlx5dr_definer_icmp6_echo_request_dw1_set(struct mlx5dr_definer_fc *fc,
+ __rte_unused const void *item_spec,
+ uint8_t *tag)
+{
+ const struct rte_flow_item_icmp6 spec = {RTE_ICMP6_ECHO_REQUEST, 0, 0};
+ mlx5dr_definer_icmp6_dw1_set(fc, &spec, tag);
+}
+
+static void
+mlx5dr_definer_icmp6_echo_reply_dw1_set(struct mlx5dr_definer_fc *fc,
+ __rte_unused const void *item_spec,
+ uint8_t *tag)
+{
+ const struct rte_flow_item_icmp6 spec = {RTE_ICMP6_ECHO_REPLY, 0, 0};
+ mlx5dr_definer_icmp6_dw1_set(fc, &spec, tag);
+}
+
+static void
+mlx5dr_definer_icmp6_echo_dw2_set(struct mlx5dr_definer_fc *fc,
+ const void *item_spec,
+ uint8_t *tag)
+{
+ const struct rte_flow_item_icmp6_echo *v = item_spec;
+ rte_be32_t dw2;
+
+ dw2 = (rte_be_to_cpu_16(v->echo.identifier) << __mlx5_dw_bit_off(header_icmp, ident)) |
+ (rte_be_to_cpu_16(v->echo.sequence) << __mlx5_dw_bit_off(header_icmp, seq_nb));
+
+ DR_SET(tag, dw2, fc->byte_off, fc->bit_off, fc->bit_mask);
}
static void
@@ -1419,9 +1460,9 @@ mlx5dr_definer_conv_item_icmp(struct mlx5dr_definer_conv_data *cd,
struct mlx5dr_definer_fc *fc;
bool inner = cd->tunnel;
- /* Overwrite match on outer L4 type ICMP */
+ /* Overwrite match on L4 type ICMP */
if (!cd->relaxed) {
- fc = &cd->fc[MLX5DR_DEFINER_FNAME_IP_PROTOCOL_O];
+ fc = &cd->fc[DR_CALC_FNAME(IP_PROTOCOL, inner)];
fc->item_idx = item_idx;
fc->tag_set = &mlx5dr_definer_icmp_protocol_set;
fc->tag_mask_set = &mlx5dr_definer_ones_set;
@@ -1457,9 +1498,9 @@ mlx5dr_definer_conv_item_icmp6(struct mlx5dr_definer_conv_data *cd,
struct mlx5dr_definer_fc *fc;
bool inner = cd->tunnel;
- /* Overwrite match on outer L4 type ICMP6 */
+ /* Overwrite match on L4 type ICMP6 */
if (!cd->relaxed) {
- fc = &cd->fc[MLX5DR_DEFINER_FNAME_IP_PROTOCOL_O];
+ fc = &cd->fc[DR_CALC_FNAME(IP_PROTOCOL, inner)];
fc->item_idx = item_idx;
fc->tag_set = &mlx5dr_definer_icmp_protocol_set;
fc->tag_mask_set = &mlx5dr_definer_ones_set;
@@ -1479,6 +1520,48 @@ mlx5dr_definer_conv_item_icmp6(struct mlx5dr_definer_conv_data *cd,
return 0;
}
+static int
+mlx5dr_definer_conv_item_icmp6_echo(struct mlx5dr_definer_conv_data *cd,
+ struct rte_flow_item *item,
+ int item_idx)
+{
+ const struct rte_flow_item_icmp6_echo *m = item->mask;
+ struct mlx5dr_definer_fc *fc;
+ bool inner = cd->tunnel;
+
+ if (!cd->relaxed) {
+ /* Overwrite match on L4 type ICMP6 */
+ fc = &cd->fc[DR_CALC_FNAME(IP_PROTOCOL, inner)];
+ fc->item_idx = item_idx;
+ fc->tag_set = &mlx5dr_definer_icmp_protocol_set;
+ fc->tag_mask_set = &mlx5dr_definer_ones_set;
+ DR_CALC_SET(fc, eth_l2, l4_type, inner);
+
+ /* Set fixed type and code for icmp6 echo request/reply */
+ fc = &cd->fc[MLX5DR_DEFINER_FNAME_ICMP_DW1];
+ fc->item_idx = item_idx;
+ fc->tag_mask_set = &mlx5dr_definer_icmp6_echo_dw1_mask_set;
+ if (item->type == RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST)
+ fc->tag_set = &mlx5dr_definer_icmp6_echo_request_dw1_set;
+ else /* RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY */
+ fc->tag_set = &mlx5dr_definer_icmp6_echo_reply_dw1_set;
+ DR_CALC_SET_HDR(fc, tcp_icmp, icmp_dw1);
+ }
+
+ if (!m)
+ return 0;
+
+ /* Set identifier & sequence into icmp_dw2 */
+ if (m->echo.identifier || m->echo.sequence) {
+ fc = &cd->fc[MLX5DR_DEFINER_FNAME_ICMP_DW2];
+ fc->item_idx = item_idx;
+ fc->tag_set = &mlx5dr_definer_icmp6_echo_dw2_set;
+ DR_CALC_SET_HDR(fc, tcp_icmp, icmp_dw2);
+ }
+
+ return 0;
+}
+
static int
mlx5dr_definer_conv_item_meter_color(struct mlx5dr_definer_conv_data *cd,
struct rte_flow_item *item,
@@ -1615,6 +1698,11 @@ mlx5dr_definer_conv_items_to_hl(struct mlx5dr_context *ctx,
ret = mlx5dr_definer_conv_item_icmp6(&cd, items, i);
item_flags |= MLX5_FLOW_LAYER_ICMP6;
break;
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST:
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY:
+ ret = mlx5dr_definer_conv_item_icmp6_echo(&cd, items, i);
+ item_flags |= MLX5_FLOW_LAYER_ICMP6;
+ break;
case RTE_FLOW_ITEM_TYPE_METER_COLOR:
ret = mlx5dr_definer_conv_item_meter_color(&cd, items, i);
item_flags |= MLX5_FLOW_ITEM_METER_COLOR;
diff --git a/drivers/net/mlx5/steering/mlx5dr_definer.h b/drivers/net/mlx5/steering/mlx5dr_definer.h
index 9bf4bb3c13..b826b4468e 100644
--- a/drivers/net/mlx5/steering/mlx5dr_definer.h
+++ b/drivers/net/mlx5/steering/mlx5dr_definer.h
@@ -536,16 +536,16 @@ struct mlx5_ifc_header_icmp_bits {
union {
u8 icmp_dw1[0x20];
struct {
- u8 cksum[0x10];
- u8 code[0x8];
u8 type[0x8];
+ u8 code[0x8];
+ u8 cksum[0x10];
};
};
union {
u8 icmp_dw2[0x20];
struct {
- u8 seq_nb[0x10];
u8 ident[0x10];
+ u8 seq_nb[0x10];
};
};
};
--
2.27.0
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v2 0/3] support match icmpv6 ID and sequence
2022-12-12 8:59 [PATCH 0/3] support match icmpv6 id and sequence Leo Xu
` (2 preceding siblings ...)
2022-12-12 8:59 ` [PATCH 3/3] net/mlx5/hws: " Leo Xu
@ 2022-12-20 7:44 ` Leo Xu
2022-12-20 7:44 ` [PATCH v2 1/3] ethdev: add ICMPv6 " Leo Xu
` (4 more replies)
3 siblings, 5 replies; 31+ messages in thread
From: Leo Xu @ 2022-12-20 7:44 UTC (permalink / raw)
To: dev
Currently, rte_flow API does not support matching
ID and sequence fields of icmp6 echo packets.
This patchset is used to support match icmpv6 ID and
sequence in rte_flow. It adds needed API in rte_flow,
and gives corresponding implementation for mlx5 pmd.
Leo Xu (3):
ethdev: add ICMPv6 ID and sequence
net/mlx5: add ICMPv6 ID and sequence match support
net/mlx5/hws: add ICMPv6 ID and sequence match support
---
v2:
* rebase 23.03
app/test-pmd/cmdline_flow.c | 70 ++++++++++++++++
doc/guides/nics/mlx5.rst | 2 +-
doc/guides/prog_guide/rte_flow.rst | 14 ++++
doc/guides/rel_notes/release_23_03.rst | 10 +++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 +++
drivers/net/mlx5/hws/mlx5dr_definer.c | 88 +++++++++++++++++++++
drivers/net/mlx5/mlx5_flow.c | 61 ++++++++++++++
drivers/net/mlx5/mlx5_flow.h | 4 +
drivers/net/mlx5/mlx5_flow_dv.c | 76 ++++++++++++++++++
drivers/net/mlx5/mlx5_flow_hw.c | 2 +
lib/ethdev/rte_flow.c | 4 +
lib/ethdev/rte_flow.h | 25 ++++++
lib/net/meson.build | 1 +
lib/net/rte_icmp6.h | 48 +++++++++++
14 files changed, 414 insertions(+), 1 deletion(-)
create mode 100644 lib/net/rte_icmp6.h
--
2.27.0
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v2 1/3] ethdev: add ICMPv6 ID and sequence
2022-12-20 7:44 ` [PATCH v2 0/3] support match icmpv6 ID and sequence Leo Xu
@ 2022-12-20 7:44 ` Leo Xu
2023-01-03 8:17 ` Ori Kam
` (2 more replies)
2022-12-20 7:44 ` [PATCH v2 2/3] net/mlx5: add ICMPv6 ID and sequence match support Leo Xu
` (3 subsequent siblings)
4 siblings, 3 replies; 31+ messages in thread
From: Leo Xu @ 2022-12-20 7:44 UTC (permalink / raw)
To: dev
Cc: Bing Zhao, Ori Kam, Aman Singh, Yuying Zhang, Thomas Monjalon,
Ferruh Yigit, Andrew Rybchenko, Olivier Matz
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/rel_notes/release_23_03.rst | 4 ++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 +++
lib/ethdev/rte_flow.c | 4 ++
lib/ethdev/rte_flow.h | 25 ++++++++
lib/net/meson.build | 1 +
lib/net/rte_icmp6.h | 48 ++++++++++++++
8 files changed, 176 insertions(+)
create mode 100644 lib/net/rte_icmp6.h
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 88108498e0..7dc1528899 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -360,6 +360,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,
@@ -1327,6 +1333,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,
@@ -1575,6 +1583,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,
@@ -4323,6 +4345,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(COMMON_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(COMMON_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(COMMON_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(COMMON_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 3e6242803d..59932e82a6 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1165,6 +1165,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/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst
index b8c5b68d6c..5af9c43dd9 100644
--- a/doc/guides/rel_notes/release_23_03.rst
+++ b/doc/guides/rel_notes/release_23_03.rst
@@ -55,6 +55,10 @@ New Features
Also, make sure to start the actual text at the margin.
=======================================================
+* **Added rte_flow support for matching ICMPv6 ID and sequence fields.**
+
+ Added ``icmp6_echo`` item in rte_flow to support ID and sequence
+ matching in ICMPv6 echo request/reply packets.
Removed Items
-------------
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 0037506a79..f497bba26d 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3622,6 +3622,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/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 7d0c24366c..39cd4f9817 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -123,6 +123,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/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index b60987db4b..72695aca8a 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/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>
@@ -624,6 +625,20 @@ enum rte_flow_item_type {
* See struct rte_flow_item_meter_color.
*/
RTE_FLOW_ITEM_TYPE_METER_COLOR,
+
+ /**
+ * 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,
};
/**
@@ -1303,6 +1318,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/net/meson.build b/lib/net/meson.build
index 379d161ee0..ce3ca67bdc 100644
--- a/lib/net/meson.build
+++ b/lib/net/meson.build
@@ -22,6 +22,7 @@ headers = files(
'rte_geneve.h',
'rte_l2tpv2.h',
'rte_ppp.h',
+ 'rte_icmp6.h',
)
sources = files(
diff --git a/lib/net/rte_icmp6.h b/lib/net/rte_icmp6.h
new file mode 100644
index 0000000000..bf6956d7c9
--- /dev/null
+++ b/lib/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
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH v2 1/3] ethdev: add ICMPv6 ID and sequence
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-26 10:45 ` Ferruh Yigit
2 siblings, 0 replies; 31+ messages in thread
From: Ori Kam @ 2023-01-03 8:17 UTC (permalink / raw)
To: Leo Xu (Networking SW), dev
Cc: Bing Zhao, Aman Singh, Yuying Zhang,
NBU-Contact-Thomas Monjalon (EXTERNAL),
Ferruh Yigit, Andrew Rybchenko, Olivier Matz
Hi Leo,
> -----Original Message-----
> From: Leo Xu (Networking SW) <yongquanx@nvidia.com>
> Sent: Tuesday, 20 December 2022 9:44
>
> 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>
> ---
Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v2 1/3] ethdev: add ICMPv6 ID and sequence
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-01-26 10:45 ` Ferruh Yigit
2 siblings, 1 reply; 31+ messages in thread
From: Thomas Monjalon @ 2023-01-18 9:30 UTC (permalink / raw)
To: Leo Xu
Cc: dev, Bing Zhao, Ori Kam, Aman Singh, Yuying Zhang, Ferruh Yigit,
Andrew Rybchenko, Olivier Matz, david.marchand
20/12/2022 08:44, Leo Xu:
> +* **Added rte_flow support for matching ICMPv6 ID and sequence fields.**
> +
> + Added ``icmp6_echo`` item in rte_flow to support ID and sequence
> + matching in ICMPv6 echo request/reply packets.
Easier to read:
"
Added flow items to match ICMPv6 echo request and reply packets.
Matching patterns can include ICMP identifier and sequence numbers.
"
> + /**
> + * 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,
It is better to use @see doxygen syntax.
> +/**
> + * 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;
> +};
Other items are defined with "hdr" as first field
(instead of the name "echo" here).
> --- a/lib/net/meson.build
> +++ b/lib/net/meson.build
> @@ -22,6 +22,7 @@ headers = files(
> 'rte_geneve.h',
> 'rte_l2tpv2.h',
> 'rte_ppp.h',
> + 'rte_icmp6.h',
> )
Please insert it after rte_icmp.h.
> +#ifndef _RTE_ICMP6_H_
> +#define _RTE_ICMP6_H_
No need of underscores at the beginning and end, it is not reserved.
[...]
> +/**
> + * 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;
It is exactly the same as struct rte_icmp_hdr.
Why not reuse it?
Maybe introduce struct rte_icmp_base_hdr
and define rte_icmp_echo_hdr as rte_icmp_hdr?
> +/* ICMP6 packet types */
> +#define RTE_ICMP6_ECHO_REQUEST 128
> +#define RTE_ICMP6_ECHO_REPLY 129
Can we avoid adding this file and add only these defines to rte_icmp.h?
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH v2 1/3] ethdev: add ICMPv6 ID and sequence
2023-01-18 9:30 ` Thomas Monjalon
@ 2023-01-31 6:53 ` Leo Xu (Networking SW)
2023-02-01 9:56 ` Thomas Monjalon
0 siblings, 1 reply; 31+ messages in thread
From: Leo Xu (Networking SW) @ 2023-01-31 6:53 UTC (permalink / raw)
To: NBU-Contact-Thomas Monjalon (EXTERNAL)
Cc: dev, Bing Zhao, Ori Kam, Aman Singh, Yuying Zhang, Ferruh Yigit,
Andrew Rybchenko, Olivier Matz, david.marchand
Hi Thomas,
Thanks for those comments.
PSB
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, January 18, 2023 5:31 PM
> To: Leo Xu (Networking SW) <yongquanx@nvidia.com>
> Cc: dev@dpdk.org; Bing Zhao <bingz@nvidia.com>; Ori Kam
> <orika@nvidia.com>; Aman Singh <aman.deep.singh@intel.com>; Yuying
> Zhang <yuying.zhang@intel.com>; Ferruh Yigit <ferruh.yigit@amd.com>;
> Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>; Olivier Matz
> <olivier.matz@6wind.com>; david.marchand@redhat.com
> Subject: Re: [PATCH v2 1/3] ethdev: add ICMPv6 ID and sequence
>
> External email: Use caution opening links or attachments
>
>
> 20/12/2022 08:44, Leo Xu:
> > +* **Added rte_flow support for matching ICMPv6 ID and sequence
> > +fields.**
> > +
> > + Added ``icmp6_echo`` item in rte_flow to support ID and sequence
> > + matching in ICMPv6 echo request/reply packets.
>
> Easier to read:
> "
> Added flow items to match ICMPv6 echo request and reply packets.
> Matching patterns can include ICMP identifier and sequence numbers.
> "
Thanks for that good sentence, will update accordingly.
>
> > + /**
> > + * 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,
>
> It is better to use @see doxygen syntax.
Ok, thanks.
>
> > +/**
> > + * 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;
> > +};
>
> Other items are defined with "hdr" as first field (instead of the name "echo"
> here).
>
> > --- a/lib/net/meson.build
> > +++ b/lib/net/meson.build
> > @@ -22,6 +22,7 @@ headers = files(
> > 'rte_geneve.h',
> > 'rte_l2tpv2.h',
> > 'rte_ppp.h',
> > + 'rte_icmp6.h',
> > )
>
> Please insert it after rte_icmp.h.
Will merge the rte_icmp6.h into rte_icmp.h, then no rte_icmp6.h any more.
>
> > +#ifndef _RTE_ICMP6_H_
> > +#define _RTE_ICMP6_H_
>
> No need of underscores at the beginning and end, it is not reserved.
>
Will merge the rte_icmp6.h into rte_icmp.h, then no rte_icmp6.h any more.
> [...]
> > +/**
> > + * 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;
>
> It is exactly the same as struct rte_icmp_hdr.
> Why not reuse it?
> Maybe introduce struct rte_icmp_base_hdr and define rte_icmp_echo_hdr as
> rte_icmp_hdr?
Hi Thomas,
Looks like, using rte_icmp_hdr as base header for both icmp and icmpv6 is not that good.
since, rte_icmp_hdr default their headers always having id and sequence fields, which is not applicable for most other icmp6/icmp types packets.
I may suggest to keep icmp and icmp6 structures independent against each other, because, looks like these two protocols definitions do not share common base.
>
> > +/* ICMP6 packet types */
> > +#define RTE_ICMP6_ECHO_REQUEST 128
> > +#define RTE_ICMP6_ECHO_REPLY 129
>
> Can we avoid adding this file and add only these defines to rte_icmp.h?
>
Yes, good idea. rte_ip.h does not have independent v6 header file either.
We should not create v6 header file for icmp.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v2 1/3] ethdev: add ICMPv6 ID and sequence
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)
0 siblings, 1 reply; 31+ messages in thread
From: Thomas Monjalon @ 2023-02-01 9:56 UTC (permalink / raw)
To: Leo Xu (Networking SW)
Cc: dev, Bing Zhao, Ori Kam, Aman Singh, Yuying Zhang, Ferruh Yigit,
Andrew Rybchenko, Olivier Matz, david.marchand
31/01/2023 07:53, Leo Xu (Networking SW):
> From: Thomas Monjalon <thomas@monjalon.net>
> > 20/12/2022 08:44, Leo Xu:
> > > +/**
> > > + * 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;
> >
> > It is exactly the same as struct rte_icmp_hdr.
> > Why not reuse it?
> > Maybe introduce struct rte_icmp_base_hdr and define rte_icmp_echo_hdr as
> > rte_icmp_hdr?
>
> Hi Thomas,
> Looks like, using rte_icmp_hdr as base header for both icmp and icmpv6 is not that good.
> since, rte_icmp_hdr default their headers always having id and sequence fields, which is not applicable for most other icmp6/icmp types packets.
>
> I may suggest to keep icmp and icmp6 structures independent against each other, because, looks like these two protocols definitions do not share common base.
What about introducing rte_icmp_base_hdr?
We should try to avoid duplicating things.
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH v2 1/3] ethdev: add ICMPv6 ID and sequence
2023-02-01 9:56 ` Thomas Monjalon
@ 2023-02-02 18:33 ` Leo Xu (Networking SW)
2023-02-02 21:23 ` Thomas Monjalon
0 siblings, 1 reply; 31+ messages in thread
From: Leo Xu (Networking SW) @ 2023-02-02 18:33 UTC (permalink / raw)
To: NBU-Contact-Thomas Monjalon (EXTERNAL)
Cc: dev, Bing Zhao, Ori Kam, Aman Singh, Yuying Zhang, Ferruh Yigit,
Andrew Rybchenko, Olivier Matz, david.marchand
Hi Thomas
PSB
> 31/01/2023 07:53, Leo Xu (Networking SW):
> > From: Thomas Monjalon <thomas@monjalon.net>
> > > 20/12/2022 08:44, Leo Xu:
> > > > +/**
> > > > + * 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;
> > >
> > > It is exactly the same as struct rte_icmp_hdr.
> > > Why not reuse it?
> > > Maybe introduce struct rte_icmp_base_hdr and define
> > > rte_icmp_echo_hdr as rte_icmp_hdr?
> >
> > Hi Thomas,
> > Looks like, using rte_icmp_hdr as base header for both icmp and icmpv6 is
> not that good.
> > since, rte_icmp_hdr default their headers always having id and sequence
> fields, which is not applicable for most other icmp6/icmp types packets.
> >
> > I may suggest to keep icmp and icmp6 structures independent against each
> other, because, looks like these two protocols definitions do not share common
> base.
>
> What about introducing rte_icmp_base_hdr?
> We should try to avoid duplicating things.
>
You mean introduce rte_icmp_base_hdr like following?
struct rte_icmp_base_hdr {
uint8_t icmp_type;
uint8_t icmp_code;
rte_be16_t icmp_cksum;
} __rte_packed;
And change the existing rte_icmp_hdr to be:
struct rte_icmp_hdr {
rte_icmp_base_hdr bash_hdr;
rte_be16_t icmp_ident;
rte_be16_t icmp_seq_nb;
} __rte_packed;
#define rte_icmp6_echo struct rte_icmp_hdr;
If it is, there will be some compatibilities issues, since we changed existing structure.
Or, maybe I'm missing something.
Would you help to give more details about above comment?
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v2 1/3] ethdev: add ICMPv6 ID and sequence
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)
0 siblings, 1 reply; 31+ messages in thread
From: Thomas Monjalon @ 2023-02-02 21:23 UTC (permalink / raw)
To: Leo Xu (Networking SW)
Cc: dev, Bing Zhao, Ori Kam, Aman Singh, Yuying Zhang, Ferruh Yigit,
Andrew Rybchenko, Olivier Matz, david.marchand
02/02/2023 19:33, Leo Xu (Networking SW):
> > 31/01/2023 07:53, Leo Xu (Networking SW):
> > > From: Thomas Monjalon <thomas@monjalon.net>
> > > > 20/12/2022 08:44, Leo Xu:
> > > > > +/**
> > > > > + * 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;
> > > >
> > > > It is exactly the same as struct rte_icmp_hdr.
> > > > Why not reuse it?
> > > > Maybe introduce struct rte_icmp_base_hdr and define
> > > > rte_icmp_echo_hdr as rte_icmp_hdr?
> > >
> > > Hi Thomas,
> > > Looks like, using rte_icmp_hdr as base header for both icmp and icmpv6 is
> > not that good.
> > > since, rte_icmp_hdr default their headers always having id and sequence
> > fields, which is not applicable for most other icmp6/icmp types packets.
> > >
> > > I may suggest to keep icmp and icmp6 structures independent against each
> > other, because, looks like these two protocols definitions do not share common
> > base.
> >
> > What about introducing rte_icmp_base_hdr?
> > We should try to avoid duplicating things.
> >
>
> You mean introduce rte_icmp_base_hdr like following?
> struct rte_icmp_base_hdr {
> uint8_t icmp_type;
> uint8_t icmp_code;
> rte_be16_t icmp_cksum;
> } __rte_packed;
>
> And change the existing rte_icmp_hdr to be:
> struct rte_icmp_hdr {
> rte_icmp_base_hdr bash_hdr;
> rte_be16_t icmp_ident;
> rte_be16_t icmp_seq_nb;
> } __rte_packed;
> #define rte_icmp6_echo struct rte_icmp_hdr;
>
> If it is, there will be some compatibilities issues, since we changed existing structure.
>
> Or, maybe I'm missing something.
> Would you help to give more details about above comment?
Currently we have this:
struct rte_icmp_hdr {
uint8_t icmp_type; /* ICMP packet type. */
uint8_t icmp_code; /* ICMP packet code. */
rte_be16_t icmp_cksum; /* ICMP packet checksum. */
rte_be16_t icmp_ident; /* ICMP packet identifier. */
rte_be16_t icmp_seq_nb; /* ICMP packet sequence number. */
} __rte_packed;
I agree we can move some fields in a base struct,
it would change the API.
We could manage with a union, but we would lose the benefit.
It looks like we need to keep rte_icmp_hdr as is.
So we need to duplicate and define new structs.
What about removing the "6" from the new structs,
so it would apply both to IPv4 and IPv6?
struct rte_icmp_base_hdr {
uint8_t type;
uint8_t code;
rte_be16_t checksum;
} __rte_packed;
struct rte_icmp_echo_hdr {
struct rte_icmp_base_hdr base;
rte_be16_t identifier;
rte_be16_t sequence;
} __rte_packed;
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH v2 1/3] ethdev: add ICMPv6 ID and sequence
2023-02-02 21:23 ` Thomas Monjalon
@ 2023-02-03 2:56 ` Leo Xu (Networking SW)
0 siblings, 0 replies; 31+ messages in thread
From: Leo Xu (Networking SW) @ 2023-02-03 2:56 UTC (permalink / raw)
To: NBU-Contact-Thomas Monjalon (EXTERNAL)
Cc: dev, Bing Zhao, Ori Kam, Aman Singh, Yuying Zhang, Ferruh Yigit,
Andrew Rybchenko, Olivier Matz, david.marchand
> 02/02/2023 19:33, Leo Xu (Networking SW):
> > > 31/01/2023 07:53, Leo Xu (Networking SW):
> > > > From: Thomas Monjalon <thomas@monjalon.net>
> > > > > 20/12/2022 08:44, Leo Xu:
> > > > > > +/**
> > > > > > + * 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;
> > > > >
> > > > > It is exactly the same as struct rte_icmp_hdr.
> > > > > Why not reuse it?
> > > > > Maybe introduce struct rte_icmp_base_hdr and define
> > > > > rte_icmp_echo_hdr as rte_icmp_hdr?
> > > >
> > > > Hi Thomas,
> > > > Looks like, using rte_icmp_hdr as base header for both icmp and
> > > > icmpv6 is
> > > not that good.
> > > > since, rte_icmp_hdr default their headers always having id and
> > > > sequence
> > > fields, which is not applicable for most other icmp6/icmp types packets.
> > > >
> > > > I may suggest to keep icmp and icmp6 structures independent
> > > > against each
> > > other, because, looks like these two protocols definitions do not
> > > share common base.
> > >
> > > What about introducing rte_icmp_base_hdr?
> > > We should try to avoid duplicating things.
> > >
> >
> > You mean introduce rte_icmp_base_hdr like following?
> > struct rte_icmp_base_hdr {
> > uint8_t icmp_type;
> > uint8_t icmp_code;
> > rte_be16_t icmp_cksum;
> > } __rte_packed;
> >
> > And change the existing rte_icmp_hdr to be:
> > struct rte_icmp_hdr {
> > rte_icmp_base_hdr bash_hdr;
> > rte_be16_t icmp_ident;
> > rte_be16_t icmp_seq_nb;
> > } __rte_packed;
> > #define rte_icmp6_echo struct rte_icmp_hdr;
> >
> > If it is, there will be some compatibilities issues, since we changed existing
> structure.
> >
> > Or, maybe I'm missing something.
> > Would you help to give more details about above comment?
>
> Currently we have this:
> struct rte_icmp_hdr {
> uint8_t icmp_type; /* ICMP packet type. */
> uint8_t icmp_code; /* ICMP packet code. */
> rte_be16_t icmp_cksum; /* ICMP packet checksum. */
> rte_be16_t icmp_ident; /* ICMP packet identifier. */
> rte_be16_t icmp_seq_nb; /* ICMP packet sequence number. */ }
> __rte_packed;
>
> I agree we can move some fields in a base struct, it would change the API.
> We could manage with a union, but we would lose the benefit.
> It looks like we need to keep rte_icmp_hdr as is.
> So we need to duplicate and define new structs.
>
> What about removing the "6" from the new structs, so it would apply both to
> IPv4 and IPv6?
>
> struct rte_icmp_base_hdr {
> uint8_t type;
> uint8_t code;
> rte_be16_t checksum;
> } __rte_packed;
>
> struct rte_icmp_echo_hdr {
> struct rte_icmp_base_hdr base;
> rte_be16_t identifier;
> rte_be16_t sequence;
> } __rte_packed;
>
>
I agree with that proposal.
Then, we can deem existing struct rte_icmp_hdr as old one, which should not be used in new app.
And looks like, these new defined structures can cover all ICMP4/6 formats.
Good idea!
I will update accordingly, in next patch.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v2 1/3] ethdev: add ICMPv6 ID and sequence
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-26 10:45 ` Ferruh Yigit
2023-01-31 3:58 ` Leo Xu (Networking SW)
2 siblings, 1 reply; 31+ messages in thread
From: Ferruh Yigit @ 2023-01-26 10:45 UTC (permalink / raw)
To: Leo Xu, dev
Cc: Bing Zhao, Ori Kam, Aman Singh, Yuying Zhang, Thomas Monjalon,
Andrew Rybchenko, Olivier Matz
On 12/20/2022 7:44 AM, Leo Xu wrote:
> 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/rel_notes/release_23_03.rst | 4 ++
> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 +++
> lib/ethdev/rte_flow.c | 4 ++
> lib/ethdev/rte_flow.h | 25 ++++++++
> lib/net/meson.build | 1 +
> lib/net/rte_icmp6.h | 48 ++++++++++++++
> 8 files changed, 176 insertions(+)
> create mode 100644 lib/net/rte_icmp6.h
Please update .mailmap with in this patch.
>
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 88108498e0..7dc1528899 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -360,6 +360,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,
> @@ -1327,6 +1333,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,
> @@ -1575,6 +1583,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,
> @@ -4323,6 +4345,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(COMMON_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(COMMON_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(COMMON_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(COMMON_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 3e6242803d..59932e82a6 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -1165,6 +1165,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/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst
> index b8c5b68d6c..5af9c43dd9 100644
> --- a/doc/guides/rel_notes/release_23_03.rst
> +++ b/doc/guides/rel_notes/release_23_03.rst
> @@ -55,6 +55,10 @@ New Features
> Also, make sure to start the actual text at the margin.
> =======================================================
>
> +* **Added rte_flow support for matching ICMPv6 ID and sequence fields.**
> +
> + Added ``icmp6_echo`` item in rte_flow to support ID and sequence
> + matching in ICMPv6 echo request/reply packets.
>
Should keep two empty lines before next section.
> Removed Items
> -------------
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index 0037506a79..f497bba26d 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -3622,6 +3622,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/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
> index 7d0c24366c..39cd4f9817 100644
> --- a/lib/ethdev/rte_flow.c
> +++ b/lib/ethdev/rte_flow.c
> @@ -123,6 +123,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)),
Syntax, please merge lines, to make it more readable.
> 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/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
> index b60987db4b..72695aca8a 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/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>
> @@ -624,6 +625,20 @@ enum rte_flow_item_type {
> * See struct rte_flow_item_meter_color.
> */
> RTE_FLOW_ITEM_TYPE_METER_COLOR,
> +
> + /**
> + * 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,
> };
>
> /**
> @@ -1303,6 +1318,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/net/meson.build b/lib/net/meson.build
> index 379d161ee0..ce3ca67bdc 100644
> --- a/lib/net/meson.build
> +++ b/lib/net/meson.build
> @@ -22,6 +22,7 @@ headers = files(
> 'rte_geneve.h',
> 'rte_l2tpv2.h',
> 'rte_ppp.h',
> + 'rte_icmp6.h',
Can you please move just below rte_icmp.h to group them.
> )
>
> sources = files(
> diff --git a/lib/net/rte_icmp6.h b/lib/net/rte_icmp6.h
> new file mode 100644
> index 0000000000..bf6956d7c9
> --- /dev/null
> +++ b/lib/net/rte_icmp6.h
> @@ -0,0 +1,48 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (c) 2022 NVIDIA Corporation & Affiliates
2023?
> + */
> +
> +#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_ */
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH v2 1/3] ethdev: add ICMPv6 ID and sequence
2023-01-26 10:45 ` Ferruh Yigit
@ 2023-01-31 3:58 ` Leo Xu (Networking SW)
0 siblings, 0 replies; 31+ messages in thread
From: Leo Xu (Networking SW) @ 2023-01-31 3:58 UTC (permalink / raw)
To: Ferruh Yigit, dev
Cc: Bing Zhao, Ori Kam, Aman Singh, Yuying Zhang,
NBU-Contact-Thomas Monjalon (EXTERNAL),
Andrew Rybchenko, Olivier Matz
Hi,
PSB
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@amd.com>
> Sent: Thursday, January 26, 2023 6:45 PM
> To: Leo Xu (Networking SW) <yongquanx@nvidia.com>; dev@dpdk.org
> Cc: Bing Zhao <bingz@nvidia.com>; Ori Kam <orika@nvidia.com>; Aman Singh
> <aman.deep.singh@intel.com>; Yuying Zhang <yuying.zhang@intel.com>;
> NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>; Andrew
> Rybchenko <andrew.rybchenko@oktetlabs.ru>; Olivier Matz
> <olivier.matz@6wind.com>
> Subject: Re: [PATCH v2 1/3] ethdev: add ICMPv6 ID and sequence
>
> External email: Use caution opening links or attachments
>
>
> On 12/20/2022 7:44 AM, Leo Xu wrote:
> > 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/rel_notes/release_23_03.rst | 4 ++
> > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 +++
> > lib/ethdev/rte_flow.c | 4 ++
> > lib/ethdev/rte_flow.h | 25 ++++++++
> > lib/net/meson.build | 1 +
> > lib/net/rte_icmp6.h | 48 ++++++++++++++
> > 8 files changed, 176 insertions(+)
> > create mode 100644 lib/net/rte_icmp6.h
>
> Please update .mailmap with in this patch.
Thanks, will update it in next patch.
>
> >
> > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> > index 88108498e0..7dc1528899 100644
> > --- a/app/test-pmd/cmdline_flow.c
> > +++ b/app/test-pmd/cmdline_flow.c
> > @@ -360,6 +360,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,
> > @@ -1327,6 +1333,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,
> > @@ -1575,6 +1583,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,
> > @@ -4323,6 +4345,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(COMMON_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(COMMON_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(COMMON_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(COMMON_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 3e6242803d..59932e82a6 100644
> > --- a/doc/guides/prog_guide/rte_flow.rst
> > +++ b/doc/guides/prog_guide/rte_flow.rst
> > @@ -1165,6 +1165,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/rel_notes/release_23_03.rst
> > b/doc/guides/rel_notes/release_23_03.rst
> > index b8c5b68d6c..5af9c43dd9 100644
> > --- a/doc/guides/rel_notes/release_23_03.rst
> > +++ b/doc/guides/rel_notes/release_23_03.rst
> > @@ -55,6 +55,10 @@ New Features
> > Also, make sure to start the actual text at the margin.
> > =======================================================
> >
> > +* **Added rte_flow support for matching ICMPv6 ID and sequence
> > +fields.**
> > +
> > + Added ``icmp6_echo`` item in rte_flow to support ID and sequence
> > + matching in ICMPv6 echo request/reply packets.
> >
>
> Should keep two empty lines before next section.
Thanks for that catch, will fix it.
>
> > Removed Items
> > -------------
> > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > index 0037506a79..f497bba26d 100644
> > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > @@ -3622,6 +3622,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/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index
> > 7d0c24366c..39cd4f9817 100644
> > --- a/lib/ethdev/rte_flow.c
> > +++ b/lib/ethdev/rte_flow.c
> > @@ -123,6 +123,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)),
>
> Syntax, please merge lines, to make it more readable.
Thanks for that catch, will fix it.
>
> > 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/ethdev/rte_flow.h
> > b/lib/ethdev/rte_flow.h index b60987db4b..72695aca8a 100644
> > --- a/lib/ethdev/rte_flow.h
> > +++ b/lib/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>
> > @@ -624,6 +625,20 @@ enum rte_flow_item_type {
> > * See struct rte_flow_item_meter_color.
> > */
> > RTE_FLOW_ITEM_TYPE_METER_COLOR,
> > +
> > + /**
> > + * 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,
> > };
> >
> > /**
> > @@ -1303,6 +1318,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/net/meson.build b/lib/net/meson.build index
> > 379d161ee0..ce3ca67bdc 100644
> > --- a/lib/net/meson.build
> > +++ b/lib/net/meson.build
> > @@ -22,6 +22,7 @@ headers = files(
> > 'rte_geneve.h',
> > 'rte_l2tpv2.h',
> > 'rte_ppp.h',
> > + 'rte_icmp6.h',
>
> Can you please move just below rte_icmp.h to group them.
Thanks, will merge the rte_icmp6.h into rte_icmp.h. Then, there will be no rte_icmp6.h file.
>
> > )
> >
> > sources = files(
> > diff --git a/lib/net/rte_icmp6.h b/lib/net/rte_icmp6.h new file mode
> > 100644 index 0000000000..bf6956d7c9
> > --- /dev/null
> > +++ b/lib/net/rte_icmp6.h
> > @@ -0,0 +1,48 @@
> > +/* SPDX-License-Identifier: BSD-3-Clause
> > + * Copyright (c) 2022 NVIDIA Corporation & Affiliates
>
> 2023?
Thanks, will update it.
>
> > + */
> > +
> > +#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_ */
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v2 2/3] net/mlx5: add ICMPv6 ID and sequence match support
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
@ 2022-12-20 7:44 ` Leo Xu
2023-01-18 8:55 ` Thomas Monjalon
2022-12-20 7:44 ` [PATCH v2 3/3] net/mlx5/hws: " Leo Xu
` (2 subsequent siblings)
4 siblings, 1 reply; 31+ messages in thread
From: Leo Xu @ 2022-12-20 7:44 UTC (permalink / raw)
To: dev; +Cc: Matan Azrad, Viacheslav Ovsiienko
This patch adds ICMPv6 ID and sequence match support.
Since type and code of ICMPv6 echo is already specified by ITEM type:
RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST
RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY
mlx5 pmd will set appropriate type and code automatically:
Echo request: type(128), code(0)
Echo reply: type(129), code(0)
type and code provided by application will be ignored.
Signed-off-by: Leo Xu <yongquanx@nvidia.com>
---
doc/guides/nics/mlx5.rst | 2 +-
doc/guides/rel_notes/release_23_03.rst | 6 ++
drivers/net/mlx5/mlx5_flow.c | 61 +++++++++++++++++++++
drivers/net/mlx5/mlx5_flow.h | 4 ++
drivers/net/mlx5/mlx5_flow_dv.c | 76 ++++++++++++++++++++++++++
drivers/net/mlx5/mlx5_flow_hw.c | 2 +
6 files changed, 150 insertions(+), 1 deletion(-)
diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 51f51259e3..78693d19b0 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -405,7 +405,7 @@ Limitations
- The input buffer, providing the removal size, is not validated.
- The buffer size must match the length of the headers to be removed.
-- ICMP(code/type/identifier/sequence number) / ICMP6(code/type) matching, IP-in-IP and MPLS flow matching are all
+- ICMP(code/type/identifier/sequence number) / ICMP6(code/type/identifier/sequence number) matching, IP-in-IP and MPLS flow matching are all
mutually exclusive features which cannot be supported together
(see :ref:`mlx5_firmware_config`).
diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst
index 5af9c43dd9..011c2489f7 100644
--- a/doc/guides/rel_notes/release_23_03.rst
+++ b/doc/guides/rel_notes/release_23_03.rst
@@ -60,6 +60,12 @@ New Features
Added ``icmp6_echo`` item in rte_flow to support ID and sequence
matching in ICMPv6 echo request/reply packets.
+* **Updated Mellanox mlx5 driver.**
+
+ Updated the Mellanox mlx5 driver with new features and improvements, including:
+
+ * Added support for matching on ICMPv6 ID and sequence fields.
+
Removed Items
-------------
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index a0cf677fb0..8eea78251e 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -2352,6 +2352,67 @@ mlx5_flow_validate_item_icmp6(const struct rte_flow_item *item,
return 0;
}
+/**
+ * Validate ICMP6 echo request/reply item.
+ *
+ * @param[in] item
+ * Item specification.
+ * @param[in] item_flags
+ * Bit-fields that holds the items detected until now.
+ * @param[in] ext_vlan_sup
+ * Whether extended VLAN features are supported or not.
+ * @param[out] error
+ * Pointer to error structure.
+ *
+ * @return
+ * 0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+int
+mlx5_flow_validate_item_icmp6_echo(const struct rte_flow_item *item,
+ uint64_t item_flags,
+ uint8_t target_protocol,
+ struct rte_flow_error *error)
+{
+ const struct rte_flow_item_icmp6_echo *mask = item->mask;
+ const struct rte_flow_item_icmp6_echo nic_mask = {
+ .echo.hdr.type = 0xff,
+ .echo.hdr.code = 0xff,
+ .echo.identifier = RTE_BE16(0xffff),
+ .echo.sequence = RTE_BE16(0xffff),
+ };
+ const int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
+ const uint64_t l3m = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV6 :
+ MLX5_FLOW_LAYER_OUTER_L3_IPV6;
+ const uint64_t l4m = tunnel ? MLX5_FLOW_LAYER_INNER_L4 :
+ MLX5_FLOW_LAYER_OUTER_L4;
+ int ret;
+
+ if (target_protocol != 0xFF && target_protocol != IPPROTO_ICMPV6)
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM, item,
+ "protocol filtering not compatible"
+ " with ICMP6 layer");
+ if (!(item_flags & l3m))
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM, item,
+ "IPv6 is mandatory to filter on"
+ " ICMP6");
+ if (item_flags & l4m)
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM, item,
+ "multiple L4 layers not supported");
+ if (!mask)
+ mask = &nic_mask;
+ ret = mlx5_flow_item_acceptable
+ (item, (const uint8_t *)mask,
+ (const uint8_t *)&nic_mask,
+ sizeof(struct rte_flow_item_icmp6_echo),
+ MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
+ if (ret < 0)
+ return ret;
+ return 0;
+}
+
/**
* Validate ICMP item.
*
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 1f57ecd6e1..9243f58b4c 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -2322,6 +2322,10 @@ int mlx5_flow_validate_item_icmp6(const struct rte_flow_item *item,
uint64_t item_flags,
uint8_t target_protocol,
struct rte_flow_error *error);
+int mlx5_flow_validate_item_icmp6_echo(const struct rte_flow_item *item,
+ uint64_t item_flags,
+ uint8_t target_protocol,
+ struct rte_flow_error *error);
int mlx5_flow_validate_item_nvgre(const struct rte_flow_item *item,
uint64_t item_flags,
uint8_t target_protocol,
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 7ca909999b..62381c6346 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7370,6 +7370,17 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
item_ipv6_proto = IPPROTO_ICMPV6;
last_item = MLX5_FLOW_LAYER_ICMP6;
break;
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST:
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY:
+ ret = mlx5_flow_validate_item_icmp6_echo(items,
+ item_flags,
+ next_protocol,
+ error);
+ if (ret < 0)
+ return ret;
+ item_ipv6_proto = IPPROTO_ICMPV6;
+ last_item = MLX5_FLOW_LAYER_ICMP6;
+ break;
case RTE_FLOW_ITEM_TYPE_TAG:
ret = flow_dv_validate_item_tag(dev, items,
attr, error);
@@ -10269,6 +10280,65 @@ flow_dv_translate_item_icmp6(void *key, const struct rte_flow_item *item,
icmp6_v->code & icmp6_m->code);
}
+/**
+ * Add ICMP6 echo request/reply item to the value.
+ *
+ * @param[in, out] key
+ * Flow matcher value.
+ * @param[in] item
+ * Flow pattern to translate.
+ * @param[in] inner
+ * Item is inner pattern.
+ * @param[in] key_type
+ * Set flow matcher mask or value.
+ */
+static void
+flow_dv_translate_item_icmp6_echo(void *key, const struct rte_flow_item *item,
+ int inner, uint32_t key_type)
+{
+ const struct rte_flow_item_icmp6_echo *icmp6_m;
+ const struct rte_flow_item_icmp6_echo *icmp6_v;
+ uint32_t icmp6_header_data_m = 0;
+ uint32_t icmp6_header_data_v = 0;
+ void *headers_v;
+ void *misc3_v = MLX5_ADDR_OF(fte_match_param, key, misc_parameters_3);
+ uint8_t icmp6_type = 0;
+ struct rte_flow_item_icmp6_echo zero_mask;
+
+ memset(&zero_mask, 0, sizeof(zero_mask));
+ headers_v = inner ? MLX5_ADDR_OF(fte_match_param, key, inner_headers) :
+ MLX5_ADDR_OF(fte_match_param, key, outer_headers);
+ if (key_type & MLX5_SET_MATCHER_M)
+ MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol, 0xFF);
+ else
+ MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol,
+ IPPROTO_ICMPV6);
+ MLX5_ITEM_UPDATE(item, key_type, icmp6_v, icmp6_m, &zero_mask);
+ /* Set fixed type and code for icmpv6 echo request or reply */
+ icmp6_type = (item->type == RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST ?
+ RTE_ICMP6_ECHO_REQUEST : RTE_ICMP6_ECHO_REPLY);
+ if (key_type & MLX5_SET_MATCHER_M) {
+ MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_type, 0xFF);
+ MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_code, 0xFF);
+ } else {
+ MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_type, icmp6_type);
+ MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_code, 0);
+ }
+ if (icmp6_v == NULL)
+ return;
+ /* Set icmp6 header data (identifier & sequence) accordingly */
+ icmp6_header_data_m =
+ (rte_be_to_cpu_16(icmp6_m->echo.identifier) << 16) |
+ rte_be_to_cpu_16(icmp6_m->echo.sequence);
+ if (icmp6_header_data_m) {
+ icmp6_header_data_v =
+ (rte_be_to_cpu_16(icmp6_v->echo.identifier) << 16) |
+ rte_be_to_cpu_16(icmp6_v->echo.sequence);
+ MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_header_data,
+ icmp6_header_data_v & icmp6_header_data_m);
+ }
+}
+
/**
* Add ICMP item to the value.
*
@@ -13381,6 +13451,12 @@ flow_dv_translate_items(struct rte_eth_dev *dev,
wks->priority = MLX5_PRIORITY_MAP_L4;
last_item = MLX5_FLOW_LAYER_ICMP6;
break;
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST:
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY:
+ flow_dv_translate_item_icmp6_echo(key, items, tunnel, key_type);
+ wks->priority = MLX5_PRIORITY_MAP_L4;
+ last_item = MLX5_FLOW_LAYER_ICMP6;
+ break;
case RTE_FLOW_ITEM_TYPE_TAG:
flow_dv_translate_item_tag(dev, key, items, key_type);
last_item = MLX5_FLOW_ITEM_TAG;
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 20c71ff7f0..dbf935ca26 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -4731,6 +4731,8 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,
case RTE_FLOW_ITEM_TYPE_GRE_OPTION:
case RTE_FLOW_ITEM_TYPE_ICMP:
case RTE_FLOW_ITEM_TYPE_ICMP6:
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST:
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY:
case RTE_FLOW_ITEM_TYPE_CONNTRACK:
break;
case RTE_FLOW_ITEM_TYPE_INTEGRITY:
--
2.27.0
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v2 2/3] net/mlx5: add ICMPv6 ID and sequence match support
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)
0 siblings, 1 reply; 31+ messages in thread
From: Thomas Monjalon @ 2023-01-18 8:55 UTC (permalink / raw)
To: Leo Xu; +Cc: dev, Matan Azrad, Viacheslav Ovsiienko
20/12/2022 08:44, Leo Xu:
> --- a/doc/guides/nics/mlx5.rst
> +++ b/doc/guides/nics/mlx5.rst
> @@ -405,7 +405,7 @@ Limitations
> - The input buffer, providing the removal size, is not validated.
> - The buffer size must match the length of the headers to be removed.
>
> -- ICMP(code/type/identifier/sequence number) / ICMP6(code/type) matching, IP-in-IP and MPLS flow matching are all
> +- ICMP(code/type/identifier/sequence number) / ICMP6(code/type/identifier/sequence number) matching, IP-in-IP and MPLS flow matching are all
You can split the line after the comma.
> mutually exclusive features which cannot be supported together
> (see :ref:`mlx5_firmware_config`).
>
> diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst
> index 5af9c43dd9..011c2489f7 100644
> --- a/doc/guides/rel_notes/release_23_03.rst
> +++ b/doc/guides/rel_notes/release_23_03.rst
> @@ -60,6 +60,12 @@ New Features
> Added ``icmp6_echo`` item in rte_flow to support ID and sequence
> matching in ICMPv6 echo request/reply packets.
>
> +* **Updated Mellanox mlx5 driver.**
> +
> + Updated the Mellanox mlx5 driver with new features and improvements, including:
This sentence above can be removed.
We don't have this in recent release notes to keep it short.
> +
> + * Added support for matching on ICMPv6 ID and sequence fields.
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH v2 2/3] net/mlx5: add ICMPv6 ID and sequence match support
2023-01-18 8:55 ` Thomas Monjalon
@ 2023-01-31 6:57 ` Leo Xu (Networking SW)
0 siblings, 0 replies; 31+ messages in thread
From: Leo Xu (Networking SW) @ 2023-01-31 6:57 UTC (permalink / raw)
To: NBU-Contact-Thomas Monjalon (EXTERNAL); +Cc: dev, Matan Azrad, Slava Ovsiienko
Hi Thomas,
PSB
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, January 18, 2023 4:55 PM
> To: Leo Xu (Networking SW) <yongquanx@nvidia.com>
> Cc: dev@dpdk.org; Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>
> Subject: Re: [PATCH v2 2/3] net/mlx5: add ICMPv6 ID and sequence match
> support
>
> External email: Use caution opening links or attachments
>
>
> 20/12/2022 08:44, Leo Xu:
> > --- a/doc/guides/nics/mlx5.rst
> > +++ b/doc/guides/nics/mlx5.rst
> > @@ -405,7 +405,7 @@ Limitations
> > - The input buffer, providing the removal size, is not validated.
> > - The buffer size must match the length of the headers to be removed.
> >
> > -- ICMP(code/type/identifier/sequence number) / ICMP6(code/type)
> matching, IP-in-IP and MPLS flow matching are all
> > +- ICMP(code/type/identifier/sequence number) /
> ICMP6(code/type/identifier/sequence number) matching, IP-in-IP and MPLS
> flow matching are all
>
> You can split the line after the comma.
Ok, thanks.
>
> > mutually exclusive features which cannot be supported together
> > (see :ref:`mlx5_firmware_config`).
> >
> > diff --git a/doc/guides/rel_notes/release_23_03.rst
> b/doc/guides/rel_notes/release_23_03.rst
> > index 5af9c43dd9..011c2489f7 100644
> > --- a/doc/guides/rel_notes/release_23_03.rst
> > +++ b/doc/guides/rel_notes/release_23_03.rst
> > @@ -60,6 +60,12 @@ New Features
> > Added ``icmp6_echo`` item in rte_flow to support ID and sequence
> > matching in ICMPv6 echo request/reply packets.
> >
> > +* **Updated Mellanox mlx5 driver.**
> > +
> > + Updated the Mellanox mlx5 driver with new features and improvements,
> including:
>
> This sentence above can be removed.
> We don't have this in recent release notes to keep it short.
Ok, thanks, will update it in next patch.
>
> > +
> > + * Added support for matching on ICMPv6 ID and sequence fields.
>
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v2 3/3] net/mlx5/hws: add ICMPv6 ID and sequence match support
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
2022-12-20 7:44 ` [PATCH v2 2/3] net/mlx5: add ICMPv6 ID and sequence match support Leo Xu
@ 2022-12-20 7:44 ` Leo Xu
2023-01-18 8:58 ` Thomas Monjalon
2023-01-26 10:47 ` [PATCH v2 0/3] support match icmpv6 ID and sequence Ferruh Yigit
2023-02-05 13:41 ` [PATCH v3 " Leo Xu
4 siblings, 1 reply; 31+ messages in thread
From: Leo Xu @ 2022-12-20 7:44 UTC (permalink / raw)
To: dev; +Cc: Matan Azrad, Viacheslav Ovsiienko
This patch adds ICMPv6 ID and sequence match support for HWS.
Since type and code of ICMPv6 echo is already specified by ITEM type:
RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST
RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY
mlx5 pmd will set appropriate type and code automatically:
Echo request: type(128), code(0)
Echo reply: type(129), code(0)
type and code provided by application will be ignored
This patch also fixes these issues in ICMP definer.
1. Parsing inner ICMP item gets and overwrites the outer IP_PROTOCOL
function, which will remove the outer L4 match incorrectly. Fix this
by getting correct inner function.
2. Member order of mlx5_ifc_header_icmp_bits doesn't follow ICMP format.
Reorder them to make it more consistent.
Signed-off-by: Leo Xu <yongquanx@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr_definer.c | 88 +++++++++++++++++++++++++++
1 file changed, 88 insertions(+)
diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index 6b98eb8c96..8fbc40ff15 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -368,6 +368,47 @@ mlx5dr_definer_icmp6_dw1_set(struct mlx5dr_definer_fc *fc,
DR_SET(tag, icmp_dw1, fc->byte_off, fc->bit_off, fc->bit_mask);
}
+static void
+mlx5dr_definer_icmp6_echo_dw1_mask_set(struct mlx5dr_definer_fc *fc,
+ __rte_unused const void *item_spec,
+ uint8_t *tag)
+{
+ const struct rte_flow_item_icmp6 spec = {0xFF, 0xFF, 0x0};
+ mlx5dr_definer_icmp6_dw1_set(fc, &spec, tag);
+}
+
+static void
+mlx5dr_definer_icmp6_echo_request_dw1_set(struct mlx5dr_definer_fc *fc,
+ __rte_unused const void *item_spec,
+ uint8_t *tag)
+{
+ const struct rte_flow_item_icmp6 spec = {RTE_ICMP6_ECHO_REQUEST, 0, 0};
+ mlx5dr_definer_icmp6_dw1_set(fc, &spec, tag);
+}
+
+static void
+mlx5dr_definer_icmp6_echo_reply_dw1_set(struct mlx5dr_definer_fc *fc,
+ __rte_unused const void *item_spec,
+ uint8_t *tag)
+{
+ const struct rte_flow_item_icmp6 spec = {RTE_ICMP6_ECHO_REPLY, 0, 0};
+ mlx5dr_definer_icmp6_dw1_set(fc, &spec, tag);
+}
+
+static void
+mlx5dr_definer_icmp6_echo_dw2_set(struct mlx5dr_definer_fc *fc,
+ const void *item_spec,
+ uint8_t *tag)
+{
+ const struct rte_flow_item_icmp6_echo *v = item_spec;
+ rte_be32_t dw2;
+
+ dw2 = (rte_be_to_cpu_16(v->echo.identifier) << __mlx5_dw_bit_off(header_icmp, ident)) |
+ (rte_be_to_cpu_16(v->echo.sequence) << __mlx5_dw_bit_off(header_icmp, seq_nb));
+
+ DR_SET(tag, dw2, fc->byte_off, fc->bit_off, fc->bit_mask);
+}
+
static void
mlx5dr_definer_ipv6_flow_label_set(struct mlx5dr_definer_fc *fc,
const void *item_spec,
@@ -1441,6 +1482,48 @@ mlx5dr_definer_conv_item_icmp6(struct mlx5dr_definer_conv_data *cd,
return 0;
}
+static int
+mlx5dr_definer_conv_item_icmp6_echo(struct mlx5dr_definer_conv_data *cd,
+ struct rte_flow_item *item,
+ int item_idx)
+{
+ const struct rte_flow_item_icmp6_echo *m = item->mask;
+ struct mlx5dr_definer_fc *fc;
+ bool inner = cd->tunnel;
+
+ if (!cd->relaxed) {
+ /* Overwrite match on L4 type ICMP6 */
+ fc = &cd->fc[DR_CALC_FNAME(IP_PROTOCOL, inner)];
+ fc->item_idx = item_idx;
+ fc->tag_set = &mlx5dr_definer_icmp_protocol_set;
+ fc->tag_mask_set = &mlx5dr_definer_ones_set;
+ DR_CALC_SET(fc, eth_l2, l4_type, inner);
+
+ /* Set fixed type and code for icmp6 echo request/reply */
+ fc = &cd->fc[MLX5DR_DEFINER_FNAME_ICMP_DW1];
+ fc->item_idx = item_idx;
+ fc->tag_mask_set = &mlx5dr_definer_icmp6_echo_dw1_mask_set;
+ if (item->type == RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST)
+ fc->tag_set = &mlx5dr_definer_icmp6_echo_request_dw1_set;
+ else /* RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY */
+ fc->tag_set = &mlx5dr_definer_icmp6_echo_reply_dw1_set;
+ DR_CALC_SET_HDR(fc, tcp_icmp, icmp_dw1);
+ }
+
+ if (!m)
+ return 0;
+
+ /* Set identifier & sequence into icmp_dw2 */
+ if (m->echo.identifier || m->echo.sequence) {
+ fc = &cd->fc[MLX5DR_DEFINER_FNAME_ICMP_DW2];
+ fc->item_idx = item_idx;
+ fc->tag_set = &mlx5dr_definer_icmp6_echo_dw2_set;
+ DR_CALC_SET_HDR(fc, tcp_icmp, icmp_dw2);
+ }
+
+ return 0;
+}
+
static int
mlx5dr_definer_conv_item_meter_color(struct mlx5dr_definer_conv_data *cd,
struct rte_flow_item *item,
@@ -1577,6 +1660,11 @@ mlx5dr_definer_conv_items_to_hl(struct mlx5dr_context *ctx,
ret = mlx5dr_definer_conv_item_icmp6(&cd, items, i);
item_flags |= MLX5_FLOW_LAYER_ICMP6;
break;
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST:
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY:
+ ret = mlx5dr_definer_conv_item_icmp6_echo(&cd, items, i);
+ item_flags |= MLX5_FLOW_LAYER_ICMP6;
+ break;
case RTE_FLOW_ITEM_TYPE_METER_COLOR:
ret = mlx5dr_definer_conv_item_meter_color(&cd, items, i);
item_flags |= MLX5_FLOW_ITEM_METER_COLOR;
--
2.27.0
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v2 3/3] net/mlx5/hws: add ICMPv6 ID and sequence match support
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)
0 siblings, 1 reply; 31+ messages in thread
From: Thomas Monjalon @ 2023-01-18 8:58 UTC (permalink / raw)
To: Leo Xu; +Cc: dev, Matan Azrad, Viacheslav Ovsiienko
20/12/2022 08:44, Leo Xu:
> This patch adds ICMPv6 ID and sequence match support for HWS.
> Since type and code of ICMPv6 echo is already specified by ITEM type:
> RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST
> RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY
> mlx5 pmd will set appropriate type and code automatically:
> Echo request: type(128), code(0)
> Echo reply: type(129), code(0)
> type and code provided by application will be ignored
>
> This patch also fixes these issues in ICMP definer.
> 1. Parsing inner ICMP item gets and overwrites the outer IP_PROTOCOL
> function, which will remove the outer L4 match incorrectly. Fix this
> by getting correct inner function.
> 2. Member order of mlx5_ifc_header_icmp_bits doesn't follow ICMP format.
> Reorder them to make it more consistent.
Please don't fix stuff in the same patch as a new feature.
You should have one patch per fix.
The code for the new feature may be squashed in the other mlx5 patch for the feature.
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH v2 3/3] net/mlx5/hws: add ICMPv6 ID and sequence match support
2023-01-18 8:58 ` Thomas Monjalon
@ 2023-01-31 6:56 ` Leo Xu (Networking SW)
0 siblings, 0 replies; 31+ messages in thread
From: Leo Xu (Networking SW) @ 2023-01-31 6:56 UTC (permalink / raw)
To: NBU-Contact-Thomas Monjalon (EXTERNAL); +Cc: dev, Matan Azrad, Slava Ovsiienko
Hi Thomas,
PSB
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, January 18, 2023 4:58 PM
> To: Leo Xu (Networking SW) <yongquanx@nvidia.com>
> Cc: dev@dpdk.org; Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>
> Subject: Re: [PATCH v2 3/3] net/mlx5/hws: add ICMPv6 ID and sequence match
> support
>
> External email: Use caution opening links or attachments
>
>
> 20/12/2022 08:44, Leo Xu:
> > This patch adds ICMPv6 ID and sequence match support for HWS.
> > Since type and code of ICMPv6 echo is already specified by ITEM type:
> > RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST
> > RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY
> > mlx5 pmd will set appropriate type and code automatically:
> > Echo request: type(128), code(0)
> > Echo reply: type(129), code(0)
> > type and code provided by application will be ignored
> >
> > This patch also fixes these issues in ICMP definer.
> > 1. Parsing inner ICMP item gets and overwrites the outer IP_PROTOCOL
> > function, which will remove the outer L4 match incorrectly. Fix this
> > by getting correct inner function.
> > 2. Member order of mlx5_ifc_header_icmp_bits doesn't follow ICMP format.
> > Reorder them to make it more consistent.
>
> Please don't fix stuff in the same patch as a new feature.
> You should have one patch per fix.
> The code for the new feature may be squashed in the other mlx5 patch for the
> feature.
>
Thanks for that good catch.
Actually, those "fix stuff" related sentences should be removed.
I leave it there by accident.
Will remove them, in next patch
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v2 0/3] support match icmpv6 ID and sequence
2022-12-20 7:44 ` [PATCH v2 0/3] support match icmpv6 ID and sequence Leo Xu
` (2 preceding siblings ...)
2022-12-20 7:44 ` [PATCH v2 3/3] net/mlx5/hws: " Leo Xu
@ 2023-01-26 10:47 ` Ferruh Yigit
2023-01-31 3:54 ` Leo Xu (Networking SW)
2023-02-05 13:41 ` [PATCH v3 " Leo Xu
4 siblings, 1 reply; 31+ messages in thread
From: Ferruh Yigit @ 2023-01-26 10:47 UTC (permalink / raw)
To: Leo Xu; +Cc: Matan Azrad, dev, Viacheslav Ovsiienko
On 12/20/2022 7:44 AM, Leo Xu wrote:
> Currently, rte_flow API does not support matching
> ID and sequence fields of icmp6 echo packets.
>
> This patchset is used to support match icmpv6 ID and
> sequence in rte_flow. It adds needed API in rte_flow,
> and gives corresponding implementation for mlx5 pmd.
>
> Leo Xu (3):
> ethdev: add ICMPv6 ID and sequence
> net/mlx5: add ICMPv6 ID and sequence match support
> net/mlx5/hws: add ICMPv6 ID and sequence match support
>
> ---
> v2:
> * rebase 23.03
>
mlx patches are giving following warning:
$ ./devtools/check-doc-vs-code.sh
rte_flow doc out of sync for mlx5
item icmp6_echo_reply
item icmp6_echo_request
Also can you please make sure driver patches are acked by driver
maintainers, so we can merge all set with ethdev and driver patches
together.
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH v2 0/3] support match icmpv6 ID and sequence
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)
0 siblings, 0 replies; 31+ messages in thread
From: Leo Xu (Networking SW) @ 2023-01-31 3:54 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: Matan Azrad, dev, Slava Ovsiienko
Hi,
PSB
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@amd.com>
> Sent: Thursday, January 26, 2023 6:47 PM
> To: Leo Xu (Networking SW) <yongquanx@nvidia.com>
> Cc: Matan Azrad <matan@nvidia.com>; dev@dpdk.org; Slava Ovsiienko
> <viacheslavo@nvidia.com>
> Subject: Re: [PATCH v2 0/3] support match icmpv6 ID and sequence
>
> External email: Use caution opening links or attachments
>
>
> On 12/20/2022 7:44 AM, Leo Xu wrote:
> > Currently, rte_flow API does not support matching ID and sequence
> > fields of icmp6 echo packets.
> >
> > This patchset is used to support match icmpv6 ID and sequence in
> > rte_flow. It adds needed API in rte_flow, and gives corresponding
> > implementation for mlx5 pmd.
> >
> > Leo Xu (3):
> > ethdev: add ICMPv6 ID and sequence
> > net/mlx5: add ICMPv6 ID and sequence match support
> > net/mlx5/hws: add ICMPv6 ID and sequence match support
> >
> > ---
> > v2:
> > * rebase 23.03
> >
>
> mlx patches are giving following warning:
> $ ./devtools/check-doc-vs-code.sh
> rte_flow doc out of sync for mlx5
> item icmp6_echo_reply
> item icmp6_echo_request
Thanks for the catch, will fix it in next PATCH.
>
> Also can you please make sure driver patches are acked by driver maintainers,
> so we can merge all set with ethdev and driver patches together.
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 0/3] support match icmpv6 ID and sequence
2022-12-20 7:44 ` [PATCH v2 0/3] support match icmpv6 ID and sequence Leo Xu
` (3 preceding siblings ...)
2023-01-26 10:47 ` [PATCH v2 0/3] support match icmpv6 ID and sequence Ferruh Yigit
@ 2023-02-05 13:41 ` Leo Xu
2023-02-05 13:41 ` [PATCH v3 1/3] ethdev: add ICMPv6 " Leo Xu
` (3 more replies)
4 siblings, 4 replies; 31+ messages in thread
From: Leo Xu @ 2023-02-05 13:41 UTC (permalink / raw)
To: dev
Currently, rte_flow API does not support matching
ID and sequence fields of icmp6 echo packets.
This patchset is used to support match icmpv6 ID and
sequence in rte_flow. It adds needed API in rte_flow,
and gives corresponding implementation for mlx5 pmd.
---
v2:
* rebase 23.03
---
v3:
* Merge content of rte_icmp6.h into rte_icmp.h.
Just keep one header file(rte_icmp.h) for icmp.
* Correct some code style problems.
Leo Xu (3):
ethdev: add ICMPv6 ID and sequence
net/mlx5: add ICMPv6 ID and sequence match support
net/mlx5/hws: add ICMPv6 ID and sequence match support
.mailmap | 1 +
app/test-pmd/cmdline_flow.c | 70 ++++++++++++++++
doc/guides/nics/features/default.ini | 2 +
doc/guides/nics/features/mlx5.ini | 2 +
doc/guides/nics/mlx5.rst | 4 +-
doc/guides/prog_guide/rte_flow.rst | 14 ++++
doc/guides/rel_notes/release_23_03.rst | 9 +++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 +++
drivers/net/mlx5/hws/mlx5dr_definer.c | 88 +++++++++++++++++++++
drivers/net/mlx5/mlx5_flow.c | 61 ++++++++++++++
drivers/net/mlx5/mlx5_flow.h | 4 +
drivers/net/mlx5/mlx5_flow_dv.c | 76 ++++++++++++++++++
drivers/net/mlx5/mlx5_flow_hw.c | 2 +
lib/ethdev/rte_flow.c | 2 +
lib/ethdev/rte_flow.h | 24 ++++++
lib/net/rte_icmp.h | 22 ++++++
16 files changed, 389 insertions(+), 2 deletions(-)
--
2.27.0
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 1/3] ethdev: add ICMPv6 ID and sequence
2023-02-05 13:41 ` [PATCH v3 " Leo Xu
@ 2023-02-05 13:41 ` Leo Xu
2023-02-05 13:41 ` [PATCH v3 2/3] net/mlx5: add ICMPv6 ID and sequence match support Leo Xu
` (2 subsequent siblings)
3 siblings, 0 replies; 31+ messages in thread
From: Leo Xu @ 2023-02-05 13:41 UTC (permalink / raw)
To: dev
Cc: Ori Kam, Thomas Monjalon, Aman Singh, Yuying Zhang, Ferruh Yigit,
Andrew Rybchenko, Olivier Matz
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 structures for ICMP packet definitions.
struct rte_icmp_base_hdr; # For basic header of all ICMP/ICMPv6 header
struct rte_icmp_echo_hdr; # For ICMP/ICMPv6 echo header
The existing struct rte_icmp_hdr should not be used in new code. It
should be set to be deprecated in future. The reason for that is,
icmp_ident/icmp_seq_nb are not common fields of ICMP/ICMPv6 packets.
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>
Acked-by: Ori Kam <orika@nvidia.com>
---
.mailmap | 1 +
app/test-pmd/cmdline_flow.c | 70 +++++++++++++++++++++
doc/guides/nics/features/default.ini | 2 +
doc/guides/prog_guide/rte_flow.rst | 14 +++++
doc/guides/rel_notes/release_23_03.rst | 5 ++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 +++
lib/ethdev/rte_flow.c | 2 +
lib/ethdev/rte_flow.h | 24 +++++++
lib/net/rte_icmp.h | 22 +++++++
9 files changed, 150 insertions(+)
diff --git a/.mailmap b/.mailmap
index 75884b6fe2..310853bd5e 100644
--- a/.mailmap
+++ b/.mailmap
@@ -728,6 +728,7 @@ Lei Gong <arei.gonglei@huawei.com>
Lei Ji <jilei8@huawei.com>
Lei Yao <lei.a.yao@intel.com>
Leonid Myravjev <myravjev@amicon.ru>
+Leo Xu <yongquanx@nvidia.com>
Leszek Zygo <leszek.zygo@intel.com>
Levend Sayar <levendsayar@gmail.com>
Lev Faerman <lev.faerman@intel.com>
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 88108498e0..97ab742abd 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -360,6 +360,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,
@@ -1327,6 +1333,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,
@@ -1575,6 +1583,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,
@@ -4323,6 +4345,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(COMMON_UNSIGNED),
+ item_param),
+ .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp6_echo,
+ hdr.identifier)),
+ },
+ [ITEM_ICMP6_ECHO_REQUEST_SEQ] = {
+ .name = "seq",
+ .help = "ICMPv6 echo request sequence",
+ .next = NEXT(item_icmp6_echo_request, NEXT_ENTRY(COMMON_UNSIGNED),
+ item_param),
+ .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp6_echo,
+ hdr.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(COMMON_UNSIGNED),
+ item_param),
+ .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp6_echo,
+ hdr.identifier)),
+ },
+ [ITEM_ICMP6_ECHO_REPLY_SEQ] = {
+ .name = "seq",
+ .help = "ICMPv6 echo reply sequence",
+ .next = NEXT(item_icmp6_echo_reply, NEXT_ENTRY(COMMON_UNSIGNED),
+ item_param),
+ .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp6_echo,
+ hdr.sequence)),
+ },
[ITEM_ICMP6_ND_NS] = {
.name = "icmp6_nd_ns",
.help = "match ICMPv6 neighbor discovery solicitation",
diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini
index 510cc6679d..976a020985 100644
--- a/doc/guides/nics/features/default.ini
+++ b/doc/guides/nics/features/default.ini
@@ -105,6 +105,8 @@ gtp_psc =
higig2 =
icmp =
icmp6 =
+icmp6_echo_request =
+icmp6_echo_reply =
icmp6_nd_na =
icmp6_nd_ns =
icmp6_nd_opt =
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 3e6242803d..b910ea51bd 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1165,6 +1165,20 @@ Matches any ICMPv6 header.
- ``checksum``: ICMPv6 checksum.
- Default ``mask`` matches ``type`` and ``code``.
+Item: ``ICMP6_ECHO_REQUEST``
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Matches an ICMPv6 echo request.
+
+- ``hdr``: ICMP6 echo header definition (``rte_icmp.h``).
+
+Item: ``ICMP6_ECHO_REPLY``
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Matches an ICMPv6 echo reply.
+
+- ``hdr``: ICMP6 echo header definition (``rte_icmp.h``).
+
Item: ``ICMP6_ND_NS``
^^^^^^^^^^^^^^^^^^^^^
diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst
index c15f6fbb9f..3f5c7af3b6 100644
--- a/doc/guides/rel_notes/release_23_03.rst
+++ b/doc/guides/rel_notes/release_23_03.rst
@@ -69,6 +69,11 @@ New Features
``rte_event_dev_config::nb_single_link_event_port_queues`` parameter
required for eth_rx, eth_tx, crypto and timer eventdev adapters.
+* **Added rte_flow support for matching ICMPv6 ID and sequence fields.**
+
+ * Added flow items to match ICMPv6 echo request and reply packets.
+ Matching patterns can include ICMP identifier and sequence numbers.
+
Removed Items
-------------
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 0037506a79..f497bba26d 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3622,6 +3622,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/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 7d0c24366c..adcd4a61be 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -123,6 +123,8 @@ 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/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index b60987db4b..3ce6f188a3 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -624,6 +624,20 @@ enum rte_flow_item_type {
* See struct rte_flow_item_meter_color.
*/
RTE_FLOW_ITEM_TYPE_METER_COLOR,
+
+ /**
+ * 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,
};
/**
@@ -1303,6 +1317,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_icmp_echo_hdr hdr;
+};
+
/**
* RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
*
diff --git a/lib/net/rte_icmp.h b/lib/net/rte_icmp.h
index 4429e8e29f..7aaf0fd096 100644
--- a/lib/net/rte_icmp.h
+++ b/lib/net/rte_icmp.h
@@ -37,6 +37,28 @@ struct rte_icmp_hdr {
#define RTE_IP_ICMP_ECHO_REPLY 0
#define RTE_IP_ICMP_ECHO_REQUEST 8
+/**
+ * ICMP base header
+ */
+struct rte_icmp_base_hdr {
+ uint8_t type;
+ uint8_t code;
+ rte_be16_t checksum;
+} __rte_packed;
+
+/**
+ * ICMP echo header
+ */
+struct rte_icmp_echo_hdr {
+ struct rte_icmp_base_hdr base;
+ 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
--
2.27.0
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 2/3] net/mlx5: add ICMPv6 ID and sequence match support
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 ` 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-09 13:04 ` [PATCH v3 0/3] support match icmpv6 ID and sequence Ferruh Yigit
3 siblings, 1 reply; 31+ messages in thread
From: Leo Xu @ 2023-02-05 13:41 UTC (permalink / raw)
To: dev; +Cc: Matan Azrad, Viacheslav Ovsiienko
This patch adds ICMPv6 ID and sequence match support.
Since type and code of ICMPv6 echo is already specified by ITEM type:
RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST
RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY
mlx5 pmd will set appropriate type and code automatically:
Echo request: type(128), code(0)
Echo reply: type(129), code(0)
type and code provided by application will be ignored.
Signed-off-by: Leo Xu <yongquanx@nvidia.com>
---
doc/guides/nics/features/mlx5.ini | 2 +
doc/guides/nics/mlx5.rst | 4 +-
doc/guides/rel_notes/release_23_03.rst | 4 ++
drivers/net/mlx5/mlx5_flow.c | 61 +++++++++++++++++++++
drivers/net/mlx5/mlx5_flow.h | 4 ++
drivers/net/mlx5/mlx5_flow_dv.c | 76 ++++++++++++++++++++++++++
drivers/net/mlx5/mlx5_flow_hw.c | 2 +
7 files changed, 151 insertions(+), 2 deletions(-)
diff --git a/doc/guides/nics/features/mlx5.ini b/doc/guides/nics/features/mlx5.ini
index 62fd330e2b..eb016f34da 100644
--- a/doc/guides/nics/features/mlx5.ini
+++ b/doc/guides/nics/features/mlx5.ini
@@ -69,6 +69,8 @@ gtp = Y
gtp_psc = Y
icmp = Y
icmp6 = Y
+icmp6_echo_request = Y
+icmp6_echo_reply = Y
integrity = Y
ipv4 = Y
ipv6 = Y
diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index f137f156f9..9c6f1cca19 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -405,8 +405,8 @@ Limitations
- The input buffer, providing the removal size, is not validated.
- The buffer size must match the length of the headers to be removed.
-- ICMP(code/type/identifier/sequence number) / ICMP6(code/type) matching, IP-in-IP and MPLS flow matching are all
- mutually exclusive features which cannot be supported together
+- ICMP(code/type/identifier/sequence number) / ICMP6(code/type/identifier/sequence number) matching,
+ IP-in-IP and MPLS flow matching are all mutually exclusive features which cannot be supported together
(see :ref:`mlx5_firmware_config`).
- LRO:
diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst
index 3f5c7af3b6..cac69e3173 100644
--- a/doc/guides/rel_notes/release_23_03.rst
+++ b/doc/guides/rel_notes/release_23_03.rst
@@ -74,6 +74,10 @@ New Features
* Added flow items to match ICMPv6 echo request and reply packets.
Matching patterns can include ICMP identifier and sequence numbers.
+* **Updated Mellanox mlx5 driver.**
+
+ * Added support for matching on ICMPv6 ID and sequence fields.
+
Removed Items
-------------
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index f5e2831480..b38062c70e 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -2352,6 +2352,67 @@ mlx5_flow_validate_item_icmp6(const struct rte_flow_item *item,
return 0;
}
+/**
+ * Validate ICMP6 echo request/reply item.
+ *
+ * @param[in] item
+ * Item specification.
+ * @param[in] item_flags
+ * Bit-fields that holds the items detected until now.
+ * @param[in] ext_vlan_sup
+ * Whether extended VLAN features are supported or not.
+ * @param[out] error
+ * Pointer to error structure.
+ *
+ * @return
+ * 0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+int
+mlx5_flow_validate_item_icmp6_echo(const struct rte_flow_item *item,
+ uint64_t item_flags,
+ uint8_t target_protocol,
+ struct rte_flow_error *error)
+{
+ const struct rte_flow_item_icmp6_echo *mask = item->mask;
+ const struct rte_flow_item_icmp6_echo nic_mask = {
+ .hdr.base.type = 0xff,
+ .hdr.base.code = 0xff,
+ .hdr.identifier = RTE_BE16(0xffff),
+ .hdr.sequence = RTE_BE16(0xffff),
+ };
+ const int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
+ const uint64_t l3m = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV6 :
+ MLX5_FLOW_LAYER_OUTER_L3_IPV6;
+ const uint64_t l4m = tunnel ? MLX5_FLOW_LAYER_INNER_L4 :
+ MLX5_FLOW_LAYER_OUTER_L4;
+ int ret;
+
+ if (target_protocol != 0xFF && target_protocol != IPPROTO_ICMPV6)
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM, item,
+ "protocol filtering not compatible"
+ " with ICMP6 layer");
+ if (!(item_flags & l3m))
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM, item,
+ "IPv6 is mandatory to filter on"
+ " ICMP6");
+ if (item_flags & l4m)
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM, item,
+ "multiple L4 layers not supported");
+ if (!mask)
+ mask = &nic_mask;
+ ret = mlx5_flow_item_acceptable
+ (item, (const uint8_t *)mask,
+ (const uint8_t *)&nic_mask,
+ sizeof(struct rte_flow_item_icmp6_echo),
+ MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
+ if (ret < 0)
+ return ret;
+ return 0;
+}
+
/**
* Validate ICMP item.
*
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index e376dcae93..86311b0b08 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -2322,6 +2322,10 @@ int mlx5_flow_validate_item_icmp6(const struct rte_flow_item *item,
uint64_t item_flags,
uint8_t target_protocol,
struct rte_flow_error *error);
+int mlx5_flow_validate_item_icmp6_echo(const struct rte_flow_item *item,
+ uint64_t item_flags,
+ uint8_t target_protocol,
+ struct rte_flow_error *error);
int mlx5_flow_validate_item_nvgre(const struct rte_flow_item *item,
uint64_t item_flags,
uint8_t target_protocol,
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 7ca909999b..2ac9587761 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7370,6 +7370,17 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
item_ipv6_proto = IPPROTO_ICMPV6;
last_item = MLX5_FLOW_LAYER_ICMP6;
break;
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST:
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY:
+ ret = mlx5_flow_validate_item_icmp6_echo(items,
+ item_flags,
+ next_protocol,
+ error);
+ if (ret < 0)
+ return ret;
+ item_ipv6_proto = IPPROTO_ICMPV6;
+ last_item = MLX5_FLOW_LAYER_ICMP6;
+ break;
case RTE_FLOW_ITEM_TYPE_TAG:
ret = flow_dv_validate_item_tag(dev, items,
attr, error);
@@ -10269,6 +10280,65 @@ flow_dv_translate_item_icmp6(void *key, const struct rte_flow_item *item,
icmp6_v->code & icmp6_m->code);
}
+/**
+ * Add ICMP6 echo request/reply item to the value.
+ *
+ * @param[in, out] key
+ * Flow matcher value.
+ * @param[in] item
+ * Flow pattern to translate.
+ * @param[in] inner
+ * Item is inner pattern.
+ * @param[in] key_type
+ * Set flow matcher mask or value.
+ */
+static void
+flow_dv_translate_item_icmp6_echo(void *key, const struct rte_flow_item *item,
+ int inner, uint32_t key_type)
+{
+ const struct rte_flow_item_icmp6_echo *icmp6_m;
+ const struct rte_flow_item_icmp6_echo *icmp6_v;
+ uint32_t icmp6_header_data_m = 0;
+ uint32_t icmp6_header_data_v = 0;
+ void *headers_v;
+ void *misc3_v = MLX5_ADDR_OF(fte_match_param, key, misc_parameters_3);
+ uint8_t icmp6_type = 0;
+ struct rte_flow_item_icmp6_echo zero_mask;
+
+ memset(&zero_mask, 0, sizeof(zero_mask));
+ headers_v = inner ? MLX5_ADDR_OF(fte_match_param, key, inner_headers) :
+ MLX5_ADDR_OF(fte_match_param, key, outer_headers);
+ if (key_type & MLX5_SET_MATCHER_M)
+ MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol, 0xFF);
+ else
+ MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol,
+ IPPROTO_ICMPV6);
+ MLX5_ITEM_UPDATE(item, key_type, icmp6_v, icmp6_m, &zero_mask);
+ /* Set fixed type and code for icmpv6 echo request or reply */
+ icmp6_type = (item->type == RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST ?
+ RTE_ICMP6_ECHO_REQUEST : RTE_ICMP6_ECHO_REPLY);
+ if (key_type & MLX5_SET_MATCHER_M) {
+ MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_type, 0xFF);
+ MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_code, 0xFF);
+ } else {
+ MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_type, icmp6_type);
+ MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_code, 0);
+ }
+ if (icmp6_v == NULL)
+ return;
+ /* Set icmp6 header data (identifier & sequence) accordingly */
+ icmp6_header_data_m =
+ (rte_be_to_cpu_16(icmp6_m->hdr.identifier) << 16) |
+ rte_be_to_cpu_16(icmp6_m->hdr.sequence);
+ if (icmp6_header_data_m) {
+ icmp6_header_data_v =
+ (rte_be_to_cpu_16(icmp6_v->hdr.identifier) << 16) |
+ rte_be_to_cpu_16(icmp6_v->hdr.sequence);
+ MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_header_data,
+ icmp6_header_data_v & icmp6_header_data_m);
+ }
+}
+
/**
* Add ICMP item to the value.
*
@@ -13381,6 +13451,12 @@ flow_dv_translate_items(struct rte_eth_dev *dev,
wks->priority = MLX5_PRIORITY_MAP_L4;
last_item = MLX5_FLOW_LAYER_ICMP6;
break;
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST:
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY:
+ flow_dv_translate_item_icmp6_echo(key, items, tunnel, key_type);
+ wks->priority = MLX5_PRIORITY_MAP_L4;
+ last_item = MLX5_FLOW_LAYER_ICMP6;
+ break;
case RTE_FLOW_ITEM_TYPE_TAG:
flow_dv_translate_item_tag(dev, key, items, key_type);
last_item = MLX5_FLOW_ITEM_TAG;
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 20c71ff7f0..dbf935ca26 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -4731,6 +4731,8 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,
case RTE_FLOW_ITEM_TYPE_GRE_OPTION:
case RTE_FLOW_ITEM_TYPE_ICMP:
case RTE_FLOW_ITEM_TYPE_ICMP6:
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST:
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY:
case RTE_FLOW_ITEM_TYPE_CONNTRACK:
break;
case RTE_FLOW_ITEM_TYPE_INTEGRITY:
--
2.27.0
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH v3 2/3] net/mlx5: add ICMPv6 ID and sequence match support
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
0 siblings, 0 replies; 31+ messages in thread
From: Slava Ovsiienko @ 2023-02-07 13:48 UTC (permalink / raw)
To: Leo Xu (Networking SW), dev; +Cc: Matan Azrad
> -----Original Message-----
> From: Leo Xu (Networking SW) <yongquanx@nvidia.com>
> Sent: Sunday, February 5, 2023 3:42 PM
> To: dev@dpdk.org
> Cc: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>
> Subject: [PATCH v3 2/3] net/mlx5: add ICMPv6 ID and sequence match support
>
> This patch adds ICMPv6 ID and sequence match support.
> Since type and code of ICMPv6 echo is already specified by ITEM type:
> RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST
> RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY
> mlx5 pmd will set appropriate type and code automatically:
> Echo request: type(128), code(0)
> Echo reply: type(129), code(0)
> type and code provided by application will be ignored.
>
> Signed-off-by: Leo Xu <yongquanx@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 3/3] net/mlx5/hws: add ICMPv6 ID and sequence match support
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-05 13:41 ` 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
3 siblings, 2 replies; 31+ messages in thread
From: Leo Xu @ 2023-02-05 13:41 UTC (permalink / raw)
To: dev; +Cc: Matan Azrad, Viacheslav Ovsiienko
This patch adds ICMPv6 ID and sequence match support for HWS.
Since type and code of ICMPv6 echo is already specified by ITEM type:
RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST
RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY
mlx5 pmd will set appropriate type and code automatically:
Echo request: type(128), code(0)
Echo reply: type(129), code(0)
type and code provided by application will be ignored
Signed-off-by: Leo Xu <yongquanx@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr_definer.c | 88 +++++++++++++++++++++++++++
1 file changed, 88 insertions(+)
diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index 6b98eb8c96..d56e85631d 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -368,6 +368,47 @@ mlx5dr_definer_icmp6_dw1_set(struct mlx5dr_definer_fc *fc,
DR_SET(tag, icmp_dw1, fc->byte_off, fc->bit_off, fc->bit_mask);
}
+static void
+mlx5dr_definer_icmp6_echo_dw1_mask_set(struct mlx5dr_definer_fc *fc,
+ __rte_unused const void *item_spec,
+ uint8_t *tag)
+{
+ const struct rte_flow_item_icmp6 spec = {0xFF, 0xFF, 0x0};
+ mlx5dr_definer_icmp6_dw1_set(fc, &spec, tag);
+}
+
+static void
+mlx5dr_definer_icmp6_echo_request_dw1_set(struct mlx5dr_definer_fc *fc,
+ __rte_unused const void *item_spec,
+ uint8_t *tag)
+{
+ const struct rte_flow_item_icmp6 spec = {RTE_ICMP6_ECHO_REQUEST, 0, 0};
+ mlx5dr_definer_icmp6_dw1_set(fc, &spec, tag);
+}
+
+static void
+mlx5dr_definer_icmp6_echo_reply_dw1_set(struct mlx5dr_definer_fc *fc,
+ __rte_unused const void *item_spec,
+ uint8_t *tag)
+{
+ const struct rte_flow_item_icmp6 spec = {RTE_ICMP6_ECHO_REPLY, 0, 0};
+ mlx5dr_definer_icmp6_dw1_set(fc, &spec, tag);
+}
+
+static void
+mlx5dr_definer_icmp6_echo_dw2_set(struct mlx5dr_definer_fc *fc,
+ const void *item_spec,
+ uint8_t *tag)
+{
+ const struct rte_flow_item_icmp6_echo *v = item_spec;
+ rte_be32_t dw2;
+
+ dw2 = (rte_be_to_cpu_16(v->hdr.identifier) << __mlx5_dw_bit_off(header_icmp, ident)) |
+ (rte_be_to_cpu_16(v->hdr.sequence) << __mlx5_dw_bit_off(header_icmp, seq_nb));
+
+ DR_SET(tag, dw2, fc->byte_off, fc->bit_off, fc->bit_mask);
+}
+
static void
mlx5dr_definer_ipv6_flow_label_set(struct mlx5dr_definer_fc *fc,
const void *item_spec,
@@ -1441,6 +1482,48 @@ mlx5dr_definer_conv_item_icmp6(struct mlx5dr_definer_conv_data *cd,
return 0;
}
+static int
+mlx5dr_definer_conv_item_icmp6_echo(struct mlx5dr_definer_conv_data *cd,
+ struct rte_flow_item *item,
+ int item_idx)
+{
+ const struct rte_flow_item_icmp6_echo *m = item->mask;
+ struct mlx5dr_definer_fc *fc;
+ bool inner = cd->tunnel;
+
+ if (!cd->relaxed) {
+ /* Overwrite match on L4 type ICMP6 */
+ fc = &cd->fc[DR_CALC_FNAME(IP_PROTOCOL, inner)];
+ fc->item_idx = item_idx;
+ fc->tag_set = &mlx5dr_definer_icmp_protocol_set;
+ fc->tag_mask_set = &mlx5dr_definer_ones_set;
+ DR_CALC_SET(fc, eth_l2, l4_type, inner);
+
+ /* Set fixed type and code for icmp6 echo request/reply */
+ fc = &cd->fc[MLX5DR_DEFINER_FNAME_ICMP_DW1];
+ fc->item_idx = item_idx;
+ fc->tag_mask_set = &mlx5dr_definer_icmp6_echo_dw1_mask_set;
+ if (item->type == RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST)
+ fc->tag_set = &mlx5dr_definer_icmp6_echo_request_dw1_set;
+ else /* RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY */
+ fc->tag_set = &mlx5dr_definer_icmp6_echo_reply_dw1_set;
+ DR_CALC_SET_HDR(fc, tcp_icmp, icmp_dw1);
+ }
+
+ if (!m)
+ return 0;
+
+ /* Set identifier & sequence into icmp_dw2 */
+ if (m->hdr.identifier || m->hdr.sequence) {
+ fc = &cd->fc[MLX5DR_DEFINER_FNAME_ICMP_DW2];
+ fc->item_idx = item_idx;
+ fc->tag_set = &mlx5dr_definer_icmp6_echo_dw2_set;
+ DR_CALC_SET_HDR(fc, tcp_icmp, icmp_dw2);
+ }
+
+ return 0;
+}
+
static int
mlx5dr_definer_conv_item_meter_color(struct mlx5dr_definer_conv_data *cd,
struct rte_flow_item *item,
@@ -1577,6 +1660,11 @@ mlx5dr_definer_conv_items_to_hl(struct mlx5dr_context *ctx,
ret = mlx5dr_definer_conv_item_icmp6(&cd, items, i);
item_flags |= MLX5_FLOW_LAYER_ICMP6;
break;
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST:
+ case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY:
+ ret = mlx5dr_definer_conv_item_icmp6_echo(&cd, items, i);
+ item_flags |= MLX5_FLOW_LAYER_ICMP6;
+ break;
case RTE_FLOW_ITEM_TYPE_METER_COLOR:
ret = mlx5dr_definer_conv_item_meter_color(&cd, items, i);
item_flags |= MLX5_FLOW_ITEM_METER_COLOR;
--
2.27.0
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH v3 3/3] net/mlx5/hws: add ICMPv6 ID and sequence match support
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
1 sibling, 0 replies; 31+ messages in thread
From: Alex Vesker @ 2023-02-07 13:05 UTC (permalink / raw)
To: Leo Xu (Networking SW), dev; +Cc: Matan Azrad, Slava Ovsiienko
Hi,
> -----Original Message-----
> From: Leo Xu <yongquanx@nvidia.com>
> Sent: Sunday, 5 February 2023 15:42
> To: dev@dpdk.org
> Cc: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>
> Subject: [PATCH v3 3/3] net/mlx5/hws: add ICMPv6 ID and sequence match
> support
>
> This patch adds ICMPv6 ID and sequence match support for HWS.
> Since type and code of ICMPv6 echo is already specified by ITEM type:
> RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST
> RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY
> mlx5 pmd will set appropriate type and code automatically:
> Echo request: type(128), code(0)
> Echo reply: type(129), code(0)
> type and code provided by application will be ignored
>
> Signed-off-by: Leo Xu <yongquanx@nvidia.com>
> ---
> drivers/net/mlx5/hws/mlx5dr_definer.c | 88 +++++++++++++++++++++++++++
> 1 file changed, 88 insertions(+)
>
> diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c
> b/drivers/net/mlx5/hws/mlx5dr_definer.c
> index 6b98eb8c96..d56e85631d 100644
> --- a/drivers/net/mlx5/hws/mlx5dr_definer.c
> +++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
> @@ -368,6 +368,47 @@ mlx5dr_definer_icmp6_dw1_set(struct
> mlx5dr_definer_fc *fc,
> DR_SET(tag, icmp_dw1, fc->byte_off, fc->bit_off, fc->bit_mask); }
>
> +static void
> +mlx5dr_definer_icmp6_echo_dw1_mask_set(struct mlx5dr_definer_fc *fc,
> + __rte_unused const void *item_spec,
> + uint8_t *tag)
> +{
> + const struct rte_flow_item_icmp6 spec = {0xFF, 0xFF, 0x0};
> + mlx5dr_definer_icmp6_dw1_set(fc, &spec, tag); }
> +
> +static void
> +mlx5dr_definer_icmp6_echo_request_dw1_set(struct mlx5dr_definer_fc *fc,
> + __rte_unused const void *item_spec,
> + uint8_t *tag)
> +{
> + const struct rte_flow_item_icmp6 spec = {RTE_ICMP6_ECHO_REQUEST,
> 0, 0};
> + mlx5dr_definer_icmp6_dw1_set(fc, &spec, tag); }
> +
> +static void
> +mlx5dr_definer_icmp6_echo_reply_dw1_set(struct mlx5dr_definer_fc *fc,
> + __rte_unused const void *item_spec,
> + uint8_t *tag)
> +{
> + const struct rte_flow_item_icmp6 spec = {RTE_ICMP6_ECHO_REPLY, 0,
> 0};
> + mlx5dr_definer_icmp6_dw1_set(fc, &spec, tag); }
> +
> +static void
> +mlx5dr_definer_icmp6_echo_dw2_set(struct mlx5dr_definer_fc *fc,
> + const void *item_spec,
> + uint8_t *tag)
> +{
> + const struct rte_flow_item_icmp6_echo *v = item_spec;
> + rte_be32_t dw2;
> +
> + dw2 = (rte_be_to_cpu_16(v->hdr.identifier) <<
> __mlx5_dw_bit_off(header_icmp, ident)) |
> + (rte_be_to_cpu_16(v->hdr.sequence) <<
> +__mlx5_dw_bit_off(header_icmp, seq_nb));
> +
> + DR_SET(tag, dw2, fc->byte_off, fc->bit_off, fc->bit_mask); }
> +
> static void
> mlx5dr_definer_ipv6_flow_label_set(struct mlx5dr_definer_fc *fc,
> const void *item_spec,
> @@ -1441,6 +1482,48 @@ mlx5dr_definer_conv_item_icmp6(struct
> mlx5dr_definer_conv_data *cd,
> return 0;
> }
>
> +static int
> +mlx5dr_definer_conv_item_icmp6_echo(struct mlx5dr_definer_conv_data *cd,
> + struct rte_flow_item *item,
> + int item_idx)
> +{
> + const struct rte_flow_item_icmp6_echo *m = item->mask;
> + struct mlx5dr_definer_fc *fc;
> + bool inner = cd->tunnel;
> +
> + if (!cd->relaxed) {
> + /* Overwrite match on L4 type ICMP6 */
> + fc = &cd->fc[DR_CALC_FNAME(IP_PROTOCOL, inner)];
> + fc->item_idx = item_idx;
> + fc->tag_set = &mlx5dr_definer_icmp_protocol_set;
> + fc->tag_mask_set = &mlx5dr_definer_ones_set;
> + DR_CALC_SET(fc, eth_l2, l4_type, inner);
> +
> + /* Set fixed type and code for icmp6 echo request/reply */
> + fc = &cd->fc[MLX5DR_DEFINER_FNAME_ICMP_DW1];
> + fc->item_idx = item_idx;
> + fc->tag_mask_set =
> &mlx5dr_definer_icmp6_echo_dw1_mask_set;
> + if (item->type ==
> RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST)
> + fc->tag_set =
> &mlx5dr_definer_icmp6_echo_request_dw1_set;
> + else /* RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY */
> + fc->tag_set =
> &mlx5dr_definer_icmp6_echo_reply_dw1_set;
> + DR_CALC_SET_HDR(fc, tcp_icmp, icmp_dw1);
> + }
> +
> + if (!m)
> + return 0;
> +
> + /* Set identifier & sequence into icmp_dw2 */
> + if (m->hdr.identifier || m->hdr.sequence) {
> + fc = &cd->fc[MLX5DR_DEFINER_FNAME_ICMP_DW2];
> + fc->item_idx = item_idx;
> + fc->tag_set = &mlx5dr_definer_icmp6_echo_dw2_set;
> + DR_CALC_SET_HDR(fc, tcp_icmp, icmp_dw2);
> + }
> +
> + return 0;
> +}
> +
> static int
> mlx5dr_definer_conv_item_meter_color(struct mlx5dr_definer_conv_data *cd,
> struct rte_flow_item *item,
> @@ -1577,6 +1660,11 @@ mlx5dr_definer_conv_items_to_hl(struct
> mlx5dr_context *ctx,
> ret = mlx5dr_definer_conv_item_icmp6(&cd, items, i);
> item_flags |= MLX5_FLOW_LAYER_ICMP6;
> break;
> + case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST:
> + case RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY:
> + ret = mlx5dr_definer_conv_item_icmp6_echo(&cd,
> items, i);
> + item_flags |= MLX5_FLOW_LAYER_ICMP6;
> + break;
> case RTE_FLOW_ITEM_TYPE_METER_COLOR:
> ret = mlx5dr_definer_conv_item_meter_color(&cd,
> items, i);
> item_flags |= MLX5_FLOW_ITEM_METER_COLOR;
> --
> 2.27.0
Acked-by: Alex Vesker <valex@nvidia.com>
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH v3 3/3] net/mlx5/hws: add ICMPv6 ID and sequence match support
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
1 sibling, 0 replies; 31+ messages in thread
From: Slava Ovsiienko @ 2023-02-07 13:49 UTC (permalink / raw)
To: Leo Xu (Networking SW), dev; +Cc: Matan Azrad
> -----Original Message-----
> From: Leo Xu (Networking SW) <yongquanx@nvidia.com>
> Sent: Sunday, February 5, 2023 3:42 PM
> To: dev@dpdk.org
> Cc: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>
> Subject: [PATCH v3 3/3] net/mlx5/hws: add ICMPv6 ID and sequence match
> support
>
> This patch adds ICMPv6 ID and sequence match support for HWS.
> Since type and code of ICMPv6 echo is already specified by ITEM type:
> RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST
> RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY
> mlx5 pmd will set appropriate type and code automatically:
> Echo request: type(128), code(0)
> Echo reply: type(129), code(0)
> type and code provided by application will be ignored
>
> Signed-off-by: Leo Xu <yongquanx@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 0/3] support match icmpv6 ID and sequence
2023-02-05 13:41 ` [PATCH v3 " Leo Xu
` (2 preceding siblings ...)
2023-02-05 13:41 ` [PATCH v3 3/3] net/mlx5/hws: " Leo Xu
@ 2023-02-09 13:04 ` Ferruh Yigit
3 siblings, 0 replies; 31+ messages in thread
From: Ferruh Yigit @ 2023-02-09 13:04 UTC (permalink / raw)
To: Leo Xu, dev; +Cc: Ori Kam, Alex Vesker, Viacheslav Ovsiienko
On 2/5/2023 1:41 PM, Leo Xu wrote:
> Currently, rte_flow API does not support matching
> ID and sequence fields of icmp6 echo packets.
>
> This patchset is used to support match icmpv6 ID and
> sequence in rte_flow. It adds needed API in rte_flow,
> and gives corresponding implementation for mlx5 pmd.
>
> ---
> v2:
> * rebase 23.03
>
> ---
> v3:
> * Merge content of rte_icmp6.h into rte_icmp.h.
> Just keep one header file(rte_icmp.h) for icmp.
> * Correct some code style problems.
>
> Leo Xu (3):
> ethdev: add ICMPv6 ID and sequence
> net/mlx5: add ICMPv6 ID and sequence match support
> net/mlx5/hws: add ICMPv6 ID and sequence match support
Series applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 31+ messages in thread