From patchwork Fri Jun 9 11:01:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13273716 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 442CFC7EE43 for ; Fri, 9 Jun 2023 11:14:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231377AbjFILOR (ORCPT ); Fri, 9 Jun 2023 07:14:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230317AbjFILOQ (ORCPT ); Fri, 9 Jun 2023 07:14:16 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A13AE1FDC for ; Fri, 9 Jun 2023 04:14:15 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1b24ff03400so5463105ad.3 for ; Fri, 09 Jun 2023 04:14:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686309255; x=1688901255; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=tCGAeAnDjRbpJU4Q7ejLwWgvSEb0nbz9W+JEEFo/ndE=; b=VmIKyafqDd2NAx6P14H+0AHKfdcXBPTuh2Wx4HmEHEl0zIHmrZ+GPMBrCxMtvtuZUO rbrAwp0VILPpMMzAsV58l4n9SujOogZf9B+rg4XbtyLOTOvaX3gQ2zx7laPZ2cvyE1Df vGK8r6UVbtl+L/8TNBoAqjiOhf699erhwqdMQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686309255; x=1688901255; 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=tCGAeAnDjRbpJU4Q7ejLwWgvSEb0nbz9W+JEEFo/ndE=; b=hKtwhN2UnWsqqlk+M7Ws/1L9DsEnKjnXDsQZAKNIpDhfkVMDyN4kmRLRnaeQpPCc6p JruxSUFuV3/1dzfG4PzzISsiV46Vj+ECO4kpDxG4EyKN36W1gMkit8yA7g2JuavDeVFF e2WR3SejF8LVOwSTXILpjiESa3zhA8XOFFR2uxcKvtIRy4Oz9/AL2A5ypYRM+e2mwXy8 QJYVGAcdaa8ygff4fC3QU8SI94ByD1cO1Ft+3y1+tvuYsMBtkGGX3Si8KzkMjClwtv/C 1vELnOyObmnB+22eN4f81i0kiIWh0y5PqvPKgwSQkXcCw2czxYOef1zKDXwRgF6druBN wnww== X-Gm-Message-State: AC+VfDxdNHB/ogbzBzvSGtHh76k1v8C3dnnjM4aZklIuYUycvQSZpU5q H++vvxrajTZWVzpBhZ/tQ6o+Bw== X-Google-Smtp-Source: ACHHUZ5M5sVmBB5iqZg8GCI96iYyP3eiKQdGzp/ZJCy9rOaLVqmmUcXzgYKkRZ488h5WgBeAE21+/w== X-Received: by 2002:a17:902:db02:b0:1ac:750e:33ef with SMTP id m2-20020a170902db0200b001ac750e33efmr856052plx.3.1686309255088; Fri, 09 Jun 2023 04:14:15 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id q4-20020a170902dac400b001b0142908f7sm2992954plx.291.2023.06.09.04.14.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Jun 2023 04:14:14 -0700 (PDT) From: Selvin Xavier To: jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com, kashyap.desai@broadcom.com, Selvin Xavier Subject: [PATCH v2 for-next 01/17] RDMA/bnxt_re: wraparound mbox producer index Date: Fri, 9 Jun 2023 04:01:38 -0700 Message-Id: <1686308514-11996-2-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1686308514-11996-1-git-send-email-selvin.xavier@broadcom.com> References: <1686308514-11996-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)) {