From patchwork Mon Apr 16 05:16:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 38162 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AECA31B1C3; Mon, 16 Apr 2018 07:16:34 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 5C3941AFF6 for ; Mon, 16 Apr 2018 07:16:31 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Apr 2018 22:16:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,458,1517904000"; d="scan'208";a="47206356" Received: from dpdk51.sh.intel.com ([10.67.110.184]) by fmsmga001.fm.intel.com with ESMTP; 15 Apr 2018 22:16:28 -0700 From: Qi Zhang To: adrien.mazarguil@6wind.com Cc: dev@dpdk.org, declan.doherty@intel.com, sugesh.chandran@intel.com, michael.j.glynn@intel.com, yu.y.liu@intel.com, konstantin.ananyev@intel.com, bruce.richardson@intel.com, Qi Zhang Date: Mon, 16 Apr 2018 13:16:36 +0800 Message-Id: <20180416051639.188034-2-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180416051639.188034-1-qi.z.zhang@intel.com> References: <1522279780-34842-1-git-send-email-qi.z.zhang@intel.com> <20180416051639.188034-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v3 1/4] ethdev: add more protocol support in flow API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add new protocol header match support as below RTE_FLOW_ITEM_TYPE_ARP_IPV4 - matches an IPv4 ARP header RTE_FLOW_ITEM_TYPE_IPV6_EXT - matches an IPv6 extension header with any type. RTE_FLOW_ITEM_TYPE_ICMP6 - matches an ICMPv6 header followed by any message body. RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS - matches an ICMPv6 header followed by network discovery neighbor solicitation. RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA - matches an ICMPv6 header followed by network discovery neighbor advertisement. RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_ETH_SLA - matches an ICMPv6 header followed by network discovery neighbor solicitation contains source Ethernet link-layer address option. RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_ETH_TLA - matches an ICMPv6 header followed by network discovery neighbor advertisement contains target Ethernet link-layer address option. Suggested-by: Adrien Mazarguil Signed-off-by: Qi Zhang --- app/test-pmd/cmdline_flow.c | 174 +++++++++++++++++++++ app/test-pmd/config.c | 8 + doc/guides/prog_guide/rte_flow.rst | 72 +++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 27 ++++ lib/librte_ether/rte_flow.h | 231 ++++++++++++++++++++++++++++ 5 files changed, 512 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 59f3b3b57..a5e21c1fe 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -150,6 +150,21 @@ enum index { ITEM_GENEVE, ITEM_GENEVE_VNI, ITEM_GENEVE_PROTO, + ITEM_IPV6_EXT, + ITEM_IPV6_EXT_NEXT_HDR, + ITEM_ICMP6, + ITEM_ICMP6_TYPE, + ITEM_ICMP6_CODE, + ITEM_ICMP6_ND_NS, + ITEM_ICMP6_ND_NS_TGT_ADDR, + ITEM_ICMP6_ND_NA, + ITEM_ICMP6_ND_NA_TGT_ADDR, + ITEM_ICMP6_ND_OPT_SLA_ETH, + ITEM_ICMP6_ND_OPT_SLA_ETH_TGT_ADDR, + ITEM_ICMP6_ND_OPT_SLA_ETH_SLL_ADDR, + ITEM_ICMP6_ND_OPT_TLA_ETH, + ITEM_ICMP6_ND_OPT_TLA_ETH_TGT_ADDR, + ITEM_ICMP6_ND_OPT_TLA_ETH_TLL_ADDR, /* Validate/create actions. */ ACTIONS, @@ -436,6 +451,12 @@ static const enum index next_item[] = { ITEM_GTPC, ITEM_GTPU, ITEM_GENEVE, + ITEM_IPV6_EXT, + ITEM_ICMP6, + ITEM_ICMP6_ND_NS, + ITEM_ICMP6_ND_NA, + ITEM_ICMP6_ND_OPT_SLA_ETH, + ITEM_ICMP6_ND_OPT_TLA_ETH, ZERO, }; @@ -586,6 +607,39 @@ static const enum index item_geneve[] = { ZERO, }; +static const enum index item_ipv6_ext[] = { + ITEM_IPV6_EXT_NEXT_HDR, + ZERO, +}; + +static const enum index item_icmp6[] = { + ITEM_ICMP6_TYPE, + ITEM_ICMP6_CODE, + ZERO, +}; + +static const enum index item_icmp6_nd_ns[] = { + ITEM_ICMP6_ND_NS_TGT_ADDR, + ZERO, +}; + +static const enum index item_icmp6_nd_na[] = { + ITEM_ICMP6_ND_NA_TGT_ADDR, + ZERO, +}; + +static const enum index item_icmp6_nd_opt_sla_eth[] = { + ITEM_ICMP6_ND_OPT_SLA_ETH_TGT_ADDR, + ITEM_ICMP6_ND_OPT_SLA_ETH_SLL_ADDR, + ZERO, +}; + +static const enum index item_icmp6_nd_opt_tla_eth[] = { + ITEM_ICMP6_ND_OPT_TLA_ETH_TGT_ADDR, + ITEM_ICMP6_ND_OPT_TLA_ETH_TLL_ADDR, + ZERO, +}; + static const enum index next_action[] = { ACTION_END, ACTION_VOID, @@ -1473,6 +1527,126 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_geneve, protocol)), }, + [ITEM_IPV6_EXT] = { + .name = "ext", + .help = "match IPv6 extend header", + .priv = PRIV_ITEM(IPV6_EXT, + sizeof(struct rte_flow_item_ipv6_ext)), + .next = NEXT(item_ipv6_ext), + .call = parse_vc, + }, + [ITEM_IPV6_EXT_NEXT_HDR] = { + .name = "next", + .help = "next header in IPv6 extend header", + .next = NEXT(item_ipv6_ext, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_ext, + next_hdr)), + }, + [ITEM_ICMP6] = { + .name = "icmp6", + .help = "match ICMPv6 header", + .priv = PRIV_ITEM(ICMP, sizeof(struct rte_flow_item_icmp6)), + .next = NEXT(item_icmp6), + .call = parse_vc, + }, + [ITEM_ICMP6_TYPE] = { + .name = "type", + .help = "ICMPv6 packet type", + .next = NEXT(item_icmp6, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp6, + type)), + }, + [ITEM_ICMP6_CODE] = { + .name = "code", + .help = "ICMPv6 packet code", + .next = NEXT(item_icmp6, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp6, + code)), + }, + [ITEM_ICMP6_ND_NS] = { + .name = "ns", + .help = "match neighbor solicitation over ICMPv6 ", + .priv = PRIV_ITEM(ICMP6_ND_NS, + sizeof(struct rte_flow_item_icmp6_nd_ns)), + .next = NEXT(item_icmp6_nd_ns), + .call = parse_vc, + }, + [ITEM_ICMP6_ND_NS_TGT_ADDR] = { + .name = "tgt_addr", + .help = "target address of neighbor solicitation", + .next = NEXT(item_icmp6_nd_ns, NEXT_ENTRY(UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp6_nd_ns, + target_addr)), + }, + [ITEM_ICMP6_ND_NA] = { + .name = "na", + .help = "match neighbor advertisement over ICMPv6 ", + .priv = PRIV_ITEM(ICMP6_ND_NA, + sizeof(struct rte_flow_item_icmp6_nd_na)), + .next = NEXT(item_icmp6_nd_na), + .call = parse_vc, + }, + [ITEM_ICMP6_ND_NA_TGT_ADDR] = { + .name = "tgt_addr", + .help = "target address of neighbor advertisement", + .next = NEXT(item_icmp6_nd_na, NEXT_ENTRY(UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp6_nd_na, + target_addr)), + }, + [ITEM_ICMP6_ND_OPT_SLA_ETH] = { + .name = "sla", + .help = "match source link-layer address over neighbor solicitation", + .priv = PRIV_ITEM(ICMP6_ND_OPT_SLA_ETH, + sizeof(struct rte_flow_item_icmp6_nd_opt_sla_eth)), + .next = NEXT(item_icmp6_nd_opt_sla_eth), + .call = parse_vc, + }, + [ITEM_ICMP6_ND_OPT_SLA_ETH_TGT_ADDR] = { + .name = "tgt_addr", + .help = "target address of neighbor solicitation", + .next = NEXT(item_icmp6_nd_opt_sla_eth, NEXT_ENTRY(UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON( + struct rte_flow_item_icmp6_nd_opt_sla_eth, + target_addr)), + }, + [ITEM_ICMP6_ND_OPT_SLA_ETH_SLL_ADDR] = { + .name = "sll_addr", + .help = "source link-layer address over neighbor solicitation", + .next = NEXT(item_icmp6_nd_opt_sla_eth, NEXT_ENTRY(UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON( + struct rte_flow_item_icmp6_nd_opt_sla_eth, + sll_addr)), + }, + [ITEM_ICMP6_ND_OPT_TLA_ETH] = { + .name = "tla", + .help = "match target link-layer address over neighbor advertisement", + .priv = PRIV_ITEM(ICMP6_ND_OPT_TLA_ETH, + sizeof(struct rte_flow_item_icmp6_nd_opt_tla_eth)), + .next = NEXT(item_icmp6_nd_opt_tla_eth), + .call = parse_vc, + }, + [ITEM_ICMP6_ND_OPT_TLA_ETH_TGT_ADDR] = { + .name = "tgt_addr", + .help = "target address of neighbor advertisement", + .next = NEXT(item_icmp6_nd_opt_tla_eth, NEXT_ENTRY(UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON( + struct rte_flow_item_icmp6_nd_opt_tla_eth, + target_addr)), + }, + [ITEM_ICMP6_ND_OPT_TLA_ETH_TLL_ADDR] = { + .name = "tll_addr", + .help = "target link-layer address over neighbor advertisement", + .next = NEXT(item_icmp6_nd_opt_tla_eth, NEXT_ENTRY(UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON( + struct rte_flow_item_icmp6_nd_opt_tla_eth, + tll_addr)), + }, /* Validate/create actions. */ [ACTIONS] = { diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 4bb255c62..4cd56bf26 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -980,6 +980,14 @@ static const struct { MK_FLOW_ITEM(GTPC, sizeof(struct rte_flow_item_gtp)), MK_FLOW_ITEM(GTPU, sizeof(struct rte_flow_item_gtp)), MK_FLOW_ITEM(GENEVE, sizeof(struct rte_flow_item_geneve)), + MK_FLOW_ITEM(IPV6_EXT, sizeof(struct rte_flow_item_ipv6_ext)), + MK_FLOW_ITEM(ICMP6, sizeof(struct rte_flow_item_icmp6)), + 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_SLA_ETH, + sizeof(struct rte_flow_item_icmp6_nd_opt_sla_eth)), + MK_FLOW_ITEM(ICMP6_ND_OPT_TLA_ETH, + sizeof(struct rte_flow_item_icmp6_nd_opt_tla_eth)), }; /** Compute storage space needed by item specification. */ diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 961943dda..9c9ddcbd2 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -992,6 +992,78 @@ Matches a GENEVE header. - ``rsvd1``: reserved, normally 0x00. - Default ``mask`` matches VNI only. +Item: ``IPV6_EXT`` +^^^^^^^^^^^^^^^^^^ + +Matches an IPv6 Extension header with any type. + +- ``next_hdr``: protocol of next header. +- Default ``mask`` matches protocal of next header. + +Item: ``ICMP6`` +^^^^^^^^^^^^^^^ + +Matches an ICMPv6 header followed by any message body. + +- ``type``: ICMPv6 type. +- ``code``: ICMPv6 code. +- ``checksume``: ICMPv6 checksume. +- Default ``mask`` matches type and code only. + +Item: ``ICMP6_ND_NS`` +^^^^^^^^^^^^^^^^^^^^^ + +Matches an ICMPv6 header followed by network discvoery neighbor solicitation, + +- ``type``: ICMPv6 type, normally 135. +- ``code``: ICMPv6 code, normally 0. +- ``checksume``: ICMPv6 checksume. +- ``reserved``: reserved, normally 0x00. +- ``tgt_addr``: target address of neighbor solicitation. +- Default ``mask`` matches target address only. + +Item: ``ICMP6_ND_NA`` +^^^^^^^^^^^^^^^^^^^^^ + +Matches an ICMPv6 header followed by network discvoery neighbor advertisement, + +- ``type``: ICMPv6 type, normally 136. +- ``code``: ICMPv6 code, normally 0. +- ``checksume``: ICMPv6 checksume. +- ``rso_reserved``: route flag (1b), solicited flag (1b), override flag (1b), + reserved (29b). +- ``tgt_addr``: target address of neighbor advertisement. +- Default ``mask`` matches target address only. + +Item: ``ICMP6_ND_OPT_SLA_ETH`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Matches an ICMPv6 header followed by network discvoery neighbor solicitation +that contains source Ethernet link-layer address option. + +- ``type``: ICMPv6 type, normally 135. +- ``code``: ICMPv6 code, normally 0. +- ``checksume``: ICMPv6 checksume. +- ``reserved``: reserved, normally 0x00. +- ``tgt_addr``: target address of neighbor solicitation. +- ``sll_ADDR``: source Ethernet link-layer address. +- Default ``mask`` matches target address and source link-layer address only. + +Item: ``ICMP6_ND_OPT_TLA_ETH`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Matches an ICMPv6 header followed by network discvoery neighbor advertisement. +that contains target Ethernet link-layer address option. + +- ``type``: ICMPv6 type, normally 136. +- ``code``: ICMPv6 code, normally 0. +- ``checksume``: ICMPv6 checksume. +- ``rso_reserved``: route flag (1b), solicited flag (1b), override flag (1b), + reserved (29b). +- ``tgt_addr``: target address of neighbor advertisement. +- ``tll_ADDR``: target Ethernet link-layer address. +- Default ``mask`` matches target address and target link-layer address only. + Actions ~~~~~~~ diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index a766ac795..48688600e 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3305,6 +3305,33 @@ This section lists supported pattern items and their attributes, if any. - ``vni {unsigned}``: virtual network identifier. - ``protocol {unsigned}``: protocol type. +- ``ext``: match IPv6 extend header. + + - ``next {unsigned}``: protocol (next header). + +- ``icmp6``: match ICMPv6 header. + + - ``type {unsgined}``: ICMPv6 packet type. + - ``code {unsigned}``: ICMPv6 packet code. + +- ``ns``: match neighbor solicitation over ICMPv6. + + - ``tgt_addr {ipv6 address}``: target address of neighbor solicitation. + +- ``na``: match neighbor advertisement over ICMPv6. + + - ``tgt_addr {ipv6 address}``: target address of neighbor advertisement. + +- ``sla``: match source link-layer address over neighbor solicitation. + + - ``tgt_addr {ipv6 address}``: target address of neighbor solicitation. + - ``sll_addr {MAC-48}``: source link-layer address over neightbor solicitation. + +- ``tla``: match target link-layer address over neighbor advertisement. + + - ``tgt_addr {ipv6 address}``: target address of neighbor advertisement. + - ``tll_addr {MAC-48}``: target link-layer address over neightbor advertisement. + Actions list ^^^^^^^^^^^^ diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h index 56c733451..2efbfb3c4 100644 --- a/lib/librte_ether/rte_flow.h +++ b/lib/librte_ether/rte_flow.h @@ -323,6 +323,61 @@ enum rte_flow_item_type { * See struct rte_flow_item_geneve. */ RTE_FLOW_ITEM_TYPE_GENEVE, + + /** + * Matches an IPv4 ARP header. + * + * See struct rte_flow_item_arp. + */ + RTE_FLOW_ITEM_TYPE_ARP_IPV4, + + /** + * Matches an IPv6 Extension header with any type. + * + * See struct rte_flow_item_ipv6_ext. + */ + RTE_FLOW_ITEM_TYPE_IPV6_EXT, + + /** + * Matches an ICMPv6 header followed by any message body. + * + * See struct rte_flow_item_icmp6. + */ + RTE_FLOW_ITEM_TYPE_ICMP6, + + /** + * Matches an ICMPv6 header followed by network discovery + * neighbor solicitation. + * + * See struct rte_flow_item_icmp6_nd_ns. + */ + RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS, + + /** + * Matches an ICMPv6 header followed by network discovery + * neighbor advertisement. + * + * See struct rte_flow_item_icmp6_nd_na. + */ + RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA, + + /** + * Matches an ICMPv6 header followed by network discovery neighbor + * solicitation that contains source Ethernet link-layer address + * option. + * + * See struct rte_flow_item_icmp6_nd_opt_sla_eth. + */ + RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH, + + /** + * Matches an ICMPv6 header followed by network discovery neighbor + * advertisement that contains target Ethernet link-layer address + * option. + * + * See struct rte_flow_item_icmp6_nd_opt_tla_eth. + */ + RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH, }; /** @@ -815,6 +870,182 @@ static const struct rte_flow_item_geneve rte_flow_item_geneve_mask = { #endif /** + * RTE_FLOW_ITEM_TYPE_ARP_IPV4 + * + * Matches an IPv4 ARP header. + */ +struct rte_flow_item_arp { + struct arp_hdr hdr; /**< ARP header. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_ARP_IPV4. */ +#ifndef __cplusplus +static const struct rte_flow_item_arp rte_flow_item_arp_mask = { + .hdr = { + .arp_data = { + .arp_sha = { + .addr_bytes = "\xff\xff\xff\xff\xff\xff", + }, + .arp_sip = RTE_BE32(0xffffffff), + .arp_tha = { + .addr_bytes = "\xff\xff\xff\xff\xff\xff", + }, + .arp_tip = RTE_BE32(0xffffffff), + }, + }, +}; +#endif + +/** + * RTE_FLOW_ITEM_TYPE_IPV6_EXT + * + * Matches an IPv6 extension header with any type. + */ +struct rte_flow_item_ipv6_ext { + uint8_t next_hdr; /**< protocol of next header */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_IPV6_EXT. */ +#ifndef __cplusplus +static const +struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask = { + .next_hdr = 0xff, +}; +#endif + +/** + * RTE_FLOW_ITEM_TYPE_ICMP6 + * + * Matches an ICMPv6 header followed by any message body. + */ +struct rte_flow_item_icmp6 { + uint8_t type; /**< ICMPv6 type. */ + uint8_t code; /**< ICMPv6 code. */ + uint16_t checksum; /**< ICMPv6 checksum. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6. */ +#ifndef __cplusplus +static const struct rte_flow_item_icmp6 rte_flow_item_icmp6_mask = { + .type = 0xff, + .code = 0xff, +}; +#endif + +/** + * RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS + * + * Matches an ICMP6 header followed by network discovery + * neighbor solicitation. + */ +struct rte_flow_item_icmp6_nd_ns { + uint8_t type; /**< ICMPv6 type, normally 135. */ + uint8_t code; /**< ICMPv6 code, normally 0. */ + rte_be16_t checksum; /**< ICMPv6 checksum. */ + rte_be32_t reserved; + uint8_t target_addr[16]; /**< Target address. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS */ +#ifndef __cplusplus +static const +struct rte_flow_item_icmp6_nd_ns rte_flow_item_icmp6_nd_ns_mask = { + .target_addr = + "\xff\xff\xff\xff\xff\xff\xff\xff" + "\xff\xff\xff\xff\xff\xff\xff\xff", +}; +#endif + +/** + * RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA + * + * Matches an ICMPv6 header followed by network discovery + * neighbor advertisement. + */ +struct rte_flow_item_icmp6_nd_na { + uint8_t type; /**< ICMPv6 type, normally 136. */ + uint8_t code; /**< ICMPv6 code, normally 0. */ + rte_be16_t checksum; /**< ICMPv6 checksum. */ + /** + * Route flag (1b), solicited flag (1b), override flag (1b), + * reserved (29b). + */ + rte_be32_t rso_reserved; + uint8_t target_addr[16]; /**< Target address. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA. */ +#ifndef __cplusplus +static const +struct rte_flow_item_icmp6_nd_na rte_flow_item_icmp6_nd_na_mask = { + .target_addr = + "\xff\xff\xff\xff\xff\xff\xff\xff" + "\xff\xff\xff\xff\xff\xff\xff\xff", +}; +#endif + +/** + * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH + * + * Matches an ICMPv6 header followed by network discovery neighbor + * solicitation that contains source Ethernet link-layer address option. + */ +struct rte_flow_item_icmp6_nd_opt_sla_eth { + uint8_t type; /**< ICMPv6 type, normally 135. */ + uint8_t code; /**< ICMPv6 code, normally 0. */ + rte_be16_t checksum; /**< ICMPv6 checksum. */ + rte_be32_t reserved; + uint8_t target_addr[16]; /**< Target address. */ + struct ether_addr sll_addr; /**< Source Ethernet link-layer address. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH. */ +#ifndef __cplusplus +static const struct rte_flow_item_icmp6_nd_opt_sla_eth + rte_flow_item_icmp6_nd_opt_sla_eth_mask = { + .target_addr = + "\xff\xff\xff\xff\xff\xff\xff\xff" + "\xff\xff\xff\xff\xff\xff\xff\xff", + .sll_addr = { + .addr_bytes = "\xff\xff\xff\xff\xff\xff", + } +}; +#endif + +/** + * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH + * + * Matches an ICMPv6 header followed by network discovery neighbor + * advertisement that contains target Ethernet link-layer address option. + */ +struct rte_flow_item_icmp6_nd_opt_tla_eth { + uint8_t type; /**< ICMPv6 type, normally 136. */ + uint8_t code; /**< ICMPv6 code, normally 0. */ + rte_be16_t checksum; /**< ICMPv6 checksum. */ + /** + * Route flag (1b), solicited flag (1b), override flag (1b), + * reserved (29b). + */ + rte_be32_t rso_reserved; + uint8_t target_addr[16]; /**< Target address. */ + struct ether_addr tll_addr; /**< Target Ethernet link-layer address. */ + +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH. */ +#ifndef __cplusplus +static const struct rte_flow_item_icmp6_nd_opt_tla_eth + rte_flow_item_icmp6_nd_opt_tla_eth_mask = { + .target_addr = + "\xff\xff\xff\xff\xff\xff\xff\xff" + "\xff\xff\xff\xff\xff\xff\xff\xff", + .tll_addr = { + .addr_bytes = "\xff\xff\xff\xff\xff\xff", + } +}; +#endif + +/** * Matching pattern item definition. * * A pattern is formed by stacking items starting from the lowest protocol