Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17926698ybl; Thu, 2 Jan 2020 14:58:48 -0800 (PST) X-Google-Smtp-Source: APXvYqxjDWXxU2PyS/lYpDcMxLd71ykrlRZNaCleNkjMpurrasVGbtIY43kySu1DCKDtUCOe60hD X-Received: by 2002:a9d:65da:: with SMTP id z26mr86746185oth.197.1578005928875; Thu, 02 Jan 2020 14:58:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578005928; cv=none; d=google.com; s=arc-20160816; b=PNcAfnFUtcH7m9//QqR1ALfy+RiRqrBkbDXbc6OHUwtS2IHInOaJXntABBB5nBoINM 0jlAaks2e6QkPz90xuUMV25HFzGwF/LkgHd/0i5VouLXM83OotrTYacAFaZTkEqMO0/B CxRH37K9pWhDpEhcnSEszN20ZOODW5KOdztFKR6NNUzjEzJpvGLpbypYF/yjL5JOnHi2 d2GLnXvkRbz5yfAsxh04PhxiH8YyAZyTvLSFec5w1jSh9e4OwyxEmPBY9P3OAaS4EKhQ jHcgtlmIhXi37IjR7XX+Unz45YplarAV4/e04TAPjMPWFH7rlYLM6ftP+PtqbQ0S9HSO 0m5A== 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:dkim-signature; bh=15p6QvnAqeXH/kWxdUIMdyq3oDnsh/aVTXu0ZuNoVcM=; b=wg+lXkVlz3ltnGwoPrKpZf1AWTzRkJcpfLbWoklixB0iaZ0kDqgLo+IcDhmJM+W5Kq d8K012c+QrCLERrw7MZqrWIW5vQ21BpKvMC4VBfCymBUbAV5z4mFpDE6bujEEGU6y1zO fH8c5GH4Q5peuaZKreHrTLls4QYKMNVeEbtj4lQkzvwuQKPklx8MuFK6QjFwpdf3+HoV vabxMzfcxGe91Gf8INGZJh1H/pmC1wEHm67GQn6+iF9r/GcG1+zGxl79UM2YgGjBHgUe 5lUouo0EBJ3Uw5Wrrw4bNUOmbmFXwZO+3ne9CsDxWzj+5OhubK9wkXgRuKZDAxWxnooz MsgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=01GBSuv8; 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 j9si29345712otq.317.2020.01.02.14.58.37; Thu, 02 Jan 2020 14:58:48 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=01GBSuv8; 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 S1728016AbgABW5S (ORCPT + 99 others); Thu, 2 Jan 2020 17:57:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:59530 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728335AbgABWRL (ORCPT ); Thu, 2 Jan 2020 17:17:11 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0C39A22314; Thu, 2 Jan 2020 22:17:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003430; bh=FEU+wb56kXY41/LbKxx41Q+u86Vh8kPfLw7+5HaC4Gw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=01GBSuv8yqSmg/qzIO62JyB+FM6o/x35COJ+1rAfDPplkqvLtr7+wW4ECzbDcV1q7 sypVXBA7y/n+eP/3KAei0XO/aXXPfH44XKpdTBMwQnMq3UthmduvRa6dSrkQAm+Nyx fLPzJlBA2gDIkMmnv1pBbb9kVVGNCKKAJMiCe7nM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Chan , "David S. Miller" Subject: [PATCH 5.4 158/191] bnxt_en: Fix MSIX request logic for RDMA driver. Date: Thu, 2 Jan 2020 23:07:20 +0100 Message-Id: <20200102215846.336461084@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102215829.911231638@linuxfoundation.org> References: <20200102215829.911231638@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Michael Chan [ Upstream commit 0c722ec0a289c7f6b53f89bad1cfb7c4db3f7a62 ] The logic needs to check both bp->total_irqs and the reserved IRQs in hw_resc->resv_irqs if applicable and see if both are enough to cover the L2 and RDMA requested vectors. The current code is only checking bp->total_irqs and can fail in some code paths, such as the TX timeout code path with the RDMA driver requesting vectors after recovery. In this code path, we have not reserved enough MSIX resources for the RDMA driver yet. Fixes: 75720e6323a1 ("bnxt_en: Keep track of reserved IRQs.") Signed-off-by: Michael Chan Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c @@ -113,8 +113,10 @@ static int bnxt_req_msix_vecs(struct bnx { struct net_device *dev = edev->net; struct bnxt *bp = netdev_priv(dev); + struct bnxt_hw_resc *hw_resc; int max_idx, max_cp_rings; int avail_msix, idx; + int total_vecs; int rc = 0; ASSERT_RTNL(); @@ -142,7 +144,10 @@ static int bnxt_req_msix_vecs(struct bnx } edev->ulp_tbl[ulp_id].msix_base = idx; edev->ulp_tbl[ulp_id].msix_requested = avail_msix; - if (bp->total_irqs < (idx + avail_msix)) { + hw_resc = &bp->hw_resc; + total_vecs = idx + avail_msix; + if (bp->total_irqs < total_vecs || + (BNXT_NEW_RM(bp) && hw_resc->resv_irqs < total_vecs)) { if (netif_running(dev)) { bnxt_close_nic(bp, true, false); rc = bnxt_open_nic(bp, true, false); @@ -156,7 +161,6 @@ static int bnxt_req_msix_vecs(struct bnx } if (BNXT_NEW_RM(bp)) { - struct bnxt_hw_resc *hw_resc = &bp->hw_resc; int resv_msix; resv_msix = hw_resc->resv_irqs - bp->cp_nr_rings;