From patchwork Tue Apr 9 21:54:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13623278 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (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 F3654158A3D for ; Tue, 9 Apr 2024 21:54:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712699694; cv=none; b=RAjdDrUHM3C1vHyVLncKQy7FzKymTnruHWBmMzIyC1yzYPQteR0l5+pMQDbuSX28m+EUbkQ6nVDmTHXQrWjNWniVh3vECa5tXA3eESJs3k6WgMiZTN3cr7eE0yhBX6AcWdAAgBt5XQE67YvNerjcNIExUQx4oRZLKT2j8i2iLyI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712699694; c=relaxed/simple; bh=MEcnLix/Wd8btksbaTEI1TFpQnqkUrXYBAqaUSBtqX0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=OdwcL4MpAj3/2ses4bzO/U//j6eZHKOaFn3mZP+4IPkD/4QvA+VYfIG4bZqcOSn44QBKZy800oproXUtLVhAevQoUYozuW2+G2bk/5RpShFSYkEKBgFkePgbvWy+9yMd9VwYBzzV63ddCtuCluqUutjtGIBDtQIVB8WOreDBlDE= 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=JrY/TPDl; arc=none smtp.client-ip=209.85.210.171 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="JrY/TPDl" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-6ed20fb620fso2528906b3a.2 for ; Tue, 09 Apr 2024 14:54:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1712699692; x=1713304492; 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=PtvFd6Kd77nn+odLvoUqL485YQW3L+mJmJZAOAl7TeI=; b=JrY/TPDlHcdexSqhrXUXkFbzrhnZ4ug+IdY8rCYX/2EF9LQ9IbH5qt5H7hAVcsLJIr LgjrlsW11tmpkcp/vrJor+huuQSAgCncBKqpAZlk5hGys+Cmm71qy/vmPCyhP1iEH0v6 mdjrVS+76ZOYVqp9QXozshFsokXELQzG2AFLw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712699692; x=1713304492; 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=PtvFd6Kd77nn+odLvoUqL485YQW3L+mJmJZAOAl7TeI=; b=PQ8lbGH3bjzHoZjspq/o9T0zMltWhbD2DHImshVuRyWRywqFQOnHTbZaPmZY4sP2px X9HfEZpfN5DGpUdz3ncSsnevLL7JnOYUUrevFE7vKk0EA87U3A66JanWMJqHgK44+P5h pNBasaNob95yEHwwacJCVZPp2rAw8vo41sHnaGC/CKBJ/cdMp+NnCKD38WfJW9XOARzd k/tv5wyjhWDcJJYh/77qznjS3lPBU560sJkFfb44pbCUfQ1X8UpRAVGACL3aFTTUzity UFtv+nAl8k0B4ar8eqJjGXPiOJ6HHDv4MPfhMAUZWILDOxPKPPVAHPvI4YpTIpMm6Iaj o7Gw== X-Gm-Message-State: AOJu0Yw4eTWQVo2JJ0yPN1us7bBSUcKk4AWyOKACOVYPjvmae5Pap8oD 5xhlgG+QNfQhHg68T8Fi3ym2NPE9QzDbgTO5ykw30i9Z0k8NeR3UGwyhN19eJA== X-Google-Smtp-Source: AGHT+IGbbShBvkhRClt03D5IbuzG33Tnekn3MK4sRkKtU0hTDXyTdcH1Y4W52yNFHzRRjRQb3oiegw== X-Received: by 2002:a05:6a21:7894:b0:1a7:4b40:96db with SMTP id bf20-20020a056a21789400b001a74b4096dbmr1269966pzc.10.1712699691993; Tue, 09 Apr 2024 14:54:51 -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.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2024 14:54:51 -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, Kalesh AP , Somnath Kotur Subject: [PATCH net-next 1/7] bnxt_en: Skip ethtool RSS context configuration in ifdown state Date: Tue, 9 Apr 2024 14:54:25 -0700 Message-Id: <20240409215431.41424-2-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: Pavan Chebbi The current implementation requires the ifstate to be up when configuring the RSS contexts. It will try to fetch the RX ring IDs and will crash if it is in ifdown state. Return error if !netif_running() to prevent the crash. An improved implementation is in the works to allow RSS contexts to be changed while in ifdown state. Fixes: b3d0083caf9a ("bnxt_en: Support RSS contexts in ethtool .{get|set}_rxfh()") Reviewed-by: Kalesh AP Reviewed-by: Somnath Kotur Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan Reviewed-by: Jacob Keller --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 9c49f629d565..68444234b268 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -1876,6 +1876,11 @@ static int bnxt_set_rxfh_context(struct bnxt *bp, return -EOPNOTSUPP; } + if (!netif_running(bp->dev)) { + NL_SET_ERR_MSG_MOD(extack, "Unable to set RSS contexts when interface is down"); + return -EAGAIN; + } + if (*rss_context != ETH_RXFH_CONTEXT_ALLOC) { rss_ctx = bnxt_get_rss_ctx_from_index(bp, *rss_context); if (!rss_ctx) { From patchwork Tue Apr 9 21:54:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13623279 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (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 C51D9158D70 for ; Tue, 9 Apr 2024 21:54:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712699696; cv=none; b=a3joH138IIFGw7DRZc2VTuS/uUG6zHph/IW3vzkts9vpbqeFE5WemVz7+OpRdA5/Z1liKc7ujsLcxo8rIK562oKdfdP1zwFJAP21kaogfwyR6CzfFWrIioERCQD5iyScpjYGc1dj8ETnBrxbofQGqqnfBOZl5x1ad5pn751kvjA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712699696; c=relaxed/simple; bh=StFW7/nRK2KNMwYnAHda7tVJzsil5oUoUnzi+R/NdGc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=izzo2CdtMV7HjB6BpCr3YGLcjrdJJrBxTQxCFXXCq/dKOP4C4+AYXMyQk+D30Lq1B+0ufaZjcX4oxjzBgRPb12xn/ieizOqy2kRwVF55YFqMCkMvGtg3TUdkzTP+nDXJ9pc8EmLzJDFZdaVZpr4RTZVtITSbHLu7daIcf47pq0A= 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=X5IrU6PL; arc=none smtp.client-ip=209.85.215.173 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="X5IrU6PL" Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-5d3907ff128so5116397a12.3 for ; Tue, 09 Apr 2024 14:54:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1712699694; x=1713304494; 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=E9HOG+p18/YwVjGzDQQFCoXS65i4FGfH9omv2K3d+N8=; b=X5IrU6PLYDfuVaYOHDCi3sUyLiPAGfJaEuHUHJome3Yh41LbJ/e2mk6lWza79QfgfM 3WZbQqkZelxHqUkRtueL91g4hZP7k+kdvHknXF9kpAKAk6yBz9JFsopndAAFWfcdTi4u cq/Tb4IESFv+8wCyXR+8wLJfpuda2DX0vNZ4E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712699694; x=1713304494; 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=E9HOG+p18/YwVjGzDQQFCoXS65i4FGfH9omv2K3d+N8=; b=RjwpI6ISETnYV1YVtnfT7W8+k9yie/pjeF2RKfyusxnqeAiGIEQCCn1IJRwIoENdVh lpKzRugxfToroHqm5KdPWYLIdsviUH4oV6FhAL4E8WAPst7jV37Xed+oqqSCc+zEehhO URc8mVcgfVvg2QREvGYgqgVrEL27/PE2/SpW7Eqfug5pf/vO64+BfI7DLiGTP6l5DOJ4 yW/kWzB8tBIHwY9sVMJ72mt/pO9vqEkNGPyD098jJSighsIpV2k8QseKmNVgnahEUz65 Xc/o8oDz92NgdXmmZEV866VNzlEEkAuWLdsAGZryQfmPHdYVK/7TMSmaxBxuqI76Oxto R0Pw== X-Gm-Message-State: AOJu0YxJ7SInMxHJSB8XQkmPU+eN5kqrWUnEdHxSMNq6/EVGZLlUgcKS qJ7lDBo/0aPgonEh0DVXodPZz8RlCC3Z5ov2LkCOUlEFjGTw65VV/84XPdWaYg== X-Google-Smtp-Source: AGHT+IFiIhW/S532G8p8d9b6XC3JOCGSDZoLQDzghxI4njb5JCxgVE2siuTMd60UOw6XyF8QyCZrhA== X-Received: by 2002:a17:902:da86:b0:1e4:55d8:e5f1 with SMTP id j6-20020a170902da8600b001e455d8e5f1mr1267749plx.5.1712699693645; Tue, 09 Apr 2024 14:54:53 -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.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2024 14:54:52 -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, Kalesh AP , Vikas Gupta , Somnath Kotur Subject: [PATCH net-next 2/7] bnxt_en: Remove a redundant NULL check in bnxt_register_dev() Date: Tue, 9 Apr 2024 14:54:26 -0700 Message-Id: <20240409215431.41424-3-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: Kalesh AP The memory for "edev->ulp_tbl" is allocated inside the bnxt_rdma_aux_device_init() function. If it fails, the driver will not create the auxiliary device for RoCE. Hence the NULL check inside bnxt_register_dev() is unnecessary. Reviewed-by: Vikas Gupta Reviewed-by: Somnath Kotur Signed-off-by: Kalesh AP Signed-off-by: Michael Chan Reviewed-by: Jacob Keller --- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c index 86dcd2c76587..fd890819d4bc 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c @@ -64,9 +64,6 @@ int bnxt_register_dev(struct bnxt_en_dev *edev, return -ENOMEM; ulp = edev->ulp_tbl; - if (!ulp) - return -ENOMEM; - ulp->handle = handle; rcu_assign_pointer(ulp->ulp_ops, ulp_ops); 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); From patchwork Tue Apr 9 21:54:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13623281 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 68CAC158D91 for ; Tue, 9 Apr 2024 21:54:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712699701; cv=none; b=G0UfFBa6z7z7shQZyRYjOYWc0mvjq5bYQE9kAbcMupmB+v5cLhPnd9B7qpEr450QpR3MfIcwE+9NuLK0G1nUN2/KrGfi817dPpYN14KHivHft4oHflhz8EUu9VccSaAykVGl5OHHG87y8xR1zDT72gYQyLW1DDBq5NzYNR2mL14= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712699701; c=relaxed/simple; bh=61FDAwX7jHa+ItCQpLYECF+0sOjMhzZQ4+CpV0UlWUE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=szI2bcxCh062H3ve23XEAgleU+RmsNvZ0f7no9wcOrlEXlJHnggxPYFKx1VlRwNFMIVqay0626r9O/YqPrwqdqhN1xEg9he2dUFAIBov5H/Ln/BcQbkwvnukiwmIjWigDC7478z3VDmDFTFEEq49cO47r27HRqoal8ARLeD9bdw= 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=Xp7Tzyud; arc=none smtp.client-ip=209.85.214.170 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="Xp7Tzyud" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1e36b7e7dd2so39251245ad.1 for ; Tue, 09 Apr 2024 14:54:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1712699699; x=1713304499; 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=ZXySbWC15L67iUXb5gskHolh+euWlf3i1sGN9m+BaNM=; b=Xp7TzyudE3KWblI5eOTV1nReeoFXiZeNEvecpxO6ybU3KYuGMWMx597z7RqkIQe8lO ixE4NnReV/rzBs2Nv+qFMXZ2JRryHKlGAa6zo5o3VrDgtWtAJqFxYVyGWoY9t5AyEAwJ uXQ0I8Vs04BBmagoUCO/fK39mkYHcGIKA82pQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712699699; x=1713304499; 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=ZXySbWC15L67iUXb5gskHolh+euWlf3i1sGN9m+BaNM=; b=t00VaQBu+Vk/xO2gZUnqwuzOgTEaQzxCg18KmRP2DlciQLz9azdBWJLG4PAhi2hzw3 gk7FCbSyQoCIWlPdVqJ6yra/3MHtWRWkU+d8ekZtt4JTp+37HdFiH6Q9piQOQ/SVPde8 DlRM8XCecsL3CI+zQZmkvtPWw/3wMUrDEhP+nlbcRe4Y6lFQO1xDTVua32tPQneZnRuJ g/3uXBc4eCWlANtdwddxdZ2gYAd+6U+u8r0q+ORKzAF9ZPXdjPSkbWHEMcqtg5oMdWTV HF8wDOq1goLSHL1oMtusWxUzwgxxasR3HMRdGykTUnSWf6CRzcSxrlBg/oMI3yABLG7P aEYg== X-Gm-Message-State: AOJu0Yz8aHc77m0wHCjx4FuBlZ8XEMMqmyT60kTITKJH0B8nSTLjobxC JwP03LiYmYbY1pbFS+K4wWRxOFB7t5GIPzvVKDQ6bSbMOzlQFa7200AhDv18Uw== X-Google-Smtp-Source: AGHT+IH2EzpY8KNoEYG69im1t6UdJEhx2lyjZbM0xIYFOyYQS3uoy/H/4cDDWqHwZTSNdFfCZ7QuDA== X-Received: by 2002:a17:902:c105:b0:1e2:74af:e166 with SMTP id 5-20020a170902c10500b001e274afe166mr881541pli.63.1712699697805; Tue, 09 Apr 2024 14:54:57 -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.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2024 14:54:56 -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 Subject: [PATCH net-next 4/7] bnxt_en: Refactor bnxt_rdma_aux_device_init/uninit functions Date: Tue, 9 Apr 2024 14:54:28 -0700 Message-Id: <20240409215431.41424-5-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 In its current form, bnxt_rdma_aux_device_init() not only initializes the necessary data structures of the newly created aux device but also adds the aux device into the aux bus subsytem. Refactor the logic into separate functions, first function to initialize the aux device along with the required resources and second, to actually add the device to the aux bus subsytem. This separation helps to create bnxt_en_dev much earlier and save its resources separately. 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 | 10 ++++-- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 33 ++++++++++++++----- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h | 2 ++ 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 8213a37cba3e..8c24e83ba050 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -14786,10 +14786,13 @@ static void bnxt_remove_one(struct pci_dev *pdev) if (BNXT_PF(bp)) bnxt_sriov_disable(bp); - bnxt_rdma_aux_device_uninit(bp); + bnxt_rdma_aux_device_del(bp); bnxt_ptp_clear(bp); unregister_netdev(dev); + + bnxt_rdma_aux_device_uninit(bp); + bnxt_free_l2_filters(bp, true); bnxt_free_ntp_fltrs(bp, true); if (BNXT_SUPPORTS_MULTI_RSS_CTX(bp)) @@ -15408,13 +15411,15 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (BNXT_SUPPORTS_NTUPLE_VNIC(bp)) bnxt_init_multi_rss_ctx(bp); + bnxt_rdma_aux_device_init(bp); + rc = register_netdev(dev); if (rc) goto init_err_cleanup; bnxt_dl_fw_reporters_create(bp); - bnxt_rdma_aux_device_init(bp); + bnxt_rdma_aux_device_add(bp); bnxt_print_device_info(bp); @@ -15422,6 +15427,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) return 0; init_err_cleanup: + bnxt_rdma_aux_device_uninit(bp); bnxt_dl_unregister(bp); init_err_dl: bnxt_shutdown_tc(bp); diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c index cae88747b110..ae2b367b1226 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c @@ -291,7 +291,6 @@ void bnxt_rdma_aux_device_uninit(struct bnxt *bp) aux_priv = bp->aux_priv; adev = &aux_priv->aux_dev; - auxiliary_device_delete(adev); auxiliary_device_uninit(adev); } @@ -309,6 +308,14 @@ static void bnxt_aux_dev_release(struct device *dev) bp->aux_priv = NULL; } +void bnxt_rdma_aux_device_del(struct bnxt *bp) +{ + if (!bp->edev) + return; + + auxiliary_device_delete(&bp->aux_priv->aux_dev); +} + static void bnxt_set_edev_info(struct bnxt_en_dev *edev, struct bnxt *bp) { edev->net = bp->dev; @@ -332,6 +339,23 @@ static void bnxt_set_edev_info(struct bnxt_en_dev *edev, struct bnxt *bp) edev->ulp_tbl->msix_requested = bnxt_get_ulp_msix_num(bp); } +void bnxt_rdma_aux_device_add(struct bnxt *bp) +{ + struct auxiliary_device *aux_dev; + int rc; + + if (!bp->edev) + return; + + aux_dev = &bp->aux_priv->aux_dev; + rc = auxiliary_device_add(aux_dev); + if (rc) { + netdev_warn(bp->dev, "Failed to add auxiliary device for ROCE\n"); + auxiliary_device_uninit(aux_dev); + bp->flags &= ~BNXT_FLAG_ROCE_CAP; + } +} + void bnxt_rdma_aux_device_init(struct bnxt *bp) { struct auxiliary_device *aux_dev; @@ -386,13 +410,6 @@ void bnxt_rdma_aux_device_init(struct bnxt *bp) bp->edev = edev; bnxt_set_edev_info(edev, bp); - rc = auxiliary_device_add(aux_dev); - if (rc) { - netdev_warn(bp->dev, - "Failed to add auxiliary device for ROCE\n"); - goto aux_dev_uninit; - } - return; aux_dev_uninit: diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h index f8df4095399f..ae7266ddf167 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h @@ -103,6 +103,8 @@ void bnxt_ulp_irq_stop(struct bnxt *bp); void bnxt_ulp_irq_restart(struct bnxt *bp, int err); void bnxt_ulp_async_events(struct bnxt *bp, struct hwrm_async_event_cmpl *cmpl); void bnxt_rdma_aux_device_uninit(struct bnxt *bp); +void bnxt_rdma_aux_device_del(struct bnxt *bp); +void bnxt_rdma_aux_device_add(struct bnxt *bp); void bnxt_rdma_aux_device_init(struct bnxt *bp); int bnxt_register_dev(struct bnxt_en_dev *edev, struct bnxt_ulp_ops *ulp_ops, void *handle); From patchwork Tue Apr 9 21:54:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13623282 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) (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 8BC84158D69 for ; Tue, 9 Apr 2024 21:55:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712699702; cv=none; b=chGqzqjSpiBPz5TV2Lu73wGjkBZHSPivEyykpVoYABQHf7hRkwOu1XMqI9f+eqwTqII1uLr7IXjlsGAkYIC5me0rI7tZFlRYXQQVaRjcok4AaNO34ZyZVQrCSQlD9Ob8EmbP26nLRbg4RN1bINk9g1UJ6Ax57NeBhlqn/jnsn9c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712699702; c=relaxed/simple; bh=Ldqkp9BAoit63xZcF6K/kb5w1Db243gn16Mdatw06rs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=FjJnivee/TpdZveCyf5Ph2ODg+3R75Z+oshT24qU2QhIwlVrZNj3h3Uk3lbUARFlxscCKo1QuvSsbOJdgW1BtZpS/E+uDlaLDRP8b5197HvN8ShwfPDXp+isNYP+O/dmpzigVxMm3KTbaa/l7S3mZScNNt+sPj/AfCknRPSx4e8= 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=TR6ExWam; arc=none smtp.client-ip=209.85.215.175 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="TR6ExWam" Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-5e42b4bbfa4so3843898a12.1 for ; Tue, 09 Apr 2024 14:55:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1712699700; x=1713304500; 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=LLD8rPxiOSZFhJddRAP1lXW3R20XalF+CxnaaZmRqFg=; b=TR6ExWamdsgzpV7NIVJXfNqf259xV2bdyDYONchWYE+mbTWbnzlSQOr/7bHLwjwF5g ivjOC2P3rKWCWgXgpXMX66KHkjLBgCUfOdgl9BCvFt3Qv6eVNX2N9JaIqjY/hqPVvLk1 Y8UYtvgerzzQPLGOUHi+vIjJ24PSMKN+eTz6c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712699700; x=1713304500; 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=LLD8rPxiOSZFhJddRAP1lXW3R20XalF+CxnaaZmRqFg=; b=dW2kqV4XDftsD9p/WdlXKzPiNlm7xCMDjueBRysabkQ211frhI5Ar6qgw55mSvjGES KPbjPNsL0mmjMkoClGBhw2iLQV4/1X18vuUBzBYfNY+1rg+77DRYC5EDZyXs62LRXifs 5mJZi8THEajrpq2TwmPRsyW4DwRP7S1isHJOA4SIUlzXHGzATueNJhVf1kGsqGOJcwH+ TXb8VOwmcfWothwJUjaNMKTPQVHX0ipcutkIh3KLWLxYsQ0yXOvPGVU8RQxEx4nX+mq1 kuC8NeodRiSjDRjDWz+SjNyPZqONiRsopVIFzqzV7pZz6dg8Xw410pGpTJTo8KRPCtiC rUPQ== X-Gm-Message-State: AOJu0YzzopieiWmx/pIiJPBU/MRs+kqxkOzlkhT8+WD23XPYGQafg7tm Ri+GOclX0eLuAo+d87R1xb27LQ2E+xuEvG5nD3fWC5Uwk+tNi6gf+2nsETHEsA== X-Google-Smtp-Source: AGHT+IH4EeplSWDvaF8sy5Cf/AU2N/iG4Jvvy4pPauBuFZdCiFlw1QNMRtn6rWgv7pyd6eNjq2gg+A== X-Received: by 2002:a17:903:1c1:b0:1e2:88ec:d456 with SMTP id e1-20020a17090301c100b001e288ecd456mr1138710plh.68.1712699699135; Tue, 09 Apr 2024 14:54:59 -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.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2024 14:54:58 -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 Subject: [PATCH net-next 5/7] bnxt_en: Change MSIX/NQs allocation policy Date: Tue, 9 Apr 2024 14:54:29 -0700 Message-Id: <20240409215431.41424-6-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 The existing scheme sets aside a number of MSIX/NQs for the RoCE driver whether the RoCE driver is registered or not. This scheme is not flexible and limits the resources available for the L2 rings if RoCE is never used. Modify the scheme so that the RoCE MSIX/NQs can be used by the L2 driver if they are not used for RoCE. The MSIX/NQs are now represented by 3 fields. bp->ulp_num_msix_want contains the desired default value, edev->ulp_num_msix_vec contains the available value (but not necessarily in use), and ulp_tbl->msix_requested contains the actual value in use by RoCE. The L2 driver can dip into edev->ulp_num_msix_vec if necessary. We need to add rtnl_lock() back in bnxt_register_dev() and bnxt_unregister_dev() to synchronize the MSIX usage between L2 and RoCE. 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 | 25 +++++- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 77 +++++++++++++++---- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h | 8 +- 4 files changed, 92 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 8c24e83ba050..88cf8f47e071 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -7549,6 +7549,20 @@ static int __bnxt_reserve_rings(struct bnxt *bp) if (!netif_is_rxfh_configured(bp->dev)) bnxt_set_dflt_rss_indir_tbl(bp, NULL); + if (!bnxt_ulp_registered(bp->edev) && BNXT_NEW_RM(bp)) { + int resv_msix, resv_ctx, ulp_msix, ulp_ctxs; + struct bnxt_hw_resc *hw_resc; + + hw_resc = &bp->hw_resc; + resv_msix = hw_resc->resv_irqs - bp->cp_nr_rings; + ulp_msix = bnxt_get_ulp_msix_num(bp); + ulp_msix = min_t(int, resv_msix, ulp_msix); + bnxt_set_ulp_msix_num(bp, ulp_msix); + resv_ctx = hw_resc->resv_stat_ctxs - bp->cp_nr_rings; + ulp_ctxs = min(resv_ctx, bnxt_get_ulp_stat_ctxs(bp)); + bnxt_set_ulp_stat_ctxs(bp, ulp_ctxs); + } + return rc; } @@ -14982,6 +14996,7 @@ static void bnxt_trim_dflt_sh_rings(struct bnxt *bp) static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh) { int dflt_rings, max_rx_rings, max_tx_rings, rc; + int avail_msix; if (!bnxt_can_reserve_rings(bp)) return 0; @@ -15009,6 +15024,14 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh) bp->cp_nr_rings = bp->tx_nr_rings_per_tc + bp->rx_nr_rings; bp->tx_nr_rings = bp->tx_nr_rings_per_tc; + avail_msix = bnxt_get_max_func_irqs(bp) - bp->cp_nr_rings; + if (avail_msix >= BNXT_MIN_ROCE_CP_RINGS) { + int ulp_num_msix = min(avail_msix, bp->ulp_num_msix_want); + + bnxt_set_ulp_msix_num(bp, ulp_num_msix); + bnxt_set_dflt_ulp_stat_ctxs(bp); + } + rc = __bnxt_reserve_rings(bp); if (rc && rc != -ENODEV) netdev_warn(bp->dev, "Unable to reserve tx rings\n"); @@ -15358,6 +15381,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) bnxt_set_rx_skb_mode(bp, false); bnxt_set_tpa_flags(bp); bnxt_set_ring_params(bp); + bnxt_rdma_aux_device_init(bp); rc = bnxt_set_dflt_rings(bp, true); if (rc) { if (BNXT_VF(bp) && rc == -ENODEV) { @@ -15411,7 +15435,6 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (BNXT_SUPPORTS_NTUPLE_VNIC(bp)) bnxt_init_multi_rss_ctx(bp); - bnxt_rdma_aux_device_init(bp); rc = register_netdev(dev); if (rc) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 0640fcb57ef8..ad57ef051798 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -2303,6 +2303,7 @@ struct bnxt { struct bnxt_irq *irq_tbl; int total_irqs; + int ulp_num_msix_want; u8 mac_addr[ETH_ALEN]; #ifdef CONFIG_BNXT_DCB diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c index ae2b367b1226..de2cb1d4cd98 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c @@ -48,6 +48,46 @@ static void bnxt_fill_msix_vecs(struct bnxt *bp, struct bnxt_msix_entry *ent) } } +int bnxt_get_ulp_msix_num(struct bnxt *bp) +{ + if (bp->edev) + return bp->edev->ulp_num_msix_vec; + return 0; +} + +void bnxt_set_ulp_msix_num(struct bnxt *bp, int num) +{ + if (bp->edev) + bp->edev->ulp_num_msix_vec = num; +} + +int bnxt_get_ulp_stat_ctxs(struct bnxt *bp) +{ + if (bp->edev) + return bp->edev->ulp_num_ctxs; + return 0; +} + +void bnxt_set_ulp_stat_ctxs(struct bnxt *bp, int num_ulp_ctx) +{ + if (bp->edev) + bp->edev->ulp_num_ctxs = num_ulp_ctx; +} + +void bnxt_set_dflt_ulp_stat_ctxs(struct bnxt *bp) +{ + if (bp->edev) { + bp->edev->ulp_num_ctxs = BNXT_MIN_ROCE_STAT_CTXS; + /* Reserve one additional stat_ctx for PF0 (except + * on 1-port NICs) as it also creates one stat_ctx + * for PF1 in case of RoCE bonding. + */ + if (BNXT_PF(bp) && !bp->pf.port_id && + bp->port_count > 1) + bp->edev->ulp_num_ctxs++; + } +} + int bnxt_register_dev(struct bnxt_en_dev *edev, struct bnxt_ulp_ops *ulp_ops, void *handle) @@ -56,11 +96,19 @@ int bnxt_register_dev(struct bnxt_en_dev *edev, struct bnxt *bp = netdev_priv(dev); unsigned int max_stat_ctxs; struct bnxt_ulp *ulp; + int rc = 0; + rtnl_lock(); + if (!bp->irq_tbl) { + rc = -ENODEV; + goto exit; + } max_stat_ctxs = bnxt_get_max_func_stat_ctxs(bp); if (max_stat_ctxs <= BNXT_MIN_ROCE_STAT_CTXS || - bp->cp_nr_rings == max_stat_ctxs) - return -ENOMEM; + bp->cp_nr_rings == max_stat_ctxs) { + rc = -ENOMEM; + goto exit; + } ulp = edev->ulp_tbl; ulp->handle = handle; @@ -69,9 +117,13 @@ int bnxt_register_dev(struct bnxt_en_dev *edev, if (test_bit(BNXT_STATE_OPEN, &bp->state)) bnxt_hwrm_vnic_cfg(bp, &bp->vnic_info[BNXT_VNIC_DEFAULT]); + edev->ulp_tbl->msix_requested = bnxt_get_ulp_msix_num(bp); + bnxt_fill_msix_vecs(bp, bp->edev->msix_entries); edev->flags |= BNXT_EN_FLAG_MSIX_REQUESTED; - return 0; +exit: + rtnl_unlock(); + return rc; } EXPORT_SYMBOL(bnxt_register_dev); @@ -83,8 +135,10 @@ void bnxt_unregister_dev(struct bnxt_en_dev *edev) int i = 0; ulp = edev->ulp_tbl; + rtnl_lock(); if (ulp->msix_requested) edev->flags &= ~BNXT_EN_FLAG_MSIX_REQUESTED; + edev->ulp_tbl->msix_requested = 0; if (ulp->max_async_event_id) bnxt_hwrm_func_drv_rgtr(bp, NULL, 0, true); @@ -97,11 +151,12 @@ void bnxt_unregister_dev(struct bnxt_en_dev *edev) msleep(100); i++; } + rtnl_unlock(); return; } EXPORT_SYMBOL(bnxt_unregister_dev); -int bnxt_get_ulp_msix_num(struct bnxt *bp) +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; @@ -110,18 +165,6 @@ int bnxt_get_ulp_msix_num(struct bnxt *bp) min_t(u32, roce_msix, num_online_cpus()) : 0); } -int bnxt_get_ulp_stat_ctxs(struct bnxt *bp) -{ - if (bnxt_ulp_registered(bp->edev)) { - struct bnxt_en_dev *edev = bp->edev; - - if (edev->ulp_tbl->msix_requested) - return BNXT_MIN_ROCE_STAT_CTXS; - } - - return 0; -} - int bnxt_send_msg(struct bnxt_en_dev *edev, struct bnxt_fw_msg *fw_msg) { @@ -336,7 +379,6 @@ static void bnxt_set_edev_info(struct bnxt_en_dev *edev, struct bnxt *bp) edev->pf_port_id = bp->pf.port_id; edev->en_state = bp->state; edev->bar0 = bp->bar0; - edev->ulp_tbl->msix_requested = bnxt_get_ulp_msix_num(bp); } void bnxt_rdma_aux_device_add(struct bnxt *bp) @@ -409,6 +451,7 @@ void bnxt_rdma_aux_device_init(struct bnxt *bp) aux_priv->edev = edev; bp->edev = edev; bnxt_set_edev_info(edev, bp); + bp->ulp_num_msix_want = bnxt_set_dflt_ulp_msix(bp); return; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h index ae7266ddf167..04ce3328e66f 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h @@ -85,17 +85,23 @@ struct bnxt_en_dev { * updated in resume. */ void __iomem *bar0; + + u16 ulp_num_msix_vec; + u16 ulp_num_ctxs; }; static inline bool bnxt_ulp_registered(struct bnxt_en_dev *edev) { - if (edev && edev->ulp_tbl) + if (edev && rcu_access_pointer(edev->ulp_tbl->ulp_ops)) return true; return false; } int bnxt_get_ulp_msix_num(struct bnxt *bp); +void bnxt_set_ulp_msix_num(struct bnxt *bp, int num); int bnxt_get_ulp_stat_ctxs(struct bnxt *bp); +void bnxt_set_ulp_stat_ctxs(struct bnxt *bp, int num_ctxs); +void bnxt_set_dflt_ulp_stat_ctxs(struct bnxt *bp); void bnxt_ulp_stop(struct bnxt *bp); void bnxt_ulp_start(struct bnxt *bp, int err); void bnxt_ulp_sriov_cfg(struct bnxt *bp, int num_vfs); From patchwork Tue Apr 9 21:54:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13623283 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 1B651158D9F for ; Tue, 9 Apr 2024 21:55:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712699703; cv=none; b=V1Y0Cs8I3XRHaw+EHK6UyDOKCbztPgRhdFqd2MVZL1H7Ux5daF4ZX2A3CyD+GjhCF9J4zptkua7E8AZ0dxt4xzWKv2MF27Eq4LIuwSD40MxgjNVw8dxMJiRP1IiiQgTK42PiqTwY55SfqiH2n2TAcK8hYjR4vwjMCc3bwFnO3ag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712699703; c=relaxed/simple; bh=rxiBEKEkedwIdDbxrEOerM+1lZhF5rPcZUriLyF0Y5g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=VOefMuqpKh4CMECWOP2N8+R8XvufmhzkilRYVL2e7XxEsutHLLxWXgn5pxUkprYwvNIySCzzbipvxtXa4vlN3wQ/3eyOEYoAg4/WQ2VjozYVc8gt/VLF9BIFG74/5kKpfGgoGJHwcgMnFxRzOtVHUJubccMDZxXsSkUlDSC5G6A= 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=FsLkywsb; arc=none smtp.client-ip=209.85.214.170 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="FsLkywsb" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1e2b1cd446fso45117695ad.3 for ; Tue, 09 Apr 2024 14:55:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1712699701; x=1713304501; 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=95QbEKMhYkj+kQkqYtTK5zZYTEWqiLFm6PQcTVhJSn4=; b=FsLkywsbbhGtqyCwGsmfRjUNxNCFopUCkLG6PXSrSz2c6QZrnI0KtmEF4oZqJRacl4 d69+2YXT0bR7sm0PcJAxOD/LVbzM9WtRNoW0bWD8oawNNd1KdqZw4lnmFKGhiVNrB/a2 rkMNJufONSeuk9KzTlfr8MFCag/exfV9qvkZg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712699701; x=1713304501; 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=95QbEKMhYkj+kQkqYtTK5zZYTEWqiLFm6PQcTVhJSn4=; b=hToFU9V7d4UJZlbBFVoE5NRPZzhAt+cLohFtiAY64cQfqHc/BVItZb2xmRnYo7S20v rPnBsF/6srxsp/Iep2AA+ttn9mAyxw8JJER4RK4+ejjO3wyNWwERtsk20+v2S7spM59I rTW8ESTiXT5IF/hgMVe2CGkm+yISox0s4GGkqkUG0KVVj8RurEv/SKiPNctQ9yr1OcJo KzfGkP/ouyUAeGZVVQ7hP0akKvNUbacQzSSflhPmv62OSc9gp10Pq5AjizpmNAeYBVnV 6GhixAbd/IoBycwSgEMAoTN/UPPzH2m9UaypUJwP4S35n12p5Htni+Nj1c3cgDdD0RS/ L5WQ== X-Gm-Message-State: AOJu0YynAsO7fRb+dDmJJUawmpnWBdt7rYHzJGdC5OxaO9QbDsHjqlCK Vp5SgUySMHuqWUd61PLrrS6k89RNkwEZ5t34so4dZK/nlWHsdZZX325AAxdzJw== X-Google-Smtp-Source: AGHT+IEiMt2zv6OGJ5m4jRf3/HNlWTOlRr4AdRq4F58p87ZB7XtnJwEcR0YZNi+wP71tAoKs+sk5FQ== X-Received: by 2002:a17:903:25d3:b0:1e2:7aba:6d0f with SMTP id jc19-20020a17090325d300b001e27aba6d0fmr1047164plb.36.1712699700500; Tue, 09 Apr 2024 14:55:00 -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.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2024 14:55:00 -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 Subject: [PATCH net-next 6/7] bnxt_en: Utilize ulp client resources if RoCE is not registered Date: Tue, 9 Apr 2024 14:54:30 -0700 Message-Id: <20240409215431.41424-7-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 If the RoCE driver is not registered for a RoCE capable device, add flexibility to use the RoCE resources (MSIX/NQs) for L2 purposes, such as additional rings configured by the user or for XDP. 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 | 41 +++++++++++++++---- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 14 +++++++ drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h | 2 + 3 files changed, 48 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 88cf8f47e071..a2e21fe64ab9 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -7470,14 +7470,27 @@ static bool bnxt_rings_ok(struct bnxt *bp, struct bnxt_hw_rings *hwr) static int __bnxt_reserve_rings(struct bnxt *bp) { struct bnxt_hw_rings hwr = {0}; + int cp = bp->cp_nr_rings; int rx_rings, rc; + int ulp_msix = 0; bool sh = false; int tx_cp; if (!bnxt_need_reserve_rings(bp)) return 0; - hwr.cp = bnxt_nq_rings_in_use(bp); + if (!bnxt_ulp_registered(bp->edev)) { + ulp_msix = bnxt_get_avail_msix(bp, bp->ulp_num_msix_want); + if (!ulp_msix) + bnxt_set_ulp_stat_ctxs(bp, 0); + + if (ulp_msix > bp->ulp_num_msix_want) + ulp_msix = bp->ulp_num_msix_want; + hwr.cp = cp + ulp_msix; + } else { + hwr.cp = bnxt_nq_rings_in_use(bp); + } + hwr.tx = bp->tx_nr_rings; hwr.rx = bp->rx_nr_rings; if (bp->flags & BNXT_FLAG_SHARED_RINGS) @@ -7550,12 +7563,11 @@ static int __bnxt_reserve_rings(struct bnxt *bp) bnxt_set_dflt_rss_indir_tbl(bp, NULL); if (!bnxt_ulp_registered(bp->edev) && BNXT_NEW_RM(bp)) { - int resv_msix, resv_ctx, ulp_msix, ulp_ctxs; + int resv_msix, resv_ctx, ulp_ctxs; struct bnxt_hw_resc *hw_resc; hw_resc = &bp->hw_resc; resv_msix = hw_resc->resv_irqs - bp->cp_nr_rings; - ulp_msix = bnxt_get_ulp_msix_num(bp); ulp_msix = min_t(int, resv_msix, ulp_msix); bnxt_set_ulp_msix_num(bp, ulp_msix); resv_ctx = hw_resc->resv_stat_ctxs - bp->cp_nr_rings; @@ -10609,13 +10621,23 @@ int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init) { bool irq_cleared = false; int tcs = bp->num_tc; + int irqs_required; int rc; if (!bnxt_need_reserve_rings(bp)) return 0; - if (irq_re_init && BNXT_NEW_RM(bp) && - bnxt_get_num_msix(bp) != bp->total_irqs) { + if (!bnxt_ulp_registered(bp->edev)) { + int ulp_msix = bnxt_get_avail_msix(bp, bp->ulp_num_msix_want); + + if (ulp_msix > bp->ulp_num_msix_want) + ulp_msix = bp->ulp_num_msix_want; + irqs_required = ulp_msix + bp->cp_nr_rings; + } else { + irqs_required = bnxt_get_num_msix(bp); + } + + if (irq_re_init && BNXT_NEW_RM(bp) && irqs_required != bp->total_irqs) { bnxt_ulp_irq_stop(bp); bnxt_clear_int_mode(bp); irq_cleared = true; @@ -13625,8 +13647,8 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs, return -ENOMEM; hwr.stat = hwr.cp; if (BNXT_NEW_RM(bp)) { - hwr.cp += bnxt_get_ulp_msix_num(bp); - hwr.stat += bnxt_get_ulp_stat_ctxs(bp); + hwr.cp += bnxt_get_ulp_msix_num_in_use(bp); + hwr.stat += bnxt_get_ulp_stat_ctxs_in_use(bp); hwr.grp = rx; hwr.rss_ctx = bnxt_get_total_rss_ctxs(bp, &hwr); } @@ -14899,8 +14921,9 @@ static void _bnxt_get_max_rings(struct bnxt *bp, int *max_rx, int *max_tx, *max_rx = hw_resc->max_rx_rings; *max_cp = bnxt_get_max_func_cp_rings_for_en(bp); max_irq = min_t(int, bnxt_get_max_func_irqs(bp) - - bnxt_get_ulp_msix_num(bp), - hw_resc->max_stat_ctxs - bnxt_get_ulp_stat_ctxs(bp)); + bnxt_get_ulp_msix_num_in_use(bp), + hw_resc->max_stat_ctxs - + bnxt_get_ulp_stat_ctxs_in_use(bp)); if (!(bp->flags & BNXT_FLAG_CHIP_P5_PLUS)) *max_cp = min_t(int, *max_cp, max_irq); max_ring_grps = hw_resc->max_hw_ring_grps; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c index de2cb1d4cd98..edb10aebd095 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c @@ -61,6 +61,13 @@ void bnxt_set_ulp_msix_num(struct bnxt *bp, int num) bp->edev->ulp_num_msix_vec = num; } +int bnxt_get_ulp_msix_num_in_use(struct bnxt *bp) +{ + if (bnxt_ulp_registered(bp->edev)) + return bp->edev->ulp_num_msix_vec; + return 0; +} + int bnxt_get_ulp_stat_ctxs(struct bnxt *bp) { if (bp->edev) @@ -74,6 +81,13 @@ void bnxt_set_ulp_stat_ctxs(struct bnxt *bp, int num_ulp_ctx) bp->edev->ulp_num_ctxs = num_ulp_ctx; } +int bnxt_get_ulp_stat_ctxs_in_use(struct bnxt *bp) +{ + if (bnxt_ulp_registered(bp->edev)) + return bp->edev->ulp_num_ctxs; + return 0; +} + void bnxt_set_dflt_ulp_stat_ctxs(struct bnxt *bp) { if (bp->edev) { diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h index 04ce3328e66f..b86baf901a5d 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h @@ -98,9 +98,11 @@ 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_num_in_use(struct bnxt *bp); void bnxt_set_ulp_msix_num(struct bnxt *bp, int num); int bnxt_get_ulp_stat_ctxs(struct bnxt *bp); void bnxt_set_ulp_stat_ctxs(struct bnxt *bp, int num_ctxs); +int bnxt_get_ulp_stat_ctxs_in_use(struct bnxt *bp); void bnxt_set_dflt_ulp_stat_ctxs(struct bnxt *bp); void bnxt_ulp_stop(struct bnxt *bp); void bnxt_ulp_start(struct bnxt *bp, int err); From patchwork Tue Apr 9 21:54:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13623284 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 D6728158DA3 for ; Tue, 9 Apr 2024 21:55:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712699704; cv=none; b=KV7nt2zhW1NzqwEbCRuocUHaJ1cw3w8KUHt/R9Yp/9Rv3v6Y+V7weHyCPZweKIgFebh0AjFjoWCtkg0XK6UNEOTFykH6qfkq/EBbZrYSqjK3IorgGkqf0EpUrSYyz8MJXczPX44kPUpSvNZ9CK0b2qBQXevvEKk7vNmxGi7/PBY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712699704; c=relaxed/simple; bh=zZZ3Kv9kIN++h5cZe78fmzJ6P2EaJuVfX3OQxyclcLo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=PslTjj8kJzgvwuUUwCznj0HULbehuQ+RX96jH9NZ0U4flD+cuBaNpQpeu4253GqY5UZNwYuck9a4Ai3W8awGyVoDZr0jumL8lBCV4W9nUnWgVtKc7ryFEzrbZ5O//qcUHmbmikyAzF+vyGrP514SZKhlFcqSQ/GAKI36abvTaCc= 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=EgZbliPi; arc=none smtp.client-ip=209.85.214.181 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="EgZbliPi" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1e4bf0b3e06so7912575ad.1 for ; Tue, 09 Apr 2024 14:55:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1712699702; x=1713304502; 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=y9ehl14tCA3glxFlXadqYFeHICvCarG/okEjeFDPDso=; b=EgZbliPiQ1zj1zP/mBncE4izKM/1o69KuEN8XT8kdwQX8ajs+lqaLdEM57bduoHT6M xCf+kjGdF0fTa2DJTj2/hRc1xalwdR6gVuA2xTR686gXxuC8hRrh4C8/XjiK8qg4Go4v pWCX9LOnnJahGnWIJYOjCHWjRbIGWWWX8teR4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712699702; x=1713304502; 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=y9ehl14tCA3glxFlXadqYFeHICvCarG/okEjeFDPDso=; b=RImt2EF0VaQXeRE8q8ltrvfnCXnupqwecfEoTRw0NVNG28XIzjLcfUR9wWsmnx+J3/ Fg2eH5NMO1IsCPCRWVjSUnogrb9E9xjLx52ueD56Rj4pM9MPelDIQu9TdJN1AnH+xnMr 3b5Yyc8yqO7fymJfPFZI++3mgZ79GA+2TI/dPFkEUV+hAhEIUHF37WK/CHk4tDonr7vL rwb1Z47V54lwoRKdIOH9hRx2FfmH5naL3U80qot/YnD/Ge3fG0vNCCzOkiw/YICTPoK1 tu42+qoljp8XMHYbkmW2tU8PzaSuL3J5f6tTP6+Ln3EfmMS7VvNlTW4FwxFqRNyvQGKV abzg== X-Gm-Message-State: AOJu0Yy6ktHm4zrWxYEdwfoXk3NE2tb9yQHxhfn5zv7PnegNp/e7pECV Km4vuXp91VhDQGS7yWqftd/vxUVva/dJ+D7uM0U+bFQOHmfA7ZSwn4ypL0Dr9nkLHauT/1PHUr4 = X-Google-Smtp-Source: AGHT+IFdPoP2eHcp4RE/VLAo09v8Ij+vICHLO4/BJJu6qCL+XmO3hs+ou8u/388I4intD5c3hey/ew== X-Received: by 2002:a17:902:ca0d:b0:1e3:cd8c:d370 with SMTP id w13-20020a170902ca0d00b001e3cd8cd370mr978981pld.44.1712699701731; Tue, 09 Apr 2024 14:55:01 -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.55.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2024 14:55:01 -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 Subject: [PATCH net-next 7/7] bnxt_en: Update MODULE_DESCRIPTION Date: Tue, 9 Apr 2024 14:54:31 -0700 Message-Id: <20240409215431.41424-8-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 Update MODULE_DESCRIPTION to the more generic adapter family name. The old name only includes the first generation of supported adapters. Signed-off-by: Michael Chan Reviewed-by: Jacob Keller --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index a2e21fe64ab9..d728df139c9c 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -76,7 +76,7 @@ NETIF_MSG_TX_ERR) MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Broadcom BCM573xx network driver"); +MODULE_DESCRIPTION("Broadcom NetXtreme network driver"); #define BNXT_RX_OFFSET (NET_SKB_PAD + NET_IP_ALIGN) #define BNXT_RX_DMA_OFFSET NET_SKB_PAD