From patchwork Tue Apr 9 21:54:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13623280 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (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 C7BF1158A37 for ; Tue, 9 Apr 2024 21:54:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712699698; cv=none; b=DtPxztwVEO+KEtQZa8Byoi+tAglEhrvh2tRVswv6pJbWJGh9YcJCCBRbgqmK2ZfxnYRSZrYr3TSFbToFP888cAGim1ne1P+W0RpjZo0U70/apIm5d4sWxzXz/v5zz+k7tyLOSwDYh3INbtGjyWSrRexxuPUPj8mtpvs3EVAs0uo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712699698; c=relaxed/simple; bh=DE36xFvE7B7guPegznarAm0TQmeYd3/VyxjI0XZ640E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=EzXLn1CV/2faA4lLwbPi/uSnDHMdz0xP7NASrjJhSut/cXeigBxoKzBptBsR+QZyL6kwVRfRydSFy0xFABcVTBR+A9HHIT68JNt+jsCKj5FrDdvEtQM0esbRf7xvREoblUxs5EofaYwBaOFT8Dk1rQrVLMVfW8rZ5HHynnKHh50= 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=dU8GQtA6; arc=none smtp.client-ip=209.85.214.180 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="dU8GQtA6" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1e4266673bbso23642625ad.2 for ; Tue, 09 Apr 2024 14:54:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1712699696; x=1713304496; 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=oJB/79BEZAa3LWVuqfORyW2Ld4UjXZdq0FGdt1L9ezY=; b=dU8GQtA6JMX6lezTQ+LDXwWpom0R6YbKAFOSJcpIgjFVcI8ps2jk+pzDpg+cXsznZ+ Us/NrvBU1V02tXcyy7RkCMCBA6/+KIQy6OPQLZffd5G0ISrVhm9B6ebT85/3hEWZTxS+ M9IGYPsnmAil3RjG1hLsPxt6/neBH0NJOffhk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712699696; x=1713304496; 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=oJB/79BEZAa3LWVuqfORyW2Ld4UjXZdq0FGdt1L9ezY=; b=ozkalTraim9gapcbqpbCBGT4QiGtR+iRS8H9Nt53HH7rIQ4KrkLrzUFHyJ5a6FuZpo +CePDcxm7U3e3bx2OvJQ7IcBMIhQeRZRhar0p9O+tlGnI6YRdbCKTmbUJEbN1+QjlgZl 9JBBo8rPCX1lNGUoHu5DBof883/iHgFknPP3+kmD+5GQfkQErFN8zazDVb2EUY1K4qNu 4EhKuC8R8Cfh+v9WXk65THMpQTcsOsN6bvQi0PtLEFdpHvzh8BwxQhm8NRIZa4LrPwk/ Jsp/qa9JxNLs+MqKa9oA0kT8NJg4Kux+z3Wml7DrTJtfWtu+/PR5J3+v+9LCVsiaItOT uOvQ== X-Gm-Message-State: AOJu0YzEJjNfZ8eDODpnukYdMSNeXG94p+2Q0AjCo5wL3ZEl/zHukgpk o6PK/9eq+vRzB1GgfH0TxBzSq9nD2Q0x3zBDLh95ytxKFWPOQcnxM2QsL/gsNA== X-Google-Smtp-Source: AGHT+IF3gfB4lNa3j3+45isjso2dKdTQSOSSzwSYgOk/ecJEl+EH3ZaZyFY5HxOXGcEGCcx+IPzSmw== X-Received: by 2002:a17:903:25cd:b0:1e0:9ee1:d4cf with SMTP id jc13-20020a17090325cd00b001e09ee1d4cfmr914325plb.41.1712699695571; Tue, 09 Apr 2024 14:54:55 -0700 (PDT) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b001e3e081dea1sm6983687plb.0.2024.04.09.14.54.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2024 14:54:54 -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, Vikas Gupta , Somnath Kotur Subject: [PATCH net-next 3/7] bnxt_en: Remove unneeded MSIX base structure fields and code Date: Tue, 9 Apr 2024 14:54:27 -0700 Message-Id: <20240409215431.41424-4-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20240409215431.41424-1-michael.chan@broadcom.com> References: <20240409215431.41424-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 From: Vikas Gupta Ever since commit: 303432211324 ("bnxt_en: Remove runtime interrupt vector allocation") The MSIX base vector is effectively always 0. Remove all unneeded structure fields and code referencing the MSIX base. Reviewed-by: Somnath Kotur Reviewed-by: Andy Gospodarek Signed-off-by: Vikas Gupta Signed-off-by: Michael Chan Reviewed-by: Jacob Keller --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 31 +++---------------- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 20 +++--------- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h | 2 -- 3 files changed, 8 insertions(+), 45 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 795f3f957eb5..8213a37cba3e 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -3905,13 +3905,12 @@ static int bnxt_alloc_cp_sub_ring(struct bnxt *bp, static int bnxt_alloc_cp_rings(struct bnxt *bp) { bool sh = !!(bp->flags & BNXT_FLAG_SHARED_RINGS); - int i, j, rc, ulp_base_vec, ulp_msix; + int i, j, rc, ulp_msix; int tcs = bp->num_tc; if (!tcs) tcs = 1; ulp_msix = bnxt_get_ulp_msix_num(bp); - ulp_base_vec = bnxt_get_ulp_msix_base(bp); for (i = 0, j = 0; i < bp->cp_nr_rings; i++) { struct bnxt_napi *bnapi = bp->bnapi[i]; struct bnxt_cp_ring_info *cpr, *cpr2; @@ -3930,10 +3929,7 @@ static int bnxt_alloc_cp_rings(struct bnxt *bp) if (rc) return rc; - if (ulp_msix && i >= ulp_base_vec) - ring->map_idx = i + ulp_msix; - else - ring->map_idx = i; + ring->map_idx = ulp_msix + i; if (!(bp->flags & BNXT_FLAG_CHIP_P5_PLUS)) continue; @@ -7347,17 +7343,7 @@ static int bnxt_hwrm_reserve_rings(struct bnxt *bp, struct bnxt_hw_rings *hwr) int bnxt_nq_rings_in_use(struct bnxt *bp) { - int cp = bp->cp_nr_rings; - int ulp_msix, ulp_base; - - ulp_msix = bnxt_get_ulp_msix_num(bp); - if (ulp_msix) { - ulp_base = bnxt_get_ulp_msix_base(bp); - cp += ulp_msix; - if ((ulp_base + ulp_msix) > cp) - cp = ulp_base + ulp_msix; - } - return cp; + return bp->cp_nr_rings + bnxt_get_ulp_msix_num(bp); } static int bnxt_cp_rings_in_use(struct bnxt *bp) @@ -7373,16 +7359,7 @@ static int bnxt_cp_rings_in_use(struct bnxt *bp) static int bnxt_get_func_stat_ctxs(struct bnxt *bp) { - int ulp_stat = bnxt_get_ulp_stat_ctxs(bp); - int cp = bp->cp_nr_rings; - - if (!ulp_stat) - return cp; - - if (bnxt_nq_rings_in_use(bp) > cp + bnxt_get_ulp_msix_num(bp)) - return bnxt_get_ulp_msix_base(bp) + ulp_stat; - - return cp + ulp_stat; + return bp->cp_nr_rings + bnxt_get_ulp_stat_ctxs(bp); } static int bnxt_get_total_rss_ctxs(struct bnxt *bp, struct bnxt_hw_rings *hwr) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c index fd890819d4bc..cae88747b110 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c @@ -31,21 +31,20 @@ static DEFINE_IDA(bnxt_aux_dev_ids); static void bnxt_fill_msix_vecs(struct bnxt *bp, struct bnxt_msix_entry *ent) { struct bnxt_en_dev *edev = bp->edev; - int num_msix, idx, i; + int num_msix, i; if (!edev->ulp_tbl->msix_requested) { netdev_warn(bp->dev, "Requested MSI-X vectors insufficient\n"); return; } num_msix = edev->ulp_tbl->msix_requested; - idx = edev->ulp_tbl->msix_base; for (i = 0; i < num_msix; i++) { - ent[i].vector = bp->irq_tbl[idx + i].vector; - ent[i].ring_idx = idx + i; + ent[i].vector = bp->irq_tbl[i].vector; + ent[i].ring_idx = i; if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) ent[i].db_offset = bp->db_offset; else - ent[i].db_offset = (idx + i) * 0x80; + ent[i].db_offset = i * 0x80; } } @@ -111,17 +110,6 @@ int bnxt_get_ulp_msix_num(struct bnxt *bp) min_t(u32, roce_msix, num_online_cpus()) : 0); } -int bnxt_get_ulp_msix_base(struct bnxt *bp) -{ - if (bnxt_ulp_registered(bp->edev)) { - struct bnxt_en_dev *edev = bp->edev; - - if (edev->ulp_tbl->msix_requested) - return edev->ulp_tbl->msix_base; - } - return 0; -} - int bnxt_get_ulp_stat_ctxs(struct bnxt *bp) { if (bnxt_ulp_registered(bp->edev)) { diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h index b9e73de14b57..f8df4095399f 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h @@ -46,7 +46,6 @@ struct bnxt_ulp { unsigned long *async_events_bmap; u16 max_async_event_id; u16 msix_requested; - u16 msix_base; atomic_t ref_count; }; @@ -96,7 +95,6 @@ static inline bool bnxt_ulp_registered(struct bnxt_en_dev *edev) } int bnxt_get_ulp_msix_num(struct bnxt *bp); -int bnxt_get_ulp_msix_base(struct bnxt *bp); int bnxt_get_ulp_stat_ctxs(struct bnxt *bp); void bnxt_ulp_stop(struct bnxt *bp); void bnxt_ulp_start(struct bnxt *bp, int err);