From patchwork Mon Sep 9 20:27:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13797554 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.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 9BF7D189F5A for ; Mon, 9 Sep 2024 20:27:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725913675; cv=none; b=uLkV2xPA3xB8FnecR6vLpVVYdfH5weU4s1SJjZWV1FYz0xzcj5pAn1NIiDs6FiwegYM4n7KyJblENdH+6MEjO6M/Ulk253zQRMUFkmoz6y0rJBEX99UnQOHLmDG0AQ47BqUs2APtDiMYPXebknykYX9c7P/+jb8Bcu9n7slqw7w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725913675; c=relaxed/simple; bh=IoMLM+pM4PI4PCaP0U82Z56e8odOqzBgITB4+hKYtYA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j27ItxhleQFHXvqBK78gFIJpwht+6LuU6cDPpoTNYNWyGswZNpMDPyjCgnNMwmdCF9BT9kcyrhWy+pTE604kBJV3tZAOys+uuszLjr7qhBgtKA3/kiuz32OgMw2I3pQWoketUfKFYekE8cSPFAcYXmDJaYfvea3vTNOIEIkHiZk= 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=dLUH2ff3; arc=none smtp.client-ip=209.85.215.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="dLUH2ff3" Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-7d666fb3fb9so1873714a12.0 for ; Mon, 09 Sep 2024 13:27:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1725913673; x=1726518473; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ilD7dyTO6/xNbxDdpuRmI8uD5Jsijx4sm+AvYWaLjOU=; b=dLUH2ff3pNUomPF5p8w4oizZiyzpl2nR7i3a3yA2/Ww/TG5NGiRai2jFi+PY1Dx7rK 2/GtNXTsrKGQOGQ0inYUmv2g3EVCDLUTPJq+sf1SlJf+PZjyUncY2heCqsU0LJoStQwp 9Ko+b803yCIAT4uDwjfuGLFfqdAgZsQH6JU1M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725913673; x=1726518473; h=content-transfer-encoding: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=ilD7dyTO6/xNbxDdpuRmI8uD5Jsijx4sm+AvYWaLjOU=; b=tb94bGg+4x7iE8qbRKhCfXjJ+r6SmZbmPjLdaireLYExaaGGnBeoJM1n7O7/l9ogIY oG4nxXDIAK7Ws+kpD/qigwXG7NcZwPCNN1LdWqxaXU2sU/VxxOxzTJBl/DUDnzSjVrqB UACyo93/iM5V0K5HMRBUDP751857wizwCJEu4siiy8/7MFDTXvwMNR/vHKD6tlzdCuSs fzByTYQ9bC2mK8CDQUmmJfzfeT2FrMLf3sg/To8DBLTBYU/khyYXq3ZomUYReT1KusTc QTI8uF447FlLGv+Asf0FsNksdlweDf9jgtR05rGeaJ1SOLEm/uSVeEgdQl3RkjiZa/nl ptow== X-Gm-Message-State: AOJu0Yz/ZroDodgyuiq/Dda2zUuHHP00Y7KifkPlF6jEcJYzNTnAoSUh zpwxjiK6M8C6Q3betrNNpCjsx5LrS31EFTpDD+zsGl/SkdfFMyIeROD51H2C5A== X-Google-Smtp-Source: AGHT+IG979PCcxo5O60MSkVlmgolXHcRfZbp/R+3yKN1zc08vPtgo4KZ+UChrvxFqxcDePXRsxq/sQ== X-Received: by 2002:a05:6a21:3e0a:b0:1cf:2d22:564e with SMTP id adf61e73a8af0-1cf4fd62e0emr1209289637.6.1725913672769; Mon, 09 Sep 2024 13:27:52 -0700 (PDT) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d8259bccbcsm4427640a12.79.2024.09.09.13.27.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Sep 2024 13:27:51 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, gospo@broadcom.com, selvin.xavier@broadcom.com, pavan.chebbi@broadcom.com, Andy Gospodarek Subject: [PATCH net-next 1/3] bnxt_en: Increase the number of MSIX vectors for RoCE device Date: Mon, 9 Sep 2024 13:27:35 -0700 Message-ID: <20240909202737.93852-2-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20240909202737.93852-1-michael.chan@broadcom.com> References: <20240909202737.93852-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 RocE is supported on the device, set the number of RoCE MSIX vectors to the number of online CPUs + 1 and capped at these maximums: VF: 2 NPAR: 5 PF: 64 For the PF, the maximum is now increased from the previous value of 9 to get better performance for kernel applications. Remove the unnecessary check for BNXT_FLAG_ROCE_CAP. bnxt_set_dflt_ulp_msix() will only be called if the flag is set. Reviewed-by: Andy Gospodarek Signed-off-by: Michael Chan Reviewed-by: Simon Horman --- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 14 ++++++++++---- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h | 6 ++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c index b9e7d3e7b15d..fdd6356f21ef 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c @@ -176,11 +176,17 @@ EXPORT_SYMBOL(bnxt_unregister_dev); static int bnxt_set_dflt_ulp_msix(struct bnxt *bp) { - u32 roce_msix = BNXT_VF(bp) ? - BNXT_MAX_VF_ROCE_MSIX : BNXT_MAX_ROCE_MSIX; + int roce_msix = BNXT_MAX_ROCE_MSIX; - return ((bp->flags & BNXT_FLAG_ROCE_CAP) ? - min_t(u32, roce_msix, num_online_cpus()) : 0); + if (BNXT_VF(bp)) + roce_msix = BNXT_MAX_ROCE_MSIX_VF; + else if (bp->port_partition_type) + roce_msix = BNXT_MAX_ROCE_MSIX_NPAR_PF; + + /* NQ MSIX vectors should match the number of CPUs plus 1 more for + * the CREQ MSIX, up to the default. + */ + return min_t(int, roce_msix, num_online_cpus() + 1); } int bnxt_send_msg(struct bnxt_en_dev *edev, diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h index 4eafe6ec0abf..4f4914f5c84c 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h @@ -15,8 +15,10 @@ #define BNXT_MIN_ROCE_CP_RINGS 2 #define BNXT_MIN_ROCE_STAT_CTXS 1 -#define BNXT_MAX_ROCE_MSIX 9 -#define BNXT_MAX_VF_ROCE_MSIX 2 + +#define BNXT_MAX_ROCE_MSIX_VF 2 +#define BNXT_MAX_ROCE_MSIX_NPAR_PF 5 +#define BNXT_MAX_ROCE_MSIX 64 struct hwrm_async_event_cmpl; struct bnxt; From patchwork Mon Sep 9 20:27:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13797555 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (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 40CBE18A6C2 for ; Mon, 9 Sep 2024 20:27:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725913676; cv=none; b=qp7AKxeqIeDWgJf/e57WrgiUz835Z9DSlGHkq59mQ9he4uhb3W+m51gzhxA6VXoz2jl8uwpKmU/r4HGXuBMXgJYZ+tW2z31cdzZ9621ndhMX0v47dggoe9Y9tyrFO9M0zMZkVB8ZPlLia5NVtJvQE12Vsyhq2h4/mzYK6Dn5nGg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725913676; c=relaxed/simple; bh=QJQh+h/Pqn6NlvbAgKbgMGBsbq0wJfw1xIwzHg7WAQ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=s4QtO2Ekjao8ukbI03W+0WrV7s17OMqm39ecsnM5ammc0daE1I66gLSK4lNdcc2pYW7tJgIWIiiWhJ4jz5y41roO61DGWpNvRa1rZBYOOmCuW4mE8QFJ/rSVa4uvH+ybYq2mErjsZMd/qGG65wI+aXmeVWMaunjlQkjY6yfMvDE= 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=WLksWkfa; arc=none smtp.client-ip=209.85.215.179 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="WLksWkfa" Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-6e7b121be30so3057542a12.1 for ; Mon, 09 Sep 2024 13:27:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1725913674; x=1726518474; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7uxF6Cg0CSkbEeMgc2zVaa3upbCVBR7QxQBGiN3DuhY=; b=WLksWkfa4kS57b1hMqxgDn1WCCKlWnckRjp9K3z5XwQUxZNcjgpaRbWDyHuSSTbOgc Uq6WxnTyjIA3dtCMZ1i/AkBbN3yFWNmAztKFQBdweIGFdJ3ZnkjYfXYrHN+VtwfHrI5U hI/wS9hFks0sMoqDAz1tJfCjjUkyhKsPdNigQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725913674; x=1726518474; h=content-transfer-encoding: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=7uxF6Cg0CSkbEeMgc2zVaa3upbCVBR7QxQBGiN3DuhY=; b=dmbFR5bjbws8sQE9/o1l6qM8Qm6EEwMwk5tkMkIQ61Y+grKV1JQzbpHHtHOy+8tbBa ZC6zRtymsFcIr/DawlzRMlgS9+nSuL5ei+vgy2e4rahcDptBIxXE64L+GYAlXyC4T457 hA5AbJjuYVRXbxBbEsC3JVhSNEqnlmFvg4U3DLXoXVDUfSma/pDh2Qa2Z1mllfM7WZ0t XhWbr4rvCL4QZs/bQCBvSMS6Iq+YaJXziAxmuJKE/Hu2HcZdrWaLgQc4zL+IoRDrTxjZ cOjOll7rQFF1gbDbasvknuO7jokBNzu5jaaBY7rDDC+JbpLCOWm0SladMMMbVtSautXP 8Rvg== X-Gm-Message-State: AOJu0Yz5k68e7P5hm0eHg2edSM3EF4APWYVEF2Us4DdXwYCxaSqKoSUy DzNDjsAZyL3uGl52tUx4Dol41s1z/MYSsoZ1VPdQxrSw80vGx1v79qzsLpcVvg== X-Google-Smtp-Source: AGHT+IGMUZiuNYM3EOufhM0F2JTPu1W9wIaU4ea9Cy9THFJNhG+VwiqwYvwDqMRClnitp3lvcNMjgw== X-Received: by 2002:a05:6a20:2d14:b0:1c6:ba9c:5d7b with SMTP id adf61e73a8af0-1cf1d0f98b5mr11113235637.23.1725913674352; Mon, 09 Sep 2024 13:27:54 -0700 (PDT) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d8259bccbcsm4427640a12.79.2024.09.09.13.27.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Sep 2024 13:27:53 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, gospo@broadcom.com, selvin.xavier@broadcom.com, pavan.chebbi@broadcom.com, Somnath Kotur , Kalesh AP , Andy Gospodarek Subject: [PATCH net-next 2/3] bnxt_en: Add MSIX check in bnxt_check_rings() Date: Mon, 9 Sep 2024 13:27:36 -0700 Message-ID: <20240909202737.93852-3-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20240909202737.93852-1-michael.chan@broadcom.com> References: <20240909202737.93852-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 bnxt_check_rings() is called to ensure that we have the hardware ring resources before committing to reinitialize with the new number of rings. MSIX vectors are never checked at this point, because up until recently we must first disable MSIX before we can allocate the new set of MSIX vectors. Now that we support dynamic MSIX allocation, check to make sure we can dynamically allocate the new MSIX vectors as the last step in bnxt_check_rings() if dynamic MSIX is supported. For example, the IOMMU group may limit the number of MSIX vectors for the device. With this patch, the ring change will fail more gracefully when there is not enough MSIX vectors. It is also better to move bnxt_check_rings() to be called as the last step when changing ethtool rings. Reviewed-by: Somnath Kotur Reviewed-by: Kalesh AP Reviewed-by: Andy Gospodarek Signed-off-by: Michael Chan Reviewed-by: Simon Horman --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 19 ++++++++++++++++++- .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 11 ++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index c9248ed9330c..6e422e24750a 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -13803,6 +13803,7 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs, int max_rx, max_tx, max_cp, tx_sets = 1, tx_cp; struct bnxt_hw_rings hwr = {0}; int rx_rings = rx; + int rc; if (tcs) tx_sets = tcs; @@ -13835,7 +13836,23 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs, } if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) hwr.cp_p5 = hwr.tx + rx; - return bnxt_hwrm_check_rings(bp, &hwr); + rc = bnxt_hwrm_check_rings(bp, &hwr); + if (!rc && pci_msix_can_alloc_dyn(bp->pdev)) { + if (!bnxt_ulp_registered(bp->edev)) { + hwr.cp += bnxt_get_ulp_msix_num(bp); + hwr.cp = min_t(int, hwr.cp, bnxt_get_max_func_irqs(bp)); + } + if (hwr.cp > bp->total_irqs) { + int total_msix = bnxt_change_msix(bp, hwr.cp); + + if (total_msix < hwr.cp) { + netdev_warn(bp->dev, "Unable to allocate %d MSIX vectors, maximum available %d\n", + hwr.cp, total_msix); + rc = -ENOSPC; + } + } + } + return rc; } static void bnxt_unmap_bars(struct bnxt *bp, struct pci_dev *pdev) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 7392a716f28d..4aecc40be6eb 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -955,11 +955,6 @@ static int bnxt_set_channels(struct net_device *dev, } tx_xdp = req_rx_rings; } - rc = bnxt_check_rings(bp, req_tx_rings, req_rx_rings, sh, tcs, tx_xdp); - if (rc) { - netdev_warn(dev, "Unable to allocate the requested rings\n"); - return rc; - } if (bnxt_get_nr_rss_ctxs(bp, req_rx_rings) != bnxt_get_nr_rss_ctxs(bp, bp->rx_nr_rings) && @@ -968,6 +963,12 @@ static int bnxt_set_channels(struct net_device *dev, return -EINVAL; } + rc = bnxt_check_rings(bp, req_tx_rings, req_rx_rings, sh, tcs, tx_xdp); + if (rc) { + netdev_warn(dev, "Unable to allocate the requested rings\n"); + return rc; + } + if (netif_running(dev)) { if (BNXT_PF(bp)) { /* TODO CHIMP_FW: Send message to all VF's From patchwork Mon Sep 9 20:27: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: 13797556 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) (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 E34C218A939 for ; Mon, 9 Sep 2024 20:27:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725913678; cv=none; b=PR9rIoOiq7YL6rvHDtwzxDVv6eTQZZ7dDaOlppjdMbFHua9SC/sEwR4p51W6tQh1O2PnAHfRSQar7WBszD0UWjEqeZFqGc5t9hvTps+ZxOkOnQ9xjyZiNKdiIqvgjGXr3Mhukm3+kuzsIEJzskhgMHSVVyyAltF7FbYp2UNj740= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725913678; c=relaxed/simple; bh=NfSezVbqpVPh3z734Wfe0yOT2S2BDv3q5d4evui9eHs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rHKiU3A79bRa9u+Wq6oEUDFqixapXZGJkY5COTNX/yFo0vvl46wrA825KXu5TxORChvL+Q+vWtXCg0cXegxsn7Z5kZLvUX0MPVlLA6iUJDIq0kR0aBqH3S2X4Z3htfv33DrIatfMTAruwxhwbvU10Byebb5/+jU8qF80QtiE/w8= 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=bxEI4ire; arc=none smtp.client-ip=209.85.167.179 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="bxEI4ire" Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-3e04b7b3c6dso434366b6e.2 for ; Mon, 09 Sep 2024 13:27:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1725913676; x=1726518476; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=00kPR+cauuf6XV+1sL3yq8G8B46prJwufLkaH1X+q4s=; b=bxEI4ire1dF2Q2VQyV0D/7MxQ8X92RHXGpItzzXhs/5cxXDE6CqecnTnbX3WldoUfK SDpBSJy3jZWfhK173NMGjXd2rz/x+LVNdmC+SL9SoEAmOtcIsBnDS8C11YOHQb/JOt19 q7DIbYOl5uUojbcn6exkPEqeQenPqxBWbNa9Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725913676; x=1726518476; h=content-transfer-encoding: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=00kPR+cauuf6XV+1sL3yq8G8B46prJwufLkaH1X+q4s=; b=XC9n24Vfpx6EDjz2GeW3s68mPE2gEdSLSh/YywrGLReNTxRujOH8bT/pEFqTYcTKUw kDJrTxI/mxBFKeBQgasI6DEKm9Ml6vQbAQSn2O7Ibr8mPNSUKVc5Xx4JjXbyVcWOw89S fPI8ARnKTBNife3OfYkS/c0WLtL6H5q051HNt4nZfSITfPHfYgoq+4ktRNFyjrfOPUmX Q2NA8ObbI/BLDZoLWNufF7hdbKco/1KpeQqfNsNqss6oQS6mS3cD+C4W7aAUSOOUOQx5 BbtswDZpYvDN958ZsxFrAR9M0Orw9MpYQj5vGsChx6rGO8ATaDi2gQIXfrEO9qIXpZh6 5Oww== X-Gm-Message-State: AOJu0Ywiu9fMVmKaFv/FlWM1NzmTDogu9UA/MdOuMz23UYncExN+j4av 2tnev4AKeFkHDXnx/T+AeKOj9TPzhMhsyIecq2n1E7rQ8R5f2iUbol5kvQUyLA== X-Google-Smtp-Source: AGHT+IGSwqrqwJVSY+PDJ0na4ow1TTzjAvCAZM1R/eZsXXTzH+FsGUYcjZHR3uKx2LmnsgrMcaLVOw== X-Received: by 2002:a05:6808:bd3:b0:3e0:473f:58bc with SMTP id 5614622812f47-3e0473f5e82mr3694549b6e.17.1725913675680; Mon, 09 Sep 2024 13:27:55 -0700 (PDT) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d8259bccbcsm4427640a12.79.2024.09.09.13.27.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Sep 2024 13:27:55 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, gospo@broadcom.com, selvin.xavier@broadcom.com, pavan.chebbi@broadcom.com Subject: [PATCH net-next 3/3] bnxt_en: resize bnxt_irq name field to fit format string Date: Mon, 9 Sep 2024 13:27:37 -0700 Message-ID: <20240909202737.93852-4-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20240909202737.93852-1-michael.chan@broadcom.com> References: <20240909202737.93852-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: Edwin Peer The name field of struct bnxt_irq is written using snprintf in bnxt_setup_msix(). Make the field large enough to fit the maximal formatted string to prevent truncation. Truncated IRQ names are less meaningful to the user. For example, "enp4s0f0np0-TxRx-0" gets truncated to "enp4s0f0np0-TxRx-" with the existing code. Make sure we have space for the extra characters added to the IRQ names: - the characters introduced by the static format string: hyphens - the maximal static substituted ring type string: "TxRx" - the maximum length of an integer formatted as a string, even though reasonable ring numbers would never be as long as this. Signed-off-by: Edwin Peer Signed-off-by: Michael Chan Reviewed-by: Simon Horman --- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 3b805ed433ed..69231e85140b 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -1217,12 +1217,15 @@ struct bnxt_napi { bool in_reset; }; +/* "TxRx", 2 hypens, plus maximum integer */ +#define BNXT_IRQ_NAME_EXTRA 17 + struct bnxt_irq { irq_handler_t handler; unsigned int vector; u8 requested:1; u8 have_cpumask:1; - char name[IFNAMSIZ + 2]; + char name[IFNAMSIZ + BNXT_IRQ_NAME_EXTRA]; cpumask_var_t cpu_mask; };