| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/11/20 20:22 | flow | patch-triage |
2mArgs:null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"KMSANReasoning": "",
"NeedsKMSAN": false,
"Reasoning": "The patch exclusively modifies the bnge driver (Broadcom ThorUltra 50/100/200/400/800 Gbps Ethernet controller), which requires specific physical Broadcom PCIe hardware (BCM57708) not emulated by QEMU or standard virtualized environments. Therefore, the modified code is structurally unreachable for syzkaller fuzzing.",
"WorthFuzzing": false
} |
| 1/1 | 2026/11/20 20:22 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 0071124e571e8b8b7227965382994b2f2adcd3da\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Fri Nov 20 20:22: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 4479ccd071f532..64c792b278ad5f 100644\n--- a/drivers/net/ethernet/broadcom/bnge/bnge.h\n+++ b/drivers/net/ethernet/broadcom/bnge/bnge.h\n@@ -220,6 +220,36 @@ 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+ * NQ0 (index 0) lives from probe to remove and is managed by\n+ * bnge_nq0_init()/uninit() and the nq0 handoff helpers; therefore,\n+ * bnge_for_each_open_nq() skips it.\n+ *\n+ * irq_tbl order: NQ0, aux (RoCE) vectors, open-time NQs.\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 +293,21 @@ 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. @aux_msix is a single bnge_aux_get_msix()\n+ * sample shared by all NQs of one allocation.\n+ */\n+static inline int bnge_nq_irq_idx(u16 aux_msix, int nq_idx)\n+{\n+\tif (nq_idx \u003c BNGE_FIRST_OPEN_NQ)\n+\t\treturn nq_idx;\n+\n+\treturn aux_msix + 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 87ae40eab59263..d1cc2e8b6e9bf7 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 01547311add899..227de771f2ef6f 100644\n--- a/drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c\n+++ b/drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c\n@@ -1303,7 +1303,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@@ -1396,7 +1397,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@@ -1407,7 +1408,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 25f844e6f6d34a..8b184978da23f2 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,95 @@ 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+\t\t\t u16 aux_msix)\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-\t\tbnge_free_nq_desc_arr(\u0026bnapi-\u003enq_ring);\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+\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(aux_msix, 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+\tu16 aux_msix;\n+\tint i, rc;\n+\n+\t/* RoCE can be disabled concurrently; sample the aux vector count once\n+\t * so every NQ gets a distinct irq_tbl index.\n+\t */\n+\taux_msix = bnge_aux_get_msix(bd);\n+\tbnge_for_each_open_nq(i, bd) {\n+\t\trc = bnge_alloc_nq(bn, bn-\u003ebnapi[i], aux_msix);\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 +628,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 +658,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 +667,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 +687,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 +1215,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 +1245,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 +1260,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 +1332,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 +1340,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 +1355,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 +1380,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 +1425,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 +1947,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 +1992,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@@ -2410,6 +2464,8 @@ static void bnge_disable_napi(struct bnge_net *bn)\n \n \t\tnapi_disable_locked(\u0026bnapi-\u003enapi);\n \t}\n+\n+\tsynchronize_net();\n }\n \n static void bnge_enable_napi(struct bnge_net *bn)\n@@ -2559,6 +2615,10 @@ static void bnge_hwrm_ring_free(struct bnge_net *bn, bool close_path)\n \t\tbnge_hwrm_rx_agg_ring_free(bn, \u0026bn-\u003erx_ring[i], close_path);\n \t}\n \n+\t/* Keep after ring frees: their HWRM completions need NAPI. */\n+\tif (close_path)\n+\t\tbnge_disable_napi(bn);\n+\n \t/* The completion rings are about to be freed. After that the\n \t * IRQ doorbell will not work anymore. So we need to disable\n \t * IRQ here.\n@@ -2566,23 +2626,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 +2646,7 @@ 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+\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 +2680,58 @@ 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+\tirq-\u003erequested = 1;\n+\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-\u003erequested = 0;\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 +2744,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@@ -2800,9 +2864,14 @@ static void bnge_init_napi(struct bnge_net *bn)\n \tint i;\n \n \tfor (i = 0; i \u003c bd-\u003enq_nr_rings; i++) {\n+\t\tint map_idx;\n+\n \t\tbnapi = bn-\u003ebnapi[i];\n+\t\tmap_idx = bnapi-\u003enq_ring.ring_struct.map_idx;\n \t\tnetif_napi_add_config_locked(bn-\u003enetdev, \u0026bnapi-\u003enapi,\n \t\t\t\t\t bnge_napi_poll, bnapi-\u003eindex);\n+\t\tnetif_napi_set_irq_locked(\u0026bnapi-\u003enapi,\n+\t\t\t\t\t bd-\u003eirq_tbl[map_idx].vector);\n \t}\n }\n \n@@ -2826,11 +2895,96 @@ static void bnge_del_napi(struct bnge_net *bn)\n \tsynchronize_net();\n }\n \n+static int bnge_nq0_init(struct bnge_net *bn)\n+{\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+\t/* NQ0 helpers hard-code NQ index 0 */\n+\tBUILD_BUG_ON(BNGE_FIRST_OPEN_NQ != 1);\n+\n+\tbnapi = kzalloc_obj(*bnapi);\n+\tif (!bnapi)\n+\t\treturn -ENOMEM;\n+\n+\tbnapi-\u003ebn = bn;\n+\tbnapi-\u003eindex = 0;\n+\tbn-\u003enq0 = bnapi;\n+\tnqr = \u0026bnapi-\u003enq_ring;\n+\n+\t/* NQ0 always sits at irq_tbl[0], independent of the aux vector count.\n+\t * Its ring size is fixed here; a later change to bn-\u003ecp_* must\n+\t * re-create NQ0.\n+\t */\n+\trc = bnge_alloc_nq(bn, bnapi, 0);\n+\tif (rc)\n+\t\tgoto err_free_bnapi;\n+\n+\tirq = \u0026bd-\u003eirq_tbl[nqr-\u003ering_struct.map_idx];\n+\tirq-\u003ehandler = bnge_nq0_msix;\n+\tsnprintf(irq-\u003ename, sizeof(irq-\u003ename), \"%s-nq0\", pci_name(bd-\u003epdev));\n+\n+\trc = bnge_nq_request_irq(bn, bnapi);\n+\tif (rc)\n+\t\tgoto err_free_nq;\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_hwrm;\n+\t}\n+\n+\t/* BNGE_STATE_NQ0_NAPI is clear, so from here on the ISR queues\n+\t * nq0_work. nq0_wq must already exist.\n+\t * This is the first arm, so keep it last: the unwind above does not\n+\t * cancel nq0_work.\n+\t */\n+\tBNGE_DB_NQ_ARM(bd, \u0026nqr-\u003enq_db, nqr-\u003enq_raw_cons);\n+\treturn 0;\n+\n+err_free_hwrm:\n+\tbnge_hwrm_nq_free(bn, bnapi);\n+err_free_irq:\n+\tbnge_nq_free_irq(bn, bnapi);\n+err_free_nq:\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_quiesce(struct bnge_net *bn)\n+{\n+\tbnge_nq_free_irq(bn, bn-\u003enq0);\n+\tcancel_work_sync(\u0026bn-\u003enq0_work);\n+}\n+\n+static void bnge_nq0_uninit(struct bnge_net *bn)\n+{\n+\tstruct bnge_napi *bnapi = bn-\u003enq0;\n+\n+\tbnge_nq0_quiesce(bn);\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@@ -2913,11 +3067,28 @@ static int bnge_hwrm_if_change(struct bnge_dev *bd, bool up)\n \treturn bnge_hwrm_req_send(bd, req);\n }\n \n+/* Hand NQ0 from nq0_work to NAPI. NQ0's NAPI was already enabled by\n+ * bnge_enable_napi(). The caller keeps NQ0's IRQ disabled; it is re-enabled\n+ * here.\n+ */\n+static void bnge_nq0_wq_to_napi(struct bnge_net *bn)\n+{\n+\tstruct bnge_nq_ring_info *nqr = \u0026bn-\u003enq0-\u003enq_ring;\n+\tstruct bnge_dev *bd = bn-\u003ebd;\n+\n+\tset_bit(BNGE_STATE_NQ0_NAPI, \u0026bn-\u003estate);\n+\tenable_irq(bd-\u003eirq_tbl[nqr-\u003ering_struct.map_idx].vector);\n+}\n+\n static int bnge_open_core(struct bnge_net *bn)\n {\n+\tstruct bnge_nq_ring_info *nqr0 = \u0026bn-\u003enq0-\u003enq_ring;\n \tstruct bnge_dev *bd = bn-\u003ebd;\n+\tunsigned int vector0;\n \tint rc;\n \n+\tvector0 = bd-\u003eirq_tbl[nqr0-\u003ering_struct.map_idx].vector;\n+\n \tnetif_carrier_off(bn-\u003enetdev);\n \n \trc = bnge_hwrm_if_change(bd, true);\n@@ -2932,10 +3103,19 @@ static int bnge_open_core(struct bnge_net *bn)\n \t\tgoto err_if_change;\n \t}\n \n+\tdisable_irq(vector0);\n+\tcancel_work_sync(\u0026bn-\u003enq0_work);\n+\n+\t/* Clear sp_event bits left by events seen while down. Nothing can set\n+\t * them here: NQ0's IRQ is off, nq0_work is cancelled and the timer is\n+\t * stopped. Link state is read again at the end of open.\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 +3147,7 @@ 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+\tbnge_nq0_wq_to_napi(bn);\n \n \tbnge_tx_enable(bn);\n \n@@ -2982,6 +3163,10 @@ static int bnge_open_core(struct bnge_net *bn)\n err_del_napi:\n \tbnge_del_napi(bn);\n \tbnge_free_core(bn);\n+err_nq0_resume:\n+\t/* Drop CQ notifications left by the failed bring-up; re-arms NQ0 */\n+\tbnge_nq0_poll(bn);\n+\tenable_irq(vector0);\n err_if_change:\n \tbnge_hwrm_if_change(bd, false);\n \treturn rc;\n@@ -3183,6 +3368,30 @@ static void bnge_save_ring_stats(struct bnge_net *bn)\n \t}\n }\n \n+/* Hand NQ0 from NAPI to nq0_work. Call with the netdev lock held, after the\n+ * rings were destroyed in FW (bnge_shutdown_nic()), which also stopped NQ0's\n+ * NAPI through bnge_disable_napi(). The IRQ is off while NQ0 changes hands\n+ * and is re-enabled last, so the ISR queues nq0_work from then on.\n+ */\n+static void bnge_nq0_napi_to_wq(struct bnge_net *bn)\n+{\n+\tstruct bnge_nq_ring_info *nqr = \u0026bn-\u003enq0-\u003enq_ring;\n+\tstruct bnge_dev *bd = bn-\u003ebd;\n+\tunsigned int vector;\n+\n+\tvector = bd-\u003eirq_tbl[nqr-\u003ering_struct.map_idx].vector;\n+\n+\tdisable_irq(vector);\n+\t/* Nothing should be pending; cancel so bnge_nq0_poll() below cannot\n+\t * overlap the worker\n+\t */\n+\tcancel_work_sync(\u0026bn-\u003enq0_work);\n+\tclear_bit(BNGE_STATE_NQ0_NAPI, \u0026bn-\u003estate);\n+\t/* Drop CQ notifications left by the destroyed rings; re-arms NQ0 */\n+\tbnge_nq0_poll(bn);\n+\tenable_irq(vector);\n+}\n+\n static void bnge_close_core(struct bnge_net *bn)\n {\n \tstruct bnge_dev *bd = bn-\u003ebd;\n@@ -3193,7 +3402,8 @@ static void bnge_close_core(struct bnge_net *bn)\n \n \ttimer_delete_sync(\u0026bn-\u003etimer);\n \tbnge_shutdown_nic(bn);\n-\tbnge_disable_napi(bn);\n+\n+\tbnge_nq0_napi_to_wq(bn);\n \n \t/* Save ring stats before shutdown */\n \tspin_lock_bh(\u0026bn-\u003estats_lock);\n@@ -3215,7 +3425,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@@ -3517,6 +3726,7 @@ int bnge_netdev_alloc(struct bnge_dev *bd, int max_irqs)\n \t\tnetif_set_tso_max_segs(netdev, bd-\u003etso_max_segs);\n \n \tINIT_WORK(\u0026bn-\u003esp_task, bnge_sp_task);\n+\tINIT_WORK(\u0026bn-\u003enq0_work, bnge_nq0_work);\n \ttimer_setup(\u0026bn-\u003etimer, bnge_timer, 0);\n \tbn-\u003ecurrent_interval = BNGE_TIMER_INTERVAL;\n \n@@ -3528,6 +3738,14 @@ int bnge_netdev_alloc(struct bnge_dev *bd, int max_irqs)\n \t\tgoto err_netdev;\n \t}\n \n+\tbn-\u003enq0_wq = alloc_ordered_workqueue(\"bnge_nq0_wq-%s\", WQ_MEM_RECLAIM,\n+\t\t\t\t\t dev_name(bd-\u003edev));\n+\tif (!bn-\u003enq0_wq) {\n+\t\tbnge_err(bd, \"Unable to create NQ0 workqueue.\\n\");\n+\t\trc = -ENOMEM;\n+\t\tgoto err_free_workq;\n+\t}\n+\n \tbn-\u003erx_ring_size = BNGE_DEFAULT_RX_RING_SIZE;\n \tbn-\u003etx_ring_size = BNGE_DEFAULT_TX_RING_SIZE;\n \tbn-\u003erx_dir = DMA_FROM_DEVICE;\n@@ -3541,24 +3759,35 @@ int bnge_netdev_alloc(struct bnge_dev *bd, int max_irqs)\n \n \trc = bnge_probe_phy(bn, true);\n \tif (rc)\n-\t\tgoto err_free_workq;\n+\t\tgoto err_free_nq0_wq;\n \n \trc = bnge_alloc_port_stats(bn);\n \tif (rc)\n-\t\tgoto err_free_workq;\n+\t\tgoto err_free_nq0_wq;\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\tbnge_err(bd, \"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_nq0_wq:\n+\tdestroy_workqueue(bn-\u003enq0_wq);\n err_free_workq:\n \tdestroy_workqueue(bn-\u003ebnge_pf_wq);\n err_netdev:\n@@ -3576,6 +3805,10 @@ 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+\tdestroy_workqueue(bn-\u003enq0_wq);\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 476b5bab96fed2..8c300f2fb5f3cb 100644\n--- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h\n+++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h\n@@ -266,6 +266,7 @@ struct bnge_stats_mem {\n enum bnge_net_state {\n \tBNGE_STATE_NAPI_DISABLED,\n \tBNGE_STATE_STATS_ENABLE,\n+\tBNGE_STATE_NQ0_NAPI,\n };\n \n #define BNGE_TIMER_INTERVAL\tHZ\n@@ -315,6 +316,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;\n@@ -350,7 +353,9 @@ struct bnge_net {\n \tunsigned int\t\tcurrent_interval;\n \tstruct timer_list\ttimer;\n \tstruct workqueue_struct *bnge_pf_wq;\n+\tstruct workqueue_struct *nq0_wq;\n \tstruct work_struct\tsp_task;\n+\tstruct work_struct\tnq0_work;\n \tunsigned long\t\tsp_event;\n \n \tstruct bnge_ethtool_link_info\teth_link_info;\ndiff --git a/drivers/net/ethernet/broadcom/bnge/bnge_rmem.c b/drivers/net/ethernet/broadcom/bnge/bnge_rmem.c\nindex b066ee887a0996..bbae84b4157ea5 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 472b02cc43b3c1..183b071641baf8 100644\n--- a/drivers/net/ethernet/broadcom/bnge/bnge_txrx.c\n+++ b/drivers/net/ethernet/broadcom/bnge/bnge_txrx.c\n@@ -45,6 +45,21 @@ irqreturn_t bnge_msix(int irq, void *dev_instance)\n \treturn IRQ_HANDLED;\n }\n \n+/* NQ0 outlives ndo_stop(). While the interface is up it is polled by NAPI\n+ * like any other NQ; while it is down it has no NAPI and nq0_work services it.\n+ */\n+irqreturn_t bnge_nq0_msix(int irq, void *dev_instance)\n+{\n+\tstruct bnge_napi *bnapi = dev_instance;\n+\tstruct bnge_net *bn = bnapi-\u003ebn;\n+\n+\tif (test_bit(BNGE_STATE_NQ0_NAPI, \u0026bn-\u003estate))\n+\t\treturn bnge_msix(irq, dev_instance);\n+\n+\tqueue_work(bn-\u003enq0_wq, \u0026bn-\u003enq0_work);\n+\treturn IRQ_HANDLED;\n+}\n+\n static struct rx_agg_cmp *bnge_get_tpa_agg(struct bnge_net *bn,\n \t\t\t\t\t struct bnge_rx_ring_info *rxr,\n \t\t\t\t\t u16 agg_id, u16 curr)\n@@ -1135,8 +1150,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@@ -1396,6 +1411,47 @@ int bnge_napi_poll(struct napi_struct *napi, int budget)\n \treturn work_done;\n }\n \n+/* Poll NQ0 without NAPI: handle its own events, drop notifications for CQs\n+ * that no longer exist, and re-arm it.\n+ *\n+ * Single consumer only: call from nq0_work, or with NQ0's IRQ disabled,\n+ * nq0_work cancelled and all NAPI disabled.\n+ */\n+void bnge_nq0_poll(struct bnge_net *bn)\n+{\n+\tstruct bnge_nq_ring_info *nqr = \u0026bn-\u003enq0-\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_ARM(bn-\u003ebd, \u0026nqr-\u003enq_db, raw_cons);\n+}\n+\n+void bnge_nq0_work(struct work_struct *work)\n+{\n+\tbnge_nq0_poll(container_of(work, struct bnge_net, nq0_work));\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 bd0aa6c221a499..3db6809499ba9e 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,9 @@ 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+irqreturn_t bnge_nq0_msix(int irq, void *dev_instance);\n+void bnge_nq0_poll(struct bnge_net *bn);\n+void bnge_nq0_work(struct work_struct *work);\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/11/20 20:22 | agent | patch-evaluator |
2mModel:core Args: null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch exclusively modifies the bnge driver (Broadcom ThorUltra 50/100/200/400/800 Gbps Ethernet controller), which requires specific physical Broadcom PCIe hardware (BCM57708) not emulated by QEMU or standard virtualized environments. Therefore, the modified code is structurally unreachable for syzkaller 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 0071124e571e8b8b7227965382994b2f2adcd3da
Author: syz-cluster <triage@syzkaller.com>
Date: Fri Nov 20 20:22: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 4479ccd071f532..64c792b278ad5f 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge.h
+++ b/drivers/net/ethernet/broadcom/bnge/bnge.h
@@ -220,6 +220,36 @@ 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().
+ * NQ0 (index 0) lives from probe to remove and is managed by
+ * bnge_nq0_init()/uninit() and the nq0 handoff helpers; therefore,
+ * bnge_for_each_open_nq() skips it.
+ *
+ * irq_tbl order: NQ0, aux (RoCE) vectors, open-time NQs.
+ */
+#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 +293,21 @@ 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. @aux_msix is a single bnge_aux_get_msix()
+ * sample shared by all NQs of one allocation.
+ */
+static inline int bnge_nq_irq_idx(u16 aux_msix, int nq_idx)
+{
+ if (nq_idx < BNGE_FIRST_OPEN_NQ)
+ return nq_idx;
+
+ return aux_msix + 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 87ae40eab59263..d1cc2e8b6e9bf7 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 01547311add899..227de771f2ef6f 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c
@@ -1303,7 +1303,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;
@@ -1396,7 +1397,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;
}
@@ -1407,7 +1408,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 25f844e6f6d34a..8b184978da23f2 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
@@ -503,61 +503,95 @@ 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,
+ u16 aux_msix)
+{
+ struct bnge_nq_ring_info *nqr = &bnapi->nq_ring;
+ struct bnge_ring_mem_info *rmem;
+ struct bnge_ring_struct *ring;
+ int rc;
- bnge_free_nq_desc_arr(&bnapi->nq_ring);
+ ring = &nqr->ring_struct;
+ rmem = &ring->ring_mem;
+
+ rc = bnge_alloc_nq_desc_arr(nqr, bn->cp_nr_pages);
+ if (rc)
+ return rc;
+
+ 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(aux_msix, 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;
+ u16 aux_msix;
+ int i, rc;
+
+ /* RoCE can be disabled concurrently; sample the aux vector count once
+ * so every NQ gets a distinct irq_tbl index.
+ */
+ aux_msix = bnge_aux_get_msix(bd);
+ bnge_for_each_open_nq(i, bd) {
+ rc = bnge_alloc_nq(bn, bn->bnapi[i], aux_msix);
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 +628,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 +658,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 +667,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 +687,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 +1215,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 +1245,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 +1260,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 +1332,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 +1340,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 +1355,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 +1380,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 +1425,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 +1947,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 +1992,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++) {
@@ -2410,6 +2464,8 @@ static void bnge_disable_napi(struct bnge_net *bn)
napi_disable_locked(&bnapi->napi);
}
+
+ synchronize_net();
}
static void bnge_enable_napi(struct bnge_net *bn)
@@ -2559,6 +2615,10 @@ static void bnge_hwrm_ring_free(struct bnge_net *bn, bool close_path)
bnge_hwrm_rx_agg_ring_free(bn, &bn->rx_ring[i], close_path);
}
+ /* Keep after ring frees: their HWRM completions need NAPI. */
+ if (close_path)
+ bnge_disable_napi(bn);
+
/* The completion rings are about to be freed. After that the
* IRQ doorbell will not work anymore. So we need to disable
* IRQ here.
@@ -2566,23 +2626,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 +2646,7 @@ 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++) {
+ bnge_for_each_open_nq(i, bd) {
int map_idx = bnge_cp_num_to_irq_num(bn, i);
char *attr;
@@ -2627,27 +2680,58 @@ 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;
+
+ irq->requested = 1;
+
+ if (zalloc_cpumask_var(&irq->cpu_mask, GFP_KERNEL)) {
+ int numa_node = dev_to_node(&bd->pdev->dev);
- irq->requested = 0;
+ 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 +2744,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;
@@ -2800,9 +2864,14 @@ static void bnge_init_napi(struct bnge_net *bn)
int i;
for (i = 0; i < bd->nq_nr_rings; i++) {
+ int map_idx;
+
bnapi = bn->bnapi[i];
+ map_idx = bnapi->nq_ring.ring_struct.map_idx;
netif_napi_add_config_locked(bn->netdev, &bnapi->napi,
bnge_napi_poll, bnapi->index);
+ netif_napi_set_irq_locked(&bnapi->napi,
+ bd->irq_tbl[map_idx].vector);
}
}
@@ -2826,11 +2895,96 @@ static void bnge_del_napi(struct bnge_net *bn)
synchronize_net();
}
+static int bnge_nq0_init(struct bnge_net *bn)
+{
+ struct bnge_nq_ring_info *nqr;
+ struct bnge_dev *bd = bn->bd;
+ struct bnge_napi *bnapi;
+ struct bnge_irq *irq;
+ int rc;
+
+ /* NQ0 helpers hard-code NQ index 0 */
+ BUILD_BUG_ON(BNGE_FIRST_OPEN_NQ != 1);
+
+ bnapi = kzalloc_obj(*bnapi);
+ if (!bnapi)
+ return -ENOMEM;
+
+ bnapi->bn = bn;
+ bnapi->index = 0;
+ bn->nq0 = bnapi;
+ nqr = &bnapi->nq_ring;
+
+ /* NQ0 always sits at irq_tbl[0], independent of the aux vector count.
+ * Its ring size is fixed here; a later change to bn->cp_* must
+ * re-create NQ0.
+ */
+ rc = bnge_alloc_nq(bn, bnapi, 0);
+ if (rc)
+ goto err_free_bnapi;
+
+ irq = &bd->irq_tbl[nqr->ring_struct.map_idx];
+ irq->handler = bnge_nq0_msix;
+ snprintf(irq->name, sizeof(irq->name), "%s-nq0", pci_name(bd->pdev));
+
+ rc = bnge_nq_request_irq(bn, bnapi);
+ if (rc)
+ goto err_free_nq;
+
+ 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_hwrm;
+ }
+
+ /* BNGE_STATE_NQ0_NAPI is clear, so from here on the ISR queues
+ * nq0_work. nq0_wq must already exist.
+ * This is the first arm, so keep it last: the unwind above does not
+ * cancel nq0_work.
+ */
+ BNGE_DB_NQ_ARM(bd, &nqr->nq_db, nqr->nq_raw_cons);
+ return 0;
+
+err_free_hwrm:
+ bnge_hwrm_nq_free(bn, bnapi);
+err_free_irq:
+ bnge_nq_free_irq(bn, bnapi);
+err_free_nq:
+ bnge_free_nq(bn, bnapi);
+err_free_bnapi:
+ kfree(bnapi);
+ bn->nq0 = NULL;
+ return rc;
+}
+
+static void bnge_nq0_quiesce(struct bnge_net *bn)
+{
+ bnge_nq_free_irq(bn, bn->nq0);
+ cancel_work_sync(&bn->nq0_work);
+}
+
+static void bnge_nq0_uninit(struct bnge_net *bn)
+{
+ struct bnge_napi *bnapi = bn->nq0;
+
+ bnge_nq0_quiesce(bn);
+
+ 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);
@@ -2913,11 +3067,28 @@ static int bnge_hwrm_if_change(struct bnge_dev *bd, bool up)
return bnge_hwrm_req_send(bd, req);
}
+/* Hand NQ0 from nq0_work to NAPI. NQ0's NAPI was already enabled by
+ * bnge_enable_napi(). The caller keeps NQ0's IRQ disabled; it is re-enabled
+ * here.
+ */
+static void bnge_nq0_wq_to_napi(struct bnge_net *bn)
+{
+ struct bnge_nq_ring_info *nqr = &bn->nq0->nq_ring;
+ struct bnge_dev *bd = bn->bd;
+
+ set_bit(BNGE_STATE_NQ0_NAPI, &bn->state);
+ enable_irq(bd->irq_tbl[nqr->ring_struct.map_idx].vector);
+}
+
static int bnge_open_core(struct bnge_net *bn)
{
+ struct bnge_nq_ring_info *nqr0 = &bn->nq0->nq_ring;
struct bnge_dev *bd = bn->bd;
+ unsigned int vector0;
int rc;
+ vector0 = bd->irq_tbl[nqr0->ring_struct.map_idx].vector;
+
netif_carrier_off(bn->netdev);
rc = bnge_hwrm_if_change(bd, true);
@@ -2932,10 +3103,19 @@ static int bnge_open_core(struct bnge_net *bn)
goto err_if_change;
}
+ disable_irq(vector0);
+ cancel_work_sync(&bn->nq0_work);
+
+ /* Clear sp_event bits left by events seen while down. Nothing can set
+ * them here: NQ0's IRQ is off, nq0_work is cancelled and the timer is
+ * stopped. Link state is read again at the end of open.
+ */
+ 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 +3147,7 @@ static int bnge_open_core(struct bnge_net *bn)
set_bit(BNGE_STATE_STATS_ENABLE, &bn->state);
bnge_enable_int(bn);
+ bnge_nq0_wq_to_napi(bn);
bnge_tx_enable(bn);
@@ -2982,6 +3163,10 @@ static int bnge_open_core(struct bnge_net *bn)
err_del_napi:
bnge_del_napi(bn);
bnge_free_core(bn);
+err_nq0_resume:
+ /* Drop CQ notifications left by the failed bring-up; re-arms NQ0 */
+ bnge_nq0_poll(bn);
+ enable_irq(vector0);
err_if_change:
bnge_hwrm_if_change(bd, false);
return rc;
@@ -3183,6 +3368,30 @@ static void bnge_save_ring_stats(struct bnge_net *bn)
}
}
+/* Hand NQ0 from NAPI to nq0_work. Call with the netdev lock held, after the
+ * rings were destroyed in FW (bnge_shutdown_nic()), which also stopped NQ0's
+ * NAPI through bnge_disable_napi(). The IRQ is off while NQ0 changes hands
+ * and is re-enabled last, so the ISR queues nq0_work from then on.
+ */
+static void bnge_nq0_napi_to_wq(struct bnge_net *bn)
+{
+ struct bnge_nq_ring_info *nqr = &bn->nq0->nq_ring;
+ struct bnge_dev *bd = bn->bd;
+ unsigned int vector;
+
+ vector = bd->irq_tbl[nqr->ring_struct.map_idx].vector;
+
+ disable_irq(vector);
+ /* Nothing should be pending; cancel so bnge_nq0_poll() below cannot
+ * overlap the worker
+ */
+ cancel_work_sync(&bn->nq0_work);
+ clear_bit(BNGE_STATE_NQ0_NAPI, &bn->state);
+ /* Drop CQ notifications left by the destroyed rings; re-arms NQ0 */
+ bnge_nq0_poll(bn);
+ enable_irq(vector);
+}
+
static void bnge_close_core(struct bnge_net *bn)
{
struct bnge_dev *bd = bn->bd;
@@ -3193,7 +3402,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_napi_to_wq(bn);
/* Save ring stats before shutdown */
spin_lock_bh(&bn->stats_lock);
@@ -3215,7 +3425,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;
}
@@ -3517,6 +3726,7 @@ int bnge_netdev_alloc(struct bnge_dev *bd, int max_irqs)
netif_set_tso_max_segs(netdev, bd->tso_max_segs);
INIT_WORK(&bn->sp_task, bnge_sp_task);
+ INIT_WORK(&bn->nq0_work, bnge_nq0_work);
timer_setup(&bn->timer, bnge_timer, 0);
bn->current_interval = BNGE_TIMER_INTERVAL;
@@ -3528,6 +3738,14 @@ int bnge_netdev_alloc(struct bnge_dev *bd, int max_irqs)
goto err_netdev;
}
+ bn->nq0_wq = alloc_ordered_workqueue("bnge_nq0_wq-%s", WQ_MEM_RECLAIM,
+ dev_name(bd->dev));
+ if (!bn->nq0_wq) {
+ bnge_err(bd, "Unable to create NQ0 workqueue.\n");
+ rc = -ENOMEM;
+ goto err_free_workq;
+ }
+
bn->rx_ring_size = BNGE_DEFAULT_RX_RING_SIZE;
bn->tx_ring_size = BNGE_DEFAULT_TX_RING_SIZE;
bn->rx_dir = DMA_FROM_DEVICE;
@@ -3541,24 +3759,35 @@ int bnge_netdev_alloc(struct bnge_dev *bd, int max_irqs)
rc = bnge_probe_phy(bn, true);
if (rc)
- goto err_free_workq;
+ goto err_free_nq0_wq;
rc = bnge_alloc_port_stats(bn);
if (rc)
- goto err_free_workq;
+ goto err_free_nq0_wq;
spin_lock_init(&bn->stats_lock);
netdev->request_ops_lock = true;
+
+ rc = bnge_nq0_init(bn);
+ if (rc) {
+ bnge_err(bd, "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_nq0_wq:
+ destroy_workqueue(bn->nq0_wq);
err_free_workq:
destroy_workqueue(bn->bnge_pf_wq);
err_netdev:
@@ -3576,6 +3805,10 @@ 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);
+ destroy_workqueue(bn->nq0_wq);
+
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 476b5bab96fed2..8c300f2fb5f3cb 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h
@@ -266,6 +266,7 @@ struct bnge_stats_mem {
enum bnge_net_state {
BNGE_STATE_NAPI_DISABLED,
BNGE_STATE_STATS_ENABLE,
+ BNGE_STATE_NQ0_NAPI,
};
#define BNGE_TIMER_INTERVAL HZ
@@ -315,6 +316,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;
@@ -350,7 +353,9 @@ struct bnge_net {
unsigned int current_interval;
struct timer_list timer;
struct workqueue_struct *bnge_pf_wq;
+ struct workqueue_struct *nq0_wq;
struct work_struct sp_task;
+ struct work_struct nq0_work;
unsigned long sp_event;
struct bnge_ethtool_link_info eth_link_info;
diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_rmem.c b/drivers/net/ethernet/broadcom/bnge/bnge_rmem.c
index b066ee887a0996..bbae84b4157ea5 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 472b02cc43b3c1..183b071641baf8 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_txrx.c
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_txrx.c
@@ -45,6 +45,21 @@ irqreturn_t bnge_msix(int irq, void *dev_instance)
return IRQ_HANDLED;
}
+/* NQ0 outlives ndo_stop(). While the interface is up it is polled by NAPI
+ * like any other NQ; while it is down it has no NAPI and nq0_work services it.
+ */
+irqreturn_t bnge_nq0_msix(int irq, void *dev_instance)
+{
+ struct bnge_napi *bnapi = dev_instance;
+ struct bnge_net *bn = bnapi->bn;
+
+ if (test_bit(BNGE_STATE_NQ0_NAPI, &bn->state))
+ return bnge_msix(irq, dev_instance);
+
+ queue_work(bn->nq0_wq, &bn->nq0_work);
+ return IRQ_HANDLED;
+}
+
static struct rx_agg_cmp *bnge_get_tpa_agg(struct bnge_net *bn,
struct bnge_rx_ring_info *rxr,
u16 agg_id, u16 curr)
@@ -1135,8 +1150,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:
@@ -1396,6 +1411,47 @@ int bnge_napi_poll(struct napi_struct *napi, int budget)
return work_done;
}
+/* Poll NQ0 without NAPI: handle its own events, drop notifications for CQs
+ * that no longer exist, and re-arm it.
+ *
+ * Single consumer only: call from nq0_work, or with NQ0's IRQ disabled,
+ * nq0_work cancelled and all NAPI disabled.
+ */
+void bnge_nq0_poll(struct bnge_net *bn)
+{
+ struct bnge_nq_ring_info *nqr = &bn->nq0->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_ARM(bn->bd, &nqr->nq_db, raw_cons);
+}
+
+void bnge_nq0_work(struct work_struct *work)
+{
+ bnge_nq0_poll(container_of(work, struct bnge_net, nq0_work));
+}
+
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 bd0aa6c221a499..3db6809499ba9e 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_txrx.h
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_txrx.h
@@ -120,6 +120,9 @@ 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);
+irqreturn_t bnge_nq0_msix(int irq, void *dev_instance);
+void bnge_nq0_poll(struct bnge_net *bn);
+void bnge_nq0_work(struct work_struct *work);
netdev_features_t bnge_features_check(struct sk_buff *skb,
struct net_device *dev,
netdev_features_t features);
|
| 3/2 | 2026/11/20 20:22 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 18848 output: 34 thoughts: 249 Thoughts: **Analyzing a Driver Patch for Fuzzing Potential** Okay, let's dive into this patch and figure out if it's a good candidate for syzkaller. My initial step is always to look at the modified files. I see a bunch of files listed: `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`. This is all within the `drivers/net/ethernet/broadcom/bnge/` directory. So, this appears to be the Broadcom NetXtreme Gigabit Ethernet driver, which I know as `bnge`. But, before I get too deep, is this strictly gigabit? Or perhaps also used for 100G/200G? I need to clarify that. I'll check the name. I'll search the kernel configuration (`Kconfig`) for the driver name (`bnge`) using grepper to get a good handle on what this driver is. With this, I can begin to assess the scope of the potential attack surface. |
| 4/2 | 2026/11/20 20:22 | tool | grepper |
0mArgs:{
"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/11/20 20:22 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19509 output: 40 thoughts: 30 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Investigating Broadcom Ethernet Driver Configuration** Right, let's dive into the Broadcom Ethernet driver configuration, specifically the `drivers/net/ethernet/broadcom/Kconfig` file. I need to get a clear picture of the dependencies and the overall description of this driver, so I'm honing in on around line 258. It's usually a good spot to start when you're dealing with Kconfig files; the initial blocks often contain the critical information. I'm expecting to find details on the specific hardware this driver supports, any architectural prerequisites, and probably some of the key configuration options it exposes. I'll be looking for things like chip revisions, memory map requirements, and perhaps any external dependencies on other kernel subsystems or features. Knowing the exact dependencies will be crucial for understanding how this driver integrates with the rest of the network stack and the overall system. Time to dig in and see what we've got. |
| 6/2 | 2026/11/20 20:23 | tool | read-file |
0mArgs:{
"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/11/20 20:23 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 20221 output: 46 thoughts: 319 Thoughts: **My Analysis of the Broadcom ThorUltra Driver's Fuzzing Eligibility** Okay, so this driver is for Broadcom ThorUltra gigabit Ethernet cards. It's a PCI ethernet driver, meaning it deals directly with hardware. My immediate concern is whether it's suitable for fuzzing. The instructions highlight that fuzzing is only valuable if the code *can* execute in a standard virtualized environment like QEMU. That's my primary filter. Section 2 provides negative criteria, situations where I should explicitly *not* fuzz. Specifically, "structurally unreachable hardware" is a red flag. It mentions examples like vendor-specific PCIe switches, SmartNICs, or GPU drivers that require physical ASICs or PCIe cards not emulated in standard QEMU. The crucial question is: Is this Broadcom ThorUltra hardware, specifically the BNGE driver, an example of this category? Is it a vendor-specific physical ASIC/PCIe card that's *not* emulated in standard QEMU? I need to know if this hardware requires a special environment to operate, and if that environment is present when I test. Section 1 reinforces this β reachability is key. If the code is structurally unreachable, itβs a no-go for fuzzing, no matter how complex the logic or how many assertions are added. That's a critical rule to prevent wasted effort, and potential incorrect assessments. Now, my next step is to determine the PCI IDs that `bnge` probes. That will give me more information about the specific hardware it's intended to work with. That will help me to determine if the hardware it is related to is emulated, or not. |
| 8/2 | 2026/11/20 20:23 | tool | grepper |
0mArgs:{
"Expression": "MODULE_DEVICE_TABLE|pci_device_id",
"PathPrefixes": [
"drivers/net/ethernet/broadcom/bnge/"
]
}Results: {
"Output": "drivers/net/ethernet/broadcom/bnge/bnge_core.c=20=static const struct {\n--\ndrivers/net/ethernet/broadcom/bnge/bnge_core.c-25-\ndrivers/net/ethernet/broadcom/bnge/bnge_core.c:26:static const struct pci_device_id bnge_pci_tbl[] = {\ndrivers/net/ethernet/broadcom/bnge/bnge_core.c-27-\t{ PCI_VDEVICE(BROADCOM, 0x1780), .driver_data = BCM57708 },\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--\ndrivers/net/ethernet/broadcom/bnge/bnge_core.c=249=static int bnge_map_db_bar(struct bnge_dev *bd)\n--\ndrivers/net/ethernet/broadcom/bnge/bnge_core.c-260-\ndrivers/net/ethernet/broadcom/bnge/bnge_core.c:261:static int bnge_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)\ndrivers/net/ethernet/broadcom/bnge/bnge_core.c-262-{\n"
} |
| 9/2 | 2026/11/20 20:23 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 21349 output: 38 thoughts: 644 Thoughts: **My Assessment of bnge_pci_tbl and its Fuzzing Potential** Okay, so I'm looking at this `bnge_pci_tbl` and the Broadcom ThorUltra Ethernet device support. My initial question is whether this hardware can be reasonably emulated in standard QEMU or Google Compute Engine. And the answer, unfortunately, is a resounding no. Standard QEMU doesn't touch Broadcom ThorUltra (bnge, BCM57708, the 50/100/200/400/800 GbE stuff). It only emulates the usual suspects: e1000, virtio-net, etc. This ThorUltra is a high-speed, vendor-specific NIC, a SmartNIC, a physical ASIC. It needs actual physical hardware. Let me just quickly re-read Section 2 to be sure... yep, there it is: "Structurally unreachable hardware: Vendor-specific PCIe switches, SmartNICs..." It specifically calls out devices like these, needing physical ASICs or PCIe cards that are *not* emulated in standard QEMU. The diff itself is a dead giveaway. Every single modified file falls neatly within the `drivers/net/ethernet/broadcom/bnge/` directory. That's the `bnge` driver. It's a PCI driver β `bnge_probe_one`, `bnge_pci_tbl` are all part of it β designed specifically for those Broadcom ThorUltra cards at those speeds. Without the physical PCI hardware, this driver *cannot* bind, probe, or instantiate any netdev, rings, or IRQs. It's just not going to happen in a standard QEMU/GCE environment, which is what we use with syzkaller. Therefore, the `WorthFuzzing` flag should be set to `false`, I think. Just to be absolutely sure, let me quickly glance through `bnge_core.c` and any other files just to see if there's any other code touched or virtual bus support. (Although, wait... that auxiliary bus device is registered *by* the driver itself for RoCE, but the parent is still the PCI device, so still no luck). Yes, confirming, I don't see anything. |
| 10/2 | 2026/11/20 20:23 | tool | grepper |
0mArgs:{
"Expression": "bnge_probe",
"PathPrefixes": [
"drivers/net/ethernet/broadcom/bnge/"
]
}Results: {
"Output": "drivers/net/ethernet/broadcom/bnge/bnge_core.c=249=static int bnge_map_db_bar(struct bnge_dev *bd)\n--\ndrivers/net/ethernet/broadcom/bnge/bnge_core.c-260-\ndrivers/net/ethernet/broadcom/bnge/bnge_core.c:261:static int bnge_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)\ndrivers/net/ethernet/broadcom/bnge/bnge_core.c-262-{\n--\ndrivers/net/ethernet/broadcom/bnge/bnge_core.c=426=static struct pci_driver bnge_driver = {\n--\ndrivers/net/ethernet/broadcom/bnge/bnge_core.c-428-\t.id_table\t= bnge_pci_tbl,\ndrivers/net/ethernet/broadcom/bnge/bnge_core.c:429:\t.probe\t\t= bnge_probe_one,\ndrivers/net/ethernet/broadcom/bnge/bnge_core.c-430-\t.remove\t\t= bnge_remove_one,\n--\ndrivers/net/ethernet/broadcom/bnge/bnge_link.c=116=void bnge_init_ethtool_link_settings(struct bnge_net *bn)\n--\ndrivers/net/ethernet/broadcom/bnge/bnge_link.c-142-\ndrivers/net/ethernet/broadcom/bnge/bnge_link.c:143:int bnge_probe_phy(struct bnge_net *bn, bool fw_dflt)\ndrivers/net/ethernet/broadcom/bnge/bnge_link.c-144-{\n--\ndrivers/net/ethernet/broadcom/bnge/bnge_link.h=165=void bnge_init_ethtool_link_settings(struct bnge_net *bn);\ndrivers/net/ethernet/broadcom/bnge/bnge_link.h:166:int bnge_probe_phy(struct bnge_net *bn, bool fw_dflt);\ndrivers/net/ethernet/broadcom/bnge/bnge_link.h-167-int bnge_set_link_ksettings(struct net_device *dev,\n--\ndrivers/net/ethernet/broadcom/bnge/bnge_netdev.c=3643=int bnge_netdev_alloc(struct bnge_dev *bd, int max_irqs)\n--\ndrivers/net/ethernet/broadcom/bnge/bnge_netdev.c-3759-\ndrivers/net/ethernet/broadcom/bnge/bnge_netdev.c:3760:\trc = bnge_probe_phy(bn, true);\ndrivers/net/ethernet/broadcom/bnge/bnge_netdev.c-3761-\tif (rc)\n"
} |
| 11/2 | 2026/11/20 20:23 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 23287 output: 46 thoughts: 16 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience, presented in the first person: **Diving Deep into `bnge_pci_tbl`** Alright, time to get serious. I'm going to take a really close look at the `bnge_pci_tbl`. It's crucial, and I need to make sure I'm not missing anything. I need to understand it completely, and that means a comprehensive review. Let's see what we can find. I want to make certain that I have the complete picture. |
| 12/2 | 2026/11/20 20:24 | tool | read-file |
0mArgs:{
"File": "drivers/net/ethernet/broadcom/bnge/bnge_core.c",
"FirstLine": 20,
"LineCount": 20
}Results: {
"Contents": " 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"
} |
| 13/2 | 2026/11/20 20:24 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 23825 output: 113 thoughts: 744 Thoughts: **Analysis of the BCM57708 ThorUltra Ethernet Controller for Fuzzing Eligibility**
Okay, here's the situation. This device, the Broadcom BCM57708 ThorUltra Ethernet controller, has a single PCI ID: `{ PCI_VDEVICE(BROADCOM, 0x1780), .driver_data = BCM57708 }`. And according to the guidelines, this falls squarely under Section 2: "Structurally unreachable hardware," specifically the vendor-specific PCIe NIC category. We're talking about hardware that relies on a physical ASIC/PCIe card which isn't emulated in the usual QEMU setups we're using for fuzzing.
Given that `WorthFuzzing` is `false` here, let's nail down what the `EnableConfigs` and `FocusSymbols` should be. Going through the documentation, the reasoning is pretty clear: This code modification is tied to the `bnge` driver, which is all about this ThorUltra Ethernet controller. Since the hardware isn't emulated and is structurally unreachable within our standard fuzzing environment, it's not worth fuzzing. The schema says if `WorthFuzzing` is `false`, the `FocusSymbols` should be an empty list, `[]`. And the `EnableConfigs` should also be an empty list, `[]`. Or, well, an empty list, `[]`.
Just to be absolutely certain, I did a `git diff` to confirm that all the changes are contained within the `drivers/net/ethernet/broadcom/bnge/` directory. And that's exactly what I found: only files within that path were modified.
So, to summarize succinctly: This is BCM57708 ThorUltra Ethernet, a vendor-specific PCIe device, not supported by our current fuzzing setup. I've got everything I need. Now, let's call `set-results`.
|
| 14/2 | 2026/11/20 20:24 | tool | set-results |
0mArgs:{
"EnableConfigs": [],
"FocusSymbols": [],
"Reasoning": "The patch exclusively modifies the bnge driver (Broadcom ThorUltra 50/100/200/400/800 Gbps Ethernet controller), which requires specific physical Broadcom PCIe hardware (BCM57708) not emulated by QEMU or standard virtualized environments. Therefore, the modified code is structurally unreachable for syzkaller fuzzing.",
"WorthFuzzing": false
}Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch exclusively modifies the bnge driver (Broadcom ThorUltra 50/100/200/400/800 Gbps Ethernet controller), which requires specific physical Broadcom PCIe hardware (BCM57708) not emulated by QEMU or standard virtualized environments. Therefore, the modified code is structurally unreachable for syzkaller fuzzing.",
"WorthFuzzing": false
} |
| 15/1 | 2026/11/20 20:24 | action | If |
0mArgs:{
"WorthFuzzing": false
}Results: null |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|