From patchwork Sat Jul 13 23:43:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13732557 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C94715E5D0 for ; Sat, 13 Jul 2024 23:44:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720914255; cv=none; b=fQdK+vSBUJWSWoerrF+Tt7v6tG+R0vkJsIhO2IOVFHaePqNtXZe3BSk9CqOc/ppITVAENoIH0AC1AOHM08MUgvd9iOkEFbCF3KlFHoMveyF+f5L4NVWyAQPwIBCRAYdtL2XcbiKa4A5bn68chMw1G+41pTvsp5kay9D3XoTx3r8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720914255; c=relaxed/simple; bh=rcBiMb5GCzfSy5v6UQvVcSh7pYaWsaCzjES9fPEr1x0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sBYRl6ESl9OUTHxNk+RoHOQMwdaGzF0IahtogDH8MWU2Ft8FFheNxV7yChe4wkpg3MX2taJgjACscr6JB/SLIlqqVJV3031DJr81daMWBBp9gIl+cN11Gg4cRjU147N20uAPyrXBIcM7y2VK2oWplx7i7TX6YJxSxDlvcLCuG7Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=U6dnOHjw; arc=none smtp.client-ip=209.85.222.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="U6dnOHjw" Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-79ef8fe0e90so218713485a.3 for ; Sat, 13 Jul 2024 16:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720914253; x=1721519053; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=ZUZL+0wphrv8rvFSV2QuTjXM/nNYD28JxEJYojq1Ooo=; b=U6dnOHjwEHbfOS01bdGLv5UI6zZ6+C27wpJr388txGlPdQWzrgo8TFLy7+kwAKAIvw K7S6estQbMzWDa1rdIboueaOYnmCotwgnh/P3mMSYwwVXSgNpz+sixuT9QA6H5AdLbfQ nsERedVk5lMTQY/O+mkVS5VSF1/8voorlDpxM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720914253; x=1721519053; h=mime-version: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=ZUZL+0wphrv8rvFSV2QuTjXM/nNYD28JxEJYojq1Ooo=; b=oHB3+Yd8HIbSFTmw7IjMkN1ve5GgY7yH9cGPaEILHyxFXhmVDaHjff8yEuaYfF4J/T SJf5J4ChH7n1Uao/arZMGAMEYzUvobBIlZDilFI4BHsex1q/06DSA2+iMyAdQJzVkNoU rXi4pxV/ShaJZt4MmCYDVVtdTHsGgdmb5ubPNAqatYX/BJtKvq3aRG4PJaKaA0wuyh13 iDm9Pr8/f2O8dCyHlCXuuckbwObFyzCFVDGI8pxbxI6OT87cQViZVSxDmhWwkIHiyX7c 5uxgoEM3vf21VUnXPg44CcYgsZZ2d/t76+L6/FwdkjweM1JPWpgf0SsanQiS1mZBiNT0 I23g== X-Gm-Message-State: AOJu0Yz9evKxUtXlYXko8YMdLox6C0MLIPCVW7cxD2UMpZef/kpwGPg6 2ir7htng74uc8+SIsp/0eNu0UOxYSxGqW8vTBeZ+iIjTM7ePjLGp8jyk37glAw== X-Google-Smtp-Source: AGHT+IFiot0AmrMSmvO1WKYeT0+IyMvTZ7s25aklo9QOmbpmViwIrIjjityB0a9IP4b4f0dIQho6RA== X-Received: by 2002:a05:620a:2490:b0:79e:f9f8:155f with SMTP id af79cd13be357-79f199f5024mr2214344885a.10.1720914252968; Sat, 13 Jul 2024 16:44:12 -0700 (PDT) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a160bbe6f7sm78124585a.37.2024.07.13.16.44.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Jul 2024 16:44:12 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com, Hongguang Gao , Somnath Kotur Subject: [PATCH net-next 8/9] bnxt_en: Allocate the max bp->irq_tbl size for dynamic msix allocation Date: Sat, 13 Jul 2024 16:43:38 -0700 Message-ID: <20240713234339.70293-9-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20240713234339.70293-1-michael.chan@broadcom.com> References: <20240713234339.70293-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org If dynamic MSIX allocation is supported, additional MSIX can be allocated at run-time without reinitializing the existing MSIX entries. The first step to support this dynamic scheme is to alloacte a large enough bp->irq_tbl if dynamic allocation is supported. Reviewed-by: Hongguang Gao Reviewed-by: Somnath Kotur Signed-off-by: Michael Chan Reviewed-by: Simon Horman --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index c0695a06744d..7483ea246c9d 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -10697,7 +10697,7 @@ static int bnxt_get_num_msix(struct bnxt *bp) static int bnxt_init_int_mode(struct bnxt *bp) { - int i, total_vecs, max, rc = 0, min = 1, ulp_msix, tx_cp; + int i, total_vecs, max, rc = 0, min = 1, ulp_msix, tx_cp, tbl_size; total_vecs = bnxt_get_num_msix(bp); max = bnxt_get_max_func_irqs(bp); @@ -10718,7 +10718,10 @@ static int bnxt_init_int_mode(struct bnxt *bp) goto msix_setup_exit; } - bp->irq_tbl = kcalloc(total_vecs, sizeof(struct bnxt_irq), GFP_KERNEL); + tbl_size = total_vecs; + if (pci_msix_can_alloc_dyn(bp->pdev)) + tbl_size = max; + bp->irq_tbl = kcalloc(tbl_size, sizeof(struct bnxt_irq), GFP_KERNEL); if (bp->irq_tbl) { for (i = 0; i < total_vecs; i++) bp->irq_tbl[i].vector = pci_irq_vector(bp->pdev, i);