From patchwork Wed Feb 21 21:20:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 136986 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DF2DB43B67; Wed, 21 Feb 2024 22:22:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C687940E32; Wed, 21 Feb 2024 22:21:19 +0100 (CET) Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.44]) by mails.dpdk.org (Postfix) with ESMTP id 48B5740E32 for ; Wed, 21 Feb 2024 22:21:16 +0100 (CET) Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-6e2dfc98664so583837a34.2 for ; Wed, 21 Feb 2024 13:21:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1708550475; x=1709155275; darn=dpdk.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=zwaglXelMh5fuYzV4JeyqTiD59nJfCLp8vk2iun6Njg=; b=B+Am4kV+g13NTOLhyR1lqFWYxLcUQq/wUhV8rYQ+QQVwNQzoPs/nfkPYDi+3e8gbOH R6YospMmf31X0o7LwQ0P5bIfxONxxHClw9sxMNZugEBL+rGe6q4olZRrB43XZaudmRi8 VpxkhGQTITXJVISOk/kG4p5/7APyinH0VJ6Kc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708550475; x=1709155275; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zwaglXelMh5fuYzV4JeyqTiD59nJfCLp8vk2iun6Njg=; b=odwH49Q1bD3DReTcyEVshBh3FdeI7ovgRvmloN93uYLDwvsj6h1XDLuwh5QOT/4DR1 p3jRs3IzwDxI475NEvzMOQgRqdWkOSZvsPznpTu1/HdGnPHAzb0X0Uyr31q3qbJm2NWZ vz3YJkiPCgKt0AYgEHgGYZkcxqwFNPMxmaipjTf7CdLDpswQSL0AlopK8XKfY5hYgbmT DfmGjemdhNmtmIoZPtXHY8qd5uo/xoR++1lZLGKfmy1HFQXkW6dMrZpNYHUr4F4N1zCd vqU4fl/Rf0njJLwJWX3fNBiBxwXq6uQD7KzP8NUbQf4iIHI9ol2m1S7+vKnQX+1/VzUC E85Q== X-Gm-Message-State: AOJu0YwLrg/+KjHglKyHS7ux92Ei9elbXYB2h53/QbHnq2HCpar2n0PO 3sgnbtKutZWuLaULYEacRlDoD7K+75cN0ESqJ9KxcIXv7yHsw/VbdU08G7sSn4nkKH4KB4rUzow wPDRCQXeoMMt4cZEv0VhoTS8HDLdDzyvweatgZCXuhm3a+MJyT6VtICa2lW+7oaMjZUOR1qHOAC EXoG/4EZgn8+1huEIHM7sAg1shsMMR X-Google-Smtp-Source: AGHT+IGYCaq22p+j/pDmoCqSGcKVFCctC3E7tfixIaRufMnyu7UKCkZIZ7mGazVcCa6TdqtTMAWL9g== X-Received: by 2002:a9d:76c4:0:b0:6e4:3c38:fb7d with SMTP id p4-20020a9d76c4000000b006e43c38fb7dmr17328247otl.23.1708550475166; Wed, 21 Feb 2024 13:21:15 -0800 (PST) Received: from C02GC2QQMD6T.wifi.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id 20-20020ac84e94000000b0042bff97d9a3sm4743467qtp.40.2024.02.21.13.21.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 13:21:14 -0800 (PST) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@amd.com, thomas@monjalon.net Subject: [PATCH 09/10] net/bnxt: fix compressed Rx CQE handling Date: Wed, 21 Feb 2024 13:20:44 -0800 Message-Id: <20240221212044.27209-10-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240221212044.27209-1-ajit.khaparde@broadcom.com> References: <20240221212044.27209-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 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 We were trying to reuse 32-byte CQE macros for compressed CQE handling. And that was causing the packet error bits to be misinterpreted. Fix it by using appropriate macros. Fixes: d58c6c077cc2 ("net/bnxt: add AVX2 Rx for compressed CQE") Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_rxtx_vec_avx2.c | 39 ++++++++++++++++----------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c b/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c index ce6b597611..976f258044 100644 --- a/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c +++ b/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c @@ -392,19 +392,21 @@ crx_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) 0xFF, 0xFF, 3, 2, /* pkt_len */ 0xFF, 0xFF, 0xFF, 0xFF); /* pkt_type (zeroes) */ const __m256i flags_type_mask = - _mm256_set1_epi32(RX_PKT_CMPL_FLAGS_ITYPE_MASK); + _mm256_set1_epi32(RX_PKT_COMPRESS_CMPL_FLAGS_ITYPE_MASK); const __m256i flags2_mask1 = - _mm256_set1_epi32(CMPL_FLAGS2_VLAN_TUN_MSK); + _mm256_set1_epi32(CMPL_FLAGS2_VLAN_TUN_MSK_CRX); const __m256i flags2_mask2 = - _mm256_set1_epi32(RX_PKT_CMPL_FLAGS2_IP_TYPE); + _mm256_set1_epi32(RX_PKT_COMPRESS_CMPL_FLAGS_IP_TYPE); const __m256i rss_mask = - _mm256_set1_epi32(RX_PKT_CMPL_FLAGS_RSS_VALID); + _mm256_set1_epi32(RX_PKT_COMPRESS_CMPL_FLAGS_RSS_VALID); __m256i t0, t1, flags_type, flags2, index, errors; __m256i ptype_idx, ptypes, is_tunnel; __m256i mbuf01, mbuf23, mbuf45, mbuf67; __m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5, rearm6, rearm7; __m256i ol_flags, ol_flags_hi; __m256i rss_flags; + __m256i errors_v2; + __m256i cs_err_v2; /* Validate ptype table indexing at build time. */ bnxt_check_ptype_constants(); @@ -447,7 +449,6 @@ crx_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) cons += BNXT_RX_DESCS_PER_LOOP_VEC256, mbcons += BNXT_RX_DESCS_PER_LOOP_VEC256) { __m256i rxcmp0_1, rxcmp2_3, rxcmp4_5, rxcmp6_7, info3_v; - __m256i errors_v2; uint32_t num_valid; /* Copy eight mbuf pointers to output array. */ @@ -470,6 +471,7 @@ crx_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rxcmp2_3 = _mm256_loadu_si256((void *)&cp_desc_ring[cons + 2]); rte_compiler_barrier(); rxcmp0_1 = _mm256_loadu_si256((void *)&cp_desc_ring[cons + 0]); + rte_compiler_barrier(); /* Compute packet type table indices for eight packets. */ t0 = _mm256_unpacklo_epi32(rxcmp0_1, rxcmp2_3); @@ -477,19 +479,19 @@ crx_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) flags_type = _mm256_unpacklo_epi64(t0, t1); ptype_idx = _mm256_and_si256(flags_type, flags_type_mask); ptype_idx = _mm256_srli_epi32(ptype_idx, - RX_PKT_CMPL_FLAGS_ITYPE_SFT - + RX_PKT_COMPRESS_CMPL_FLAGS_ITYPE_SFT - BNXT_PTYPE_TBL_TYPE_SFT); - t0 = _mm256_unpacklo_epi32(rxcmp0_1, rxcmp2_3); - t1 = _mm256_unpacklo_epi32(rxcmp4_5, rxcmp6_7); - flags2 = _mm256_unpackhi_epi64(t0, t1); + t0 = _mm256_unpackhi_epi32(rxcmp0_1, rxcmp2_3); + t1 = _mm256_unpackhi_epi32(rxcmp4_5, rxcmp6_7); + cs_err_v2 = _mm256_unpacklo_epi64(t0, t1); - t0 = _mm256_srli_epi32(_mm256_and_si256(flags2, flags2_mask1), - RX_PKT_CMPL_FLAGS2_META_FORMAT_SFT - + t0 = _mm256_srli_epi32(_mm256_and_si256(cs_err_v2, flags2_mask1), + RX_PKT_COMPRESS_CMPL_METADATA1_SFT - BNXT_PTYPE_TBL_VLAN_SFT); ptype_idx = _mm256_or_si256(ptype_idx, t0); - t0 = _mm256_srli_epi32(_mm256_and_si256(flags2, flags2_mask2), + t0 = _mm256_srli_epi32(_mm256_and_si256(cs_err_v2, flags2_mask2), RX_PKT_CMPL_FLAGS2_IP_TYPE_SFT - BNXT_PTYPE_TBL_IP_VER_SFT); ptype_idx = _mm256_or_si256(ptype_idx, t0); @@ -505,17 +507,22 @@ crx_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) * Compute ol_flags and checksum error table indices for eight * packets. */ - is_tunnel = _mm256_and_si256(flags2, _mm256_set1_epi32(4)); + is_tunnel = _mm256_and_si256(cs_err_v2, + _mm256_set1_epi32(BNXT_CRX_TUN_CS_CALC)); is_tunnel = _mm256_slli_epi32(is_tunnel, 3); - flags2 = _mm256_and_si256(flags2, _mm256_set1_epi32(0x1F)); + + flags2 = _mm256_and_si256(cs_err_v2, + _mm256_set1_epi32(BNXT_CRX_CQE_CSUM_CALC_MASK)); + flags2 = _mm256_srli_epi64(flags2, 8); /* Extract errors_v2 fields for eight packets. */ t0 = _mm256_unpackhi_epi32(rxcmp0_1, rxcmp2_3); t1 = _mm256_unpackhi_epi32(rxcmp4_5, rxcmp6_7); errors_v2 = _mm256_unpacklo_epi64(t0, t1); - errors = _mm256_srli_epi32(errors_v2, 4); - errors = _mm256_and_si256(errors, _mm256_set1_epi32(0xF)); + /* Compute errors out of cs_err_v2 to index into flags table. */ + errors = _mm256_and_si256(cs_err_v2, _mm256_set1_epi32(0xF0)); + errors = _mm256_srli_epi32(errors, 4); errors = _mm256_and_si256(errors, flags2); index = _mm256_andnot_si256(errors, flags2);