From patchwork Sat Jul 13 23:43:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13732556 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 6B07716D9AC for ; Sat, 13 Jul 2024 23:44:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720914253; cv=none; b=fTWbt/yatf5ClLGE5uk+ewVyV1PJcFPmqvtRhIOg3xTjzevkiIkjE40gjZLUAAcD7I+U1uxgKBulO+iQ8SHnSONzq5AEJF+FfmBa2R0Zxw0kmBjAu9DnFQcz8TgHkQ9fhNeMmP5l/VWve/UT1LLF2Rwdw/RWfHQ05LcdaNBIe6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720914253; c=relaxed/simple; bh=P1WfGf4A+k4zp8T8UMLY+eQrWiaPQVxK9mq4A+jrKnk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QFIpmLrZ2SFFEWGe08W7CuByLkNFnd/i7/eNf/AXJ5aH66DMfoYcL0hthFTa8knmrt2hrhz3BJfooL7KvpDbz3ReUNvAmbqwSiSFjf2u+rlztiFCYpJ/uhffphOxn42J6kvm+uastHniCrW3GZaka69JvBEior9OBGyezV43ojs= 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=Uuz+5vaA; arc=none smtp.client-ip=209.85.222.178 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="Uuz+5vaA" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-79f08b01ba6so270597485a.0 for ; Sat, 13 Jul 2024 16:44:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720914251; x=1721519051; 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=Ub+FoEYnFCQMABszXrLYdr7VdK1IJzfQULaMgBRK7f0=; b=Uuz+5vaAtwuKPh554cqXXawEahVjevmLsfna2nBpCP60VV82kasU/ugPwdz0GqeFDM 3mdrJRYosMSfEgfU1Koel79OA6rL7z81VuAuPZVoeCTACXeut19TcCk/7UYwW6LK669L +9oOuQslTYCeRKC9xOvm0IuSyjXxc6Y1Fe/hM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720914251; x=1721519051; 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=Ub+FoEYnFCQMABszXrLYdr7VdK1IJzfQULaMgBRK7f0=; b=E1JI/rCe2J7pfNK7pqk4wOv6ko4fbKUKUbyL17gKOvFnEo0afSZeUNcYqIdm1rsfRQ j59rI0HJ4a7WUJBWcSMyCau3CXUDiCMp+UF7YHte2cPorgncp/mXpatkSfP7fcXBt32H iZHHkHZhD9yG4YXe2r3eWlYocs17PM0lC6gakurPeKNxtqsoYHJ3eoA54UMquUVuUVaM x4I6bZoT3iPm5IwrJo0C41HL4bImCPPmsEBwIgnx1oS6/EwZzmcbORQa5oK3FkhNi5ew qq5OvZNr70NtZ8Y853Dg2Jb+Eg92d024PTEYno9vuH/NGlQ+7YBF5sr8J7VWyr6hW+rZ 6O3w== X-Gm-Message-State: AOJu0YxFPC8dCPiwrb6IHLPg0X4khO0FkttNdcmZl6hSdKpCI96DVjQc UorZHVN2wnCICE5on6SQsasZb6/DD+6WkUHo8wOkhZWN4WTAgo53+TF8RGOX/w== X-Google-Smtp-Source: AGHT+IE+FOMefFnaMQnYMWSS+alyYpSqDp1jzIW1pyzdeWrL4rwPjy5OSimvjFYOB45i03c0cZ4D/A== X-Received: by 2002:a05:620a:55b4:b0:79f:1bb:e7e6 with SMTP id af79cd13be357-7a153252629mr1027739785a.18.1720914251286; Sat, 13 Jul 2024 16:44:11 -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.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Jul 2024 16:44:10 -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, Somnath Kotur Subject: [PATCH net-next 7/9] bnxt_en: Replace deprecated PCI MSIX APIs Date: Sat, 13 Jul 2024 16:43:37 -0700 Message-ID: <20240713234339.70293-8-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 Use the new pci_alloc_irq_vectors() and pci_free_irq_vectors() to replace the deprecated pci_enable_msix_range() and pci_disable_msix(). Reviewed-by: Somnath Kotur Reviewed-by: Pavan Chebbi Signed-off-by: Michael Chan Reviewed-by: Simon Horman --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 085dffcbe6f2..c0695a06744d 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -10698,7 +10698,6 @@ 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; - struct msix_entry *msix_ent; total_vecs = bnxt_get_num_msix(bp); max = bnxt_get_max_func_irqs(bp); @@ -10708,19 +10707,11 @@ static int bnxt_init_int_mode(struct bnxt *bp) if (!total_vecs) return 0; - msix_ent = kcalloc(total_vecs, sizeof(struct msix_entry), GFP_KERNEL); - if (!msix_ent) - return -ENOMEM; - - for (i = 0; i < total_vecs; i++) { - msix_ent[i].entry = i; - msix_ent[i].vector = 0; - } - if (!(bp->flags & BNXT_FLAG_SHARED_RINGS)) min = 2; - total_vecs = pci_enable_msix_range(bp->pdev, msix_ent, min, total_vecs); + total_vecs = pci_alloc_irq_vectors(bp->pdev, min, total_vecs, + PCI_IRQ_MSIX); ulp_msix = bnxt_get_ulp_msix_num(bp); if (total_vecs < 0 || total_vecs < ulp_msix) { rc = -ENODEV; @@ -10730,7 +10721,7 @@ static int bnxt_init_int_mode(struct bnxt *bp) bp->irq_tbl = kcalloc(total_vecs, sizeof(struct bnxt_irq), GFP_KERNEL); if (bp->irq_tbl) { for (i = 0; i < total_vecs; i++) - bp->irq_tbl[i].vector = msix_ent[i].vector; + bp->irq_tbl[i].vector = pci_irq_vector(bp->pdev, i); bp->total_irqs = total_vecs; /* Trim rings based upon num of vectors allocated */ @@ -10748,21 +10739,19 @@ static int bnxt_init_int_mode(struct bnxt *bp) rc = -ENOMEM; goto msix_setup_exit; } - kfree(msix_ent); return 0; msix_setup_exit: netdev_err(bp->dev, "bnxt_init_int_mode err: %x\n", rc); kfree(bp->irq_tbl); bp->irq_tbl = NULL; - pci_disable_msix(bp->pdev); - kfree(msix_ent); + pci_free_irq_vectors(bp->pdev); return rc; } static void bnxt_clear_int_mode(struct bnxt *bp) { - pci_disable_msix(bp->pdev); + pci_free_irq_vectors(bp->pdev); kfree(bp->irq_tbl); bp->irq_tbl = NULL;