From patchwork Mon Nov 16 07:55:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoyu Min X-Patchwork-Id: 84205 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 75CBAA04DB; Mon, 16 Nov 2020 08:55:46 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 115DEC8D8; Mon, 16 Nov 2020 08:55:30 +0100 (CET) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 3CCF3323E for ; Mon, 16 Nov 2020 08:55:27 +0100 (CET) From: Xiaoyu Min To: Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Cc: dev@dpdk.org, Xiaoyu Min Date: Mon, 16 Nov 2020 15:55:14 +0800 Message-Id: <493405ea9f0f86ef8e0cfa08cab0d5ae764ae8be.1605493464.git.jackmin@nvidia.com> X-Mailer: git-send-email 2.24.0.rc0.3.g12a4aeaad8 In-Reply-To: References: MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 1/5] net/mlx5: fix protocol size for raw encap judgement 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" From: Xiaoyu Min The rte_flow_item_eth and rte_flow_item_vlan items are refined. The structs do not exactly represent the packet bits captured on the wire anymore. Should use real header instead of the whole struct. Replace the rte_flow_item_* with the existing corresponding rte_*_hdr. Fixes: 09315fc83861 ("ethdev: add VLAN attributes to ethernet and VLAN items") Signed-off-by: Xiaoyu Min Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow.c | 12 ++++++------ drivers/net/mlx5/mlx5_flow.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 324349ed19..34b7a2f137 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -3655,8 +3655,8 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, case RTE_FLOW_ACTION_TYPE_RAW_ENCAP: raw_encap = actions->conf; if (raw_encap->size > - (sizeof(struct rte_flow_item_eth) + - sizeof(struct rte_flow_item_ipv4))) + (sizeof(struct rte_ether_hdr) + + sizeof(struct rte_ipv4_hdr))) split++; action_n++; break; @@ -4092,8 +4092,8 @@ flow_hairpin_split(struct rte_eth_dev *dev, case RTE_FLOW_ACTION_TYPE_RAW_ENCAP: raw_encap = actions->conf; if (raw_encap->size > - (sizeof(struct rte_flow_item_eth) + - sizeof(struct rte_flow_item_ipv4))) { + (sizeof(struct rte_ether_hdr) + + sizeof(struct rte_ipv4_hdr))) { memcpy(actions_tx, actions, sizeof(struct rte_flow_action)); actions_tx++; @@ -4107,8 +4107,8 @@ flow_hairpin_split(struct rte_eth_dev *dev, case RTE_FLOW_ACTION_TYPE_RAW_DECAP: raw_decap = actions->conf; if (raw_decap->size < - (sizeof(struct rte_flow_item_eth) + - sizeof(struct rte_flow_item_ipv4))) { + (sizeof(struct rte_ether_hdr) + + sizeof(struct rte_ipv4_hdr))) { memcpy(actions_tx, actions, sizeof(struct rte_flow_action)); actions_tx++; diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 5fac8672fc..3b28c48a1d 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -345,8 +345,8 @@ enum mlx5_feature_name { #define MLX5_GENEVE_OPT_LEN_0 14 #define MLX5_GENEVE_OPT_LEN_1 63 -#define MLX5_ENCAPSULATION_DECISION_SIZE (sizeof(struct rte_flow_item_eth) + \ - sizeof(struct rte_flow_item_ipv4)) +#define MLX5_ENCAPSULATION_DECISION_SIZE (sizeof(struct rte_ether_hdr) + \ + sizeof(struct rte_ipv4_hdr)) /* IPv4 fragment_offset field contains relevant data in bits 2 to 15. */ #define MLX5_IPV4_FRAG_OFFSET_MASK \ From patchwork Mon Nov 16 07:55:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoyu Min X-Patchwork-Id: 84206 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 47B53A04DB; Mon, 16 Nov 2020 08:56:05 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 89500C8E2; Mon, 16 Nov 2020 08:55:33 +0100 (CET) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id CB01BC8BC for ; Mon, 16 Nov 2020 08:55:29 +0100 (CET) From: Xiaoyu Min To: Wisam Jaddo Cc: dev@dpdk.org, Xiaoyu Min Date: Mon, 16 Nov 2020 15:55:15 +0800 Message-Id: X-Mailer: git-send-email 2.24.0.rc0.3.g12a4aeaad8 In-Reply-To: References: MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 2/5] app/flow-perf: fix protocol size for raw encap 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" From: Xiaoyu Min The rte_flow_item_eth and rte_flow_item_vlan items are refined. The structs do not exactly represent the packet bits captured on the wire anymore so add_*_header functions should use real header instead of the using rte_flow_item_* struct. Replace the rte_flow_item_* with the existing corresponding rte_*_hdr. Fixes: 09315fc83861 ("ethdev: add VLAN attributes to ethernet and VLAN items") Signed-off-by: Xiaoyu Min --- app/test-flow-perf/actions_gen.c | 136 +++++++++++++++---------------- 1 file changed, 67 insertions(+), 69 deletions(-) diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c index e3a95d7ab2..ac525f6fdb 100644 --- a/app/test-flow-perf/actions_gen.c +++ b/app/test-flow-perf/actions_gen.c @@ -12,6 +12,8 @@ #include #include #include +#include +#include #include "actions_gen.h" #include "flow_gen.h" @@ -533,27 +535,27 @@ static void add_ether_header(uint8_t **header, uint64_t data, __rte_unused struct additional_para para) { - struct rte_flow_item_eth eth_item; + struct rte_ether_hdr eth_hdr; if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ETH))) return; - memset(ð_item, 0, sizeof(struct rte_flow_item_eth)); + memset(ð_hdr, 0, sizeof(struct rte_ether_hdr)); if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VLAN)) - eth_item.type = RTE_BE16(RTE_ETHER_TYPE_VLAN); + eth_hdr.ether_type = RTE_BE16(RTE_ETHER_TYPE_VLAN); else if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV4)) - eth_item.type = RTE_BE16(RTE_ETHER_TYPE_IPV4); + eth_hdr.ether_type = RTE_BE16(RTE_ETHER_TYPE_IPV4); else if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV6)) - eth_item.type = RTE_BE16(RTE_ETHER_TYPE_IPV6); - memcpy(*header, ð_item, sizeof(eth_item)); - *header += sizeof(eth_item); + eth_hdr.ether_type = RTE_BE16(RTE_ETHER_TYPE_IPV6); + memcpy(*header, ð_hdr, sizeof(eth_hdr)); + *header += sizeof(eth_hdr); } static void add_vlan_header(uint8_t **header, uint64_t data, __rte_unused struct additional_para para) { - struct rte_flow_item_vlan vlan_item; + struct rte_vlan_hdr vlan_hdr; uint16_t vlan_value; if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VLAN))) @@ -561,22 +563,22 @@ add_vlan_header(uint8_t **header, uint64_t data, vlan_value = VLAN_VALUE; - memset(&vlan_item, 0, sizeof(struct rte_flow_item_vlan)); - vlan_item.tci = RTE_BE16(vlan_value); + memset(&vlan_hdr, 0, sizeof(struct rte_vlan_hdr)); + vlan_hdr.vlan_tci = RTE_BE16(vlan_value); if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV4)) - vlan_item.inner_type = RTE_BE16(RTE_ETHER_TYPE_IPV4); + vlan_hdr.eth_proto = RTE_BE16(RTE_ETHER_TYPE_IPV4); if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV6)) - vlan_item.inner_type = RTE_BE16(RTE_ETHER_TYPE_IPV6); - memcpy(*header, &vlan_item, sizeof(vlan_item)); - *header += sizeof(vlan_item); + vlan_hdr.eth_proto = RTE_BE16(RTE_ETHER_TYPE_IPV6); + memcpy(*header, &vlan_hdr, sizeof(vlan_hdr)); + *header += sizeof(vlan_hdr); } static void add_ipv4_header(uint8_t **header, uint64_t data, struct additional_para para) { - struct rte_flow_item_ipv4 ipv4_item; + struct rte_ipv4_hdr ipv4_hdr; uint32_t ip_dst = para.counter; if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV4))) @@ -586,65 +588,64 @@ add_ipv4_header(uint8_t **header, uint64_t data, if (FIXED_VALUES) ip_dst = 1; - memset(&ipv4_item, 0, sizeof(struct rte_flow_item_ipv4)); - ipv4_item.hdr.src_addr = RTE_IPV4(127, 0, 0, 1); - ipv4_item.hdr.dst_addr = RTE_BE32(ip_dst); - ipv4_item.hdr.version_ihl = RTE_IPV4_VHL_DEF; + memset(&ipv4_hdr, 0, sizeof(struct rte_ipv4_hdr)); + ipv4_hdr.src_addr = RTE_IPV4(127, 0, 0, 1); + ipv4_hdr.dst_addr = RTE_BE32(ip_dst); + ipv4_hdr.version_ihl = RTE_IPV4_VHL_DEF; if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_UDP)) - ipv4_item.hdr.next_proto_id = RTE_IP_TYPE_UDP; + ipv4_hdr.next_proto_id = RTE_IP_TYPE_UDP; if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GRE)) - ipv4_item.hdr.next_proto_id = RTE_IP_TYPE_GRE; - memcpy(*header, &ipv4_item, sizeof(ipv4_item)); - *header += sizeof(ipv4_item); + ipv4_hdr.next_proto_id = RTE_IP_TYPE_GRE; + memcpy(*header, &ipv4_hdr, sizeof(ipv4_hdr)); + *header += sizeof(ipv4_hdr); } static void add_ipv6_header(uint8_t **header, uint64_t data, __rte_unused struct additional_para para) { - struct rte_flow_item_ipv6 ipv6_item; + struct rte_ipv6_hdr ipv6_hdr; if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV6))) return; - memset(&ipv6_item, 0, sizeof(struct rte_flow_item_ipv6)); + memset(&ipv6_hdr, 0, sizeof(struct rte_ipv6_hdr)); if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_UDP)) - ipv6_item.hdr.proto = RTE_IP_TYPE_UDP; + ipv6_hdr.proto = RTE_IP_TYPE_UDP; if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GRE)) - ipv6_item.hdr.proto = RTE_IP_TYPE_GRE; - memcpy(*header, &ipv6_item, sizeof(ipv6_item)); - *header += sizeof(ipv6_item); + ipv6_hdr.proto = RTE_IP_TYPE_GRE; + memcpy(*header, &ipv6_hdr, sizeof(ipv6_hdr)); + *header += sizeof(ipv6_hdr); } static void add_udp_header(uint8_t **header, uint64_t data, __rte_unused struct additional_para para) { - struct rte_flow_item_udp udp_item; + struct rte_udp_hdr udp_hdr; if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_UDP))) return; - memset(&udp_item, 0, sizeof(struct rte_flow_item_udp)); + memset(&udp_hdr, 0, sizeof(struct rte_flow_item_udp)); if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN)) - udp_item.hdr.dst_port = RTE_BE16(RTE_VXLAN_DEFAULT_PORT); + udp_hdr.dst_port = RTE_BE16(RTE_VXLAN_DEFAULT_PORT); if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN_GPE)) - udp_item.hdr.dst_port = RTE_BE16(RTE_VXLAN_GPE_UDP_PORT); + udp_hdr.dst_port = RTE_BE16(RTE_VXLAN_GPE_UDP_PORT); if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GENEVE)) - udp_item.hdr.dst_port = RTE_BE16(RTE_GENEVE_UDP_PORT); + udp_hdr.dst_port = RTE_BE16(RTE_GENEVE_UDP_PORT); if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GTP)) - udp_item.hdr.dst_port = RTE_BE16(RTE_GTPU_UDP_PORT); - memcpy(*header, &udp_item, sizeof(udp_item)); - *header += sizeof(udp_item); + udp_hdr.dst_port = RTE_BE16(RTE_GTPU_UDP_PORT); + memcpy(*header, &udp_hdr, sizeof(udp_hdr)); + *header += sizeof(udp_hdr); } static void add_vxlan_header(uint8_t **header, uint64_t data, struct additional_para para) { - struct rte_flow_item_vxlan vxlan_item; + struct rte_vxlan_hdr vxlan_hdr; uint32_t vni_value = para.counter; - uint8_t i; if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN))) return; @@ -653,23 +654,21 @@ add_vxlan_header(uint8_t **header, uint64_t data, if (FIXED_VALUES) vni_value = 1; - memset(&vxlan_item, 0, sizeof(struct rte_flow_item_vxlan)); + memset(&vxlan_hdr, 0, sizeof(struct rte_vxlan_hdr)); - for (i = 0; i < 3; i++) - vxlan_item.vni[2 - i] = vni_value >> (i * 8); - vxlan_item.flags = 0x8; + vxlan_hdr.vx_vni = (RTE_BE32(vni_value)) >> 16; + vxlan_hdr.vx_flags = 0x8; - memcpy(*header, &vxlan_item, sizeof(vxlan_item)); - *header += sizeof(vxlan_item); + memcpy(*header, &vxlan_hdr, sizeof(vxlan_hdr)); + *header += sizeof(vxlan_hdr); } static void add_vxlan_gpe_header(uint8_t **header, uint64_t data, struct additional_para para) { - struct rte_flow_item_vxlan_gpe vxlan_gpe_item; + struct rte_vxlan_gpe_hdr vxlan_gpe_hdr; uint32_t vni_value = para.counter; - uint8_t i; if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN_GPE))) return; @@ -678,38 +677,37 @@ add_vxlan_gpe_header(uint8_t **header, uint64_t data, if (FIXED_VALUES) vni_value = 1; - memset(&vxlan_gpe_item, 0, sizeof(struct rte_flow_item_vxlan_gpe)); + memset(&vxlan_gpe_hdr, 0, sizeof(struct rte_vxlan_gpe_hdr)); - for (i = 0; i < 3; i++) - vxlan_gpe_item.vni[2 - i] = vni_value >> (i * 8); - vxlan_gpe_item.flags = 0x0c; + vxlan_gpe_hdr.vx_vni = (RTE_BE32(vni_value)) >> 16; + vxlan_gpe_hdr.vx_flags = 0x0c; - memcpy(*header, &vxlan_gpe_item, sizeof(vxlan_gpe_item)); - *header += sizeof(vxlan_gpe_item); + memcpy(*header, &vxlan_gpe_hdr, sizeof(vxlan_gpe_hdr)); + *header += sizeof(vxlan_gpe_hdr); } static void add_gre_header(uint8_t **header, uint64_t data, __rte_unused struct additional_para para) { - struct rte_flow_item_gre gre_item; + struct rte_gre_hdr gre_hdr; if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GRE))) return; - memset(&gre_item, 0, sizeof(struct rte_flow_item_gre)); + memset(&gre_hdr, 0, sizeof(struct rte_gre_hdr)); - gre_item.protocol = RTE_BE16(RTE_ETHER_TYPE_TEB); + gre_hdr.proto = RTE_BE16(RTE_ETHER_TYPE_TEB); - memcpy(*header, &gre_item, sizeof(gre_item)); - *header += sizeof(gre_item); + memcpy(*header, &gre_hdr, sizeof(gre_hdr)); + *header += sizeof(gre_hdr); } static void add_geneve_header(uint8_t **header, uint64_t data, struct additional_para para) { - struct rte_flow_item_geneve geneve_item; + struct rte_geneve_hdr geneve_hdr; uint32_t vni_value = para.counter; uint8_t i; @@ -720,20 +718,20 @@ add_geneve_header(uint8_t **header, uint64_t data, if (FIXED_VALUES) vni_value = 1; - memset(&geneve_item, 0, sizeof(struct rte_flow_item_geneve)); + memset(&geneve_hdr, 0, sizeof(struct rte_geneve_hdr)); for (i = 0; i < 3; i++) - geneve_item.vni[2 - i] = vni_value >> (i * 8); + geneve_hdr.vni[2 - i] = vni_value >> (i * 8); - memcpy(*header, &geneve_item, sizeof(geneve_item)); - *header += sizeof(geneve_item); + memcpy(*header, &geneve_hdr, sizeof(geneve_hdr)); + *header += sizeof(geneve_hdr); } static void add_gtp_header(uint8_t **header, uint64_t data, struct additional_para para) { - struct rte_flow_item_gtp gtp_item; + struct rte_gtp_hdr gtp_hdr; uint32_t teid_value = para.counter; if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GTP))) @@ -743,13 +741,13 @@ add_gtp_header(uint8_t **header, uint64_t data, if (FIXED_VALUES) teid_value = 1; - memset(>p_item, 0, sizeof(struct rte_flow_item_gtp)); + memset(>p_hdr, 0, sizeof(struct rte_flow_item_gtp)); - gtp_item.teid = RTE_BE32(teid_value); - gtp_item.msg_type = 255; + gtp_hdr.teid = RTE_BE32(teid_value); + gtp_hdr.msg_type = 255; - memcpy(*header, >p_item, sizeof(gtp_item)); - *header += sizeof(gtp_item); + memcpy(*header, >p_hdr, sizeof(gtp_hdr)); + *header += sizeof(gtp_hdr); } static const struct encap_decap_headers { From patchwork Mon Nov 16 07:55:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoyu Min X-Patchwork-Id: 84207 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3F9B3A04DB; Mon, 16 Nov 2020 08:56:24 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C3D3BC8C6; Mon, 16 Nov 2020 08:55:39 +0100 (CET) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 23C4A2BF1 for ; Mon, 16 Nov 2020 08:55:38 +0100 (CET) From: Xiaoyu Min To: Ajit Khaparde , Somnath Kotur Cc: dev@dpdk.org, Xiaoyu Min Date: Mon, 16 Nov 2020 15:55:16 +0800 Message-Id: <141eb0140301108b1320ecfd93c89e48b02cd546.1605493464.git.jackmin@nvidia.com> X-Mailer: git-send-email 2.24.0.rc0.3.g12a4aeaad8 In-Reply-To: References: MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 3/5] net/bnxt: fix protocol size for VXLAN encap copy 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" From: Xiaoyu Min The rte_flow_item_eth and rte_flow_item_vlan items are refined. The structs do not exactly represent the packet bits captured on the wire anymore so should only copy real header instead of the whole struct. Replace the rte_flow_item_* with the existing corresponding rte_*_hdr. Fixes: 09315fc83861 ("ethdev: add VLAN attributes to ethernet and VLAN items") Signed-off-by: Xiaoyu Min Acked-by: Ajit Khaparde --- drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c index a54c55c5f5..823eeb21b8 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c @@ -3,6 +3,7 @@ * All rights reserved. */ +#include #include "bnxt.h" #include "ulp_template_db_enum.h" #include "ulp_template_struct.h" @@ -1548,7 +1549,7 @@ ulp_rte_vxlan_encap_act_handler(const struct rte_flow_action *action_item, buff = &ap->act_details[BNXT_ULP_ACT_PROP_IDX_ENCAP_VTAG]; ulp_encap_buffer_copy(buff, item->spec, - sizeof(struct rte_flow_item_vlan), + sizeof(struct rte_vlan_hdr), ULP_BUFFER_ALIGN_8_BYTE); if (!ulp_rte_item_skip_void(&item, 1)) @@ -1559,15 +1560,15 @@ ulp_rte_vxlan_encap_act_handler(const struct rte_flow_action *action_item, if (item->type == RTE_FLOW_ITEM_TYPE_VLAN) { vlan_num++; memcpy(&ap->act_details[BNXT_ULP_ACT_PROP_IDX_ENCAP_VTAG + - sizeof(struct rte_flow_item_vlan)], + sizeof(struct rte_vlan_hdr)], item->spec, - sizeof(struct rte_flow_item_vlan)); + sizeof(struct rte_vlan_hdr)); if (!ulp_rte_item_skip_void(&item, 1)) return BNXT_TF_RC_ERROR; } /* Update the vlan count and size of more than one */ if (vlan_num) { - vlan_size = vlan_num * sizeof(struct rte_flow_item_vlan); + vlan_size = vlan_num * sizeof(struct rte_vlan_hdr); vlan_num = tfp_cpu_to_be_32(vlan_num); memcpy(&ap->act_details[BNXT_ULP_ACT_PROP_IDX_ENCAP_VTAG_NUM], &vlan_num, @@ -1726,7 +1727,7 @@ ulp_rte_vxlan_encap_act_handler(const struct rte_flow_action *action_item, BNXT_TF_DBG(ERR, "vxlan encap does not have vni\n"); return BNXT_TF_RC_ERROR; } - vxlan_size = sizeof(struct rte_flow_item_vxlan); + vxlan_size = sizeof(struct rte_vxlan_hdr); /* copy the vxlan details */ memcpy(&vxlan_spec, item->spec, vxlan_size); vxlan_spec.flags = 0x08; From patchwork Mon Nov 16 07:55:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoyu Min X-Patchwork-Id: 84208 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3F33EA04DB; Mon, 16 Nov 2020 08:56:42 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A4662C900; Mon, 16 Nov 2020 08:55:43 +0100 (CET) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id B0F38C8FE for ; Mon, 16 Nov 2020 08:55:40 +0100 (CET) From: Xiaoyu Min To: Jingjing Wu , Beilei Xing Cc: dev@dpdk.org, Xiaoyu Min Date: Mon, 16 Nov 2020 15:55:17 +0800 Message-Id: X-Mailer: git-send-email 2.24.0.rc0.3.g12a4aeaad8 In-Reply-To: References: MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 4/5] net/iavf: fix protocol size for virtchnl copy 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" From: Xiaoyu Min The rte_flow_item_vlan items are refined. The structs do not exactly represent the packet bits captured on the wire anymore so should only copy real header instead of the whole struct. Replace the rte_flow_item_* with the existing corresponding rte_*_hdr. Fixes: 09315fc83861 ("ethdev: add VLAN attributes to ethernet and VLAN items") Signed-off-by: Xiaoyu Min Reviewed-by: Ferruh Yigit Acked-by: Beilei Xing --- drivers/net/iavf/iavf_fdir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/iavf/iavf_fdir.c b/drivers/net/iavf/iavf_fdir.c index d683a468c1..7054bde0b9 100644 --- a/drivers/net/iavf/iavf_fdir.c +++ b/drivers/net/iavf/iavf_fdir.c @@ -541,7 +541,7 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, ETH, ETHERTYPE); rte_memcpy(hdr->buffer, - eth_spec, sizeof(*eth_spec)); + eth_spec, sizeof(struct rte_ether_hdr)); } filter->add_fltr.rule_cfg.proto_hdrs.count = ++layer; From patchwork Mon Nov 16 07:55:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoyu Min X-Patchwork-Id: 84209 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2E7ECA04DB; Mon, 16 Nov 2020 08:56:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EB754C90A; Mon, 16 Nov 2020 08:55:45 +0100 (CET) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 3D445C8FE for ; Mon, 16 Nov 2020 08:55:43 +0100 (CET) From: Xiaoyu Min To: Jasvinder Singh , Cristian Dumitrescu Cc: dev@dpdk.org, Dekel Peled Date: Mon, 16 Nov 2020 15:55:18 +0800 Message-Id: <0bbc7b578dc8ad9348e802e2553de977805f80db.1605493464.git.jackmin@nvidia.com> X-Mailer: git-send-email 2.24.0.rc0.3.g12a4aeaad8 In-Reply-To: References: MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 5/5] net/softnic: update headers size calculation 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" From: Dekel Peled The rte_flow_item_eth and rte_flow_item_vlan items were updated in [1]. The rte_flow_item_ipv6 item was updated in [2]. The structs now contain additional metadata following the header data. The size to use for match should be the header data size only, and not the size of the whole struct. This patch replaces the rte_flow_item_* with the corresponding rte_*_hdr. [1]:commit 09315fc83861 ("ethdev: add VLAN attributes to ethernet and VLAN items") [2]: commit ad976bd40d28 ("ethdev: add extensions attributes to IPv6 item") Signed-off-by: Dekel Peled Acked-by: Jasvinder Singh Tested-by: Zhou, Jun Signed-off-by: Dekel Peled --- drivers/net/softnic/rte_eth_softnic_flow.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/softnic/rte_eth_softnic_flow.c b/drivers/net/softnic/rte_eth_softnic_flow.c index f05ff092fa..7925bad1c0 100644 --- a/drivers/net/softnic/rte_eth_softnic_flow.c +++ b/drivers/net/softnic/rte_eth_softnic_flow.c @@ -169,22 +169,22 @@ flow_item_is_proto(enum rte_flow_item_type type, case RTE_FLOW_ITEM_TYPE_ETH: *mask = &rte_flow_item_eth_mask; - *size = sizeof(struct rte_flow_item_eth); + *size = sizeof(struct rte_ether_hdr); return 1; /* TRUE */ case RTE_FLOW_ITEM_TYPE_VLAN: *mask = &rte_flow_item_vlan_mask; - *size = sizeof(struct rte_flow_item_vlan); + *size = sizeof(struct rte_vlan_hdr); return 1; case RTE_FLOW_ITEM_TYPE_IPV4: *mask = &rte_flow_item_ipv4_mask; - *size = sizeof(struct rte_flow_item_ipv4); + *size = sizeof(struct rte_ipv4_hdr); return 1; case RTE_FLOW_ITEM_TYPE_IPV6: *mask = &rte_flow_item_ipv6_mask; - *size = sizeof(struct rte_flow_item_ipv6); + *size = sizeof(struct rte_ipv6_hdr); return 1; case RTE_FLOW_ITEM_TYPE_ICMP: