Lines Matching refs:fault
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()
96 struct fault *fault = file->private_data; in fault_opcodes_write() local
135 bitmap_zero(fault->opcodes, sizeof(fault->opcodes) * in fault_opcodes_write()
145 clear_bit(i, fault->opcodes); in fault_opcodes_write()
147 set_bit(i, fault->opcodes); in fault_opcodes_write()
166 struct fault *fault = file->private_data; in fault_opcodes_read() local
167 size_t bitsize = sizeof(fault->opcodes) * BITS_PER_BYTE; in fault_opcodes_read()
172 bit = find_first_bit(fault->opcodes, bitsize); in fault_opcodes_read()
174 zero = find_next_zero_bit(fault->opcodes, bitsize, bit); in fault_opcodes_read()
183 bit = find_next_bit(fault->opcodes, bitsize, zero); in fault_opcodes_read()
201 if (ibd->fault) in hfi1_fault_exit_debugfs()
202 debugfs_remove_recursive(ibd->fault->dir); in hfi1_fault_exit_debugfs()
203 kfree(ibd->fault); in hfi1_fault_exit_debugfs()
204 ibd->fault = NULL; in hfi1_fault_exit_debugfs()
212 ibd->fault = kzalloc(sizeof(*ibd->fault), GFP_KERNEL); in hfi1_fault_init_debugfs()
213 if (!ibd->fault) in hfi1_fault_init_debugfs()
216 ibd->fault->attr.interval = 1; in hfi1_fault_init_debugfs()
217 ibd->fault->attr.require_end = ULONG_MAX; in hfi1_fault_init_debugfs()
218 ibd->fault->attr.stacktrace_depth = 32; in hfi1_fault_init_debugfs()
219 ibd->fault->attr.dname = NULL; in hfi1_fault_init_debugfs()
220 ibd->fault->attr.verbose = 0; in hfi1_fault_init_debugfs()
221 ibd->fault->enable = false; in hfi1_fault_init_debugfs()
222 ibd->fault->opcode = false; in hfi1_fault_init_debugfs()
223 ibd->fault->fault_skip = 0; in hfi1_fault_init_debugfs()
224 ibd->fault->skip = 0; in hfi1_fault_init_debugfs()
225 ibd->fault->direction = HFI1_FAULT_DIR_TXRX; in hfi1_fault_init_debugfs()
226 ibd->fault->suppress_err = false; in hfi1_fault_init_debugfs()
227 bitmap_zero(ibd->fault->opcodes, in hfi1_fault_init_debugfs()
228 sizeof(ibd->fault->opcodes) * BITS_PER_BYTE); in hfi1_fault_init_debugfs()
231 fault_create_debugfs_attr("fault", parent, &ibd->fault->attr); in hfi1_fault_init_debugfs()
233 kfree(ibd->fault); in hfi1_fault_init_debugfs()
234 ibd->fault = NULL; in hfi1_fault_init_debugfs()
237 ibd->fault->dir = fault_dir; in hfi1_fault_init_debugfs()
241 debugfs_create_bool("enable", 0600, fault_dir, &ibd->fault->enable); in hfi1_fault_init_debugfs()
243 &ibd->fault->suppress_err); in hfi1_fault_init_debugfs()
245 &ibd->fault->opcode); in hfi1_fault_init_debugfs()
246 debugfs_create_file("opcodes", 0600, fault_dir, ibd->fault, in hfi1_fault_init_debugfs()
249 &ibd->fault->fault_skip); in hfi1_fault_init_debugfs()
251 &ibd->fault->fault_skip_usec); in hfi1_fault_init_debugfs()
252 debugfs_create_u8("direction", 0600, fault_dir, &ibd->fault->direction); in hfi1_fault_init_debugfs()
259 if (ibd->fault) in hfi1_dbg_fault_suppress_err()
260 return ibd->fault->suppress_err; in hfi1_dbg_fault_suppress_err()
269 if (!ibd->fault || !ibd->fault->enable) in __hfi1_should_fault()
271 if (!(ibd->fault->direction & direction)) in __hfi1_should_fault()
273 if (ibd->fault->opcode) { in __hfi1_should_fault()
274 if (bitmap_empty(ibd->fault->opcodes, in __hfi1_should_fault()
275 (sizeof(ibd->fault->opcodes) * in __hfi1_should_fault()
278 if (!(test_bit(opcode, ibd->fault->opcodes))) in __hfi1_should_fault()
281 if (ibd->fault->fault_skip_usec && in __hfi1_should_fault()
282 time_before(jiffies, ibd->fault->skip_usec)) in __hfi1_should_fault()
284 if (ibd->fault->fault_skip && ibd->fault->skip) { in __hfi1_should_fault()
285 ibd->fault->skip--; in __hfi1_should_fault()
288 ret = should_fail(&ibd->fault->attr, 1); in __hfi1_should_fault()
290 ibd->fault->skip = ibd->fault->fault_skip; in __hfi1_should_fault()
291 ibd->fault->skip_usec = jiffies + in __hfi1_should_fault()
292 usecs_to_jiffies(ibd->fault->fault_skip_usec); in __hfi1_should_fault()
303 ibd->fault->n_txfaults[opcode]++; in hfi1_dbg_should_fault_tx()
315 ibd->fault->n_rxfaults[packet->opcode]++; in hfi1_dbg_should_fault_rx()