From patchwork Thu Jun 8 10:24:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13271919 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECFA7C7EE45 for ; Thu, 8 Jun 2023 10:37:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232139AbjFHKhC (ORCPT ); Thu, 8 Jun 2023 06:37:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235957AbjFHKhA (ORCPT ); Thu, 8 Jun 2023 06:37:00 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D363AE6C for ; Thu, 8 Jun 2023 03:36:59 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1b01d3bb571so1885945ad.2 for ; Thu, 08 Jun 2023 03:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686220619; x=1688812619; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=5uWpYILjByNrdhhrXHCKg6f9gV/+49ynHktODwaTeZk=; b=eznfhcFWjR5BL94/wx2N5GEZSziFwVUxb0QTLAkP7txA6Iffi3mPEH8f+KyXgES1Gz jAYgkzFmVGajYdKgb6MrEbvVn3G0eBvKyY3GDwp1Q/wY2Y2aGpXTGxBzPJw6DASY/DCr yOiw/xGPfERz/lealAxdb40wn6toKy6kwLQ1I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686220619; x=1688812619; h=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=5uWpYILjByNrdhhrXHCKg6f9gV/+49ynHktODwaTeZk=; b=aWy0wkh6lp0OXbyiodC1Vugylnj8dzruHMMAq7oMIJqogPXqKc/F2oEnIfhSb65bqE hYplKslg17RugD4KpKq5XX/o04+TNhSPljNhq1TM5tFPscLKzaFBDfS9+iBk+3PeQt+6 Yx+Fl+EJT9JqM/1/CIVX/HFpFfQteKGKP1AAm+zTjQjpb9ZI4GuOHBz4+n4SXkeftQCD jE6MF+NbYjBgDG18UROW2yIe+gUxYPU62RErVHZpw/vtOM5gHSEDNporE1H7tQrqopWv MewATJuBBKU76eAYkQMUJVviCOC8xHHweH7jqgKg2GKhyDUsBXzExy2zlRRU/Ffa51fu b8hg== X-Gm-Message-State: AC+VfDw5bNysRdzi7nJiV6YIwOhP7Qe++uun4HKqBIm0rPwc890Qow0S Uy4WQCDM2A6My45ymiaNUA7FoA== X-Google-Smtp-Source: ACHHUZ7V8aRPmF1TX3mUAyBePHaYOD0rg5p0tt/gugpjg5yAw4yV0Phnlcase3n6Y1LZzDr2oV1RBw== X-Received: by 2002:a17:903:2450:b0:1ad:bc86:851 with SMTP id l16-20020a170903245000b001adbc860851mr4600826pls.45.1686220619251; Thu, 08 Jun 2023 03:36:59 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id jj11-20020a170903048b00b001a980a23802sm1128510plb.111.2023.06.08.03.36.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2023 03:36:58 -0700 (PDT) From: Selvin Xavier To: jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com, Kashyap Desai , Selvin Xavier Subject: [PATCH for-next 01/17] RDMA/bnxt_re: wraparound mbox producer index Date: Thu, 8 Jun 2023 03:24:52 -0700 Message-Id: <1686219908-11181-2-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1686219908-11181-1-git-send-email-selvin.xavier@broadcom.com> References: <1686219908-11181-1-git-send-email-selvin.xavier@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Kashyap Desai Driver is not handling the wraparound of the mbox producer index correctly. Currently the wraparound happens once u32 max is reached. Bit 31 of the producer index register is special and should be set only once for the first command. Because the producer index overflow setting bit31 after a long time, FW goes to initialization sequence and this causes FW hang. Fix is to wraparound the mbox producer index once it reaches u16 max. Fixes: cee0c7bba486 ("RDMA/bnxt_re: Refactor command queue management code") Fixes: 1ac5a4047975 ("RDMA/bnxt_re: Add bnxt_re RoCE driver") Signed-off-by: Kashyap Desai Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c index 688eaa0..d4ce82b 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c @@ -180,7 +180,7 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, } while (bsize > 0); cmdq->seq_num++; - cmdq_prod = hwq->prod; + cmdq_prod = hwq->prod & 0xFFFF; if (test_bit(FIRMWARE_FIRST_FLAG, &cmdq->flags)) { /* The very first doorbell write * is required to set this flag @@ -599,7 +599,7 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res, rcfw->cmdq_depth = BNXT_QPLIB_CMDQE_MAX_CNT_8192; sginfo.pgsize = bnxt_qplib_cmdqe_page_size(rcfw->cmdq_depth); - hwq_attr.depth = rcfw->cmdq_depth; + hwq_attr.depth = rcfw->cmdq_depth & 0x7FFFFFFF; hwq_attr.stride = BNXT_QPLIB_CMDQE_UNITS; hwq_attr.type = HWQ_TYPE_CTX; if (bnxt_qplib_alloc_init_hwq(&cmdq->hwq, &hwq_attr)) {