From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4997CA0544; Tue, 25 Oct 2022 23:45:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EC57B42C5D; Tue, 25 Oct 2022 23:44:54 +0200 (CEST) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by mails.dpdk.org (Postfix) with ESMTP id 6790C42C6C for ; Tue, 25 Oct 2022 23:44:53 +0200 (CEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 256D35C019D; Tue, 25 Oct 2022 17:44:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 25 Oct 2022 17:44:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1666734293; x=1666820693; bh=TL kQJo5C1oSaw6U7fgCSevXbqtcXMQm4khWz7nIIrM4=; b=GYVcWvdHimRIh1ziqT ivsa72bwxlf1xfytxzth9b0bGaLUXYfJxGsFjg1RrOC9uPyTZ5zwkevZu/gj7fjQ y+Nt3QrJLe2VARnILwBdLfoXicHTBe1O22G1i0qrZPCnX7veKN//JpNqui8qVIsN RDLjkYc/aq/F9439auSvfAuEwv0PwajN09qnvkZi1zwfgHEylWMiYFeYjMVBcvLz kTM8tjkkGBOq7DshxYfhVCk9lMrpUTw5PHdlibKp+BmQRNT5UQY4uqCUNsiEDFuY IlyhYBsw1zQJXyCTSli3C33VJGVvLpM2nM75bhpIyg8l4ovvC9J+5szJoNSrYQmz e3Ww== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1666734293; x=1666820693; bh=TLkQJo5C1oSaw 6U7fgCSevXbqtcXMQm4khWz7nIIrM4=; b=cZ4rYbQ9ETl9hd0GcfKnVDQwb/0rR 73dd6PNsdCa0njO6AaDbMeo3kaoecMAksdcgpQ5qquOd9L7Ca5gM4JdeqthtSfHW lFot/omy5xdbetidSrqjggC2RxhuKwLH4DZlwi8KLVxpN8nMB+SzwtPztQDVSv41 s2PdtiXaglo4QzTIdGCNe4936Udwkzr624f5vZ+Kk7hIlc+zw2WlZ3TOOv2rN34F KCW0R4dS+trVRcjmnNV2Nwod1NLWWj/QHy0gqf4yZ1sMhpccGmMZE8u9hGGv9swX mV6hZCW5ByKl9xvEiyuI8tMuD6LjWvGcWUzYKt3bf2s7V2qOHMmZFUUuw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrtddugddtvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdejhfdugeehvddtieejieegteeuudfgjeeukeeiledthfetveek hefhieelhfdtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 25 Oct 2022 17:44:50 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@amd.com, andrew.rybchenko@oktetlabs.ru, Wisam Jaddo , Ori Kam , Aman Singh , Yuying Zhang , Ajit Khaparde , Somnath Kotur , Dongdong Liu , Yisen Zhuang , Beilei Xing , Qiming Yang , Qi Zhang , Rosen Xu , Wenjun Wu , Matan Azrad , Viacheslav Ovsiienko Subject: [PATCH 3/8] ethdev: use VXLAN protocol struct for flow matching Date: Tue, 25 Oct 2022 23:44:05 +0200 Message-Id: <20221025214410.715864-4-thomas@monjalon.net> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221025214410.715864-1-thomas@monjalon.net> References: <20221025214410.715864-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org As announced in the deprecation notice, flow item structures should re-use the protocol header definitions from the directory lib/net/. In the case of VXLAN-GPE, the protocol struct is added in an unnamed union, keeping old field names. The VXLAN headers (including VXLAN-GPE) are used in apps and drivers instead of the redundant fields in the flow items. Signed-off-by: Thomas Monjalon --- app/test-flow-perf/actions_gen.c | 2 +- app/test-flow-perf/items_gen.c | 12 +++---- app/test-pmd/cmdline_flow.c | 10 +++--- doc/guides/prog_guide/rte_flow.rst | 11 ++---- doc/guides/rel_notes/deprecation.rst | 1 - drivers/net/bnxt/bnxt_flow.c | 12 ++++--- drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 42 +++++++++++----------- drivers/net/hns3/hns3_flow.c | 12 +++---- drivers/net/i40e/i40e_flow.c | 4 +-- drivers/net/ice/ice_switch_filter.c | 18 +++++----- drivers/net/ipn3ke/ipn3ke_flow.c | 4 +-- drivers/net/ixgbe/ixgbe_flow.c | 18 +++++----- drivers/net/mlx5/mlx5_flow.c | 16 ++++----- drivers/net/mlx5/mlx5_flow_dv.c | 44 ++++++++++++------------ drivers/net/mlx5/mlx5_flow_verbs.c | 8 ++--- drivers/net/sfc/sfc_flow.c | 6 ++-- drivers/net/sfc/sfc_mae.c | 8 ++--- lib/ethdev/rte_flow.h | 24 +++++++++---- 18 files changed, 128 insertions(+), 124 deletions(-) diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c index 63f05d87fa..f1d5931325 100644 --- a/app/test-flow-perf/actions_gen.c +++ b/app/test-flow-perf/actions_gen.c @@ -874,7 +874,7 @@ add_vxlan_encap(struct rte_flow_action *actions, items[2].type = RTE_FLOW_ITEM_TYPE_UDP; - item_vxlan.vni[2] = 1; + item_vxlan.hdr.vni[2] = 1; items[3].spec = &item_vxlan; items[3].mask = &item_vxlan; items[3].type = RTE_FLOW_ITEM_TYPE_VXLAN; diff --git a/app/test-flow-perf/items_gen.c b/app/test-flow-perf/items_gen.c index b7f51030a1..a58245239b 100644 --- a/app/test-flow-perf/items_gen.c +++ b/app/test-flow-perf/items_gen.c @@ -128,12 +128,12 @@ add_vxlan(struct rte_flow_item *items, /* Set standard vxlan vni */ for (i = 0; i < 3; i++) { - vxlan_specs[ti].vni[2 - i] = vni_value >> (i * 8); - vxlan_masks[ti].vni[2 - i] = 0xff; + vxlan_specs[ti].hdr.vni[2 - i] = vni_value >> (i * 8); + vxlan_masks[ti].hdr.vni[2 - i] = 0xff; } /* Standard vxlan flags */ - vxlan_specs[ti].flags = 0x8; + vxlan_specs[ti].hdr.flags = 0x8; items[items_counter].type = RTE_FLOW_ITEM_TYPE_VXLAN; items[items_counter].spec = &vxlan_specs[ti]; @@ -155,12 +155,12 @@ add_vxlan_gpe(struct rte_flow_item *items, /* Set vxlan-gpe vni */ for (i = 0; i < 3; i++) { - vxlan_gpe_specs[ti].vni[2 - i] = vni_value >> (i * 8); - vxlan_gpe_masks[ti].vni[2 - i] = 0xff; + vxlan_gpe_specs[ti].hdr.vni[2 - i] = vni_value >> (i * 8); + vxlan_gpe_masks[ti].hdr.vni[2 - i] = 0xff; } /* vxlan-gpe flags */ - vxlan_gpe_specs[ti].flags = 0x0c; + vxlan_gpe_specs[ti].hdr.flags = 0x0c; items[items_counter].type = RTE_FLOW_ITEM_TYPE_VXLAN_GPE; items[items_counter].spec = &vxlan_gpe_specs[ti]; diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 68fb4b3fe4..fcbd0a2534 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -3950,7 +3950,7 @@ static const struct token token_list[] = { .help = "VXLAN identifier", .next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED), item_param), - .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, vni)), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, hdr.vni)), }, [ITEM_VXLAN_LAST_RSVD] = { .name = "last_rsvd", @@ -3958,7 +3958,7 @@ static const struct token token_list[] = { .next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED), item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, - rsvd1)), + hdr.rsvd1)), }, [ITEM_E_TAG] = { .name = "e_tag", @@ -4176,7 +4176,7 @@ static const struct token token_list[] = { .next = NEXT(item_vxlan_gpe, NEXT_ENTRY(COMMON_UNSIGNED), item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan_gpe, - vni)), + hdr.vni)), }, [ITEM_ARP_ETH_IPV4] = { .name = "arp_eth_ipv4", @@ -7415,7 +7415,7 @@ parse_setup_vxlan_encap_data(struct action_vxlan_encap_data *action_vxlan_encap_ .src_port = vxlan_encap_conf.udp_src, .dst_port = vxlan_encap_conf.udp_dst, }, - .item_vxlan.flags = 0, + .item_vxlan.hdr.flags = 0, }; memcpy(action_vxlan_encap_data->item_eth.hdr.dst_addr.addr_bytes, vxlan_encap_conf.eth_dst, RTE_ETHER_ADDR_LEN); @@ -7469,7 +7469,7 @@ parse_setup_vxlan_encap_data(struct action_vxlan_encap_data *action_vxlan_encap_ &ipv6_mask_tos; } } - memcpy(action_vxlan_encap_data->item_vxlan.vni, vxlan_encap_conf.vni, + memcpy(action_vxlan_encap_data->item_vxlan.hdr.vni, vxlan_encap_conf.vni, RTE_DIM(vxlan_encap_conf.vni)); return 0; } diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 4323681b86..92d3168d39 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -935,10 +935,7 @@ Item: ``VXLAN`` Matches a VXLAN header (RFC 7348). -- ``flags``: normally 0x08 (I flag). -- ``rsvd0``: reserved, normally 0x000000. -- ``vni``: VXLAN network identifier. -- ``rsvd1``: reserved, normally 0x00. +- ``hdr``: header definition (``rte_vxlan.h``). - Default ``mask`` matches VNI only. Item: ``E_TAG`` @@ -1104,11 +1101,7 @@ Item: ``VXLAN-GPE`` Matches a VXLAN-GPE header (draft-ietf-nvo3-vxlan-gpe-05). -- ``flags``: normally 0x0C (I and P flags). -- ``rsvd0``: reserved, normally 0x0000. -- ``protocol``: protocol type. -- ``vni``: VXLAN network identifier. -- ``rsvd1``: reserved, normally 0x00. +- ``hdr``: header definition (``rte_vxlan.h``). - Default ``mask`` matches VNI only. Item: ``ARP_ETH_IPV4`` diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 368b857e20..52c43bb652 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -87,7 +87,6 @@ Deprecation Notices - ``rte_flow_item_pfcp`` - ``rte_flow_item_pppoe`` - ``rte_flow_item_pppoe_proto_id`` - - ``rte_flow_item_vxlan_gpe`` * ethdev: Queue specific stats fields will be removed from ``struct rte_eth_stats``. Mentioned fields are: ``q_ipackets``, ``q_opackets``, ``q_ibytes``, ``q_obytes``, diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index 8f66049340..4a107e81e9 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -563,9 +563,11 @@ bnxt_validate_and_parse_flow_type(const struct rte_flow_attr *attr, break; } - if (vxlan_spec->rsvd1 || vxlan_spec->rsvd0[0] || - vxlan_spec->rsvd0[1] || vxlan_spec->rsvd0[2] || - vxlan_spec->flags != 0x8) { + if ((vxlan_spec->hdr.rsvd0[0] != 0) || + (vxlan_spec->hdr.rsvd0[1] != 0) || + (vxlan_spec->hdr.rsvd0[2] != 0) || + (vxlan_spec->hdr.rsvd1 != 0) || + (vxlan_spec->hdr.flags != 8)) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -577,7 +579,7 @@ bnxt_validate_and_parse_flow_type(const struct rte_flow_attr *attr, /* Check if VNI is masked. */ if (vxlan_mask != NULL) { vni_masked = - !!memcmp(vxlan_mask->vni, vni_mask, + !!memcmp(vxlan_mask->hdr.vni, vni_mask, RTE_DIM(vni_mask)); if (vni_masked) { rte_flow_error_set @@ -590,7 +592,7 @@ bnxt_validate_and_parse_flow_type(const struct rte_flow_attr *attr, } rte_memcpy(((uint8_t *)&tenant_id_be + 1), - vxlan_spec->vni, 3); + vxlan_spec->hdr.vni, 3); filter->vni = rte_be_to_cpu_32(tenant_id_be); filter->tunnel_type = diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c index 2928598ced..80869b79c3 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c @@ -1414,28 +1414,28 @@ ulp_rte_vxlan_hdr_handler(const struct rte_flow_item *item, * Copy the rte_flow_item for vxlan into hdr_field using vxlan * header fields */ - size = sizeof(((struct rte_flow_item_vxlan *)NULL)->flags); + size = sizeof(((struct rte_flow_item_vxlan *)NULL)->hdr.flags); ulp_rte_prsr_fld_mask(params, &idx, size, - ulp_deference_struct(vxlan_spec, flags), - ulp_deference_struct(vxlan_mask, flags), + ulp_deference_struct(vxlan_spec, hdr.flags), + ulp_deference_struct(vxlan_mask, hdr.flags), ULP_PRSR_ACT_DEFAULT); - size = sizeof(((struct rte_flow_item_vxlan *)NULL)->rsvd0); + size = sizeof(((struct rte_flow_item_vxlan *)NULL)->hdr.rsvd0); ulp_rte_prsr_fld_mask(params, &idx, size, - ulp_deference_struct(vxlan_spec, rsvd0), - ulp_deference_struct(vxlan_mask, rsvd0), + ulp_deference_struct(vxlan_spec, hdr.rsvd0), + ulp_deference_struct(vxlan_mask, hdr.rsvd0), ULP_PRSR_ACT_DEFAULT); - size = sizeof(((struct rte_flow_item_vxlan *)NULL)->vni); + size = sizeof(((struct rte_flow_item_vxlan *)NULL)->hdr.vni); ulp_rte_prsr_fld_mask(params, &idx, size, - ulp_deference_struct(vxlan_spec, vni), - ulp_deference_struct(vxlan_mask, vni), + ulp_deference_struct(vxlan_spec, hdr.vni), + ulp_deference_struct(vxlan_mask, hdr.vni), ULP_PRSR_ACT_DEFAULT); - size = sizeof(((struct rte_flow_item_vxlan *)NULL)->rsvd1); + size = sizeof(((struct rte_flow_item_vxlan *)NULL)->hdr.rsvd1); ulp_rte_prsr_fld_mask(params, &idx, size, - ulp_deference_struct(vxlan_spec, rsvd1), - ulp_deference_struct(vxlan_mask, rsvd1), + ulp_deference_struct(vxlan_spec, hdr.rsvd1), + ulp_deference_struct(vxlan_mask, hdr.rsvd1), ULP_PRSR_ACT_DEFAULT); /* Update the hdr_bitmap with vxlan */ @@ -1827,17 +1827,17 @@ ulp_rte_enc_vxlan_hdr_handler(struct ulp_rte_parser_params *params, uint32_t size; field = ¶ms->enc_field[BNXT_ULP_ENC_FIELD_VXLAN_FLAGS]; - size = sizeof(vxlan_spec->flags); - field = ulp_rte_parser_fld_copy(field, &vxlan_spec->flags, size); + size = sizeof(vxlan_spec->hdr.flags); + field = ulp_rte_parser_fld_copy(field, &vxlan_spec->hdr.flags, size); - size = sizeof(vxlan_spec->rsvd0); - field = ulp_rte_parser_fld_copy(field, &vxlan_spec->rsvd0, size); + size = sizeof(vxlan_spec->hdr.rsvd0); + field = ulp_rte_parser_fld_copy(field, &vxlan_spec->hdr.rsvd0, size); - size = sizeof(vxlan_spec->vni); - field = ulp_rte_parser_fld_copy(field, &vxlan_spec->vni, size); + size = sizeof(vxlan_spec->hdr.vni); + field = ulp_rte_parser_fld_copy(field, &vxlan_spec->hdr.vni, size); - size = sizeof(vxlan_spec->rsvd1); - field = ulp_rte_parser_fld_copy(field, &vxlan_spec->rsvd1, size); + size = sizeof(vxlan_spec->hdr.rsvd1); + field = ulp_rte_parser_fld_copy(field, &vxlan_spec->hdr.rsvd1, size); ULP_BITMAP_SET(params->enc_hdr_bitmap.bits, BNXT_ULP_HDR_BIT_T_VXLAN); } @@ -1989,7 +1989,7 @@ ulp_rte_vxlan_encap_act_handler(const struct rte_flow_action *action_item, vxlan_size = sizeof(struct rte_flow_item_vxlan); /* copy the vxlan details */ memcpy(&vxlan_spec, item->spec, vxlan_size); - vxlan_spec.flags = 0x08; + vxlan_spec.hdr.flags = 0x08; vxlan_size = tfp_cpu_to_be_32(vxlan_size); memcpy(&ap->act_details[BNXT_ULP_ACT_PROP_IDX_ENCAP_TUN_SZ], &vxlan_size, sizeof(uint32_t)); diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index ef1832982d..e88f9b7e45 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -933,23 +933,23 @@ hns3_parse_vxlan(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, vxlan_mask = item->mask; vxlan_spec = item->spec; - if (vxlan_mask->flags) + if (vxlan_mask->hdr.flags) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_MASK, item, "Flags is not supported in VxLAN"); /* VNI must be totally masked or not. */ - if (memcmp(vxlan_mask->vni, full_mask, VNI_OR_TNI_LEN) && - memcmp(vxlan_mask->vni, zero_mask, VNI_OR_TNI_LEN)) + if (memcmp(vxlan_mask->hdr.vni, full_mask, VNI_OR_TNI_LEN) && + memcmp(vxlan_mask->hdr.vni, zero_mask, VNI_OR_TNI_LEN)) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_MASK, item, "VNI must be totally masked or not in VxLAN"); - if (vxlan_mask->vni[0]) { + if (vxlan_mask->hdr.vni[0]) { hns3_set_bit(rule->input_set, OUTER_TUN_VNI, 1); - memcpy(rule->key_conf.mask.outer_tun_vni, vxlan_mask->vni, + memcpy(rule->key_conf.mask.outer_tun_vni, vxlan_mask->hdr.vni, VNI_OR_TNI_LEN); } - memcpy(rule->key_conf.spec.outer_tun_vni, vxlan_spec->vni, + memcpy(rule->key_conf.spec.outer_tun_vni, vxlan_spec->hdr.vni, VNI_OR_TNI_LEN); return 0; } diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 0acbd5a061..2855b14fe6 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -3009,7 +3009,7 @@ i40e_flow_parse_vxlan_pattern(__rte_unused struct rte_eth_dev *dev, /* Check if VNI is masked. */ if (vxlan_spec && vxlan_mask) { is_vni_masked = - !!memcmp(vxlan_mask->vni, vni_mask, + !!memcmp(vxlan_mask->hdr.vni, vni_mask, RTE_DIM(vni_mask)); if (is_vni_masked) { rte_flow_error_set(error, EINVAL, @@ -3020,7 +3020,7 @@ i40e_flow_parse_vxlan_pattern(__rte_unused struct rte_eth_dev *dev, } rte_memcpy(((uint8_t *)&tenant_id_be + 1), - vxlan_spec->vni, 3); + vxlan_spec->hdr.vni, 3); filter->tenant_id = rte_be_to_cpu_32(tenant_id_be); filter_type |= RTE_ETH_TUNNEL_FILTER_TENID; diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index d84061340e..7cb20fa0b4 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -990,17 +990,17 @@ ice_switch_parse_pattern(const struct rte_flow_item pattern[], input = &inner_input_set; if (vxlan_spec && vxlan_mask) { list[t].type = ICE_VXLAN; - if (vxlan_mask->vni[0] || - vxlan_mask->vni[1] || - vxlan_mask->vni[2]) { + if (vxlan_mask->hdr.vni[0] || + vxlan_mask->hdr.vni[1] || + vxlan_mask->hdr.vni[2]) { list[t].h_u.tnl_hdr.vni = - (vxlan_spec->vni[2] << 16) | - (vxlan_spec->vni[1] << 8) | - vxlan_spec->vni[0]; + (vxlan_spec->hdr.vni[2] << 16) | + (vxlan_spec->hdr.vni[1] << 8) | + vxlan_spec->hdr.vni[0]; list[t].m_u.tnl_hdr.vni = - (vxlan_mask->vni[2] << 16) | - (vxlan_mask->vni[1] << 8) | - vxlan_mask->vni[0]; + (vxlan_mask->hdr.vni[2] << 16) | + (vxlan_mask->hdr.vni[1] << 8) | + vxlan_mask->hdr.vni[0]; *input |= ICE_INSET_VXLAN_VNI; input_set_byte += 2; } diff --git a/drivers/net/ipn3ke/ipn3ke_flow.c b/drivers/net/ipn3ke/ipn3ke_flow.c index ee56d0f43d..d20a29b9a2 100644 --- a/drivers/net/ipn3ke/ipn3ke_flow.c +++ b/drivers/net/ipn3ke/ipn3ke_flow.c @@ -108,7 +108,7 @@ ipn3ke_pattern_vxlan(const struct rte_flow_item patterns[], case RTE_FLOW_ITEM_TYPE_VXLAN: vxlan = item->spec; - rte_memcpy(&parser->key[6], vxlan->vni, 3); + rte_memcpy(&parser->key[6], vxlan->hdr.vni, 3); break; default: @@ -576,7 +576,7 @@ ipn3ke_pattern_vxlan_ip_udp(const struct rte_flow_item patterns[], case RTE_FLOW_ITEM_TYPE_VXLAN: vxlan = item->spec; - rte_memcpy(&parser->key[0], vxlan->vni, 3); + rte_memcpy(&parser->key[0], vxlan->hdr.vni, 3); break; case RTE_FLOW_ITEM_TYPE_IPV4: diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c index 6bcd4f7126..1cbebc9a3e 100644 --- a/drivers/net/ixgbe/ixgbe_flow.c +++ b/drivers/net/ixgbe/ixgbe_flow.c @@ -2481,7 +2481,7 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr, rule->mask.tunnel_type_mask = 1; vxlan_mask = item->mask; - if (vxlan_mask->flags) { + if (vxlan_mask->hdr.flags) { memset(rule, 0, sizeof(struct ixgbe_fdir_rule)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -2489,11 +2489,11 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr, return -rte_errno; } /* VNI must be totally masked or not. */ - if ((vxlan_mask->vni[0] || vxlan_mask->vni[1] || - vxlan_mask->vni[2]) && - ((vxlan_mask->vni[0] != 0xFF) || - (vxlan_mask->vni[1] != 0xFF) || - (vxlan_mask->vni[2] != 0xFF))) { + if ((vxlan_mask->hdr.vni[0] || vxlan_mask->hdr.vni[1] || + vxlan_mask->hdr.vni[2]) && + ((vxlan_mask->hdr.vni[0] != 0xFF) || + (vxlan_mask->hdr.vni[1] != 0xFF) || + (vxlan_mask->hdr.vni[2] != 0xFF))) { memset(rule, 0, sizeof(struct ixgbe_fdir_rule)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -2501,15 +2501,15 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr, return -rte_errno; } - rte_memcpy(&rule->mask.tunnel_id_mask, vxlan_mask->vni, - RTE_DIM(vxlan_mask->vni)); + rte_memcpy(&rule->mask.tunnel_id_mask, vxlan_mask->hdr.vni, + RTE_DIM(vxlan_mask->hdr.vni)); if (item->spec) { rule->b_spec = TRUE; vxlan_spec = item->spec; rte_memcpy(((uint8_t *) &rule->ixgbe_fdir.formatted.tni_vni), - vxlan_spec->vni, RTE_DIM(vxlan_spec->vni)); + vxlan_spec->hdr.vni, RTE_DIM(vxlan_spec->hdr.vni)); } } diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 0f88fa41d9..10f6abeb07 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -308,7 +308,7 @@ mlx5_flow_expand_rss_item_complete(const struct rte_flow_item *item) ret = mlx5_ethertype_to_item_type(spec, mask, true); break; case RTE_FLOW_ITEM_TYPE_VXLAN_GPE: - MLX5_XSET_ITEM_MASK_SPEC(vxlan_gpe, protocol); + MLX5_XSET_ITEM_MASK_SPEC(vxlan_gpe, hdr.proto); ret = mlx5_nsh_proto_to_item_type(spec, mask); break; default: @@ -2816,8 +2816,8 @@ mlx5_flow_validate_item_vxlan(struct rte_eth_dev *dev, uint8_t vni[4]; } id = { .vlan_id = 0, }; const struct rte_flow_item_vxlan nic_mask = { - .vni = "\xff\xff\xff", - .rsvd1 = 0xff, + .hdr.vni = "\xff\xff\xff", + .hdr.rsvd1 = 0xff, }; const struct rte_flow_item_vxlan *valid_mask; @@ -2857,8 +2857,8 @@ mlx5_flow_validate_item_vxlan(struct rte_eth_dev *dev, if (ret < 0) return ret; if (spec) { - memcpy(&id.vni[1], spec->vni, 3); - memcpy(&id.vni[1], mask->vni, 3); + memcpy(&id.vni[1], spec->hdr.vni, 3); + memcpy(&id.vni[1], mask->hdr.vni, 3); } if (!(item_flags & MLX5_FLOW_LAYER_OUTER)) return rte_flow_error_set(error, ENOTSUP, @@ -2928,14 +2928,14 @@ mlx5_flow_validate_item_vxlan_gpe(const struct rte_flow_item *item, if (ret < 0) return ret; if (spec) { - if (spec->protocol) + if (spec->hdr.proto) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "VxLAN-GPE protocol" " not supported"); - memcpy(&id.vni[1], spec->vni, 3); - memcpy(&id.vni[1], mask->vni, 3); + memcpy(&id.vni[1], spec->hdr.vni, 3); + memcpy(&id.vni[1], mask->hdr.vni, 3); } if (!(item_flags & MLX5_FLOW_LAYER_OUTER)) return rte_flow_error_set(error, ENOTSUP, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 4987631e79..a06b6e1860 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -9244,8 +9244,8 @@ flow_dv_translate_item_vxlan(struct rte_eth_dev *dev, uint16_t dport; struct mlx5_priv *priv = dev->data->dev_private; const struct rte_flow_item_vxlan nic_mask = { - .vni = "\xff\xff\xff", - .rsvd1 = 0xff, + .hdr.vni = "\xff\xff\xff", + .hdr.rsvd1 = 0xff, }; if (inner) { @@ -9287,12 +9287,12 @@ flow_dv_translate_item_vxlan(struct rte_eth_dev *dev, misc_m = MLX5_ADDR_OF(fte_match_param, matcher, misc_parameters); misc_v = MLX5_ADDR_OF(fte_match_param, key, misc_parameters); - size = sizeof(vxlan_m->vni); + size = sizeof(vxlan_m->hdr.vni); vni_m = MLX5_ADDR_OF(fte_match_set_misc, misc_m, vxlan_vni); vni_v = MLX5_ADDR_OF(fte_match_set_misc, misc_v, vxlan_vni); - memcpy(vni_m, vxlan_m->vni, size); + memcpy(vni_m, vxlan_m->hdr.vni, size); for (i = 0; i < size; ++i) - vni_v[i] = vni_m[i] & vxlan_v->vni[i]; + vni_v[i] = vni_m[i] & vxlan_v->hdr.vni[i]; return; } misc5_m = MLX5_ADDR_OF(fte_match_param, matcher, misc_parameters_5); @@ -9303,18 +9303,18 @@ flow_dv_translate_item_vxlan(struct rte_eth_dev *dev, tunnel_header_m = (uint32_t *)MLX5_ADDR_OF(fte_match_set_misc5, misc5_m, tunnel_header_1); - *tunnel_header_v = (vxlan_v->vni[0] & vxlan_m->vni[0]) | - (vxlan_v->vni[1] & vxlan_m->vni[1]) << 8 | - (vxlan_v->vni[2] & vxlan_m->vni[2]) << 16; + *tunnel_header_v = (vxlan_v->hdr.vni[0] & vxlan_m->hdr.vni[0]) | + (vxlan_v->hdr.vni[1] & vxlan_m->hdr.vni[1]) << 8 | + (vxlan_v->hdr.vni[2] & vxlan_m->hdr.vni[2]) << 16; if (*tunnel_header_v) - *tunnel_header_m = vxlan_m->vni[0] | - vxlan_m->vni[1] << 8 | - vxlan_m->vni[2] << 16; + *tunnel_header_m = vxlan_m->hdr.vni[0] | + vxlan_m->hdr.vni[1] << 8 | + vxlan_m->hdr.vni[2] << 16; else *tunnel_header_m = 0x0; - *tunnel_header_v |= (vxlan_v->rsvd1 & vxlan_m->rsvd1) << 24; - if (vxlan_v->rsvd1 & vxlan_m->rsvd1) - *tunnel_header_m |= vxlan_m->rsvd1 << 24; + *tunnel_header_v |= (vxlan_v->hdr.rsvd1 & vxlan_m->hdr.rsvd1) << 24; + if (vxlan_v->hdr.rsvd1 & vxlan_m->hdr.rsvd1) + *tunnel_header_m |= vxlan_m->hdr.rsvd1 << 24; } /** @@ -9349,7 +9349,7 @@ flow_dv_translate_item_vxlan_gpe(void *matcher, void *key, MLX5_ADDR_OF(fte_match_set_misc3, misc_m, outer_vxlan_gpe_vni); char *vni_v = MLX5_ADDR_OF(fte_match_set_misc3, misc_v, outer_vxlan_gpe_vni); - int i, size = sizeof(vxlan_m->vni); + int i, size = sizeof(vxlan_m->hdr.vni); uint8_t flags_m = 0xff; uint8_t flags_v = 0xc; uint8_t m_protocol, v_protocol; @@ -9366,17 +9366,17 @@ flow_dv_translate_item_vxlan_gpe(void *matcher, void *key, if (!vxlan_m) vxlan_m = &rte_flow_item_vxlan_gpe_mask; } - memcpy(vni_m, vxlan_m->vni, size); + memcpy(vni_m, vxlan_m->hdr.vni, size); for (i = 0; i < size; ++i) - vni_v[i] = vni_m[i] & vxlan_v->vni[i]; - if (vxlan_m->flags) { - flags_m = vxlan_m->flags; - flags_v = vxlan_v->flags; + vni_v[i] = vni_m[i] & vxlan_v->hdr.vni[i]; + if (vxlan_m->hdr.flags) { + flags_m = vxlan_m->hdr.flags; + flags_v = vxlan_v->hdr.flags; } MLX5_SET(fte_match_set_misc3, misc_m, outer_vxlan_gpe_flags, flags_m); MLX5_SET(fte_match_set_misc3, misc_v, outer_vxlan_gpe_flags, flags_v); - m_protocol = vxlan_m->protocol; - v_protocol = vxlan_v->protocol; + m_protocol = vxlan_m->hdr.proto; + v_protocol = vxlan_v->hdr.proto; if (!m_protocol) { /* Force next protocol to ensure next headers parsing. */ if (pattern_flags & MLX5_FLOW_LAYER_INNER_L2) diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index a8b84a2119..facab1b313 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -778,9 +778,9 @@ flow_verbs_translate_item_vxlan(struct mlx5_flow *dev_flow, if (!mask) mask = &rte_flow_item_vxlan_mask; if (spec) { - memcpy(&id.vni[1], spec->vni, 3); + memcpy(&id.vni[1], spec->hdr.vni, 3); vxlan.val.tunnel_id = id.vlan_id; - memcpy(&id.vni[1], mask->vni, 3); + memcpy(&id.vni[1], mask->hdr.vni, 3); vxlan.mask.tunnel_id = id.vlan_id; /* Remove unwanted bits from values. */ vxlan.val.tunnel_id &= vxlan.mask.tunnel_id; @@ -820,9 +820,9 @@ flow_verbs_translate_item_vxlan_gpe(struct mlx5_flow *dev_flow, if (!mask) mask = &rte_flow_item_vxlan_gpe_mask; if (spec) { - memcpy(&id.vni[1], spec->vni, 3); + memcpy(&id.vni[1], spec->hdr.vni, 3); vxlan_gpe.val.tunnel_id = id.vlan_id; - memcpy(&id.vni[1], mask->vni, 3); + memcpy(&id.vni[1], mask->hdr.vni, 3); vxlan_gpe.mask.tunnel_id = id.vlan_id; /* Remove unwanted bits from values. */ vxlan_gpe.val.tunnel_id &= vxlan_gpe.mask.tunnel_id; diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index f098edc6eb..fe1f5ba55f 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -921,7 +921,7 @@ sfc_flow_parse_vxlan(const struct rte_flow_item *item, const struct rte_flow_item_vxlan *spec = NULL; const struct rte_flow_item_vxlan *mask = NULL; const struct rte_flow_item_vxlan supp_mask = { - .vni = { 0xff, 0xff, 0xff } + .hdr.vni = { 0xff, 0xff, 0xff } }; rc = sfc_flow_parse_init(item, @@ -945,8 +945,8 @@ sfc_flow_parse_vxlan(const struct rte_flow_item *item, if (spec == NULL) return 0; - rc = sfc_flow_set_efx_spec_vni_or_vsid(efx_spec, spec->vni, - mask->vni, item, error); + rc = sfc_flow_set_efx_spec_vni_or_vsid(efx_spec, spec->hdr.vni, + mask->hdr.vni, item, error); return rc; } diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index 710d04be13..aab697b204 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -2223,8 +2223,8 @@ static const struct sfc_mae_field_locator flocs_tunnel[] = { * The size and offset values are relevant * for Geneve and NVGRE, too. */ - .size = RTE_SIZEOF_FIELD(struct rte_flow_item_vxlan, vni), - .ofst = offsetof(struct rte_flow_item_vxlan, vni), + .size = RTE_SIZEOF_FIELD(struct rte_flow_item_vxlan, hdr.vni), + .ofst = offsetof(struct rte_flow_item_vxlan, hdr.vni), }, }; @@ -2359,10 +2359,10 @@ sfc_mae_rule_parse_item_tunnel(const struct rte_flow_item *item, * The extra byte is 0 both in the mask and in the value. */ vxp = (const struct rte_flow_item_vxlan *)spec; - memcpy(vnet_id_v + 1, &vxp->vni, sizeof(vxp->vni)); + memcpy(vnet_id_v + 1, &vxp->hdr.vni, sizeof(vxp->hdr.vni)); vxp = (const struct rte_flow_item_vxlan *)mask; - memcpy(vnet_id_m + 1, &vxp->vni, sizeof(vxp->vni)); + memcpy(vnet_id_m + 1, &vxp->hdr.vni, sizeof(vxp->hdr.vni)); rc = efx_mae_match_spec_field_set(ctx_mae->match_spec, EFX_MAE_FIELD_ENC_VNET_ID_BE, diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index cddbe74c33..6045a352ae 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -987,7 +987,7 @@ struct rte_flow_item_vxlan { /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN. */ #ifndef __cplusplus static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = { - .hdr.vx_vni = RTE_BE32(0xffffff00), /* (0xffffff << 8) */ + .hdr.vni = "\xff\xff\xff", }; #endif @@ -1204,18 +1204,28 @@ static const struct rte_flow_item_geneve rte_flow_item_geneve_mask = { * * Matches a VXLAN-GPE header. */ +RTE_STD_C11 struct rte_flow_item_vxlan_gpe { - uint8_t flags; /**< Normally 0x0c (I and P flags). */ - uint8_t rsvd0[2]; /**< Reserved, normally 0x0000. */ - uint8_t protocol; /**< Protocol type. */ - uint8_t vni[3]; /**< VXLAN identifier. */ - uint8_t rsvd1; /**< Reserved, normally 0x00. */ + union { + struct { + /* + * These are old fields kept for compatibility. + * Please prefer hdr field below. + */ + uint8_t flags; /**< Normally 0x0c (I and P flags). */ + uint8_t rsvd0[2]; /**< Reserved, normally 0x0000. */ + uint8_t protocol; /**< Protocol type. */ + uint8_t vni[3]; /**< VXLAN identifier. */ + uint8_t rsvd1; /**< Reserved, normally 0x00. */ + }; + struct rte_vxlan_gpe_hdr hdr; + }; }; /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN_GPE. */ #ifndef __cplusplus static const struct rte_flow_item_vxlan_gpe rte_flow_item_vxlan_gpe_mask = { - .vni = "\xff\xff\xff", + .hdr.vni = "\xff\xff\xff", }; #endif -- 2.36.1