[PATCH v2 1/3] ethdev: add ICMPv6 ID and sequence
Thomas Monjalon
thomas at monjalon.net
Wed Jan 18 10:30:40 CET 2023
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?
More information about the dev
mailing list