Lines Matching refs:ibd
48 struct hfi1_ibdev *ibd = (struct hfi1_ibdev *)s->private; in _fault_stats_seq_show() local
49 struct hfi1_devdata *dd = dd_from_dev(ibd); in _fault_stats_seq_show()
69 if (!ibd->fault->n_rxfaults[i] && !ibd->fault->n_txfaults[i]) in _fault_stats_seq_show()
74 (unsigned long long)ibd->fault->n_rxfaults[i], in _fault_stats_seq_show()
75 (unsigned long long)ibd->fault->n_txfaults[i]); in _fault_stats_seq_show()
209 void hfi1_fault_exit_debugfs(struct hfi1_ibdev *ibd) in hfi1_fault_exit_debugfs() argument
211 if (ibd->fault) in hfi1_fault_exit_debugfs()
212 debugfs_remove_recursive(ibd->fault->dir); in hfi1_fault_exit_debugfs()
213 kfree(ibd->fault); in hfi1_fault_exit_debugfs()
214 ibd->fault = NULL; in hfi1_fault_exit_debugfs()
217 int hfi1_fault_init_debugfs(struct hfi1_ibdev *ibd) in hfi1_fault_init_debugfs() argument
219 struct dentry *parent = ibd->hfi1_ibdev_dbg; in hfi1_fault_init_debugfs()
222 ibd->fault = kzalloc(sizeof(*ibd->fault), GFP_KERNEL); in hfi1_fault_init_debugfs()
223 if (!ibd->fault) in hfi1_fault_init_debugfs()
226 ibd->fault->attr.interval = 1; in hfi1_fault_init_debugfs()
227 ibd->fault->attr.require_end = ULONG_MAX; in hfi1_fault_init_debugfs()
228 ibd->fault->attr.stacktrace_depth = 32; in hfi1_fault_init_debugfs()
229 ibd->fault->attr.dname = NULL; in hfi1_fault_init_debugfs()
230 ibd->fault->attr.verbose = 0; in hfi1_fault_init_debugfs()
231 ibd->fault->enable = false; in hfi1_fault_init_debugfs()
232 ibd->fault->opcode = false; in hfi1_fault_init_debugfs()
233 ibd->fault->fault_skip = 0; in hfi1_fault_init_debugfs()
234 ibd->fault->skip = 0; in hfi1_fault_init_debugfs()
235 ibd->fault->direction = HFI1_FAULT_DIR_TXRX; in hfi1_fault_init_debugfs()
236 ibd->fault->suppress_err = false; in hfi1_fault_init_debugfs()
237 bitmap_zero(ibd->fault->opcodes, in hfi1_fault_init_debugfs()
238 sizeof(ibd->fault->opcodes) * BITS_PER_BYTE); in hfi1_fault_init_debugfs()
241 fault_create_debugfs_attr("fault", parent, &ibd->fault->attr); in hfi1_fault_init_debugfs()
243 kfree(ibd->fault); in hfi1_fault_init_debugfs()
244 ibd->fault = NULL; in hfi1_fault_init_debugfs()
247 ibd->fault->dir = fault_dir; in hfi1_fault_init_debugfs()
249 debugfs_create_file("fault_stats", 0444, fault_dir, ibd, in hfi1_fault_init_debugfs()
251 debugfs_create_bool("enable", 0600, fault_dir, &ibd->fault->enable); in hfi1_fault_init_debugfs()
253 &ibd->fault->suppress_err); in hfi1_fault_init_debugfs()
255 &ibd->fault->opcode); in hfi1_fault_init_debugfs()
256 debugfs_create_file("opcodes", 0600, fault_dir, ibd->fault, in hfi1_fault_init_debugfs()
259 &ibd->fault->fault_skip); in hfi1_fault_init_debugfs()
261 &ibd->fault->fault_skip_usec); in hfi1_fault_init_debugfs()
262 debugfs_create_u8("direction", 0600, fault_dir, &ibd->fault->direction); in hfi1_fault_init_debugfs()
267 bool hfi1_dbg_fault_suppress_err(struct hfi1_ibdev *ibd) in hfi1_dbg_fault_suppress_err() argument
269 if (ibd->fault) in hfi1_dbg_fault_suppress_err()
270 return ibd->fault->suppress_err; in hfi1_dbg_fault_suppress_err()
274 static bool __hfi1_should_fault(struct hfi1_ibdev *ibd, u32 opcode, in __hfi1_should_fault() argument
279 if (!ibd->fault || !ibd->fault->enable) in __hfi1_should_fault()
281 if (!(ibd->fault->direction & direction)) in __hfi1_should_fault()
283 if (ibd->fault->opcode) { in __hfi1_should_fault()
284 if (bitmap_empty(ibd->fault->opcodes, in __hfi1_should_fault()
285 (sizeof(ibd->fault->opcodes) * in __hfi1_should_fault()
288 if (!(test_bit(opcode, ibd->fault->opcodes))) in __hfi1_should_fault()
291 if (ibd->fault->fault_skip_usec && in __hfi1_should_fault()
292 time_before(jiffies, ibd->fault->skip_usec)) in __hfi1_should_fault()
294 if (ibd->fault->fault_skip && ibd->fault->skip) { in __hfi1_should_fault()
295 ibd->fault->skip--; in __hfi1_should_fault()
298 ret = should_fail(&ibd->fault->attr, 1); in __hfi1_should_fault()
300 ibd->fault->skip = ibd->fault->fault_skip; in __hfi1_should_fault()
301 ibd->fault->skip_usec = jiffies + in __hfi1_should_fault()
302 usecs_to_jiffies(ibd->fault->fault_skip_usec); in __hfi1_should_fault()
309 struct hfi1_ibdev *ibd = to_idev(qp->ibqp.device); in hfi1_dbg_should_fault_tx() local
311 if (__hfi1_should_fault(ibd, opcode, HFI1_FAULT_DIR_TX)) { in hfi1_dbg_should_fault_tx()
313 ibd->fault->n_txfaults[opcode]++; in hfi1_dbg_should_fault_tx()
321 struct hfi1_ibdev *ibd = &packet->rcd->dd->verbs_dev; in hfi1_dbg_should_fault_rx() local
323 if (__hfi1_should_fault(ibd, packet->opcode, HFI1_FAULT_DIR_RX)) { in hfi1_dbg_should_fault_rx()
325 ibd->fault->n_rxfaults[packet->opcode]++; in hfi1_dbg_should_fault_rx()