From nobody Fri Apr 3 03:02:34 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D7263502B3; Wed, 25 Mar 2026 07:21:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774423299; cv=none; b=o6bT7MGDcp0bDSzCE8L4jF/XqOF5G38z3GV4DPH3d+VjNWG7DnLGNqbUBbt7uvuoXUsT2CNMcXpOJW1gdW/LAm7FpwTfPF6grR5Ahc83PKLKrsKqOSjBmuRTY/doU445QnPe7uT2vk7ZMLOiLb9g6ON8pSB4Z6H5dbK/pIjw4ig= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774423299; c=relaxed/simple; bh=qHwtEmiaUzALs1U8lxciI7QvUZJpw94pPRYf1wfFSqU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A0itGvfoiHiLs8UrrIPspc9CRzFLzXUIxm6M/UDknvzasdAmAbkMRDXM+cr3WDzy7BlvxNGwOVAHJYl9pqjzOF5QOVOatNXCvtfrXnGzC3MG30NsTO80zQfTWmVJvyGXbzif3duxrXIK1tXUq2gbq7aqKDsF6zBcgStTFwaqeHg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bOr8Oc/k; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bOr8Oc/k" Received: by smtp.kernel.org (Postfix) with ESMTPS id 711EAC2BCB1; Wed, 25 Mar 2026 07:21:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774423299; bh=qHwtEmiaUzALs1U8lxciI7QvUZJpw94pPRYf1wfFSqU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=bOr8Oc/kBY5QP6r6s1IvMd7HzrnHb5Wb2udr97GBd7fuUkIdTKU+vTXOwm9TQzG13 7h5DXY45PdiuKFEjp9L2X324sl2Vj67igQJ3Qa4aCaPNmmFMLTtgiunhpYwfnc69/h PpGmSaHqCQdEoxeFTm8FGZZa/y2L+NYjHMQTopZWGkQ53uIG8ADY7HSnIVEniknvvx x4OTPdzns4Qh1fQvGWByD5IEo0C/Kqaoy1PedMcIX7h0ooz/DRyqjtcHWUSk6qyuQw DmKFRQ648kAOi+PmLH5TKE20tcclUe8SkZ7gzqRJhP8saAt/JaIfA1u7L+XsnJE5L5 sanT++Vqj8qJg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F94FFEA81E; Wed, 25 Mar 2026 07:21:39 +0000 (UTC) From: Satish Kharat via B4 Relay Date: Wed, 25 Mar 2026 00:21:39 -0700 Subject: [PATCH net-next 1/6] enic: extend resource discovery for SR-IOV admin channel Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260325-enic-sriov-v2-prep-v1-1-48f04ce110cc@cisco.com> References: <20260325-enic-sriov-v2-prep-v1-0-48f04ce110cc@cisco.com> In-Reply-To: <20260325-enic-sriov-v2-prep-v1-0-48f04ce110cc@cisco.com> To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Satish Kharat X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774423298; l=3356; i=satishkh@cisco.com; h=from:subject:message-id; bh=y0pGwL9wW5ULZUwdK19OUJqESwm7dxXUYk9R9IIroV8=; b=/Ktl/J5AWX9pZs9J6xApCzbj2/lHJxS/snKUdAMK8d8XJd5UaQMRiJdfIyuOA9Eo4xZbOvi3M ZSl/yuOa2bQB/sN9F1UuRG91Py4zPCrLbF70ULtBnZt0CZO8gntFRmc X-Developer-Key: i=satishkh@cisco.com; a=ed25519; pk=4BxbLoCGvHeIMH/PbpiNVx8/2IcTjFvqcr0AD8K6WLY= X-Endpoint-Received: by B4 Relay for satishkh@cisco.com/default with auth_id=639 X-Original-From: Satish Kharat Reply-To: satishkh@cisco.com From: Satish Kharat VIC firmware exposes admin channel resources (WQ, RQ, CQ) for PF-VF communication when SR-IOV is active. Add the corresponding resource type definitions and teach the discovery and access functions to handle them. Signed-off-by: Satish Kharat --- drivers/net/ethernet/cisco/enic/enic.h | 2 ++ drivers/net/ethernet/cisco/enic/vnic_dev.c | 10 ++++++++++ drivers/net/ethernet/cisco/enic/vnic_resource.h | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/= cisco/enic/enic.h index 6959e85ab516..366c65d072fc 100644 --- a/drivers/net/ethernet/cisco/enic/enic.h +++ b/drivers/net/ethernet/cisco/enic/enic.h @@ -297,6 +297,8 @@ static inline struct net_device *vnic_get_netdev(struct= vnic_dev *vdev) dev_warn(&(vdev)->pdev->dev, fmt, ##__VA_ARGS__) #define vdev_info(vdev, fmt, ...) \ dev_info(&(vdev)->pdev->dev, fmt, ##__VA_ARGS__) +#define vdev_dbg(vdev, fmt, ...) \ + dev_dbg(&(vdev)->pdev->dev, fmt, ##__VA_ARGS__) =20 #define vdev_neterr(vdev, fmt, ...) \ netdev_err(vnic_get_netdev(vdev), fmt, ##__VA_ARGS__) diff --git a/drivers/net/ethernet/cisco/enic/vnic_dev.c b/drivers/net/ether= net/cisco/enic/vnic_dev.c index c72452749f5e..c8d657e97094 100644 --- a/drivers/net/ethernet/cisco/enic/vnic_dev.c +++ b/drivers/net/ethernet/cisco/enic/vnic_dev.c @@ -77,6 +77,9 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev, u32 count =3D ioread32(&r->count); u32 len; =20 + vdev_dbg(vdev, "res type %u bar %u offset 0x%x count %u\n", + type, bar_num, bar_offset, count); + r++; =20 if (bar_num >=3D num_bars) @@ -90,6 +93,9 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev, case RES_TYPE_RQ: case RES_TYPE_CQ: case RES_TYPE_INTR_CTRL: + case RES_TYPE_ADMIN_WQ: + case RES_TYPE_ADMIN_RQ: + case RES_TYPE_ADMIN_CQ: /* each count is stride bytes long */ len =3D count * VNIC_RES_STRIDE; if (len + bar_offset > bar[bar_num].len) { @@ -102,6 +108,7 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev, case RES_TYPE_INTR_PBA_LEGACY: case RES_TYPE_DEVCMD: case RES_TYPE_DEVCMD2: + case RES_TYPE_SRIOV_INTR: len =3D count; break; default: @@ -135,6 +142,9 @@ void __iomem *vnic_dev_get_res(struct vnic_dev *vdev, e= num vnic_res_type type, case RES_TYPE_RQ: case RES_TYPE_CQ: case RES_TYPE_INTR_CTRL: + case RES_TYPE_ADMIN_WQ: + case RES_TYPE_ADMIN_RQ: + case RES_TYPE_ADMIN_CQ: return (char __iomem *)vdev->res[type].vaddr + index * VNIC_RES_STRIDE; default: diff --git a/drivers/net/ethernet/cisco/enic/vnic_resource.h b/drivers/net/= ethernet/cisco/enic/vnic_resource.h index b4776e334d63..d327821fa9b9 100644 --- a/drivers/net/ethernet/cisco/enic/vnic_resource.h +++ b/drivers/net/ethernet/cisco/enic/vnic_resource.h @@ -42,6 +42,10 @@ enum vnic_res_type { RES_TYPE_DEPRECATED1, /* Old version of devcmd 2 */ RES_TYPE_DEPRECATED2, /* Old version of devcmd 2 */ RES_TYPE_DEVCMD2, /* Device control region */ + RES_TYPE_SRIOV_INTR =3D 45, /* SR-IOV VF interrupt */ + RES_TYPE_ADMIN_WQ =3D 49, /* Admin channel WQ */ + RES_TYPE_ADMIN_RQ, /* Admin channel RQ */ + RES_TYPE_ADMIN_CQ, /* Admin channel CQ */ =20 RES_TYPE_MAX, /* Count of resource types */ }; --=20 2.43.0 From nobody Fri Apr 3 03:02:34 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D61A34F49F; Wed, 25 Mar 2026 07:21:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774423299; cv=none; b=ciy76iTFoVYzLZCjPR3pVJqRvjjR0v5j+T5VvogEDqM/t2/fgxfPYpgG7n+9SJCOH5ubDJMcFSVUXbdyuACURWTYiKPIXmiXwO450CkXZmeGyA+aoxxSgxwMPEfeGJSUDZvubSfcBV/Mr9UW7KfwO1pm9SmX6w/PGF15dOdP9AA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774423299; c=relaxed/simple; bh=GaJWaVTbn/UL3B4IZ3JOup4VGmfvjwuuWoZ7Ej05S78=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZRTIbuksWA289mM9dRO6ZP7B2a+eetsCxZRGFdM8H1hvGx78DstpsYsQWM49RIl4bXjcbvdHxIiI8M7aDqx33r0qnNK8cMBk+Fh0v6rehR7/VLUyBHpY9OKHBzUz8Yh1qIBUJmGKd/IwBAdduOlcn4wlvJcTKHdNB9le1ydN16M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M0Y74Anf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M0Y74Anf" Received: by smtp.kernel.org (Postfix) with ESMTPS id 7FC2FC2BCB2; Wed, 25 Mar 2026 07:21:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774423299; bh=GaJWaVTbn/UL3B4IZ3JOup4VGmfvjwuuWoZ7Ej05S78=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=M0Y74AnfbDwHsAkvbTU5Ae8qlExnAiBKDYbZRlvxWMPEdhg/1FCJRvLumNbe7Z9qC AUczzjdQKHRJYV/XIZk00ANGIWwMfg3wA9GhfFyswt73Xb2ye1EIuELvKsgETwJOM4 8xYl7sMSls0Gmp5khFTPL1qzDoub7QM+UdFKFB9s1khoYPeDxrn7tTxYmsBXNEgZR0 8DBcWP1+eCDjupRQFtz8Kwn+L5pnCikdpuSebaVbd7df46cR6FZqJKTp8efyHzCnxs HV6+6SD7ATvXiY2xHpRpvsOnWP1OqNFbOAUuGOKvy4hNER/RbCpviWJRnT7amrpeTH /Vx/i/ss9GbXA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75982FEA822; Wed, 25 Mar 2026 07:21:39 +0000 (UTC) From: Satish Kharat via B4 Relay Date: Wed, 25 Mar 2026 00:21:40 -0700 Subject: [PATCH net-next 2/6] enic: add V2 SR-IOV VF device ID Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260325-enic-sriov-v2-prep-v1-2-48f04ce110cc@cisco.com> References: <20260325-enic-sriov-v2-prep-v1-0-48f04ce110cc@cisco.com> In-Reply-To: <20260325-enic-sriov-v2-prep-v1-0-48f04ce110cc@cisco.com> To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Satish Kharat X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774423298; l=1690; i=satishkh@cisco.com; h=from:subject:message-id; bh=1chUHjnI8ZuULFMfvuOuwWNT2kAEAJEGnPmXwEaCezM=; b=VmrXT0awEfh6stHSRZl0LCMJQ6JD2asOuyGGKo1W1qqho3++AamyADVYD4KAEL5vbGK/93e4x L1QCbxhY3y7D/2D4USOSNOl1fLjQqJKKWIe0aaAYEhhqyVAoLfWVwX/ X-Developer-Key: i=satishkh@cisco.com; a=ed25519; pk=4BxbLoCGvHeIMH/PbpiNVx8/2IcTjFvqcr0AD8K6WLY= X-Endpoint-Received: by B4 Relay for satishkh@cisco.com/default with auth_id=639 X-Original-From: Satish Kharat Reply-To: satishkh@cisco.com From: Satish Kharat Register the V2 VF PCI device ID (0x02b7) so the driver binds to V2 virtual functions created via sriov_configure. Update enic_is_sriov_vf() to recognize V2 VFs alongside the existing V1 type. Signed-off-by: Satish Kharat --- drivers/net/ethernet/cisco/enic/enic_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethe= rnet/cisco/enic/enic_main.c index e839081f9ee4..e16dfbcd2c22 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c @@ -66,12 +66,14 @@ #define PCI_DEVICE_ID_CISCO_VIC_ENET 0x0043 /* ethernet vnic */ #define PCI_DEVICE_ID_CISCO_VIC_ENET_DYN 0x0044 /* enet dynamic vnic = */ #define PCI_DEVICE_ID_CISCO_VIC_ENET_VF 0x0071 /* enet SRIOV VF */ +#define PCI_DEVICE_ID_CISCO_VIC_ENET_VF_V2 0x02b7 /* enet SRIOV V2 VF */ =20 /* Supported devices */ static const struct pci_device_id enic_id_table[] =3D { { PCI_VDEVICE(CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET) }, { PCI_VDEVICE(CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET_DYN) }, { PCI_VDEVICE(CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET_VF) }, + { PCI_VDEVICE(CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET_VF_V2) }, { 0, } /* end of table */ }; =20 @@ -307,7 +309,8 @@ int enic_sriov_enabled(struct enic *enic) =20 static int enic_is_sriov_vf(struct enic *enic) { - return enic->pdev->device =3D=3D PCI_DEVICE_ID_CISCO_VIC_ENET_VF; + return enic->pdev->device =3D=3D PCI_DEVICE_ID_CISCO_VIC_ENET_VF || + enic->pdev->device =3D=3D PCI_DEVICE_ID_CISCO_VIC_ENET_VF_V2; } =20 int enic_is_valid_vf(struct enic *enic, int vf) --=20 2.43.0 From nobody Fri Apr 3 03:02:34 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3E12355049; Wed, 25 Mar 2026 07:21:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774423299; cv=none; b=RAlYk5Wg1kTPQPP1Byg15IHIpw+iB11cD68z3Sn20tothxZuZP7ayewEjvVXred8jFKsZXDNONu3WzRpJDl2Nqz2n5wr2bm/9SpgfQMI/IpRDesZ205Pnlso/dpgcK2nniT+Ehmq3k20iyIA1IdQoXAL0LB5YtS/+zYJISCiv7E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774423299; c=relaxed/simple; bh=ZxR9g+zCxK8pArCJ7PTFR8axACYwGxTDHOn4nO9U1U8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=X6sIsaW1sl66zbCpWoY8Z9C73LXJnped+AsKs2Tk/uVbR1YO8XAcF1zqGI2wtKmNhG1AmZOiphTRCCPPMXJ6nzW/hjOxBT5Y0LsCC230uqHWGoC3rdiHw0m6HLPLTOeK/9B5ArK3MGx5y25oyIfeJiGXkTPQkMp4NJ+Ui1BlUCk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=afsCAQdM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="afsCAQdM" Received: by smtp.kernel.org (Postfix) with ESMTPS id 98AEBC2BC9E; Wed, 25 Mar 2026 07:21:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774423299; bh=ZxR9g+zCxK8pArCJ7PTFR8axACYwGxTDHOn4nO9U1U8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=afsCAQdMDohdM8Xige7WpifiM9awuLuo7JPAYsMHoRQSetlugJ1fuEnWBPrPOm4H2 6cIrHlOqtRcLcF40j5G5k1Fo0ktPIhezNgKGSJYYCvdgCtT+FaM4Vnh8mqEEnxdKDX zHi7xtlE1aE1L8FvLjZHsOCVqO54+iveIcEThmMCb9asS1pT2LbpDiaR2VBgsfu9il NDhmP2hyk8TG9YbW7fuPGZO8bXFIcrlHOfJjv1oYbUgdXiy+S+Anw5BMxSWaI7NNjh 4lDcYVmi3e2UQM3mFH3ymPETQWW7V7d3HP7aVu5BwwCK4Jv8PRGL7ZLJMNsKwleoDn /R02i8cn8hF2Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91C89FEA820; Wed, 25 Mar 2026 07:21:39 +0000 (UTC) From: Satish Kharat via B4 Relay Date: Wed, 25 Mar 2026 00:21:41 -0700 Subject: [PATCH net-next 3/6] enic: detect SR-IOV VF type from PCI capability Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260325-enic-sriov-v2-prep-v1-3-48f04ce110cc@cisco.com> References: <20260325-enic-sriov-v2-prep-v1-0-48f04ce110cc@cisco.com> In-Reply-To: <20260325-enic-sriov-v2-prep-v1-0-48f04ce110cc@cisco.com> To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Satish Kharat X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774423298; l=3365; i=satishkh@cisco.com; h=from:subject:message-id; bh=EHjug9jFvuqtjK7rgKqTb+ZxcNgtnQ9ViaQc7HzlDNE=; b=yaOkGTKgsAhWqOdG77B5YS9h9fMZk/RoDGHOV+CUnvb4VnF5EFzIRQe9UXT8rvoPSrrf1lRt1 AaX3Bc4KwzOC4ZagmU9mgsJugzBW/VI1b2IWi9sS/aqXGddy268o3yf X-Developer-Key: i=satishkh@cisco.com; a=ed25519; pk=4BxbLoCGvHeIMH/PbpiNVx8/2IcTjFvqcr0AD8K6WLY= X-Endpoint-Received: by B4 Relay for satishkh@cisco.com/default with auth_id=639 X-Original-From: Satish Kharat Reply-To: satishkh@cisco.com From: Satish Kharat Read the VF device ID from the SR-IOV PCI capability at probe time to determine whether the PF is configured for V1, USNIC, or V2 virtual functions. Store the result in enic->vf_type for use by subsequent SR-IOV operations. The VF type is a firmware-configured property (set via UCSM, CIMC, Intersight etc) that is immutable from the driver's perspective. Only PFs are probed for this capability; VFs and dynamic vnics skip detection. Signed-off-by: Satish Kharat --- drivers/net/ethernet/cisco/enic/enic.h | 8 +++++++ drivers/net/ethernet/cisco/enic/enic_main.c | 37 +++++++++++++++++++++++++= ++++ 2 files changed, 45 insertions(+) diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/= cisco/enic/enic.h index 366c65d072fc..0fd9cd917132 100644 --- a/drivers/net/ethernet/cisco/enic/enic.h +++ b/drivers/net/ethernet/cisco/enic/enic.h @@ -225,6 +225,13 @@ struct enic_rq { struct page_pool *pool; } ____cacheline_aligned; =20 +enum enic_vf_type { + ENIC_VF_TYPE_NONE, + ENIC_VF_TYPE_V1, + ENIC_VF_TYPE_USNIC, + ENIC_VF_TYPE_V2, +}; + /* Per-instance private data structure */ struct enic { struct net_device *netdev; @@ -252,6 +259,7 @@ struct enic { #ifdef CONFIG_PCI_IOV u16 num_vfs; #endif + enum enic_vf_type vf_type; spinlock_t enic_api_lock; bool enic_api_busy; struct enic_port_profile *pp; diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethe= rnet/cisco/enic/enic_main.c index e16dfbcd2c22..acd05350ec1a 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c @@ -67,6 +67,7 @@ #define PCI_DEVICE_ID_CISCO_VIC_ENET_DYN 0x0044 /* enet dynamic vnic = */ #define PCI_DEVICE_ID_CISCO_VIC_ENET_VF 0x0071 /* enet SRIOV VF */ #define PCI_DEVICE_ID_CISCO_VIC_ENET_VF_V2 0x02b7 /* enet SRIOV V2 VF */ +#define PCI_DEVICE_ID_CISCO_VIC_ENET_VF_USNIC 0x00cf /* enet USNIC VF */ =20 /* Supported devices */ static const struct pci_device_id enic_id_table[] =3D { @@ -2621,6 +2622,41 @@ static void enic_iounmap(struct enic *enic) iounmap(enic->bar[i].vaddr); } =20 +#ifdef CONFIG_PCI_IOV +static void enic_sriov_detect_vf_type(struct enic *enic) +{ + struct pci_dev *pdev =3D enic->pdev; + int pos; + u16 vf_dev_id; + + if (enic_is_sriov_vf(enic) || enic_is_dynamic(enic)) + return; + + pos =3D pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV); + if (!pos) { + enic->vf_type =3D ENIC_VF_TYPE_NONE; + return; + } + + pci_read_config_word(pdev, pos + PCI_SRIOV_VF_DID, &vf_dev_id); + + switch (vf_dev_id) { + case PCI_DEVICE_ID_CISCO_VIC_ENET_VF: + enic->vf_type =3D ENIC_VF_TYPE_V1; + break; + case PCI_DEVICE_ID_CISCO_VIC_ENET_VF_USNIC: + enic->vf_type =3D ENIC_VF_TYPE_USNIC; + break; + case PCI_DEVICE_ID_CISCO_VIC_ENET_VF_V2: + enic->vf_type =3D ENIC_VF_TYPE_V2; + break; + default: + enic->vf_type =3D ENIC_VF_TYPE_NONE; + break; + } +} +#endif + static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *en= t) { struct device *dev =3D &pdev->dev; @@ -2734,6 +2770,7 @@ static int enic_probe(struct pci_dev *pdev, const str= uct pci_device_id *ent) num_pps =3D enic->num_vfs; } } + enic_sriov_detect_vf_type(enic); #endif =20 /* Allocate structure for port profiles */ --=20 2.43.0 From nobody Fri Apr 3 03:02:34 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D45EB363096; Wed, 25 Mar 2026 07:21:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774423299; cv=none; b=KdCe3J217swwN5rWKvjp++wbiqBdWuQJRsJvLlZW81/W/EYcPC/ptyXpIySj4Dw3PTxLqBner2Rs3eNSRAcLHlUqq1kJ5+FiOkU+20v3Ms7byRkievn850pyZHQd5T22tUa5QT7ZlTAcBXLabjtrRuDdfL9VanddYS5vjv4tbqc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774423299; c=relaxed/simple; bh=8nzLFxeuDNYsf3IkWcj76Hg9mmDN27Zptu4KIN/CWj8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=R37ImRkyySyDGCYv7mvSnbtYVnvZZzf3kCrqKq+y3WcCs+jmuJBquIFR62SxjZhLuWftA3lnJwt+1fA5RbfPqqDUKIeYK7lGuwo2CUcqdJDj+nqpahC3HfGBdjixsW6JL09ahIz9yOrNYAkL4LGfN5xl+CKKATK4Ym9/oAxazWs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MJcpoXV0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MJcpoXV0" Received: by smtp.kernel.org (Postfix) with ESMTPS id B7D4EC2BCB5; Wed, 25 Mar 2026 07:21:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774423299; bh=8nzLFxeuDNYsf3IkWcj76Hg9mmDN27Zptu4KIN/CWj8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=MJcpoXV0ruIEoazELldF7zEiMNsRK2Bcdnf7AtpHKbhzRaC2fSNPcW96BuRa3JWUr vSZBT+3Z/WrHmF7U6KkymkiV6JORe34gCt8f6qc5ws4NpNDu+aqqBQRZvYBRx4x+gj r/TsStRQPfnWSbrr+3p9O9jw4FNlW/Jx4F2IpUMy0u3IP0zCb3OBIDxTk6884DKPr1 vfDVi6A8RQK5Z1eej0t1vHvr4oMcvrqTjHq6E2M7N1nb1QkY7DHgCusZJfIlL82nme x999HhXjZGXTYp9QJ3G0YnJJQT0JUQIFveHAALaOizPEhTVe8W63vVMxFuEh8sLxFA RNLkSZ+24ncJA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A74DAFEA81E; Wed, 25 Mar 2026 07:21:39 +0000 (UTC) From: Satish Kharat via B4 Relay Date: Wed, 25 Mar 2026 00:21:42 -0700 Subject: [PATCH net-next 4/6] enic: make enic_dev_enable/disable ref-counted Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260325-enic-sriov-v2-prep-v1-4-48f04ce110cc@cisco.com> References: <20260325-enic-sriov-v2-prep-v1-0-48f04ce110cc@cisco.com> In-Reply-To: <20260325-enic-sriov-v2-prep-v1-0-48f04ce110cc@cisco.com> To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Satish Kharat X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774423298; l=2385; i=satishkh@cisco.com; h=from:subject:message-id; bh=UFxmA9CX8KV13iHlUmy26fUHGETjz4zvpBBpux+w9yI=; b=rw64LSAVKDU+d9rEkfxiLMhaDAlEJrSBY7/kjU9fKL9z5pe3gWK5QwiHGnu5P6DFX0QRFwjVw bh98qC5V2ewCs/xOa/+EIduHUitRIZ8BA9KYv0go1DeFHKEL6s9OkTm X-Developer-Key: i=satishkh@cisco.com; a=ed25519; pk=4BxbLoCGvHeIMH/PbpiNVx8/2IcTjFvqcr0AD8K6WLY= X-Endpoint-Received: by B4 Relay for satishkh@cisco.com/default with auth_id=639 X-Original-From: Satish Kharat Reply-To: satishkh@cisco.com From: Satish Kharat Both the data path (ndo_open/ndo_stop) and the upcoming admin channel need to enable and disable the vNIC device independently. Without reference counting, closing the admin channel while the netdev is up would inadvertently disable the entire device. Add an enable_count to struct enic, protected by the existing devcmd_lock. enic_dev_enable() issues CMD_ENABLE_WAIT only on the first caller (0 -> 1 transition), and enic_dev_disable() issues CMD_DISABLE only when the last caller releases (1 -> 0 transition). No functional change for the current single-caller data path. Signed-off-by: Satish Kharat --- drivers/net/ethernet/cisco/enic/enic.h | 1 + drivers/net/ethernet/cisco/enic/enic_dev.c | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/= cisco/enic/enic.h index 0fd9cd917132..67fd780b1fa1 100644 --- a/drivers/net/ethernet/cisco/enic/enic.h +++ b/drivers/net/ethernet/cisco/enic/enic.h @@ -260,6 +260,7 @@ struct enic { u16 num_vfs; #endif enum enic_vf_type vf_type; + unsigned int enable_count; spinlock_t enic_api_lock; bool enic_api_busy; struct enic_port_profile *pp; diff --git a/drivers/net/ethernet/cisco/enic/enic_dev.c b/drivers/net/ether= net/cisco/enic/enic_dev.c index 2cbae7c6cc3d..659787f73cf1 100644 --- a/drivers/net/ethernet/cisco/enic/enic_dev.c +++ b/drivers/net/ethernet/cisco/enic/enic_dev.c @@ -131,10 +131,13 @@ int enic_dev_set_ig_vlan_rewrite_mode(struct enic *en= ic) =20 int enic_dev_enable(struct enic *enic) { - int err; + int err =3D 0; =20 spin_lock_bh(&enic->devcmd_lock); - err =3D vnic_dev_enable_wait(enic->vdev); + if (enic->enable_count =3D=3D 0) + err =3D vnic_dev_enable_wait(enic->vdev); + if (!err) + enic->enable_count++; spin_unlock_bh(&enic->devcmd_lock); =20 return err; @@ -142,10 +145,16 @@ int enic_dev_enable(struct enic *enic) =20 int enic_dev_disable(struct enic *enic) { - int err; + int err =3D 0; =20 spin_lock_bh(&enic->devcmd_lock); - err =3D vnic_dev_disable(enic->vdev); + if (enic->enable_count =3D=3D 0) { + spin_unlock_bh(&enic->devcmd_lock); + return 0; + } + enic->enable_count--; + if (enic->enable_count =3D=3D 0) + err =3D vnic_dev_disable(enic->vdev); spin_unlock_bh(&enic->devcmd_lock); =20 return err; --=20 2.43.0 From nobody Fri Apr 3 03:02:34 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E25F83644D1; Wed, 25 Mar 2026 07:21:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774423300; cv=none; b=MquDnsCl0O4Z4FKy/pcQhyCEhe6Zndat/pErghpN3ayT0MD1vrHVHAYfMBcOxlbYlQFI8NRQZYXYidNPtW984yHo3FeJpEEywmgsclmQzoxogmoK0Lwu16C/hZ+yrEJ87KbClAJvTTgj7tB3FjYgEnWX7cdms8vClcKjAQuHdiA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774423300; c=relaxed/simple; bh=WXpYpK3yhKn2sm0AMqrjWN6OL03+heVozAsWmGdd/6M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LHKASRWkVgP0HXxkp+r6WnUMdkufKfWz8992wEHtZ/BEvd4gVxffEqh1NtCRBh3d0yJ6TtRnFm+VQV02/11HYW3C27ACzVHyokcE3/HGAWQxjeJlaW2A9GnifFlYN2Gw1r6GoabU2qKrHAR+Uhl2cVioMbW2R9301sTTL4YaKxU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=K5Y+QVg4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="K5Y+QVg4" Received: by smtp.kernel.org (Postfix) with ESMTPS id C6ADEC4CEF7; Wed, 25 Mar 2026 07:21:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774423299; bh=WXpYpK3yhKn2sm0AMqrjWN6OL03+heVozAsWmGdd/6M=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=K5Y+QVg48C6sTD5VhylNCumbRBFL/HIz4uDGG4j1A2ATtRMUrs6tGDof8OG9Rx8qY 46lhaFeg4YUqdpBIKfEO0ihv25siufzxcPXSbHvxGwq9Ydvon2jU8hyRzPYUu1S9pc PuTAw34NvP7sIFWHio8y0d+yUeWk1Dc1vhJ/NAhoZZgpJqgfWHR++KQ7sde1JgggGd YULKuFJl8DybMeszXIH1GQxEc+k8GvT9zrTZxxEZ2+EwK/MdM3VxF8rLZ1NOxjqGof l0kZPaEITH/k/iHGWktQQvX9AUp5DT5EQffdAD+2kBLfTLZsBHjLuHou3doOL4lHsa OVi4e1ba4Znnw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0592FEA822; Wed, 25 Mar 2026 07:21:39 +0000 (UTC) From: Satish Kharat via B4 Relay Date: Wed, 25 Mar 2026 00:21:43 -0700 Subject: [PATCH net-next 5/6] enic: add type-aware alloc for WQ, RQ, CQ and INTR resources Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260325-enic-sriov-v2-prep-v1-5-48f04ce110cc@cisco.com> References: <20260325-enic-sriov-v2-prep-v1-0-48f04ce110cc@cisco.com> In-Reply-To: <20260325-enic-sriov-v2-prep-v1-0-48f04ce110cc@cisco.com> To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Satish Kharat X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774423298; l=10146; i=satishkh@cisco.com; h=from:subject:message-id; bh=sStTy9Bg8r3IiBcBVUP3bIWBVt484dhT5KCgXRyPs1c=; b=QmD2EUolDeDfroPNN0AARXNneDqrQo9YfHCPbPow6gBiHnATdgZF4W36W1FKR3pPTSJKekLOZ 8JiMI9ACvm8DZsRjSdHuzK9IYQOeKslnk5cygrxOr66s3HCEVw2C8g4 X-Developer-Key: i=satishkh@cisco.com; a=ed25519; pk=4BxbLoCGvHeIMH/PbpiNVx8/2IcTjFvqcr0AD8K6WLY= X-Endpoint-Received: by B4 Relay for satishkh@cisco.com/default with auth_id=639 X-Original-From: Satish Kharat Reply-To: satishkh@cisco.com From: Satish Kharat The existing vnic_wq_alloc(), vnic_rq_alloc(), vnic_cq_alloc() and vnic_intr_alloc() hardcode data-path resource types (RES_TYPE_WQ, RES_TYPE_RQ, RES_TYPE_CQ, RES_TYPE_INTR_CTRL). The upcoming admin channel uses different BAR resource types (RES_TYPE_ADMIN_WQ/RQ/CQ, RES_TYPE_SRIOV_INTR) for its queues. Add _with_type() variants that accept an explicit resource type parameter. Refactor the original functions as thin wrappers that pass the default data-path type. No functional change. Signed-off-by: Satish Kharat --- drivers/net/ethernet/cisco/enic/vnic_cq.c | 14 +++++++++++--- drivers/net/ethernet/cisco/enic/vnic_cq.h | 3 +++ drivers/net/ethernet/cisco/enic/vnic_intr.c | 12 +++++++++--- drivers/net/ethernet/cisco/enic/vnic_intr.h | 2 ++ drivers/net/ethernet/cisco/enic/vnic_rq.c | 14 +++++++++++--- drivers/net/ethernet/cisco/enic/vnic_rq.h | 3 +++ drivers/net/ethernet/cisco/enic/vnic_wq.c | 14 +++++++++++--- drivers/net/ethernet/cisco/enic/vnic_wq.h | 3 +++ 8 files changed, 53 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/cisco/enic/vnic_cq.c b/drivers/net/ethern= et/cisco/enic/vnic_cq.c index 27c885e91552..5a0dbb816223 100644 --- a/drivers/net/ethernet/cisco/enic/vnic_cq.c +++ b/drivers/net/ethernet/cisco/enic/vnic_cq.c @@ -20,13 +20,14 @@ void vnic_cq_free(struct vnic_cq *cq) cq->ctrl =3D NULL; } =20 -int vnic_cq_alloc(struct vnic_dev *vdev, struct vnic_cq *cq, unsigned int = index, - unsigned int desc_count, unsigned int desc_size) +int vnic_cq_alloc_with_type(struct vnic_dev *vdev, struct vnic_cq *cq, + unsigned int index, unsigned int desc_count, + unsigned int desc_size, unsigned int res_type) { cq->index =3D index; cq->vdev =3D vdev; =20 - cq->ctrl =3D vnic_dev_get_res(vdev, RES_TYPE_CQ, index); + cq->ctrl =3D vnic_dev_get_res(vdev, res_type, index); if (!cq->ctrl) { vdev_err(vdev, "Failed to hook CQ[%d] resource\n", index); return -EINVAL; @@ -35,6 +36,13 @@ int vnic_cq_alloc(struct vnic_dev *vdev, struct vnic_cq = *cq, unsigned int index, return vnic_dev_alloc_desc_ring(vdev, &cq->ring, desc_count, desc_size); } =20 +int vnic_cq_alloc(struct vnic_dev *vdev, struct vnic_cq *cq, unsigned int = index, + unsigned int desc_count, unsigned int desc_size) +{ + return vnic_cq_alloc_with_type(vdev, cq, index, desc_count, desc_size, + RES_TYPE_CQ); +} + void vnic_cq_init(struct vnic_cq *cq, unsigned int flow_control_enable, unsigned int color_enable, unsigned int cq_head, unsigned int cq_tail, unsigned int cq_tail_color, unsigned int interrupt_enable, diff --git a/drivers/net/ethernet/cisco/enic/vnic_cq.h b/drivers/net/ethern= et/cisco/enic/vnic_cq.h index 0e37f5d5e527..d46d4d2ef6bb 100644 --- a/drivers/net/ethernet/cisco/enic/vnic_cq.h +++ b/drivers/net/ethernet/cisco/enic/vnic_cq.h @@ -73,6 +73,9 @@ static inline void vnic_cq_inc_to_clean(struct vnic_cq *c= q) void vnic_cq_free(struct vnic_cq *cq); int vnic_cq_alloc(struct vnic_dev *vdev, struct vnic_cq *cq, unsigned int = index, unsigned int desc_count, unsigned int desc_size); +int vnic_cq_alloc_with_type(struct vnic_dev *vdev, struct vnic_cq *cq, + unsigned int index, unsigned int desc_count, + unsigned int desc_size, unsigned int res_type); void vnic_cq_init(struct vnic_cq *cq, unsigned int flow_control_enable, unsigned int color_enable, unsigned int cq_head, unsigned int cq_tail, unsigned int cq_tail_color, unsigned int interrupt_enable, diff --git a/drivers/net/ethernet/cisco/enic/vnic_intr.c b/drivers/net/ethe= rnet/cisco/enic/vnic_intr.c index 25319f072a04..010ad8c2108d 100644 --- a/drivers/net/ethernet/cisco/enic/vnic_intr.c +++ b/drivers/net/ethernet/cisco/enic/vnic_intr.c @@ -19,13 +19,13 @@ void vnic_intr_free(struct vnic_intr *intr) intr->ctrl =3D NULL; } =20 -int vnic_intr_alloc(struct vnic_dev *vdev, struct vnic_intr *intr, - unsigned int index) +int vnic_intr_alloc_with_type(struct vnic_dev *vdev, struct vnic_intr *int= r, + unsigned int index, unsigned int res_type) { intr->index =3D index; intr->vdev =3D vdev; =20 - intr->ctrl =3D vnic_dev_get_res(vdev, RES_TYPE_INTR_CTRL, index); + intr->ctrl =3D vnic_dev_get_res(vdev, res_type, index); if (!intr->ctrl) { vdev_err(vdev, "Failed to hook INTR[%d].ctrl resource\n", index); @@ -35,6 +35,12 @@ int vnic_intr_alloc(struct vnic_dev *vdev, struct vnic_i= ntr *intr, return 0; } =20 +int vnic_intr_alloc(struct vnic_dev *vdev, struct vnic_intr *intr, + unsigned int index) +{ + return vnic_intr_alloc_with_type(vdev, intr, index, RES_TYPE_INTR_CTRL); +} + void vnic_intr_init(struct vnic_intr *intr, u32 coalescing_timer, unsigned int coalescing_type, unsigned int mask_on_assertion) { diff --git a/drivers/net/ethernet/cisco/enic/vnic_intr.h b/drivers/net/ethe= rnet/cisco/enic/vnic_intr.h index 33a72aa10b26..2bc2dbffdb80 100644 --- a/drivers/net/ethernet/cisco/enic/vnic_intr.h +++ b/drivers/net/ethernet/cisco/enic/vnic_intr.h @@ -89,6 +89,8 @@ static inline u32 vnic_intr_legacy_pba(u32 __iomem *legac= y_pba) void vnic_intr_free(struct vnic_intr *intr); int vnic_intr_alloc(struct vnic_dev *vdev, struct vnic_intr *intr, unsigned int index); +int vnic_intr_alloc_with_type(struct vnic_dev *vdev, struct vnic_intr *int= r, + unsigned int index, unsigned int res_type); void vnic_intr_init(struct vnic_intr *intr, u32 coalescing_timer, unsigned int coalescing_type, unsigned int mask_on_assertion); void vnic_intr_coalescing_timer_set(struct vnic_intr *intr, diff --git a/drivers/net/ethernet/cisco/enic/vnic_rq.c b/drivers/net/ethern= et/cisco/enic/vnic_rq.c index 5ae80551f17c..a662d9fd1199 100644 --- a/drivers/net/ethernet/cisco/enic/vnic_rq.c +++ b/drivers/net/ethernet/cisco/enic/vnic_rq.c @@ -69,15 +69,16 @@ void vnic_rq_free(struct vnic_rq *rq) rq->ctrl =3D NULL; } =20 -int vnic_rq_alloc(struct vnic_dev *vdev, struct vnic_rq *rq, unsigned int = index, - unsigned int desc_count, unsigned int desc_size) +int vnic_rq_alloc_with_type(struct vnic_dev *vdev, struct vnic_rq *rq, + unsigned int index, unsigned int desc_count, + unsigned int desc_size, unsigned int res_type) { int err; =20 rq->index =3D index; rq->vdev =3D vdev; =20 - rq->ctrl =3D vnic_dev_get_res(vdev, RES_TYPE_RQ, index); + rq->ctrl =3D vnic_dev_get_res(vdev, res_type, index); if (!rq->ctrl) { vdev_err(vdev, "Failed to hook RQ[%d] resource\n", index); return -EINVAL; @@ -98,6 +99,13 @@ int vnic_rq_alloc(struct vnic_dev *vdev, struct vnic_rq = *rq, unsigned int index, return 0; } =20 +int vnic_rq_alloc(struct vnic_dev *vdev, struct vnic_rq *rq, unsigned int = index, + unsigned int desc_count, unsigned int desc_size) +{ + return vnic_rq_alloc_with_type(vdev, rq, index, desc_count, desc_size, + RES_TYPE_RQ); +} + static void vnic_rq_init_start(struct vnic_rq *rq, unsigned int cq_index, unsigned int fetch_index, unsigned int posted_index, unsigned int error_interrupt_enable, diff --git a/drivers/net/ethernet/cisco/enic/vnic_rq.h b/drivers/net/ethern= et/cisco/enic/vnic_rq.h index a1cdd729caec..9fc2090eac44 100644 --- a/drivers/net/ethernet/cisco/enic/vnic_rq.h +++ b/drivers/net/ethernet/cisco/enic/vnic_rq.h @@ -196,6 +196,9 @@ static inline int vnic_rq_fill(struct vnic_rq *rq, void vnic_rq_free(struct vnic_rq *rq); int vnic_rq_alloc(struct vnic_dev *vdev, struct vnic_rq *rq, unsigned int = index, unsigned int desc_count, unsigned int desc_size); +int vnic_rq_alloc_with_type(struct vnic_dev *vdev, struct vnic_rq *rq, + unsigned int index, unsigned int desc_count, + unsigned int desc_size, unsigned int res_type); void vnic_rq_init(struct vnic_rq *rq, unsigned int cq_index, unsigned int error_interrupt_enable, unsigned int error_interrupt_offset); diff --git a/drivers/net/ethernet/cisco/enic/vnic_wq.c b/drivers/net/ethern= et/cisco/enic/vnic_wq.c index 29c7900349b2..5a20bdc62141 100644 --- a/drivers/net/ethernet/cisco/enic/vnic_wq.c +++ b/drivers/net/ethernet/cisco/enic/vnic_wq.c @@ -72,15 +72,16 @@ void vnic_wq_free(struct vnic_wq *wq) wq->ctrl =3D NULL; } =20 -int vnic_wq_alloc(struct vnic_dev *vdev, struct vnic_wq *wq, unsigned int = index, - unsigned int desc_count, unsigned int desc_size) +int vnic_wq_alloc_with_type(struct vnic_dev *vdev, struct vnic_wq *wq, + unsigned int index, unsigned int desc_count, + unsigned int desc_size, unsigned int res_type) { int err; =20 wq->index =3D index; wq->vdev =3D vdev; =20 - wq->ctrl =3D vnic_dev_get_res(vdev, RES_TYPE_WQ, index); + wq->ctrl =3D vnic_dev_get_res(vdev, res_type, index); if (!wq->ctrl) { vdev_err(vdev, "Failed to hook WQ[%d] resource\n", index); return -EINVAL; @@ -101,6 +102,13 @@ int vnic_wq_alloc(struct vnic_dev *vdev, struct vnic_w= q *wq, unsigned int index, return 0; } =20 +int vnic_wq_alloc(struct vnic_dev *vdev, struct vnic_wq *wq, unsigned int = index, + unsigned int desc_count, unsigned int desc_size) +{ + return vnic_wq_alloc_with_type(vdev, wq, index, desc_count, desc_size, + RES_TYPE_WQ); +} + int enic_wq_devcmd2_alloc(struct vnic_dev *vdev, struct vnic_wq *wq, unsigned int desc_count, unsigned int desc_size) { diff --git a/drivers/net/ethernet/cisco/enic/vnic_wq.h b/drivers/net/ethern= et/cisco/enic/vnic_wq.h index 3bb4758100ba..1d448b7a9ba2 100644 --- a/drivers/net/ethernet/cisco/enic/vnic_wq.h +++ b/drivers/net/ethernet/cisco/enic/vnic_wq.h @@ -165,6 +165,9 @@ static inline void vnic_wq_service(struct vnic_wq *wq, void vnic_wq_free(struct vnic_wq *wq); int vnic_wq_alloc(struct vnic_dev *vdev, struct vnic_wq *wq, unsigned int = index, unsigned int desc_count, unsigned int desc_size); +int vnic_wq_alloc_with_type(struct vnic_dev *vdev, struct vnic_wq *wq, + unsigned int index, unsigned int desc_count, + unsigned int desc_size, unsigned int res_type); void vnic_wq_init(struct vnic_wq *wq, unsigned int cq_index, unsigned int error_interrupt_enable, unsigned int error_interrupt_offset); --=20 2.43.0 From nobody Fri Apr 3 03:02:34 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07F4F365A05; Wed, 25 Mar 2026 07:21:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774423300; cv=none; b=mVSv57vOZJ+UziENqT8RS6xi4TzVZnG3hwA+KnQttHP7FWhrigQzTI1nBCIomEAf8iLfcWbARf1SgQl+Rr5axbF3vbXpMqKRFG5Qx1JHY8DYg6Ma3kmav/ZusgqrfFNxup4a68YUBxon5TBT8PFG8PnC7trEnkIe6RKtClTQQMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774423300; c=relaxed/simple; bh=37FGZY+8d8I7xFQKUrk70CCSCQXTT/DB4uVq3pHa4GI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fvY/Pqe06KEYp0GZ3qId9VDouGkBpBkjJw39nr6GIs7aswwKkK8GJ9KsRUignuMsn8Af5/cXBPAQrzVT4EM8X/eZnX6TQJnBXB41shzrl8YNY7vwVSoacvin7mgahmyo4shi/BCQ5YpnWluIzct3o/BMJBoywZNuq09sh3Vz/6E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NS3IDviO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NS3IDviO" Received: by smtp.kernel.org (Postfix) with ESMTPS id D9BA3C2BCB2; Wed, 25 Mar 2026 07:21:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774423299; bh=37FGZY+8d8I7xFQKUrk70CCSCQXTT/DB4uVq3pHa4GI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=NS3IDviOzK0HnNEA4zaOh+0/ES/4yVJkFErM/xy1/Mn2WD80Ydh+4NfvpUDXgyBcG uS1ajUNtbcGSOFGh6ZuevFKlSMGRgaLqqAlUeZkVDAnEwqhaJrYJrbrCXdH4i3sR1V By4JuK/fd0z5gcSmSH2JQOwUlB155x7wnOVs+Ec0I5S87guSuniFe4WjseA4EEIt+W X1Cq7km9X2Kwwa8p1IMuvUxM/g5/TM/tQ9ftYSzkxnXER7H3nGCifbdMlS7r5JVna6 FURW2ft7utHrcGQTNb1rukDTQc8jSle7dHP07ozOFJi3up61i36tlrm/Ou3EZYUpR+ 9qXwlJ0I7Km9A== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2CCAFEA820; Wed, 25 Mar 2026 07:21:39 +0000 (UTC) From: Satish Kharat via B4 Relay Date: Wed, 25 Mar 2026 00:21:44 -0700 Subject: [PATCH net-next 6/6] enic: detect admin channel resources for SR-IOV Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260325-enic-sriov-v2-prep-v1-6-48f04ce110cc@cisco.com> References: <20260325-enic-sriov-v2-prep-v1-0-48f04ce110cc@cisco.com> In-Reply-To: <20260325-enic-sriov-v2-prep-v1-0-48f04ce110cc@cisco.com> To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Satish Kharat X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774423298; l=2164; i=satishkh@cisco.com; h=from:subject:message-id; bh=guisoYvjQEJ8FK6Xz6w9CEhNlc7jafORVN4tNVa2Oos=; b=PfpO0JF8mYFRAIQx1SWbsr9fLnn+L2FFn3IoY/UhwYFzFBPI7ORXO0bs64UCkYS0yKqHxNsE0 57vrlNsMmyfBl2zVXYD8JaEuuVPosrfo1Z0kEj1taKVdbuUltDLyGSR X-Developer-Key: i=satishkh@cisco.com; a=ed25519; pk=4BxbLoCGvHeIMH/PbpiNVx8/2IcTjFvqcr0AD8K6WLY= X-Endpoint-Received: by B4 Relay for satishkh@cisco.com/default with auth_id=639 X-Original-From: Satish Kharat Reply-To: satishkh@cisco.com From: Satish Kharat Check for the presence of admin channel BAR resources (RES_TYPE_ADMIN_WQ, ADMIN_RQ, ADMIN_CQ, SRIOV_INTR) during resource discovery. Set has_admin_channel when all four are available. Add admin WQ, RQ, CQ and INTR fields to struct enic for use by the upcoming admin channel open/close paths. Signed-off-by: Satish Kharat --- drivers/net/ethernet/cisco/enic/enic.h | 7 +++++++ drivers/net/ethernet/cisco/enic/enic_res.c | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/= cisco/enic/enic.h index 67fd780b1fa1..08472420f3a1 100644 --- a/drivers/net/ethernet/cisco/enic/enic.h +++ b/drivers/net/ethernet/cisco/enic/enic.h @@ -289,6 +289,13 @@ struct enic { u8 rss_key[ENIC_RSS_LEN]; struct vnic_gen_stats gen_stats; enum ext_cq ext_cq; + + /* Admin channel resources for SR-IOV MBOX */ + bool has_admin_channel; + struct vnic_wq admin_wq; + struct vnic_rq admin_rq; + struct vnic_cq admin_cq[2]; + struct vnic_intr admin_intr; }; =20 static inline struct net_device *vnic_get_netdev(struct vnic_dev *vdev) diff --git a/drivers/net/ethernet/cisco/enic/enic_res.c b/drivers/net/ether= net/cisco/enic/enic_res.c index bbd3143ed73e..a3dc727d63ef 100644 --- a/drivers/net/ethernet/cisco/enic/enic_res.c +++ b/drivers/net/ethernet/cisco/enic/enic_res.c @@ -205,10 +205,16 @@ void enic_get_res_counts(struct enic *enic) enic->cq_count =3D enic->cq_avail; enic->intr_count =3D enic->intr_avail; =20 + enic->has_admin_channel =3D + vnic_dev_get_res_count(enic->vdev, RES_TYPE_ADMIN_WQ) >=3D 1 && + vnic_dev_get_res_count(enic->vdev, RES_TYPE_ADMIN_RQ) >=3D 1 && + vnic_dev_get_res_count(enic->vdev, RES_TYPE_ADMIN_CQ) >=3D 1; + dev_info(enic_get_dev(enic), - "vNIC resources avail: wq %d rq %d cq %d intr %d\n", + "vNIC resources avail: wq %d rq %d cq %d intr %d admin %s\n", enic->wq_avail, enic->rq_avail, - enic->cq_avail, enic->intr_avail); + enic->cq_avail, enic->intr_avail, + enic->has_admin_channel ? "yes" : "no"); } =20 void enic_init_vnic_resources(struct enic *enic) --=20 2.43.0