AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/10/14 00:40 flow patch-triage
2m Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "KMSANReasoning": "",
  "NeedsKMSAN": false,
  "Reasoning": "The patch modifies the Broadcom ThorUltra (bnge) Ethernet driver (drivers/net/ethernet/broadcom/bnge/), specifically ring and NQ handling during netdev open/close/init. This driver supports physical Broadcom ThorUltra 50G-800G PCIe NICs (PCI ID 14e4:1780) which are vendor-specific ASIC hardware not emulated in standard virtualized environments (QEMU/GCE). As such, the code is structurally unreachable during fuzzing.",
  "WorthFuzzing": false
}

1/1 2026/10/14 00:40 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit 366fe6c0be11e88d68c88a71dedc0df911c4b07e\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Wed Oct 14 00:40:13 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/drivers/net/ethernet/broadcom/bnge/bnge.h b/drivers/net/ethernet/broadcom/bnge/bnge.h\nindex 4479ccd071f53..950f40d699165 100644\n--- a/drivers/net/ethernet/broadcom/bnge/bnge.h\n+++ b/drivers/net/ethernet/broadcom/bnge/bnge.h\n@@ -220,6 +220,38 @@ struct bnge_dev {\n \tu32\t\t\tphy_flags;\n };\n \n+/* The netdev has no name until register_netdev(), so log through the PCI\n+ * device before that (e.g. during probe).\n+ */\n+#define bnge_log(level, bd, fmt, ...)\t\t\t\t\t\\\n+\tdo {\t\t\t\t\t\t\t\t\\\n+\t\tstruct bnge_dev *__bd = (bd);\t\t\t\t\\\n+\t\t\t\t\t\t\t\t\t\\\n+\t\tif (__bd-\u003enetdev \u0026\u0026\t\t\t\t\t\\\n+\t\t    READ_ONCE(__bd-\u003enetdev-\u003ereg_state) != NETREG_UNINITIALIZED)\\\n+\t\t\tnetdev_##level(__bd-\u003enetdev, fmt, ##__VA_ARGS__);\\\n+\t\telse\t\t\t\t\t\t\t\\\n+\t\t\tdev_##level(__bd-\u003edev, fmt, ##__VA_ARGS__);\t\\\n+\t} while (0)\n+\n+#define bnge_err(bd, fmt, ...)\tbnge_log(err, bd, fmt, ##__VA_ARGS__)\n+#define bnge_warn(bd, fmt, ...)\tbnge_log(warn, bd, fmt, ##__VA_ARGS__)\n+#define bnge_dbg(bd, fmt, ...)\tbnge_log(dbg, bd, fmt, ##__VA_ARGS__)\n+\n+/* Index of the first NQ created in ndo_open() and destroyed in ndo_stop().\n+ * NQs below it are created at probe and destroyed at remove. Exactly one NQ,\n+ * NQ0 (async events and queue 0), is created at probe.\n+ *\n+ * Layout of bd-\u003eirq_tbl, with A = aux MSI-X count: NQ0 uses irq_tbl[0],\n+ * the aux (RoCE) device irq_tbl[1..A], and the NQs created in open\n+ * irq_tbl[A + 1..]. The ring_idx the aux device receives is its irq_tbl\n+ * index.\n+ */\n+#define BNGE_FIRST_OPEN_NQ\t1\n+\n+#define bnge_for_each_open_nq(i, bd) \\\n+\tfor ((i) = BNGE_FIRST_OPEN_NQ; (i) \u003c (bd)-\u003enq_nr_rings; (i)++)\n+\n static inline bool bnge_is_roce_en(struct bnge_dev *bd)\n {\n \treturn bd-\u003eflags \u0026 BNGE_EN_ROCE;\n@@ -263,4 +295,19 @@ static inline void bnge_db_write(struct bnge_dev *bd, struct bnge_db_info *db,\n bool bnge_aux_registered(struct bnge_dev *bd);\n u16 bnge_aux_get_msix(struct bnge_dev *bd);\n \n+/* irq_tbl index of the i-th aux vector, also used as its ring_idx */\n+static inline int bnge_aux_irq_idx(int i)\n+{\n+\treturn BNGE_FIRST_OPEN_NQ + i;\n+}\n+\n+/* irq_tbl index of NQ nq_idx */\n+static inline int bnge_nq_irq_idx(struct bnge_dev *bd, int nq_idx)\n+{\n+\tif (nq_idx \u003c BNGE_FIRST_OPEN_NQ)\n+\t\treturn nq_idx;\n+\n+\treturn bnge_aux_get_msix(bd) + nq_idx;\n+}\n+\n #endif /* _BNGE_H_ */\ndiff --git a/drivers/net/ethernet/broadcom/bnge/bnge_auxr.c b/drivers/net/ethernet/broadcom/bnge/bnge_auxr.c\nindex 0955b488b6fea..0393bfea7b658 100644\n--- a/drivers/net/ethernet/broadcom/bnge/bnge_auxr.c\n+++ b/drivers/net/ethernet/broadcom/bnge/bnge_auxr.c\n@@ -34,9 +34,9 @@ static void bnge_fill_msix_vecs(struct bnge_dev *bd,\n \t}\n \tnum_msix = auxr_dev-\u003eauxr_info-\u003emsix_requested;\n \tfor (i = 0; i \u003c num_msix; i++) {\n-\t\tinfo[i].vector = bd-\u003eirq_tbl[i].vector;\n+\t\tinfo[i].vector = bd-\u003eirq_tbl[bnge_aux_irq_idx(i)].vector;\n \t\tinfo[i].db_offset = bd-\u003edb_offset;\n-\t\tinfo[i].ring_idx = i;\n+\t\tinfo[i].ring_idx = bnge_aux_irq_idx(i);\n \t}\n }\n \ndiff --git a/drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c b/drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c\nindex 651c5e783516c..fb960bff85fa5 100644\n--- a/drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c\n+++ b/drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c\n@@ -1302,7 +1302,8 @@ int hwrm_ring_free_send_msg(struct bnge_net *bn,\n \tbnge_hwrm_req_drop(bd, req);\n exit:\n \tif (rc) {\n-\t\tnetdev_err(bd-\u003enetdev, \"hwrm_ring_free type %d failed. rc:%d\\n\", ring_type, rc);\n+\t\tbnge_err(bd, \"hwrm_ring_free type %d failed. rc:%d\\n\",\n+\t\t\t ring_type, rc);\n \t\treturn -EIO;\n \t}\n \treturn 0;\n@@ -1395,7 +1396,7 @@ int hwrm_ring_alloc_send_msg(struct bnge_net *bn,\n \t\treq-\u003eint_mode = RING_ALLOC_REQ_INT_MODE_MSIX;\n \t\tbreak;\n \tdefault:\n-\t\tnetdev_err(bn-\u003enetdev, \"hwrm alloc invalid ring type %d\\n\", ring_type);\n+\t\tbnge_err(bd, \"hwrm alloc invalid ring type %d\\n\", ring_type);\n \t\treturn -EINVAL;\n \t}\n \n@@ -1406,7 +1407,8 @@ int hwrm_ring_alloc_send_msg(struct bnge_net *bn,\n \n exit:\n \tif (rc) {\n-\t\tnetdev_err(bd-\u003enetdev, \"hwrm_ring_alloc type %d failed. rc:%d\\n\", ring_type, rc);\n+\t\tbnge_err(bd, \"hwrm_ring_alloc type %d failed. rc:%d\\n\",\n+\t\t\t ring_type, rc);\n \t\treturn -EIO;\n \t}\n \tring-\u003efw_ring_id = ring_id;\ndiff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c\nindex 25f844e6f6d34..c6649a2c5876f 100644\n--- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c\n+++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c\n@@ -503,61 +503,89 @@ static int bnge_alloc_cp_desc_arr(struct bnge_cp_ring_info *cpr, int n)\n \treturn -ENOMEM;\n }\n \n-static void bnge_free_nq_arrays(struct bnge_net *bn)\n+static void bnge_free_nq(struct bnge_net *bn, struct bnge_napi *bnapi)\n {\n-\tstruct bnge_dev *bd = bn-\u003ebd;\n-\tint i;\n+\tstruct bnge_nq_ring_info *nqr = \u0026bnapi-\u003enq_ring;\n \n-\tfor (i = 0; i \u003c bd-\u003enq_nr_rings; i++) {\n-\t\tstruct bnge_napi *bnapi = bn-\u003ebnapi[i];\n+\tbnge_free_ring(bn-\u003ebd, \u0026nqr-\u003ering_struct.ring_mem);\n+\tbnge_free_nq_desc_arr(nqr);\n+}\n+\n+static int bnge_alloc_nq(struct bnge_net *bn, struct bnge_napi *bnapi)\n+{\n+\tstruct bnge_nq_ring_info *nqr = \u0026bnapi-\u003enq_ring;\n+\tstruct bnge_ring_mem_info *rmem;\n+\tstruct bnge_ring_struct *ring;\n+\tint rc;\n+\n+\tring = \u0026nqr-\u003ering_struct;\n+\trmem = \u0026ring-\u003ering_mem;\n+\n+\trc = bnge_alloc_nq_desc_arr(nqr, bn-\u003ecp_nr_pages);\n+\tif (rc)\n+\t\treturn rc;\n \n-\t\tbnge_free_nq_desc_arr(\u0026bnapi-\u003enq_ring);\n+\tnqr-\u003ebnapi = bnapi;\n+\trmem-\u003enr_pages = bn-\u003ecp_nr_pages;\n+\trmem-\u003epage_size = HW_CMPD_RING_SIZE;\n+\trmem-\u003epg_arr = (void **)nqr-\u003edesc_ring;\n+\trmem-\u003edma_arr = nqr-\u003edesc_mapping;\n+\trmem-\u003evmem_size = 0;\n+\trmem-\u003eflags = BNGE_RMEM_RING_PTE_FLAG;\n+\trc = bnge_alloc_ring(bn-\u003ebd, rmem);\n+\tif (rc) {\n+\t\tbnge_free_nq_desc_arr(nqr);\n+\t\treturn rc;\n \t}\n+\n+\tring-\u003efw_ring_id = INVALID_HW_RING_ID_32BIT;\n+\tring-\u003emap_idx = bnge_nq_irq_idx(bn-\u003ebd, bnapi-\u003eindex);\n+\treturn 0;\n }\n \n-static int bnge_alloc_nq_arrays(struct bnge_net *bn)\n+static void bnge_free_nqs(struct bnge_net *bn)\n {\n \tstruct bnge_dev *bd = bn-\u003ebd;\n-\tint i, rc;\n+\tint i;\n \n-\tfor (i = 0; i \u003c bd-\u003enq_nr_rings; i++) {\n-\t\tstruct bnge_napi *bnapi = bn-\u003ebnapi[i];\n+\tbnge_for_each_open_nq(i, bd)\n+\t\tbnge_free_nq(bn, bn-\u003ebnapi[i]);\n+}\n \n-\t\trc = bnge_alloc_nq_desc_arr(\u0026bnapi-\u003enq_ring, bn-\u003ecp_nr_pages);\n+static int bnge_alloc_nqs(struct bnge_net *bn)\n+{\n+\tstruct bnge_dev *bd = bn-\u003ebd;\n+\tint i, rc;\n+\n+\tbnge_for_each_open_nq(i, bd) {\n+\t\trc = bnge_alloc_nq(bn, bn-\u003ebnapi[i]);\n \t\tif (rc)\n-\t\t\tgoto err_free_nq_arrays;\n+\t\t\tgoto err_free_nqs;\n \t}\n \treturn 0;\n \n-err_free_nq_arrays:\n-\tbnge_free_nq_arrays(bn);\n+err_free_nqs:\n+\twhile (--i \u003e= BNGE_FIRST_OPEN_NQ)\n+\t\tbnge_free_nq(bn, bn-\u003ebnapi[i]);\n \treturn rc;\n }\n \n-static void bnge_free_nq_tree(struct bnge_net *bn)\n+static void bnge_free_cp_rings(struct bnge_net *bn)\n {\n \tstruct bnge_dev *bd = bn-\u003ebd;\n \tint i;\n \n \tfor (i = 0; i \u003c bd-\u003enq_nr_rings; i++) {\n-\t\tstruct bnge_napi *bnapi = bn-\u003ebnapi[i];\n-\t\tstruct bnge_nq_ring_info *nqr;\n-\t\tstruct bnge_ring_struct *ring;\n+\t\tstruct bnge_nq_ring_info *nqr = \u0026bn-\u003ebnapi[i]-\u003enq_ring;\n \t\tint j;\n \n-\t\tnqr = \u0026bnapi-\u003enq_ring;\n-\t\tring = \u0026nqr-\u003ering_struct;\n-\n-\t\tbnge_free_ring(bd, \u0026ring-\u003ering_mem);\n-\n \t\tif (!nqr-\u003ecp_ring_arr)\n \t\t\tcontinue;\n \n \t\tfor (j = 0; j \u003c nqr-\u003ecp_ring_count; j++) {\n \t\t\tstruct bnge_cp_ring_info *cpr = \u0026nqr-\u003ecp_ring_arr[j];\n \n-\t\t\tring = \u0026cpr-\u003ering_struct;\n-\t\t\tbnge_free_ring(bd, \u0026ring-\u003ering_mem);\n+\t\t\tbnge_free_ring(bd, \u0026cpr-\u003ering_struct.ring_mem);\n \t\t\tbnge_free_cp_desc_arr(cpr);\n \t\t}\n \t\tkfree(nqr-\u003ecp_ring_arr);\n@@ -594,31 +622,21 @@ static int alloc_one_cp_ring(struct bnge_net *bn,\n \treturn rc;\n }\n \n-static int bnge_alloc_nq_tree(struct bnge_net *bn)\n+static int bnge_alloc_cp_rings(struct bnge_net *bn)\n {\n \tstruct bnge_dev *bd = bn-\u003ebd;\n-\tint i, j, ulp_msix, rc;\n+\tint i, j, rc;\n \tint tcs = 1;\n \n-\tulp_msix = bnge_aux_get_msix(bd);\n \tfor (i = 0, j = 0; i \u003c bd-\u003enq_nr_rings; i++) {\n \t\tbool sh = !!(bd-\u003eflags \u0026 BNGE_EN_SHARED_CHNL);\n \t\tstruct bnge_napi *bnapi = bn-\u003ebnapi[i];\n \t\tstruct bnge_nq_ring_info *nqr;\n \t\tstruct bnge_cp_ring_info *cpr;\n-\t\tstruct bnge_ring_struct *ring;\n \t\tint cp_count = 0, k;\n \t\tint rx = 0, tx = 0;\n \n \t\tnqr = \u0026bnapi-\u003enq_ring;\n-\t\tnqr-\u003ebnapi = bnapi;\n-\t\tring = \u0026nqr-\u003ering_struct;\n-\n-\t\trc = bnge_alloc_ring(bd, \u0026ring-\u003ering_mem);\n-\t\tif (rc)\n-\t\t\tgoto err_free_nq_tree;\n-\n-\t\tring-\u003emap_idx = ulp_msix + i;\n \n \t\tif (i \u003c bd-\u003erx_nr_rings) {\n \t\t\tcp_count++;\n@@ -634,7 +652,7 @@ static int bnge_alloc_nq_tree(struct bnge_net *bn)\n \t\tnqr-\u003ecp_ring_arr = kzalloc_objs(*cpr, cp_count);\n \t\tif (!nqr-\u003ecp_ring_arr) {\n \t\t\trc = -ENOMEM;\n-\t\t\tgoto err_free_nq_tree;\n+\t\t\tgoto err_free_cp_rings;\n \t\t}\n \n \t\tnqr-\u003ecp_ring_count = cp_count;\n@@ -643,7 +661,7 @@ static int bnge_alloc_nq_tree(struct bnge_net *bn)\n \t\t\tcpr = \u0026nqr-\u003ecp_ring_arr[k];\n \t\t\trc = alloc_one_cp_ring(bn, cpr);\n \t\t\tif (rc)\n-\t\t\t\tgoto err_free_nq_tree;\n+\t\t\t\tgoto err_free_cp_rings;\n \n \t\t\tcpr-\u003ebnapi = bnapi;\n \t\t\tcpr-\u003ecp_idx = k;\n@@ -663,8 +681,8 @@ static int bnge_alloc_nq_tree(struct bnge_net *bn)\n \t}\n \treturn 0;\n \n-err_free_nq_tree:\n-\tbnge_free_nq_tree(bn);\n+err_free_cp_rings:\n+\tbnge_free_cp_rings(bn);\n \treturn rc;\n }\n \n@@ -1191,17 +1209,27 @@ static int bnge_init_ring_grps(struct bnge_net *bn)\n \t\tbn-\u003egrp_info[i].agg_fw_ring_id = INVALID_HW_RING_ID;\n \t\tbn-\u003egrp_info[i].nq_fw_ring_id = INVALID_HW_RING_ID;\n \t}\n+\t/* NQ0 stays allocated in FW across open/close */\n+\tbn-\u003egrp_info[0].nq_fw_ring_id =\n+\t\t(u16)bn-\u003enq0-\u003enq_ring.ring_struct.fw_ring_id;\n \n \treturn 0;\n }\n \n+static void bnge_nq0_clear_rings(struct bnge_net *bn)\n+{\n+\tbn-\u003enq0-\u003erx_ring = NULL;\n+\tmemset(bn-\u003enq0-\u003etx_ring, 0, sizeof(bn-\u003enq0-\u003etx_ring));\n+\tbn-\u003enq0-\u003eevents = 0;\n+}\n+\n static void bnge_free_core(struct bnge_net *bn)\n {\n \tbnge_free_vnic_attributes(bn);\n \tbnge_free_tx_rings(bn);\n \tbnge_free_rx_rings(bn);\n-\tbnge_free_nq_tree(bn);\n-\tbnge_free_nq_arrays(bn);\n+\tbnge_free_cp_rings(bn);\n+\tbnge_free_nqs(bn);\n \tbnge_free_ring_stats(bn);\n \tbnge_free_ring_grps(bn);\n \tbnge_free_vnics(bn);\n@@ -1211,6 +1239,7 @@ static void bnge_free_core(struct bnge_net *bn)\n \tbn-\u003etx_ring = NULL;\n \tkfree(bn-\u003erx_ring);\n \tbn-\u003erx_ring = NULL;\n+\tbnge_nq0_clear_rings(bn);\n \tkfree(bn-\u003ebnapi);\n \tbn-\u003ebnapi = NULL;\n }\n@@ -1225,20 +1254,20 @@ static int bnge_alloc_core(struct bnge_net *bn)\n \tarr_size = L1_CACHE_ALIGN(sizeof(struct bnge_napi *) *\n \t\t\tbd-\u003enq_nr_rings);\n \tsize = L1_CACHE_ALIGN(sizeof(struct bnge_napi));\n-\tbnapi = kzalloc(arr_size + size * bd-\u003enq_nr_rings, GFP_KERNEL);\n+\tbnapi = kzalloc(arr_size +\n+\t\t\tsize * (bd-\u003enq_nr_rings - BNGE_FIRST_OPEN_NQ),\n+\t\t\tGFP_KERNEL);\n \tif (!bnapi)\n \t\treturn rc;\n \n \tbn-\u003ebnapi = bnapi;\n \tbnapi += arr_size;\n-\tfor (i = 0; i \u003c bd-\u003enq_nr_rings; i++, bnapi += size) {\n-\t\tstruct bnge_nq_ring_info *nqr;\n-\n+\tbn-\u003ebnapi[0] = bn-\u003enq0;\n+\tbnge_for_each_open_nq(i, bd) {\n \t\tbn-\u003ebnapi[i] = bnapi;\n \t\tbn-\u003ebnapi[i]-\u003eindex = i;\n \t\tbn-\u003ebnapi[i]-\u003ebn = bn;\n-\t\tnqr = \u0026bn-\u003ebnapi[i]-\u003enq_ring;\n-\t\tnqr-\u003ering_struct.ring_mem.flags = BNGE_RMEM_RING_PTE_FLAG;\n+\t\tbnapi += size;\n \t}\n \n \tbn-\u003erx_ring = kzalloc_objs(struct bnge_rx_ring_info, bd-\u003erx_nr_rings);\n@@ -1297,7 +1326,7 @@ static int bnge_alloc_core(struct bnge_net *bn)\n \tif (rc)\n \t\tgoto err_free_ring_stats;\n \n-\trc = bnge_alloc_nq_arrays(bn);\n+\trc = bnge_alloc_nqs(bn);\n \tif (rc)\n \t\tgoto err_free_vnics;\n \n@@ -1305,13 +1334,13 @@ static int bnge_alloc_core(struct bnge_net *bn)\n \n \trc = bnge_alloc_rx_rings(bn);\n \tif (rc)\n-\t\tgoto err_free_nq_arrays;\n+\t\tgoto err_free_nqs;\n \n \trc = bnge_alloc_tx_rings(bn);\n \tif (rc)\n \t\tgoto err_free_rx_rings;\n \n-\trc = bnge_alloc_nq_tree(bn);\n+\trc = bnge_alloc_cp_rings(bn);\n \tif (rc)\n \t\tgoto err_free_tx_rings;\n \n@@ -1320,17 +1349,17 @@ static int bnge_alloc_core(struct bnge_net *bn)\n \t\t\t\t\t\t  BNGE_VNIC_UCAST_FLAG;\n \trc = bnge_alloc_vnic_attributes(bn);\n \tif (rc)\n-\t\tgoto err_free_nq_tree;\n+\t\tgoto err_free_cp_rings;\n \treturn 0;\n \n-err_free_nq_tree:\n-\tbnge_free_nq_tree(bn);\n+err_free_cp_rings:\n+\tbnge_free_cp_rings(bn);\n err_free_tx_rings:\n \tbnge_free_tx_rings(bn);\n err_free_rx_rings:\n \tbnge_free_rx_rings(bn);\n-err_free_nq_arrays:\n-\tbnge_free_nq_arrays(bn);\n+err_free_nqs:\n+\tbnge_free_nqs(bn);\n err_free_vnics:\n \tbnge_free_vnics(bn);\n err_free_ring_stats:\n@@ -1345,6 +1374,7 @@ static int bnge_alloc_core(struct bnge_net *bn)\n \tkfree(bn-\u003erx_ring);\n \tbn-\u003erx_ring = NULL;\n err_free_bnapi:\n+\tbnge_nq0_clear_rings(bn);\n \tkfree(bn-\u003ebnapi);\n \tbn-\u003ebnapi = NULL;\n \treturn rc;\n@@ -1389,21 +1419,18 @@ static int bnge_cp_num_to_irq_num(struct bnge_net *bn, int n)\n \treturn nqr-\u003ering_struct.map_idx;\n }\n \n-static void bnge_init_nq_tree(struct bnge_net *bn)\n+static void bnge_init_cp_rings(struct bnge_net *bn)\n {\n \tstruct bnge_dev *bd = bn-\u003ebd;\n \tint i, j;\n \n \tfor (i = 0; i \u003c bd-\u003enq_nr_rings; i++) {\n \t\tstruct bnge_nq_ring_info *nqr = \u0026bn-\u003ebnapi[i]-\u003enq_ring;\n-\t\tstruct bnge_ring_struct *ring = \u0026nqr-\u003ering_struct;\n \n-\t\tring-\u003efw_ring_id = INVALID_HW_RING_ID_32BIT;\n \t\tfor (j = 0; j \u003c nqr-\u003ecp_ring_count; j++) {\n \t\t\tstruct bnge_cp_ring_info *cpr = \u0026nqr-\u003ecp_ring_arr[j];\n \n-\t\t\tring = \u0026cpr-\u003ering_struct;\n-\t\t\tring-\u003efw_ring_id = INVALID_HW_RING_ID_32BIT;\n+\t\t\tcpr-\u003ering_struct.fw_ring_id = INVALID_HW_RING_ID_32BIT;\n \t\t}\n \t}\n }\n@@ -1914,6 +1941,44 @@ static int bnge_hwrm_rx_ring_alloc(struct bnge_net *bn,\n \treturn 0;\n }\n \n+static int bnge_hwrm_nq_alloc(struct bnge_net *bn, struct bnge_napi *bnapi)\n+{\n+\tstruct bnge_nq_ring_info *nqr = \u0026bnapi-\u003enq_ring;\n+\tu32 type = HWRM_RING_ALLOC_NQ;\n+\tstruct bnge_ring_struct *ring;\n+\tunsigned int vector;\n+\tu32 map_idx;\n+\tint rc;\n+\n+\tring = \u0026nqr-\u003ering_struct;\n+\tmap_idx = ring-\u003emap_idx;\n+\n+\tvector = bn-\u003ebd-\u003eirq_tbl[map_idx].vector;\n+\tdisable_irq_nosync(vector);\n+\trc = hwrm_ring_alloc_send_msg(bn, ring, type, map_idx);\n+\tif (rc) {\n+\t\tenable_irq(vector);\n+\t\treturn rc;\n+\t}\n+\tbnge_set_db(bn, \u0026nqr-\u003enq_db, type, map_idx, ring-\u003efw_ring_id);\n+\tbnge_db_nq(bn, \u0026nqr-\u003enq_db, nqr-\u003enq_raw_cons);\n+\tenable_irq(vector);\n+\n+\treturn 0;\n+}\n+\n+static void bnge_hwrm_nq_free(struct bnge_net *bn, struct bnge_napi *bnapi)\n+{\n+\tstruct bnge_ring_struct *ring = \u0026bnapi-\u003enq_ring.ring_struct;\n+\n+\tif (ring-\u003efw_ring_id == INVALID_HW_RING_ID_32BIT)\n+\t\treturn;\n+\n+\thwrm_ring_free_send_msg(bn, ring, RING_FREE_REQ_RING_TYPE_NQ,\n+\t\t\t\tINVALID_HW_RING_ID);\n+\tring-\u003efw_ring_id = INVALID_HW_RING_ID_32BIT;\n+}\n+\n static int bnge_hwrm_ring_alloc(struct bnge_net *bn)\n {\n \tstruct bnge_dev *bd = bn-\u003ebd;\n@@ -1921,31 +1986,14 @@ static int bnge_hwrm_ring_alloc(struct bnge_net *bn)\n \tint i, rc = 0;\n \n \tagg_rings = !!(bnge_is_agg_reqd(bd));\n-\tfor (i = 0; i \u003c bd-\u003enq_nr_rings; i++) {\n+\tbnge_for_each_open_nq(i, bd) {\n \t\tstruct bnge_napi *bnapi = bn-\u003ebnapi[i];\n-\t\tstruct bnge_nq_ring_info *nqr = \u0026bnapi-\u003enq_ring;\n-\t\tstruct bnge_ring_struct *ring = \u0026nqr-\u003ering_struct;\n-\t\tu32 type = HWRM_RING_ALLOC_NQ;\n-\t\tu32 map_idx = ring-\u003emap_idx;\n-\t\tunsigned int vector;\n \n-\t\tvector = bd-\u003eirq_tbl[map_idx].vector;\n-\t\tdisable_irq_nosync(vector);\n-\t\trc = hwrm_ring_alloc_send_msg(bn, ring, type, map_idx);\n-\t\tif (rc) {\n-\t\t\tenable_irq(vector);\n+\t\trc = bnge_hwrm_nq_alloc(bn, bnapi);\n+\t\tif (rc)\n \t\t\tgoto err_out;\n-\t\t}\n-\t\tbnge_set_db(bn, \u0026nqr-\u003enq_db, type, map_idx, ring-\u003efw_ring_id);\n-\t\tbnge_db_nq(bn, \u0026nqr-\u003enq_db, nqr-\u003enq_raw_cons);\n-\t\tenable_irq(vector);\n-\t\tbn-\u003egrp_info[i].nq_fw_ring_id = (u16)ring-\u003efw_ring_id;\n-\n-\t\tif (!i) {\n-\t\t\trc = bnge_hwrm_set_async_event_cr(bd, ring-\u003efw_ring_id);\n-\t\t\tif (rc)\n-\t\t\t\tnetdev_warn(bn-\u003enetdev, \"Failed to set async event completion ring.\\n\");\n-\t\t}\n+\t\tbn-\u003egrp_info[i].nq_fw_ring_id =\n+\t\t\t(u16)bnapi-\u003enq_ring.ring_struct.fw_ring_id;\n \t}\n \n \tfor (i = 0; i \u003c bd-\u003etx_nr_rings; i++) {\n@@ -2388,7 +2436,7 @@ static void bnge_enable_int(struct bnge_net *bn)\n \tstruct bnge_dev *bd = bn-\u003ebd;\n \tint i;\n \n-\tfor (i = 0; i \u003c bd-\u003enq_nr_rings; i++) {\n+\tbnge_for_each_open_nq(i, bd) {\n \t\tstruct bnge_napi *bnapi = bn-\u003ebnapi[i];\n \t\tstruct bnge_nq_ring_info *nqr;\n \n@@ -2405,7 +2453,7 @@ static void bnge_disable_napi(struct bnge_net *bn)\n \tif (test_and_set_bit(BNGE_STATE_NAPI_DISABLED, \u0026bn-\u003estate))\n \t\treturn;\n \n-\tfor (i = 0; i \u003c bd-\u003enq_nr_rings; i++) {\n+\tbnge_for_each_open_nq(i, bd) {\n \t\tstruct bnge_napi *bnapi = bn-\u003ebnapi[i];\n \n \t\tnapi_disable_locked(\u0026bnapi-\u003enapi);\n@@ -2418,7 +2466,7 @@ static void bnge_enable_napi(struct bnge_net *bn)\n \tint i;\n \n \tclear_bit(BNGE_STATE_NAPI_DISABLED, \u0026bn-\u003estate);\n-\tfor (i = 0; i \u003c bd-\u003enq_nr_rings; i++) {\n+\tbnge_for_each_open_nq(i, bd) {\n \t\tstruct bnge_napi *bnapi = bn-\u003ebnapi[i];\n \n \t\tbnapi-\u003ein_reset = false;\n@@ -2566,23 +2614,16 @@ static void bnge_hwrm_ring_free(struct bnge_net *bn, bool close_path)\n \tbnge_disable_int_sync(bn);\n \n \tfor (i = 0; i \u003c bd-\u003enq_nr_rings; i++) {\n-\t\tstruct bnge_napi *bnapi = bn-\u003ebnapi[i];\n-\t\tstruct bnge_nq_ring_info *nqr;\n-\t\tstruct bnge_ring_struct *ring;\n+\t\tstruct bnge_nq_ring_info *nqr = \u0026bn-\u003ebnapi[i]-\u003enq_ring;\n \t\tint j;\n \n-\t\tnqr = \u0026bnapi-\u003enq_ring;\n \t\tfor (j = 0; j \u003c nqr-\u003ecp_ring_count \u0026\u0026 nqr-\u003ecp_ring_arr; j++)\n \t\t\tbnge_hwrm_cp_ring_free(bn, \u0026nqr-\u003ecp_ring_arr[j]);\n+\t}\n \n-\t\tring = \u0026nqr-\u003ering_struct;\n-\t\tif (ring-\u003efw_ring_id != INVALID_HW_RING_ID_32BIT) {\n-\t\t\thwrm_ring_free_send_msg(bn, ring,\n-\t\t\t\t\t\tRING_FREE_REQ_RING_TYPE_NQ,\n-\t\t\t\t\t\tINVALID_HW_RING_ID);\n-\t\t\tring-\u003efw_ring_id = INVALID_HW_RING_ID_32BIT;\n-\t\t\tbn-\u003egrp_info[i].nq_fw_ring_id = INVALID_HW_RING_ID;\n-\t\t}\n+\tbnge_for_each_open_nq(i, bd) {\n+\t\tbnge_hwrm_nq_free(bn, bn-\u003ebnapi[i]);\n+\t\tbn-\u003egrp_info[i].nq_fw_ring_id = INVALID_HW_RING_ID;\n \t}\n }\n \n@@ -2593,7 +2634,10 @@ static void bnge_setup_msix(struct bnge_net *bn)\n \tint len, i;\n \n \tlen = sizeof(bd-\u003eirq_tbl[0].name);\n-\tfor (i = 0; i \u003c bd-\u003enq_nr_rings; i++) {\n+\t/* NQ0 keeps the \"\u003cpci_name\u003e-nq0\" name set in bnge_nq0_init(). Only the\n+\t * NQs created in open are named after the netdev here.\n+\t */\n+\tbnge_for_each_open_nq(i, bd) {\n \t\tint map_idx = bnge_cp_num_to_irq_num(bn, i);\n \t\tchar *attr;\n \n@@ -2627,27 +2671,59 @@ static void bnge_hwrm_resource_free(struct bnge_net *bn, bool close_path)\n \tbnge_hwrm_stat_ctx_free(bn);\n }\n \n-static void bnge_free_irq(struct bnge_net *bn)\n+static void bnge_nq_free_irq(struct bnge_net *bn, struct bnge_napi *bnapi)\n+{\n+\tint map_idx = bnapi-\u003enq_ring.ring_struct.map_idx;\n+\tstruct bnge_irq *irq = \u0026bn-\u003ebd-\u003eirq_tbl[map_idx];\n+\n+\tif (irq-\u003erequested) {\n+\t\tif (irq-\u003ehave_cpumask) {\n+\t\t\tirq_set_affinity_hint(irq-\u003evector, NULL);\n+\t\t\tfree_cpumask_var(irq-\u003ecpu_mask);\n+\t\t\tirq-\u003ehave_cpumask = 0;\n+\t\t}\n+\t\tfree_irq(irq-\u003evector, bnapi);\n+\t}\n+\n+\tirq-\u003erequested = 0;\n+}\n+\n+static int bnge_nq_request_irq(struct bnge_net *bn, struct bnge_napi *bnapi)\n {\n+\tint map_idx = bnapi-\u003enq_ring.ring_struct.map_idx;\n \tstruct bnge_dev *bd = bn-\u003ebd;\n \tstruct bnge_irq *irq;\n-\tint i;\n+\tint rc;\n \n-\tfor (i = 0; i \u003c bd-\u003enq_nr_rings; i++) {\n-\t\tint map_idx = bnge_cp_num_to_irq_num(bn, i);\n+\tirq = \u0026bd-\u003eirq_tbl[map_idx];\n \n-\t\tirq = \u0026bd-\u003eirq_tbl[map_idx];\n-\t\tif (irq-\u003erequested) {\n-\t\t\tif (irq-\u003ehave_cpumask) {\n-\t\t\t\tirq_set_affinity_hint(irq-\u003evector, NULL);\n-\t\t\t\tfree_cpumask_var(irq-\u003ecpu_mask);\n-\t\t\t\tirq-\u003ehave_cpumask = 0;\n-\t\t\t}\n-\t\t\tfree_irq(irq-\u003evector, bn-\u003ebnapi[i]);\n-\t\t}\n+\trc = request_irq(irq-\u003evector, irq-\u003ehandler, 0, irq-\u003ename, bnapi);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\tnetif_napi_set_irq_locked(\u0026bnapi-\u003enapi, irq-\u003evector);\n+\tirq-\u003erequested = 1;\n \n-\t\tirq-\u003erequested = 0;\n+\tif (zalloc_cpumask_var(\u0026irq-\u003ecpu_mask, GFP_KERNEL)) {\n+\t\tint numa_node = dev_to_node(\u0026bd-\u003epdev-\u003edev);\n+\n+\t\tirq-\u003ehave_cpumask = 1;\n+\t\tcpumask_set_cpu(cpumask_local_spread(bnapi-\u003eindex, numa_node),\n+\t\t\t\tirq-\u003ecpu_mask);\n+\t\tif (irq_set_affinity_hint(irq-\u003evector, irq-\u003ecpu_mask))\n+\t\t\tbnge_warn(bd, \"Set affinity failed, IRQ = %d\\n\",\n+\t\t\t\t  irq-\u003evector);\n \t}\n+\treturn 0;\n+}\n+\n+static void bnge_free_irq(struct bnge_net *bn)\n+{\n+\tstruct bnge_dev *bd = bn-\u003ebd;\n+\tint i;\n+\n+\tbnge_for_each_open_nq(i, bd)\n+\t\tbnge_nq_free_irq(bn, bn-\u003ebnapi[i]);\n }\n \n static int bnge_request_irq(struct bnge_net *bn)\n@@ -2660,30 +2736,10 @@ static int bnge_request_irq(struct bnge_net *bn)\n \t\tnetdev_err(bn-\u003enetdev, \"bnge_setup_interrupts err: %d\\n\", rc);\n \t\treturn rc;\n \t}\n-\tfor (i = 0; i \u003c bd-\u003enq_nr_rings; i++) {\n-\t\tint map_idx = bnge_cp_num_to_irq_num(bn, i);\n-\t\tstruct bnge_irq *irq = \u0026bd-\u003eirq_tbl[map_idx];\n-\n-\t\trc = request_irq(irq-\u003evector, irq-\u003ehandler, 0, irq-\u003ename,\n-\t\t\t\t bn-\u003ebnapi[i]);\n+\tbnge_for_each_open_nq(i, bd) {\n+\t\trc = bnge_nq_request_irq(bn, bn-\u003ebnapi[i]);\n \t\tif (rc)\n \t\t\tgoto err_free_irq;\n-\n-\t\tnetif_napi_set_irq_locked(\u0026bn-\u003ebnapi[i]-\u003enapi, irq-\u003evector);\n-\t\tirq-\u003erequested = 1;\n-\n-\t\tif (zalloc_cpumask_var(\u0026irq-\u003ecpu_mask, GFP_KERNEL)) {\n-\t\t\tint numa_node = dev_to_node(\u0026bd-\u003epdev-\u003edev);\n-\n-\t\t\tirq-\u003ehave_cpumask = 1;\n-\t\t\tcpumask_set_cpu(cpumask_local_spread(i, numa_node),\n-\t\t\t\t\tirq-\u003ecpu_mask);\n-\t\t\tif (irq_set_affinity_hint(irq-\u003evector, irq-\u003ecpu_mask)) {\n-\t\t\t\tnetdev_warn(bn-\u003enetdev,\n-\t\t\t\t\t    \"Set affinity failed, IRQ = %d\\n\",\n-\t\t\t\t\t    irq-\u003evector);\n-\t\t\t}\n-\t\t}\n \t}\n \treturn 0;\n \n@@ -2799,7 +2855,7 @@ static void bnge_init_napi(struct bnge_net *bn)\n \tstruct bnge_napi *bnapi;\n \tint i;\n \n-\tfor (i = 0; i \u003c bd-\u003enq_nr_rings; i++) {\n+\tbnge_for_each_open_nq(i, bd) {\n \t\tbnapi = bn-\u003ebnapi[i];\n \t\tnetif_napi_add_config_locked(bn-\u003enetdev, \u0026bnapi-\u003enapi,\n \t\t\t\t\t     bnge_napi_poll, bnapi-\u003eindex);\n@@ -2816,7 +2872,7 @@ static void bnge_del_napi(struct bnge_net *bn)\n \tfor (i = 0; i \u003c bd-\u003etx_nr_rings; i++)\n \t\tnetif_queue_set_napi(bn-\u003enetdev, i, NETDEV_QUEUE_TYPE_TX, NULL);\n \n-\tfor (i = 0; i \u003c bd-\u003enq_nr_rings; i++) {\n+\tbnge_for_each_open_nq(i, bd) {\n \t\tstruct bnge_napi *bnapi = bn-\u003ebnapi[i];\n \n \t\t__netif_napi_del_locked(\u0026bnapi-\u003enapi);\n@@ -2826,11 +2882,134 @@ static void bnge_del_napi(struct bnge_net *bn)\n \tsynchronize_net();\n }\n \n+static void bnge_nq0_quiesce(struct bnge_net *bn)\n+{\n+\tnapi_disable_locked(\u0026bn-\u003enq0-\u003enapi);\n+\t/* Wait for RCU grace period after napi_disable_locked(): a poll can\n+\t * still be arming the NQ doorbell after it clears NAPI_STATE_SCHED.\n+\t */\n+\tsynchronize_net();\n+\tbnge_db_nq(bn, \u0026bn-\u003enq0-\u003enq_ring.nq_db, bn-\u003enq0-\u003enq_ring.nq_raw_cons);\n+}\n+\n+static void bnge_nq0_resume(struct bnge_net *bn)\n+{\n+\tstruct bnge_nq_ring_info *nqr = \u0026bn-\u003enq0-\u003enq_ring;\n+\n+\tbn-\u003enq0-\u003ein_reset = false;\n+\tbn-\u003enq0-\u003etx_fault = 0;\n+\tnapi_enable_locked(\u0026bn-\u003enq0-\u003enapi);\n+\tbnge_db_nq_arm(bn, \u0026nqr-\u003enq_db, nqr-\u003enq_raw_cons);\n+}\n+\n+static int bnge_nq0_init(struct bnge_net *bn)\n+{\n+\tstruct net_device *dev = bn-\u003enetdev;\n+\tstruct bnge_nq_ring_info *nqr;\n+\tstruct bnge_dev *bd = bn-\u003ebd;\n+\tstruct bnge_napi *bnapi;\n+\tstruct bnge_irq *irq;\n+\tint rc;\n+\n+\tbnapi = kzalloc_obj(*bnapi);\n+\tif (!bnapi)\n+\t\treturn -ENOMEM;\n+\n+\t/* NQ0 helpers hard-code NQ index 0 */\n+\tBUILD_BUG_ON(BNGE_FIRST_OPEN_NQ != 1);\n+\n+\tbnapi-\u003ebn = bn;\n+\tbnapi-\u003eindex = 0;\n+\tbn-\u003enq0 = bnapi;\n+\tnqr = \u0026bnapi-\u003enq_ring;\n+\n+\trc = bnge_alloc_nq(bn, bnapi);\n+\tif (rc)\n+\t\tgoto err_free_bnapi;\n+\n+\tirq = \u0026bd-\u003eirq_tbl[nqr-\u003ering_struct.map_idx];\n+\tirq-\u003ehandler = bnge_msix;\n+\tsnprintf(irq-\u003ename, sizeof(irq-\u003ename), \"%s-nq0\", pci_name(bd-\u003epdev));\n+\n+\t/* The netdev is not registered yet, but the *_locked() NAPI helpers\n+\t * expect the instance lock to be held.\n+\t */\n+\tnetdev_lock(dev);\n+\tnetif_napi_add_config_locked(dev, \u0026bnapi-\u003enapi, bnge_napi_poll,\n+\t\t\t\t     bnapi-\u003eindex);\n+\n+\trc = bnge_nq_request_irq(bn, bnapi);\n+\tif (rc)\n+\t\tgoto err_del_napi;\n+\n+\trc = bnge_hwrm_nq_alloc(bn, bnapi);\n+\tif (rc)\n+\t\tgoto err_free_irq;\n+\n+\trc = bnge_hwrm_set_async_event_cr(bd, nqr-\u003ering_struct.fw_ring_id);\n+\tif (rc) {\n+\t\tbnge_err(bd, \"Failed to set async event completion ring: %d\\n\",\n+\t\t\t rc);\n+\t\tgoto err_free_irq;\n+\t}\n+\n+\t/* Enable NAPI only now that the NQ doorbell is set up, so an early\n+\t * interrupt cannot make the poll arm an uninitialized doorbell.\n+\t */\n+\tnapi_enable_locked(\u0026bnapi-\u003enapi);\n+\tbnge_db_nq_arm(bn, \u0026nqr-\u003enq_db, nqr-\u003enq_raw_cons);\n+\tnetdev_unlock(dev);\n+\treturn 0;\n+\n+err_free_irq:\n+\tbnge_nq_free_irq(bn, bnapi);\n+\t__netif_napi_del_locked(\u0026bnapi-\u003enapi);\n+\tnetdev_unlock(dev);\n+\t/* Same order as bnge_nq0_uninit(): no poll may touch the NQ once the\n+\t * FW ring is freed.\n+\t */\n+\tsynchronize_net();\n+\tbnge_hwrm_nq_free(bn, bnapi);\n+\tbnge_free_nq(bn, bnapi);\n+\tgoto err_free_bnapi;\n+err_del_napi:\n+\t__netif_napi_del_locked(\u0026bnapi-\u003enapi);\n+\tnetdev_unlock(dev);\n+\tsynchronize_net();\n+\tbnge_free_nq(bn, bnapi);\n+err_free_bnapi:\n+\tkfree(bnapi);\n+\tbn-\u003enq0 = NULL;\n+\treturn rc;\n+}\n+\n+static void bnge_nq0_uninit(struct bnge_net *bn)\n+{\n+\tstruct net_device *dev = bn-\u003enetdev;\n+\tstruct bnge_napi *bnapi = bn-\u003enq0;\n+\n+\tnetdev_lock(dev);\n+\tnapi_disable_locked(\u0026bnapi-\u003enapi);\n+\tbnge_nq_free_irq(bn, bnapi);\n+\t__netif_napi_del_locked(\u0026bnapi-\u003enapi);\n+\tnetdev_unlock(dev);\n+\t/* Wait for RCU grace period after removing the NAPI instance, and for\n+\t * a poll that may still be arming the NQ doorbell, before destroying\n+\t * the FW ring.\n+\t */\n+\tsynchronize_net();\n+\n+\tbnge_hwrm_nq_free(bn, bnapi);\n+\tbnge_free_nq(bn, bnapi);\n+\tkfree(bnapi);\n+\tbn-\u003enq0 = NULL;\n+}\n+\n static int bnge_init_nic(struct bnge_net *bn)\n {\n \tint rc;\n \n-\tbnge_init_nq_tree(bn);\n+\tbnge_init_cp_rings(bn);\n \n \tbnge_init_rx_rings(bn);\n \trc = bnge_alloc_rx_ring_pair_bufs(bn);\n@@ -2932,10 +3111,17 @@ static int bnge_open_core(struct bnge_net *bn)\n \t\tgoto err_if_change;\n \t}\n \n+\tbnge_nq0_quiesce(bn);\n+\n+\t/* Drop async events NQ0 received while down. Its NAPI is quiesced, so\n+\t * nothing can set bits concurrently.\n+\t */\n+\tWRITE_ONCE(bn-\u003esp_event, 0);\n+\n \trc = bnge_alloc_core(bn);\n \tif (rc) {\n \t\tnetdev_err(bn-\u003enetdev, \"bnge_alloc_core err: %d\\n\", rc);\n-\t\tgoto err_if_change;\n+\t\tgoto err_nq0_resume;\n \t}\n \n \tbnge_init_napi(bn);\n@@ -2967,6 +3153,8 @@ static int bnge_open_core(struct bnge_net *bn)\n \tset_bit(BNGE_STATE_STATS_ENABLE, \u0026bn-\u003estate);\n \n \tbnge_enable_int(bn);\n+\t/* Resume NQ0 with the other NQs, once BNGE_STATE_OPEN is set */\n+\tbnge_nq0_resume(bn);\n \n \tbnge_tx_enable(bn);\n \n@@ -2978,10 +3166,13 @@ static int bnge_open_core(struct bnge_net *bn)\n \treturn 0;\n \n err_free_irq:\n+\tbnge_nq_drain(bn, bn-\u003enq0);\n \tbnge_free_irq(bn);\n err_del_napi:\n \tbnge_del_napi(bn);\n \tbnge_free_core(bn);\n+err_nq0_resume:\n+\tbnge_nq0_resume(bn);\n err_if_change:\n \tbnge_hwrm_if_change(bd, false);\n \treturn rc;\n@@ -3194,6 +3385,8 @@ static void bnge_close_core(struct bnge_net *bn)\n \ttimer_delete_sync(\u0026bn-\u003etimer);\n \tbnge_shutdown_nic(bn);\n \tbnge_disable_napi(bn);\n+\tbnge_nq0_quiesce(bn);\n+\tbnge_nq_drain(bn, bn-\u003enq0);\n \n \t/* Save ring stats before shutdown */\n \tspin_lock_bh(\u0026bn-\u003estats_lock);\n@@ -3206,6 +3399,7 @@ static void bnge_close_core(struct bnge_net *bn)\n \tbnge_del_napi(bn);\n \n \tbnge_free_core(bn);\n+\tbnge_nq0_resume(bn);\n }\n \n static int bnge_close(struct net_device *dev)\n@@ -3215,7 +3409,6 @@ static int bnge_close(struct net_device *dev)\n \tbnge_close_core(bn);\n \tbnge_hwrm_shutdown_link(bn-\u003ebd);\n \tbnge_hwrm_if_change(bn-\u003ebd, false);\n-\tbn-\u003esp_event = 0;\n \n \treturn 0;\n }\n@@ -3549,14 +3742,23 @@ int bnge_netdev_alloc(struct bnge_dev *bd, int max_irqs)\n \tspin_lock_init(\u0026bn-\u003estats_lock);\n \n \tnetdev-\u003erequest_ops_lock = true;\n+\n+\trc = bnge_nq0_init(bn);\n+\tif (rc) {\n+\t\tdev_err(bd-\u003edev, \"NQ0 init failed rc: %d\\n\", rc);\n+\t\tgoto err_free_port_stats;\n+\t}\n+\n \trc = register_netdev(netdev);\n \tif (rc) {\n \t\tdev_err(bd-\u003edev, \"Register netdev failed rc: %d\\n\", rc);\n-\t\tgoto err_free_port_stats;\n+\t\tgoto err_uninit_nq0;\n \t}\n \n \treturn 0;\n \n+err_uninit_nq0:\n+\tbnge_nq0_uninit(bn);\n err_free_port_stats:\n \tbnge_free_port_stats(bn);\n err_free_workq:\n@@ -3576,6 +3778,9 @@ void bnge_netdev_free(struct bnge_dev *bd)\n \n \tunregister_netdev(netdev);\n \n+\t/* NQ0 can queue sp_task; destroy it before the timer and workqueue */\n+\tbnge_nq0_uninit(bn);\n+\n \ttimer_shutdown_sync(\u0026bn-\u003etimer);\n \tcancel_work_sync(\u0026bn-\u003esp_task);\n \tbn-\u003esp_event = 0;\ndiff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h\nindex 476b5bab96fed..118a2e4f5331f 100644\n--- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h\n+++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h\n@@ -315,6 +315,8 @@ struct bnge_net {\n \tu32\t\t\thash_seed;\n \tu64\t\t\ttoeplitz_prefix;\n \n+\t/* Lives from probe to remove. bnapi[0] points to it. */\n+\tstruct bnge_napi\t\t*nq0;\n \tstruct bnge_napi\t\t**bnapi;\n \n \tstruct bnge_rx_ring_info\t*rx_ring;\ndiff --git a/drivers/net/ethernet/broadcom/bnge/bnge_rmem.c b/drivers/net/ethernet/broadcom/bnge/bnge_rmem.c\nindex b066ee887a099..bbae84b4157ea 100644\n--- a/drivers/net/ethernet/broadcom/bnge/bnge_rmem.c\n+++ b/drivers/net/ethernet/broadcom/bnge/bnge_rmem.c\n@@ -431,20 +431,10 @@ void bnge_init_ring_struct(struct bnge_net *bn)\n \tfor (i = 0; i \u003c bd-\u003enq_nr_rings; i++) {\n \t\tstruct bnge_napi *bnapi = bn-\u003ebnapi[i];\n \t\tstruct bnge_ring_mem_info *rmem;\n-\t\tstruct bnge_nq_ring_info *nqr;\n \t\tstruct bnge_rx_ring_info *rxr;\n \t\tstruct bnge_tx_ring_info *txr;\n \t\tstruct bnge_ring_struct *ring;\n \n-\t\tnqr = \u0026bnapi-\u003enq_ring;\n-\t\tring = \u0026nqr-\u003ering_struct;\n-\t\trmem = \u0026ring-\u003ering_mem;\n-\t\trmem-\u003enr_pages = bn-\u003ecp_nr_pages;\n-\t\trmem-\u003epage_size = HW_CMPD_RING_SIZE;\n-\t\trmem-\u003epg_arr = (void **)nqr-\u003edesc_ring;\n-\t\trmem-\u003edma_arr = nqr-\u003edesc_mapping;\n-\t\trmem-\u003evmem_size = 0;\n-\n \t\trxr = bnapi-\u003erx_ring;\n \t\tif (!rxr)\n \t\t\tgoto skip_rx;\ndiff --git a/drivers/net/ethernet/broadcom/bnge/bnge_txrx.c b/drivers/net/ethernet/broadcom/bnge/bnge_txrx.c\nindex 472b02cc43b3c..9324ee889034e 100644\n--- a/drivers/net/ethernet/broadcom/bnge/bnge_txrx.c\n+++ b/drivers/net/ethernet/broadcom/bnge/bnge_txrx.c\n@@ -1135,8 +1135,8 @@ static void bnge_async_event_process(struct bnge_net *bn,\n \tu32 data1 = le32_to_cpu(cmpl-\u003eevent_data1);\n \tu32 data2 = le32_to_cpu(cmpl-\u003eevent_data2);\n \n-\tnetdev_dbg(bn-\u003enetdev, \"hwrm event 0x%x {0x%x, 0x%x}\\n\",\n-\t\t   event_id, data1, data2);\n+\tbnge_dbg(bn-\u003ebd, \"hwrm event 0x%x {0x%x, 0x%x}\\n\",\n+\t\t event_id, data1, data2);\n \n \tswitch (event_id) {\n \tcase ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE:\n@@ -1375,6 +1375,13 @@ int bnge_napi_poll(struct napi_struct *napi, int budget)\n \t\t\t\tbreak;\n \n \t\t\tidx = BNGE_NQ_HDL_IDX(idx);\n+\t\t\t/* NQ0 outlives its completion rings: ignore a stale\n+\t\t\t * notification for a CQ that no longer exists.\n+\t\t\t */\n+\t\t\tif (unlikely(idx \u003e= nqr-\u003ecp_ring_count)) {\n+\t\t\t\traw_cons = NEXT_RAW_CMP(raw_cons);\n+\t\t\t\tcontinue;\n+\t\t\t}\n \t\t\tcpr = \u0026nqr-\u003ecp_ring_arr[idx];\n \t\t\tcpr-\u003ehad_nqe_notify = 1;\n \t\t\tcpr-\u003etoggle = NQE_CN_TOGGLE(type);\n@@ -1396,6 +1403,41 @@ int bnge_napi_poll(struct napi_struct *napi, int budget)\n \treturn work_done;\n }\n \n+/* Consume pending NQ entries without polling the CP rings. The NQ's NAPI must\n+ * be disabled (or quiesced) by the caller. HWRM events are handled, CQ\n+ * notifications are dropped. cpr-\u003ehad_nqe_notify is not reset, so the CP rings\n+ * must be freed or re-initialised afterwards.\n+ */\n+void bnge_nq_drain(struct bnge_net *bn, struct bnge_napi *bnapi)\n+{\n+\tstruct bnge_nq_ring_info *nqr = \u0026bnapi-\u003enq_ring;\n+\tu32 raw_cons = nqr-\u003enq_raw_cons;\n+\n+\twhile (1) {\n+\t\tu32 cons = RING_CMP(bn, raw_cons);\n+\t\tstruct nqe_cn *nqcmp;\n+\t\tu16 type;\n+\n+\t\tnqcmp = \u0026nqr-\u003edesc_ring[CP_RING(cons)][CP_IDX(cons)];\n+\t\tif (!NQ_CMP_VALID(bn, nqcmp, raw_cons))\n+\t\t\tbreak;\n+\n+\t\t/* The valid test of the entry must be done first before\n+\t\t * reading any further.\n+\t\t */\n+\t\tdma_rmb();\n+\n+\t\ttype = le16_to_cpu(nqcmp-\u003etype);\n+\t\tif (NQE_CN_TYPE(type) != NQ_CN_TYPE_CQ_NOTIFICATION)\n+\t\t\tbnge_hwrm_handler(bn, (struct tx_cmp *)nqcmp);\n+\t\traw_cons = NEXT_RAW_CMP(raw_cons);\n+\t}\n+\n+\tnqr-\u003ehas_more_work = 0;\n+\tnqr-\u003enq_raw_cons = raw_cons;\n+\tBNGE_DB_NQ(bn-\u003ebd, \u0026nqr-\u003enq_db, raw_cons);\n+}\n+\n static u16 bnge_xmit_get_cfa_action(struct sk_buff *skb)\n {\n \tstruct metadata_dst *md_dst = skb_metadata_dst(skb);\ndiff --git a/drivers/net/ethernet/broadcom/bnge/bnge_txrx.h b/drivers/net/ethernet/broadcom/bnge/bnge_txrx.h\nindex bd0aa6c221a49..5779b78fb6a2d 100644\n--- a/drivers/net/ethernet/broadcom/bnge/bnge_txrx.h\n+++ b/drivers/net/ethernet/broadcom/bnge/bnge_txrx.h\n@@ -120,6 +120,7 @@ irqreturn_t bnge_msix(int irq, void *dev_instance);\n netdev_tx_t bnge_start_xmit(struct sk_buff *skb, struct net_device *dev);\n void bnge_reuse_rx_data(struct bnge_rx_ring_info *rxr, u16 cons, void *data);\n int bnge_napi_poll(struct napi_struct *napi, int budget);\n+void bnge_nq_drain(struct bnge_net *bn, struct bnge_napi *bnapi);\n netdev_features_t bnge_features_check(struct sk_buff *skb,\n \t\t\t\t      struct net_device *dev,\n \t\t\t\t      netdev_features_t features);\n"
}

2/1 2026/10/14 00:40 agent patch-evaluator
2m Model:
core

Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch modifies the Broadcom ThorUltra (bnge) Ethernet driver (drivers/net/ethernet/broadcom/bnge/), specifically ring and NQ handling during netdev open/close/init. This driver supports physical Broadcom ThorUltra 50G-800G PCIe NICs (PCI ID 14e4:1780) which are vendor-specific ASIC hardware not emulated in standard virtualized environments (QEMU/GCE). As such, the code is structurally unreachable during 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 366fe6c0be11e88d68c88a71dedc0df911c4b07e
Author: syz-cluster <triage@syzkaller.com>
Date:   Wed Oct 14 00:40:13 2026 +0000

    syz-cluster: applied patch under review

diff --git a/drivers/net/ethernet/broadcom/bnge/bnge.h b/drivers/net/ethernet/broadcom/bnge/bnge.h
index 4479ccd071f53..950f40d699165 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge.h
+++ b/drivers/net/ethernet/broadcom/bnge/bnge.h
@@ -220,6 +220,38 @@ struct bnge_dev {
 	u32			phy_flags;
 };
 
+/* The netdev has no name until register_netdev(), so log through the PCI
+ * device before that (e.g. during probe).
+ */
+#define bnge_log(level, bd, fmt, ...)					\
+	do {								\
+		struct bnge_dev *__bd = (bd);				\
+									\
+		if (__bd->netdev &&					\
+		    READ_ONCE(__bd->netdev->reg_state) != NETREG_UNINITIALIZED)\
+			netdev_##level(__bd->netdev, fmt, ##__VA_ARGS__);\
+		else							\
+			dev_##level(__bd->dev, fmt, ##__VA_ARGS__);	\
+	} while (0)
+
+#define bnge_err(bd, fmt, ...)	bnge_log(err, bd, fmt, ##__VA_ARGS__)
+#define bnge_warn(bd, fmt, ...)	bnge_log(warn, bd, fmt, ##__VA_ARGS__)
+#define bnge_dbg(bd, fmt, ...)	bnge_log(dbg, bd, fmt, ##__VA_ARGS__)
+
+/* Index of the first NQ created in ndo_open() and destroyed in ndo_stop().
+ * NQs below it are created at probe and destroyed at remove. Exactly one NQ,
+ * NQ0 (async events and queue 0), is created at probe.
+ *
+ * Layout of bd->irq_tbl, with A = aux MSI-X count: NQ0 uses irq_tbl[0],
+ * the aux (RoCE) device irq_tbl[1..A], and the NQs created in open
+ * irq_tbl[A + 1..]. The ring_idx the aux device receives is its irq_tbl
+ * index.
+ */
+#define BNGE_FIRST_OPEN_NQ	1
+
+#define bnge_for_each_open_nq(i, bd) \
+	for ((i) = BNGE_FIRST_OPEN_NQ; (i) < (bd)->nq_nr_rings; (i)++)
+
 static inline bool bnge_is_roce_en(struct bnge_dev *bd)
 {
 	return bd->flags & BNGE_EN_ROCE;
@@ -263,4 +295,19 @@ static inline void bnge_db_write(struct bnge_dev *bd, struct bnge_db_info *db,
 bool bnge_aux_registered(struct bnge_dev *bd);
 u16 bnge_aux_get_msix(struct bnge_dev *bd);
 
+/* irq_tbl index of the i-th aux vector, also used as its ring_idx */
+static inline int bnge_aux_irq_idx(int i)
+{
+	return BNGE_FIRST_OPEN_NQ + i;
+}
+
+/* irq_tbl index of NQ nq_idx */
+static inline int bnge_nq_irq_idx(struct bnge_dev *bd, int nq_idx)
+{
+	if (nq_idx < BNGE_FIRST_OPEN_NQ)
+		return nq_idx;
+
+	return bnge_aux_get_msix(bd) + nq_idx;
+}
+
 #endif /* _BNGE_H_ */
diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_auxr.c b/drivers/net/ethernet/broadcom/bnge/bnge_auxr.c
index 0955b488b6fea..0393bfea7b658 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_auxr.c
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_auxr.c
@@ -34,9 +34,9 @@ static void bnge_fill_msix_vecs(struct bnge_dev *bd,
 	}
 	num_msix = auxr_dev->auxr_info->msix_requested;
 	for (i = 0; i < num_msix; i++) {
-		info[i].vector = bd->irq_tbl[i].vector;
+		info[i].vector = bd->irq_tbl[bnge_aux_irq_idx(i)].vector;
 		info[i].db_offset = bd->db_offset;
-		info[i].ring_idx = i;
+		info[i].ring_idx = bnge_aux_irq_idx(i);
 	}
 }
 
diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c b/drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c
index 651c5e783516c..fb960bff85fa5 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c
@@ -1302,7 +1302,8 @@ int hwrm_ring_free_send_msg(struct bnge_net *bn,
 	bnge_hwrm_req_drop(bd, req);
 exit:
 	if (rc) {
-		netdev_err(bd->netdev, "hwrm_ring_free type %d failed. rc:%d\n", ring_type, rc);
+		bnge_err(bd, "hwrm_ring_free type %d failed. rc:%d\n",
+			 ring_type, rc);
 		return -EIO;
 	}
 	return 0;
@@ -1395,7 +1396,7 @@ int hwrm_ring_alloc_send_msg(struct bnge_net *bn,
 		req->int_mode = RING_ALLOC_REQ_INT_MODE_MSIX;
 		break;
 	default:
-		netdev_err(bn->netdev, "hwrm alloc invalid ring type %d\n", ring_type);
+		bnge_err(bd, "hwrm alloc invalid ring type %d\n", ring_type);
 		return -EINVAL;
 	}
 
@@ -1406,7 +1407,8 @@ int hwrm_ring_alloc_send_msg(struct bnge_net *bn,
 
 exit:
 	if (rc) {
-		netdev_err(bd->netdev, "hwrm_ring_alloc type %d failed. rc:%d\n", ring_type, rc);
+		bnge_err(bd, "hwrm_ring_alloc type %d failed. rc:%d\n",
+			 ring_type, rc);
 		return -EIO;
 	}
 	ring->fw_ring_id = ring_id;
diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
index 25f844e6f6d34..c6649a2c5876f 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
@@ -503,61 +503,89 @@ static int bnge_alloc_cp_desc_arr(struct bnge_cp_ring_info *cpr, int n)
 	return -ENOMEM;
 }
 
-static void bnge_free_nq_arrays(struct bnge_net *bn)
+static void bnge_free_nq(struct bnge_net *bn, struct bnge_napi *bnapi)
 {
-	struct bnge_dev *bd = bn->bd;
-	int i;
+	struct bnge_nq_ring_info *nqr = &bnapi->nq_ring;
 
-	for (i = 0; i < bd->nq_nr_rings; i++) {
-		struct bnge_napi *bnapi = bn->bnapi[i];
+	bnge_free_ring(bn->bd, &nqr->ring_struct.ring_mem);
+	bnge_free_nq_desc_arr(nqr);
+}
+
+static int bnge_alloc_nq(struct bnge_net *bn, struct bnge_napi *bnapi)
+{
+	struct bnge_nq_ring_info *nqr = &bnapi->nq_ring;
+	struct bnge_ring_mem_info *rmem;
+	struct bnge_ring_struct *ring;
+	int rc;
+
+	ring = &nqr->ring_struct;
+	rmem = &ring->ring_mem;
+
+	rc = bnge_alloc_nq_desc_arr(nqr, bn->cp_nr_pages);
+	if (rc)
+		return rc;
 
-		bnge_free_nq_desc_arr(&bnapi->nq_ring);
+	nqr->bnapi = bnapi;
+	rmem->nr_pages = bn->cp_nr_pages;
+	rmem->page_size = HW_CMPD_RING_SIZE;
+	rmem->pg_arr = (void **)nqr->desc_ring;
+	rmem->dma_arr = nqr->desc_mapping;
+	rmem->vmem_size = 0;
+	rmem->flags = BNGE_RMEM_RING_PTE_FLAG;
+	rc = bnge_alloc_ring(bn->bd, rmem);
+	if (rc) {
+		bnge_free_nq_desc_arr(nqr);
+		return rc;
 	}
+
+	ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
+	ring->map_idx = bnge_nq_irq_idx(bn->bd, bnapi->index);
+	return 0;
 }
 
-static int bnge_alloc_nq_arrays(struct bnge_net *bn)
+static void bnge_free_nqs(struct bnge_net *bn)
 {
 	struct bnge_dev *bd = bn->bd;
-	int i, rc;
+	int i;
 
-	for (i = 0; i < bd->nq_nr_rings; i++) {
-		struct bnge_napi *bnapi = bn->bnapi[i];
+	bnge_for_each_open_nq(i, bd)
+		bnge_free_nq(bn, bn->bnapi[i]);
+}
 
-		rc = bnge_alloc_nq_desc_arr(&bnapi->nq_ring, bn->cp_nr_pages);
+static int bnge_alloc_nqs(struct bnge_net *bn)
+{
+	struct bnge_dev *bd = bn->bd;
+	int i, rc;
+
+	bnge_for_each_open_nq(i, bd) {
+		rc = bnge_alloc_nq(bn, bn->bnapi[i]);
 		if (rc)
-			goto err_free_nq_arrays;
+			goto err_free_nqs;
 	}
 	return 0;
 
-err_free_nq_arrays:
-	bnge_free_nq_arrays(bn);
+err_free_nqs:
+	while (--i >= BNGE_FIRST_OPEN_NQ)
+		bnge_free_nq(bn, bn->bnapi[i]);
 	return rc;
 }
 
-static void bnge_free_nq_tree(struct bnge_net *bn)
+static void bnge_free_cp_rings(struct bnge_net *bn)
 {
 	struct bnge_dev *bd = bn->bd;
 	int i;
 
 	for (i = 0; i < bd->nq_nr_rings; i++) {
-		struct bnge_napi *bnapi = bn->bnapi[i];
-		struct bnge_nq_ring_info *nqr;
-		struct bnge_ring_struct *ring;
+		struct bnge_nq_ring_info *nqr = &bn->bnapi[i]->nq_ring;
 		int j;
 
-		nqr = &bnapi->nq_ring;
-		ring = &nqr->ring_struct;
-
-		bnge_free_ring(bd, &ring->ring_mem);
-
 		if (!nqr->cp_ring_arr)
 			continue;
 
 		for (j = 0; j < nqr->cp_ring_count; j++) {
 			struct bnge_cp_ring_info *cpr = &nqr->cp_ring_arr[j];
 
-			ring = &cpr->ring_struct;
-			bnge_free_ring(bd, &ring->ring_mem);
+			bnge_free_ring(bd, &cpr->ring_struct.ring_mem);
 			bnge_free_cp_desc_arr(cpr);
 		}
 		kfree(nqr->cp_ring_arr);
@@ -594,31 +622,21 @@ static int alloc_one_cp_ring(struct bnge_net *bn,
 	return rc;
 }
 
-static int bnge_alloc_nq_tree(struct bnge_net *bn)
+static int bnge_alloc_cp_rings(struct bnge_net *bn)
 {
 	struct bnge_dev *bd = bn->bd;
-	int i, j, ulp_msix, rc;
+	int i, j, rc;
 	int tcs = 1;
 
-	ulp_msix = bnge_aux_get_msix(bd);
 	for (i = 0, j = 0; i < bd->nq_nr_rings; i++) {
 		bool sh = !!(bd->flags & BNGE_EN_SHARED_CHNL);
 		struct bnge_napi *bnapi = bn->bnapi[i];
 		struct bnge_nq_ring_info *nqr;
 		struct bnge_cp_ring_info *cpr;
-		struct bnge_ring_struct *ring;
 		int cp_count = 0, k;
 		int rx = 0, tx = 0;
 
 		nqr = &bnapi->nq_ring;
-		nqr->bnapi = bnapi;
-		ring = &nqr->ring_struct;
-
-		rc = bnge_alloc_ring(bd, &ring->ring_mem);
-		if (rc)
-			goto err_free_nq_tree;
-
-		ring->map_idx = ulp_msix + i;
 
 		if (i < bd->rx_nr_rings) {
 			cp_count++;
@@ -634,7 +652,7 @@ static int bnge_alloc_nq_tree(struct bnge_net *bn)
 		nqr->cp_ring_arr = kzalloc_objs(*cpr, cp_count);
 		if (!nqr->cp_ring_arr) {
 			rc = -ENOMEM;
-			goto err_free_nq_tree;
+			goto err_free_cp_rings;
 		}
 
 		nqr->cp_ring_count = cp_count;
@@ -643,7 +661,7 @@ static int bnge_alloc_nq_tree(struct bnge_net *bn)
 			cpr = &nqr->cp_ring_arr[k];
 			rc = alloc_one_cp_ring(bn, cpr);
 			if (rc)
-				goto err_free_nq_tree;
+				goto err_free_cp_rings;
 
 			cpr->bnapi = bnapi;
 			cpr->cp_idx = k;
@@ -663,8 +681,8 @@ static int bnge_alloc_nq_tree(struct bnge_net *bn)
 	}
 	return 0;
 
-err_free_nq_tree:
-	bnge_free_nq_tree(bn);
+err_free_cp_rings:
+	bnge_free_cp_rings(bn);
 	return rc;
 }
 
@@ -1191,17 +1209,27 @@ static int bnge_init_ring_grps(struct bnge_net *bn)
 		bn->grp_info[i].agg_fw_ring_id = INVALID_HW_RING_ID;
 		bn->grp_info[i].nq_fw_ring_id = INVALID_HW_RING_ID;
 	}
+	/* NQ0 stays allocated in FW across open/close */
+	bn->grp_info[0].nq_fw_ring_id =
+		(u16)bn->nq0->nq_ring.ring_struct.fw_ring_id;
 
 	return 0;
 }
 
+static void bnge_nq0_clear_rings(struct bnge_net *bn)
+{
+	bn->nq0->rx_ring = NULL;
+	memset(bn->nq0->tx_ring, 0, sizeof(bn->nq0->tx_ring));
+	bn->nq0->events = 0;
+}
+
 static void bnge_free_core(struct bnge_net *bn)
 {
 	bnge_free_vnic_attributes(bn);
 	bnge_free_tx_rings(bn);
 	bnge_free_rx_rings(bn);
-	bnge_free_nq_tree(bn);
-	bnge_free_nq_arrays(bn);
+	bnge_free_cp_rings(bn);
+	bnge_free_nqs(bn);
 	bnge_free_ring_stats(bn);
 	bnge_free_ring_grps(bn);
 	bnge_free_vnics(bn);
@@ -1211,6 +1239,7 @@ static void bnge_free_core(struct bnge_net *bn)
 	bn->tx_ring = NULL;
 	kfree(bn->rx_ring);
 	bn->rx_ring = NULL;
+	bnge_nq0_clear_rings(bn);
 	kfree(bn->bnapi);
 	bn->bnapi = NULL;
 }
@@ -1225,20 +1254,20 @@ static int bnge_alloc_core(struct bnge_net *bn)
 	arr_size = L1_CACHE_ALIGN(sizeof(struct bnge_napi *) *
 			bd->nq_nr_rings);
 	size = L1_CACHE_ALIGN(sizeof(struct bnge_napi));
-	bnapi = kzalloc(arr_size + size * bd->nq_nr_rings, GFP_KERNEL);
+	bnapi = kzalloc(arr_size +
+			size * (bd->nq_nr_rings - BNGE_FIRST_OPEN_NQ),
+			GFP_KERNEL);
 	if (!bnapi)
 		return rc;
 
 	bn->bnapi = bnapi;
 	bnapi += arr_size;
-	for (i = 0; i < bd->nq_nr_rings; i++, bnapi += size) {
-		struct bnge_nq_ring_info *nqr;
-
+	bn->bnapi[0] = bn->nq0;
+	bnge_for_each_open_nq(i, bd) {
 		bn->bnapi[i] = bnapi;
 		bn->bnapi[i]->index = i;
 		bn->bnapi[i]->bn = bn;
-		nqr = &bn->bnapi[i]->nq_ring;
-		nqr->ring_struct.ring_mem.flags = BNGE_RMEM_RING_PTE_FLAG;
+		bnapi += size;
 	}
 
 	bn->rx_ring = kzalloc_objs(struct bnge_rx_ring_info, bd->rx_nr_rings);
@@ -1297,7 +1326,7 @@ static int bnge_alloc_core(struct bnge_net *bn)
 	if (rc)
 		goto err_free_ring_stats;
 
-	rc = bnge_alloc_nq_arrays(bn);
+	rc = bnge_alloc_nqs(bn);
 	if (rc)
 		goto err_free_vnics;
 
@@ -1305,13 +1334,13 @@ static int bnge_alloc_core(struct bnge_net *bn)
 
 	rc = bnge_alloc_rx_rings(bn);
 	if (rc)
-		goto err_free_nq_arrays;
+		goto err_free_nqs;
 
 	rc = bnge_alloc_tx_rings(bn);
 	if (rc)
 		goto err_free_rx_rings;
 
-	rc = bnge_alloc_nq_tree(bn);
+	rc = bnge_alloc_cp_rings(bn);
 	if (rc)
 		goto err_free_tx_rings;
 
@@ -1320,17 +1349,17 @@ static int bnge_alloc_core(struct bnge_net *bn)
 						  BNGE_VNIC_UCAST_FLAG;
 	rc = bnge_alloc_vnic_attributes(bn);
 	if (rc)
-		goto err_free_nq_tree;
+		goto err_free_cp_rings;
 	return 0;
 
-err_free_nq_tree:
-	bnge_free_nq_tree(bn);
+err_free_cp_rings:
+	bnge_free_cp_rings(bn);
 err_free_tx_rings:
 	bnge_free_tx_rings(bn);
 err_free_rx_rings:
 	bnge_free_rx_rings(bn);
-err_free_nq_arrays:
-	bnge_free_nq_arrays(bn);
+err_free_nqs:
+	bnge_free_nqs(bn);
 err_free_vnics:
 	bnge_free_vnics(bn);
 err_free_ring_stats:
@@ -1345,6 +1374,7 @@ static int bnge_alloc_core(struct bnge_net *bn)
 	kfree(bn->rx_ring);
 	bn->rx_ring = NULL;
 err_free_bnapi:
+	bnge_nq0_clear_rings(bn);
 	kfree(bn->bnapi);
 	bn->bnapi = NULL;
 	return rc;
@@ -1389,21 +1419,18 @@ static int bnge_cp_num_to_irq_num(struct bnge_net *bn, int n)
 	return nqr->ring_struct.map_idx;
 }
 
-static void bnge_init_nq_tree(struct bnge_net *bn)
+static void bnge_init_cp_rings(struct bnge_net *bn)
 {
 	struct bnge_dev *bd = bn->bd;
 	int i, j;
 
 	for (i = 0; i < bd->nq_nr_rings; i++) {
 		struct bnge_nq_ring_info *nqr = &bn->bnapi[i]->nq_ring;
-		struct bnge_ring_struct *ring = &nqr->ring_struct;
 
-		ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
 		for (j = 0; j < nqr->cp_ring_count; j++) {
 			struct bnge_cp_ring_info *cpr = &nqr->cp_ring_arr[j];
 
-			ring = &cpr->ring_struct;
-			ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
+			cpr->ring_struct.fw_ring_id = INVALID_HW_RING_ID_32BIT;
 		}
 	}
 }
@@ -1914,6 +1941,44 @@ static int bnge_hwrm_rx_ring_alloc(struct bnge_net *bn,
 	return 0;
 }
 
+static int bnge_hwrm_nq_alloc(struct bnge_net *bn, struct bnge_napi *bnapi)
+{
+	struct bnge_nq_ring_info *nqr = &bnapi->nq_ring;
+	u32 type = HWRM_RING_ALLOC_NQ;
+	struct bnge_ring_struct *ring;
+	unsigned int vector;
+	u32 map_idx;
+	int rc;
+
+	ring = &nqr->ring_struct;
+	map_idx = ring->map_idx;
+
+	vector = bn->bd->irq_tbl[map_idx].vector;
+	disable_irq_nosync(vector);
+	rc = hwrm_ring_alloc_send_msg(bn, ring, type, map_idx);
+	if (rc) {
+		enable_irq(vector);
+		return rc;
+	}
+	bnge_set_db(bn, &nqr->nq_db, type, map_idx, ring->fw_ring_id);
+	bnge_db_nq(bn, &nqr->nq_db, nqr->nq_raw_cons);
+	enable_irq(vector);
+
+	return 0;
+}
+
+static void bnge_hwrm_nq_free(struct bnge_net *bn, struct bnge_napi *bnapi)
+{
+	struct bnge_ring_struct *ring = &bnapi->nq_ring.ring_struct;
+
+	if (ring->fw_ring_id == INVALID_HW_RING_ID_32BIT)
+		return;
+
+	hwrm_ring_free_send_msg(bn, ring, RING_FREE_REQ_RING_TYPE_NQ,
+				INVALID_HW_RING_ID);
+	ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
+}
+
 static int bnge_hwrm_ring_alloc(struct bnge_net *bn)
 {
 	struct bnge_dev *bd = bn->bd;
@@ -1921,31 +1986,14 @@ static int bnge_hwrm_ring_alloc(struct bnge_net *bn)
 	int i, rc = 0;
 
 	agg_rings = !!(bnge_is_agg_reqd(bd));
-	for (i = 0; i < bd->nq_nr_rings; i++) {
+	bnge_for_each_open_nq(i, bd) {
 		struct bnge_napi *bnapi = bn->bnapi[i];
-		struct bnge_nq_ring_info *nqr = &bnapi->nq_ring;
-		struct bnge_ring_struct *ring = &nqr->ring_struct;
-		u32 type = HWRM_RING_ALLOC_NQ;
-		u32 map_idx = ring->map_idx;
-		unsigned int vector;
 
-		vector = bd->irq_tbl[map_idx].vector;
-		disable_irq_nosync(vector);
-		rc = hwrm_ring_alloc_send_msg(bn, ring, type, map_idx);
-		if (rc) {
-			enable_irq(vector);
+		rc = bnge_hwrm_nq_alloc(bn, bnapi);
+		if (rc)
 			goto err_out;
-		}
-		bnge_set_db(bn, &nqr->nq_db, type, map_idx, ring->fw_ring_id);
-		bnge_db_nq(bn, &nqr->nq_db, nqr->nq_raw_cons);
-		enable_irq(vector);
-		bn->grp_info[i].nq_fw_ring_id = (u16)ring->fw_ring_id;
-
-		if (!i) {
-			rc = bnge_hwrm_set_async_event_cr(bd, ring->fw_ring_id);
-			if (rc)
-				netdev_warn(bn->netdev, "Failed to set async event completion ring.\n");
-		}
+		bn->grp_info[i].nq_fw_ring_id =
+			(u16)bnapi->nq_ring.ring_struct.fw_ring_id;
 	}
 
 	for (i = 0; i < bd->tx_nr_rings; i++) {
@@ -2388,7 +2436,7 @@ static void bnge_enable_int(struct bnge_net *bn)
 	struct bnge_dev *bd = bn->bd;
 	int i;
 
-	for (i = 0; i < bd->nq_nr_rings; i++) {
+	bnge_for_each_open_nq(i, bd) {
 		struct bnge_napi *bnapi = bn->bnapi[i];
 		struct bnge_nq_ring_info *nqr;
 
@@ -2405,7 +2453,7 @@ static void bnge_disable_napi(struct bnge_net *bn)
 	if (test_and_set_bit(BNGE_STATE_NAPI_DISABLED, &bn->state))
 		return;
 
-	for (i = 0; i < bd->nq_nr_rings; i++) {
+	bnge_for_each_open_nq(i, bd) {
 		struct bnge_napi *bnapi = bn->bnapi[i];
 
 		napi_disable_locked(&bnapi->napi);
@@ -2418,7 +2466,7 @@ static void bnge_enable_napi(struct bnge_net *bn)
 	int i;
 
 	clear_bit(BNGE_STATE_NAPI_DISABLED, &bn->state);
-	for (i = 0; i < bd->nq_nr_rings; i++) {
+	bnge_for_each_open_nq(i, bd) {
 		struct bnge_napi *bnapi = bn->bnapi[i];
 
 		bnapi->in_reset = false;
@@ -2566,23 +2614,16 @@ static void bnge_hwrm_ring_free(struct bnge_net *bn, bool close_path)
 	bnge_disable_int_sync(bn);
 
 	for (i = 0; i < bd->nq_nr_rings; i++) {
-		struct bnge_napi *bnapi = bn->bnapi[i];
-		struct bnge_nq_ring_info *nqr;
-		struct bnge_ring_struct *ring;
+		struct bnge_nq_ring_info *nqr = &bn->bnapi[i]->nq_ring;
 		int j;
 
-		nqr = &bnapi->nq_ring;
 		for (j = 0; j < nqr->cp_ring_count && nqr->cp_ring_arr; j++)
 			bnge_hwrm_cp_ring_free(bn, &nqr->cp_ring_arr[j]);
+	}
 
-		ring = &nqr->ring_struct;
-		if (ring->fw_ring_id != INVALID_HW_RING_ID_32BIT) {
-			hwrm_ring_free_send_msg(bn, ring,
-						RING_FREE_REQ_RING_TYPE_NQ,
-						INVALID_HW_RING_ID);
-			ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
-			bn->grp_info[i].nq_fw_ring_id = INVALID_HW_RING_ID;
-		}
+	bnge_for_each_open_nq(i, bd) {
+		bnge_hwrm_nq_free(bn, bn->bnapi[i]);
+		bn->grp_info[i].nq_fw_ring_id = INVALID_HW_RING_ID;
 	}
 }
 
@@ -2593,7 +2634,10 @@ static void bnge_setup_msix(struct bnge_net *bn)
 	int len, i;
 
 	len = sizeof(bd->irq_tbl[0].name);
-	for (i = 0; i < bd->nq_nr_rings; i++) {
+	/* NQ0 keeps the "<pci_name>-nq0" name set in bnge_nq0_init(). Only the
+	 * NQs created in open are named after the netdev here.
+	 */
+	bnge_for_each_open_nq(i, bd) {
 		int map_idx = bnge_cp_num_to_irq_num(bn, i);
 		char *attr;
 
@@ -2627,27 +2671,59 @@ static void bnge_hwrm_resource_free(struct bnge_net *bn, bool close_path)
 	bnge_hwrm_stat_ctx_free(bn);
 }
 
-static void bnge_free_irq(struct bnge_net *bn)
+static void bnge_nq_free_irq(struct bnge_net *bn, struct bnge_napi *bnapi)
+{
+	int map_idx = bnapi->nq_ring.ring_struct.map_idx;
+	struct bnge_irq *irq = &bn->bd->irq_tbl[map_idx];
+
+	if (irq->requested) {
+		if (irq->have_cpumask) {
+			irq_set_affinity_hint(irq->vector, NULL);
+			free_cpumask_var(irq->cpu_mask);
+			irq->have_cpumask = 0;
+		}
+		free_irq(irq->vector, bnapi);
+	}
+
+	irq->requested = 0;
+}
+
+static int bnge_nq_request_irq(struct bnge_net *bn, struct bnge_napi *bnapi)
 {
+	int map_idx = bnapi->nq_ring.ring_struct.map_idx;
 	struct bnge_dev *bd = bn->bd;
 	struct bnge_irq *irq;
-	int i;
+	int rc;
 
-	for (i = 0; i < bd->nq_nr_rings; i++) {
-		int map_idx = bnge_cp_num_to_irq_num(bn, i);
+	irq = &bd->irq_tbl[map_idx];
 
-		irq = &bd->irq_tbl[map_idx];
-		if (irq->requested) {
-			if (irq->have_cpumask) {
-				irq_set_affinity_hint(irq->vector, NULL);
-				free_cpumask_var(irq->cpu_mask);
-				irq->have_cpumask = 0;
-			}
-			free_irq(irq->vector, bn->bnapi[i]);
-		}
+	rc = request_irq(irq->vector, irq->handler, 0, irq->name, bnapi);
+	if (rc)
+		return rc;
+
+	netif_napi_set_irq_locked(&bnapi->napi, irq->vector);
+	irq->requested = 1;
 
-		irq->requested = 0;
+	if (zalloc_cpumask_var(&irq->cpu_mask, GFP_KERNEL)) {
+		int numa_node = dev_to_node(&bd->pdev->dev);
+
+		irq->have_cpumask = 1;
+		cpumask_set_cpu(cpumask_local_spread(bnapi->index, numa_node),
+				irq->cpu_mask);
+		if (irq_set_affinity_hint(irq->vector, irq->cpu_mask))
+			bnge_warn(bd, "Set affinity failed, IRQ = %d\n",
+				  irq->vector);
 	}
+	return 0;
+}
+
+static void bnge_free_irq(struct bnge_net *bn)
+{
+	struct bnge_dev *bd = bn->bd;
+	int i;
+
+	bnge_for_each_open_nq(i, bd)
+		bnge_nq_free_irq(bn, bn->bnapi[i]);
 }
 
 static int bnge_request_irq(struct bnge_net *bn)
@@ -2660,30 +2736,10 @@ static int bnge_request_irq(struct bnge_net *bn)
 		netdev_err(bn->netdev, "bnge_setup_interrupts err: %d\n", rc);
 		return rc;
 	}
-	for (i = 0; i < bd->nq_nr_rings; i++) {
-		int map_idx = bnge_cp_num_to_irq_num(bn, i);
-		struct bnge_irq *irq = &bd->irq_tbl[map_idx];
-
-		rc = request_irq(irq->vector, irq->handler, 0, irq->name,
-				 bn->bnapi[i]);
+	bnge_for_each_open_nq(i, bd) {
+		rc = bnge_nq_request_irq(bn, bn->bnapi[i]);
 		if (rc)
 			goto err_free_irq;
-
-		netif_napi_set_irq_locked(&bn->bnapi[i]->napi, irq->vector);
-		irq->requested = 1;
-
-		if (zalloc_cpumask_var(&irq->cpu_mask, GFP_KERNEL)) {
-			int numa_node = dev_to_node(&bd->pdev->dev);
-
-			irq->have_cpumask = 1;
-			cpumask_set_cpu(cpumask_local_spread(i, numa_node),
-					irq->cpu_mask);
-			if (irq_set_affinity_hint(irq->vector, irq->cpu_mask)) {
-				netdev_warn(bn->netdev,
-					    "Set affinity failed, IRQ = %d\n",
-					    irq->vector);
-			}
-		}
 	}
 	return 0;
 
@@ -2799,7 +2855,7 @@ static void bnge_init_napi(struct bnge_net *bn)
 	struct bnge_napi *bnapi;
 	int i;
 
-	for (i = 0; i < bd->nq_nr_rings; i++) {
+	bnge_for_each_open_nq(i, bd) {
 		bnapi = bn->bnapi[i];
 		netif_napi_add_config_locked(bn->netdev, &bnapi->napi,
 					     bnge_napi_poll, bnapi->index);
@@ -2816,7 +2872,7 @@ static void bnge_del_napi(struct bnge_net *bn)
 	for (i = 0; i < bd->tx_nr_rings; i++)
 		netif_queue_set_napi(bn->netdev, i, NETDEV_QUEUE_TYPE_TX, NULL);
 
-	for (i = 0; i < bd->nq_nr_rings; i++) {
+	bnge_for_each_open_nq(i, bd) {
 		struct bnge_napi *bnapi = bn->bnapi[i];
 
 		__netif_napi_del_locked(&bnapi->napi);
@@ -2826,11 +2882,134 @@ static void bnge_del_napi(struct bnge_net *bn)
 	synchronize_net();
 }
 
+static void bnge_nq0_quiesce(struct bnge_net *bn)
+{
+	napi_disable_locked(&bn->nq0->napi);
+	/* Wait for RCU grace period after napi_disable_locked(): a poll can
+	 * still be arming the NQ doorbell after it clears NAPI_STATE_SCHED.
+	 */
+	synchronize_net();
+	bnge_db_nq(bn, &bn->nq0->nq_ring.nq_db, bn->nq0->nq_ring.nq_raw_cons);
+}
+
+static void bnge_nq0_resume(struct bnge_net *bn)
+{
+	struct bnge_nq_ring_info *nqr = &bn->nq0->nq_ring;
+
+	bn->nq0->in_reset = false;
+	bn->nq0->tx_fault = 0;
+	napi_enable_locked(&bn->nq0->napi);
+	bnge_db_nq_arm(bn, &nqr->nq_db, nqr->nq_raw_cons);
+}
+
+static int bnge_nq0_init(struct bnge_net *bn)
+{
+	struct net_device *dev = bn->netdev;
+	struct bnge_nq_ring_info *nqr;
+	struct bnge_dev *bd = bn->bd;
+	struct bnge_napi *bnapi;
+	struct bnge_irq *irq;
+	int rc;
+
+	bnapi = kzalloc_obj(*bnapi);
+	if (!bnapi)
+		return -ENOMEM;
+
+	/* NQ0 helpers hard-code NQ index 0 */
+	BUILD_BUG_ON(BNGE_FIRST_OPEN_NQ != 1);
+
+	bnapi->bn = bn;
+	bnapi->index = 0;
+	bn->nq0 = bnapi;
+	nqr = &bnapi->nq_ring;
+
+	rc = bnge_alloc_nq(bn, bnapi);
+	if (rc)
+		goto err_free_bnapi;
+
+	irq = &bd->irq_tbl[nqr->ring_struct.map_idx];
+	irq->handler = bnge_msix;
+	snprintf(irq->name, sizeof(irq->name), "%s-nq0", pci_name(bd->pdev));
+
+	/* The netdev is not registered yet, but the *_locked() NAPI helpers
+	 * expect the instance lock to be held.
+	 */
+	netdev_lock(dev);
+	netif_napi_add_config_locked(dev, &bnapi->napi, bnge_napi_poll,
+				     bnapi->index);
+
+	rc = bnge_nq_request_irq(bn, bnapi);
+	if (rc)
+		goto err_del_napi;
+
+	rc = bnge_hwrm_nq_alloc(bn, bnapi);
+	if (rc)
+		goto err_free_irq;
+
+	rc = bnge_hwrm_set_async_event_cr(bd, nqr->ring_struct.fw_ring_id);
+	if (rc) {
+		bnge_err(bd, "Failed to set async event completion ring: %d\n",
+			 rc);
+		goto err_free_irq;
+	}
+
+	/* Enable NAPI only now that the NQ doorbell is set up, so an early
+	 * interrupt cannot make the poll arm an uninitialized doorbell.
+	 */
+	napi_enable_locked(&bnapi->napi);
+	bnge_db_nq_arm(bn, &nqr->nq_db, nqr->nq_raw_cons);
+	netdev_unlock(dev);
+	return 0;
+
+err_free_irq:
+	bnge_nq_free_irq(bn, bnapi);
+	__netif_napi_del_locked(&bnapi->napi);
+	netdev_unlock(dev);
+	/* Same order as bnge_nq0_uninit(): no poll may touch the NQ once the
+	 * FW ring is freed.
+	 */
+	synchronize_net();
+	bnge_hwrm_nq_free(bn, bnapi);
+	bnge_free_nq(bn, bnapi);
+	goto err_free_bnapi;
+err_del_napi:
+	__netif_napi_del_locked(&bnapi->napi);
+	netdev_unlock(dev);
+	synchronize_net();
+	bnge_free_nq(bn, bnapi);
+err_free_bnapi:
+	kfree(bnapi);
+	bn->nq0 = NULL;
+	return rc;
+}
+
+static void bnge_nq0_uninit(struct bnge_net *bn)
+{
+	struct net_device *dev = bn->netdev;
+	struct bnge_napi *bnapi = bn->nq0;
+
+	netdev_lock(dev);
+	napi_disable_locked(&bnapi->napi);
+	bnge_nq_free_irq(bn, bnapi);
+	__netif_napi_del_locked(&bnapi->napi);
+	netdev_unlock(dev);
+	/* Wait for RCU grace period after removing the NAPI instance, and for
+	 * a poll that may still be arming the NQ doorbell, before destroying
+	 * the FW ring.
+	 */
+	synchronize_net();
+
+	bnge_hwrm_nq_free(bn, bnapi);
+	bnge_free_nq(bn, bnapi);
+	kfree(bnapi);
+	bn->nq0 = NULL;
+}
+
 static int bnge_init_nic(struct bnge_net *bn)
 {
 	int rc;
 
-	bnge_init_nq_tree(bn);
+	bnge_init_cp_rings(bn);
 
 	bnge_init_rx_rings(bn);
 	rc = bnge_alloc_rx_ring_pair_bufs(bn);
@@ -2932,10 +3111,17 @@ static int bnge_open_core(struct bnge_net *bn)
 		goto err_if_change;
 	}
 
+	bnge_nq0_quiesce(bn);
+
+	/* Drop async events NQ0 received while down. Its NAPI is quiesced, so
+	 * nothing can set bits concurrently.
+	 */
+	WRITE_ONCE(bn->sp_event, 0);
+
 	rc = bnge_alloc_core(bn);
 	if (rc) {
 		netdev_err(bn->netdev, "bnge_alloc_core err: %d\n", rc);
-		goto err_if_change;
+		goto err_nq0_resume;
 	}
 
 	bnge_init_napi(bn);
@@ -2967,6 +3153,8 @@ static int bnge_open_core(struct bnge_net *bn)
 	set_bit(BNGE_STATE_STATS_ENABLE, &bn->state);
 
 	bnge_enable_int(bn);
+	/* Resume NQ0 with the other NQs, once BNGE_STATE_OPEN is set */
+	bnge_nq0_resume(bn);
 
 	bnge_tx_enable(bn);
 
@@ -2978,10 +3166,13 @@ static int bnge_open_core(struct bnge_net *bn)
 	return 0;
 
 err_free_irq:
+	bnge_nq_drain(bn, bn->nq0);
 	bnge_free_irq(bn);
 err_del_napi:
 	bnge_del_napi(bn);
 	bnge_free_core(bn);
+err_nq0_resume:
+	bnge_nq0_resume(bn);
 err_if_change:
 	bnge_hwrm_if_change(bd, false);
 	return rc;
@@ -3194,6 +3385,8 @@ static void bnge_close_core(struct bnge_net *bn)
 	timer_delete_sync(&bn->timer);
 	bnge_shutdown_nic(bn);
 	bnge_disable_napi(bn);
+	bnge_nq0_quiesce(bn);
+	bnge_nq_drain(bn, bn->nq0);
 
 	/* Save ring stats before shutdown */
 	spin_lock_bh(&bn->stats_lock);
@@ -3206,6 +3399,7 @@ static void bnge_close_core(struct bnge_net *bn)
 	bnge_del_napi(bn);
 
 	bnge_free_core(bn);
+	bnge_nq0_resume(bn);
 }
 
 static int bnge_close(struct net_device *dev)
@@ -3215,7 +3409,6 @@ static int bnge_close(struct net_device *dev)
 	bnge_close_core(bn);
 	bnge_hwrm_shutdown_link(bn->bd);
 	bnge_hwrm_if_change(bn->bd, false);
-	bn->sp_event = 0;
 
 	return 0;
 }
@@ -3549,14 +3742,23 @@ int bnge_netdev_alloc(struct bnge_dev *bd, int max_irqs)
 	spin_lock_init(&bn->stats_lock);
 
 	netdev->request_ops_lock = true;
+
+	rc = bnge_nq0_init(bn);
+	if (rc) {
+		dev_err(bd->dev, "NQ0 init failed rc: %d\n", rc);
+		goto err_free_port_stats;
+	}
+
 	rc = register_netdev(netdev);
 	if (rc) {
 		dev_err(bd->dev, "Register netdev failed rc: %d\n", rc);
-		goto err_free_port_stats;
+		goto err_uninit_nq0;
 	}
 
 	return 0;
 
+err_uninit_nq0:
+	bnge_nq0_uninit(bn);
 err_free_port_stats:
 	bnge_free_port_stats(bn);
 err_free_workq:
@@ -3576,6 +3778,9 @@ void bnge_netdev_free(struct bnge_dev *bd)
 
 	unregister_netdev(netdev);
 
+	/* NQ0 can queue sp_task; destroy it before the timer and workqueue */
+	bnge_nq0_uninit(bn);
+
 	timer_shutdown_sync(&bn->timer);
 	cancel_work_sync(&bn->sp_task);
 	bn->sp_event = 0;
diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h
index 476b5bab96fed..118a2e4f5331f 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h
@@ -315,6 +315,8 @@ struct bnge_net {
 	u32			hash_seed;
 	u64			toeplitz_prefix;
 
+	/* Lives from probe to remove. bnapi[0] points to it. */
+	struct bnge_napi		*nq0;
 	struct bnge_napi		**bnapi;
 
 	struct bnge_rx_ring_info	*rx_ring;
diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_rmem.c b/drivers/net/ethernet/broadcom/bnge/bnge_rmem.c
index b066ee887a099..bbae84b4157ea 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_rmem.c
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_rmem.c
@@ -431,20 +431,10 @@ void bnge_init_ring_struct(struct bnge_net *bn)
 	for (i = 0; i < bd->nq_nr_rings; i++) {
 		struct bnge_napi *bnapi = bn->bnapi[i];
 		struct bnge_ring_mem_info *rmem;
-		struct bnge_nq_ring_info *nqr;
 		struct bnge_rx_ring_info *rxr;
 		struct bnge_tx_ring_info *txr;
 		struct bnge_ring_struct *ring;
 
-		nqr = &bnapi->nq_ring;
-		ring = &nqr->ring_struct;
-		rmem = &ring->ring_mem;
-		rmem->nr_pages = bn->cp_nr_pages;
-		rmem->page_size = HW_CMPD_RING_SIZE;
-		rmem->pg_arr = (void **)nqr->desc_ring;
-		rmem->dma_arr = nqr->desc_mapping;
-		rmem->vmem_size = 0;
-
 		rxr = bnapi->rx_ring;
 		if (!rxr)
 			goto skip_rx;
diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_txrx.c b/drivers/net/ethernet/broadcom/bnge/bnge_txrx.c
index 472b02cc43b3c..9324ee889034e 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_txrx.c
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_txrx.c
@@ -1135,8 +1135,8 @@ static void bnge_async_event_process(struct bnge_net *bn,
 	u32 data1 = le32_to_cpu(cmpl->event_data1);
 	u32 data2 = le32_to_cpu(cmpl->event_data2);
 
-	netdev_dbg(bn->netdev, "hwrm event 0x%x {0x%x, 0x%x}\n",
-		   event_id, data1, data2);
+	bnge_dbg(bn->bd, "hwrm event 0x%x {0x%x, 0x%x}\n",
+		 event_id, data1, data2);
 
 	switch (event_id) {
 	case ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE:
@@ -1375,6 +1375,13 @@ int bnge_napi_poll(struct napi_struct *napi, int budget)
 				break;
 
 			idx = BNGE_NQ_HDL_IDX(idx);
+			/* NQ0 outlives its completion rings: ignore a stale
+			 * notification for a CQ that no longer exists.
+			 */
+			if (unlikely(idx >= nqr->cp_ring_count)) {
+				raw_cons = NEXT_RAW_CMP(raw_cons);
+				continue;
+			}
 			cpr = &nqr->cp_ring_arr[idx];
 			cpr->had_nqe_notify = 1;
 			cpr->toggle = NQE_CN_TOGGLE(type);
@@ -1396,6 +1403,41 @@ int bnge_napi_poll(struct napi_struct *napi, int budget)
 	return work_done;
 }
 
+/* Consume pending NQ entries without polling the CP rings. The NQ's NAPI must
+ * be disabled (or quiesced) by the caller. HWRM events are handled, CQ
+ * notifications are dropped. cpr->had_nqe_notify is not reset, so the CP rings
+ * must be freed or re-initialised afterwards.
+ */
+void bnge_nq_drain(struct bnge_net *bn, struct bnge_napi *bnapi)
+{
+	struct bnge_nq_ring_info *nqr = &bnapi->nq_ring;
+	u32 raw_cons = nqr->nq_raw_cons;
+
+	while (1) {
+		u32 cons = RING_CMP(bn, raw_cons);
+		struct nqe_cn *nqcmp;
+		u16 type;
+
+		nqcmp = &nqr->desc_ring[CP_RING(cons)][CP_IDX(cons)];
+		if (!NQ_CMP_VALID(bn, nqcmp, raw_cons))
+			break;
+
+		/* The valid test of the entry must be done first before
+		 * reading any further.
+		 */
+		dma_rmb();
+
+		type = le16_to_cpu(nqcmp->type);
+		if (NQE_CN_TYPE(type) != NQ_CN_TYPE_CQ_NOTIFICATION)
+			bnge_hwrm_handler(bn, (struct tx_cmp *)nqcmp);
+		raw_cons = NEXT_RAW_CMP(raw_cons);
+	}
+
+	nqr->has_more_work = 0;
+	nqr->nq_raw_cons = raw_cons;
+	BNGE_DB_NQ(bn->bd, &nqr->nq_db, raw_cons);
+}
+
 static u16 bnge_xmit_get_cfa_action(struct sk_buff *skb)
 {
 	struct metadata_dst *md_dst = skb_metadata_dst(skb);
diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_txrx.h b/drivers/net/ethernet/broadcom/bnge/bnge_txrx.h
index bd0aa6c221a49..5779b78fb6a2d 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_txrx.h
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_txrx.h
@@ -120,6 +120,7 @@ irqreturn_t bnge_msix(int irq, void *dev_instance);
 netdev_tx_t bnge_start_xmit(struct sk_buff *skb, struct net_device *dev);
 void bnge_reuse_rx_data(struct bnge_rx_ring_info *rxr, u16 cons, void *data);
 int bnge_napi_poll(struct napi_struct *napi, int budget);
+void bnge_nq_drain(struct bnge_net *bn, struct bnge_napi *bnapi);
 netdev_features_t bnge_features_check(struct sk_buff *skb,
 				      struct net_device *dev,
 				      netdev_features_t features);

3/2 2026/10/14 00:40 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 17983
							output: 34
							thoughts: 316
						

Thoughts:
**Evaluating the Fuzzing Potential of This Patch Series**

Okay, let's take a look at this patch series and see if it's a good candidate for syzkaller fuzzing. The first thing I need to do is understand the scope of the changes. It looks like it's touching the `drivers/net/ethernet/broadcom/bnge/` directory. Right, let's see which files are affected: `bnge.h`, `bnge_auxr.c`, `bnge_hwrm_lib.c`, `bnge_netdev.c`, `bnge_netdev.h`, `bnge_rmem.c`, `bnge_txrx.c`, and `bnge_txrx.h`.

Hmm, now the question is: what is `bnge`? Is it the Broadcom NetXtreme Gigabit Ethernet driver, or something else entirely? I need to clarify that before I can really assess the fuzzing potential. I'll quickly check the `Kconfig` file in that directory using `grepper` or `read-file` to confirm. Once I know what kind of device this is, I can determine if the changes warrant further investigation for fuzzing.



4/2 2026/10/14 00:40 tool grepper
0m Args:
{
  "Expression": "config BNGE",
  "PathPrefixes": [
    "drivers/net/ethernet/broadcom/"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/broadcom/Kconfig=250=config BNXT_HWMON\n--\ndrivers/net/ethernet/broadcom/Kconfig-257-\ndrivers/net/ethernet/broadcom/Kconfig:258:config BNGE\ndrivers/net/ethernet/broadcom/Kconfig-259-\ttristate \"Broadcom ThorUltra Ethernet device support\"\n"
}

5/2 2026/10/14 00:40 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 18705
							output: 40
							thoughts: 35
						

Thoughts:
Okay, here's my interpretation of that thought process, assuming I'm deep in networking hardware and kernel configuration:

**Investigating the BNGE Network Driver's Hardware Dependency**

Alright, I need to understand exactly what hardware the `BNGE` driver is intended to support. Let's start by digging into the Kconfig file for Broadcom Ethernet drivers. I'm going to jump straight to the relevant area – around line 258 in `drivers/net/ethernet/broadcom/Kconfig` should be a good starting point. That's where I'd expect to see the configuration options related to that specific driver and, ideally, a clear indication of which Broadcom silicon it's designed to interface with. From there, I'll be able to infer and evaluate the compatibility and intended use of `BNGE`.



6/2 2026/10/14 00:41 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/broadcom/Kconfig",
  "FirstLine": 255,
  "LineCount": 30
}

Results:
{
  "Contents": " 255:\t\t  Say Y if you want to expose the thermal sensor data on NetXtreme-C/E\n 256:\t\t  devices, via the hwmon sysfs interface.\n 257:\t\n 258:\tconfig BNGE\n 259:\t\ttristate \"Broadcom ThorUltra Ethernet device support\"\n 260:\t\tdepends on PCI\n 261:\t\tselect NET_DEVLINK\n 262:\t\tselect PAGE_POOL\n 263:\t\tselect AUXILIARY_BUS\n 264:\t\thelp\n 265:\t\t  This driver supports Broadcom ThorUltra 50/100/200/400/800 gigabit\n 266:\t\t  Ethernet cards. The module will be called bng_en. To compile this\n 267:\t\t  driver as a module, choose M here.\n 268:\t\n 269:\tconfig BCMASP\n 270:\t\ttristate \"Broadcom ASP 2.0 Ethernet support\"\n 271:\t\tdepends on ARCH_BRCMSTB || COMPILE_TEST\n 272:\t\tdefault ARCH_BRCMSTB\n 273:\t\tdepends on OF\n 274:\t\tselect PHYLIB\n 275:\t\tselect MDIO_BCM_UNIMAC\n 276:\t\tselect PAGE_POOL\n 277:\t\thelp\n 278:\t\t  This configuration enables the Broadcom ASP 2.0 Ethernet controller\n 279:\t\t  driver which is present in Broadcom STB SoCs such as 72165.\n 280:\t\n 281:\tendif # NET_VENDOR_BROADCOM\n"
}

7/2 2026/10/14 00:41 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 19384
							output: 38
							thoughts: 301
						

Thoughts:
**Analyzing the Fuzzing Potential of the CONFIG_BNGE Driver**

Okay, let's dive into this `CONFIG_BNGE` driver. The description says it supports Broadcom ThorUltra Ethernet cards – 50, 100, 200, 400, and 800 gigabit. The module will be `bng_en`. My initial thought is, is this ThorUltra hardware specifically PCIe? That's the critical question here for fuzzing potential.

I need to apply the fuzzing rules. I have to look at the "WHEN TO RETURN WorthFuzzing=false" criteria. Specifically, I need to check if this driver falls under the "Structurally unreachable hardware" category. The rules explicitly mention vendor-specific PCIe switches, SmartNICs, or GPU drivers that require physical ASICs/PCIe cards and aren't emulated in standard QEMU. That's a red flag. Does this fit that description?

To determine if this is a problem, I need to investigate how `bnge` registers devices, and critically, what PCI IDs it binds to. Is this something that can be emulated or probed through virtual devices in QEMU? This is the critical line of questioning. My next step will be to grep for the `bnge` probe function and its PCI ID table. That'll tell me if it *could* theoretically be exercised in a virtual environment, or if it's inextricably tied to specific, un-emulatable hardware. I need to understand the hardware dependencies before I can make a call.



8/2 2026/10/14 00:41 tool grepper
0m Args:
{
  "Expression": "MODULE_DEVICE_TABLE",
  "PathPrefixes": [
    "drivers/net/ethernet/broadcom/bnge"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/broadcom/bnge/bnge_core.c=26=static const struct pci_device_id bnge_pci_tbl[] = {\n--\ndrivers/net/ethernet/broadcom/bnge/bnge_core.c-30-};\ndrivers/net/ethernet/broadcom/bnge/bnge_core.c:31:MODULE_DEVICE_TABLE(pci, bnge_pci_tbl);\ndrivers/net/ethernet/broadcom/bnge/bnge_core.c-32-\n"
}

9/2 2026/10/14 00:41 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 20204
							output: 45
							thoughts: 21
						

Thoughts:
Here's a summary of my current thought process, tailored for an expert audience:

**Analyzing `bnge_core.c` Line 20-50**

Okay, I'm focusing in on `bnge_core.c` specifically, and I'm directing my attention to lines 20 through 50. Given what I know about this code base and the potential issues that typically arise in this area, my mind is immediately jumping to a few possibilities. I'm likely looking for the initialization or setup of a critical data structure or hardware interaction. Perhaps this section handles early register configuration, or potentially the allocation and linking of buffers used in DMA transfers. I'm anticipating possibly seeing some potential race conditions if the code is poorly written, or even something that seems innocuous now but could later lead to subtle issues. It could also relate to power-up sequencing for the card itself. Let's see what's actually in there. I'll be looking for any hints about interrupt handling too. Knowing this system, what would be the most common cause of errors in this region? Let's check the code.



10/2 2026/10/14 00:42 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/broadcom/bnge/bnge_core.c",
  "FirstLine": 1,
  "LineCount": 50
}

Results:
{
  "Contents": "   1:\t// SPDX-License-Identifier: GPL-2.0\n   2:\t// Copyright (c) 2025 Broadcom.\n   3:\t\n   4:\t#include \u003clinux/init.h\u003e\n   5:\t#include \u003clinux/crash_dump.h\u003e\n   6:\t#include \u003clinux/module.h\u003e\n   7:\t#include \u003clinux/pci.h\u003e\n   8:\t\n   9:\t#include \"bnge.h\"\n  10:\t#include \"bnge_devlink.h\"\n  11:\t#include \"bnge_hwrm.h\"\n  12:\t#include \"bnge_hwrm_lib.h\"\n  13:\t#include \"bnge_link.h\"\n  14:\t\n  15:\tMODULE_LICENSE(\"GPL\");\n  16:\tMODULE_DESCRIPTION(DRV_SUMMARY);\n  17:\t\n  18:\tchar bnge_driver_name[] = DRV_NAME;\n  19:\t\n  20:\tstatic const struct {\n  21:\t\tchar *name;\n  22:\t} board_info[] = {\n  23:\t\t[BCM57708] = { \"Broadcom BCM57708 ThorUltra 50Gb/100Gb/200Gb/400Gb/800Gb Ethernet\" },\n  24:\t};\n  25:\t\n  26:\tstatic const struct pci_device_id bnge_pci_tbl[] = {\n  27:\t\t{ PCI_VDEVICE(BROADCOM, 0x1780), .driver_data = BCM57708 },\n  28:\t\t/* Required last entry */\n  29:\t\t{0, }\n  30:\t};\n  31:\tMODULE_DEVICE_TABLE(pci, bnge_pci_tbl);\n  32:\t\n  33:\tstatic void bnge_print_device_info(struct pci_dev *pdev, enum board_idx idx)\n  34:\t{\n  35:\t\tstruct device *dev = \u0026pdev-\u003edev;\n  36:\t\n  37:\t\tdev_info(dev, \"%s found at mem %lx\\n\", board_info[idx].name,\n  38:\t\t\t (long)pci_resource_start(pdev, 0));\n  39:\t\n  40:\t\tpcie_print_link_status(pdev);\n  41:\t}\n  42:\t\n  43:\tbool bnge_aux_registered(struct bnge_dev *bd)\n  44:\t{\n  45:\t\tstruct bnge_auxr_dev *ba_dev = bd-\u003eauxr_dev;\n  46:\t\n  47:\t\tif (ba_dev \u0026\u0026 ba_dev-\u003eauxr_info-\u003emsix_requested)\n  48:\t\t\treturn true;\n  49:\t\n  50:\t\treturn false;\n"
}

11/2 2026/10/14 00:42 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 21254
							output: 143
							thoughts: 1419
						

Thoughts:
**Analysis of the BCM57708 ThorUltra Driver for Fuzzing Eligibility**

Okay, here's the deal. I see this patch targets the Broadcom BCM57708, which is a ThorUltra SmartNIC, a high-speed Ethernet ASIC PCIe card.  My immediate thought is, does QEMU even emulate this thing?  No, it doesn't. Standard QEMU sticks to emulating more common network devices like e1000, virtio-net, and the like. It's clear that BCM57708 is *not* in that list.

Now, let's carefully check the guidelines. Specifically, the "NEGATIVE CRITERIA" section.  We're looking for reasons to return `WorthFuzzing=false`. The guidelines say this is appropriate if *all* modified code falls into certain categories. The key category here is: "Structurally unreachable hardware: * Vendor-specific PCIe switches, SmartNICs, or GPU drivers... requiring physical ASIC/PCIe cards not emulated in standard QEMU." Bingo.

I need to confirm that *all* the files touched are indeed related to this specific device.  I'm seeing changes in: `drivers/net/ethernet/broadcom/bnge/`. I'm going to quickly double-check the diff and the file list to be absolutely sure no other files are included.  Nope. All modifications are confined within the `bnge` driver's directory.  This is critical.

The configuration file confirms that `bnge` supports Broadcom ThorUltra Ethernet cards, with the `BCM57708` identified as the target device.  The `bnge_core.c` file specifically links the PCI vendor/device ID to `BCM57708`.

Since QEMU/GCE don't emulate the Broadcom BCM57708 hardware, the `bnge` driver can't possibly probe, allocate rings, or execute *any* of its code in a standard, virtualized fuzzing environment.  It's simply unreachable without that specific physical ASIC. Therefore, it's clear this patch falls squarely under the "structurally unreachable hardware" category defined in the guidelines. I must set `WorthFuzzing` to `false`.

The output from `set-results` should be in the following format:
*   `WorthFuzzing`: `false`
*   `Reasoning`: "Broadcom ThorUltra SmartNIC/high-speed Ethernet PCIe driver, requires physical ASIC/PCIe device 0x1780 not emulated in QEMU/GCE, structurally unreachable."
*   `FocusSymbols`: `[]`
*   `EnableConfigs`: `[]`

And I'm calling `set-results`.



12/2 2026/10/14 00:42 tool set-results
0m Args:
{
  "EnableConfigs": [],
  "FocusSymbols": [],
  "Reasoning": "The patch modifies the Broadcom ThorUltra (bnge) Ethernet driver (drivers/net/ethernet/broadcom/bnge/), specifically ring and NQ handling during netdev open/close/init. This driver supports physical Broadcom ThorUltra 50G-800G PCIe NICs (PCI ID 14e4:1780) which are vendor-specific ASIC hardware not emulated in standard virtualized environments (QEMU/GCE). As such, the code is structurally unreachable during fuzzing.",
  "WorthFuzzing": false
}

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch modifies the Broadcom ThorUltra (bnge) Ethernet driver (drivers/net/ethernet/broadcom/bnge/), specifically ring and NQ handling during netdev open/close/init. This driver supports physical Broadcom ThorUltra 50G-800G PCIe NICs (PCI ID 14e4:1780) which are vendor-specific ASIC hardware not emulated in standard virtualized environments (QEMU/GCE). As such, the code is structurally unreachable during fuzzing.",
  "WorthFuzzing": false
}

13/1 2026/10/14 00:42 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)