Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp724429imm; Thu, 13 Sep 2018 06:52:21 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZVnXcB9gT5tcuIXCIuKARHxcUnD/cqchBBMAbziFjqi7+y1XXWTeqrZNjzVOpJa3eA3mkC X-Received: by 2002:a17:902:8bc8:: with SMTP id r8-v6mr7561385plo.100.1536846741527; Thu, 13 Sep 2018 06:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536846741; cv=none; d=google.com; s=arc-20160816; b=onYKNg9bDTHHB+368hMj5JHMfUKVYJqcn0PkowoHfb471V1OjarkgSF9VRanAGrjkC OEKOvoMmJyb+44uo1L9KABkoF0G+jvCwoycMHnbGeCUcYFOl+NgBs5WXggQiFkyGQB/p hM0c/MKtRKZdKt3scMd64kYM38J3HWBCwbzVtxSBVef/hmi5DwFULYtWUhAeSeWnhEAN H/9AjNOQoasiHqq1DKAsi8DJ8eox+Xqp7c3RNKGyrzAoRc62bykU2gz6uFpPc2m5vTxB 2kyDj/FrofzX0apivQHPXjlkRdNrV9oEgewh7qNxAHMaxx81yYRKTVT5mQTjD+rGmwIU J/lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=kth6Y65/l7fh7e/c3XghafK55eCD21OdvSZD3Nooo0Q=; b=CkmlORJu/RYLaRlo61L4s8qMrfAZS1mgWesexYOSMvj3kfY5Oevco2qgWko9FjR1Vs 567dPr/1exBgPKUWHpAMVMna/5Sc3a3cuUpnGsKJQueYf6cajtml/MDLFvZaBfRCq9oG nWvoHiQQ7lvtW/1C6ApRTXr/aCTXIycT9aWZRY/KRAWLiaVI5Yz5b6RggMonppt3ZzmX C40sVcFjWb7H6aVaqpBD9gzE21ZKH0gGZ/KpbZf1BgKaPXjj/VZTw5MMhVz6KrK0yE0F rFjeZjWICC7C5ka/wwfdiuFrpq5mcUS3UIUBJrW4vOIYCt44tXHy96hPx5h1eRKYJ0pt vJIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k10-v6si4138205pfe.41.2018.09.13.06.52.06; Thu, 13 Sep 2018 06:52:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730855AbeIMTBR (ORCPT + 99 others); Thu, 13 Sep 2018 15:01:17 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33324 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729138AbeIMTBQ (ORCPT ); Thu, 13 Sep 2018 15:01:16 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D5E78D10; Thu, 13 Sep 2018 13:51:41 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tariq Toukan , Eran Ben Elisha , Saeed Mahameed , "David S. Miller" Subject: [PATCH 4.18 027/197] net/mlx5: Fix SQ offset in QPs with small RQ Date: Thu, 13 Sep 2018 15:29:36 +0200 Message-Id: <20180913131842.647142172@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tariq Toukan [ Upstream commit 639505d4397b8c654a8e2616f9cb70ece40c83f9 ] Correct the formula for calculating the RQ page remainder, which should be in byte granularity. The result will be non-zero only for RQs smaller than PAGE_SIZE, as an RQ size is a power of 2. Divide this by the SQ stride (MLX5_SEND_WQE_BB) to get the SQ offset in strides granularity. Fixes: d7037ad73daa ("net/mlx5: Fix QP fragmented buffer allocation") Signed-off-by: Tariq Toukan Reviewed-by: Eran Ben Elisha Signed-off-by: Saeed Mahameed Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/wq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/wq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/wq.c @@ -139,14 +139,15 @@ int mlx5_wq_qp_create(struct mlx5_core_d struct mlx5_wq_ctrl *wq_ctrl) { u32 sq_strides_offset; + u32 rq_pg_remainder; int err; mlx5_fill_fbc(MLX5_GET(qpc, qpc, log_rq_stride) + 4, MLX5_GET(qpc, qpc, log_rq_size), &wq->rq.fbc); - sq_strides_offset = - ((wq->rq.fbc.frag_sz_m1 + 1) % PAGE_SIZE) / MLX5_SEND_WQE_BB; + rq_pg_remainder = mlx5_wq_cyc_get_byte_size(&wq->rq) % PAGE_SIZE; + sq_strides_offset = rq_pg_remainder / MLX5_SEND_WQE_BB; mlx5_fill_fbc_offset(ilog2(MLX5_SEND_WQE_BB), MLX5_GET(qpc, qpc, log_sq_size),