From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id BBAF81B1C7 for ; Mon, 16 Apr 2018 08:10:35 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Apr 2018 23:10:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,458,1517904000"; d="scan'208";a="33655037" Received: from dpdk51.sh.intel.com ([10.67.110.184]) by orsmga007.jf.intel.com with ESMTP; 15 Apr 2018 23:10:33 -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 14:10:39 +0800 Message-Id: <20180416061042.785-2-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180416061042.785-1-qi.z.zhang@intel.com> References: <1522279780-34842-1-git-send-email-qi.z.zhang@intel.com> <20180416061042.785-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: , X-List-Received-Date: Mon, 16 Apr 2018 06:10:36 -0000 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 | 224 ++++++++++++++++++++++++++ app/test-pmd/config.c | 9 ++ doc/guides/prog_guide/rte_flow.rst | 88 +++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 34 ++++ lib/librte_ether/rte_flow.h | 235 ++++++++++++++++++++++++++++ 5 files changed, 590 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 59f3b3b57..7950b1b8d 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -150,6 +150,26 @@ enum index { ITEM_GENEVE, ITEM_GENEVE_VNI, ITEM_GENEVE_PROTO, + ITEM_ARP_IPV4, + ITEM_ARP_IPV4_SHA, + ITEM_ARP_IPV4_SIP, + ITEM_ARP_IPV4_THA, + ITEM_ARP_IPV4_TIP, + 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 +456,13 @@ static const enum index next_item[] = { ITEM_GTPC, ITEM_GTPU, ITEM_GENEVE, + ITEM_ARP_IPV4, + 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 +613,47 @@ static const enum index item_geneve[] = { ZERO, }; +static const enum index item_arp_ipv4[] = { + ITEM_ARP_IPV4_SHA, + ITEM_ARP_IPV4_SIP, + ITEM_ARP_IPV4_THA, + ITEM_ARP_IPV4_TIP, + 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 +1541,162 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_geneve, protocol)), }, + [ITEM_ARP_IPV4] = { + .name = "arp", + .help = "match IPv4 ARP header", + .priv = PRIV_ITEM(ARP_IPV4, + sizeof(struct rte_flow_item_arp_ipv4)), + .next = NEXT(item_arp_ipv4), + .call = parse_vc, + }, + [ITEM_ARP_IPV4_SHA] = { + .name = "sha", + .help = "sender hardware address", + .next = NEXT(item_arp_ipv4, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_arp_ipv4, + arp_sha.addr_bytes)), + }, + [ITEM_ARP_IPV4_SIP] = { + .name = "sip", + .help = "sender IP address", + .next = NEXT(item_arp_ipv4, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_arp_ipv4, + arp_sip)), + }, + [ITEM_ARP_IPV4_THA] = { + .name = "tha", + .help = "target hardware address", + .next = NEXT(item_arp_ipv4, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_arp_ipv4, + arp_tha.addr_bytes)), + }, + [ITEM_ARP_IPV4_TIP] = { + .name = "tip", + .help = "target IP address", + .next = NEXT(item_arp_ipv4, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_arp_ipv4, + arp_tip)), + }, + [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..4a1af5c57 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -980,6 +980,15 @@ 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(ARP_IPV4, sizeof(struct rte_flow_item_arp_ipv4)), + 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..99468bf60 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -992,6 +992,94 @@ Matches a GENEVE header. - ``rsvd1``: reserved, normally 0x00. - Default ``mask`` matches VNI only. +Item: ``ARP_IPV4`` +^^^^^^^^^^^^^^^^^^ + +Matches an IPv4 ARP header. + +- ``arp_hdr``: format of hardware address. +- ``arp_pro``: format of protocol address. +- ``arp_hln``: length of hardware address. +- ``arp_pln``: length of protocol address. +- ``arp_op``: ARP opcode. +- ``sha``: sender hardware address. +- ``sip``: sender IP address. +- ``tha``: target hardware address. +- ``tip``: target IP address. +- Default ``mask`` only matches sha, sip, tha, tip. + +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..12d78f10b 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3305,6 +3305,40 @@ This section lists supported pattern items and their attributes, if any. - ``vni {unsigned}``: virtual network identifier. - ``protocol {unsigned}``: protocol type. +- ``arp``: match IPv4 arp header. + + - ``sha``: sender hardware address. + - ``sip``: sender IP address. + - ``tha``: target hardware address. + - ``tip``: target IP address. + +- ``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..f84bbfda5 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_ipv4. + */ + 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,186 @@ 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_ipv4 { + rte_be16_t arp_hrd; /**< format of hardware address. */ + rte_be16_t arp_pro; /**< format of protocol address. */ + uint8_t arp_hln; /**< length of hardware address. */ + uint8_t arp_pln; /**< length of protocol address. */ + rte_be16_t arp_op; /**< ARP opcode */ + struct ether_addr arp_sha; /**< sender hardware address. */ + rte_be32_t arp_sip; /**< sender IP address. */ + struct ether_addr arp_tha; /**< target hardware address. */ + rte_be32_t arp_tip; /**< target IP address. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_ARP_IPV4. */ +#ifndef __cplusplus +static const struct rte_flow_item_arp_ipv4 rte_flow_item_arp_ipv4_mask = { + .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 -- 2.13.6