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 B7E6041D52 for ; Thu, 23 Feb 2023 16:09:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B1EA8432DA; Thu, 23 Feb 2023 16:09:07 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 91F6943239 for ; Thu, 23 Feb 2023 16:09:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677164945; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VLWL7VUbKWSFYZxgIsS3ajEOFgo/EZ3u4HQkYYm1CXw=; b=TosVbLYxI5369Dd6KnXqrv7AKmvHWExP6uZJ74tO/ndjE5Fra4wnlr45t5tD9yCbT4Mzd0 8bEd1NAHL0MSv6zrsKtatTS0k/55fQA2lWdGG4lXsvZHlf7tFucf79/0V0sUcH/oB0a0fc yJlde5NcwJFlFWYt/dVWLvTnXK8w0Uo= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-659-OUX54DZLMI2odfnQ35Y_Bw-1; Thu, 23 Feb 2023 10:08:28 -0500 X-MC-Unique: OUX54DZLMI2odfnQ35Y_Bw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2C16B3815EF2; Thu, 23 Feb 2023 15:08:18 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.192.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BE5F2166B29; Thu, 23 Feb 2023 15:08:17 +0000 (UTC) From: Kevin Traynor To: Alexander Kozyrev Cc: Matan Azrad , dpdk stable Subject: patch 'net/mlx5: check compressed CQE opcode in vectorized Rx' has been queued to stable release 21.11.4 Date: Thu, 23 Feb 2023 15:06:06 +0000 Message-Id: <20230223150631.723699-75-ktraynor@redhat.com> In-Reply-To: <20230223150631.723699-1-ktraynor@redhat.com> References: <20230223150631.723699-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/28/23. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/0b4592d34787a25cca6e9a7875e5274ab4e31019 Thanks. Kevin --- >From 0b4592d34787a25cca6e9a7875e5274ab4e31019 Mon Sep 17 00:00:00 2001 From: Alexander Kozyrev Date: Fri, 27 Jan 2023 05:23:14 +0200 Subject: [PATCH] net/mlx5: check compressed CQE opcode in vectorized Rx [ upstream commit 1f903ebe2c05366aed6a453b6e7636945fc87285 ] The CQE opcode is never checked for a compressed CQE in the vectorized Rx burst routines. It is assumed that compressed CQEs are always valid and skipped error checking. This is obviously not the case and error CQEs may be compressed together as well. Need to check for the MLX5_CQE_RESP_ERR opcode and mark all the packets as bad ones in the compression session if it is there. Note that this issue is not applicable to the scalar Rx burst. Fixes: 6cb559d67b ("net/mlx5: add vectorized Rx/Tx burst for x86") Signed-off-by: Alexander Kozyrev Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_rxtx_vec_altivec.h | 16 +++++++++++++--- drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 10 +++++++--- drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 9 ++++++--- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h index 683a8f9a6c..204d17a8f2 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h @@ -784,5 +784,5 @@ rxq_cq_process_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, const uint16_t q_n = 1 << rxq->cqe_n; const uint16_t q_mask = q_n - 1; - unsigned int pos; + unsigned int pos, adj; uint64_t n = 0; uint64_t comp_idx = MLX5_VPMD_DESCS_PER_LOOP; @@ -867,5 +867,5 @@ rxq_cq_process_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, __vector unsigned char op_own, op_own_tmp1, op_own_tmp2; __vector unsigned char opcode, owner_mask, invalid_mask; - __vector unsigned char comp_mask; + __vector unsigned char comp_mask, mini_mask; __vector unsigned char mask; #ifdef MLX5_PMD_SOFT_COUNTERS @@ -1175,4 +1175,14 @@ rxq_cq_process_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, /* D.3 check error in opcode. */ + adj = (comp_idx != MLX5_VPMD_DESCS_PER_LOOP && comp_idx == n); + mask = (__vector unsigned char)(__vector unsigned long){ + (adj * sizeof(uint16_t) * 8), 0}; + lshift = vec_splat((__vector unsigned long)mask, 0); + shmask = vec_cmpgt(shmax, lshift); + mini_mask = (__vector unsigned char) + vec_sl((__vector unsigned long)invalid_mask, lshift); + mini_mask = (__vector unsigned char) + vec_sel((__vector unsigned long)shmask, + (__vector unsigned long)mini_mask, shmask); opcode = (__vector unsigned char) vec_cmpeq((__vector unsigned int)resp_err_check, @@ -1183,5 +1193,5 @@ rxq_cq_process_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, opcode = (__vector unsigned char) vec_andc((__vector unsigned long)opcode, - (__vector unsigned long)invalid_mask); + (__vector unsigned long)mini_mask); /* D.4 mark if any error is set */ diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h index f7bbde4e0e..41b9cf5444 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h @@ -525,5 +525,5 @@ rxq_cq_process_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, const uint16_t q_n = 1 << rxq->cqe_n; const uint16_t q_mask = q_n - 1; - unsigned int pos; + unsigned int pos, adj; uint64_t n = 0; uint64_t comp_idx = MLX5_VPMD_DESCS_PER_LOOP; @@ -617,5 +617,5 @@ rxq_cq_process_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, uint16x4_t op_own; uint16x4_t opcode, owner_mask, invalid_mask; - uint16x4_t comp_mask; + uint16x4_t comp_mask, mini_mask; uint16x4_t mask; uint16x4_t byte_cnt; @@ -781,6 +781,10 @@ rxq_cq_process_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, invalid_mask = vorr_u16(invalid_mask, mask); /* D.3 check error in opcode. */ + adj = (comp_idx != MLX5_VPMD_DESCS_PER_LOOP && comp_idx == n); + mask = vcreate_u16(adj ? + -1UL >> ((n + 1) * sizeof(uint16_t) * 8) : -1UL); + mini_mask = vand_u16(invalid_mask, mask); opcode = vceq_u16(resp_err_check, opcode); - opcode = vbic_u16(opcode, invalid_mask); + opcode = vbic_u16(opcode, mini_mask); /* D.4 mark if any error is set */ *err |= vget_lane_u64(vreinterpret_u64_u16(opcode), 0); diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h index 185d2695db..ab69af0c55 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h @@ -524,5 +524,5 @@ rxq_cq_process_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, const uint16_t q_n = 1 << rxq->cqe_n; const uint16_t q_mask = q_n - 1; - unsigned int pos; + unsigned int pos, adj; uint64_t n = 0; uint64_t comp_idx = MLX5_VPMD_DESCS_PER_LOOP; @@ -592,5 +592,5 @@ rxq_cq_process_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, __m128i op_own, op_own_tmp1, op_own_tmp2; __m128i opcode, owner_mask, invalid_mask; - __m128i comp_mask; + __m128i comp_mask, mini_mask; __m128i mask; #ifdef MLX5_PMD_SOFT_COUNTERS @@ -730,7 +730,10 @@ rxq_cq_process_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, invalid_mask = _mm_or_si128(invalid_mask, mask); /* D.3 check error in opcode. */ + adj = (comp_idx != MLX5_VPMD_DESCS_PER_LOOP && comp_idx == n); + mask = _mm_set_epi64x(0, adj * sizeof(uint16_t) * 8); + mini_mask = _mm_sll_epi64(invalid_mask, mask); opcode = _mm_cmpeq_epi32(resp_err_check, opcode); opcode = _mm_packs_epi32(opcode, zero); - opcode = _mm_andnot_si128(invalid_mask, opcode); + opcode = _mm_andnot_si128(mini_mask, opcode); /* D.4 mark if any error is set */ *err |= _mm_cvtsi128_si64(opcode); -- 2.39.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-02-23 14:46:25.619517288 +0000 +++ 0075-net-mlx5-check-compressed-CQE-opcode-in-vectorized-R.patch 2023-02-23 14:46:23.849236241 +0000 @@ -1 +1 @@ -From 1f903ebe2c05366aed6a453b6e7636945fc87285 Mon Sep 17 00:00:00 2001 +From 0b4592d34787a25cca6e9a7875e5274ab4e31019 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 1f903ebe2c05366aed6a453b6e7636945fc87285 ] + @@ -18 +19,0 @@ -Cc: stable@dpdk.org