AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/11/05 05:16 flow patch-triage
1m Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "KMSANReasoning": "",
  "NeedsKMSAN": false,
  "Reasoning": "The patch exclusively modifies the Cisco VIC Ethernet NIC driver (drivers/net/ethernet/cisco/enic/), specifically handling SR-IOV V2 admin channel management, devcmd2 status tracking, and device teardown/quarantine logic. Cisco VIC is proprietary PCIe hardware used in Cisco UCS servers and is not emulated in standard QEMU or virtualized environments used by syzkaller. Because the modified code is structurally unreachable without physical Cisco VIC ASIC hardware, it is not worth fuzzing.",
  "WorthFuzzing": false
}

1/1 2026/11/05 05:16 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit 7a348b6e865ff0a69bf877a135363b0c1415a531\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Thu Nov 5 05:16:02 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/cisco/enic/enic.h\nindex 7a509a05699004..d1f9f2156e0b00 100644\n--- a/drivers/net/ethernet/cisco/enic/enic.h\n+++ b/drivers/net/ethernet/cisco/enic/enic.h\n@@ -238,6 +238,12 @@ enum enic_vf_type {\n \tENIC_VF_TYPE_V2,\n };\n \n+enum enic_admin_chan_state {\n+\tENIC_ADMIN_CHAN_DOWN,\n+\tENIC_ADMIN_CHAN_LIVE,\n+\tENIC_ADMIN_CHAN_QUARANTINED,\n+};\n+\n /* Per-instance private data structure */\n struct enic {\n \tstruct net_device *netdev;\n@@ -265,6 +271,11 @@ struct enic {\n \tu16 num_vfs;\n \tenum enic_vf_type vf_type;\n \tbool vf_registered;\n+\tu16 vf_id;\n+\t/* A CMD_SRIOV_STATS_GET timeout leaves its persistent coherent target\n+\t * device-owned until a later serialized command completes.\n+\t */\n+\tbool sriov_stats_dma_unresolved;\n \tu32 pf_cap_version;\n \tunsigned int enable_count;\n \tspinlock_t enic_api_lock;\n@@ -298,12 +309,9 @@ struct enic {\n \n \t/* Admin channel resources for SR-IOV MBOX */\n \tbool has_admin_channel;\n-\t/* true only while the admin WQ/RQ/CQ are allocated and enabled; gates\n-\t * enic_admin_channel_close() so it is a no-op after a failed (re)open\n-\t * left the resources freed.\n-\t */\n-\tbool admin_chan_up;\n-\t/* set on send timeout; cleared on channel re-open */\n+\t/* QUARANTINED retains admin DMA until a final teardown recheck. */\n+\tenum enic_admin_chan_state admin_chan_state;\n+\t/* Blocks sends throughout close, partial open and timeout recovery. */\n \tbool mbox_send_disabled;\n \tstruct vnic_wq admin_wq;\n \tstruct vnic_rq admin_rq;\ndiff --git a/drivers/net/ethernet/cisco/enic/enic_admin.c b/drivers/net/ethernet/cisco/enic/enic_admin.c\nindex 61c82b48044d0a..6fa27a755e3f3e 100644\n--- a/drivers/net/ethernet/cisco/enic/enic_admin.c\n+++ b/drivers/net/ethernet/cisco/enic/enic_admin.c\n@@ -5,6 +5,7 @@\n #include \u003clinux/netdevice.h\u003e\n #include \u003clinux/dma-mapping.h\u003e\n #include \u003clinux/interrupt.h\u003e\n+#include \u003clinux/iopoll.h\u003e\n \n #include \"vnic_dev.h\"\n #include \"vnic_wq.h\"\n@@ -15,6 +16,7 @@\n #include \"vnic_devcmd.h\"\n #include \"enic.h\"\n #include \"enic_admin.h\"\n+#include \"enic_dev.h\"\n #include \"cq_desc.h\"\n #include \"cq_enet_desc.h\"\n #include \"wq_enet_desc.h\"\n@@ -400,12 +402,23 @@ static void enic_admin_teardown_intr(struct enic *enic)\n \n static int enic_admin_qp_type_set(struct enic *enic, u32 enable)\n {\n+\tenum vnic_devcmd2_status status;\n \tu64 a0 = QP_TYPE_ADMIN, a1 = enable;\n \tint wait = 1000;\n \tint err;\n \n \tspin_lock_bh(\u0026enic-\u003edevcmd_lock);\n-\terr = vnic_dev_cmd(enic-\u003evdev, CMD_QP_TYPE_SET, \u0026a0, \u0026a1, wait);\n+\tif (vnic_dev_uses_devcmd2(enic-\u003evdev)) {\n+\t\terr = vnic_dev_cmd2_status(enic-\u003evdev, CMD_QP_TYPE_SET,\n+\t\t\t\t\t   \u0026a0, \u0026a1, wait, \u0026status);\n+\t\t/* Ordered completion fences the earlier statistics DMA target,\n+\t\t * including an error result. Admin queues still need RUNNING == 0.\n+\t\t */\n+\t\tif (status == VNIC_DEVCMD2_COMPLETED)\n+\t\t\tWRITE_ONCE(enic-\u003esriov_stats_dma_unresolved, false);\n+\t} else {\n+\t\terr = vnic_dev_cmd(enic-\u003evdev, CMD_QP_TYPE_SET, \u0026a0, \u0026a1, wait);\n+\t}\n \tspin_unlock_bh(\u0026enic-\u003edevcmd_lock);\n \n \treturn err;\n@@ -530,11 +543,19 @@ static void enic_admin_msg_drain(struct enic *enic)\n \n int enic_admin_channel_open(struct enic *enic)\n {\n+\tint close_err;\n \tint err;\n \n \tif (!enic-\u003ehas_admin_channel)\n \t\treturn -ENODEV;\n-\n+\tif (READ_ONCE(enic-\u003eadmin_chan_state) != ENIC_ADMIN_CHAN_DOWN) {\n+\t\tnetdev_err(enic-\u003enetdev,\n+\t\t\t   \"Refusing to open non-down admin channel (%u)\\n\",\n+\t\t\t   READ_ONCE(enic-\u003eadmin_chan_state));\n+\t\treturn -EBUSY;\n+\t}\n+\tif (READ_ONCE(enic-\u003esriov_stats_dma_unresolved))\n+\t\treturn -EBUSY;\n \t/* Keep MBOX sends disabled for the entire open sequence.  It is\n \t * cleared only after every resource is allocated and enabled below,\n \t * so any early error return here leaves sends disabled and a\n@@ -567,6 +588,7 @@ int enic_admin_channel_open(struct enic *enic)\n \n \tvnic_wq_enable(\u0026enic-\u003eadmin_wq);\n \tvnic_rq_enable(\u0026enic-\u003eadmin_rq);\n+\tWRITE_ONCE(enic-\u003eadmin_chan_state, ENIC_ADMIN_CHAN_LIVE);\n \n \terr = enic_admin_rq_fill(enic, GFP_KERNEL);\n \tif (err) {\n@@ -582,15 +604,40 @@ int enic_admin_channel_open(struct enic *enic)\n \t\tgoto disable_queues;\n \t}\n \n-\tvnic_intr_unmask(\u0026enic-\u003eadmin_intr);\n+\tif (enic_is_sriov_vf_v2(enic) \u0026\u0026\n+\t    READ_ONCE(enic-\u003evf_id) == ENIC_MBOX_DST_PF) {\n+\t\tstruct vnic_sriov_stats *stats;\n+\t\tu32 version;\n+\t\tu16 vf_id;\n+\n+\t\t/* Keep received notifications queued until their ACK can use\n+\t\t * the VF source ID. The statistics query needs QP_ENABLE first.\n+\t\t */\n+\t\terr = enic_dev_sriov_stats(enic, \u0026stats);\n+\t\tif (err) {\n+\t\t\tnetdev_err(enic-\u003enetdev,\n+\t\t\t\t   \"Failed to get SR-IOV statistics: %d\\n\", err);\n+\t\t\tgoto disable_queues;\n+\t\t}\n+\t\tversion = le32_to_cpu(stats-\u003ever);\n+\t\tvf_id = le16_to_cpu(stats-\u003evf_index);\n+\t\tif (version != VNIC_SRIOV_STATS_VERSION ||\n+\t\t    vf_id == ENIC_MBOX_DST_PF) {\n+\t\t\tnetdev_err(enic-\u003enetdev,\n+\t\t\t\t   \"Invalid SR-IOV statistics version %u VF index %#x\\n\",\n+\t\t\t\t   version, vf_id);\n+\t\t\terr = -EINVAL;\n+\t\t\tgoto disable_queues;\n+\t\t}\n+\t\tWRITE_ONCE(enic-\u003evf_id, vf_id);\n+\t}\n \n \t/* Only now that the admin WQ/RQ/CQ and interrupt are fully allocated,\n-\t * programmed and enabled is it safe to allow MBOX sends.  Clearing this\n-\t * earlier opened a window where a concurrent sender (e.g. link-notify\n-\t * work scheduled by a post-reset link-up) could call enic_mbox_send_msg()\n-\t * against a not-yet-allocated admin_wq and crash.\n+\t * programmed and enabled is it safe to allow MBOX sends. Publish send\n+\t * readiness before unmasking so queued notifications can be acknowledged.\n \t */\n \tWRITE_ONCE(enic-\u003embox_send_disabled, false);\n+\tvnic_intr_unmask(\u0026enic-\u003eadmin_intr);\n \n \tnetdev_dbg(enic-\u003enetdev,\n \t\t   \"admin channel open: intr=%u wq_avail=%u rq_avail=%u cq0_color=%u cq1_color=%u\\n\",\n@@ -600,60 +647,51 @@ int enic_admin_channel_open(struct enic *enic)\n \t\t   enic-\u003eadmin_cq[0].last_color,\n \t\t   enic-\u003eadmin_cq[1].last_color);\n \n-\tenic-\u003eadmin_chan_up = true;\n-\n \treturn 0;\n \n disable_queues:\n-\tenic_admin_teardown_intr(enic);\n-\tenic_admin_qp_type_set(enic, QP_DISABLE);\n-\tif (vnic_wq_disable(\u0026enic-\u003eadmin_wq))\n-\t\tnetdev_warn(enic-\u003enetdev, \"Failed to disable admin WQ\\n\");\n-\tif (vnic_rq_disable(\u0026enic-\u003eadmin_rq))\n-\t\tnetdev_warn(enic-\u003enetdev, \"Failed to disable admin RQ\\n\");\n-\tcancel_work_sync(\u0026enic-\u003eadmin_msg_work);\n-\tenic_admin_msg_drain(enic);\n-\tenic_admin_rq_drain(enic);\n+\tclose_err = enic_admin_channel_close(enic);\n+\tif (close_err)\n+\t\tnetdev_err(enic-\u003enetdev,\n+\t\t\t   \"Failed to close partial admin channel: %d\\n\",\n+\t\t\t   close_err);\n+\treturn err;\n free_resources:\n \tenic_admin_free_resources(enic);\n \treturn err;\n }\n \n-void enic_admin_channel_close(struct enic *enic)\n+static int enic_admin_wq_disable(struct enic *enic)\n {\n-\tint err;\n-\n-\tif (!enic-\u003ehas_admin_channel)\n-\t\treturn;\n+\tstruct vnic_wq *wq = \u0026enic-\u003eadmin_wq;\n+\tu32 running;\n \n-\t/* Nothing to tear down if the channel was never (re)opened, e.g. a\n-\t * failed enic_admin_channel_open() in probe or in the reset path;\n-\t * otherwise the disable/clean calls below dereference freed resources.\n-\t */\n-\tif (!enic-\u003eadmin_chan_up)\n-\t\treturn;\n-\n-\tWRITE_ONCE(enic-\u003embox_send_disabled, true);\n-\n-\tnetdev_dbg(enic-\u003enetdev, \"admin channel close\\n\");\n+\tiowrite32(0, \u0026wq-\u003ectrl-\u003eenable);\n+\treturn read_poll_timeout(ioread32, running, !running, 10, 500000,\n+\t\t\t\t false, \u0026wq-\u003ectrl-\u003erunning);\n+}\n \n-\tvnic_intr_mask(\u0026enic-\u003eadmin_intr);\n-\tenic_admin_teardown_intr(enic);\n-\tcancel_work_sync(\u0026enic-\u003elink_notify_work);\n-\tcancel_work_sync(\u0026enic-\u003eadmin_msg_work);\n-\tenic_admin_msg_drain(enic);\n+static int enic_admin_rq_disable(struct enic *enic)\n+{\n+\tstruct vnic_rq *rq = \u0026enic-\u003eadmin_rq;\n+\tu32 running;\n+\tint err;\n+\tint i;\n \n-\tenic_admin_qp_type_set(enic, QP_DISABLE);\n+\t/* Preserve the two disable/check passes used for the RQ mini-cache. */\n+\tfor (i = 0; i \u003c 2; i++) {\n+\t\tiowrite32(0, \u0026rq-\u003ectrl-\u003eenable);\n+\t\terr = read_poll_timeout(ioread32, running, !running, 10, 500000,\n+\t\t\t\t\tfalse, \u0026rq-\u003ectrl-\u003erunning);\n+\t\tif (err)\n+\t\t\treturn err;\n+\t}\n \n-\terr = vnic_wq_disable(\u0026enic-\u003eadmin_wq);\n-\tif (err)\n-\t\tnetdev_warn(enic-\u003enetdev,\n-\t\t\t    \"Failed to disable admin WQ: %d\\n\", err);\n-\terr = vnic_rq_disable(\u0026enic-\u003eadmin_rq);\n-\tif (err)\n-\t\tnetdev_warn(enic-\u003enetdev,\n-\t\t\t    \"Failed to disable admin RQ: %d\\n\", err);\n+\treturn 0;\n+}\n \n+static void enic_admin_channel_release(struct enic *enic)\n+{\n \tvnic_wq_clean(\u0026enic-\u003eadmin_wq, enic_admin_wq_buf_clean);\n \tenic_admin_rq_drain(enic);\n \tvnic_cq_clean(\u0026enic-\u003eadmin_cq[0]);\n@@ -662,6 +700,111 @@ void enic_admin_channel_close(struct enic *enic)\n \n \tenic-\u003eadmin_rq_handler = NULL;\n \tenic_admin_free_resources(enic);\n+\tWRITE_ONCE(enic-\u003eadmin_chan_state, ENIC_ADMIN_CHAN_DOWN);\n+}\n+\n+int enic_admin_channel_close(struct enic *enic)\n+{\n+\tint qp_err;\n+\tint rq_err;\n+\tint wq_err;\n+\n+\tif (!enic-\u003ehas_admin_channel)\n+\t\treturn 0;\n+\tif (READ_ONCE(enic-\u003eadmin_chan_state) == ENIC_ADMIN_CHAN_DOWN)\n+\t\treturn 0;\n+\tif (READ_ONCE(enic-\u003eadmin_chan_state) == ENIC_ADMIN_CHAN_QUARANTINED)\n+\t\treturn -EBUSY;\n+\n+\tWRITE_ONCE(enic-\u003embox_send_disabled, true);\n+\n+\tif (READ_ONCE(enic-\u003eadmin_chan_state) == ENIC_ADMIN_CHAN_LIVE) {\n+\t\tnetdev_dbg(enic-\u003enetdev, \"admin channel quiesce\\n\");\n+\n+\t\tvnic_intr_mask(\u0026enic-\u003eadmin_intr);\n+\t\tenic_admin_teardown_intr(enic);\n+\t\tcancel_work_sync(\u0026enic-\u003elink_notify_work);\n+\t\tcancel_work_sync(\u0026enic-\u003eadmin_msg_work);\n+\t\tenic_admin_msg_drain(enic);\n+\t}\n+\n+\t/* A sender may have passed the gate before it was raised.  Wait only\n+\t * after cancelling workers which can themselves wait for mbox_lock.\n+\t */\n+\tmutex_lock(\u0026enic-\u003embox_lock);\n+\tqp_err = enic_admin_qp_type_set(enic, QP_DISABLE);\n+\tif (qp_err)\n+\t\tnetdev_warn(enic-\u003enetdev,\n+\t\t\t    \"Failed to disable admin QP type: %d\\n\", qp_err);\n+\n+\twq_err = enic_admin_wq_disable(enic);\n+\trq_err = enic_admin_rq_disable(enic);\n+\n+\t/* Run both complete disable helpers once before retrying only a helper\n+\t * which timed out.\n+\t */\n+\tif (wq_err == -ETIMEDOUT)\n+\t\twq_err = enic_admin_wq_disable(enic);\n+\tif (rq_err == -ETIMEDOUT)\n+\t\trq_err = enic_admin_rq_disable(enic);\n+\n+\tif (wq_err)\n+\t\tnetdev_warn(enic-\u003enetdev,\n+\t\t\t    \"Failed to disable admin WQ after retry: %d\\n\",\n+\t\t\t    wq_err);\n+\tif (rq_err)\n+\t\tnetdev_warn(enic-\u003enetdev,\n+\t\t\t    \"Failed to disable admin RQ after retry: %d\\n\",\n+\t\t\t    rq_err);\n+\n+\t/* QP_DISABLE does not report every low-level stop failure.  The direct\n+\t * WQ/RQ RUNNING observations own the admin allocation graph.\n+\t */\n+\tif (wq_err || rq_err) {\n+\t\tWRITE_ONCE(enic-\u003eadmin_chan_state, ENIC_ADMIN_CHAN_QUARANTINED);\n+\t\tmutex_unlock(\u0026enic-\u003embox_lock);\n+\t\t/* Retained targets remain valid for late DMA. Keep bus mastering\n+\t\t * enabled for the independent datapath and command transport.\n+\t\t */\n+\t\treturn wq_err ?: rq_err;\n+\t}\n+\n+\tenic_admin_channel_release(enic);\n+\tmutex_unlock(\u0026enic-\u003embox_lock);\n+\n+\t/* Firmware rejection does not undermine the WQ/RQ proof. */\n+\treturn qp_err;\n+}\n+\n+int enic_admin_channel_final_recheck(struct enic *enic)\n+{\n+\tint rq_err;\n+\tint wq_err;\n \n-\tenic-\u003eadmin_chan_up = false;\n+\tif (READ_ONCE(enic-\u003eadmin_chan_state) != ENIC_ADMIN_CHAN_QUARANTINED)\n+\t\treturn 0;\n+\n+\t/* Channel close already detached every CPU entry point and attempted\n+\t * QP_DISABLE. This is the final direct check of queue ownership.\n+\t */\n+\tmutex_lock(\u0026enic-\u003embox_lock);\n+\twq_err = enic_admin_wq_disable(enic);\n+\trq_err = enic_admin_rq_disable(enic);\n+\tif (wq_err || rq_err) {\n+\t\tmutex_unlock(\u0026enic-\u003embox_lock);\n+\t\treturn wq_err ?: rq_err;\n+\t}\n+\n+\tenic_admin_channel_release(enic);\n+\tmutex_unlock(\u0026enic-\u003embox_lock);\n+\tnetdev_info(enic-\u003enetdev,\n+\t\t    \"Admin queues stopped during final teardown; releasing DMA graph\\n\");\n+\n+\treturn 0;\n+}\n+\n+bool enic_admin_channel_is_quarantined(const struct enic *enic)\n+{\n+\treturn READ_ONCE(enic-\u003eadmin_chan_state) ==\n+\t\tENIC_ADMIN_CHAN_QUARANTINED;\n }\ndiff --git a/drivers/net/ethernet/cisco/enic/enic_admin.h b/drivers/net/ethernet/cisco/enic/enic_admin.h\nindex 62c80220b0cacc..1fe747c3dd3506 100644\n--- a/drivers/net/ethernet/cisco/enic/enic_admin.h\n+++ b/drivers/net/ethernet/cisco/enic/enic_admin.h\n@@ -20,7 +20,9 @@ struct enic_admin_msg {\n };\n \n int enic_admin_channel_open(struct enic *enic);\n-void enic_admin_channel_close(struct enic *enic);\n+int enic_admin_channel_close(struct enic *enic);\n+int enic_admin_channel_final_recheck(struct enic *enic);\n+bool enic_admin_channel_is_quarantined(const struct enic *enic);\n unsigned int enic_admin_wq_cq_service(struct enic *enic);\n unsigned int enic_admin_rq_cq_service(struct enic *enic);\n \ndiff --git a/drivers/net/ethernet/cisco/enic/enic_dev.c b/drivers/net/ethernet/cisco/enic/enic_dev.c\nindex 659787f73cf180..7d5298e6df0274 100644\n--- a/drivers/net/ethernet/cisco/enic/enic_dev.c\n+++ b/drivers/net/ethernet/cisco/enic/enic_dev.c\n@@ -171,6 +171,50 @@ int enic_dev_intr_coal_timer_info(struct enic *enic)\n \treturn err;\n }\n \n+int enic_dev_close(struct enic *enic)\n+{\n+\tenum vnic_devcmd2_status status;\n+\tu64 a0 = 0, a1 = 0;\n+\tint err;\n+\n+\tspin_lock_bh(\u0026enic-\u003edevcmd_lock);\n+\tif (vnic_dev_uses_devcmd2(enic-\u003evdev)) {\n+\t\terr = vnic_dev_cmd2_status(enic-\u003evdev, CMD_CLOSE,\n+\t\t\t\t\t   \u0026a0, \u0026a1, 1000, \u0026status);\n+\t\t/* A close result also fences earlier statistics DMA, including\n+\t\t * an error result. Admin queues still need RUNNING == 0.\n+\t\t */\n+\t\tif (status == VNIC_DEVCMD2_COMPLETED)\n+\t\t\tWRITE_ONCE(enic-\u003esriov_stats_dma_unresolved, false);\n+\t} else {\n+\t\terr = vnic_dev_close(enic-\u003evdev);\n+\t}\n+\tspin_unlock_bh(\u0026enic-\u003edevcmd_lock);\n+\n+\treturn err;\n+}\n+\n+int enic_dev_sriov_stats(struct enic *enic,\n+\t\t\t struct vnic_sriov_stats **stats)\n+{\n+\tenum vnic_devcmd2_status status;\n+\tint err;\n+\n+\t*stats = NULL;\n+\tspin_lock_bh(\u0026enic-\u003edevcmd_lock);\n+\tif (READ_ONCE(enic-\u003esriov_stats_dma_unresolved)) {\n+\t\terr = -EBUSY;\n+\t\tgoto unlock;\n+\t}\n+\terr = vnic_dev_sriov_stats(enic-\u003evdev, stats, \u0026status);\n+\tif (status == VNIC_DEVCMD2_POSTED)\n+\t\tWRITE_ONCE(enic-\u003esriov_stats_dma_unresolved, true);\n+unlock:\n+\tspin_unlock_bh(\u0026enic-\u003edevcmd_lock);\n+\n+\treturn err;\n+}\n+\n /* rtnl lock is held */\n int enic_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid)\n {\ndiff --git a/drivers/net/ethernet/cisco/enic/enic_dev.h b/drivers/net/ethernet/cisco/enic/enic_dev.h\nindex 698d0cb020644d..eed1674ff30fbc 100644\n--- a/drivers/net/ethernet/cisco/enic/enic_dev.h\n+++ b/drivers/net/ethernet/cisco/enic/enic_dev.h\n@@ -40,6 +40,9 @@ int enic_dev_set_ig_vlan_rewrite_mode(struct enic *enic);\n int enic_dev_enable(struct enic *enic);\n int enic_dev_disable(struct enic *enic);\n int enic_dev_intr_coal_timer_info(struct enic *enic);\n+int enic_dev_close(struct enic *enic);\n+int enic_dev_sriov_stats(struct enic *enic,\n+\t\t\t struct vnic_sriov_stats **stats);\n int enic_dev_status_to_errno(int devcmd_status);\n \n #endif /* _ENIC_DEV_H_ */\ndiff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c\nindex 6b5824f45a14cd..3c9937f8856d85 100644\n--- a/drivers/net/ethernet/cisco/enic/enic_main.c\n+++ b/drivers/net/ethernet/cisco/enic/enic_main.c\n@@ -1736,6 +1736,13 @@ static int enic_open(struct net_device *netdev)\n \t\t.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV,\n \t};\n \n+\t/* Internal reopen paths also bypass the networking core's presence check. */\n+\tif (!netif_device_present(netdev))\n+\t\treturn -ENODEV;\n+\tif (enic_is_sriov_vf_v2(enic) \u0026\u0026\n+\t    enic_admin_channel_is_quarantined(enic))\n+\t\treturn -EBUSY;\n+\n \terr = enic_request_intr(enic);\n \tif (err) {\n \t\tnetdev_err(netdev, \"Unable to request irq.\\n\");\n@@ -2196,6 +2203,12 @@ static bool enic_has_admin_chan(struct enic *enic)\n \t       (enic_sriov_enabled(enic) \u0026\u0026 enic-\u003evf_type == ENIC_VF_TYPE_V2);\n }\n \n+static bool enic_control_dma_unresolved(struct enic *enic)\n+{\n+\treturn enic_admin_channel_is_quarantined(enic) ||\n+\t       READ_ONCE(enic-\u003esriov_stats_dma_unresolved);\n+}\n+\n /* Re-establish the admin/MBOX channel after a reset has re-created the data\n  * path.  Mirrors the relevant part of the probe / SR-IOV-enable sequence:\n  * reinitialise MBOX and reopen the channel, then for a VF re-run the PF\n@@ -2206,6 +2219,9 @@ static void enic_admin_chan_reopen(struct enic *enic)\n {\n \tint err;\n \n+\tif (enic_admin_channel_is_quarantined(enic))\n+\t\treturn;\n+\n \t/* Install the MBOX receive handler and clear pending reply state before\n \t * opening the channel, so the handler is in place before the admin\n \t * interrupt is unmasked and no early completion is dropped.  Keep the\n@@ -2237,6 +2253,7 @@ static void enic_admin_chan_reopen(struct enic *enic)\n \t\t\t\t   \"MBOX capability check after reset failed: %d\\n\",\n \t\t\t\t   err);\n \t\t\tenic_admin_channel_close(enic);\n+\t\t\tWRITE_ONCE(enic-\u003evf_registered, false);\n \t\t\treturn;\n \t\t}\n \t\terr = enic_mbox_vf_register(enic);\n@@ -2245,6 +2262,7 @@ static void enic_admin_chan_reopen(struct enic *enic)\n \t\t\t\t   \"MBOX VF re-registration after reset failed: %d\\n\",\n \t\t\t\t   err);\n \t\t\tenic_admin_channel_close(enic);\n+\t\t\tWRITE_ONCE(enic-\u003evf_registered, false);\n \t\t}\n \t} else {\n \t\t/* The link came back up during enic_open() above while MBOX\n@@ -2264,6 +2282,9 @@ static void enic_reset(struct work_struct *work)\n \n \trtnl_lock();\n \n+\tif (!netif_running(enic-\u003enetdev))\n+\t\tgoto unlock;\n+\n \t/* Stop any activity from infiniband */\n \tenic_set_api_busy(enic, true);\n \n@@ -2273,8 +2294,17 @@ static void enic_reset(struct work_struct *work)\n \t * DMAs from the about-to-be-reset rings) and frees the admin resources\n \t * so they are cleanly re-allocated afterwards.\n \t */\n-\tif (enic_has_admin_chan(enic))\n+\tif (enic_has_admin_chan(enic)) {\n \t\tenic_admin_channel_close(enic);\n+\t\t/* Channel close has drained registration replies. */\n+\t\tif (enic_is_sriov_vf_v2(enic))\n+\t\t\tWRITE_ONCE(enic-\u003evf_registered, false);\n+\t}\n+\tif (enic_admin_channel_is_quarantined(enic)) {\n+\t\t/* Core close excludes netpoll and clears __LINK_STATE_START first. */\n+\t\tdev_close(enic-\u003enetdev);\n+\t\tgoto reset_out;\n+\t}\n \n \tenic_stop(enic-\u003enetdev);\n \tif (enic_is_sriov_vf_v2(enic))\n@@ -2287,7 +2317,8 @@ static void enic_reset(struct work_struct *work)\n \tenic_dev_set_ig_vlan_rewrite_mode(enic);\n \tenic_ext_cq(enic);\n \n-\tenic_open(enic-\u003enetdev);\n+\tif (enic_open(enic-\u003enetdev))\n+\t\tgoto reset_out;\n \n \t/* Re-establish the admin/MBOX channel after the data path is back up.\n \t * It was fully torn down by enic_admin_channel_close() above;\n@@ -2296,12 +2327,17 @@ static void enic_reset(struct work_struct *work)\n \t */\n \tif (enic_has_admin_chan(enic))\n \t\tenic_admin_chan_reopen(enic);\n+\tif (enic_is_sriov_vf_v2(enic) \u0026\u0026\n+\t    enic_admin_channel_is_quarantined(enic))\n+\t\tdev_close(enic-\u003enetdev);\n \n+reset_out:\n \t/* Allow infiniband to fiddle with the device again */\n \tenic_set_api_busy(enic, false);\n \n \tcall_netdevice_notifiers(NETDEV_REBOOT, enic-\u003enetdev);\n \n+unlock:\n \trtnl_unlock();\n }\n \n@@ -2311,6 +2347,9 @@ static void enic_tx_hang_reset(struct work_struct *work)\n \n \trtnl_lock();\n \n+\tif (!netif_running(enic-\u003enetdev))\n+\t\tgoto unlock;\n+\n \t/* Stop any activity from infiniband */\n \tenic_set_api_busy(enic, true);\n \n@@ -2318,8 +2357,16 @@ static void enic_tx_hang_reset(struct work_struct *work)\n \t * the same reason as the soft reset path: stop the admin QP and free\n \t * the admin resources before the hardware queues are wiped.\n \t */\n-\tif (enic_has_admin_chan(enic))\n+\tif (enic_has_admin_chan(enic)) {\n \t\tenic_admin_channel_close(enic);\n+\t\t/* Channel close has drained registration replies. */\n+\t\tif (enic_is_sriov_vf_v2(enic))\n+\t\t\tWRITE_ONCE(enic-\u003evf_registered, false);\n+\t}\n+\tif (enic_admin_channel_is_quarantined(enic)) {\n+\t\tdev_close(enic-\u003enetdev);\n+\t\tgoto reset_out;\n+\t}\n \n \tenic_dev_hang_notify(enic);\n \tenic_stop(enic-\u003enetdev);\n@@ -2333,7 +2380,8 @@ static void enic_tx_hang_reset(struct work_struct *work)\n \tenic_dev_set_ig_vlan_rewrite_mode(enic);\n \tenic_ext_cq(enic);\n \n-\tenic_open(enic-\u003enetdev);\n+\tif (enic_open(enic-\u003enetdev))\n+\t\tgoto reset_out;\n \n \t/* Re-establish the admin/MBOX channel after the data path is back up.\n \t * It was fully torn down by enic_admin_channel_close() above;\n@@ -2342,12 +2390,17 @@ static void enic_tx_hang_reset(struct work_struct *work)\n \t */\n \tif (enic_has_admin_chan(enic))\n \t\tenic_admin_chan_reopen(enic);\n+\tif (enic_is_sriov_vf_v2(enic) \u0026\u0026\n+\t    enic_admin_channel_is_quarantined(enic))\n+\t\tdev_close(enic-\u003enetdev);\n \n+reset_out:\n \t/* Allow infiniband to fiddle with the device again */\n \tenic_set_api_busy(enic, false);\n \n \tcall_netdevice_notifiers(NETDEV_REBOOT, enic-\u003enetdev);\n \n+unlock:\n \trtnl_unlock();\n }\n \n@@ -2841,6 +2894,12 @@ static void enic_sriov_detect_vf_type(struct enic *enic)\n \n \tif (enic-\u003evf_type != ENIC_VF_TYPE_V2)\n \t\treturn;\n+\tif (!vnic_dev_uses_devcmd2(enic-\u003evdev)) {\n+\t\tdev_warn(\u0026pdev-\u003edev,\n+\t\t\t \"SR-IOV V2 requires DEVCMD2; disabling V2 support\\n\");\n+\t\tenic-\u003evf_type = ENIC_VF_TYPE_NONE;\n+\t\treturn;\n+\t}\n \n \t/* A successful command means firmware recognizes\n \t * VIC_FEATURE_SRIOV; supported_versions is available\n@@ -3025,6 +3084,7 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \tenic = netdev_priv(netdev);\n \tenic-\u003enetdev = netdev;\n \tenic-\u003epdev = pdev;\n+\tWRITE_ONCE(enic-\u003evf_id, ENIC_MBOX_DST_PF);\n \tspin_lock_init(\u0026enic-\u003evf_link_state_lock);\n \n \t/* Setup PCI resources\n@@ -3036,7 +3096,8 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \t\tgoto err_out_free_netdev;\n \t}\n \n-\terr = pci_request_regions(pdev, DRV_NAME);\n+\t/* A terminal admin allocation keeps the reservation after module unload. */\n+\terr = pci_request_regions(pdev, dev_name(dev));\n \tif (err) {\n \t\tdev_err(dev, \"Cannot request PCI regions, aborting\\n\");\n \t\tgoto err_out_disable_device;\n@@ -3091,6 +3152,12 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \n \tif (err)\n \t\tgoto err_out_vnic_unregister;\n+\tif (enic_is_sriov_vf_v2(enic) \u0026\u0026\n+\t    !vnic_dev_uses_devcmd2(enic-\u003evdev)) {\n+\t\tdev_err(dev, \"SR-IOV V2 VF requires DEVCMD2\\n\");\n+\t\terr = -EOPNOTSUPP;\n+\t\tgoto err_out_vnic_unregister;\n+\t}\n \n #ifdef CONFIG_PCI_IOV\n \tenic_sriov_detect_vf_type(enic);\n@@ -3219,6 +3286,8 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \t\t\t\t\"MBOX VF registration failed: %d\\n\", err);\n \t\t\tgoto err_out_admin_close;\n \t\t}\n+\t\tdev_info(dev, \"V2 VF registered, VF index %u\\n\",\n+\t\t\t READ_ONCE(enic-\u003evf_id));\n \t}\n \n \tnetif_set_real_num_tx_queues(netdev, enic-\u003ewq_count);\n@@ -3363,7 +3432,9 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n err_out_dev_deinit:\n \tenic_dev_deinit(enic);\n err_out_dev_close:\n-\tvnic_dev_close(enic-\u003evdev);\n+\tenic_dev_close(enic);\n+\tif (enic_admin_channel_is_quarantined(enic))\n+\t\tenic_admin_channel_final_recheck(enic);\n err_out_disable_sriov:\n \tkfree(enic-\u003epp);\n err_out_disable_sriov_pp:\n@@ -3374,6 +3445,17 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \t}\n #endif\n err_out_vnic_unregister:\n+\tif (enic_control_dma_unresolved(enic)) {\n+\t\t/* Normal generic cleanup and CMD_CLOSE have already run. Retain\n+\t\t * only the inert admin/control owners and their PCI reservation.\n+\t\t */\n+\t\tpci_dev_get(pdev);\n+\t\tpci_clear_master(pdev);\n+\t\tpci_disable_device(pdev);\n+\t\tpci_set_drvdata(pdev, NULL);\n+\t\tdev_err(dev, \"Control DMA unresolved; retaining resources until reboot\\n\");\n+\t\treturn err;\n+\t}\n \tvnic_dev_unregister(enic-\u003evdev);\n err_out_iounmap:\n \tenic_iounmap(enic);\n@@ -3397,6 +3479,9 @@ static void enic_remove(struct pci_dev *pdev)\n \t\tdisable_work_sync(\u0026enic-\u003ereset);\n \t\tdisable_work_sync(\u0026enic-\u003etx_hang_reset);\n \t\tdisable_work_sync(\u0026enic-\u003echange_mtu_work);\n+\t\trtnl_lock();\n+\t\tnetif_device_detach(netdev);\n+\t\trtnl_unlock();\n \n \t\t/* Close the admin channel and unregister from the PF before\n \t\t * unregister_netdev() to prevent a late PF notification from\n@@ -3430,8 +3515,24 @@ static void enic_remove(struct pci_dev *pdev)\n \t\t}\n #endif\n \t\tenic_dev_deinit(enic);\n-\t\tvnic_dev_close(enic-\u003evdev);\n+\t\tenic_dev_close(enic);\n+\t\tif (enic_admin_channel_is_quarantined(enic))\n+\t\t\tenic_admin_channel_final_recheck(enic);\n \t\tkfree(enic-\u003epp);\n+\t\tif (enic_control_dma_unresolved(enic)) {\n+\t\t\t/* All generic queues and CPU entry points followed ordinary\n+\t\t\t * teardown. No admin buffer can return from the network stack.\n+\t\t\t * Pin the PCI object for the reservation's owner-name pointer;\n+\t\t\t * this reference does not fence DMA or preserve IOMMU state.\n+\t\t\t */\n+\t\t\tpci_dev_get(pdev);\n+\t\t\tpci_clear_master(pdev);\n+\t\t\tpci_disable_device(pdev);\n+\t\t\tpci_set_drvdata(pdev, NULL);\n+\t\t\tdev_err(\u0026pdev-\u003edev,\n+\t\t\t\t\"Control DMA unresolved; retaining resources until reboot\\n\");\n+\t\t\treturn;\n+\t\t}\n \t\tvnic_dev_unregister(enic-\u003evdev);\n \t\tenic_iounmap(enic);\n \t\tpci_release_regions(pdev);\ndiff --git a/drivers/net/ethernet/cisco/enic/enic_mbox.c b/drivers/net/ethernet/cisco/enic/enic_mbox.c\nindex 5c93ca49552ac2..a1f8138d0bbd83 100644\n--- a/drivers/net/ethernet/cisco/enic/enic_mbox.c\n+++ b/drivers/net/ethernet/cisco/enic/enic_mbox.c\n@@ -18,10 +18,17 @@\n #define ENIC_MBOX_POLL_TIMEOUT_US\t5000000\n #define ENIC_MBOX_POLL_INTERVAL_US\t100\n \n-static void enic_mbox_fill_hdr(struct enic_mbox_hdr *hdr, u8 msg_type,\n+static void enic_mbox_fill_hdr(struct enic *enic, struct enic_mbox_hdr *hdr,\n+\t\t\t       u8 msg_type,\n \t\t\t       u16 dst_vnic_id, u16 msg_len, u64 msg_num)\n {\n+\tu16 src_vnic_id = ENIC_MBOX_DST_PF;\n+\n+\tif (enic_is_sriov_vf_v2(enic))\n+\t\tsrc_vnic_id = READ_ONCE(enic-\u003evf_id);\n+\n \tmemset(hdr, 0, sizeof(*hdr));\n+\thdr-\u003esrc_vnic_id = cpu_to_le16(src_vnic_id);\n \thdr-\u003edst_vnic_id = cpu_to_le16(dst_vnic_id);\n \thdr-\u003emsg_type = msg_type;\n \thdr-\u003emsg_len = cpu_to_le16(msg_len);\n@@ -85,7 +92,8 @@ static int enic_mbox_send_msg_id(struct enic *enic, u8 msg_type,\n \t\treply_expected = true;\n \t}\n \n-\tenic_mbox_fill_hdr(buf, msg_type, dst_vnic_id, total_len, msg_num);\n+\tenic_mbox_fill_hdr(enic, buf, msg_type, dst_vnic_id, total_len,\n+\t\t\t   msg_num);\n \tif (payload_len) {\n \t\tvoid *dst = buf + sizeof(struct enic_mbox_hdr);\n \ndiff --git a/drivers/net/ethernet/cisco/enic/vnic_dev.c b/drivers/net/ethernet/cisco/enic/vnic_dev.c\nindex c8d657e97094ed..92eec1455ceb8b 100644\n--- a/drivers/net/ethernet/cisco/enic/vnic_dev.c\n+++ b/drivers/net/ethernet/cisco/enic/vnic_dev.c\n@@ -287,8 +287,9 @@ static int _vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,\n \treturn -ETIMEDOUT;\n }\n \n-static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,\n-\t\t\t  int wait)\n+static int _vnic_dev_cmd2_status(struct vnic_dev *vdev,\n+\t\t\t\t enum vnic_devcmd_cmd cmd, int wait,\n+\t\t\t\t enum vnic_devcmd2_status *status)\n {\n \tstruct devcmd2_controller *dc2c = vdev-\u003edevcmd2;\n \tstruct devcmd2_result *result;\n@@ -298,6 +299,9 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,\n \tu32 fetch_index, new_posted;\n \tu32 posted = dc2c-\u003eposted;\n \n+\tif (status)\n+\t\t*status = VNIC_DEVCMD2_NOT_POSTED;\n+\n \tfetch_index = ioread32(\u0026dc2c-\u003ewq_ctrl-\u003efetch_index);\n \n \tif (fetch_index == 0xFFFFFFFF)\n@@ -326,6 +330,8 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,\n \twmb();\n \tiowrite32(new_posted, \u0026dc2c-\u003ewq_ctrl-\u003eposted_index);\n \tdc2c-\u003eposted = new_posted;\n+\tif (status)\n+\t\t*status = VNIC_DEVCMD2_POSTED;\n \n \tif (dc2c-\u003ecmd_ring[posted].flags \u0026 DEVCMD2_FNORESULT)\n \t\treturn 0;\n@@ -340,7 +346,10 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,\n \t}\n \n \tfor (delay = 0; delay \u003c wait; delay++) {\n-\t\tif (result-\u003ecolor == color) {\n+\t\tif (READ_ONCE(result-\u003ecolor) == color) {\n+\t\t\tdma_rmb();\n+\t\t\tif (status)\n+\t\t\t\t*status = VNIC_DEVCMD2_COMPLETED;\n \t\t\tif (result-\u003eerror) {\n \t\t\t\terr = result-\u003eerror;\n \t\t\t\tif (err != ERR_ECMDUNKNOWN ||\n@@ -363,6 +372,31 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,\n \treturn -ETIMEDOUT;\n }\n \n+static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,\n+\t\t\t  int wait)\n+{\n+\treturn _vnic_dev_cmd2_status(vdev, cmd, wait, NULL);\n+}\n+\n+int vnic_dev_cmd2_status(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,\n+\t\t\t u64 *a0, u64 *a1, int wait,\n+\t\t\t enum vnic_devcmd2_status *status)\n+{\n+\tint err;\n+\n+\t*status = VNIC_DEVCMD2_NOT_POSTED;\n+\tif (!vdev-\u003edevcmd2 || vdev-\u003eproxy != PROXY_NONE)\n+\t\treturn -EOPNOTSUPP;\n+\n+\tmemset(vdev-\u003eargs, 0, sizeof(vdev-\u003eargs));\n+\tvdev-\u003eargs[0] = *a0;\n+\tvdev-\u003eargs[1] = *a1;\n+\terr = _vnic_dev_cmd2_status(vdev, cmd, wait, status);\n+\t*a0 = vdev-\u003eargs[0];\n+\t*a1 = vdev-\u003eargs[1];\n+\treturn err;\n+}\n+\n static int vnic_dev_init_devcmd1(struct vnic_dev *vdev)\n {\n \tvdev-\u003edevcmd = vnic_dev_get_res(vdev, RES_TYPE_DEVCMD, 0);\n@@ -1046,6 +1080,11 @@ void vnic_dev_unregister(struct vnic_dev *vdev)\n \t\t\tdma_free_coherent(\u0026vdev-\u003epdev-\u003edev,\n \t\t\t\t\t  sizeof(struct vnic_stats),\n \t\t\t\t\t  vdev-\u003estats, vdev-\u003estats_pa);\n+\t\tif (vdev-\u003esriov_stats)\n+\t\t\tdma_free_coherent(\u0026vdev-\u003epdev-\u003edev,\n+\t\t\t\t\t  sizeof(struct vnic_sriov_stats),\n+\t\t\t\t\t  vdev-\u003esriov_stats,\n+\t\t\t\t\t  vdev-\u003esriov_stats_pa);\n \t\tif (vdev-\u003efw_info)\n \t\t\tdma_free_coherent(\u0026vdev-\u003epdev-\u003edev,\n \t\t\t\t\t  sizeof(struct vnic_devcmd_fw_info),\n@@ -1088,6 +1127,11 @@ struct pci_dev *vnic_dev_get_pdev(struct vnic_dev *vdev)\n }\n EXPORT_SYMBOL(vnic_dev_get_pdev);\n \n+bool vnic_dev_uses_devcmd2(struct vnic_dev *vdev)\n+{\n+\treturn vdev-\u003edevcmd2;\n+}\n+\n int vnic_devcmd_init(struct vnic_dev *vdev)\n {\n \tvoid __iomem *res;\n@@ -1295,3 +1339,38 @@ int vnic_dev_capable_rss_hash_type(struct vnic_dev *vdev, u8 *rss_hash_type)\n \n \treturn 0;\n }\n+\n+int vnic_dev_sriov_stats(struct vnic_dev *vdev,\n+\t\t\t struct vnic_sriov_stats **stats,\n+\t\t\t enum vnic_devcmd2_status *status)\n+{\n+\tu64 a0, a1;\n+\tint err;\n+\n+\t*stats = NULL;\n+\t*status = VNIC_DEVCMD2_NOT_POSTED;\n+\tif (!vdev-\u003esriov_stats) {\n+\t\tvdev-\u003esriov_stats =\n+\t\t\tdma_alloc_coherent(\u0026vdev-\u003epdev-\u003edev,\n+\t\t\t\t\t   sizeof(*vdev-\u003esriov_stats),\n+\t\t\t\t\t   \u0026vdev-\u003esriov_stats_pa,\n+\t\t\t\t\t   GFP_ATOMIC);\n+\t\tif (!vdev-\u003esriov_stats)\n+\t\t\treturn -ENOMEM;\n+\t}\n+\n+\tmemset(vdev-\u003esriov_stats, 0, sizeof(*vdev-\u003esriov_stats));\n+\ta0 = vdev-\u003esriov_stats_pa;\n+\ta1 = sizeof(*vdev-\u003esriov_stats);\n+\terr = vnic_dev_cmd2_status(vdev, CMD_SRIOV_STATS_GET, \u0026a0, \u0026a1,\n+\t\t\t\t   1000, status);\n+\tif (!err) {\n+\t\t/* Order CPU reads from the coherent target after command\n+\t\t * completion.\n+\t\t */\n+\t\tdma_rmb();\n+\t\t*stats = vdev-\u003esriov_stats;\n+\t}\n+\n+\treturn err;\n+}\ndiff --git a/drivers/net/ethernet/cisco/enic/vnic_dev.h b/drivers/net/ethernet/cisco/enic/vnic_dev.h\nindex 7fdd8c661c99dc..6a4d7ce3b63657 100644\n--- a/drivers/net/ethernet/cisco/enic/vnic_dev.h\n+++ b/drivers/net/ethernet/cisco/enic/vnic_dev.h\n@@ -93,6 +93,8 @@ struct vnic_dev {\n \tdma_addr_t linkstatus_pa;\n \tstruct vnic_stats *stats;\n \tdma_addr_t stats_pa;\n+\tstruct vnic_sriov_stats *sriov_stats;\n+\tdma_addr_t sriov_stats_pa;\n \tstruct vnic_devcmd_fw_info *fw_info;\n \tdma_addr_t fw_info_pa;\n \tenum vnic_proxy_type proxy;\n@@ -106,6 +108,12 @@ struct vnic_dev {\n \n struct vnic_stats;\n \n+enum vnic_devcmd2_status {\n+\tVNIC_DEVCMD2_NOT_POSTED,\n+\tVNIC_DEVCMD2_POSTED,\n+\tVNIC_DEVCMD2_COMPLETED,\n+};\n+\n void *vnic_dev_priv(struct vnic_dev *vdev);\n unsigned int vnic_dev_get_res_count(struct vnic_dev *vdev,\n \tenum vnic_res_type type);\n@@ -118,6 +126,9 @@ void vnic_dev_free_desc_ring(struct vnic_dev *vdev,\n \tstruct vnic_dev_ring *ring);\n int vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,\n \tu64 *a0, u64 *a1, int wait);\n+int vnic_dev_cmd2_status(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,\n+\t\t\t u64 *a0, u64 *a1, int wait,\n+\t\t\t enum vnic_devcmd2_status *status);\n void vnic_dev_cmd_proxy_by_index_start(struct vnic_dev *vdev, u16 index);\n void vnic_dev_cmd_proxy_end(struct vnic_dev *vdev);\n int vnic_dev_fw_info(struct vnic_dev *vdev,\n@@ -163,6 +174,7 @@ struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev,\n \tvoid *priv, struct pci_dev *pdev, struct vnic_dev_bar *bar,\n \tunsigned int num_bars);\n struct pci_dev *vnic_dev_get_pdev(struct vnic_dev *vdev);\n+bool vnic_dev_uses_devcmd2(struct vnic_dev *vdev);\n int vnic_dev_init_prov2(struct vnic_dev *vdev, u8 *buf, u32 len);\n int vnic_dev_enable2(struct vnic_dev *vdev, int active);\n int vnic_dev_enable2_done(struct vnic_dev *vdev, int *status);\n@@ -177,5 +189,8 @@ int vnic_dev_overlay_offload_cfg(struct vnic_dev *vdev, u8 overlay,\n int vnic_dev_get_supported_feature_ver(struct vnic_dev *vdev, u8 feature,\n \t\t\t\t       u64 *supported_versions, u64 *a1);\n int vnic_dev_capable_rss_hash_type(struct vnic_dev *vdev, u8 *rss_hash_type);\n+int vnic_dev_sriov_stats(struct vnic_dev *vdev,\n+\t\t\t struct vnic_sriov_stats **stats,\n+\t\t\t enum vnic_devcmd2_status *status);\n \n #endif /* _VNIC_DEV_H_ */\ndiff --git a/drivers/net/ethernet/cisco/enic/vnic_devcmd.h b/drivers/net/ethernet/cisco/enic/vnic_devcmd.h\nindex 90ca06691ebd63..9f397df88c50bb 100644\n--- a/drivers/net/ethernet/cisco/enic/vnic_devcmd.h\n+++ b/drivers/net/ethernet/cisco/enic/vnic_devcmd.h\n@@ -461,6 +461,14 @@ enum vnic_devcmd_cmd {\n \t * in: (u32) a1 = enable (1) / disable (0)\n \t */\n \tCMD_QP_TYPE_SET = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 97),\n+\n+\t/*\n+\t * Get SR-IOV capabilities, resource usage, and this function's logical\n+\t * VF index.\n+\t * in: (u64) a0 = DMA address of struct vnic_sriov_stats\n+\t * in: (u32) a1 = length of the buffer\n+\t */\n+\tCMD_SRIOV_STATS_GET = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 98),\n };\n \n #define QP_TYPE_ADMIN\t0\n@@ -468,6 +476,32 @@ enum vnic_devcmd_cmd {\n #define QP_ENABLE\t1\n #define QP_DISABLE\t0\n \n+#define VNIC_SRIOV_STATS_VERSION\t1\n+\n+struct vnic_sriov_stats {\n+\t__le32 ver;\n+\tu8 sriov_vlan_membership_cap;\n+\tu8 sriov_vlan_membership_enabled;\n+\tu8 sriov_rss_vf_full_cap;\n+\tu8 sriov_host_rx_stats;\n+\t__le32 ig_classifier0_tcam_cfg;\n+\t__le32 ig_classifier0_tcam_free;\n+\t__le32 eg_classifier0_tcam_cfg;\n+\t__le32 eg_classifier0_tcam_free;\n+\t__le32 ig_classifier1_tcam_cfg;\n+\t__le32 ig_classifier1_tcam_free;\n+\t__le32 eg_classifier1_tcam_cfg;\n+\t__le32 eg_classifier1_tcam_free;\n+\t__le32 sriov_ig_flow_table_cfg;\n+\t__le32 sriov_ig_flow_table_free;\n+\t__le32 sriov_eg_flow_table_cfg;\n+\t__le32 sriov_eg_flow_table_free;\n+\tu8 admin_qp_ready[32];\n+\t__le16 vf_index;\n+\t__le16 reserved1;\n+\t__le32 reserved2[256 - 23];\n+};\n+\n /* CMD_ENABLE2 flags */\n #define CMD_ENABLE2_STANDBY 0x0\n #define CMD_ENABLE2_ACTIVE  0x1\n"
}

2/1 2026/11/05 05:16 agent patch-evaluator
1m Model:
core

Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch exclusively modifies the Cisco VIC Ethernet NIC driver (drivers/net/ethernet/cisco/enic/), specifically handling SR-IOV V2 admin channel management, devcmd2 status tracking, and device teardown/quarantine logic. Cisco VIC is proprietary PCIe hardware used in Cisco UCS servers and is not emulated in standard QEMU or virtualized environments used by syzkaller. Because the modified code is structurally unreachable without physical Cisco VIC ASIC hardware, it is not worth fuzzing.",
  "WorthFuzzing": false
}

Instruction:
You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.

IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.

================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.

- REACHABILITY IS THE PRIMARY GATE:
  Fuzzing can only discover bugs in code that can actually execute in standard virtualized
  environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
  If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
  regardless of whether it adds assertions or complex logic.

- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
  Patch authors routinely label changes as "cleanups", "refactorings", or state
  "No functional change intended". Do NOT take these claims at face value.
  Code refactorings that rearrange logic, introduce helper functions, or alter state management
  in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
  If reachable executable code is modified or refactored, it MUST be fuzzed.

- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
  When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
  BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
  Even if the author believes the invariant always holds, fuzzing is essential to verify whether
  an unusual sequence of operations can violate it.

================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:

- Non-kernel and non-executable changes:
  * Modifications to Documentation/, comments, or spelling fixes.
  * User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
    that do not affect the compiled kernel image (vmlinux) or kernel modules.
  * Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
    that do not alter control flow or data structures.
  * Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
  * Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
    ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
  * Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
    physical PCI hot-unplug or manual sysfs driver unbinding.
  * Code paths exclusive to architectures other than the target architecture.

================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
  * Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
    BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
  * Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
  * Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
  * Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).

================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:

- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
  Do NOT list generic, ubiquitous functions called by almost every program in the corpus
  (including, but not limited to: general memory allocators and deallocators, page fault
  and trap handlers, or core synchronization primitives; this is not an exhaustive list).
  Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
  which severely dilutes fuzzing effort away from the actual changes.

- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
  List functions that specifically implement the logic being added or altered, or direct API entrypoints
  for the subsystem feature under review.

- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
  Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
  distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
  If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
  functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).

================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
Target architecture: amd64

For your convenience, here is the diff of the changes:
commit 7a348b6e865ff0a69bf877a135363b0c1415a531
Author: syz-cluster <triage@syzkaller.com>
Date:   Thu Nov 5 05:16:02 2026 +0000

    syz-cluster: applied patch under review

diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/cisco/enic/enic.h
index 7a509a05699004..d1f9f2156e0b00 100644
--- a/drivers/net/ethernet/cisco/enic/enic.h
+++ b/drivers/net/ethernet/cisco/enic/enic.h
@@ -238,6 +238,12 @@ enum enic_vf_type {
 	ENIC_VF_TYPE_V2,
 };
 
+enum enic_admin_chan_state {
+	ENIC_ADMIN_CHAN_DOWN,
+	ENIC_ADMIN_CHAN_LIVE,
+	ENIC_ADMIN_CHAN_QUARANTINED,
+};
+
 /* Per-instance private data structure */
 struct enic {
 	struct net_device *netdev;
@@ -265,6 +271,11 @@ struct enic {
 	u16 num_vfs;
 	enum enic_vf_type vf_type;
 	bool vf_registered;
+	u16 vf_id;
+	/* A CMD_SRIOV_STATS_GET timeout leaves its persistent coherent target
+	 * device-owned until a later serialized command completes.
+	 */
+	bool sriov_stats_dma_unresolved;
 	u32 pf_cap_version;
 	unsigned int enable_count;
 	spinlock_t enic_api_lock;
@@ -298,12 +309,9 @@ struct enic {
 
 	/* Admin channel resources for SR-IOV MBOX */
 	bool has_admin_channel;
-	/* true only while the admin WQ/RQ/CQ are allocated and enabled; gates
-	 * enic_admin_channel_close() so it is a no-op after a failed (re)open
-	 * left the resources freed.
-	 */
-	bool admin_chan_up;
-	/* set on send timeout; cleared on channel re-open */
+	/* QUARANTINED retains admin DMA until a final teardown recheck. */
+	enum enic_admin_chan_state admin_chan_state;
+	/* Blocks sends throughout close, partial open and timeout recovery. */
 	bool mbox_send_disabled;
 	struct vnic_wq admin_wq;
 	struct vnic_rq admin_rq;
diff --git a/drivers/net/ethernet/cisco/enic/enic_admin.c b/drivers/net/ethernet/cisco/enic/enic_admin.c
index 61c82b48044d0a..6fa27a755e3f3e 100644
--- a/drivers/net/ethernet/cisco/enic/enic_admin.c
+++ b/drivers/net/ethernet/cisco/enic/enic_admin.c
@@ -5,6 +5,7 @@
 #include <linux/netdevice.h>
 #include <linux/dma-mapping.h>
 #include <linux/interrupt.h>
+#include <linux/iopoll.h>
 
 #include "vnic_dev.h"
 #include "vnic_wq.h"
@@ -15,6 +16,7 @@
 #include "vnic_devcmd.h"
 #include "enic.h"
 #include "enic_admin.h"
+#include "enic_dev.h"
 #include "cq_desc.h"
 #include "cq_enet_desc.h"
 #include "wq_enet_desc.h"
@@ -400,12 +402,23 @@ static void enic_admin_teardown_intr(struct enic *enic)
 
 static int enic_admin_qp_type_set(struct enic *enic, u32 enable)
 {
+	enum vnic_devcmd2_status status;
 	u64 a0 = QP_TYPE_ADMIN, a1 = enable;
 	int wait = 1000;
 	int err;
 
 	spin_lock_bh(&enic->devcmd_lock);
-	err = vnic_dev_cmd(enic->vdev, CMD_QP_TYPE_SET, &a0, &a1, wait);
+	if (vnic_dev_uses_devcmd2(enic->vdev)) {
+		err = vnic_dev_cmd2_status(enic->vdev, CMD_QP_TYPE_SET,
+					   &a0, &a1, wait, &status);
+		/* Ordered completion fences the earlier statistics DMA target,
+		 * including an error result. Admin queues still need RUNNING == 0.
+		 */
+		if (status == VNIC_DEVCMD2_COMPLETED)
+			WRITE_ONCE(enic->sriov_stats_dma_unresolved, false);
+	} else {
+		err = vnic_dev_cmd(enic->vdev, CMD_QP_TYPE_SET, &a0, &a1, wait);
+	}
 	spin_unlock_bh(&enic->devcmd_lock);
 
 	return err;
@@ -530,11 +543,19 @@ static void enic_admin_msg_drain(struct enic *enic)
 
 int enic_admin_channel_open(struct enic *enic)
 {
+	int close_err;
 	int err;
 
 	if (!enic->has_admin_channel)
 		return -ENODEV;
-
+	if (READ_ONCE(enic->admin_chan_state) != ENIC_ADMIN_CHAN_DOWN) {
+		netdev_err(enic->netdev,
+			   "Refusing to open non-down admin channel (%u)\n",
+			   READ_ONCE(enic->admin_chan_state));
+		return -EBUSY;
+	}
+	if (READ_ONCE(enic->sriov_stats_dma_unresolved))
+		return -EBUSY;
 	/* Keep MBOX sends disabled for the entire open sequence.  It is
 	 * cleared only after every resource is allocated and enabled below,
 	 * so any early error return here leaves sends disabled and a
@@ -567,6 +588,7 @@ int enic_admin_channel_open(struct enic *enic)
 
 	vnic_wq_enable(&enic->admin_wq);
 	vnic_rq_enable(&enic->admin_rq);
+	WRITE_ONCE(enic->admin_chan_state, ENIC_ADMIN_CHAN_LIVE);
 
 	err = enic_admin_rq_fill(enic, GFP_KERNEL);
 	if (err) {
@@ -582,15 +604,40 @@ int enic_admin_channel_open(struct enic *enic)
 		goto disable_queues;
 	}
 
-	vnic_intr_unmask(&enic->admin_intr);
+	if (enic_is_sriov_vf_v2(enic) &&
+	    READ_ONCE(enic->vf_id) == ENIC_MBOX_DST_PF) {
+		struct vnic_sriov_stats *stats;
+		u32 version;
+		u16 vf_id;
+
+		/* Keep received notifications queued until their ACK can use
+		 * the VF source ID. The statistics query needs QP_ENABLE first.
+		 */
+		err = enic_dev_sriov_stats(enic, &stats);
+		if (err) {
+			netdev_err(enic->netdev,
+				   "Failed to get SR-IOV statistics: %d\n", err);
+			goto disable_queues;
+		}
+		version = le32_to_cpu(stats->ver);
+		vf_id = le16_to_cpu(stats->vf_index);
+		if (version != VNIC_SRIOV_STATS_VERSION ||
+		    vf_id == ENIC_MBOX_DST_PF) {
+			netdev_err(enic->netdev,
+				   "Invalid SR-IOV statistics version %u VF index %#x\n",
+				   version, vf_id);
+			err = -EINVAL;
+			goto disable_queues;
+		}
+		WRITE_ONCE(enic->vf_id, vf_id);
+	}
 
 	/* Only now that the admin WQ/RQ/CQ and interrupt are fully allocated,
-	 * programmed and enabled is it safe to allow MBOX sends.  Clearing this
-	 * earlier opened a window where a concurrent sender (e.g. link-notify
-	 * work scheduled by a post-reset link-up) could call enic_mbox_send_msg()
-	 * against a not-yet-allocated admin_wq and crash.
+	 * programmed and enabled is it safe to allow MBOX sends. Publish send
+	 * readiness before unmasking so queued notifications can be acknowledged.
 	 */
 	WRITE_ONCE(enic->mbox_send_disabled, false);
+	vnic_intr_unmask(&enic->admin_intr);
 
 	netdev_dbg(enic->netdev,
 		   "admin channel open: intr=%u wq_avail=%u rq_avail=%u cq0_color=%u cq1_color=%u\n",
@@ -600,60 +647,51 @@ int enic_admin_channel_open(struct enic *enic)
 		   enic->admin_cq[0].last_color,
 		   enic->admin_cq[1].last_color);
 
-	enic->admin_chan_up = true;
-
 	return 0;
 
 disable_queues:
-	enic_admin_teardown_intr(enic);
-	enic_admin_qp_type_set(enic, QP_DISABLE);
-	if (vnic_wq_disable(&enic->admin_wq))
-		netdev_warn(enic->netdev, "Failed to disable admin WQ\n");
-	if (vnic_rq_disable(&enic->admin_rq))
-		netdev_warn(enic->netdev, "Failed to disable admin RQ\n");
-	cancel_work_sync(&enic->admin_msg_work);
-	enic_admin_msg_drain(enic);
-	enic_admin_rq_drain(enic);
+	close_err = enic_admin_channel_close(enic);
+	if (close_err)
+		netdev_err(enic->netdev,
+			   "Failed to close partial admin channel: %d\n",
+			   close_err);
+	return err;
 free_resources:
 	enic_admin_free_resources(enic);
 	return err;
 }
 
-void enic_admin_channel_close(struct enic *enic)
+static int enic_admin_wq_disable(struct enic *enic)
 {
-	int err;
-
-	if (!enic->has_admin_channel)
-		return;
+	struct vnic_wq *wq = &enic->admin_wq;
+	u32 running;
 
-	/* Nothing to tear down if the channel was never (re)opened, e.g. a
-	 * failed enic_admin_channel_open() in probe or in the reset path;
-	 * otherwise the disable/clean calls below dereference freed resources.
-	 */
-	if (!enic->admin_chan_up)
-		return;
-
-	WRITE_ONCE(enic->mbox_send_disabled, true);
-
-	netdev_dbg(enic->netdev, "admin channel close\n");
+	iowrite32(0, &wq->ctrl->enable);
+	return read_poll_timeout(ioread32, running, !running, 10, 500000,
+				 false, &wq->ctrl->running);
+}
 
-	vnic_intr_mask(&enic->admin_intr);
-	enic_admin_teardown_intr(enic);
-	cancel_work_sync(&enic->link_notify_work);
-	cancel_work_sync(&enic->admin_msg_work);
-	enic_admin_msg_drain(enic);
+static int enic_admin_rq_disable(struct enic *enic)
+{
+	struct vnic_rq *rq = &enic->admin_rq;
+	u32 running;
+	int err;
+	int i;
 
-	enic_admin_qp_type_set(enic, QP_DISABLE);
+	/* Preserve the two disable/check passes used for the RQ mini-cache. */
+	for (i = 0; i < 2; i++) {
+		iowrite32(0, &rq->ctrl->enable);
+		err = read_poll_timeout(ioread32, running, !running, 10, 500000,
+					false, &rq->ctrl->running);
+		if (err)
+			return err;
+	}
 
-	err = vnic_wq_disable(&enic->admin_wq);
-	if (err)
-		netdev_warn(enic->netdev,
-			    "Failed to disable admin WQ: %d\n", err);
-	err = vnic_rq_disable(&enic->admin_rq);
-	if (err)
-		netdev_warn(enic->netdev,
-			    "Failed to disable admin RQ: %d\n", err);
+	return 0;
+}
 
+static void enic_admin_channel_release(struct enic *enic)
+{
 	vnic_wq_clean(&enic->admin_wq, enic_admin_wq_buf_clean);
 	enic_admin_rq_drain(enic);
 	vnic_cq_clean(&enic->admin_cq[0]);
@@ -662,6 +700,111 @@ void enic_admin_channel_close(struct enic *enic)
 
 	enic->admin_rq_handler = NULL;
 	enic_admin_free_resources(enic);
+	WRITE_ONCE(enic->admin_chan_state, ENIC_ADMIN_CHAN_DOWN);
+}
+
+int enic_admin_channel_close(struct enic *enic)
+{
+	int qp_err;
+	int rq_err;
+	int wq_err;
+
+	if (!enic->has_admin_channel)
+		return 0;
+	if (READ_ONCE(enic->admin_chan_state) == ENIC_ADMIN_CHAN_DOWN)
+		return 0;
+	if (READ_ONCE(enic->admin_chan_state) == ENIC_ADMIN_CHAN_QUARANTINED)
+		return -EBUSY;
+
+	WRITE_ONCE(enic->mbox_send_disabled, true);
+
+	if (READ_ONCE(enic->admin_chan_state) == ENIC_ADMIN_CHAN_LIVE) {
+		netdev_dbg(enic->netdev, "admin channel quiesce\n");
+
+		vnic_intr_mask(&enic->admin_intr);
+		enic_admin_teardown_intr(enic);
+		cancel_work_sync(&enic->link_notify_work);
+		cancel_work_sync(&enic->admin_msg_work);
+		enic_admin_msg_drain(enic);
+	}
+
+	/* A sender may have passed the gate before it was raised.  Wait only
+	 * after cancelling workers which can themselves wait for mbox_lock.
+	 */
+	mutex_lock(&enic->mbox_lock);
+	qp_err = enic_admin_qp_type_set(enic, QP_DISABLE);
+	if (qp_err)
+		netdev_warn(enic->netdev,
+			    "Failed to disable admin QP type: %d\n", qp_err);
+
+	wq_err = enic_admin_wq_disable(enic);
+	rq_err = enic_admin_rq_disable(enic);
+
+	/* Run both complete disable helpers once before retrying only a helper
+	 * which timed out.
+	 */
+	if (wq_err == -ETIMEDOUT)
+		wq_err = enic_admin_wq_disable(enic);
+	if (rq_err == -ETIMEDOUT)
+		rq_err = enic_admin_rq_disable(enic);
+
+	if (wq_err)
+		netdev_warn(enic->netdev,
+			    "Failed to disable admin WQ after retry: %d\n",
+			    wq_err);
+	if (rq_err)
+		netdev_warn(enic->netdev,
+			    "Failed to disable admin RQ after retry: %d\n",
+			    rq_err);
+
+	/* QP_DISABLE does not report every low-level stop failure.  The direct
+	 * WQ/RQ RUNNING observations own the admin allocation graph.
+	 */
+	if (wq_err || rq_err) {
+		WRITE_ONCE(enic->admin_chan_state, ENIC_ADMIN_CHAN_QUARANTINED);
+		mutex_unlock(&enic->mbox_lock);
+		/* Retained targets remain valid for late DMA. Keep bus mastering
+		 * enabled for the independent datapath and command transport.
+		 */
+		return wq_err ?: rq_err;
+	}
+
+	enic_admin_channel_release(enic);
+	mutex_unlock(&enic->mbox_lock);
+
+	/* Firmware rejection does not undermine the WQ/RQ proof. */
+	return qp_err;
+}
+
+int enic_admin_channel_final_recheck(struct enic *enic)
+{
+	int rq_err;
+	int wq_err;
 
-	enic->admin_chan_up = false;
+	if (READ_ONCE(enic->admin_chan_state) != ENIC_ADMIN_CHAN_QUARANTINED)
+		return 0;
+
+	/* Channel close already detached every CPU entry point and attempted
+	 * QP_DISABLE. This is the final direct check of queue ownership.
+	 */
+	mutex_lock(&enic->mbox_lock);
+	wq_err = enic_admin_wq_disable(enic);
+	rq_err = enic_admin_rq_disable(enic);
+	if (wq_err || rq_err) {
+		mutex_unlock(&enic->mbox_lock);
+		return wq_err ?: rq_err;
+	}
+
+	enic_admin_channel_release(enic);
+	mutex_unlock(&enic->mbox_lock);
+	netdev_info(enic->netdev,
+		    "Admin queues stopped during final teardown; releasing DMA graph\n");
+
+	return 0;
+}
+
+bool enic_admin_channel_is_quarantined(const struct enic *enic)
+{
+	return READ_ONCE(enic->admin_chan_state) ==
+		ENIC_ADMIN_CHAN_QUARANTINED;
 }
diff --git a/drivers/net/ethernet/cisco/enic/enic_admin.h b/drivers/net/ethernet/cisco/enic/enic_admin.h
index 62c80220b0cacc..1fe747c3dd3506 100644
--- a/drivers/net/ethernet/cisco/enic/enic_admin.h
+++ b/drivers/net/ethernet/cisco/enic/enic_admin.h
@@ -20,7 +20,9 @@ struct enic_admin_msg {
 };
 
 int enic_admin_channel_open(struct enic *enic);
-void enic_admin_channel_close(struct enic *enic);
+int enic_admin_channel_close(struct enic *enic);
+int enic_admin_channel_final_recheck(struct enic *enic);
+bool enic_admin_channel_is_quarantined(const struct enic *enic);
 unsigned int enic_admin_wq_cq_service(struct enic *enic);
 unsigned int enic_admin_rq_cq_service(struct enic *enic);
 
diff --git a/drivers/net/ethernet/cisco/enic/enic_dev.c b/drivers/net/ethernet/cisco/enic/enic_dev.c
index 659787f73cf180..7d5298e6df0274 100644
--- a/drivers/net/ethernet/cisco/enic/enic_dev.c
+++ b/drivers/net/ethernet/cisco/enic/enic_dev.c
@@ -171,6 +171,50 @@ int enic_dev_intr_coal_timer_info(struct enic *enic)
 	return err;
 }
 
+int enic_dev_close(struct enic *enic)
+{
+	enum vnic_devcmd2_status status;
+	u64 a0 = 0, a1 = 0;
+	int err;
+
+	spin_lock_bh(&enic->devcmd_lock);
+	if (vnic_dev_uses_devcmd2(enic->vdev)) {
+		err = vnic_dev_cmd2_status(enic->vdev, CMD_CLOSE,
+					   &a0, &a1, 1000, &status);
+		/* A close result also fences earlier statistics DMA, including
+		 * an error result. Admin queues still need RUNNING == 0.
+		 */
+		if (status == VNIC_DEVCMD2_COMPLETED)
+			WRITE_ONCE(enic->sriov_stats_dma_unresolved, false);
+	} else {
+		err = vnic_dev_close(enic->vdev);
+	}
+	spin_unlock_bh(&enic->devcmd_lock);
+
+	return err;
+}
+
+int enic_dev_sriov_stats(struct enic *enic,
+			 struct vnic_sriov_stats **stats)
+{
+	enum vnic_devcmd2_status status;
+	int err;
+
+	*stats = NULL;
+	spin_lock_bh(&enic->devcmd_lock);
+	if (READ_ONCE(enic->sriov_stats_dma_unresolved)) {
+		err = -EBUSY;
+		goto unlock;
+	}
+	err = vnic_dev_sriov_stats(enic->vdev, stats, &status);
+	if (status == VNIC_DEVCMD2_POSTED)
+		WRITE_ONCE(enic->sriov_stats_dma_unresolved, true);
+unlock:
+	spin_unlock_bh(&enic->devcmd_lock);
+
+	return err;
+}
+
 /* rtnl lock is held */
 int enic_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
 {
diff --git a/drivers/net/ethernet/cisco/enic/enic_dev.h b/drivers/net/ethernet/cisco/enic/enic_dev.h
index 698d0cb020644d..eed1674ff30fbc 100644
--- a/drivers/net/ethernet/cisco/enic/enic_dev.h
+++ b/drivers/net/ethernet/cisco/enic/enic_dev.h
@@ -40,6 +40,9 @@ int enic_dev_set_ig_vlan_rewrite_mode(struct enic *enic);
 int enic_dev_enable(struct enic *enic);
 int enic_dev_disable(struct enic *enic);
 int enic_dev_intr_coal_timer_info(struct enic *enic);
+int enic_dev_close(struct enic *enic);
+int enic_dev_sriov_stats(struct enic *enic,
+			 struct vnic_sriov_stats **stats);
 int enic_dev_status_to_errno(int devcmd_status);
 
 #endif /* _ENIC_DEV_H_ */
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index 6b5824f45a14cd..3c9937f8856d85 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -1736,6 +1736,13 @@ static int enic_open(struct net_device *netdev)
 		.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV,
 	};
 
+	/* Internal reopen paths also bypass the networking core's presence check. */
+	if (!netif_device_present(netdev))
+		return -ENODEV;
+	if (enic_is_sriov_vf_v2(enic) &&
+	    enic_admin_channel_is_quarantined(enic))
+		return -EBUSY;
+
 	err = enic_request_intr(enic);
 	if (err) {
 		netdev_err(netdev, "Unable to request irq.\n");
@@ -2196,6 +2203,12 @@ static bool enic_has_admin_chan(struct enic *enic)
 	       (enic_sriov_enabled(enic) && enic->vf_type == ENIC_VF_TYPE_V2);
 }
 
+static bool enic_control_dma_unresolved(struct enic *enic)
+{
+	return enic_admin_channel_is_quarantined(enic) ||
+	       READ_ONCE(enic->sriov_stats_dma_unresolved);
+}
+
 /* Re-establish the admin/MBOX channel after a reset has re-created the data
  * path.  Mirrors the relevant part of the probe / SR-IOV-enable sequence:
  * reinitialise MBOX and reopen the channel, then for a VF re-run the PF
@@ -2206,6 +2219,9 @@ static void enic_admin_chan_reopen(struct enic *enic)
 {
 	int err;
 
+	if (enic_admin_channel_is_quarantined(enic))
+		return;
+
 	/* Install the MBOX receive handler and clear pending reply state before
 	 * opening the channel, so the handler is in place before the admin
 	 * interrupt is unmasked and no early completion is dropped.  Keep the
@@ -2237,6 +2253,7 @@ static void enic_admin_chan_reopen(struct enic *enic)
 				   "MBOX capability check after reset failed: %d\n",
 				   err);
 			enic_admin_channel_close(enic);
+			WRITE_ONCE(enic->vf_registered, false);
 			return;
 		}
 		err = enic_mbox_vf_register(enic);
@@ -2245,6 +2262,7 @@ static void enic_admin_chan_reopen(struct enic *enic)
 				   "MBOX VF re-registration after reset failed: %d\n",
 				   err);
 			enic_admin_channel_close(enic);
+			WRITE_ONCE(enic->vf_registered, false);
 		}
 	} else {
 		/* The link came back up during enic_open() above while MBOX
@@ -2264,6 +2282,9 @@ static void enic_reset(struct work_struct *work)
 
 	rtnl_lock();
 
+	if (!netif_running(enic->netdev))
+		goto unlock;
+
 	/* Stop any activity from infiniband */
 	enic_set_api_busy(enic, true);
 
@@ -2273,8 +2294,17 @@ static void enic_reset(struct work_struct *work)
 	 * DMAs from the about-to-be-reset rings) and frees the admin resources
 	 * so they are cleanly re-allocated afterwards.
 	 */
-	if (enic_has_admin_chan(enic))
+	if (enic_has_admin_chan(enic)) {
 		enic_admin_channel_close(enic);
+		/* Channel close has drained registration replies. */
+		if (enic_is_sriov_vf_v2(enic))
+			WRITE_ONCE(enic->vf_registered, false);
+	}
+	if (enic_admin_channel_is_quarantined(enic)) {
+		/* Core close excludes netpoll and clears __LINK_STATE_START first. */
+		dev_close(enic->netdev);
+		goto reset_out;
+	}
 
 	enic_stop(enic->netdev);
 	if (enic_is_sriov_vf_v2(enic))
@@ -2287,7 +2317,8 @@ static void enic_reset(struct work_struct *work)
 	enic_dev_set_ig_vlan_rewrite_mode(enic);
 	enic_ext_cq(enic);
 
-	enic_open(enic->netdev);
+	if (enic_open(enic->netdev))
+		goto reset_out;
 
 	/* Re-establish the admin/MBOX channel after the data path is back up.
 	 * It was fully torn down by enic_admin_channel_close() above;
@@ -2296,12 +2327,17 @@ static void enic_reset(struct work_struct *work)
 	 */
 	if (enic_has_admin_chan(enic))
 		enic_admin_chan_reopen(enic);
+	if (enic_is_sriov_vf_v2(enic) &&
+	    enic_admin_channel_is_quarantined(enic))
+		dev_close(enic->netdev);
 
+reset_out:
 	/* Allow infiniband to fiddle with the device again */
 	enic_set_api_busy(enic, false);
 
 	call_netdevice_notifiers(NETDEV_REBOOT, enic->netdev);
 
+unlock:
 	rtnl_unlock();
 }
 
@@ -2311,6 +2347,9 @@ static void enic_tx_hang_reset(struct work_struct *work)
 
 	rtnl_lock();
 
+	if (!netif_running(enic->netdev))
+		goto unlock;
+
 	/* Stop any activity from infiniband */
 	enic_set_api_busy(enic, true);
 
@@ -2318,8 +2357,16 @@ static void enic_tx_hang_reset(struct work_struct *work)
 	 * the same reason as the soft reset path: stop the admin QP and free
 	 * the admin resources before the hardware queues are wiped.
 	 */
-	if (enic_has_admin_chan(enic))
+	if (enic_has_admin_chan(enic)) {
 		enic_admin_channel_close(enic);
+		/* Channel close has drained registration replies. */
+		if (enic_is_sriov_vf_v2(enic))
+			WRITE_ONCE(enic->vf_registered, false);
+	}
+	if (enic_admin_channel_is_quarantined(enic)) {
+		dev_close(enic->netdev);
+		goto reset_out;
+	}
 
 	enic_dev_hang_notify(enic);
 	enic_stop(enic->netdev);
@@ -2333,7 +2380,8 @@ static void enic_tx_hang_reset(struct work_struct *work)
 	enic_dev_set_ig_vlan_rewrite_mode(enic);
 	enic_ext_cq(enic);
 
-	enic_open(enic->netdev);
+	if (enic_open(enic->netdev))
+		goto reset_out;
 
 	/* Re-establish the admin/MBOX channel after the data path is back up.
 	 * It was fully torn down by enic_admin_channel_close() above;
@@ -2342,12 +2390,17 @@ static void enic_tx_hang_reset(struct work_struct *work)
 	 */
 	if (enic_has_admin_chan(enic))
 		enic_admin_chan_reopen(enic);
+	if (enic_is_sriov_vf_v2(enic) &&
+	    enic_admin_channel_is_quarantined(enic))
+		dev_close(enic->netdev);
 
+reset_out:
 	/* Allow infiniband to fiddle with the device again */
 	enic_set_api_busy(enic, false);
 
 	call_netdevice_notifiers(NETDEV_REBOOT, enic->netdev);
 
+unlock:
 	rtnl_unlock();
 }
 
@@ -2841,6 +2894,12 @@ static void enic_sriov_detect_vf_type(struct enic *enic)
 
 	if (enic->vf_type != ENIC_VF_TYPE_V2)
 		return;
+	if (!vnic_dev_uses_devcmd2(enic->vdev)) {
+		dev_warn(&pdev->dev,
+			 "SR-IOV V2 requires DEVCMD2; disabling V2 support\n");
+		enic->vf_type = ENIC_VF_TYPE_NONE;
+		return;
+	}
 
 	/* A successful command means firmware recognizes
 	 * VIC_FEATURE_SRIOV; supported_versions is available
@@ -3025,6 +3084,7 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	enic = netdev_priv(netdev);
 	enic->netdev = netdev;
 	enic->pdev = pdev;
+	WRITE_ONCE(enic->vf_id, ENIC_MBOX_DST_PF);
 	spin_lock_init(&enic->vf_link_state_lock);
 
 	/* Setup PCI resources
@@ -3036,7 +3096,8 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		goto err_out_free_netdev;
 	}
 
-	err = pci_request_regions(pdev, DRV_NAME);
+	/* A terminal admin allocation keeps the reservation after module unload. */
+	err = pci_request_regions(pdev, dev_name(dev));
 	if (err) {
 		dev_err(dev, "Cannot request PCI regions, aborting\n");
 		goto err_out_disable_device;
@@ -3091,6 +3152,12 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	if (err)
 		goto err_out_vnic_unregister;
+	if (enic_is_sriov_vf_v2(enic) &&
+	    !vnic_dev_uses_devcmd2(enic->vdev)) {
+		dev_err(dev, "SR-IOV V2 VF requires DEVCMD2\n");
+		err = -EOPNOTSUPP;
+		goto err_out_vnic_unregister;
+	}
 
 #ifdef CONFIG_PCI_IOV
 	enic_sriov_detect_vf_type(enic);
@@ -3219,6 +3286,8 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 				"MBOX VF registration failed: %d\n", err);
 			goto err_out_admin_close;
 		}
+		dev_info(dev, "V2 VF registered, VF index %u\n",
+			 READ_ONCE(enic->vf_id));
 	}
 
 	netif_set_real_num_tx_queues(netdev, enic->wq_count);
@@ -3363,7 +3432,9 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 err_out_dev_deinit:
 	enic_dev_deinit(enic);
 err_out_dev_close:
-	vnic_dev_close(enic->vdev);
+	enic_dev_close(enic);
+	if (enic_admin_channel_is_quarantined(enic))
+		enic_admin_channel_final_recheck(enic);
 err_out_disable_sriov:
 	kfree(enic->pp);
 err_out_disable_sriov_pp:
@@ -3374,6 +3445,17 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	}
 #endif
 err_out_vnic_unregister:
+	if (enic_control_dma_unresolved(enic)) {
+		/* Normal generic cleanup and CMD_CLOSE have already run. Retain
+		 * only the inert admin/control owners and their PCI reservation.
+		 */
+		pci_dev_get(pdev);
+		pci_clear_master(pdev);
+		pci_disable_device(pdev);
+		pci_set_drvdata(pdev, NULL);
+		dev_err(dev, "Control DMA unresolved; retaining resources until reboot\n");
+		return err;
+	}
 	vnic_dev_unregister(enic->vdev);
 err_out_iounmap:
 	enic_iounmap(enic);
@@ -3397,6 +3479,9 @@ static void enic_remove(struct pci_dev *pdev)
 		disable_work_sync(&enic->reset);
 		disable_work_sync(&enic->tx_hang_reset);
 		disable_work_sync(&enic->change_mtu_work);
+		rtnl_lock();
+		netif_device_detach(netdev);
+		rtnl_unlock();
 
 		/* Close the admin channel and unregister from the PF before
 		 * unregister_netdev() to prevent a late PF notification from
@@ -3430,8 +3515,24 @@ static void enic_remove(struct pci_dev *pdev)
 		}
 #endif
 		enic_dev_deinit(enic);
-		vnic_dev_close(enic->vdev);
+		enic_dev_close(enic);
+		if (enic_admin_channel_is_quarantined(enic))
+			enic_admin_channel_final_recheck(enic);
 		kfree(enic->pp);
+		if (enic_control_dma_unresolved(enic)) {
+			/* All generic queues and CPU entry points followed ordinary
+			 * teardown. No admin buffer can return from the network stack.
+			 * Pin the PCI object for the reservation's owner-name pointer;
+			 * this reference does not fence DMA or preserve IOMMU state.
+			 */
+			pci_dev_get(pdev);
+			pci_clear_master(pdev);
+			pci_disable_device(pdev);
+			pci_set_drvdata(pdev, NULL);
+			dev_err(&pdev->dev,
+				"Control DMA unresolved; retaining resources until reboot\n");
+			return;
+		}
 		vnic_dev_unregister(enic->vdev);
 		enic_iounmap(enic);
 		pci_release_regions(pdev);
diff --git a/drivers/net/ethernet/cisco/enic/enic_mbox.c b/drivers/net/ethernet/cisco/enic/enic_mbox.c
index 5c93ca49552ac2..a1f8138d0bbd83 100644
--- a/drivers/net/ethernet/cisco/enic/enic_mbox.c
+++ b/drivers/net/ethernet/cisco/enic/enic_mbox.c
@@ -18,10 +18,17 @@
 #define ENIC_MBOX_POLL_TIMEOUT_US	5000000
 #define ENIC_MBOX_POLL_INTERVAL_US	100
 
-static void enic_mbox_fill_hdr(struct enic_mbox_hdr *hdr, u8 msg_type,
+static void enic_mbox_fill_hdr(struct enic *enic, struct enic_mbox_hdr *hdr,
+			       u8 msg_type,
 			       u16 dst_vnic_id, u16 msg_len, u64 msg_num)
 {
+	u16 src_vnic_id = ENIC_MBOX_DST_PF;
+
+	if (enic_is_sriov_vf_v2(enic))
+		src_vnic_id = READ_ONCE(enic->vf_id);
+
 	memset(hdr, 0, sizeof(*hdr));
+	hdr->src_vnic_id = cpu_to_le16(src_vnic_id);
 	hdr->dst_vnic_id = cpu_to_le16(dst_vnic_id);
 	hdr->msg_type = msg_type;
 	hdr->msg_len = cpu_to_le16(msg_len);
@@ -85,7 +92,8 @@ static int enic_mbox_send_msg_id(struct enic *enic, u8 msg_type,
 		reply_expected = true;
 	}
 
-	enic_mbox_fill_hdr(buf, msg_type, dst_vnic_id, total_len, msg_num);
+	enic_mbox_fill_hdr(enic, buf, msg_type, dst_vnic_id, total_len,
+			   msg_num);
 	if (payload_len) {
 		void *dst = buf + sizeof(struct enic_mbox_hdr);
 
diff --git a/drivers/net/ethernet/cisco/enic/vnic_dev.c b/drivers/net/ethernet/cisco/enic/vnic_dev.c
index c8d657e97094ed..92eec1455ceb8b 100644
--- a/drivers/net/ethernet/cisco/enic/vnic_dev.c
+++ b/drivers/net/ethernet/cisco/enic/vnic_dev.c
@@ -287,8 +287,9 @@ static int _vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
 	return -ETIMEDOUT;
 }
 
-static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
-			  int wait)
+static int _vnic_dev_cmd2_status(struct vnic_dev *vdev,
+				 enum vnic_devcmd_cmd cmd, int wait,
+				 enum vnic_devcmd2_status *status)
 {
 	struct devcmd2_controller *dc2c = vdev->devcmd2;
 	struct devcmd2_result *result;
@@ -298,6 +299,9 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
 	u32 fetch_index, new_posted;
 	u32 posted = dc2c->posted;
 
+	if (status)
+		*status = VNIC_DEVCMD2_NOT_POSTED;
+
 	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
 
 	if (fetch_index == 0xFFFFFFFF)
@@ -326,6 +330,8 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
 	wmb();
 	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
 	dc2c->posted = new_posted;
+	if (status)
+		*status = VNIC_DEVCMD2_POSTED;
 
 	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
 		return 0;
@@ -340,7 +346,10 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
 	}
 
 	for (delay = 0; delay < wait; delay++) {
-		if (result->color == color) {
+		if (READ_ONCE(result->color) == color) {
+			dma_rmb();
+			if (status)
+				*status = VNIC_DEVCMD2_COMPLETED;
 			if (result->error) {
 				err = result->error;
 				if (err != ERR_ECMDUNKNOWN ||
@@ -363,6 +372,31 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
 	return -ETIMEDOUT;
 }
 
+static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
+			  int wait)
+{
+	return _vnic_dev_cmd2_status(vdev, cmd, wait, NULL);
+}
+
+int vnic_dev_cmd2_status(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
+			 u64 *a0, u64 *a1, int wait,
+			 enum vnic_devcmd2_status *status)
+{
+	int err;
+
+	*status = VNIC_DEVCMD2_NOT_POSTED;
+	if (!vdev->devcmd2 || vdev->proxy != PROXY_NONE)
+		return -EOPNOTSUPP;
+
+	memset(vdev->args, 0, sizeof(vdev->args));
+	vdev->args[0] = *a0;
+	vdev->args[1] = *a1;
+	err = _vnic_dev_cmd2_status(vdev, cmd, wait, status);
+	*a0 = vdev->args[0];
+	*a1 = vdev->args[1];
+	return err;
+}
+
 static int vnic_dev_init_devcmd1(struct vnic_dev *vdev)
 {
 	vdev->devcmd = vnic_dev_get_res(vdev, RES_TYPE_DEVCMD, 0);
@@ -1046,6 +1080,11 @@ void vnic_dev_unregister(struct vnic_dev *vdev)
 			dma_free_coherent(&vdev->pdev->dev,
 					  sizeof(struct vnic_stats),
 					  vdev->stats, vdev->stats_pa);
+		if (vdev->sriov_stats)
+			dma_free_coherent(&vdev->pdev->dev,
+					  sizeof(struct vnic_sriov_stats),
+					  vdev->sriov_stats,
+					  vdev->sriov_stats_pa);
 		if (vdev->fw_info)
 			dma_free_coherent(&vdev->pdev->dev,
 					  sizeof(struct vnic_devcmd_fw_info),
@@ -1088,6 +1127,11 @@ struct pci_dev *vnic_dev_get_pdev(struct vnic_dev *vdev)
 }
 EXPORT_SYMBOL(vnic_dev_get_pdev);
 
+bool vnic_dev_uses_devcmd2(struct vnic_dev *vdev)
+{
+	return vdev->devcmd2;
+}
+
 int vnic_devcmd_init(struct vnic_dev *vdev)
 {
 	void __iomem *res;
@@ -1295,3 +1339,38 @@ int vnic_dev_capable_rss_hash_type(struct vnic_dev *vdev, u8 *rss_hash_type)
 
 	return 0;
 }
+
+int vnic_dev_sriov_stats(struct vnic_dev *vdev,
+			 struct vnic_sriov_stats **stats,
+			 enum vnic_devcmd2_status *status)
+{
+	u64 a0, a1;
+	int err;
+
+	*stats = NULL;
+	*status = VNIC_DEVCMD2_NOT_POSTED;
+	if (!vdev->sriov_stats) {
+		vdev->sriov_stats =
+			dma_alloc_coherent(&vdev->pdev->dev,
+					   sizeof(*vdev->sriov_stats),
+					   &vdev->sriov_stats_pa,
+					   GFP_ATOMIC);
+		if (!vdev->sriov_stats)
+			return -ENOMEM;
+	}
+
+	memset(vdev->sriov_stats, 0, sizeof(*vdev->sriov_stats));
+	a0 = vdev->sriov_stats_pa;
+	a1 = sizeof(*vdev->sriov_stats);
+	err = vnic_dev_cmd2_status(vdev, CMD_SRIOV_STATS_GET, &a0, &a1,
+				   1000, status);
+	if (!err) {
+		/* Order CPU reads from the coherent target after command
+		 * completion.
+		 */
+		dma_rmb();
+		*stats = vdev->sriov_stats;
+	}
+
+	return err;
+}
diff --git a/drivers/net/ethernet/cisco/enic/vnic_dev.h b/drivers/net/ethernet/cisco/enic/vnic_dev.h
index 7fdd8c661c99dc..6a4d7ce3b63657 100644
--- a/drivers/net/ethernet/cisco/enic/vnic_dev.h
+++ b/drivers/net/ethernet/cisco/enic/vnic_dev.h
@@ -93,6 +93,8 @@ struct vnic_dev {
 	dma_addr_t linkstatus_pa;
 	struct vnic_stats *stats;
 	dma_addr_t stats_pa;
+	struct vnic_sriov_stats *sriov_stats;
+	dma_addr_t sriov_stats_pa;
 	struct vnic_devcmd_fw_info *fw_info;
 	dma_addr_t fw_info_pa;
 	enum vnic_proxy_type proxy;
@@ -106,6 +108,12 @@ struct vnic_dev {
 
 struct vnic_stats;
 
+enum vnic_devcmd2_status {
+	VNIC_DEVCMD2_NOT_POSTED,
+	VNIC_DEVCMD2_POSTED,
+	VNIC_DEVCMD2_COMPLETED,
+};
+
 void *vnic_dev_priv(struct vnic_dev *vdev);
 unsigned int vnic_dev_get_res_count(struct vnic_dev *vdev,
 	enum vnic_res_type type);
@@ -118,6 +126,9 @@ void vnic_dev_free_desc_ring(struct vnic_dev *vdev,
 	struct vnic_dev_ring *ring);
 int vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
 	u64 *a0, u64 *a1, int wait);
+int vnic_dev_cmd2_status(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
+			 u64 *a0, u64 *a1, int wait,
+			 enum vnic_devcmd2_status *status);
 void vnic_dev_cmd_proxy_by_index_start(struct vnic_dev *vdev, u16 index);
 void vnic_dev_cmd_proxy_end(struct vnic_dev *vdev);
 int vnic_dev_fw_info(struct vnic_dev *vdev,
@@ -163,6 +174,7 @@ struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev,
 	void *priv, struct pci_dev *pdev, struct vnic_dev_bar *bar,
 	unsigned int num_bars);
 struct pci_dev *vnic_dev_get_pdev(struct vnic_dev *vdev);
+bool vnic_dev_uses_devcmd2(struct vnic_dev *vdev);
 int vnic_dev_init_prov2(struct vnic_dev *vdev, u8 *buf, u32 len);
 int vnic_dev_enable2(struct vnic_dev *vdev, int active);
 int vnic_dev_enable2_done(struct vnic_dev *vdev, int *status);
@@ -177,5 +189,8 @@ int vnic_dev_overlay_offload_cfg(struct vnic_dev *vdev, u8 overlay,
 int vnic_dev_get_supported_feature_ver(struct vnic_dev *vdev, u8 feature,
 				       u64 *supported_versions, u64 *a1);
 int vnic_dev_capable_rss_hash_type(struct vnic_dev *vdev, u8 *rss_hash_type);
+int vnic_dev_sriov_stats(struct vnic_dev *vdev,
+			 struct vnic_sriov_stats **stats,
+			 enum vnic_devcmd2_status *status);
 
 #endif /* _VNIC_DEV_H_ */
diff --git a/drivers/net/ethernet/cisco/enic/vnic_devcmd.h b/drivers/net/ethernet/cisco/enic/vnic_devcmd.h
index 90ca06691ebd63..9f397df88c50bb 100644
--- a/drivers/net/ethernet/cisco/enic/vnic_devcmd.h
+++ b/drivers/net/ethernet/cisco/enic/vnic_devcmd.h
@@ -461,6 +461,14 @@ enum vnic_devcmd_cmd {
 	 * in: (u32) a1 = enable (1) / disable (0)
 	 */
 	CMD_QP_TYPE_SET = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 97),
+
+	/*
+	 * Get SR-IOV capabilities, resource usage, and this function's logical
+	 * VF index.
+	 * in: (u64) a0 = DMA address of struct vnic_sriov_stats
+	 * in: (u32) a1 = length of the buffer
+	 */
+	CMD_SRIOV_STATS_GET = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 98),
 };
 
 #define QP_TYPE_ADMIN	0
@@ -468,6 +476,32 @@ enum vnic_devcmd_cmd {
 #define QP_ENABLE	1
 #define QP_DISABLE	0
 
+#define VNIC_SRIOV_STATS_VERSION	1
+
+struct vnic_sriov_stats {
+	__le32 ver;
+	u8 sriov_vlan_membership_cap;
+	u8 sriov_vlan_membership_enabled;
+	u8 sriov_rss_vf_full_cap;
+	u8 sriov_host_rx_stats;
+	__le32 ig_classifier0_tcam_cfg;
+	__le32 ig_classifier0_tcam_free;
+	__le32 eg_classifier0_tcam_cfg;
+	__le32 eg_classifier0_tcam_free;
+	__le32 ig_classifier1_tcam_cfg;
+	__le32 ig_classifier1_tcam_free;
+	__le32 eg_classifier1_tcam_cfg;
+	__le32 eg_classifier1_tcam_free;
+	__le32 sriov_ig_flow_table_cfg;
+	__le32 sriov_ig_flow_table_free;
+	__le32 sriov_eg_flow_table_cfg;
+	__le32 sriov_eg_flow_table_free;
+	u8 admin_qp_ready[32];
+	__le16 vf_index;
+	__le16 reserved1;
+	__le32 reserved2[256 - 23];
+};
+
 /* CMD_ENABLE2 flags */
 #define CMD_ENABLE2_STANDBY 0x0
 #define CMD_ENABLE2_ACTIVE  0x1

3/2 2026/11/05 05:16 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 17207
							output: 34
							thoughts: 383
						

Thoughts:
**Evaluating the Patch Series for Syzkaller Fuzzing Suitability**

Okay, so the task at hand is to determine if this patch series is a good candidate for Syzkaller fuzzing. Let's break this down systematically. First, the guidelines emphasize reachability. The core philosophy is that fuzzing is only effective if the modified code can *actually execute* in a standard virtualized environment like GCE or QEMU, using emulated devices. The primary gate is reachability. If it's structurally unreachable, we stop immediately.

The negative criteria are clear: if the code relies on hardware not emulated in the standard environment, it's a no-go. Specifically, vendor-specific PCIe switches, SmartNICs, or GPU drivers that need physical hardware are out. Examples like `mlxsw`, `pds_core`, `qed`, `ionic`, and `amdgpu` come to mind – those are clear red flags.

Now, let's look at the drivers in question: `drivers/net/ethernet/cisco/enic/...`. This is where it gets interesting. We need to determine if Cisco's VIC (Virtual Interface Card) Ethernet NIC driver, specifically `enic`, is emulated in a standard QEMU setup. That's the crux of the matter. So, does QEMU emulate the Cisco `enic` / `vnic`? That's the key question. We need to ascertain this conclusively. I need to investigate further - perhaps a `grep` through the relevant source code or a careful look at the Kconfig options within `drivers/net/ethernet/cisco/enic/` to determine the emulation status.



4/2 2026/11/05 05:16 tool grepper
0m Args:
{
  "Expression": "config ENIC",
  "PathPrefixes": [
    "drivers/net/ethernet/cisco/"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/cisco/enic/Kconfig-5-\ndrivers/net/ethernet/cisco/enic/Kconfig:6:config ENIC\ndrivers/net/ethernet/cisco/enic/Kconfig-7-\ttristate \"Cisco VIC Ethernet NIC Support\"\n"
}

5/2 2026/11/05 05:16 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 18058
							output: 40
							thoughts: 20
						

Thoughts:
Here's a summary of my thought process, as requested:

**Diving into the ENIC Kconfig**

Okay, time to get my hands dirty. I need to understand the configuration options for the Cisco ENIC driver. My immediate thought is to head straight for `drivers/net/ethernet/cisco/enic/Kconfig`. That's where I expect to find the meat of the configuration logic – the conditional compilation flags, dependencies, and help text that determine how the ENIC driver behaves and what features are exposed during the kernel build process. I'm especially interested in things like:

*   Does it offer multiple ENIC versions or different feature levels?
*   What other modules or features does it depend on?
*   Are there options for debugging, tracing, or performance tuning?
*   How configurable is the jumbo frame support, and SR-IOV features?

I'll be looking to quickly grasp the key build-time controls so I can later navigate the code effectively and modify build configuration without difficulty.



6/2 2026/11/05 05:16 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/cisco/enic/Kconfig",
  "FirstLine": 1,
  "LineCount": 40
}

Results:
{
  "Contents": "   1:\t# SPDX-License-Identifier: GPL-2.0-only\n   2:\t#\n   3:\t# Cisco device configuration\n   4:\t#\n   5:\t\n   6:\tconfig ENIC\n   7:\t\ttristate \"Cisco VIC Ethernet NIC Support\"\n   8:\t\tdepends on PCI\n   9:\t\tselect PAGE_POOL\n  10:\t\thelp\n  11:\t\t  This enables the support for the Cisco VIC Ethernet card.\n"
}

7/2 2026/11/05 05:16 llm patch-evaluator
1m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 18459
							output: 133
							thoughts: 769
						

Thoughts:
**Fuzzing Verdict: Structurally Unreachable Hardware**

Okay, let's break this down. My initial question was whether the Cisco VIC (Virtual Interface Card), a proprietary Ethernet adapter found in Cisco UCS servers, is emulated in QEMU. Given my experience, I know QEMU offers a range of network card emulations, like e1000, virtio-net, vmxnet3, etc. But, the crucial piece is that the Cisco VIC (specifically, the `enic` driver) isn't on that list. This raises a red flag immediately.

Looking at the provided instructions, the situation perfectly aligns with the documented "Structurally unreachable hardware" scenario. The instructions specifically mention vendor-specific PCIe hardware like SmartNICs that aren't emulated in QEMU. That's a perfect match.

Let's confirm this by analyzing the patch. It changes several files, all neatly contained within the `drivers/net/ethernet/cisco/enic/` directory. This tells me we are dealing with the Cisco VIC Ethernet NIC driver, specifically designed for Cisco UCS hardware. This driver depends on the physical Cisco UCS VIC hardware (PCI vendor ID 0x1137 / Cisco), which I know is not emulated within QEMU or even environments like Google Compute Engine.

Furthermore, this patch is clearly focused on SR-IOV V2 admin channels, mailbox communication, and hardware commands specific to the Cisco VIC adapters. These are low-level hardware interactions. This seals the deal, confirming it's not fuzzer material.

Therefore, this falls directly under the "structurally unreachable hardware" category defined in the instructions. It can't be fuzzed.

My conclusion is clear: `WorthFuzzing` must be false. The detailed reasoning confirms this. There are no other configuration settings or details that would alter my verdict. The code relies on proprietary hardware that is inaccessible to a fuzzing environment. The patch touches the Cisco VIC driver (`CONFIG_ENIC`), which demands physical PCIe ASICs that are unavailable in virtualized fuzzing setups. The code is structurally unreachable.

Now I will call `set-results`.



8/2 2026/11/05 05:17 tool set-results
0m Args:
{
  "EnableConfigs": [],
  "FocusSymbols": [],
  "Reasoning": "The patch exclusively modifies the Cisco VIC Ethernet NIC driver (drivers/net/ethernet/cisco/enic/), specifically handling SR-IOV V2 admin channel management, devcmd2 status tracking, and device teardown/quarantine logic. Cisco VIC is proprietary PCIe hardware used in Cisco UCS servers and is not emulated in standard QEMU or virtualized environments used by syzkaller. Because the modified code is structurally unreachable without physical Cisco VIC ASIC hardware, it is not worth fuzzing.",
  "WorthFuzzing": false
}

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch exclusively modifies the Cisco VIC Ethernet NIC driver (drivers/net/ethernet/cisco/enic/), specifically handling SR-IOV V2 admin channel management, devcmd2 status tracking, and device teardown/quarantine logic. Cisco VIC is proprietary PCIe hardware used in Cisco UCS servers and is not emulated in standard QEMU or virtualized environments used by syzkaller. Because the modified code is structurally unreachable without physical Cisco VIC ASIC hardware, it is not worth fuzzing.",
  "WorthFuzzing": false
}

9/1 2026/11/05 05:17 action If
0m Args:
{
  "WorthFuzzing": false
}

Results:
null

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)