From patchwork Thu May 18 08:10:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13246289 X-Patchwork-Delegate: jgg@ziepe.ca 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 7DB33C7EE22 for ; Thu, 18 May 2023 08:23:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229586AbjERIXt (ORCPT ); Thu, 18 May 2023 04:23:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230031AbjERIXq (ORCPT ); Thu, 18 May 2023 04:23:46 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87BE21721 for ; Thu, 18 May 2023 01:23:24 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-643846c006fso1739477b3a.0 for ; Thu, 18 May 2023 01:23:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1684398183; x=1686990183; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=hQO3YqDiaYc/NCO7Loq4Lrw91GQemKMuZ2x3OieiTgg=; b=XpQ2SvV7HZVVsipmCTiErpOXvbHN1Ru8lePIPaiIspwbIOUL+XAtsKMPb3TpLsEmV5 Cm5237KnZt4yDPbVGQZf37gDjyHYOGvThhW7WeTgJsWRr0fHojS/svaqlB/XiTX6EO7G Y3SoPnlg7jvhuGGQuOGLBETftGO21Jt5erEeU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684398183; x=1686990183; 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=hQO3YqDiaYc/NCO7Loq4Lrw91GQemKMuZ2x3OieiTgg=; b=N84EeX3CF2dvQChJsl+3hZsBe6YV5dYQ4asIrmrb2G5cfD4RzGP0hFfjuQKpxEaXVA EOz81SSIkl7/zrTnVFgaea5Zt+p20f/mUqZow6MHRjv8rb0RUwAqZV0A6dvgOzLqofxy L5Hd45B6McVxq0cDDiVuW/Fe4vGs69Q76kWx8J4fyUtHY6lmVFS0Y3b3gvHfS5LjyvnG AHZ1cNTWh8/VCx/ZD8fzVE1AYtZGrKXi4Q7EGMuMgN3/BzZSDR35smxKUcP4cVYzaz2e atmuOBsiF1tN162260sdzDH/9SR6Ap/XjKbAd3BP4UDh+EFSfPoNqXv2AKMzPcPxKK/N UyoQ== X-Gm-Message-State: AC+VfDwVF9OxXj69+WV+MyZ5/5um95KiBYsSLjRbHYFH6Moa2eScLK36 oqLBxOAphrGs0m4NvqyORoSgOQ== X-Google-Smtp-Source: ACHHUZ7wbXvhqtYw1jzHl+UCyjz1OQmVzLLh8OgQV6kvNBJD+UavYOAF7T9SNkO8anJf23EOZr0YzA== X-Received: by 2002:a05:6a00:238e:b0:647:3de:c0ff with SMTP id f14-20020a056a00238e00b0064703dec0ffmr2934596pfc.30.1684398182415; Thu, 18 May 2023 01:23:02 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id b24-20020aa78718000000b0062dd9a8c1b8sm806922pfo.100.2023.05.18.01.22.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 May 2023 01:23:01 -0700 (PDT) From: Selvin Xavier To: jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com, Kalesh AP , Selvin Xavier Subject: [PATCH v2 for-rc 1/3] RDMA/bnxt_re: Fix a possible memory leak Date: Thu, 18 May 2023 01:10:59 -0700 Message-Id: <1684397461-23082-2-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1684397461-23082-1-git-send-email-selvin.xavier@broadcom.com> References: <1684397461-23082-1-git-send-email-selvin.xavier@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Kalesh AP Inside bnxt_qplib_create_cq(), when the check for NULL DPI fails, driver returns directly without freeing the memory allocated inside bnxt_qplib_alloc_init_hwq() routine. Fixed this by moving the check for NULL DPI before invoking bnxt_qplib_alloc_init_hwq(). Fixes: 1ac5a4047975 ("RDMA/bnxt_re: Add bnxt_re RoCE driver") Reviewed-by: Kashyap Desai Signed-off-by: Kalesh AP Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c index f139d4c..8974f62 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c @@ -2056,6 +2056,12 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) u32 pg_sz_lvl; int rc; + if (!cq->dpi) { + dev_err(&rcfw->pdev->dev, + "FP: CREATE_CQ failed due to NULL DPI\n"); + return -EINVAL; + } + hwq_attr.res = res; hwq_attr.depth = cq->max_wqe; hwq_attr.stride = sizeof(struct cq_base); @@ -2069,11 +2075,6 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) CMDQ_BASE_OPCODE_CREATE_CQ, sizeof(req)); - if (!cq->dpi) { - dev_err(&rcfw->pdev->dev, - "FP: CREATE_CQ failed due to NULL DPI\n"); - return -EINVAL; - } req.dpi = cpu_to_le32(cq->dpi->dpi); req.cq_handle = cpu_to_le64(cq->cq_handle); req.cq_size = cpu_to_le32(cq->hwq.max_elements); From patchwork Thu May 18 08:11:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13246290 X-Patchwork-Delegate: jgg@ziepe.ca 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 6ADC1C77B7D for ; Thu, 18 May 2023 08:23:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229750AbjERIXv (ORCPT ); Thu, 18 May 2023 04:23:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229982AbjERIXs (ORCPT ); Thu, 18 May 2023 04:23:48 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBEFE19B2 for ; Thu, 18 May 2023 01:23:26 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-64d2467d63fso98159b3a.0 for ; Thu, 18 May 2023 01:23:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1684398185; x=1686990185; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=3oudnmeF1UdQVVWapzcFzz6TigNu8DDvRfu5qrese2c=; b=gq9jqqMDP2WNEJBEiCvx+jHfzR8q4R5qXUgNEwp1J2Ka42AHReAudtG2QEhHWbChsy Jzz3vAuvPyd7kL5oCiDXlwPRd8CvZ3+vVhMG7h9twt7jRjY/nGQrop7XzxA1b41OZU2h Tq0z9j8zl/dpx1Fikd3QxihVz0HeUVs3r9YpQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684398185; x=1686990185; 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=3oudnmeF1UdQVVWapzcFzz6TigNu8DDvRfu5qrese2c=; b=R5c4h4C8QOj5LtMC9kGu2JR7q9hM9Jr6m1XQC+sNruL1Sj3xP5fshRmPrwHm0o6EWx PSnsIh3+KvQ5F+eUGV8JNCvrH8DgvNRcXDSsxGjFiTo+y7fljSMYZM2BD88BAwtlkxZ9 HHkydc3kuTR7GopbK97CRqGiSwrLsXBoE4YT/CRg7GcpI1pa7HX59DsC8Yao1QcyMKGh lNUap3ndjZX+GFRv4pQA9fPWBhpQJGIkRjUkKflce+Ov9nmnz67n0JBuWW1Ld/8QB8xh RTw7+LaYAbIZJ+lyTOzckhVpcLGZyXo69Was1Lwh1S4Nauq89ZImU1V67J9FuurvEKHr FmRg== X-Gm-Message-State: AC+VfDysVEhn+gLpN84zV1lvBXJFzEFdMohrzW9tggsApOLGjq+19MM/ /kKRda5hsptOMNdbnBUsmnsCF0dtXzI8/kU/2lM= X-Google-Smtp-Source: ACHHUZ4P/DEWd4ItYVTkiCbwXW75+eKwGURgeIbqSCyYlM+Cz5U8au9qqVQktlknJMIBbj0xHRTZAA== X-Received: by 2002:a05:6a00:1255:b0:64c:aa98:a69f with SMTP id u21-20020a056a00125500b0064caa98a69fmr3732513pfi.1.1684398185095; Thu, 18 May 2023 01:23:05 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id b24-20020aa78718000000b0062dd9a8c1b8sm806922pfo.100.2023.05.18.01.23.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 May 2023 01:23:04 -0700 (PDT) From: Selvin Xavier To: jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com, Kalesh AP , Selvin Xavier Subject: [PATCH v2 for-rc 2/3] RDMA/bnxt_re: Fix return value of bnxt_re_process_raw_qp_pkt_rx Date: Thu, 18 May 2023 01:11:00 -0700 Message-Id: <1684397461-23082-3-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1684397461-23082-1-git-send-email-selvin.xavier@broadcom.com> References: <1684397461-23082-1-git-send-email-selvin.xavier@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Kalesh AP bnxt_re_process_raw_qp_pkt_rx() always return 0 and ignores the return value of bnxt_re_post_send_shadow_qp(). Fixes: 1ac5a4047975 ("RDMA/bnxt_re: Add bnxt_re RoCE driver") Reviewed-by: Hongguang Gao Reviewed-by: Ajit Khaparde Signed-off-by: Kalesh AP Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c index e86afec..0b581c2 100644 --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c @@ -3343,7 +3343,7 @@ static int bnxt_re_process_raw_qp_pkt_rx(struct bnxt_re_qp *gsi_qp, /* post data received in the send queue */ rc = bnxt_re_post_send_shadow_qp(rdev, gsi_sqp, swr); - return 0; + return rc; } static void bnxt_re_process_res_rawqp1_wc(struct ib_wc *wc, From patchwork Thu May 18 08:11:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13246291 X-Patchwork-Delegate: jgg@ziepe.ca 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 DCFF1C7EE23 for ; Thu, 18 May 2023 08:23:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229982AbjERIXw (ORCPT ); Thu, 18 May 2023 04:23:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230124AbjERIXt (ORCPT ); Thu, 18 May 2023 04:23:49 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D8EA26BD for ; Thu, 18 May 2023 01:23:28 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-643bb9cdd6eso1859481b3a.1 for ; Thu, 18 May 2023 01:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1684398188; x=1686990188; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=LqzSgtf+78nE14prUkos87ovavccWYpZfseQiW1ADFg=; b=VRxF+ycNSwLhBrXF4Pyd0nnnE+AhrLs6CGJXGPqD7RrWyPJEuC0brKyeSgo8Kxxweu 6LwLMp8NkSrwUEu/lHj0uAZ9VMOvoqEpLdNt5xW4c0Fw8bgUd7szPAovzVK5eDa83eBb hqJTSwwdG8QH50+AU22dgCaJ8z+mnXe9XypTM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684398188; x=1686990188; 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=LqzSgtf+78nE14prUkos87ovavccWYpZfseQiW1ADFg=; b=krLQOP+6GMy8m/elQNIfiy9Hg49jejrLEChcfR7m1coKr5onctBMGpwZzI5TQ+RFvE 5Uao/Tvv/9B0PH7vlO7zxJDxujki3f2Eok/j0WQTlkIwE+mak/WPOgzfy9cxqowEU0e8 Qa3nEx7IxP4ZzCxEymIaR2puNK1wKtu9NuMzqaTxL15KYIY9sObnmEw64swBUNNOPsKX ePIOq2xsWYRkFkc32QhOcJt+5udxT6jq8htLpxicIg7I8uQhTjQm4icFBg+9hDKhyHU0 BWUs0kHVI0fGxGhOYkVZzUlb/rjLSLeQsvq3ZqDETL+T4/AqYPwFgA7SLivkbTDoPQfZ 1i1g== X-Gm-Message-State: AC+VfDy3rS/TQi4H5e6+g6a/Hz4/8MJnPe3CvEueXBUR2afDIKtpLcXX L0jS5/mInt7lq6q8tAHw5+rKSw== X-Google-Smtp-Source: ACHHUZ66mAkskuLpqxv/OFJ62wMnWvk0kvsT47ucw8k13U55lIG4GmrVXoZWViI6UWa/+E/4aCu/KA== X-Received: by 2002:a05:6a00:1907:b0:647:7ee8:6251 with SMTP id y7-20020a056a00190700b006477ee86251mr3249434pfi.21.1684398187883; Thu, 18 May 2023 01:23:07 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id b24-20020aa78718000000b0062dd9a8c1b8sm806922pfo.100.2023.05.18.01.23.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 May 2023 01:23:07 -0700 (PDT) From: Selvin Xavier To: jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com, Kalesh AP , Selvin Xavier Subject: [PATCH v2 for-rc 3/3] RDMA/bnxt_re: Do not enable congestion control on VFs Date: Thu, 18 May 2023 01:11:01 -0700 Message-Id: <1684397461-23082-4-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1684397461-23082-1-git-send-email-selvin.xavier@broadcom.com> References: <1684397461-23082-1-git-send-email-selvin.xavier@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Kalesh AP Congestion control needs to be enabled only on the PFs. FW fails the command if issued on VFs. Avoid sending the command on VFs. Fixes: f13bcef04ba0 ("RDMA/bnxt_re: Enable congestion control by default") Signed-off-by: Kalesh AP Reviewed-by: Selvin Thyparampil Xavier Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index b9e2f89..e34eccd 100644 --- a/drivers/infiniband/hw/bnxt_re/main.c +++ b/drivers/infiniband/hw/bnxt_re/main.c @@ -1336,6 +1336,10 @@ static void bnxt_re_setup_cc(struct bnxt_re_dev *rdev, bool enable) { struct bnxt_qplib_cc_param cc_param = {}; + /* Do not enable congestion control on VFs */ + if (rdev->is_virtfn) + return; + /* Currently enabling only for GenP5 adapters */ if (!bnxt_qplib_is_chip_gen_p5(rdev->chip_ctx)) return;