Lines Matching refs:ibd

90 	struct hfi1_ibdev *ibd = (struct hfi1_ibdev *)s->private;  in _fault_stats_seq_show()  local
91 struct hfi1_devdata *dd = dd_from_dev(ibd); in _fault_stats_seq_show()
111 if (!ibd->fault->n_rxfaults[i] && !ibd->fault->n_txfaults[i]) in _fault_stats_seq_show()
116 (unsigned long long)ibd->fault->n_rxfaults[i], in _fault_stats_seq_show()
117 (unsigned long long)ibd->fault->n_txfaults[i]); in _fault_stats_seq_show()
242 void hfi1_fault_exit_debugfs(struct hfi1_ibdev *ibd) in hfi1_fault_exit_debugfs() argument
244 if (ibd->fault) in hfi1_fault_exit_debugfs()
245 debugfs_remove_recursive(ibd->fault->dir); in hfi1_fault_exit_debugfs()
246 kfree(ibd->fault); in hfi1_fault_exit_debugfs()
247 ibd->fault = NULL; in hfi1_fault_exit_debugfs()
250 int hfi1_fault_init_debugfs(struct hfi1_ibdev *ibd) in hfi1_fault_init_debugfs() argument
252 struct dentry *parent = ibd->hfi1_ibdev_dbg; in hfi1_fault_init_debugfs()
254 ibd->fault = kzalloc(sizeof(*ibd->fault), GFP_KERNEL); in hfi1_fault_init_debugfs()
255 if (!ibd->fault) in hfi1_fault_init_debugfs()
258 ibd->fault->attr.interval = 1; in hfi1_fault_init_debugfs()
259 ibd->fault->attr.require_end = ULONG_MAX; in hfi1_fault_init_debugfs()
260 ibd->fault->attr.stacktrace_depth = 32; in hfi1_fault_init_debugfs()
261 ibd->fault->attr.dname = NULL; in hfi1_fault_init_debugfs()
262 ibd->fault->attr.verbose = 0; in hfi1_fault_init_debugfs()
263 ibd->fault->enable = false; in hfi1_fault_init_debugfs()
264 ibd->fault->opcode = false; in hfi1_fault_init_debugfs()
265 ibd->fault->fault_skip = 0; in hfi1_fault_init_debugfs()
266 ibd->fault->skip = 0; in hfi1_fault_init_debugfs()
267 ibd->fault->direction = HFI1_FAULT_DIR_TXRX; in hfi1_fault_init_debugfs()
268 ibd->fault->suppress_err = false; in hfi1_fault_init_debugfs()
269 bitmap_zero(ibd->fault->opcodes, in hfi1_fault_init_debugfs()
270 sizeof(ibd->fault->opcodes) * BITS_PER_BYTE); in hfi1_fault_init_debugfs()
272 ibd->fault->dir = in hfi1_fault_init_debugfs()
274 &ibd->fault->attr); in hfi1_fault_init_debugfs()
275 if (IS_ERR(ibd->fault->dir)) { in hfi1_fault_init_debugfs()
276 kfree(ibd->fault); in hfi1_fault_init_debugfs()
277 ibd->fault = NULL; in hfi1_fault_init_debugfs()
281 DEBUGFS_SEQ_FILE_CREATE(fault_stats, ibd->fault->dir, ibd); in hfi1_fault_init_debugfs()
282 if (!debugfs_create_bool("enable", 0600, ibd->fault->dir, in hfi1_fault_init_debugfs()
283 &ibd->fault->enable)) in hfi1_fault_init_debugfs()
286 ibd->fault->dir, in hfi1_fault_init_debugfs()
287 &ibd->fault->suppress_err)) in hfi1_fault_init_debugfs()
289 if (!debugfs_create_bool("opcode_mode", 0600, ibd->fault->dir, in hfi1_fault_init_debugfs()
290 &ibd->fault->opcode)) in hfi1_fault_init_debugfs()
292 if (!debugfs_create_file("opcodes", 0600, ibd->fault->dir, in hfi1_fault_init_debugfs()
293 ibd->fault, &__fault_opcodes_fops)) in hfi1_fault_init_debugfs()
296 ibd->fault->dir, in hfi1_fault_init_debugfs()
297 &ibd->fault->fault_skip)) in hfi1_fault_init_debugfs()
300 ibd->fault->dir, in hfi1_fault_init_debugfs()
301 &ibd->fault->fault_skip_usec)) in hfi1_fault_init_debugfs()
303 if (!debugfs_create_u8("direction", 0600, ibd->fault->dir, in hfi1_fault_init_debugfs()
304 &ibd->fault->direction)) in hfi1_fault_init_debugfs()
309 hfi1_fault_exit_debugfs(ibd); in hfi1_fault_init_debugfs()
313 bool hfi1_dbg_fault_suppress_err(struct hfi1_ibdev *ibd) in hfi1_dbg_fault_suppress_err() argument
315 if (ibd->fault) in hfi1_dbg_fault_suppress_err()
316 return ibd->fault->suppress_err; in hfi1_dbg_fault_suppress_err()
320 static bool __hfi1_should_fault(struct hfi1_ibdev *ibd, u32 opcode, in __hfi1_should_fault() argument
325 if (!ibd->fault || !ibd->fault->enable) in __hfi1_should_fault()
327 if (!(ibd->fault->direction & direction)) in __hfi1_should_fault()
329 if (ibd->fault->opcode) { in __hfi1_should_fault()
330 if (bitmap_empty(ibd->fault->opcodes, in __hfi1_should_fault()
331 (sizeof(ibd->fault->opcodes) * in __hfi1_should_fault()
334 if (!(test_bit(opcode, ibd->fault->opcodes))) in __hfi1_should_fault()
337 if (ibd->fault->fault_skip_usec && in __hfi1_should_fault()
338 time_before(jiffies, ibd->fault->skip_usec)) in __hfi1_should_fault()
340 if (ibd->fault->fault_skip && ibd->fault->skip) { in __hfi1_should_fault()
341 ibd->fault->skip--; in __hfi1_should_fault()
344 ret = should_fail(&ibd->fault->attr, 1); in __hfi1_should_fault()
346 ibd->fault->skip = ibd->fault->fault_skip; in __hfi1_should_fault()
347 ibd->fault->skip_usec = jiffies + in __hfi1_should_fault()
348 usecs_to_jiffies(ibd->fault->fault_skip_usec); in __hfi1_should_fault()
355 struct hfi1_ibdev *ibd = to_idev(qp->ibqp.device); in hfi1_dbg_should_fault_tx() local
357 if (__hfi1_should_fault(ibd, opcode, HFI1_FAULT_DIR_TX)) { in hfi1_dbg_should_fault_tx()
359 ibd->fault->n_txfaults[opcode]++; in hfi1_dbg_should_fault_tx()
367 struct hfi1_ibdev *ibd = &packet->rcd->dd->verbs_dev; in hfi1_dbg_should_fault_rx() local
369 if (__hfi1_should_fault(ibd, packet->opcode, HFI1_FAULT_DIR_RX)) { in hfi1_dbg_should_fault_rx()
371 ibd->fault->n_rxfaults[packet->opcode]++; in hfi1_dbg_should_fault_rx()